diff --git a/BUILD.gn b/BUILD.gn index 6f098f0..5382f89 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/gr551x/BUILD.gn b/gr551x/BUILD.gn old mode 100755 new mode 100644 index 482a945..3be0699 --- a/gr551x/BUILD.gn +++ b/gr551x/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -11,37 +11,41 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//build/lite/config/component/lite_component.gni") -import("//build/lite/config/subsystem/lite_subsystem.gni") import("//kernel/liteos_m/liteos.gni") -copy("link-script") { - sources = [ "sdk_liteos/platform/startup/gr551x.ld" ] +action("resolve-link-script") { + script = "//build/lite/run_shell_cmd.py" + args = [ + "${compile_prefix}cpp${toolchain_cmd_suffix}", + "-include", + rebase_path("sdk_liteos/config/custom_config.h"), + "-E", + rebase_path("sdk_liteos/platform/linker/gr5515.ld.tmpl"), + "-o", + rebase_path("$root_build_dir/bin/link.ld"), + "-P", + ] outputs = [ "$root_build_dir/bin/link.ld" ] } copy("sdk_lib") { - sources = - [ "sdk_liteos/gr551x_sdk/components/sdk/linker/lib_gcc/libble_sdk.a" ] + sources = [ "sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/libble_sdk.a" ] outputs = [ "$root_build_dir/libs/libble_sdk.a" ] } copy("rom_symbol") { - sources = [ - "sdk_liteos/gr551x_sdk/components/patch/symbol_table/rom_symbol_gcc.txt", - ] + sources = + [ "sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/rom_symbol_gcc.txt" ] outputs = [ "$root_build_dir/libs/rom_symbol_gcc.txt" ] } -module_name = get_path_info(rebase_path("."), "name") -module_group(module_name) { +module_group("gr551x") { deps = [ - ":link-script", + ":resolve-link-script", ":rom_symbol", ":sdk_lib", - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static", - "//build/lite/config/component/cJSON:cjson_static", ] + modules = [ "sdk_liteos", "components", diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c index 004c3e3..6acc7f0 100755 --- a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c +++ b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_gpio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,7 +17,8 @@ #include "iot_gpio.h" #include "app_io.h" #include "app_gpiote.h" -#include "stdbool.h" +#include +#include /* ID 0~31 Normal GPIO */ @@ -118,7 +119,7 @@ static int get_pin_index(uint32_t pin) return index; } -static void app_io_callback(app_gpiote_evt_t *p_evt) +static void app_io_callback(app_io_evt_t *p_evt) { uint32_t index = 0; @@ -160,7 +161,7 @@ unsigned int IoTGpioSetDir(unsigned int id, IotGpioDir dir) if (dir == IOT_GPIO_DIR_IN) { io_init.mode = APP_IO_MODE_INPUT; } else if (dir == IOT_GPIO_DIR_OUT) { - io_init.mode = APP_IO_MODE_OUT_PUT; + io_init.mode = APP_IO_MODE_OUTPUT; } g_gpio_dir[id] = dir; @@ -244,7 +245,6 @@ unsigned int IoTGpioRegisterIsrFunc(unsigned int id, IotGpioIntType intType, Iot gpiote_param.type = io_type; gpiote_param.pin = pin; gpiote_param.pull = APP_IO_PULLUP; - gpiote_param.handle_mode = APP_IO_ENABLE_WAKEUP; if (intType == IOT_INT_TYPE_LEVEL) { if (intPolarity == IOT_GPIO_EDGE_FALL_LEVEL_LOW) { isr_cfg_info[id].mode = APP_IO_MODE_IT_LOW; @@ -293,7 +293,6 @@ unsigned int IoTGpioUnregisterIsrFunc(unsigned int id) gpiote_param.pin = pin; gpiote_param.mode = isr_cfg_info[id].mode; gpiote_param.pull = APP_IO_PULLUP; - gpiote_param.handle_mode = APP_IO_ENABLE_WAKEUP; gpiote_param.io_evt_cb = NULL; if (isr_cfg_info[id].initialized == false) { @@ -330,7 +329,6 @@ unsigned int IoTGpioSetIsrMode(unsigned int id, IotGpioIntType intType, IotGpioI gpiote_param.type = io_type; gpiote_param.pin = pin; gpiote_param.pull = APP_IO_PULLUP; - gpiote_param.handle_mode = APP_IO_ENABLE_WAKEUP; gpiote_param.io_evt_cb = app_io_callback; if (intType == IOT_INT_TYPE_LEVEL) { diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c index 18b758e..f8885cb 100755 --- a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c +++ b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_i2c.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,72 +20,100 @@ /* I2C0 config params */ /* SCL : GPIO30 */ -#define USER_I2C0_SCL_PIN APP_IO_PIN_30 -#define USER_I2C0_SCL_PIN_TYPE APP_IO_TYPE_NORMAL -#define USER_I2C0_SCL_PIN_MUX APP_IO_MUX_2 -#define USER_I2C0_SCL_PIN_PULL APP_IO_PULLUP +#define USER_I2C0_SCL_PIN APP_IO_PIN_30 +#define USER_I2C0_SCL_PIN_TYPE APP_IO_TYPE_NORMAL +#define USER_I2C0_SCL_PIN_MUX APP_IO_MUX_2 +#define USER_I2C0_SCL_PIN_PULL APP_IO_PULLUP /* SDA : GPIO26 */ -#define USER_I2C0_SDA_PIN APP_IO_PIN_26 -#define USER_I2C0_SDA_PIN_TYPE APP_IO_TYPE_NORMAL -#define USER_I2C0_SDA_PIN_MUX APP_IO_MUX_2 -#define USER_I2C0_SDA_PIN_PULL APP_IO_PULLUP -#define USER_I2C0_SPEED I2C_SPEED_400K -#define I2C0_IO_CONFIG {{USER_I2C0_SCL_PIN_TYPE, USER_I2C0_SCL_PIN_MUX, USER_I2C0_SCL_PIN, USER_I2C0_SCL_PIN_PULL}, \ - {USER_I2C0_SDA_PIN_TYPE, USER_I2C0_SDA_PIN_MUX, USER_I2C0_SDA_PIN, USER_I2C0_SDA_PIN_PULL}} -#define I2C0_MODE_CONFIG {APP_I2C_TYPE_INTERRUPT, DMA_Channel0, DMA_Channel0} -#define I2C0_I2C_CONFIG {USER_I2C0_SPEED, 0x00, I2C_ADDRESSINGMODE_7BIT, I2C_GENERALCALL_DISABLE} -#define I2C0_PARAM_CONFIG {APP_I2C_ID_0, APP_I2C_ROLE_MASTER, I2C0_IO_CONFIG, I2C0_MODE_CONFIG, I2C0_I2C_CONFIG} +#define USER_I2C0_SDA_PIN APP_IO_PIN_26 +#define USER_I2C0_SDA_PIN_TYPE APP_IO_TYPE_NORMAL +#define USER_I2C0_SDA_PIN_MUX APP_IO_MUX_2 +#define USER_I2C0_SDA_PIN_PULL APP_IO_PULLUP +#define USER_I2C0_SPEED I2C_SPEED_400K + +#define I2C0_IO_CONFIG \ + { \ + {USER_I2C0_SCL_PIN_TYPE, USER_I2C0_SCL_PIN_MUX, USER_I2C0_SCL_PIN, USER_I2C0_SCL_PIN_PULL}, \ + {USER_I2C0_SDA_PIN_TYPE, USER_I2C0_SDA_PIN_MUX, USER_I2C0_SDA_PIN, USER_I2C0_SDA_PIN_PULL}, \ + } + +#define I2C0_DMA_CONFIG \ + { \ + DMA0, DMA0, DMA_Channel2, DMA_Channel3 \ + } + +#define I2C0_I2C_CONFIG \ + { \ + USER_I2C0_SPEED, 0x00, I2C_ADDRESSINGMODE_7BIT, I2C_GENERALCALL_DISABLE \ + } + +#define I2C0_PARAM_CONFIG \ + { \ + APP_I2C_ID_0, APP_I2C_ROLE_MASTER, I2C0_IO_CONFIG, I2C0_DMA_CONFIG, I2C0_I2C_CONFIG \ + } /* I2C1 config params */ /* SCL : GPIO8 */ -#define USER_I2C1_SCL_PIN APP_IO_PIN_8 -#define USER_I2C1_SCL_PIN_TYPE APP_IO_TYPE_NORMAL -#define USER_I2C1_SCL_PIN_MUX APP_IO_MUX_1 -#define USER_I2C1_SCL_PIN_PULL APP_IO_PULLUP +#define USER_I2C1_SCL_PIN APP_IO_PIN_8 +#define USER_I2C1_SCL_PIN_TYPE APP_IO_TYPE_NORMAL +#define USER_I2C1_SCL_PIN_MUX APP_IO_MUX_1 +#define USER_I2C1_SCL_PIN_PULL APP_IO_PULLUP /* SDA : GPIO9 */ -#define USER_I2C1_SDA_PIN APP_IO_PIN_9 -#define USER_I2C1_SDA_PIN_TYPE APP_IO_TYPE_NORMAL -#define USER_I2C1_SDA_PIN_MUX APP_IO_MUX_1 -#define USER_I2C1_SDA_PIN_PULL APP_IO_PULLUP -#define USER_I2C1_SPEED I2C_SPEED_400K +#define USER_I2C1_SDA_PIN APP_IO_PIN_9 +#define USER_I2C1_SDA_PIN_TYPE APP_IO_TYPE_NORMAL +#define USER_I2C1_SDA_PIN_MUX APP_IO_MUX_1 +#define USER_I2C1_SDA_PIN_PULL APP_IO_PULLUP +#define USER_I2C1_SPEED I2C_SPEED_400K -#define I2C1_IO_CONFIG {{USER_I2C1_SCL_PIN_TYPE, USER_I2C1_SCL_PIN_MUX, USER_I2C1_SCL_PIN, USER_I2C1_SCL_PIN_PULL}, \ - {USER_I2C1_SDA_PIN_TYPE, USER_I2C1_SDA_PIN_MUX, USER_I2C1_SDA_PIN, USER_I2C1_SDA_PIN_PULL}} -#define I2C1_MODE_CONFIG {APP_I2C_TYPE_INTERRUPT, DMA_Channel0, DMA_Channel0} -#define I2C1_I2C_CONFIG {USER_I2C1_SPEED, 0x00, I2C_ADDRESSINGMODE_7BIT, I2C_GENERALCALL_DISABLE} -#define I2C1_PARAM_CONFIG {APP_I2C_ID_1, APP_I2C_ROLE_MASTER, I2C1_IO_CONFIG, I2C1_MODE_CONFIG, I2C1_I2C_CONFIG} -#define I2C_SYNC_TIMEOUT 20 +#define I2C1_IO_CONFIG \ + { \ + {USER_I2C1_SCL_PIN_TYPE, USER_I2C1_SCL_PIN_MUX, USER_I2C1_SCL_PIN, USER_I2C1_SCL_PIN_PULL}, \ + {USER_I2C1_SDA_PIN_TYPE, USER_I2C1_SDA_PIN_MUX, USER_I2C1_SDA_PIN, USER_I2C1_SDA_PIN_PULL}, \ + } -#define I2C_BAUDRATE_100K 100 -#define I2C_BAUDRATE_400K 400 -#define I2C_BAUDRATE_1000K 1000 -#define I2C_BAUDRATE_2000K 2000 +#define I2C2_DMA_CONFIG \ + { \ + DMA0, DMA_Channel4, DMA_Channel5 \ + } -static const app_i2c_params_t i2c_cfg_params[APP_I2C_ID_MAX] = { - I2C0_PARAM_CONFIG, - I2C1_PARAM_CONFIG -}; -static uint32_t i2c_tx_mutex[APP_I2C_ID_MAX]; -static uint32_t i2c_rx_mutex[APP_I2C_ID_MAX]; +#define I2C1_I2C_CONFIG \ + { \ + USER_I2C1_SPEED, 0x00, I2C_ADDRESSINGMODE_7BIT, I2C_GENERALCALL_DISABLE \ + } + +#define I2C1_PARAM_CONFIG \ + { \ + APP_I2C_ID_1, APP_I2C_ROLE_MASTER, I2C1_IO_CONFIG, I2C2_DMA_CONFIG, I2C1_I2C_CONFIG \ + } + +#define I2C_SYNC_TIMEOUT 20 + +#define I2C_BAUDRATE_100K 100 +#define I2C_BAUDRATE_400K 400 +#define I2C_BAUDRATE_1000K 1000 +#define I2C_BAUDRATE_2000K 2000 + +static app_i2c_params_t s_i2c_params[APP_I2C_ID_MAX] = {I2C0_PARAM_CONFIG, I2C1_PARAM_CONFIG}; +static uint32_t s_i2c_tx_mutex[APP_I2C_ID_MAX]; +static uint32_t s_i2c_rx_mutex[APP_I2C_ID_MAX]; unsigned int IoTI2cWrite(unsigned int id, unsigned short deviceAddr, const unsigned char *data, unsigned int dataLen) { int ret = 0; - if (id > APP_I2C_ID_MAX) { + if (id >= APP_I2C_ID_MAX) { return IOT_FAILURE; } - LOS_MuxPend(i2c_tx_mutex[id], LOS_WAIT_FOREVER); + LOS_MuxPend(s_i2c_tx_mutex[id], LOS_WAIT_FOREVER); ret = app_i2c_transmit_sync(id, deviceAddr, data, dataLen, I2C_SYNC_TIMEOUT); if (ret != 0) { - printf("ret=%d\r\n", ret); - LOS_MuxPost(i2c_tx_mutex[id]); + LOS_MuxPost(s_i2c_tx_mutex[id]); return IOT_FAILURE; } - LOS_MuxPost(i2c_tx_mutex[id]); + LOS_MuxPost(s_i2c_tx_mutex[id]); return IOT_SUCCESS; } @@ -94,13 +122,13 @@ unsigned int IoTI2cRead(unsigned int id, unsigned short deviceAddr, unsigned cha { int ret = 0; - LOS_MuxPend(i2c_rx_mutex[id], LOS_WAIT_FOREVER); + LOS_MuxPend(s_i2c_rx_mutex[id], LOS_WAIT_FOREVER); ret = app_i2c_receive_sync(id, deviceAddr, data, dataLen, I2C_SYNC_TIMEOUT); if (ret != 0) { - LOS_MuxPost(i2c_rx_mutex[id]); + LOS_MuxPost(s_i2c_rx_mutex[id]); return IOT_FAILURE; } - LOS_MuxPost(i2c_rx_mutex[id]); + LOS_MuxPost(s_i2c_rx_mutex[id]); return IOT_SUCCESS; } @@ -108,39 +136,37 @@ unsigned int IoTI2cRead(unsigned int id, unsigned short deviceAddr, unsigned cha unsigned int IoTI2cInit(unsigned int id, unsigned int baudrate) { int ret = 0; - app_i2c_params_t i2c_params; uint32_t uwRet; - if (id > APP_I2C_ID_MAX) { + if (id >= APP_I2C_ID_MAX) { return IOT_FAILURE; } - memcpy_s(&i2c_params, sizeof(app_i2c_params_t), &i2c_cfg_params[id], sizeof(app_i2c_params_t)); if (baudrate == I2C_BAUDRATE_100K) { - i2c_params.init.speed = I2C_SPEED_100K; + s_i2c_params[id].init.speed = I2C_SPEED_100K; } else if (baudrate == I2C_BAUDRATE_400K) { - i2c_params.init.speed = I2C_SPEED_400K; - } else if (baudrate == I2C_BAUDRATE_1000K) { - i2c_params.init.speed = I2C_SPEED_1000K; + s_i2c_params[id].init.speed = I2C_SPEED_400K; + } else if (baudrate == I2C_BAUDRATE_1000K) { + s_i2c_params[id].init.speed = I2C_SPEED_1000K; } else if (baudrate == I2C_BAUDRATE_2000K) { - i2c_params.init.speed = I2C_SPEED_2000K; + s_i2c_params[id].init.speed = I2C_SPEED_2000K; } else { return IOT_FAILURE; } - ret = app_i2c_init(&i2c_params, NULL); + ret = app_i2c_init(&s_i2c_params[id], NULL); if (ret != 0) { return IOT_FAILURE; } - uwRet = LOS_MuxCreate(&i2c_tx_mutex[id]); + uwRet = LOS_MuxCreate(&s_i2c_tx_mutex[id]); if (uwRet != LOS_OK) { return IOT_FAILURE; } - uwRet = LOS_MuxCreate(&i2c_rx_mutex[id]); + uwRet = LOS_MuxCreate(&s_i2c_rx_mutex[id]); if (uwRet != LOS_OK) { - LOS_SemDelete(i2c_tx_mutex[id]); + LOS_SemDelete(s_i2c_tx_mutex[id]); return IOT_FAILURE; } @@ -149,13 +175,13 @@ unsigned int IoTI2cInit(unsigned int id, unsigned int baudrate) unsigned int IoTI2cDeinit(unsigned int id) { - if (id > APP_I2C_ID_MAX) { + if (id >= APP_I2C_ID_MAX) { return IOT_FAILURE; } app_i2c_deinit(id); - LOS_SemDelete(i2c_tx_mutex[id]); - LOS_SemDelete(i2c_rx_mutex[id]); + LOS_SemDelete(s_i2c_tx_mutex[id]); + LOS_SemDelete(s_i2c_rx_mutex[id]); return IOT_SUCCESS; } @@ -163,27 +189,25 @@ unsigned int IoTI2cDeinit(unsigned int id) unsigned int IoTI2cSetBaudrate(unsigned int id, unsigned int baudrate) { int ret = 0; - app_i2c_params_t i2c_params; - if (id > APP_I2C_ID_MAX) { + if (id >= APP_I2C_ID_MAX) { return IOT_FAILURE; } - memcpy_s(&i2c_params, sizeof(app_i2c_params_t), &i2c_cfg_params[id], sizeof(app_i2c_params_t)); if (baudrate == I2C_BAUDRATE_100K) { - i2c_params.init.speed = I2C_SPEED_100K; + s_i2c_params[id].init.speed = I2C_SPEED_100K; } else if (baudrate == I2C_BAUDRATE_400K) { - i2c_params.init.speed = I2C_SPEED_400K; - } else if (baudrate == I2C_BAUDRATE_1000K) { - i2c_params.init.speed = I2C_SPEED_1000K; + s_i2c_params[id].init.speed = I2C_SPEED_400K; + } else if (baudrate == I2C_BAUDRATE_1000K) { + s_i2c_params[id].init.speed = I2C_SPEED_1000K; } else if (baudrate == I2C_BAUDRATE_2000K) { - i2c_params.init.speed = I2C_SPEED_2000K; + s_i2c_params[id].init.speed = I2C_SPEED_2000K; } else { return IOT_FAILURE; } app_i2c_deinit(id); - ret = app_i2c_init(&i2c_params, NULL); + ret = app_i2c_init(&s_i2c_params[id], NULL); if (ret != 0) { return IOT_FAILURE; } diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c index 17d8ca8..888d005 100755 --- a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c +++ b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_pwm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,28 +17,110 @@ #include "iot_pwm.h" #include "app_pwm.h" -#define PWM_IO_CONFIG {{ APP_IO_TYPE_MSIO, APP_IO_MUX_0, APP_IO_PIN_0, APP_IO_NOPULL, APP_PWM_PIN_ENABLE }, \ - { APP_IO_TYPE_MSIO, APP_IO_MUX_0, APP_IO_PIN_1, APP_IO_NOPULL, APP_PWM_PIN_ENABLE }, \ - { APP_IO_TYPE_MSIO, APP_IO_MUX_0, APP_IO_PIN_2, APP_IO_NOPULL, APP_PWM_PIN_ENABLE }} +// APP_PWM_ID_0 +#define USER_PWM0_CHANNEL_A_PIN APP_IO_PIN_0 +#define USER_PWM0_CHANNEL_A_PIN_TYPE APP_IO_TYPE_MSIO +#define USER_PWM0_CHANNEL_A_PIN_MUX APP_IO_MUX_0 +#define USER_PWM0_CHANNEL_A_PIN_PULL APP_IO_NOPULL -#define PWM_ACTIVE_CAHN APP_PWM_ACTIVE_CHANNEL_ALL -#define PWM_CONFIG { PWM_MODE_FLICKER, PWM_ALIGNED_EDGE, 10, 500, 200, \ - { 50, PWM_DRIVEPOLARITY_POSITIVE }, \ - { 50, PWM_DRIVEPOLARITY_POSITIVE }, \ - { 50, PWM_DRIVEPOLARITY_POSITIVE }} -#define PWM_PARAM_CONFIG {0, PWM_IO_CONFIG, PWM_ACTIVE_CAHN, PWM_CONFIG } +#define USER_PWM0_CHANNEL_B_PIN APP_IO_PIN_1 +#define USER_PWM0_CHANNEL_B_PIN_TYPE APP_IO_TYPE_MSIO +#define USER_PWM0_CHANNEL_B_PIN_MUX APP_IO_MUX_0 +#define USER_PWM0_CHANNEL_B_PIN_PULL APP_IO_NOPULL + +#define USER_PWM0_CHANNEL_C_PIN APP_IO_PIN_2 +#define USER_PWM0_CHANNEL_C_PIN_TYPE APP_IO_TYPE_MSIO +#define USER_PWM0_CHANNEL_C_PIN_MUX APP_IO_MUX_0 +#define USER_PWM0_CHANNEL_C_PIN_PULL APP_IO_NOPULL + +#define PWM0_IO_CONFIG \ +{ \ + {USER_PWM0_CHANNEL_A_PIN_TYPE, USER_PWM0_CHANNEL_A_PIN_MUX, USER_PWM0_CHANNEL_A_PIN, USER_PWM0_CHANNEL_A_PIN_PULL, APP_PWM_PIN_ENABLE}, \ + {USER_PWM0_CHANNEL_B_PIN_TYPE, USER_PWM0_CHANNEL_B_PIN_MUX, USER_PWM0_CHANNEL_B_PIN, USER_PWM0_CHANNEL_B_PIN_PULL, APP_PWM_PIN_ENABLE}, \ + {USER_PWM0_CHANNEL_C_PIN_TYPE, USER_PWM0_CHANNEL_C_PIN_MUX, USER_PWM0_CHANNEL_C_PIN, USER_PWM0_CHANNEL_C_PIN_PULL, APP_PWM_PIN_ENABLE}, \ +} + +#define PWM0_ACTIVE_CHANNEL APP_PWM_ACTIVE_CHANNEL_ALL + +#define PWM0_PWM_CHANNEL_A_CONFIG \ + { \ + 50, PWM_DRIVEPOLARITY_POSITIVE \ + } + +#define PWM0_PWM_CHANNEL_B_CONFIG \ + { \ + 50, PWM_DRIVEPOLARITY_POSITIVE \ + } + +#define PWM0_PWM_CHANNEL_C_CONFIG \ + { \ + 50, PWM_DRIVEPOLARITY_POSITIVE \ + } + +#define PWM0_PWM_CONFIG \ + { \ + PWM_MODE_FLICKER, PWM_ALIGNED_EDGE, 10, 500, 200, PWM0_PWM_CHANNEL_A_CONFIG, PWM0_PWM_CHANNEL_B_CONFIG, PWM0_PWM_CHANNEL_C_CONFIG, \ + } + +#define PWM0_PARAM_CONFIG \ + { \ + APP_PWM_ID_0, PWM0_IO_CONFIG, PWM0_ACTIVE_CHANNEL, PWM0_PWM_CONFIG \ + } + +// APP_PWM_ID_1 +#define USER_PWM1_CHANNEL_A_PIN APP_IO_PIN_3 +#define USER_PWM1_CHANNEL_A_PIN_TYPE APP_IO_TYPE_MSIO +#define USER_PWM1_CHANNEL_A_PIN_MUX APP_IO_MUX_0 +#define USER_PWM1_CHANNEL_A_PIN_PULL APP_IO_NOPULL + +#define USER_PWM1_CHANNEL_B_PIN APP_IO_PIN_4 +#define USER_PWM1_CHANNEL_B_PIN_TYPE APP_IO_TYPE_MSIO +#define USER_PWM1_CHANNEL_B_PIN_MUX APP_IO_MUX_0 +#define USER_PWM1_CHANNEL_B_PIN_PULL APP_IO_NOPULL + +#define PWM1_IO_CONFIG \ +{ \ + {USER_PWM1_CHANNEL_A_PIN_TYPE, USER_PWM1_CHANNEL_A_PIN_MUX, USER_PWM1_CHANNEL_A_PIN, USER_PWM1_CHANNEL_A_PIN_PULL, APP_PWM_PIN_ENABLE}, \ + {USER_PWM1_CHANNEL_B_PIN_TYPE, USER_PWM1_CHANNEL_B_PIN_MUX, USER_PWM1_CHANNEL_B_PIN, USER_PWM1_CHANNEL_B_PIN_PULL, APP_PWM_PIN_ENABLE}, \ + {0}, \ +} + +#define PWM1_ACTIVE_CHANNEL (APP_PWM_ACTIVE_CHANNEL_A | APP_PWM_ACTIVE_CHANNEL_B) + +#define PWM1_PWM_CHANNEL_A_CONFIG \ + { \ + 50, PWM_DRIVEPOLARITY_POSITIVE \ + } + +#define PWM1_PWM_CHANNEL_B_CONFIG \ + { \ + 50, PWM_DRIVEPOLARITY_POSITIVE \ + } + +#define PWM1_PWM_CONFIG \ + { \ + PWM_MODE_FLICKER, PWM_ALIGNED_EDGE, 10, 500, 200, PWM1_PWM_CHANNEL_A_CONFIG, PWM1_PWM_CHANNEL_B_CONFIG, {0}, \ + } + +#define PWM1_PARAM_CONFIG \ + { \ + APP_PWM_ID_1, PWM1_IO_CONFIG, PWM1_ACTIVE_CHANNEL, PWM1_PWM_CONFIG \ + } + +static app_pwm_params_t s_pwm_params[APP_PWM_ID_MAX] = { + PWM0_PARAM_CONFIG, + PWM1_PARAM_CONFIG, +}; unsigned int IoTPwmInit(unsigned int port) { uint16_t ret = APP_DRV_SUCCESS; - app_pwm_params_t pwm_params = PWM_PARAM_CONFIG; - if (port > APP_PWM_ID_MAX) { + if (port >= APP_PWM_ID_MAX) { return IOT_FAILURE; } - pwm_params.id = port; - ret = app_pwm_init(&pwm_params); + ret = app_pwm_init(&s_pwm_params[port]); if (ret != APP_DRV_SUCCESS) { return IOT_FAILURE; } @@ -49,7 +131,7 @@ unsigned int IoTPwmDeinit(unsigned int port) { int ret = 0; - if (port > APP_PWM_ID_MAX) { + if (port >= APP_PWM_ID_MAX) { return IOT_FAILURE; } @@ -63,10 +145,9 @@ unsigned int IoTPwmDeinit(unsigned int port) unsigned int IoTPwmStart(unsigned int port, unsigned short duty, unsigned int freq) { - app_pwm_params_t pwm_params = PWM_PARAM_CONFIG; app_pwm_channel_init_t channel_cfg = {0}; - if (port > APP_PWM_ID_MAX) { + if (port >= APP_PWM_ID_MAX) { return IOT_FAILURE; } @@ -81,7 +162,7 @@ unsigned int IoTPwmStart(unsigned int port, unsigned short duty, unsigned int fr unsigned int IoTPwmStop(unsigned int port) { - if (port > APP_PWM_ID_MAX) { + if (port >= APP_PWM_ID_MAX) { return IOT_FAILURE; } diff --git a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c index e12ab6c..41b1f92 100755 --- a/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c +++ b/gr551x/adapter/hals/iot_hardware/wifiiot_lite/hal_iot_uart.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -16,6 +16,7 @@ #include "iot_errno.h" #include "iot_uart.h" #include "app_uart.h" +#include "app_uart_dma.h" #include "app_io.h" #include "los_sem.h" @@ -43,8 +44,9 @@ static app_uart_params_t uart_param[APP_UART_ID_MAX] = { .pull = APP_IO_PULLUP, } }, - .use_mode = { - .type = APP_UART_TYPE_DMA, + .dma_cfg = { + .tx_dma_instance = DMA0, + .rx_dma_instance = DMA0, .tx_dma_channel = DMA_Channel0, .rx_dma_channel = DMA_Channel1, } @@ -67,9 +69,6 @@ static app_uart_params_t uart_param[APP_UART_ID_MAX] = { .pull = APP_IO_PULLUP, } }, - .use_mode = { - .type = APP_UART_TYPE_INTERRUPT, /* UART1 only supports interrupt mode */ - } }, }; @@ -78,7 +77,7 @@ static uint32_t uart_tx_mutex[APP_UART_ID_MAX]; static uint32_t uart_rx_mutex[APP_UART_ID_MAX]; static uint32_t g_rx_num[APP_UART_ID_MAX]; -static const app_uart_evt_handler_t *evt_handler[APP_UART_ID_MAX] = { +static const app_uart_evt_handler_t evt_handler[APP_UART_ID_MAX] = { app_uart0_callback, app_uart1_callback }; @@ -105,6 +104,10 @@ static void app_uart1_callback(app_uart_evt_t *p_evt) struct app_uart_params_t* uart_cfg(unsigned int id, const IotUartAttribute *param) { + if (id >= APP_UART_ID_MAX) { + return IOT_FAILURE; + } + app_uart_params_t *params = &uart_param[id]; params->init.baud_rate = param->baudRate; params->init.rx_timeout_mode = UART_RECEIVER_TIMEOUT_ENABLE; @@ -159,6 +162,7 @@ unsigned int IoTUartInit(unsigned int id, const IotUartAttribute *param) if (id >= APP_UART_ID_MAX) { return IOT_FAILURE; } + params = uart_cfg(id, param); ret = app_uart_init(params, evt_handler[id], &uart_buffer); @@ -166,6 +170,14 @@ unsigned int IoTUartInit(unsigned int id, const IotUartAttribute *param) return IOT_FAILURE; } + if (id == APP_UART_ID_0) { + // Only UART0 support DMA + ret = app_uart_dma_init(params); + if (ret != 0) { + return IOT_FAILURE; + } + } + uwRet = LOS_BinarySemCreate(0, &uart_rx_sem[id]); if (uwRet != LOS_OK) { return IOT_FAILURE; @@ -192,11 +204,19 @@ int IoTUartRead(unsigned int id, unsigned char *data, unsigned int dataLen) int ret = 0; uint32_t uwRet = 0; + if (id >= APP_UART_ID_MAX) { + return IOT_FAILURE; + } + LOS_MuxPend(uart_rx_mutex[id], LOS_WAIT_FOREVER); g_rx_num[id] = 0; LOS_SemPend(uart_rx_sem[id], 0); - ret = app_uart_receive_async(id, data, dataLen); + if (id == APP_UART_ID_0) { + ret = app_uart_dma_receive_async(id, data, dataLen); + } else { + ret = app_uart_receive_async(id, data, dataLen); + } if (ret != 0) { LOS_MuxPost(uart_rx_mutex[id]); return IOT_FAILURE; @@ -217,6 +237,10 @@ int IoTUartWrite(unsigned int id, const unsigned char *data, unsigned int dataLe { int ret = 0; + if (id >= APP_UART_ID_MAX) { + return IOT_FAILURE; + } + LOS_MuxPend(uart_tx_mutex[id], LOS_WAIT_FOREVER); ret = app_uart_transmit_sync(id, data, dataLen, UART_TIMEOUT); if (ret != 0) { @@ -230,6 +254,10 @@ int IoTUartWrite(unsigned int id, const unsigned char *data, unsigned int dataLe unsigned int IoTUartDeinit(unsigned int id) { + if (id >= APP_UART_ID_MAX) { + return IOT_FAILURE; + } + app_uart_deinit(id); LOS_SemDelete(uart_rx_sem[id]); LOS_SemDelete(uart_tx_mutex[id]); diff --git a/gr551x/components/fs/BUILD.gn b/gr551x/components/fs/BUILD.gn index 3d26e89..722609f 100755 --- a/gr551x/components/fs/BUILD.gn +++ b/gr551x/components/fs/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -19,6 +19,4 @@ config("public") { hdf_driver("fs_adapter") { sources = [ "fs_init.c" ] - - deps = [ "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_static" ] } diff --git a/gr551x/gr551x_executable.gni b/gr551x/gr551x_executable.gni new file mode 100644 index 0000000..62fbcca --- /dev/null +++ b/gr551x/gr551x_executable.gni @@ -0,0 +1,86 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +template("gr551x_executable") { + executable("${target_name}.elf") { + forward_variables_from(invoker, + "*", + [ + "force_link_libs", + "gen_asm", + ]) + + if (defined(ldflags)) { + ldflags += [ "-Wl,--whole-archive" ] + } else { + ldflags = [ "-Wl,--whole-archive" ] + } + foreach(force_link_lib, invoker.force_link_libs) { + ldflags += [ "-l${force_link_lib}" ] + } + ldflags += [ "-Wl,--no-whole-archive" ] + } + + action("${target_name}.bin") { + script = "//build/lite/run_shell_cmd.py" + args = [ + "${compile_prefix}objcopy${toolchain_cmd_suffix}", + "-O", + "binary", + rebase_path("${root_build_dir}/bin/${invoker.target_name}.elf"), + rebase_path("${root_build_dir}/bin/${invoker.target_name}.bin"), + ] + outputs = [ "${root_build_dir}/bin/${invoker.target_name}.bin" ] + deps = [ ":${invoker.target_name}.elf" ] + } + + action("${target_name}.hex") { + script = "//build/lite/run_shell_cmd.py" + args = [ + "${compile_prefix}objcopy${toolchain_cmd_suffix}", + "-O", + "ihex", + rebase_path("${root_build_dir}/bin/${invoker.target_name}.elf"), + rebase_path("${root_build_dir}/bin/${invoker.target_name}.hex"), + ] + outputs = [ "${root_build_dir}/bin/${invoker.target_name}.hex" ] + deps = [ ":${invoker.target_name}.elf" ] + } + + if (defined(invoker.gen_asm) && invoker.gen_asm) { + action("${target_name}.asm") { + script = "//build/lite/run_shell_cmd.py" + args = [ + "${compile_prefix}objdump${toolchain_cmd_suffix}", + "-D", + rebase_path( + "${root_build_dir}/unstripped/bin/${invoker.target_name}.elf"), + ">", + rebase_path("${root_build_dir}/bin/${invoker.target_name}.asm"), + ] + outputs = [ "${root_build_dir}/bin/${invoker.target_name}.asm" ] + deps = [ ":${invoker.target_name}.elf" ] + } + } + + group("${target_name}") { + deps = [ + ":${target_name}.bin", + ":${target_name}.hex", + ] + + if (defined(invoker.gen_asm) && invoker.gen_asm) { + deps += [ ":${target_name}.asm" ] + } + } +} diff --git a/gr551x/hcs/gpio/gpio_config.hcs b/gr551x/hcs/gpio/gpio_config.hcs index 50511cd..6064806 100755 --- a/gr551x/hcs/gpio/gpio_config.hcs +++ b/gr551x/hcs/gpio/gpio_config.hcs @@ -5,7 +5,6 @@ root { configNum = 1; gpioIndex = [0]; pull = [0]; - handleMode = [0]; } } } diff --git a/gr551x/sdk_liteos/BUILD.gn b/gr551x/sdk_liteos/BUILD.gn old mode 100755 new mode 100644 index 952af47..66a8c5c --- a/gr551x/sdk_liteos/BUILD.gn +++ b/gr551x/sdk_liteos/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -13,12 +13,12 @@ import("//kernel/liteos_m/liteos.gni") -module_name = get_path_info(rebase_path("."), "name") -module_group(module_name) { +module_group("sdk_liteos") { modules = [ - "platform", + "config", "gr551x_sdk", "liteos_m", - "config", + "platform/main", + "platform/system", ] } diff --git a/gr551x/sdk_liteos/config/BUILD.gn b/gr551x/sdk_liteos/config/BUILD.gn old mode 100755 new mode 100644 index f0346dd..60dc829 --- a/gr551x/sdk_liteos/config/BUILD.gn +++ b/gr551x/sdk_liteos/config/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -17,6 +17,5 @@ config("public") { include_dirs = [ "." ] } -module_name = get_path_info(rebase_path("."), "name") -kernel_module(module_name) { +kernel_module("config") { } diff --git a/gr551x/sdk_liteos/config/custom_config.h b/gr551x/sdk_liteos/config/custom_config.h old mode 100755 new mode 100644 index 64cc69e..1973a7d --- a/gr551x/sdk_liteos/config/custom_config.h +++ b/gr551x/sdk_liteos/config/custom_config.h @@ -47,48 +47,74 @@ // Basic configuration // Chip version -#define GR5515_D +#define SOC_GR5515 // Select chip type -// <0=> GR5515 -// <1=> GR5513 +// <0=> GR5515IGND +// <1=> GR5515IENDU +// <2=> GR5515I0ND +// <3=> GR5515I0NDA +// <4=> GR5515RGBD +// <5=> GR5515GGBD +// <6=> GR5513BEND +// <7=> GR5513BENDU #ifndef CHIP_TYPE -#define CHIP_TYPE 0 +#define CHIP_TYPE 4 #endif +// Platform support sleep function +// <0=> not support +// <1=> support +#ifndef PLAT_SUPPORT_SLEEP +#define PLAT_SUPPORT_SLEEP 1 +#endif + +// Platform support ble function +// <0=> not support +// <1=> support +#ifndef PLAT_SUPPORT_BLE +#define PLAT_SUPPORT_BLE 1 +#endif // Enable encrypt chip // <0=> DISABLE // <1=> ENABLE #ifndef ENCRYPT_ENABLE -#define ENCRYPT_ENABLE 1 +#define ENCRYPT_ENABLE 0 #endif // Enable the external flash of chip // <0=> DISABLE // <1=> ENABLE #ifndef EXT_EXFLASH_ENABLE -#define EXT_EXFLASH_ENABLE 0 +#define EXT_EXFLASH_ENABLE 0 +#endif + +// Enable the platform initialization process +// <0=> DISABLE +// <1=> ENABLE +#ifndef PLATFORM_INIT_ENABLE +#define PLATFORM_INIT_ENABLE 1 #endif // Enable system fault trace module // <0=> DISABLE // <1=> ENABLE #ifndef SYS_FAULT_TRACE_ENABLE -#define SYS_FAULT_TRACE_ENABLE 1 +#define SYS_FAULT_TRACE_ENABLE 1 #endif // Enable APP driver module // <0=> DISABLE // <1=> ENABLE #ifndef APP_DRIVER_USE_ENABLE -#define APP_DRIVER_USE_ENABLE 1 +#define APP_DRIVER_USE_ENABLE 1 #endif // Eanble APP log module // <0=> DISABLE // <1=> ENABLE #ifndef APP_LOG_ENABLE -#define APP_LOG_ENABLE 1 +#define APP_LOG_ENABLE 1 #endif // APP log port type @@ -96,22 +122,22 @@ // <1=> RTT // <2=> ITM #ifndef APP_LOG_PORT -#define APP_LOG_PORT 0 +#define APP_LOG_PORT 0 #endif // Eanble APP log store module // <0=> DISABLE // <1=> ENABLE #ifndef APP_LOG_STORE_ENABLE -#define APP_LOG_STORE_ENABLE 0 +#define APP_LOG_STORE_ENABLE 0 #endif -#if (CHIP_TYPE == 0) +#if (CHIP_TYPE <= 5) // Enable SK GUI module, only available in GR5515 // <0=> DISABLE // <1=> ENABLE #ifndef SK_GUI_ENABLE -#define SK_GUI_ENABLE 1 +#define SK_GUI_ENABLE 1 #endif #endif @@ -119,64 +145,78 @@ // <0=> DISABLE // <1=> ENABLE #ifndef DEBUG_MONITOR -#define DEBUG_MONITOR 0 +#define DEBUG_MONITOR 0 #endif // Enable DTM test support // <0=> DISABLE // <1=> ENABLE #ifndef DTM_TEST_ENABLE -#define DTM_TEST_ENABLE 0 +#define DTM_TEST_ENABLE 0 #endif // Enable BLE DFU support // <0=> DISABLE // <1=> ENABLE #ifndef DFU_ENABLE -#define DFU_ENABLE 1 +#define DFU_ENABLE 1 #endif // Protection priority level // Default: 0 #ifndef FLASH_PROTECT_PRIORITY -#define FLASH_PROTECT_PRIORITY 0 +#define FLASH_PROTECT_PRIORITY 0 #endif // NVDS Start Address // Default: 0x010FF000 #ifndef NVDS_START_ADDR +#if (CHIP_TYPE == 1) || (CHIP_TYPE == 6) || (CHIP_TYPE == 7) +#define NVDS_START_ADDR 0x0107F000 +#else #define NVDS_START_ADDR 0x010FF000 #endif +#endif // The Number of sectors for NVDS // Default: 1 +// Range: 1-16 #ifndef NVDS_NUM_SECTOR -#define NVDS_NUM_SECTOR 1 +#define NVDS_NUM_SECTOR 1 #endif // Call Stack Size // Default: 0x4000 -#ifndef CSTACK_HEAP_SIZE -#define CSTACK_HEAP_SIZE 0x4000 +#ifndef SYSTEM_STACK_SIZE +#define SYSTEM_STACK_SIZE 0x4000 +#endif + +// Call Heap Size +// Default: 0x1000 +#ifndef SYSTEM_HEAP_SIZE +#define SYSTEM_HEAP_SIZE 0x1000 #endif // Enable callstack backtrace function // Default: 0 #ifndef ENABLE_BACKTRACE_FEA -#define ENABLE_BACKTRACE_FEA 0 +#define ENABLE_BACKTRACE_FEA 0 #endif // // Boot info configuration +// Chip version +// Default: 0x00 +#define CHIP_VER 0x5515 // Code load address // Default: 0x01002000 -#define APP_CODE_LOAD_ADDR 0x0100b000 +#define APP_CODE_LOAD_ADDR 0x01002000 // Code run address // Default: 0x01002000 -#define APP_CODE_RUN_ADDR 0x0100b000 +#define APP_CODE_RUN_ADDR 0x01002000 // System clock // <0=> 64MHZ @@ -194,7 +234,15 @@ // Enable internal osc as low power clock // <0=> Default: Disable internal osc as low power clock // <1=> Enable internal osc as low power clock and force CFG_LF_ACCURACY_PPM to 500ppm -#define CFG_LPCLK_INTERNAL_EN 0 +#define CFG_LPCLK_INTERNAL_EN 1 + +// Delay time for Crystal stabilization time +// Default: 100 +// Range: 100-500 +// Note: Set according to actual measurement data +#ifndef CFG_CRYSTAL_DELAY +#define CFG_CRYSTAL_DELAY 100 +#endif // Delay time for Boot startup // <0=> Not Delay @@ -206,9 +254,6 @@ // <1=> Check image #define BOOT_CHECK_IMAGE 1 -// Code version.16bits -#define VERSION 1 - // Delay time between flash wakeup and read chip id in warm boot // Default: 0 // Range: 0-10 @@ -222,53 +267,87 @@ #ifndef EXFLASH_WAKEUP_DELAY #define EXFLASH_WAKEUP_DELAY 0 #endif + // // BLE resource configuration -// Note: The total number of BLE Activities(CONNECTIONS+ADVS+2*PER_ADVS+SYNCS+SCAN) should not exceed the limit 12. +// Note: The total number of BLE Activities(CONNECTIONS+ADVS+SCAN) should not exceed the limit 12. -// Support maximum number of BLE profiles <0-64> -// Range: 0-64 +// Support maximum number of BLE profiles <1-64> +// Range: 1-64 #ifndef CFG_MAX_PRFS -#define CFG_MAX_PRFS 10 +#define CFG_MAX_PRFS 10 #endif -// Support maximum number of bonded devices <0-10> -// Range: 0-10 +// Support maximum number of bonded devices #ifndef CFG_MAX_BOND_DEVS -#define CFG_MAX_BOND_DEVS 4 +#define CFG_MAX_BOND_DEVS 4 #endif -// Support maximum number of BLE Links <0-10> -// Range: 0-10 +// Config scan duplicate filter list number +// Range: 0-50 +#ifndef CFG_SCAN_DUP_FILT_LIST_NUM +#define CFG_SCAN_DUP_FILT_LIST_NUM 10 +#endif + +// Support maximum number of BLE Links <1-10> +// Range: 1-10 #ifndef CFG_MAX_CONNECTIONS -#define CFG_MAX_CONNECTIONS 10 +#define CFG_MAX_CONNECTIONS 5 #endif // Support maximum number of BLE Legacy/Extended Advertisings <0-5> // Range: 0-5 // Note: The total number of BLE Legacy/Extended/Periodic Advertisings should not exceed the limit 5. #ifndef CFG_MAX_ADVS -#define CFG_MAX_ADVS 1 +#define CFG_MAX_ADVS 1 +#endif + +// Support 31 bytes adv data for legacy adv +// <0=> NOT SUPPORT +// <1=> SUPPORT +#ifndef CFG_MAX_ADV_DATA_LEN_SUPPORT +#define CFG_MAX_ADV_DATA_LEN_SUPPORT 0 #endif // Support maximum number of BLE Periodic Advertisings <0-5> // Range: 0-5 // Note: The total number of BLE Legacy/Extended/Periodic Advertisings should not exceed the limit 5. #ifndef CFG_MAX_PER_ADVS -#define CFG_MAX_PER_ADVS 0 +#define CFG_MAX_PER_ADVS 0 #endif // Support maximum number of BLE Periodic Advertising Synchronizations <0-5> // Range: 0-5 #ifndef CFG_MAX_SYNCS -#define CFG_MAX_SYNCS 0 +#define CFG_MAX_SYNCS 0 #endif // Support maximum number of BLE Scan <0-1> // Range: 0-1 #ifndef CFG_MAX_SCAN -#define CFG_MAX_SCAN 1 +#define CFG_MAX_SCAN 1 +#endif + +// support +// <0=> NOT SUPPORT +// <1=> SUPPORT +#ifndef CFG_BT_BREDR +#define CFG_BT_BREDR 0 +#endif + +// Support multiple link with the same device +// <0=> NOT SUPPORT +// <1=> SUPPORT +#ifndef CFG_MUL_LINK_WITH_SAME_DEV +#define CFG_MUL_LINK_WITH_SAME_DEV 0 +#endif + +// support +// <0=> NOT SUPPORT +// <1=> SUPPORT +#ifndef CFG_CAR_KEY_SUPPORT +#define CFG_CAR_KEY_SUPPORT 0 #endif // @@ -277,7 +356,7 @@ // <0=> NOT SUPPORT // <1=> SUPPORT #ifndef CFG_MESH_SUPPORT -#define CFG_MESH_SUPPORT 0 +#define CFG_MESH_SUPPORT 0 #endif // @@ -286,9 +365,18 @@ // <0=> NOT SUPPORT // <1=> SUPPORT #ifndef CFG_LCP_SUPPORT -#define CFG_LCP_SUPPORT 0 +#define CFG_LCP_SUPPORT 0 +#endif +// + +// security configuration +// algorithm security level +// <0=> Enable algorithm level one +// <1=> Enable algorithm level two +#ifndef SECURITY_CFG_VAL +#define SECURITY_CFG_VAL 0 #endif // // <<< end of configuration section >>> -#endif // __CUSTOM_CONFIG_H__ +#endif //__CUSTOM_CONFIG_H__ diff --git a/gr551x/sdk_liteos/config/flash_scatter_config.h b/gr551x/sdk_liteos/config/flash_scatter_config.h old mode 100755 new mode 100644 index 2088ed2..a52f113 --- a/gr551x/sdk_liteos/config/flash_scatter_config.h +++ b/gr551x/sdk_liteos/config/flash_scatter_config.h @@ -1,18 +1,3 @@ -/* - * Copyright (c) 2021 GOODIX. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - /** **************************************************************************************** * @@ -24,17 +9,17 @@ **************************************************************************************** */ -#ifndef SCATTER_CONFIG_H -#define SCATTER_CONFIG_H +#ifndef __SCATTER_CONFIG_H__ +#define __SCATTER_CONFIG_H__ #include "custom_config.h" /***************************************************************** - * if CSTACK_HEAP_SIZE is not defined in custom_config.h, + * if SYSTEM_STACK_SIZE is not defined in custom_config.h, * keep default setting to 32KB */ -#ifndef CSTACK_HEAP_SIZE -#define CSTACK_HEAP_SIZE 0x8000 +#ifndef SYSTEM_STACK_SIZE + #define SYSTEM_STACK_SIZE 0x8000 #endif #define FLASH_START_ADDR 0x01000000 @@ -42,7 +27,7 @@ /* size of ROM reserved RAM in retention cell */ #ifndef ROM_RTN_RAM_SIZE -#define ROM_RTN_RAM_SIZE 0x4020 +#define ROM_RTN_RAM_SIZE 0x4100 #endif #define RAM_ALIAS @@ -56,159 +41,42 @@ #define RAM_START_ADDR 0x30000000 #endif -#if (CHIP_TYPE == 0) -#define RAM_SIZE 0x00040000 -#else -#define RAM_SIZE 0x00020000 +#if (CHIP_TYPE == 6) || (CHIP_TYPE == 7) //GR5513 + #define RAM_SIZE 0x00020000 +#else //GR5515 + #define RAM_SIZE 0x00040000 #endif #define RAM_END_ADDR (RAM_START_ADDR + RAM_SIZE) -#define FERP_SIZE 0x8000 // 32K +#define FERP_SIZE 0x8000 //32K #define CRITICAL_CODE_MAX_SIZE 0x10000 // maximum size of critical code reserved #if (APP_CODE_RUN_ADDR == APP_CODE_LOAD_ADDR && \ APP_CODE_RUN_ADDR >= FLASH_START_ADDR && \ APP_CODE_RUN_ADDR < FLASH_START_ADDR + FLASH_SIZE) -#define XIP_MODE + #define XIP_MODE #endif /****************************************************************/ -/* ************************************************************************ - * developer must define CFG_MAX_CONNECTIONS in custom_config.h . - * Max value for GR551X: 10 which must be same with CFG_CON - * in ROM's configs.opt - */ -#ifndef CFG_MAX_CONNECTIONS -#error "CFG_MAX_CONNECTIONS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_CONNECTIONS <= 10) -#define USER_MAX_CONNECTIONS CFG_MAX_CONNECTIONS -#else -#define USER_MAX_CONNECTIONS (1) -#endif - -#ifndef CFG_MAX_ADVS -#error "CFG_MAX_ADVS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_ADVS <= 5) -#define USER_MAX_ADVS CFG_MAX_ADVS -#else -#define USER_MAX_ADVS (1) -#endif - -#ifndef CFG_MAX_PER_ADVS -#error "CFG_MAX_PER_ADVS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_PER_ADVS <= 5) -#define USER_MAX_PER_ADVS CFG_MAX_PER_ADVS -#else -#define USER_MAX_PER_ADVS (0) -#endif - -#if ((USER_MAX_ADVS+USER_MAX_PER_ADVS) > 5) -#error "The number of BLE Legacy/Extended/Periodic Advertising exceeds the limit." -#endif - -#ifndef CFG_MAX_SCAN -#error "CFG_MAX_SCAN is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_SCAN <= 1) -#define USER_MAX_SCAN CFG_MAX_SCAN -#else -#define USER_MAX_SCAN (1) -#endif - -#ifndef CFG_MAX_SYNCS -#error "CFG_MAX_SYNCS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_SYNCS <= 5) -#define USER_MAX_SYNCS CFG_MAX_SYNCS -#else -#define USER_MAX_SYNCS (0) -#endif - -#if ((USER_MAX_CONNECTIONS+USER_MAX_ADVS+2*USER_MAX_PER_ADVS+USER_MAX_SCAN+USER_MAX_SYNCS) > 12) -#error "The number of BLE Activities exceeds the limit." -#endif - -#ifndef CFG_MAX_BOND_DEVS -#error "CFG_MAX_BOND_DEVS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_BOND_DEVS <= 10) -#define USER_MAX_BOND_DEVS CFG_MAX_BOND_DEVS -#else -#define USER_MAX_BOND_DEVS (1) -#endif - -#ifndef CFG_MAX_PRFS -#error "CFG_MAX_PRFS is not defined in app's custom_config.h ." -#endif - -#if (CFG_MAX_PRFS <= 64) -#define USER_MAX_PRFS CFG_MAX_PRFS -#else -#define USER_MAX_PRFS (1) -#endif - -/* The macro is used to compute size of the heap block in bytes. */ -#define MEM_HEAP_HEADER (12 / sizeof(uint32_t)) -#define MEM_CALC_HEAP_LEN(len) ((((len) + (sizeof(uint32_t) - 1)) / sizeof(uint32_t)) + MEM_HEAP_HEADER) -#define MEM_CALC_HEAP_LEN_IN_BYTES(len) (MEM_CALC_HEAP_LEN(len) * sizeof(uint32_t)) - -#define ENV_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(292 * USER_MAX_CONNECTIONS + \ - 426 * (USER_MAX_CONNECTIONS + USER_MAX_ADVS + \ - 2 * USER_MAX_PER_ADVS+USER_MAX_SCAN+USER_MAX_SYNCS) + \ - 600) -/* The size of heap for ATT database depends on the number of attributes in - * profiles. The value can be tuned based on supported profiles. */ -#if (CFG_MESH_SUPPORT == 1) -#include "mesh_stack_config.h" -#define ATT_DB_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1000 + MESH_HEAP_SIZE_ADD) -#else -#define ATT_DB_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1024) -#endif - -#define KE_MSG_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1650 * (USER_MAX_SCAN+USER_MAX_SYNCS) + \ - 112 *(USER_MAX_CONNECTIONS + USER_MAX_ADVS + \ - 2*USER_MAX_PER_ADVS) + 408 *(USER_MAX_CONNECTIONS + \ - USER_MAX_ADVS + 2 * USER_MAX_PER_ADVS + \ - USER_MAX_SCAN + USER_MAX_SYNCS)+ 3072) -/* The size of non-retention heap is customized. This heap will used by BLE - * stack only when other three heaps are full. */ -#define NON_RET_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(328 * 2) - -#define PRF_BUF_SIZE (92*USER_MAX_PRFS + 4) -#define BOND_BUF_SIZE (8*USER_MAX_BOND_DEVS + 4) -#define CONN_BUF_SIZE (372*USER_MAX_CONNECTIONS + 4) - - /**************************************************************************/ /* sections on retention RAM cells */ #ifdef CFG_FERP -#define STACK_END_ADDR (RAM_END_ADDR-FERP_SIZE) + #define STACK_END_ADDR (RAM_END_ADDR-FERP_SIZE) #else -#define STACK_END_ADDR (RAM_END_ADDR) + #define STACK_END_ADDR (RAM_END_ADDR) #endif -#ifndef GR5515_E #define USE_TINY_RAM_SPACE -#endif -#define TINY_RAM_SPACE_START (RAM_START_ADDR + 0x35CC) /* DONT MODIFY ME !!! */ +#define TINY_RAM_SPACE_START (0x30000000 + 0x35CC) /* DONT MODIFY ME !!! */ #define TINY_RAM_SPACE_SIZE (0x750) /* DONT MODIFY ME !!! */ #define FPB_SECTION_START 0x30004000 -#define FPB_SECTION_SIZE 0x20 +#define FPB_SECTION_SIZE 0x100 -#define UNUSED_SECTION_SIZE 0x64 +#define RAM_RESERVE_SECTION_SIZE 0x64 // Code size of Application #ifndef APP_MAX_CODE_SIZE @@ -220,4 +88,5 @@ #define APP_RAM_SIZE 0x00030000 #endif -#endif // SCATTER_CONFIG_H +#endif // __SCATTER_CONFIG_H__ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/BUILD.gn index 9ce8bc2..6e22cf2 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/BUILD.gn +++ b/gr551x/sdk_liteos/gr551x_sdk/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -11,65 +11,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This BUILD.gn is used to compile the SDK source code of Goodix GR551x SOC. -# In this script, optionally add source code compilation. If the SDK is upgraded, -# you can directly replace components, drivers, and toolchain folders. - import("//kernel/liteos_m/liteos.gni") -config("public") { - include_dirs = [ - "components/app_drivers/inc", - "components/boards", - "components/drivers_ext/gr551x", - "components/libraries/app_lfs", - "components/libraries/app_assert", - "components/libraries/app_error", - "components/libraries/app_log", - "components/libraries/app_timer", - "components/libraries/hal_flash", - "components/libraries/pmu_calibration", - "components/libraries/ring_buffer", - "components/libraries/utility", - "components/patch/ind", - "components/sdk/", - "drivers/inc", - "toolchain/gr551x/include", - ] -} - -kernel_module("gr551x_sdk") { - sources = [ - "components/app_drivers/src/app_dma.c", - "components/app_drivers/src/app_gpiote.c", - "components/app_drivers/src/app_i2c.c", - "components/app_drivers/src/app_io.c", - "components/app_drivers/src/app_pwm.c", - "components/app_drivers/src/app_pwr_mgmt.c", - "components/app_drivers/src/app_rng.c", - "components/app_drivers/src/app_systick.c", - "components/app_drivers/src/app_uart.c", - "components/libraries/app_assert/app_assert.c", - "components/libraries/app_error/app_error.c", - "components/libraries/app_log/app_log.c", - "components/libraries/app_timer/app_timer.c", - "components/libraries/pmu_calibration/pmu_calibration.c", - "components/libraries/ring_buffer/ring_buffer.c", - "components/libraries/utility/utility.c", - "drivers/src/gr55xx_hal.c", - "drivers/src/gr55xx_hal_adc.c", - "drivers/src/gr55xx_hal_aon_gpio.c", - "drivers/src/gr55xx_hal_aon_wdt.c", - "drivers/src/gr55xx_hal_calendar.c", - "drivers/src/gr55xx_hal_exflash.c", - "drivers/src/gr55xx_hal_gpio.c", - "drivers/src/gr55xx_hal_i2c.c", - "drivers/src/gr55xx_hal_pwm.c", - "drivers/src/gr55xx_hal_pwr.c", - "drivers/src/gr55xx_hal_rng.c", - "drivers/src/gr55xx_hal_uart.c", - "toolchain/gr551x/source/interrupt_gr55xx.c", - "toolchain/gr551x/source/platform_gr55xx.c", - "toolchain/gr551x/source/system_gr55xx.c", +module_group("gr551x_sdk") { + modules = [ + "drivers", + "components", + "platform", + "external/segger_rtt", ] } diff --git a/gr551x/sdk_liteos/gr551x_sdk/README.md b/gr551x/sdk_liteos/gr551x_sdk/README.md new file mode 100644 index 0000000..c431068 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/README.md @@ -0,0 +1,127 @@ +# GR551x Series SoC + +## 1. Introduction + +- The Goodix GR551x family is a single-mode, low-power Bluetooth 5.1 System-on-Chip (SoC). It can be configured as a Broadcaster, an Observer, a Central, a Peripheral, and supports the combination of all the above roles, making it an ideal choice for Internet of Things (IoT) and smart wearable devices. + +- Based on ARM® Cortex®-M4F CPU core, the GR551x integrates Bluetooth 5.1 Protocol Stack, a 2.4 GHz RF transceiver, on-chip programmable Flash memory, RAM, and multiple peripherals. + +- The [GR551x SDK](https://www.goodix.com/en/software_tool/gr551x_sdk) is the software development kit for the GR551x SoC, offering a complete solution that integrates the protocol stacks, application samples and hardware drivers. + + + +## 2. Key Features + +- Bluetooth 5.1 transceiver integrates Controller and Host layers + - Support these data transmission rates: 1 Mbps, 2 Mbps, LR (500 kbps, 125 kbps) + - TX power: -20 dBm ~ +7 dBm + - -96 dBm reception sensitivity (under the 1 Mbps mode) + - -93 dBm reception sensitivity (under the 2 Mbps mode) + - -99 dBm reception sensitivity (under the LR 500 kbps mode) + - -102 dBm reception sensitivity (under the LR 125 kbps mode) + - TX current: 5.6 mA @ 0 dBm,1 Mbps + - RX current: 4.8 mA @ 1 Mbps +- Built-in ARM® Cortex®-M4F 32-bit micro-processor, supporting floating-point operation + - Maximum frequency: 64 MHz + - Power consumption: 51 μA/MHz +- Memory + - Flash Configurations for GR5515 series + - GR5515I0NDA: no embedded Flash + - GR5515IENDU: embedded with 512 KB Flash + - All other SoCs: embedded with 1 MB flash + - Flash Configurations for GR5513 series + - GR5513 series: embedded with 512 KB Flash +- Power Management + - On-chip DC-DC Converter + - On-chip I/O LDO to provide I/O voltage and supply external components + - Supply voltage: 2.2 V to 3.8 V + - I/O voltage: 1.8 V to 3.3 V + - OFF mode: 0.15 µA (Typical), chip in reset + - Ultra deep sleep mode: 1.8 µA (Typical), no memory retention + - Sleep mode: 2.7 µA (Typical), 256 KB memory retention + +- Peripherals + - 2 QSPI interfaces, up to 32 MHz + - 2 SPI interfaces (1 SPI Master Interface with 2 Slave CS pins + 1 SPI Slave Interface), up to 32 MHz + - 2 I2C interfaces (Supports 100 kHz, 400 kHz, 1 MHz, 2 MHz) + - 2 I2S interfaces (1 I2S Master Interface + 1 I2S Slave Interface) + - 2 UART interfaces (One with DMA channel) + - 13-bit ADC, up to 1 Msps, 8 channels (5 external test channels and 3 internal signal channels), supporting both single-ended and differential inputs + - ISO 7816 interface + - Two PWM modules with edge alignment mode and center alignment mode, each with three channels + - Built-in temperature and voltage sensors + - 2 general-purpose, 32-bit timer modules + - 1 dual timer module composed of two programmable 32-bit or 16-bit down counters + - 1 AON hardware timer + - 2 watchdog timers (one for the system and one is always-on) + - 1 real-time counter (RTC), can be used as Calendar + - Wake-up comparator + - Supports up to 39 multiplexed GPIO pins +- Security + - Complete secure computing engine: + - AES 128-bit/192-bit/256-bit encryption (ECB and CBC) + - Keyed Hash Message Authentication Code(HMAC) + - PKC + - TRNG + - Comprehensive security operation mechanism: + - Secure boot + - Encrypted firmware runs directly from Flash + - Fuse for encrypted key storage + - Differentiate application data key and firmware key, supporting one data per device/product +- Packages + - QFN56: 7 mm * 7 mm * 0.75 mm, 0.40 mm pitch + - BGA68: 5.3 mm * 5.3 mm * 0.88 mm , 0.50 mm pitch + - BGA55: 3.5 mm * 3.5 mm * 0.60 mm, 0.40 mm pitch + - QFN40: 5 mm * 5 mm * 0.75 mm, 0.40 mm pitch +- Operating temperature range: -40°C to +85°C + + + +## 3. Production Details + +| | | GR5515IGND | GR5515I0NDA | GR5515IENDU | GR5515GGBD | GR5515RGBD | GR5513BENDU | +| --------------------- | ------------------ | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | +| Status | | Active | Active | Active | Active | Active | Active | +| Protocol | Bluetooth LE [1] | 5.1 | 5.1 | 5.1 | 5.1 | 5.1 | 5.1 | +| | Bluetooth Mesh | ● | ● | ● | ● | ● | ● | +| Core System | CPU | Cortex®-M4F | Cortex®-M4F | Cortex®-M4F | Cortex®-M4F | Cortex®-M4F | Cortex®-M4F | +| | Clocks | 64 MHz / 32K Hz | 64 MHz / 32 KHz | 64 MHz / 32 KHz | 64 MHz / 32 KHz | 64 MHz / 32 KHz | 64 MHz / 32 KHz | +| | Cache | 8 KB | 8 KB | 8 KB | 8 KB | 8 KB | 8 KB | +| | RAM | 256 KB | 256 KB | 256 KB | 256 KB | 256 KB | 128 KB | +| | OTP | | | | | | | +| | Flash | 1 MB | External Flash | 512 KB | 1 MB | 1 MB | 512 KB | +| Security | Root of Trust | ● | ● | ● | ● | ● | ● | +| | Secure Key Store | 4 | 4 | 4 | 4 | 4 | 4 | +| | PKC | ● | ● | ● | ● | ● | ● | +| | RSA | ● | ● | ● | ● | ● | ● | +| | AES | ● | ● | ● | ● | ● | ● | +| | ECC | ● | ● | ● | ● | ● | ● | +| | TRNG | ● | ● | ● | ● | ● | ● | +| Radio | Frequency | 2.4 GHz | 2.4 GHz | 2.4 GHz | 2.4 GHz | 2.4 GHz | 2.4 GHz | +| | Maximum Tx Power | 7 dBm | 7 dBm | 7 dBm | 7 dBm | 7 dBm | 7 dBm | +| | Rx Sensitivity | -96 dBm(@1Mbps) | -96 dBm(@1Mbps) | -96 dBm(@1Mbps) | -96 dBm(@1Mbps) | -96 dBm(@1Mbps) | -96 dBm(@1Mbps) | +| Peripheral | UART | 2 | 2 | 2 | 2 | 2 | 2 | +| | SPI | 1 * SPIM / 1 * SPIS | 1 * SPIM / 1 * SPIS | 1 * SPIM / 1 * SPIS | 1 * SPIM / 1 * SPIS | 1 * SPIM / 1 * SPIS | 1 * SPIM / 1 * SPIS | +| | I2C | 2 | 2 | 2 | 2 | 2 | 2 | +| | QSPI | 2 | 2 | 2 | 0 | 2 | 1 | +| | Timers | 4 | 4 | 4 | 4 | 4 | 4 | +| | PWM | 2 | 2 | 2 | 2 | 2 | 2 | +| | RTC | 1 | 1 | 1 | 1 | 1 | 1 | +| | I2S | 1 * I2SM / 1 * I2SS | 1 * I2SM / 1 * I2SS | 1 * I2SM / 1 * I2SS | 1 * I2SM / 1 * I2SS | 1 * I2SM / 1 * I2SS | 1 * I2SM / 1 * I2SS | +| | ADC | 13-bit | 13-bit | 13-bit | 13-bit | 13-bit | 13-bit | +| | Comparator | ● | ● | ● | ● | ● | ● | +| | Temperature Sensor | ● | ● | ● | ● | ● | ● | +| | GPIO | 39 | 39 | 39 | 29 | 39 | 22 | +| Packages | Type | QFN56 | QFN56 | QFN56 | BGA55 | BGA68 | QFN40 | +| | Dimensions | 7.0 * 7.0 mm | 7.0 * 7.0 mm | 7.0 * 7.0 mm | 3.5 *3.5 mm | 5.3 * 5.3 mm | 5.0 * 5.0 mm | +| Certification | | PSA Level 1 SIG BQB (QDID: 119449) | PSA Level 1 SIG BQB (QDID: 119449) | PSA Level 1 SIG BQB (QDID: 119449) | PSA Level 1 SIG BQB (QDID: 119449) | PSA Level 1 SIG BQB (QDID: 119449) | PSA Level 1 SIG BQB (QDID: 119449) | +| Operating Temperature | | -40℃ - 85℃ | -40℃ - 85℃ | -40℃ - 85℃ | -40℃ - 85℃ | -40℃ - 85℃ | -40℃ - 85℃ | +| Supply Voltage Range | | 2.2 V - 3.8 V | 2.2 V - 3.8 V | 2.2 V - 3.8 V | 2.2 V - 3.8 V | 2.2 V - 3.8 V | 2.2 V - 3.8 V | +| Development Kits | | GR5515 Starter Kit | GR5515 Starter Kit | GR5515 Starter Kit | GR5515 Starter Kit | GR5515 Starter Kit | GR5515 Starter Kit | + + + +## 4. Change Log + +- Click to view the [change log](../../wiki/Change-Notes-for-GR551x) + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/BUILD.gn new file mode 100644 index 0000000..29636ad --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +module_group("components") { + modules = [ + "libraries", + "profiles", + "sdk", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_measure_mux_signal_api.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_measure_mux_signal_api.c new file mode 100644 index 0000000..28bd87d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_measure_mux_signal_api.c @@ -0,0 +1,140 @@ +/** + **************************************************************************************** + * + * @file gr55xx_measure_mux_signal_api.c + * + * @brief GR55XX MUX module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "grx_hal.h" +#include "grx_sys.h" +#include "gr55xx_measure_mux_signal_api.h" + +/* Private macros ------------------------------------------------------------*/ +#define ADC_INPUT_SRC_MUX (0x0D) +#define MAX_SIMPLE_POINTS (4096) + +/* + * GLOBAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static adc_handle_t gr55xx_snsadc_handle = {0}; +static double adc_offset = 0; +static double adc_slope = 0; + +static gr55xx_set_signal_to_mux(gr55xx_mux_signal_t my_mux_signal) +{ +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void gr55xx_mux_signal_measurement_init(void); +{ + adc_trim_info_t adc_trim = {0}; + + gr55xx_snsadc_handle.init.channel_n = ADC_INPUT_SRC_REF; + gr55xx_snsadc_handle.init.channel_p = ADC_INPUT_SRC_MUX; + gr55xx_snsadc_handle.init.input_mode = ADC_INPUT_DIFFERENTIAL; + gr55xx_snsadc_handle.init.ref_source = ADC_REF_SRC_BUF_INT; + gr55xx_snsadc_handle.init.ref_value = ADC_REF_VALUE_0P8; +#if !defined(GR55XXx) + gr55xx_snsadc_handle.init.clock = ADC_CLK_1M; +#else + gr55xx_snsadc_handle.init.clock = ADC_CLK_1P6M; +#endif + hal_adc_init(&gr55xx_snsadc_handle); + + if(SDK_SUCCESS == sys_adc_trim_get(&adc_trim)) + { + adc_offset = (double)adc_trim.offset_int_0p8; + adc_slope = (-1) * (double)adc_trim.slope_int_0p8; + } + else + { + adc_offset = 8362; + adc_slope = -4754; + } + return; +} + +double gr55xx_mux_signal_measure_average(gr55xx_mux_signal_t my_mux_signal); +{ + uint16_t conver_buff[16] = {0}; + uint16_t average = 0; + double test_result; + + /* Set the fixed signal to Mux*/ + gr55xx_set_signal_to_mux(my_mux_signal); + + /* Get the average of mux signal */ + hal_adc_poll_for_conversion(&gr55xx_snsadc_handle, conver_buff, 16); + for(uint8_t i = 0; i < 8; i++) + { + average += conver_buff[8 + i]; + } + average = average >> 3; + test_result = (((double)average - adc_offset) / adc_slope); + + test_result = test_result + 0.85; + + return test_result; +} + +void gr55xx_mux_signal_measure_n_points(gr55xx_mux_signal_t my_mux_signal, uint32_t num, double* result_buf) +{ + uint16_t conver_buff[MAX_SIMPLE_POINTS] = {0}; + double test_result; + + /* Set the fixed signal to Mux*/ + gr55xx_set_signal_to_mux(my_mux_signal); + + /* Get the average of mux signal */ + memset(&conver_buff[0], 0, 2*MAX_SIMPLE_POINTS); + hal_adc_poll_for_conversion(&gr55xx_snsadc_handle, conver_buff, num); + for(uint32_t i=0; i + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief gr55xx mux signals definition + */ +typedef enum +{ + /**< MUX signal of LPD block. */ + GR55XX_MUX_SIGNAL_LPD_RESET = 0x00U, + GR55XX_MUX_SIGNAL_LPD_POR_RST, + GR55XX_MUX_SIGNAL_LPD_VDD_RC, + GR55XX_MUX_SIGNAL_LPD_POC, + GR55XX_MUX_SIGNAL_LPD_SRPG_BIAS, + GR55XX_MUX_SIGNAL_LPD_RET_BIAS, + GR55XX_MUX_SIGNAL_LPD_PMU_BOD, + GR55XX_MUX_SIGNAL_LPD_VDDC_AON, + /**< MUX signal of SensADC block. */ + GR55XX_MUX_SIGNAL_SNSADC_VREF, + + /**< MUX signal of VDMs block. */ + GR55XX_MUX_SIGNAL_VDM_0, + + /**< MUX signal of PD cores block. */ + GR55XX_MUX_SIGNAL_PD_SRON, + + /**< MUX signal of EFUSE block. */ + GR55XX_MUX_SIGNAL_EFUSE_25V, + + /**< MUX signal of Clock block. */ + GR55XX_MUX_SIGNAL_CLOCK_FS_750K, + + /**< MUX signal of LDO block. */ + GR55XX_MUX_SIGNAL_LDO_VIO, + + /**< MUX signal of DCDC block. */ + GR55XX_MUX_SIGNAL_DCDC_BATT_CMP, + + GR55XX_MUX_SIGNAL_MAX, +}gr55xx_mux_signal_t; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize mux signal measurement modul. + * + **************************************************************************************** + */ +void gr55xx_mux_signal_measurement_init(void); + +/** + **************************************************************************************** + * @brief Get the average value of mux signal input + * + * @return The volatge of mux signal. Unit (volt). + **************************************************************************************** + */ +double gr55xx_mux_signal_measure_average(gr55xx_mux_signal_t my_mux_signal); + +/** + **************************************************************************************** + * @brief Get num points value of mux signal input, num cannot over 4096 + * + * @return The volatge of num points value of mux signal. Unit (volt). + **************************************************************************************** + */ +void gr55xx_mux_signal_measure_n_points(gr55xx_mux_signal_t my_mux_signal, uint32_t num, double* result_buf); + +#ifdef __cplusplus +} +#endif + +#endif // __GR55XX_MEASURE_MUX_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.c new file mode 100644 index 0000000..52851bf --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.c @@ -0,0 +1,863 @@ +/** + **************************************************************************************** + * @file gr55xx_spi_flash.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "grx_hal.h" +#include "gr55xx_spi_flash.h" + + +#define SSI_HIGH_FREQ_CLOCK_PRESCALER 4u + +#define SSI_LOW_FREQ_CLOCK_PRESCALER 8u + +/* + * SPI Master DEFINES + ***************************************************************************************** + */ +#define SPI_CLOCK_PRESCALER 8u /* The SPI CLOCK Freq = Peripheral CLK/SPI_CLOCK_PRESCALER */ +#define SPI_SOFT_CS_MODE_ENABLE 1u /* suggest to enable SOFT CS MODE */ +#define SPI_WAIT_TIMEOUT_MS 1500u /* default time(ms) for wait operation */ + +#if SPI_CLOCK_PRESCALER == 2u + #define SPI_RX_SAMPLE_DELAY 1u +#else + #define SPI_RX_SAMPLE_DELAY 0u +#endif + +/* master spi parameters */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) //pin configuration should be specified in the input of spi_flash_init +#define MASTER_SPI_PIN_CONFIG {{APP_IO_TYPE_GPIOB, APP_IO_MUX_3, APP_IO_PIN_9, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOB, APP_IO_MUX_3, APP_IO_PIN_6, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOB, APP_IO_MUX_3, APP_IO_PIN_7, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOB, APP_IO_MUX_3, APP_IO_PIN_8, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE}} +#else +#define MASTER_SPI_PIN_CONFIG {{APP_IO_TYPE_GPIOA, APP_IO_MUX_1, APP_IO_PIN_15, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOA, APP_IO_MUX_1, APP_IO_PIN_12, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOA, APP_IO_MUX_1, APP_IO_PIN_13, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE},\ + {APP_IO_TYPE_GPIOA, APP_IO_MUX_1, APP_IO_PIN_14, APP_IO_MODE_MUX, APP_IO_PULLUP, APP_SPI_PIN_ENABLE}} +#endif +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +#define MASTER_SPI_MODE_CONFIG {DMA0, DMA0, DMA_Channel0, DMA_Channel1, SPI_WAIT_TIMEOUT_MS, 0} +#define MASTER_SPI_CONFIG {SPI_DATASIZE_8BIT, SPI_POLARITY_LOW, SPI_PHASE_1EDGE, \ + SPI_CLOCK_PRESCALER, SPI_TIMODE_DISABLE, SPI_SLAVE_SELECT_0, SPI_RX_SAMPLE_DELAY} +#else +#define MASTER_SPI_MODE_CONFIG {DMA, DMA, DMA_Channel0, DMA_Channel1} +#define MASTER_SPI_CONFIG {SPI_DATASIZE_8BIT, SPI_POLARITY_LOW, SPI_PHASE_1EDGE, \ + SPI_CLOCK_PRESCALER, SPI_TIMODE_DISABLE, SPI_SLAVE_SELECT_0} +#endif + +#define MASTER_SPI_PARAM_CONFIG {APP_SPI_ID_MASTER, MASTER_SPI_PIN_CONFIG, MASTER_SPI_MODE_CONFIG, MASTER_SPI_CONFIG, SPI_SOFT_CS_MODE_ENABLE} + +/* + * QSPI DEFINES + ***************************************************************************************** + */ +/***************************************** + * CHANGE FOLLOWING SETTINGS By YOUR CASE ! + *****************************************/ + +#define QSPI_CLOCK_PRESCALER 8u /* The QSPI CLOCK Freq = Peripheral CLK/QSPI_CLOCK_PRESCALER */ +#define QSPI_WAIT_TIMEOUT_MS 1500u /* default time(ms) for wait operation */ +#define QSPI_ID APP_QSPI_ID_0 +#define QSPI_TIMING_MODE QSPI_CLOCK_MODE_0 + +/***************************************** + * CHANGE FOLLOWING SETTINGS CAREFULLY ! + *****************************************/ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#if QSPI_ID == APP_QSPI_ID_0 + #define QSPI_USED_DMA DMA0 + #define QSPI_USED_DMA_CH DMA_Channel0 +#elif QSPI_ID == APP_QSPI_ID_1 + #define QSPI_USED_DMA DMA0 + #define QSPI_USED_DMA_CH DMA_Channel1 +#else + #define QSPI_USED_DMA DMA1 + #define QSPI_USED_DMA_CH DMA_Channel0 +#endif +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + #define QSPI_USED_DMA DMA + #define QSPI_USED_DMA_CH DMA_Channel7 +#endif + + +#if QSPI_CLOCK_PRESCALER == 2u + #define QSPI_RX_SAMPLE_DELAY 1u +#else + #define QSPI_RX_SAMPLE_DELAY 0u +#endif +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static volatile qspi_control_t g_qspi_ctl; +static flash_init_t g_flash_init; +static app_spi_params_t spim_params = MASTER_SPI_PARAM_CONFIG; +static app_qspi_params_t qspi_params; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void spi_app_spim_callback(app_spi_evt_t *p_evt) +{ + if (p_evt->type == APP_SPI_EVT_TX_CPLT) + { + g_qspi_ctl.spi_tmt_done = 1; + } + if (p_evt->type == APP_SPI_EVT_RX_CPLT) + { + g_qspi_ctl.spi_rcv_done = 1; + } + if (p_evt->type == APP_SPI_EVT_TX_RX_CPLT) + { + g_qspi_ctl.spi_tx_rx_done = 1; + } + if (p_evt->type == APP_SPI_EVT_ERROR) + { + g_qspi_ctl.spi_tmt_done = 1; + g_qspi_ctl.spi_rcv_done = 1; + g_qspi_ctl.spi_tx_rx_done = 1; + printf("spi error event!!"); + } +} + +static void app_qspi_callback(app_qspi_evt_t *p_evt) +{ + if (p_evt->type == APP_QSPI_EVT_TX_CPLT) + { + g_qspi_ctl.qspi_tmt_done = 1; + } + if (p_evt->type == APP_QSPI_EVT_RX_DATA) + { + g_qspi_ctl.qspi_rcv_done = 1; + } + if (p_evt->type == APP_QSPI_EVT_ERROR) + { + g_qspi_ctl.qspi_tmt_done = 1; + g_qspi_ctl.qspi_rcv_done = 1; + printf("QSPI error event!!"); + } +} + +static void spi_flash_write_enable(void) +{ + uint8_t control_frame[1] = {SPI_FLASH_CMD_WREN}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_dma_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_WREN, + .address = 0, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_00_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = 0, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_dma_command_async(g_qspi_ctl.qspi_id, &command); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + + return; +} + +static uint8_t spi_flash_read_status(void) +{ + uint8_t status = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t cmd = SPI_FLASH_CMD_RDSR; + + g_qspi_ctl.spi_tx_rx_done = 0; + app_spi_dma_read_eeprom_async(g_qspi_ctl.spi_id, &cmd, &status, 1, 1); + while(g_qspi_ctl.spi_tx_rx_done == 0); + } + else + { + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_RDSR, + .address = 0, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_00_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = 1, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_dma_command_receive_async(g_qspi_ctl.qspi_id, &command, &status); + while(g_qspi_ctl.qspi_rcv_done == 0); + } + + return status; +} + +static uint32_t spi_flash_device_size(void) +{ + uint32_t flash_size = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t data[5] = {0}; + uint8_t control_frame[5] = {SPI_FLASH_CMD_SFUD, 0, 0, 0x34, DUMMY_BYTE}; + + g_qspi_ctl.spi_tx_rx_done = 0; + app_spi_dma_read_eeprom_async(g_qspi_ctl.spi_id, control_frame, data, 5, 5); + while(g_qspi_ctl.spi_tx_rx_done == 0); + + if (data[0] != 0 && data[3] < 0xFF) + { + flash_size = ((data[3] << 24) + (data[2] << 16) + (data[1] << 8) + (data[0] << 0) + 1) / 8; + } + } + else + { + uint8_t data[4] = {0}; + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_SFUD, // SPI_FLASH_CMD_SFUD //SPI_FLASH_CMD_RDSR + .address = 0x000034, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 8, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = sizeof(data), +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_dma_command_receive_async(g_qspi_ctl.qspi_id, &command, &data[0]); + while(g_qspi_ctl.qspi_rcv_done == 0); + + if (data[0] != 0 && data[3] < 0xFF) + { + flash_size = ((data[3] << 24) + (data[2] << 16) + (data[1] << 8) + (data[0] << 0) + 1) / 8; + } + } + + return flash_size; +} + + +static uint32_t spim_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + g_qspi_ctl.spi_tmt_done = 0; + app_spim_dma_transmit_with_ia(g_qspi_ctl.spi_id, SPI_FLASH_CMD_PP, address, buffer, nbytes); + while(g_qspi_ctl.spi_tmt_done == 0); + + return nbytes; +} + +static uint32_t qspi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t ret; + + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_PP, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = nbytes, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_tmt_done = 0; + ret = app_qspi_dma_command_transmit_async(g_qspi_ctl.qspi_id, &command, buffer); + if(ret == APP_DRV_SUCCESS) + { + while(g_qspi_ctl.qspi_tmt_done == 0); + return nbytes; + } + else + { + return 0; + } +} + +static uint32_t qspi_flash_dual_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t ret; + + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_DPP, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_DUALSPI, + .length = nbytes, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_tmt_done = 0; + ret = app_qspi_dma_command_transmit_async(g_qspi_ctl.qspi_id, &command, buffer); + if(ret == APP_DRV_SUCCESS) + { + while(g_qspi_ctl.qspi_tmt_done == 0); + return nbytes; + } + else + { + return 0; + } +} + +static uint32_t spim_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_READ; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.spi_tx_rx_done = 0; + app_spi_dma_read_eeprom_async(g_qspi_ctl.spi_id, control_frame, buffer, 4, nbytes); + while(g_qspi_ctl.spi_tx_rx_done == 0); + + return nbytes; +} + +static uint32_t qspi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t ret ; + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_READ, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = nbytes, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_rcv_done = 0; + ret = app_qspi_dma_command_receive_async(g_qspi_ctl.qspi_id, &command, &buffer[0]); + if(ret == APP_DRV_SUCCESS) + { + while(g_qspi_ctl.qspi_rcv_done == 0); + return nbytes; + } + else + { + return 0; + } +} + +static uint32_t qspi_flash_dual_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t ret ; + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_DREAD, + .address = address, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_24_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 8, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_DUALSPI, + .length = nbytes, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + + g_qspi_ctl.qspi_rcv_done = 0; + ret = app_qspi_dma_command_receive_async(g_qspi_ctl.qspi_id, &command, &buffer[0]); + if(ret == APP_DRV_SUCCESS) + { + while(g_qspi_ctl.qspi_rcv_done == 0); + return nbytes; + } + else + { + return 0; + } +} + +bool spim_flash_sector_erase(uint32_t address) +{ + uint8_t control_frame[4] = {0}; + uint32_t ret ; + + control_frame[0] = SPI_FLASH_CMD_SE; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.spi_tmt_done = 0; + ret = app_spi_dma_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + + return (ret == APP_DRV_SUCCESS) ? true : false; +} + +bool qspi_flash_sector_erase(uint32_t address) +{ + uint32_t ret; + uint8_t control_frame[4] = {0}; + + control_frame[0] = SPI_FLASH_CMD_SE; + control_frame[1] = (address >> 16) & 0xFF; + control_frame[2] = (address >> 8) & 0xFF; + control_frame[3] = address & 0xFF; + + g_qspi_ctl.qspi_tmt_done = 0; + ret = app_qspi_dma_transmit_async_ex(g_qspi_ctl.qspi_id, QSPI_DATA_MODE_SPI, QSPI_DATASIZE_08_BITS, control_frame, sizeof(control_frame)); + if(ret == APP_DRV_SUCCESS) + { + while(g_qspi_ctl.qspi_tmt_done == 0); + return true; + } + else + { + return false; + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +void spi_flash_init(flash_init_t *p_flash_init) +{ + uint16_t ret; + + memcpy(&g_flash_init, p_flash_init, sizeof(flash_init_t)); + + if (FLASH_SPIM_ID == p_flash_init->spi_type) + { + if(p_flash_init->is_high_freq) { + spim_params.init.baudrate_prescaler = SSI_HIGH_FREQ_CLOCK_PRESCALER; + } else { + spim_params.init.baudrate_prescaler = SSI_LOW_FREQ_CLOCK_PRESCALER; + } + + spim_params.pin_cfg.cs.type = p_flash_init->flash_io.spi_cs.gpio; + spim_params.pin_cfg.cs.pin = p_flash_init->flash_io.spi_cs.pin; + spim_params.pin_cfg.cs.mux = p_flash_init->flash_io.spi_cs.mux; + + spim_params.pin_cfg.clk.type = p_flash_init->flash_io.spi_clk.gpio; + spim_params.pin_cfg.clk.pin = p_flash_init->flash_io.spi_clk.pin; + spim_params.pin_cfg.clk.mux = p_flash_init->flash_io.spi_clk.mux; + + spim_params.pin_cfg.mosi.type = p_flash_init->flash_io.spi_io0.qspi_io0.gpio; + spim_params.pin_cfg.mosi.pin = p_flash_init->flash_io.spi_io0.qspi_io0.pin; + spim_params.pin_cfg.mosi.mux = p_flash_init->flash_io.spi_io0.qspi_io0.mux; + + spim_params.pin_cfg.miso.type = p_flash_init->flash_io.spi_io1.qspi_io1.gpio; + spim_params.pin_cfg.miso.pin = p_flash_init->flash_io.spi_io1.qspi_io1.pin; + spim_params.pin_cfg.miso.mux = p_flash_init->flash_io.spi_io1.qspi_io1.mux; + + g_qspi_ctl.spi_id = APP_SPI_ID_MASTER; + spim_params.id = APP_SPI_ID_MASTER; + + app_spi_deinit(g_qspi_ctl.spi_id); + ret = app_spi_init(&spim_params, spi_app_spim_callback); + if (ret != 0) + { + printf("SPI master initial failed! Please check the input paraments.\r\n"); + return; + } + ret = app_spi_dma_init(&spim_params); + if (ret != 0) + { + printf("SPI master dma initial failed! Please check the input paraments.\r\n"); + return; + } + } + else if ((FLASH_QSPI_ID0 == p_flash_init->spi_type) + ||(FLASH_QSPI_ID1 == p_flash_init->spi_type) +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + || (FLASH_QSPI_ID2 == p_flash_init->spi_type) +#endif + ) + { + if(FLASH_QSPI_ID0 == p_flash_init->spi_type){ + g_qspi_ctl.qspi_id = APP_QSPI_ID_0; + } else if(FLASH_QSPI_ID1 == p_flash_init->spi_type){ + g_qspi_ctl.qspi_id = APP_QSPI_ID_1; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + } else { + g_qspi_ctl.qspi_id = APP_QSPI_ID_2; +#endif + } + + if(p_flash_init->is_high_freq) { + qspi_params.init.clock_prescaler = SSI_HIGH_FREQ_CLOCK_PRESCALER; + } else { + qspi_params.init.clock_prescaler = SSI_LOW_FREQ_CLOCK_PRESCALER; + } + + qspi_params.init.clock_mode = QSPI_TIMING_MODE; + if(qspi_params.init.clock_prescaler == 2) + { + qspi_params.init.rx_sample_delay = 1; + } + else + { + qspi_params.init.rx_sample_delay = 0; + } + + qspi_params.id = g_qspi_ctl.qspi_id; + qspi_params.pin_cfg.cs.type = p_flash_init->flash_io.spi_cs.gpio; + qspi_params.pin_cfg.cs.pin = p_flash_init->flash_io.spi_cs.pin; + qspi_params.pin_cfg.cs.mux = p_flash_init->flash_io.spi_cs.mux; + qspi_params.pin_cfg.cs.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.cs.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.cs.enable = APP_QSPI_PIN_ENABLE; + qspi_params.pin_cfg.clk.type = p_flash_init->flash_io.spi_clk.gpio; + qspi_params.pin_cfg.clk.pin = p_flash_init->flash_io.spi_clk.pin; + qspi_params.pin_cfg.clk.mux = p_flash_init->flash_io.spi_clk.mux; + qspi_params.pin_cfg.clk.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.clk.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.clk.enable = APP_QSPI_PIN_ENABLE; + qspi_params.pin_cfg.io_0.type = p_flash_init->flash_io.spi_io0.qspi_io0.gpio; + qspi_params.pin_cfg.io_0.pin = p_flash_init->flash_io.spi_io0.qspi_io0.pin; + qspi_params.pin_cfg.io_0.mux = p_flash_init->flash_io.spi_io0.qspi_io0.mux; + qspi_params.pin_cfg.io_0.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.io_0.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.io_0.enable = APP_QSPI_PIN_ENABLE; + qspi_params.pin_cfg.io_1.type = p_flash_init->flash_io.spi_io1.qspi_io1.gpio; + qspi_params.pin_cfg.io_1.pin = p_flash_init->flash_io.spi_io1.qspi_io1.pin; + qspi_params.pin_cfg.io_1.mux = p_flash_init->flash_io.spi_io1.qspi_io1.mux; + qspi_params.pin_cfg.io_1.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.io_1.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.io_1.enable = APP_QSPI_PIN_ENABLE; + qspi_params.pin_cfg.io_2.type = p_flash_init->flash_io.qspi_io2.gpio; + qspi_params.pin_cfg.io_2.pin = p_flash_init->flash_io.qspi_io2.pin; + qspi_params.pin_cfg.io_2.mux = p_flash_init->flash_io.qspi_io2.mux; + qspi_params.pin_cfg.io_2.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.io_2.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.io_2.enable = APP_QSPI_PIN_ENABLE; + qspi_params.pin_cfg.io_3.type = p_flash_init->flash_io.qspi_io3.gpio; + qspi_params.pin_cfg.io_3.pin = p_flash_init->flash_io.qspi_io3.pin; + qspi_params.pin_cfg.io_3.mux = p_flash_init->flash_io.qspi_io3.mux; + qspi_params.pin_cfg.io_3.mode = APP_IO_MODE_MUX; + qspi_params.pin_cfg.io_3.pull = APP_IO_PULLUP; + qspi_params.pin_cfg.io_3.enable = APP_QSPI_PIN_ENABLE; + + qspi_params.dma_cfg.dma_instance = QSPI_USED_DMA; + qspi_params.dma_cfg.dma_channel = QSPI_USED_DMA_CH; + + app_qspi_dma_deinit(g_qspi_ctl.qspi_id); + app_qspi_deinit(g_qspi_ctl.qspi_id); + ret = app_qspi_init(&qspi_params, app_qspi_callback); + if (ret != 0) + { + printf("QSPI initial failed! Please check the input paraments."); + return ; + } + ret = app_qspi_dma_init(&qspi_params); + if (ret != 0) + { + printf("QSPI initial dma failed! Please check the input paraments."); + return ; + } + + //set qspi hold/wp pin to high + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pull = APP_IO_PULLUP; + io_init.pin = qspi_params.pin_cfg.io_2.pin; + io_init.mux = APP_IO_MUX; + app_io_init(qspi_params.pin_cfg.io_2.type, &io_init); + + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pull = APP_IO_PULLUP; + io_init.pin = qspi_params.pin_cfg.io_3.pin; + io_init.mux = APP_IO_MUX; + app_io_init(qspi_params.pin_cfg.io_3.type , &io_init); + + app_io_write_pin(qspi_params.pin_cfg.io_2.type, qspi_params.pin_cfg.io_2.pin, APP_IO_PIN_SET); + app_io_write_pin(qspi_params.pin_cfg.io_3.type, qspi_params.pin_cfg.io_3.pin, APP_IO_PIN_SET); + } + + return; +} + +uint32_t spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t page_ofs, write_size, write_cont = nbytes; + hal_status_t status = HAL_OK; + + while (write_cont) + { + page_ofs = address & 0xFF; + write_size = EXFLASH_SIZE_PAGE_BYTES - page_ofs; + + if (write_cont < write_size) + { + write_size = write_cont; + write_cont = 0; + } + else + { + write_cont -= write_size; + } + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + spim_flash_write(address, buffer, write_size); + } + else + { + if(g_flash_init.is_dual_line) { + qspi_flash_dual_write(address, buffer, write_size); + } else { + qspi_flash_write(address, buffer, write_size); + } + } + + while(spi_flash_read_status() & 0x1); + + address += write_size; + buffer += write_size; + } + + return ((status == HAL_OK) ? nbytes : 0); +} + +uint32_t spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + uint32_t count = 0; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + count = spim_flash_read(address, buffer, nbytes); + } + else + { + if(g_flash_init.is_dual_line) { + count = qspi_flash_dual_read(address, buffer, nbytes); + } else { + count = qspi_flash_read(address, buffer, nbytes); + } + } + + return count; +} + +bool spi_flash_sector_erase(uint32_t address, uint32_t size) +{ + bool status = true; + + uint32_t erase_addr = address; + uint32_t sector_ofs, erase_size, erase_cont = size; + + while (erase_cont) + { + sector_ofs = erase_addr & 0xFFF; + erase_size = EXFLASH_SIZE_SECTOR_BYTES - sector_ofs; + + if (erase_cont < erase_size) + { + erase_size = erase_cont; + erase_cont = 0; + } + else + { + erase_cont -= erase_size; + } + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + status = spim_flash_sector_erase(erase_addr); + } + else + { + status = qspi_flash_sector_erase(erase_addr); + } + + while(spi_flash_read_status() & 0x1); + + erase_addr += erase_size; + } + + return status; +} + +bool spi_flash_chip_erase(void) +{ + uint32_t ret; + uint8_t control_frame[1] = {SPI_FLASH_CMD_CE}; + + spi_flash_write_enable(); + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + ret = app_spi_dma_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + g_qspi_ctl.qspi_tmt_done = 0; + ret = app_qspi_dma_transmit_async_ex(g_qspi_ctl.qspi_id, QSPI_DATA_MODE_SPI, QSPI_DATASIZE_08_BITS, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + while(spi_flash_read_status() & 0x1); + + return ((ret == APP_DRV_SUCCESS) ? true : false); +} + +void spi_flash_chip_reset(void) +{ + uint8_t control_frame[1] = {SPI_FLASH_CMD_RSTEN}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_dma_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_dma_transmit_async_ex(g_qspi_ctl.qspi_id, QSPI_DATA_MODE_SPI, QSPI_DATASIZE_08_BITS, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + + control_frame[0] = SPI_FLASH_CMD_RST; + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + g_qspi_ctl.spi_tmt_done = 0; + app_spi_dma_transmit_async(g_qspi_ctl.spi_id, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.spi_tmt_done == 0); + } + else + { + g_qspi_ctl.qspi_tmt_done = 0; + app_qspi_dma_transmit_async_ex(g_qspi_ctl.qspi_id, QSPI_DATA_MODE_SPI, QSPI_DATASIZE_08_BITS, control_frame, sizeof(control_frame)); + while(g_qspi_ctl.qspi_tmt_done == 0); + } + + return; +} + +uint32_t spi_flash_device_id(void) +{ + uint8_t data[3] = {0}; + + if (FLASH_SPIM_ID == g_flash_init.spi_type) + { + uint8_t control_frame[1] = {SPI_FLASH_CMD_RDID}; + + g_qspi_ctl.spi_tx_rx_done = 0; + app_spi_dma_read_eeprom_async(g_qspi_ctl.spi_id, control_frame, data, 1, 3); + while(g_qspi_ctl.spi_tx_rx_done == 0); + } + else + { + qspi_command_t command = { + .instruction = SPI_FLASH_CMD_RDID, + .address = 0, + .instruction_size = QSPI_INSTSIZE_08_BITS, + .address_size = QSPI_ADDRSIZE_00_BITS, + .data_size = QSPI_DATASIZE_08_BITS, + .dummy_cycles = 0, + .instruction_address_mode = QSPI_INST_ADDR_ALL_IN_SPI, + .data_mode = QSPI_DATA_MODE_SPI, + .length = 3, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .clock_stretch_en = 1, +#endif + }; + g_qspi_ctl.qspi_rcv_done = 0; + app_qspi_dma_command_receive_async(g_qspi_ctl.qspi_id, &command, data); + while(g_qspi_ctl.qspi_rcv_done == 0); + } + + return (((uint32_t)data[0] << 16) + ((uint32_t)data[1] << 8) + data[2]); +} + +void spi_flash_device_info(uint32_t *id, uint32_t *size) +{ + if (NULL == id || NULL == size) + { + return; + } + + *id = spi_flash_device_id(); + *size = spi_flash_device_size(); + + return; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.h new file mode 100644 index 0000000..911e54b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_spi_flash.h @@ -0,0 +1,264 @@ +/** + **************************************************************************************** + * @file gr55xx_spi_flash.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of spi flash library. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ +#ifndef __GR55XX_SPI_FLASH_H__ +#define __GR55XX_SPI_FLASH_H__ + +#include +#include "grx_hal.h" +#include "app_io.h" +#include "app_qspi.h" +#include "app_qspi_dma.h" +#include "app_spi.h" +#include "app_spi_dma.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup Flash operation instruction macro definition + * @{ + */ + +#define SPI_FLASH_CMD_WRSR 0x01 +#define SPI_FLASH_CMD_WRSR1 0x31 +#define SPI_FLASH_CMD_RDSR 0x05 + +#define SPI_FLASH_CMD_WREN 0x06 +#define SPI_FLASH_CMD_WRDI 0x04 + +#define SPI_FLASH_CMD_READ 0x03 +#define SPI_FLASH_CMD_FREAD 0x0B +#define SPI_FLASH_CMD_DOFR 0x3B +#define SPI_FLASH_CMD_DIOFR 0xBB +#define SPI_FLASH_CMD_QOFR 0x6B +#define SPI_FLASH_CMD_QIOFR 0xEB +#define SPI_FLASH_CMD_READ_RESET 0xFF +#define SPI_FLASH_CMD_DPP 0xA2 +#define SPI_FLASH_CMD_DREAD 0x3B +#define SPI_FLASH_CMD_PP 0x02 +#define SPI_FLASH_CMD_SE 0x20 +#define SPI_FLASH_CMD_BE_32 0x52 +#define SPI_FLASH_CMD_BE_64 0xD8 +#define SPI_FLASH_CMD_CE 0xC7 +#define SPI_FLASH_CMD_PES 0x75 +#define SPI_FLASH_CMD_PER 0x7A + +#define SPI_FLASH_CMD_RDI 0xAB +#define SPI_FLASH_CMD_REMS 0x90 +#define SPI_FLASH_CMD_RDID 0x9F + +#define SPI_FLASH_CMD_RSTEN 0x66 +#define SPI_FLASH_CMD_RST 0x99 +#define SPI_FLASH_CMD_DP 0xB9 +#define SPI_FLASH_CMD_RDP 0xAB + +#define SPI_FLASH_CMD_SFUD 0x5A + +#define DUMMY_BYTE 0xFF + +#define SPI_FLASH_PAGE_SIZE 0x00100 +#define SPI_FLASH_SECTOR_SIZE 0x01000 +#define SPI_FLASH_BLOCK_SIZE 0x10000 +#define SPI_FLASH_ADDRESS_MAX 0xFFFFF + +/** @} */ + +/** + * @addtogroup Spi Flash IO configuration Structures + * @{ + */ +typedef enum +{ + FLASH_SPIM_ID, /**< SPI master module. */ + FLASH_QSPI_ID0, /**< QSPI master module 0. */ + FLASH_QSPI_ID1, /**< QSPI master module 1. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + FLASH_QSPI_ID2, /**< QSPI master module 2. */ +#endif + FLASH_SPI_ID_MAX, /**< Only for check parameter, not used as input parameters. */ +} spi_type_t; + +typedef struct _spi_io +{ + app_io_type_t gpio; + uint32_t pin; + app_io_mux_t mux; +} spi_io_t; + +typedef struct _flash_io +{ + spi_io_t spi_cs; + spi_io_t spi_clk; + union + { + spi_io_t spim_mosi; + spi_io_t qspi_io0; + } spi_io0; + union + { + spi_io_t spim_miso; + spi_io_t qspi_io1; + } spi_io1; + spi_io_t qspi_io2; + spi_io_t qspi_io3; +} flash_io_t; + +typedef struct _flash_init +{ + spi_type_t spi_type; + flash_io_t flash_io; + bool is_dual_line; + bool is_high_freq; +} flash_init_t; + +typedef struct flash_control +{ + uint8_t qspi_tmt_done; + uint8_t qspi_rcv_done; + app_qspi_id_t qspi_id; + uint8_t spi_tmt_done; + uint8_t spi_rcv_done; + uint8_t spi_tx_rx_done; + app_spi_id_t spi_id; +} qspi_control_t; + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_SPI_FLASH_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the SPI FLASH DRIVER according to the specified parameters + * in the spi_flash_io_t. + * + * @param[in] p_params: Pointer to spi_flash_io_t parameter. + * + **************************************************************************************** + */ +void spi_flash_init(flash_init_t *p_flash_init); + +/** + ******************************************************************************* + * @brief Write flash Memory. + * + * @param[in] address: start address in flash to write data to. + * @param[in,out] buffer: buffer of data to write. + * @param[in] nbytes: number of bytes to write. + * + * @return number of bytes written + ******************************************************************************* + */ +uint32_t spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes); + +/** + ******************************************************************************* + * @brief Read flash Memory. + * + * @param[in] address: start address in flash to read data. + * @param[in,out] buffer: buffer to read data to. + * @param[in] nbytes: number of bytes to read. + * + * @return number of bytes read + ******************************************************************************* + */ +uint32_t spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes); + +/** + ******************************************************************************* + * @brief Erase flash region. + * + * @note All sectors that have address in range of [addr, addr+len] + * will be erased. If addr is not sector aligned, preceding data + * on the sector that addr belongs to will also be erased. + * If (addr + size) is not sector aligned, the whole sector + * will also be erased. + * + * @param[in] address: start address in flash to write data to. + * @param[in] size: number of bytes to write. + * + * @retval true: If successful. + * @retval false: If failure. + ******************************************************************************* + */ +bool spi_flash_sector_erase(uint32_t address, uint32_t size); + +/** + ******************************************************************************* + * @brief Erase flash chip. + * + * @retval true: If successful. + * @retval false: If failure. + ******************************************************************************* + */ +bool spi_flash_chip_erase(void); + +/** + ******************************************************************************* + * @brief Reset flash chip. + * + ******************************************************************************* + */ +void spi_flash_chip_reset(void); + +/** + ******************************************************************************* + * @brief Get flash chip id. + * + * @retval Flash chip id. + ******************************************************************************* + */ +uint32_t spi_flash_device_id(void); + +/** + ******************************************************************************* + * @brief Get Flash information. + * + * @param[in,out] id: Pointer to flash id. + * @param[in,out] size: Pointer to flash size, Unit:Byte. + * + ******************************************************************************* + */ +void spi_flash_device_info(uint32_t *id, uint32_t *size); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif // __GR55XX_SPI_FLASH_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.c new file mode 100644 index 0000000..3552dc3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.c @@ -0,0 +1,88 @@ +/** + **************************************************************************************** + * + * @file gr551x_tim_delay.c + * + * @brief GR551x tim delay. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gr551x_tim_delay.h" + +/* + * STATIC VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint32_t fus = 0; +static uint32_t fms = 0; +static dual_timer_regs_t *tim_regs; + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void tim_delay_init(dual_timer_regs_t *timx) +{ + fus = SystemCoreClock / 1000000; + fms = SystemCoreClock / 1000; + tim_regs = timx; + tim_regs->RELOAD = 0xFFFFFFFF; + /* Disable tim, period mode, 32-bit counter, one-shot mdoe */ + tim_regs->CTRL = 0x43; +} + +void tim_delay_us(uint32_t us) +{ + uint32_t load = us * fus - 1; + tim_regs->RELOAD = load; + /* Enable tim */ + tim_regs->CTRL |= 0x80; + while(tim_regs->VALUE != 0); + tim_regs->CTRL &= ~0x80; + /* Clear flag */ + tim_regs->INTCLR = 1; +} + +void tim_delay_ms(uint32_t ms) +{ + uint32_t load = ms * fms - 1; + tim_regs->RELOAD = load; + /* Enable tim */ + tim_regs->CTRL |= 0x80; + while(tim_regs->VALUE != 0); + tim_regs->CTRL &= ~0x80; + /* Clear flag */ + tim_regs->INTCLR = 1; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.h new file mode 100644 index 0000000..d899d6f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/gr55xx/gr55xx_tim_delay.h @@ -0,0 +1,85 @@ +/** + **************************************************************************************** + * + * @file gr551x_tim_delay.h + * + * @brief Header file - GR551x tim delay. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __GR551X_TIM_DELAY_H__ +#define __GR551X_TIM_DELAY_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "grx_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize the DUAL TIM according to the specified register + * in the dual_timer_regs_t. + **************************************************************************************** + */ +void tim_delay_init(dual_timer_regs_t *timx); + +/** + ***************************************************************************************** + * @brief Delay the function execution. + * + * @param[in] us: Microsecond. + ***************************************************************************************** + */ +void tim_delay_us(uint32_t us); + +/** + ***************************************************************************************** + * @brief Delay the function execution. + * + * @param[in] ms: Millisecond. + ***************************************************************************************** + */ +void tim_delay_ms(uint32_t ms); + +#ifdef __cplusplus +} +#endif + +#endif // __GR551X_TIM_DELAY_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735.c new file mode 100644 index 0000000..88d07d9 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735.c @@ -0,0 +1,237 @@ +/** + ***************************************************************************************** + * + * @file st7533.c + * + * @brief LCD controller driver of st7735 IC. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "st7735.h" +#include "st7735_config.h" +#include +#include + + /* + * GLOBAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +uint16_t g_lcd_gram[LCD_YMAX][LCD_XMAX]; +uint16_t g_lcd_buffer[LCD_YMAX][LCD_XMAX]; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint16_t (*s_lcd_memory)[LCD_XMAX] = g_lcd_gram; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void lcd_set_window(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1) +{ + st7735_write_cmd(0x2a); + st7735_write_data(0x00); + st7735_write_data(x0+0x02); + st7735_write_data(0x00); + st7735_write_data(x1+0x02); + + st7735_write_cmd(0x2b); + st7735_write_data(0x00); + st7735_write_data(y0+0x03); + st7735_write_data(0x00); + st7735_write_data(y1+0x03); + + st7735_write_cmd(0x2C); +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void lcd_set_memory(bool gram_set) +{ + if(gram_set) + { + s_lcd_memory = g_lcd_gram; + } + else + { + s_lcd_memory = g_lcd_buffer; + } +} + +void lcd_draw_point(uint8_t x, uint8_t y, uint16_t color) +{ + if(x > (LCD_XMAX-1) || y > (LCD_YMAX-1)) + return; + s_lcd_memory[y][x] = color; +} + + +void lcd_fill_mem(uint16_t color) +{ + uint8_t x; + uint8_t y; + for(y=0; y +#include + +/** + * @defgroup ST7735_MAROC Defines + * @{ + */ +#define LCD_XMAX 128 /**< LCD Max Pixel of X coordinate. */ +#define LCD_YMAX 128 /**< LCD Max Pixel of Y coordinate. */ + +/** + * @defgroup ST7735_EXTRERN Extern_Variable + * @{ + */ +extern uint16_t g_lcd_gram[LCD_YMAX][LCD_XMAX]; /**< Gram memory define. */ +extern uint16_t g_lcd_buffer[LCD_YMAX][LCD_XMAX]; /**< Buffer memory define. */ +/** @} */ + +/** + * @defgroup UC1701_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize lcd. + ***************************************************************************************** + */ +void lcd_init(void); + +/** + ***************************************************************************************** + * @brief Resume lcd. + ***************************************************************************************** + */ +void lcd_resume(void); + +/** + ***************************************************************************************** + * @brief Set the memory type of lcd. + * + * @param[in] type: Memory type. + ***************************************************************************************** + */ +void lcd_set_memory(bool gram_set); + +/** + ***************************************************************************************** + * @brief Fill Data to Lcm memory. + * + * @param[in] data: Fill data. + ***************************************************************************************** + */ +void lcd_fill_mem(uint16_t color); + +/** + ***************************************************************************************** + * @brief Refresh the memory data to lcd. + ***************************************************************************************** + */ +void lcd_refresh(void); + +/** + ***************************************************************************************** + * @brief Draw a point to lcd memory. + * + * @param[in] x: X coordinate. + * @param[in] y: Y coordinate. + * @param[in] color: The color of the memory. + ***************************************************************************************** + */ +void lcd_draw_point(uint8_t x, uint8_t y, uint16_t color); + +/** + ***************************************************************************************** + * @brief Read a point from lcd memory. + * + * @param[in] x: X coordinate. + * @param[in] y: Y coordinate. + * + * @return The color of the read point.(Return 0xff:error) + ***************************************************************************************** + */ +uint16_t lcd_read_point(uint8_t x, uint8_t y); + +/** + ***************************************************************************************** + * @brief Fill Data to Lcm rectangle memory. + * + * @param[in] x0: X0 coordinate. + * @param[in] y0: Y0 coordinate. + * @param[in] x1: X1 coordinate. + * @param[in] y1: Y1 coordinate. + * @param[in] color: The color of the memory. + ***************************************************************************************** + */ +void lcd_rectangle_fill_mem(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint16_t color); + +/** + ***************************************************************************************** + * @brief Refresh the rectangle memory data to lcd. + * + * @param[in] x0: X0 coordinate. + * @param[in] y0: Y0 coordinate. + * @param[in] x1: X1 coordinate. + * @param[in] y1: Y1 coordinate. + ***************************************************************************************** + */ +void lcd_rectangle_refresh(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1); + + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.c b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.c new file mode 100644 index 0000000..4c55223 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.c @@ -0,0 +1,237 @@ +/** + **************************************************************************************** + * + * @file uc1701_config.c + * + * @brief uc1701 config Implementation. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "st7735_config.h" +#include "grx_hal.h" +#include "app_spi_dma.h" +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +#ifdef DISPLAY_DRIVER_TYPE_HW_SPI +#include "app_spi.h" +static volatile uint8_t master_tx_done = 0; +static void app_spi_callback(app_spi_evt_t *p_evt); +static app_spi_params_t spi_params; +#endif +app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void st7735_init(void) +{ + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pin = DISPLAY_BACK_LIGHT_PIN | DISPLAY_CMD_AND_DATA_PIN; + io_init.mux = APP_IO_MUX_7; + app_io_init(APP_IO_TYPE_GPIOA, &io_init); + app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_BACK_LIGHT_PIN, APP_IO_PIN_SET); + +#ifdef DISPLAY_DRIVER_TYPE_SW_IO + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pin = DISPLAY_SPIM_CS0_PIN | DISPLAY_SPIM_CLK_PIN | DISPLAY_SPIM_MOSI_PIN; + io_init.mux = APP_IO_MUX_7; + app_io_init(DISPLAY_SPIM_GPIO_TYPE, &io_init); +#else + spi_params.id = APP_SPI_ID_MASTER; + + spi_params.pin_cfg.cs.type = DISPLAY_SPIM_GPIO_TYPE; + spi_params.pin_cfg.cs.pin = DISPLAY_SPIM_CS0_PIN; + spi_params.pin_cfg.cs.mux = APP_IO_MUX_7; + spi_params.pin_cfg.cs.mode = APP_IO_MODE_MUX; + spi_params.pin_cfg.cs.pull = APP_IO_PULLUP; + spi_params.pin_cfg.cs.enable = APP_SPI_PIN_ENABLE; + + spi_params.pin_cfg.clk.type = DISPLAY_SPIM_GPIO_TYPE; + spi_params.pin_cfg.clk.pin = DISPLAY_SPIM_CLK_PIN; + spi_params.pin_cfg.clk.mux = APP_IO_MUX_4; + spi_params.pin_cfg.clk.mode = APP_IO_MODE_MUX; + spi_params.pin_cfg.clk.pull = APP_IO_PULLUP; + spi_params.pin_cfg.clk.enable = APP_SPI_PIN_ENABLE; + + spi_params.pin_cfg.mosi.type = DISPLAY_SPIM_GPIO_TYPE; + spi_params.pin_cfg.mosi.pin = DISPLAY_SPIM_MOSI_PIN; + spi_params.pin_cfg.mosi.mux = APP_IO_MUX_4; + spi_params.pin_cfg.mosi.mode = APP_IO_MODE_MUX; + spi_params.pin_cfg.mosi.pull = APP_IO_PULLUP; + spi_params.pin_cfg.mosi.enable = APP_SPI_PIN_ENABLE; + + spi_params.pin_cfg.miso.enable = APP_SPI_PIN_DISABLE; + + spi_params.dma_cfg.rx_dma_instance = DMA0; + spi_params.dma_cfg.tx_dma_instance = DMA0; + spi_params.dma_cfg.rx_dma_channel = DMA_Channel1; + spi_params.dma_cfg.tx_dma_channel = DMA_Channel0; + + spi_params.init.data_size = SPI_DATASIZE_8BIT; + spi_params.init.clock_polarity = SPI_POLARITY_LOW; + spi_params.init.clock_phase = SPI_PHASE_1EDGE; + spi_params.init.baudrate_prescaler = SystemCoreClock / 4000000; + spi_params.init.ti_mode = SPI_TIMODE_DISABLE; + spi_params.init.slave_select = SPI_SLAVE_SELECT_0; + + spi_params.is_soft_cs = 1u; + + app_spi_init(&spi_params, app_spi_callback); + app_spi_dma_init(&spi_params); +#endif +} + +#ifdef DISPLAY_DRIVER_TYPE_SW_IO +/*--------------------------------DISPLAY_DRIVER_TYPE_SW_IO------------------------------------*/ +void st7735_write_cmd(uint8_t cmd) +{ + uint8_t i; + + SEND_CMD; + CS_LOW; + for(i=0;i<8;i++) + { + if (cmd &0x80) + SDA_HIGH; + else + SDA_LOW; + + SCK_LOW; + SCK_HIGH; + cmd <<= 1; + } + CS_HIGH; +} + +void st7735_write_data(uint8_t data) +{ + uint8_t i; + + SEND_DATA; + CS_LOW; + for(i=0;i<8;i++) + { + if(data&0x80) + SDA_HIGH; + else + SDA_LOW; + SCK_LOW; + SCK_HIGH; + data <<= 1; + } + CS_HIGH; +} + +void st7735_write_buffer(uint8_t *p_data, uint16_t length) +{ + uint16_t i= 0; + SEND_DATA; + CS_LOW; + for (i=0; itype == APP_SPI_EVT_TX_CPLT) + { + master_tx_done = 1; + } +} + +void st7735_write_cmd(uint8_t cmd) +{ + SEND_CMD; + master_tx_done = 0; + app_spi_transmit_async(APP_SPI_ID_MASTER, &cmd, 1); + while(master_tx_done == 0); +} + +void st7735_write_data(uint8_t data) +{ + SEND_DATA; + master_tx_done = 0; + app_spi_transmit_async(APP_SPI_ID_MASTER, &data, 1); + while(master_tx_done == 0); +} + +void st7735_write_buffer(uint8_t *p_data, uint16_t length) +{ + uint16_t last_size; + uint16_t count_size; + uint16_t i; + SEND_DATA; + if(length <= 4095) + { + master_tx_done = 0; + app_spi_transmit_async(APP_SPI_ID_MASTER, p_data, length); + while(master_tx_done == 0); + } + else + { + last_size = length % 4095; + count_size = length / 4095; + for(i = 0; i < count_size; i++) + { + master_tx_done = 0; + app_spi_transmit_async(APP_SPI_ID_MASTER, p_data + i * 4095, 4095); + while(master_tx_done == 0); + } + if(last_size) + { + master_tx_done = 0; + app_spi_transmit_async(APP_SPI_ID_MASTER, p_data + i * 4095, last_size); + while(master_tx_done == 0); + } + } +} + +#endif + +void st7735_delay(uint16_t time) +{ + delay_ms(time); +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.h b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.h new file mode 100644 index 0000000..3fe1bd0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/drivers_ext/st7735/st7735_config.h @@ -0,0 +1,71 @@ +#ifndef __ST7735X_CONFIG_H__ +#define __ST7735X_CONFIG_H__ +#include "board_SK.h" +#include "app_io.h" + +#define CS_HIGH app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_CS0_PIN, APP_IO_PIN_SET) /**< set cs pin to high. */ +#define CS_LOW app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_CS0_PIN, APP_IO_PIN_RESET) /**< set cs pin to low. */ +#define SEND_CMD app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_CMD_AND_DATA_PIN, APP_IO_PIN_RESET) /**< set cmd pin to high. */ +#define SEND_DATA app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_CMD_AND_DATA_PIN, APP_IO_PIN_SET) /**< set cmd pin to low. */ + +#ifdef DISPLAY_DRIVER_TYPE_SW_IO + +#define SCK_HIGH app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_CLK_PIN, APP_IO_PIN_SET) /**< set sck pin to high. */ +#define SCK_LOW app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_CLK_PIN, APP_IO_PIN_RESET) /**< set sck pin to low. */ +#define SDA_HIGH app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_MOSI_PIN, APP_IO_PIN_SET) /**< set sda pin to high. */ +#define SDA_LOW app_io_write_pin(DISPLAY_SPIM_GPIO_TYPE, DISPLAY_SPIM_MOSI_PIN, APP_IO_PIN_RESET) /**< set sda pin to low. */ + +#endif + +/** + * @defgroup st7735_CONFIG_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief st7735 init(config gpio spi). + ***************************************************************************************** + */ +void st7735_init(void); + +/** + ***************************************************************************************** + * @brief Write cmd to st7735. + * + * @param[in] cmd: Cmd to write. + ***************************************************************************************** + */ +void st7735_write_cmd(uint8_t cmd); + +/** + ***************************************************************************************** + * @brief Write one data to st7735. + * + * @param[in] data: Data to write. + ***************************************************************************************** + */ +void st7735_write_data(uint8_t data); + +/** + ***************************************************************************************** + * @brief Write data buffer to st7735. + * + * @param[in] p_data: The pointer of the data. + * @param[in] length: The length of write data. + ***************************************************************************************** + */ +void st7735_write_buffer(uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief st7735 delay function. + * + * @param[in] time: Delay time. + ***************************************************************************************** + */ +void st7735_delay(uint16_t time); + + + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/BUILD.gn new file mode 100644 index 0000000..ec93c58 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/BUILD.gn @@ -0,0 +1,51 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +module_group("libraries") { + modules = [ + "at_cmd", + "fcc", + "utility", + "app_memory", + "dfu_master", + + # "virt_key", + "app_linked_list", + "hci_uart", + "app_alarm", + "ble/ble_time", + + # "ble/ble_gatt_service", + # "ble/ble_connect", + # "ble/ble_scanner", + # "ble/ble_advertising", + "crypto_lib", + "pmu_calibration", + "app_timer", + "sensorsim", + "app_log", + "user_efuse", + "app_scheduler", + "app_error", + "app_key", + "hal_flash", + "app_queue", + "dfu_port", + "fault_trace", + "app_assert", + "CMSIS/cmsis_dsp", + "ring_buffer", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/BUILD.gn new file mode 100644 index 0000000..ab1d72a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "include" ] + lib_dirs = [ rebase_path("Lib/GCC") ] + libs = [ "arm_cortexM4lf_math" ] +} + +kernel_module("cmsis_dsp") { +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/Lib/GCC/libarm_cortexM4lf_math.a b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/Lib/GCC/libarm_cortexM4lf_math.a new file mode 100644 index 0000000..101d668 Binary files /dev/null and b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/Lib/GCC/libarm_cortexM4lf_math.a differ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_common_tables.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_common_tables.h new file mode 100644 index 0000000..721b18d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_common_tables.h @@ -0,0 +1,517 @@ +/* ---------------------------------------------------------------------- + * Project: CMSIS DSP Library + * Title: arm_common_tables.h + * Description: Extern declaration for common tables + * + * $Date: 27. January 2017 + * $Revision: V.1.5.1 + * + * Target Processor: Cortex-M cores + * -------------------------------------------------------------------- */ +/* + * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ARM_COMMON_TABLES_H +#define _ARM_COMMON_TABLES_H + +#include "arm_math.h" + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) + /* Double Precision Float CFFT twiddles */ + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREV_1024) + extern const uint16_t armBitRevTable[1024]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_16) + extern const uint64_t twiddleCoefF64_16[32]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_32) + extern const uint64_t twiddleCoefF64_32[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_64) + extern const uint64_t twiddleCoefF64_64[128]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_128) + extern const uint64_t twiddleCoefF64_128[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_256) + extern const uint64_t twiddleCoefF64_256[512]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_512) + extern const uint64_t twiddleCoefF64_512[1024]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_1024) + extern const uint64_t twiddleCoefF64_1024[2048]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_2048) + extern const uint64_t twiddleCoefF64_2048[4096]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F64_4096) + extern const uint64_t twiddleCoefF64_4096[8192]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_16) + extern const float32_t twiddleCoef_16[32]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_32) + extern const float32_t twiddleCoef_32[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_64) + extern const float32_t twiddleCoef_64[128]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_128) + extern const float32_t twiddleCoef_128[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_256) + extern const float32_t twiddleCoef_256[512]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_512) + extern const float32_t twiddleCoef_512[1024]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_1024) + extern const float32_t twiddleCoef_1024[2048]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_2048) + extern const float32_t twiddleCoef_2048[4096]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_4096) + extern const float32_t twiddleCoef_4096[8192]; + #define twiddleCoef twiddleCoef_4096 + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_16) + extern const q31_t twiddleCoef_16_q31[24]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_32) + extern const q31_t twiddleCoef_32_q31[48]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_64) + extern const q31_t twiddleCoef_64_q31[96]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_128) + extern const q31_t twiddleCoef_128_q31[192]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_256) + extern const q31_t twiddleCoef_256_q31[384]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_512) + extern const q31_t twiddleCoef_512_q31[768]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_1024) + extern const q31_t twiddleCoef_1024_q31[1536]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_2048) + extern const q31_t twiddleCoef_2048_q31[3072]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_4096) + extern const q31_t twiddleCoef_4096_q31[6144]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_16) + extern const q15_t twiddleCoef_16_q15[24]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_32) + extern const q15_t twiddleCoef_32_q15[48]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_64) + extern const q15_t twiddleCoef_64_q15[96]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_128) + extern const q15_t twiddleCoef_128_q15[192]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_256) + extern const q15_t twiddleCoef_256_q15[384]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_512) + extern const q15_t twiddleCoef_512_q15[768]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_1024) + extern const q15_t twiddleCoef_1024_q15[1536]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_2048) + extern const q15_t twiddleCoef_2048_q15[3072]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_4096) + extern const q15_t twiddleCoef_4096_q15[6144]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + /* Double Precision Float RFFT twiddles */ + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_32) + extern const uint64_t twiddleCoefF64_rfft_32[32]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_64) + extern const uint64_t twiddleCoefF64_rfft_64[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_128) + extern const uint64_t twiddleCoefF64_rfft_128[128]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_256) + extern const uint64_t twiddleCoefF64_rfft_256[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_512) + extern const uint64_t twiddleCoefF64_rfft_512[512]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_1024) + extern const uint64_t twiddleCoefF64_rfft_1024[1024]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_2048) + extern const uint64_t twiddleCoefF64_rfft_2048[2048]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F64_4096) + extern const uint64_t twiddleCoefF64_rfft_4096[4096]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_32) + extern const float32_t twiddleCoef_rfft_32[32]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_64) + extern const float32_t twiddleCoef_rfft_64[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_128) + extern const float32_t twiddleCoef_rfft_128[128]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_256) + extern const float32_t twiddleCoef_rfft_256[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_512) + extern const float32_t twiddleCoef_rfft_512[512]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_1024) + extern const float32_t twiddleCoef_rfft_1024[1024]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_2048) + extern const float32_t twiddleCoef_rfft_2048[2048]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_RFFT_F32_4096) + extern const float32_t twiddleCoef_rfft_4096[4096]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + + /* Double precision floating-point bit reversal tables */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_16) + #define ARMBITREVINDEXTABLEF64_16_TABLE_LENGTH ((uint16_t)12) + extern const uint16_t armBitRevIndexTableF64_16[ARMBITREVINDEXTABLEF64_16_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_32) + #define ARMBITREVINDEXTABLEF64_32_TABLE_LENGTH ((uint16_t)24) + extern const uint16_t armBitRevIndexTableF64_32[ARMBITREVINDEXTABLEF64_32_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_64) + #define ARMBITREVINDEXTABLEF64_64_TABLE_LENGTH ((uint16_t)56) + extern const uint16_t armBitRevIndexTableF64_64[ARMBITREVINDEXTABLEF64_64_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_128) + #define ARMBITREVINDEXTABLEF64_128_TABLE_LENGTH ((uint16_t)112) + extern const uint16_t armBitRevIndexTableF64_128[ARMBITREVINDEXTABLEF64_128_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_256) + #define ARMBITREVINDEXTABLEF64_256_TABLE_LENGTH ((uint16_t)240) + extern const uint16_t armBitRevIndexTableF64_256[ARMBITREVINDEXTABLEF64_256_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_512) + #define ARMBITREVINDEXTABLEF64_512_TABLE_LENGTH ((uint16_t)480) + extern const uint16_t armBitRevIndexTableF64_512[ARMBITREVINDEXTABLEF64_512_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_1024) + #define ARMBITREVINDEXTABLEF64_1024_TABLE_LENGTH ((uint16_t)992) + extern const uint16_t armBitRevIndexTableF64_1024[ARMBITREVINDEXTABLEF64_1024_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_2048) + #define ARMBITREVINDEXTABLEF64_2048_TABLE_LENGTH ((uint16_t)1984) + extern const uint16_t armBitRevIndexTableF64_2048[ARMBITREVINDEXTABLEF64_2048_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT64_4096) + #define ARMBITREVINDEXTABLEF64_4096_TABLE_LENGTH ((uint16_t)4032) + extern const uint16_t armBitRevIndexTableF64_4096[ARMBITREVINDEXTABLEF64_4096_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + /* floating-point bit reversal tables */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_16) + #define ARMBITREVINDEXTABLE_16_TABLE_LENGTH ((uint16_t)20) + extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE_16_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_32) + #define ARMBITREVINDEXTABLE_32_TABLE_LENGTH ((uint16_t)48) + extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE_32_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_64) + #define ARMBITREVINDEXTABLE_64_TABLE_LENGTH ((uint16_t)56) + extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE_64_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_128) + #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208) + extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_256) + #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440) + extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_512) + #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448) + extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_1024) + #define ARMBITREVINDEXTABLE_1024_TABLE_LENGTH ((uint16_t)1800) + extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE_1024_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_2048) + #define ARMBITREVINDEXTABLE_2048_TABLE_LENGTH ((uint16_t)3808) + extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE_2048_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FLT_4096) + #define ARMBITREVINDEXTABLE_4096_TABLE_LENGTH ((uint16_t)4032) + extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE_4096_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + + /* fixed-point bit reversal tables */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_16) + #define ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH ((uint16_t)12) + extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_32) + #define ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH ((uint16_t)24) + extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_64) + #define ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH ((uint16_t)56) + extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_128) + #define ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH ((uint16_t)112) + extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_256) + #define ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH ((uint16_t)240) + extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_512) + #define ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH ((uint16_t)480) + extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_1024) + #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992) + extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_2048) + #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) + extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_BITREVIDX_FXT_4096) + #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) + extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_F32) + extern const float32_t realCoefA[8192]; + extern const float32_t realCoefB[8192]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_Q31) + extern const q31_t realCoefAQ31[8192]; + extern const q31_t realCoefBQ31[8192]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_REALCOEF_Q15) + extern const q15_t realCoefAQ15[8192]; + extern const q15_t realCoefBQ15[8192]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_128) + extern const float32_t Weights_128[256]; + extern const float32_t cos_factors_128[128]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_512) + extern const float32_t Weights_512[1024]; + extern const float32_t cos_factors_512[512]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_2048) + extern const float32_t Weights_2048[4096]; + extern const float32_t cos_factors_2048[2048]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_F32_8192) + extern const float32_t Weights_8192[16384]; + extern const float32_t cos_factors_8192[8192]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_128) + extern const q15_t WeightsQ15_128[256]; + extern const q15_t cos_factorsQ15_128[128]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_512) + extern const q15_t WeightsQ15_512[1024]; + extern const q15_t cos_factorsQ15_512[512]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_2048) + extern const q15_t WeightsQ15_2048[4096]; + extern const q15_t cos_factorsQ15_2048[2048]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q15_8192) + extern const q15_t WeightsQ15_8192[16384]; + extern const q15_t cos_factorsQ15_8192[8192]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_128) + extern const q31_t WeightsQ31_128[256]; + extern const q31_t cos_factorsQ31_128[128]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_512) + extern const q31_t WeightsQ31_512[1024]; + extern const q31_t cos_factorsQ31_512[512]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_2048) + extern const q31_t WeightsQ31_2048[4096]; + extern const q31_t cos_factorsQ31_2048[2048]; + #endif + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_DCT4_Q31_8192) + extern const q31_t WeightsQ31_8192[16384]; + extern const q31_t cos_factorsQ31_8192[8192]; + #endif + +#endif /* if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_TABLES) */ + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_ALLOW_TABLES) + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_RECIP_Q15) + extern const q15_t armRecipTableQ15[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_RECIP_Q31) + extern const q31_t armRecipTableQ31[64]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + + /* Tables for Fast Math Sine and Cosine */ + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_F32) + extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q31) + extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_SIN_Q15) + extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + + #if defined(ARM_MATH_MVEI) + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_FAST_SQRT_Q31_MVE) + extern const q31_t sqrtTable_Q31[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + #endif + + #if defined(ARM_MATH_MVEI) + #if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FAST_TABLES) || defined(ARM_TABLE_FAST_SQRT_Q15_MVE) + extern const q15_t sqrtTable_Q15[256]; + #endif /* !defined(ARM_DSP_CONFIG_TABLES) defined(ARM_ALL_FAST_TABLES) */ + #endif + +#endif /* if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FAST_TABLES) */ + +#if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE) + extern const float32_t exp_tab[8]; + extern const float32_t __logf_lut_f32[8]; +#endif /* (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE) */ + +#if (defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) +extern const unsigned char hwLUT[256]; +#endif /* (defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) */ + +#endif /* ARM_COMMON_TABLES_H */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_const_structs.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_const_structs.h new file mode 100644 index 0000000..83984c4 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_const_structs.h @@ -0,0 +1,76 @@ +/* ---------------------------------------------------------------------- + * Project: CMSIS DSP Library + * Title: arm_const_structs.h + * Description: Constant structs that are initialized for user convenience. + * For example, some can be given as arguments to the arm_cfft_f32() function. + * + * $Date: 27. January 2017 + * $Revision: V.1.5.1 + * + * Target Processor: Cortex-M cores + * -------------------------------------------------------------------- */ +/* + * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ARM_CONST_STRUCTS_H +#define _ARM_CONST_STRUCTS_H + +#include "arm_math.h" +#include "arm_common_tables.h" + + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len16; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len32; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len64; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len128; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len256; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len512; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len1024; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len2048; + extern const arm_cfft_instance_f64 arm_cfft_sR_f64_len4096; + + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; + extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; + + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; + extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; + + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; + extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_math.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_math.h new file mode 100644 index 0000000..48bee62 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_math.h @@ -0,0 +1,8970 @@ +/****************************************************************************** + * @file arm_math.h + * @brief Public header file for CMSIS DSP Library + * @version V1.7.0 + * @date 18. March 2019 + ******************************************************************************/ +/* + * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + \mainpage CMSIS DSP Software Library + * + * Introduction + * ------------ + * + * This user manual describes the CMSIS DSP software library, + * a suite of common signal processing functions for use on Cortex-M and Cortex-A processor + * based devices. + * + * The library is divided into a number of functions each covering a specific category: + * - Basic math functions + * - Fast math functions + * - Complex math functions + * - Filtering functions + * - Matrix functions + * - Transform functions + * - Motor control functions + * - Statistical functions + * - Support functions + * - Interpolation functions + * - Support Vector Machine functions (SVM) + * - Bayes classifier functions + * - Distance functions + * + * The library has generally separate functions for operating on 8-bit integers, 16-bit integers, + * 32-bit integer and 32-bit floating-point values. + * + * Using the Library + * ------------ + * + * The library installer contains prebuilt versions of the libraries in the Lib folder. + * + * Here is the list of pre-built libraries : + * - arm_cortexM7lfdp_math.lib (Cortex-M7, Little endian, Double Precision Floating Point Unit) + * - arm_cortexM7bfdp_math.lib (Cortex-M7, Big endian, Double Precision Floating Point Unit) + * - arm_cortexM7lfsp_math.lib (Cortex-M7, Little endian, Single Precision Floating Point Unit) + * - arm_cortexM7bfsp_math.lib (Cortex-M7, Big endian and Single Precision Floating Point Unit on) + * - arm_cortexM7l_math.lib (Cortex-M7, Little endian) + * - arm_cortexM7b_math.lib (Cortex-M7, Big endian) + * - arm_cortexM4lf_math.lib (Cortex-M4, Little endian, Floating Point Unit) + * - arm_cortexM4bf_math.lib (Cortex-M4, Big endian, Floating Point Unit) + * - arm_cortexM4l_math.lib (Cortex-M4, Little endian) + * - arm_cortexM4b_math.lib (Cortex-M4, Big endian) + * - arm_cortexM3l_math.lib (Cortex-M3, Little endian) + * - arm_cortexM3b_math.lib (Cortex-M3, Big endian) + * - arm_cortexM0l_math.lib (Cortex-M0 / Cortex-M0+, Little endian) + * - arm_cortexM0b_math.lib (Cortex-M0 / Cortex-M0+, Big endian) + * - arm_ARMv8MBLl_math.lib (Armv8-M Baseline, Little endian) + * - arm_ARMv8MMLl_math.lib (Armv8-M Mainline, Little endian) + * - arm_ARMv8MMLlfsp_math.lib (Armv8-M Mainline, Little endian, Single Precision Floating Point Unit) + * - arm_ARMv8MMLld_math.lib (Armv8-M Mainline, Little endian, DSP instructions) + * - arm_ARMv8MMLldfsp_math.lib (Armv8-M Mainline, Little endian, DSP instructions, Single Precision Floating Point Unit) + * + * The library functions are declared in the public file arm_math.h which is placed in the Include folder. + * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single + * public header file arm_math.h for Cortex-M cores with little endian and big endian. Same header file will be used for floating point unit(FPU) variants. + * + * + * Examples + * -------- + * + * The library ships with a number of examples which demonstrate how to use the library functions. + * + * Toolchain Support + * ------------ + * + * The library is now tested on Fast Models building with cmake. + * Core M0, M7, A5 are tested. + * + * + * + * Building the Library + * ------------ + * + * The library installer contains a project file to rebuild libraries on MDK toolchain in the CMSIS\\DSP\\Projects\\ARM folder. + * - arm_cortexM_math.uvprojx + * + * + * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional preprocessor macros detailed above. + * + * There is also a work in progress cmake build. The README file is giving more details. + * + * Preprocessor Macros + * ------------ + * + * Each library project have different preprocessor macros. + * + * - ARM_MATH_BIG_ENDIAN: + * + * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. + * + * - ARM_MATH_MATRIX_CHECK: + * + * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices + * + * - ARM_MATH_ROUNDING: + * + * Define macro ARM_MATH_ROUNDING for rounding on support functions + * + * - ARM_MATH_LOOPUNROLL: + * + * Define macro ARM_MATH_LOOPUNROLL to enable manual loop unrolling in DSP functions + * + * - ARM_MATH_NEON: + * + * Define macro ARM_MATH_NEON to enable Neon versions of the DSP functions. + * It is not enabled by default when Neon is available because performances are + * dependent on the compiler and target architecture. + * + * - ARM_MATH_NEON_EXPERIMENTAL: + * + * Define macro ARM_MATH_NEON_EXPERIMENTAL to enable experimental Neon versions of + * of some DSP functions. Experimental Neon versions currently do not have better + * performances than the scalar versions. + * + * - ARM_MATH_HELIUM: + * + * It implies the flags ARM_MATH_MVEF and ARM_MATH_MVEI and ARM_MATH_FLOAT16. + * + * - ARM_MATH_MVEF: + * + * Select Helium versions of the f32 algorithms. + * It implies ARM_MATH_FLOAT16 and ARM_MATH_MVEI. + * + * - ARM_MATH_MVEI: + * + * Select Helium versions of the int and fixed point algorithms. + * + * - ARM_MATH_FLOAT16: + * + * Float16 implementations of some algorithms (Requires MVE extension). + * + *
+ * CMSIS-DSP in ARM::CMSIS Pack + * ----------------------------- + * + * The following files relevant to CMSIS-DSP are present in the ARM::CMSIS Pack directories: + * |File/Folder |Content | + * |---------------------------------|------------------------------------------------------------------------| + * |\b CMSIS\\Documentation\\DSP | This documentation | + * |\b CMSIS\\DSP\\DSP_Lib_TestSuite | DSP_Lib test suite | + * |\b CMSIS\\DSP\\Examples | Example projects demonstrating the usage of the library functions | + * |\b CMSIS\\DSP\\Include | DSP_Lib include files | + * |\b CMSIS\\DSP\\Lib | DSP_Lib binaries | + * |\b CMSIS\\DSP\\Projects | Projects to rebuild DSP_Lib binaries | + * |\b CMSIS\\DSP\\Source | DSP_Lib source files | + * + *
+ * Revision History of CMSIS-DSP + * ------------ + * Please refer to \ref ChangeLog_pg. + */ + + +/** + * @defgroup groupMath Basic Math Functions + */ + +/** + * @defgroup groupFastMath Fast Math Functions + * This set of functions provides a fast approximation to sine, cosine, and square root. + * As compared to most of the other functions in the CMSIS math library, the fast math functions + * operate on individual values and not arrays. + * There are separate functions for Q15, Q31, and floating-point data. + * + */ + +/** + * @defgroup groupCmplxMath Complex Math Functions + * This set of functions operates on complex data vectors. + * The data in the complex arrays is stored in an interleaved fashion + * (real, imag, real, imag, ...). + * In the API functions, the number of samples in a complex array refers + * to the number of complex values; the array contains twice this number of + * real values. + */ + +/** + * @defgroup groupFilters Filtering Functions + */ + +/** + * @defgroup groupMatrix Matrix Functions + * + * This set of functions provides basic matrix math operations. + * The functions operate on matrix data structures. For example, + * the type + * definition for the floating-point matrix structure is shown + * below: + *
+ *     typedef struct
+ *     {
+ *       uint16_t numRows;     // number of rows of the matrix.
+ *       uint16_t numCols;     // number of columns of the matrix.
+ *       float32_t *pData;     // points to the data of the matrix.
+ *     } arm_matrix_instance_f32;
+ * 
+ * There are similar definitions for Q15 and Q31 data types. + * + * The structure specifies the size of the matrix and then points to + * an array of data. The array is of size numRows X numCols + * and the values are arranged in row order. That is, the + * matrix element (i, j) is stored at: + *
+ *     pData[i*numCols + j]
+ * 
+ * + * \par Init Functions + * There is an associated initialization function for each type of matrix + * data structure. + * The initialization function sets the values of the internal structure fields. + * Refer to \ref arm_mat_init_f32(), \ref arm_mat_init_q31() and \ref arm_mat_init_q15() + * for floating-point, Q31 and Q15 types, respectively. + * + * \par + * Use of the initialization function is optional. However, if initialization function is used + * then the instance structure cannot be placed into a const data section. + * To place the instance structure in a const data + * section, manually initialize the data structure. For example: + *
+ * arm_matrix_instance_f32 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q31 S = {nRows, nColumns, pData};
+ * arm_matrix_instance_q15 S = {nRows, nColumns, pData};
+ * 
+ * where nRows specifies the number of rows, nColumns + * specifies the number of columns, and pData points to the + * data array. + * + * \par Size Checking + * By default all of the matrix functions perform size checking on the input and + * output matrices. For example, the matrix addition function verifies that the + * two input matrices and the output matrix all have the same number of rows and + * columns. If the size check fails the functions return: + *
+ *     ARM_MATH_SIZE_MISMATCH
+ * 
+ * Otherwise the functions return + *
+ *     ARM_MATH_SUCCESS
+ * 
+ * There is some overhead associated with this matrix size checking. + * The matrix size checking is enabled via the \#define + *
+ *     ARM_MATH_MATRIX_CHECK
+ * 
+ * within the library project settings. By default this macro is defined + * and size checking is enabled. By changing the project settings and + * undefining this macro size checking is eliminated and the functions + * run a bit faster. With size checking disabled the functions always + * return ARM_MATH_SUCCESS. + */ + +/** + * @defgroup groupTransforms Transform Functions + */ + +/** + * @defgroup groupController Controller Functions + */ + +/** + * @defgroup groupStats Statistics Functions + */ + +/** + * @defgroup groupSupport Support Functions + */ + +/** + * @defgroup groupInterpolation Interpolation Functions + * These functions perform 1- and 2-dimensional interpolation of data. + * Linear interpolation is used for 1-dimensional data and + * bilinear interpolation is used for 2-dimensional data. + */ + +/** + * @defgroup groupExamples Examples + */ + +/** + * @defgroup groupSVM SVM Functions + * This set of functions is implementing SVM classification on 2 classes. + * The training must be done from scikit-learn. The parameters can be easily + * generated from the scikit-learn object. Some examples are given in + * DSP/Testing/PatternGeneration/SVM.py + * + * If more than 2 classes are needed, the functions in this folder + * will have to be used, as building blocks, to do multi-class classification. + * + * No multi-class classification is provided in this SVM folder. + * + */ + + +/** + * @defgroup groupBayes Bayesian estimators + * + * Implement the naive gaussian Bayes estimator. + * The training must be done from scikit-learn. + * + * The parameters can be easily + * generated from the scikit-learn object. Some examples are given in + * DSP/Testing/PatternGeneration/Bayes.py + */ + +/** + * @defgroup groupDistance Distance functions + * + * Distance functions for use with clustering algorithms. + * There are distance functions for float vectors and boolean vectors. + * + */ + + +#ifndef _ARM_MATH_H +#define _ARM_MATH_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Compiler specific diagnostic adjustment */ +#if defined ( __CC_ARM ) + +#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) + +#elif defined ( __GNUC__ ) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wsign-conversion" + #pragma GCC diagnostic ignored "-Wconversion" + #pragma GCC diagnostic ignored "-Wunused-parameter" + +#elif defined ( __ICCARM__ ) + +#elif defined ( __TI_ARM__ ) + +#elif defined ( __CSMC__ ) + +#elif defined ( __TASKING__ ) + +#elif defined ( _MSC_VER ) + +#else + #error Unknown compiler +#endif + + +/* Included for instrinsics definitions */ +#if defined (_MSC_VER ) +#include +#define __STATIC_FORCEINLINE static __forceinline +#define __STATIC_INLINE static __inline +#define __ALIGNED(x) __declspec(align(x)) + +#elif defined (__GNUC_PYTHON__) +#include +#define __ALIGNED(x) __attribute__((aligned(x))) +#define __STATIC_FORCEINLINE static __attribute__((inline)) +#define __STATIC_INLINE static __attribute__((inline)) +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wattributes" + +#else +#include "cmsis_compiler.h" +#endif + + + +#include +#include +#include +#include + + +#define F64_MAX ((float64_t)DBL_MAX) +#define F32_MAX ((float32_t)FLT_MAX) + +#if defined(ARM_MATH_FLOAT16) +#define F16_MAX ((float16_t)FLT_MAX) +#endif + +#define F64_MIN (-DBL_MAX) +#define F32_MIN (-FLT_MAX) + +#if defined(ARM_MATH_FLOAT16) +#define F16_MIN (-(float16_t)FLT_MAX) +#endif + +#define F64_ABSMAX ((float64_t)DBL_MAX) +#define F32_ABSMAX ((float32_t)FLT_MAX) + +#if defined(ARM_MATH_FLOAT16) +#define F16_ABSMAX ((float16_t)FLT_MAX) +#endif + +#define F64_ABSMIN ((float64_t)0.0) +#define F32_ABSMIN ((float32_t)0.0) + +#if defined(ARM_MATH_FLOAT16) +#define F16_ABSMIN ((float16_t)0.0) +#endif + +#define Q31_MAX ((q31_t)(0x7FFFFFFFL)) +#define Q15_MAX ((q15_t)(0x7FFF)) +#define Q7_MAX ((q7_t)(0x7F)) +#define Q31_MIN ((q31_t)(0x80000000L)) +#define Q15_MIN ((q15_t)(0x8000)) +#define Q7_MIN ((q7_t)(0x80)) + +#define Q31_ABSMAX ((q31_t)(0x7FFFFFFFL)) +#define Q15_ABSMAX ((q15_t)(0x7FFF)) +#define Q7_ABSMAX ((q7_t)(0x7F)) +#define Q31_ABSMIN ((q31_t)0) +#define Q15_ABSMIN ((q15_t)0) +#define Q7_ABSMIN ((q7_t)0) + +/* evaluate ARM DSP feature */ +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + #define ARM_MATH_DSP 1 +#endif + +#if defined(ARM_MATH_NEON) +#include +#endif + +#if defined (ARM_MATH_HELIUM) + #define ARM_MATH_MVEF + #define ARM_MATH_FLOAT16 +#endif + +#if defined (ARM_MATH_MVEF) + #define ARM_MATH_MVEI + #define ARM_MATH_FLOAT16 +#endif + +#if defined (ARM_MATH_HELIUM) || defined(ARM_MATH_MVEF) || defined(ARM_MATH_MVEI) +#include +#endif + + + /** + * @brief Macros required for reciprocal calculation in Normalized LMS + */ + +#define DELTA_Q31 ((q31_t)(0x100)) +#define DELTA_Q15 ((q15_t)0x5) +#define INDEX_MASK 0x0000003F +#ifndef PI + #define PI 3.14159265358979f +#endif + + /** + * @brief Macros required for SINE and COSINE Fast math approximations + */ + +#define FAST_MATH_TABLE_SIZE 512 +#define FAST_MATH_Q31_SHIFT (32 - 10) +#define FAST_MATH_Q15_SHIFT (16 - 10) +#define CONTROLLER_Q31_SHIFT (32 - 9) +#define TABLE_SPACING_Q31 0x400000 +#define TABLE_SPACING_Q15 0x80 + + /** + * @brief Macros required for SINE and COSINE Controller functions + */ + /* 1.31(q31) Fixed value of 2/360 */ + /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ +#define INPUT_SPACING 0xB60B61 + + /** + * @brief Macros for complex numbers + */ + + /* Dimension C vector space */ + #define CMPLX_DIM 2 + + /** + * @brief Error status returned by some functions in the library. + */ + + typedef enum + { + ARM_MATH_SUCCESS = 0, /**< No error */ + ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ + ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ + ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation */ + ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ + ARM_MATH_SINGULAR = -5, /**< Input matrix is singular and cannot be inverted */ + ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ + } arm_status; + + /** + * @brief 8-bit fractional data type in 1.7 format. + */ + typedef int8_t q7_t; + + /** + * @brief 16-bit fractional data type in 1.15 format. + */ + typedef int16_t q15_t; + + /** + * @brief 32-bit fractional data type in 1.31 format. + */ + typedef int32_t q31_t; + + /** + * @brief 64-bit fractional data type in 1.63 format. + */ + typedef int64_t q63_t; + + /** + * @brief 32-bit floating-point type definition. + */ + typedef float float32_t; + + /** + * @brief 64-bit floating-point type definition. + */ + typedef double float64_t; + + /** + * @brief vector types + */ +#if defined(ARM_MATH_NEON) || defined (ARM_MATH_MVEI) + /** + * @brief 64-bit fractional 128-bit vector data type in 1.63 format + */ + typedef int64x2_t q63x2_t; + + /** + * @brief 32-bit fractional 128-bit vector data type in 1.31 format. + */ + typedef int32x4_t q31x4_t; + + /** + * @brief 16-bit fractional 128-bit vector data type with 16-bit alignement in 1.15 format. + */ + typedef __ALIGNED(2) int16x8_t q15x8_t; + + /** + * @brief 8-bit fractional 128-bit vector data type with 8-bit alignement in 1.7 format. + */ + typedef __ALIGNED(1) int8x16_t q7x16_t; + + /** + * @brief 32-bit fractional 128-bit vector pair data type in 1.31 format. + */ + typedef int32x4x2_t q31x4x2_t; + + /** + * @brief 32-bit fractional 128-bit vector quadruplet data type in 1.31 format. + */ + typedef int32x4x4_t q31x4x4_t; + + /** + * @brief 16-bit fractional 128-bit vector pair data type in 1.15 format. + */ + typedef int16x8x2_t q15x8x2_t; + + /** + * @brief 16-bit fractional 128-bit vector quadruplet data type in 1.15 format. + */ + typedef int16x8x4_t q15x8x4_t; + + /** + * @brief 8-bit fractional 128-bit vector pair data type in 1.7 format. + */ + typedef int8x16x2_t q7x16x2_t; + + /** + * @brief 8-bit fractional 128-bit vector quadruplet data type in 1.7 format. + */ + typedef int8x16x4_t q7x16x4_t; + + /** + * @brief 32-bit fractional data type in 9.23 format. + */ + typedef int32_t q23_t; + + /** + * @brief 32-bit fractional 128-bit vector data type in 9.23 format. + */ + typedef int32x4_t q23x4_t; + + /** + * @brief 64-bit status 128-bit vector data type. + */ + typedef int64x2_t status64x2_t; + + /** + * @brief 32-bit status 128-bit vector data type. + */ + typedef int32x4_t status32x4_t; + + /** + * @brief 16-bit status 128-bit vector data type. + */ + typedef int16x8_t status16x8_t; + + /** + * @brief 8-bit status 128-bit vector data type. + */ + typedef int8x16_t status8x16_t; + + +#endif + +#if defined(ARM_MATH_NEON) || defined(ARM_MATH_MVEF) /* floating point vector*/ + /** + * @brief 32-bit floating-point 128-bit vector type + */ + typedef float32x4_t f32x4_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit floating-point 128-bit vector data type + */ + typedef __ALIGNED(2) float16x8_t f16x8_t; +#endif + + /** + * @brief 32-bit floating-point 128-bit vector pair data type + */ + typedef float32x4x2_t f32x4x2_t; + + /** + * @brief 32-bit floating-point 128-bit vector quadruplet data type + */ + typedef float32x4x4_t f32x4x4_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit floating-point 128-bit vector pair data type + */ + typedef float16x8x2_t f16x8x2_t; + + /** + * @brief 16-bit floating-point 128-bit vector quadruplet data type + */ + typedef float16x8x4_t f16x8x4_t; +#endif + + /** + * @brief 32-bit ubiquitous 128-bit vector data type + */ + typedef union _any32x4_t + { + float32x4_t f; + int32x4_t i; + } any32x4_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit ubiquitous 128-bit vector data type + */ + typedef union _any16x8_t + { + float16x8_t f; + int16x8_t i; + } any16x8_t; +#endif + +#endif + +#if defined(ARM_MATH_NEON) + /** + * @brief 32-bit fractional 64-bit vector data type in 1.31 format. + */ + typedef int32x2_t q31x2_t; + + /** + * @brief 16-bit fractional 64-bit vector data type in 1.15 format. + */ + typedef __ALIGNED(2) int16x4_t q15x4_t; + + /** + * @brief 8-bit fractional 64-bit vector data type in 1.7 format. + */ + typedef __ALIGNED(1) int8x8_t q7x8_t; + + /** + * @brief 32-bit float 64-bit vector data type. + */ + typedef float32x2_t f32x2_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit float 64-bit vector data type. + */ + typedef __ALIGNED(2) float16x4_t f16x4_t; +#endif + + /** + * @brief 32-bit floating-point 128-bit vector triplet data type + */ + typedef float32x4x3_t f32x4x3_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit floating-point 128-bit vector triplet data type + */ + typedef float16x8x3_t f16x8x3_t; +#endif + + /** + * @brief 32-bit fractional 128-bit vector triplet data type in 1.31 format + */ + typedef int32x4x3_t q31x4x3_t; + + /** + * @brief 16-bit fractional 128-bit vector triplet data type in 1.15 format + */ + typedef int16x8x3_t q15x8x3_t; + + /** + * @brief 8-bit fractional 128-bit vector triplet data type in 1.7 format + */ + typedef int8x16x3_t q7x16x3_t; + + /** + * @brief 32-bit floating-point 64-bit vector pair data type + */ + typedef float32x2x2_t f32x2x2_t; + + /** + * @brief 32-bit floating-point 64-bit vector triplet data type + */ + typedef float32x2x3_t f32x2x3_t; + + /** + * @brief 32-bit floating-point 64-bit vector quadruplet data type + */ + typedef float32x2x4_t f32x2x4_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit floating-point 64-bit vector pair data type + */ + typedef float16x4x2_t f16x4x2_t; + + /** + * @brief 16-bit floating-point 64-bit vector triplet data type + */ + typedef float16x4x3_t f16x4x3_t; + + /** + * @brief 16-bit floating-point 64-bit vector quadruplet data type + */ + typedef float16x4x4_t f16x4x4_t; +#endif + + /** + * @brief 32-bit fractional 64-bit vector pair data type in 1.31 format + */ + typedef int32x2x2_t q31x2x2_t; + + /** + * @brief 32-bit fractional 64-bit vector triplet data type in 1.31 format + */ + typedef int32x2x3_t q31x2x3_t; + + /** + * @brief 32-bit fractional 64-bit vector quadruplet data type in 1.31 format + */ + typedef int32x4x3_t q31x2x4_t; + + /** + * @brief 16-bit fractional 64-bit vector pair data type in 1.15 format + */ + typedef int16x4x2_t q15x4x2_t; + + /** + * @brief 16-bit fractional 64-bit vector triplet data type in 1.15 format + */ + typedef int16x4x2_t q15x4x3_t; + + /** + * @brief 16-bit fractional 64-bit vector quadruplet data type in 1.15 format + */ + typedef int16x4x3_t q15x4x4_t; + + /** + * @brief 8-bit fractional 64-bit vector pair data type in 1.7 format + */ + typedef int8x8x2_t q7x8x2_t; + + /** + * @brief 8-bit fractional 64-bit vector triplet data type in 1.7 format + */ + typedef int8x8x3_t q7x8x3_t; + + /** + * @brief 8-bit fractional 64-bit vector quadruplet data type in 1.7 format + */ + typedef int8x8x4_t q7x8x4_t; + + /** + * @brief 32-bit ubiquitous 64-bit vector data type + */ + typedef union _any32x2_t + { + float32x2_t f; + int32x2_t i; + } any32x2_t; + +#if defined(ARM_MATH_FLOAT16) + /** + * @brief 16-bit ubiquitous 64-bit vector data type + */ + typedef union _any16x4_t + { + float16x4_t f; + int16x4_t i; + } any16x4_t; +#endif + + /** + * @brief 32-bit status 64-bit vector data type. + */ + typedef int32x4_t status32x2_t; + + /** + * @brief 16-bit status 64-bit vector data type. + */ + typedef int16x8_t status16x4_t; + + /** + * @brief 8-bit status 64-bit vector data type. + */ + typedef int8x16_t status8x8_t; + +#endif + + + +/** + @brief definition to read/write two 16 bit values. + @deprecated + */ +#if defined ( __CC_ARM ) + #define __SIMD32_TYPE int32_t __packed +#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) + #define __SIMD32_TYPE int32_t +#elif defined ( __GNUC__ ) + #define __SIMD32_TYPE int32_t +#elif defined ( __ICCARM__ ) + #define __SIMD32_TYPE int32_t __packed +#elif defined ( __TI_ARM__ ) + #define __SIMD32_TYPE int32_t +#elif defined ( __CSMC__ ) + #define __SIMD32_TYPE int32_t +#elif defined ( __TASKING__ ) + #define __SIMD32_TYPE __un(aligned) int32_t +#elif defined(_MSC_VER ) + #define __SIMD32_TYPE int32_t +#else + #error Unknown compiler +#endif + +#define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) +#define __SIMD32_CONST(addr) ( (__SIMD32_TYPE * ) (addr)) +#define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE * ) (addr)) +#define __SIMD64(addr) (*( int64_t **) & (addr)) + +#define STEP(x) (x) <= 0 ? 0 : 1 +#define SQ(x) ((x) * (x)) + +/* SIMD replacement */ + + +/** + @brief Read 2 Q15 from Q15 pointer. + @param[in] pQ15 points to input value + @return Q31 value + */ +__STATIC_FORCEINLINE q31_t read_q15x2 ( + q15_t * pQ15) +{ + q31_t val; + +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (&val, pQ15, 4); +#else + val = (pQ15[1] << 16) | (pQ15[0] & 0x0FFFF) ; +#endif + + return (val); +} + +/** + @brief Read 2 Q15 from Q15 pointer and increment pointer afterwards. + @param[in] pQ15 points to input value + @return Q31 value + */ +__STATIC_FORCEINLINE q31_t read_q15x2_ia ( + q15_t ** pQ15) +{ + q31_t val; + +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (&val, *pQ15, 4); +#else + val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF); +#endif + + *pQ15 += 2; + return (val); +} + +/** + @brief Read 2 Q15 from Q15 pointer and decrement pointer afterwards. + @param[in] pQ15 points to input value + @return Q31 value + */ +__STATIC_FORCEINLINE q31_t read_q15x2_da ( + q15_t ** pQ15) +{ + q31_t val; + +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (&val, *pQ15, 4); +#else + val = ((*pQ15)[1] << 16) | ((*pQ15)[0] & 0x0FFFF); +#endif + + *pQ15 -= 2; + return (val); +} + +/** + @brief Write 2 Q15 to Q15 pointer and increment pointer afterwards. + @param[in] pQ15 points to input value + @param[in] value Q31 value + @return none + */ +__STATIC_FORCEINLINE void write_q15x2_ia ( + q15_t ** pQ15, + q31_t value) +{ + q31_t val = value; +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (*pQ15, &val, 4); +#else + (*pQ15)[0] = (val & 0x0FFFF); + (*pQ15)[1] = (val >> 16) & 0x0FFFF; +#endif + + *pQ15 += 2; +} + +/** + @brief Write 2 Q15 to Q15 pointer. + @param[in] pQ15 points to input value + @param[in] value Q31 value + @return none + */ +__STATIC_FORCEINLINE void write_q15x2 ( + q15_t * pQ15, + q31_t value) +{ + q31_t val = value; + +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (pQ15, &val, 4); +#else + pQ15[0] = val & 0x0FFFF; + pQ15[1] = val >> 16; +#endif +} + + +/** + @brief Read 4 Q7 from Q7 pointer and increment pointer afterwards. + @param[in] pQ7 points to input value + @return Q31 value + */ +__STATIC_FORCEINLINE q31_t read_q7x4_ia ( + q7_t ** pQ7) +{ + q31_t val; + + +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (&val, *pQ7, 4); +#else + val =(((*pQ7)[3] & 0x0FF) << 24) | (((*pQ7)[2] & 0x0FF) << 16) | (((*pQ7)[1] & 0x0FF) << 8) | ((*pQ7)[0] & 0x0FF); +#endif + + *pQ7 += 4; + + return (val); +} + +/** + @brief Read 4 Q7 from Q7 pointer and decrement pointer afterwards. + @param[in] pQ7 points to input value + @return Q31 value + */ +__STATIC_FORCEINLINE q31_t read_q7x4_da ( + q7_t ** pQ7) +{ + q31_t val; +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (&val, *pQ7, 4); +#else + val = ((((*pQ7)[3]) & 0x0FF) << 24) | ((((*pQ7)[2]) & 0x0FF) << 16) | ((((*pQ7)[1]) & 0x0FF) << 8) | ((*pQ7)[0] & 0x0FF); +#endif + *pQ7 -= 4; + + return (val); +} + +/** + @brief Write 4 Q7 to Q7 pointer and increment pointer afterwards. + @param[in] pQ7 points to input value + @param[in] value Q31 value + @return none + */ +__STATIC_FORCEINLINE void write_q7x4_ia ( + q7_t ** pQ7, + q31_t value) +{ + q31_t val = value; +#ifdef __ARM_FEATURE_UNALIGNED + memcpy (*pQ7, &val, 4); +#else + (*pQ7)[0] = val & 0x0FF; + (*pQ7)[1] = (val >> 8) & 0x0FF; + (*pQ7)[2] = (val >> 16) & 0x0FF; + (*pQ7)[3] = (val >> 24) & 0x0FF; + +#endif + *pQ7 += 4; +} + +/* + +Normally those kind of definitions are in a compiler file +in Core or Core_A. + +But for MSVC compiler it is a bit special. The goal is very specific +to CMSIS-DSP and only to allow the use of this library from other +systems like Python or Matlab. + +MSVC is not going to be used to cross-compile to ARM. So, having a MSVC +compiler file in Core or Core_A would not make sense. + +*/ +#if defined ( _MSC_VER ) || defined(__GNUC_PYTHON__) + __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t data) + { + if (data == 0U) { return 32U; } + + uint32_t count = 0U; + uint32_t mask = 0x80000000U; + + while ((data & mask) == 0U) + { + count += 1U; + mask = mask >> 1U; + } + return count; + } + + __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) + { + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; + } + + __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) + { + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; + } +#endif + +#ifndef ARM_MATH_DSP + /** + * @brief definition to pack two 16 bit values. + */ + #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ + (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) + #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ + (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) +#endif + + /** + * @brief definition to pack four 8 bit values. + */ +#ifndef ARM_MATH_BIG_ENDIAN + #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ + (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ + (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ + (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) +#else + #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ + (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ + (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ + (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) +#endif + + + /** + * @brief Clips Q63 to Q31 values. + */ + __STATIC_FORCEINLINE q31_t clip_q63_to_q31( + q63_t x) + { + return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? + ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; + } + + /** + * @brief Clips Q63 to Q15 values. + */ + __STATIC_FORCEINLINE q15_t clip_q63_to_q15( + q63_t x) + { + return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? + ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); + } + + /** + * @brief Clips Q31 to Q7 values. + */ + __STATIC_FORCEINLINE q7_t clip_q31_to_q7( + q31_t x) + { + return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? + ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; + } + + /** + * @brief Clips Q31 to Q15 values. + */ + __STATIC_FORCEINLINE q15_t clip_q31_to_q15( + q31_t x) + { + return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? + ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; + } + + /** + * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. + */ + __STATIC_FORCEINLINE q63_t mult32x64( + q63_t x, + q31_t y) + { + return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + + (((q63_t) (x >> 32) * y) ) ); + } + + /** + * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. + */ + __STATIC_FORCEINLINE uint32_t arm_recip_q31( + q31_t in, + q31_t * dst, + const q31_t * pRecipTable) + { + q31_t out; + uint32_t tempVal; + uint32_t index, i; + uint32_t signBits; + + if (in > 0) + { + signBits = ((uint32_t) (__CLZ( in) - 1)); + } + else + { + signBits = ((uint32_t) (__CLZ(-in) - 1)); + } + + /* Convert input sample to 1.31 format */ + in = (in << signBits); + + /* calculation of index for initial approximated Val */ + index = (uint32_t)(in >> 24); + index = (index & INDEX_MASK); + + /* 1.31 with exp 1 */ + out = pRecipTable[index]; + + /* calculation of reciprocal value */ + /* running approximation for two iterations */ + for (i = 0U; i < 2U; i++) + { + tempVal = (uint32_t) (((q63_t) in * out) >> 31); + tempVal = 0x7FFFFFFFu - tempVal; + /* 1.31 with exp 1 */ + /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */ + out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30); + } + + /* write output */ + *dst = out; + + /* return num of signbits of out = 1/in value */ + return (signBits + 1U); + } + + + /** + * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. + */ + __STATIC_FORCEINLINE uint32_t arm_recip_q15( + q15_t in, + q15_t * dst, + const q15_t * pRecipTable) + { + q15_t out = 0; + uint32_t tempVal = 0; + uint32_t index = 0, i = 0; + uint32_t signBits = 0; + + if (in > 0) + { + signBits = ((uint32_t)(__CLZ( in) - 17)); + } + else + { + signBits = ((uint32_t)(__CLZ(-in) - 17)); + } + + /* Convert input sample to 1.15 format */ + in = (in << signBits); + + /* calculation of index for initial approximated Val */ + index = (uint32_t)(in >> 8); + index = (index & INDEX_MASK); + + /* 1.15 with exp 1 */ + out = pRecipTable[index]; + + /* calculation of reciprocal value */ + /* running approximation for two iterations */ + for (i = 0U; i < 2U; i++) + { + tempVal = (uint32_t) (((q31_t) in * out) >> 15); + tempVal = 0x7FFFu - tempVal; + /* 1.15 with exp 1 */ + out = (q15_t) (((q31_t) out * tempVal) >> 14); + /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */ + } + + /* write output */ + *dst = out; + + /* return num of signbits of out = 1/in value */ + return (signBits + 1); + } + +/** + * @brief Integer exponentiation + * @param[in] x value + * @param[in] nb integer exponent >= 1 + * @return x^nb + * + */ +__STATIC_INLINE float32_t arm_exponent_f32(float32_t x, int32_t nb) +{ + float32_t r = x; + nb --; + while(nb > 0) + { + r = r * x; + nb--; + } + return(r); +} + +/** + * @brief 64-bit to 32-bit unsigned normalization + * @param[in] in is input unsigned long long value + * @param[out] normalized is the 32-bit normalized value + * @param[out] norm is norm scale + */ +__STATIC_INLINE void arm_norm_64_to_32u(uint64_t in, int32_t * normalized, int32_t *norm) +{ + int32_t n1; + int32_t hi = (int32_t) (in >> 32); + int32_t lo = (int32_t) ((in << 32) >> 32); + + n1 = __CLZ(hi) - 32; + if (!n1) + { + /* + * input fits in 32-bit + */ + n1 = __CLZ(lo); + if (!n1) + { + /* + * MSB set, need to scale down by 1 + */ + *norm = -1; + *normalized = (((uint32_t) lo) >> 1); + } else + { + if (n1 == 32) + { + /* + * input is zero + */ + *norm = 0; + *normalized = 0; + } else + { + /* + * 32-bit normalization + */ + *norm = n1 - 1; + *normalized = lo << *norm; + } + } + } else + { + /* + * input fits in 64-bit + */ + n1 = 1 - n1; + *norm = -n1; + /* + * 64 bit normalization + */ + *normalized = (((uint32_t) lo) >> n1) | (hi << (32 - n1)); + } +} + +__STATIC_INLINE q31_t arm_div_q63_to_q31(q63_t num, q31_t den) +{ + q31_t result; + uint64_t absNum; + int32_t normalized; + int32_t norm; + + /* + * if sum fits in 32bits + * avoid costly 64-bit division + */ + absNum = num > 0 ? num : -num; + arm_norm_64_to_32u(absNum, &normalized, &norm); + if (norm > 0) + /* + * 32-bit division + */ + result = (q31_t) num / den; + else + /* + * 64-bit division + */ + result = (q31_t) (num / den); + + return result; +} + + +/* + * @brief C custom defined intrinsic functions + */ +#if !defined (ARM_MATH_DSP) + + /* + * @brief C custom defined QADD8 + */ + __STATIC_FORCEINLINE uint32_t __QADD8( + uint32_t x, + uint32_t y) + { + q31_t r, s, t, u; + + r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; + s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; + t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; + u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; + + return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); + } + + + /* + * @brief C custom defined QSUB8 + */ + __STATIC_FORCEINLINE uint32_t __QSUB8( + uint32_t x, + uint32_t y) + { + q31_t r, s, t, u; + + r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF; + s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF; + t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF; + u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF; + + return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r ))); + } + + + /* + * @brief C custom defined QADD16 + */ + __STATIC_FORCEINLINE uint32_t __QADD16( + uint32_t x, + uint32_t y) + { +/* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */ + q31_t r = 0, s = 0; + + r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; + s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined SHADD16 + */ + __STATIC_FORCEINLINE uint32_t __SHADD16( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; + s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined QSUB16 + */ + __STATIC_FORCEINLINE uint32_t __QSUB16( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; + s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined SHSUB16 + */ + __STATIC_FORCEINLINE uint32_t __SHSUB16( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; + s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined QASX + */ + __STATIC_FORCEINLINE uint32_t __QASX( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; + s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined SHASX + */ + __STATIC_FORCEINLINE uint32_t __SHASX( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; + s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined QSAX + */ + __STATIC_FORCEINLINE uint32_t __QSAX( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF; + s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined SHSAX + */ + __STATIC_FORCEINLINE uint32_t __SHSAX( + uint32_t x, + uint32_t y) + { + q31_t r, s; + + r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF; + s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF; + + return ((uint32_t)((s << 16) | (r ))); + } + + + /* + * @brief C custom defined SMUSDX + */ + __STATIC_FORCEINLINE uint32_t __SMUSDX( + uint32_t x, + uint32_t y) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - + ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); + } + + /* + * @brief C custom defined SMUADX + */ + __STATIC_FORCEINLINE uint32_t __SMUADX( + uint32_t x, + uint32_t y) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) )); + } + + + /* + * @brief C custom defined QADD + */ + __STATIC_FORCEINLINE int32_t __QADD( + int32_t x, + int32_t y) + { + return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y))); + } + + + /* + * @brief C custom defined QSUB + */ + __STATIC_FORCEINLINE int32_t __QSUB( + int32_t x, + int32_t y) + { + return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y))); + } + + + /* + * @brief C custom defined SMLAD + */ + __STATIC_FORCEINLINE uint32_t __SMLAD( + uint32_t x, + uint32_t y, + uint32_t sum) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + + ( ((q31_t)sum ) ) )); + } + + + /* + * @brief C custom defined SMLADX + */ + __STATIC_FORCEINLINE uint32_t __SMLADX( + uint32_t x, + uint32_t y, + uint32_t sum) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + + ( ((q31_t)sum ) ) )); + } + + + /* + * @brief C custom defined SMLSDX + */ + __STATIC_FORCEINLINE uint32_t __SMLSDX( + uint32_t x, + uint32_t y, + uint32_t sum) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) - + ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + + ( ((q31_t)sum ) ) )); + } + + + /* + * @brief C custom defined SMLALD + */ + __STATIC_FORCEINLINE uint64_t __SMLALD( + uint32_t x, + uint32_t y, + uint64_t sum) + { +/* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */ + return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) + + ( ((q63_t)sum ) ) )); + } + + + /* + * @brief C custom defined SMLALDX + */ + __STATIC_FORCEINLINE uint64_t __SMLALDX( + uint32_t x, + uint32_t y, + uint64_t sum) + { +/* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */ + return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) + + ( ((q63_t)sum ) ) )); + } + + + /* + * @brief C custom defined SMUAD + */ + __STATIC_FORCEINLINE uint32_t __SMUAD( + uint32_t x, + uint32_t y) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) + + ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); + } + + + /* + * @brief C custom defined SMUSD + */ + __STATIC_FORCEINLINE uint32_t __SMUSD( + uint32_t x, + uint32_t y) + { + return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) - + ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) )); + } + + + /* + * @brief C custom defined SXTB16 + */ + __STATIC_FORCEINLINE uint32_t __SXTB16( + uint32_t x) + { + return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) | + ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) )); + } + + /* + * @brief C custom defined SMMLA + */ + __STATIC_FORCEINLINE int32_t __SMMLA( + int32_t x, + int32_t y, + int32_t sum) + { + return (sum + (int32_t) (((int64_t) x * y) >> 32)); + } + +#endif /* !defined (ARM_MATH_DSP) */ + + + /** + * @brief Instance structure for the Q7 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + } arm_fir_instance_q7; + + /** + * @brief Instance structure for the Q15 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + } arm_fir_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + } arm_fir_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of filter coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + } arm_fir_instance_f32; + + /** + * @brief Processing function for the Q7 FIR filter. + * @param[in] S points to an instance of the Q7 FIR filter structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_q7( + const arm_fir_instance_q7 * S, + const q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q7 FIR filter. + * @param[in,out] S points to an instance of the Q7 FIR structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of samples that are processed. + */ + void arm_fir_init_q7( + arm_fir_instance_q7 * S, + uint16_t numTaps, + const q7_t * pCoeffs, + q7_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q15 FIR filter. + * @param[in] S points to an instance of the Q15 FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_q15( + const arm_fir_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the fast Q15 FIR filter (fast version). + * @param[in] S points to an instance of the Q15 FIR filter structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_fast_q15( + const arm_fir_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q15 FIR filter. + * @param[in,out] S points to an instance of the Q15 FIR filter structure. + * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + * @return The function returns either + * ARM_MATH_SUCCESS if initialization was successful or + * ARM_MATH_ARGUMENT_ERROR if numTaps is not a supported value. + */ + arm_status arm_fir_init_q15( + arm_fir_instance_q15 * S, + uint16_t numTaps, + const q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR filter. + * @param[in] S points to an instance of the Q31 FIR filter structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_q31( + const arm_fir_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the fast Q31 FIR filter (fast version). + * @param[in] S points to an instance of the Q31 FIR filter structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_fast_q31( + const arm_fir_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 FIR filter. + * @param[in,out] S points to an instance of the Q31 FIR structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + */ + void arm_fir_init_q31( + arm_fir_instance_q31 * S, + uint16_t numTaps, + const q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + /** + * @brief Processing function for the floating-point FIR filter. + * @param[in] S points to an instance of the floating-point FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_f32( + const arm_fir_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point FIR filter. + * @param[in,out] S points to an instance of the floating-point FIR filter structure. + * @param[in] numTaps Number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of samples that are processed at a time. + */ + void arm_fir_init_f32( + arm_fir_instance_f32 * S, + uint16_t numTaps, + const float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + /** + * @brief Instance structure for the Q15 Biquad cascade filter. + */ + typedef struct + { + int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + const q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ + } arm_biquad_casd_df1_inst_q15; + + /** + * @brief Instance structure for the Q31 Biquad cascade filter. + */ + typedef struct + { + uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + const q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ + } arm_biquad_casd_df1_inst_q31; + + /** + * @brief Instance structure for the floating-point Biquad cascade filter. + */ + typedef struct + { + uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ + const float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_casd_df1_inst_f32; + +#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) + /** + * @brief Instance structure for the modified Biquad coefs required by vectorized code. + */ + typedef struct + { + float32_t coeffs[8][4]; /**< Points to the array of modified coefficients. The array is of length 32. There is one per stage */ + } arm_biquad_mod_coef_f32; +#endif + + /** + * @brief Processing function for the Q15 Biquad cascade filter. + * @param[in] S points to an instance of the Q15 Biquad cascade structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df1_q15( + const arm_biquad_casd_df1_inst_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q15 Biquad cascade filter. + * @param[in,out] S points to an instance of the Q15 Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format + */ + void arm_biquad_cascade_df1_init_q15( + arm_biquad_casd_df1_inst_q15 * S, + uint8_t numStages, + const q15_t * pCoeffs, + q15_t * pState, + int8_t postShift); + + /** + * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. + * @param[in] S points to an instance of the Q15 Biquad cascade structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df1_fast_q15( + const arm_biquad_casd_df1_inst_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 Biquad cascade filter + * @param[in] S points to an instance of the Q31 Biquad cascade structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df1_q31( + const arm_biquad_casd_df1_inst_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. + * @param[in] S points to an instance of the Q31 Biquad cascade structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df1_fast_q31( + const arm_biquad_casd_df1_inst_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the Q31 Biquad cascade filter. + * @param[in,out] S points to an instance of the Q31 Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format + */ + void arm_biquad_cascade_df1_init_q31( + arm_biquad_casd_df1_inst_q31 * S, + uint8_t numStages, + const q31_t * pCoeffs, + q31_t * pState, + int8_t postShift); + + /** + * @brief Processing function for the floating-point Biquad cascade filter. + * @param[in] S points to an instance of the floating-point Biquad cascade structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df1_f32( + const arm_biquad_casd_df1_inst_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point Biquad cascade filter. + * @param[in,out] S points to an instance of the floating-point Biquad cascade structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pCoeffsMod points to the modified filter coefficients (only MVE version). + * @param[in] pState points to the state buffer. + */ +#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) + void arm_biquad_cascade_df1_mve_init_f32( + arm_biquad_casd_df1_inst_f32 * S, + uint8_t numStages, + const float32_t * pCoeffs, + arm_biquad_mod_coef_f32 * pCoeffsMod, + float32_t * pState); +#endif + + void arm_biquad_cascade_df1_init_f32( + arm_biquad_casd_df1_inst_f32 * S, + uint8_t numStages, + const float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Compute the logical bitwise AND of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_and_u16( + const uint16_t * pSrcA, + const uint16_t * pSrcB, + uint16_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise AND of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_and_u32( + const uint32_t * pSrcA, + const uint32_t * pSrcB, + uint32_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise AND of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_and_u8( + const uint8_t * pSrcA, + const uint8_t * pSrcB, + uint8_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise OR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_or_u16( + const uint16_t * pSrcA, + const uint16_t * pSrcB, + uint16_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise OR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_or_u32( + const uint32_t * pSrcA, + const uint32_t * pSrcB, + uint32_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise OR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_or_u8( + const uint8_t * pSrcA, + const uint8_t * pSrcB, + uint8_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise NOT of a fixed-point vector. + * @param[in] pSrc points to input vector + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_not_u16( + const uint16_t * pSrc, + uint16_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise NOT of a fixed-point vector. + * @param[in] pSrc points to input vector + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_not_u32( + const uint32_t * pSrc, + uint32_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise NOT of a fixed-point vector. + * @param[in] pSrc points to input vector + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_not_u8( + const uint8_t * pSrc, + uint8_t * pDst, + uint32_t blockSize); + +/** + * @brief Compute the logical bitwise XOR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_xor_u16( + const uint16_t * pSrcA, + const uint16_t * pSrcB, + uint16_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise XOR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_xor_u32( + const uint32_t * pSrcA, + const uint32_t * pSrcB, + uint32_t * pDst, + uint32_t blockSize); + + /** + * @brief Compute the logical bitwise XOR of two fixed-point vectors. + * @param[in] pSrcA points to input vector A + * @param[in] pSrcB points to input vector B + * @param[out] pDst points to output vector + * @param[in] blockSize number of samples in each vector + * @return none + */ + void arm_xor_u8( + const uint8_t * pSrcA, + const uint8_t * pSrcB, + uint8_t * pDst, + uint32_t blockSize); + + /** + * @brief Struct for specifying sorting algorithm + */ + typedef enum + { + ARM_SORT_BITONIC = 0, + /**< Bitonic sort */ + ARM_SORT_BUBBLE = 1, + /**< Bubble sort */ + ARM_SORT_HEAP = 2, + /**< Heap sort */ + ARM_SORT_INSERTION = 3, + /**< Insertion sort */ + ARM_SORT_QUICK = 4, + /**< Quick sort */ + ARM_SORT_SELECTION = 5 + /**< Selection sort */ + } arm_sort_alg; + + /** + * @brief Struct for specifying sorting algorithm + */ + typedef enum + { + ARM_SORT_DESCENDING = 0, + /**< Descending order (9 to 0) */ + ARM_SORT_ASCENDING = 1 + /**< Ascending order (0 to 9) */ + } arm_sort_dir; + + /** + * @brief Instance structure for the sorting algorithms. + */ + typedef struct + { + arm_sort_alg alg; /**< Sorting algorithm selected */ + arm_sort_dir dir; /**< Sorting order (direction) */ + } arm_sort_instance_f32; + + /** + * @param[in] S points to an instance of the sorting structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_sort_f32( + const arm_sort_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @param[in,out] S points to an instance of the sorting structure. + * @param[in] alg Selected algorithm. + * @param[in] dir Sorting order. + */ + void arm_sort_init_f32( + arm_sort_instance_f32 * S, + arm_sort_alg alg, + arm_sort_dir dir); + + /** + * @brief Instance structure for the sorting algorithms. + */ + typedef struct + { + arm_sort_dir dir; /**< Sorting order (direction) */ + float32_t * buffer; /**< Working buffer */ + } arm_merge_sort_instance_f32; + + /** + * @param[in] S points to an instance of the sorting structure. + * @param[in,out] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_merge_sort_f32( + const arm_merge_sort_instance_f32 * S, + float32_t *pSrc, + float32_t *pDst, + uint32_t blockSize); + + /** + * @param[in,out] S points to an instance of the sorting structure. + * @param[in] dir Sorting order. + * @param[in] buffer Working buffer. + */ + void arm_merge_sort_init_f32( + arm_merge_sort_instance_f32 * S, + arm_sort_dir dir, + float32_t * buffer); + + /** + * @brief Struct for specifying cubic spline type + */ + typedef enum + { + ARM_SPLINE_NATURAL = 0, /**< Natural spline */ + ARM_SPLINE_PARABOLIC_RUNOUT = 1 /**< Parabolic runout spline */ + } arm_spline_type; + + /** + * @brief Instance structure for the floating-point cubic spline interpolation. + */ + typedef struct + { + arm_spline_type type; /**< Type (boundary conditions) */ + const float32_t * x; /**< x values */ + const float32_t * y; /**< y values */ + uint32_t n_x; /**< Number of known data points */ + float32_t * coeffs; /**< Coefficients buffer (b,c, and d) */ + } arm_spline_instance_f32; + + /** + * @brief Processing function for the floating-point cubic spline interpolation. + * @param[in] S points to an instance of the floating-point spline structure. + * @param[in] xq points to the x values ot the interpolated data points. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples of output data. + */ + void arm_spline_f32( + arm_spline_instance_f32 * S, + const float32_t * xq, + float32_t * pDst, + uint32_t blockSize); + + /** + * @brief Initialization function for the floating-point cubic spline interpolation. + * @param[in,out] S points to an instance of the floating-point spline structure. + * @param[in] type type of cubic spline interpolation (boundary conditions) + * @param[in] x points to the x values of the known data points. + * @param[in] y points to the y values of the known data points. + * @param[in] n number of known data points. + * @param[in] coeffs coefficients array for b, c, and d + * @param[in] tempBuffer buffer array for internal computations + */ + void arm_spline_init_f32( + arm_spline_instance_f32 * S, + arm_spline_type type, + const float32_t * x, + const float32_t * y, + uint32_t n, + float32_t * coeffs, + float32_t * tempBuffer); + + /** + * @brief Instance structure for the floating-point matrix structure. + */ + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + float32_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_f32; + + /** + * @brief Instance structure for the floating-point matrix structure. + */ + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + float64_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_f64; + + /** + * @brief Instance structure for the Q15 matrix structure. + */ + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + q15_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_q15; + + /** + * @brief Instance structure for the Q31 matrix structure. + */ + typedef struct + { + uint16_t numRows; /**< number of rows of the matrix. */ + uint16_t numCols; /**< number of columns of the matrix. */ + q31_t *pData; /**< points to the data of the matrix. */ + } arm_matrix_instance_q31; + + /** + * @brief Floating-point matrix addition. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_add_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix addition. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_add_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix addition. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_add_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point, complex, matrix multiplication. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_cmplx_mult_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15, complex, matrix multiplication. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_cmplx_mult_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pScratch); + + /** + * @brief Q31, complex, matrix multiplication. + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_cmplx_mult_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point matrix transpose. + * @param[in] pSrc points to the input matrix + * @param[out] pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_trans_f32( + const arm_matrix_instance_f32 * pSrc, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix transpose. + * @param[in] pSrc points to the input matrix + * @param[out] pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_trans_q15( + const arm_matrix_instance_q15 * pSrc, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix transpose. + * @param[in] pSrc points to the input matrix + * @param[out] pDst points to the output matrix + * @return The function returns either ARM_MATH_SIZE_MISMATCH + * or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_trans_q31( + const arm_matrix_instance_q31 * pSrc, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point matrix multiplication + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_mult_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix multiplication + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @param[in] pState points to the array for storing intermediate results + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_mult_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pState); + + /** + * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @param[in] pState points to the array for storing intermediate results + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_mult_fast_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst, + q15_t * pState); + + /** + * @brief Q31 matrix multiplication + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_mult_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_mult_fast_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point matrix subtraction + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_sub_f32( + const arm_matrix_instance_f32 * pSrcA, + const arm_matrix_instance_f32 * pSrcB, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix subtraction + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_sub_q15( + const arm_matrix_instance_q15 * pSrcA, + const arm_matrix_instance_q15 * pSrcB, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix subtraction + * @param[in] pSrcA points to the first input matrix structure + * @param[in] pSrcB points to the second input matrix structure + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_sub_q31( + const arm_matrix_instance_q31 * pSrcA, + const arm_matrix_instance_q31 * pSrcB, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Floating-point matrix scaling. + * @param[in] pSrc points to the input matrix + * @param[in] scale scale factor + * @param[out] pDst points to the output matrix + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_scale_f32( + const arm_matrix_instance_f32 * pSrc, + float32_t scale, + arm_matrix_instance_f32 * pDst); + + /** + * @brief Q15 matrix scaling. + * @param[in] pSrc points to input matrix + * @param[in] scaleFract fractional portion of the scale factor + * @param[in] shift number of bits to shift the result by + * @param[out] pDst points to output matrix + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_scale_q15( + const arm_matrix_instance_q15 * pSrc, + q15_t scaleFract, + int32_t shift, + arm_matrix_instance_q15 * pDst); + + /** + * @brief Q31 matrix scaling. + * @param[in] pSrc points to input matrix + * @param[in] scaleFract fractional portion of the scale factor + * @param[in] shift number of bits to shift the result by + * @param[out] pDst points to output matrix structure + * @return The function returns either + * ARM_MATH_SIZE_MISMATCH or ARM_MATH_SUCCESS based on the outcome of size checking. + */ +arm_status arm_mat_scale_q31( + const arm_matrix_instance_q31 * pSrc, + q31_t scaleFract, + int32_t shift, + arm_matrix_instance_q31 * pDst); + + /** + * @brief Q31 matrix initialization. + * @param[in,out] S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] pData points to the matrix data array. + */ +void arm_mat_init_q31( + arm_matrix_instance_q31 * S, + uint16_t nRows, + uint16_t nColumns, + q31_t * pData); + + /** + * @brief Q15 matrix initialization. + * @param[in,out] S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] pData points to the matrix data array. + */ +void arm_mat_init_q15( + arm_matrix_instance_q15 * S, + uint16_t nRows, + uint16_t nColumns, + q15_t * pData); + + /** + * @brief Floating-point matrix initialization. + * @param[in,out] S points to an instance of the floating-point matrix structure. + * @param[in] nRows number of rows in the matrix. + * @param[in] nColumns number of columns in the matrix. + * @param[in] pData points to the matrix data array. + */ +void arm_mat_init_f32( + arm_matrix_instance_f32 * S, + uint16_t nRows, + uint16_t nColumns, + float32_t * pData); + + + /** + * @brief Instance structure for the Q15 PID Control. + */ + typedef struct + { + q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ +#if !defined (ARM_MATH_DSP) + q15_t A1; + q15_t A2; +#else + q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ +#endif + q15_t state[3]; /**< The state array of length 3. */ + q15_t Kp; /**< The proportional gain. */ + q15_t Ki; /**< The integral gain. */ + q15_t Kd; /**< The derivative gain. */ + } arm_pid_instance_q15; + + /** + * @brief Instance structure for the Q31 PID Control. + */ + typedef struct + { + q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ + q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ + q31_t A2; /**< The derived gain, A2 = Kd . */ + q31_t state[3]; /**< The state array of length 3. */ + q31_t Kp; /**< The proportional gain. */ + q31_t Ki; /**< The integral gain. */ + q31_t Kd; /**< The derivative gain. */ + } arm_pid_instance_q31; + + /** + * @brief Instance structure for the floating-point PID Control. + */ + typedef struct + { + float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ + float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ + float32_t A2; /**< The derived gain, A2 = Kd . */ + float32_t state[3]; /**< The state array of length 3. */ + float32_t Kp; /**< The proportional gain. */ + float32_t Ki; /**< The integral gain. */ + float32_t Kd; /**< The derivative gain. */ + } arm_pid_instance_f32; + + + + /** + * @brief Initialization function for the floating-point PID Control. + * @param[in,out] S points to an instance of the PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + */ + void arm_pid_init_f32( + arm_pid_instance_f32 * S, + int32_t resetStateFlag); + + + /** + * @brief Reset function for the floating-point PID Control. + * @param[in,out] S is an instance of the floating-point PID Control structure + */ + void arm_pid_reset_f32( + arm_pid_instance_f32 * S); + + + /** + * @brief Initialization function for the Q31 PID Control. + * @param[in,out] S points to an instance of the Q15 PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + */ + void arm_pid_init_q31( + arm_pid_instance_q31 * S, + int32_t resetStateFlag); + + + /** + * @brief Reset function for the Q31 PID Control. + * @param[in,out] S points to an instance of the Q31 PID Control structure + */ + + void arm_pid_reset_q31( + arm_pid_instance_q31 * S); + + + /** + * @brief Initialization function for the Q15 PID Control. + * @param[in,out] S points to an instance of the Q15 PID structure. + * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. + */ + void arm_pid_init_q15( + arm_pid_instance_q15 * S, + int32_t resetStateFlag); + + + /** + * @brief Reset function for the Q15 PID Control. + * @param[in,out] S points to an instance of the q15 PID Control structure + */ + void arm_pid_reset_q15( + arm_pid_instance_q15 * S); + + + /** + * @brief Instance structure for the floating-point Linear Interpolate function. + */ + typedef struct + { + uint32_t nValues; /**< nValues */ + float32_t x1; /**< x1 */ + float32_t xSpacing; /**< xSpacing */ + float32_t *pYData; /**< pointer to the table of Y values */ + } arm_linear_interp_instance_f32; + + /** + * @brief Instance structure for the floating-point bilinear interpolation function. + */ + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + float32_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_f32; + + /** + * @brief Instance structure for the Q31 bilinear interpolation function. + */ + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q31_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q31; + + /** + * @brief Instance structure for the Q15 bilinear interpolation function. + */ + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q15_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q15; + + /** + * @brief Instance structure for the Q15 bilinear interpolation function. + */ + typedef struct + { + uint16_t numRows; /**< number of rows in the data table. */ + uint16_t numCols; /**< number of columns in the data table. */ + q7_t *pData; /**< points to the data table. */ + } arm_bilinear_interp_instance_q7; + + + /** + * @brief Q7 vector multiplication. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_mult_q7( + const q7_t * pSrcA, + const q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q15 vector multiplication. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_mult_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q31 vector multiplication. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_mult_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Floating-point vector multiplication. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_mult_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q15 CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix2_instance_q15; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_q15( + arm_cfft_radix2_instance_q15 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_q15( + const arm_cfft_radix2_instance_q15 * S, + q15_t * pSrc); + + + /** + * @brief Instance structure for the Q15 CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const q15_t *pTwiddle; /**< points to the twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix4_instance_q15; + +/* Deprecated */ + arm_status arm_cfft_radix4_init_q15( + arm_cfft_radix4_instance_q15 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix4_q15( + const arm_cfft_radix4_instance_q15 * S, + q15_t * pSrc); + + /** + * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix2_instance_q31; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_q31( + arm_cfft_radix2_instance_q31 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_q31( + const arm_cfft_radix2_instance_q31 * S, + q31_t * pSrc); + + /** + * @brief Instance structure for the Q31 CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const q31_t *pTwiddle; /**< points to the twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + } arm_cfft_radix4_instance_q31; + +/* Deprecated */ + void arm_cfft_radix4_q31( + const arm_cfft_radix4_instance_q31 * S, + q31_t * pSrc); + +/* Deprecated */ + arm_status arm_cfft_radix4_init_q31( + arm_cfft_radix4_instance_q31 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + float32_t onebyfftLen; /**< value of 1/fftLen. */ + } arm_cfft_radix2_instance_f32; + +/* Deprecated */ + arm_status arm_cfft_radix2_init_f32( + arm_cfft_radix2_instance_f32 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix2_f32( + const arm_cfft_radix2_instance_f32 * S, + float32_t * pSrc); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ + uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ + const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ + float32_t onebyfftLen; /**< value of 1/fftLen. */ + } arm_cfft_radix4_instance_f32; + +/* Deprecated */ + arm_status arm_cfft_radix4_init_f32( + arm_cfft_radix4_instance_f32 * S, + uint16_t fftLen, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + +/* Deprecated */ + void arm_cfft_radix4_f32( + const arm_cfft_radix4_instance_f32 * S, + float32_t * pSrc); + + /** + * @brief Instance structure for the fixed-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ +#if defined(ARM_MATH_MVEI) + const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ + const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ + const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ + const q15_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ + const q15_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ + const q15_t *rearranged_twiddle_stride3; +#endif + } arm_cfft_instance_q15; + +arm_status arm_cfft_init_q15( + arm_cfft_instance_q15 * S, + uint16_t fftLen); + +void arm_cfft_q15( + const arm_cfft_instance_q15 * S, + q15_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the fixed-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ +#if defined(ARM_MATH_MVEI) + const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ + const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ + const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ + const q31_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ + const q31_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ + const q31_t *rearranged_twiddle_stride3; +#endif + } arm_cfft_instance_q31; + +arm_status arm_cfft_init_q31( + arm_cfft_instance_q31 * S, + uint16_t fftLen); + +void arm_cfft_q31( + const arm_cfft_instance_q31 * S, + q31_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the floating-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ +#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) + const uint32_t *rearranged_twiddle_tab_stride1_arr; /**< Per stage reordered twiddle pointer (offset 1) */ \ + const uint32_t *rearranged_twiddle_tab_stride2_arr; /**< Per stage reordered twiddle pointer (offset 2) */ \ + const uint32_t *rearranged_twiddle_tab_stride3_arr; /**< Per stage reordered twiddle pointer (offset 3) */ \ + const float32_t *rearranged_twiddle_stride1; /**< reordered twiddle offset 1 storage */ \ + const float32_t *rearranged_twiddle_stride2; /**< reordered twiddle offset 2 storage */ \ + const float32_t *rearranged_twiddle_stride3; +#endif + } arm_cfft_instance_f32; + + + arm_status arm_cfft_init_f32( + arm_cfft_instance_f32 * S, + uint16_t fftLen); + + void arm_cfft_f32( + const arm_cfft_instance_f32 * S, + float32_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + + /** + * @brief Instance structure for the Double Precision Floating-point CFFT/CIFFT function. + */ + typedef struct + { + uint16_t fftLen; /**< length of the FFT. */ + const float64_t *pTwiddle; /**< points to the Twiddle factor table. */ + const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ + uint16_t bitRevLength; /**< bit reversal table length. */ + } arm_cfft_instance_f64; + + void arm_cfft_f64( + const arm_cfft_instance_f64 * S, + float64_t * p1, + uint8_t ifftFlag, + uint8_t bitReverseFlag); + + /** + * @brief Instance structure for the Q15 RFFT/RIFFT function. + */ + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + const q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + const q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ +#if defined(ARM_MATH_MVEI) + arm_cfft_instance_q15 cfftInst; +#else + const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ +#endif + } arm_rfft_instance_q15; + + arm_status arm_rfft_init_q15( + arm_rfft_instance_q15 * S, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_q15( + const arm_rfft_instance_q15 * S, + q15_t * pSrc, + q15_t * pDst); + + /** + * @brief Instance structure for the Q31 RFFT/RIFFT function. + */ + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + const q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + const q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ +#if defined(ARM_MATH_MVEI) + arm_cfft_instance_q31 cfftInst; +#else + const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ +#endif + } arm_rfft_instance_q31; + + arm_status arm_rfft_init_q31( + arm_rfft_instance_q31 * S, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_q31( + const arm_rfft_instance_q31 * S, + q31_t * pSrc, + q31_t * pDst); + + /** + * @brief Instance structure for the floating-point RFFT/RIFFT function. + */ + typedef struct + { + uint32_t fftLenReal; /**< length of the real FFT. */ + uint16_t fftLenBy2; /**< length of the complex FFT. */ + uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ + uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ + uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ + const float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ + const float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ + arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ + } arm_rfft_instance_f32; + + arm_status arm_rfft_init_f32( + arm_rfft_instance_f32 * S, + arm_cfft_radix4_instance_f32 * S_CFFT, + uint32_t fftLenReal, + uint32_t ifftFlagR, + uint32_t bitReverseFlag); + + void arm_rfft_f32( + const arm_rfft_instance_f32 * S, + float32_t * pSrc, + float32_t * pDst); + + /** + * @brief Instance structure for the Double Precision Floating-point RFFT/RIFFT function. + */ +typedef struct + { + arm_cfft_instance_f64 Sint; /**< Internal CFFT structure. */ + uint16_t fftLenRFFT; /**< length of the real sequence */ + const float64_t * pTwiddleRFFT; /**< Twiddle factors real stage */ + } arm_rfft_fast_instance_f64 ; + +arm_status arm_rfft_fast_init_f64 ( + arm_rfft_fast_instance_f64 * S, + uint16_t fftLen); + + +void arm_rfft_fast_f64( + arm_rfft_fast_instance_f64 * S, + float64_t * p, float64_t * pOut, + uint8_t ifftFlag); + + + /** + * @brief Instance structure for the floating-point RFFT/RIFFT function. + */ +typedef struct + { + arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ + uint16_t fftLenRFFT; /**< length of the real sequence */ + const float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ + } arm_rfft_fast_instance_f32 ; + +arm_status arm_rfft_fast_init_f32 ( + arm_rfft_fast_instance_f32 * S, + uint16_t fftLen); + + + void arm_rfft_fast_f32( + const arm_rfft_fast_instance_f32 * S, + float32_t * p, float32_t * pOut, + uint8_t ifftFlag); + + /** + * @brief Instance structure for the floating-point DCT4/IDCT4 function. + */ + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + float32_t normalize; /**< normalizing factor. */ + const float32_t *pTwiddle; /**< points to the twiddle factor table. */ + const float32_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_f32; + + + /** + * @brief Initialization function for the floating-point DCT4/IDCT4. + * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure. + * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure. + * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure. + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if fftLenReal is not a supported transform length. + */ + arm_status arm_dct4_init_f32( + arm_dct4_instance_f32 * S, + arm_rfft_instance_f32 * S_RFFT, + arm_cfft_radix4_instance_f32 * S_CFFT, + uint16_t N, + uint16_t Nby2, + float32_t normalize); + + + /** + * @brief Processing function for the floating-point DCT4/IDCT4. + * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure. + * @param[in] pState points to state buffer. + * @param[in,out] pInlineBuffer points to the in-place input and output buffer. + */ + void arm_dct4_f32( + const arm_dct4_instance_f32 * S, + float32_t * pState, + float32_t * pInlineBuffer); + + + /** + * @brief Instance structure for the Q31 DCT4/IDCT4 function. + */ + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + q31_t normalize; /**< normalizing factor. */ + const q31_t *pTwiddle; /**< points to the twiddle factor table. */ + const q31_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_q31; + + + /** + * @brief Initialization function for the Q31 DCT4/IDCT4. + * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure. + * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure + * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. + */ + arm_status arm_dct4_init_q31( + arm_dct4_instance_q31 * S, + arm_rfft_instance_q31 * S_RFFT, + arm_cfft_radix4_instance_q31 * S_CFFT, + uint16_t N, + uint16_t Nby2, + q31_t normalize); + + + /** + * @brief Processing function for the Q31 DCT4/IDCT4. + * @param[in] S points to an instance of the Q31 DCT4 structure. + * @param[in] pState points to state buffer. + * @param[in,out] pInlineBuffer points to the in-place input and output buffer. + */ + void arm_dct4_q31( + const arm_dct4_instance_q31 * S, + q31_t * pState, + q31_t * pInlineBuffer); + + + /** + * @brief Instance structure for the Q15 DCT4/IDCT4 function. + */ + typedef struct + { + uint16_t N; /**< length of the DCT4. */ + uint16_t Nby2; /**< half of the length of the DCT4. */ + q15_t normalize; /**< normalizing factor. */ + const q15_t *pTwiddle; /**< points to the twiddle factor table. */ + const q15_t *pCosFactor; /**< points to the cosFactor table. */ + arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ + arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ + } arm_dct4_instance_q15; + + + /** + * @brief Initialization function for the Q15 DCT4/IDCT4. + * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure. + * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure. + * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure. + * @param[in] N length of the DCT4. + * @param[in] Nby2 half of the length of the DCT4. + * @param[in] normalize normalizing factor. + * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if N is not a supported transform length. + */ + arm_status arm_dct4_init_q15( + arm_dct4_instance_q15 * S, + arm_rfft_instance_q15 * S_RFFT, + arm_cfft_radix4_instance_q15 * S_CFFT, + uint16_t N, + uint16_t Nby2, + q15_t normalize); + + + /** + * @brief Processing function for the Q15 DCT4/IDCT4. + * @param[in] S points to an instance of the Q15 DCT4 structure. + * @param[in] pState points to state buffer. + * @param[in,out] pInlineBuffer points to the in-place input and output buffer. + */ + void arm_dct4_q15( + const arm_dct4_instance_q15 * S, + q15_t * pState, + q15_t * pInlineBuffer); + + + /** + * @brief Floating-point vector addition. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_add_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q7 vector addition. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_add_q7( + const q7_t * pSrcA, + const q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q15 vector addition. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_add_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q31 vector addition. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_add_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Floating-point vector subtraction. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_sub_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q7 vector subtraction. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_sub_q7( + const q7_t * pSrcA, + const q7_t * pSrcB, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q15 vector subtraction. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_sub_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q31 vector subtraction. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in each vector + */ + void arm_sub_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Multiplies a floating-point vector by a scalar. + * @param[in] pSrc points to the input vector + * @param[in] scale scale factor to be applied + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_scale_f32( + const float32_t * pSrc, + float32_t scale, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Multiplies a Q7 vector by a scalar. + * @param[in] pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_scale_q7( + const q7_t * pSrc, + q7_t scaleFract, + int8_t shift, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Multiplies a Q15 vector by a scalar. + * @param[in] pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_scale_q15( + const q15_t * pSrc, + q15_t scaleFract, + int8_t shift, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Multiplies a Q31 vector by a scalar. + * @param[in] pSrc points to the input vector + * @param[in] scaleFract fractional portion of the scale value + * @param[in] shift number of bits to shift the result by + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_scale_q31( + const q31_t * pSrc, + q31_t scaleFract, + int8_t shift, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q7 vector absolute value. + * @param[in] pSrc points to the input buffer + * @param[out] pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + */ + void arm_abs_q7( + const q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Floating-point vector absolute value. + * @param[in] pSrc points to the input buffer + * @param[out] pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + */ + void arm_abs_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q15 vector absolute value. + * @param[in] pSrc points to the input buffer + * @param[out] pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + */ + void arm_abs_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Q31 vector absolute value. + * @param[in] pSrc points to the input buffer + * @param[out] pDst points to the output buffer + * @param[in] blockSize number of samples in each vector + */ + void arm_abs_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Dot product of floating-point vectors. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] result output result returned here + */ + void arm_dot_prod_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + uint32_t blockSize, + float32_t * result); + + + /** + * @brief Dot product of Q7 vectors. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] result output result returned here + */ + void arm_dot_prod_q7( + const q7_t * pSrcA, + const q7_t * pSrcB, + uint32_t blockSize, + q31_t * result); + + + /** + * @brief Dot product of Q15 vectors. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] result output result returned here + */ + void arm_dot_prod_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + uint32_t blockSize, + q63_t * result); + + + /** + * @brief Dot product of Q31 vectors. + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[out] result output result returned here + */ + void arm_dot_prod_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + uint32_t blockSize, + q63_t * result); + + + /** + * @brief Shifts the elements of a Q7 vector a specified number of bits. + * @param[in] pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_shift_q7( + const q7_t * pSrc, + int8_t shiftBits, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Shifts the elements of a Q15 vector a specified number of bits. + * @param[in] pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_shift_q15( + const q15_t * pSrc, + int8_t shiftBits, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Shifts the elements of a Q31 vector a specified number of bits. + * @param[in] pSrc points to the input vector + * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_shift_q31( + const q31_t * pSrc, + int8_t shiftBits, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Adds a constant offset to a floating-point vector. + * @param[in] pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_offset_f32( + const float32_t * pSrc, + float32_t offset, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Adds a constant offset to a Q7 vector. + * @param[in] pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_offset_q7( + const q7_t * pSrc, + q7_t offset, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Adds a constant offset to a Q15 vector. + * @param[in] pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_offset_q15( + const q15_t * pSrc, + q15_t offset, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Adds a constant offset to a Q31 vector. + * @param[in] pSrc points to the input vector + * @param[in] offset is the offset to be added + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_offset_q31( + const q31_t * pSrc, + q31_t offset, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Negates the elements of a floating-point vector. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_negate_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Negates the elements of a Q7 vector. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_negate_q7( + const q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Negates the elements of a Q15 vector. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_negate_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Negates the elements of a Q31 vector. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] blockSize number of samples in the vector + */ + void arm_negate_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Copies the elements of a floating-point vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_copy_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Copies the elements of a Q7 vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_copy_q7( + const q7_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Copies the elements of a Q15 vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_copy_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Copies the elements of a Q31 vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_copy_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Fills a constant value into a floating-point vector. + * @param[in] value input value to be filled + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_fill_f32( + float32_t value, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Fills a constant value into a Q7 vector. + * @param[in] value input value to be filled + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_fill_q7( + q7_t value, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Fills a constant value into a Q15 vector. + * @param[in] value input value to be filled + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_fill_q15( + q15_t value, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Fills a constant value into a Q31 vector. + * @param[in] value input value to be filled + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_fill_q31( + q31_t value, + q31_t * pDst, + uint32_t blockSize); + + +/** + * @brief Convolution of floating-point sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. + */ + void arm_conv_f32( + const float32_t * pSrcA, + uint32_t srcALen, + const float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst); + + + /** + * @brief Convolution of Q15 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + */ + void arm_conv_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + +/** + * @brief Convolution of Q15 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the location where the output result is written. Length srcALen+srcBLen-1. + */ + void arm_conv_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + + /** + * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + */ + void arm_conv_fast_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + + /** + * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + */ + void arm_conv_fast_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Convolution of Q31 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + */ + void arm_conv_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + + /** + * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + */ + void arm_conv_fast_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + + /** + * @brief Convolution of Q7 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + */ + void arm_conv_opt_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Convolution of Q7 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length srcALen+srcBLen-1. + */ + void arm_conv_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst); + + + /** + * @brief Partial convolution of floating-point sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_f32( + const float32_t * pSrcA, + uint32_t srcALen, + const float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q15 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Partial convolution of Q15 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_fast_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_fast_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Partial convolution of Q31 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_fast_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Partial convolution of Q7 sequences + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_opt_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + uint32_t firstIndex, + uint32_t numPoints, + q15_t * pScratch1, + q15_t * pScratch2); + + +/** + * @brief Partial convolution of Q7 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data + * @param[in] firstIndex is the first output sample to start with. + * @param[in] numPoints is the number of output points to be computed. + * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. + */ + arm_status arm_conv_partial_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + uint32_t firstIndex, + uint32_t numPoints); + + + /** + * @brief Instance structure for the Q15 FIR decimator. + */ + typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + } arm_fir_decimate_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR decimator. + */ + typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + } arm_fir_decimate_instance_q31; + +/** + @brief Instance structure for floating-point FIR decimator. + */ +typedef struct + { + uint8_t M; /**< decimation factor. */ + uint16_t numTaps; /**< number of coefficients in the filter. */ + const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + } arm_fir_decimate_instance_f32; + + +/** + @brief Processing function for floating-point FIR decimator. + @param[in] S points to an instance of the floating-point FIR decimator structure + @param[in] pSrc points to the block of input data + @param[out] pDst points to the block of output data + @param[in] blockSize number of samples to process + */ +void arm_fir_decimate_f32( + const arm_fir_decimate_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + +/** + @brief Initialization function for the floating-point FIR decimator. + @param[in,out] S points to an instance of the floating-point FIR decimator structure + @param[in] numTaps number of coefficients in the filter + @param[in] M decimation factor + @param[in] pCoeffs points to the filter coefficients + @param[in] pState points to the state buffer + @param[in] blockSize number of input samples to process per call + @return execution status + - \ref ARM_MATH_SUCCESS : Operation successful + - \ref ARM_MATH_LENGTH_ERROR : blockSize is not a multiple of M + */ +arm_status arm_fir_decimate_init_f32( + arm_fir_decimate_instance_f32 * S, + uint16_t numTaps, + uint8_t M, + const float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 FIR decimator. + * @param[in] S points to an instance of the Q15 FIR decimator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_decimate_q15( + const arm_fir_decimate_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. + * @param[in] S points to an instance of the Q15 FIR decimator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_decimate_fast_q15( + const arm_fir_decimate_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q15 FIR decimator. + * @param[in,out] S points to an instance of the Q15 FIR decimator structure. + * @param[in] numTaps number of coefficients in the filter. + * @param[in] M decimation factor. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * blockSize is not a multiple of M. + */ + arm_status arm_fir_decimate_init_q15( + arm_fir_decimate_instance_q15 * S, + uint16_t numTaps, + uint8_t M, + const q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 FIR decimator. + * @param[in] S points to an instance of the Q31 FIR decimator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_decimate_q31( + const arm_fir_decimate_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + /** + * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. + * @param[in] S points to an instance of the Q31 FIR decimator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_decimate_fast_q31( + const arm_fir_decimate_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 FIR decimator. + * @param[in,out] S points to an instance of the Q31 FIR decimator structure. + * @param[in] numTaps number of coefficients in the filter. + * @param[in] M decimation factor. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * blockSize is not a multiple of M. + */ + arm_status arm_fir_decimate_init_q31( + arm_fir_decimate_instance_q31 * S, + uint16_t numTaps, + uint8_t M, + const q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q15 FIR interpolator. + */ + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ + } arm_fir_interpolate_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR interpolator. + */ + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ + } arm_fir_interpolate_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR interpolator. + */ + typedef struct + { + uint8_t L; /**< upsample factor. */ + uint16_t phaseLength; /**< length of each polyphase filter component. */ + const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ + float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ + } arm_fir_interpolate_instance_f32; + + + /** + * @brief Processing function for the Q15 FIR interpolator. + * @param[in] S points to an instance of the Q15 FIR interpolator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_interpolate_q15( + const arm_fir_interpolate_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q15 FIR interpolator. + * @param[in,out] S points to an instance of the Q15 FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficient buffer. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + arm_status arm_fir_interpolate_init_q15( + arm_fir_interpolate_instance_q15 * S, + uint8_t L, + uint16_t numTaps, + const q15_t * pCoeffs, + q15_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 FIR interpolator. + * @param[in] S points to an instance of the Q15 FIR interpolator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_interpolate_q31( + const arm_fir_interpolate_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 FIR interpolator. + * @param[in,out] S points to an instance of the Q31 FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficient buffer. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + arm_status arm_fir_interpolate_init_q31( + arm_fir_interpolate_instance_q31 * S, + uint8_t L, + uint16_t numTaps, + const q31_t * pCoeffs, + q31_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the floating-point FIR interpolator. + * @param[in] S points to an instance of the floating-point FIR interpolator structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_interpolate_f32( + const arm_fir_interpolate_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the floating-point FIR interpolator. + * @param[in,out] S points to an instance of the floating-point FIR interpolator structure. + * @param[in] L upsample factor. + * @param[in] numTaps number of filter coefficients in the filter. + * @param[in] pCoeffs points to the filter coefficient buffer. + * @param[in] pState points to the state buffer. + * @param[in] blockSize number of input samples to process per call. + * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if + * the filter length numTaps is not a multiple of the interpolation factor L. + */ + arm_status arm_fir_interpolate_init_f32( + arm_fir_interpolate_instance_f32 * S, + uint8_t L, + uint16_t numTaps, + const float32_t * pCoeffs, + float32_t * pState, + uint32_t blockSize); + + + /** + * @brief Instance structure for the high precision Q31 Biquad cascade filter. + */ + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ + const q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ + } arm_biquad_cas_df1_32x64_ins_q31; + + + /** + * @param[in] S points to an instance of the high precision Q31 Biquad cascade filter structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cas_df1_32x64_q31( + const arm_biquad_cas_df1_32x64_ins_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @param[in,out] S points to an instance of the high precision Q31 Biquad cascade filter structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format + */ + void arm_biquad_cas_df1_32x64_init_q31( + arm_biquad_cas_df1_32x64_ins_q31 * S, + uint8_t numStages, + const q31_t * pCoeffs, + q63_t * pState, + uint8_t postShift); + + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ + const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_df2T_instance_f32; + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ + const float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_stereo_df2T_instance_f32; + + /** + * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. + */ + typedef struct + { + uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ + float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ + const float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ + } arm_biquad_cascade_df2T_instance_f64; + + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in] S points to an instance of the filter data structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df2T_f32( + const arm_biquad_cascade_df2T_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels + * @param[in] S points to an instance of the filter data structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_stereo_df2T_f32( + const arm_biquad_cascade_stereo_df2T_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in] S points to an instance of the filter data structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_biquad_cascade_df2T_f64( + const arm_biquad_cascade_df2T_instance_f64 * S, + const float64_t * pSrc, + float64_t * pDst, + uint32_t blockSize); + + +#if defined(ARM_MATH_NEON) +void arm_biquad_cascade_df2T_compute_coefs_f32( + arm_biquad_cascade_df2T_instance_f32 * S, + uint8_t numStages, + float32_t * pCoeffs); +#endif + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + */ + void arm_biquad_cascade_df2T_init_f32( + arm_biquad_cascade_df2T_instance_f32 * S, + uint8_t numStages, + const float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + */ + void arm_biquad_cascade_stereo_df2T_init_f32( + arm_biquad_cascade_stereo_df2T_instance_f32 * S, + uint8_t numStages, + const float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. + * @param[in,out] S points to an instance of the filter data structure. + * @param[in] numStages number of 2nd order stages in the filter. + * @param[in] pCoeffs points to the filter coefficients. + * @param[in] pState points to the state buffer. + */ + void arm_biquad_cascade_df2T_init_f64( + arm_biquad_cascade_df2T_instance_f64 * S, + uint8_t numStages, + const float64_t * pCoeffs, + float64_t * pState); + + + /** + * @brief Instance structure for the Q15 FIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ + const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_q15; + + /** + * @brief Instance structure for the Q31 FIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ + const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_q31; + + /** + * @brief Instance structure for the floating-point FIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of filter stages. */ + float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ + const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ + } arm_fir_lattice_instance_f32; + + + /** + * @brief Initialization function for the Q15 FIR lattice filter. + * @param[in] S points to an instance of the Q15 FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] pState points to the state buffer. The array is of length numStages. + */ + void arm_fir_lattice_init_q15( + arm_fir_lattice_instance_q15 * S, + uint16_t numStages, + const q15_t * pCoeffs, + q15_t * pState); + + + /** + * @brief Processing function for the Q15 FIR lattice filter. + * @param[in] S points to an instance of the Q15 FIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_fir_lattice_q15( + const arm_fir_lattice_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 FIR lattice filter. + * @param[in] S points to an instance of the Q31 FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] pState points to the state buffer. The array is of length numStages. + */ + void arm_fir_lattice_init_q31( + arm_fir_lattice_instance_q31 * S, + uint16_t numStages, + const q31_t * pCoeffs, + q31_t * pState); + + + /** + * @brief Processing function for the Q31 FIR lattice filter. + * @param[in] S points to an instance of the Q31 FIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_fir_lattice_q31( + const arm_fir_lattice_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + +/** + * @brief Initialization function for the floating-point FIR lattice filter. + * @param[in] S points to an instance of the floating-point FIR lattice structure. + * @param[in] numStages number of filter stages. + * @param[in] pCoeffs points to the coefficient buffer. The array is of length numStages. + * @param[in] pState points to the state buffer. The array is of length numStages. + */ + void arm_fir_lattice_init_f32( + arm_fir_lattice_instance_f32 * S, + uint16_t numStages, + const float32_t * pCoeffs, + float32_t * pState); + + + /** + * @brief Processing function for the floating-point FIR lattice filter. + * @param[in] S points to an instance of the floating-point FIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] blockSize number of samples to process. + */ + void arm_fir_lattice_f32( + const arm_fir_lattice_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q15 IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_q15; + + /** + * @brief Instance structure for the Q31 IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_q31; + + /** + * @brief Instance structure for the floating-point IIR lattice filter. + */ + typedef struct + { + uint16_t numStages; /**< number of stages in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ + float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ + float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ + } arm_iir_lattice_instance_f32; + + + /** + * @brief Processing function for the floating-point IIR lattice filter. + * @param[in] S points to an instance of the floating-point IIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_iir_lattice_f32( + const arm_iir_lattice_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the floating-point IIR lattice filter. + * @param[in] S points to an instance of the floating-point IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. + * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. + * @param[in] pState points to the state buffer. The array is of length numStages+blockSize-1. + * @param[in] blockSize number of samples to process. + */ + void arm_iir_lattice_init_f32( + arm_iir_lattice_instance_f32 * S, + uint16_t numStages, + float32_t * pkCoeffs, + float32_t * pvCoeffs, + float32_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 IIR lattice filter. + * @param[in] S points to an instance of the Q31 IIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_iir_lattice_q31( + const arm_iir_lattice_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 IIR lattice filter. + * @param[in] S points to an instance of the Q31 IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. + * @param[in] pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. + * @param[in] pState points to the state buffer. The array is of length numStages+blockSize. + * @param[in] blockSize number of samples to process. + */ + void arm_iir_lattice_init_q31( + arm_iir_lattice_instance_q31 * S, + uint16_t numStages, + q31_t * pkCoeffs, + q31_t * pvCoeffs, + q31_t * pState, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 IIR lattice filter. + * @param[in] S points to an instance of the Q15 IIR lattice structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data. + * @param[in] blockSize number of samples to process. + */ + void arm_iir_lattice_q15( + const arm_iir_lattice_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + +/** + * @brief Initialization function for the Q15 IIR lattice filter. + * @param[in] S points to an instance of the fixed-point Q15 IIR lattice structure. + * @param[in] numStages number of stages in the filter. + * @param[in] pkCoeffs points to reflection coefficient buffer. The array is of length numStages. + * @param[in] pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. + * @param[in] pState points to state buffer. The array is of length numStages+blockSize. + * @param[in] blockSize number of samples to process per call. + */ + void arm_iir_lattice_init_q15( + arm_iir_lattice_instance_q15 * S, + uint16_t numStages, + q15_t * pkCoeffs, + q15_t * pvCoeffs, + q15_t * pState, + uint32_t blockSize); + + + /** + * @brief Instance structure for the floating-point LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + float32_t mu; /**< step size that controls filter coefficient updates. */ + } arm_lms_instance_f32; + + + /** + * @brief Processing function for floating-point LMS filter. + * @param[in] S points to an instance of the floating-point LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_f32( + const arm_lms_instance_f32 * S, + const float32_t * pSrc, + float32_t * pRef, + float32_t * pOut, + float32_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for floating-point LMS filter. + * @param[in] S points to an instance of the floating-point LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to the coefficient buffer. + * @param[in] pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_init_f32( + arm_lms_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + float32_t mu, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q15 LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q15_t mu; /**< step size that controls filter coefficient updates. */ + uint32_t postShift; /**< bit shift applied to coefficients. */ + } arm_lms_instance_q15; + + + /** + * @brief Initialization function for the Q15 LMS filter. + * @param[in] S points to an instance of the Q15 LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to the coefficient buffer. + * @param[in] pState points to the state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + */ + void arm_lms_init_q15( + arm_lms_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + q15_t mu, + uint32_t blockSize, + uint32_t postShift); + + + /** + * @brief Processing function for Q15 LMS filter. + * @param[in] S points to an instance of the Q15 LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_q15( + const arm_lms_instance_q15 * S, + const q15_t * pSrc, + q15_t * pRef, + q15_t * pOut, + q15_t * pErr, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q31 LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q31_t mu; /**< step size that controls filter coefficient updates. */ + uint32_t postShift; /**< bit shift applied to coefficients. */ + } arm_lms_instance_q31; + + + /** + * @brief Processing function for Q31 LMS filter. + * @param[in] S points to an instance of the Q15 LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_q31( + const arm_lms_instance_q31 * S, + const q31_t * pSrc, + q31_t * pRef, + q31_t * pOut, + q31_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for Q31 LMS filter. + * @param[in] S points to an instance of the Q31 LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to coefficient buffer. + * @param[in] pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + */ + void arm_lms_init_q31( + arm_lms_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + q31_t mu, + uint32_t blockSize, + uint32_t postShift); + + + /** + * @brief Instance structure for the floating-point normalized LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + float32_t mu; /**< step size that control filter coefficient updates. */ + float32_t energy; /**< saves previous frame energy. */ + float32_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_f32; + + + /** + * @brief Processing function for floating-point normalized LMS filter. + * @param[in] S points to an instance of the floating-point normalized LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_norm_f32( + arm_lms_norm_instance_f32 * S, + const float32_t * pSrc, + float32_t * pRef, + float32_t * pOut, + float32_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for floating-point normalized LMS filter. + * @param[in] S points to an instance of the floating-point LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to coefficient buffer. + * @param[in] pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_norm_init_f32( + arm_lms_norm_instance_f32 * S, + uint16_t numTaps, + float32_t * pCoeffs, + float32_t * pState, + float32_t mu, + uint32_t blockSize); + + + /** + * @brief Instance structure for the Q31 normalized LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q31_t mu; /**< step size that controls filter coefficient updates. */ + uint8_t postShift; /**< bit shift applied to coefficients. */ + const q31_t *recipTable; /**< points to the reciprocal initial value table. */ + q31_t energy; /**< saves previous frame energy. */ + q31_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_q31; + + + /** + * @brief Processing function for Q31 normalized LMS filter. + * @param[in] S points to an instance of the Q31 normalized LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_norm_q31( + arm_lms_norm_instance_q31 * S, + const q31_t * pSrc, + q31_t * pRef, + q31_t * pOut, + q31_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for Q31 normalized LMS filter. + * @param[in] S points to an instance of the Q31 normalized LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to coefficient buffer. + * @param[in] pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + */ + void arm_lms_norm_init_q31( + arm_lms_norm_instance_q31 * S, + uint16_t numTaps, + q31_t * pCoeffs, + q31_t * pState, + q31_t mu, + uint32_t blockSize, + uint8_t postShift); + + + /** + * @brief Instance structure for the Q15 normalized LMS filter. + */ + typedef struct + { + uint16_t numTaps; /**< Number of coefficients in the filter. */ + q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ + q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ + q15_t mu; /**< step size that controls filter coefficient updates. */ + uint8_t postShift; /**< bit shift applied to coefficients. */ + const q15_t *recipTable; /**< Points to the reciprocal initial value table. */ + q15_t energy; /**< saves previous frame energy. */ + q15_t x0; /**< saves previous input sample. */ + } arm_lms_norm_instance_q15; + + + /** + * @brief Processing function for Q15 normalized LMS filter. + * @param[in] S points to an instance of the Q15 normalized LMS filter structure. + * @param[in] pSrc points to the block of input data. + * @param[in] pRef points to the block of reference data. + * @param[out] pOut points to the block of output data. + * @param[out] pErr points to the block of error data. + * @param[in] blockSize number of samples to process. + */ + void arm_lms_norm_q15( + arm_lms_norm_instance_q15 * S, + const q15_t * pSrc, + q15_t * pRef, + q15_t * pOut, + q15_t * pErr, + uint32_t blockSize); + + + /** + * @brief Initialization function for Q15 normalized LMS filter. + * @param[in] S points to an instance of the Q15 normalized LMS filter structure. + * @param[in] numTaps number of filter coefficients. + * @param[in] pCoeffs points to coefficient buffer. + * @param[in] pState points to state buffer. + * @param[in] mu step size that controls filter coefficient updates. + * @param[in] blockSize number of samples to process. + * @param[in] postShift bit shift applied to coefficients. + */ + void arm_lms_norm_init_q15( + arm_lms_norm_instance_q15 * S, + uint16_t numTaps, + q15_t * pCoeffs, + q15_t * pState, + q15_t mu, + uint32_t blockSize, + uint8_t postShift); + + + /** + * @brief Correlation of floating-point sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + */ + void arm_correlate_f32( + const float32_t * pSrcA, + uint32_t srcALen, + const float32_t * pSrcB, + uint32_t srcBLen, + float32_t * pDst); + + +/** + @brief Correlation of Q15 sequences + @param[in] pSrcA points to the first input sequence + @param[in] srcALen length of the first input sequence + @param[in] pSrcB points to the second input sequence + @param[in] srcBLen length of the second input sequence + @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. +*/ +void arm_correlate_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch); + + +/** + @brief Correlation of Q15 sequences. + @param[in] pSrcA points to the first input sequence + @param[in] srcALen length of the first input sequence + @param[in] pSrcB points to the second input sequence + @param[in] srcBLen length of the second input sequence + @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + */ + void arm_correlate_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + +/** + @brief Correlation of Q15 sequences (fast version). + @param[in] pSrcA points to the first input sequence + @param[in] srcALen length of the first input sequence + @param[in] pSrcB points to the second input sequence + @param[in] srcBLen length of the second input sequence + @param[out] pDst points to the location where the output result is written. Length 2 * max(srcALen, srcBLen) - 1. + @return none + */ +void arm_correlate_fast_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst); + + +/** + @brief Correlation of Q15 sequences (fast version). + @param[in] pSrcA points to the first input sequence. + @param[in] srcALen length of the first input sequence. + @param[in] pSrcB points to the second input sequence. + @param[in] srcBLen length of the second input sequence. + @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + @param[in] pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + */ +void arm_correlate_fast_opt_q15( + const q15_t * pSrcA, + uint32_t srcALen, + const q15_t * pSrcB, + uint32_t srcBLen, + q15_t * pDst, + q15_t * pScratch); + + + /** + * @brief Correlation of Q31 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + */ + void arm_correlate_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + +/** + @brief Correlation of Q31 sequences (fast version). + @param[in] pSrcA points to the first input sequence + @param[in] srcALen length of the first input sequence + @param[in] pSrcB points to the second input sequence + @param[in] srcBLen length of the second input sequence + @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + */ +void arm_correlate_fast_q31( + const q31_t * pSrcA, + uint32_t srcALen, + const q31_t * pSrcB, + uint32_t srcBLen, + q31_t * pDst); + + + /** + * @brief Correlation of Q7 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + * @param[in] pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. + * @param[in] pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). + */ + void arm_correlate_opt_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst, + q15_t * pScratch1, + q15_t * pScratch2); + + + /** + * @brief Correlation of Q7 sequences. + * @param[in] pSrcA points to the first input sequence. + * @param[in] srcALen length of the first input sequence. + * @param[in] pSrcB points to the second input sequence. + * @param[in] srcBLen length of the second input sequence. + * @param[out] pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. + */ + void arm_correlate_q7( + const q7_t * pSrcA, + uint32_t srcALen, + const q7_t * pSrcB, + uint32_t srcBLen, + q7_t * pDst); + + + /** + * @brief Instance structure for the floating-point sparse FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + const float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_f32; + + /** + * @brief Instance structure for the Q31 sparse FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + const q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q31; + + /** + * @brief Instance structure for the Q15 sparse FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + const q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q15; + + /** + * @brief Instance structure for the Q7 sparse FIR filter. + */ + typedef struct + { + uint16_t numTaps; /**< number of coefficients in the filter. */ + uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ + q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ + const q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ + uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ + int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ + } arm_fir_sparse_instance_q7; + + + /** + * @brief Processing function for the floating-point sparse FIR filter. + * @param[in] S points to an instance of the floating-point sparse FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] pScratchIn points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_sparse_f32( + arm_fir_sparse_instance_f32 * S, + const float32_t * pSrc, + float32_t * pDst, + float32_t * pScratchIn, + uint32_t blockSize); + + + /** + * @brief Initialization function for the floating-point sparse FIR filter. + * @param[in,out] S points to an instance of the floating-point sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] pCoeffs points to the array of filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + */ + void arm_fir_sparse_init_f32( + arm_fir_sparse_instance_f32 * S, + uint16_t numTaps, + const float32_t * pCoeffs, + float32_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q31 sparse FIR filter. + * @param[in] S points to an instance of the Q31 sparse FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] pScratchIn points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_sparse_q31( + arm_fir_sparse_instance_q31 * S, + const q31_t * pSrc, + q31_t * pDst, + q31_t * pScratchIn, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q31 sparse FIR filter. + * @param[in,out] S points to an instance of the Q31 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] pCoeffs points to the array of filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + */ + void arm_fir_sparse_init_q31( + arm_fir_sparse_instance_q31 * S, + uint16_t numTaps, + const q31_t * pCoeffs, + q31_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q15 sparse FIR filter. + * @param[in] S points to an instance of the Q15 sparse FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] pScratchIn points to a temporary buffer of size blockSize. + * @param[in] pScratchOut points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_sparse_q15( + arm_fir_sparse_instance_q15 * S, + const q15_t * pSrc, + q15_t * pDst, + q15_t * pScratchIn, + q31_t * pScratchOut, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q15 sparse FIR filter. + * @param[in,out] S points to an instance of the Q15 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] pCoeffs points to the array of filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + */ + void arm_fir_sparse_init_q15( + arm_fir_sparse_instance_q15 * S, + uint16_t numTaps, + const q15_t * pCoeffs, + q15_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + + /** + * @brief Processing function for the Q7 sparse FIR filter. + * @param[in] S points to an instance of the Q7 sparse FIR structure. + * @param[in] pSrc points to the block of input data. + * @param[out] pDst points to the block of output data + * @param[in] pScratchIn points to a temporary buffer of size blockSize. + * @param[in] pScratchOut points to a temporary buffer of size blockSize. + * @param[in] blockSize number of input samples to process per call. + */ + void arm_fir_sparse_q7( + arm_fir_sparse_instance_q7 * S, + const q7_t * pSrc, + q7_t * pDst, + q7_t * pScratchIn, + q31_t * pScratchOut, + uint32_t blockSize); + + + /** + * @brief Initialization function for the Q7 sparse FIR filter. + * @param[in,out] S points to an instance of the Q7 sparse FIR structure. + * @param[in] numTaps number of nonzero coefficients in the filter. + * @param[in] pCoeffs points to the array of filter coefficients. + * @param[in] pState points to the state buffer. + * @param[in] pTapDelay points to the array of offset times. + * @param[in] maxDelay maximum offset time supported. + * @param[in] blockSize number of samples that will be processed per block. + */ + void arm_fir_sparse_init_q7( + arm_fir_sparse_instance_q7 * S, + uint16_t numTaps, + const q7_t * pCoeffs, + q7_t * pState, + int32_t * pTapDelay, + uint16_t maxDelay, + uint32_t blockSize); + + + /** + * @brief Floating-point sin_cos function. + * @param[in] theta input value in degrees + * @param[out] pSinVal points to the processed sine output. + * @param[out] pCosVal points to the processed cos output. + */ + void arm_sin_cos_f32( + float32_t theta, + float32_t * pSinVal, + float32_t * pCosVal); + + + /** + * @brief Q31 sin_cos function. + * @param[in] theta scaled input value in degrees + * @param[out] pSinVal points to the processed sine output. + * @param[out] pCosVal points to the processed cosine output. + */ + void arm_sin_cos_q31( + q31_t theta, + q31_t * pSinVal, + q31_t * pCosVal); + + + /** + * @brief Floating-point complex conjugate. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_conj_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + /** + * @brief Q31 complex conjugate. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_conj_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q15 complex conjugate. + * @param[in] pSrc points to the input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_conj_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + + /** + * @brief Floating-point complex magnitude squared + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_squared_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q31 complex magnitude squared + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_squared_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q15 complex magnitude squared + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_squared_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + + /** + * @ingroup groupController + */ + + /** + * @defgroup PID PID Motor Control + * + * A Proportional Integral Derivative (PID) controller is a generic feedback control + * loop mechanism widely used in industrial control systems. + * A PID controller is the most commonly used type of feedback controller. + * + * This set of functions implements (PID) controllers + * for Q15, Q31, and floating-point data types. The functions operate on a single sample + * of data and each call to the function returns a single processed value. + * S points to an instance of the PID control data structure. in + * is the input sample value. The functions return the output value. + * + * \par Algorithm: + *
+   *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
+   *    A0 = Kp + Ki + Kd
+   *    A1 = (-Kp ) - (2 * Kd )
+   *    A2 = Kd
+   * 
+ * + * \par + * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant + * + * \par + * \image html PID.gif "Proportional Integral Derivative Controller" + * + * \par + * The PID controller calculates an "error" value as the difference between + * the measured output and the reference input. + * The controller attempts to minimize the error by adjusting the process control inputs. + * The proportional value determines the reaction to the current error, + * the integral value determines the reaction based on the sum of recent errors, + * and the derivative value determines the reaction based on the rate at which the error has been changing. + * + * \par Instance Structure + * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. + * A separate instance structure must be defined for each PID Controller. + * There are separate instance structure declarations for each of the 3 supported data types. + * + * \par Reset Functions + * There is also an associated reset function for each data type which clears the state array. + * + * \par Initialization Functions + * There is also an associated initialization function for each data type. + * The initialization function performs the following operations: + * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. + * - Zeros out the values in the state buffer. + * + * \par + * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. + * + * \par Fixed-Point Behavior + * Care must be taken when using the fixed-point versions of the PID Controller functions. + * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup PID + * @{ + */ + + /** + * @brief Process function for the floating-point PID Control. + * @param[in,out] S is an instance of the floating-point PID Control structure + * @param[in] in input sample to process + * @return processed output sample. + */ + __STATIC_FORCEINLINE float32_t arm_pid_f32( + arm_pid_instance_f32 * S, + float32_t in) + { + float32_t out; + + /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ + out = (S->A0 * in) + + (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + + } + +/** + @brief Process function for the Q31 PID Control. + @param[in,out] S points to an instance of the Q31 PID Control structure + @param[in] in input sample to process + @return processed output sample. + + \par Scaling and Overflow Behavior + The function is implemented using an internal 64-bit accumulator. + The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. + Thus, if the accumulator result overflows it wraps around rather than clip. + In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. + After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. + */ +__STATIC_FORCEINLINE q31_t arm_pid_q31( + arm_pid_instance_q31 * S, + q31_t in) + { + q63_t acc; + q31_t out; + + /* acc = A0 * x[n] */ + acc = (q63_t) S->A0 * in; + + /* acc += A1 * x[n-1] */ + acc += (q63_t) S->A1 * S->state[0]; + + /* acc += A2 * x[n-2] */ + acc += (q63_t) S->A2 * S->state[1]; + + /* convert output to 1.31 format to add y[n-1] */ + out = (q31_t) (acc >> 31U); + + /* out += y[n-1] */ + out += S->state[2]; + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + } + + +/** + @brief Process function for the Q15 PID Control. + @param[in,out] S points to an instance of the Q15 PID Control structure + @param[in] in input sample to process + @return processed output sample. + + \par Scaling and Overflow Behavior + The function is implemented using a 64-bit internal accumulator. + Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. + The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. + There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. + After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. + Lastly, the accumulator is saturated to yield a result in 1.15 format. + */ +__STATIC_FORCEINLINE q15_t arm_pid_q15( + arm_pid_instance_q15 * S, + q15_t in) + { + q63_t acc; + q15_t out; + +#if defined (ARM_MATH_DSP) + /* Implementation of PID controller */ + + /* acc = A0 * x[n] */ + acc = (q31_t) __SMUAD((uint32_t)S->A0, (uint32_t)in); + + /* acc += A1 * x[n-1] + A2 * x[n-2] */ + acc = (q63_t)__SMLALD((uint32_t)S->A1, (uint32_t)read_q15x2 (S->state), (uint64_t)acc); +#else + /* acc = A0 * x[n] */ + acc = ((q31_t) S->A0) * in; + + /* acc += A1 * x[n-1] + A2 * x[n-2] */ + acc += (q31_t) S->A1 * S->state[0]; + acc += (q31_t) S->A2 * S->state[1]; +#endif + + /* acc += y[n-1] */ + acc += (q31_t) S->state[2] << 15; + + /* saturate the output */ + out = (q15_t) (__SSAT((q31_t)(acc >> 15), 16)); + + /* Update state */ + S->state[1] = S->state[0]; + S->state[0] = in; + S->state[2] = out; + + /* return to application */ + return (out); + } + + /** + * @} end of PID group + */ + + + /** + * @brief Floating-point matrix inverse. + * @param[in] src points to the instance of the input floating-point matrix structure. + * @param[out] dst points to the instance of the output floating-point matrix structure. + * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. + * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. + */ + arm_status arm_mat_inverse_f32( + const arm_matrix_instance_f32 * src, + arm_matrix_instance_f32 * dst); + + + /** + * @brief Floating-point matrix inverse. + * @param[in] src points to the instance of the input floating-point matrix structure. + * @param[out] dst points to the instance of the output floating-point matrix structure. + * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. + * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. + */ + arm_status arm_mat_inverse_f64( + const arm_matrix_instance_f64 * src, + arm_matrix_instance_f64 * dst); + + + + /** + * @ingroup groupController + */ + + /** + * @defgroup clarke Vector Clarke Transform + * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. + * Generally the Clarke transform uses three-phase currents Ia, Ib and Ic to calculate currents + * in the two-phase orthogonal stator axis Ialpha and Ibeta. + * When Ialpha is superposed with Ia as shown in the figure below + * \image html clarke.gif Stator current space vector and its components in (a,b). + * and Ia + Ib + Ic = 0, in this condition Ialpha and Ibeta + * can be calculated using only Ia and Ib. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html clarkeFormula.gif + * where Ia and Ib are the instantaneous stator phases and + * pIalpha and pIbeta are the two coordinates of time invariant vector. + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Clarke transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup clarke + * @{ + */ + + /** + * + * @brief Floating-point Clarke transform + * @param[in] Ia input three-phase coordinate a + * @param[in] Ib input three-phase coordinate b + * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] pIbeta points to output two-phase orthogonal vector axis beta + * @return none + */ + __STATIC_FORCEINLINE void arm_clarke_f32( + float32_t Ia, + float32_t Ib, + float32_t * pIalpha, + float32_t * pIbeta) + { + /* Calculate pIalpha using the equation, pIalpha = Ia */ + *pIalpha = Ia; + + /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ + *pIbeta = ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); + } + + +/** + @brief Clarke transform for Q31 version + @param[in] Ia input three-phase coordinate a + @param[in] Ib input three-phase coordinate b + @param[out] pIalpha points to output two-phase orthogonal vector axis alpha + @param[out] pIbeta points to output two-phase orthogonal vector axis beta + @return none + + \par Scaling and Overflow Behavior + The function is implemented using an internal 32-bit accumulator. + The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + There is saturation on the addition, hence there is no risk of overflow. + */ +__STATIC_FORCEINLINE void arm_clarke_q31( + q31_t Ia, + q31_t Ib, + q31_t * pIalpha, + q31_t * pIbeta) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + + /* Calculating pIalpha from Ia by equation pIalpha = Ia */ + *pIalpha = Ia; + + /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ + product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); + + /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ + product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); + + /* pIbeta is calculated by adding the intermediate products */ + *pIbeta = __QADD(product1, product2); + } + + /** + * @} end of clarke group + */ + + + /** + * @ingroup groupController + */ + + /** + * @defgroup inv_clarke Vector Inverse Clarke Transform + * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html clarkeInvFormula.gif + * where pIa and pIb are the instantaneous stator phases and + * Ialpha and Ibeta are the two coordinates of time invariant vector. + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Clarke transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup inv_clarke + * @{ + */ + + /** + * @brief Floating-point Inverse Clarke transform + * @param[in] Ialpha input two-phase orthogonal vector axis alpha + * @param[in] Ibeta input two-phase orthogonal vector axis beta + * @param[out] pIa points to output three-phase coordinate a + * @param[out] pIb points to output three-phase coordinate b + * @return none + */ + __STATIC_FORCEINLINE void arm_inv_clarke_f32( + float32_t Ialpha, + float32_t Ibeta, + float32_t * pIa, + float32_t * pIb) + { + /* Calculating pIa from Ialpha by equation pIa = Ialpha */ + *pIa = Ialpha; + + /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ + *pIb = -0.5f * Ialpha + 0.8660254039f * Ibeta; + } + + +/** + @brief Inverse Clarke transform for Q31 version + @param[in] Ialpha input two-phase orthogonal vector axis alpha + @param[in] Ibeta input two-phase orthogonal vector axis beta + @param[out] pIa points to output three-phase coordinate a + @param[out] pIb points to output three-phase coordinate b + @return none + + \par Scaling and Overflow Behavior + The function is implemented using an internal 32-bit accumulator. + The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + There is saturation on the subtraction, hence there is no risk of overflow. + */ +__STATIC_FORCEINLINE void arm_inv_clarke_q31( + q31_t Ialpha, + q31_t Ibeta, + q31_t * pIa, + q31_t * pIb) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + + /* Calculating pIa from Ialpha by equation pIa = Ialpha */ + *pIa = Ialpha; + + /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ + product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); + + /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ + product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); + + /* pIb is calculated by subtracting the products */ + *pIb = __QSUB(product2, product1); + } + + /** + * @} end of inv_clarke group + */ + + + + /** + * @ingroup groupController + */ + + /** + * @defgroup park Vector Park Transform + * + * Forward Park transform converts the input two-coordinate vector to flux and torque components. + * The Park transform can be used to realize the transformation of the Ialpha and the Ibeta currents + * from the stationary to the moving reference frame and control the spatial relationship between + * the stator vector current and rotor flux vector. + * If we consider the d axis aligned with the rotor flux, the diagram below shows the + * current vector and the relationship from the two reference frames: + * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html parkFormula.gif + * where Ialpha and Ibeta are the stator vector components, + * pId and pIq are rotor vector components and cosVal and sinVal are the + * cosine and sine values of theta (rotor flux position). + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Park transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup park + * @{ + */ + + /** + * @brief Floating-point Park transform + * @param[in] Ialpha input two-phase vector coordinate alpha + * @param[in] Ibeta input two-phase vector coordinate beta + * @param[out] pId points to output rotor reference frame d + * @param[out] pIq points to output rotor reference frame q + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none + * + * The function implements the forward Park transform. + * + */ + __STATIC_FORCEINLINE void arm_park_f32( + float32_t Ialpha, + float32_t Ibeta, + float32_t * pId, + float32_t * pIq, + float32_t sinVal, + float32_t cosVal) + { + /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ + *pId = Ialpha * cosVal + Ibeta * sinVal; + + /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ + *pIq = -Ialpha * sinVal + Ibeta * cosVal; + } + + +/** + @brief Park transform for Q31 version + @param[in] Ialpha input two-phase vector coordinate alpha + @param[in] Ibeta input two-phase vector coordinate beta + @param[out] pId points to output rotor reference frame d + @param[out] pIq points to output rotor reference frame q + @param[in] sinVal sine value of rotation angle theta + @param[in] cosVal cosine value of rotation angle theta + @return none + + \par Scaling and Overflow Behavior + The function is implemented using an internal 32-bit accumulator. + The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + There is saturation on the addition and subtraction, hence there is no risk of overflow. + */ +__STATIC_FORCEINLINE void arm_park_q31( + q31_t Ialpha, + q31_t Ibeta, + q31_t * pId, + q31_t * pIq, + q31_t sinVal, + q31_t cosVal) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + q31_t product3, product4; /* Temporary variables used to store intermediate results */ + + /* Intermediate product is calculated by (Ialpha * cosVal) */ + product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); + + /* Intermediate product is calculated by (Ibeta * sinVal) */ + product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); + + + /* Intermediate product is calculated by (Ialpha * sinVal) */ + product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); + + /* Intermediate product is calculated by (Ibeta * cosVal) */ + product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); + + /* Calculate pId by adding the two intermediate products 1 and 2 */ + *pId = __QADD(product1, product2); + + /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ + *pIq = __QSUB(product4, product3); + } + + /** + * @} end of park group + */ + + + /** + * @ingroup groupController + */ + + /** + * @defgroup inv_park Vector Inverse Park transform + * Inverse Park transform converts the input flux and torque components to two-coordinate vector. + * + * The function operates on a single sample of data and each call to the function returns the processed output. + * The library provides separate functions for Q31 and floating-point data types. + * \par Algorithm + * \image html parkInvFormula.gif + * where pIalpha and pIbeta are the stator vector components, + * Id and Iq are rotor vector components and cosVal and sinVal are the + * cosine and sine values of theta (rotor flux position). + * \par Fixed-Point Behavior + * Care must be taken when using the Q31 version of the Park transform. + * In particular, the overflow and saturation behavior of the accumulator used must be considered. + * Refer to the function specific documentation below for usage guidelines. + */ + + /** + * @addtogroup inv_park + * @{ + */ + + /** + * @brief Floating-point Inverse Park transform + * @param[in] Id input coordinate of rotor reference frame d + * @param[in] Iq input coordinate of rotor reference frame q + * @param[out] pIalpha points to output two-phase orthogonal vector axis alpha + * @param[out] pIbeta points to output two-phase orthogonal vector axis beta + * @param[in] sinVal sine value of rotation angle theta + * @param[in] cosVal cosine value of rotation angle theta + * @return none + */ + __STATIC_FORCEINLINE void arm_inv_park_f32( + float32_t Id, + float32_t Iq, + float32_t * pIalpha, + float32_t * pIbeta, + float32_t sinVal, + float32_t cosVal) + { + /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ + *pIalpha = Id * cosVal - Iq * sinVal; + + /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ + *pIbeta = Id * sinVal + Iq * cosVal; + } + + +/** + @brief Inverse Park transform for Q31 version + @param[in] Id input coordinate of rotor reference frame d + @param[in] Iq input coordinate of rotor reference frame q + @param[out] pIalpha points to output two-phase orthogonal vector axis alpha + @param[out] pIbeta points to output two-phase orthogonal vector axis beta + @param[in] sinVal sine value of rotation angle theta + @param[in] cosVal cosine value of rotation angle theta + @return none + + @par Scaling and Overflow Behavior + The function is implemented using an internal 32-bit accumulator. + The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. + There is saturation on the addition, hence there is no risk of overflow. + */ +__STATIC_FORCEINLINE void arm_inv_park_q31( + q31_t Id, + q31_t Iq, + q31_t * pIalpha, + q31_t * pIbeta, + q31_t sinVal, + q31_t cosVal) + { + q31_t product1, product2; /* Temporary variables used to store intermediate results */ + q31_t product3, product4; /* Temporary variables used to store intermediate results */ + + /* Intermediate product is calculated by (Id * cosVal) */ + product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); + + /* Intermediate product is calculated by (Iq * sinVal) */ + product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); + + + /* Intermediate product is calculated by (Id * sinVal) */ + product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); + + /* Intermediate product is calculated by (Iq * cosVal) */ + product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); + + /* Calculate pIalpha by using the two intermediate products 1 and 2 */ + *pIalpha = __QSUB(product1, product2); + + /* Calculate pIbeta by using the two intermediate products 3 and 4 */ + *pIbeta = __QADD(product4, product3); + } + + /** + * @} end of Inverse park group + */ + + + /** + * @ingroup groupInterpolation + */ + + /** + * @defgroup LinearInterpolate Linear Interpolation + * + * Linear interpolation is a method of curve fitting using linear polynomials. + * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line + * + * \par + * \image html LinearInterp.gif "Linear interpolation" + * + * \par + * A Linear Interpolate function calculates an output value(y), for the input(x) + * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) + * + * \par Algorithm: + *
+   *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
+   *       where x0, x1 are nearest values of input x
+   *             y0, y1 are nearest values to output y
+   * 
+ * + * \par + * This set of functions implements Linear interpolation process + * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single + * sample of data and each call to the function returns a single processed value. + * S points to an instance of the Linear Interpolate function data structure. + * x is the input sample value. The functions returns the output value. + * + * \par + * if x is outside of the table boundary, Linear interpolation returns first value of the table + * if x is below input range and returns last value of table if x is above range. + */ + + /** + * @addtogroup LinearInterpolate + * @{ + */ + + /** + * @brief Process function for the floating-point Linear Interpolation Function. + * @param[in,out] S is an instance of the floating-point Linear Interpolation structure + * @param[in] x input sample to process + * @return y processed output sample. + * + */ + __STATIC_FORCEINLINE float32_t arm_linear_interp_f32( + arm_linear_interp_instance_f32 * S, + float32_t x) + { + float32_t y; + float32_t x0, x1; /* Nearest input values */ + float32_t y0, y1; /* Nearest output values */ + float32_t xSpacing = S->xSpacing; /* spacing between input values */ + int32_t i; /* Index variable */ + float32_t *pYData = S->pYData; /* pointer to output table */ + + /* Calculation of index */ + i = (int32_t) ((x - S->x1) / xSpacing); + + if (i < 0) + { + /* Iniatilize output for below specified range as least output value of table */ + y = pYData[0]; + } + else if ((uint32_t)i >= (S->nValues - 1)) + { + /* Iniatilize output for above specified range as last output value of table */ + y = pYData[S->nValues - 1]; + } + else + { + /* Calculation of nearest input values */ + x0 = S->x1 + i * xSpacing; + x1 = S->x1 + (i + 1) * xSpacing; + + /* Read of nearest output values */ + y0 = pYData[i]; + y1 = pYData[i + 1]; + + /* Calculation of output */ + y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); + + } + + /* returns output value */ + return (y); + } + + + /** + * + * @brief Process function for the Q31 Linear Interpolation Function. + * @param[in] pYData pointer to Q31 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + * + */ + __STATIC_FORCEINLINE q31_t arm_linear_interp_q31( + q31_t * pYData, + q31_t x, + uint32_t nValues) + { + q31_t y; /* output */ + q31_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + int32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + index = ((x & (q31_t)0xFFF00000) >> 20); + + if (index >= (int32_t)(nValues - 1)) + { + return (pYData[nValues - 1]); + } + else if (index < 0) + { + return (pYData[0]); + } + else + { + /* 20 bits for the fractional part */ + /* shift left by 11 to keep fract in 1.31 format */ + fract = (x & 0x000FFFFF) << 11; + + /* Read two nearest output values from the index in 1.31(q31) format */ + y0 = pYData[index]; + y1 = pYData[index + 1]; + + /* Calculation of y0 * (1-fract) and y is in 2.30 format */ + y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); + + /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ + y += ((q31_t) (((q63_t) y1 * fract) >> 32)); + + /* Convert y to 1.31 format */ + return (y << 1U); + } + } + + + /** + * + * @brief Process function for the Q15 Linear Interpolation Function. + * @param[in] pYData pointer to Q15 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + * + */ + __STATIC_FORCEINLINE q15_t arm_linear_interp_q15( + q15_t * pYData, + q31_t x, + uint32_t nValues) + { + q63_t y; /* output */ + q15_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + int32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + index = ((x & (int32_t)0xFFF00000) >> 20); + + if (index >= (int32_t)(nValues - 1)) + { + return (pYData[nValues - 1]); + } + else if (index < 0) + { + return (pYData[0]); + } + else + { + /* 20 bits for the fractional part */ + /* fract is in 12.20 format */ + fract = (x & 0x000FFFFF); + + /* Read two nearest output values from the index */ + y0 = pYData[index]; + y1 = pYData[index + 1]; + + /* Calculation of y0 * (1-fract) and y is in 13.35 format */ + y = ((q63_t) y0 * (0xFFFFF - fract)); + + /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ + y += ((q63_t) y1 * (fract)); + + /* convert y to 1.15 format */ + return (q15_t) (y >> 20); + } + } + + + /** + * + * @brief Process function for the Q7 Linear Interpolation Function. + * @param[in] pYData pointer to Q7 Linear Interpolation table + * @param[in] x input sample to process + * @param[in] nValues number of table values + * @return y processed output sample. + * + * \par + * Input sample x is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. + * This function can support maximum of table size 2^12. + */ + __STATIC_FORCEINLINE q7_t arm_linear_interp_q7( + q7_t * pYData, + q31_t x, + uint32_t nValues) + { + q31_t y; /* output */ + q7_t y0, y1; /* Nearest output values */ + q31_t fract; /* fractional part */ + uint32_t index; /* Index to read nearest output values */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + if (x < 0) + { + return (pYData[0]); + } + index = (x >> 20) & 0xfff; + + if (index >= (nValues - 1)) + { + return (pYData[nValues - 1]); + } + else + { + /* 20 bits for the fractional part */ + /* fract is in 12.20 format */ + fract = (x & 0x000FFFFF); + + /* Read two nearest output values from the index and are in 1.7(q7) format */ + y0 = pYData[index]; + y1 = pYData[index + 1]; + + /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ + y = ((y0 * (0xFFFFF - fract))); + + /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ + y += (y1 * fract); + + /* convert y to 1.7(q7) format */ + return (q7_t) (y >> 20); + } + } + + /** + * @} end of LinearInterpolate group + */ + + /** + * @brief Fast approximation to the trigonometric sine function for floating-point data. + * @param[in] x input value in radians. + * @return sin(x). + */ + float32_t arm_sin_f32( + float32_t x); + + + /** + * @brief Fast approximation to the trigonometric sine function for Q31 data. + * @param[in] x Scaled input value in radians. + * @return sin(x). + */ + q31_t arm_sin_q31( + q31_t x); + + + /** + * @brief Fast approximation to the trigonometric sine function for Q15 data. + * @param[in] x Scaled input value in radians. + * @return sin(x). + */ + q15_t arm_sin_q15( + q15_t x); + + + /** + * @brief Fast approximation to the trigonometric cosine function for floating-point data. + * @param[in] x input value in radians. + * @return cos(x). + */ + float32_t arm_cos_f32( + float32_t x); + + + /** + * @brief Fast approximation to the trigonometric cosine function for Q31 data. + * @param[in] x Scaled input value in radians. + * @return cos(x). + */ + q31_t arm_cos_q31( + q31_t x); + + + /** + * @brief Fast approximation to the trigonometric cosine function for Q15 data. + * @param[in] x Scaled input value in radians. + * @return cos(x). + */ + q15_t arm_cos_q15( + q15_t x); + + +/** + @brief Floating-point vector of log values. + @param[in] pSrc points to the input vector + @param[out] pDst points to the output vector + @param[in] blockSize number of samples in each vector + @return none + */ + void arm_vlog_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + +/** + @brief Floating-point vector of exp values. + @param[in] pSrc points to the input vector + @param[out] pDst points to the output vector + @param[in] blockSize number of samples in each vector + @return none + */ + void arm_vexp_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + /** + * @ingroup groupFastMath + */ + + + /** + * @defgroup SQRT Square Root + * + * Computes the square root of a number. + * There are separate functions for Q15, Q31, and floating-point data types. + * The square root function is computed using the Newton-Raphson algorithm. + * This is an iterative algorithm of the form: + *
+   *      x1 = x0 - f(x0)/f'(x0)
+   * 
+ * where x1 is the current estimate, + * x0 is the previous estimate, and + * f'(x0) is the derivative of f() evaluated at x0. + * For the square root function, the algorithm reduces to: + *
+   *     x0 = in/2                         [initial guess]
+   *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
+   * 
+ */ + + + /** + * @addtogroup SQRT + * @{ + */ + +/** + @brief Floating-point square root function. + @param[in] in input value + @param[out] pOut square root of input value + @return execution status + - \ref ARM_MATH_SUCCESS : input value is positive + - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 + */ +__STATIC_FORCEINLINE arm_status arm_sqrt_f32( + float32_t in, + float32_t * pOut) + { + if (in >= 0.0f) + { +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + *pOut = __sqrtf(in); + #else + *pOut = sqrtf(in); + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + __ASM("VSQRT.F32 %0,%1" : "=t"(*pOut) : "t"(in)); + #else + *pOut = sqrtf(in); + #endif + +#else + *pOut = sqrtf(in); +#endif + + return (ARM_MATH_SUCCESS); + } + else + { + *pOut = 0.0f; + return (ARM_MATH_ARGUMENT_ERROR); + } + } + + +/** + @brief Q31 square root function. + @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF + @param[out] pOut points to square root of input value + @return execution status + - \ref ARM_MATH_SUCCESS : input value is positive + - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 + */ +arm_status arm_sqrt_q31( + q31_t in, + q31_t * pOut); + + +/** + @brief Q15 square root function. + @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF + @param[out] pOut points to square root of input value + @return execution status + - \ref ARM_MATH_SUCCESS : input value is positive + - \ref ARM_MATH_ARGUMENT_ERROR : input value is negative; *pOut is set to 0 + */ +arm_status arm_sqrt_q15( + q15_t in, + q15_t * pOut); + + /** + * @brief Vector Floating-point square root function. + * @param[in] pIn input vector. + * @param[out] pOut vector of square roots of input elements. + * @param[in] len length of input vector. + * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if + * in is negative value and returns zero output for negative values. + */ + void arm_vsqrt_f32( + float32_t * pIn, + float32_t * pOut, + uint16_t len); + + void arm_vsqrt_q31( + q31_t * pIn, + q31_t * pOut, + uint16_t len); + + void arm_vsqrt_q15( + q15_t * pIn, + q15_t * pOut, + uint16_t len); + + /** + * @} end of SQRT group + */ + + + /** + * @brief floating-point Circular write function. + */ + __STATIC_FORCEINLINE void arm_circularWrite_f32( + int32_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const int32_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0U; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if (wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = (uint16_t)wOffset; + } + + + + /** + * @brief floating-point Circular Read function. + */ + __STATIC_FORCEINLINE void arm_circularRead_f32( + int32_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + int32_t * dst, + int32_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0U; + int32_t rOffset; + int32_t* dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + dst_end = dst_base + dst_length; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if (dst == dst_end) + { + dst = dst_base; + } + + /* Circularly update rOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if (rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + + /** + * @brief Q15 Circular write function. + */ + __STATIC_FORCEINLINE void arm_circularWrite_q15( + q15_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const q15_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0U; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if (wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = (uint16_t)wOffset; + } + + + /** + * @brief Q15 Circular Read function. + */ + __STATIC_FORCEINLINE void arm_circularRead_q15( + q15_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + q15_t * dst, + q15_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0; + int32_t rOffset; + q15_t* dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + + dst_end = dst_base + dst_length; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if (dst == dst_end) + { + dst = dst_base; + } + + /* Circularly update wOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if (rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + + /** + * @brief Q7 Circular write function. + */ + __STATIC_FORCEINLINE void arm_circularWrite_q7( + q7_t * circBuffer, + int32_t L, + uint16_t * writeOffset, + int32_t bufferInc, + const q7_t * src, + int32_t srcInc, + uint32_t blockSize) + { + uint32_t i = 0U; + int32_t wOffset; + + /* Copy the value of Index pointer that points + * to the current location where the input samples to be copied */ + wOffset = *writeOffset; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the input sample to the circular buffer */ + circBuffer[wOffset] = *src; + + /* Update the input pointer */ + src += srcInc; + + /* Circularly update wOffset. Watch out for positive and negative value */ + wOffset += bufferInc; + if (wOffset >= L) + wOffset -= L; + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *writeOffset = (uint16_t)wOffset; + } + + + /** + * @brief Q7 Circular Read function. + */ + __STATIC_FORCEINLINE void arm_circularRead_q7( + q7_t * circBuffer, + int32_t L, + int32_t * readOffset, + int32_t bufferInc, + q7_t * dst, + q7_t * dst_base, + int32_t dst_length, + int32_t dstInc, + uint32_t blockSize) + { + uint32_t i = 0; + int32_t rOffset; + q7_t* dst_end; + + /* Copy the value of Index pointer that points + * to the current location from where the input samples to be read */ + rOffset = *readOffset; + + dst_end = dst_base + dst_length; + + /* Loop over the blockSize */ + i = blockSize; + + while (i > 0U) + { + /* copy the sample from the circular buffer to the destination buffer */ + *dst = circBuffer[rOffset]; + + /* Update the input pointer */ + dst += dstInc; + + if (dst == dst_end) + { + dst = dst_base; + } + + /* Circularly update rOffset. Watch out for positive and negative value */ + rOffset += bufferInc; + + if (rOffset >= L) + { + rOffset -= L; + } + + /* Decrement the loop counter */ + i--; + } + + /* Update the index pointer */ + *readOffset = rOffset; + } + + + /** + * @brief Sum of the squares of the elements of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_power_q31( + const q31_t * pSrc, + uint32_t blockSize, + q63_t * pResult); + + + /** + * @brief Sum of the squares of the elements of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_power_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + + /** + * @brief Sum of the squares of the elements of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_power_q15( + const q15_t * pSrc, + uint32_t blockSize, + q63_t * pResult); + + + /** + * @brief Sum of the squares of the elements of a Q7 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_power_q7( + const q7_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + + /** + * @brief Mean value of a Q7 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_mean_q7( + const q7_t * pSrc, + uint32_t blockSize, + q7_t * pResult); + + + /** + * @brief Mean value of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_mean_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + + /** + * @brief Mean value of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_mean_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + + /** + * @brief Mean value of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_mean_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + + /** + * @brief Variance of the elements of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_var_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + + /** + * @brief Variance of the elements of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_var_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + + /** + * @brief Variance of the elements of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_var_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + + /** + * @brief Root Mean Square of the elements of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_rms_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + + /** + * @brief Root Mean Square of the elements of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_rms_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + + /** + * @brief Root Mean Square of the elements of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_rms_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + + /** + * @brief Standard deviation of the elements of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_std_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult); + + + /** + * @brief Standard deviation of the elements of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_std_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult); + + + /** + * @brief Standard deviation of the elements of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output value. + */ + void arm_std_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult); + + + /** + * @brief Floating-point complex magnitude + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_f32( + const float32_t * pSrc, + float32_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q31 complex magnitude + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_q31( + const q31_t * pSrc, + q31_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q15 complex magnitude + * @param[in] pSrc points to the complex input vector + * @param[out] pDst points to the real output vector + * @param[in] numSamples number of complex samples in the input vector + */ + void arm_cmplx_mag_q15( + const q15_t * pSrc, + q15_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q15 complex dot product + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] realResult real part of the result returned here + * @param[out] imagResult imaginary part of the result returned here + */ + void arm_cmplx_dot_prod_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + uint32_t numSamples, + q31_t * realResult, + q31_t * imagResult); + + + /** + * @brief Q31 complex dot product + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] realResult real part of the result returned here + * @param[out] imagResult imaginary part of the result returned here + */ + void arm_cmplx_dot_prod_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + uint32_t numSamples, + q63_t * realResult, + q63_t * imagResult); + + + /** + * @brief Floating-point complex dot product + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] numSamples number of complex samples in each vector + * @param[out] realResult real part of the result returned here + * @param[out] imagResult imaginary part of the result returned here + */ + void arm_cmplx_dot_prod_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + uint32_t numSamples, + float32_t * realResult, + float32_t * imagResult); + + + /** + * @brief Q15 complex-by-real multiplication + * @param[in] pSrcCmplx points to the complex input vector + * @param[in] pSrcReal points to the real input vector + * @param[out] pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + */ + void arm_cmplx_mult_real_q15( + const q15_t * pSrcCmplx, + const q15_t * pSrcReal, + q15_t * pCmplxDst, + uint32_t numSamples); + + + /** + * @brief Q31 complex-by-real multiplication + * @param[in] pSrcCmplx points to the complex input vector + * @param[in] pSrcReal points to the real input vector + * @param[out] pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + */ + void arm_cmplx_mult_real_q31( + const q31_t * pSrcCmplx, + const q31_t * pSrcReal, + q31_t * pCmplxDst, + uint32_t numSamples); + + + /** + * @brief Floating-point complex-by-real multiplication + * @param[in] pSrcCmplx points to the complex input vector + * @param[in] pSrcReal points to the real input vector + * @param[out] pCmplxDst points to the complex output vector + * @param[in] numSamples number of samples in each vector + */ + void arm_cmplx_mult_real_f32( + const float32_t * pSrcCmplx, + const float32_t * pSrcReal, + float32_t * pCmplxDst, + uint32_t numSamples); + + + /** + * @brief Minimum value of a Q7 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] result is output pointer + * @param[in] index is the array index of the minimum value in the input buffer. + */ + void arm_min_q7( + const q7_t * pSrc, + uint32_t blockSize, + q7_t * result, + uint32_t * index); + + + /** + * @brief Minimum value of a Q15 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output pointer + * @param[in] pIndex is the array index of the minimum value in the input buffer. + */ + void arm_min_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult, + uint32_t * pIndex); + + + /** + * @brief Minimum value of a Q31 vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output pointer + * @param[out] pIndex is the array index of the minimum value in the input buffer. + */ + void arm_min_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult, + uint32_t * pIndex); + + + /** + * @brief Minimum value of a floating-point vector. + * @param[in] pSrc is input pointer + * @param[in] blockSize is the number of samples to process + * @param[out] pResult is output pointer + * @param[out] pIndex is the array index of the minimum value in the input buffer. + */ + void arm_min_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult, + uint32_t * pIndex); + + +/** + * @brief Maximum value of a Q7 vector. + * @param[in] pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] pResult maximum value returned here + * @param[out] pIndex index of maximum value returned here + */ + void arm_max_q7( + const q7_t * pSrc, + uint32_t blockSize, + q7_t * pResult, + uint32_t * pIndex); + + +/** + * @brief Maximum value of a Q15 vector. + * @param[in] pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] pResult maximum value returned here + * @param[out] pIndex index of maximum value returned here + */ + void arm_max_q15( + const q15_t * pSrc, + uint32_t blockSize, + q15_t * pResult, + uint32_t * pIndex); + + +/** + * @brief Maximum value of a Q31 vector. + * @param[in] pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] pResult maximum value returned here + * @param[out] pIndex index of maximum value returned here + */ + void arm_max_q31( + const q31_t * pSrc, + uint32_t blockSize, + q31_t * pResult, + uint32_t * pIndex); + + +/** + * @brief Maximum value of a floating-point vector. + * @param[in] pSrc points to the input buffer + * @param[in] blockSize length of the input vector + * @param[out] pResult maximum value returned here + * @param[out] pIndex index of maximum value returned here + */ + void arm_max_f32( + const float32_t * pSrc, + uint32_t blockSize, + float32_t * pResult, + uint32_t * pIndex); + + /** + @brief Maximum value of a floating-point vector. + @param[in] pSrc points to the input vector + @param[in] blockSize number of samples in input vector + @param[out] pResult maximum value returned here + @return none + */ + void arm_max_no_idx_f32( + const float32_t *pSrc, + uint32_t blockSize, + float32_t *pResult); + + /** + * @brief Q15 complex-by-complex multiplication + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_mult_cmplx_q15( + const q15_t * pSrcA, + const q15_t * pSrcB, + q15_t * pDst, + uint32_t numSamples); + + + /** + * @brief Q31 complex-by-complex multiplication + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_mult_cmplx_q31( + const q31_t * pSrcA, + const q31_t * pSrcB, + q31_t * pDst, + uint32_t numSamples); + + + /** + * @brief Floating-point complex-by-complex multiplication + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[out] pDst points to the output vector + * @param[in] numSamples number of complex samples in each vector + */ + void arm_cmplx_mult_cmplx_f32( + const float32_t * pSrcA, + const float32_t * pSrcB, + float32_t * pDst, + uint32_t numSamples); + + + /** + * @brief Converts the elements of the floating-point vector to Q31 vector. + * @param[in] pSrc points to the floating-point input vector + * @param[out] pDst points to the Q31 output vector + * @param[in] blockSize length of the input vector + */ + void arm_float_to_q31( + const float32_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the floating-point vector to Q15 vector. + * @param[in] pSrc points to the floating-point input vector + * @param[out] pDst points to the Q15 output vector + * @param[in] blockSize length of the input vector + */ + void arm_float_to_q15( + const float32_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the floating-point vector to Q7 vector. + * @param[in] pSrc points to the floating-point input vector + * @param[out] pDst points to the Q7 output vector + * @param[in] blockSize length of the input vector + */ + void arm_float_to_q7( + const float32_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q31 vector to floating-point vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q31_to_float( + const q31_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q31 vector to Q15 vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q31_to_q15( + const q31_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q31 vector to Q7 vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q31_to_q7( + const q31_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q15 vector to floating-point vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q15_to_float( + const q15_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q15 vector to Q31 vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q15_to_q31( + const q15_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q15 vector to Q7 vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q15_to_q7( + const q15_t * pSrc, + q7_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q7 vector to floating-point vector. + * @param[in] pSrc is input pointer + * @param[out] pDst is output pointer + * @param[in] blockSize is the number of samples to process + */ + void arm_q7_to_float( + const q7_t * pSrc, + float32_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q7 vector to Q31 vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_q7_to_q31( + const q7_t * pSrc, + q31_t * pDst, + uint32_t blockSize); + + + /** + * @brief Converts the elements of the Q7 vector to Q15 vector. + * @param[in] pSrc input pointer + * @param[out] pDst output pointer + * @param[in] blockSize number of samples to process + */ + void arm_q7_to_q15( + const q7_t * pSrc, + q15_t * pDst, + uint32_t blockSize); + +/** + * @brief Struct for specifying SVM Kernel + */ +typedef enum +{ + ARM_ML_KERNEL_LINEAR = 0, + /**< Linear kernel */ + ARM_ML_KERNEL_POLYNOMIAL = 1, + /**< Polynomial kernel */ + ARM_ML_KERNEL_RBF = 2, + /**< Radial Basis Function kernel */ + ARM_ML_KERNEL_SIGMOID = 3 + /**< Sigmoid kernel */ +} arm_ml_kernel_type; + + +/** + * @brief Instance structure for linear SVM prediction function. + */ +typedef struct +{ + uint32_t nbOfSupportVectors; /**< Number of support vectors */ + uint32_t vectorDimension; /**< Dimension of vector space */ + float32_t intercept; /**< Intercept */ + const float32_t *dualCoefficients; /**< Dual coefficients */ + const float32_t *supportVectors; /**< Support vectors */ + const int32_t *classes; /**< The two SVM classes */ +} arm_svm_linear_instance_f32; + + +/** + * @brief Instance structure for polynomial SVM prediction function. + */ +typedef struct +{ + uint32_t nbOfSupportVectors; /**< Number of support vectors */ + uint32_t vectorDimension; /**< Dimension of vector space */ + float32_t intercept; /**< Intercept */ + const float32_t *dualCoefficients; /**< Dual coefficients */ + const float32_t *supportVectors; /**< Support vectors */ + const int32_t *classes; /**< The two SVM classes */ + int32_t degree; /**< Polynomial degree */ + float32_t coef0; /**< Polynomial constant */ + float32_t gamma; /**< Gamma factor */ +} arm_svm_polynomial_instance_f32; + +/** + * @brief Instance structure for rbf SVM prediction function. + */ +typedef struct +{ + uint32_t nbOfSupportVectors; /**< Number of support vectors */ + uint32_t vectorDimension; /**< Dimension of vector space */ + float32_t intercept; /**< Intercept */ + const float32_t *dualCoefficients; /**< Dual coefficients */ + const float32_t *supportVectors; /**< Support vectors */ + const int32_t *classes; /**< The two SVM classes */ + float32_t gamma; /**< Gamma factor */ +} arm_svm_rbf_instance_f32; + +/** + * @brief Instance structure for sigmoid SVM prediction function. + */ +typedef struct +{ + uint32_t nbOfSupportVectors; /**< Number of support vectors */ + uint32_t vectorDimension; /**< Dimension of vector space */ + float32_t intercept; /**< Intercept */ + const float32_t *dualCoefficients; /**< Dual coefficients */ + const float32_t *supportVectors; /**< Support vectors */ + const int32_t *classes; /**< The two SVM classes */ + float32_t coef0; /**< Independant constant */ + float32_t gamma; /**< Gamma factor */ +} arm_svm_sigmoid_instance_f32; + +/** + * @brief SVM linear instance init function + * @param[in] S Parameters for SVM functions + * @param[in] nbOfSupportVectors Number of support vectors + * @param[in] vectorDimension Dimension of vector space + * @param[in] intercept Intercept + * @param[in] dualCoefficients Array of dual coefficients + * @param[in] supportVectors Array of support vectors + * @param[in] classes Array of 2 classes ID + * @return none. + * + */ + + +void arm_svm_linear_init_f32(arm_svm_linear_instance_f32 *S, + uint32_t nbOfSupportVectors, + uint32_t vectorDimension, + float32_t intercept, + const float32_t *dualCoefficients, + const float32_t *supportVectors, + const int32_t *classes); + +/** + * @brief SVM linear prediction + * @param[in] S Pointer to an instance of the linear SVM structure. + * @param[in] in Pointer to input vector + * @param[out] pResult Decision value + * @return none. + * + */ + +void arm_svm_linear_predict_f32(const arm_svm_linear_instance_f32 *S, + const float32_t * in, + int32_t * pResult); + + +/** + * @brief SVM polynomial instance init function + * @param[in] S points to an instance of the polynomial SVM structure. + * @param[in] nbOfSupportVectors Number of support vectors + * @param[in] vectorDimension Dimension of vector space + * @param[in] intercept Intercept + * @param[in] dualCoefficients Array of dual coefficients + * @param[in] supportVectors Array of support vectors + * @param[in] classes Array of 2 classes ID + * @param[in] degree Polynomial degree + * @param[in] coef0 coeff0 (scikit-learn terminology) + * @param[in] gamma gamma (scikit-learn terminology) + * @return none. + * + */ + + +void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S, + uint32_t nbOfSupportVectors, + uint32_t vectorDimension, + float32_t intercept, + const float32_t *dualCoefficients, + const float32_t *supportVectors, + const int32_t *classes, + int32_t degree, + float32_t coef0, + float32_t gamma + ); + +/** + * @brief SVM polynomial prediction + * @param[in] S Pointer to an instance of the polynomial SVM structure. + * @param[in] in Pointer to input vector + * @param[out] pResult Decision value + * @return none. + * + */ +void arm_svm_polynomial_predict_f32(const arm_svm_polynomial_instance_f32 *S, + const float32_t * in, + int32_t * pResult); + + +/** + * @brief SVM radial basis function instance init function + * @param[in] S points to an instance of the polynomial SVM structure. + * @param[in] nbOfSupportVectors Number of support vectors + * @param[in] vectorDimension Dimension of vector space + * @param[in] intercept Intercept + * @param[in] dualCoefficients Array of dual coefficients + * @param[in] supportVectors Array of support vectors + * @param[in] classes Array of 2 classes ID + * @param[in] gamma gamma (scikit-learn terminology) + * @return none. + * + */ + +void arm_svm_rbf_init_f32(arm_svm_rbf_instance_f32 *S, + uint32_t nbOfSupportVectors, + uint32_t vectorDimension, + float32_t intercept, + const float32_t *dualCoefficients, + const float32_t *supportVectors, + const int32_t *classes, + float32_t gamma + ); + +/** + * @brief SVM rbf prediction + * @param[in] S Pointer to an instance of the rbf SVM structure. + * @param[in] in Pointer to input vector + * @param[out] pResult decision value + * @return none. + * + */ +void arm_svm_rbf_predict_f32(const arm_svm_rbf_instance_f32 *S, + const float32_t * in, + int32_t * pResult); + +/** + * @brief SVM sigmoid instance init function + * @param[in] S points to an instance of the rbf SVM structure. + * @param[in] nbOfSupportVectors Number of support vectors + * @param[in] vectorDimension Dimension of vector space + * @param[in] intercept Intercept + * @param[in] dualCoefficients Array of dual coefficients + * @param[in] supportVectors Array of support vectors + * @param[in] classes Array of 2 classes ID + * @param[in] coef0 coeff0 (scikit-learn terminology) + * @param[in] gamma gamma (scikit-learn terminology) + * @return none. + * + */ + +void arm_svm_sigmoid_init_f32(arm_svm_sigmoid_instance_f32 *S, + uint32_t nbOfSupportVectors, + uint32_t vectorDimension, + float32_t intercept, + const float32_t *dualCoefficients, + const float32_t *supportVectors, + const int32_t *classes, + float32_t coef0, + float32_t gamma + ); + +/** + * @brief SVM sigmoid prediction + * @param[in] S Pointer to an instance of the rbf SVM structure. + * @param[in] in Pointer to input vector + * @param[out] pResult Decision value + * @return none. + * + */ +void arm_svm_sigmoid_predict_f32(const arm_svm_sigmoid_instance_f32 *S, + const float32_t * in, + int32_t * pResult); + + + +/** + * @brief Instance structure for Naive Gaussian Bayesian estimator. + */ +typedef struct +{ + uint32_t vectorDimension; /**< Dimension of vector space */ + uint32_t numberOfClasses; /**< Number of different classes */ + const float32_t *theta; /**< Mean values for the Gaussians */ + const float32_t *sigma; /**< Variances for the Gaussians */ + const float32_t *classPriors; /**< Class prior probabilities */ + float32_t epsilon; /**< Additive value to variances */ +} arm_gaussian_naive_bayes_instance_f32; + +/** + * @brief Naive Gaussian Bayesian Estimator + * + * @param[in] S points to a naive bayes instance structure + * @param[in] in points to the elements of the input vector. + * @param[in] pBuffer points to a buffer of length numberOfClasses + * @return The predicted class + * + */ + + +uint32_t arm_gaussian_naive_bayes_predict_f32(const arm_gaussian_naive_bayes_instance_f32 *S, + const float32_t * in, + float32_t *pBuffer); + +/** + * @brief Computation of the LogSumExp + * + * In probabilistic computations, the dynamic of the probability values can be very + * wide because they come from gaussian functions. + * To avoid underflow and overflow issues, the values are represented by their log. + * In this representation, multiplying the original exp values is easy : their logs are added. + * But adding the original exp values is requiring some special handling and it is the + * goal of the LogSumExp function. + * + * If the values are x1...xn, the function is computing: + * + * ln(exp(x1) + ... + exp(xn)) and the computation is done in such a way that + * rounding issues are minimised. + * + * The max xm of the values is extracted and the function is computing: + * xm + ln(exp(x1 - xm) + ... + exp(xn - xm)) + * + * @param[in] *in Pointer to an array of input values. + * @param[in] blockSize Number of samples in the input array. + * @return LogSumExp + * + */ + + +float32_t arm_logsumexp_f32(const float32_t *in, uint32_t blockSize); + +/** + * @brief Dot product with log arithmetic + * + * Vectors are containing the log of the samples + * + * @param[in] pSrcA points to the first input vector + * @param[in] pSrcB points to the second input vector + * @param[in] blockSize number of samples in each vector + * @param[in] pTmpBuffer temporary buffer of length blockSize + * @return The log of the dot product . + * + */ + + +float32_t arm_logsumexp_dot_prod_f32(const float32_t * pSrcA, + const float32_t * pSrcB, + uint32_t blockSize, + float32_t *pTmpBuffer); + +/** + * @brief Entropy + * + * @param[in] pSrcA Array of input values. + * @param[in] blockSize Number of samples in the input array. + * @return Entropy -Sum(p ln p) + * + */ + + +float32_t arm_entropy_f32(const float32_t * pSrcA,uint32_t blockSize); + + +/** + * @brief Entropy + * + * @param[in] pSrcA Array of input values. + * @param[in] blockSize Number of samples in the input array. + * @return Entropy -Sum(p ln p) + * + */ + + +float64_t arm_entropy_f64(const float64_t * pSrcA, uint32_t blockSize); + + +/** + * @brief Kullback-Leibler + * + * @param[in] pSrcA Pointer to an array of input values for probability distribution A. + * @param[in] pSrcB Pointer to an array of input values for probability distribution B. + * @param[in] blockSize Number of samples in the input array. + * @return Kullback-Leibler Divergence D(A || B) + * + */ +float32_t arm_kullback_leibler_f32(const float32_t * pSrcA + ,const float32_t * pSrcB + ,uint32_t blockSize); + + +/** + * @brief Kullback-Leibler + * + * @param[in] pSrcA Pointer to an array of input values for probability distribution A. + * @param[in] pSrcB Pointer to an array of input values for probability distribution B. + * @param[in] blockSize Number of samples in the input array. + * @return Kullback-Leibler Divergence D(A || B) + * + */ +float64_t arm_kullback_leibler_f64(const float64_t * pSrcA, + const float64_t * pSrcB, + uint32_t blockSize); + + +/** + * @brief Weighted sum + * + * + * @param[in] *in Array of input values. + * @param[in] *weigths Weights + * @param[in] blockSize Number of samples in the input array. + * @return Weighted sum + * + */ +float32_t arm_weighted_sum_f32(const float32_t *in + , const float32_t *weigths + , uint32_t blockSize); + + +/** + * @brief Barycenter + * + * + * @param[in] in List of vectors + * @param[in] weights Weights of the vectors + * @param[out] out Barycenter + * @param[in] nbVectors Number of vectors + * @param[in] vecDim Dimension of space (vector dimension) + * @return None + * + */ +void arm_barycenter_f32(const float32_t *in + , const float32_t *weights + , float32_t *out + , uint32_t nbVectors + , uint32_t vecDim); + +/** + * @brief Euclidean distance between two vectors + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ + +float32_t arm_euclidean_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + +/** + * @brief Bray-Curtis distance between two vectors + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ +float32_t arm_braycurtis_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + +/** + * @brief Canberra distance between two vectors + * + * This function may divide by zero when samples pA[i] and pB[i] are both zero. + * The result of the computation will be correct. So the division per zero may be + * ignored. + * + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ +float32_t arm_canberra_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + + +/** + * @brief Chebyshev distance between two vectors + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ +float32_t arm_chebyshev_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + + +/** + * @brief Cityblock (Manhattan) distance between two vectors + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ +float32_t arm_cityblock_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + +/** + * @brief Correlation distance between two vectors + * + * The input vectors are modified in place ! + * + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ +float32_t arm_correlation_distance_f32(float32_t *pA,float32_t *pB, uint32_t blockSize); + +/** + * @brief Cosine distance between two vectors + * + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ + +float32_t arm_cosine_distance_f32(const float32_t *pA,const float32_t *pB, uint32_t blockSize); + +/** + * @brief Jensen-Shannon distance between two vectors + * + * This function is assuming that elements of second vector are > 0 + * and 0 only when the corresponding element of first vector is 0. + * Otherwise the result of the computation does not make sense + * and for speed reasons, the cases returning NaN or Infinity are not + * managed. + * + * When the function is computing x log (x / y) with x 0 and y 0, + * it will compute the right value (0) but a division per zero will occur + * and shoudl be ignored in client code. + * + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] blockSize vector length + * @return distance + * + */ + +float32_t arm_jensenshannon_distance_f32(const float32_t *pA,const float32_t *pB,uint32_t blockSize); + +/** + * @brief Minkowski distance between two vectors + * + * @param[in] pA First vector + * @param[in] pB Second vector + * @param[in] n Norm order (>= 2) + * @param[in] blockSize vector length + * @return distance + * + */ + + + +float32_t arm_minkowski_distance_f32(const float32_t *pA,const float32_t *pB, int32_t order, uint32_t blockSize); + +/** + * @brief Dice distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] order Distance order + * @param[in] blockSize Number of samples + * @return distance + * + */ + + +float32_t arm_dice_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Hamming distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_hamming_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Jaccard distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_jaccard_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Kulsinski distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_kulsinski_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Roger Stanimoto distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_rogerstanimoto_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Russell-Rao distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_russellrao_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Sokal-Michener distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_sokalmichener_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Sokal-Sneath distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_sokalsneath_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + +/** + * @brief Yule distance between two vectors + * + * @param[in] pA First vector of packed booleans + * @param[in] pB Second vector of packed booleans + * @param[in] numberOfBools Number of booleans + * @return distance + * + */ + +float32_t arm_yule_distance(const uint32_t *pA, const uint32_t *pB, uint32_t numberOfBools); + + + /** + * @ingroup groupInterpolation + */ + + /** + * @defgroup BilinearInterpolate Bilinear Interpolation + * + * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. + * The underlying function f(x, y) is sampled on a regular grid and the interpolation process + * determines values between the grid points. + * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. + * Bilinear interpolation is often used in image processing to rescale images. + * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. + * + * Algorithm + * \par + * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. + * For floating-point, the instance structure is defined as: + *
+   *   typedef struct
+   *   {
+   *     uint16_t numRows;
+   *     uint16_t numCols;
+   *     float32_t *pData;
+   * } arm_bilinear_interp_instance_f32;
+   * 
+ * + * \par + * where numRows specifies the number of rows in the table; + * numCols specifies the number of columns in the table; + * and pData points to an array of size numRows*numCols values. + * The data table pTable is organized in row order and the supplied data values fall on integer indexes. + * That is, table element (x,y) is located at pTable[x + y*numCols] where x and y are integers. + * + * \par + * Let (x, y) specify the desired interpolation point. Then define: + *
+   *     XF = floor(x)
+   *     YF = floor(y)
+   * 
+ * \par + * The interpolated output point is computed as: + *
+   *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
+   *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
+   *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
+   *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
+   * 
+ * Note that the coordinates (x, y) contain integer and fractional components. + * The integer components specify which portion of the table to use while the + * fractional components control the interpolation processor. + * + * \par + * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. + */ + + + /** + * @addtogroup BilinearInterpolate + * @{ + */ + + /** + * @brief Floating-point bilinear interpolation. + * @param[in,out] S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate. + * @param[in] Y interpolation coordinate. + * @return out interpolated value. + */ + __STATIC_FORCEINLINE float32_t arm_bilinear_interp_f32( + const arm_bilinear_interp_instance_f32 * S, + float32_t X, + float32_t Y) + { + float32_t out; + float32_t f00, f01, f10, f11; + float32_t *pData = S->pData; + int32_t xIndex, yIndex, index; + float32_t xdiff, ydiff; + float32_t b1, b2, b3, b4; + + xIndex = (int32_t) X; + yIndex = (int32_t) Y; + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if (xIndex < 0 || xIndex > (S->numCols - 2) || yIndex < 0 || yIndex > (S->numRows - 2)) + { + return (0); + } + + /* Calculation of index for two nearest points in X-direction */ + index = (xIndex ) + (yIndex ) * S->numCols; + + + /* Read two nearest points in X-direction */ + f00 = pData[index]; + f01 = pData[index + 1]; + + /* Calculation of index for two nearest points in Y-direction */ + index = (xIndex ) + (yIndex+1) * S->numCols; + + + /* Read two nearest points in Y-direction */ + f10 = pData[index]; + f11 = pData[index + 1]; + + /* Calculation of intermediate values */ + b1 = f00; + b2 = f01 - f00; + b3 = f10 - f00; + b4 = f00 - f01 - f10 + f11; + + /* Calculation of fractional part in X */ + xdiff = X - xIndex; + + /* Calculation of fractional part in Y */ + ydiff = Y - yIndex; + + /* Calculation of bi-linear interpolated output */ + out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; + + /* return to application */ + return (out); + } + + + /** + * @brief Q31 bilinear interpolation. + * @param[in,out] S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + __STATIC_FORCEINLINE q31_t arm_bilinear_interp_q31( + arm_bilinear_interp_instance_q31 * S, + q31_t X, + q31_t Y) + { + q31_t out; /* Temporary output */ + q31_t acc = 0; /* output */ + q31_t xfract, yfract; /* X, Y fractional parts */ + q31_t x1, x2, y1, y2; /* Nearest output values */ + int32_t rI, cI; /* Row and column indices */ + q31_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & (q31_t)0xFFF00000) >> 20); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & (q31_t)0xFFF00000) >> 20); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* shift left xfract by 11 to keep 1.31 format */ + xfract = (X & 0x000FFFFF) << 11U; + + /* Read two nearest output values from the index */ + x1 = pYData[(rI) + (int32_t)nCols * (cI) ]; + x2 = pYData[(rI) + (int32_t)nCols * (cI) + 1]; + + /* 20 bits for the fractional part */ + /* shift left yfract by 11 to keep 1.31 format */ + yfract = (Y & 0x000FFFFF) << 11U; + + /* Read two nearest output values from the index */ + y1 = pYData[(rI) + (int32_t)nCols * (cI + 1) ]; + y2 = pYData[(rI) + (int32_t)nCols * (cI + 1) + 1]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ + out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); + acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); + + /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); + + /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); + + /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ + out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); + acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); + + /* Convert acc to 1.31(q31) format */ + return ((q31_t)(acc << 2)); + } + + + /** + * @brief Q15 bilinear interpolation. + * @param[in,out] S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + __STATIC_FORCEINLINE q15_t arm_bilinear_interp_q15( + arm_bilinear_interp_instance_q15 * S, + q31_t X, + q31_t Y) + { + q63_t acc = 0; /* output */ + q31_t out; /* Temporary output */ + q15_t x1, x2, y1, y2; /* Nearest output values */ + q31_t xfract, yfract; /* X, Y fractional parts */ + int32_t rI, cI; /* Row and column indices */ + q15_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & (q31_t)0xFFF00000) >> 20); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & (q31_t)0xFFF00000) >> 20); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* xfract should be in 12.20 format */ + xfract = (X & 0x000FFFFF); + + /* Read two nearest output values from the index */ + x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; + x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; + + /* 20 bits for the fractional part */ + /* yfract should be in 12.20 format */ + yfract = (Y & 0x000FFFFF); + + /* Read two nearest output values from the index */ + y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; + y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ + + /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ + /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ + out = (q31_t) (((q63_t) x1 * (0x0FFFFF - xfract)) >> 4U); + acc = ((q63_t) out * (0x0FFFFF - yfract)); + + /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) x2 * (0x0FFFFF - yfract)) >> 4U); + acc += ((q63_t) out * (xfract)); + + /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) y1 * (0x0FFFFF - xfract)) >> 4U); + acc += ((q63_t) out * (yfract)); + + /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ + out = (q31_t) (((q63_t) y2 * (xfract)) >> 4U); + acc += ((q63_t) out * (yfract)); + + /* acc is in 13.51 format and down shift acc by 36 times */ + /* Convert out to 1.15 format */ + return ((q15_t)(acc >> 36)); + } + + + /** + * @brief Q7 bilinear interpolation. + * @param[in,out] S points to an instance of the interpolation structure. + * @param[in] X interpolation coordinate in 12.20 format. + * @param[in] Y interpolation coordinate in 12.20 format. + * @return out interpolated value. + */ + __STATIC_FORCEINLINE q7_t arm_bilinear_interp_q7( + arm_bilinear_interp_instance_q7 * S, + q31_t X, + q31_t Y) + { + q63_t acc = 0; /* output */ + q31_t out; /* Temporary output */ + q31_t xfract, yfract; /* X, Y fractional parts */ + q7_t x1, x2, y1, y2; /* Nearest output values */ + int32_t rI, cI; /* Row and column indices */ + q7_t *pYData = S->pData; /* pointer to output table values */ + uint32_t nCols = S->numCols; /* num of rows */ + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + rI = ((X & (q31_t)0xFFF00000) >> 20); + + /* Input is in 12.20 format */ + /* 12 bits for the table index */ + /* Index value calculation */ + cI = ((Y & (q31_t)0xFFF00000) >> 20); + + /* Care taken for table outside boundary */ + /* Returns zero output when values are outside table boundary */ + if (rI < 0 || rI > (S->numCols - 2) || cI < 0 || cI > (S->numRows - 2)) + { + return (0); + } + + /* 20 bits for the fractional part */ + /* xfract should be in 12.20 format */ + xfract = (X & (q31_t)0x000FFFFF); + + /* Read two nearest output values from the index */ + x1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) ]; + x2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI) + 1]; + + /* 20 bits for the fractional part */ + /* yfract should be in 12.20 format */ + yfract = (Y & (q31_t)0x000FFFFF); + + /* Read two nearest output values from the index */ + y1 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) ]; + y2 = pYData[((uint32_t)rI) + nCols * ((uint32_t)cI + 1) + 1]; + + /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ + out = ((x1 * (0xFFFFF - xfract))); + acc = (((q63_t) out * (0xFFFFF - yfract))); + + /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ + out = ((x2 * (0xFFFFF - yfract))); + acc += (((q63_t) out * (xfract))); + + /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ + out = ((y1 * (0xFFFFF - xfract))); + acc += (((q63_t) out * (yfract))); + + /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ + out = ((y2 * (yfract))); + acc += (((q63_t) out * (xfract))); + + /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ + return ((q7_t)(acc >> 40)); + } + + /** + * @} end of BilinearInterpolate group + */ + + +/* SMMLAR */ +#define multAcc_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) + +/* SMMLSR */ +#define multSub_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) + +/* SMMULR */ +#define mult_32x32_keep32_R(a, x, y) \ + a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) + +/* SMMLA */ +#define multAcc_32x32_keep32(a, x, y) \ + a += (q31_t) (((q63_t) x * y) >> 32) + +/* SMMLS */ +#define multSub_32x32_keep32(a, x, y) \ + a -= (q31_t) (((q63_t) x * y) >> 32) + +/* SMMUL */ +#define mult_32x32_keep32(a, x, y) \ + a = (q31_t) (((q63_t) x * y ) >> 32) + + +#if defined ( __CC_ARM ) + /* Enter low optimization region - place directly above function definition */ + #if defined( __ARM_ARCH_7EM__ ) + #define LOW_OPTIMIZATION_ENTER \ + _Pragma ("push") \ + _Pragma ("O1") + #else + #define LOW_OPTIMIZATION_ENTER + #endif + + /* Exit low optimization region - place directly after end of function definition */ + #if defined ( __ARM_ARCH_7EM__ ) + #define LOW_OPTIMIZATION_EXIT \ + _Pragma ("pop") + #else + #define LOW_OPTIMIZATION_EXIT + #endif + + /* Enter low optimization region - place directly above function definition */ + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + + /* Exit low optimization region - place directly after end of function definition */ + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined (__ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) + #define LOW_OPTIMIZATION_ENTER + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( __GNUC__ ) + #define LOW_OPTIMIZATION_ENTER \ + __attribute__(( optimize("-O1") )) + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( __ICCARM__ ) + /* Enter low optimization region - place directly above function definition */ + #if defined ( __ARM_ARCH_7EM__ ) + #define LOW_OPTIMIZATION_ENTER \ + _Pragma ("optimize=low") + #else + #define LOW_OPTIMIZATION_ENTER + #endif + + /* Exit low optimization region - place directly after end of function definition */ + #define LOW_OPTIMIZATION_EXIT + + /* Enter low optimization region - place directly above function definition */ + #if defined ( __ARM_ARCH_7EM__ ) + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ + _Pragma ("optimize=low") + #else + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #endif + + /* Exit low optimization region - place directly after end of function definition */ + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( __TI_ARM__ ) + #define LOW_OPTIMIZATION_ENTER + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( __CSMC__ ) + #define LOW_OPTIMIZATION_ENTER + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( __TASKING__ ) + #define LOW_OPTIMIZATION_ENTER + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT + +#elif defined ( _MSC_VER ) || defined(__GNUC_PYTHON__) + #define LOW_OPTIMIZATION_ENTER + #define LOW_OPTIMIZATION_EXIT + #define IAR_ONLY_LOW_OPTIMIZATION_ENTER + #define IAR_ONLY_LOW_OPTIMIZATION_EXIT +#endif + + + +/* Compiler specific diagnostic adjustment */ +#if defined ( __CC_ARM ) + +#elif defined ( __ARMCC_VERSION ) && ( __ARMCC_VERSION >= 6010050 ) + +#elif defined ( __GNUC__ ) +#pragma GCC diagnostic pop + +#elif defined ( __ICCARM__ ) + +#elif defined ( __TI_ARM__ ) + +#elif defined ( __CSMC__ ) + +#elif defined ( __TASKING__ ) + +#elif defined ( _MSC_VER ) + +#else + #error Unknown compiler +#endif + +#ifdef __cplusplus +} +#endif + + +#endif /* _ARM_MATH_H */ + +/** + * + * End of file. + */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_mve_tables.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_mve_tables.h new file mode 100644 index 0000000..4d2c135 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_mve_tables.h @@ -0,0 +1,235 @@ +/* ---------------------------------------------------------------------- + * Project: CMSIS DSP Library + * Title: arm_mve_tables.h + * Description: common tables like fft twiddle factors, Bitreverse, reciprocal etc + * used for MVE implementation only + * + * $Date: 08. January 2020 + * $Revision: V1.7.0 + * + * Target Processor: Cortex-M cores + * -------------------------------------------------------------------- */ +/* + * Copyright (C) 2010-2020 ARM Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #ifndef _ARM_MVE_TABLES_H + #define _ARM_MVE_TABLES_H + + #include "arm_math.h" + + + + + + +#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_16) || defined(ARM_TABLE_TWIDDLECOEF_F32_32) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_16_f32[2]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_16_f32[2]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_16_f32[2]; +extern float32_t rearranged_twiddle_stride1_16_f32[8]; +extern float32_t rearranged_twiddle_stride2_16_f32[8]; +extern float32_t rearranged_twiddle_stride3_16_f32[8]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_64) || defined(ARM_TABLE_TWIDDLECOEF_F32_128) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_64_f32[3]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_64_f32[3]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_64_f32[3]; +extern float32_t rearranged_twiddle_stride1_64_f32[40]; +extern float32_t rearranged_twiddle_stride2_64_f32[40]; +extern float32_t rearranged_twiddle_stride3_64_f32[40]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_256) || defined(ARM_TABLE_TWIDDLECOEF_F32_512) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_256_f32[4]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_256_f32[4]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_256_f32[4]; +extern float32_t rearranged_twiddle_stride1_256_f32[168]; +extern float32_t rearranged_twiddle_stride2_256_f32[168]; +extern float32_t rearranged_twiddle_stride3_256_f32[168]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_1024) || defined(ARM_TABLE_TWIDDLECOEF_F32_2048) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_1024_f32[5]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_1024_f32[5]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_1024_f32[5]; +extern float32_t rearranged_twiddle_stride1_1024_f32[680]; +extern float32_t rearranged_twiddle_stride2_1024_f32[680]; +extern float32_t rearranged_twiddle_stride3_1024_f32[680]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_F32_4096) || defined(ARM_TABLE_TWIDDLECOEF_F32_8192) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_4096_f32[6]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_4096_f32[6]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_4096_f32[6]; +extern float32_t rearranged_twiddle_stride1_4096_f32[2728]; +extern float32_t rearranged_twiddle_stride2_4096_f32[2728]; +extern float32_t rearranged_twiddle_stride3_4096_f32[2728]; +#endif + + +#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */ + +#endif /* defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE) */ + + + +#if defined(ARM_MATH_MVEI) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_16) || defined(ARM_TABLE_TWIDDLECOEF_Q31_32) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_16_q31[2]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_16_q31[2]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_16_q31[2]; +extern q31_t rearranged_twiddle_stride1_16_q31[8]; +extern q31_t rearranged_twiddle_stride2_16_q31[8]; +extern q31_t rearranged_twiddle_stride3_16_q31[8]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_64) || defined(ARM_TABLE_TWIDDLECOEF_Q31_128) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_64_q31[3]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_64_q31[3]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_64_q31[3]; +extern q31_t rearranged_twiddle_stride1_64_q31[40]; +extern q31_t rearranged_twiddle_stride2_64_q31[40]; +extern q31_t rearranged_twiddle_stride3_64_q31[40]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_256) || defined(ARM_TABLE_TWIDDLECOEF_Q31_512) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_256_q31[4]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_256_q31[4]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_256_q31[4]; +extern q31_t rearranged_twiddle_stride1_256_q31[168]; +extern q31_t rearranged_twiddle_stride2_256_q31[168]; +extern q31_t rearranged_twiddle_stride3_256_q31[168]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_1024) || defined(ARM_TABLE_TWIDDLECOEF_Q31_2048) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_1024_q31[5]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_1024_q31[5]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_1024_q31[5]; +extern q31_t rearranged_twiddle_stride1_1024_q31[680]; +extern q31_t rearranged_twiddle_stride2_1024_q31[680]; +extern q31_t rearranged_twiddle_stride3_1024_q31[680]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q31_4096) || defined(ARM_TABLE_TWIDDLECOEF_Q31_8192) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_4096_q31[6]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_4096_q31[6]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_4096_q31[6]; +extern q31_t rearranged_twiddle_stride1_4096_q31[2728]; +extern q31_t rearranged_twiddle_stride2_4096_q31[2728]; +extern q31_t rearranged_twiddle_stride3_4096_q31[2728]; +#endif + + +#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */ + +#endif /* defined(ARM_MATH_MVEI) */ + + + +#if defined(ARM_MATH_MVEI) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_16) || defined(ARM_TABLE_TWIDDLECOEF_Q15_32) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_16_q15[2]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_16_q15[2]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_16_q15[2]; +extern q15_t rearranged_twiddle_stride1_16_q15[8]; +extern q15_t rearranged_twiddle_stride2_16_q15[8]; +extern q15_t rearranged_twiddle_stride3_16_q15[8]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_64) || defined(ARM_TABLE_TWIDDLECOEF_Q15_128) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_64_q15[3]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_64_q15[3]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_64_q15[3]; +extern q15_t rearranged_twiddle_stride1_64_q15[40]; +extern q15_t rearranged_twiddle_stride2_64_q15[40]; +extern q15_t rearranged_twiddle_stride3_64_q15[40]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_256) || defined(ARM_TABLE_TWIDDLECOEF_Q15_512) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_256_q15[4]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_256_q15[4]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_256_q15[4]; +extern q15_t rearranged_twiddle_stride1_256_q15[168]; +extern q15_t rearranged_twiddle_stride2_256_q15[168]; +extern q15_t rearranged_twiddle_stride3_256_q15[168]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_1024) || defined(ARM_TABLE_TWIDDLECOEF_Q15_2048) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_1024_q15[5]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_1024_q15[5]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_1024_q15[5]; +extern q15_t rearranged_twiddle_stride1_1024_q15[680]; +extern q15_t rearranged_twiddle_stride2_1024_q15[680]; +extern q15_t rearranged_twiddle_stride3_1024_q15[680]; +#endif + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_ALL_FFT_TABLES) || defined(ARM_TABLE_TWIDDLECOEF_Q15_4096) || defined(ARM_TABLE_TWIDDLECOEF_Q15_8192) + +extern uint32_t rearranged_twiddle_tab_stride1_arr_4096_q15[6]; +extern uint32_t rearranged_twiddle_tab_stride2_arr_4096_q15[6]; +extern uint32_t rearranged_twiddle_tab_stride3_arr_4096_q15[6]; +extern q15_t rearranged_twiddle_stride1_4096_q15[2728]; +extern q15_t rearranged_twiddle_stride2_4096_q15[2728]; +extern q15_t rearranged_twiddle_stride3_4096_q15[2728]; +#endif + + +#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */ + +#endif /* defined(ARM_MATH_MVEI) */ + + + +#if defined(ARM_MATH_MVEI) + +#if !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) + + +#endif /* !defined(ARM_DSP_CONFIG_TABLES) || defined(ARM_FFT_ALLOW_TABLES) */ + +#endif /* defined(ARM_MATH_MVEI) */ + + + +#endif /*_ARM_MVE_TABLES_H*/ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_vec_math.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_vec_math.h new file mode 100644 index 0000000..0ce9464 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/CMSIS/cmsis_dsp/include/arm_vec_math.h @@ -0,0 +1,372 @@ +/****************************************************************************** + * @file arm_vec_math.h + * @brief Public header file for CMSIS DSP Library + * @version V1.7.0 + * @date 15. October 2019 + ******************************************************************************/ +/* + * Copyright (c) 2010-2019 Arm Limited or its affiliates. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _ARM_VEC_MATH_H +#define _ARM_VEC_MATH_H + +#include "arm_math.h" +#include "arm_common_tables.h" +#include "arm_helium_utils.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + +#if (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE) + +#define INV_NEWTON_INIT_F32 0x7EF127EA + +static const float32_t __logf_rng_f32=0.693147180f; + + +/* fast inverse approximation (3x newton) */ +__STATIC_INLINE f32x4_t vrecip_medprec_f32( + f32x4_t x) +{ + q31x4_t m; + f32x4_t b; + any32x4_t xinv; + f32x4_t ax = vabsq(x); + + xinv.f = ax; + m = 0x3F800000 - (xinv.i & 0x7F800000); + xinv.i = xinv.i + m; + xinv.f = 1.41176471f - 0.47058824f * xinv.f; + xinv.i = xinv.i + m; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + xinv.f = vdupq_m(xinv.f, INFINITY, vcmpeqq(x, 0.0f)); + /* + * restore sign + */ + xinv.f = vnegq_m(xinv.f, xinv.f, vcmpltq(x, 0.0f)); + + return xinv.f; +} + +/* fast inverse approximation (4x newton) */ +__STATIC_INLINE f32x4_t vrecip_hiprec_f32( + f32x4_t x) +{ + q31x4_t m; + f32x4_t b; + any32x4_t xinv; + f32x4_t ax = vabsq(x); + + xinv.f = ax; + + m = 0x3F800000 - (xinv.i & 0x7F800000); + xinv.i = xinv.i + m; + xinv.f = 1.41176471f - 0.47058824f * xinv.f; + xinv.i = xinv.i + m; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + b = 2.0f - xinv.f * ax; + xinv.f = xinv.f * b; + + xinv.f = vdupq_m(xinv.f, INFINITY, vcmpeqq(x, 0.0f)); + /* + * restore sign + */ + xinv.f = vnegq_m(xinv.f, xinv.f, vcmpltq(x, 0.0f)); + + return xinv.f; +} + +__STATIC_INLINE f32x4_t vdiv_f32( + f32x4_t num, f32x4_t den) +{ + return vmulq(num, vrecip_hiprec_f32(den)); +} + +/** + @brief Single-precision taylor dev. + @param[in] x f32 quad vector input + @param[in] coeffs f32 quad vector coeffs + @return destination f32 quad vector + */ + +__STATIC_INLINE f32x4_t vtaylor_polyq_f32( + f32x4_t x, + const float32_t * coeffs) +{ + f32x4_t A = vfmasq(vdupq_n_f32(coeffs[4]), x, coeffs[0]); + f32x4_t B = vfmasq(vdupq_n_f32(coeffs[6]), x, coeffs[2]); + f32x4_t C = vfmasq(vdupq_n_f32(coeffs[5]), x, coeffs[1]); + f32x4_t D = vfmasq(vdupq_n_f32(coeffs[7]), x, coeffs[3]); + f32x4_t x2 = vmulq(x, x); + f32x4_t x4 = vmulq(x2, x2); + f32x4_t res = vfmaq(vfmaq_f32(A, B, x2), vfmaq_f32(C, D, x2), x4); + + return res; +} + +__STATIC_INLINE f32x4_t vmant_exp_f32( + f32x4_t x, + int32x4_t * e) +{ + any32x4_t r; + int32x4_t n; + + r.f = x; + n = r.i >> 23; + n = n - 127; + r.i = r.i - (n << 23); + + *e = n; + return r.f; +} + + +__STATIC_INLINE f32x4_t vlogq_f32(f32x4_t vecIn) +{ + q31x4_t vecExpUnBiased; + f32x4_t vecTmpFlt0, vecTmpFlt1; + f32x4_t vecAcc0, vecAcc1, vecAcc2, vecAcc3; + f32x4_t vecExpUnBiasedFlt; + + /* + * extract exponent + */ + vecTmpFlt1 = vmant_exp_f32(vecIn, &vecExpUnBiased); + + vecTmpFlt0 = vecTmpFlt1 * vecTmpFlt1; + /* + * a = (__logf_lut_f32[4] * r.f) + (__logf_lut_f32[0]); + */ + vecAcc0 = vdupq_n_f32(__logf_lut_f32[0]); + vecAcc0 = vfmaq(vecAcc0, vecTmpFlt1, __logf_lut_f32[4]); + /* + * b = (__logf_lut_f32[6] * r.f) + (__logf_lut_f32[2]); + */ + vecAcc1 = vdupq_n_f32(__logf_lut_f32[2]); + vecAcc1 = vfmaq(vecAcc1, vecTmpFlt1, __logf_lut_f32[6]); + /* + * c = (__logf_lut_f32[5] * r.f) + (__logf_lut_f32[1]); + */ + vecAcc2 = vdupq_n_f32(__logf_lut_f32[1]); + vecAcc2 = vfmaq(vecAcc2, vecTmpFlt1, __logf_lut_f32[5]); + /* + * d = (__logf_lut_f32[7] * r.f) + (__logf_lut_f32[3]); + */ + vecAcc3 = vdupq_n_f32(__logf_lut_f32[3]); + vecAcc3 = vfmaq(vecAcc3, vecTmpFlt1, __logf_lut_f32[7]); + /* + * a = a + b * xx; + */ + vecAcc0 = vfmaq(vecAcc0, vecAcc1, vecTmpFlt0); + /* + * c = c + d * xx; + */ + vecAcc2 = vfmaq(vecAcc2, vecAcc3, vecTmpFlt0); + /* + * xx = xx * xx; + */ + vecTmpFlt0 = vecTmpFlt0 * vecTmpFlt0; + vecExpUnBiasedFlt = vcvtq_f32_s32(vecExpUnBiased); + /* + * r.f = a + c * xx; + */ + vecAcc0 = vfmaq(vecAcc0, vecAcc2, vecTmpFlt0); + /* + * add exponent + * r.f = r.f + ((float32_t) m) * __logf_rng_f32; + */ + vecAcc0 = vfmaq(vecAcc0, vecExpUnBiasedFlt, __logf_rng_f32); + // set log0 down to -inf + vecAcc0 = vdupq_m(vecAcc0, -INFINITY, vcmpeqq(vecIn, 0.0f)); + return vecAcc0; +} + +__STATIC_INLINE f32x4_t vexpq_f32( + f32x4_t x) +{ + // Perform range reduction [-log(2),log(2)] + int32x4_t m = vcvtq_s32_f32(vmulq_n_f32(x, 1.4426950408f)); + f32x4_t val = vfmsq_f32(x, vcvtq_f32_s32(m), vdupq_n_f32(0.6931471805f)); + + // Polynomial Approximation + f32x4_t poly = vtaylor_polyq_f32(val, exp_tab); + + // Reconstruct + poly = (f32x4_t) (vqaddq_s32((q31x4_t) (poly), vqshlq_n_s32(m, 23))); + + poly = vdupq_m(poly, 0.0f, vcmpltq_n_s32(m, -126)); + return poly; +} + +__STATIC_INLINE f32x4_t arm_vec_exponent_f32(f32x4_t x, int32_t nb) +{ + f32x4_t r = x; + nb--; + while (nb > 0) { + r = vmulq(r, x); + nb--; + } + return (r); +} + +__STATIC_INLINE f32x4_t vrecip_f32(f32x4_t vecIn) +{ + f32x4_t vecSx, vecW, vecTmp; + any32x4_t v; + + vecSx = vabsq(vecIn); + + v.f = vecIn; + v.i = vsubq(vdupq_n_s32(INV_NEWTON_INIT_F32), v.i); + + vecW = vmulq(vecSx, v.f); + + // v.f = v.f * (8 + w * (-28 + w * (56 + w * (-70 + w *(56 + w * (-28 + w * (8 - w))))))); + vecTmp = vsubq(vdupq_n_f32(8.0f), vecW); + vecTmp = vfmasq(vecW, vecTmp, -28.0f); + vecTmp = vfmasq(vecW, vecTmp, 56.0f); + vecTmp = vfmasq(vecW, vecTmp, -70.0f); + vecTmp = vfmasq(vecW, vecTmp, 56.0f); + vecTmp = vfmasq(vecW, vecTmp, -28.0f); + vecTmp = vfmasq(vecW, vecTmp, 8.0f); + v.f = vmulq(v.f, vecTmp); + + v.f = vdupq_m(v.f, INFINITY, vcmpeqq(vecIn, 0.0f)); + /* + * restore sign + */ + v.f = vnegq_m(v.f, v.f, vcmpltq(vecIn, 0.0f)); + return v.f; +} + +__STATIC_INLINE f32x4_t vtanhq_f32( + f32x4_t val) +{ + f32x4_t x = + vminnmq_f32(vmaxnmq_f32(val, vdupq_n_f32(-10.f)), vdupq_n_f32(10.0f)); + f32x4_t exp2x = vexpq_f32(vmulq_n_f32(x, 2.f)); + f32x4_t num = vsubq_n_f32(exp2x, 1.f); + f32x4_t den = vaddq_n_f32(exp2x, 1.f); + f32x4_t tanh = vmulq_f32(num, vrecip_f32(den)); + return tanh; +} + +__STATIC_INLINE f32x4_t vpowq_f32( + f32x4_t val, + f32x4_t n) +{ + return vexpq_f32(vmulq_f32(n, vlogq_f32(val))); +} + +#endif /* (defined(ARM_MATH_MVEF) || defined(ARM_MATH_HELIUM)) && !defined(ARM_MATH_AUTOVECTORIZE)*/ + +#if (defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) +#endif /* (defined(ARM_MATH_MVEI) || defined(ARM_MATH_HELIUM)) */ + +#if (defined(ARM_MATH_NEON) || defined(ARM_MATH_NEON_EXPERIMENTAL)) && !defined(ARM_MATH_AUTOVECTORIZE) + +#include "NEMath.h" +/** + * @brief Vectorized integer exponentiation + * @param[in] x value + * @param[in] nb integer exponent >= 1 + * @return x^nb + * + */ +__STATIC_INLINE float32x4_t arm_vec_exponent_f32(float32x4_t x, int32_t nb) +{ + float32x4_t r = x; + nb --; + while(nb > 0) + { + r = vmulq_f32(r , x); + nb--; + } + return(r); +} + + +__STATIC_INLINE float32x4_t __arm_vec_sqrt_f32_neon(float32x4_t x) +{ + float32x4_t x1 = vmaxq_f32(x, vdupq_n_f32(FLT_MIN)); + float32x4_t e = vrsqrteq_f32(x1); + e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e); + e = vmulq_f32(vrsqrtsq_f32(vmulq_f32(x1, e), e), e); + return vmulq_f32(x, e); +} + +__STATIC_INLINE int16x8_t __arm_vec_sqrt_q15_neon(int16x8_t vec) +{ + float32x4_t tempF; + int32x4_t tempHI,tempLO; + + tempLO = vmovl_s16(vget_low_s16(vec)); + tempF = vcvtq_n_f32_s32(tempLO,15); + tempF = __arm_vec_sqrt_f32_neon(tempF); + tempLO = vcvtq_n_s32_f32(tempF,15); + + tempHI = vmovl_s16(vget_high_s16(vec)); + tempF = vcvtq_n_f32_s32(tempHI,15); + tempF = __arm_vec_sqrt_f32_neon(tempF); + tempHI = vcvtq_n_s32_f32(tempF,15); + + return(vcombine_s16(vqmovn_s32(tempLO),vqmovn_s32(tempHI))); +} + +__STATIC_INLINE int32x4_t __arm_vec_sqrt_q31_neon(int32x4_t vec) +{ + float32x4_t temp; + + temp = vcvtq_n_f32_s32(vec,31); + temp = __arm_vec_sqrt_f32_neon(temp); + return(vcvtq_n_s32_f32(temp,31)); +} + +#endif /* (defined(ARM_MATH_NEON) || defined(ARM_MATH_NEON_EXPERIMENTAL)) && !defined(ARM_MATH_AUTOVECTORIZE) */ + +#ifdef __cplusplus +} +#endif + + +#endif /* _ARM_VEC_MATH_H */ + +/** + * + * End of file. + */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/BUILD.gn new file mode 100644 index 0000000..f9419fa --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_alarm") { + sources = [ "app_alarm.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.c new file mode 100644 index 0000000..4cb5788 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.c @@ -0,0 +1,726 @@ +/** + **************************************************************************************** + * @file app_alarm.c + * @author BLE Driver Team + * @brief APP Alarm Library. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "grx_hal.h" +#include "app_alarm.h" + +#ifdef HAL_CALENDAR_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + +#define _LOCAL_APP_ALARM_LOCK() \ + uint32_t __l_irq_rest = __get_BASEPRI(); \ + __set_BASEPRI(NVIC_GetPriority(BLE_IRQn) + \ + (1 << (NVIC_GetPriorityGrouping() + 1))); + +#define _LOCAL_APP_ALARM_UNLOCK() \ + __set_BASEPRI(__l_irq_rest); + +#define APP_ALARM_BASE_ALARM_MARK 0x9f00 +#define APP_ALARM_FIRST_YEAR (2000UL) +#define APP_ALARM_SECONDS_PER_HOUR (3600UL) +#define APP_ALARM_SECONDS_PER_DAY (24UL * APP_ALARM_SECONDS_PER_HOUR) +#define APP_ALARM_SECONDS_PER_YEAR (365UL * APP_ALARM_SECONDS_PER_DAY) +#define APP_ALARM_DAYS_PER_MONTH {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} +#define IS_APP_ALARM_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \ + ((__YEAR__) % 400) == 0) + +#define APP_ALARM_LOCK() _LOCAL_APP_ALARM_LOCK() +#define APP_ALARM_UNLOCK() _LOCAL_APP_ALARM_UNLOCK() + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +typedef struct +{ + app_alarm_id_t alarm_id; + uint32_t delay; + app_alarm_t alarm; +} app_alarm_node_t; + +typedef struct +{ + app_alarm_node_t alarm_list[MAX_ALARM_SUPPORT]; + app_alarm_node_t alarm0; + calendar_handle_t handle; + bool initialized; + uint8_t alarm_available; + NvdsTag_t alarm_data_tag; + app_alarm_fun_t callback; +} app_alarm_info_t; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static uint32_t time2seconds(const app_time_t *time); +static void update_alarm_delay(const app_time_t *cur_time, const uint32_t cur_seconds, app_alarm_node_t *alarm_node); +static void calendar_alarm_cb(calendar_handle_t *hcalendar); +static void sort_alarm_list(void); +static uint8_t check_alarm_existed_alarm_id(app_alarm_id_t alarm_id); +static uint8_t check_alarm_existed_alarm(const app_alarm_t *alarm); +static uint16_t save_alarm_list(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static app_alarm_info_t s_app_alarm_info = {0}; + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_alarm_init(NvdsTag_t tag, app_alarm_fun_t callback) +{ + hal_status_t hal_err_code; + uint8_t error_code; + uint16_t len; + app_alarm_node_t alarm_buf[MAX_ALARM_SUPPORT]; + + if (0xFFFF == tag || 0x0000 == tag || NULL == callback) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + /* Clear rtc_alarm globle info */ + memset(&s_app_alarm_info, 0, sizeof(app_alarm_info_t)); + + /* Initialize calendar */ + hal_err_code = hal_calendar_init(&s_app_alarm_info.handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + /* Copy alarm setting from NVDS to buffer */ + s_app_alarm_info.alarm_data_tag = tag; + s_app_alarm_info.callback = callback; + len = sizeof(alarm_buf); + error_code = nvds_get(s_app_alarm_info.alarm_data_tag, &len, (uint8_t *)alarm_buf); + if (NVDS_SUCCESS != error_code) + { + if (NVDS_TAG_NOT_EXISTED == error_code) + { + memset(alarm_buf, 0, sizeof(alarm_buf)); + error_code = nvds_put(s_app_alarm_info.alarm_data_tag, sizeof(alarm_buf), (const uint8_t *)alarm_buf); + if (NVDS_SUCCESS != error_code) + { + return HAL_ERROR; + } + } + else + { + return HAL_ERROR; + } + } + + /* Base alarm, generate an alarm clock at 0 o'clock every day */ + s_app_alarm_info.alarm0.alarm.hour = 0; + s_app_alarm_info.alarm0.alarm.min = 0; + s_app_alarm_info.alarm0.alarm.alarm_date_week_mask = 0x7F; + s_app_alarm_info.alarm0.alarm.alarm_sel = CALENDAR_ALARM_SEL_WEEKDAY; + s_app_alarm_info.alarm0.alarm_id = APP_ALARM_BASE_ALARM_MARK; + + /* Check the number of alarm */ + for (uint8_t i = 0; i < MAX_ALARM_SUPPORT; i++) + { + if (alarm_buf[i].alarm.alarm_date_week_mask) + { + memcpy(&s_app_alarm_info.alarm_list[i], &alarm_buf[i], sizeof(app_alarm_node_t)); + s_app_alarm_info.alarm_available++; + } + } + + s_app_alarm_info.initialized = true; + + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_deinit(void) +{ + hal_status_t hal_err_code; + uint8_t error_code; + + if (!s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_err_code = hal_calendar_disable_event(&s_app_alarm_info.handle, CALENDAR_ALARM_DISABLE_ALL); + HAL_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_calendar_deinit(&s_app_alarm_info.handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + error_code = nvds_del(s_app_alarm_info.alarm_data_tag); + if (NVDS_SUCCESS != error_code) + { + return APP_DRV_ERR_HAL; + } + + /* Clear rtc_alarm globle info */ + memset(&s_app_alarm_info, 0, sizeof(app_alarm_info_t)); + + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_add(const app_alarm_t *alarm, app_alarm_id_t p_alarm_id) +{ + hal_status_t hal_err_code; + app_drv_err_t app_err_code; + + if (NULL == alarm || + MAX_ALARM_SUPPORT <= s_app_alarm_info.alarm_available || + !s_app_alarm_info.initialized || + APP_ALARM_BASE > p_alarm_id) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + APP_ALARM_LOCK(); + /* Check the alarm is existed, avoid to load the same alarm */ + if (check_alarm_existed_alarm(alarm) == s_app_alarm_info.alarm_available) + { + /* Insert to end */ + memcpy(&s_app_alarm_info.alarm_list[s_app_alarm_info.alarm_available].alarm, alarm, sizeof(app_alarm_t)); + s_app_alarm_info.alarm_list[s_app_alarm_info.alarm_available].alarm_id = p_alarm_id ; + s_app_alarm_info.alarm_available++; + + /* Sort alarm then set the lastest */ + sort_alarm_list(); + if (s_app_alarm_info.alarm0.delay <= s_app_alarm_info.alarm_list[0].delay) + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm0.alarm); + } + else + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm_list[0].alarm); + } + + if (HAL_OK != hal_err_code) + { + APP_ALARM_UNLOCK(); + return hal_err_code; + } + + app_err_code = save_alarm_list(); + if (APP_DRV_SUCCESS != app_err_code) + { + APP_ALARM_UNLOCK(); + return app_err_code; + } + } + APP_ALARM_UNLOCK(); + + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_del(app_alarm_id_t alarm_id) +{ + hal_status_t hal_err_code; + app_drv_err_t app_err_code; + + if (0 == s_app_alarm_info.alarm_available || + !s_app_alarm_info.initialized || + APP_ALARM_BASE > alarm_id) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + APP_ALARM_LOCK(); + uint8_t indx = check_alarm_existed_alarm_id(alarm_id); + if (indx < s_app_alarm_info.alarm_available) + { + /* Delete the indx */ + for (uint8_t i = indx; i < s_app_alarm_info.alarm_available - 1; i++) + { + memcpy(&s_app_alarm_info.alarm_list[i], &s_app_alarm_info.alarm_list[i + 1], sizeof(app_alarm_node_t)); + } + s_app_alarm_info.alarm_available--; + /* Check alarm available, if there is not any alarm then disable alarm */ + if (s_app_alarm_info.alarm_available > 0) + { + if (s_app_alarm_info.alarm0.delay <= s_app_alarm_info.alarm_list[0].delay) + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm0.alarm); + } + else + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm_list[0].alarm); + } + if (HAL_OK != hal_err_code) + { + APP_ALARM_UNLOCK(); + return hal_err_code; + } + } + else + { + hal_err_code = hal_calendar_disable_event(&s_app_alarm_info.handle, CALENDAR_ALARM_DISABLE_ALL); + if (HAL_OK != hal_err_code) + { + APP_ALARM_UNLOCK(); + return hal_err_code; + } + } + + app_err_code = save_alarm_list(); + if (APP_DRV_SUCCESS != app_err_code) + { + APP_ALARM_UNLOCK(); + return app_err_code; + } + } + else + { + APP_ALARM_UNLOCK(); + return APP_DRV_ERR_INVALID_PARAM; + } + + APP_ALARM_UNLOCK(); + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_del_all(void) +{ + hal_status_t hal_err_code; + app_drv_err_t app_err_code; + + if (0 == s_app_alarm_info.alarm_available || + !s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + APP_ALARM_LOCK(); + for (uint8_t i = 0; i < s_app_alarm_info.alarm_available; i++) + { + memset(&s_app_alarm_info.alarm_list[i], 0, sizeof(app_alarm_node_t)); + } + s_app_alarm_info.alarm_available = 0; + hal_err_code = hal_calendar_disable_event(&s_app_alarm_info.handle, CALENDAR_ALARM_DISABLE_ALL); + if (HAL_OK != hal_err_code) + { + APP_ALARM_UNLOCK(); + return hal_err_code; + } + + app_err_code = save_alarm_list(); + if (APP_DRV_SUCCESS != app_err_code) + { + APP_ALARM_UNLOCK(); + return app_err_code; + } + + APP_ALARM_UNLOCK(); + + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_get_time(app_time_t *p_time) +{ + hal_status_t hal_err_code; + + if (p_time == NULL || !s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_err_code = hal_calendar_get_time(&s_app_alarm_info.handle, p_time); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_alarm_set_time(app_time_t *p_time) +{ + hal_status_t hal_err_code; + + if (p_time == NULL || !s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_err_code = hal_calendar_init_time(&s_app_alarm_info.handle, p_time); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} + +/* If you reset system time, you should call this function again */ +uint16_t app_alarm_reload(void) +{ + hal_status_t hal_err_code; + + if (!s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (0 < s_app_alarm_info.alarm_available) + { + /* Sort alarm then set the lastest */ + sort_alarm_list(); + sys_delay_ms(100); + if (s_app_alarm_info.alarm0.delay <= s_app_alarm_info.alarm_list[0].delay) + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm0.alarm); + } + else + { + hal_err_code = hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm_list[0].alarm); + } + HAL_ERR_CODE_CHECK(hal_err_code); + } + + return APP_DRV_SUCCESS; +} + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/* Caculate seconds from 01.01.2000 00:00 to the input time */ +static uint32_t time2seconds(const app_time_t *time) +{ + uint32_t seconds = 0; + uint32_t mon_days[12] = APP_ALARM_DAYS_PER_MONTH; + + seconds = time->year * APP_ALARM_SECONDS_PER_YEAR + ((time->year + 3) / 4) * APP_ALARM_SECONDS_PER_DAY; + + mon_days[1] = IS_APP_ALARM_LEAP_YEAR((uint32_t)time->year + APP_ALARM_FIRST_YEAR) ? 29 : 28; + for (uint32_t i = 0; i < time->mon - 1; i++) + { + seconds += mon_days[i] * APP_ALARM_SECONDS_PER_DAY; + } + + seconds += (uint32_t)(time->date - 1) * APP_ALARM_SECONDS_PER_DAY; + + seconds += (uint32_t)time->hour * APP_ALARM_SECONDS_PER_HOUR; + + seconds += (uint32_t)time->min * 60 + (uint32_t)time->sec; + + return seconds; +} + +/* To caculate how long it will take to get to the alarm time from now */ +static void update_alarm_delay(const app_time_t *cur_time, const uint32_t cur_seconds, app_alarm_node_t *alarm_node) +{ + uint32_t alarm_sec = 0; + uint32_t mon_days[12] = APP_ALARM_DAYS_PER_MONTH; + app_time_t time; + + mon_days[1] = IS_APP_ALARM_LEAP_YEAR((uint32_t)cur_time->year + APP_ALARM_FIRST_YEAR) ? 29 : 28; + + memcpy(&time, cur_time, sizeof(app_time_t)); + /* Set current hour, min and sec to alarm time */ + time.sec = 0; + time.min = alarm_node->alarm.min; + time.hour = alarm_node->alarm.hour; + if (CALENDAR_ALARM_SEL_DATE == alarm_node->alarm.alarm_sel) + { + /* Type of alarm is date every month */ + time.date = alarm_node->alarm.alarm_date_week_mask; + alarm_sec = time2seconds(&time); + /* Calculate the latest alarm time in the future */ + if (alarm_sec <= cur_seconds) + { + if (++time.mon > 12) + { + time.mon = 1; + time.year++; + } + else + { + if (time.date > mon_days[time.mon - 1]) + { + time.mon++; + } + } + alarm_sec = time2seconds(&time); + } + } + else + { + /* Type of alarm is day every week */ + /* Get the latest date */ + uint8_t mask = 1 << time.week; + do { + /* Check if the alarm time is over current time */ + if (mask & alarm_node->alarm.alarm_date_week_mask) + { + alarm_sec = time2seconds(&time); + if (alarm_sec > cur_seconds) + { + break; + } + } + + /* Get the next latest alarm time */ + for (uint8_t day = 1; day < 8; day++) + { + mask <<= 1; + if (0x80 == mask) + { + mask = CALENDAR_ALARM_WEEKDAY_SUN; + } + + if (mask & alarm_node->alarm.alarm_date_week_mask) + { + time.date += day; + break; + } + } + if (time.date > mon_days[time.mon - 1]) + { + time.date -= mon_days[time.mon - 1]; + if (++time.mon > 12) + { + time.mon = 1; + time.year++; + } + } + alarm_sec = time2seconds(&time); + } while(0); + } + + alarm_node->delay = alarm_sec - cur_seconds; +} + +static void calendar_alarm_notify(app_alarm_node_t *alarm_node) +{ + app_time_t time; + + app_alarm_get_time(&time); + + if (time.hour == alarm_node->alarm.hour && time.min == alarm_node->alarm.min) + { + if (0 == alarm_node->alarm.hour && 0 == alarm_node->alarm.min) + { + if (CALENDAR_ALARM_SEL_WEEKDAY == alarm_node->alarm.alarm_sel) + { + if (alarm_node->alarm.alarm_date_week_mask & (1UL << time.week)) + { + s_app_alarm_info.callback(alarm_node->alarm_id); + } + } + else + { + if (alarm_node->alarm.alarm_date_week_mask == time.date) + { + s_app_alarm_info.callback(alarm_node->alarm_id); + } + } + } + else + { + s_app_alarm_info.callback(alarm_node->alarm_id); + } + } +} + +static void calendar_alarm_cb(calendar_handle_t *hcalendar) +{ + app_alarm_node_t alarm_node; + + /* Check alarm available */ + if (0 < s_app_alarm_info.alarm_available) + { + /* Save the current alarm */ + memcpy(&alarm_node, &s_app_alarm_info.alarm_list[0], sizeof(app_alarm_node_t)); + /* Sort for setting next */ + sort_alarm_list(); + + if (s_app_alarm_info.alarm0.delay <= s_app_alarm_info.alarm_list[0].delay) + { + hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm0.alarm); + } + else + { + hal_calendar_set_alarm(&s_app_alarm_info.handle, &s_app_alarm_info.alarm_list[0].alarm); + } + + /* User callback */ + calendar_alarm_notify(&alarm_node); + } +} + +static int32_t partition(app_alarm_node_t *alarm_list, int32_t begin, int32_t end) +{ + uint32_t x = alarm_list[end].delay; + int32_t i = begin - 1; + int32_t j; + app_alarm_node_t tmp; + + for (j = begin; j < end; j++) + { + if (alarm_list[j].delay <= x) + { + i++; + if (j != i) + { + memcpy(&tmp, &alarm_list[i], sizeof(app_alarm_node_t)); + memcpy(&alarm_list[i], &alarm_list[j], sizeof(app_alarm_node_t)); + memcpy(&alarm_list[j], &tmp, sizeof(app_alarm_node_t)); + } + } + } + + if (++i != end) + { + memcpy(&tmp, &alarm_list[i], sizeof(app_alarm_node_t)); + memcpy(&alarm_list[i], &alarm_list[end], sizeof(app_alarm_node_t)); + memcpy(&alarm_list[end], &tmp, sizeof(app_alarm_node_t)); + } + + return i; +} + +static void quick_sort(app_alarm_node_t *alarm_list, int32_t begin, int32_t end) +{ + int32_t m = 0; + + if ((NULL == alarm_list) || (begin >= end)) + { + return; + } + + m = partition(alarm_list, begin, end); + quick_sort(alarm_list, begin, m - 1); + quick_sort(alarm_list, m + 1, end); +} + +static void sort_alarm_list(void) +{ + app_time_t cur_time; + uint32_t cur_sec; + + if (0 < s_app_alarm_info.alarm_available) + { + hal_calendar_get_time(&s_app_alarm_info.handle, &cur_time); + cur_sec = time2seconds(&cur_time); + + /* Update alarm seconds */ + for (uint8_t i = 0; i < s_app_alarm_info.alarm_available; i++) + { + update_alarm_delay(&cur_time, cur_sec, &s_app_alarm_info.alarm_list[i]); + } + + /* sort the seconds */ + quick_sort(s_app_alarm_info.alarm_list, 0, s_app_alarm_info.alarm_available - 1); + + /* update the alarm0 seconds */ + update_alarm_delay(&cur_time, cur_sec, &s_app_alarm_info.alarm0); + } +} + +static uint8_t check_alarm_existed_alarm_id(app_alarm_id_t alarm_id) +{ + uint8_t indx = 0; + + for (; indx < s_app_alarm_info.alarm_available; indx++) + { + if (s_app_alarm_info.alarm_list[indx].alarm_id == alarm_id) + { + break; + } + } + + return indx; +} + +static uint8_t check_alarm_existed_alarm(const app_alarm_t *alarm) +{ + uint8_t indx = 0; + + for (; indx < s_app_alarm_info.alarm_available; indx++) + { + if (!memcmp(&s_app_alarm_info.alarm_list[indx].alarm, alarm, sizeof(app_alarm_t))) + { + break; + } + } + + return indx; +} + +static uint16_t save_alarm_list(void) +{ + uint8_t error_code; + app_alarm_node_t alarm_buf[MAX_ALARM_SUPPORT]; + + if (!s_app_alarm_info.initialized) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + memset(alarm_buf, 0, sizeof(alarm_buf)); + for (uint8_t i = 0; i < s_app_alarm_info.alarm_available; i++) + { + memcpy(&alarm_buf[i], &s_app_alarm_info.alarm_list[i], sizeof(app_alarm_node_t)); + } + + error_code = nvds_put(s_app_alarm_info.alarm_data_tag, sizeof(alarm_buf), (const uint8_t *)alarm_buf); + if (NVDS_SUCCESS != error_code) + { + return error_code; + } + + return APP_DRV_SUCCESS; +} + +/* Calendar HAL driver alarm callback */ +void hal_calendar_alarm_callback(calendar_handle_t *hcalendar) +{ + calendar_alarm_cb(hcalendar); +} + +/* Calendar HAL driver overflow callback */ +void hal_calendar_overflow_callback(calendar_handle_t *hcalendar) +{ + calendar_alarm_cb(hcalendar); +} + +void CALENDAR_IRQHandler(void) +{ + hal_calendar_irq_handler(&s_app_alarm_info.handle); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.h new file mode 100644 index 0000000..e40b540 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_alarm/app_alarm.h @@ -0,0 +1,206 @@ +/** + **************************************************************************************** + * + * @file app_alarm.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of APP Alarm APIs library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +#ifndef __APP_ALARM__ +#define __APP_ALARM__ + +#include "grx_sys.h" +#include "app_drv_error.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_CALENDAR_MODULE_ENABLED + +/** @addtogroup APP_ALARM_DEFINES Macro definition + * @{ + */ + +/**@brief APP ALARM tag mask for user application. + */ +#define APP_ALARM_BASE 0x8000 + +/**@brief Get App Alarm tag for user application. + */ +#define APP_ALARM_ID(idx) (APP_ALARM_BASE | ((idx) & 0x7FFF)) + +/**@brief The maximum number of alarms. + */ +#define MAX_ALARM_SUPPORT 8 + +/**@brief App Alarm base year. + */ +#define APP_ALARM_BASE_YEAR (2000) + +/** @} */ + +/** @defgroup APP_ALARM Time + * @{ + */ + +/** + * @brief App time structure definition + */ +typedef calendar_time_t app_time_t; + +/** + * @brief App alarm structure definition + */ +typedef calendar_alarm_t app_alarm_t; + +/** + * @brief App alarm id definition + */ +typedef uint16_t app_alarm_id_t; + +/** @} */ + +/** @addtogroup APP_ALARM_STRUCTURES Event definition + * @{ + */ + +/** + *@brief The alarm node trigger function. + */ +typedef void (*app_alarm_fun_t)(app_alarm_id_t app_alarm_id); + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_ALARM_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP ALARM according to the specified parameters in the + * NvdsTag_t where the alram data is stored. + * + * @param[in] tag: Location where the alram data is stored. + * @param[in] callback: Pointer to alarm expire callback function + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_alarm_init(NvdsTag_t tag, app_alarm_fun_t callback); + +/** + **************************************************************************************** + * @brief De-initialize the app alarm. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_alarm_deinit(void); + +/** + **************************************************************************************** + * @brief Set a App alarm. + * + * @note if your call the app_alarm_set_time function, + * you should call this function after 1s. + * + * @param[in] alarm: After seconds will generate an alarm interrupt. + * @param[in] alarm_id: the id of alarm node. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_add(const calendar_alarm_t *alarm, app_alarm_id_t alarm_id); + +/** + **************************************************************************************** + * @brief Delete a App alarm from list. + * + * @param[in] alarm_id: the id of alarm node. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_del(app_alarm_id_t alarm_id); + +/** + **************************************************************************************** + * @brief Get current App time. + * + * @param[in] p_time: Pointer to a app time struction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_get_time(calendar_time_t *p_time); + +/** + **************************************************************************************** + * @brief Initialize the app time. + * + * @param[in] p_time: Pointer to a app time struction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_set_time(calendar_time_t *p_time); + +/** + **************************************************************************************** + * @brief Time synchronization function. + * + * @note If you reset system time, you should call this function again after 1s + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_reload(void); + +/** + **************************************************************************************** + * @brief Delete all App alarm from list. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_alarm_del_all(void); + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __APP_ALARM__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/BUILD.gn new file mode 100644 index 0000000..1ddc3ee --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_assert") { + sources = [ "app_assert.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.c old mode 100755 new mode 100644 index f0631d7..908f20e --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.c @@ -41,12 +41,13 @@ * INCLUDE FILES ***************************************************************************************** */ +#include "app_assert.h" +#include "app_log.h" #include #include #include #include -#include "app_log.h" -#include "app_assert.h" + /* * DEFINITIONS @@ -76,7 +77,8 @@ ***************************************************************************************** */ /**@brief Assert information save. */ -struct app_asser_info_t { +struct app_asser_info_t +{ char file_name[APP_ASSERT_FILE_NAME_LEN]; int magic1; int file_line; @@ -94,8 +96,9 @@ struct app_asser_info_t { */ static struct app_asser_info_t s_assert_info; -static sys_assert_cb_t s_assert_cbs = { - .assert_err_cb = app_assert_err_cb, +static sys_assert_cb_t s_assert_cbs = +{ + .assert_err_cb = app_assert_err_cb , .assert_param_cb = app_assert_param_cb, .assert_warn_cb = app_assert_warn_cb, }; @@ -114,28 +117,21 @@ static sys_assert_cb_t s_assert_cbs = { static void app_assert_info_output(uint8_t assert_type) { char assert_info[1024] = {0}; - uint32_t ret; s_assert_info.file_name[APP_ASSERT_FILE_NAME_LEN - 1] = ' '; s_assert_info.expr[APP_ASSERT_FILE_NAME_LEN - 1] = ' '; - if (assert_type == APP_ASSERT_ERROR) { - ret = sprintf_s(assert_info, sizeof(assert_info), "[ERROR] %s", s_assert_info.expr); - if (ret < 0) { - return; - } - } else if (assert_type == APP_ASSERT_WARNING) { - ret = sprintf_s(assert_info, sizeof(assert_info), "[WARNING] Param0:%d,Param1:%d", s_assert_info.param0, - s_assert_info.param1); - if (ret < 0) { - return; - } - } else if (assert_type == APP_ASSERT_PARAM) { - ret = sprintf_s(assert_info, sizeof(assert_info), "[PARAM] Param0:%d,Param1:%d", \ - s_assert_info.param0, s_assert_info.param1); - if (ret < 0) { - return; - } + if (APP_ASSERT_ERROR == assert_type) + { + sprintf(assert_info,"[ERROR] %s", s_assert_info.expr); + } + else if (APP_ASSERT_WARNING == assert_type) + { + sprintf(assert_info,"[WARNING] Param0:%d,Param1:%d", s_assert_info.param0, s_assert_info.param1); + } + else if (APP_ASSERT_PARAM == assert_type) + { + sprintf(assert_info,"[PARAM] Param0:%d,Param1:%d", s_assert_info.param0, s_assert_info.param1); } app_log_output(APP_LOG_LVL_ERROR, @@ -160,8 +156,8 @@ __WEAK void app_assert_warn_cb(int param0, int param1, const char *file, int lin file_name_len = (APP_ASSERT_FILE_NAME_LEN < strlen(file)) ? APP_ASSERT_FILE_NAME_LEN : strlen(file); - memset_s(&s_assert_info, sizeof(s_assert_info), 0, sizeof(s_assert_info)); - memcpy_s(s_assert_info.file_name, sizeof (s_assert_info.file_name), file, file_name_len); + memset(&s_assert_info, 0, sizeof(s_assert_info)); + memcpy(s_assert_info.file_name, file, file_name_len); s_assert_info.magic1 = APP_ASSERT_WARN_MAGIC_1; s_assert_info.file_line = line; @@ -177,14 +173,14 @@ __WEAK void app_assert_warn_cb(int param0, int param1, const char *file, int lin __WEAK void app_assert_param_cb(int param0, int param1, const char *file, int line) { - __disable_irq(); + __disable_irq(); uint32_t file_name_len; file_name_len = (APP_ASSERT_FILE_NAME_LEN < strlen(file)) ? APP_ASSERT_FILE_NAME_LEN : strlen(file); - memset_s(&s_assert_info, sizeof (s_assert_info), 0, sizeof(s_assert_info)); - memcpy_s(s_assert_info.file_name, sizeof (s_assert_info.file_name), file, file_name_len); + memset(&s_assert_info, 0, sizeof(s_assert_info)); + memcpy(s_assert_info.file_name, file, file_name_len); s_assert_info.magic1 = (int)APP_ASSERT_PARAM_MAGIC_1; s_assert_info.file_line = line; @@ -196,13 +192,13 @@ __WEAK void app_assert_param_cb(int param0, int param1, const char *file, int li // Also can store assert info to flash app_assert_info_output(APP_ASSERT_PARAM); - while (1) { - }; + + while(1); } __WEAK void app_assert_err_cb(const char *expr, const char *file, int line) { - __disable_irq(); + __disable_irq(); uint32_t file_name_len; uint32_t expre_len; @@ -210,9 +206,10 @@ __WEAK void app_assert_err_cb(const char *expr, const char *file, int line) file_name_len = (APP_ASSERT_FILE_NAME_LEN < strlen(file)) ? APP_ASSERT_FILE_NAME_LEN : strlen(file); expre_len = (APP_ASSERT_EXPR_NAME_LEN < strlen(expr)) ? APP_ASSERT_EXPR_NAME_LEN : strlen(expr); - memset_s(&s_assert_info, sizeof(s_assert_info), 0, sizeof(s_assert_info)); - memcpy_s(s_assert_info.file_name, sizeof(s_assert_info.file_name), file, file_name_len); - memcpy_s(s_assert_info.expr, sizeof(s_assert_info.expr), expr, expre_len); + memset(&s_assert_info, 0, sizeof(s_assert_info)); + memcpy(s_assert_info.file_name, file, file_name_len); + memcpy(s_assert_info.expr, expr, expre_len); + s_assert_info.magic1 = (int)APP_ASSERT_ERR_MAGIC_1; s_assert_info.file_line = line; s_assert_info.magic2 = (int)APP_ASSERT_ERR_MAGIC_2; @@ -221,8 +218,7 @@ __WEAK void app_assert_err_cb(const char *expr, const char *file, int line) // Also can store assert info to flash app_assert_info_output(APP_ASSERT_ERROR); - while (1) { - }; + while(1); } void app_assert_init(void) @@ -232,7 +228,10 @@ void app_assert_init(void) void app_assert_handler(const char *expr, const char *file, int line) { - if (s_assert_cbs.assert_err_cb) { + if (s_assert_cbs.assert_err_cb) + { s_assert_cbs.assert_err_cb(expr, file, line); } } + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.h old mode 100755 new mode 100644 index c648f83..45bb084 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_assert/app_assert.h @@ -38,8 +38,8 @@ #ifndef __APP_ASSERT_H__ #define __APP_ASSERT_H__ +#include "grx_sys.h" #include -#include "gr55xx_sys.h" /** * @defgroup APP_ASSERT_MAROC Defines @@ -53,7 +53,7 @@ { \ app_assert_handler(#EXPR, __FILE__, __LINE__); \ } \ - } while (0) + } while(0) /** @} */ /** @@ -112,6 +112,11 @@ void app_assert_param_cb(int param0, int param1, const char *file, int line); ***************************************************************************************** */ void app_assert_err_cb(const char *expr, const char *file, int line); + + /** @} */ -#endif \ No newline at end of file +#endif + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/BUILD.gn new file mode 100644 index 0000000..3aa079a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_error") { + sources = [ + "app_error.c", + "cortex_backtrace.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.c old mode 100755 new mode 100644 index 107975c..639f5cf --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.c @@ -41,26 +41,27 @@ * INCLUDE FILES ***************************************************************************************** */ +#include "app_error.h" +#include "app_error_cfg.h" +#include "app_log.h" #include #include #include -#include "app_error_cfg.h" -#include "app_log.h" -#include "app_error.h" /* * DEFINITIONS ***************************************************************************************** */ #define APP_ERROR_INFO_LEN 512 -#define APP_ERROR_CODE_NB 43 +#define APP_ERROR_CODE_NB 46 /* * STRUCTURES ***************************************************************************************** */ /**@brief SDK error code information. */ -typedef struct { +typedef struct +{ sdk_err_t error_code; char *error_info; } error_code_info_t; @@ -69,8 +70,10 @@ typedef struct { * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -#ifndef GR5515_E -static error_code_info_t s_error_code_info[APP_ERROR_CODE_NB] = { +static char s_error_print_info[APP_ERROR_INFO_LEN] = { 0 }; + +static error_code_info_t s_error_code_info[APP_ERROR_CODE_NB] = +{ {SDK_SUCCESS, "Successful."}, {SDK_ERR_INVALID_PARAM, "Invalid parameter supplied."}, {SDK_ERR_POINTER_NULL, "Invalid pointer supplied."}, @@ -114,10 +117,11 @@ static error_code_info_t s_error_code_info[APP_ERROR_CODE_NB] = { {SDK_ERR_INVALID_CID, "Invalid CID supplied."}, {SDK_ERR_INVALID_CHL_NUM, "Invalid channel number supplied."}, {SDK_ERR_NOT_ENOUGH_CREDITS, "Not enough credits."}, + {SDK_ERR_REPEAT_CID, "Invalid repeat CID."}, + {SDK_ERR_CACHE_NOT_ENABLE, "Cache feature is not enabled."}, + {SDK_ERR_CACHE_INVALID, "Cache data is invalid."}, }; -#else -static error_code_info_t s_error_code_info[]; -#endif + /* * GLOBAL FUNCTION DEFINITIONS @@ -126,36 +130,34 @@ static error_code_info_t s_error_code_info[]; __WEAK void app_error_fault_handler(app_error_info_t *p_error_info) { #if APP_ERROR_INFO_PRINT_ENABLE - uint32_t ret; - char s_error_print_info[APP_ERROR_INFO_LEN]; - ret = memset_s(s_error_print_info, sizeof(s_error_print_info), 0, APP_ERROR_INFO_LEN); - if (ret < 0) { - return; - } + memset(s_error_print_info, 0, APP_ERROR_INFO_LEN); - if (APP_ERROR_API_RET == p_error_info->error_type) { - for (uint8_t i = 0; ; i++) { - if (p_error_info->value.error_code == s_error_code_info[i].error_code) { - ret = sprintf_s(s_error_print_info, sizeof (s_error_print_info), - "Error code 0x%04X: %s", - p_error_info->value.error_code, - s_error_code_info[i].error_info); + if (APP_ERROR_API_RET == p_error_info->error_type) + { + for (uint8_t i = 0; ; i++) + { + if (p_error_info->value.error_code == s_error_code_info[i].error_code) + { + sprintf(s_error_print_info, + "Error code 0x%04X: %s", + p_error_info->value.error_code, + s_error_code_info[i].error_info); break; - } else if (i == APP_ERROR_CODE_NB) { - ret = sprintf_s(s_error_print_info, sizeof(s_error_print_info), \ - "Error code 0x%04X: No found information.", p_error_info->value.error_code); + } + else if (APP_ERROR_CODE_NB == i) + { + sprintf(s_error_print_info, "Error code 0x%04X: No found information.", p_error_info->value.error_code); break; } } - } else if (APP_ERROR_BOOL_COMPARE == p_error_info->error_type) { - ret = sprintf_s(s_error_print_info, sizeof(s_error_print_info), - "(%s) is not established.", - p_error_info->value.expr); + } + else if (APP_ERROR_BOOL_COMPARE == p_error_info->error_type) + { + sprintf(s_error_print_info, + "(%s) is not established.", + p_error_info->value.expr); } - if (ret < 0) { - return; - } app_log_output(APP_LOG_LVL_ERROR, APP_LOG_TAG, p_error_info->file, diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.h old mode 100755 new mode 100644 index c50b987..8764158 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error.h @@ -38,8 +38,8 @@ #ifndef __APP_ERROR_H__ #define __APP_ERROR_H__ -#include #include "ble_error.h" +#include /** * @defgroup APP_ERROR_MAROC Defines @@ -48,32 +48,39 @@ /**@brief Macro for calling error handler function if supplied error code isn`t GR_SUCCESS. */ #define APP_ERROR_CHECK(ERROR_CODE) \ - do { \ - if ((ERROR_CODE) != SDK_SUCCESS) { \ - app_error_info_t error_info = { \ + do \ + { \ + if (ERROR_CODE != SDK_SUCCESS) \ + { \ + app_error_info_t error_info = \ + { \ .error_type = APP_ERROR_API_RET, \ - .value.error_code = (ERROR_CODE), \ + .value.error_code = ERROR_CODE, \ .file = __FILE__, \ .func = __FUNCTION__, \ .line = __LINE__, \ }; \ app_error_fault_handler(&error_info); \ } \ - } while (0) + } while(0) /**@brief Macro for calling error handler function if supplied boolean value is false. */ #define APP_BOOL_CHECK(BOOL_VAL) \ - do { \ - if (!(BOOL_VAL)) { \ - app_error_info_t error_info = { \ + do \ + { \ + if (!BOOL_VAL) \ + { \ + app_error_info_t error_info = \ + { \ .error_type = APP_ERROR_BOOL_COMPARE, \ .value.expr = #BOOL_VAL, \ - .file = __FILE__, \ - .func = __FUNCTION__, .line = __LINE__, \ + .file = __FILE__, \ + .func = __FUNCTION__, \ + .line = __LINE__, \ }; \ app_error_fault_handler(&error_info); \ } \ - } while (0) + } while(0) /** @} */ /** @@ -81,7 +88,8 @@ * @{ */ /**@brief App error check type.*/ -typedef enum { +typedef enum +{ APP_ERROR_API_RET, /**< API return error code check failed. */ APP_ERROR_BOOL_COMPARE, /**< Bool value check failed. */ } app_error_type_t; @@ -92,9 +100,11 @@ typedef enum { * @{ */ /**@brief App error info.*/ -typedef struct { +typedef struct +{ app_error_type_t error_type; /**< Error occurred type. */ - union { + union + { sdk_err_t error_code; /**< Error code. */ char const *expr; /**< Error expression. */ } value; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error_cfg.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error_cfg.h old mode 100755 new mode 100644 index 91a5a63..00658df --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error_cfg.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/app_error_cfg.h @@ -38,10 +38,10 @@ #ifndef __APP_ERROR_CFG_H__ #define __APP_ERROR_CFG_H__ +#include "grx_sys.h" #include #include #include -#include "gr55xx.h" /** * @defgroup APP_ERROR_CFG_MAROC Defines @@ -49,22 +49,20 @@ */ #define APP_IS_USING_FREEROTS false /**< Is using FREEROTS or not. */ #define APP_ERROR_DUMP_STACK_INFO_ENABLE 1 /**< Enable dump stack information. */ -/**< Enable error information prinf. */ -#define APP_ERROR_INFO_PRINT_ENABLE 1 -/**< Supported function call stack max depth, default is 16. */ -#define APP_ERROR_CALL_STACK_DEPTH_MAX 16 +#define APP_ERROR_INFO_PRINT_ENABLE 1 /**< Enable error information prinf. */ +#define APP_ERROR_CALL_STACK_DEPTH_MAX 16 /**< Supported function call stack max depth, default is 16. */ #if APP_ERROR_INFO_PRINT_ENABLE -#define APP_ERROR_INFO_PRINT(...) printf(__VA_ARGS__);printf("\r\n") /**< Print line. */ + #define APP_ERROR_INFO_PRINT(...) printf(__VA_ARGS__);printf("\r\n");/**< Print line. */ #else -#define APP_ERROR_INFO_PRINT(...) + #define APP_ERROR_INFO_PRINT(...) #endif #if APP_IS_USING_FREEROTS -#include "FreeRTOS.h" -extern uint32_t *vTaskStackAddr(void); -extern uint32_t vTaskStackSize(void); -extern char *vTaskName(void); + #include "FreeRTOS.h" + extern uint32_t *vTaskStackAddr(void); + extern uint32_t vTaskStackSize(void); + extern char *vTaskName(void); #endif /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.c old mode 100755 new mode 100644 index 9d66f4d..5a2c958 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.c @@ -39,17 +39,19 @@ * INCLUDE FILES ***************************************************************************************** */ +#include "cortex_backtrace.h" +#include "app_error.h" +#include "fault_trace.h" #include "app_assert.h" #include "app_log.h" +#include +#include + #if ENABLE_BACKTRACE_FEA -#define CALL_STACK_INFO_CNT 11 -#define BIT_8 8 -#define BIT_9 9 -#define BIT_10 10 #if __STDC_VERSION__ < 199901L -#error "must be C99 or higher. try to add '-std=c99' to compile parameters" + #error "must be C99 or higher. try to add '-std=c99' to compile parameters" #endif /* @@ -64,81 +66,106 @@ #endif #ifdef ENV_USE_FREERTOS -#include "FreeRTOS.h" -#include "task.h" -#define APP_IS_USING_FREEROTS 1 + #include "FreeRTOS.h" + #include "task.h" + #define APP_IS_USING_FREEROTS 1 #endif #ifndef SYS_FAULT_TRACE_MODE -#define SYS_FAULT_TRACE_MODE 1 + #define SYS_FAULT_TRACE_MODE 3 #endif +//----------------------------------------------------------------------------------------------- #define NVDS_FAULT_INFO_LEN_MAX (1024) static char s_fault_info_nvds[NVDS_FAULT_INFO_LEN_MAX] = {0}; static uint32_t s_fault_info_nvds_len = 0; -void fault_trace_nvds_save_prepare(void) +void __fault_trace_nvds_save_prepare(void) { - memset_s(s_fault_info_nvds, NVDS_FAULT_INFO_LEN_MAX, 0, NVDS_FAULT_INFO_LEN_MAX); + memset(s_fault_info_nvds, 0, NVDS_FAULT_INFO_LEN_MAX); s_fault_info_nvds_len = 0; } -void fault_trace_nvds_add(const char *format, ...) +void __fault_trace_nvds_add(const char *format, ...) { - int ret; - int INFO_OFFSET = 100; - - if (s_fault_info_nvds_len + INFO_OFFSET >= NVDS_FAULT_INFO_LEN_MAX) + if (s_fault_info_nvds_len + 100 >= NVDS_FAULT_INFO_LEN_MAX) return; va_list argx; - va_start(argx, format); - ret = vsprintf_s(s_fault_info_nvds+s_fault_info_nvds_len, NVDS_FAULT_INFO_LEN_MAX, format, argx); - if (ret < 0) { - return; - } + va_start(argx,format); + vsprintf(s_fault_info_nvds+s_fault_info_nvds_len,format,argx); va_end(argx); s_fault_info_nvds_len = strlen(s_fault_info_nvds); } -void fault_trace_nvds_save_flush(void) +void __fault_trace_nvds_save_flush(void) { fault_db_record_add((uint8_t *)s_fault_info_nvds, s_fault_info_nvds_len); } - -#if SYS_FAULT_TRACE_MODE == 1 // only UART Print -#define FAULT_TRACE_OUTPUT_PREPARE() -#define FAULT_TRACE_OUTPUT(format, ...) APP_ERROR_INFO_PRINT(format, ##__VA_ARGS__) -#define FAULT_TRACE_OUTPUT_FLUSH() app_log_flush() -#elif SYS_FAULT_TRACE_MODE == 2 // only Save to NVDS -#define FAULT_TRACE_OUTPUT_PREPARE() fault_trace_db_init();fault_trace_nvds_save_prepare() -#define FAULT_TRACE_OUTPUT(format, ...) do { - fault_trace_nvds_add(format, ##__VA_ARGS__); \ - fault_trace_nvds_add("\r\n"); - } while (0) -#define FAULT_TRACE_OUTPUT_FLUSH() fault_trace_nvds_save_flush() +//-------------------------------------------------------------------------------------- +#if SYS_FAULT_TRACE_MODE == 1 //only UART Print + #define __FAULT_TRACE_OUTPUT_PREPARE() + #define __FAULT_TRACE_OUTPUT(format, ...) APP_ERROR_INFO_PRINT(format,##__VA_ARGS__) + #define __FAULT_TRACE_OUTPUT_FLUSH() app_log_flush() +#elif SYS_FAULT_TRACE_MODE == 2 //only Save to NVDS + #define __FAULT_TRACE_OUTPUT_PREPARE() fault_trace_db_init();__fault_trace_nvds_save_prepare() + #define __FAULT_TRACE_OUTPUT(format, ...) __fault_trace_nvds_add(format,##__VA_ARGS__);__fault_trace_nvds_add("\r\n") + #define __FAULT_TRACE_OUTPUT_FLUSH() __fault_trace_nvds_save_flush() #elif SYS_FAULT_TRACE_MODE == 3 // UART Print and Save to NVDS -#define FAULT_TRACE_OUTPUT_PREPARE() fault_trace_db_init();fault_trace_nvds_save_prepare() -#define FAULT_TRACE_OUTPUT(format, ...) do { - APP_ERROR_INFO_PRINT(format, ##__VA_ARGS__); \ - fault_trace_nvds_add(format, ##__VA_ARGS__); \ - fault_trace_nvds_add("\r\n"); \ - } while (0) -#define FAULT_TRACE_OUTPUT_FLUSH() do { - app_log_flush(); \ - fault_trace_nvds_save_flush(); \ - } while (0) + #define __FAULT_TRACE_OUTPUT_PREPARE() fault_trace_db_init();__fault_trace_nvds_save_prepare() + #define __FAULT_TRACE_OUTPUT(format, ...) APP_ERROR_INFO_PRINT(format,##__VA_ARGS__); \ + __fault_trace_nvds_add(format,##__VA_ARGS__);__fault_trace_nvds_add("\r\n") + #define __FAULT_TRACE_OUTPUT_FLUSH() app_log_flush(); \ + __fault_trace_nvds_save_flush() #else -#define FAULT_TRACE_OUTPUT_PREPARE() -#define FAULT_TRACE_OUTPUT(...) -#define FAULT_TRACE_OUTPUT_FLUSH() + #define __FAULT_TRACE_OUTPUT_PREPARE() + #define __FAULT_TRACE_OUTPUT(...) + #define __FAULT_TRACE_OUTPUT_FLUSH() +#endif + +#if defined(__CC_ARM) + #define CSTACK_BLOCK_NAME ARM_LIB_STACK /**< C stack block name: ARM_LIB_STACKHEAP. */ + #define CODE_SECTION_NAME FLASH_CODE /**< Code section name: ER_FLASH. */ + + #define SECTION_START(_name_) _name_##$$Base + #define SECTION_END(_name_) _name_##$$Limit + #define IMAGE_SECTION_START(_name_) Image$$##_name_##$$Base + #define IMAGE_SECTION_END(_name_) Image$$##_name_##$$ZI$$Limit + #define CSTACK_BLOCK_START(_name_) IMAGE_SECTION_START(_name_) + #define CSTACK_BLOCK_END(_name_) IMAGE_SECTION_END(_name_) + #define CODE_SECTION_START(_name_) IMAGE_SECTION_START(_name_) + #define CODE_SECTION_END(_name_) IMAGE_SECTION_END(_name_) + + extern const int CSTACK_BLOCK_START(CSTACK_BLOCK_NAME); + extern const int CSTACK_BLOCK_END(CSTACK_BLOCK_NAME); + extern const int CODE_SECTION_START(CODE_SECTION_NAME); + extern const int CODE_SECTION_END(CODE_SECTION_NAME); +#elif defined(__ICCARM__) + #define CSTACK_BLOCK_NAME "CSTACK" /**< C stack block name, default is 'CSTACK'. */ + #define CODE_SECTION_NAME ".text" /**< Code section name, default is '.text'. */ + + #pragma section = CMB_CSTACK_BLOCK_NAME + #pragma section = CMB_CODE_SECTION_NAME +#elif defined(__GNUC__) + #define CSTACK_BLOCK_START __sstack /**< C stack block start address, defined on linker script file, default is _sstack. */ + #define CSTACK_BLOCK_END __estack /**< C stack block end address, defined on linker script file, default is _estack. */ + #define CODE_SECTION_START __stext /**< code section start address, defined on linker script file, default is _stext. */ + #define CODE_SECTION_END __etext /**< code section end address, defined on linker script file, default is _etext. */ + + extern const int CSTACK_BLOCK_START; + extern const int CSTACK_BLOCK_END; + extern const int CODE_SECTION_START; + extern const int CODE_SECTION_END; +#else + #error "not supported compiler" #endif /* * STRUCTURE ***************************************************************************************** */ -typedef struct { +typedef struct +{ uint32_t code_start_addr; uint32_t code_end_addr; } code_section_info_t; @@ -147,7 +174,8 @@ typedef struct { * ENUMERATION ***************************************************************************************** */ -enum { +enum +{ CB_PRINT_ASSERT_ON_THREAD, CB_PRINT_ASSERT_ON_HANDLER, CB_PRINT_THREAD_STACK_INFO, @@ -190,58 +218,59 @@ enum { * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static const char * const s_print_info[] = { - [CB_PRINT_ASSERT_ON_THREAD] = "Assert on thread %s", - [CB_PRINT_ASSERT_ON_HANDLER] = "Assert on interrupt or bare metal(no OS) environment", - [CB_PRINT_THREAD_STACK_INFO] = "=== Thread stack information ===", - [CB_PRINT_MAIN_STACK_INFO] = "==== Main stack information ====", - [CB_PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow", - [CB_PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow", - [CB_PRINT_CALL_STACK_INFO] = "Call stack info : %.*s", - [CB_PRINT_CALL_STACK_ERR] = "Dump call stack has an error", - [CB_PRINT_FAULT_ON_THREAD] = "Fault on thread %s", - [CB_PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment", - [CB_PRINT_REGS_TITLE] = "==== Registers information =====", - [CB_PRINT_HFSR_VECTBL] = "Hard fault is caused by failed vector fetch", - [CB_PRINT_MFSR_IACCVIOL] = "Memory management: instruction access violation", - [CB_PRINT_MFSR_DACCVIOL] = "Memory management: data access violation", - [CB_PRINT_MFSR_MUNSTKERR] = "Memory management: unstacking error", - [CB_PRINT_MFSR_MSTKERR] = "Memory management: stacking error", - [CB_PRINT_MFSR_MLSPERR] = "Memory management: floating-point lazy state preservation", - [CB_PRINT_BFSR_IBUSERR] = "Bus fault: instruction access violation", - [CB_PRINT_BFSR_PRECISERR] = "Bus fault: precise data access violation", - [CB_PRINT_BFSR_IMPREISERR] = "Bus fault: imprecise data access violation", - [CB_PRINT_BFSR_UNSTKERR] = "Bus fault: unstacking error", - [CB_PRINT_BFSR_STKERR] = "Bus fault: stacking error", - [CB_PRINT_BFSR_LSPERR] = "Bus fault: floating-point lazy state preservation", - [CB_PRINT_UFSR_UNDEFINSTR] = "Usage fault: attempts to execute an undefined instruction", - [CB_PRINT_UFSR_INVSTATE] = "Usage fault: attempts to switch to an invalid state (e.g., ARM)", - [CB_PRINT_UFSR_INVPC] = "Usage fault: \ - attempts to do an exception with a bad value in the EXC_RETURN number", - [CB_PRINT_UFSR_NOCP] = "Usage fault: attempts to execute a coprocessor instruction", - [CB_PRINT_UFSR_UNALIGNED] = "Usage fault: indicates that an unaligned access fault has taken place", - [CB_PRINT_UFSR_DIVBYZERO0] = "Usage fault: Indicates a divide by zero has taken place \ - (can be set only if DIV_0_TRP is set)", - [CB_PRINT_DFSR_HALTED] = "Debug fault: halt requested in NVIC", - [CB_PRINT_DFSR_BKPT] = "Debug fault: BKPT instruction executed", - [CB_PRINT_DFSR_DWTTRAP] = "Debug fault: DWT match occurred", - [CB_PRINT_DFSR_VCATCH] = "Debug fault: Vector fetch occurred", - [CB_PRINT_DFSR_EXTERNAL] = "Debug fault: EDBGRQ signal asserted", - [CB_PRINT_MMAR] = "The memory management fault occurred address is %08x", - [CB_PRINT_BFAR] = "The bus fault occurred address is %08x", +static const char * const s_print_info[] = +{ + [CB_PRINT_ASSERT_ON_THREAD] = "Assert on thread %s", + [CB_PRINT_ASSERT_ON_HANDLER] = "Assert on interrupt or bare metal(no OS) environment", + [CB_PRINT_THREAD_STACK_INFO] = "=== Thread stack information ===", + [CB_PRINT_MAIN_STACK_INFO] = "==== Main stack information ====", + [CB_PRINT_THREAD_STACK_OVERFLOW] = "Error: Thread stack(%08x) was overflow", + [CB_PRINT_MAIN_STACK_OVERFLOW] = "Error: Main stack(%08x) was overflow", + [CB_PRINT_CALL_STACK_INFO] = "Call stack info : %.*s", + [CB_PRINT_CALL_STACK_ERR] = "Dump call stack has an error", + [CB_PRINT_FAULT_ON_THREAD] = "Fault on thread %s", + [CB_PRINT_FAULT_ON_HANDLER] = "Fault on interrupt or bare metal(no OS) environment", + [CB_PRINT_REGS_TITLE] = "==== Registers information =====", + [CB_PRINT_HFSR_VECTBL] = "Hard fault is caused by failed vector fetch", + [CB_PRINT_MFSR_IACCVIOL] = "Memory management: instruction access violation", + [CB_PRINT_MFSR_DACCVIOL] = "Memory management: data access violation", + [CB_PRINT_MFSR_MUNSTKERR] = "Memory management: unstacking error", + [CB_PRINT_MFSR_MSTKERR] = "Memory management: stacking error", + [CB_PRINT_MFSR_MLSPERR] = "Memory management: floating-point lazy state preservation", + [CB_PRINT_BFSR_IBUSERR] = "Bus fault: instruction access violation", + [CB_PRINT_BFSR_PRECISERR] = "Bus fault: precise data access violation", + [CB_PRINT_BFSR_IMPREISERR] = "Bus fault: imprecise data access violation", + [CB_PRINT_BFSR_UNSTKERR] = "Bus fault: unstacking error", + [CB_PRINT_BFSR_STKERR] = "Bus fault: stacking error", + [CB_PRINT_BFSR_LSPERR] = "Bus fault: floating-point lazy state preservation", + [CB_PRINT_UFSR_UNDEFINSTR] = "Usage fault: attempts to execute an undefined instruction", + [CB_PRINT_UFSR_INVSTATE] = "Usage fault: attempts to switch to an invalid state (e.g., ARM)", + [CB_PRINT_UFSR_INVPC] = "Usage fault: attempts to do an exception with a bad value in the EXC_RETURN number", + [CB_PRINT_UFSR_NOCP] = "Usage fault: attempts to execute a coprocessor instruction", + [CB_PRINT_UFSR_UNALIGNED] = "Usage fault: indicates that an unaligned access fault has taken place", + [CB_PRINT_UFSR_DIVBYZERO0] = "Usage fault: Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set)", + [CB_PRINT_DFSR_HALTED] = "Debug fault: halt requested in NVIC", + [CB_PRINT_DFSR_BKPT] = "Debug fault: BKPT instruction executed", + [CB_PRINT_DFSR_DWTTRAP] = "Debug fault: DWT match occurred", + [CB_PRINT_DFSR_VCATCH] = "Debug fault: Vector fetch occurred", + [CB_PRINT_DFSR_EXTERNAL] = "Debug fault: EDBGRQ signal asserted", + [CB_PRINT_MMAR] = "The memory management fault occurred address is %08x", + [CB_PRINT_BFAR] = "The bus fault occurred address is %08x", }; -static uint32_t s_main_stack_start_addr = ZERO; -static uint32_t s_main_stack_size = ZERO; +static uint32_t s_main_stack_start_addr = 0; +static uint32_t s_main_stack_size = 0; +//static uint32_t s_code_start_addr = 0; +//static uint32_t s_code_size = 0; static bool s_is_stack_overflow = false; static bool s_is_on_thread_before_fault = false; static bool s_is_on_fault = false; -static char s_call_stack_info[APP_ERROR_CALL_STACK_DEPTH_MAX * CALLBACK_CNT] = { ZERO }; +static char s_call_stack_info[APP_ERROR_CALL_STACK_DEPTH_MAX * (8 + 1)] = { 0 }; static cb_hard_fault_regs_t s_regs; -static uint32_t s_code_section_count = ZERO; +static uint32_t s_code_section_count = 0; static code_section_info_t s_code_section_infos[FAULT_CODE_SECTON_CNT_MAX]; /* @@ -251,45 +280,45 @@ static code_section_info_t s_code_section_infos[FAULT_CODE_SECTON_CNT_MAX]; /**@brief Include or export for supported cb_psp_get and cb_sp_get function */ #if APP_IS_USING_FREEROTS #if defined(__CC_ARM) -static __inline __asm uint32_t cb_psp_get(void) -{ - mrs r0, psp - bx lr -} -static __inline __asm uint32_t cb_sp_get(void) -{ - mov r0, sp - bx lr -} + static __inline __asm uint32_t cb_psp_get(void) + { + mrs r0, psp + bx lr + } + static __inline __asm uint32_t cb_sp_get(void) + { + mov r0, sp + bx lr + } #elif defined(__ICCARM__) // IAR iccarm specific functions Close Raw Asm Code Warning. #pragma diag_suppress=Pe940 -static uint32_t cb_psp_get(void) -{ - __asm("mrs r0, psp"); - __asm("bx lr"); -} -static uint32_t cb_sp_get(void) -{ - __asm("mov r0, sp"); - __asm("bx lr"); -} + static uint32_t cb_psp_get(void) + { + __asm("mrs r0, psp"); + __asm("bx lr"); + } + static uint32_t cb_sp_get(void) + { + __asm("mov r0, sp"); + __asm("bx lr"); + } #pragma diag_default=Pe940 #elif defined(__GNUC__) -__attribute__ ((always_inline)) static inline uint32_t cb_psp_get(void) -{ - register uint32_t result; - __asm volatile ("MRS %0, psp\n" : "=r" (result)); - return(result); -} -__attribute__ ((always_inline)) static inline uint32_t cb_sp_get(void) -{ - register uint32_t result; - __asm volatile ("MOV %0, sp\n" : "=r" (result)); - return(result); -} + __attribute__( ( always_inline ) ) static inline uint32_t cb_psp_get(void) + { + register uint32_t result; + __asm volatile ("MRS %0, psp\n" : "=r" (result) ); + return(result); + } + __attribute__( ( always_inline ) ) static inline uint32_t cb_sp_get(void) + { + register uint32_t result; + __asm volatile ("MOV %0, sp\n" : "=r" (result) ); + return(result); + } #else -#error "not supported compiler" + #error "not supported compiler" #endif #endif @@ -305,8 +334,11 @@ __attribute__ ((always_inline)) static inline uint32_t cb_sp_get(void) */ static void cb_cur_thread_stack_info_get(uint32_t sp, uint32_t *p_start_addr, uint32_t *p_stack_size) { +// APP_ASSERT_CHECK(p_start_addr); +// APP_ASSERT_CHECK(p_stack_size); + *p_start_addr = (uint32_t)vTaskStackAddr(); - *p_stack_size = vTaskStackSize() * sizeof(StackType_t); + *p_stack_size = vTaskStackSize() * sizeof( StackType_t ); } /** @@ -332,449 +364,523 @@ static const char *cb_cur_thread_name_get(void) */ static void cb_stack_info_dump(uint32_t stack_start_addr, uint32_t stack_size, uint32_t *p_stack) { - if (s_is_stack_overflow) { - if (s_is_on_thread_before_fault) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_THREAD_STACK_OVERFLOW], p_stack); - } else { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MAIN_STACK_OVERFLOW], p_stack); + if (s_is_stack_overflow) + { + if (s_is_on_thread_before_fault) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_THREAD_STACK_OVERFLOW], p_stack); + } + else + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MAIN_STACK_OVERFLOW], p_stack); } - if ((uint32_t)p_stack < stack_start_addr) { + if ((uint32_t)p_stack < stack_start_addr) + { p_stack = (uint32_t *)stack_start_addr; - } else if ((uint32_t) p_stack > stack_start_addr + stack_size) { + } + else if ((uint32_t) p_stack > stack_start_addr + stack_size) + { p_stack = (uint32_t *)(stack_start_addr + stack_size); } - } else { - if (s_is_on_thread_before_fault) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_THREAD_STACK_INFO]); - } else { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MAIN_STACK_INFO]); + } + else + { + if (s_is_on_thread_before_fault) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_THREAD_STACK_INFO]); + } + else + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MAIN_STACK_INFO]); } } - for (; (uint32_t)p_stack < stack_start_addr + stack_size; p_stack++) { - FAULT_TRACE_OUTPUT(" addr: %08x data: %08x", p_stack, *p_stack); + for (; (uint32_t)p_stack < stack_start_addr + stack_size; p_stack++) + { + __FAULT_TRACE_OUTPUT(" addr: %08x data: %08x", p_stack, *p_stack); app_log_flush(); } - FAULT_TRACE_OUTPUT("========="); + __FAULT_TRACE_OUTPUT("========="); } #endif #if (__CORTEX_M != CB_CPU_ARM_CORTEX_M0) - -void deal_mvalue(void) -{ - // Memory Management Fault. - if (s_regs.mfsr.bits.IACCVIOL) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_IACCVIOL]); - } - - if (s_regs.mfsr.bits.DACCVIOL) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_DACCVIOL]); - } - - if (s_regs.mfsr.bits.MUNSTKERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MUNSTKERR]); - } - - if (s_regs.mfsr.bits.MSTKERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MSTKERR]); - } - -#if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) - if (s_regs.mfsr.bits.MLSPERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MLSPERR]); - } -#endif - if (s_regs.mfsr.bits.MMARVALID) { - if ((s_regs.mfsr.bits.IACCVIOL) || (s_regs.mfsr.bits.DACCVIOL)) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MMAR], s_regs.mmar); - } - } -} - -void deal_bvalue(void) -{ - if (s_regs.bfsr.bits.IBUSERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_IBUSERR]); - } - - if (s_regs.bfsr.bits.PRECISERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_PRECISERR]); - } - - if (s_regs.bfsr.bits.IMPREISERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_IMPREISERR]); - } - - if (s_regs.bfsr.bits.UNSTKERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_UNSTKERR]); - } - - if (s_regs.bfsr.bits.STKERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_STKERR]); - } - -#if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) - if (s_regs.bfsr.bits.LSPERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_LSPERR]); - } -#endif - - if (s_regs.bfsr.bits.BFARVALID) { - if (s_regs.bfsr.bits.PRECISERR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFAR], s_regs.bfar); - } - } -} - -void deal_uvalue(void) -{ - if (s_regs.ufsr.bits.UNDEFINSTR) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_UNDEFINSTR]); - } - - if (s_regs.ufsr.bits.INVSTATE) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_INVSTATE]); - } - - if (s_regs.ufsr.bits.INVPC) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_INVPC]); - } - - if (s_regs.ufsr.bits.NOCP) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_NOCP]); - } - - if (s_regs.ufsr.bits.UNALIGNED) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_UNALIGNED]); - } - - if (s_regs.ufsr.bits.DIVBYZERO0) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_DIVBYZERO0]); - } -} - -void deal_dvalue(void) -{ - if (s_regs.dfsr.bits.HALTED) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_HALTED]); - } - - if (s_regs.dfsr.bits.BKPT) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_BKPT]); - } - - if (s_regs.dfsr.bits.DWTTRAP) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_DWTTRAP]); - } - - if (s_regs.dfsr.bits.VCATCH) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_VCATCH]); - } - - if (s_regs.dfsr.bits.EXTERNAL) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_EXTERNAL]); - } -} - /** ***************************************************************************************** - * Fault diagnosis then print cause of fault - ***************************************************************************************** - */ + * Fault diagnosis then print cause of fault + ***************************************************************************************** + */ static void cb_fault_diagnosis(void) { - FAULT_TRACE_OUTPUT("Fault reason:"); + __FAULT_TRACE_OUTPUT("Fault reason:"); - if (s_regs.hfsr.bits.VECTBL) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_HFSR_VECTBL]); + if (s_regs.hfsr.bits.VECTBL) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_HFSR_VECTBL]); } - if (s_regs.hfsr.bits.FORCED) { + if (s_regs.hfsr.bits.FORCED) + { // Memory Management Fault. - if (s_regs.mfsr.value) { - deal_mvalue(); - } - // Bus Fault - if (s_regs.bfsr.value) { - deal_bvalue(); - } - // Usage Fault - if (s_regs.ufsr.value) { - deal_uvalue(); - } - } + if (s_regs.mfsr.value) + { + if (s_regs.mfsr.bits.IACCVIOL) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_IACCVIOL]); + } - // Debug Fault - if (s_regs.hfsr.bits.DEBUGEVT) { - if (s_regs.dfsr.value) { - deal_dvalue(); - } - } -} -#endif + if (s_regs.mfsr.bits.DACCVIOL) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_DACCVIOL]); + } + + if (s_regs.mfsr.bits.MUNSTKERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MUNSTKERR]); + } + + if (s_regs.mfsr.bits.MSTKERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MSTKERR]); + } #if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) -#define FPSCR_OFFSET 18 - static uint32_t cb_statck_fpu_reg_del(uint32_t fault_handler_lr, uint32_t sp) - { - bool statck_has_fpu_regs = (fault_handler_lr & (1UL << 4)) == 0 ? true : false; - - // The stack has S0~S15 and FPSCR registers when statck_has_fpu_regs is true, double word align. - return statck_has_fpu_regs == true ? sp + sizeof(size_t) * FPSCR_OFFSET : sp; - } + if (s_regs.mfsr.bits.MLSPERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MFSR_MLSPERR]); + } #endif - static uint32_t cb_backtrace_call_stack_depth(uint32_t *p_buffer, uint32_t size, uint32_t sp) - { - uint32_t stack_start_addr = s_main_stack_start_addr; - uint32_t depth = 0; - uint32_t stack_size = s_main_stack_size; - uint32_t pc; - uint32_t i; - - if (s_is_stack_overflow) { - if (sp < stack_start_addr) { - sp = stack_start_addr; - } else if (sp > stack_start_addr + stack_size) { - sp = stack_start_addr + stack_size; - } - } - // Copy called function address. - for (; sp < stack_start_addr + stack_size; sp += sizeof(uint32_t)) { - // The *sp value may be LR, so need decrease a word to PC. - pc = *((uint32_t *)sp) - sizeof(uint32_t); - - // The Cortex-M using thumb instruction, so the pc must be an odd number. - if (pc % TWO == 0) { - continue; - } - - for (i = 0; i < s_code_section_count; i++) { - if ((pc >= (s_code_section_infos[i].code_start_addr)) && \ - (pc <= (s_code_section_infos[i].code_end_addr)) && \ - (depth < APP_ERROR_CALL_STACK_DEPTH_MAX) && \ - (depth < size) && \ - ((depth != TWO) || (!is_regs_saved_lr_valid) || (pc != p_buffer[1]))) { - // The second depth function may be already saved, so need ignore repeat. - p_buffer[depth++] = pc; - } else if ((depth == TWO) && is_regs_saved_lr_valid && (pc == p_buffer[1])) { - continue; + if (s_regs.mfsr.bits.MMARVALID) + { + if (s_regs.mfsr.bits.IACCVIOL || s_regs.mfsr.bits.DACCVIOL) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_MMAR], s_regs.mmar); } } } - return depth; - } + //Bus Fault + if (s_regs.bfsr.value) + { + if (s_regs.bfsr.bits.IBUSERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_IBUSERR]); + } - /** - ***************************************************************************************** - * Backtrace function call stack - * - * @param[in] p_buffer: Pointer to call stack buffer. - * @param[in] size: Size of call stack buffer. - * @param[in] sp: Stack pointer - * - * @return Depth - ***************************************************************************************** - */ - static uint32_t cb_backtrace_call_stack(uint32_t *p_buffer, uint32_t size, uint32_t sp) - { - uint32_t stack_start_addr = s_main_stack_start_addr; - uint32_t depth = 0; - uint32_t stack_size = s_main_stack_size; - uint32_t pc; - uint32_t i; + if (s_regs.bfsr.bits.PRECISERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_PRECISERR]); + } - bool is_regs_saved_lr_valid = false; - if (!s_is_on_fault) { -#if APP_IS_USING_FREEROTS - // OS environment. - if (cb_sp_get() == cb_psp_get()) { - cb_cur_thread_stack_info_get(sp, &stack_start_addr, &stack_size); + if (s_regs.bfsr.bits.IMPREISERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_IMPREISERR]); + } + + if (s_regs.bfsr.bits.UNSTKERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_UNSTKERR]); + } + + if (s_regs.bfsr.bits.STKERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_STKERR]); + } + +#if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) + if (s_regs.bfsr.bits.LSPERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFSR_LSPERR]); } #endif - depth = cb_backtrace_call_stack_depth(p_buffer, size, sp); - return depth; + if (s_regs.bfsr.bits.BFARVALID) + { + if (s_regs.bfsr.bits.PRECISERR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_BFAR], s_regs.bfar); + } + } } - if (!s_is_stack_overflow) { + // Usage Fault + if (s_regs.ufsr.value) + { + if (s_regs.ufsr.bits.UNDEFINSTR) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_UNDEFINSTR]); + } + + if (s_regs.ufsr.bits.INVSTATE) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_INVSTATE]); + } + + if (s_regs.ufsr.bits.INVPC) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_INVPC]); + } + + if (s_regs.ufsr.bits.NOCP) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_NOCP]); + } + + if (s_regs.ufsr.bits.UNALIGNED) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_UNALIGNED]); + } + + if (s_regs.ufsr.bits.DIVBYZERO0) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_UFSR_DIVBYZERO0]); + } + } + } + + // Debug Fault + if (s_regs.hfsr.bits.DEBUGEVT) + { + if (s_regs.dfsr.value) + { + if (s_regs.dfsr.bits.HALTED) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_HALTED]); + } + + if (s_regs.dfsr.bits.BKPT) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_BKPT]); + } + + if (s_regs.dfsr.bits.DWTTRAP) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_DWTTRAP]); + } + + if (s_regs.dfsr.bits.VCATCH) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_VCATCH]); + } + + if (s_regs.dfsr.bits.EXTERNAL) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_DFSR_EXTERNAL]); + } + } + } +} +#endif + +#if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) +static uint32_t cb_statck_fpu_reg_del(uint32_t fault_handler_lr, uint32_t sp) +{ + bool statck_has_fpu_regs = (fault_handler_lr & (1UL << 4)) == 0 ? true : false; + + // The stack has S0~S15 and FPSCR registers when statck_has_fpu_regs is true, double word align. + return statck_has_fpu_regs == true ? sp + sizeof(size_t) * 18 : sp; +} +#endif + +/** + ***************************************************************************************** + * Backtrace function call stack + * + * @param[in] p_buffer: Pointer to call stack buffer. + * @param[in] size: Size of call stack buffer. + * @param[in] sp: Stack pointer + * + * @return Depth + ***************************************************************************************** + */ +static uint32_t cb_backtrace_call_stack(uint32_t *p_buffer, uint32_t size, uint32_t sp) +{ + uint32_t stack_start_addr = s_main_stack_start_addr; + uint32_t depth = 0; + uint32_t stack_size = s_main_stack_size; + uint32_t pc; + uint32_t i; + + bool is_regs_saved_lr_valid = false; + + if (s_is_on_fault) + { + if (!s_is_stack_overflow) + { // First depth is PC p_buffer[depth++] = s_regs.saved.pc; // Second depth is from LR, so need decrease a word to PC pc = s_regs.saved.lr - sizeof(uint32_t); - for (i = 0; i < s_code_section_count; i++) { - if ((pc >= s_code_section_infos[i].code_start_addr) && - (pc <= s_code_section_infos[i].code_end_addr) && - (depth < APP_ERROR_CALL_STACK_DEPTH_MAX) && - (depth < size)) { + + for (i = 0; i < s_code_section_count; i++) + { + if ((pc >= s_code_section_infos[i].code_start_addr) && \ + (pc <= s_code_section_infos[i].code_end_addr) && \ + (depth < APP_ERROR_CALL_STACK_DEPTH_MAX) && \ + (depth < size)) + { p_buffer[depth++] = pc; is_regs_saved_lr_valid = true; } } } + #if APP_IS_USING_FREEROTS // Program is running on thread before fault. - if (s_is_on_thread_before_fault) { + if (s_is_on_thread_before_fault) + { + cb_cur_thread_stack_info_get(sp, &stack_start_addr, &stack_size); + } + } + else + { + // OS environment. + if (cb_sp_get() == cb_psp_get()) + { cb_cur_thread_stack_info_get(sp, &stack_start_addr, &stack_size); } #endif - depth = cb_backtrace_call_stack_depth(p_buffer, size, sp); - return depth; } - /** - ***************************************************************************************** - * Dump function call stack - * - * @param[in] sp:Pointer to stack. - ***************************************************************************************** - */ - static void cb_call_stack_print(uint32_t sp) + if (s_is_stack_overflow) { - int ret; - uint32_t i; - uint32_t cur_depth = 0; - uint32_t call_stack_buf[APP_ERROR_CALL_STACK_DEPTH_MAX] = {0}; + if (sp < stack_start_addr) + { + sp = stack_start_addr; + } + else if (sp > stack_start_addr + stack_size) + { + sp = stack_start_addr + stack_size; + } + } - cur_depth = cb_backtrace_call_stack(call_stack_buf, APP_ERROR_CALL_STACK_DEPTH_MAX, sp); + // Copy called function address. + for (; sp < stack_start_addr + stack_size; sp += sizeof(uint32_t)) + { + // The *sp value may be LR, so need decrease a word to PC. + pc = *((uint32_t *)sp) - sizeof(uint32_t); - for (i = 0; i < cur_depth; i++) { - ret = sprintf_s(s_call_stack_info + i * CALL_STACK_INFO_CNT, - NVDS_FAULT_INFO_LEN_MAX, "%08lx", call_stack_buf[i]); - if (ret < 0) { - return; + // The Cortex-M using thumb instruction, so the pc must be an odd number. + if (pc % 2 == 0) + { + continue; + } + + for (i = 0; i < s_code_section_count; i++) + { + if ((pc >= s_code_section_infos[i].code_start_addr) && \ + (pc <= s_code_section_infos[i].code_end_addr) && \ + (depth < APP_ERROR_CALL_STACK_DEPTH_MAX) && \ + (depth < size)) + { + // The second depth function may be already saved, so need ignore repeat. + if ((depth == 2) && is_regs_saved_lr_valid && (pc == p_buffer[1])) + { + continue; + } + p_buffer[depth++] = pc; } - s_call_stack_info[i * CALL_STACK_INFO_CNT + BIT_8] = '<'; - s_call_stack_info[i * CALL_STACK_INFO_CNT + BIT_9] = '-'; - s_call_stack_info[i * CALL_STACK_INFO_CNT + BIT_10] = '-'; - } - - if (cur_depth) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_CALL_STACK_INFO], \ - cur_depth * CALL_STACK_INFO_CNT, s_call_stack_info); - } else { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_CALL_STACK_ERR]); } } - /* - * GLOBAL FUNCTION DEFINITIONS - ***************************************************************************************** - */ + return depth; +} - /** - ***************************************************************************************** - * @brief Add Code sections for stack analysis. - ***************************************************************************************** - */ - bool cortex_backtrace_code_section_add(uint32_t code_start_addr, uint32_t code_end_addr) +/** + ***************************************************************************************** + * Dump function call stack + * + * @param[in] sp:Pointer to stack. + ***************************************************************************************** + */ +static void cb_call_stack_print(uint32_t sp) +{ + uint32_t i; + uint32_t cur_depth = 0; + uint32_t call_stack_buf[APP_ERROR_CALL_STACK_DEPTH_MAX] = {0}; + + cur_depth = cb_backtrace_call_stack(call_stack_buf, APP_ERROR_CALL_STACK_DEPTH_MAX, sp); + + for (i = 0; i < cur_depth; i++) { - if (s_code_section_count < FAULT_CODE_SECTON_CNT_MAX) { - return false; - } - - s_code_section_infos[s_code_section_count].code_start_addr = code_start_addr; - s_code_section_infos[s_code_section_count].code_end_addr = code_end_addr - TWO; - ++s_code_section_count; - - return true; +// sprintf(s_call_stack_info + i * (8 + 1), "%08lx", call_stack_buf[i]); +// s_call_stack_info[i * (8 + 1) + 8] = ' '; + sprintf(s_call_stack_info + i * (8 + 3), "%08lx", call_stack_buf[i]); + s_call_stack_info[i * (8 + 3) + 8] = '<'; + s_call_stack_info[i * (8 + 3) + 9] = '-'; + s_call_stack_info[i * (8 + 3) + 10] = '-'; } - void stack_cfg(uint32_t fault_handler_sp) + if (cur_depth) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_CALL_STACK_INFO], cur_depth * (8 + 3), s_call_stack_info); + } + else + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_CALL_STACK_ERR]); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ + +/** + ***************************************************************************************** + * @brief Add Code sections for stack analysis. + ***************************************************************************************** + */ +bool cortex_backtrace_code_section_add(uint32_t code_start_addr, uint32_t code_end_addr) +{ + if (FAULT_CODE_SECTON_CNT_MAX > s_code_section_count) + { + return false; + } + + s_code_section_infos[s_code_section_count].code_start_addr = code_start_addr; + s_code_section_infos[s_code_section_count].code_end_addr = code_end_addr - 2; + ++s_code_section_count; + + return true; +} + +/** + ***************************************************************************************** + * @brief Initialize Cortex backtrace. + ***************************************************************************************** + */ +void cortex_backtrace_fault_handler(uint32_t fault_handler_lr, uint32_t fault_handler_sp) +{ + __FAULT_TRACE_OUTPUT_PREPARE(); + + //BL 0 ER_IROM_BOOT + s_code_section_infos[s_code_section_count ].code_start_addr = 0x00000000; + s_code_section_infos[s_code_section_count ].code_end_addr = 0x000036FE; + //BL 1 ER_IROM_BOOT + s_code_section_infos[s_code_section_count + 1].code_start_addr = 0x00003C00; + s_code_section_infos[s_code_section_count + 1].code_end_addr = 0x00003D3A; + //BL 1 ER_IROM_BLE_STACK + s_code_section_infos[s_code_section_count + 2].code_start_addr = 0x00003D6C; + s_code_section_infos[s_code_section_count + 2].code_end_addr = 0x0005CE3A; + //SDK ER_SDK + s_code_section_infos[s_code_section_count + 3].code_start_addr = 0x00062C00; + s_code_section_infos[s_code_section_count + 3].code_end_addr = 0x0007D0E4; + s_code_section_count += 4; + +// #if SYS_FAULT_TRACE_MODE +// hardfault_trace_handler(fault_handler_lr, fault_handler_sp); +// #endif +#if defined(__CC_ARM) + s_main_stack_start_addr = (uint32_t)&CSTACK_BLOCK_START(CSTACK_BLOCK_NAME); + s_main_stack_size = (uint32_t)&CSTACK_BLOCK_END(CSTACK_BLOCK_NAME) - s_main_stack_start_addr; +// s_code_start_addr = (uint32_t)&CODE_SECTION_START(CODE_SECTION_NAME); +// s_code_size = (uint32_t)&CODE_SECTION_END(CODE_SECTION_NAME) - s_code_start_addr; + uint32_t i_code_start_addr = 0; + uint32_t i_code_size = 0; + i_code_start_addr = (uint32_t)&CODE_SECTION_START(CODE_SECTION_NAME); + i_code_size = (uint32_t)&CODE_SECTION_END(CODE_SECTION_NAME) - i_code_start_addr; +// printf("\r\ni_code_start_addr=0X%x,i_code_size=%d\r\n",i_code_start_addr,i_code_size); + s_code_section_infos[s_code_section_count ].code_start_addr = (uint32_t)&CODE_SECTION_START(CODE_SECTION_NAME); + s_code_section_infos[s_code_section_count ].code_end_addr = (uint32_t)&CODE_SECTION_END(CODE_SECTION_NAME); + s_code_section_count +=1; + +#elif defined(__ICCARM__) + uint32_t s_main_stack_start_addr = (uint32_t)__section_begin(CSTACK_BLOCK_NAME); + uint32_t s_main_stack_size = (uint32_t)__section_end(CSTACK_BLOCK_NAME) - s_main_stack_start_addr; +// uint32_t s_code_start_addr = (uint32_t)__section_begin(CODE_SECTION_NAME); +// uint32_t s_code_size = (uint32_t)__section_end(CODE_SECTION_NAME) - s_code_start_addr; +#elif defined(__GNUC__) + s_main_stack_start_addr = (uint32_t)(&CSTACK_BLOCK_START); + s_main_stack_size = (uint32_t)(&CSTACK_BLOCK_END) - s_main_stack_start_addr; +// uint32_t s_code_start_addr = (uint32_t)(&CODE_SECTION_START); +// uint32_t s_code_size = (uint32_t)(&CODE_SECTION_END) - s_code_start_addr; + s_code_section_infos[s_code_section_count ].code_start_addr = (uint32_t)(&CODE_SECTION_START); + s_code_section_infos[s_code_section_count ].code_end_addr = (uint32_t)(&CODE_SECTION_END); + s_code_section_count +=1; +#else + #error "not supported compiler" +#endif + uint32_t stack_pointer = fault_handler_sp; uint32_t saved_regs_addr = stack_pointer; const char *regs_name[] = { "R0 ", "R1 ", "R2 ", "R3 ", "R12", "LR ", "PC ", "PSR" }; + #if APP_ERROR_DUMP_STACK_INFO_ENABLE uint32_t stack_start_addr = s_main_stack_start_addr; uint32_t stack_size = s_main_stack_size; #endif // Only call once +// APP_ASSERT_CHECK(!s_is_on_fault); + s_is_on_fault = true; + #if APP_IS_USING_FREEROTS - s_is_on_thread_before_fault = fault_handler_lr & (1UL << LEFT_MOV_2BIT); + s_is_on_thread_before_fault = fault_handler_lr & (1UL << 2); // Check which stack was used before (MSP or PSP). - if (s_is_on_thread_before_fault) { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_THREAD], - cb_cur_thread_name_get() ? cb_cur_thread_name_get() : "NO_NAME"); + if (s_is_on_thread_before_fault) + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_THREAD], + cb_cur_thread_name_get() ? cb_cur_thread_name_get() : "NO_NAME"); + stack_pointer = cb_psp_get(); saved_regs_addr = stack_pointer; + #if APP_ERROR_DUMP_STACK_INFO_ENABLE cb_cur_thread_stack_info_get(stack_pointer, &stack_start_addr, &stack_size); #endif - } else { - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_HANDLER]); + } + else + { + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_HANDLER]); } #else - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_HANDLER]); + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_FAULT_ON_HANDLER]); #endif + // Delete saved R0~R3, R12, LR, PC, xPSR registers space - stack_pointer += sizeof(uint32_t) * REGISTER_CNT; + stack_pointer += sizeof(uint32_t) * 8; + #if (__CORTEX_M == CB_CPU_ARM_CORTEX_M4) || (__CORTEX_M == CB_CPU_ARM_CORTEX_M7) stack_pointer = cb_statck_fpu_reg_del(fault_handler_lr, stack_pointer); #endif + #if APP_ERROR_DUMP_STACK_INFO_ENABLE // Check stack overflow. - if (stack_pointer < stack_start_addr || stack_pointer > stack_start_addr + stack_size) { + if (stack_pointer < stack_start_addr || stack_pointer > stack_start_addr + stack_size) + { s_is_stack_overflow = true; } + // Dump stack information. +// cb_stack_info_dump(stack_start_addr, stack_size, (uint32_t *)stack_pointer); #endif -} -void platform_cfg(void) -{ -#if defined(__CC_ARM) - s_main_stack_start_addr = (uint32_t)&CSTACK_BLOCK_START(CSTACK_BLOCK_NAME); - s_main_stack_size = (uint32_t)&(CSTACK_BLOCK_END(CSTACK_BLOCK_NAME) - s_main_stack_start_addr); - uint32_t i_code_start_addr = 0; - uint32_t i_code_size = 0; - i_code_start_addr = (uint32_t)&CODE_SECTION_START(CODE_SECTION_NAME); - i_code_size = (uint32_t)&(CODE_SECTION_END(CODE_SECTION_NAME) - i_code_start_addr); - s_code_section_infos[s_code_section_count ].code_start_addr = (uint32_t)&CODE_SECTION_START(CODE_SECTION_NAME); - s_code_section_infos[s_code_section_count ].code_end_addr = (uint32_t)&CODE_SECTION_END(CODE_SECTION_NAME); - s_code_section_count +=1; -#elif defined(__ICCARM__) - uint32_t s_main_stack_start_addr = (uint32_t)__section_begin(CSTACK_BLOCK_NAME); - uint32_t s_main_stack_size = (uint32_t)__section_end(CSTACK_BLOCK_NAME) - s_main_stack_start_addr; -#elif defined(__GNUC__) - uint32_t s_main_stack_start_addr = (uint32_t)(&CSTACK_BLOCK_START); - uint32_t s_main_stack_size = (uint32_t)(&CSTACK_BLOCK_END) - s_main_stack_start_addr; -#else -#error "not supported compiler" -#endif -} - -void reg_cfg(void) -{ - if (!s_is_stack_overflow) { + if (!s_is_stack_overflow) + { // Dump register. - FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_REGS_TITLE]); + __FAULT_TRACE_OUTPUT(s_print_info[CB_PRINT_REGS_TITLE]); - s_regs.saved.r0 = ((uint32_t *)saved_regs_addr)[DRG_R0]; // Register R0 - s_regs.saved.r1 = ((uint32_t *)saved_regs_addr)[DRG_R1]; // Register R1 - s_regs.saved.r2 = ((uint32_t *)saved_regs_addr)[DRG_R2]; // Register R2 - s_regs.saved.r3 = ((uint32_t *)saved_regs_addr)[DRG_R3]; // Register R3 - s_regs.saved.r12 = ((uint32_t *)saved_regs_addr)[DRG_R4]; // Register R12 - s_regs.saved.lr = ((uint32_t *)saved_regs_addr)[DRG_R5]; // Link register LR - s_regs.saved.pc = ((uint32_t *)saved_regs_addr)[DRG_R6]; // Program Counter PC - s_regs.saved.psr.value = ((uint32_t *)saved_regs_addr)[DRG_R7]; // Program status word PSR + s_regs.saved.r0 = ((uint32_t *)saved_regs_addr)[0]; // Register R0 + s_regs.saved.r1 = ((uint32_t *)saved_regs_addr)[1]; // Register R1 + s_regs.saved.r2 = ((uint32_t *)saved_regs_addr)[2]; // Register R2 + s_regs.saved.r3 = ((uint32_t *)saved_regs_addr)[3]; // Register R3 + s_regs.saved.r12 = ((uint32_t *)saved_regs_addr)[4]; // Register R12 + s_regs.saved.lr = ((uint32_t *)saved_regs_addr)[5]; // Link register LR + s_regs.saved.pc = ((uint32_t *)saved_regs_addr)[6]; // Program Counter PC + s_regs.saved.psr.value = ((uint32_t *)saved_regs_addr)[7]; // Program status word PSR - FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[0], s_regs.saved.r0, \ - regs_name[1], s_regs.saved.r1); - FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[2], s_regs.saved.r2, \ - regs_name[3], s_regs.saved.r3); - FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[4], s_regs.saved.r12, \ - regs_name[5], s_regs.saved.lr); - FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[6], s_regs.saved.pc, \ - regs_name[7], s_regs.saved.psr.value); - FAULT_TRACE_OUTPUT("========="); + __FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[0], s_regs.saved.r0, regs_name[1], s_regs.saved.r1); + __FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[2], s_regs.saved.r2, regs_name[3], s_regs.saved.r3); + __FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[4], s_regs.saved.r12, regs_name[5], s_regs.saved.lr); + __FAULT_TRACE_OUTPUT(" %s: %08x %s: %08x", regs_name[6], s_regs.saved.pc, regs_name[7], s_regs.saved.psr.value); + __FAULT_TRACE_OUTPUT("========="); } // The Cortex-M0 is not support fault diagnosis. @@ -791,53 +897,9 @@ void reg_cfg(void) cb_fault_diagnosis(); #endif -} -void GR5515_D_cfg(void) -{ -#if defined(GR5515_D) -#define CODE_INDEX1 1 -#define CODE_INDEX2 2 -#define CODE_INDEX3 3 - // BL 0 ER_IROM_BOOT - s_code_section_infos[s_code_section_count ].code_start_addr = 0x00000000; - s_code_section_infos[s_code_section_count ].code_end_addr = 0x000036FE; - // BL 1 ER_IROM_BOOT - s_code_section_infos[s_code_section_count + CODE_INDEX1].code_start_addr = 0x00003C00; - s_code_section_infos[s_code_section_count + CODE_INDEX1].code_end_addr = 0x00003D3A; - // BL 1 ER_IROM_BLE_STACK - s_code_section_infos[s_code_section_count + CODE_INDEX2].code_start_addr = 0x00003D6C; - s_code_section_infos[s_code_section_count + CODE_INDEX2].code_end_addr = 0x0005CE3A; - // SDK ER_SDK - s_code_section_infos[s_code_section_count + CODE_INDEX3].code_start_addr = 0x00062C00; - s_code_section_infos[s_code_section_count + CODE_INDEX3].code_end_addr = 0x0007D0E4; - s_code_section_count += FOUR; -#else - // ER_IROM_BOOT - s_code_section_infos[s_code_section_count ].code_start_addr = 0x00004000; - s_code_section_infos[s_code_section_count ].code_end_addr = 0x0000413A; - // ER_IROM_BLE_STACK - s_code_section_infos[s_code_section_count + 1].code_start_addr = 0x0000416C; - s_code_section_infos[s_code_section_count + 1].code_end_addr = 0x0004c25A; - s_code_section_count += TWO; -#endif -} - -/** - ***************************************************************************************** - * @brief Initialize Cortex backtrace. - ***************************************************************************************** - */ -void cortex_backtrace_fault_handler(uint32_t fault_handler_lr, uint32_t fault_handler_sp) -{ - FAULT_TRACE_OUTPUT_PREPARE(); - - GR5515_D_cfg(); - platform_cfg(); - stack_cfg(fault_handler_sp); - reg_cfg(); cb_call_stack_print(stack_pointer); - FAULT_TRACE_OUTPUT_FLUSH(); + __FAULT_TRACE_OUTPUT_FLUSH(); } #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.h old mode 100755 new mode 100644 index 2bc5fa1..8af0d2b --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/cortex_backtrace.h @@ -38,71 +38,8 @@ #ifndef __CORTEX_BACKTRACE_H__ #define __CORTEX_BACKTRACE_H__ -#include #include "app_error_cfg.h" - -#if ENABLE_BACKTRACE_FEASS -#define TWO 2 -#define FOUR 4 -#define LEFT_MOV_2BIT 2 -#define REGISTER_CNT 8 -#define DRG_R0 0 -#define DRG_R1 1 -#define DRG_R2 2 -#define DRG_R3 3 -#define DRG_R4 4 -#define DRG_R5 5 -#define DRG_R6 6 -#define DRG_R7 7 - -#if defined(__CC_ARM) -#define CSTACK_BLOCK_NAME ARM_LIB_STACKHEAP /**< C stack block name: ARM_LIB_STACKHEAP. */ -#define CODE_SECTION_NAME FLASH_CODE /**< Code section name: ER_FLASH. */ - -#define SECTION_START(_name_) _name_##$$Base -#define SECTION_END(_name_) _name_##$$Limit -#define IMAGE_SECTION_START(_name_) Image$$##_name_##$$Base -#define IMAGE_SECTION_END(_name_) Image$$##_name_##$$ZI$$Limit -#define CSTACK_BLOCK_START(_name_) IMAGE_SECTION_START(_name_) -#define CSTACK_BLOCK_END(_name_) IMAGE_SECTION_END(_name_) -#define CODE_SECTION_START(_name_) IMAGE_SECTION_START(_name_) -#define CODE_SECTION_END(_name_) IMAGE_SECTION_END(_name_) - -extern const int CSTACK_BLOCK_START(CSTACK_BLOCK_NAME); -extern const int CSTACK_BLOCK_END(CSTACK_BLOCK_NAME); -extern const int CODE_SECTION_START(CODE_SECTION_NAME); -extern const int CODE_SECTION_END(CODE_SECTION_NAME); -#elif defined(__ICCARM__) -#define CSTACK_BLOCK_NAME "CSTACK" /**< C stack block name, default is 'CSTACK'. */ -#define CODE_SECTION_NAME ".text" /**< Code section name, default is '.text'. */ - -#pragma section = CMB_CSTACK_BLOCK_NAME -#pragma section = CMB_CODE_SECTION_NAME -#elif defined(__GNUC__) - -/**< C stack block start address, defined on linker script file, default is _sstack. */ -#define CSTACK_BLOCK_START _sstack -/**< C stack block end address, defined on linker script file, default is _estack. */ -#define CSTACK_BLOCK_END _estack -/**< code section start address, defined on linker script file, default is _stext. */ -#define CODE_SECTION_START _stext -/**< code section end address, defined on linker script file, default is _etext. */ -#define CODE_SECTION_END _etext -#define CALLBACK_CNT 9 -#define ZERO 0 - -extern const int CSTACK_BLOCK_START; -extern const int CSTACK_BLOCK_END; -extern const int CODE_SECTION_START; -extern const int CODE_SECTION_END; -#else -#error "not supported compiler" -#endif -#endif - -void fault_trace_nvds_save_prepare(void); -void fault_trace_nvds_add(const char *format, ...); -void fault_trace_nvds_save_flush(void); +#include /** * @defgroup CORTEX_BACKTRACE_MAROC Defines @@ -113,34 +50,25 @@ void fault_trace_nvds_save_flush(void); #define CB_CPU_ARM_CORTEX_M4 (0x04U) /**< Cortex-M4 Core */ #define CB_CPU_ARM_CORTEX_M7 (0x07U) /**< Cortex-M7 Core */ -/**< System Handler Control and State Register.*/ -#define CB_SYSHND_CTRL (*(volatile unsigned int*) (0xE000ED24u)) -/**< Memory management fault State register. */ -#define CB_NVIC_MFSR (*(volatile unsigned char*) (0xE000ED28u)) -/**< Bus fault State register. */ -#define CB_NVIC_BFSR (*(volatile unsigned char*) (0xE000ED29u)) -/**< Usage fault State register. */ -#define CB_NVIC_UFSR (*(volatile unsigned short*)(0xE000ED2Au)) -/**< Hard fault State register. */ -#define CB_NVIC_HFSR (*(volatile unsigned int*) (0xE000ED2Cu)) -/**< Debug fault State register. */ -#define CB_NVIC_DFSR (*(volatile unsigned short*)(0xE000ED30u)) -/**< Memory management fault address register. */ -#define CB_NVIC_MMAR (*(volatile unsigned int*) (0xE000ED34u)) -/**< Bus fault manage address register. */ -#define CB_NVIC_BFAR (*(volatile unsigned int*) (0xE000ED38u)) -/**< Auxiliary fault State register. */ -#define CB_NVIC_AFSR (*(volatile unsigned short*)(0xE000ED3Cu)) +#define CB_SYSHND_CTRL (*(volatile unsigned int*) (0xE000ED24u)) /**< System Handler Control and State Register. */ +#define CB_NVIC_MFSR (*(volatile unsigned char*) (0xE000ED28u)) /**< Memory management fault State register. */ +#define CB_NVIC_BFSR (*(volatile unsigned char*) (0xE000ED29u)) /**< Bus fault State register. */ +#define CB_NVIC_UFSR (*(volatile unsigned short*)(0xE000ED2Au)) /**< Usage fault State register. */ +#define CB_NVIC_HFSR (*(volatile unsigned int*) (0xE000ED2Cu)) /**< Hard fault State register. */ +#define CB_NVIC_DFSR (*(volatile unsigned short*)(0xE000ED30u)) /**< Debug fault State register. */ +#define CB_NVIC_MMAR (*(volatile unsigned int*) (0xE000ED34u)) /**< Memory management fault address register. */ +#define CB_NVIC_BFAR (*(volatile unsigned int*) (0xE000ED38u)) /**< Bus fault manage address register. */ +#define CB_NVIC_AFSR (*(volatile unsigned short*)(0xE000ED3Cu)) /**< Auxiliary fault State register. */ /**@brief ELF(Executable and Linking Format) file extension name for each compiler. */ #if defined(__CC_ARM) -#define CB_ELF_FILE_EXTENSION_NAME ".axf" + #define CB_ELF_FILE_EXTENSION_NAME ".axf" #elif defined(__ICCARM__) -#define CB_ELF_FILE_EXTENSION_NAME ".out" + #define CB_ELF_FILE_EXTENSION_NAME ".out" #elif defined(__GNUC__) -#define CB_ELF_FILE_EXTENSION_NAME ".elf" + #define CB_ELF_FILE_EXTENSION_NAME ".elf" #else -#error "not supported compiler" + #error "not supported compiler" #endif /** @} */ @@ -149,123 +77,130 @@ void fault_trace_nvds_save_flush(void); * @{ */ /**@brief Cortex-M fault registers. */ -typedef struct { - struct { - unsigned int r0; /**< Register R0. */ - unsigned int r1; /**< Register R1. */ - unsigned int r2; /**< Register R2. */ - unsigned int r3; /**< Register R3. */ - unsigned int r12; /**< Register R12. */ - unsigned int lr; /**< Link register. */ - unsigned int pc; /**< Program counter. */ - union { - unsigned int value; - struct { - unsigned int IPSR : 8; /**< Interrupt Program Status register (IPSR). */ - unsigned int EPSR : 19; /**< Execution Program Status register (EPSR). */ - unsigned int APSR : 5; /**< Application Program Status register (APSR). */ - } bits; - } psr; /**< Program status register. */ - } saved; +typedef struct +{ + struct + { + unsigned int r0; /**< Register R0. */ + unsigned int r1; /**< Register R1. */ + unsigned int r2; /**< Register R2. */ + unsigned int r3; /**< Register R3. */ + unsigned int r12; /**< Register R12. */ + unsigned int lr; /**< Link register. */ + unsigned int pc; /**< Program counter. */ + union + { + unsigned int value; + struct + { + unsigned int IPSR : 8; /**< Interrupt Program Status register (IPSR). */ + unsigned int EPSR : 19; /**< Execution Program Status register (EPSR). */ + unsigned int APSR : 5; /**< Application Program Status register (APSR). */ + } bits; + } psr; /**< Program status register. */ + } saved; - union { - unsigned int value; - struct { - unsigned int MEMFAULTACT : 1; /**< Read as 1 if memory management fault is active. */ - unsigned int BUSFAULTACT : 1; /**< Read as 1 if bus fault exception is active. */ - unsigned int UnusedBits1 : 1; /**< Unused Bits 1. */ - unsigned int USGFAULTACT : 1; /**< Read as 1 if usage fault exception is active. */ - unsigned int UnusedBits2 : 3; /**< Unused Bits 2. */ - unsigned int SVCALLACT : 1; /**< Read as 1 if SVC exception is active. */ - unsigned int MONITORACT : 1; /**< Read as 1 if debug monitor exception is active. */ - unsigned int UnusedBits3 : 1; /**< Unused Bits 3. */ - unsigned int PENDSVACT : 1; /**< Read as 1 if PendSV exception is active. */ - unsigned int SYSTICKACT : 1; /**< Read as 1 if SYSTICK exception is active. */ -/**< Usage fault pended; usage fault started but was replaced by a higher-priority exception. */ - unsigned int USGFAULTPENDED : 1; -/**< Memory management fault pended; memory management fault started but was replaced - * by a higher-priority exception. */ - unsigned int MEMFAULTPENDED : 1; -/**< Bus fault pended; bus fault handler was started but was replaced by a higher-priority exception. */ - unsigned int BUSFAULTPENDED : 1; -/**< SVC pended; SVC was started but was replaced by a higher-priority exception. */ - unsigned int SVCALLPENDED : 1; - unsigned int MEMFAULTENA : 1; /**< Memory management fault handler enable. */ - unsigned int BUSFAULTENA : 1; /**< Bus fault handler enable. */ - unsigned int USGFAULTENA : 1; /**< Usage fault handler enable. */ - } bits; - } syshndctrl; /**< System Handler Control and State Register (0xE000ED24). */ + union + { + unsigned int value; + struct + { + unsigned int MEMFAULTACT : 1; /**< Read as 1 if memory management fault is active. */ + unsigned int BUSFAULTACT : 1; /**< Read as 1 if bus fault exception is active. */ + unsigned int UnusedBits1 : 1; /**< Unused Bits 1. */ + unsigned int USGFAULTACT : 1; /**< Read as 1 if usage fault exception is active. */ + unsigned int UnusedBits2 : 3; /**< Unused Bits 2. */ + unsigned int SVCALLACT : 1; /**< Read as 1 if SVC exception is active. */ + unsigned int MONITORACT : 1; /**< Read as 1 if debug monitor exception is active. */ + unsigned int UnusedBits3 : 1; /**< Unused Bits 3. */ + unsigned int PENDSVACT : 1; /**< Read as 1 if PendSV exception is active. */ + unsigned int SYSTICKACT : 1; /**< Read as 1 if SYSTICK exception is active. */ + unsigned int USGFAULTPENDED : 1; /**< Usage fault pended; usage fault started but was replaced by a higher-priority exception. */ + unsigned int MEMFAULTPENDED : 1; /**< Memory management fault pended; memory management fault started but was replaced by a higher-priority exception. */ + unsigned int BUSFAULTPENDED : 1; /**< Bus fault pended; bus fault handler was started but was replaced by a higher-priority exception. */ + unsigned int SVCALLPENDED : 1; /**< SVC pended; SVC was started but was replaced by a higher-priority exception. */ + unsigned int MEMFAULTENA : 1; /**< Memory management fault handler enable. */ + unsigned int BUSFAULTENA : 1; /**< Bus fault handler enable. */ + unsigned int USGFAULTENA : 1; /**< Usage fault handler enable. */ + } bits; + } syshndctrl; /**< System Handler Control and State Register (0xE000ED24). */ - union { - unsigned char value; - struct { - unsigned char IACCVIOL : 1; /**< Instruction access violation. */ - unsigned char DACCVIOL : 1; /**< Data access violation. */ - unsigned char UnusedBits : 1; /**< Unused Bits 1. */ - unsigned char MUNSTKERR : 1; /**< Unstacking error. */ - unsigned char MSTKERR : 1; /**< Stacking error. */ - unsigned char MLSPERR : 1; /**< Floating-point lazy state preservation (M4/M7). */ - unsigned char UnusedBits2 : 1; /**< Unused Bits 2. */ - unsigned char MMARVALID : 1; /**< Indicates the MMAR is valid. */ - } bits; - } mfsr; /**< Memory Management Fault Status Register (0xE000ED28). */ - unsigned int mmar; /**< Memory Management Fault Address Register (0xE000ED34). */ + union + { + unsigned char value; + struct + { + unsigned char IACCVIOL : 1; /**< Instruction access violation. */ + unsigned char DACCVIOL : 1; /**< Data access violation. */ + unsigned char UnusedBits : 1; /**< Unused Bits 1. */ + unsigned char MUNSTKERR : 1; /**< Unstacking error. */ + unsigned char MSTKERR : 1; /**< Stacking error. */ + unsigned char MLSPERR : 1; /**< Floating-point lazy state preservation (M4/M7). */ + unsigned char UnusedBits2 : 1; /**< Unused Bits 2. */ + unsigned char MMARVALID : 1; /**< Indicates the MMAR is valid. */ + } bits; + } mfsr; /**< Memory Management Fault Status Register (0xE000ED28). */ + unsigned int mmar; /**< Memory Management Fault Address Register (0xE000ED34). */ - union { - unsigned char value; - struct { - unsigned char IBUSERR : 1; /**< Instruction access violation. */ - unsigned char PRECISERR : 1; /**< Precise data access violation. */ - unsigned char IMPREISERR : 1; /**< Imprecise data access violation. */ - unsigned char UNSTKERR : 1; /**< Unstacking error. */ - unsigned char STKERR : 1; /**< Stacking error. */ - unsigned char LSPERR : 1; /**< Floating-point lazy state preservation (M4/M7). */ - unsigned char UnusedBits : 1; /**< Unused Bits 1. */ - unsigned char BFARVALID : 1; /**< Indicates BFAR is valid. */ - } bits; - } bfsr; /**< Bus Fault Status Register (0xE000ED29). */ - unsigned int bfar; /**< Bus Fault Manage Address Register (0xE000ED38). */ + union + { + unsigned char value; + struct + { + unsigned char IBUSERR : 1; /**< Instruction access violation. */ + unsigned char PRECISERR : 1; /**< Precise data access violation. */ + unsigned char IMPREISERR : 1; /**< Imprecise data access violation. */ + unsigned char UNSTKERR : 1; /**< Unstacking error. */ + unsigned char STKERR : 1; /**< Stacking error. */ + unsigned char LSPERR : 1; /**< Floating-point lazy state preservation (M4/M7). */ + unsigned char UnusedBits : 1; /**< Unused Bits 1. */ + unsigned char BFARVALID : 1; /**< Indicates BFAR is valid. */ + } bits; + } bfsr; /**< Bus Fault Status Register (0xE000ED29). */ + unsigned int bfar; /**< Bus Fault Manage Address Register (0xE000ED38). */ - union { - unsigned short value; - struct { - unsigned short UNDEFINSTR : 1; /**< Attempts to execute an undefined instruction. */ - unsigned short INVSTATE : 1; /**< Attempts to switch to an invalid state (e.g., ARM). */ - /**< Attempts to do an exception with a bad value in the EXC_RETURN number. */ - unsigned short INVPC : 1; - unsigned short NOCP : 1; /**< Attempts to execute a coprocessor instruction. */ - unsigned short UnusedBits : 4; /**< Unused Bits 1. */ - unsigned short UNALIGNED : 1; /**< Indicates that an unaligned access fault has taken place. */ -unsigned short DIVBYZERO0 : - 1; /**< Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set). */ - } bits; - } ufsr; /**< Usage Fault Status Register (0xE000ED2A). */ + union + { + unsigned short value; + struct + { + unsigned short UNDEFINSTR : 1; /**< Attempts to execute an undefined instruction. */ + unsigned short INVSTATE : 1; /**< Attempts to switch to an invalid state (e.g., ARM). */ + unsigned short INVPC : 1; /**< Attempts to do an exception with a bad value in the EXC_RETURN number. */ + unsigned short NOCP : 1; /**< Attempts to execute a coprocessor instruction. */ + unsigned short UnusedBits : 4; /**< Unused Bits 1. */ + unsigned short UNALIGNED : 1; /**< Indicates that an unaligned access fault has taken place. */ + unsigned short DIVBYZERO0 : 1; /**< Indicates a divide by zero has taken place (can be set only if DIV_0_TRP is set). */ + } bits; + } ufsr; /**< Usage Fault Status Register (0xE000ED2A). */ - union { - unsigned int value; - struct { - unsigned int UnusedBits : 1; - unsigned int VECTBL : 1; /**< Indicates hard fault is caused by failed vector fetch. */ - unsigned int UnusedBits2 : 28; /**< Unused Bits 1. */ -unsigned int FORCED : - 1; /**< Indicates hard fault is taken because of bus fault/memory management fault/usage fault. */ - unsigned int DEBUGEVT : 1; /**< Indicates hard fault is triggered by debug event. */ - } bits; - } hfsr; /**< Hard Fault Status Register (0xE000ED2C). */ + union + { + unsigned int value; + struct + { + unsigned int UnusedBits : 1; + unsigned int VECTBL : 1; /**< Indicates hard fault is caused by failed vector fetch. */ + unsigned int UnusedBits2 : 28; /**< Unused Bits 1. */ + unsigned int FORCED : 1; /**< Indicates hard fault is taken because of bus fault/memory management fault/usage fault. */ + unsigned int DEBUGEVT : 1; /**< Indicates hard fault is triggered by debug event. */ + } bits; + } hfsr; /**< Hard Fault Status Register (0xE000ED2C). */ - union { - unsigned int value; - struct { - unsigned int HALTED : 1; /**< Halt requested in NVIC. */ - unsigned int BKPT : 1; /**< BKPT instruction executed. */ - unsigned int DWTTRAP : 1; /**< DWT match occurred. */ - unsigned int VCATCH : 1; /**< Vector fetch occurred. */ - unsigned int EXTERNAL : 1; /**< EDBGRQ signal asserted. */ - } bits; /**< Unused Bits 1. */ - } dfsr; /**< Debug Fault Status Register (0xE000ED30). */ + union + { + unsigned int value; + struct + { + unsigned int HALTED : 1; /**< Halt requested in NVIC. */ + unsigned int BKPT : 1; /**< BKPT instruction executed. */ + unsigned int DWTTRAP : 1; /**< DWT match occurred. */ + unsigned int VCATCH : 1; /**< Vector fetch occurred. */ + unsigned int EXTERNAL : 1; /**< EDBGRQ signal asserted. */ + } bits; /**< Unused Bits 1. */ + } dfsr; /**< Debug Fault Status Register (0xE000ED30). */ - unsigned int - afsr; /**< Auxiliary Fault Status Register (0xE000ED3C), Vendor controlled (optional). */ + unsigned int afsr; /**< Auxiliary Fault Status Register (0xE000ED3C), Vendor controlled (optional). */ } cb_hard_fault_regs_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_gcc.s b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_gcc.s new file mode 100644 index 0000000..a71160f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_gcc.s @@ -0,0 +1,28 @@ +;/** +; ***************************************************************************************** +; * +; * @file app_hardfault_kei.s +; * +; * @brief App HardFault Handler Function Implementation for GCC. +; * +; * Copyright(C) 2016-2018, Shenzhen Goodix Technology Co., Ltd +; * All Rights Reserved +; * +; ***************************************************************************************** +; */ + +.syntax unified +.thumb +.text + +/* NOTE: If use this file's HardFault_Handler, please comments the HardFault_Handler code on other file. */ + +.global HardFault_Handler +.type HardFault_Handler, %function +HardFault_Handler: + MOV r0, lr /* get lr */ + MOV r1, sp /* get stack pointer (current is MSP) */ + BL cortex_backtrace_fault_handler + +Fault_Loop: + BL Fault_Loop /* while(1) */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_iar.s b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_iar.s old mode 100755 new mode 100644 diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_keil.s b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_error/hardfault_handler/cortex_hardfault_keil.s old mode 100755 new mode 100644 diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/BUILD.gn new file mode 100644 index 0000000..fd34876 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_key") { + sources = [ + "app_key.c", + "app_key_core.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.c new file mode 100644 index 0000000..b8c4715 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.c @@ -0,0 +1,237 @@ +/** + ***************************************************************************************** + * + * @file app_key.c + * + * @brief App key Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_key.h" +#include "app_gpiote.h" + +#ifdef ENV_USE_FREERTOS +#include "FreeRTOS.h" +#include "timers.h" +#else +#include "app_timer.h" +#endif +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_KEY_TIMER_INTERVAL 10 /**< App key polling interval interval (in units of 1ms). */ +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint8_t s_app_key_info[APP_KEY_REG_COUNT_MAX]; +static app_gpiote_param_t s_app_io_cfg[APP_KEY_REG_COUNT_MAX]; +static app_key_evt_cb_t s_app_key_evt_cb; +static uint8_t s_app_key_reg_num; +#ifdef ENV_USE_FREERTOS +static TimerHandle_t app_key_timer_handle = NULL; +#else +static app_timer_id_t s_app_key_timer_id; +#endif +static bool s_is_timer_enabled; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + ***************************************************************************************** + * @brief Polling app key pressed state. + ***************************************************************************************** + */ +static void app_key_press_state_polling(void) +{ + app_io_pin_state_t pin_state; + bool is_pressed = false; + + for (uint8_t key_idx = 0; key_idx < s_app_key_reg_num; key_idx++) + { + is_pressed = false; + + pin_state = app_io_read_pin(s_app_io_cfg[key_idx].type, s_app_io_cfg[key_idx].pin); + + if (APP_IO_PIN_RESET == pin_state && s_app_io_cfg[key_idx].pull == APP_IO_PULLUP) + { + is_pressed = true; + } + else if (APP_IO_PIN_SET == pin_state && s_app_io_cfg[key_idx].pull == APP_IO_PULLDOWN) + { + is_pressed = true; + } + + app_key_core_key_pressed_record(key_idx, is_pressed); + } +} + +/** + ***************************************************************************************** + * @brief App key timing timeout handler. + ***************************************************************************************** + */ +static void app_key_timeout_handler(void *p_arg) +{ + app_key_press_state_polling(); + app_key_core_polling_10ms(); +} + +/** + ***************************************************************************************** + * @brief Start app key timer. + ***************************************************************************************** + */ +static void app_key_timer_start(void) +{ +#if defined(ENV_USE_FREERTOS) + xTimerStartFromISR(app_key_timer_handle, 0); +#else + app_timer_create(&s_app_key_timer_id, ATIMER_REPEAT, app_key_timeout_handler); + app_timer_start(s_app_key_timer_id, APP_KEY_TIMER_INTERVAL, NULL); +#endif + s_is_timer_enabled = true; +} + +/** + ***************************************************************************************** + * @brief Stop app key timer. + ***************************************************************************************** + */ +void app_key_timer_stop(void) +{ +#if defined(ENV_USE_FREERTOS) + xTimerStopFromISR(app_key_timer_handle,0); +#else + app_timer_delete(&s_app_key_timer_id); +#endif + s_is_timer_enabled = false; +} + +/** + ***************************************************************************************** + * @brief App key core event handler. + ***************************************************************************************** + */ +static void app_key_core_evt_handler(uint8_t key_idx, app_key_click_type_t key_click_type) +{ + if (app_key_core_is_all_release()) + { + app_key_timer_stop(); + } + + s_app_key_evt_cb(s_app_key_info[key_idx], key_click_type); +} + +static void app_gpiote_event_handler(app_io_evt_t *p_evt) +{ + if ( NULL == p_evt) + return; + + for (uint8_t key_idx = 0; key_idx < s_app_key_reg_num; key_idx++) + { + if ((s_app_io_cfg[key_idx].type == p_evt->type)&& + (p_evt->pin & s_app_io_cfg[key_idx].pin)) + { + if (!s_is_timer_enabled) + { + app_key_timer_start(); + } + app_key_core_key_wait_polling_record(key_idx); + return; + } + } +} + + + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +bool app_key_init(app_key_gpio_t key_inst[], uint8_t key_num, app_key_evt_cb_t key_evt_cb) +{ + if (APP_KEY_REG_COUNT_MAX < key_num || NULL == key_evt_cb) + { + return false; + } + + for (uint8_t key_idx = 0; key_idx < key_num; key_idx++) + { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (key_inst[key_idx].gpio_type != APP_IO_TYPE_NORMAL && + key_inst[key_idx].gpio_type != APP_IO_TYPE_AON) + { + continue; + } +#elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + if (key_inst[key_idx].gpio_type != APP_IO_TYPE_GPIOA && + key_inst[key_idx].gpio_type != APP_IO_TYPE_GPIOB && + key_inst[key_idx].gpio_type != APP_IO_TYPE_GPIOC && + key_inst[key_idx].gpio_type != APP_IO_TYPE_AON) + { + continue; + } +#endif + s_app_key_info[key_idx] = key_inst[key_idx].key_id; + s_app_io_cfg[key_idx].type = key_inst[key_idx].gpio_type; + s_app_io_cfg[key_idx].pin = key_inst[key_idx].gpio_pin; + s_app_io_cfg[key_idx].mode = key_inst[key_idx].trigger_mode; + s_app_io_cfg[key_idx].pull = key_inst[key_idx].pull; + s_app_io_cfg[key_idx].io_evt_cb = app_gpiote_event_handler; + } + + app_gpiote_init(s_app_io_cfg, key_num); + + s_app_key_reg_num = key_num; + s_app_key_evt_cb = key_evt_cb; + app_key_core_cb_register(app_key_core_evt_handler); + +/* If using FreeRTOS, xTimer need to be create and do not create in IRQ handler */ +#if defined(ENV_USE_FREERTOS) + #if defined(FREERTOS_V10_4_3_LTS) + app_key_timer_handle = + xTimerCreate(NULL, APP_KEY_TIMER_INTERVAL, pdTRUE, NULL, (TimerCallbackFunction_t)app_key_timeout_handler); + #else + app_key_timer_handle = xTimerCreate(NULL, APP_KEY_TIMER_INTERVAL, pdTRUE, NULL, app_key_timeout_handler); + #endif +#endif + return true; +} + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.h new file mode 100644 index 0000000..7ab301f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key.h @@ -0,0 +1,95 @@ +/** + **************************************************************************************** + * + * @file app_key.c + * + * @brief App Key API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_KEY_H__ +#define __APP_KEY_H__ + +#include "app_key_core.h" +#include "app_gpiote.h" +#include +#include + +/** + * @defgroup APP_KEY_STRUCT Structures + * @{ + */ +/**@brief App key gpio initialization variables. */ +typedef struct +{ + app_io_type_t gpio_type; /**< Key gpio type. */ + uint32_t gpio_pin; /**< Key gpio pin. */ + app_io_mode_t trigger_mode; /**< Specifies the operating mode for the selected pin. */ + app_io_pull_t pull; /**< Pull mode.*/ + uint8_t key_id; /**< Key register ID. */ +} app_key_gpio_t; +/** @} */ + +/** + * @defgroup APP_KEY_TYPEDEF Typedefs + * @{ + */ +/**@brief APP Key event callback.*/ +typedef void (*app_key_evt_cb_t)(uint8_t key_id, app_key_click_type_t key_click_type); +/** @} */ + +/** + * @defgroup APP_KEY_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief App key initialize. + * + * @param[in] key_inst: The array of key instance. + * @param[in] key_num: The number of key instance. + * @param[in] key_click_cb: App key click event callback. + * + * @return Result of app key inlitialization. + ***************************************************************************************** + */ +bool app_key_init(app_key_gpio_t key_inst[], uint8_t key_num, app_key_evt_cb_t key_click_cb); + +/** + ***************************************************************************************** + * @brief App key pressed down handler. + ***************************************************************************************** + */ +void app_key_pressed_handler(app_key_gpio_t *p_app_key_info); +/** @} */ + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.c new file mode 100644 index 0000000..15307a7 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.c @@ -0,0 +1,319 @@ +/** + ***************************************************************************************** + * + * @file app_key_core.c + * + * @brief App Key Core Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_key_core.h" +#include + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +/**@brief App key core variable. */ +struct app_key_core_t +{ + bool is_pressed; + bool is_in_polling; +}; +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static app_key_core_evt_cb_t s_key_core_evt_cb; +static struct app_key_core_t s_key_core_info[APP_KEY_REG_COUNT_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_key_core_key_polling_cplt(uint8_t key_idx) +{ + s_key_core_info[key_idx].is_pressed = false; + s_key_core_info[key_idx].is_in_polling = false; +} + +/** + ***************************************************************************************** + * @brief APP key click event handler. + * + * @param[in] key_idx: Index of key register. + * @param[in] key_state: Key state of read procedure. + ***************************************************************************************** + */ +static void app_key_core_click_event_handler(uint8_t key_idx, app_key_state_t key_state) +{ + app_key_click_type_t key_click_type = APP_KEY_NO_CLICK; + + switch (key_state) + { + case APP_KEY_STA_NO_CLICK: + key_click_type = APP_KEY_NO_CLICK; + app_key_core_key_polling_cplt(key_idx); + break; + + case APP_KEY_STA_SINGLE_CLICK: + key_click_type = APP_KEY_SINGLE_CLICK; + app_key_core_key_polling_cplt(key_idx); + break; + + case APP_KEY_STA_DOUBLE_CLICK: + key_click_type = APP_KEY_DOUBLE_CLICK; + app_key_core_key_polling_cplt(key_idx); + break; + + case APP_KEY_STA_LONG_CLICK: + key_click_type = APP_KEY_LONG_CLICK; + break; + + case APP_KEY_STA_CONTINUE_CLICK: + key_click_type = APP_KEY_CONTINUE_CLICK; + break; + + case APP_KEY_STA_RELEASE: + key_click_type = APP_KEY_CONTINUE_RELEASE; + break; + + default: + break; + } + + s_key_core_evt_cb(key_idx, key_click_type); +} + +/** + ***************************************************************************************** + * @brief App key state scan. + * + * @param[in] key_idx: Index of key. + * + * @return Result of scan. + ***************************************************************************************** + */ +static app_key_state_t app_key_core_state_scan(uint8_t key_idx) +{ + static app_key_state_t key_scan_state[APP_KEY_REG_COUNT_MAX] = {APP_KEY_STA_INIT}; + static uint8_t key_long_click_count[APP_KEY_REG_COUNT_MAX] = {0}; + + app_key_state_t key_state_return = APP_KEY_STA_INIT; + + switch (key_scan_state[key_idx]) + { + case APP_KEY_STA_INIT: + if (s_key_core_info[key_idx].is_pressed) + { + key_scan_state[key_idx] = APP_KEY_STA_DEBOUNCE; + } + break; + + case APP_KEY_STA_DEBOUNCE: + if (s_key_core_info[key_idx].is_pressed) + { + key_long_click_count[key_idx] = 0; + key_scan_state[key_idx] = APP_KEY_STA_PRESS; + } + else + { + key_scan_state[key_idx] = APP_KEY_STA_INIT; + key_state_return = APP_KEY_STA_NO_CLICK; + } + break; + + case APP_KEY_STA_PRESS: + if (!s_key_core_info[key_idx].is_pressed) + { + key_state_return = APP_KEY_STA_SINGLE_CLICK; + key_scan_state[key_idx] = APP_KEY_STA_INIT; + } + else + { + if ( APP_KEY_LONG_TIME_COUNT <= ++key_long_click_count[key_idx]) + { + key_state_return = APP_KEY_STA_LONG_CLICK; + key_scan_state[key_idx] = APP_KEY_STA_WAITE_RELEASE; + } + } + break; + + case APP_KEY_STA_WAITE_RELEASE: + if (!s_key_core_info[key_idx].is_pressed) + { + key_scan_state[key_idx] = APP_KEY_STA_INIT; + app_key_core_key_polling_cplt(key_idx); + key_state_return = APP_KEY_STA_RELEASE; + } + else + { + key_state_return = APP_KEY_STA_CONTINUE_CLICK; + } + break; + + default: + break; + } + + return key_state_return; +} + +/** + ***************************************************************************************** + * @brief App key click type read. + * + * @param[in] key_idx: Index of key register. + ***************************************************************************************** + */ +static void app_key_core_click_read(uint8_t key_idx) +{ + static app_key_state_t key_read_state[APP_KEY_REG_COUNT_MAX] = {APP_KEY_STA_INIT}; + static uint8_t key_double_click_count[APP_KEY_REG_COUNT_MAX] = {0}; + static uint8_t key_continue_click_count[APP_KEY_REG_COUNT_MAX] = {0}; + + app_key_state_t current_key_state; + + current_key_state = app_key_core_state_scan(key_idx); + + switch (key_read_state[key_idx]) + { + case APP_KEY_STA_INIT: + if (APP_KEY_STA_SINGLE_CLICK == current_key_state) + { + key_double_click_count[key_idx] = 0; + key_read_state[key_idx] = APP_KEY_STA_SINGLE_CLICK; + } + else if (APP_KEY_STA_NO_CLICK == current_key_state ||APP_KEY_STA_LONG_CLICK == current_key_state) + { + app_key_core_click_event_handler(key_idx, current_key_state); + } + else if (APP_KEY_STA_CONTINUE_CLICK == current_key_state) + { + if (APP_KEY_CONTINUE_TIME_COUNT <= ++key_continue_click_count[key_idx]) + { + key_continue_click_count[key_idx] = 0; + key_read_state[key_idx] = APP_KEY_STA_CONTINUE_CLICK; + app_key_core_click_event_handler(key_idx, APP_KEY_STA_CONTINUE_CLICK); + } + } + break; + + case APP_KEY_STA_SINGLE_CLICK: + if (APP_KEY_STA_SINGLE_CLICK == current_key_state) + { + key_read_state[key_idx] = APP_KEY_STA_INIT; + app_key_core_click_event_handler(key_idx, APP_KEY_STA_DOUBLE_CLICK); + } + else if (APP_KEY_DOUBLE_TIME_COUNT <= ++key_double_click_count[key_idx]) + { + key_read_state[key_idx] = APP_KEY_STA_INIT; + app_key_core_click_event_handler(key_idx, APP_KEY_STA_SINGLE_CLICK); + } + break; + + case APP_KEY_STA_CONTINUE_CLICK: + if (APP_KEY_STA_RELEASE == current_key_state) + { + key_read_state[key_idx] = APP_KEY_STA_INIT; + app_key_core_click_event_handler(key_idx, APP_KEY_STA_RELEASE); + } + else if (APP_KEY_STA_CONTINUE_CLICK == current_key_state) + { + if (APP_KEY_CONTINUE_TIME_COUNT <= ++key_continue_click_count[key_idx]) + { + key_continue_click_count[key_idx] = 0; + key_read_state[key_idx] = APP_KEY_STA_CONTINUE_CLICK; + app_key_core_click_event_handler(key_idx, APP_KEY_STA_CONTINUE_CLICK); + } + } + break; + + default: + break; + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +bool app_key_core_cb_register(app_key_core_evt_cb_t key_core_evt_cb) +{ + if (NULL == key_core_evt_cb) + { + return false; + } + + s_key_core_evt_cb = key_core_evt_cb; + + return true; +} + +void app_key_core_polling_10ms() +{ + for (uint8_t key_idx = 0; key_idx < APP_KEY_REG_COUNT_MAX; key_idx++) + { + if (s_key_core_info[key_idx].is_in_polling) + { + app_key_core_click_read(key_idx); + } + } +} + +void app_key_core_key_wait_polling_record(uint8_t key_idx) +{ + s_key_core_info[key_idx].is_in_polling = true; +} + +void app_key_core_key_pressed_record(uint8_t key_idx, bool is_pressed) +{ + s_key_core_info[key_idx].is_pressed = is_pressed; +} + +bool app_key_core_is_all_release(void) +{ + for (uint8_t key_idx = 0; key_idx < APP_KEY_REG_COUNT_MAX; key_idx++) + { + if (s_key_core_info[key_idx].is_pressed) + { + return false; + } + } + + return true; +} + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.h new file mode 100644 index 0000000..0b8bcd3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_key/app_key_core.h @@ -0,0 +1,146 @@ +/** + **************************************************************************************** + * + * @file App key core.h + * + * @brief App Key Core API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __APP_KEY_CORE_H__ +#define __APP_KEY_CORE_H__ + +#include +#include + +/** + * @defgroup APP_KEY_CORE_MAROC Defines + * @{ + */ +#define APP_KEY_REG_COUNT_MAX 10 /**< Maximum number of key instance can register, which can be configurable. */ +#define APP_KEY_DOUBLE_TIME_COUNT 50 /**< Double click time count(in unit of 10ms), which can be configurable. */ +#define APP_KEY_LONG_TIME_COUNT 100 /**< Long click time count(in uint of 10ms), which can be configurable. */ +#define APP_KEY_CONTINUE_TIME_COUNT 20 /**< Continue click time count(in uint of 10ms), which can be configurable. */ +/** @} */ + +/** + * @defgroup APP_KEY_CORE_ENUM Enumerations + * @{ + */ +/**@brief App key polling state. */ +typedef enum +{ + APP_KEY_STA_INIT, /**< Key initialization state for key scan procedure. */ + APP_KEY_STA_DEBOUNCE, /**< Key debounce state for key scan procedure. */ + APP_KEY_STA_PRESS, /**< Key press state for key scan procedure. */ + APP_KEY_STA_WAITE_RELEASE, /**< Waite key release state for key scan procedure. */ + APP_KEY_STA_NO_CLICK, /**< Key no click state for key read procedure. */ + APP_KEY_STA_SINGLE_CLICK, /**< Key single click state for key read procedure. */ + APP_KEY_STA_DOUBLE_CLICK, /**< Key double click state for key read procedure. */ + APP_KEY_STA_LONG_CLICK, /**< Key long click state for key read procedure. */ + APP_KEY_STA_CONTINUE_CLICK, /**< Key continue click state for key read procedure. */ + APP_KEY_STA_RELEASE, /**< key continue click release state. */ +} app_key_state_t; + +/**@brief App key click event type. */ +typedef enum +{ + APP_KEY_NO_CLICK, /**< Key no click event. */ + APP_KEY_SINGLE_CLICK, /**< Key single click event. */ + APP_KEY_DOUBLE_CLICK, /**< Key double click event. */ + APP_KEY_LONG_CLICK, /**< Key long click event. */ + APP_KEY_CONTINUE_CLICK, /**< Key continue click event. */ + APP_KEY_CONTINUE_RELEASE /**< Key continue click release. */ +} app_key_click_type_t; +/** @} */ + +/** + * @defgroup APP_KEY_CORE_TYPEDEF Typedefs + * @{ + */ +/**@brief APP Key core event callback.*/ +typedef void (*app_key_core_evt_cb_t)(uint8_t key_idx, app_key_click_type_t key_click_type); +/** @} */ + +/** + * @defgroup APP_KEY_CORE_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Register app key click event callback. + * + * @param[in] key_core_evt_cb: Key core event callback. + * + * @return Result of key core event callback is NULL or not. + ***************************************************************************************** + */ +bool app_key_core_cb_register(app_key_core_evt_cb_t key_core_evt_cb); + +/** + ***************************************************************************************** + * @brief Record app key is pressed down. + * + * @param[in] key_idx: Index of key register. + * @param[in] is_pressed: True or false + ***************************************************************************************** + */ +void app_key_core_key_pressed_record(uint8_t key_idx, bool is_pressed); + +/** + ***************************************************************************************** + * @brief Notificaiton which key is waiting for polling. + * + * @param[in] key_idx: Index of key register. + ***************************************************************************************** + */ +void app_key_core_key_wait_polling_record(uint8_t key_idx); + +/** + ***************************************************************************************** + * @brief Check all keys are released or not. + * + * @return Result of checking. + ***************************************************************************************** + */ +bool app_key_core_is_all_release(void); + +/** + ***************************************************************************************** + * @brief App key state polling. + ***************************************************************************************** + */ +void app_key_core_polling_10ms(void); +/** @} */ + +#endif +/** @} */ +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/BUILD.gn new file mode 100644 index 0000000..feff43b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_linked_list") { + sources = [ "app_linked_list.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.c new file mode 100644 index 0000000..721f6ea --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.c @@ -0,0 +1,254 @@ +/** + ***************************************************************************************** + * + * @file app_linked_list.c + * + * @brief App Linked List Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_linked_list.h" +#include + + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +sdk_err_t app_s_list_init(app_s_list_t *p_s_list) +{ + if (NULL == p_s_list) + { + return SDK_ERR_POINTER_NULL; + } + + p_s_list->p_head = NULL; + p_s_list->size = 0; + + return SDK_SUCCESS; +} + + +app_s_list_node_t *app_s_list_node_append(app_s_list_t *p_s_list) +{ + app_s_list_node_t *p_iterator_node; + app_s_list_node_t *p_s_insert_node; + + if (NULL == p_s_list) + { + return NULL; + } + + p_s_insert_node = app_malloc(sizeof(app_s_list_node_t)); + + if (NULL == p_s_insert_node) + { + return NULL; + } + + memset(p_s_insert_node, 0, sizeof(app_s_list_node_t)); + + if (NULL == p_s_list->p_head) + { + p_s_list->p_head = p_s_insert_node; + p_s_list->size = 1; + + return p_s_insert_node; + } + + p_iterator_node = p_s_list->p_head; + + while(p_iterator_node->p_next_node) + { + p_iterator_node = p_iterator_node->p_next_node; + } + + p_iterator_node->p_next_node = p_s_insert_node; + p_s_insert_node->p_next_node = NULL; + + p_s_list->size++; + + return p_s_insert_node; +} + +app_s_list_node_t *app_s_list_node_insert(app_s_list_t *p_s_list, app_s_list_node_t *p_dgt_node, bool is_ahead) +{ + app_s_list_node_t *p_previous_node; + app_s_list_node_t *p_iterator_node; + app_s_list_node_t *p_s_insert_node; + + if (NULL == p_s_list || NULL == p_dgt_node) + { + return NULL; + } + + p_s_insert_node = app_malloc(sizeof(app_s_list_node_t)); + + if (NULL == p_s_insert_node) + { + return NULL; + } + + + p_previous_node = p_s_list->p_head; + p_iterator_node = p_s_list->p_head; + + do + { + if (p_iterator_node == p_dgt_node) + { + break; + } + + p_previous_node = p_iterator_node; + p_iterator_node = p_iterator_node->p_next_node; + + } while (p_iterator_node); + + if (NULL == p_iterator_node) + { + return NULL; + } + + if (is_ahead) + { + if (p_iterator_node == p_s_list->p_head) + { + p_s_insert_node->p_next_node = p_iterator_node; + p_s_list->p_head = p_s_insert_node; + } + else + { + p_s_insert_node->p_next_node = p_iterator_node; + p_previous_node->p_next_node = p_s_insert_node; + } + } + else + { + p_s_insert_node->p_next_node = p_iterator_node->p_next_node; + p_iterator_node->p_next_node = p_s_insert_node; + } + + p_s_list->size++; + + return p_s_insert_node; +} + +sdk_err_t app_s_list_node_delete(app_s_list_t *p_s_list, app_s_list_node_t *p_s_list_node, bool free_data) +{ + app_s_list_node_t *p_previous_node; + app_s_list_node_t *p_iterator_node; + + if (NULL == p_s_list || NULL == p_s_list_node) + { + return SDK_ERR_POINTER_NULL; + } + + if (p_s_list_node == p_s_list->p_head) + { + p_s_list->p_head = p_s_list_node->p_next_node; + if (free_data) + { + app_free(p_s_list_node->p_data); + } + app_free(p_s_list_node); + + return SDK_SUCCESS; + } + + p_previous_node = p_s_list->p_head; + p_iterator_node = p_s_list->p_head; + + do + { + if (p_iterator_node == p_s_list_node) + { + break; + } + + p_previous_node = p_iterator_node; + p_iterator_node = p_iterator_node->p_next_node; + + } while (p_iterator_node); + + if (NULL == p_iterator_node) + { + return SDK_ERR_LIST_ITEM_NOT_FOUND; + } + + p_previous_node->p_next_node = p_iterator_node->p_next_node; + if (free_data) + { + app_free(p_s_list_node->p_data); + } + app_free(p_s_list_node); + + p_s_list->size--; + + return SDK_SUCCESS; +} + +sdk_err_t app_s_list_clear(app_s_list_t *p_s_list, bool free_data) +{ + app_s_list_node_t *p_iterator_node; + + if (NULL == p_s_list) + { + return SDK_ERR_POINTER_NULL; + } + + if (NULL == p_s_list->p_head) + { + return SDK_SUCCESS; + } + + p_iterator_node = p_s_list->p_head; + + while (p_iterator_node) + { + if (free_data) + { + app_free(p_iterator_node->p_data); + } + p_s_list->p_head = p_iterator_node->p_next_node; + app_free(p_iterator_node); + p_iterator_node = p_s_list->p_head; + }; + + p_s_list->size = 0; + + return SDK_SUCCESS; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.h new file mode 100644 index 0000000..4672dbb --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_linked_list/app_linked_list.h @@ -0,0 +1,136 @@ +/** + **************************************************************************************** + * + * @file app_linked_list.h + * + * @brief App Linked List API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_LINKED_LIST_H__ +#define __APP_LINKED_LIST_H__ + +#include "grx_hal.h" +#include "grx_sys.h" +#include "app_memory.h" +#include +#include + +/** + * @defgroup APP_LINKED_LIST_STRUCT Structures + * @{ + */ +/**@brief App Singly Linked List Node */ +typedef struct singly_list_node +{ + void *p_data; /**< Pointer to data. */ + struct singly_list_node *p_next_node; /**< Pointer to next node. */ +} app_s_list_node_t; + +/**@brief App Singly Linked List */ +typedef struct +{ + app_s_list_node_t *p_head; /**< Pointer to head node. */ + uint32_t size; /**< Size of list. */ +} app_s_list_t; +/** @} */ + +/** + * @defgroup APP_LINKED_LIST_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize one singly linked list instance. + * + * @param[in] p_s_list: Pointer to a singly linked list instance. + * + * @return Result of initialization. + ***************************************************************************************** + */ +sdk_err_t app_s_list_init(app_s_list_t *p_s_list); + +/** + ***************************************************************************************** + * @brief Append one singly linked list node at tail. + * + * @param[in] p_s_list: Pointer to a singly linked list instance. + * + * @return Pointer to append node. + ***************************************************************************************** + */ +app_s_list_node_t *app_s_list_node_append(app_s_list_t *p_s_list); + +/** + ***************************************************************************************** + * @brief Insert one singly linked list node into designated location. + * + * @param[in] p_s_list: Pointer to a singly linked list instance. + * @param[in] p_dgt_node: Pointer to a designated singly linked list node. + * @param[in] is_ahead: True: insert in ahead of designated node, False: insert in behind of designated node. + * + * @return Pointer to insert node. + ***************************************************************************************** + */ +app_s_list_node_t *app_s_list_node_insert(app_s_list_t *p_s_list, app_s_list_node_t *p_dgt_node, bool is_ahead); + +/** + ***************************************************************************************** + * @brief Delete one designated singly linked list node. + * + * @param[in] p_s_list: Pointer to a singly linked list instance. + * @param[in] p_s_list_node: Pointer to a designated singly linked list node. + * @param[in] free_data: Free node data or not. + * + * @return Result of delete. + ***************************************************************************************** + */ +sdk_err_t app_s_list_node_delete(app_s_list_t *p_s_list, app_s_list_node_t *p_s_list_node, bool free_data); + +/** + ***************************************************************************************** + * @brief Clear one singly linked list instance. + * + * @param[in] p_s_list: Pointer to a singly linked list instance. + * @param[in] free_data: Free node data or not. + * + * @return Result of clear. + ***************************************************************************************** + */ +sdk_err_t app_s_list_clear(app_s_list_t *p_s_list, bool free_data); + + + +/** @} */ + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/BUILD.gn new file mode 100644 index 0000000..3731c62 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_log") { + sources = [ + "app_log.c", + "app_log_dump_port.c", + "app_log_store.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.c old mode 100755 new mode 100644 index 1cdf35c..bed1ec3 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.c @@ -39,18 +39,17 @@ * INCLUDE FILES ***************************************************************************************** */ +#include "app_log.h" #include #include #include -#include "app_log.h" /* * DEFINE ***************************************************************************************** */ #if APP_LOG_COLOR_ENABLE -/**@brief CSI(Control Sequence Introducer/Initiator) sign more information on - * https://en.wikipedia.org/wiki/ANSI_escape_code. */ +/**@brief CSI(Control Sequence Introducer/Initiator) sign more information on https://en.wikipedia.org/wiki/ANSI_escape_code. */ #define CSI_START "\033[" #define CSI_END "\033[0m" @@ -100,18 +99,18 @@ #endif -#define BIT_8 8 - /* * STRUCTURES ***************************************************************************************** */ /**@brief App log environment variable. */ -struct app_log_env_t { +struct app_log_env_t +{ app_log_init_t app_log_init; /**< App log initialization variables. */ bool is_filter_set; /**< App log filter is set or not. */ app_log_trans_func_t trans_func; /**< App log transmit function. */ app_log_flush_func_t flush_func; /**< App log flush function. */ + }; /* @@ -120,7 +119,8 @@ struct app_log_env_t { */ static uint8_t s_log_encode_buf[APP_LOG_LINE_BUF_SIZE]; /**< App log data encode buffer. */ -static const char *s_log_svt_lvl_output_info[] = { /**< App log severity level outpout information. */ +static const char *s_log_svt_lvl_output_info[] = /**< App log severity level outpout information. */ +{ [APP_LOG_LVL_ERROR] = "APP_E: ", [APP_LOG_LVL_WARNING] = "APP_W: ", [APP_LOG_LVL_INFO] = "APP_I: ", @@ -128,7 +128,8 @@ static const char *s_log_svt_lvl_output_info[] = { /**< App log severi }; #if APP_LOG_COLOR_ENABLE -static const char *s_log_color_output_info[] = { /**< App log level outpout color information. */ +static const char *s_log_color_output_info[] = /**< App log level outpout color information. */ +{ [APP_LOG_LVL_ERROR] = APP_LOG_COLOR_ERROR, [APP_LOG_LVL_WARNING] = APP_LOG_COLOR_WARNING, [APP_LOG_LVL_INFO] = APP_LOG_COLOR_INFO, @@ -157,17 +158,21 @@ static struct app_log_env_t s_app_log_env; /**< App log enviro static uint16_t app_log_strcpy(uint16_t wr_idx, uint8_t *p_log_buff, const char *p_log_data) { uint16_t cpy_length = 0; - char *temp_p_log_data = p_log_data; - if (!p_log_buff || !temp_p_log_data) { + if (!p_log_buff || !p_log_data) + { return cpy_length; } - while (*temp_p_log_data != 0) { - if ((wr_idx + cpy_length) < APP_LOG_LINE_BUF_SIZE) { - p_log_buff[wr_idx + cpy_length] = *temp_p_log_data++; + while (*p_log_data != 0) + { + if ((wr_idx + cpy_length) < APP_LOG_LINE_BUF_SIZE) + { + p_log_buff[wr_idx + cpy_length] = *p_log_data++; cpy_length++; - } else { + } + else + { break; } } @@ -187,11 +192,15 @@ static uint16_t app_log_strcpy(uint16_t wr_idx, uint8_t *p_log_buff, const char */ static bool app_log_is_fmt_set(uint8_t level, uint8_t fmt) { - if (s_app_log_env.app_log_init.fmt_set[level] & fmt) { + if (s_app_log_env.app_log_init.fmt_set[level] & fmt) + { return true; - } else { + } + else + { return false; } + } /** @@ -206,11 +215,13 @@ static bool app_log_is_fmt_set(uint8_t level, uint8_t fmt) */ static void app_log_data_trans(uint8_t *p_data, uint16_t length) { - if (p_data == NULL || length == 0) { + if (NULL == p_data || 0 == length) + { return; } - if (s_app_log_env.trans_func) { + if (s_app_log_env.trans_func) + { s_app_log_env.trans_func(p_data, length); } @@ -225,13 +236,18 @@ static void app_log_data_trans(uint8_t *p_data, uint16_t length) */ sdk_err_t app_log_init(app_log_init_t *p_log_init, app_log_trans_func_t trans_func, app_log_flush_func_t flush_func) { - if (NULL == p_log_init) { + if (NULL == p_log_init) + { s_app_log_env.is_filter_set = false; - memset_s(&s_app_log_env.app_log_init, sizeof (s_app_log_env.app_log_init), 0, sizeof(app_log_init_t)); - } else if (p_log_init->filter.level <= APP_LOG_LVL_DEBUG) { + memset(&s_app_log_env.app_log_init, 0, sizeof(app_log_init_t)); + } + else if ( p_log_init->filter.level <= APP_LOG_LVL_DEBUG) + { s_app_log_env.is_filter_set = true; - memset_s(&s_app_log_env.app_log_init, sizeof (s_app_log_env.app_log_init), p_log_init, sizeof(app_log_init_t)); - } else { + memcpy(&s_app_log_env.app_log_init, p_log_init, sizeof(app_log_init_t)); + } + else + { return SDK_ERR_INVALID_PARAM; } @@ -241,92 +257,28 @@ sdk_err_t app_log_init(app_log_init_t *p_log_init, app_log_trans_func_t trans_fu return SDK_SUCCESS; } -uint16_t encode_name(uint8_t level, const char *file, const char *func, const long line) -{ - uint16_t log_length = 0; - char line_num[APP_LOG_LINE_NB_LEN_MAX + 1] = { 0 }; - - // Encode file directory name , function name and lune number info. - if (app_log_is_fmt_set(level, APP_LOG_FMT_DIR | APP_LOG_FMT_FUNC | APP_LOG_FMT_LINE)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, "("); - - if (app_log_is_fmt_set(level, APP_LOG_FMT_DIR)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, file); - - if (app_log_is_fmt_set(level, APP_LOG_FMT_FUNC)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, " "); - } else if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, ":"); - } - } - - if (app_log_is_fmt_set(level, APP_LOG_FMT_FUNC)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, func); - - if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) { - log_length += app_log_strcpy(log_length, s_log_encode_buf, " Line:"); - } - } - - if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) { - snprintf_s(line_num, sizeof (line_num), APP_LOG_LINE_NB_LEN_MAX, "%ld", line); - log_length += app_log_strcpy(log_length, s_log_encode_buf, line_num); - } - - log_length += app_log_strcpy(log_length, s_log_encode_buf, ") "); - } - return log_length; -} - -uint16_t calculate_log_length(uint16_t log_length, int fmt_result) -{ - uint8_t newline_length = strlen(APP_LOG_NEWLINE_SIGN); - uint16_t log_len = log_length; - // Calculate log length - if ((fmt_result > -1) && (log_len + fmt_result) <= APP_LOG_LINE_BUF_SIZE) { - log_len += fmt_result; - } else { - log_len = APP_LOG_LINE_BUF_SIZE; - } - -#if APP_LOG_COLOR_ENABLE - if (log_len + (sizeof(CSI_END) - 1) + newline_length > APP_LOG_LINE_BUF_SIZE) { - log_len = APP_LOG_LINE_BUF_SIZE; - // Reserve some space for CSI end sign. - log_len -= sizeof(CSI_END) - 1; -#else - if (log_len + newline_length > APP_LOG_LINE_BUF_SIZE) { - log_len = APP_LOG_LINE_BUF_SIZE; -#endif - log_len -= newline_length; - } - -#if APP_LOG_COLOR_ENABLE - // Encode CSI end sign. - log_len += app_log_strcpy(log_len, s_log_encode_buf, CSI_END); -#endif - - // Encode newline sign. - log_len += app_log_strcpy(log_len, s_log_encode_buf, APP_LOG_NEWLINE_SIGN); - return log_len; -} - -void app_log_output(uint8_t level, const char *tag, const char *file, const char *func, const long line, - const char *format, ...) +void app_log_output(uint8_t level, const char *tag, const char *file, const char *func, const long line, const char *format, ...) { uint16_t log_length = 0; + uint8_t newline_length = strlen(APP_LOG_NEWLINE_SIGN); int fmt_result = 0; + char line_num[APP_LOG_LINE_NB_LEN_MAX + 1] = { 0 }; va_list ap; - if (level > s_app_log_env.app_log_init.filter.level && s_app_log_env.is_filter_set) { + if (level > s_app_log_env.app_log_init.filter.level && s_app_log_env.is_filter_set) + { return; } + #if APP_LOG_TAG_ENABLE - if (!strstr(tag, s_app_log_env.app_log_init.filter.tag)) { + if (!strstr(tag, s_app_log_env.app_log_init.filter.tag)) + { return; } #endif + va_start(ap, format); + APP_LOG_LOCK(); #if APP_LOG_COLOR_ENABLE @@ -336,25 +288,98 @@ void app_log_output(uint8_t level, const char *tag, const char *file, const char #endif // Encode level info. - if (app_log_is_fmt_set(level, APP_LOG_FMT_LVL)) { + if (app_log_is_fmt_set(level, APP_LOG_FMT_LVL)) + { log_length += app_log_strcpy(log_length, s_log_encode_buf, s_log_svt_lvl_output_info[level]); } #if APP_LOG_TAG_ENABLE // Encode tag info. - if (app_log_is_fmt_set(level, APP_LOG_FMT_TAG)) { + if (app_log_is_fmt_set(level, APP_LOG_FMT_TAG)) + { log_length += app_log_strcpy(log_length, s_log_encode_buf, tag); log_length += app_log_strcpy(log_length, s_log_encode_buf, " "); } #endif - log_length = encode_name(level, file, func, line); + + // Encode file directory name , function name and lune number info. + if (app_log_is_fmt_set(level, APP_LOG_FMT_DIR | APP_LOG_FMT_FUNC | APP_LOG_FMT_LINE)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, "("); + + if (app_log_is_fmt_set(level, APP_LOG_FMT_DIR)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, file); + + if (app_log_is_fmt_set(level, APP_LOG_FMT_FUNC)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, " "); + } + else if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, ":"); + } + } + + if (app_log_is_fmt_set(level, APP_LOG_FMT_FUNC)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, func); + + if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, " Line:"); + } + } + + if (app_log_is_fmt_set(level, APP_LOG_FMT_LINE)) + { + snprintf(line_num, APP_LOG_LINE_NB_LEN_MAX, "%ld", line); + log_length += app_log_strcpy(log_length, s_log_encode_buf, line_num); + } + + log_length += app_log_strcpy(log_length, s_log_encode_buf, ") "); + } + // Encode other log data to buffer. '\0' must be added in the end by vsnprintf. */ - fmt_result = vsnprintf_s((char *)s_log_encode_buf + log_length, sizeof (s_log_encode_buf), - APP_LOG_LINE_BUF_SIZE - log_length, format, ap); + fmt_result = vsnprintf((char *)s_log_encode_buf + log_length, APP_LOG_LINE_BUF_SIZE - log_length, format, ap); va_end(ap); - log_length = calculate_log_length(log_length, fmt_result); + + // Calculate log length + if ((fmt_result > -1) && (log_length + fmt_result) <= APP_LOG_LINE_BUF_SIZE) + { + log_length += fmt_result; + } + else + { + log_length = APP_LOG_LINE_BUF_SIZE; + } + +#if APP_LOG_COLOR_ENABLE + if (log_length + (sizeof(CSI_END) - 1) + newline_length > APP_LOG_LINE_BUF_SIZE) + { + log_length = APP_LOG_LINE_BUF_SIZE; + // Reserve some space for CSI end sign. + log_length -= sizeof(CSI_END) - 1; +#else + if (log_length + newline_length > APP_LOG_LINE_BUF_SIZE) + { + log_length = APP_LOG_LINE_BUF_SIZE; +#endif + log_length -= newline_length; + } + +#if APP_LOG_COLOR_ENABLE + // Encode CSI end sign. + log_length += app_log_strcpy(log_length, s_log_encode_buf, CSI_END); +#endif + + // Encode newline sign. + log_length += app_log_strcpy(log_length, s_log_encode_buf, APP_LOG_NEWLINE_SIGN); + + app_log_data_trans(s_log_encode_buf, log_length); + APP_LOG_UNLOCK(); } @@ -368,10 +393,14 @@ void app_log_raw_info(const char *format, ...) APP_LOG_LOCK(); - fmt_result = vsnprintf_s((char *)s_log_encode_buf, sizeof(s_log_encode_buf), APP_LOG_LINE_BUF_SIZE, format, ap); - if ((fmt_result > -1) && (fmt_result) <= APP_LOG_LINE_BUF_SIZE) { + fmt_result = vsnprintf((char *)s_log_encode_buf, APP_LOG_LINE_BUF_SIZE, format, ap); + + if ((fmt_result > -1) && (fmt_result) <= APP_LOG_LINE_BUF_SIZE) + { log_length = fmt_result; - } else { + } + else + { log_length = APP_LOG_LINE_BUF_SIZE; } @@ -380,50 +409,132 @@ void app_log_raw_info(const char *format, ...) APP_LOG_UNLOCK(); } -void app_log_hex_dump(uint8_t *p_data, uint16_t length) +void app_log_hex_dump(void *p_data, uint16_t length) { uint16_t log_length = 0; uint16_t convert_idx = 0; + uint16_t line_num = 0; char dump_str[8] = {0}; APP_LOG_LOCK(); - for (convert_idx = 0; convert_idx < length; convert_idx++) { - if (log_length >= APP_LOG_LINE_BUF_SIZE) { - log_length = APP_LOG_LINE_BUF_SIZE; - break; + line_num = length / APP_LOG_PER_LINE_HEX_DUMP_SIZE; + + for (uint8_t i = 0; i < line_num; i ++) + { + if (app_log_is_fmt_set(APP_LOG_LVL_DEBUG, APP_LOG_FMT_LVL)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, s_log_svt_lvl_output_info[APP_LOG_LVL_DEBUG]); } - if (p_data[convert_idx] < ' ') { - s_log_encode_buf[log_length] = '.'; - log_length++; - } else { - snprintf_s(dump_str, sizeof (dump_str), BIT_8, "%02X ", p_data[convert_idx]); + for (uint8_t j = 0; j < APP_LOG_PER_LINE_HEX_DUMP_SIZE; j++) + { + snprintf(dump_str, 8, "%02X ", ((uint8_t *)p_data)[convert_idx++]); log_length += app_log_strcpy(log_length, s_log_encode_buf, dump_str); } + + if (convert_idx % APP_LOG_PER_LINE_HEX_DUMP_SIZE == 0) + { + snprintf(dump_str, 8, " | "); + log_length += app_log_strcpy(log_length, s_log_encode_buf, dump_str); + convert_idx -= APP_LOG_PER_LINE_HEX_DUMP_SIZE; + for (uint8_t j = 0; j < APP_LOG_PER_LINE_HEX_DUMP_SIZE; j++) + { + if (((uint8_t *)p_data)[convert_idx] < ' ' || ((uint8_t *)p_data)[convert_idx] > 0x7f) + { + s_log_encode_buf[log_length] = '.'; + log_length++; + } + else + { + s_log_encode_buf[log_length] = ((uint8_t *)p_data)[convert_idx]; + log_length++; + } + convert_idx++; + } + } + log_length += app_log_strcpy(log_length, s_log_encode_buf, APP_LOG_NEWLINE_SIGN); + app_log_data_trans(s_log_encode_buf, log_length); + log_length = 0; } - app_log_data_trans(s_log_encode_buf, log_length); + if (length % APP_LOG_PER_LINE_HEX_DUMP_SIZE) + { + if (app_log_is_fmt_set(APP_LOG_LVL_DEBUG, APP_LOG_FMT_LVL)) + { + log_length += app_log_strcpy(log_length, s_log_encode_buf, s_log_svt_lvl_output_info[APP_LOG_LVL_DEBUG]); + } + + for (uint8_t j = 0; j < length % APP_LOG_PER_LINE_HEX_DUMP_SIZE; j++) + { + snprintf(dump_str, 8, "%02X ", ((uint8_t *)p_data)[convert_idx++]); + log_length += app_log_strcpy(log_length, s_log_encode_buf, dump_str); + } + + for (uint8_t j = 0; j < APP_LOG_PER_LINE_HEX_DUMP_SIZE -length % APP_LOG_PER_LINE_HEX_DUMP_SIZE; j++) + { + snprintf(dump_str, 8, " "); + log_length += app_log_strcpy(log_length, s_log_encode_buf, dump_str); + } + + snprintf(dump_str, 8, " | "); + log_length += app_log_strcpy(log_length, s_log_encode_buf, dump_str); + convert_idx -= length % APP_LOG_PER_LINE_HEX_DUMP_SIZE; + for (uint8_t j = 0; j < length % APP_LOG_PER_LINE_HEX_DUMP_SIZE; j++) + { + if (((uint8_t *)p_data)[convert_idx] < ' ' || ((uint8_t *)p_data)[convert_idx] > 0x7f) + { + s_log_encode_buf[log_length] = '.'; + log_length++; + } + else + { + s_log_encode_buf[log_length] = ((uint8_t *)p_data)[convert_idx]; + log_length++; + } + convert_idx++; + } + + log_length += app_log_strcpy(log_length, s_log_encode_buf, APP_LOG_NEWLINE_SIGN); + app_log_data_trans(s_log_encode_buf, log_length); + } APP_LOG_UNLOCK(); } void app_log_flush(void) { - if (s_app_log_env.flush_func) { + if (s_app_log_env.flush_func) + { s_app_log_env.flush_func(); } } + #if IO_REDIRECT == 0 #if defined(__CC_ARM) -struct __FILE { +struct __FILE +{ int handle; }; -FILE s_stdout; -FILE s_stdin; +FILE __stdout; +FILE __stdin; + +#if !defined(__MICROLIB) +void _sys_exit(int x) { + x = x; +} + +void _ttywrch(int ch) { + ch = ch; +} + +void _sys_command_string(int y) { + y = y; +} +#endif int fputc(int ch, FILE *file) { @@ -437,11 +548,11 @@ int fputc(int ch, FILE *file) int _write(int file, const char *buf, int len) { int tx_len = 0; - char *temp_buf = buf; - while (tx_len < len) { + while (tx_len < len) + { app_log_data_trans((uint8_t *)buf, 1); - temp_buf++; + buf++; tx_len++; } return tx_len; @@ -449,14 +560,14 @@ int _write(int file, const char *buf, int len) #elif defined(__ICCARM__) -size_t s_write(int handle, const unsigned char *buf, size_t size) +size_t __write(int handle, const unsigned char *buf, size_t size) { size_t len = 0; - unsigned char* temp_buf = buf; - while (len < size) { + while (len < size) + { app_log_data_trans((uint8_t *)buf, 1); - temp_buf++; + buf++; len++; } return len; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.h old mode 100755 new mode 100644 index a26bc1d..4680bc3 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log.h @@ -39,8 +39,8 @@ #define __APP_LOG_H__ #include "custom_config.h" -#include "gr55xx_sys.h" -#include "gr55xx_hal.h" +#include "grx_sys.h" +#include "grx_hal.h" #if APP_LOG_STORE_ENABLE #include "app_log_store.h" #endif @@ -71,11 +71,12 @@ #define APP_LOG_UNLOCK() LOCAL_INT_RESTORE() /**< APP log unlock. */ #ifndef APP_LOG_TAG -#define APP_LOG_TAG "NO_TAG" /**< Default app log tag. */ + #define APP_LOG_TAG "NO_TAG" /**< Default app log tag. */ #endif #define APP_LOG_LINE_BUF_SIZE 256 /**< Buffer size for every line's log. */ -#define APP_LOG_SEVERITY_LEVEL APP_LOG_LVL_DEBUG /**< Default log severity level. */ +#define APP_LOG_PER_LINE_HEX_DUMP_SIZE 8 /**< Hex char dump size in per line. */ +#define APP_LOG_SEVERITY_LEVEL APP_LOG_LVL_DEBUG /**< Default log severity level. */ #define APP_LOG_TAG_LEN_MAX 20 /**< Maximum length of output filter's tag. */ #define APP_LOG_LINE_NB_LEN_MAX 5 /**< Maximum length of output line number. */ #define APP_LOG_NEWLINE_SIGN "\r\n" /**< Newline sign output. */ @@ -106,43 +107,39 @@ /** @} */ #if APP_LOG_PRINTF_ENABLE -#if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_ERROR -#define APP_LOG_ERROR(...) app_log_output(APP_LOG_LVL_ERROR, APP_LOG_TAG, \ - __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) -#else -#define APP_LOG_ERROR(...) -#endif + #if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_ERROR + #define APP_LOG_ERROR(...) app_log_output(APP_LOG_LVL_ERROR, APP_LOG_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + #else + #define APP_LOG_ERROR(...) + #endif -#if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_WARNING -#define APP_LOG_WARNING(...) app_log_output(APP_LOG_LVL_WARNING, APP_LOG_TAG, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) -#else -#define APP_LOG_WARNING(...) -#endif + #if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_WARNING + #define APP_LOG_WARNING(...) app_log_output(APP_LOG_LVL_WARNING, APP_LOG_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + #else + #define APP_LOG_WARNING(...) + #endif -#if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_INFO -#define APP_LOG_INFO(...) app_log_output(APP_LOG_LVL_INFO, APP_LOG_TAG, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) -#else -#define APP_LOG_INFO(...) -#endif + #if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_INFO + #define APP_LOG_INFO(...) app_log_output(APP_LOG_LVL_INFO, APP_LOG_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + #else + #define APP_LOG_INFO(...) + #endif -#if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_DEBUG -#define APP_LOG_DEBUG(...) app_log_output(APP_LOG_LVL_DEBUG, APP_LOG_TAG, __FILE__, \ - __FUNCTION__, __LINE__, __VA_ARGS__) -#else -#define APP_LOG_DEBUG(...) -#endif + #if APP_LOG_SEVERITY_LEVEL >= APP_LOG_LVL_DEBUG + #define APP_LOG_DEBUG(...) app_log_output(APP_LOG_LVL_DEBUG, APP_LOG_TAG, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__) + #else + #define APP_LOG_DEBUG(...) + #endif -#define APP_LOG_RAW_INFO(...) app_log_raw_info(__VA_ARGS__) -#define APP_LOG_HEX_DUMP(p_data, length) app_log_hex_dump(p_data, length) + #define APP_LOG_RAW_INFO(...) app_log_raw_info( __VA_ARGS__) + #define APP_LOG_HEX_DUMP(p_data, length) app_log_hex_dump(p_data, length) #else -#define APP_LOG_ERROR(...) -#define APP_LOG_WARNING(...) -#define APP_LOG_INFO(...) -#define APP_LOG_DEBUG(...) -#define APP_LOG_RAW_INFO(...) -#define APP_LOG_HEX_DUMP(p_data, length) + #define APP_LOG_ERROR(...) + #define APP_LOG_WARNING(...) + #define APP_LOG_INFO(...) + #define APP_LOG_DEBUG(...) + #define APP_LOG_RAW_INFO(...) + #define APP_LOG_HEX_DUMP(p_data, length) #endif /** @} */ @@ -162,13 +159,15 @@ typedef void (*app_log_flush_func_t)(void); * @{ */ /**@brief App log filter. */ -typedef struct { +typedef struct +{ uint8_t level; /**< App log filter level. */ char tag[APP_LOG_TAG_LEN_MAX + 1]; /**< App log filter tag. */ } app_log_filter_t; /**@brief App log init stucture. */ -typedef struct { +typedef struct +{ app_log_filter_t filter; /**< App log filter. */ uint8_t fmt_set[APP_LOG_LVL_NB]; /**< Format of app log. See @ref APP_LOG_FMT.*/ } app_log_init_t; @@ -185,7 +184,6 @@ typedef struct { * @param[in] p_log_feat: Pointer to app log feature set. * @param[in] trans_func: App log transmit function. * @param[in] flush_func: App log flush function. - * * @return Result of initialization. ***************************************************************************************** @@ -205,8 +203,7 @@ sdk_err_t app_log_init(app_log_init_t *p_log_init, app_log_trans_func_t trans_fu * @param[in] ...: Arguments. ***************************************************************************************** */ -void app_log_output(uint8_t level, const char *tag, const char *file, const char *func, const long line, - const char *format, ...); +void app_log_output(uint8_t level, const char *tag, const char *file, const char *func, const long line, const char *format, ...); /** ***************************************************************************************** @@ -226,7 +223,7 @@ void app_log_raw_info(const char *format, ...); * @param[in] length Length of data. ***************************************************************************************** */ -void app_log_hex_dump(uint8_t *p_data, uint16_t length); +void app_log_hex_dump(void *p_data, uint16_t length); /** ***************************************************************************************** @@ -237,3 +234,7 @@ void app_log_flush(void); /** @} */ #endif + + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.c new file mode 100644 index 0000000..5672e10 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.c @@ -0,0 +1,231 @@ +/** + ***************************************************************************************** + * + * @file app_log_store_dump_port.c + * + * @brief App Log store dump port Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "app_log_dump_port.h" +#include "app_log_store.h" +#include "lms.h" +#include "app_error.h" +#include "custom_config.h" + +#if APP_LOG_STORE_ENABLE +/* + * DEFINE + ***************************************************************************************** + */ + + +/* + * STRUCTURES + ***************************************************************************************** + */ + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static void lms_log_length_send(uint32_t log_len); +static void lms_data_send(uint8_t *p_data, uint16_t length); +static void lms_data_send_finish_cb(void); +static app_log_dump_cbs_t s_dump_cbs = +{ + .dump_start_cb = lms_log_length_send, + .dump_process_cb = lms_data_send, + .dump_finish_cb = lms_data_send_finish_cb +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint8_t *s_send_data_addr = NULL; +static uint16_t s_send_block_size = 0; +static uint32_t s_sended_len = 0; +static uint16_t s_once_size = 20; +static uint32_t s_checksum = 0; + +static void lms_log_length_send(uint32_t log_len) +{ + sdk_err_t error_code; + uint8_t arr[10] = {0}; + arr[0] = 0x81; + arr[1] = 0; + arr[2] = log_len; + arr[3] = log_len >> 8; + arr[4] = log_len >> 16; + arr[5] = log_len >> 24; + error_code = lms_notify_cmd(0, arr, 6); + APP_ERROR_CHECK(error_code); +} + +static void lms_data_send(uint8_t *p_data, uint16_t length) +{ + for(uint16_t i = 0; i < length; i++) + s_checksum += p_data[i]; + + sdk_err_t error_code; + s_send_block_size = length; + s_send_data_addr = p_data; + + if (s_send_block_size > s_once_size) + { + s_sended_len += s_once_size; + error_code = lms_notify_data(0, s_send_data_addr, s_once_size); + APP_ERROR_CHECK(error_code); + } + else + { + s_sended_len += s_send_block_size; + error_code = lms_notify_data(0, s_send_data_addr, s_send_block_size); + APP_ERROR_CHECK(error_code); + } +} +static void lms_data_continue_send(void) +{ + if (NULL == s_send_data_addr) + { + return; + } + sdk_err_t error_code; + uint16_t remain = s_send_block_size - s_sended_len; + uint16_t offset = 0; + + if (remain > s_once_size) + { + offset = s_sended_len; + s_sended_len += s_once_size; + + error_code = lms_notify_data(0, &s_send_data_addr[offset], s_once_size); + APP_ERROR_CHECK(error_code); + } + else if(remain > 0) + { + offset = s_sended_len; + s_sended_len += remain; + error_code = lms_notify_data(0, &s_send_data_addr[offset],remain); + APP_ERROR_CHECK(error_code); + } + else + { + //vPortFree(s_send_data_addr); + s_send_data_addr = NULL; + s_send_block_size = 0; + s_sended_len = 0; + app_log_dump_continue(); + } +} + +static void lms_data_send_finish_cb(void) +{ + uint8_t arr[5] = {0}; + arr[0] = 0xc1; + arr[1] = s_checksum; + arr[2] = s_checksum >> 8; + arr[3] = s_checksum >> 16; + arr[4] = s_checksum >> 24; + lms_notify_cmd(0, arr, 5); + s_checksum = 0; +} + +static void lms_service_process_event(lms_evt_t *p_evt) +{ + uint8_t arr[10] = {0}; + sdk_err_t error_code; + switch (p_evt->evt_type) + { + case LMS_EVT_CMD_RECEIVE_DATA: + if (1 == p_evt->p_data[0]) + { + error_code = app_log_store_dump(&s_dump_cbs); + if (error_code) + { + arr[0] = 0x81; + arr[1] = error_code; + error_code = lms_notify_cmd(0, arr, 6); + APP_ERROR_CHECK(error_code); + } + } + else if(2 == p_evt->p_data[0]) + { + error_code = app_log_store_clear(); + APP_ERROR_CHECK(error_code); + arr[0] = 0x82; + arr[1] = 0; + error_code = lms_notify_cmd(0, arr, 2); + APP_ERROR_CHECK(error_code); + } + break; + + case LMS_EVT_CMD_NOTIFY_COMPLETE: + break; + + case LMS_EVT_DATA_RECEIVE_DATA: + break; + + case LMS_EVT_DATA_NOTIFY_COMPLETE: + lms_data_continue_send(); + break; + + + default: + break; + } +} + +void lms_update_mtu_size(uint16_t new_mtu) +{ + s_once_size = new_mtu - 3; +} + +void app_log_dump_service_init(void) +{ + sdk_err_t error_code; + lms_init_t lms_init; + + lms_init.evt_handler = lms_service_process_event; + + error_code = lms_service_init(&lms_init); + APP_ERROR_CHECK(error_code); +} + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.h new file mode 100644 index 0000000..73cf46c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_dump_port.h @@ -0,0 +1,58 @@ +/** + **************************************************************************************** + * + * @file app_log_dump_port.h + * + * @brief App Log dump port API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_LOG_DUMP_PORTH__ +#define __APP_LOG_DUMP_PORTH__ + +#include + +/** + ***************************************************************************************** + * @brief Update the Length of log data packet. + ***************************************************************************************** + */ +void lms_update_mtu_size(uint16_t new_mtu); + +/** + ***************************************************************************************** + * @brief Init log dump service. + ***************************************************************************************** + */ +void app_log_dump_service_init(void); +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.c old mode 100755 new mode 100644 index 4226bf1..4d48cad --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.c @@ -40,6 +40,7 @@ * INCLUDE FILES ***************************************************************************************** */ +#include "app_log_store.h" #if APP_LOG_STORE_ENABLE #include "utility.h" @@ -52,21 +53,19 @@ #define APP_LOG_STORE_TIME_DEFAULT "[1970/01/01 00:00:00:000] " #define APP_LOG_STORE_CACHE_SIZE ((APP_LOG_STORE_LINE_SIZE) * (APP_LOG_STORE_CACHE_NUM)) #define APP_LOG_STORE_ONECE_OP_SIZE 1024 -#define APP_LOG_STORE_BUSY_BIT (0x01 << 0) +#define APP_LOG_STORE_CLEAR_BIT (0x01 << 0) #define APP_LOG_STORE_SAVE_BIT (0x01 << 1) #define APP_LOG_STORE_DUMP_BIT (0x01 << 2) - -#define OFFSET_0 0 -#define OFFSET_1 1 -#define OFFSET_2 2 - +#define APP_LOG_STORE_DUMP_READY_BIT (0x01 << 3) +#define APP_LOG_STORE_DUMP_START_BIT (0x01 << 4) /* * STRUCTURES ***************************************************************************************** */ /**@brief App log store head info. */ -typedef struct { +typedef struct +{ uint32_t magic; /**< Magic for app log store. */ uint32_t db_addr; /**< Start address of app log db flash. */ uint32_t db_size; /**< Size of app log db flash. */ @@ -76,7 +75,8 @@ typedef struct { } log_store_head_t; /**@brief App log store environment variable. */ -struct log_store_env_t { +struct log_store_env_t +{ bool initialized; uint8_t store_status; log_store_head_t store_head; @@ -90,10 +90,11 @@ struct log_store_env_t { */ static struct log_store_env_t s_log_store_env; static app_log_store_op_t s_log_store_ops; -static app_log_store_dump_cb_t s_log_store_dump_cb; +static app_log_dump_cbs_t *s_log_dump_cbs; static uint32_t s_log_store_dump_offset; -static ring_buffer_t s_log_store_rbuf; -static uint8_t s_log_store_cache[APP_LOG_STORE_CACHE_SIZE]; +static ring_buffer_t s_log_store_rbuf __attribute__((section("RAM_CODE"))) = {0}; +static uint8_t s_log_store_cache[APP_LOG_STORE_CACHE_SIZE] __attribute__((section("RAM_CODE"))) = {0}; +static uint8_t s_read_dump_buffer[APP_LOG_STORE_ONECE_OP_SIZE]; /* * LOCAL FUNCTION DEFINITIONS @@ -103,8 +104,10 @@ static uint32_t log_store_check_sum_calc(uint8_t *p_data, uint32_t len) { uint32_t check_sum = 0; - if (p_data && len) { - for (uint8_t i = 0; i < len; i++) { + if (p_data && len) + { + for (uint8_t i = 0; i < len; i++) + { check_sum += p_data[i]; } } @@ -118,13 +121,15 @@ static bool log_store_head_check(log_store_head_t *p_head, uint32_t db_addr, uin uint8_t *head_data = (uint8_t *)p_head; if (p_head->magic != APP_LOG_STORE_MAGIC || - p_head->db_addr != db_addr || - p_head->db_size != db_size || - p_head->offset > db_size) { + p_head->db_addr != db_addr || + p_head->db_size != db_size || + p_head->offset > db_size) + { return false; } - if (p_head->check_sum != log_store_check_sum_calc(head_data, head_len - OFFSET_2)) { + if (p_head->check_sum != log_store_check_sum_calc(head_data, head_len - 2)) + { return false; } @@ -136,9 +141,10 @@ static bool log_store_head_update(uint16_t nv_tag, log_store_head_t *p_head) uint16_t head_len = sizeof(log_store_head_t); uint8_t *head_data = (uint8_t *)p_head; - p_head->check_sum = log_store_check_sum_calc(head_data, head_len - OFFSET_2); + p_head->check_sum = log_store_check_sum_calc(head_data, head_len - 2); - if (nvds_put(nv_tag, head_len, (uint8_t *)p_head)) { + if (nvds_put(nv_tag, head_len, (uint8_t *)p_head)) + { return false; } @@ -147,7 +153,8 @@ static bool log_store_head_update(uint16_t nv_tag, log_store_head_t *p_head) static bool log_store_time_stamp_encode(uint8_t *p_buffer, uint8_t buffer_size) { - if (buffer_size != APP_LOG_STORE_TIME_SIZE) { + if (APP_LOG_STORE_TIME_SIZE != buffer_size) + { return false; } @@ -155,12 +162,12 @@ static bool log_store_time_stamp_encode(uint8_t *p_buffer, uint8_t buffer_size) s_log_store_ops.time_get(&rtc_time); - if (APP_LOG_STORE_TIME_SIZE == snprintf_s((char *)p_buffer, APP_LOG_STORE_TIME_SIZE, \ - APP_LOG_STORE_TIME_SIZE, \ - "[%04d/%02d/%02d %02d:%02d:%02d:%03d] ", \ - rtc_time.year, rtc_time.month, rtc_time.day, \ - rtc_time.hour, rtc_time.min, \ - rtc_time.sec, rtc_time.msec)) { + if (APP_LOG_STORE_TIME_SIZE == snprintf((char *)p_buffer, + APP_LOG_STORE_TIME_SIZE, + "[%04d/%02d/%02d %02d:%02d:%02d:%03d] ", + rtc_time.year, rtc_time.month, rtc_time.day, + rtc_time.hour, rtc_time.min, rtc_time.sec, rtc_time.msec)) + { return true; } @@ -171,97 +178,141 @@ static void log_store_data_flash_write(void) { uint32_t align_num = 0; uint32_t read_len; - uint8_t read_buff[APP_LOG_STORE_ONECE_OP_SIZE]; + uint8_t *read_buff = s_read_dump_buffer; - if ((s_log_store_env.store_head.offset % s_log_store_env.blk_size) == 0) { - if (s_log_store_ops.flash_erase) { + if (0 == (s_log_store_env.store_head.offset % s_log_store_env.blk_size)) + { + if (s_log_store_ops.flash_erase) + { s_log_store_ops.flash_erase(s_log_store_env.store_head.db_addr + s_log_store_env.store_head.offset, s_log_store_env.blk_size); } } align_num = ALIGN_NUM(APP_LOG_STORE_ONECE_OP_SIZE, s_log_store_env.store_head.offset); - if (align_num != s_log_store_env.store_head.offset) { + + if (align_num != s_log_store_env.store_head.offset) + { read_len = ring_buffer_read(&s_log_store_rbuf, read_buff, align_num - s_log_store_env.store_head.offset); - } else { + } + else + { read_len = ring_buffer_read(&s_log_store_rbuf, read_buff, APP_LOG_STORE_ONECE_OP_SIZE); } - if (s_log_store_ops.flash_write && read_len) { - s_log_store_ops.flash_write(s_log_store_env.store_head.db_addr + s_log_store_env.store_head.offset, read_buff, - read_len); + if (s_log_store_ops.flash_write && read_len) + { + s_log_store_ops.flash_write(s_log_store_env.store_head.db_addr + s_log_store_env.store_head.offset, read_buff, read_len); s_log_store_env.store_head.offset += read_len; } - if (s_log_store_env.store_head.offset >= s_log_store_env.store_head.db_size) { + if (s_log_store_env.store_head.offset >= s_log_store_env.store_head.db_size) + { s_log_store_env.store_head.offset = 0; s_log_store_env.store_head.flip_over = 1; } log_store_head_update(s_log_store_env.head_nv_tag, &s_log_store_env.store_head); + } static void log_store_to_flash(void) { -#if (APP_LOG_STORE_RUN_ON_OS == 0) - if (s_log_store_env.store_status & APP_LOG_STORE_BUSY_BIT) { - return; - } - - s_log_store_env.store_status |= APP_LOG_STORE_BUSY_BIT; -#endif - log_store_data_flash_write(); s_log_store_env.store_status &= ~APP_LOG_STORE_SAVE_BIT; -#if (APP_LOG_STORE_RUN_ON_OS == 0) - s_log_store_env.store_status &= ~APP_LOG_STORE_BUSY_BIT; -#endif } static void log_dump_from_flash(void) { - uint8_t dump_buffer[APP_LOG_STORE_ONECE_OP_SIZE]; + uint8_t *dump_buffer = s_read_dump_buffer; uint16_t dump_len; + uint32_t need_dump_size = s_log_store_env.store_head.flip_over ? + s_log_store_env.store_head.db_size : s_log_store_env.store_head.offset; - if (s_log_store_env.store_status & APP_LOG_STORE_BUSY_BIT) { - return; - } - s_log_store_env.store_status |= APP_LOG_STORE_BUSY_BIT; + if (s_log_store_ops.flash_read && need_dump_size) + { + uint32_t align_num = ALIGN_NUM(APP_LOG_STORE_ONECE_OP_SIZE, need_dump_size); - if (s_log_store_ops.flash_read) { - uint32_t align_num = ALIGN_NUM(APP_LOG_STORE_ONECE_OP_SIZE, s_log_store_env.store_head.offset); - if (align_num != s_log_store_env.store_head.offset && - (s_log_store_dump_offset + APP_LOG_STORE_ONECE_OP_SIZE) == align_num) { - dump_len = (s_log_store_env.store_head.offset + APP_LOG_STORE_ONECE_OP_SIZE - align_num); - } else { + if (align_num != need_dump_size && + (s_log_store_dump_offset + APP_LOG_STORE_ONECE_OP_SIZE) == align_num) + { + dump_len = (need_dump_size + APP_LOG_STORE_ONECE_OP_SIZE - align_num); + } + else + { dump_len = APP_LOG_STORE_ONECE_OP_SIZE; } s_log_store_ops.flash_read(s_log_store_dump_offset + s_log_store_env.store_head.db_addr, dump_buffer, dump_len); - if (s_log_store_dump_cb) { - s_log_store_dump_cb(dump_buffer, dump_len); + s_log_store_env.store_status &= ~APP_LOG_STORE_DUMP_READY_BIT; + + s_log_store_dump_offset += dump_len; + if (need_dump_size == s_log_store_dump_offset) + { + s_log_store_dump_offset = 0; + s_log_store_env.store_status &= ~APP_LOG_STORE_DUMP_BIT; + } + + if (s_log_dump_cbs->dump_process_cb) + { + s_log_dump_cbs->dump_process_cb(dump_buffer, dump_len); } - s_log_store_dump_offset += dump_len; - } else { + } + else + { s_log_store_env.store_status &= ~APP_LOG_STORE_DUMP_BIT; + s_log_store_env.store_status |= APP_LOG_STORE_DUMP_READY_BIT; } - - if (s_log_store_env.store_head.db_size == s_log_store_dump_offset) { - s_log_store_dump_offset = 0; - } - - if (s_log_store_env.store_head.offset == s_log_store_dump_offset) { - s_log_store_dump_offset = 0; - s_log_store_env.store_status &= ~APP_LOG_STORE_DUMP_BIT; - } - - s_log_store_env.store_status &= ~APP_LOG_STORE_BUSY_BIT; } +static void log_store_flush(void) +{ + uint32_t items_count = 0; + + if (!s_log_store_env.initialized) + { + return; + } + do + { + items_count = ring_buffer_items_count_get(&s_log_store_rbuf); + + if (items_count) + { + log_store_data_flash_write(); + } + } while (items_count >= APP_LOG_STORE_ONECE_OP_SIZE); +} + +static void log_dump_ready(void) +{ + uint32_t log_length; + log_store_flush(); + + // get length and send + if (s_log_dump_cbs->dump_start_cb) + { + log_length = s_log_store_env.store_head.flip_over ? + s_log_store_env.store_head.db_size : s_log_store_env.store_head.offset; + s_log_dump_cbs->dump_start_cb(log_length); + } +} + +static void log_store_clear(void) +{ + s_log_store_env.store_head.offset = 0; + s_log_store_env.store_head.flip_over = 0; + ring_buffer_clean(&s_log_store_rbuf); + + log_store_head_update(s_log_store_env.head_nv_tag, &s_log_store_env.store_head); + + s_log_store_dump_offset = 0; + s_log_store_env.store_status = APP_LOG_STORE_DUMP_READY_BIT; +} /* * GLOBAL FUNCTION DEFINITIONS @@ -271,46 +322,61 @@ uint16_t app_log_store_init(app_log_store_info_t *p_info, app_log_store_op_t *p_ { uint16_t head_len = sizeof(log_store_head_t); - if (s_log_store_env.initialized) { + if (s_log_store_env.initialized) + { return SDK_ERR_DISALLOWED; } - if (p_info == NULL || - p_op_func == NULL || - p_op_func->flash_init == NULL || - p_op_func->flash_read == NULL || - p_op_func->flash_write == NULL || - p_op_func->flash_erase == NULL || - p_info->db_size == 0 || - p_info->blk_size == 0 || - (p_info->db_addr % p_info->blk_size) != 0) { + if (NULL == p_info + || NULL == p_op_func + || NULL == p_op_func->flash_init + || NULL == p_op_func->flash_read + || NULL == p_op_func->flash_write + || NULL == p_op_func->flash_erase + || 0 == p_info->db_size + || 0 == p_info->blk_size + || 0 != (p_info->db_addr % p_info->blk_size)) + { return SDK_ERR_INVALID_PARAM; } nvds_get(p_info->nv_tag, &head_len, (uint8_t *)&s_log_store_env.store_head); - if (!log_store_head_check(&s_log_store_env.store_head, p_info->db_addr, p_info->db_size)) { + if (!log_store_head_check(&s_log_store_env.store_head, p_info->db_addr, p_info->db_size)) + { s_log_store_env.store_head.magic = APP_LOG_STORE_MAGIC; s_log_store_env.store_head.db_addr = p_info->db_addr; s_log_store_env.store_head.db_size = p_info->db_size; s_log_store_env.store_head.offset = 0; s_log_store_env.store_head.flip_over = 0; - if (!log_store_head_update(p_info->nv_tag, &s_log_store_env.store_head)) { + if (!log_store_head_update(p_info->nv_tag, &s_log_store_env.store_head)) + { return SDK_ERR_SDK_INTERNAL; } } - ring_buffer_init(&s_log_store_rbuf, s_log_store_cache, APP_LOG_STORE_CACHE_SIZE); - - memcpy_s(&s_log_store_ops, sizeof (s_log_store_ops), p_op_func, sizeof(s_log_store_ops)); + memcpy(&s_log_store_ops, p_op_func, sizeof(s_log_store_ops)); s_log_store_env.head_nv_tag = p_info->nv_tag; s_log_store_env.blk_size = p_info->blk_size; s_log_store_env.initialized = true; + s_log_store_env.store_status |= APP_LOG_STORE_DUMP_READY_BIT; p_op_func->flash_init(); + if (APP_LOG_STORE_CACHE_SIZE != s_log_store_rbuf.buffer_size) + { + ring_buffer_init(&s_log_store_rbuf, s_log_store_cache, APP_LOG_STORE_CACHE_SIZE); + } + else + { + if (s_log_store_ops.sem_give) + { + s_log_store_ops.sem_give(); + } + } + return SDK_SUCCESS; } @@ -319,17 +385,13 @@ uint16_t app_log_store_save(const uint8_t *p_data, const uint16_t length) { uint8_t time_encode[APP_LOG_STORE_TIME_SIZE] = APP_LOG_STORE_TIME_DEFAULT; - if (!s_log_store_env.initialized) { + if (!s_log_store_env.initialized) + { return SDK_ERR_DISALLOWED; } - if (s_log_store_env.store_status & APP_LOG_STORE_BUSY_BIT) { - return SDK_ERR_BUSY; - } - - s_log_store_env.store_status |= APP_LOG_STORE_BUSY_BIT; - - if (s_log_store_ops.time_get) { + if (s_log_store_ops.time_get) + { log_store_time_stamp_encode(time_encode, APP_LOG_STORE_TIME_SIZE); time_encode[APP_LOG_STORE_TIME_SIZE - 1] = ' '; } @@ -337,78 +399,60 @@ uint16_t app_log_store_save(const uint8_t *p_data, const uint16_t length) ring_buffer_write(&s_log_store_rbuf, time_encode, APP_LOG_STORE_TIME_SIZE); ring_buffer_write(&s_log_store_rbuf, p_data, length); - if (ring_buffer_items_count_get(&s_log_store_rbuf >= APP_LOG_STORE_ONECE_OP_SIZE)) { + if ((APP_LOG_STORE_ONECE_OP_SIZE <= ring_buffer_items_count_get(&s_log_store_rbuf)) && + !(s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT)) + { s_log_store_env.store_status |= APP_LOG_STORE_SAVE_BIT; -#if APP_LOG_STORE_RUN_ON_OS - log_store_to_flash(); -#endif + if (s_log_store_ops.sem_give) + { + s_log_store_ops.sem_give(); + } } - s_log_store_env.store_status &= ~APP_LOG_STORE_BUSY_BIT; - return SDK_SUCCESS; } - -void app_log_store_flush(void) +uint16_t app_log_store_dump(app_log_dump_cbs_t * p_dump_cbs) { - uint32_t items_count = 0; - - if (!s_log_store_env.initialized) { - return; - } - - do { - items_count = ring_buffer_items_count_get(&s_log_store_rbuf); - if (items_count) { - log_store_data_flash_write(); - } - } while (items_count >= APP_LOG_STORE_ONECE_OP_SIZE); -} - -uint16_t app_log_store_dump(app_log_store_dump_cb_t dump_cb) -{ - if (!s_log_store_env.initialized) { + if (!s_log_store_env.initialized) + { return SDK_ERR_DISALLOWED; } - if (s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) { + if (s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) + { return SDK_ERR_BUSY; } - - if (dump_cb == NULL) { - return SDK_ERR_POINTER_NULL; - } - - s_log_store_dump_cb = dump_cb; - - app_log_store_flush(); - - if (s_log_store_env.store_head.flip_over == 0 && s_log_store_env.store_head.offset == 0) { - return SDK_SUCCESS; - } - - if (s_log_store_env.store_head.flip_over) { - uint32_t align_num; - - align_num = ALIGN_NUM(s_log_store_env.blk_size, s_log_store_env.store_head.offset); - - s_log_store_dump_offset = align_num >= s_log_store_env.store_head.db_size ? 0 : align_num; - } else { - s_log_store_dump_offset = 0; - } - + s_log_dump_cbs = p_dump_cbs; + s_log_store_env.store_status |= APP_LOG_STORE_DUMP_START_BIT; s_log_store_env.store_status |= APP_LOG_STORE_DUMP_BIT; + if (s_log_store_ops.sem_give) + { + s_log_store_ops.sem_give(); + } return SDK_SUCCESS; } -void app_log_store_clear(void) +uint16_t app_log_store_clear(void) { - s_log_store_env.store_head.offset = 0; - s_log_store_env.store_head.flip_over = 0; + if (!s_log_store_env.initialized) + { + return SDK_ERR_DISALLOWED; + } + s_log_store_env.store_status |= APP_LOG_STORE_CLEAR_BIT; + if (s_log_store_ops.sem_give) + { + s_log_store_ops.sem_give(); + } + + return SDK_SUCCESS; +} - log_store_head_update(s_log_store_env.head_nv_tag, &s_log_store_env.store_head); +void app_log_status_reset(void) +{ + s_log_store_dump_offset = 0; + s_log_store_env.store_status = APP_LOG_STORE_DUMP_READY_BIT; } bool app_log_store_dump_ongoing(void) @@ -416,17 +460,52 @@ bool app_log_store_dump_ongoing(void) return (s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) ? true : false; } +void app_log_dump_continue(void) +{ + s_log_store_env.store_status |= APP_LOG_STORE_DUMP_READY_BIT; + + if (s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) + { + if (s_log_store_ops.sem_give) + { + s_log_store_ops.sem_give(); + } + } + else + { + if (s_log_dump_cbs->dump_finish_cb) + s_log_dump_cbs->dump_finish_cb(); + } +} + void app_log_store_schedule(void) { -#if APP_LOG_STORE_RUN_ON_OS == 0 - if (s_log_store_env.store_status & APP_LOG_STORE_SAVE_BIT) { + if (s_log_store_ops.sem_take) + { + s_log_store_ops.sem_take(); + } + + if (s_log_store_env.store_status & APP_LOG_STORE_CLEAR_BIT) + { + log_store_clear(); + } + + if (s_log_store_env.store_status & APP_LOG_STORE_SAVE_BIT) + { log_store_to_flash(); } -#endif - if (s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) { + if ((s_log_store_env.store_status & APP_LOG_STORE_DUMP_BIT) && (s_log_store_env.store_status & APP_LOG_STORE_DUMP_READY_BIT)) + { + if (s_log_store_env.store_status & APP_LOG_STORE_DUMP_START_BIT) + { + log_dump_ready(); + s_log_store_env.store_status &= ~APP_LOG_STORE_DUMP_START_BIT; + } + log_dump_from_flash(); } } + #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.h old mode 100755 new mode 100644 index 41dee56..04c7f26 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_log/app_log_store.h @@ -40,7 +40,7 @@ #include "custom_config.h" #if APP_LOG_STORE_ENABLE -#include "gr55xx_sys.h" +#include "grx_sys.h" #include "ring_buffer.h" #include #include @@ -61,16 +61,20 @@ * @{ */ /**@brief APP LOG Store flash data dump callback type. */ -typedef void (*app_log_store_dump_cb_t)(uint8_t *p_data, uint16_t len); +typedef void (*app_log_store_dump_process_cb_t)(uint8_t *p_data, uint16_t len); +typedef void (*app_log_store_dump_start_cb_t)(uint32_t len); +typedef void (*app_log_store_dump_finish_cb_t)(void); +typedef void (*app_log_sem_process)(void); /** @} */ /** * @defgroup APP_LOG_STORE_STRUCT Structures * @{ */ -/**@brief The date and time structure. The packed size is 7 bytes. */ -typedef struct { - uint16_t year; /**< Year time element. */ + /**@brief The date and time structure. The packed size is 7 bytes. */ +typedef struct +{ + uint8_t year; /**< Year time element. */ uint8_t month; /**< Month time element. */ uint8_t day; /**< Day time element. */ uint8_t hour; /**< Hour time element. */ @@ -80,16 +84,20 @@ typedef struct { } app_log_store_time_t; /**@brief App log store operation functions. */ -typedef struct { +typedef struct +{ bool (*flash_init)(void); /**< Flash init. */ bool (*flash_erase)(const uint32_t addr, const uint32_t size); /**< Flash erase. */ uint32_t (*flash_read)(const uint32_t addr, uint8_t *buf, const uint32_t size); /**< Flash read. */ uint32_t (*flash_write)(const uint32_t addr, const uint8_t *buf, const uint32_t size); /**< Flash write. */ void (*time_get)(app_log_store_time_t *p_time); /**< Get real time. */ + app_log_sem_process sem_give; + app_log_sem_process sem_take; } app_log_store_op_t; /**@brief App log store init stucture. */ -typedef struct { +typedef struct +{ uint16_t nv_tag; /**< NVDS Tag for app log store env. */ uint32_t db_addr; /**< Start address of app log db flash. */ uint32_t db_size; /**< Size of app log db flash. */ @@ -97,6 +105,15 @@ typedef struct { } app_log_store_info_t; /** @} */ +/**@brief App log store dump stucture. */ +typedef struct +{ + app_log_store_dump_process_cb_t dump_process_cb; /**< App log store dump callback. */ + app_log_store_dump_start_cb_t dump_start_cb; /**< App log store dump start callback. */ + app_log_store_dump_finish_cb_t dump_finish_cb; /**< App log store dump finish callback. */ +} app_log_dump_cbs_t; +/** @} */ + /** * @defgroup APP_LOG_STORE_FUNCTION Functions * @{ @@ -134,21 +151,15 @@ uint16_t app_log_store_save(const uint8_t *p_data, uint16_t length); * @return Result of dump. ***************************************************************************************** */ -uint16_t app_log_store_dump(app_log_store_dump_cb_t dump_cb); +uint16_t app_log_store_dump(app_log_dump_cbs_t *p_dump_cbs); -/** - ***************************************************************************************** - * @brief Flush app log store cache to flash. - ***************************************************************************************** - */ -void app_log_store_flush(void); /** ***************************************************************************************** * @brief App log store clear. ***************************************************************************************** */ -void app_log_store_clear(void); +uint16_t app_log_store_clear(void); /** ***************************************************************************************** @@ -157,12 +168,21 @@ void app_log_store_clear(void); */ bool app_log_store_dump_ongoing(void); +/** + ***************************************************************************************** + * @brief Continue log dump. + ***************************************************************************************** + */ +void app_log_dump_continue(void); /** ***************************************************************************************** * @brief App log store schedule for save and dump. ***************************************************************************************** */ void app_log_store_schedule(void); + /** @} */ #endif #endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/BUILD.gn new file mode 100644 index 0000000..d44487d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_memory") { + sources = [ "app_memory.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.c new file mode 100644 index 0000000..e1f49c8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.c @@ -0,0 +1,267 @@ +/** + ***************************************************************************************** + * + * @file app_memory.c + * + * @brief App Memory Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_memory.h" +#include "utility.h" +#include + +/* + * DEFINE + ***************************************************************************************** + */ +#define MEM_BLOCK_SIZE ALIGN_NUM(APP_MEM_ALIGN_NUM, sizeof(app_mem_block_t)) +#define BLOCK_ALLOCATED_BIT ((size_t)1 << (sizeof(size_t) * 8 - 1)) +#define BLOCK_ALLOC_SIZE_MIN (MEM_BLOCK_SIZE + APP_MEM_ALIGN_NUM) + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static __attribute__ ((aligned (APP_MEM_ALIGN_NUM))) uint8_t s_mem_heap[APP_MEM_HEAP_SIZE]; + +static app_mem_block_t s_start_list_node; +static app_mem_block_t s_end_list_node; +static size_t s_curr_free_bytes; +static size_t s_ever_free_bytes_min; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_mem_init(void) +{ + app_mem_block_t *p_fir_free_block; + + s_start_list_node.p_next_free_block = (void *)s_mem_heap; + s_start_list_node.block_size = 0; + + + s_end_list_node.p_next_free_block = NULL; + s_end_list_node.block_size = 0; + + p_fir_free_block = (void *)s_mem_heap; + + p_fir_free_block->p_next_free_block = &s_end_list_node; + p_fir_free_block->block_size = APP_MEM_HEAP_SIZE; + + s_curr_free_bytes = p_fir_free_block->block_size; + s_ever_free_bytes_min = p_fir_free_block->block_size; +} + + +static void free_block_node_insert(app_mem_block_t *p_insert_node) +{ + app_mem_block_t *p_iterator_node = &s_start_list_node; + + while (p_iterator_node->p_next_free_block < p_insert_node && + NULL != p_iterator_node->p_next_free_block->p_next_free_block) + { + p_iterator_node = p_iterator_node->p_next_free_block; + } + + + if (((uint8_t *)p_iterator_node + p_iterator_node->block_size) == (uint8_t *)p_insert_node) + { + p_iterator_node->block_size += p_insert_node->block_size; + p_insert_node = p_iterator_node; + } + + if (((uint8_t *)p_insert_node + p_insert_node->block_size) == (uint8_t *)p_iterator_node->p_next_free_block) + { + if (p_iterator_node->p_next_free_block != &s_end_list_node) + { + p_insert_node->block_size += p_iterator_node->p_next_free_block->block_size; + p_insert_node->p_next_free_block = p_iterator_node->p_next_free_block->p_next_free_block; + } + else + { + p_insert_node->p_next_free_block = &s_end_list_node; + } + } + else + { + p_insert_node->p_next_free_block = p_iterator_node->p_next_free_block; + } + + if (p_iterator_node != p_insert_node) + { + p_iterator_node->p_next_free_block = p_insert_node; + } +} + + + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void *app_malloc(size_t size) +{ + app_mem_block_t *p_block; + app_mem_block_t *p_pre_block; + app_mem_block_t *p_new_block; + void *return_ptr = NULL; + + APP_MEM_LOCK(); + + if (NULL == s_start_list_node.p_next_free_block) + { + app_mem_init(); + } + + if (0 == (size & BLOCK_ALLOCATED_BIT) && 0 != size) + { + size += MEM_BLOCK_SIZE; + size = ALIGN_NUM(APP_MEM_ALIGN_NUM, size); + } + else + { + return return_ptr; + } + + if (size > 0 && size < s_curr_free_bytes) + { + p_pre_block = &s_start_list_node; + p_block = s_start_list_node.p_next_free_block; + + while ((p_block->block_size < size) && (NULL != p_block->p_next_free_block)) + { + p_pre_block = p_block; + p_block = p_block->p_next_free_block; + } + + if (p_block != &s_end_list_node) + { + return_ptr = (void *)((uint8_t *)p_pre_block->p_next_free_block + MEM_BLOCK_SIZE); + p_pre_block->p_next_free_block = p_block->p_next_free_block; + + if ((p_block->block_size - size) > BLOCK_ALLOC_SIZE_MIN) + { + p_new_block = (void *)((uint8_t *)p_block + size); + p_new_block->block_size = p_block->block_size - size; + p_block->block_size = size; + + free_block_node_insert(p_new_block); + } + + s_curr_free_bytes -= p_block->block_size; + + if (s_curr_free_bytes < s_ever_free_bytes_min) + { + s_ever_free_bytes_min = s_curr_free_bytes; + } + + p_block->block_size |= BLOCK_ALLOCATED_BIT; + p_block->p_next_free_block = NULL; + } + } + + APP_MEM_UNLOCK(); + + return return_ptr; +} + + +void app_free(void *ptr) +{ + app_mem_block_t *p_block; + + if (NULL == ptr) + { + return; + } + + APP_MEM_LOCK(); + + p_block = (app_mem_block_t *)((uint8_t *)ptr - MEM_BLOCK_SIZE); + + + if (p_block->block_size & BLOCK_ALLOCATED_BIT) + { + if (NULL == p_block->p_next_free_block) + { + p_block->block_size &= ~BLOCK_ALLOCATED_BIT; + + s_curr_free_bytes += p_block->block_size; + + free_block_node_insert(p_block); + } + } + + APP_MEM_UNLOCK(); +} + +void *app_realloc(void *ptr, size_t size) +{ + app_mem_block_t *p_block; + void *p_realloc_ptr; + size_t block_size; + size_t copy_size; + + p_realloc_ptr = app_malloc(size); + if (p_realloc_ptr) + { + APP_MEM_LOCK(); + p_block = (app_mem_block_t *)((uint8_t *)ptr - MEM_BLOCK_SIZE); + block_size = (p_block->block_size & ~BLOCK_ALLOCATED_BIT); + copy_size = (block_size - MEM_BLOCK_SIZE) > size ? size : (block_size - MEM_BLOCK_SIZE); + memcpy(p_realloc_ptr, (uint8_t *)ptr, copy_size); + APP_MEM_UNLOCK(); + app_free(ptr); + return p_realloc_ptr; + } + + return NULL; +} + +size_t app_mem_curr_free_size_get(void) +{ + return s_curr_free_bytes; +} + + +size_t app_mem_ever_free_min_size_get(void) +{ + return s_ever_free_bytes_min; +} + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.h new file mode 100644 index 0000000..e7c7e24 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_memory/app_memory.h @@ -0,0 +1,128 @@ +/** + **************************************************************************************** + * + * @file app_memory.h + * + * @brief App Memory API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_MEMORY_H__ +#define __APP_MEMORY_H__ + +#include "grx_hal.h" +#include +#include + +/** + * @defgroup APP_MEMORY_MAROC Defines + * @{ + */ +#ifndef APP_MEM_ALIGN_NUM +#define APP_MEM_ALIGN_NUM 4 /**< ALIGN number: 4 byte. */ +#endif + +#ifndef APP_MEM_HEAP_SIZE +#define APP_MEM_HEAP_SIZE (4 * 1024) /**< Total app memory heap size. */ +#endif + +#define APP_MEM_LOCK() GLOBAL_EXCEPTION_DISABLE() /**< App memory lock. */ +#define APP_MEM_UNLOCK() GLOBAL_EXCEPTION_ENABLE() /**< App memory unlock. */ +/** @} */ + + +/** + * @defgroup APP_MEMORY_STRUCT Structures + * @{ + */ +/**@brief App Memory Block Information */ +typedef struct mem_block_info +{ + struct mem_block_info *p_next_free_block; /**< Pointer to next free block. */ + size_t block_size; /**< Size of block. */ +} app_mem_block_t; + +/** @} */ + +/** + * @defgroup APP_MEMORY_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Malloc a block memory. + * + * @param[in] size: Size of memory needed to be alloced. + * + * @return Pointer to alloced memory. + ***************************************************************************************** + */ +void *app_malloc(size_t size); + +/** + ***************************************************************************************** + * @brief Realloc a block memory. + * + * @param[in] ptr: Pointer to memory had been alloced. + * @param[in] size: Size of memory needed to be realloced. + * + * @return Pointer to realloced memory. + ***************************************************************************************** + */ +void *app_realloc(void *ptr, size_t size); + +/** + ***************************************************************************************** + * @brief Free a block memory. + * + * @param[in] ptr: Pointer to memory needed to be free. + ***************************************************************************************** + */ +void app_free(void *ptr); + +/** + ***************************************************************************************** + * @brief Get current free size of app memory. + ***************************************************************************************** + */ +size_t app_mem_curr_free_size_get(void); + +/** + ***************************************************************************************** + * @brief Get ever min free size of app memory. + ***************************************************************************************** + */ +size_t app_mem_ever_free_min_size_get(void); +/** @} */ + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/BUILD.gn new file mode 100644 index 0000000..c3c71d5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_queue") { + sources = [ "app_queue.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.c new file mode 100644 index 0000000..6f68c4c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.c @@ -0,0 +1,277 @@ +/** + ***************************************************************************************** + * + * @file app_queue.c + * + * @brief APP Queue function Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_queue.h" +#include "grx_hal.h" +#include +#include + +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_QUEUE_LOCK() LOCAL_INT_DISABLE(BLE_IRQn) +#define APP_QUEUE_UNLOCK() LOCAL_INT_RESTORE() + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +sdk_err_t app_queue_init(app_queue_t *p_queue, void *p_buffer, uint16_t queue_size, uint16_t element_size) +{ + if (NULL == p_queue || NULL == p_buffer) + { + return SDK_ERR_POINTER_NULL; + } + + p_queue->element_size = element_size; + p_queue->queue_size = queue_size; + p_queue->p_buffer = p_buffer; + p_queue->start_idx = 0; + p_queue->end_idx = 0; + + return SDK_SUCCESS; +} + +sdk_err_t app_queue_push(app_queue_t *p_queue, void const *p_elemment) +{ + bool is_full; + uint16_t wr_idx; + void *p_wr_pos; + sdk_err_t error_code = SDK_SUCCESS; + + if (NULL == p_queue || NULL == p_elemment) + { + return SDK_ERR_POINTER_NULL; + } + + APP_QUEUE_LOCK(); + + is_full = app_queue_is_full(p_queue); + + if (is_full) + { + error_code = SDK_ERR_NO_RESOURCES; + } + else + { + wr_idx = p_queue->end_idx; + p_wr_pos = (void *)((size_t)p_queue->p_buffer + wr_idx * p_queue->element_size); + p_queue->end_idx = app_queue_next_idx_get(p_queue->end_idx, p_queue->queue_size); + + memcpy(p_wr_pos, p_elemment, p_queue->element_size); + } + + APP_QUEUE_UNLOCK(); + + return error_code; +} + +uint16_t app_queue_multi_push(app_queue_t *p_queue, void const *p_elemment, uint16_t amount) +{ + uint16_t stored_num = 0; + uint16_t surplus_space = 0; + uint16_t over_flow = 0; + uint16_t wr_idx; + void *p_wr_pos; + void *p_head_pos; + + if (NULL == p_elemment || 0 == amount) + { + stored_num = 0; + } + + APP_QUEUE_LOCK(); + + surplus_space = app_queue_surplus_space_get(p_queue); + wr_idx = p_queue->end_idx; + p_wr_pos = (void *)((size_t)p_queue->p_buffer + wr_idx * p_queue->element_size); + p_head_pos = (void *)((size_t)p_queue->p_buffer); + + stored_num = amount > surplus_space ? surplus_space : amount; + + if (p_queue->start_idx <= p_queue->end_idx) + { + if (p_queue->end_idx + amount >= p_queue->queue_size) + { + over_flow = p_queue->end_idx + amount - p_queue->queue_size; + } + } + + memcpy(p_wr_pos, p_elemment, p_queue->element_size * (stored_num - over_flow)); + memcpy(p_head_pos, + (void const *)((size_t)p_elemment + p_queue->element_size * (stored_num - over_flow)), + p_queue->element_size * over_flow); + + wr_idx += stored_num; + + if (wr_idx >= p_queue->queue_size) + { + wr_idx -= p_queue->queue_size; + } + + p_queue->end_idx = wr_idx; + + APP_QUEUE_UNLOCK(); + + return stored_num; +} + +sdk_err_t app_queue_peek(app_queue_t *p_queue, void *p_elemment) +{ + uint16_t peek_idx = 0; + void *p_peek_pos = NULL; + sdk_err_t error_code = SDK_SUCCESS; + + if (NULL == p_queue || NULL == p_elemment) + { + return SDK_ERR_POINTER_NULL; + } + + APP_QUEUE_LOCK(); + + if (app_queue_is_empty(p_queue)) + { + error_code = SDK_ERR_LIST_ITEM_NOT_FOUND; + } + + peek_idx = p_queue->start_idx; + p_peek_pos = (void *)((size_t)p_queue->p_buffer + peek_idx * p_queue->element_size); + + memcpy(p_elemment, p_peek_pos, p_queue->element_size); + + APP_QUEUE_UNLOCK(); + + return error_code; +} + +sdk_err_t app_queue_pop(app_queue_t *p_queue, void *p_elemment) +{ + uint16_t peek_idx = 0; + void *p_peek_pos = NULL; + sdk_err_t error_code = SDK_SUCCESS; + + if (NULL == p_queue || NULL == p_elemment) + { + return SDK_ERR_POINTER_NULL; + } + + APP_QUEUE_LOCK(); + + if (app_queue_is_empty(p_queue)) + { + error_code = SDK_ERR_LIST_ITEM_NOT_FOUND; + } + else + { + peek_idx = p_queue->start_idx; + p_peek_pos = (void *)((size_t)p_queue->p_buffer + peek_idx * p_queue->element_size); + p_queue->start_idx = app_queue_next_idx_get(p_queue->start_idx, p_queue->queue_size); + + memcpy(p_elemment, p_peek_pos, p_queue->element_size); + } + + APP_QUEUE_UNLOCK(); + + return error_code; +} + +uint16_t app_queue_surplus_space_get(app_queue_t *p_queue) +{ + uint16_t start_idx = p_queue->start_idx; + uint16_t end_idx = p_queue->end_idx; + uint16_t queue_size = p_queue->queue_size; + uint16_t surplus_space = 0; + + APP_QUEUE_LOCK(); + + if (start_idx <= end_idx) + { + surplus_space = queue_size - end_idx + start_idx; + } + else + { + surplus_space = start_idx - end_idx - 1; + } + + APP_QUEUE_UNLOCK(); + + return surplus_space; +} + +uint16_t app_queue_items_count_get(app_queue_t *p_queue) +{ + uint16_t start_idx = p_queue->start_idx; + uint16_t end_idx = p_queue->end_idx; + uint16_t queue_size = p_queue->queue_size; + uint16_t items_count = 0; + + if (NULL == p_queue) + { + return 0; + } + + APP_QUEUE_LOCK(); + + if (start_idx <= end_idx) + { + items_count = end_idx - start_idx; + } + else + { + items_count = queue_size - start_idx + end_idx; + } + + APP_QUEUE_UNLOCK(); + + return items_count; +} + +void app_queue_clean(app_queue_t *p_queue) +{ + APP_QUEUE_LOCK(); + + p_queue->start_idx = 0; + p_queue->end_idx = 0; + + APP_QUEUE_UNLOCK(); +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.h new file mode 100644 index 0000000..56680b9 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_queue/app_queue.h @@ -0,0 +1,208 @@ + /** + ***************************************************************************************** + * + * @file app_queue.h + * + * @brief Header file - APP QUEUE APIs + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_QUEUE_H__ +#define __APP_QUEUE_H__ + +#include "grx_sys.h" +#include +#include + +/** + * @defgroup APP_QUEUE_STRUCT Structures + * @{ + */ +/**@brief App queue instance information. */ +typedef struct +{ + uint16_t element_size; /**< Size of app queue element. */ + uint16_t queue_size; /**< Size of app queue buffer. */ + void *p_buffer; /**< Pointer to app queue buffer. */ + uint16_t start_idx; /**< Start index of app queue. */ + uint16_t end_idx; /**< End index of app queue. */ +} app_queue_t; +/** @} */ + +/** + * @defgroup APP_QUEUE_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize one app queue instance. + * + * @param[in] p_queue: Pointer to app queue instance. + * @param[in] p_buffer: Pointer to queue buffer. + * @param[in] queue_size: Size of queue buffer(The actual queue allocation size is one more than available). + * @param[in] element_size: Size of queue element + * + * @return Result of initializing app queue. + ***************************************************************************************** + */ +sdk_err_t app_queue_init(app_queue_t *p_queue, void *p_buffer, uint16_t queue_size, uint16_t element_size); + +/** + ***************************************************************************************** + * @brief Push one element to tail of app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + * @param[in] p_elemment: Pointer to the element that will be stored in the queue. + * + * @return Result of element push. + ***************************************************************************************** + */ +sdk_err_t app_queue_push(app_queue_t *p_queue, void const *p_elemment); + +/** + ***************************************************************************************** + * @brief Push some elements to tail of app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + * @param[in] p_elemment: Pointer to the elements that will be stored in the queue. + * @param[in] amount: Amount of the elements that wants be stored in the queue. + * + * @return Amount of writen elements. + ***************************************************************************************** + */ +uint16_t app_queue_multi_push(app_queue_t *p_queue, void const *p_elemment, uint16_t amount); + +/** + ***************************************************************************************** + * @brief Peek one element from tail of app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + * @param[out] p_elemment: Pointer to where the element will be copied. + * + * @return Result of element peek. + ***************************************************************************************** + */ +sdk_err_t app_queue_peek(app_queue_t *p_queue, void *p_elemment); + +/** + ***************************************************************************************** + * @brief Pop one element from tail of app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + * @param[out] p_elemment: Pointer to where the element will be copied. + * + * @return Result of element pop. + ***************************************************************************************** + */ +sdk_err_t app_queue_pop(app_queue_t *p_queue, void *p_elemment); + +/** + ***************************************************************************************** + * @brief Get next index. + * + * @param[in] curr_idx: Current index. + * @param[in] size: Size of current app queue. + * + * @retval Next index. + ***************************************************************************************** + */ +__STATIC_FORCEINLINE uint16_t app_queue_next_idx_get(uint16_t curr_idx, uint16_t size) +{ + return (curr_idx < size) ? (curr_idx + 1) : 0; +} + +/** + ***************************************************************************************** + * @brief Check app queue is full or not. + * + * @param[in] p_queue: Pointer to app queue instance. + * + * @return Result of check. + ***************************************************************************************** + */ +__STATIC_FORCEINLINE bool app_queue_is_full(app_queue_t *p_queue) +{ + uint16_t next_idx; + + next_idx = app_queue_next_idx_get( p_queue->end_idx, p_queue->queue_size); + + return next_idx == p_queue->start_idx; +} + +/** + ***************************************************************************************** + * @brief Check app queue is empty or not. + * + * @param[in] p_queue: Pointer to app queue instance. + * + * @return Result of check. + ***************************************************************************************** + */ +__STATIC_FORCEINLINE bool app_queue_is_empty(app_queue_t *p_queue) +{ + return (p_queue->start_idx == p_queue->end_idx); +} + +/** + ***************************************************************************************** + * @brief Get surplus space of one app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + * + * @retval Size of surplus space. + ***************************************************************************************** + */ +uint16_t app_queue_surplus_space_get(app_queue_t *p_queue); + +/** + ***************************************************************************************** + * @brief Get availdble data from one ring buffer. + * + * @param[in] p_queue: Pointer to app queue instance. + * + * @retval Count of availdble items. + ***************************************************************************************** + */ +uint16_t app_queue_items_count_get(app_queue_t *p_queue); + +/** + ***************************************************************************************** + * @brief Clean one app queue. + * + * @param[in] p_queue: Pointer to app queue instance. + ***************************************************************************************** + */ +void app_queue_clean(app_queue_t *p_queue); + +/** @} */ + + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/BUILD.gn new file mode 100644 index 0000000..69d0b77 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_scheduler") { + sources = [ "app_scheduler.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.c new file mode 100644 index 0000000..97055be --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.c @@ -0,0 +1,178 @@ +/** + ***************************************************************************************** + * + * @file app_scheduler.c + * + * @brief App Scheduler Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_scheduler.h" +#include "grx_hal.h" +#include "app_memory.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_SCHEDULER_LOCK() LOCAL_INT_DISABLE(BLE_IRQn) +#define APP_SCHEDULER_UNLOCK() LOCAL_INT_RESTORE() + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief App scheduler environment variable. */ +struct app_scheduler_env_t +{ + app_scheduler_evt_info_t *p_evt_info_buffer; + uint16_t evt_queue_size; + volatile uint8_t queue_start_index; + volatile uint8_t queue_end_index; +}; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static struct app_scheduler_env_t s_app_scheduler_env; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static __INLINE uint8_t next_index_get(uint8_t index) +{ + return (index < s_app_scheduler_env.evt_queue_size) ? (index + 1) : 0; +} + +static __INLINE bool is_evt_queue_full() +{ + return next_index_get(s_app_scheduler_env.queue_end_index) == s_app_scheduler_env.queue_start_index; +} + +static __INLINE bool is_evt_queue_empty() +{ + return s_app_scheduler_env.queue_end_index == s_app_scheduler_env.queue_start_index; +} + + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +sdk_err_t app_scheduler_init(uint16_t queue_size) +{ + if (!queue_size) + { + return SDK_ERR_INVALID_PARAM; + } + + s_app_scheduler_env.p_evt_info_buffer = app_malloc((queue_size + 1) * sizeof(app_scheduler_evt_info_t)); + + if (NULL == s_app_scheduler_env.p_evt_info_buffer) + { + return SDK_ERR_NO_RESOURCES; + } + + memset(s_app_scheduler_env.p_evt_info_buffer, 0, (queue_size + 1) * sizeof(app_scheduler_evt_info_t)); + + s_app_scheduler_env.evt_queue_size = queue_size; + s_app_scheduler_env.queue_start_index = 0; + s_app_scheduler_env.queue_end_index = 0; + + return SDK_SUCCESS; +} + +sdk_err_t app_scheduler_evt_put(void const *p_evt_data, uint16_t evt_data_size, app_scheduler_evt_handler_t evt_handler) +{ + sdk_err_t error_code; + void *evt_data_ptr; + + APP_SCHEDULER_LOCK(); + + if (!is_evt_queue_full()) + { + s_app_scheduler_env.p_evt_info_buffer[s_app_scheduler_env.queue_end_index].evt_handler = evt_handler; + s_app_scheduler_env.p_evt_info_buffer[s_app_scheduler_env.queue_end_index].evt_data_size = evt_data_size; + if (p_evt_data && evt_data_size) + { + evt_data_ptr = app_malloc(evt_data_size); + if (NULL == evt_data_ptr) + { + return SDK_ERR_NO_RESOURCES; + } + + memcpy(evt_data_ptr, p_evt_data, evt_data_size); + s_app_scheduler_env.p_evt_info_buffer[s_app_scheduler_env.queue_end_index].p_evt_data = evt_data_ptr; + } + s_app_scheduler_env.queue_end_index = next_index_get(s_app_scheduler_env.queue_end_index); + error_code = SDK_SUCCESS; + } + else + { + error_code = SDK_ERR_NO_RESOURCES; + } + + APP_SCHEDULER_UNLOCK(); + + return error_code; +} + +void app_scheduler_execute(void) +{ + while(!is_evt_queue_empty()) + { + void *p_evt_data; + uint16_t evt_data_size; + app_scheduler_evt_handler_t evt_handler; + uint8_t evt_index; + + evt_index = s_app_scheduler_env.queue_start_index; + + p_evt_data = s_app_scheduler_env.p_evt_info_buffer[evt_index].p_evt_data; + evt_data_size = s_app_scheduler_env.p_evt_info_buffer[evt_index].evt_data_size; + evt_handler = s_app_scheduler_env.p_evt_info_buffer[evt_index].evt_handler; + + if (evt_handler) + { + evt_handler(p_evt_data, evt_data_size); + } + + app_free(p_evt_data); + + s_app_scheduler_env.queue_start_index = next_index_get(s_app_scheduler_env.queue_start_index); + } +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.h new file mode 100644 index 0000000..555679c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_scheduler/app_scheduler.h @@ -0,0 +1,104 @@ +/** + **************************************************************************************** + * + * @file app_scheduler.h + * + * @brief App Scheduler API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __APP_SCHEDULER_H__ +#define __APP_SCHEDULER_H__ + +#include "grx_sys.h" +#include +#include + +/** + * @defgroup APP_SCHEDULER_TYPEDEF Typedefs + * @{ + */ +/**@brief APP Scheduler event handler type. */ +typedef void (*app_scheduler_evt_handler_t)(void *p_evt_data, uint16_t evt_data_size); +/** @} */ + +/** + * @defgroup APP_SCHEDULER_STRUCT Structures + * @{ + */ +/**@brief App scheduler event information. */ +typedef struct +{ + app_scheduler_evt_handler_t evt_handler; /**< Event handler. */ + void *p_evt_data; /**< Pointer to event data. */ + uint16_t evt_data_size; /**< Size of event data. */ +} app_scheduler_evt_info_t; +/** @} */ + +/** + * @defgroup APP_SCHEDULER_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize app scheduler module. + * + * @param[in] queue_size: Event queue size. + * + * @return Result of initialization. + ***************************************************************************************** + */ +sdk_err_t app_scheduler_init(uint16_t queue_size); + +/** + ***************************************************************************************** + * @brief Put an event into event queue. + * + * @param[in] p_evt_data: Pointer to event data. + * @param[in] evt_data_size: Size of event data. + * @param[in] evt_handler: Event handler. + * + * @return Result of put. + ***************************************************************************************** + */ +sdk_err_t app_scheduler_evt_put(void const *p_evt_data, uint16_t evt_data_size, app_scheduler_evt_handler_t evt_handler); + +/** + ***************************************************************************************** + * @brief Executing all events. + ***************************************************************************************** + */ +void app_scheduler_execute(void); +/** @} */ + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/BUILD.gn new file mode 100644 index 0000000..aae4e14 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("app_timer") { + sources = [ "app_timer.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.c old mode 100755 new mode 100644 index 875c65d..1eb0610 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.c @@ -39,16 +39,21 @@ * INCLUDE FILES ***************************************************************************************** */ -#include -#include "custom_config.h" -#include "gr55xx_hal.h" -#include "gr55xx_pwr.h" #include "app_timer.h" - -#if APP_TIMER_USE_SCHEDULER -#include "app_scheduler.h" +#include "grx_hal.h" +#include "gr_soc.h" +#if APP_TIMER_ASSERT_ENABLE +#include "app_assert.h" +#else +#define APP_ASSERT_CHECK(x) #endif + +/* + * GLOBAL VERIABLE DECLARATION + ***************************************************************************************** + */ + /* * DEFINES ***************************************************************************************** @@ -64,453 +69,604 @@ not disable SVC_IRQ, BLE_IRQ, BLE_SLEEP_IRQ to ensure the highest priority of Bluetooth services */ -#define LOCAL_APP_TIMER_LOCK() \ - uint32_t __l_irq_rest = __get_BASEPRI(); \ - __set_BASEPRI(NVIC_GetPriority(BLE_IRQn) + \ - (1 << (NVIC_GetPriorityGrouping() + 1))) +#define _LOCAL_APP_TIMER_LOCK() \ + uint32_t __l_irq_rest = __get_BASEPRI(); \ + __set_BASEPRI(NVIC_GetPriority(BLE_IRQn) + \ + (1 << (NVIC_GetPriorityGrouping() + 1))); -#define LOCAL_APP_TIMER_UNLOCK() \ - __set_BASEPRI(__l_irq_rest) +#define _LOCAL_APP_TIMER_UNLOCK() \ + __set_BASEPRI(__l_irq_rest); -/**@brief The length of timer node list. */ -#define TIMER_NODE_CNT 20 -#define TIMER_INVALID_DELAY_VALUE 0 -#define TIMER_INVALID_NODE_NUMBER 0xFF -#define APP_TIMER_STOP_VALUE 0x1 -#define APP_TIMER_INVALID_ID NULL -#define APP_TIMER_SUC 0x0 -#define APP_TIMER_FAIL (-1) -#define APP_TIMER_LOCK() LOCAL_APP_TIMER_LOCK() -#define APP_TIMER_UNLOCK() LOCAL_APP_TIMER_UNLOCK() +#define APP_TIMER_LOCK() _LOCAL_APP_TIMER_LOCK() +#define APP_TIMER_UNLOCK() _LOCAL_APP_TIMER_UNLOCK() -static inline uint32_t APP_TIMER_MS_TO_US(uint32_t x) +/** @brief app timer clock and some time conversion formula definitions */ +#define APP_TIMER_CLK_FREQ_HZ (hal_sleep_timer_get_clock_freq()) +#define APP_TIMER_MS_TO_US(x) ((x) * 1000UL) +//#define APP_TIMER_US_TO_TICKS(x) ((((uint64_t)(x) * APP_TIMER_CLK_FREQ_HZ) + (999999)) / 1000000) +#define APP_TIMER_US_TO_TICKS(x) (((double)(x) * APP_TIMER_CLK_FREQ_HZ / 1000000.0) + 0.5) +#define APP_TIMER_TICKS_TO_US(x) ((uint64_t)(x) * 1000000.0f / APP_TIMER_CLK_FREQ_HZ) + +/** @brief app timer status return definitions */ +#define APP_TIMER_RET_SUC (1) +#define APP_TIMER_RET_FAIL (0) + +/** @brief app timer work parameter definitions */ +#define APP_TIMER_INTERNAL_TIMEOUT (1000) +#define APP_TIMER_DELAY_MS_MIN (1) +#define APP_TIMER_DELAY_MS_MAX (36 * 3600 * 1000) +#define APP_TIMER_DELAY_US_MAX ((uint64_t)APP_TIMER_DELAY_MS_MAX * 1000) +#define APP_TIMER_TRIGGER_WINDOW_US (0) + +#define FALL_WITHIN_TRIGGER_WINDOW(x) (((x) - s_app_timer_info.apptimer_total_us) <= s_app_timer_info.apptimer_trigger_window_us) +#define WITHIN_TRIGGER_WINDOW_MARK(x) (x->timer_mark = true) +#define WITHIN_TRIGGER_WINDOW_CLEAR(x) (x->timer_mark = false) +#define IS_TRIGGER_WINDOW_MARKED(x) (x->timer_mark == true) + +/** @brief App timer global state variable. */ +typedef struct app_timer_struct { - return x * 1000UL; -} + uint32_t cnt_node; + app_timer_t *p_curr_timer_node; + app_timer_t *p_within_window_one_shot_node_hd; + uint64_t apptimer_total_us; + uint64_t apptimer_trigger_window_us; + app_timer_t hd_node; +}app_timer_info_t; -static inline float APP_TIMER_TICKS_TO_US(uint32_t x) +/** @brief App timer node state variable. */ +typedef enum { - float ret = ((x) * 1000000.0f / sys_lpclk_get()); - return ret; -} + NOT_INIT = 0xFF, + STOP = 0x00, + RUN = 0x01, +}app_timer_node_statu_t; -static inline void APP_TIMER_GET_CURRENT_TICKS(uint32_t x) +/** @brief App timer global list, all newly added timer nodes will be added to the queue. */ +static app_timer_info_t s_app_timer_info = { - hal_pwr_get_timer_current_value(PWR_TIMER_TYPE_SLP_TIMER, x); -} - -/**@brief App timer global state variable. */ -typedef struct app_timer_struct { - uint8_t apptimer_start; - uint8_t apptimer_in_int; - app_timer_t *p_curr_timer_node; - int apptimer_runout_time; - uint32_t apptimer_total_ticks; - uint32_t apptimer_total_ticks_us; -} app_timer_info_t; - - -/**@brief App timer state types. */ -enum { - APP_TIMER_STOP = 0, - APP_TIMER_START, + .cnt_node = 0, + .p_curr_timer_node = NULL, + .p_within_window_one_shot_node_hd = NULL, + .apptimer_total_us = 0, + .apptimer_trigger_window_us = APP_TIMER_TRIGGER_WINDOW_US, }; -/**@brief App timer state types. */ -enum { - TIMER_NODE_FREE = 0, - TIMER_NODE_USED, -}; - -/**@brief App timer state types. */ -enum { - APP_TIMER_NODE_START = 0xaa, - APP_TIMER_NODE_STOP, -}; - -/**@brief Aon-timer global list, all newly added timer nodes will be added to the queue. */ -static app_timer_t s_timer_node[TIMER_NODE_CNT]; -static app_timer_info_t s_app_timer_info; - /* - * LOCAL VARIABLE DEFINITIONS + * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -app_timer_t* get_next_timer(void) +static void sleep_timer_handler_register(void); +static void low_level_timer_startup(uint64_t value); +static void low_level_timer_stop(void); +static uint64_t low_level_timer_rest_get(void); +static uint8_t app_timer_running_queue_insert(app_timer_id_t *p_timer_id); +static app_timer_id_t* app_timer_running_queue_remove(app_timer_id_t *p_timer_id); +static uint8_t app_timer_running_queue_trigger_window_mark(void); +static uint8_t app_timer_running_queue_trigger_window_execute(void); +static void app_timer_node_init(app_timer_id_t *p_timer_id, uint64_t delay, void *p_ctx, uint64_t insert_time); +static uint8_t is_need_insert_front(uint64_t delay_value, uint64_t rest_time); +static uint8_t is_timer_node_created(app_timer_id_t *p_timer_id); + + +/** + **************************************************************************************** + * @brief sleep timer Interrupt Handler + * @retval none + **************************************************************************************** + */ +void SLPTIMER_IRQHandler(void) { - int min_handle = TIMER_INVALID_NODE_NUMBER; - uint32_t min_value = (uint32_t)0xFFFFFFFF; - - for (int idx = 0; idx < TIMER_NODE_CNT; idx++) { - if (s_timer_node[idx].original_delay && (s_timer_node[idx].timer_node_status == APP_TIMER_NODE_START)) { - if ((s_timer_node[idx].next_trigger_time - s_app_timer_info.apptimer_total_ticks) < min_value) { - min_value = s_timer_node[idx].next_trigger_time - s_app_timer_info.apptimer_total_ticks; - min_handle = idx; - } else if (s_timer_node[idx].next_trigger_time < s_app_timer_info.apptimer_total_ticks) { - s_timer_node[idx].next_trigger_time = s_app_timer_info.apptimer_total_ticks; - min_value = 0; - min_handle = idx; - } - - if (min_value == 0) { - return &s_timer_node[min_handle]; - } - } - } - - if (min_handle == TIMER_INVALID_NODE_NUMBER) { - return NULL; - } - - return &s_timer_node[min_handle]; -} - -void clear_total_ticks(void) -{ - if (s_app_timer_info.apptimer_total_ticks >= 0xF0000000) { - for (int idx = 0; idx < TIMER_NODE_CNT; idx++) { - if (s_timer_node[idx].original_delay) { - s_timer_node[idx].next_trigger_time -= s_app_timer_info.apptimer_total_ticks; - } - } - s_app_timer_info.apptimer_total_ticks = 0x0; - } -} - -__STATIC_INLINE void app_timer_drv_stop(void) -{ - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_DISABLE, APP_TIMER_STOP_VALUE); -} - -uint8_t app_timer_get_valid_node(void) -{ - uint8_t idx = 0; - for (idx=0; idxtimeout_handler(p_timer_evt->p_ctx); -} -#endif - -TINY_RAM_SECTION void hal_pwr_sleep_timer_elapsed_callback(void) -{ - APP_TIMER_LOCK(); - - app_timer_t *p_timer_node = s_app_timer_info.p_curr_timer_node; - app_timer_t *p_exe_node = p_timer_node; - s_app_timer_info.apptimer_total_ticks += s_app_timer_info.apptimer_runout_time; - - if (p_timer_node->next_trigger_mode == ATIMER_ONE_SHOT) { - p_timer_node->original_delay = 0x0; - } else if (p_timer_node->next_trigger_mode == ATIMER_REPEAT) { - p_timer_node->next_trigger_time = p_timer_node->original_delay + s_app_timer_info.apptimer_total_ticks; - } - - clear_total_ticks(); - s_app_timer_info.p_curr_timer_node = get_next_timer(); - p_timer_node = s_app_timer_info.p_curr_timer_node; - - if (s_app_timer_info.p_curr_timer_node != NULL) { - s_app_timer_info.apptimer_runout_time = p_timer_node->next_trigger_time-s_app_timer_info.apptimer_total_ticks; - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_SINGLE, - sys_us_2_lpcycles(s_app_timer_info.apptimer_runout_time)); - } else { - s_app_timer_info.apptimer_start = APP_TIMER_STOP; - pwr_mgmt_notify_timer_event(EVENT_APP_TIMER_STOP); - } - - APP_TIMER_UNLOCK(); - if (p_exe_node && (p_exe_node->timer_node_status == APP_TIMER_NODE_START)) { - if (p_exe_node->next_trigger_mode == ATIMER_ONE_SHOT) { - p_exe_node->timer_node_status = APP_TIMER_NODE_STOP; - } -#if APP_TIMER_USE_SCHEDULER - app_timer_evt_t evt; - - evt.timeout_handler = p_exe_node->next_trigger_callback; - evt.p_ctx = p_exe_node->next_trigger_callback_var; - - app_scheduler_evt_put(&evt, sizeof(evt), timeout_handler_scheduled_exec); -#else - p_exe_node->next_trigger_callback(p_exe_node->next_trigger_callback_var); -#endif - } + hal_pwr_sleep_timer_irq_handler(); } /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ -uint8_t app_timer_get_status(void) +void hal_pwr_sleep_timer_elapsed_callback(void) { - return (s_app_timer_info.apptimer_start == APP_TIMER_STOP)?0:1; -} + app_timer_t *p_curr_node = app_timer_running_queue_remove(NULL); -TINY_RAM_SECTION uint32_t app_timer_stop_and_ret(app_timer_id_t p_timer_id) -{ - uint32_t ret = 0; - uint32_t atimer_curr_ticks = 0, atimer_curr_us = 0; - app_timer_t *p_timer_node = p_timer_id; + APP_ASSERT_CHECK(p_curr_node); - if (p_timer_node == NULL) { - return 0; + s_app_timer_info.apptimer_total_us = p_curr_node->next_shot_time; + if (s_app_timer_info.apptimer_total_us >= APP_TIMER_DELAY_US_MAX) + { + app_timer_t *tmp = (app_timer_id_t *)&s_app_timer_info.hd_node; + while (tmp->p_next) + { + if (tmp->p_next->next_shot_time >= s_app_timer_info.apptimer_total_us) + { + tmp->p_next->next_shot_time -= s_app_timer_info.apptimer_total_us; + } + else + { + /* should never come here */ + APP_ASSERT_CHECK(false); + } + tmp = tmp->p_next; + } + + s_app_timer_info.apptimer_total_us = 0; } - hal_pwr_get_timer_current_value(PWR_TIMER_TYPE_SLP_TIMER, &atimer_curr_ticks); + if (p_curr_node->timer_node_mode == ATIMER_REPEAT) + { + p_curr_node->next_shot_time = s_app_timer_info.apptimer_total_us + p_curr_node->original_delay; + app_timer_running_queue_insert(p_curr_node); + } - app_timer_drv_stop(); + app_timer_running_queue_trigger_window_mark(); - atimer_curr_us = (uint32_t)(APP_TIMER_TICKS_TO_US(atimer_curr_ticks)); + if (s_app_timer_info.p_curr_timer_node) + { + APP_ASSERT_CHECK(s_app_timer_info.p_curr_timer_node->next_shot_time >= s_app_timer_info.apptimer_total_us); + low_level_timer_startup(s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us); + } - uint32_t already_ran_time = s_app_timer_info.apptimer_runout_time - atimer_curr_us; + if (p_curr_node->timer_node_cb) + p_curr_node->timer_node_cb(p_curr_node->arg); + else + APP_ASSERT_CHECK(false); - s_app_timer_info.apptimer_total_ticks += already_ran_time; + app_timer_running_queue_trigger_window_execute(); +} - ret = s_app_timer_info.apptimer_runout_time - atimer_curr_us; +sdk_err_t app_timer_start_api(app_timer_id_t *p_timer_id, uint32_t delay, void *p_ctx) +{ + uint8_t trigger_flag = false; + uint64_t insert_time = 0; + uint64_t last_rest_time; - p_timer_node->original_delay = 0x0; - p_timer_node->timer_node_status = APP_TIMER_NODE_STOP; + if ((NULL == p_timer_id) || + (delay > APP_TIMER_DELAY_MS_MAX) || + (delay < APP_TIMER_DELAY_MS_MIN)) + return SDK_ERR_INVALID_PARAM; - s_app_timer_info.apptimer_start = APP_TIMER_STOP; - pwr_mgmt_notify_timer_event(EVENT_APP_TIMER_STOP); - return ret; + APP_TIMER_LOCK(); + + if ((!is_timer_node_created(p_timer_id)) || + (p_timer_id->timer_node_status != STOP)) + { + APP_TIMER_UNLOCK(); + return SDK_ERR_DISALLOWED; + } + + last_rest_time = low_level_timer_rest_get(); + + if (is_need_insert_front(APP_TIMER_MS_TO_US(delay), last_rest_time)) + { + if (s_app_timer_info.p_curr_timer_node) + { + APP_ASSERT_CHECK(last_rest_time <= (s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us)); + s_app_timer_info.apptimer_total_us = s_app_timer_info.p_curr_timer_node->next_shot_time - last_rest_time; + low_level_timer_stop(); + } + else + { + // the node that will be started is the first timer node + s_app_timer_info.apptimer_total_us = 0; + last_rest_time = 0; + } + trigger_flag = true; + insert_time = s_app_timer_info.apptimer_total_us; + } + else + { + APP_ASSERT_CHECK(last_rest_time <= (s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us)); + insert_time = s_app_timer_info.p_curr_timer_node->next_shot_time - last_rest_time; + } + + app_timer_node_init(p_timer_id, delay, p_ctx, insert_time); + app_timer_running_queue_insert(p_timer_id); + + sleep_timer_handler_register(); + if (!NVIC_GetEnableIRQ(SLPTIMER_IRQn)) + { + NVIC_ClearPendingIRQ(SLPTIMER_IRQn); + NVIC_EnableIRQ(SLPTIMER_IRQn); + } + + if (trigger_flag) + { + APP_ASSERT_CHECK(s_app_timer_info.p_curr_timer_node->next_shot_time > s_app_timer_info.apptimer_total_us); + low_level_timer_startup(s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us); + } + + APP_TIMER_UNLOCK(); + + return SDK_SUCCESS; +} + +void app_timer_stop_api(app_timer_id_t *p_timer_id) +{ + uint8_t timer_has_stop = false; + uint64_t last_rest_time = 0; + + if (NULL == p_timer_id) + return; + + APP_TIMER_LOCK(); + if (p_timer_id->timer_node_status == RUN) + { + if (s_app_timer_info.p_curr_timer_node == p_timer_id) + { + last_rest_time = low_level_timer_rest_get(); + APP_ASSERT_CHECK(last_rest_time <= (s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us)); + s_app_timer_info.apptimer_total_us = (p_timer_id->next_shot_time - last_rest_time); + + low_level_timer_stop(); + timer_has_stop = true; + } + + app_timer_running_queue_remove(p_timer_id); + + if (timer_has_stop && s_app_timer_info.p_curr_timer_node) + { + APP_ASSERT_CHECK(s_app_timer_info.p_curr_timer_node->next_shot_time > s_app_timer_info.apptimer_total_us); + low_level_timer_startup(s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us); + } + else if ((!timer_has_stop) && (NULL == s_app_timer_info.p_curr_timer_node)) + { + low_level_timer_stop(); + APP_ASSERT_CHECK(false); + } + } + + APP_TIMER_UNLOCK(); } sdk_err_t app_timer_delete(app_timer_id_t *p_timer_id) { - app_timer_t *p_timer_node = *p_timer_id; - - if (p_timer_node == APP_TIMER_INVALID_ID) { + if (NULL == p_timer_id) return SDK_ERR_INVALID_PARAM; - } - APP_TIMER_LOCK(); + app_timer_stop_api(p_timer_id); + p_timer_id->timer_node_status = NOT_INIT; + p_timer_id->original_delay = 0; + p_timer_id->next_shot_time = 0; + p_timer_id->timer_node_cb = NULL; - p_timer_node->original_delay = 0x0; - p_timer_node->timer_node_status = APP_TIMER_NODE_STOP; - p_timer_node->timer_node_used = TIMER_NODE_FREE; - *p_timer_id = APP_TIMER_INVALID_ID; - - if (s_app_timer_info.p_curr_timer_node == p_timer_node) { - app_timer_drv_stop(); - p_timer_node = get_next_timer(); - if (p_timer_node != NULL) { - s_app_timer_info.apptimer_runout_time = p_timer_node->next_trigger_time- - s_app_timer_info.apptimer_total_ticks; - s_app_timer_info.p_curr_timer_node = p_timer_node; - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_SINGLE, - sys_us_2_lpcycles(s_app_timer_info.apptimer_runout_time)); - } else { - s_app_timer_info.apptimer_start = APP_TIMER_STOP; - s_app_timer_info.p_curr_timer_node = NULL; - pwr_mgmt_notify_timer_event(EVENT_APP_TIMER_STOP); - } - } - APP_TIMER_UNLOCK(); return SDK_SUCCESS; } -void app_timer_stop(app_timer_id_t p_timer_id) +uint8_t app_timer_get_status(void) { + uint8_t status = (uint8_t)STOP; + APP_TIMER_LOCK(); - app_timer_t *p_timer_node = p_timer_id; - uint32_t atimer_curr_ticks = 0, atimer_curr_us = 0; + if (s_app_timer_info.p_curr_timer_node) + status = (uint8_t)RUN; - if (p_timer_node == NULL) { - APP_TIMER_UNLOCK(); - return ; - } - - if (p_timer_node->timer_node_status != APP_TIMER_NODE_START) { - APP_TIMER_UNLOCK(); - return; - } - - p_timer_node->timer_node_status = APP_TIMER_NODE_STOP; - p_timer_node->original_delay = 0x0; - - if (s_app_timer_info.p_curr_timer_node == p_timer_node) { - app_timer_drv_stop(); - APP_TIMER_GET_CURRENT_TICKS(&atimer_curr_ticks); - - atimer_curr_us = (uint32_t)(APP_TIMER_TICKS_TO_US(atimer_curr_ticks)); - - if (atimer_curr_ticks == 0xFFFFFFFF) { - ll_pwr_clear_wakeup_event(LL_PWR_WKUP_EVENT_TIMER); - NVIC_ClearPendingIRQ(SLPTIMER_IRQn); - atimer_curr_ticks = 0; - } - - uint32_t already_ran_time = s_app_timer_info.apptimer_runout_time - atimer_curr_us; - s_app_timer_info.apptimer_total_ticks += already_ran_time; - - p_timer_node = get_next_timer(); - if (p_timer_node != NULL) { - s_app_timer_info.apptimer_runout_time = p_timer_node->next_trigger_time- - s_app_timer_info.apptimer_total_ticks; - s_app_timer_info.p_curr_timer_node = p_timer_node; - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_SINGLE, - sys_us_2_lpcycles(s_app_timer_info.apptimer_runout_time)); - } else { - s_app_timer_info.apptimer_start = APP_TIMER_STOP; - pwr_mgmt_notify_timer_event(EVENT_APP_TIMER_STOP); - } - } APP_TIMER_UNLOCK(); - return ; + + return status; } -TINY_RAM_SECTION sdk_err_t app_timer_start(app_timer_id_t p_timer_id, uint32_t delay, uint8_t *p_ctx) +void app_timer_trigger_window_set(uint64_t window_us) { - app_timer_t *p_timer_node = p_timer_id; - uint32_t delay_time = APP_TIMER_MS_TO_US(delay); - uint32_t atimer_curr_ticks = 0, atimer_curr_us = 0; - bool is_pending_trigger = false; + APP_TIMER_LOCK(); + s_app_timer_info.apptimer_trigger_window_us = window_us; + APP_TIMER_UNLOCK(); +} - if (p_timer_node == NULL) - return SDK_ERR_INVALID_PARAM; - - /* DO NOT SUPPORT NULL TIMER */ - if (delay = TIMER_INVALID_DELAY_VALUE) { - return SDK_ERR_INVALID_PARAM; - } +uint64_t app_timer_trigger_window_get(void) +{ + uint64_t window_us = APP_TIMER_TRIGGER_WINDOW_US; APP_TIMER_LOCK(); - - app_timer_t *p_cur_node = p_timer_node; - - if (p_cur_node->timer_node_status == APP_TIMER_NODE_START) { - APP_TIMER_UNLOCK(); - return SDK_ERR_BUSY; - } - - p_cur_node->next_trigger_callback_var = p_ctx; - p_cur_node->timer_node_status = APP_TIMER_NODE_START; - /*******ther first time to start timer********/ - if (APP_TIMER_STOP == s_app_timer_info.apptimer_start) { - NVIC_ClearPendingIRQ(SLPTIMER_IRQn); - - s_app_timer_info.p_curr_timer_node = p_cur_node; - s_app_timer_info.apptimer_runout_time = delay_time; - s_app_timer_info.apptimer_total_ticks = 0x0; - s_app_timer_info.apptimer_start = APP_TIMER_START; - - p_cur_node->original_delay = delay_time; - p_cur_node->next_trigger_time = delay_time + s_app_timer_info.apptimer_total_ticks; - - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_SINGLE, - sys_us_2_lpcycles(s_app_timer_info.apptimer_runout_time)); - /* - * < NVIC_EnableIRQ(SLPTIMER_IRQn) > - * This function must be placed after initializing the parameters of timer, - * otherwise an unprepared timer interrupt may be triggered ahead of time, leading to hardfault. - */ - NVIC_EnableIRQ(SLPTIMER_IRQn); - } else { - /* - To stop sleep timer counter. if time expired at this time, - the counter of sleep timer will filled with 0xFFFFFFFF. - */ - if (s_app_timer_info.p_curr_timer_node->original_delay >= delay_time) { - app_timer_drv_stop(); - } - - /* To get current counter in sleep timer. */ - APP_TIMER_GET_CURRENT_TICKS(&atimer_curr_ticks); - - /* Current counter transform to u-second. */ - atimer_curr_us = (uint32_t)(APP_TIMER_TICKS_TO_US(atimer_curr_ticks)); - - /* - Because when the sleep timer counts to zero, - the counter value will automatically be 0xFFFFFFFF. - so we need to manually change to 0 and set is_pending_trigger to true. - */ - if (atimer_curr_ticks == 0xFFFFFFFF) { - atimer_curr_us = 0x0; - is_pending_trigger = true; - } - - /* To get the rest of ran time of the current timer node. */ - uint32_t already_ran_time = s_app_timer_info.apptimer_runout_time - atimer_curr_us; - - if (atimer_curr_us > delay_time) { - s_app_timer_info.p_curr_timer_node = p_cur_node; - s_app_timer_info.apptimer_runout_time = delay_time; - } - - p_cur_node->original_delay = delay_time; - - if (s_app_timer_info.p_curr_timer_node->original_delay >= delay_time) { - if (is_pending_trigger == false) { - s_app_timer_info.apptimer_total_ticks += already_ran_time; - p_cur_node->next_trigger_time = delay_time + s_app_timer_info.apptimer_total_ticks; - s_app_timer_info.apptimer_runout_time = s_app_timer_info.p_curr_timer_node->next_trigger_time - - s_app_timer_info.apptimer_total_ticks; - } else { - p_cur_node->next_trigger_time = delay_time + s_app_timer_info.apptimer_total_ticks + already_ran_time; - } - - if ((is_pending_trigger == false)&&(s_app_timer_info.apptimer_runout_time < 0)) { - s_app_timer_info.apptimer_runout_time = 0; - } - if (is_pending_trigger == false) { - hal_pwr_config_timer_wakeup(PWR_SLP_TIMER_MODE_SINGLE, - sys_us_2_lpcycles(s_app_timer_info.apptimer_runout_time)); - } - } else { - p_cur_node->next_trigger_time = delay_time + s_app_timer_info.apptimer_total_ticks + already_ran_time; - } - } - - pwr_mgmt_notify_timer_event(EVENT_APP_TIMER_START); - + window_us = s_app_timer_info.apptimer_trigger_window_us; APP_TIMER_UNLOCK(); - return SDK_SUCCESS; + + return window_us; } sdk_err_t app_timer_create(app_timer_id_t *p_timer_id, app_timer_type_t mode, app_timer_fun_t callback) { - uint8_t handle = TIMER_INVALID_NODE_NUMBER; - - if (callback == NULL) + if (!IS_APP_TIMER_MODE(mode)) return SDK_ERR_INVALID_PARAM; - /* p_timer_id is already in use */ - if (*p_timer_id != NULL) - return SDK_ERR_DISALLOWED; + if ((NULL == p_timer_id) || (NULL == callback)) + { + return SDK_ERR_INVALID_PARAM; + } APP_TIMER_LOCK(); - /* pick up one null item for new timer node */ - handle = app_timer_get_valid_node(); - if (handle == TIMER_INVALID_NODE_NUMBER) { - *p_timer_id = NULL; - APP_TIMER_UNLOCK(); - return SDK_ERR_LIST_FULL; - } - app_timer_set_var(handle, mode, callback); + p_timer_id->timer_node_status = STOP; + p_timer_id->timer_node_mode = mode; + p_timer_id->timer_node_cb = callback; - *p_timer_id = &s_timer_node[handle]; APP_TIMER_UNLOCK(); + return SDK_SUCCESS; } + +/* + * LOCAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +static void sleep_timer_handler_register(void) +{ + static uint8_t handler_registered = false; + + if (!handler_registered) + { + soc_register_nvic(SLPTIMER_IRQn, (uint32_t)SLPTIMER_IRQHandler); + handler_registered = true; + } +} +static void low_level_timer_startup(uint64_t value) +{ + uint32_t timeout = 0; + uint32_t lpcycles = APP_TIMER_US_TO_TICKS(value); + + APP_ASSERT_CHECK(value <= APP_TIMER_DELAY_US_MAX); + + hal_sleep_timer_config_and_start(PWR_SLP_TIMER_MODE_SINGLE, lpcycles); + while (!hal_sleep_timer_status_get()) + { + delay_us(1); + if (timeout++ >= APP_TIMER_INTERNAL_TIMEOUT) + { + APP_ASSERT_CHECK(false); + return; + } + } +} + +static void low_level_timer_stop(void) +{ + uint32_t timeout = 0; + + hal_sleep_timer_stop(); + while (hal_sleep_timer_status_get()) + { + delay_us(1); + if (timeout++ >= APP_TIMER_INTERNAL_TIMEOUT) + { + APP_ASSERT_CHECK(false); + return; + } + } +} + +static uint64_t low_level_timer_rest_get(void) +{ + uint32_t atimer_curr_ticks = hal_sleep_timer_get_current_value(); + uint64_t curr_rest_us = 0; + + if (atimer_curr_ticks == 0xFFFFFFFF) + { + return 0; + } + + curr_rest_us = APP_TIMER_TICKS_TO_US(atimer_curr_ticks); + if (s_app_timer_info.p_curr_timer_node) + { + if (curr_rest_us > (s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us)) + curr_rest_us = s_app_timer_info.p_curr_timer_node->next_shot_time - s_app_timer_info.apptimer_total_us; + } + else + { + curr_rest_us = 0; + } + + return curr_rest_us; +} + +static uint8_t app_timer_running_queue_insert(app_timer_t *p_timer_id) +{ + if (p_timer_id == NULL) + { + return false; + } + + APP_TIMER_LOCK(); + + app_timer_t *tmp = (app_timer_id_t *)&s_app_timer_info.hd_node; + p_timer_id->p_next = NULL; + + while (tmp->p_next) + { + app_timer_t *curr_node = tmp->p_next; + if (curr_node->next_shot_time > p_timer_id->next_shot_time) + { + p_timer_id->p_next = tmp->p_next; + break; + } + tmp = tmp->p_next; + } + + tmp->p_next = p_timer_id; + p_timer_id->timer_node_status = RUN; + + s_app_timer_info.cnt_node++; + s_app_timer_info.p_curr_timer_node = s_app_timer_info.hd_node.p_next; + + APP_TIMER_UNLOCK(); + return true; +} + +static uint8_t app_timer_running_queue_trigger_window_mark(void) +{ + // todo: + // 1, pick timer nodes that fall within the trigger window; + // 2, mark these timers; + // 1), for repeat node, need mark and adjust next_shot_timer; + // 2), for one-shot node, chain up these timers in specify list + + APP_TIMER_LOCK(); + + app_timer_t *p_triggered_node = NULL; + app_timer_t *tmp = &s_app_timer_info.hd_node; + + while (tmp->p_next) + { + if (FALL_WITHIN_TRIGGER_WINDOW(tmp->p_next->next_shot_time)) + { + p_triggered_node = tmp->p_next; + WITHIN_TRIGGER_WINDOW_MARK(p_triggered_node); + + app_timer_running_queue_remove(p_triggered_node); + if (p_triggered_node->timer_node_mode == ATIMER_REPEAT) + { + p_triggered_node->next_shot_time = s_app_timer_info.apptimer_total_us + p_triggered_node->original_delay; + app_timer_running_queue_insert(p_triggered_node); + } + else + { + app_timer_t **pp_trigger_window_one_shot_node_tail = &s_app_timer_info.p_within_window_one_shot_node_hd; + while (*pp_trigger_window_one_shot_node_tail) + { + pp_trigger_window_one_shot_node_tail = &(*pp_trigger_window_one_shot_node_tail)->p_next; + } + p_triggered_node->p_next = NULL; + (*pp_trigger_window_one_shot_node_tail)->p_next = p_triggered_node; + } + } + else + { + break; + } + } + + APP_TIMER_UNLOCK(); + return true; +} + +static uint8_t app_timer_running_queue_trigger_window_execute(void) +{ + // todo: + // 1, check timer node that marked in the app_timer_running_queue_trigger_window_mark(); + // 2, execute the callback; + // 3, clear mark; + + APP_TIMER_LOCK(); + + app_timer_t *p_triggered_node = NULL; + app_timer_t *tmp = &s_app_timer_info.hd_node; + + while (tmp->p_next) + { + if (IS_TRIGGER_WINDOW_MARKED(tmp->p_next)) + { + p_triggered_node = tmp->p_next; + + if (p_triggered_node->timer_node_cb) + p_triggered_node->timer_node_cb(p_triggered_node->arg); + else + APP_ASSERT_CHECK(false); + + WITHIN_TRIGGER_WINDOW_CLEAR(p_triggered_node); + } + + tmp = tmp->p_next; + } + + while (s_app_timer_info.p_within_window_one_shot_node_hd) + { + p_triggered_node = s_app_timer_info.p_within_window_one_shot_node_hd; + if (p_triggered_node->timer_node_cb) + p_triggered_node->timer_node_cb(p_triggered_node->arg); + else + APP_ASSERT_CHECK(false); + + WITHIN_TRIGGER_WINDOW_CLEAR(p_triggered_node); + + s_app_timer_info.p_within_window_one_shot_node_hd = p_triggered_node->p_next; + p_triggered_node->p_next = NULL; + } + + APP_TIMER_UNLOCK(); + return true; +} + +static app_timer_t *app_timer_running_queue_remove(app_timer_id_t *p_timer_id) +{ + app_timer_t *remove_node = NULL; + + APP_TIMER_LOCK(); + + if (NULL != s_app_timer_info.hd_node.p_next) + { + if (NULL == p_timer_id) + { + // the node that will be removed is the first node + remove_node = s_app_timer_info.hd_node.p_next; + + s_app_timer_info.hd_node.p_next = remove_node->p_next; + s_app_timer_info.cnt_node--; + } + else + { + // remove specified node + app_timer_t *tmp = (app_timer_id_t *)&s_app_timer_info.hd_node; + while (tmp->p_next) + { + if (tmp->p_next == p_timer_id) + { + s_app_timer_info.cnt_node--; + tmp->p_next = p_timer_id->p_next; + + remove_node = p_timer_id; + break; + } + tmp = tmp->p_next; + } + } + + if (remove_node) + { + remove_node->p_next = NULL; + remove_node->timer_node_status = STOP; + s_app_timer_info.p_curr_timer_node = s_app_timer_info.hd_node.p_next; + } + } + + APP_TIMER_UNLOCK(); + return remove_node; +} + +static void app_timer_node_init(app_timer_id_t *p_timer_id, uint64_t delay, void *p_ctx, uint64_t insert_time) +{ + p_timer_id->arg = p_ctx; + p_timer_id->original_delay = APP_TIMER_MS_TO_US(delay); + p_timer_id->next_shot_time = insert_time + p_timer_id->original_delay; + p_timer_id->p_next = NULL; +} + +static uint8_t is_need_insert_front(uint64_t delay_value, uint64_t rest_time) +{ + APP_TIMER_LOCK(); + if (s_app_timer_info.p_curr_timer_node == NULL) + { + APP_TIMER_UNLOCK(); + return APP_TIMER_RET_SUC; + } + + APP_ASSERT_CHECK(rest_time <= s_app_timer_info.p_curr_timer_node->original_delay); + { + if (delay_value < rest_time) + { + APP_TIMER_UNLOCK(); + return APP_TIMER_RET_SUC; + } + } + APP_TIMER_UNLOCK(); + return APP_TIMER_RET_FAIL; +} + +static uint8_t is_timer_node_created(app_timer_id_t *p_timer_id) +{ + if (p_timer_id) + { + if ((p_timer_id->timer_node_cb) && + (IS_APP_TIMER_MODE(p_timer_id->timer_node_mode))) + return true; + } + + return false; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.h old mode 100755 new mode 100644 index 99eb6bd..421c8a9 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/app_timer/app_timer.h @@ -38,27 +38,34 @@ #ifndef __APP_TIMER_H__ #define __APP_TIMER_H__ +#include "grx_sys.h" #include #include -#include "gr55xx_sys.h" /** * @defgroup APP_TIMER_MAROC Defines * @{ */ -#ifndef APP_TIMER_USE_SCHEDULER -#define APP_TIMER_USE_SCHEDULER 0 /**< Enable scheduling app_timer events to app_scheduler. */ -#endif +/** @brief For compatibility with previous version. */ +#define app_timer_start(a, b, c) app_timer_start_api(&a, b, c) +#define app_timer_stop(a) app_timer_stop_api(&a) + +/** @brief App timer version difine. */ +#define APP_TIMER_VERSION 0x0200 + +/** @brief App timer assert enable define. */ +#define APP_TIMER_ASSERT_ENABLE 0 /** @} */ /** * @defgroup APP_TIMER_ENUM Enumerations * @{ */ -/**@brief App timer trigger types. */ -typedef enum { - ATIMER_ONE_SHOT = 0x0, /**< The timer will expire only once. */ - ATIMER_REPEAT /**< The timer will restart each time it expires. */ +/** @brief App timer trigger types. */ +typedef enum +{ + ATIMER_ONE_SHOT = 0x0, /**< The timer will expire only once. */ + ATIMER_REPEAT /**< The timer will restart each time it expires. */ } app_timer_type_t; /** @} */ @@ -66,40 +73,36 @@ typedef enum { * @defgroup APP_TIMER_TYPEDEF Typedefs * @{ */ -/**@brief The timer node trigger function. */ -typedef void (*app_timer_fun_t)(uint8_t* p_ctx); +/** @brief The timer node trigger function. */ +typedef void (*app_timer_fun_t)(void* p_ctx); /** @} */ /** * @defgroup APP_TIMER_STRUCT Structures * @{ */ -/**@brief App timer global variable. */ -typedef struct { - uint8_t timer_node_used; /**< Timer node is used or not. */ - uint8_t timer_node_status; /**< Timer node status. */ - uint8_t next_trigger_mode; /**< Next trigger mode. */ - uint32_t original_delay; /**< Original delay (us). */ - uint32_t next_trigger_time; /**< Next trigger time. */ - uint8_t* next_trigger_callback_var; /**< Timer trigger callback argument. */ - app_timer_fun_t next_trigger_callback; /**< Timer trigger callback . */ +/** @brief App timer global variable. */ +typedef struct app_timer_s +{ + uint8_t timer_mark; + uint8_t timer_node_status; /**< Timer node status. */ + uint8_t timer_node_mode; /**< Next trigger mode. */ + uint64_t original_delay; /**< Original delay (us). */ + uint64_t next_shot_time; + void* arg; /**< Timer trigger callback argument. */ + app_timer_fun_t timer_node_cb; /**< Timer trigger callback . */ + struct app_timer_s *p_next; } app_timer_t; -#if APP_TIMER_USE_SCHEDULER -/**@brief Structure passed to app_scheduler. */ -typedef struct { - app_timer_fun_t timeout_handler; /**< Timer timeout handler. */ - void *p_ctx; /**< Pointer to callback argument. */ -} app_timer_evt_t; -#endif /** @} */ /** * @defgroup APP_TIMER_TYPEDEF Typedefs * @{ */ -/**@brief The timer node id. */ -typedef app_timer_t* app_timer_id_t; +/** @brief The timer node id. */ +typedef app_timer_t app_timer_id_t; +typedef app_timer_t* p_app_timer_id_t; /** @} */ /** @@ -131,21 +134,13 @@ typedef app_timer_t* app_timer_id_t; */ sdk_err_t app_timer_create(app_timer_id_t *p_timer_id, app_timer_type_t mode, app_timer_fun_t callback); -/** - ***************************************************************************************** - * @brief Gets the current app timer's switching status - * @return state 0 means stop 1 means open - ***************************************************************************************** - */ -uint8_t app_timer_get_status(void); - /** ***************************************************************************************** * @brief To stop a existed timer in node list * @param[in] p_timer_id: the id of timer node ***************************************************************************************** */ -void app_timer_stop(app_timer_id_t p_timer_id); +void app_timer_stop_api(app_timer_id_t *p_timer_id); /** ***************************************************************************************** @@ -156,7 +151,7 @@ void app_timer_stop(app_timer_id_t p_timer_id); * @param[in] p_ctx : the pointer of context ***************************************************************************************** */ -sdk_err_t app_timer_start(app_timer_id_t p_timer_id, uint32_t delay, uint8_t *p_ctx); +sdk_err_t app_timer_start_api(app_timer_id_t *p_timer_id, uint32_t delay, void *p_ctx); /** ***************************************************************************************** @@ -169,14 +164,52 @@ sdk_err_t app_timer_delete(app_timer_id_t *p_timer_id); /** ***************************************************************************************** - * @brief Stop the currently running timer and return the running time - * - * @param[in] p_timer_handle: Pointer to the timer handle - * - * @return The time that the current timer has run + * @brief Gets the current app timer's switching status + * @return state 0 means stop, 1 means run ***************************************************************************************** */ -uint32_t app_timer_stop_and_ret(app_timer_id_t p_timer_id); +uint8_t app_timer_get_status(void); + +/** + ***************************************************************************************** + * @brief Set the app timer's trigger window, all timer nodes that fall within the window + * will be triggered at the same time. + * @param[in] window_us: new trigger window size, in us + ***************************************************************************************** + */ +void app_timer_trigger_window_set(uint64_t window_us); + +/** + ***************************************************************************************** + * @brief Get the app timer's trigger window, all timer nodes that fall within the window + * will be triggered at the same time. + * @return current trigger window size, in us + ***************************************************************************************** + */ +uint64_t app_timer_trigger_window_get(void); + +#define IS_APP_TIMER_MODE(MODE) \ + (((MODE) == ATIMER_ONE_SHOT) || ((MODE) == ATIMER_REPEAT)) + +#define APP_TIMER_DEFINE(name, func, mode) \ + app_timer_t name = \ + { \ + .timer_node_status = 0x0, \ + .timer_node_mode = mode, \ + .timer_node_cb = func, \ + } + +#define APP_TIMER_QUICK_START(name, func, peido) \ + { \ + app_timer_create(&name, ATIMER_REPEAT, func); \ + app_timer_start_api(&name, peido, &name); \ + } + +#define APP_TIMER_QUICK_STOP(name) \ + { \ + app_timer_stop_api(&name); \ + } + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/BUILD.gn new file mode 100644 index 0000000..b9a83dd --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("at_cmd") { + sources = [ + "at_cmd.c", + "at_cmd_utils.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.c new file mode 100644 index 0000000..60f4ad6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.c @@ -0,0 +1,366 @@ +/** + **************************************************************************************** + * + * @file AT_CMD.c + * + * @brief AT Command implementation. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include "at_cmd.h" +#include "at_cmd_utils.h" +#include "cmsis_compiler.h" +#include + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief AT Command environment variable. */ +struct at_cmd_env_t +{ + uint8_t cmd_num; + at_cmd_src_t cmd_src; + at_cmd_attr_t *p_cmd_attr; + at_cmd_time_callback_t cmd_time_cb; + at_cmd_cplt_callback_t cmd_cplt_cb; + at_cmd_state_t cmd_state; +}; + +/* + * LOCAL VARIABLE DEFINITIONS + **************************************************************************************** + */ +static struct at_cmd_env_t s_at_cmd_env; +static at_cmd_parse_t s_parse_rlt; + +static uint8_t at_cmd_inp_buff[AT_CMD_BUFFER_SIZE_MAX]; +static uint8_t at_cmd_rsp_buff[AT_CMD_BUFFER_SIZE_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + ***************************************************************************************** + * @brief Check AT CMD input integrity. + * + * @param[in] p_data: Pointer to input data. + * @param[in] length: Length of input data. + * @param[out] p_parse_rlt: Pointer to parse result. + * + * @return Result of check. + ***************************************************************************************** + */ +static bool at_cmd_integrity_check(const uint8_t *p_data, uint16_t length, at_cmd_parse_t *p_parse_rlt) +{ + if (0 != memcmp(p_data, "AT:", 3)) + { + return false; + } + for (uint8_t i = 1; i < length; i++) + { + if (0x0a == p_data[i] && 0x0d == p_data[i - 1]) + { + p_parse_rlt->buff_length = i + 1; + memcpy(p_parse_rlt->p_buff, p_data, p_parse_rlt->buff_length); + return true; + } + } + + return false; +} + +/** + ***************************************************************************************** + * @brief Get args of AT CMD. + * + * @param[out] p_parse_rlt: Pointer to parse result. + ***************************************************************************************** + */ +static void at_cmd_args_get(at_cmd_parse_t *p_parse_rlt) +{ + p_parse_rlt->arg_count = 0; + + uint16_t first_arg_idx = 0; + + p_parse_rlt->cmd_tag_idx = 3; + + for (uint16_t i = p_parse_rlt->cmd_tag_idx; i <= (p_parse_rlt->buff_length - 2); i++) + { + if (i == (p_parse_rlt->buff_length - 2)) + { + p_parse_rlt->cmd_tag_length = i - p_parse_rlt->cmd_tag_idx; + p_parse_rlt->arg_count = 0; + return; + } + + if ('=' == p_parse_rlt->p_buff[i]) + { + p_parse_rlt->cmd_tag_length = i - p_parse_rlt->cmd_tag_idx + 1; + first_arg_idx = i + 1; + break; + } + } + + p_parse_rlt->arg_idx[0] = first_arg_idx; + + for (uint16_t i = first_arg_idx; i <= (p_parse_rlt->buff_length - 2); i++) + { + if ((':' == p_parse_rlt->p_buff[i]) || (',' == p_parse_rlt->p_buff[i])) + { + p_parse_rlt->arg_length[p_parse_rlt->arg_count] = i - p_parse_rlt->arg_idx[p_parse_rlt->arg_count]; + p_parse_rlt->arg_count++; + p_parse_rlt->arg_idx[p_parse_rlt->arg_count] = i + 1; + } + else if (i == (p_parse_rlt->buff_length - 2)) + { + p_parse_rlt->arg_length[p_parse_rlt->arg_count] = i - p_parse_rlt->arg_idx[p_parse_rlt->arg_count]; + p_parse_rlt->arg_count++; + } + } +} + +/** + ***************************************************************************************** + * @brief Get ID of AT CMD. + * + * @param[out] p_parse_rlt: Pointer to parse result. + ***************************************************************************************** + */ +static void at_cmd_id_get(at_cmd_parse_t *p_parse_rlt) +{ + p_parse_rlt->cmd_id = AT_CMD_INVALID; + + for (uint8_t i = 0; i < s_at_cmd_env.cmd_num; i++) + { + if (p_parse_rlt->cmd_tag_length == s_at_cmd_env.p_cmd_attr[i].cmd_tag_length) + { + if (0 == memcmp(&p_parse_rlt->p_buff[p_parse_rlt->cmd_tag_idx], + s_at_cmd_env.p_cmd_attr[i].cmd_tag_str, + p_parse_rlt->cmd_tag_length)) + { + p_parse_rlt->cmd_id = s_at_cmd_env.p_cmd_attr[i].cmd_id; + p_parse_rlt->cmd_idx = i; + break; + } + } + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +void at_cmd_init(at_cmd_init_t *p_cmd_init) +{ + memset(&s_at_cmd_env, 0, sizeof(s_at_cmd_env)); + memset(&s_parse_rlt, 0, sizeof(at_cmd_parse_t)); + + s_at_cmd_env.cmd_num = p_cmd_init->cmd_num; + s_at_cmd_env.p_cmd_attr = p_cmd_init->p_cmd_attr; + s_at_cmd_env.cmd_time_cb = p_cmd_init->cmd_time_cb; + s_at_cmd_env.cmd_cplt_cb = p_cmd_init->cmd_cplt_cb; + s_at_cmd_env.cmd_state = AT_CMD_IN_READY_PARSE; + s_at_cmd_env.cmd_src = AT_CMD_SRC_UART; + + s_parse_rlt.p_buff = at_cmd_inp_buff; + s_parse_rlt.buff_length = 0; +} + +void at_cmd_parse(at_cmd_src_t cmd_src, const uint8_t *p_data, uint16_t length) +{ + AT_CMD_RSP_DEF(cmd_rsp); + bool reset = false; + static at_cmd_parse_t pre_parse_rlt; + + s_at_cmd_env.cmd_src = cmd_src; + if (pre_parse_rlt.cmd_id == AT_CMD_CONN_INIT) + { + s_at_cmd_env.cmd_state = AT_CMD_IN_READY_PARSE; + reset = true; + } + + // Check parse cmd is allowed or not + if (AT_CMD_IN_READY_PARSE != s_at_cmd_env.cmd_state) + { + cmd_rsp.error_code = AT_CMD_ERR_PARSE_NOT_ALLOWED; + at_cmd_execute_cplt(&cmd_rsp); + return; + } + else + { + s_at_cmd_env.cmd_state = AT_CMD_IN_PARSING; + } + + // Check cmd input is integrity or not + if (!at_cmd_integrity_check(p_data, length, &s_parse_rlt)) + { + cmd_rsp.error_code = AT_CMD_ERR_INVALID_INPUT; + at_cmd_execute_cplt(&cmd_rsp); + return; + } + + // Get cmd parameters + at_cmd_args_get(&s_parse_rlt); + + // Get cmd Id + at_cmd_id_get(&s_parse_rlt); + + if (reset && s_parse_rlt.cmd_id == AT_CMD_CONN_CANCEL) + { + cmd_rsp.error_code = AT_CMD_ERR_NO_ERROR; + cmd_rsp.length = at_cmd_printf_bush(cmd_rsp.data, "start cancel connect..."); + at_cmd_execute_cplt(&cmd_rsp); + } + + // Check cmd id is valid or not + if (AT_CMD_INVALID == s_parse_rlt.cmd_id) + { + cmd_rsp.error_code = AT_CMD_ERR_UNSUPPORTED_CMD; + at_cmd_execute_cplt(&cmd_rsp); + return; + } + + s_at_cmd_env.cmd_state = AT_CMD_IN_WAITE_EXECUTE; + pre_parse_rlt = s_parse_rlt; +} + +void at_cmd_execute_timing_process(void) +{ + AT_CMD_RSP_DEF(cmd_rsp); + + if (AT_CMD_IN_READY_PARSE != s_at_cmd_env.cmd_state) + { + s_at_cmd_env.cmd_state = AT_CMD_IN_READY_PARSE; + + cmd_rsp.error_code = AT_CMD_ERR_TIMEOUT; + at_cmd_execute_cplt(&cmd_rsp); + } +} + +void at_cmd_execute_cplt(at_cmd_rsp_t *p_cmd_rsp) +{ + uint8_t length = 0; + + if (AT_CMD_ERR_NO_ERROR != p_cmd_rsp->error_code) + { + switch(p_cmd_rsp->error_code) + { + case AT_CMD_ERR_INVALID_INPUT: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Invalid input."); + break; + case AT_CMD_ERR_UNSUPPORTED_CMD: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Unsupported AT CMD."); + break; + case AT_CMD_ERR_PARSE_NOT_ALLOWED: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: No allowed parse state."); + break; + case AT_CMD_ERR_CMD_REQ_ALLOWED: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Command request is not allowed."); + break; + case AT_CMD_ERR_NO_CMD_HANDLER: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: No AT CMD handler."); + break; + case AT_CMD_ERR_INVALID_PARAM: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Invalid parameters."); + break; + case AT_CMD_ERR_HAL_ERROR: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Hal error."); + break; + case AT_CMD_ERR_TIMEOUT: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: AT CMD execute timeout."); + break; + case AT_CMD_ERR_OTHER_ERROR: + length = at_cmd_printf_bush(at_cmd_rsp_buff, "ERR: Other error code."); + break; + default: + break; + } + } + else + { + memcpy(at_cmd_rsp_buff, p_cmd_rsp->data, p_cmd_rsp->length); + length = p_cmd_rsp->length; + } + + at_cmd_rsp_buff[length] = 0x0d; + at_cmd_rsp_buff[length + 1] = 0x0a; + + if (s_at_cmd_env.cmd_cplt_cb) + { + if (AT_CMD_SRC_UART == s_at_cmd_env.cmd_src) + { + s_at_cmd_env.cmd_cplt_cb(AT_CMD_RSP_DEST_UART, at_cmd_rsp_buff, length + 2); + } + else if (AT_CMD_SRC_BLE == s_at_cmd_env.cmd_src) + { + s_at_cmd_env.cmd_cplt_cb(AT_CMD_RSP_DEST_BLE, at_cmd_rsp_buff, length + 2); + } + } + + s_at_cmd_env.cmd_state = AT_CMD_IN_READY_PARSE; + if (AT_CMD_ERR_TIMEOUT == p_cmd_rsp->error_code && + s_at_cmd_env.p_cmd_attr[s_parse_rlt.cmd_idx].cmd_timeout_str) + { + char *cmd_timeout_str = s_at_cmd_env.p_cmd_attr[s_parse_rlt.cmd_idx].cmd_timeout_str; + uint16_t length = strlen(cmd_timeout_str); + at_cmd_parse(s_at_cmd_env.cmd_src, (const uint8_t *)cmd_timeout_str, length); + } +} + +void at_cmd_schedule(void) +{ + if (AT_CMD_IN_WAITE_EXECUTE == s_at_cmd_env.cmd_state) + { + s_at_cmd_env.cmd_state = AT_CMD_IN_EXECUTING; + + if (s_at_cmd_env.p_cmd_attr[s_parse_rlt.cmd_idx].cmd_handler) + { + if (s_at_cmd_env.cmd_time_cb) + { + s_at_cmd_env.cmd_time_cb(); + } + + s_at_cmd_env.p_cmd_attr[s_parse_rlt.cmd_idx].cmd_handler(&s_parse_rlt); + } + else + { + AT_CMD_RSP_DEF(cmd_rsp); + cmd_rsp.error_code = AT_CMD_ERR_NO_CMD_HANDLER; + at_cmd_execute_cplt(&cmd_rsp); + } + } +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.h new file mode 100644 index 0000000..9afb7ea --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd.h @@ -0,0 +1,247 @@ +/** + ***************************************************************************************** + * + * @file AT_CMD.h + * + * @brief AT Command API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __AT_CMD_H_ +#define __AT_CMD_H_ + +#include +#include + + +/** + * @defgroup AT_CMD_MACRO Defines + * @{ + */ +#define AT_CMD_BUFFER_SIZE_MAX 256 /**< Maximum size of AT CMD buffer. */ +#define AT_CMD_ARG_COUNT_MAX 28 /**< Maximum number of arguments input. */ +/** @} */ + +/** + * @defgroup AT_CMD_ENUM Enumerations + * @{ + */ +/**@brief AT CMD state. */ +typedef enum +{ + AT_CMD_IN_READY_PARSE = 0x01, /**< Ready for AT CMD parse state. */ + AT_CMD_IN_PARSING, /**< In parsing AT CMD state. */ + AT_CMD_IN_WAITE_EXECUTE, /**< Waite for executing state. */ + AT_CMD_IN_EXECUTING, /**< In executing state. */ +} at_cmd_state_t; + +/**@brief AT CMD source type. */ +typedef enum +{ + AT_CMD_SRC_INVALID, /**< Invalid AT CMD source. */ + AT_CMD_SRC_UART, /**< AT CMD source: Uart. */ + AT_CMD_SRC_BLE, /**< AT CMD source: BLE. */ +} at_cmd_src_t; + +/**@brief AT CMD response destination type. */ +typedef enum +{ + AT_CMD_RSP_DEST_INVALID, /**< Invalid AT CMD response destination. */ + AT_CMD_RSP_DEST_UART, /**< AT CMD response destination: Uart. */ + AT_CMD_RSP_DEST_BLE, /**< AT CMD response destination: BLE.*/ +} at_cmd_rsp_dest_t; + +/**@brief AT CMD ID type. */ +typedef enum +{ + AT_CMD_INVALID, /**< Invalid AT CMD type. */ + AT_CMD_TEST, /**< Test module AT CMD. */ + AT_CMD_VERSION_GET, /**< Module version get AT CMD. */ + AT_CMD_RESET, /**< System reset. */ + AT_CMD_BAUD_SET, /**< Uart baud rate set AT CMD. */ + AT_CMD_ADDR_GET, /**< Board address get AT CMD. */ + AT_CMD_GAP_ROLE_GET, /**< GAP role get AT CMD. */ + AT_CMD_GAP_ROLE_SET, /**< GAP role set AT CMD. */ + AT_CMD_GAP_NAME_GET, /**< GAP name get AT CMD. */ + AT_CMD_GAP_NAME_SET, /**< GAP name set AT CMD. */ + AT_CMD_ADV_PARAM_SET, /**< Advertising parameters set AT CMD. */ + AT_CMD_ADV_DATA_SET, /**< Advertising data set AT CMD. */ + AT_CMD_RSP_DATA_SET, /**< Scan response data set AT CMD. */ + AT_CMD_ADV_START, /**< Start advertising AT CMD. */ + AT_CMD_ADV_STOP, /**< Stop advertising AT CMD. */ + AT_CMD_SCAN_PARAM_SET, /**< Scan parameters set AT CMD. */ + AT_CMD_SCAN_START, /**< Start scan AT CMD. */ + AT_CMD_SCAN_STOP, /**< Stop scan AT CMD. */ + AT_CMD_CONN_PARAM_SET, /**< Connect parameters set AT CMD. */ + AT_CMD_CONN_INIT, /**< Initiate connection AT CMD. */ + AT_CMD_CONN_CANCEL, /**< Cancel connection AT CMD. */ + AT_CMD_DISCONN, /**< Disconnect AT CMD. */ + AT_CMD_MTU_EXCHANGE, /**< Exchange MTU AT CMD. */ + AT_CMD_SRVC_DISC, /**< Discovery service AT CMD. */ + AT_CMD_CONN_PARAM_UPDATE, /**< Connect parameters update AT CMD. */ + AT_CMD_ATTR_READ, /**< Read attr AT CMD. */ + AT_CMD_ATTR_WRITE, /**< Write attr AT CMD. */ + AT_CMD_NB /**< Number of supported AT CMD. */ +} at_cmd_id_t; + +/**@brief AT CMD error code. */ +typedef enum +{ + AT_CMD_ERR_NO_ERROR, /**< No error. */ + AT_CMD_ERR_INVALID_INPUT, /**< Invalid input. */ + AT_CMD_ERR_UNSUPPORTED_CMD, /**< Unsupported AT CMD. */ + AT_CMD_ERR_PARSE_NOT_ALLOWED, /**< No allowed parse state. */ + AT_CMD_ERR_CMD_REQ_ALLOWED, /**< Command request is not allowed. */ + AT_CMD_ERR_NO_CMD_HANDLER, /**< No AT CMD handler. */ + AT_CMD_ERR_INVALID_PARAM, /**< Invalid parameters. */ + AT_CMD_ERR_HAL_ERROR, /**< Hal error. */ + AT_CMD_ERR_TIMEOUT, /**< AT CMD execute timeout. */ + + AT_CMD_ERR_OTHER_ERROR, /**< Other error code. */ +} at_cmd_error_t; +/** @} */ + +/** + * @defgroup AT_CMD_STRUCT Structures + * @{ + */ +/**@brief AT CMD parse result. */ +typedef struct +{ + at_cmd_id_t cmd_id; /**< AT CMD ID type. */ + uint8_t cmd_idx; /**< AT CMD index in its table. */ + uint8_t cmd_tag_idx; /**< AT CMD tag index. */ + uint8_t cmd_tag_length; /**< Length of AT CMD tag. */ + uint8_t arg_count; /**< Count of arguments. */ + uint8_t arg_idx[AT_CMD_ARG_COUNT_MAX]; /**< Index of arguments. */ + uint8_t arg_length[AT_CMD_ARG_COUNT_MAX]; /**< Length of arguments. */ + uint8_t *p_buff; /**< Pointer to AT CMD buffer. */ + uint16_t buff_length; /**< BUffer valid length. */ +} at_cmd_parse_t; + +/**@brief AT CMD response variables. */ +typedef struct +{ + at_cmd_error_t error_code; /**< Error code. */ + uint8_t data[AT_CMD_BUFFER_SIZE_MAX]; /**< Response data. */ + uint16_t length; /**< Length of response data. */ +} at_cmd_rsp_t; +/** @} */ + +/** + * @defgroup AT_CMD_TYPEDEF Typedefs + * @{ + */ +/**@brief AT CMD handler type. */ +typedef void (*at_cmd_handler_t)(at_cmd_parse_t *p_cmd_parse); + +/**@brief AT CMD execute timing callback type. */ +typedef void (*at_cmd_time_callback_t)(void); + +/**@brief AT CMD execute complete callback type. */ +typedef void (*at_cmd_cplt_callback_t)(at_cmd_rsp_dest_t rsp_dest, const uint8_t *p_data, uint8_t length); +/** @} */ + +/** + * @defgroup AT_CMD_STRUCT Structures + * @{ + */ +/**@brief AT CMD attribute. */ +typedef struct +{ + at_cmd_id_t cmd_id; /**< AT CMD ID type. */ + char *cmd_tag_str; /**< String of AT CMD tag. */ + uint8_t cmd_tag_length; /**< Length of AT CMD tag. */ + at_cmd_handler_t cmd_handler; /**< AT CMD handler. */ + char *cmd_timeout_str; /**< String of timeout AT CMD. */ +} at_cmd_attr_t; + +/**@brief AT CMD initialization variables. */ +typedef struct +{ + at_cmd_attr_t *p_cmd_attr; /**< Pointer to AT CMD attribute table. */ + uint8_t cmd_num; /**< Number of AT CMD register. */ + at_cmd_time_callback_t cmd_time_cb; /**< AT CMD timing callback. */ + at_cmd_cplt_callback_t cmd_cplt_cb; /**< AT CMD execute complete callback. */ +} at_cmd_init_t; +/** @} */ + +/** + * @defgroup AT_CMD_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize AT CMD module. + * + * @param[in] p_cmd_init: Pointer to p_cmd_init. + ***************************************************************************************** + */ +void at_cmd_init(at_cmd_init_t *p_cmd_init); + +/** + ***************************************************************************************** + * @brief Parse user input data. + * + * @param[in] cmd_src: Source of input. + * @param[in] p_data: Pointer to input data. + * @param[in] length: Length of input data. + ***************************************************************************************** + */ +void at_cmd_parse(at_cmd_src_t cmd_src, const uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Process AT CMD execute timing check. + ***************************************************************************************** + */ +void at_cmd_execute_timing_process(void); + +/** + ***************************************************************************************** + * @brief AT CMD execute complete. + * + * @param[in] p_cmd_rsp: Pointer to cmd response. + ***************************************************************************************** + */ +void at_cmd_execute_cplt(at_cmd_rsp_t *p_cmd_rsp); + +/** + ***************************************************************************************** + * @brief AT CMD schedule, called in main(). + ***************************************************************************************** + */ +void at_cmd_schedule(void); +/** @} */ + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.c new file mode 100644 index 0000000..319abcf --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.c @@ -0,0 +1,157 @@ +/** + **************************************************************************************** + * + * @file at_cmd_utils.c + * + * @brief AT Command Utilities implementation. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include "at_cmd_utils.h" +#include +#include +#include + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +uint8_t at_cmd_printf_bush(uint8_t *p_buff, const char *format, ...) +{ + char str_temp[AT_CMD_BUFFER_SIZE_MAX]; + va_list ap; + + va_start(ap, format); + vsprintf(str_temp, format, ap); + va_end(ap); + + memcpy(p_buff, (uint8_t *)str_temp, strlen(str_temp)); + + return (strlen(str_temp)); +} + +bool at_cmd_decimal_num_check(uint8_t *p_data, uint16_t length, uint32_t *p_num) +{ + if (0 == length) + { + return false; + } + + *p_num = 0; + + for (uint8_t i = 0; i < length; i++) + { + if ('0' > p_data[i] || '9' < p_data[i]) + { + return false; + } + else + { + *p_num = (*p_num * 10) + (p_data[i] - '0'); + } + } + + return true; +} + +bool at_cmd_hex_num_check(uint8_t *p_data, uint16_t length, uint32_t *p_num) +{ + if (2 >= length) + { + return false; + } + + *p_num = 0; + if ('0' != p_data[0]||('X' != p_data[1]&&'x' != p_data[1])) + { + return false; + } + for (uint8_t i = 2; i < length; i++) + { + if ('0' <= p_data[i] && '9' >= p_data[i]) + { + *p_num = (*p_num * 16) + (p_data[i] - '0'); + } + else if ('a' <= p_data[i] && 'f' >= p_data[i]) + { + *p_num = (*p_num * 16) + (p_data[i] - 'a' + 10); + } + else if ('A' <= p_data[i] && 'F' >= p_data[i]) + { + *p_num = (*p_num * 16) + (p_data[i] - 'A' + 10); + } + else + { + return false; + } + } + + return true; +} + +at_cmd_error_t at_cmd_hal_err_convert(hal_status_t error_code) +{ + switch (error_code) + { + case HAL_OK: + return AT_CMD_ERR_NO_ERROR; + + case HAL_ERROR: + case HAL_BUSY: + case HAL_TIMEOUT: + return AT_CMD_ERR_HAL_ERROR; + + default: + break; + } + + return AT_CMD_ERR_NO_ERROR; +} + +at_cmd_error_t at_cmd_ble_err_convert(sdk_err_t error_code) +{ + switch (error_code) + { + case BLE_SUCCESS: + return AT_CMD_ERR_NO_ERROR; + + case SDK_ERR_INVALID_PARAM: + case BLE_GAP_ERR_INVALID_PARAM: + return AT_CMD_ERR_INVALID_PARAM; + + default: + return AT_CMD_ERR_OTHER_ERROR; + } +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.h new file mode 100644 index 0000000..d2b2e7b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/at_cmd/at_cmd_utils.h @@ -0,0 +1,128 @@ +/** + ***************************************************************************************** + * + * @file AT_CMD_UTILS.h + * + * @brief AT Command Utilities API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __AT_CMD_UTILS_H__ +#define __AT_CMD_UTILS_H__ + +#include "at_cmd.h" +#include "grx_hal.h" +#include "grx_sys.h" + +/** + * @defgroup AT_CMD_UTILS_MACRO Defines + * @{ + */ +#define ERROR_CHECK(error_code) do \ + { \ + if (0 != error_code) \ + { \ + return error_code; \ + } \ + } while(0) /**< Error check. */ + +#define AT_CMD_RSP_DEF(at_cmd_rsp) at_cmd_rsp_t at_cmd_rsp = \ + { \ + .error_code = AT_CMD_ERR_NO_ERROR, \ + .data = {0}, \ + .length = 0, \ + } /**< Define AT CMD response variable. */ +/** @} */ + +/** + * @defgroup CTS_C_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Prinf string and push to buffer. + * + * @param[in] p_buff: Pointer to buffer. + * + * @result Length of data push to buffer. + ***************************************************************************************** + */ +uint8_t at_cmd_printf_bush(uint8_t *p_buff, const char *format, ...); + +/** + ***************************************************************************************** + * @brief Check decimal number is valid and calculate. + * + * @param[in] p_data: Pointer to data. + * @param[in] length: Length of dta. + * @param[out] p_num: Result of calculate. + + * @result Result of check. + ***************************************************************************************** + */ +bool at_cmd_decimal_num_check(uint8_t *p_data, uint16_t length, uint32_t *p_num); + +/** + ***************************************************************************************** + * @brief Check hexadecimal number is valid and calculate. + * + * @param[in] p_data: Pointer to data. + * @param[in] length: Length of dta. + * @param[out] p_num: Result of calculate. + * + * @result Result of check. + ***************************************************************************************** + */ +bool at_cmd_hex_num_check(uint8_t *p_data, uint16_t length, uint32_t *p_num); + +/** + ***************************************************************************************** + * @brief Convert hal error code to AT CMD error code. + * + * @param[in] error_code: HAL error code. + * + * @result Result of convert. + ***************************************************************************************** + */ +at_cmd_error_t at_cmd_hal_err_convert(hal_status_t error_code); + +/** + ***************************************************************************************** + * @brief Convert ble error code to AT CMD error code. + * + * @param[in] error_code: BLE error code. + * + * @result Result of convert. + ***************************************************************************************** + */ +at_cmd_error_t at_cmd_ble_err_convert(sdk_err_t error_code); +/** @} */ +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/BUILD.gn new file mode 100644 index 0000000..9a80612 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ble_advertising") { + sources = [ "ble_advertising.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.c new file mode 100644 index 0000000..88804bd --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.c @@ -0,0 +1,512 @@ +/** + **************************************************************************************** + * + * @file ble_advertising.c + * + * @brief BLE Advertising Module API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "ble_module_config.h" +#if BLE_ADVERTISING_ENABLE +#include "ble_advertising.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define BLE_ADV_HIGH_DUTY_DIR_DURATION 128 +#define BLE_ADV_INTERVAL_MIN 32 +#define BLE_ADV_DURATION_MAX 18000 + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief BLE Advertising Module environment variable. */ +struct ble_adv_env_t +{ + bool initialized; + bool adv_act_exist; + ble_adv_mode_t cur_adv_mode; + ble_adv_mode_cfg_t adv_mode_cfg; + ble_adv_evt_handler_t evt_handler; + ble_adv_err_handler_t err_handler; + ble_gap_ext_adv_param_t adv_param; + ble_gap_adv_time_param_t adv_time_param; + bool peer_addr_exist; +}; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static struct ble_adv_env_t adv_env; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static ble_adv_mode_t adv_mode_next_get(ble_adv_mode_t adv_mode) +{ + return (ble_adv_mode_t)((adv_mode + 1) % (BLE_ADV_MODE_SLOW + 2)); +} + +static ble_adv_mode_t adv_mode_next_avail_get(ble_adv_mode_cfg_t *p_adv_mode_cfg, ble_adv_mode_t adv_mode) +{ + switch (adv_mode) + { + case BLE_ADV_MODE_DIRECTED_HIGH_DUTY: + if ((p_adv_mode_cfg->adv_directed_high_duty_enabled) && (!p_adv_mode_cfg->adv_extended_enabled) && + adv_env.peer_addr_exist) + { + return BLE_ADV_MODE_DIRECTED_HIGH_DUTY; + } + + case BLE_ADV_MODE_DIRECTED_LOW_DUTY: + if ((p_adv_mode_cfg->adv_directed_low_duty_enabled && adv_env.peer_addr_exist)) + { + return BLE_ADV_MODE_DIRECTED_LOW_DUTY; + } + + case BLE_ADV_MODE_FAST: + if (p_adv_mode_cfg->adv_fast_enabled) + { + return BLE_ADV_MODE_FAST; + } + + case BLE_ADV_MODE_SLOW: + if (p_adv_mode_cfg->adv_slow_enabled) + { + return BLE_ADV_MODE_SLOW; + } + + default: + return BLE_ADV_MODE_IDLE; + } +} + +static sdk_err_t directed_high_duty_adv_param_set(struct ble_adv_env_t *p_adv_env) +{ + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_LEGACY; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_CONNECTABLE_BIT | + BLE_GAP_ADV_PROP_DIRECTED_BIT | + BLE_GAP_ADV_PROP_HDC_BIT; + p_adv_env->adv_param.disc_mode = BLE_GAP_DISC_MODE_NON_DISCOVERABLE; + + p_adv_env->adv_time_param.max_adv_evt = 0; + + p_adv_env->adv_time_param.duration = BLE_ADV_HIGH_DUTY_DIR_DURATION; + + return ble_gap_ext_adv_param_set(0, BLE_GAP_OWN_ADDR_GEN_RSLV, &p_adv_env->adv_param); +} + +static sdk_err_t directed_low_duty_adv_param_set(struct ble_adv_env_t *p_adv_env) +{ + if (p_adv_env->adv_mode_cfg.adv_extended_enabled) + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_EXTENDED; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_DIRECTED_BIT | + BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + else + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_LEGACY; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_DIRECTED_BIT | + BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + p_adv_env->adv_param.prim_cfg.adv_intv_min = p_adv_env->adv_mode_cfg.adv_directed_low_duty_interval; + p_adv_env->adv_param.prim_cfg.adv_intv_max = p_adv_env->adv_mode_cfg.adv_directed_low_duty_interval; + p_adv_env->adv_param.disc_mode = BLE_GAP_DISC_MODE_NON_DISCOVERABLE; + + p_adv_env->adv_time_param.max_adv_evt = 0; + p_adv_env->adv_time_param.duration = p_adv_env->adv_mode_cfg.adv_directed_low_duty_timeout; + return ble_gap_ext_adv_param_set(0, BLE_GAP_OWN_ADDR_GEN_RSLV, &p_adv_env->adv_param); +} + +static sdk_err_t fast_adv_param_set(struct ble_adv_env_t *p_adv_env) +{ + if (p_adv_env->adv_mode_cfg.adv_extended_enabled) + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_EXTENDED; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + else + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_LEGACY; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_SCANNABLE_BIT | + BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + p_adv_env->adv_param.prim_cfg.adv_intv_min = p_adv_env->adv_mode_cfg.adv_fast_interval; + p_adv_env->adv_param.prim_cfg.adv_intv_max = p_adv_env->adv_mode_cfg.adv_fast_interval; + p_adv_env->adv_param.disc_mode = (p_adv_env->adv_param.filter_pol == BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_ANY)? + BLE_GAP_DISC_MODE_GEN_DISCOVERABLE : BLE_GAP_DISC_MODE_NON_DISCOVERABLE; + + p_adv_env->adv_time_param.max_adv_evt = 0; + p_adv_env->adv_time_param.duration = p_adv_env->adv_mode_cfg.adv_fast_timeout; + + return ble_gap_ext_adv_param_set(0, BLE_GAP_OWN_ADDR_STATIC, &p_adv_env->adv_param); +} + +static sdk_err_t slow_adv_param_set(struct ble_adv_env_t *p_adv_env) +{ + if (p_adv_env->adv_mode_cfg.adv_extended_enabled) + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_EXTENDED; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + else + { + p_adv_env->adv_param.type = BLE_GAP_ADV_TYPE_LEGACY; + p_adv_env->adv_param.prop = BLE_GAP_ADV_PROP_SCANNABLE_BIT | + BLE_GAP_ADV_PROP_CONNECTABLE_BIT; + } + p_adv_env->adv_param.prim_cfg.adv_intv_min = p_adv_env->adv_mode_cfg.adv_slow_interval; + p_adv_env->adv_param.prim_cfg.adv_intv_max = p_adv_env->adv_mode_cfg.adv_slow_interval; + p_adv_env->adv_param.disc_mode = (p_adv_env->adv_param.filter_pol == BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_ANY)? + BLE_GAP_DISC_MODE_GEN_DISCOVERABLE : BLE_GAP_DISC_MODE_NON_DISCOVERABLE; + + p_adv_env->adv_time_param.max_adv_evt = 0; + p_adv_env->adv_time_param.duration = p_adv_env->adv_mode_cfg.adv_slow_timeout; + + return ble_gap_ext_adv_param_set(0, BLE_GAP_OWN_ADDR_STATIC, &p_adv_env->adv_param); +} + +static void ble_adv_started(void) +{ + ble_adv_evt_type_t evt = BLE_ADV_EVT_INVALID; + + switch(adv_env.cur_adv_mode) + { + case BLE_ADV_MODE_DIRECTED_HIGH_DUTY: + evt = BLE_ADV_EVT_DIRECTED_HIGH_DUTY; + break; + + case BLE_ADV_MODE_DIRECTED_LOW_DUTY: + evt = BLE_ADV_EVT_DIRECTED_LOW_DUTY; + break; + + case BLE_ADV_MODE_FAST: + evt = BLE_ADV_EVT_FAST; + break; + + case BLE_ADV_MODE_SLOW: + evt = BLE_ADV_EVT_SLOW; + break; + + default: + break; + } + + adv_env.adv_act_exist = true; + + if (adv_env.evt_handler && evt) + { + adv_env.evt_handler(evt); + } +} + +static void ble_advertising_err_on_ble_capture(uint8_t err_code) +{ + if (adv_env.err_handler && err_code) + { + adv_env.err_handler(err_code); + } +} + +static void ble_adv_stopped(uint8_t stop_reason) +{ + sdk_err_t err_code; + + adv_env.adv_act_exist = false; + + if (BLE_GAP_STOPPED_REASON_TIMEOUT == stop_reason) + { + err_code = ble_advertising_start(adv_mode_next_get(adv_env.cur_adv_mode)); + ble_advertising_err_on_ble_capture(err_code); + } + else if (BLE_GAP_STOPPED_REASON_CONN_EST == stop_reason) + { + if (adv_env.adv_mode_cfg.multi_link_enabled && !adv_env.adv_act_exist) + { + ble_advertising_start(BLE_ADV_MODE_DIRECTED_HIGH_DUTY); + } + } +} + +static void ble_adv_disconnected(void) +{ + if (adv_env.adv_mode_cfg.adv_on_disconnect_enabled && !adv_env.adv_act_exist) + { + ble_advertising_start(BLE_ADV_MODE_DIRECTED_HIGH_DUTY); + } +} + +static sdk_err_t adv_init_param_check(ble_adv_init_t *p_adv_init) +{ + if (NULL == p_adv_init) + { + return SDK_ERR_POINTER_NULL; + } + + ble_adv_mode_cfg_t *p_cfg = &p_adv_init->adv_mode_cfg; + + if (p_cfg->adv_directed_low_duty_enabled && + (p_cfg->adv_directed_low_duty_interval < BLE_ADV_INTERVAL_MIN || p_cfg->adv_directed_low_duty_timeout > BLE_ADV_DURATION_MAX)) + { + return SDK_ERR_INVALID_PARAM; + } + + if (p_cfg->adv_fast_enabled && + (p_cfg->adv_fast_interval < BLE_ADV_INTERVAL_MIN || p_cfg->adv_fast_interval > BLE_ADV_DURATION_MAX)) + { + return SDK_ERR_INVALID_PARAM; + } + if (p_cfg->adv_slow_enabled && + (p_cfg->adv_slow_interval < BLE_ADV_INTERVAL_MIN || p_cfg->adv_slow_interval > BLE_ADV_DURATION_MAX)) + { + return SDK_ERR_INVALID_PARAM; + } + + return SDK_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +sdk_err_t ble_advertising_init(ble_adv_init_t *p_adv_init) +{ + sdk_err_t error_code; + + if (adv_env.initialized) + { + return SDK_ERR_DISALLOWED; + } + + error_code = adv_init_param_check(p_adv_init); + RET_VERIFY_SUCCESS(error_code); + + adv_env.cur_adv_mode = BLE_ADV_MODE_IDLE; + adv_env.evt_handler = p_adv_init->evt_handler; + adv_env.err_handler = p_adv_init->err_handler; + + memcpy(&adv_env.adv_mode_cfg, &p_adv_init->adv_mode_cfg, sizeof(ble_adv_mode_cfg_t)); + + error_code = ble_gap_adv_data_set(0, + BLE_GAP_ADV_DATA_TYPE_DATA, + p_adv_init->adv_data.p_data, + p_adv_init->adv_data.length); + + if (p_adv_init->srp_data.p_data && p_adv_init->srp_data.length && !p_adv_init->adv_mode_cfg.adv_extended_enabled) + { + error_code = ble_gap_adv_data_set(0, + BLE_GAP_ADV_DATA_TYPE_SCAN_RSP, + p_adv_init->srp_data.p_data, + p_adv_init->srp_data.length); + RET_VERIFY_SUCCESS(error_code); + } + + RET_VERIFY_SUCCESS(error_code); + + adv_env.initialized = true; + + return error_code; +} + +sdk_err_t ble_advertising_start(ble_adv_mode_t adv_mode) +{ + sdk_err_t error_code; + + if (!adv_env.initialized) + { + return SDK_ERR_DISALLOWED; + } + + adv_env.cur_adv_mode = adv_mode; + + //Set general parameters + adv_env.adv_param.disc_mode = BLE_GAP_DISC_MODE_GEN_DISCOVERABLE; + adv_env.adv_param.max_tx_pwr = 0; + adv_env.adv_param.prim_cfg.chnl_map = BLE_GAP_ADV_CHANNEL_37_38_39; + adv_env.adv_param.filter_pol = BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_ANY; +// adv_env.adv_param.filter_pol = (adv_env.adv_mode_cfg.ble_adv_whitelist_enabled)? +// BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_WLST : BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_ANY; + adv_env.adv_param.prim_cfg.phy = BLE_GAP_PHY_1MBPS_VALUE; + + if (adv_env.adv_mode_cfg.adv_extended_enabled) + { + if (adv_env.adv_mode_cfg.adv_primary_phy) + { + adv_env.adv_param.prim_cfg.phy = adv_env.adv_mode_cfg.adv_primary_phy; + } + + if (adv_env.adv_mode_cfg.adv_secondary_phy) + { + adv_env.adv_param.second_cfg.phy = adv_env.adv_mode_cfg.adv_secondary_phy; + } + else + { + adv_env.adv_param.second_cfg.phy = (ble_gap_le_phy_value_t)BLE_GAP_PHY_LE_1MBPS; + } + } + + if (((adv_env.adv_mode_cfg.adv_directed_high_duty_enabled) && (adv_env.cur_adv_mode == BLE_ADV_MODE_DIRECTED_HIGH_DUTY)) || \ + ((adv_env.adv_mode_cfg.adv_directed_low_duty_enabled) && (adv_env.cur_adv_mode == BLE_ADV_MODE_DIRECTED_HIGH_DUTY)) || \ + ((adv_env.adv_mode_cfg.adv_directed_low_duty_enabled) && (adv_env.cur_adv_mode == BLE_ADV_MODE_DIRECTED_LOW_DUTY))) + { + if (adv_env.evt_handler) + { + adv_env.evt_handler(BLE_ADV_EVT_DIR_ADDR_REQUEST); + } + } + else + { + memset(&adv_env.adv_param.peer_addr, 0, sizeof(ble_gap_bdaddr_t)); + } + + adv_env.cur_adv_mode = adv_mode_next_avail_get(&adv_env.adv_mode_cfg, adv_mode); + + if (adv_env.adv_mode_cfg.adv_extended_enabled) + { + if (adv_env.adv_mode_cfg.adv_primary_phy) + { + adv_env.adv_param.prim_cfg.phy = adv_env.adv_mode_cfg.adv_primary_phy; + } + + if (adv_env.adv_mode_cfg.adv_secondary_phy) + { + adv_env.adv_param.second_cfg.phy = adv_env.adv_mode_cfg.adv_secondary_phy; + } + } + + switch (adv_env.cur_adv_mode) + { + case BLE_ADV_MODE_DIRECTED_HIGH_DUTY: + error_code = directed_high_duty_adv_param_set(&adv_env); + RET_VERIFY_SUCCESS(error_code); + break; + + case BLE_ADV_MODE_DIRECTED_LOW_DUTY: + error_code = directed_low_duty_adv_param_set(&adv_env); + RET_VERIFY_SUCCESS(error_code); + break; + + case BLE_ADV_MODE_FAST: + error_code = fast_adv_param_set(&adv_env); + RET_VERIFY_SUCCESS(error_code); + break; + + case BLE_ADV_MODE_SLOW: + error_code = slow_adv_param_set(&adv_env); + RET_VERIFY_SUCCESS(error_code); + break; + + default: + break; + } + + return ble_gap_adv_start(0, &adv_env.adv_time_param); +} + +sdk_err_t ble_advertising_adv_data_update(const uint8_t *p_adv_data, uint16_t adv_data_len, const uint8_t *p_srsp_data, uint16_t srsp_data_len) +{ + sdk_err_t error_code; + + if ((p_adv_data == NULL) && (p_srsp_data == NULL) && (adv_data_len <= 0) && (srsp_data_len <= 0)) + { + return SDK_ERR_POINTER_NULL; + } + + if (adv_env.initialized == false) + { + return SDK_ERR_DISALLOWED; + } + else + { + if (p_adv_data && adv_data_len) + { + error_code = ble_gap_adv_data_set(0, BLE_GAP_ADV_DATA_TYPE_DATA, p_adv_data, adv_data_len); + RET_VERIFY_SUCCESS(error_code); + } + + if (p_srsp_data && srsp_data_len) + { + error_code = ble_gap_adv_data_set(0, BLE_GAP_ADV_DATA_TYPE_SCAN_RSP, p_srsp_data, srsp_data_len); + RET_VERIFY_SUCCESS(error_code); + } + } + return error_code; +} + +sdk_err_t ble_advertising_dir_addr_fill(ble_gap_bdaddr_t *p_peer_addr) +{ + for (uint8_t i = 0; i < BLE_GAP_ADDR_LEN; i++) + { + if (p_peer_addr->gap_addr.addr[i] != 0) + { + break; + } + return SDK_ERR_INVALID_PARAM; + } + + memcpy(&adv_env.adv_param.peer_addr, p_peer_addr, sizeof(ble_gap_bdaddr_t)); + adv_env.peer_addr_exist = true; + + return SDK_SUCCESS; +} + +void ble_advertising_evt_on_ble_capture(const ble_evt_t *p_evt) +{ + switch (p_evt->evt_id) + { + case BLE_GAPM_EVT_ADV_START: + ble_adv_started(); + break; + + case BLE_GAPM_EVT_ADV_STOP: + ble_adv_stopped(p_evt->evt.gapm_evt.params.adv_stop.reason); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + ble_adv_disconnected(); + break; + + default: + break; + } +} +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.h new file mode 100644 index 0000000..7d10ec3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_advertising/ble_advertising.h @@ -0,0 +1,192 @@ +/** + **************************************************************************************** + * + * @file ble_advertising.h + * + * @brief BLE Advertising Module Header + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __BLE_ADVERTISING_H__ +#define __BLE_ADVERTISING_H__ + +#include "gr_includes.h" + +/** + * @defgroup BLE_ADVERTISING_MAROC Defines + * @{ + */ +#define RET_VERIFY_SUCCESS(RET_CODE) \ +do \ +{ \ + if (RET_CODE != SDK_SUCCESS) \ + { \ + return RET_CODE; \ + } \ +} while(0) +/** @} */ + +/** + * @defgroup BLE_ADVERTISING_ENUM Enumerations + * @{ + */ +/**@brief Advertising mode type. */ +typedef enum +{ + BLE_ADV_MODE_IDLE, /**< No advertising activity. */ + BLE_ADV_MODE_DIRECTED_HIGH_DUTY, /**< High duty directed advertising. */ + BLE_ADV_MODE_DIRECTED_LOW_DUTY, /**< Low duty directed advertising. */ + BLE_ADV_MODE_FAST, /**< Fast advertising mode. */ + BLE_ADV_MODE_SLOW, /**< Slow advertising mode. */ +} ble_adv_mode_t; + +/**@brief Advertising events type. */ +typedef enum +{ + BLE_ADV_EVT_INVALID, /**< Invalid advertising event. */ + BLE_ADV_EVT_DIRECTED_HIGH_DUTY, /**< High duty directed advertising started. */ + BLE_ADV_EVT_DIRECTED_LOW_DUTY, /**< Low duty directed advertising started. */ + BLE_ADV_EVT_FAST, /**< Fast advertising started. */ + BLE_ADV_EVT_SLOW, /**< Slow advertising started. */ + BLE_ADV_EVT_DIR_ADDR_REQUEST, /**< Request peer address for directed advertising. */ +} ble_adv_evt_type_t; +/** @} */ + +/** + * @defgroup BLE_ADVERTISING_TYPEDEF Typedefs + * @{ + */ +/**@brief BLE advertising event handler type. */ +typedef void (*ble_adv_evt_handler_t)(ble_adv_evt_type_t evt); + +/**@brief BLE advertising error handler type. */ +typedef void (*ble_adv_err_handler_t)(uint8_t err_code); +/** @} */ + + +/** + * @defgroup BLE_ADVERTISING_STRUCT Structures + * @{ + */ +/**@brief Data structure. */ +typedef struct +{ + const uint8_t *p_data; /**< Pointer to the data. */ + uint16_t length; /**< Length of the data. */ +} ble_data_t; + +/**@brief Options for the different advertisement modes.*/ +typedef struct +{ + bool multi_link_enabled; /**< Enable or disable multi link. */ + bool adv_on_disconnect_enabled; /**< Enable or disable auto advertising after disconnecting. */ + bool adv_directed_high_duty_enabled; /**< Enable or disable high duty direct advertising mode. */ + bool adv_directed_low_duty_enabled; /**< Enable or disable low duty direct advertising mode. */ + bool adv_fast_enabled; /**< Enable or disable fast advertising mode. */ + bool adv_slow_enabled; /**< Enable or disable slow advertising mode. */ + bool adv_extended_enabled; /**< Enable or disable extended advertising. */ + uint16_t adv_directed_low_duty_interval; /**< Advertising interval for directed advertising. */ + uint16_t adv_directed_low_duty_timeout; /**< Time-out (number of tries) for direct advertising. */ + uint16_t adv_fast_interval; /**< Advertising interval for fast advertising. */ + uint16_t adv_fast_timeout; /**< Time-out (in units of 10ms) for fast advertising. */ + uint16_t adv_slow_interval; /**< Advertising interval for slow advertising. */ + uint16_t adv_slow_timeout; /**< Time-out (in units of 10ms) for slow advertising. */ + ble_gap_le_phy_value_t adv_secondary_phy; /**< PHY for the secondary (extended) advertising. */ + ble_gap_le_phy_value_t adv_primary_phy; /**< PHY for the primary advertising. */ +} ble_adv_mode_cfg_t; + +/**@brief Avertising initialization. */ +typedef struct +{ + ble_data_t adv_data; /**< Advertising data. */ + ble_data_t srp_data; /**< Scan response data. */ + ble_adv_mode_cfg_t adv_mode_cfg; /**< Advertising mode config. */ + ble_adv_evt_handler_t evt_handler; /**< Advertising event handler. */ + ble_adv_err_handler_t err_handler; /**< Advertising error handler. */ +} ble_adv_init_t; +/** @} */ + +/** + * @defgroup BLE_ADVERTISING_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize BLE advertising module. + * + * @param[in] p_adv_init: Pointer to advertising init params. + * + * @return Result of ble advertising initialization. + ***************************************************************************************** + */ +sdk_err_t ble_advertising_init(ble_adv_init_t *p_adv_init); + +/** + ***************************************************************************************** + * @brief Start advertising. + * + * @param[in] adv_mode: Advertising mode. + * + * @return Result of ble advertising start. + ***************************************************************************************** + */ +sdk_err_t ble_advertising_start(ble_adv_mode_t adv_mode); + +/** + ***************************************************************************************** + * @brief Update the advertising data. + * + * @param[in] p_adv_data: Pointer to the new advertising data, or null if advertising data dosen't need to be updated. + * @param[in] adv_data_len: Length of the new advertising data. + * @param[in] p_srsp_data: Pointer to the new scan response data, or null if advertising data dosen't need to be updated. + * @param[in] srsp_data_len: Length of the new scan response data. + * + * @return Result of adv data update. + ***************************************************************************************** + */ +sdk_err_t ble_advertising_adv_data_update(const uint8_t *p_adv_data, uint16_t adv_data_len, const uint8_t *p_srsp_data, uint16_t srsp_data_len); + +/** + ***************************************************************************************** + * @brief Fill direct advertising peer address. + * + * @param[in] p_peer_addr: Pointer to peer address. + * + * @return Result of address check. + ***************************************************************************************** + */ +sdk_err_t ble_advertising_dir_addr_fill(ble_gap_bdaddr_t *p_peer_addr); + +void ble_advertising_evt_on_ble_capture(const ble_evt_t *p_evt); + +/** @} */ + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/BUILD.gn new file mode 100644 index 0000000..98f8083 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ble_connect") { + sources = [ "ble_connect.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.c new file mode 100644 index 0000000..f37718c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.c @@ -0,0 +1,610 @@ +/** + **************************************************************************************** + * + * @file ble_connect.c + * + * @brief BLE Connect Module API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "ble_module_config.h" +#if BLE_CONNECT_ENABLE +#include "ble_connect.h" +#include "app_timer.h" +#include "utility.h" + +/* + * DEFINES + ***************************************************************************************** + */ +/**@brief Gapm config data. */ +#define BLE_CONN_INTERVAL_MIN 0x0006 /**< Minimum value for the connection interval(7.5 ms). */ +#define BLE_CONN_INTERVAL_MAX 0x0C80 /**< Maximum value for the connection interval(4 s). */ +#define BLE_CONN_LATENCY_MAX 0x01F3 /**< Maximum value for the slave latency(499). */ +#define BLE_CONN_TIMEOUT_MIN 0x000A /**< Minimum value for the supervision timeout(100ms s). */ +#define BLE_CONN_TIMEOUT_MAX 0x0C80 /**< Maximum value for the supervision timeout(32 s). */ +#define BLE_TIMER_TIMEOUT_MAX 4000000 /**< Maximum value for the app_timer timeout(4000 s). */ + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief BLE Connect Module environment variable. */ +typedef struct +{ + uint8_t act_conn_idx; + bool conn_param_manage_enable; + ble_conn_link_info_t link_info[BLE_CONN_LINK_CNT_MAX]; + uint32_t first_conn_param_update_delay; + uint32_t next_conn_param_update_delay; + uint8_t max_conn_param_update_count; + bool disconnect_on_fail; + ble_conn_evt_handler_t evt_handler; + ble_conn_err_handler_t err_handler; +} ble_conn_env_t; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static ble_conn_env_t s_conn_env; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool is_conn_param_ok(ble_gap_conn_param_t const * p_preferred_conn_param, + ble_gap_evt_conn_param_updated_t const * p_actual_conn_param, + uint16_t max_slave_latency_err, + uint16_t max_sup_timeout_err) +{ + uint32_t max_allowed_sl = p_preferred_conn_param->slave_latency + max_slave_latency_err; + uint32_t min_allowed_sl = p_preferred_conn_param->slave_latency + - MIN(max_slave_latency_err, p_preferred_conn_param->slave_latency); + uint32_t max_allowed_to = p_preferred_conn_param->sup_timeout + max_sup_timeout_err; + uint32_t min_allowed_to = p_preferred_conn_param->sup_timeout + - MIN(max_sup_timeout_err, p_preferred_conn_param->sup_timeout); + + // Check if interval is within the acceptable range. + // NOTE: Using max_conn_interval in the received event data because this contains + // the client's connection interval. + if ((p_actual_conn_param->conn_interval < p_preferred_conn_param->interval_min) || + (p_actual_conn_param->conn_interval > p_preferred_conn_param->interval_max)) + { + return false; + } + + // Check if slave latency is within the acceptable deviation. + if ((p_actual_conn_param->slave_latency < min_allowed_sl) + || (p_actual_conn_param->slave_latency > max_allowed_sl)) + { + return false; + } + + // Check if supervision timeout is within the acceptable deviation. + if ((p_actual_conn_param->sup_timeout < min_allowed_to) || (p_actual_conn_param->sup_timeout > max_allowed_to)) + { + return false; + } + + return true; +} + +void ble_connect_err_on_ble_capture(uint8_t err_code) +{ + if (s_conn_env.err_handler && err_code) + { + s_conn_env.err_handler(err_code); + } +} + +static bool send_update_request(uint8_t conn_idx, ble_gap_conn_param_t * p_new_conn_param) +{ + sdk_err_t error_code; + + ble_gap_conn_update_param_t conn_update_param; + memcpy(&conn_update_param, p_new_conn_param, sizeof(ble_gap_conn_param_t)); + conn_update_param.ce_len = 0; + + error_code = ble_gap_conn_param_update(conn_idx, &conn_update_param); + if ((error_code != SDK_SUCCESS) && (error_code != SDK_ERR_BUSY)) // SDK_ERR_BUSY means another conn_param_update request is pending. + { + ble_connect_err_on_ble_capture(error_code); + } + + return (error_code == SDK_SUCCESS); +} + +static void update_timeout_handler(void *p_context) +{ + uint32_t conn_idx = (uint32_t)p_context; + + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[conn_idx].conn_state) + { + if (s_conn_env.link_info[conn_idx].param_ok) + { + return; + } + // Check if we have reached the maximum number of attempts + if (s_conn_env.link_info[conn_idx].update_count < s_conn_env.max_conn_param_update_count) + { + bool update_sent = send_update_request(conn_idx, &s_conn_env.link_info[conn_idx].pref_conn_param); + if (update_sent) + { + s_conn_env.link_info[conn_idx].update_count++; + } + } + else + { + s_conn_env.link_info[conn_idx].update_count = 0; + + // Negotiation failed, disconnect automatically if this has been configured + if (s_conn_env.disconnect_on_fail) + { + sdk_err_t error_code; + + error_code = ble_gap_disconnect_with_reason(conn_idx, BLE_GAP_HCI_CONN_INTERVAL_UNACCEPTABLE); + + ble_connect_err_on_ble_capture(error_code); + } + + // Notify the application that the procedure has failed + if (s_conn_env.evt_handler) + { + ble_conn_evt_t conn_evt; + + conn_evt.evt_type = BLE_CONN_EVT_PARAM_NEGO_FAILED; + conn_evt.conn_idx = conn_idx; + + s_conn_env.evt_handler(&conn_evt); + } + } + } +} + +static void conn_param_negotiation(uint8_t conn_idx) +{ + // Start negotiation if the received connection parameters are not acceptable + if (!s_conn_env.link_info[conn_idx].param_ok) + { + sdk_err_t error_code; + uint32_t timeout_ticks; + + if (0 == s_conn_env.link_info[conn_idx].update_count) + { + // First connection parameter update + timeout_ticks = s_conn_env.first_conn_param_update_delay; + } + else + { + timeout_ticks = s_conn_env.next_conn_param_update_delay; + } + + app_timer_stop(s_conn_env.link_info[conn_idx].timer_id); + error_code = app_timer_start(s_conn_env.link_info[conn_idx].timer_id, timeout_ticks, (void *)(uint32_t)conn_idx); + ble_connect_err_on_ble_capture(error_code); + } + else + { + s_conn_env.link_info[conn_idx].update_count = 0; + + // Notify the application that the procedure has succeeded + if (s_conn_env.evt_handler != NULL) + { + ble_conn_evt_t evt; + + evt.evt_type = BLE_CONN_EVT_PARAM_NEGO_SUCCEEDED; + evt.conn_idx = conn_idx; + s_conn_env.evt_handler(&evt); + } + } +} + +static void ble_conn_established(uint8_t conn_idx, const ble_gap_evt_connected_t *p_conn_param) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return; + } + + s_conn_env.link_info[conn_idx].conn_state = BLE_CONN_STATE_CONNECTED; + s_conn_env.link_info[conn_idx].local_role = p_conn_param->ll_role; + s_conn_env.link_info[conn_idx].conn_param.conn_interval = p_conn_param->conn_interval; + s_conn_env.link_info[conn_idx].conn_param.slave_latency = p_conn_param->slave_latency; + s_conn_env.link_info[conn_idx].conn_param.sup_timeout = p_conn_param->sup_timeout; + s_conn_env.link_info[conn_idx].peer_addr.addr_type = p_conn_param->peer_addr_type; + memcpy(&s_conn_env.link_info[conn_idx].peer_addr.gap_addr, &p_conn_param->peer_addr, sizeof(ble_gap_addr_t)); + + + if (BLE_GAP_LL_ROLE_SLAVE == s_conn_env.link_info[conn_idx].local_role) + { + ble_gap_evt_conn_param_updated_t conn_updated_param; + memcpy(&conn_updated_param, &p_conn_param->conn_interval, sizeof(conn_updated_param)); + + s_conn_env.link_info[conn_idx].param_ok = is_conn_param_ok(&s_conn_env.link_info[conn_idx].pref_conn_param, + &conn_updated_param, + BLE_CONN_PARAM_MAX_SLAVE_LATENCY_DEVIATION, + BLE_CONN_PARAM_MAX_SUPERVISION_TIMEOUT_DEVIATION); + + if (s_conn_env.conn_param_manage_enable) + { + conn_param_negotiation(conn_idx); + } + else if (!s_conn_env.link_info[conn_idx].param_ok && s_conn_env.disconnect_on_fail) + { + sdk_err_t error_code; + + error_code = ble_gap_disconnect_with_reason(conn_idx, BLE_GAP_HCI_CONN_INTERVAL_UNACCEPTABLE); + ble_connect_err_on_ble_capture(error_code); + } + } + if (s_conn_env.evt_handler) + { + ble_conn_evt_t conn_evt; + + conn_evt.evt_type = BLE_CONN_EVT_CONNECTED; + conn_evt.conn_idx = conn_idx; + conn_evt.param.p_link_info = &s_conn_env.link_info[conn_idx]; + + s_conn_env.evt_handler(&conn_evt); + } +} + +static void ble_conn_terminated(uint8_t conn_idx, uint8_t reason) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return; + } + + app_timer_id_t timer_id_temp = s_conn_env.link_info[conn_idx].timer_id; + ble_gap_conn_param_t pref_conn_param_temp = s_conn_env.link_info[conn_idx].pref_conn_param; + + memset(&s_conn_env.link_info[conn_idx], 0, sizeof(ble_conn_link_info_t)); + s_conn_env.link_info[conn_idx].timer_id = timer_id_temp; + s_conn_env.link_info[conn_idx].conn_state = BLE_CONN_STATE_DISCONNECTED; + memcpy(&s_conn_env.link_info[conn_idx].pref_conn_param, &pref_conn_param_temp, sizeof(ble_gap_conn_param_t)); + + app_timer_stop(s_conn_env.link_info[conn_idx].timer_id); + + if (conn_idx == s_conn_env.act_conn_idx) + { + s_conn_env.act_conn_idx = BLE_GAP_INVALID_CONN_INDEX; + } + + if (s_conn_env.evt_handler) + { + ble_conn_evt_t conn_evt; + + conn_evt.evt_type = BLE_CONN_EVT_DISCONNECTED; + conn_evt.conn_idx = conn_idx; + conn_evt.param.disconn_reason = reason; + + s_conn_env.evt_handler(&conn_evt); + } +} + +static void ble_conn_param_updated(uint8_t conn_idx, const ble_gap_evt_conn_param_updated_t *p_conn_param_updated_info) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return; + } + + memcpy(&s_conn_env.link_info[conn_idx].conn_param, p_conn_param_updated_info, sizeof(ble_conn_param_t)); + + if (BLE_GAP_LL_ROLE_SLAVE == s_conn_env.link_info[conn_idx].local_role) + { + s_conn_env.link_info[conn_idx].param_ok = is_conn_param_ok(&s_conn_env.link_info[conn_idx].pref_conn_param, + p_conn_param_updated_info, + BLE_CONN_PARAM_MAX_SLAVE_LATENCY_DEVIATION, + BLE_CONN_PARAM_MAX_SUPERVISION_TIMEOUT_DEVIATION); + if (s_conn_env.conn_param_manage_enable) + { + conn_param_negotiation(conn_idx); + } + else if (!s_conn_env.link_info[conn_idx].param_ok && s_conn_env.disconnect_on_fail) + { + sdk_err_t error_code; + + error_code = ble_gap_disconnect_with_reason(conn_idx, BLE_GAP_HCI_CONN_INTERVAL_UNACCEPTABLE); + ble_connect_err_on_ble_capture(error_code); + } + } + + // Interval = 0x4000 means thats connect param update request is rejected by master. + if (s_conn_env.evt_handler && p_conn_param_updated_info->conn_interval != 0x4000) + { + ble_conn_evt_t conn_evt; + + conn_evt.evt_type = BLE_CONN_EVT_PATAM_UPDATED; + conn_evt.conn_idx = conn_idx; + conn_evt.param.p_update_param = (ble_conn_param_t *)p_conn_param_updated_info; + + s_conn_env.evt_handler(&conn_evt); + } +} + +static void ble_conn_link_encrypted(uint8_t conn_idx, uint8_t enc_ind) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return; + } + + s_conn_env.link_info[conn_idx].is_encrypt = true; +} + +static sdk_err_t conn_init_param_check(ble_conn_init_t *p_conn_init) +{ + if (NULL == p_conn_init) + { + return SDK_ERR_POINTER_NULL; + } + if (NULL != p_conn_init->p_conn_param) + { + ble_gap_conn_param_t *p_conn_param = p_conn_init->p_conn_param; + if (p_conn_param->interval_max > BLE_CONN_INTERVAL_MAX || p_conn_param->interval_min < BLE_CONN_INTERVAL_MIN || + p_conn_param->interval_max < p_conn_param->interval_min || p_conn_param->slave_latency > BLE_CONN_LATENCY_MAX || + p_conn_param->sup_timeout > BLE_CONN_TIMEOUT_MAX || p_conn_param->sup_timeout < BLE_CONN_TIMEOUT_MIN) + { + return SDK_ERR_INVALID_PARAM; + } + } + if (p_conn_init->first_conn_param_update_delay > BLE_TIMER_TIMEOUT_MAX || + p_conn_init->next_conn_param_update_delay > BLE_TIMER_TIMEOUT_MAX) + { + return SDK_ERR_INVALID_PARAM; + } + return SDK_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +sdk_err_t ble_connect_init(ble_conn_init_t *p_conn_init) +{ + sdk_err_t error_code; + + error_code = conn_init_param_check(p_conn_init); + RET_VERIFY_SUCCESS(error_code); + + memset(&s_conn_env, 0, sizeof(s_conn_env)); + + s_conn_env.act_conn_idx = BLE_GAP_INVALID_CONN_INDEX; + s_conn_env.conn_param_manage_enable = p_conn_init->conn_param_manage_enable; + if (s_conn_env.conn_param_manage_enable) + { + if (p_conn_init->p_conn_param != NULL) + { + // Set the connection param in stack. + error_code = ble_gap_ppcp_set(p_conn_init->p_conn_param); + RET_VERIFY_SUCCESS(error_code); + } + else + { + // Get the (default) connection param from stack. + error_code = ble_gap_ppcp_get(p_conn_init->p_conn_param); + RET_VERIFY_SUCCESS(error_code); + } + s_conn_env.first_conn_param_update_delay = p_conn_init->first_conn_param_update_delay; + s_conn_env.next_conn_param_update_delay = p_conn_init->next_conn_param_update_delay; + s_conn_env.max_conn_param_update_count = p_conn_init->max_conn_param_update_count; + + for (uint32_t i = 0; i < BLE_CONN_LINK_CNT_MAX; i++) + { + memcpy(&s_conn_env.link_info[i].pref_conn_param, p_conn_init->p_conn_param, sizeof(ble_gap_conn_param_t)); + + error_code = app_timer_create(&s_conn_env.link_info[i].timer_id, ATIMER_ONE_SHOT, + update_timeout_handler); + RET_VERIFY_SUCCESS(error_code); + } + } + + s_conn_env.disconnect_on_fail = p_conn_init->disconnect_on_fail; + s_conn_env.evt_handler = p_conn_init->evt_handler; + s_conn_env.err_handler = p_conn_init->err_handler; + + return SDK_SUCCESS; +} + +uint8_t ble_connect_established_cnt_get(void) +{ + uint8_t count = 0; + + for (uint8_t i = 0; i < BLE_CONN_LINK_CNT_MAX; i++) + { + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[i].conn_state) + { + count++; + } + } + + return count; +} + +bool ble_connect_is_connected(uint8_t conn_idx) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return false; + } + + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[conn_idx].conn_state) + { + return true; + } + + return false; +} + +sdk_err_t ble_connect_link_info_get(uint8_t conn_idx, ble_conn_link_info_t *p_link_info) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX || NULL == p_link_info) + { + return SDK_ERR_INVALID_PARAM; + } + + memcpy(p_link_info, &s_conn_env.link_info[conn_idx], sizeof(ble_conn_link_info_t)); + + return SDK_SUCCESS; +} + +sdk_err_t ble_connect_active_link_set(uint8_t conn_idx) +{ + if (conn_idx >= BLE_CONN_LINK_CNT_MAX || BLE_CONN_STATE_DISCONNECTED == s_conn_env.link_info[conn_idx].conn_state) + { + return SDK_ERR_INVALID_CONN_IDX; + } + + s_conn_env.act_conn_idx = conn_idx; + + return SDK_SUCCESS; +} + +uint8_t ble_connect_active_link_get(void) +{ + return s_conn_env.act_conn_idx; +} + +sdk_err_t ble_connect_all_to_do(ble_conn_all_link_exec_handler_t exec_handler) +{ + if (NULL == exec_handler) + { + return SDK_ERR_POINTER_NULL; + } + + for (uint8_t i = 0; i < BLE_CONN_LINK_CNT_MAX; i++) + { + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[i].conn_state) + { + exec_handler(i); + } + } + + return SDK_SUCCESS; +} + +sdk_err_t ble_connect_next_link_idx_get(uint8_t cur_conn_idx, uint8_t *next_conn_idx) +{ + if (cur_conn_idx >= BLE_CONN_LINK_CNT_MAX || NULL == next_conn_idx || + BLE_CONN_STATE_DISCONNECTED == s_conn_env.link_info[cur_conn_idx].conn_state) + { + *next_conn_idx = BLE_GAP_INVALID_CONN_INDEX; + return SDK_ERR_INVALID_CONN_IDX; + } + + for (uint8_t i = cur_conn_idx + 1; ; i++) + { + if (i == BLE_CONN_LINK_CNT_MAX) + { + i = 0; + } + + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[i].conn_state) + { + *next_conn_idx = i; + return SDK_SUCCESS; + } + } +} + +sdk_err_t ble_connect_param_update_stop(void) +{ + for (uint32_t i = 0; i < BLE_CONN_LINK_CNT_MAX; i++) + { + app_timer_stop(s_conn_env.link_info[i].timer_id); + } + return SDK_SUCCESS; +} + +sdk_err_t ble_connect_param_change(uint8_t conn_idx, ble_gap_conn_param_t *p_new_conn_param) +{ + sdk_err_t error_code = SDK_ERR_INVALID_CONN_IDX; + + if (conn_idx >= BLE_CONN_LINK_CNT_MAX) + { + return SDK_ERR_INVALID_CONN_IDX; + } + + if (p_new_conn_param == NULL) + { + p_new_conn_param = &s_conn_env.link_info[conn_idx].pref_conn_param; + } + + if (BLE_CONN_STATE_CONNECTED == s_conn_env.link_info[conn_idx].conn_state) + { + ble_gap_conn_update_param_t conn_update_param; + memcpy(&conn_update_param, p_new_conn_param, sizeof(ble_gap_conn_param_t)); + conn_update_param.ce_len = 0; + // Send request to master. + error_code = ble_gap_conn_param_update(conn_idx, &conn_update_param); + if (error_code == SDK_SUCCESS) + { + s_conn_env.link_info[conn_idx].param_ok = false; + s_conn_env.link_info[conn_idx].update_count = 1; + s_conn_env.link_info[conn_idx].pref_conn_param = *p_new_conn_param; + } + } + + return error_code; +} + +void ble_connect_evt_on_ble_capture(const ble_evt_t *p_evt) +{ + switch (p_evt->evt_id) + { + case BLE_GAPC_EVT_CONNECTED: + ble_conn_established(p_evt->evt.gapc_evt.index, &(p_evt->evt.gapc_evt.params.connected)); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + ble_conn_terminated(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; + + case BLE_GAPC_EVT_CONN_PARAM_UPDATED: + ble_conn_param_updated(p_evt->evt.gapc_evt.index, &(p_evt->evt.gapc_evt.params.conn_param_updated)); + break; + + case BLE_SEC_EVT_LINK_ENCRYPTED: + ble_conn_link_encrypted(p_evt->evt.gapc_evt.index, p_evt->evt_status); + break; + } +} + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.h new file mode 100644 index 0000000..472bace --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_connect/ble_connect.h @@ -0,0 +1,289 @@ +/** + **************************************************************************************** + * + * @file ble_connect.h + * + * @brief BLE Connect Module Header + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __BLE_CONNECT_H__ +#define __BLE_CONNECT_H__ + +#include "gr_includes.h" +#include "app_timer.h" + + +/** + * @defgroup BLE_CONNECT_MAROC Defines + * @{ + */ +#define RET_VERIFY_SUCCESS(RET_CODE) \ +do \ +{ \ + if (RET_CODE != SDK_SUCCESS) \ + { \ + return RET_CODE; \ + } \ +} while(0) + +#define BLE_CONN_PARAM_MAX_SLAVE_LATENCY_DEVIATION 10 /**< The largest acceptable deviation in slave latency. */ +#define BLE_CONN_PARAM_MAX_SUPERVISION_TIMEOUT_DEVIATION 100 /**< The largest acceptable deviation (in 10 ms units) in supervision timeout. */ + + +#ifdef CFG_MAX_CONNECTIONS + #define BLE_CONN_LINK_CNT_MAX CFG_MAX_CONNECTIONS +#else + #define BLE_CONN_LINK_CNT_MAX 10 +#endif + +/** @} */ + +/** + * @defgroup BLE_CONNECT_ENUM Enumerations + * @{ + */ +/**@brief BLE connect state. */ +typedef enum +{ + BLE_CONN_STATE_DISCONNECTED, /**< BLE link disconnected state. */ + BLE_CONN_STATE_CONNECTED, /**< BLE link connected state. */ +} ble_conn_state_t; + +/**@brief BLE connect events type. */ +typedef enum +{ + BLE_CONN_EVT_INVALID, /**< Invalid connect event. */ + BLE_CONN_EVT_CONNECTED, /**< Connected event. */ + BLE_CONN_EVT_DISCONNECTED, /**< Disconnected event. */ + BLE_CONN_EVT_PATAM_UPDATED, /**< Connect param updated event. */ + BLE_CONN_EVT_PPCP_GET_FAIL, /**< PPCP get fail. */ + BLE_CONN_EVT_PARAM_NEGO_FAILED, /**< Negotiation procedure failed. */ + BLE_CONN_EVT_PARAM_NEGO_SUCCEEDED /**< Negotiation procedure succeeded. */ +} ble_conn_evt_type_t; +/** @} */ + +/** + * @defgroup BLE_CONNECT_TYPEDEF Typedefs + * @{ + */ +/**@brief BLE connect role of LL layer. */ +typedef ble_gap_ll_role_type_t ble_conn_role_t; + +/**@brief BLE connect parameter. */ +typedef ble_gap_evt_conn_param_updated_t ble_conn_param_t; + +/**@brief All connected link need to execute handler type. */ +typedef void (*ble_conn_all_link_exec_handler_t)(uint8_t conn_idx); + +/**@brief BLE connect error handler type. */ +typedef void (*ble_conn_err_handler_t)(uint8_t err_code); +/** @} */ + +/** + * @defgroup BLE_CONNECT_STRUCT Structures + * @{ + */ +/**@brief BLE connect link information. */ +typedef struct +{ + bool is_encrypt; /**< Is encrypt or not. */ + ble_conn_state_t conn_state; /**< BLE connect state. */ + ble_conn_role_t local_role; /**< Local BLE LL role. */ + ble_gap_bdaddr_t peer_addr; /**< Peer address. */ + ble_conn_param_t conn_param; /**< BLE connect parameters. */ + ble_gap_conn_param_t pref_conn_param; /**< BLE prefer connect parameters. */ + uint8_t param_ok; /**< Whether the current connection parameters on this link are acceptable. */ + uint8_t update_count; /**< The number of times the connection parameters have been attempted + negotiated on this link. */ + app_timer_id_t timer_id; /**< Timer id of connect parameter update. */ +} ble_conn_link_info_t; + +/**@brief BLE connect event information. */ +typedef struct +{ + ble_conn_evt_type_t evt_type; + uint8_t conn_idx; + union + { + ble_conn_link_info_t *p_link_info; + uint8_t disconn_reason; + ble_conn_param_t *p_update_param; + } param; +}ble_conn_evt_t; +/** @} */ + +/** + * @defgroup BLE_CONNECT_TYPEDEF Typedefs + * @{ + */ +/**@brief BLE connect event handler type. */ +typedef void (*ble_conn_evt_handler_t)(ble_conn_evt_t *p_evt); +/** @} */ + +/** + * @defgroup BLE_CONNECT_STRUCT Structures + * @{ + */ +/**@brief BLE connect initialization. */ +typedef struct +{ + bool conn_param_manage_enable; /**< Enable or disable connect param auto update. */ + ble_gap_conn_param_t *p_conn_param; /**< Pointer to the connection parameters desired by the application.It will be fetched from host if set to NULL. */ + uint32_t first_conn_param_update_delay; /**< Time from connect to first time ble_gap_conn_param_update is called (in 1 ms). */ + uint32_t next_conn_param_update_delay; /**< Time between each call to ble_gap_conn_param_update after the first (in 1 ms). */ + uint8_t max_conn_param_update_count; /**< Number of attempts before giving up the negotiation. */ + bool disconnect_on_fail; /**< Set to TRUE if a failed connection parameters update shall cause an automatic disconnection. */ + ble_conn_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the Connection. */ + ble_conn_err_handler_t err_handler; /**< Function to be called in case of an error. */ +} ble_conn_init_t; +/** @} */ + + +/** + * @defgroup BLE_CONNECT_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize BLE connect module. + * + * @param[in] p_conn_init: Pointer to initialization params. + * + * @return Result of ble connect initialization. + ***************************************************************************************** + */ +sdk_err_t ble_connect_init(ble_conn_init_t *p_conn_init); + +/** + ***************************************************************************************** + * @brief Get count of established BLE connect link. + * + * @return Count of established ble connect link. + ***************************************************************************************** + */ +uint8_t ble_connect_established_cnt_get(void); + +/** + ***************************************************************************************** + * @brief Check BLE connect link is connected or not. + * + * @param[in] conn_idx: Index of connection. + * + * @return Result of check. + ***************************************************************************************** + */ +bool ble_connect_is_connected(uint8_t conn_idx); + +/** + ***************************************************************************************** + * @brief Get connect link information. + * + * @param[in] conn_idx: Index of connection. + * @param[in\out] p_link_info: Buffer for save information get. + * + * @return Result of get. + ***************************************************************************************** + */ +sdk_err_t ble_connect_link_info_get(uint8_t conn_idx, ble_conn_link_info_t *p_link_info); + +/** + ***************************************************************************************** + * @brief Set active connect link. + * + * @param[in] conn_idx: Index of connection. + * + * @return Result of set. + ***************************************************************************************** + */ +sdk_err_t ble_connect_active_link_set(uint8_t conn_idx); + +/** + ***************************************************************************************** + * @brief Set active connect link. + * + * @param[in] conn_idx: Index of connection. + * + * @return Result of get. + ***************************************************************************************** + */ +uint8_t ble_connect_active_link_get(void); + +/** + ***************************************************************************************** + * @brief All connected link need to execute handler. + * + * @param[in] exec_handler: Execute handler. + * + * @return Result of check. + ***************************************************************************************** + */ +sdk_err_t ble_connect_all_to_do(ble_conn_all_link_exec_handler_t exec_handler); + +/** + ***************************************************************************************** + * @brief Get next connected link index. + * + * @param[in] cur_conn_idx: Index of cur_connection. + * @param[in] next_conn_idx: Pointer to next connected link index. + * + * @return Result of get.. + ***************************************************************************************** + */ +sdk_err_t ble_connect_next_link_idx_get(uint8_t cur_conn_idx, uint8_t *next_conn_idx); + + /** + ***************************************************************************************** + * @brief Function for stopping the Connection Parameters manage module. + + * @return Result of stopping the Connection Parameters module. + ***************************************************************************************** + */ +sdk_err_t ble_connect_param_update_stop(void); + +/** + ***************************************************************************************** + * @brief Initialize parameter update request. + * + * @param[in] conn_idx: Index of connection. + * + * @param[in] p_new_param: Pointer to the new connect parameter. + * + * @return Result of ble advertising initialization. + ***************************************************************************************** + */ +sdk_err_t ble_connect_param_change(uint8_t conn_idx, ble_gap_conn_param_t *p_new_param); + +void ble_connect_evt_on_ble_capture(const ble_evt_t *p_evt); + +/** @} */ + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/BUILD.gn new file mode 100644 index 0000000..fd290d5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ble_gatt_service") { + sources = [ "ble_gatt_service.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.c new file mode 100644 index 0000000..83d92f6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.c @@ -0,0 +1,675 @@ +/** + **************************************************************************************** + * + * @file ble_gatt_service.c + * + * @brief BLE GATT Service Module API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "ble_gatt_service.h" +#include "ble_prf_types.h" +#include "custom_config.h" + + +/* + * DEFINES + ***************************************************************************************** + */ +#define BLE_GATTS_ATT_ELEMENT_SIZE sizeof(attm_desc_128_t) +#define BLE_GATTS_HADNLE_PTR_SIZE sizeof(uint16_t *) +#define BLE_GATTS_INVALID_SERV_IDX 0xff + +#define BLE_GATT_REALLOC_VERIFY(ptr, offset, size) \ +do \ +{ \ + if (NULL == ptr) \ + { \ + return SDK_ERR_NO_RESOURCES; \ + } \ + memset(&ptr[offset], 0, size); \ +} while(0); + +#define BLE_GATT_MALLOC_VERIFY(ptr, size) \ +do \ +{ \ + if (NULL == ptr) \ + { \ + return SDK_ERR_NO_RESOURCES; \ + } \ + memset(ptr, 0, size); \ +} while(0); + +/* + * STRUCTURES + ***************************************************************************************** + */ +typedef struct +{ + uint16_t start_hdl; /**< Start handle. */ + uint16_t end_hdl; /**< End handle. */ + ble_gatts_handler_t handlers; /**< Att handlers. */ +} ble_gatts_serv_info_t; + +typedef struct +{ + + uint8_t inc_serv_num; /**< Number of include services. */ + uint16_t **p_inc_hdl_tab; /**< Pointer to include service handle pointer table. */ + uint16_t **p_att_hdl_tab; /**< Pointer to attributehandle pointer table. */ + attm_desc_128_t *p_db_tab; /**< Pointer to db table. */ + ble_att_uuid_t uuid; /**< Service UUID. */ + uint8_t att_num; /**< Number of attributes. */ +} ble_gatts_db_info_t; + +typedef struct +{ + uint8_t serv_num; + uint16_t start_hdl; + ble_gatts_serv_info_t *p_serv_info; +} ble_gatts_serv_env_t; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static ble_err_t ble_gatts_serv_load(void); +static void ble_gatts_read_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_read_req); +static void ble_gatts_write_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_write_req); +static void ble_gatts_prep_write_cb(uint8_t conn_idx, const gatts_prep_write_req_cb_t *p_prep_write_req); +static void ble_gatts_ntf_ind_cplt_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); +static void ble_gatts_cccd_recovery_cb(uint8_t conidx, uint16_t handle, uint16_t cccd_val); +static void ble_gatts_on_connect_cb(uint8_t conn_idx); +static void ble_gatts_on_disconnect_cb(uint8_t conn_idx, uint8_t reason); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static ble_prf_manager_cbs_t s_mgr_cbs = +{ + ble_gatts_serv_load, + ble_gatts_on_connect_cb, + ble_gatts_on_disconnect_cb +}; + +static gatts_prf_cbs_t s_gatts_cbs = +{ + ble_gatts_read_cb, + ble_gatts_write_cb, + ble_gatts_prep_write_cb, + ble_gatts_ntf_ind_cplt_cb, + ble_gatts_cccd_recovery_cb +}; + +static const prf_server_info_t s_prf_info = +{ + .max_connection_nb = CFG_MAX_CONNECTIONS, + .manager_cbs = &s_mgr_cbs, + .gatts_prf_cbs = &s_gatts_cbs +}; + +static uint8_t s_create_serv_idx; +static uint8_t s_load_serv_idx; +static ble_gatts_db_info_t *s_p_db_info_tab; +static ble_gatts_serv_env_t s_gatts_serv_env; + + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint8_t ble_gatts_serv_indx_find(uint16_t handle) +{ + for (uint8_t i = 0; i < s_gatts_serv_env.serv_num; i++) + { + if (handle >= s_gatts_serv_env.p_serv_info[i].start_hdl && + handle <= s_gatts_serv_env.p_serv_info[i].end_hdl) + { + return i; + } + } + + return BLE_GATTS_INVALID_SERV_IDX; +} + +extern uint8_t fpb_save_state(void); +extern void fpb_load_state(uint8_t state); + +static ble_err_t ble_gatts_serv_load(void) +{ + fpb_load_state(0); + sdk_err_t error_code; + gatts_create_db_t gatts_db; + uint8_t uuid[] = BLE_ATT_16_TO_128_ARRAY(s_p_db_info_tab[s_load_serv_idx].uuid.uuid.uuid16); + + + memset(&gatts_db, 0, sizeof(gatts_create_db_t)); + + s_gatts_serv_env.p_serv_info[s_load_serv_idx].start_hdl = PRF_INVALID_HANDLE; + + if (s_p_db_info_tab[s_load_serv_idx].uuid.type == BLE_ATT_UUID_128) + { + gatts_db.uuid = s_p_db_info_tab[s_load_serv_idx].uuid.uuid.uuid128; + gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); + } + else + { + gatts_db.uuid = uuid; + gatts_db.srvc_perm = 0; + } + + gatts_db.shdl = &s_gatts_serv_env.p_serv_info[s_load_serv_idx].start_hdl; + gatts_db.attr_tab_cfg = NULL; + gatts_db.max_nb_attr = s_p_db_info_tab[s_load_serv_idx].att_num; + gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; + gatts_db.attr_tab.attr_tab_128 = s_p_db_info_tab[s_load_serv_idx].p_db_tab; + gatts_db.inc_srvc_num = s_p_db_info_tab[s_load_serv_idx].inc_serv_num; + + for (uint8_t i = 0; i < gatts_db.inc_srvc_num; i++) + { + gatts_db.inc_srvc_handle[i] = s_p_db_info_tab[s_load_serv_idx].p_inc_hdl_tab[i]; + } + + error_code = ble_gatts_srvc_db_create(&gatts_db); + + if (SDK_SUCCESS == error_code) + { + s_gatts_serv_env.p_serv_info[s_load_serv_idx].end_hdl = s_gatts_serv_env.p_serv_info[s_load_serv_idx].start_hdl + \ + s_p_db_info_tab[s_load_serv_idx].att_num - 1; + } + + for (uint8_t i = 0; i < gatts_db.max_nb_attr; i++) + { + *(s_p_db_info_tab[s_load_serv_idx].p_att_hdl_tab[i]) = *(gatts_db.shdl) + i; + } + + if (s_p_db_info_tab[s_load_serv_idx].p_inc_hdl_tab) + { + BLE_GATT_SERV_FREE(s_p_db_info_tab[s_load_serv_idx].p_inc_hdl_tab); + } + + + BLE_GATT_SERV_FREE(s_p_db_info_tab[s_load_serv_idx].p_att_hdl_tab); + BLE_GATT_SERV_FREE(s_p_db_info_tab[s_load_serv_idx].p_db_tab); + + + s_load_serv_idx++; + + if (s_load_serv_idx == s_gatts_serv_env.serv_num) + { + BLE_GATT_SERV_FREE(s_p_db_info_tab); + } + + fpb_save_state(); + return error_code; +} + +static void ble_gatts_read_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_read_req) +{ + uint8_t sevr_idx = ble_gatts_serv_indx_find(p_read_req->handle); + + if (sevr_idx != BLE_GATTS_INVALID_SERV_IDX && + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.read_req_handler) + { + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.read_req_handler(conn_idx, p_read_req->handle); + } +} + +static void ble_gatts_write_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_write_req) +{ + uint8_t sevr_idx = ble_gatts_serv_indx_find(p_write_req->handle); + + gatts_write_cfm_t cfm; + + cfm.handle = p_write_req->handle; + cfm.status = sevr_idx == BLE_GATTS_INVALID_SERV_IDX ? BLE_ATT_ERR_INVALID_HANDLE : BLE_SUCCESS; + + ble_gatts_write_cfm(conn_idx, &cfm); + + if (sevr_idx != BLE_GATTS_INVALID_SERV_IDX && + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.write_req_handler) + { + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.write_req_handler(conn_idx, + p_write_req->handle, + p_write_req->offset, + p_write_req->value, + p_write_req->length); + } +} + +static void ble_gatts_prep_write_cb(uint8_t conn_idx, const gatts_prep_write_req_cb_t *p_prep_write_req) +{ + uint8_t sevr_idx = ble_gatts_serv_indx_find(p_prep_write_req->handle); + + gatts_prep_write_cfm_t cfm; + + cfm.handle = p_prep_write_req->handle; + cfm.status = sevr_idx == BLE_GATTS_INVALID_SERV_IDX ? BLE_ATT_ERR_INVALID_HANDLE : BLE_SUCCESS; + + ble_gatts_prepare_write_cfm(conn_idx, &cfm); +} + +static void ble_gatts_ntf_ind_cplt_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +{ + uint8_t sevr_idx = ble_gatts_serv_indx_find(p_ntf_ind->handle); + uint16_t h_offset = p_ntf_ind->handle - s_gatts_serv_env.start_hdl; + + if (sevr_idx != BLE_GATTS_INVALID_SERV_IDX && + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.ntf_ind_handler) + { + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.ntf_ind_handler(conn_idx, status, p_ntf_ind->type, h_offset); + } +} + +static void ble_gatts_cccd_recovery_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val) +{ + uint8_t sevr_idx = ble_gatts_serv_indx_find(handle); + + if (sevr_idx != BLE_GATTS_INVALID_SERV_IDX && + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.cccd_recovery_handler) + { + s_gatts_serv_env.p_serv_info[sevr_idx].handlers.cccd_recovery_handler(conn_idx, handle, cccd_val); + } +} + +static void ble_gatts_on_connect_cb(uint8_t conn_idx) +{ + fpb_load_state(0); + + for (uint8_t i = 0; i < s_gatts_serv_env.serv_num; i++) + { + if (s_gatts_serv_env.p_serv_info[i].handlers.on_conn_handler) + { + s_gatts_serv_env.p_serv_info[i].handlers.on_conn_handler(conn_idx); + } + } + fpb_save_state(); +} + +static void ble_gatts_on_disconnect_cb(uint8_t conn_idx, uint8_t reason) +{ + for (uint8_t i = 0; i < s_gatts_serv_env.serv_num; i++) + { + if (s_gatts_serv_env.p_serv_info[i].handlers.on_disconn_handler) + { + s_gatts_serv_env.p_serv_info[i].handlers.on_disconn_handler(conn_idx, reason); + } + } +} + +static void ble_gatts_att_perm_set(uint16_t *p_att_perm, uint16_t prop, ble_att_perm_t perm) +{ + if (NULL == p_att_perm || 0 == prop) + { + return; + } + + *p_att_perm = 0; + + if (prop & BLE_ATT_PROP_BROADCAST) + { + *p_att_perm |= (BROADCAST << 8); + } + + if (prop & BLE_ATT_PROP_READ) + { + *p_att_perm |= (READ << 8 | (((perm) & SEC_LEVEL_MASK) << READ_POS)); + } + + if (prop & BLE_ATT_PROP_WRITE_NO_RESP) + { + *p_att_perm |= (WRITE_CMD << 8 | (((perm) & SEC_LEVEL_MASK) << WRITE_POS)); + } + + if (prop & BLE_ATT_PROP_WRITE) + { + *p_att_perm |= (WRITE_REQ << 8 | (((perm) & SEC_LEVEL_MASK) << WRITE_POS)); + } + + if (prop & BLE_ATT_PROP_NOTIFY) + { + *p_att_perm |= (NOTIFY << 8 | (((perm) & SEC_LEVEL_MASK) << NOTIFY_POS)); + } + + if (prop & BLE_ATT_PROP_INDICATE) + { + *p_att_perm |= (INDICATE << 8 | (((perm) & SEC_LEVEL_MASK) << INDICATE_POS)); + } + + if (prop & BLE_ATT_PROP_WRITE_SIGNED) + { + *p_att_perm |= (WRITE_SIGNED << 8 | (((perm) & SEC_LEVEL_MASK) << WRITE_POS)); + } + + if (prop & BLE_ATT_PROP_EXTENDED) + { + *p_att_perm |= (EXT_PROP << 8); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +sdk_err_t ble_gatts_serv_add(bool is_primary, const ble_att_uuid_t *p_uuid, uint16_t *p_handle) +{ + size_t re_size; + void *mal_ptr; + uint8_t att_idx; + + if (NULL == p_uuid) + { + return SDK_ERR_POINTER_NULL; + } + + // re-malloc s_p_db_info_tab + mal_ptr = s_p_db_info_tab; + re_size = sizeof(ble_gatts_db_info_t) * (s_create_serv_idx + 1); + + s_p_db_info_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab, s_create_serv_idx, sizeof(ble_gatts_db_info_t)); + + // re-malloc s_gatts_serv_env.p_serv_info + mal_ptr = s_gatts_serv_env.p_serv_info; + re_size = sizeof(ble_gatts_serv_info_t) * (s_gatts_serv_env.serv_num + 1); + + s_gatts_serv_env.p_serv_info = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_gatts_serv_env.p_serv_info, s_gatts_serv_env.serv_num, sizeof(ble_gatts_serv_info_t)); + + // malloc att handle ptr table + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab = BLE_GATT_SERV_MALLOC(BLE_GATTS_HADNLE_PTR_SIZE); + BLE_GATT_MALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab, BLE_GATTS_HADNLE_PTR_SIZE); + + att_idx = s_p_db_info_tab[s_create_serv_idx].att_num; + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab[att_idx] = p_handle; + + // re-malloc att table + s_p_db_info_tab[s_create_serv_idx].p_db_tab = BLE_GATT_SERV_MALLOC(BLE_GATTS_ATT_ELEMENT_SIZE); + BLE_GATT_MALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_db_tab, BLE_GATTS_ATT_ELEMENT_SIZE); + + // record service uuid + memcpy(&s_p_db_info_tab[s_create_serv_idx].uuid, p_uuid, sizeof(ble_att_uuid_t)); + + // ->uuid + if (is_primary) + { + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + } + else + { + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_SECONDARY_SERVICE); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + } + // ->perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].perm = READ_PERM_UNSEC; + // ->ext_perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm = 0; + // ->max_size + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].max_size = 0; + + s_gatts_serv_env.serv_num++; + s_p_db_info_tab[s_create_serv_idx].att_num++; + + return SDK_SUCCESS; +} + +sdk_err_t ble_gatts_inc_serv_add(uint16_t *p_handle) +{ + size_t re_size; + void *mal_ptr; + uint8_t inc_serv_idx; + uint8_t att_idx; + + if (NULL == p_handle) + { + return SDK_ERR_POINTER_NULL; + } + + att_idx = s_p_db_info_tab[s_create_serv_idx].att_num; + + // re-malloc att handle ptr table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab; + re_size = BLE_GATTS_HADNLE_PTR_SIZE * (s_p_db_info_tab[s_create_serv_idx].att_num + 1); + + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab, att_idx, BLE_GATTS_HADNLE_PTR_SIZE); + + // re-malloc att table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_db_tab; + re_size = BLE_GATTS_ATT_ELEMENT_SIZE * (att_idx + 1); + + s_p_db_info_tab[s_create_serv_idx].p_db_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_db_tab, att_idx, BLE_GATTS_ATT_ELEMENT_SIZE); + + // ->uuid + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_INCLUDE); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + // ->perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].perm = READ_PERM_UNSEC; + // ->ext_perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm = 0; + // ->max_size + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].max_size = 0; + + inc_serv_idx = s_p_db_info_tab[s_create_serv_idx].inc_serv_num; + + // re-malloc p_inc_hdl_table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_inc_hdl_tab; + re_size = BLE_GATTS_HADNLE_PTR_SIZE * (s_p_db_info_tab[s_create_serv_idx].inc_serv_num + 1); + s_p_db_info_tab[s_create_serv_idx].p_inc_hdl_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_inc_hdl_tab, inc_serv_idx, BLE_GATTS_HADNLE_PTR_SIZE); + + s_p_db_info_tab[s_create_serv_idx].p_inc_hdl_tab = mal_ptr; + s_p_db_info_tab[s_create_serv_idx].p_inc_hdl_tab[inc_serv_idx] = p_handle; + s_p_db_info_tab[s_create_serv_idx].inc_serv_num++; + + s_p_db_info_tab[s_create_serv_idx].att_num++; + + return SDK_SUCCESS; +} + +sdk_err_t ble_gatts_characteristic_add(ble_gatts_att_t *p_att, uint16_t *p_val_handle) +{ + size_t re_size; + void *mal_ptr; + uint8_t att_idx; + + if (NULL == p_att) + { + return SDK_ERR_POINTER_NULL; + } + + att_idx = s_p_db_info_tab[s_create_serv_idx].att_num; + + // re-malloc att handle ptr table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab; + re_size = BLE_GATTS_HADNLE_PTR_SIZE * (s_p_db_info_tab[s_create_serv_idx].att_num + 2); + + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab, att_idx, BLE_GATTS_HADNLE_PTR_SIZE * 2); + + // re-malloc att table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_db_tab; + re_size = BLE_GATTS_ATT_ELEMENT_SIZE * (att_idx + 2); + + s_p_db_info_tab[s_create_serv_idx].p_db_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_db_tab, att_idx, BLE_GATTS_ATT_ELEMENT_SIZE * 2); + + // Character dec + // ->uuid + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_CHARACTERISTIC); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + // ->perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].perm = READ_PERM_UNSEC; + // ->ext_perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm = 0; + // ->max_size + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].max_size = 0; + + s_p_db_info_tab[s_create_serv_idx].att_num++; + att_idx++; + + // Character val + // ->uuid + if (p_att->att_uuid.type == BLE_ATT_UUID_128) + { + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, p_att->att_uuid.uuid.uuid128, 16); + } + else + { + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(p_att->att_uuid.uuid.uuid16); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + } + // ->perm + ble_gatts_att_perm_set(&s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].perm, p_att->att_prop, p_att->att_perm); + // ->ext_perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm = ATT_VAL_LOC_USER; + if (p_att->att_uuid.type == BLE_ATT_UUID_128) + { + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm |= SERVICE_TABLE_TYPE_128; + } + // ->max_size + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].max_size = p_att->max_len; + + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab[att_idx] = p_val_handle; + + s_p_db_info_tab[s_create_serv_idx].att_num++; + + return SDK_SUCCESS; +} + +sdk_err_t ble_gatts_descriptor_add(ble_gatts_att_t *p_att, uint16_t *p_handle) +{ + size_t re_size; + void *mal_ptr; + uint8_t att_idx; + + if (NULL == p_att) + { + return SDK_ERR_POINTER_NULL; + } + + att_idx = s_p_db_info_tab[s_create_serv_idx].att_num; + + // re-malloc att handle ptr table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab; + re_size = BLE_GATTS_HADNLE_PTR_SIZE * (s_p_db_info_tab[s_create_serv_idx].att_num + 1); + + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab, att_idx, BLE_GATTS_HADNLE_PTR_SIZE); + + // re-malloc att table + mal_ptr = s_p_db_info_tab[s_create_serv_idx].p_db_tab; + re_size = BLE_GATTS_ATT_ELEMENT_SIZE * (att_idx + 1); + + s_p_db_info_tab[s_create_serv_idx].p_db_tab = BLE_GATT_SERV_REALLOC(mal_ptr, re_size); + BLE_GATT_REALLOC_VERIFY(s_p_db_info_tab[s_create_serv_idx].p_db_tab, att_idx, BLE_GATTS_ATT_ELEMENT_SIZE); + + // ->uuid + if (p_att->att_uuid.type == BLE_ATT_UUID_128) + { + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, p_att->att_uuid.uuid.uuid128, 16); + } + else + { + uint8_t uuid[16] = BLE_ATT_16_TO_128_ARRAY(p_att->att_uuid.uuid.uuid16); + memcpy(s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].uuid, uuid, 16); + } + + // ->perm + ble_gatts_att_perm_set(&s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].perm, p_att->att_prop, p_att->att_perm); + // ->ext_perm + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm = ATT_VAL_LOC_USER; + if (p_att->att_uuid.type == BLE_ATT_UUID_128) + { + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].ext_perm |= SERVICE_TABLE_TYPE_128; + } + // ->max_size + s_p_db_info_tab[s_create_serv_idx].p_db_tab[att_idx].max_size = p_att->max_len; + + s_p_db_info_tab[s_create_serv_idx].p_att_hdl_tab[att_idx] = p_handle; + + s_p_db_info_tab[s_create_serv_idx].att_num++; + + return SDK_SUCCESS; +} + +sdk_err_t ble_gatts_serv_enable(ble_gatts_handler_t *p_att_handler) +{ + if (NULL == p_att_handler) + { + return SDK_ERR_POINTER_NULL; + } + + memcpy(&s_gatts_serv_env.p_serv_info[s_create_serv_idx].handlers, p_att_handler, sizeof(ble_gatts_handler_t)); + + return ble_server_prf_add(&s_prf_info); +} + +sdk_err_t ble_gatts_att_req_reply(uint8_t conn_idx, ble_gatts_att_req_reply_t *p_att_reply) +{ + if (NULL == p_att_reply) + { + return SDK_ERR_POINTER_NULL; + } + + if (BLE_ATT_READ_REPLY == p_att_reply->type) + { + gatts_read_cfm_t cfm; + + cfm.handle = p_att_reply->param.rd.handle; + cfm.status = p_att_reply->param.rd.status; + cfm.value = p_att_reply->param.rd.p_value; + cfm.length = p_att_reply->param.rd.length; + + return ble_gatts_read_cfm(conn_idx, &cfm); + } + else if (BLE_ATT_WRITE_REPLY == p_att_reply->type) + { + gatts_write_cfm_t cfm; + + cfm.handle = p_att_reply->param.wr.handle; + cfm.status = p_att_reply->param.wr.status; + + return ble_gatts_write_cfm(conn_idx, &cfm); + } + else + { + return SDK_ERR_INVALID_PARAM; + } +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.h new file mode 100644 index 0000000..9fcc45f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_gatt_service/ble_gatt_service.h @@ -0,0 +1,252 @@ +/** + **************************************************************************************** + * + * @file ble_gatt_service.h + * + * @brief BLE GATT Service Module Header + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __BLE_GATT_SERVICE_H__ +#define __BLE_GATT_SERVICE_H__ + +#include "ble.h" +#include "app_memory.h" + +/** + * @defgroup BLE_GATT_SERVICE_MAROC Defines + * @{ + */ +#define BLE_GATT_SERV_MALLOC(size) app_malloc(size) /**< Malloc adaptor. */ +#define BLE_GATT_SERV_FREE(ptr) app_free(ptr) /**< Free adaptor. */ +#define BLE_GATT_SERV_REALLOC(ptr, size) app_realloc(ptr, size) /**< Realloc adaptor. */ +/** @} */ + +/** + * @defgroup BLE_GATT_SERVICE_ENUM Enumerations + * @{ + */ +/**@brief BLE ATT UUID types. */ +typedef enum +{ + BLE_ATT_UUID_16, /**< 16-bit UUID type. */ + BLE_ATT_UUID_128 /**< 128-bit UUID type. */ +} ble_att_uuid_type_t; + +/**@brief BLE ATT properties. */ +typedef enum +{ + BLE_ATT_PROP_BROADCAST = 0x01 << 0, /**< Broadcast. */ + BLE_ATT_PROP_READ = 0x01 << 1, /**< Read. */ + BLE_ATT_PROP_WRITE_NO_RESP = 0x01 << 2, /**< Write CMD. */ + BLE_ATT_PROP_WRITE = 0x01 << 3, /**< Write with response. */ + BLE_ATT_PROP_NOTIFY = 0x01 << 4, /**< Notify. */ + BLE_ATT_PROP_INDICATE = 0x01 << 5, /**< Indicate. */ + BLE_ATT_PROP_WRITE_SIGNED = 0x01 << 6, /**< Signed write. */ + BLE_ATT_PROP_EXTENDED = 0x01 << 7, /**< Extended. */ +} ble_att_prop_t; + +/**@brief BLE ATT permission. */ +typedef enum +{ + BLE_ATT_NOAUTH, /**< No need to be encrypted or authenticated. */ + BLE_ATT_UNAUTH, /**< Need to be encrypted, but not to be authenticated. */ + BLE_ATT_AUTH, /**< Need to be encrypted and authenticated (MITM). */ + BLE_ATT_SEC_CON, /**< Need to be encrypted and authenticated (secure connections). */ +} ble_att_perm_t; + +/**@brief BLE ATT request reply types. */ +typedef enum +{ + BLE_ATT_READ_REPLY, /**< GATTS read reply. */ + BLE_ATT_WRITE_REPLY /**< GATTS write reply. */ +} ble_att_req_reply_type_t; +/** @} */ + +/** + * @defgroup BLE_GATT_SERVICE_TYPEDEF Typedefs + * @{ + */ +/**@brief Read attribute value request handler. */ +typedef void (*ble_gatts_read_req_handler_t)(uint8_t conn_idx, uint16_t handle); + +/**@brief Write attribute value request handler. */ +typedef void (*ble_gatts_write_req_handler_t)(uint8_t conn_idx, uint16_t handle, uint16_t offset, const uint8_t *p_value, uint16_t length); + +/**@brief Notification or indication handler. */ +typedef void (*ble_gatts_ntf_ind_handler_t)(uint8_t conn_idx, uint8_t status, gatt_evt_type_t type, uint16_t h_offset); + +/**@brief CCCD value recovery handler. */ +typedef void (*ble_gatts_cccd_recovery_handler_t)(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val); + +/**@brief Connect handler. */ +typedef void (*ble_gatts_on_connect_handler_t)(uint8_t conn_idx); + +/**@brief Disconnect handler. */ +typedef void (*ble_gatts_on_disconnect_handler_t)(uint8_t conn_idx, uint8_t reason); + +/** @} */ + +/** + * @defgroup BLE_GATT_SERVICE_STRUCT Structures + * @{ + */ +/**@brief BLE ATT UUID. */ +typedef struct +{ + ble_att_uuid_type_t type; /**< UUID type. */ + union + { + uint16_t uuid16; /**< 16-bit UUID. */ + uint8_t uuid128[16]; /**< 128-bit UUID. */ + }uuid; /**< UUID. */ +} ble_att_uuid_t; + +/**@brief GATT Attribute. */ +typedef struct +{ + ble_att_uuid_t att_uuid; /**< Pointer to the attribute UUID. */ + uint16_t att_prop; /**< ATT propertie bit map. */ + ble_att_perm_t att_perm; /**< ATT permission. */ + uint16_t max_len; /**< Maximum attribute value length. */ +} ble_gatts_att_t; + +/**@brief GATT Attribute read/write request reply. */ +typedef struct +{ + ble_att_req_reply_type_t type; /**< Reply type. */ + union + { + struct + { + uint16_t handle; /**< Value handle. */ + uint8_t status; /**< Reply status. */ + }wr; /**< Write reply. */ + struct + { + uint16_t handle; /**< Value handle. */ + uint8_t status; /**< Reply status. */ + uint8_t *p_value; /**< Pointer to read value. */ + uint16_t length; /**< Length of read value. */ + }rd; /**< Read reply. */ + }param; /**< Parameter of reply. */ +} ble_gatts_att_req_reply_t; + +/**@brief BLE GATTs callbacks. */ +typedef struct +{ + ble_gatts_read_req_handler_t read_req_handler; /**< Read attribute value request handler. */ + ble_gatts_write_req_handler_t write_req_handler; /**< Write attribute value request handler. */ + ble_gatts_ntf_ind_handler_t ntf_ind_handler; /**< Notification or indication handler. */ + ble_gatts_cccd_recovery_handler_t cccd_recovery_handler; /**< CCCD value recovery handler. */ + ble_gatts_on_connect_handler_t on_conn_handler; + ble_gatts_on_disconnect_handler_t on_disconn_handler; +} ble_gatts_handler_t; +/** @} */ + +/** + * @defgroup BLE_GATT_SERVICE_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Add primary/secondary service. + * + * @param[in] is_primary: Is primary service or not. + * @param[in] p_uuid: Pointer to service UUID. + * @param[out] p_handle: Pointer to service handle(will be allocated async after advertising start). + * + * @return Result of gatt service add. + ***************************************************************************************** + */ +sdk_err_t ble_gatts_serv_add(bool is_primary, const ble_att_uuid_t *p_uuid, uint16_t *p_handle); + +/** + ***************************************************************************************** + * @brief Add included service to GATT service. + * + * @param[in] p_offset: Pointer to the include service handle. + * + * @return Result of include service add. + ***************************************************************************************** + */ +sdk_err_t ble_gatts_inc_serv_add(uint16_t *p_handle); + +/** + ***************************************************************************************** + * @brief Add characteristic to GATT service. + * + * @param[in] p_att: Pointer to att info. + * @param[out] p_handle: Pointer to value handle(will be allocated async after advertising start). + * + * @return Result of gatt characteristic add. + ***************************************************************************************** + */ +sdk_err_t ble_gatts_characteristic_add(ble_gatts_att_t *p_att, uint16_t *p_val_handle); + +/** + ***************************************************************************************** + * @brief Add descriptor to GATT service. + * + * @param[in] p_att: Pointer to att info. + * @param[out] p_handle: Pointer to descriptor handle(will be allocated async after advertising start). + * + * @return Result of gatt descriptor add. + ***************************************************************************************** + */ +sdk_err_t ble_gatts_descriptor_add(ble_gatts_att_t *p_att, uint16_t *p_handle); + +/** + ***************************************************************************************** + * @brief Enable service to local DB. + * + * @param[in] p_att_handler: Pointer to attribute request handler. + * + * @return Result of publish. + ***************************************************************************************** + */ +sdk_err_t ble_gatts_serv_enable(ble_gatts_handler_t *p_att_handler); + +/** + **************************************************************************************** + * @brief Reply to an attribute read/write request. + * + * @param[in] conn_idx: Connection index. + * @param[in] p_att_reply: Pointer to att reply. + * + * @return Result of reply. + **************************************************************************************** + */ +sdk_err_t ble_gatts_att_req_reply(uint8_t conn_idx, ble_gatts_att_req_reply_t *p_att_reply); + +/** @} */ + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/BUILD.gn new file mode 100644 index 0000000..e0b70b4 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ble_scanner") { + sources = [ "ble_scanner.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.c new file mode 100644 index 0000000..c05e3d7 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.c @@ -0,0 +1,518 @@ +/** + ***************************************************************************************** + * + * @file ble_scanner.c + * + * @brief BLE Scanner Module implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* +* INCLUDE FILES +****************************************************************************************** +*/ +#include "ble_scanner.h" + +#if BLE_SCANNER_ENABLE + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief BLE Scanner Module environment variable. */ +struct ble_scanner_env_t +{ + bool connect_auto; + bool is_matched; + ble_gap_scan_param_t scan_param; + ble_gap_init_param_t conn_param; + ble_scanner_evt_handler_t evt_handler; + ble_scanner_err_handler_t err_handler; + bool filter_enable; + uint8_t filter_type; + ble_scanner_filter_mode_t filter_mode; + ble_scanner_filter_data_t target_data; +}; + +/* + * LOCAL VARIABLE DECLARATION + ***************************************************************************************** + */ +static struct ble_scanner_env_t s_scanner_env; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +//static void on_scanner_stoped(void *arg) +static void on_scanner_stoped(const ble_gap_stopped_reason_t reason) +{ + ble_scanner_evt_t event; + uint8_t error_code; + + event.evt_type = BLE_SCANNER_EVT_INVALID; + + if (BLE_GAP_STOPPED_REASON_TIMEOUT == reason) + { + event.evt_type = s_scanner_env.filter_type ? BLE_SCANNER_EVT_FILTER_NO_MATCH : BLE_SCANNER_EVT_TIMEOUT; + } + + if (BLE_GAP_STOPPED_REASON_ON_USER == reason && s_scanner_env.is_matched) + { + s_scanner_env.is_matched = false; + error_code = ble_gap_connect(BLE_GAP_OWN_ADDR_STATIC, &s_scanner_env.conn_param); + if (error_code) + { + ble_scanner_err_on_ble_capture(error_code); + } + } + + if (event.evt_type && s_scanner_env.evt_handler) + { + s_scanner_env.evt_handler(&event); + } +} + +static void on_scanner_connected(uint8_t conn_idx) +{ + ble_scanner_evt_t event; + + event.evt_type = BLE_SCANNER_EVT_CONNECTED; + event.param.conn_idx = conn_idx; + + if (s_scanner_env.evt_handler) + { + s_scanner_env.evt_handler(&event); + } +} + +static void ble_scanner_uuid_encode(const uint8_t *p_uuid_data, uint16_t length, uint8_t uuid_type, ble_scanner_uuid_t *p_uuid_buff) +{ + if (NULL == p_uuid_data || NULL == p_uuid_buff) + { + return; + } + + uint8_t current_offset = 0; + + while (current_offset < length) + { + switch (uuid_type) + { + case UUID_16_BIT_BYTES: + if (p_uuid_buff->uuid_16_bit_count < UUID_16_BIT_NUM_MAX) + { + memcpy(&p_uuid_buff->uuid_16_bit[p_uuid_buff->uuid_16_bit_count++], &p_uuid_data[current_offset], UUID_16_BIT_BYTES); + current_offset += UUID_16_BIT_BYTES; + } + break; + + case UUID_32_BIT_BYTES: + if (p_uuid_buff->uuid_32_bit_count < UUID_32_BIT_NUM_MAX) + { + memcpy(&p_uuid_buff->uuid_16_bit[p_uuid_buff->uuid_32_bit_count++], &p_uuid_data[current_offset], UUID_32_BIT_BYTES); + current_offset += UUID_32_BIT_BYTES; + } + break; + + case UUID_128_BIT_BYTES: + if (p_uuid_buff->uuid_128_bit_count < UUID_128_BIT_NUM_MAX) + { + memcpy(&p_uuid_buff->uuid_128_bit[p_uuid_buff->uuid_128_bit_count++][0], &p_uuid_data[current_offset], UUID_128_BIT_BYTES); + current_offset += UUID_128_BIT_BYTES; + } + break; + + default: + return; + } + } +} + +static void ble_scanner_parse_record(uint8_t ad_type, const uint8_t *p_data, uint16_t length, ble_scanner_parse_rec_t *p_parse_rec) +{ + uint8_t rec_idx = p_parse_rec->type_count; + + p_parse_rec->single_rec[rec_idx].ad_type = ad_type; + p_parse_rec->single_rec[rec_idx].type_data.p_data = p_data; + p_parse_rec->single_rec[rec_idx].type_data.length = length; + p_parse_rec->type_count++; +} + +static void ble_scanner_data_parse(const ble_gap_evt_adv_report_t *p_adv_report, ble_scanner_parse_report_t *p_parse_report) +{ + if (NULL == p_adv_report || NULL == p_parse_report) + { + return; + } + + memset(p_parse_report, 0, sizeof(ble_scanner_parse_report_t)); + + p_parse_report->adv_report_type = (ble_gap_adv_report_type_t)p_adv_report->adv_type; + p_parse_report->rssi = p_adv_report->rssi; + memcpy(&p_parse_report->peer_addr, &p_adv_report->broadcaster_addr, sizeof(ble_gap_bdaddr_t)); + memcpy(&s_scanner_env.conn_param.peer_addr, &p_adv_report->broadcaster_addr, sizeof(ble_gap_bdaddr_t)); + + uint8_t parse_offset = 0; + uint8_t *adv_data = p_adv_report->data; + uint8_t adv_data_len = p_adv_report->length; + uint8_t fragment_ad_type = 0; + uint8_t fragment_length = 0; + uint8_t data_length = 0; + + while (parse_offset < adv_data_len) + { + fragment_length = adv_data[parse_offset++]; + + if (0 == fragment_length) + { + break; + } + + data_length = fragment_length - 1; + fragment_ad_type = adv_data[parse_offset++]; + + switch (fragment_ad_type) + { + case BLE_GAP_AD_TYPE_FLAGS: + p_parse_report->flag = adv_data[parse_offset]; + p_parse_report->adv_type_parsed.flag = true; + break; + + case BLE_GAP_AD_TYPE_APPEARANCE: + p_parse_report->appearance = adv_data[parse_offset] | adv_data[parse_offset + 1] << 8; + p_parse_report->adv_type_parsed.appearance = true; + break; + + case BLE_GAP_AD_TYPE_SHORTENED_NAME: + case BLE_GAP_AD_TYPE_COMPLETE_NAME: + p_parse_report->local_name.p_data = &adv_data[parse_offset]; + p_parse_report->local_name.length = data_length; + p_parse_report->adv_type_parsed.local_name = true; + break; + + case BLE_GAP_AD_TYPE_MANU_SPECIFIC_DATA: + p_parse_report->manufacture_data.p_data = &adv_data[parse_offset]; + p_parse_report->manufacture_data.length = data_length; + p_parse_report->adv_type_parsed.manufacture_data = true; + break; + + case BLE_GAP_AD_TYPE_MORE_16_BIT_UUID: + case BLE_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID: + ble_scanner_uuid_encode(&adv_data[parse_offset], data_length, UUID_16_BIT_BYTES, &p_parse_report->uuid_list); + p_parse_report->adv_type_parsed.uuid = true; + break; + + case BLE_GAP_AD_TYPE_MORE_32_BIT_UUID: + case BLE_GAP_AD_TYPE_COMPLETE_LIST_32_BIT_UUID: + ble_scanner_uuid_encode(&adv_data[parse_offset], data_length, UUID_32_BIT_BYTES, &p_parse_report->uuid_list); + p_parse_report->adv_type_parsed.uuid = true; + break; + + case BLE_GAP_AD_TYPE_MORE_128_BIT_UUID: + case BLE_GAP_AD_TYPE_COMPLETE_LIST_128_BIT_UUID: + ble_scanner_uuid_encode(&adv_data[parse_offset], data_length, UUID_128_BIT_BYTES, &p_parse_report->uuid_list); + p_parse_report->adv_type_parsed.uuid = true; + break; + + default: + ble_scanner_parse_record(fragment_ad_type, &adv_data[parse_offset], data_length, &p_parse_report->other_parse_rec); + break; + } + + parse_offset += data_length; + } +} + +static bool ble_scanner_filter_uuid_macth(ble_data_t *p_uuid, ble_scanner_uuid_t *p_uuid_list) +{ + if (p_uuid->length == UUID_16_BIT_BYTES) + { + for (uint8_t i = 0; i < p_uuid_list->uuid_16_bit_count; i++) + { + if (0 == memcmp(p_uuid->p_data, (uint8_t *)&p_uuid_list->uuid_16_bit[i], UUID_16_BIT_BYTES)) + { + return true; + } + } + } + + if (p_uuid->length == UUID_32_BIT_BYTES) + { + for (uint8_t i = 0; i < p_uuid_list->uuid_32_bit_count; i++) + { + if (0 == memcmp(p_uuid->p_data, (uint8_t *)&p_uuid_list->uuid_32_bit[i], UUID_32_BIT_BYTES)) + { + return true; + } + } + } + + if (p_uuid->length == UUID_128_BIT_BYTES) + { + for (uint8_t i = 0; i < p_uuid_list->uuid_128_bit_count; i++) + { + if (0 == memcmp(p_uuid->p_data, p_uuid_list->uuid_128_bit[i], UUID_128_BIT_BYTES)) + { + return true; + } + } + } + + return false; +} + +static bool ble_scanner_filter_match_check(ble_scanner_parse_report_t *p_parse_report, ble_scanner_filter_match_t *p_match_result) +{ + memset(p_match_result, 0, sizeof(ble_scanner_filter_match_t)); + + if (s_scanner_env.filter_type & BLE_SCANNER_NAME_FILTER) + { + if (p_parse_report->local_name.length == s_scanner_env.target_data.dev_name.length && + 0 == memcmp(p_parse_report->local_name.p_data, + s_scanner_env.target_data.dev_name.p_data, + s_scanner_env.target_data.dev_name.length)) + { + p_match_result->dev_name_match = true; + } + } + + if (s_scanner_env.filter_type & BLE_SCANNER_APPEARANCE_FILTER) + { + if (p_parse_report->appearance == s_scanner_env.target_data.appearance) + { + p_match_result->appearance_match = true; + } + } + + if (s_scanner_env.filter_type & BLE_SCANNER_UUID_FILTER) + { + if (ble_scanner_filter_uuid_macth(&s_scanner_env.target_data.svr_uuid, &p_parse_report->uuid_list)) + { + p_match_result->uuid_match = true; + } + } + + if (s_scanner_env.filter_type & BLE_SCANNER_ADDR_FILTER) + { + if (0 == memcmp(&s_scanner_env.target_data.target_addr, &p_parse_report->peer_addr, sizeof(ble_gap_bdaddr_t))) + { + p_match_result->addr_match = true; + } + } + + if (BLE_SCANNER_FILTER_ANYONE_MATCH == s_scanner_env.filter_mode) + { + if (p_match_result->dev_name_match || + p_match_result->appearance_match || + p_match_result->uuid_match || + p_match_result->addr_match) + { + return true; + } + + return false; + } + else + { + if (s_scanner_env.filter_type & BLE_SCANNER_NAME_FILTER && !p_match_result->dev_name_match) + { + return false; + } + + if (s_scanner_env.filter_type & BLE_SCANNER_APPEARANCE_FILTER && !p_match_result->appearance_match) + { + return false; + } + + if (s_scanner_env.filter_type & BLE_SCANNER_UUID_FILTER && !p_match_result->uuid_match) + { + return false; + } + + if (s_scanner_env.filter_type & BLE_SCANNER_ADDR_FILTER && !p_match_result->addr_match) + { + return false; + } + } + + return true; +} + +static void on_scanner_adv_report(const ble_gap_evt_adv_report_t *p_adv_report) +{ + ble_scanner_parse_report_t parse_report; + ble_scanner_evt_t event; + ble_scanner_filter_match_t match_result; + + memset(&event, 0, sizeof(event)); + memset(&parse_report, 0, sizeof(parse_report)); + memset(&match_result, 0, sizeof(match_result)); + + if(!s_scanner_env.is_matched) + { + ble_scanner_data_parse(p_adv_report, &parse_report); + } + + event.evt_type = BLE_SCANNER_EVT_ADV_REPORT_PARSE; + memcpy(&event.param.parse_record, &parse_report, sizeof(ble_scanner_parse_report_t)); + + if (s_scanner_env.evt_handler) + { + s_scanner_env.evt_handler(&event); + } + + if (s_scanner_env.filter_enable) + { + if (ble_scanner_filter_match_check(&parse_report, &match_result)) + { + event.evt_type = BLE_SCANNER_EVT_FILTER_MATCH; + memcpy(&event.param.match_result, &match_result, sizeof(ble_scanner_filter_match_t)); + + if (s_scanner_env.evt_handler) + { + s_scanner_env.evt_handler(&event); + } + + if (s_scanner_env.connect_auto) + { + s_scanner_env.is_matched = true; + ble_scanner_stop(); + } + } + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +sdk_err_t ble_scanner_init(ble_scanner_init_t *p_scan_init) +{ + if (NULL == p_scan_init) + { + return SDK_ERR_INVALID_PARAM; + } + + memcpy(&s_scanner_env, p_scan_init, sizeof(ble_scanner_init_t)); + + return ble_gap_scan_param_set(BLE_GAP_OWN_ADDR_STATIC, &s_scanner_env.scan_param); +} + +sdk_err_t ble_scanner_filter_set(uint8_t filter_type, ble_scanner_filter_data_t *p_filter_data) +{ + sdk_err_t error_code = SDK_SUCCESS; + + if (NULL == p_filter_data) + { + return SDK_ERR_INVALID_PARAM; + } + + s_scanner_env.filter_type = filter_type; + memcpy(&s_scanner_env.target_data, p_filter_data, sizeof(ble_scanner_filter_data_t)); + + return error_code; +} + +void ble_scanner_filter_disable(void) +{ + s_scanner_env.filter_enable = false; +} + +void ble_scanner_filter_enable(ble_scanner_filter_mode_t filter_mode) +{ + s_scanner_env.filter_mode = filter_mode; + + s_scanner_env.filter_enable = true; +} + +sdk_err_t ble_scanner_start(void) +{ + ble_scanner_evt_t event; + + if (s_scanner_env.scan_param.use_whitelist) + { + event.evt_type = BLE_SCANNER_EVT_WHITELIST_REQUEST; + + if (s_scanner_env.evt_handler) + { + s_scanner_env.evt_handler(&event); + } + } + + return ble_gap_scan_start(); +} + +sdk_err_t ble_scanner_stop(void) +{ + return ble_gap_scan_stop(); +} + + +void ble_scanner_err_on_ble_capture(uint8_t err_code) +{ + if (s_scanner_env.err_handler && err_code) + { + s_scanner_env.err_handler(err_code); + } +} + +void ble_scanner_evt_on_ble_capture(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GAPM_EVT_SCAN_START: + break; + + case BLE_GAPM_EVT_SCAN_STOP: + on_scanner_stoped(p_evt->evt.gapm_evt.params.scan_stop.reason); + break; + + case BLE_GAPM_EVT_ADV_REPORT: + on_scanner_adv_report(&p_evt->evt.gapm_evt.params.adv_report); + break; + + case BLE_GAPC_EVT_CONNECTED: + on_scanner_connected(p_evt->evt.gapc_evt.index); + break; + + default: + break; + } +} +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.h new file mode 100644 index 0000000..636432d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_scanner/ble_scanner.h @@ -0,0 +1,331 @@ +/** + ***************************************************************************************** + * + * @file ble_scanner.h + * + * @brief BLE Scanner Module API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +#ifndef __BLE_SCANNER__ +#define __BLE_SCANNER__ + +#include "ble_module_config.h" +#include "ble_event.h" +#include "ble_gapm.h" + +/** + * @defgroup BLE_SCANNER_MAROC Defines + * @{ + */ +/**@brief Capture scanner event. */ +#define BLE_SCANNER_EVT_CAPTURE(err, evt_id, arg) \ +do \ +{ \ + if (err != BLE_SUCCESS) \ + { \ + ble_scanner_err_on_ble_capture(err); \ + } \ + else \ + { \ + ble_scanner_evt_on_ble_capture(evt_id, arg); \ + } \ +} while(0) +/** @} */ + +#define AD_TYPE_NUM_MAX 10 /**< Maximum number of ad type can be parsed in one advertising report packet. */ +#define UUID_16_BIT_NUM_MAX 14 /**< Maximum number of 16 bit uuid service can be parsed in one advertising report packet. */ +#define UUID_32_BIT_NUM_MAX 7 /**< Maximum number of 32 bit uuid service can be parsed in one advertising report packet. */ +#define UUID_128_BIT_NUM_MAX 1 /**< Maximum number of 128 bit uuid service can be parsed in one advertising report packet. */ + +#define UUID_16_BIT_BYTES 2 /**< Length of bytes for 16 bit UUID. */ +#define UUID_32_BIT_BYTES 4 /**< Length of bytes for 32 bit UUID. */ +#define UUID_128_BIT_BYTES 16 /**< Length of bytes for 128 bit UUID. */ +/** @} */ + +/** + * @defgroup BLE_SCANNER_ENUM Enumerations + * @{ + */ +/**@brief BLE GAP event ids. */ +enum +{ + BLE_GAP_EVT_ID_ADV_START = BLE_COMMON_EVT_BASE, + BLE_GAP_EVT_ID_ADV_STOP, + BLE_GAP_EVT_ID_ADV_REPORT, + BLE_GAP_EVT_ID_CONNECTED, + BLE_GAP_EVT_ID_DISCONNECTED, + BLE_GAP_EVT_ID_CONNECTED_CANCLE, + BLE_GAP_EVT_ID_CONN_PARAM_UPDATED, + BLE_GAP_EVT_ID_PHY_UPDATED, + BLE_GAP_EVT_ID_DEV_INFO_GOT, + BLE_GAP_EVT_ID_SCAN_START, + BLE_GAP_EVT_ID_SCAN_STOP, + BLE_GAP_EVT_ID_SCAN_REQUEST, + BLE_GAP_EVT_ID_SYNC_ESTABLISH, + BLE_GAP_EVT_ID_PEER_NAME_GOT, + BLE_GAP_EVT_ID_CONN_PARAM_UPDATE_REQUEST, + BLE_GAP_EVT_ID_CONN_INFO_GOT, + BLE_GAP_EVT_ID_PEER_DEV_INFO_GOT, + BLE_GAP_EVT_ID_DATA_LENGTH_UPDATED, + BLE_GAP_EVT_ID_READ_RSLV_ADDR +}; + +/**@brief BLE Scanner filter match mode. */ +typedef enum +{ + BLE_SCANNER_FILTER_ALL_MATCH, /**< Only when all type match. */ + BLE_SCANNER_FILTER_ANYONE_MATCH, /**< Just match any type . */ +} ble_scanner_filter_mode_t; + +/**@brief BLE Scanner filter types. */ +typedef enum +{ + BLE_SCANNER_NAME_FILTER = (0x01 << 0), /**< Filter device base on target device name. */ + BLE_SCANNER_APPEARANCE_FILTER = (0x01 << 1), /**< Filter device base on target appearance. */ + BLE_SCANNER_UUID_FILTER = (0x01 << 2), /**< Filter device base on tagert service UUID. */ + BLE_SCANNER_ADDR_FILTER = (0x01 << 3), /**< Filter device base on target address. */ +} ble_scanner_filter_type_t; + +/**@brief BLE Scanner event type. */ +typedef enum +{ + BLE_SCANNER_EVT_INVALID, /**< Invalid event. */ + BLE_SCANNER_EVT_WHITELIST_REQUEST, /**< Request user to add whitelist. */ + BLE_SCANNER_EVT_TIMEOUT, /**< Scan tiemout. */ + BLE_SCANNER_EVT_ADV_REPORT_PARSE, /**< Advertising report parsed. */ + BLE_SCANNER_EVT_FILTER_MATCH, /**< Filter match from adv report. */ + BLE_SCANNER_EVT_FILTER_NO_MATCH, /**< Filter no match from adv report. */ + BLE_SCANNER_EVT_CONNECTED, /**< Connected. */ +} ble_scanner_evt_type_t; +/** @} */ + +/** + * @defgroup BLE_SCANNER_STRUCT Structures + * @{ + */ +/**@brief Data structure. */ +typedef struct +{ + const uint8_t *p_data; /**< Pointer to the data. */ + uint16_t length; /**< Length of the data. */ +} ble_data_t; + +/**@brief Target data provided to filter. */ +typedef struct +{ + ble_data_t dev_name; /**< Target device name. */ + uint16_t appearance; /**< Target appearance. */ + ble_data_t svr_uuid; /**< Target service UUID. */ + ble_gap_bdaddr_t target_addr; /**< Target device address. */ +} ble_scanner_filter_data_t; + +/**@brief UUID data parsed from advertising report. */ +typedef struct +{ + uint8_t uuid_16_bit_count; /**< Count of 16 bit uuid parsed. */ + uint8_t uuid_32_bit_count; /**< Count of 32 bit uuid parsed. */ + uint8_t uuid_128_bit_count; /**< Count of 128 bit uuid parsed. */ + uint16_t uuid_16_bit[UUID_16_BIT_NUM_MAX]; /**< All 16 bit uuid data parsed. */ + uint32_t uuid_32_bit[UUID_32_BIT_NUM_MAX]; /**< All 32 bit uuid data parsed. */ + uint8_t uuid_128_bit[UUID_128_BIT_NUM_MAX][UUID_128_BIT_BYTES]; /**< All 128 bit uuid data parsed. */ +} ble_scanner_uuid_t; + +/**@brief Parsed adv types */ +typedef struct +{ + bool flag; /**< True if flag existed, false or not. */ + bool appearance; /**< True if appearance existed, false or not. */ + bool local_name; /**< True if service UUID existed, false or not. */ + bool manufacture_data; /**< True if manufacture data existed, false or not. */ + bool uuid; /**< True if UUID existed, false or not. */ +} ble_scanner_adv_type_t; + +/**@brief Single advertising type parsed from advertising report. */ +typedef struct +{ + uint8_t ad_type; /**< GAP advertising data type. */ + ble_data_t type_data; /**< Adv type raw data. */ +} ble_scanner_single_rec_t; + +/**@brief All GAP advertising type parsed from advertising report. */ +typedef struct +{ + uint8_t type_count; /**< Count of advertising type parsed. */ + ble_scanner_single_rec_t single_rec[AD_TYPE_NUM_MAX]; /**< Information of parsed. */ +} ble_scanner_parse_rec_t; + +/**@brief All parsed result from advertising report. */ +typedef struct +{ + ble_gap_adv_report_type_t adv_report_type; /**< Advertising report type. */ + ble_scanner_adv_type_t adv_type_parsed; /**< Parsed adv types. */ + ble_gap_bdaddr_t peer_addr; /**< Address of device from which advertising. */ + int8_t rssi; /**< RSSI (between -127 and +20 dBm). */ + uint8_t flag; /**< Flag, shall not appear more than once in a block. */ + uint16_t appearance; /**< Appearance, shall not appear more than once in a block. */ + ble_data_t local_name; /**< Local name, shall not appear more than once in a block. */ + ble_data_t manufacture_data; /**< Manufacturer specific data. */ + ble_scanner_uuid_t uuid_list; /**< Service uuid list. */ + ble_scanner_parse_rec_t other_parse_rec; /**< Other data parse record. */ +} ble_scanner_parse_report_t; + +/**@brief Matched with which target data. */ +typedef struct +{ + bool dev_name_match; /**< True if device name matched, false or not. */ + bool appearance_match; /**< True if appearance matched, false or not. */ + bool uuid_match; /**< True if service UUID matched, false or not. */ + bool addr_match; /**< True if address matched, false or not. */ +} ble_scanner_filter_match_t; + +/**@brief BLE Scanner Module event. */ +typedef struct +{ + ble_scanner_evt_type_t evt_type; /**< BLE Scanner event type. */ + union + { + ble_scanner_filter_match_t match_result; /**< Filter match result. */ + ble_scanner_parse_report_t parse_record; /**< Advertising report parse result record. */ + uint8_t conn_idx; /**< Connect index. */ + } param; +} ble_scanner_evt_t; +/** @} */ + +/** + * @defgroup BLE_SCANNER_TYPEDEF Typedefs + * @{ + */ +/**@brief BLE scanner event handler type. */ +typedef void (*ble_scanner_evt_handler_t)(ble_scanner_evt_t *p_evt); + +/**@brief BLE scanner error handler type. */ +typedef void (*ble_scanner_err_handler_t)(uint8_t err_code); +/** @} */ + +/** + * @defgroup BLE_SCANNER_STRUCT Structures + * @{ + */ +typedef struct +{ + bool connect_auto; /**< Ture: Connect to target device when found, False: Notify to application when device when found. */ + ble_gap_scan_param_t scan_param; /**< Scan parameters. */ + ble_gap_init_param_t conn_param; /**< Connect parameters which must be initialized when @see connect_auto to be set Ture. */ + ble_scanner_evt_handler_t evt_handler; /**< Handler to handle scan events for application. */ + ble_scanner_err_handler_t err_handler; /**< Handler to handle scan errors for application. */ +} ble_scanner_init_t; +/** @} */ + +/** + * @defgroup BLE_SCANNER_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief BLE Scanner Module initialization. + * + * @param[in] p_scanner_init: Pointer to BLE Scanner Module initialization parameters + * + * @return Result of init operation. + ***************************************************************************************** + */ +sdk_err_t ble_scanner_init(ble_scanner_init_t *p_scanner_init); + +/** + ***************************************************************************************** + * @brief BLE Scanner Module filter set(can override set). + * + * @param[in] filter_type: Filter type. + * @param[in] p_filter_data: Pointer to data for filtering. + * + * @return Result of set operation. + ***************************************************************************************** + */ +sdk_err_t ble_scanner_filter_set(uint8_t filter_type, ble_scanner_filter_data_t *p_filter_data); + +/** + ***************************************************************************************** + * @brief BLE Scanner Module filter diasble. + ***************************************************************************************** + */ +void ble_scanner_filter_disable(void); + +/** + ***************************************************************************************** + * @brief BLE Scan Module filter enable. + * + * @param[in] filter_mode: Filter mode. + ***************************************************************************************** + */ +void ble_scanner_filter_enable(ble_scanner_filter_mode_t filter_mode); + +/** + ***************************************************************************************** + * @brief BLE Scanner Module starts scanning device. + * + * @return Result of start scanning. + ***************************************************************************************** + */ +sdk_err_t ble_scanner_start(void); + +/** + ***************************************************************************************** + * @brief BLE Scanner Module stop scanning device. + * + * @return Result of stop scanning. + ***************************************************************************************** + */ +sdk_err_t ble_scanner_stop(void); + +/** + ***************************************************************************************** + * @brief Capture scanner events on BLE. + * + * @param[in] evt_id: Event ID on BLE. + * @param[in] arg: Arguments. + ***************************************************************************************** + */ +void ble_scanner_evt_on_ble_capture(const ble_evt_t *p_evt); + +/** + ***************************************************************************************** + * @brief Capture scanner error. + * + * @param[in] err_code: Error code. + ***************************************************************************************** + */ +void ble_scanner_err_on_ble_capture(uint8_t err_code); +/** @} */ +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/BUILD.gn new file mode 100644 index 0000000..01b78e2 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ble_time") { + sources = [ "ble_time.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.c new file mode 100644 index 0000000..0d5ddca --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.c @@ -0,0 +1,68 @@ +/** + ***************************************************************************************** + * + * @file ble_time.c + * + * @brief Provide method to get and calculate ble time. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "grx_hal.h" +#include "grx_sys.h" +#include "ble_time.h" + +/** + **************************************************************************************** + * @brief This function get the ble time. + * + * @note This function is supported only when ble core is powered on + * + **************************************************************************************** + */ +ble_time_t rwip_time_get(void); + +/** + **************************************************************************************** + * @brief This function gets the ble time. + * + * @note This function is supported only when ble stack is initiated + * + **************************************************************************************** + */ +SECTION_RAM_CODE ble_time_t ble_time_get(void) +{ + pwr_mgmt_ble_wakeup(); + return rwip_time_get(); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.h new file mode 100644 index 0000000..02b8572 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ble/ble_time/ble_time.h @@ -0,0 +1,35 @@ +#ifndef __APP_BLE_TIME_H__ +#define __APP_BLE_TIME_H__ +#include "grx_hal.h" + +/* + * MACRO DEFINITIONS + ***************************************************************************************** + */ +#define TICK_MS_IN_HUS (2000) +#define HALF_SLOT_SIZE (625) +#define RWIP_MAX_CLOCK_TIME (0xFFFFFFF) +#define SECOND_IN_HUS (2000000) +#define CLK_SUB(clock_a, clock_b) ((uint32_t)(((clock_a) - (clock_b)) & RWIP_MAX_CLOCK_TIME)) + +/* + * STRUCTURE DEFINITIONS + ***************************************************************************************** + */ +typedef struct +{ + uint32_t hs; + uint16_t hus; +} ble_time_t; + +/** + **************************************************************************************** + * @brief This function get the ble time. + * + * @note This function is supported only when ble stack is initiated + * + **************************************************************************************** + */ +ble_time_t ble_time_get(void); + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/BUILD.gn new file mode 100644 index 0000000..fe5dc56 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "inc" ] +} + +kernel_module("crypto_lib") { + sources = [ + "src/crypto_aes.c", + "src/crypto_ecc.c", + "src/crypto_ecc_port.c", + "src/crypto_gcm.c", + "src/crypto_pkc.c", + "src/crypto_pkc_port.c", + "src/crypto_rsa.c", + "src/crypto_rsa_port.c", + "src/crypto_sha256.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_aes.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_aes.h new file mode 100644 index 0000000..c2f1a35 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_aes.h @@ -0,0 +1,360 @@ +/** + **************************************************************************************** + * + * @file crypto_aes.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto AES library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup CRYPTO_DRIVER CRYPTO DRIVER + * @{ + */ + +/** @defgroup CRYPTO_AES AES + * @brief AES CRYPTO driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CRYPTO_AES_H__ +#define __CRYPTO_AES_H__ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CRYPTO_AES_MACRO Defines + * @{ + */ + +#define AES_BLOCK_SIZE 16 /**< AES BLOCK SIZE. */ +#define AES_ENCRYPT 1 /**< AES ENCRYPT MODE. */ +#define AES_DECRYPT 0 /**< AES DECRYPT MODE. */ +#define AES_MAX_KEY_SIZE 32 /**< AES MAX KEY SIZE. */ +/** @} */ + +/** @addtogroup CRYPTO_AES_ENUM Enumerations + * @{ + */ + +/** + * @brief This defines the process state of aes padding type value. + */ +typedef enum { + PADDING_NONE = 0, /**< AES padding type none. */ + PADDING_ZEROS, /**< AES padding type zeros. */ + PADDING_PKCS7, /**< AES padding type pkcs7. */ +} crypto_aes_padding_t; +/** @} */ + +/** @addtogroup CRYPTO_AES_CONTEXT_STRUCTURES Structures + * @{ + */ + +/** @defgroup AES Context Structurs Definition + * @{ + */ + +/** + * @brief This defines the structure of aes context. + */ +typedef struct +{ + uint8_t key[AES_MAX_KEY_SIZE]; /**< the key. */ + uint16_t keybits; /**< the keybits. */ + crypto_aes_padding_t padding_mode; /**< padding mode. */ + void *instance; /**< the aes instance. */ +} crypto_aes_context; +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CRYPTO_AES_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief crypto aes init. + * + * @param[in] ctx: aes context. + * + **************************************************************************************** + */ +void crypto_aes_init(crypto_aes_context *ctx); + +/** + **************************************************************************************** + * @brief crypto aes free. + * + * @param[in] ctx: aes context. + * + **************************************************************************************** + */ +void crypto_aes_free(crypto_aes_context *ctx); + +/** + **************************************************************************************** + * @brief crypto aes set the padding type. + * + * @param[in] ctx: aes context. + * @param[in] padding_type: PADDING_NONE/PADDING_ZEROS/PADDING_PKCS7. + * + * @retval ::-1: The aes set paddings type error. + * @retval ::0: The aes set paddings type successfully. + **************************************************************************************** + */ +int crypto_aes_set_paddings(crypto_aes_context *ctx, crypto_aes_padding_t padding_type); + +/** + * **************************************************************************************** + * @brief AES key schedule (encryption) + * + * @param[in] ctx: AES context to be initialized + * @param[in] key: encryption key + * @param[in] keybits: must be 128, 192 or 256 + * + * @retval ::-1: The aes set key enc error. + * @retval ::0: The aes set key enc successfully. + * **************************************************************************************** + */ +int crypto_aes_setkey_enc(crypto_aes_context *ctx, uint8_t *key, uint16_t keybits); + +/** + * **************************************************************************************** + * @brief AES key schedule (decryption) + * + * @param[in] ctx: AES context to be initialized + * @param[in] key: encryption key + * @param[in] keybits: must be 128, 192 or 256 + * + * @retval ::-1: The aes set key enc error. + * @retval ::0: The aes set key enc successfully. + * **************************************************************************************** + */ +int crypto_aes_setkey_dec(crypto_aes_context *ctx, uint8_t *key, uint16_t keybits); + +/** + * **************************************************************************************** + * @brief pkcs7 padding algorithm + * + * @param[in] input: input block + * @param[in] length: input length + * @param[out] output: output block + * + * @retval ::-1: The aes pkcs7 padding error. + * @retval ::others: The aes pkcs7 padding output length. + * ***************************************************************************************** + */ +int crypto_aes_pkcs7_padding(uint8_t *input, uint32_t length, uint8_t *output); + +/** + * **************************************************************************************** + * @brief zero padding algorithm + * + * @param[in] input: input block + * @param[in] length: input length + * @param[out] output: output block + * + * @retval ::-1: The aes zero padding error. + * @retval ::others: The aes zero padding output length. + * ***************************************************************************************** + */ +int crypto_aes_zero_padding(uint8_t *input, uint32_t length, uint8_t *output); + +/** + * **************************************************************************************** + * @brief get output length + * + * @param[in] length: input length + * @param[in] padding_type: padding type + * + * @retval ::len: The output len. + * ***************************************************************************************** + */ +uint32_t crypto_aes_get_output_length(uint32_t length, crypto_aes_padding_t padding_type); + +/** + * **************************************************************************************** + * @brief AES-ECB block encryption/decryption + * + * @param[in] ctx: AES context + * @param[in] mode: AES_ENCRYPT or AES_DECRYPT + * @param[in] input: input block + * @param[in] length: input length + * @param[out] output: output block + * + * @retval ::-1: The aes ecb crypt error. + * @retval ::0: The aes ecb crypt successfully. + * ***************************************************************************************** + */ +int crypto_aes_crypt_ecb(crypto_aes_context *ctx, uint8_t mode, uint8_t *input, uint32_t length, uint8_t *output); + +/** + * ***************************************************************************************** + * @brief AES-CBC buffer encryption/decryption + * Length should be a multiple of the block + * size (16 bytes) + * + * @note Upon exit, the content of the IV is updated so that you can + * call the function same function again on the following + * block(s) of data and get the same result as if it was + * encrypted in one call. This allows a "streaming" usage. + * If on the other hand you need to retain the contents of the + * IV, you should either save it manually or use the cipher + * module instead. + * + * @param[in] ctx: AES context + * @param[in] mode: AES_ENCRYPT or AES_DECRYPT + * @param[in] iv: initialization vector (updated after use) + * @param[in] input: buffer holding the input data + * @param[in] length: buffer holding the input data length + * @param[out] output: buffer holding the output data + * + * @retval ::-1: The aes cbc crypt error. + * @retval ::0: The aes cbc crypt successfully. + * ***************************************************************************************** + */ +int crypto_aes_crypt_cbc(crypto_aes_context *ctx, uint8_t mode, uint8_t iv[16], uint8_t *input, uint32_t length, uint8_t *output); + +/** + * ***************************************************************************************** + * @brief AES-CTR buffer encryption/decryption + * Length should be a multiple of the block + * size (16 bytes) + * + * @note Upon exit, the content of the IV is updated so that you can + * call the function same function again on the following + * block(s) of data and get the same result as if it was + * encrypted in one call. This allows a "streaming" usage. + * If on the other hand you need to retain the contents of the + * IV, you should either save it manually or use the cipher + * module instead. + * + * @param[in] ctx: AES context + * @param[in] length: buffer holding the input data length + * @param[in] nc_off: The offset in the current stream_block, for resuming within the current cipher stream. + * The offset pointer should be 0 at the start of a stream. + * @param[in] nonce_counter: The 128-bit nonce and counter. + * It must be a readable-writeable buffer of 16 Bytes. + * @param[in] stream_block: The saved stream block for resuming. + * This is overwritten by the function. + * It must be a readable-writeable buffer of 16 Bytes. + * @param[in] input: buffer holding the input data + * @param[out] output: buffer holding the output data + * + * @retval ::-1: The aes ctr crypt error. + * @retval ::0: The aes ctr crypt successfully. + * ***************************************************************************************** + */ +int crypto_aes_crypt_ctr(crypto_aes_context *ctx, uint32_t length, uint32_t *nc_off, + uint8_t nonce_counter[16], uint8_t stream_block[16], const uint8_t *input, uint8_t *output); + +/** + * ***************************************************************************************** + * @brief AES-CFB128 buffer encryption/decryption + * Length should be a multiple of the block + * size (16 bytes) + * + * @note Upon exit, the content of the IV is updated so that you can + * call the function same function again on the following + * block(s) of data and get the same result as if it was + * encrypted in one call. This allows a "streaming" usage. + * If on the other hand you need to retain the contents of the + * IV, you should either save it manually or use the cipher + * module instead. + * + * @param[in] ctx: AES context + * @param[in] mode: AES operation + * @param[in] length: buffer holding the input data length + * @param[in] iv_off: The offset in IV (updated after use) + * @param[in] iv: The initialization vector (updated after use) + * @param[in] input: buffer holding the input data + * @param[out] output: buffer holding the output data + * + * @retval ::-1: The aes ctr crypt error. + * @retval ::0: The aes ctr crypt successfully. + * ***************************************************************************************** + */ +int crypto_aes_crypt_cfb128(crypto_aes_context *ctx, uint8_t mode, uint32_t length, uint32_t *iv_off, + uint8_t iv[16], const uint8_t *input, uint8_t *output); + +/** + * ***************************************************************************************** + * @brief AES-OFB buffer encryption/decryption + * Length should be a multiple of the block + * size (16 bytes) + * + * @note Upon exit, the content of the IV is updated so that you can + * call the function same function again on the following + * block(s) of data and get the same result as if it was + * encrypted in one call. This allows a "streaming" usage. + * If on the other hand you need to retain the contents of the + * IV, you should either save it manually or use the cipher + * module instead. + * + * @param[in] ctx: AES context + * @param[in] length: buffer holding the input data length + * @param[in] iv_off: The offset in IV (updated after use) + * @param[in] iv: The initialization vector (updated after use) + * @param[in] input: buffer holding the input data + * @param[out] output: buffer holding the output data + * + * @retval ::-1: The aes ctr crypt error. + * @retval ::0: The aes ctr crypt successfully. + * ***************************************************************************************** + */ +int crypto_aes_crypt_ofb(crypto_aes_context *ctx, uint32_t length, uint32_t *iv_off, + uint8_t iv[16], const uint8_t *input, uint8_t *output); +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_AES_H__ */ + +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_ecc.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_ecc.h new file mode 100644 index 0000000..4fc4308 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_ecc.h @@ -0,0 +1,411 @@ +/** + **************************************************************************************** + * + * @file crypto_ecc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto ECC library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup CRYPTO_DRIVER CRYPTO DRIVER + * @{ + */ + +/** @defgroup CRYPTO_ECC ECC + * @brief ECC CRYPTO driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CRYPTO_ECC_H__ +#define __CRYPTO_ECC_H__ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CRYPTO_ECC_MACRO Defines + * @{ + */ + +#define ECC_U32_LENGTH (8) /**< ECC supported 256-bit. */ +#define ECC_HASH_SHA_256 (1) /**< ECC use hash sha256. */ +#define ECC_HASH_NONE (0) /**< ECC without hash. */ +/** @} */ + +/** @addtogroup CRYPTO_ECC_ENUM Enumerations + * @{ + */ + +/** + * @brief ECC Return code. + */ +typedef enum _algo_ecc_ret { + + ECC_OK = 0, /**< ECC Return OK. */ + ECC_ERROR_PARAMETER = 10000, /**< ECC Return Parameter Error. */ + ECC_ERROR_SIGN, /**< ECC Return Sign Error. */ + ECC_ERROR_VERIFY, /**< ECC Return Verify Error. */ + ECC_ERROR_POINT_NOT_ON_CURVE, /**< ECC Return Point is not on curve Error. */ + ECC_ERROR_INTERFACE_EMPTY, /**< ECC Return interface not found. */ +} algo_ecc_ret_e; + +/** + * @brief ECC Curve type. + */ +typedef enum _algo_ecc_curve_type { + + ECC_CURVE_SECP256R1, /**< NIST SECP256R1 Curve. */ + ECC_CURVE_SECP256K1, /**< NIST SECP256K1 Curve. */ +} algo_ecc_curve_type_e; +/** @} */ + +/** @addtogroup CRYPTO_ECC_CONTEXT_STRUCTURES Structures + * @{ + */ + +/** @defgroup ECC Point Structurs Definition + * @{ + */ + +/** + * @brief Defines a data structure of a point, include x-axis and y-axis. And (0,0) is defined as the point of infinite. + */ +typedef struct _algo_ecc_point { + + uint32_t x[ECC_U32_LENGTH]; /**< point' x-axis, interger format (ANSI X9.62 - 2005 (Page 27))*/ + uint32_t y[ECC_U32_LENGTH]; /**< point' y-axis, interger format (ANSI X9.62 - 2005 (Page 27))*/ + +} algo_ecc_point_t; +/** @} */ + +/** @defgroup ECC Curve Structurs Definition + * @{ + */ + +/** + * @brief User defined elliptic curve description. + */ +typedef struct _algo_ecc_curve_parameter { + + /** + * parameter A in Montgomery Filed! a = a * R, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 a = {0xfffffffc,0xffffffff,0xffffffff,0x00000003,0x00000000,0x00000000,0x00000004,0xfffffffc}; + */ + uint32_t a[ECC_U32_LENGTH]; /**< parameter A in Montgomery Filed! */ + + /** + * parameter B in Montgomery Filed! b = b * R, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 b = {0x29c4bddf,0xd89cdf62,0x78843090,0xacf005cd,0xf7212ed6,0xe5a220ab,0x04874834,0xdc30061d}; + */ + uint32_t b[ECC_U32_LENGTH]; /**< parameter B in Montgomery Filed! */ + + /** + * parameter p, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 p = {0xffffffff, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff}; + */ + uint32_t p[ECC_U32_LENGTH]; /**< parameter P in curve */ + + /** + * parameter R ^ 2 mod p, where R = 2 ^ 256, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 R^2 mod p {0x00000004, 0xfffffffd, 0xffffffff, 0xfffffffe, 0xfffffffb, 0xffffffff, 0x00000000, 0x00000003} + */ + uint32_t p_r_square[ECC_U32_LENGTH]; /**< R^2 mod p */ + + /** + * Montgomery multiplication constant for prime p + */ + uint32_t constp; /**< Montgomery multiplication constant for prime p */ + + /** + * parameter p, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 n = {0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0xbce6faad, 0xa7179e84, 0xf3b9cac2, 0xfc632551} + */ + uint32_t n[ECC_U32_LENGTH]; /**< NIST P256 n */ + + /** + * parameter R ^ 2 mod n, where R = 2 ^ 256, denoted integer format as ANSI X9.62 - 2005 (Page 27). + * For example NIST P256 R^2 mod n {0x66e12d94, 0xf3d95620, 0x2845b239, 0x2b6bec59, 0x4699799c, 0x49bd6fa6, 0x83244c95, 0xbe79eea2} + */ + uint32_t n_r_square[ECC_U32_LENGTH]; /**< R^2 mod n */ + + /** + * Montgomery multiplication constant for prime n + */ + uint32_t constn; /**< Montgomery multiplication constant for prime n */ + + /** + * parameter h for ecc curve + */ + uint32_t h; /**< parameter h for ecc curve */ + + /** + * generation point for ecc curve + */ + algo_ecc_point_t G; /**< generation point for ecc curve */ + +} algo_ecc_curve_parameter_t; +/** @} */ + +/** @defgroup ECC Config Structurs Definition + * @{ + */ + +/** + * @brief ECC Computation config + * \note It is recommended to set config via API ecc_init_config + */ +typedef struct _algo_ecc_config { + + /* Followings parameters are for Both ECC/RSA */ + /** + * This member MUST BE specified. The default p256 params can be get from ROM + */ + algo_ecc_curve_parameter_t *curve; /**< ecc curve */ + +} algo_ecc_config_t; +/** @} */ + +/** @defgroup ECDSA Config Structurs Definition + * @{ + */ + +/** + * @brief The ECDSA context structure + */ +typedef struct _algo_ecc_ecdsa_config { + + /** + * ECDSA compute options, include curve type. + */ + algo_ecc_config_t calc_options; /**< ecc config options */ + + /** + * ECDSA our secret value, (a random number < n) + */ + uint32_t our_secret_value[ECC_U32_LENGTH]; /** +#include +#include +#include +#include +#include "crypto_ecc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t hw_ecc_rng32(void); +void hw_ecc_point_mul(algo_ecc_config_t *ecc_calc_options, + uint32_t k[ECC_U32_LENGTH], + algo_ecc_point_t *Q, + algo_ecc_point_t *result); +void hw_ecc_sha(const uint8_t *message, uint32_t message_byte_length, uint8_t output[32]); +void hw_ecc_modular_compare(algo_ecc_config_t *ecc_calc_options, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t result[]); +void ecc_modular_inverse(algo_ecc_config_t *ecc_config, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t out_a_inverse[]); +void hw_ecc_montgomery_inverse( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_prime[], uint32_t constp, uint32_t out_x[]); +void hw_ecc_modular_sub( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]); +void hw_ecc_montgomery_mul(algo_ecc_config_t *ecc_calc_options, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t constp, + uint32_t result[]); +void hw_ecc_modular_add( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]); +void ecc_modular_multiply(algo_ecc_config_t *ecc_config, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t out_result[]); +uint32_t ecc_is_infinite_point(algo_ecc_point_t *point); + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_ECC_PORT_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_gcm.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_gcm.h new file mode 100644 index 0000000..9e75515 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_gcm.h @@ -0,0 +1,238 @@ +/** + **************************************************************************************** + * + * @file crypto_gcm.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto GCM library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup CRYPTO_DRIVER CRYPTO DRIVER + * @{ + */ + +/** @defgroup CRYPTO_GCM GCM + * @brief GCM CRYPTO driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CRYPTO_GCM_H__ +#define __CRYPTO_GCM_H__ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include +#include "crypto_aes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup CRYPTO_GCM_CONTEXT_STRUCTURES Structures + * @{ + */ + +/** @defgroup GCM Context Structurs Definition + * @{ + */ + +/** + * @brief This defines the structure of gcm context. + */ +typedef struct crypto_gcm_context +{ + crypto_aes_context cipher_ctx; /**< The cipher context used. */ + uint64_t HL[16]; /**< Precalculated HTable low. */ + uint64_t HH[16]; /**< Precalculated HTable high. */ + uint64_t len; /**< The total length of the encrypted data. */ + uint64_t add_len; /**< The total length of the additional data. */ + unsigned char base_ectr[16]; /**< The first ECTR for tag. */ + unsigned char y[16]; /**< The Y working value. */ + unsigned char buf[16]; /**< The buf working value. */ + int mode; /**< The operation to perform: + #AES_ENCRYPT or + #AES_DECRYPT. */ +}crypto_gcm_context; +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CRYPTO_GCM_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief crypto gcm init. + * + * @param[in] ctx: gcm context. + * + **************************************************************************************** + */ +void crypto_gcm_init( crypto_gcm_context *ctx ); + +/** + **************************************************************************************** + * @brief crypto gcm set key. + * + * @param[in] ctx: gcm context. + * @param[in] key: encryption/decryption key. + * @param[in] keybits: must be 128, 192 or 256. + * + * @retval ::-1: The gcm set key error. + * @retval ::0: The gcm set key successfully. + **************************************************************************************** + */ +int crypto_gcm_setkey( crypto_gcm_context *ctx, const uint8_t *key, uint32_t keybits ); + +/** + **************************************************************************************** + * @brief start GCM encryption or decryption. + * + * @param[in] ctx: gcm context. + * @param[in] mode: AES_ENCRYPT or AES_DECRYPT. + * @param[in] iv: The initialization vector. + * @param[in] iv_len: The length of the IV. + * @param[in] add: The buffer holding the additional data, or NULL if add_len is 0. + * @param[in] add_len: The length of the additional data. + * + * @retval ::-1: The gcm start error. + * @retval ::0: The gcm start successfully. + **************************************************************************************** + */ +int crypto_gcm_starts( crypto_gcm_context *ctx, int mode, const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len ); + +/** + **************************************************************************************** + * @brief update GCM encryption or decryption buffer. + * + * @param[in] ctx: gcm context. + * @param[in] length: The length of the input data. This must be a multiple of + * 16 except in the last call before crypto_gcm_finish(). + * @param[in] input: The buffer holding the input data. + * @param[out] output: The buffer for holding the output data. + * + * @retval ::-1: The gcm update error. + * @retval ::0: The gcm update successfully. + **************************************************************************************** + */ +int crypto_gcm_update( crypto_gcm_context *ctx, uint32_t length, const uint8_t *input, uint8_t *output ); + +/** + **************************************************************************************** + * @brief GCM generates the authentication tag. + * + * @param[in] ctx: gcm context. + * @param[out] tag: The buffer for holding the tag. + * @param[in] tag_len: The length of the tag to generate. + * + * @retval ::-1: The gcm generates tag error. + * @retval ::0: The gcm generates tag successfully. + **************************************************************************************** + */ +int crypto_gcm_finish( crypto_gcm_context *ctx, uint8_t *tag, uint32_t tag_len ); + +/** + **************************************************************************************** + * @brief crypto gcm free. + * + * @param[in] ctx: gcm context. + * + **************************************************************************************** + */ +void crypto_gcm_free( crypto_gcm_context *ctx ); + +/** + **************************************************************************************** + * @brief GCM encryption or decryption. + * + * @param[in] ctx: gcm context. + * @param[in] mode: AES_ENCRYPT or AES_DECRYPT. + * @param[in] length: The length of the input data. + * @param[in] iv: The initialization vector. + * @param[in] iv_len: The length of the IV. + * @param[in] add: The buffer holding the additional data, or NULL if add_len is 0. + * @param[in] add_len: The length of the additional data. + * @param[in] input: The buffer holding the input data. + * @param[out] output: The buffer for holding the output data. + * @param[out] tag: The buffer for holding the tag. + * @param[in] tag_len: The length of the tag to generate. + * + * @retval ::-1: The gcm encryption or decryption error. + * @retval ::0: The gcm encryption or decryption successfully. + **************************************************************************************** + */ +int crypto_gcm_crypt_and_tag( crypto_gcm_context *ctx, int mode, uint32_t length, + const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len, + const uint8_t *input, uint8_t *output, uint32_t tag_len, uint8_t *tag ); + +/** + **************************************************************************************** + * @brief GCM authenticated decryption. + * + * @param[in] ctx: gcm context. + * @param[in] length: The length of the input data. + * @param[in] iv: The initialization vector. + * @param[in] iv_len: The length of the IV. + * @param[in] add: The buffer holding the additional data, or NULL if add_len is 0. + * @param[in] add_len: The length of the additional data. + * @param[in] tag: The buffer for holding the tag. + * @param[in] tag_len: The length of the tag to generate. + * @param[in] input: The buffer holding the input data. + * @param[out] output: The buffer for holding the output data. + * + * @retval ::-1: The gcm authenticated decryption error. + * @retval ::0: The gcm authenticated decryption successfully. + **************************************************************************************** + */ +int crypto_gcm_auth_decrypt( crypto_gcm_context *ctx, uint32_t length, + const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len, + const uint8_t *tag, uint32_t tag_len, const uint8_t *input, uint8_t *output ); +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_GCM_H__ */ + +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc.h new file mode 100644 index 0000000..b8343c3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc.h @@ -0,0 +1,237 @@ +/** + **************************************************************************************** + * + * @file crypto_pkc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto PKC library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +#ifndef __CRYPTO_PKC_H__ +#define __CRYPTO_PKC_H__ + +#include +#include +#include +#include +#include +#include "grx_hal.h" +#include "crypto_ecc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief modular shift operation: result(bits_len bit) = (2 ^ shift_bits) * in_a (bits_len bit) mod in_prime (bits_len bit) + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[in] shift_bits number of shift bits. + * + * \param[out] result bits_len bit output. + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_modular_left_shift_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_prime[], + uint32_t shift_bits, uint32_t result[]); + +/** + * \brief modular compare operation: result(bits_len bit) = in_a(bits_len bit) mod in_prime(bits_len bit) + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[out] result bits_len bit output. + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_modular_compare_handle(uint32_t bits_len, uint32_t in_a[],uint32_t in_prime[], + uint32_t result[]); + +/** + * \brief Montgomery inverse operation: (out_x,outk) = in_a ^(-1) * 2 ^ (out_k) mod in_prime, where bits_len <= out_k <= 2*bits_len + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[out] out_x bits_len bit output. + * + * \param[out] out_k output k (13 bits, denoted by a uint32_t variable). + * + * \return + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_montgomery_inverse(uint32_t bits_len, uint32_t in_a[], uint32_t in_prime[], uint32_t constp, uint32_t out_x[]); + +/** + * \brief compute modular exponent for RSA: result = in_a ^(in_b) mod in_prime + * + * \param[in] bits_len RSA number bit width, hardware supports up to 2048 bits + * + * \param[in] in_a the base number of bits_len bits + * + * \param[in] in_b the exponet number of bits_len bits + * + * \param[in] in_prime the modular number + * + * \param[in] r_square R^2 mod in_prime, where R = 2 ^ bits_len. If this field is NULL, the program will interanly + * compute R^2 mod p and constq, at a cost of performance degradation. + * + * \param[in] constq Montgomery multiplication constant of in_prime + * + * \param[out] result in_a ^(in_b) mod in_prime + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_rsa_modular_exponent_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], + uint32_t in_prime[], uint32_t r_square[], uint32_t constq,uint32_t result[]); + +/** + * \brief Montgomery multiply operation: result = in_a * in_b *R^(-1) mod in_prime, where R = 2^bits_len + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_b second input operand (bits_lenbit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[in] constq Montgomery multiplication constant for in_prime, where constq = (-in_prime[0]) ^(-1) mod 2^32 + * + * \param[out] result bits_len bit output. + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_montgomery_mul(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], + uint32_t constq, uint32_t result[]); + +/** + * \brief set ECC Curve type + * + * \param[in] ECC Curve type. + * + */ +ecc_curve_init_t *pkc_set_curve_p256_params(algo_ecc_curve_type_e curve); + +/** + * \brief Set user defined curve + * + * \param[in] curve ECC curve parameters, for NIST-P256 curve, invokers may fill this parameter with NULL + * Note that hal_pkc_init inits NIST-P256 curve, invokers may ignore this API if only use + * NIST-P256 curve. + * For other curves, invokers must fill the curve parameters \ref ecc_curve_parameter_t + * + */ +void hal_set_curve(ecc_curve_init_t * curve); + +/** + * \brief ECC point multiplication operation based on NIST P256 (also known as SECP256R1) curve. + * If secure mode is set(by hal_pkc_init), anti-DPA security measures will be employed, + * at a cost of performance loss (about 25%-35%) + * + * \param[in] k input 256 bit number. + * + * \param[in] Q input ecc point (x:256 bit, y:256 bit). If #Q is null, then Q point is equal G point + * + * \param[out] result output ecc point (x:256 bit, y:256 bit) -- result = k * point + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_ecc_point_mul_handle(uint32_t k[ECC_U32_LENGTH], ecc_point_t *Q, ecc_point_t *result); + +/** + * \brief modular sub operation: result(256 bit) = in_a(256 bit) - in_b(256 bit) mod in_prime(256 bit) + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_b second input operand (bits_len bit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[out] result bits_len bit output. + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_modular_sub_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], + uint32_t result[]); + +/** + * \brief modular add operation: result(256 bit) = in_a(256 bit) + in_b(256 bit) mod in_prime(256 bit) + * + * \param[in] bits_len number bit-length, support 256, 288, 320, ... up to 2048 bits.(32 bits per step) + * + * \param[in] in_a first input operand (bits_len bit). + * + * \param[in] in_b second input operand (bits_len bit). + * + * \param[in] in_prime input prime (bits_len bit). + * + * \param[out] result bits_len bit output. + * + * \return operation status + * \li \ref HAL_ERROR + * \li \ref HAL_OK + */ +hal_status_t hal_pkc_modular_add_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], + uint32_t result[]); + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_PKC_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc_port.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc_port.h new file mode 100644 index 0000000..f6dd0dd --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_pkc_port.h @@ -0,0 +1,64 @@ +/** + **************************************************************************************** + * + * @file crypto_pkc_port.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto PKC library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +#ifndef __CRYPTO_PKC_PORT_H__ +#define __CRYPTO_PKC_PORT_H__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef uint32_t (*pkc_rng_func_ptr)(void); + +void pkc_setbit(uint32_t q[], uint32_t in_prime[], uint32_t k, uint32_t bits_len); +void pkc_zeroize(void *start_address, uint32_t u32_len); +int32_t pkc_number_compare_to_const(uint32_t a[], uint32_t b, uint32_t bits_len); +uint8_t pkc_safe_compare(pkc_rng_func_ptr rng32, uint32_t *src, uint32_t *dest, uint32_t u32_len); +int32_t pkc_number_compare(uint32_t a[], uint32_t b[], uint32_t bits_len); +void pkc_read_oct_string(uint32_t *big_number, uint8_t* buffer, uint32_t byte_size); + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_PKC_PORT_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_rsa.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_rsa.h new file mode 100644 index 0000000..45fd85e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_rsa.h @@ -0,0 +1,203 @@ +/** + **************************************************************************************** + * + * @file crypto_rsa.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto RSA library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup CRYPTO_DRIVER CRYPTO DRIVER + * @{ + */ + +/** @defgroup CRYPTO_RSA RSA + * @brief RSA CRYPTO driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CRYPTO_RSA_H__ +#define __CRYPTO_RSA_H__ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CRYPTO_RSA_MACRO Defines + * @{ + */ + +//#define RSA_OPENSSL_SEQ /**< Open with Openssl sequence.*/ +#define RSA_PKCS1_V21 (1) /**< PKCS1_PSS sign, as defined in PKCS#1_2.1/2.2: same message and private key will produce different result, since random salt is different each time.*/ +#define RSA_PKCS1_V15 (0) /**< PKCS1_V15 sign, same message and private key will produce same result.*/ +#define RSA_U32_LENGTH (64) /** +#include +#include +#include +#include +#include "crypto_rsa.h" + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t hw_rsa_rng32(void); +void hw_rsa_sha(const uint8_t *message, uint32_t message_byte_length, uint8_t output[32]); +void hw_rsa_modular_left_shift(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t shift_bits, + uint32_t result[]); +void hw_rsa_modular_compare(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t result[]); +void rsa_modular_inverse(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t out_a_inverse[]); +void hw_rsa_montgomery_inverse(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t constp, + uint32_t out_x[]); +void hw_rsa_modular_exponent(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t result[]); +void hw_rsa_montgomery_mul(algo_rsa_config_t *rsa_calc_options, + uint32_t bis_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t constp, + uint32_t result[]); +int rsa_safer_memcmp( const void *a, const void *b, size_t n ); + +/** + * \brief compute modular exponent for RSA: out_result = (in_a ^in_b) mod in_prime + * + * \param[in] rsa_config rsa_config \ref algo_rsa_config_t + * + * \param[in] bits_len bit width of modular number of in_prime, supports up to 2048 bits + * + * \param[in] in_a the base number of bits_len bits + * + * \param[in] in_b the exponent number of bits_len bits; + * + * \param[in] in_prime the modular number + * + * \param[in] r_square R^2 mod in_prime, where R = 2 ^ bits_len + * + * \param[in] constp montgomery multiplication constant of in_prime + * + * \param[out] out_result in_a ^(in_b) mod in_prime + * + * \return + * \li \ref RSA_ERROR_PARAMETER : NULL input pointer + * \li \ref RSA_OK + */ +void rsa_modular_exponent(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + uint32_t out_result[]); + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_RSA_PORT_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_sha256.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_sha256.h new file mode 100644 index 0000000..553cc7d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/inc/crypto_sha256.h @@ -0,0 +1,297 @@ +/** + **************************************************************************************** + * + * @file crypto_sha256.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of crypto SHA256 library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2022 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup CRYPTO_DRIVER CRYPTO DRIVER + * @{ + */ + +/** @defgroup CRYPTO_SHA SHA + * @brief SHA CRYPTO driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __CRYPTO_SHA256_H__ +#define __CRYPTO_SHA256_H__ + +/* Includes ------------------------------------------------------------------*/ +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CRYPTO_SHA_MACRO Defines + * @{ + */ + +/** + * @brief SHA256 SIZE + */ +#define SHA256_SIZE 32 +/** + * @brief SHA256 MAX SIZE + */ +#define SHA256_MAX_SIZE 32 +/** + * @brief SHA256 BLOCK SIZE + */ +#define SHA256_BLOCK_SIZE 64 +/** + * @brief HMAC-SHA256 KEY SIZE + */ +#define HMAC_SHA256_KEY_SIZE 32 +/** @} */ + +/** @addtogroup CRYPTO_SHA_CONTEXT_STRUCTURES Structures + * @{ + */ + +/** @defgroup SHA Context Structurs Definition + * @{ + */ + +/** + * @brief This defines the structure of sha256 context. + */ +typedef struct crypto_sha256_context +{ + uint32_t total; /**< The number of Bytes processed. */ + uint32_t block_size; /**< block size. */ + uint8_t *input; /**< input data. */ + void *instance; /**< The sha256 instance. */ +} crypto_sha256_context; +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup CRYPTO_SHA_FUNCTIONS Functions + * @{ + */ + +/** + ******************************************************************************************* + * @brief This function initializes a SHA-256 context. + * + * @param[in] ctx: The SHA-256 context to initialize. This must not be NULL. + * + ******************************************************************************************* + */ +void crypto_sha256_init(crypto_sha256_context *ctx); + +/** + ******************************************************************************************* + * @brief This function clears a SHA-256 context. + * + * @param[in] ctx: The SHA-256 context to clear. This may be NULL, + * in which case this function does nothing. If it + * is not \c NULL, it must point to an initialized + * SHA-256 context. + ******************************************************************************************* + */ +void crypto_sha256_free(crypto_sha256_context *ctx); + +/** + ******************************************************************************************* + * @brief This function clones the state of a SHA-256 context. + * + * @param[out] dst: The destination context. This must be initialized. + * @param[in] src: The context to clone. This must be initialized. + ******************************************************************************************* + */ +void crypto_sha256_clone(crypto_sha256_context *dst, const crypto_sha256_context *src); + +/** + ******************************************************************************************* + * @brief This function starts a SHA-256 calculation. + * + * @param[in] ctx: The SHA-256 context to use. This must be initialized. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_sha256_starts(crypto_sha256_context *ctx); + +/** + ******************************************************************************************* + * @brief This function feeds an input buffer into an ongoing + * SHA-256 calculation. + * + * @param[in] ctx: The SHA-256 context. This must be initialized + * and have a hash operation started. + * @param[in] input: The buffer holding the input data. This must + * be a readable buffer of length \p ilen Bytes. + * @param[in] ilen: The length of the input data in Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_sha256_update(crypto_sha256_context *ctx, const uint8_t *input, size_t ilen); + +/** + ******************************************************************************************* + * @brief This function finishes the SHA-256 operation, and writes + * the result to the output buffer. This function is for + * internal use only. + * + * @param[in] ctx: The SHA-256 context. This must be initialized + * and have a hash operation started. + * @param[out] output: SHA-256 result. + * This must be a writable buffer of length \c 32 Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_sha256_finish(crypto_sha256_context *ctx, uint8_t output[32]); + +/** + ******************************************************************************************* + * @brief This function calculates the SHA-256 into a buffer. + * + * The function allocates the context, performs the + * calculation, and frees the context. + * + * The SHA-256 result is calculated as + * output = SHA-256(input buffer). + * + * @param[in] input: The buffer holding the input data. This must be + * a readable buffer of length \p ilen Bytes. + * @param[in] ilen: The length of the input data in Bytes. + * @param[out] output: SHA-256 result. + * This must be a writable buffer of length \c 32 Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_sha256(const uint8_t *input, size_t ilen, uint8_t output[32]); + +/** + ******************************************************************************************* + * @brief This function starts a HMAC-SHA-256 calculation. + * + * @param[in] ctx: The HMAC-SHA-256 context to use. This must be initialized. + * @param[in] key: The HMAC secret key. + * @param[in] keylen: The length of the HMAC key in Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_hmac_sha256_starts(crypto_sha256_context *ctx, const uint8_t *key, size_t keylen); + +/** + ******************************************************************************************* + * @brief This function feeds an input buffer into an ongoing + * HMAC-SHA-256 calculation. + * + * @param[in] ctx: The HMAC-SHA-256 context. This must be initialized + * and have a hash operation started. + * @param[in] input: The buffer holding the input data. This must + * be a readable buffer of length \p ilen Bytes. + * @param[in] ilen: The length of the input data in Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_hmac_sha256_update(crypto_sha256_context *ctx, const uint8_t *input, size_t ilen); + +/** + ******************************************************************************************* + * @brief This function finishes the HMAC-SHA-256 operation, and + * writes the result to the output buffer. This function is for + * is forinternal use only. + * + * @param[in] ctx: The HMAC-SHA-256 context. This must be initialized + * and have a hash operation started. + * @param[out] output: HMAC-SHA-256 checksum result. + * This must be a writable buffer of length \c 32 Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_hmac_sha256_finish(crypto_sha256_context *ctx, uint8_t output[32]); + +/** + ******************************************************************************************* + * @brief This function calculates the HMAC-SHA-256 into a buffer. + * + * The function allocates the context, performs the + * calculation, and frees the context. + * + * The HMAC-SHA-256 result is calculated as + * output = HMAC-SHA-256(input buffer). + * + * @param[in] key: The HMAC secret key. + * @param[in] keylen: The length of the HMAC key in Bytes. + * @param[in] input: The buffer holding the input data. This must be + * a readable buffer of length \p ilen Bytes. + * @param[in] ilen: The length of the input data in Bytes. + * @param[out] output: HMAC-SHA-256 result. + * This must be a writable buffer of length \c 32 Bytes. + * + * @retval::-1:NULL input pointer. + * @retval::0: execute successfully. + ******************************************************************************************* + */ +int crypto_hmac_sha256(const uint8_t *key, size_t keylen, const uint8_t *input, size_t ilen, uint8_t output[32]); + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __CRYPTO_SHA256_H__ */ + +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_aes.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_aes.c new file mode 100644 index 0000000..41621a6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_aes.c @@ -0,0 +1,615 @@ +#include "crypto_aes.h" +#include "grx_hal.h" + +#define crypto_malloc malloc +#define crypto_free free + +typedef struct +{ + uint8_t seed[AES_BLOCK_SIZE]; + aes_handle_t aes_handle; +} aes_instance_t; + +/* + * AES context init + */ +void crypto_aes_init(crypto_aes_context *ctx) +{ + if (ctx == NULL) + { + return; + } + + memset(ctx, 0x0, sizeof(crypto_aes_context)); + + ctx->instance = crypto_malloc(sizeof(aes_instance_t)); + + if (NULL == ctx->instance) + { + return; + } + + memset(ctx->instance, 0, sizeof(aes_instance_t)); +} + +/* + * AES context free + */ +void crypto_aes_free(crypto_aes_context *ctx) +{ + if (ctx == NULL) + { + return; + } + + if (ctx->instance) + { + crypto_free(ctx->instance); + } +} + +/* + * AES set paddings mode + */ +int crypto_aes_set_paddings(crypto_aes_context *ctx, crypto_aes_padding_t padding_type) +{ + if (ctx == NULL) + { + return -1; + } + ctx->padding_mode = padding_type; + return 0; +} + +static void aes_hardware_reset(void) +{ + CLEAR_BITS(MCU_SUB->SECURITY_RESET, MCU_SUB_SECURITY_RESET_AES); + SET_BITS(MCU_SUB->SECURITY_RESET, MCU_SUB_SECURITY_RESET_AES); +} + +static int crypto_set_aes_key(crypto_aes_context *ctx, uint8_t *key, uint16_t keybits) +{ + int8_t ret = 0; + if (ctx == NULL || key == NULL || ctx->instance == NULL) + { + return -1; + } + + memset(ctx->key, 0, AES_MAX_KEY_SIZE); + memcpy(ctx->key, key, keybits >> 3); + ctx->keybits = keybits; + + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + switch (ctx->keybits) + { + case 128: + p_aes_handle->init.key_size = AES_KEYSIZE_128BITS; + break; + case 192: + p_aes_handle->init.key_size = AES_KEYSIZE_192BITS; + break; + case 256: + p_aes_handle->init.key_size = AES_KEYSIZE_256BITS; + break; + default: + ret = -1; + break; + } + + p_aes_handle->init.p_key = (uint32_t *)ctx->key; + + return ret; +} + +/* + * AES key schedule (encryption) + */ +int crypto_aes_setkey_enc(crypto_aes_context *ctx, uint8_t *key, uint16_t keybits) +{ + return crypto_set_aes_key(ctx, key, keybits); +} + +/* + * AES key schedule (decryption) + */ +int crypto_aes_setkey_dec(crypto_aes_context *ctx, uint8_t *key, uint16_t keybits) +{ + return crypto_set_aes_key(ctx, key, keybits); +} + +/* + * pkcs7 padding + */ +int crypto_aes_pkcs7_padding(uint8_t *input, uint32_t length, uint8_t *output) +{ + if (input == NULL || output == NULL) + { + return -1; + } + + uint32_t out_len = ((length >> 4) + 1) * AES_BLOCK_SIZE; + int padding_value = AES_BLOCK_SIZE - (length & 0xF); + + if (input != output) + { + for (uint32_t i = 0; i < length; i++) + { + output[i] = input[i]; + } + } + + for (uint32_t i = length; i < out_len; i++) + { + output[i] = padding_value; + } + + return out_len; +} + +/* + * zero padding + */ +int crypto_aes_zero_padding(uint8_t *input, uint32_t length, uint8_t *output) +{ + if (input == NULL || output == NULL) + { + return -1; + } + + uint32_t out_len = ((length >> 4) + 1) * AES_BLOCK_SIZE; + + if (input != output) + { + for (uint32_t i = 0; i < length; i++) + { + output[i] = input[i]; + } + } + + for (uint32_t i = length; i < out_len; i++) + { + output[i] = 0; + } + + return out_len; +} + +/* + * get output length + */ +uint32_t crypto_aes_get_output_length(uint32_t length, crypto_aes_padding_t padding_type) +{ + if (PADDING_NONE == padding_type) + { + return length; + } + + return ((length >> 4) + 1) * AES_BLOCK_SIZE; +} + +/* + * AES-ECB buffer encryption/decryption + */ +static int crypto_internal_aes_ecb_crypt(crypto_aes_context *ctx, + uint8_t mode, + uint8_t *input, + uint32_t length, + uint8_t *output) +{ + int ret = 0; + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_ECB; + p_aes_handle->init.p_init_vector = NULL; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + if (mode == AES_ENCRYPT) + { + if (HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)input, length, (uint32_t *)output, 5000)) + { + ret = -1; + goto exit; + } + } + else + { + if (HAL_OK != hal_aes_ecb_decrypt(p_aes_handle, (uint32_t *)input, length, (uint32_t *)output, 5000)) + { + ret = -1; + goto exit; + } + } + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return ret; +} + +/* + * AES-ECB block encryption/decryption + */ +int crypto_aes_crypt_ecb(crypto_aes_context *ctx, uint8_t mode, uint8_t *input, uint32_t length, uint8_t *output) +{ + int ret = 0; + + uint32_t compute_len = 0; + uint8_t padding_len = 0; + + uint8_t padding_temp[AES_BLOCK_SIZE] = {0}; + + uint8_t *p_input = input; + uint8_t *p_output = output; + + if (ctx == NULL || input == NULL || output == NULL || mode > 1 || length == 0) + { + return -1; + } + + compute_len = length & (~0xF); + padding_len = length & 0xF; + + if ((ctx->padding_mode == PADDING_NONE) && padding_len) + { + return -1; + } + + if (0 != crypto_internal_aes_ecb_crypt(ctx, mode, p_input, compute_len, p_output)) + { + return -1; + } + + if (PADDING_NONE == ctx->padding_mode) + { + return 0; + } + + p_input += compute_len; + p_output += compute_len; + + if (PADDING_ZEROS == ctx->padding_mode) + { + crypto_aes_zero_padding(p_input, padding_len, padding_temp); + } + else if (PADDING_PKCS7 == ctx->padding_mode) + { + crypto_aes_pkcs7_padding(p_input, padding_len, padding_temp); + } + else + { + ret = -1; + } + + if (0 != ret) + { + return ret; + } + + if (0 != crypto_internal_aes_ecb_crypt(ctx, mode, padding_temp, AES_BLOCK_SIZE, p_output)) + { + return -1; + } + + return ret; +} + +/* + * AES-CBC buffer encryption/decryption + */ +static int crypto_internal_aes_cbc_crypt(crypto_aes_context *ctx, + uint8_t mode, + uint8_t iv[AES_BLOCK_SIZE], + const uint8_t *input, + uint32_t length, + uint8_t *output) +{ + int ret = 0; + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_CBC; + p_aes_handle->init.p_init_vector = (uint32_t *)iv; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + if (mode == AES_ENCRYPT) + { + if (HAL_OK != hal_aes_cbc_encrypt(p_aes_handle, (uint32_t *)input, length, (uint32_t *)output, 5000)) + { + ret = -1; + goto exit; + } + } + else + { + if (HAL_OK != hal_aes_cbc_decrypt(p_aes_handle, (uint32_t *)input, length, (uint32_t *)output, 5000)) + { + ret = -1; + goto exit; + } + } + + if (mode == AES_ENCRYPT) + { + memcpy(iv, output + length - AES_BLOCK_SIZE, AES_BLOCK_SIZE); + } + else + { + memcpy(iv, input + length - AES_BLOCK_SIZE, AES_BLOCK_SIZE); + } + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return ret; +} + +/* + * AES-CBC buffer encryption/decryption + */ +int crypto_aes_crypt_cbc(crypto_aes_context *ctx, uint8_t mode, uint8_t iv[16], uint8_t *input, uint32_t length, uint8_t *output) +{ + int ret = 0; + + uint32_t compute_len = 0; + uint8_t padding_len = 0; + + uint8_t padding_temp[AES_BLOCK_SIZE] = {0}; + + uint8_t *p_input = input; + uint8_t *p_output = output; + + if (ctx == NULL || input == NULL || output == NULL || mode > 1 || length == 0) + { + return -1; + } + + compute_len = length & (~0xF); + padding_len = length & 0xF; + + if ((ctx->padding_mode == PADDING_NONE) && padding_len) + { + return -1; + } + + if (0 != crypto_internal_aes_cbc_crypt(ctx, mode, iv, p_input, compute_len, p_output)) + { + return -1; + } + + if (PADDING_NONE == ctx->padding_mode) + { + return 0; + } + + p_input += compute_len; + p_output += compute_len; + + if (PADDING_ZEROS == ctx->padding_mode) + { + crypto_aes_zero_padding(p_input, padding_len, padding_temp); + } + else if (PADDING_PKCS7 == ctx->padding_mode) + { + crypto_aes_pkcs7_padding(p_input, padding_len, padding_temp); + } + else + { + ret = -1; + } + + if (0 != ret) + { + return ret; + } + + if (0 != crypto_internal_aes_cbc_crypt(ctx, mode, iv, padding_temp, AES_BLOCK_SIZE, p_output)) + { + return -1; + } + + return ret; +} + +/* + * AES-CTR buffer encryption/decryption + */ +int crypto_aes_crypt_ctr(crypto_aes_context *ctx, uint32_t length, uint32_t *nc_off, + uint8_t nonce_counter[16], uint8_t stream_block[16], const uint8_t *input, uint8_t *output) +{ + int c, i; + size_t n; + + if (ctx == NULL || nc_off == NULL || nonce_counter == NULL || stream_block == NULL || input == NULL || output == NULL) + { + return ( -1 ); + } + + int ret = 0; + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_ECB; + p_aes_handle->init.p_init_vector = NULL; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + n = *nc_off; + + if ( n > 0x0F ) + return ( -1 ); + + while( length-- ) + { + if( n == 0 ) { + if ( HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)nonce_counter, 16, (uint32_t *)stream_block, 5000) ) + { + ret = -1; + goto exit; + } + + for( i = 16; i > 0; i-- ) + if( ++nonce_counter[i - 1] != 0 ) + break; + } + c = *input++; + *output++ = (unsigned char)( c ^ stream_block[n] ); + + n = ( n + 1 ) & 0x0F; + } + + *nc_off = n; + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return( ret ); +} + +/* + * AES-CFB128 buffer encryption/decryption + */ +int crypto_aes_crypt_cfb128(crypto_aes_context *ctx, uint8_t mode, uint32_t length, uint32_t *iv_off, + uint8_t iv[16], const uint8_t *input, uint8_t *output) +{ + int c; + size_t n; + + if (ctx == NULL || mode > 1 || iv_off == NULL || iv == NULL || input == NULL || output == NULL) + { + return ( -1 ); + } + + int ret = 0; + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_ECB; + p_aes_handle->init.p_init_vector = NULL; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + n = *iv_off; + + if( n > 15 ) + return ( -1 ); + + if( mode == AES_DECRYPT ) + { + while( length-- ) + { + if( n == 0 ) + { + if ( HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)iv, 16, (uint32_t *)iv, 5000) ) + { + ret = -1; + goto exit; + } + } + + c = *input++; + *output++ = (unsigned char)( c ^ iv[n] ); + iv[n] = (unsigned char) c; + + n = ( n + 1 ) & 0x0F; + } + } + else + { + while( length-- ) + { + if( n == 0 ) + { + if ( HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)iv, 16, (uint32_t *)iv, 5000) ) + { + ret = -1; + goto exit; + } + } + + iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ ); + + n = ( n + 1 ) & 0x0F; + } + } + + *iv_off = n; + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return( ret ); +} + +/* + * AES-OFB (Output Feedback Mode) buffer encryption/decryption + */ +int crypto_aes_crypt_ofb(crypto_aes_context *ctx, uint32_t length, uint32_t *iv_off, + uint8_t iv[16], const uint8_t *input, uint8_t *output) +{ + int ret = 0; + size_t n; + + if (ctx == NULL || iv_off == NULL || iv == NULL || input == NULL || output == NULL) + { + return ( -1 ); + } + + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_ECB; + p_aes_handle->init.p_init_vector = NULL; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + n = *iv_off; + + if( n > 15 ) + return ( -1 ); + + while( length-- ) + { + if( n == 0 ) + { + if ( HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)iv, 16, (uint32_t *)iv, 5000) ) + { + ret = -1; + goto exit; + } + } + *output++ = *input++ ^ iv[n]; + + n = ( n + 1 ) & 0x0F; + } + + *iv_off = n; + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return( ret ); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc.c new file mode 100644 index 0000000..e177f27 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc.c @@ -0,0 +1,651 @@ +#include "crypto_ecc.h" +#include "crypto_pkc.h" +#include "crypto_pkc_port.h" +#include "crypto_ecc_port.h" + +static bool ecc_is_zero_value(uint32_t *value, uint32_t len) +{ + for (int i = 0; i < len; i++) + { + if (value[i]) + { + return false; + } + } + + return true; +} + +static void ecc_init_config(algo_ecc_config_t *ecc_config, algo_ecc_curve_type_e curve) +{ + if (NULL == ecc_config) + { + return; + } + + ecc_config->curve = (algo_ecc_curve_parameter_t *)pkc_set_curve_p256_params(curve); +} + +void crypto_ecc_ecdsa_init(algo_ecc_ecdsa_config_t *ecdsa_data, algo_ecc_curve_type_e curve) +{ + if (NULL == ecdsa_data) + { + return; + } + + pkc_zeroize((void *)(&ecdsa_data->our_public_point), sizeof(algo_ecc_point_t) / 4); + pkc_zeroize((void *)(&ecdsa_data->our_secret_value), ECC_U32_LENGTH); + pkc_zeroize((void *)(&ecdsa_data->k), ECC_U32_LENGTH); + + ecc_init_config(&ecdsa_data->calc_options, curve); +} + +static void ecc_gen_rng(algo_ecc_config_t *ecc_config, uint32_t out[]) +{ + if (NULL == ecc_config) + { + return; + } + + uint32_t i = 0; + uint32_t *n = (uint32_t *)(ecc_config->curve->n); + + for (i = 0; i < ECC_U32_LENGTH; i++) + { + out[i] = hw_ecc_rng32(); + } + +#if 0 + if (out[ECC_U32_LENGTH - 1] >= n[ECC_U32_LENGTH - 1]) + { + out[ECC_U32_LENGTH - 1] = n[ECC_U32_LENGTH - 1] - 1; + } + + out[0] |= 2; +#else + // since the n defined as big endian + if (out[0] >= n[0]) + { + out[0] = n[0] - 1; + } + + out[ECC_U32_LENGTH - 1] |= 2; +#endif +} + +algo_ecc_ret_e crypto_ecc_ecdsa_gen_secret_and_public(algo_ecc_ecdsa_config_t *ecdsa_data) +{ + + uint32_t i = 0; + uint8_t ret = 0; + + if (NULL == ecdsa_data || NULL == ecdsa_data->calc_options.curve) + { + return ECC_ERROR_PARAMETER; + } + + for (i = 0; i < ECC_U32_LENGTH; i++) + { + if (ecdsa_data->our_secret_value[i] == 0) + { + ecdsa_data->our_secret_value[i] = hw_ecc_rng32(); + ret = 1; + } + } + + // make sure 1 < our_secret_value < n + if (ret == 1) + { + ecc_gen_rng(&ecdsa_data->calc_options, ecdsa_data->our_secret_value); + } + + hw_ecc_point_mul(&ecdsa_data->calc_options, ecdsa_data->our_secret_value, NULL, &ecdsa_data->our_public_point); + return ECC_OK; +} + +// s = (e + r1*d1 + r2 * d2)* ke_inverse + (r1 * d2 + r2 * d1) * ke_inverse +static void secure_calc_signature_s(algo_ecc_config_t *ecc_config, + uint32_t random_r1[ECC_U32_LENGTH], + uint32_t random_d1[ECC_U32_LENGTH], + uint32_t ke[ECC_U32_LENGTH], + uint32_t private_key[ECC_U32_LENGTH], + uint32_t e[ECC_U32_LENGTH], + uint32_t r[ECC_U32_LENGTH], + algo_ecc_curve_parameter_t *ecc_curve, + uint32_t out_sig_s[ECC_U32_LENGTH]) +{ + if (NULL == ecc_config || NULL == random_r1 || NULL == random_d1 || NULL == ke || NULL == private_key || NULL == e || NULL == r || NULL == out_sig_s || NULL == ecc_curve) + { + return; + } + + uint32_t ke_inverse[ECC_U32_LENGTH] = { 0 }; + uint32_t r2[ECC_U32_LENGTH] = { 0 }; + uint32_t d2[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp1[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp2[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp_rd1[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp_rd2[ECC_U32_LENGTH] = { 0 }; + + ecc_modular_inverse(ecc_config, ke, ecc_curve->n, ecc_curve->n_r_square, ecc_curve->constn, ke_inverse); + + // calc d2 = d - d1 + hw_ecc_modular_sub(ecc_config, private_key, random_d1, ecc_curve->n, d2); + + // calc r2 = r - r1 + hw_ecc_modular_sub(ecc_config, r, random_r1, ecc_curve->n, r2); + + // calc tmp_rd1 = r1 * d1 + hw_ecc_montgomery_mul(ecc_config, random_r1, random_d1, ecc_curve->n, ecc_curve->constn, tmp_rd1); + hw_ecc_montgomery_mul(ecc_config, tmp_rd1, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp_rd1); + + // calc tmp_rd2 = r2 * d2 + hw_ecc_montgomery_mul(ecc_config, r2, d2, ecc_curve->n, ecc_curve->constn, tmp_rd2); + hw_ecc_montgomery_mul(ecc_config, tmp_rd2, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp_rd2); + + // calc tmp1 = e + r1d1 + r2d2 + hw_ecc_modular_add(ecc_config, e, tmp_rd1, ecc_curve->n, tmp1); + hw_ecc_modular_add(ecc_config, tmp1, tmp_rd2, ecc_curve->n, tmp1); + + // calc tmp1 = (e + r1d1 + r2d2) * ke_inverse + hw_ecc_montgomery_mul(ecc_config, tmp1, ke_inverse, ecc_curve->n, ecc_curve->constn, tmp1); + hw_ecc_montgomery_mul(ecc_config, tmp1, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp1); + + ////Next Step. + // calc tmp_rd1 = r1 * d2 + hw_ecc_montgomery_mul(ecc_config, random_r1, d2, ecc_curve->n, ecc_curve->constn, tmp_rd1); + hw_ecc_montgomery_mul(ecc_config, tmp_rd1, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp_rd1); + + // calc tmp_rd2 = r2 * d1 + hw_ecc_montgomery_mul(ecc_config, r2, random_d1, ecc_curve->n, ecc_curve->constn, tmp_rd2); + hw_ecc_montgomery_mul(ecc_config, tmp_rd2, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp_rd2); + + // calc tmp2 = r1d1 + r2d2 + hw_ecc_modular_add(ecc_config, tmp_rd1, tmp_rd2, ecc_curve->n, tmp2); + + // calc tmp2 = (r1d2 + r2d1) * ke_inverse + hw_ecc_montgomery_mul(ecc_config, tmp2, ke_inverse, ecc_curve->n, ecc_curve->constn, tmp2); + hw_ecc_montgomery_mul(ecc_config, tmp2, ecc_curve->n_r_square, ecc_curve->n, ecc_curve->constn, tmp2); + + ////Final Step. + // calc s = tmp1 + tmp2 + hw_ecc_modular_add(ecc_config, tmp1, tmp2, ecc_curve->n, out_sig_s); +} + +static algo_ecc_ret_e ecc_ecdsa_sign_with_hash(algo_ecc_ecdsa_config_t *ecdsa_calc_options, + uint8_t *message_hash, + uint32_t out_signiture_r[ECC_U32_LENGTH], + uint32_t out_signiture_s[ECC_U32_LENGTH]) +{ + algo_ecc_ret_e err = ECC_OK; + uint32_t ke[ECC_U32_LENGTH] = { 0 }; + algo_ecc_point_t R = { { 0 }, { 0 } }; + uint32_t message_hash_bignumber[ECC_U32_LENGTH] = { 0 }; + uint32_t s1[ECC_U32_LENGTH] = { 0 }; + uint32_t s2[ECC_U32_LENGTH] = { 0 }; + uint32_t ke_backup[ECC_U32_LENGTH] = { 0 }; + algo_ecc_curve_parameter_t *ecc_curve = NULL; + uint32_t temp = 0; + + if (NULL == ecdsa_calc_options) + { + return ECC_ERROR_PARAMETER; + } + + ecc_curve = (ecdsa_calc_options->calc_options.curve); + + if (NULL == ecc_curve || NULL == message_hash || NULL == out_signiture_r || NULL == out_signiture_s) + { + return ECC_ERROR_PARAMETER; + } + + pkc_read_oct_string((uint32_t *)message_hash_bignumber, message_hash, ECC_U32_LENGTH * 4); + + for (int i = 0; i < (ECC_U32_LENGTH/2); i++) + { + temp = message_hash_bignumber[i]; + message_hash_bignumber[i] = message_hash_bignumber[ECC_U32_LENGTH - 1 - i]; + message_hash_bignumber[ECC_U32_LENGTH - 1 - i] = temp; + } + + do + { + uint32_t random_r1[ECC_U32_LENGTH] = { 0 }; + uint32_t random_d1[ECC_U32_LENGTH] = { 0 }; + uint32_t random_r2[ECC_U32_LENGTH] = { 0 }; + uint32_t random_d2[ECC_U32_LENGTH] = { 0 }; + + if (ecc_is_zero_value(ecdsa_calc_options->k, ECC_U32_LENGTH)) + { + // not indicate a k value, we random generate + ecc_gen_rng(&ecdsa_calc_options->calc_options, ecdsa_calc_options->k); + memcpy(ke, ecdsa_calc_options->k, ECC_U32_LENGTH * 4); + } + + memcpy(ke_backup, ke, ECC_U32_LENGTH * 4); + + // Step 1 Gen ke = SHA(message_hash || private_key || "ECDSA_SIGN_KEY"); + + ecc_gen_rng(&ecdsa_calc_options->calc_options, random_r1); + ecc_gen_rng(&ecdsa_calc_options->calc_options, random_d1); + ecc_gen_rng(&ecdsa_calc_options->calc_options, random_r2); + ecc_gen_rng(&ecdsa_calc_options->calc_options, random_d2); + + // step 2. calc R = ke * G + hw_ecc_point_mul(&ecdsa_calc_options->calc_options, ke, NULL, &R); + + hw_ecc_modular_compare(&ecdsa_calc_options->calc_options, R.x, ecc_curve->n, out_signiture_r); // print_ecc_data("R.x",R.x); + + hw_ecc_modular_compare( + &ecdsa_calc_options->calc_options, message_hash_bignumber, ecc_curve->n, message_hash_bignumber); + + secure_calc_signature_s( + &ecdsa_calc_options->calc_options, random_r1, random_d1, ke, ecdsa_calc_options->our_secret_value, message_hash_bignumber, out_signiture_r, ecc_curve, s1); + + memcpy(ke, ke_backup, ECC_U32_LENGTH * 4); + secure_calc_signature_s( + &ecdsa_calc_options->calc_options, random_r2, random_d2, ke, ecdsa_calc_options->our_secret_value, message_hash_bignumber, out_signiture_r, ecc_curve, s2); + + if (pkc_safe_compare(hw_ecc_rng32, s1, s2, ECC_U32_LENGTH) == 0) + { + err = ECC_OK; + } + else + { + err = ECC_ERROR_SIGN; + break; + } + // compare s, 0; + if (pkc_number_compare_to_const(s1, 0, 256) == 0) + { + err = ECC_ERROR_SIGN; + break; + } + + memcpy(out_signiture_s, s1, ECC_U32_LENGTH * 4); + + } while (0); + + if (ECC_OK != err) + { + pkc_zeroize((void *)out_signiture_s, ECC_U32_LENGTH); + pkc_zeroize((void *)out_signiture_r, ECC_U32_LENGTH); + pkc_zeroize((void *)ke, ECC_U32_LENGTH); + pkc_zeroize((void *)ke_backup, ECC_U32_LENGTH); + } + + pkc_zeroize((void *)s1, ECC_U32_LENGTH); + pkc_zeroize((void *)s2, ECC_U32_LENGTH); + + return err; +} + +algo_ecc_ret_e crypto_ecc_ecdsa_sign(algo_ecc_ecdsa_config_t *ecdsa_calc_options, + uint8_t hash_func, + uint8_t *message, + uint32_t message_byte_length, + uint32_t out_signiture_r[ECC_U32_LENGTH], + uint32_t out_signiture_s[ECC_U32_LENGTH]) +{ + + uint8_t hash[ECC_U32_LENGTH * 4] = { 0 }; + + if (NULL == ecdsa_calc_options || NULL == message) + { + return ECC_ERROR_PARAMETER; + } + + switch (hash_func) + { + case ECC_HASH_NONE: + memcpy(hash, message, message_byte_length); + break; + case ECC_HASH_SHA_256: + hw_ecc_sha(message, message_byte_length, (uint8_t *)hash); + break; + default: + return ECC_ERROR_PARAMETER; + } + + return ecc_ecdsa_sign_with_hash(ecdsa_calc_options, hash, out_signiture_r, out_signiture_s); +} + +static algo_ecc_ret_e ecc_is_point_on_curve(algo_ecc_config_t *ecc_calc_options, algo_ecc_point_t *Q) +{ + + uint32_t xr[ECC_U32_LENGTH] = { 0 }; + uint32_t yr[ECC_U32_LENGTH] = { 0 }; + uint32_t x3[ECC_U32_LENGTH] = { 0 }; + uint32_t ax[ECC_U32_LENGTH] = { 0 }; + uint32_t x3_ax_b[ECC_U32_LENGTH] = { 0 }; + uint32_t y2[ECC_U32_LENGTH] = { 0 }; + algo_ecc_curve_parameter_t *ecc_curve = NULL; + + if (NULL == ecc_calc_options && NULL == ecc_calc_options->curve && NULL == Q) + { + return ECC_ERROR_PARAMETER; + } + ecc_curve = ecc_calc_options->curve; + + // To montgomery field + hw_ecc_montgomery_mul(ecc_calc_options, Q->x, ecc_curve->p_r_square, ecc_curve->p, ecc_curve->constp, xr); + hw_ecc_montgomery_mul(ecc_calc_options, Q->y, ecc_curve->p_r_square, ecc_curve->p, ecc_curve->constp, yr); + + // calc x^3 + ax + b + hw_ecc_montgomery_mul(ecc_calc_options, xr, xr, ecc_curve->p, ecc_curve->constp, x3); + hw_ecc_montgomery_mul(ecc_calc_options, x3, xr, ecc_curve->p, ecc_curve->constp, x3); + hw_ecc_montgomery_mul(ecc_calc_options, xr, ecc_curve->a, ecc_curve->p, ecc_curve->constp, ax); + hw_ecc_modular_add(ecc_calc_options, x3, ax, ecc_curve->p, x3_ax_b); + hw_ecc_modular_add(ecc_calc_options, x3_ax_b, ecc_curve->b, ecc_curve->p, x3_ax_b); + + // calc y^2 + hw_ecc_montgomery_mul(ecc_calc_options, yr, yr, ecc_curve->p, ecc_curve->constp, y2); + + if (pkc_number_compare(x3_ax_b, y2, 256) == 0) + { + return ECC_OK; + } + + return ECC_ERROR_POINT_NOT_ON_CURVE; +} + +static void ecc_point_addition(algo_ecc_config_t *ecc_config, + algo_ecc_point_t *pointA, + algo_ecc_point_t *pointB, + algo_ecc_point_t *out_result) +{ + + uint32_t s[ECC_U32_LENGTH] = { 0 }; + uint32_t temp[ECC_U32_LENGTH] = { 0 }; + uint32_t temp2[ECC_U32_LENGTH] = { 0 }; + uint32_t temp3[ECC_U32_LENGTH] = { 0 }; + + if (NULL == ecc_config) + { + return; + } + + algo_ecc_curve_parameter_t *ecc_curve = (algo_ecc_curve_parameter_t *)(ecc_config->curve); + + // check input parameters + if (NULL == pointA || NULL == pointB || NULL == out_result || NULL == ecc_curve) + { + return; + } + + if (ecc_is_infinite_point(pointA)) + { + memcpy(out_result, pointB, sizeof(algo_ecc_point_t)); + return; + } + + if (ecc_is_infinite_point(pointB)) + { + memcpy(out_result, pointA, sizeof(algo_ecc_point_t)); + return; + } + + if (memcmp(pointA, pointB, sizeof(algo_ecc_point_t)) == 0) + { + if (pkc_number_compare_to_const(pointA->y, 0, 256) == 0) + { + // point of infinite + memset(out_result, 0, sizeof(algo_ecc_point_t)); + return; + } + else + { + // s = (3*(x1^2) + a)/(2*y1) mod p + uint32_t tmp[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp_backup[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp2[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp3[ECC_U32_LENGTH] = { 0 }; + uint32_t number2[ECC_U32_LENGTH] = { 2, 0, 0, 0, 0, 0, 0, 0 }; + uint32_t number3[ECC_U32_LENGTH] = { 3, 0, 0, 0, 0, 0, 0, 0 }; + + // calc tmp = x1 ^ 2 + ecc_modular_multiply( + ecc_config, pointA->x, pointA->x, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, tmp); + + // calc tmp2 = 3 * tmp = 3*(x1^2) + ecc_modular_multiply( + ecc_config, number3, tmp, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, tmp2); + + // calc tmp3 = tmp2 + a = tmp2 - 3 = 3*(x1^2) - 3; + hw_ecc_modular_sub(ecc_config, tmp2, number3, ecc_curve->p, tmp3); + + // calc tmp = 2* y1; + ecc_modular_multiply( + ecc_config, number2, pointA->y, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, tmp); + + // calc tmp2 = tmp ^(-1) = (2y1)^(-1); + memcpy(tmp_backup, tmp, 32); + ecc_modular_inverse(ecc_config, tmp, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, tmp2); + memcpy(tmp, tmp_backup, 32); + + // calc s = tmp3 * tmp2; + ecc_modular_multiply(ecc_config, tmp3, tmp2, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, s); + } + } + else + { + // point addition: s = (y2-y1)/(x2-x1) + if (memcmp(pointA->x, pointB->x, sizeof(algo_ecc_point_t)) == 0) + { + // return point of infinite + memset(out_result, 0, sizeof(algo_ecc_point_t)); + return; + } + else + { + // s = (y2-y1)/(x2-x1) mod p + uint32_t tmp[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp2[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp3[ECC_U32_LENGTH] = { 0 }; + + // tmp = y2-y1; + hw_ecc_modular_sub(ecc_config, pointB->y, pointA->y, ecc_curve->p, tmp); + + // tmp2 = x2-x1; + hw_ecc_modular_sub(ecc_config, pointB->x, pointA->x, ecc_curve->p, tmp2); + + // tmp3 = tmp2 ^(-1) = (x2-x1)^(-1); + ecc_modular_inverse(ecc_config, tmp2, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, tmp3); + + // s = tmp * tmp3 = (y2-y1)*((x2-x1)^(-1)) + ecc_modular_multiply(ecc_config, tmp, tmp3, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, s); + } + } + + // calc (x3,y3) + // x3 = s^2 - x1 - x2; + // y3 = s(x1-x3) - y1 + // temp = s^2 + ecc_modular_multiply(ecc_config, s, s, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, temp); + + // temp2 = temp - x1; + hw_ecc_modular_sub(ecc_config, temp, pointA->x, ecc_curve->p, temp2); + + // x3 = temp2 - x2; + hw_ecc_modular_sub(ecc_config, temp2, pointB->x, ecc_curve->p, out_result->x); + + // temp3 = x1 - x3; + hw_ecc_modular_sub(ecc_config, pointA->x, out_result->x, ecc_curve->p, temp3); + + // temp2 = s * temp3 = s(x1-x3); + ecc_modular_multiply(ecc_config, s, temp3, ecc_curve->p, ecc_curve->p_r_square, ecc_curve->constp, temp2); + + // y3 = temp2 - y1 = s(x1-x3) - y1; + hw_ecc_modular_sub(ecc_config, temp2, pointA->y, ecc_curve->p, out_result->y); +} + +static algo_ecc_ret_e ecc_ecdsa_verify_with_hash(algo_ecc_ecdsa_config_t *ecdsa_calc_options, + uint8_t *message_hash, + uint32_t in_signiture_r[ECC_U32_LENGTH], + uint32_t in_signiture_s[ECC_U32_LENGTH]) +{ + algo_ecc_ret_e err = ECC_OK; + uint32_t t2[ECC_U32_LENGTH] = { 0 }; + uint32_t tmp_rd1[ECC_U32_LENGTH] = { 0 }; + uint32_t u1[ECC_U32_LENGTH] = { 0 }; + uint32_t u2[ECC_U32_LENGTH] = { 0 }; + uint32_t r[ECC_U32_LENGTH] = { 0 }; + uint32_t s[ECC_U32_LENGTH] = { 0 }; + uint32_t x[ECC_U32_LENGTH] = { 0 }; + uint32_t message_hash_bignumber[ECC_U32_LENGTH] = { 0 }; + algo_ecc_point_t A = { { 0 }, { 0 } }; + algo_ecc_point_t u1G = { { 0 }, { 0 } }; + algo_ecc_point_t u2Q = { { 0 }, { 0 } }; + uint32_t temp = 0; + + if (NULL == ecdsa_calc_options) + { + return ECC_ERROR_PARAMETER; + } + algo_ecc_curve_parameter_t *ecc_curve = ecdsa_calc_options->calc_options.curve; + + if (NULL == ecc_curve || NULL == in_signiture_r || NULL == in_signiture_s) + { + return ECC_ERROR_PARAMETER; + } + pkc_read_oct_string((uint32_t *)message_hash_bignumber, (uint8_t *)message_hash, ECC_U32_LENGTH * 4); + for (int i = 0; i < (ECC_U32_LENGTH/2); i++) + { + temp = message_hash_bignumber[i]; + message_hash_bignumber[i] = message_hash_bignumber[ECC_U32_LENGTH - 1 - i]; + message_hash_bignumber[ECC_U32_LENGTH - 1 - i] = temp; + } + + do + { + hw_ecc_modular_compare(&ecdsa_calc_options->calc_options, in_signiture_r, ecc_curve->n, r); + hw_ecc_modular_compare(&ecdsa_calc_options->calc_options, in_signiture_s, ecc_curve->n, s); + + if (pkc_number_compare_to_const(in_signiture_r, 0, 256) == 0) + { + err = ECC_ERROR_VERIFY; + break; + } + + hw_ecc_modular_compare( + &ecdsa_calc_options->calc_options, message_hash_bignumber, ecc_curve->n, tmp_rd1); + + ecc_modular_inverse(&ecdsa_calc_options->calc_options, s, ecc_curve->n, ecc_curve->n_r_square, ecc_curve->constn, t2); + + ecc_modular_multiply( + &ecdsa_calc_options->calc_options, tmp_rd1, t2, ecc_curve->n, ecc_curve->n_r_square, ecc_curve->constn, u1); + + ecc_modular_multiply(&ecdsa_calc_options->calc_options, r, t2, ecc_curve->n, ecc_curve->n_r_square, ecc_curve->constn, u2); + + hw_ecc_point_mul(&ecdsa_calc_options->calc_options, u1, NULL, &u1G); + + if (ecc_is_point_on_curve(&ecdsa_calc_options->calc_options, &u1G) != ECC_OK) + { + + return ECC_ERROR_POINT_NOT_ON_CURVE; + } + + hw_ecc_point_mul(&ecdsa_calc_options->calc_options, u2, &ecdsa_calc_options->our_public_point, &u2Q); + + if (ecc_is_point_on_curve(&ecdsa_calc_options->calc_options, &u2Q) != ECC_OK) + { + return ECC_ERROR_POINT_NOT_ON_CURVE; + } + + ecc_point_addition(&ecdsa_calc_options->calc_options, &u1G, &u2Q, &A); + + hw_ecc_modular_compare(&ecdsa_calc_options->calc_options, A.x, ecc_curve->n, x); + + if (ecc_is_point_on_curve(&ecdsa_calc_options->calc_options, &A) != ECC_OK) + { + return ECC_ERROR_POINT_NOT_ON_CURVE; + } + + if (pkc_number_compare(x, r, 256) != 0) + { + return ECC_ERROR_VERIFY; + } + } while (0); + + return err; +} + +algo_ecc_ret_e crypto_ecc_ecdsa_verify(algo_ecc_ecdsa_config_t *ecdsa_calc_options, + uint8_t hash_func, + uint8_t *message, + uint32_t message_byte_length, + uint32_t in_signiture_r[ECC_U32_LENGTH], + uint32_t in_signiture_s[ECC_U32_LENGTH]) +{ + + uint8_t e[ECC_U32_LENGTH * 4] = { 0 }; + if (NULL == ecdsa_calc_options || NULL == message) + { + return ECC_ERROR_PARAMETER; + } + + switch (hash_func) + { + case ECC_HASH_NONE: + memcpy(e, message, message_byte_length); + break; + case ECC_HASH_SHA_256: + hw_ecc_sha(message, message_byte_length, (uint8_t *)e); + break; + default: + return ECC_ERROR_PARAMETER; + } + + return ecc_ecdsa_verify_with_hash(ecdsa_calc_options, e, in_signiture_r, in_signiture_s); +} + +void crypto_ecc_ecdh_init(algo_ecc_ecdh_config_t *ecdh_data, algo_ecc_curve_type_e curve) +{ + if (NULL == ecdh_data) + { + return; + } + + pkc_zeroize((void *)(&ecdh_data->our_public_point), sizeof(algo_ecc_point_t) / 4); + pkc_zeroize((void *)(&ecdh_data->peer_public_point), sizeof(algo_ecc_point_t) / 4); + pkc_zeroize((void *)(&ecdh_data->shared_point), sizeof(algo_ecc_point_t) / 4); + pkc_zeroize((void *)(&ecdh_data->our_secret_value), ECC_U32_LENGTH); + + ecc_init_config(&ecdh_data->calc_options, curve); +} + +algo_ecc_ret_e crypto_ecc_ecdh_gen_secret_and_public(algo_ecc_ecdh_config_t *ecdh_data) +{ + if (NULL == ecdh_data || NULL == ecdh_data->calc_options.curve) + { + return ECC_ERROR_PARAMETER; + } + + // make sure 1 < our_secret_value < n + ecc_gen_rng(&ecdh_data->calc_options, ecdh_data->our_secret_value); + + hw_ecc_point_mul( + &ecdh_data->calc_options, ecdh_data->our_secret_value, NULL, &ecdh_data->our_public_point); + + return ECC_OK; +} + +algo_ecc_ret_e crypto_ecc_ecdh_compute_shared(algo_ecc_ecdh_config_t *ecdh_data, algo_ecc_point_t *qb) +{ + + if (NULL == ecdh_data || NULL == ecdh_data->calc_options.curve || NULL == qb) + { + return ECC_ERROR_PARAMETER; + } + + if (ecc_is_point_on_curve(&ecdh_data->calc_options, qb) != ECC_OK) + { + return ECC_ERROR_POINT_NOT_ON_CURVE; + } + + memcpy(&ecdh_data->peer_public_point, qb, sizeof(algo_ecc_point_t)); + + hw_ecc_point_mul( + &ecdh_data->calc_options, ecdh_data->our_secret_value, &ecdh_data->peer_public_point, &ecdh_data->shared_point); + return ECC_OK; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc_port.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc_port.c new file mode 100644 index 0000000..1a4f265 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_ecc_port.c @@ -0,0 +1,192 @@ +#include "crypto_ecc_port.h" +#include "crypto_pkc.h" +#include "crypto_pkc_port.h" +#include "crypto_sha256.h" +#include "grx_hal.h" + +uint32_t hw_ecc_rng32(void) +{ + uint32_t rng32; + rng_handle_t g_rng_handle; + + g_rng_handle.p_instance = RNG; + g_rng_handle.init.seed_mode = RNG_SEED_FR0_S0; + g_rng_handle.init.lfsr_mode = RNG_LFSR_MODE_59BIT; + g_rng_handle.init.out_mode = RNG_OUTPUT_FR0_S0; + g_rng_handle.init.post_mode = RNG_POST_PRO_NOT; + + hal_rng_deinit(&g_rng_handle); + hal_rng_init(&g_rng_handle); + hal_rng_generate_random_number(&g_rng_handle, NULL, &rng32); + hal_rng_deinit(&g_rng_handle); + return rng32; +} + +void hw_ecc_point_mul(algo_ecc_config_t *ecc_calc_options, + uint32_t k[ECC_U32_LENGTH], + algo_ecc_point_t *Q, + algo_ecc_point_t *result) +{ + + hal_status_t err = HAL_OK; + ecc_curve_init_t *ecc_curve = (ecc_curve_init_t *)ecc_calc_options->curve; + + hal_set_curve(ecc_curve); + + err = hal_pkc_ecc_point_mul_handle(k, (ecc_point_t *)Q, (ecc_point_t *)result); + + if (HAL_OK != err) + { +// printf("hw_ecc_point_mul error %d\n", __LINE__); + } +} + +void hw_ecc_sha(const uint8_t *message, uint32_t message_byte_length, uint8_t output[32]) +{ + crypto_sha256_context config = { 0 }; + crypto_sha256_init(&config); + crypto_sha256_starts(&config); + crypto_sha256_update(&config, (uint8_t *)message, message_byte_length); + crypto_sha256_finish(&config, output); + crypto_sha256_free(&config); +} + +void hw_ecc_modular_compare(algo_ecc_config_t *ecc_calc_options, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t result[]) +{ + + hal_status_t err = HAL_OK; + + err = hal_pkc_modular_compare_handle(256, in_a, in_prime, result); + + if (HAL_OK != err) + { +// printf("hw_ecc_modular_compare error %d\n", __LINE__); + } +} + +// modular inverse +// output is a^(-1) +void ecc_modular_inverse( + algo_ecc_config_t *ecc_config, uint32_t in_a[], uint32_t in_prime[], uint32_t r_square[], uint32_t constq, uint32_t out_a_inverse[]) +{ + // check if input a = 0 + if (pkc_number_compare_to_const(in_a, 0, 256) == 0) + { + return; + } + + if ((in_prime[0] & 1) == 0) + { + return; + } + + hw_ecc_montgomery_inverse(ecc_config, in_a, in_prime, constq, out_a_inverse); +} + +void hw_ecc_montgomery_inverse( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_prime[], uint32_t constp, uint32_t out_x[]) +{ + + hal_status_t err = HAL_OK; + + err = hal_pkc_montgomery_inverse(256, in_a, in_prime, constp, out_x); + + if (HAL_OK != err) + { +// printf("hw_ecc_montgomery_inverse error %d\n", __LINE__); + } +} + +void hw_ecc_modular_sub( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]) +{ + hal_status_t err = HAL_OK; + + err = hal_pkc_modular_sub_handle(256, in_a, in_b, in_prime, result); + + if (HAL_OK != err) + { +// printf("hw_ecc_modular_sub error %d\n", __LINE__); + } +} + +void hw_ecc_montgomery_mul(algo_ecc_config_t *ecc_calc_options, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t constp, + uint32_t result[]) +{ + hal_status_t err = HAL_OK; + + err = hal_pkc_montgomery_mul(256, in_a, in_b, in_prime, constp, result); + + if (HAL_OK != err) + { +// printf("hw_eccmontgomery_mul error %d\n", __LINE__); + } +} + +void hw_ecc_modular_add( + algo_ecc_config_t *ecc_calc_options, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]) +{ + hal_status_t err = HAL_OK; + + err = hal_pkc_modular_add_handle(256, in_a, in_b, in_prime, result); + + if (HAL_OK != err) + { +// printf("hw_ecc_modular_add error %d\n", __LINE__); + } +} + +// c = a * b mod prime +void ecc_modular_multiply(algo_ecc_config_t *ecc_config, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t out_result[]) +{ + //algo_ecc_ret_e err = ECC_OK; + uint32_t tmp[64] = { 0 }; + + hw_ecc_montgomery_mul(ecc_config, in_a, in_b, in_prime, constq, tmp); + + hw_ecc_montgomery_mul(ecc_config, tmp, r_square, in_prime, constq, out_result); +} + +/** + * \brief check if point is an infinite point + * + * \param[in] point input point. + * + * \return + * \li 0 Not inifinte point + * \li 1 is infinite point + */ +uint32_t ecc_is_infinite_point(algo_ecc_point_t *point) +{ + + uint32_t i = 0; + + if (NULL == point) + { + return (uint32_t)ECC_ERROR_PARAMETER; + } + + for (i = 0; i < ECC_U32_LENGTH; i++) + { + + if (point->x[i] != 0 || point->y[i] != 0) + { + return 0; + } + } + + return 1; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_gcm.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_gcm.c new file mode 100644 index 0000000..23f42db --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_gcm.c @@ -0,0 +1,444 @@ +#include "crypto_gcm.h" +#include "grx_hal.h" + +#define GET_UINT32_BE(n,b,i) \ +{ \ + (n) = ( (uint32_t) (b)[(i) ] << 24 ) \ + | ( (uint32_t) (b)[(i) + 1] << 16 ) \ + | ( (uint32_t) (b)[(i) + 2] << 8 ) \ + | ( (uint32_t) (b)[(i) + 3] ); \ +} + +#define PUT_UINT32_BE(n,b,i) \ +{ \ + (b)[(i) ] = (uint8_t ) ( (n) >> 24 ); \ + (b)[(i) + 1] = (uint8_t) ( (n) >> 16 ); \ + (b)[(i) + 2] = (uint8_t) ( (n) >> 8 ); \ + (b)[(i) + 3] = (uint8_t) ( (n) ); \ +} + +typedef struct +{ + uint8_t seed[AES_BLOCK_SIZE]; + aes_handle_t aes_handle; +} aes_instance_t; + +/* + * Shoup's method for multiplication use this table with + * last4[x] = x times P^128 + * where x and last4[x] are seen as elements of GF(2^128) as in [MGV] + */ +static const uint64_t last4[16] = +{ + 0x0000, 0x1c20, 0x3840, 0x2460, + 0x7080, 0x6ca0, 0x48c0, 0x54e0, + 0xe100, 0xfd20, 0xd940, 0xc560, + 0x9180, 0x8da0, 0xa9c0, 0xb5e0 +}; + +static void aes_hardware_reset(void) +{ + CLEAR_BITS(MCU_SUB->SECURITY_RESET, MCU_SUB_SECURITY_RESET_AES); + SET_BITS(MCU_SUB->SECURITY_RESET, MCU_SUB_SECURITY_RESET_AES); +} + +void crypto_gcm_init( crypto_gcm_context *ctx ) +{ + if (ctx == NULL) + { + return; + } + + memset( ctx, 0, sizeof( crypto_gcm_context ) ); + crypto_aes_init( &ctx->cipher_ctx ); +} + +/* + * Precompute small multiples of H, that is set + * HH[i] || HL[i] = H times i, + * where i is seen as a field element as in [MGV], ie high-order bits + * correspond to low powers of P. The result is stored in the same way, that + * is the high-order bit of HH corresponds to P^0 and the low-order bit of HL + * corresponds to P^127. + */ +static int gcm_gen_table( crypto_gcm_context *ctx ) +{ + int ret, i, j; + uint64_t hi, lo; + uint64_t vl, vh; + unsigned char h[16]; + + memset( h, 0, 16 ); + if( ( ret = crypto_aes_crypt_ecb(&ctx->cipher_ctx, AES_ENCRYPT, h, 16, h) ) != 0 ) + return( ret ); + + /* pack h as two 64-bits ints, big-endian */ + GET_UINT32_BE( hi, h, 0 ); + GET_UINT32_BE( lo, h, 4 ); + vh = (uint64_t) hi << 32 | lo; + + GET_UINT32_BE( hi, h, 8 ); + GET_UINT32_BE( lo, h, 12 ); + vl = (uint64_t) hi << 32 | lo; + + /* 8 = 1000 corresponds to 1 in GF(2^128) */ + ctx->HL[8] = vl; + ctx->HH[8] = vh; + + /* 0 corresponds to 0 in GF(2^128) */ + ctx->HH[0] = 0; + ctx->HL[0] = 0; + + for( i = 4; i > 0; i >>= 1 ) + { + uint32_t T = ( vl & 1 ) * 0xe1000000U; + vl = ( vh << 63 ) | ( vl >> 1 ); + vh = ( vh >> 1 ) ^ ( (uint64_t) T << 32); + + ctx->HL[i] = vl; + ctx->HH[i] = vh; + } + + for( i = 2; i <= 8; i *= 2 ) + { + uint64_t *HiL = ctx->HL + i, *HiH = ctx->HH + i; + vh = *HiH; + vl = *HiL; + for( j = 1; j < i; j++ ) + { + HiH[j] = vh ^ ctx->HH[j]; + HiL[j] = vl ^ ctx->HL[j]; + } + } + + return( 0 ); +} + +int crypto_gcm_setkey( crypto_gcm_context *ctx, const uint8_t *key, uint32_t keybits ) +{ + int ret = 0; + + if (ctx == NULL || key == NULL || ctx->cipher_ctx.instance == NULL) + { + return( -1 ); + } + + if( ( ret = crypto_aes_setkey_enc(&ctx->cipher_ctx, (uint8_t *)key, keybits) ) != 0 ) + { + return( ret ); + } + + if( ( ret = gcm_gen_table( ctx ) ) != 0 ) + return( ret ); + + return( 0 ); +} + +/* + * Sets output to x times H using the precomputed tables. + * x and output are seen as elements of GF(2^128) as in [MGV]. + */ +static void gcm_mult( crypto_gcm_context *ctx, const uint8_t x[16], uint8_t output[16] ) +{ + int i = 0; + unsigned char lo, hi, rem; + uint64_t zh, zl; + + lo = x[15] & 0xf; + + zh = ctx->HH[lo]; + zl = ctx->HL[lo]; + + for( i = 15; i >= 0; i-- ) + { + lo = x[i] & 0xf; + hi = ( x[i] >> 4 ) & 0xf; + + if( i != 15 ) + { + rem = (unsigned char) zl & 0xf; + zl = ( zh << 60 ) | ( zl >> 4 ); + zh = ( zh >> 4 ); + zh ^= (uint64_t) last4[rem] << 48; + zh ^= ctx->HH[lo]; + zl ^= ctx->HL[lo]; + + } + + rem = (unsigned char) zl & 0xf; + zl = ( zh << 60 ) | ( zl >> 4 ); + zh = ( zh >> 4 ); + zh ^= (uint64_t) last4[rem] << 48; + zh ^= ctx->HH[hi]; + zl ^= ctx->HL[hi]; + } + + PUT_UINT32_BE( zh >> 32, output, 0 ); + PUT_UINT32_BE( zh, output, 4 ); + PUT_UINT32_BE( zl >> 32, output, 8 ); + PUT_UINT32_BE( zl, output, 12 ); +} + +int crypto_gcm_starts( crypto_gcm_context *ctx, int mode, const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len ) +{ + int ret = 0; + uint8_t work_buf[16]; + uint32_t i; + const uint8_t *p; + uint32_t use_len = 0; + + if (ctx == NULL || iv == NULL || (add == NULL && add_len != 0)) + { + return( -1 ); + } + + /* IV and AD are limited to 2^64 bits, so 2^61 bytes */ + /* IV is not allowed to be zero length */ + if( iv_len == 0 || + ( (uint64_t) iv_len ) >> 61 != 0 || + ( (uint64_t) add_len ) >> 61 != 0 ) + { + return( -1 ); + } + + memset( ctx->y, 0x00, sizeof(ctx->y) ); + memset( ctx->buf, 0x00, sizeof(ctx->buf) ); + + ctx->mode = mode; + ctx->len = 0; + ctx->add_len = 0; + + if( iv_len == 12 ) + { + memcpy( ctx->y, iv, iv_len ); + ctx->y[15] = 1; + } + else + { + memset( work_buf, 0x00, 16 ); + PUT_UINT32_BE( iv_len * 8, work_buf, 12 ); + + p = iv; + while( iv_len > 0 ) + { + use_len = ( iv_len < 16 ) ? iv_len : 16; + + for( i = 0; i < use_len; i++ ) + ctx->y[i] ^= p[i]; + + gcm_mult( ctx, ctx->y, ctx->y ); + + iv_len -= use_len; + p += use_len; + } + + for( i = 0; i < 16; i++ ) + ctx->y[i] ^= work_buf[i]; + + gcm_mult( ctx, ctx->y, ctx->y ); + } + + if( ( ret = crypto_aes_crypt_ecb(&ctx->cipher_ctx, AES_ENCRYPT, ctx->y, 16, ctx->base_ectr) ) != 0 ) + { + return( ret ); + } + + ctx->add_len = add_len; + p = add; + while( add_len > 0 ) + { + use_len = ( add_len < 16 ) ? add_len : 16; + + for( i = 0; i < use_len; i++ ) + ctx->buf[i] ^= p[i]; + + gcm_mult( ctx, ctx->buf, ctx->buf ); + + add_len -= use_len; + p += use_len; + } + + return( 0 ); +} + +int crypto_gcm_update( crypto_gcm_context *ctx, uint32_t length, const uint8_t *input, uint8_t *output ) +{ + int ret = 0; + uint8_t ectr[16]; + uint32_t i; + const uint8_t *p; + uint8_t *out_p = output; + uint32_t use_len = 0; + + if (ctx == NULL || input == NULL || output == NULL) + { + return( -1 ); + } + + if( output > input && (size_t) ( output - input ) < length ) + return( -1 ); + + /* Total length is restricted to 2^39 - 256 bits, ie 2^36 - 2^5 bytes + * Also check for possible overflow */ + if( ctx->len + length < ctx->len || + (uint64_t) ctx->len + length > 0xFFFFFFFE0ull ) + { + return( -1 ); + } + + aes_handle_t *p_aes_handle = &((aes_instance_t *)ctx->cipher_ctx.instance)->aes_handle; + + p_aes_handle->p_instance = AES; + p_aes_handle->init.chaining_mode = AES_CHAININGMODE_ECB; + p_aes_handle->init.p_init_vector = NULL; + p_aes_handle->init.p_seed = (uint32_t *)(((aes_instance_t *)ctx->cipher_ctx.instance)->seed); + p_aes_handle->init.dpa_mode = DISABLE; + + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + hal_aes_init(p_aes_handle); + + ctx->len += length; + + p = input; + while( length > 0 ) + { + use_len = ( length < 16 ) ? length : 16; + + for( i = 16; i > 12; i-- ) + if( ++ctx->y[i - 1] != 0 ) + break; + + if ( HAL_OK != hal_aes_ecb_encrypt(p_aes_handle, (uint32_t *)ctx->y, 16, (uint32_t *)ectr, 5000) ) + { + ret = -1; + goto exit; + } + + for( i = 0; i < use_len; i++ ) + { + if( ctx->mode == AES_DECRYPT ) + ctx->buf[i] ^= p[i]; + out_p[i] = ectr[i] ^ p[i]; + if( ctx->mode == AES_ENCRYPT ) + ctx->buf[i] ^= out_p[i]; + } + + gcm_mult( ctx, ctx->buf, ctx->buf ); + + length -= use_len; + p += use_len; + out_p += use_len; + } + +exit: + hal_aes_deinit(p_aes_handle); + aes_hardware_reset(); + return( ret ); +} + +int crypto_gcm_finish( crypto_gcm_context *ctx, uint8_t *tag, uint32_t tag_len ) +{ + uint8_t work_buf[16]; + uint32_t i; + uint64_t orig_len; + uint64_t orig_add_len; + + if (ctx == NULL || tag == NULL) + { + return( -1 ); + } + + orig_len = ctx->len * 8; + orig_add_len = ctx->add_len * 8; + + if( tag_len > 16 || tag_len < 4 ) + return( -1 ); + + memcpy( tag, ctx->base_ectr, tag_len ); + + if( orig_len || orig_add_len ) + { + memset( work_buf, 0x00, 16 ); + + PUT_UINT32_BE( ( orig_add_len >> 32 ), work_buf, 0 ); + PUT_UINT32_BE( ( orig_add_len ), work_buf, 4 ); + PUT_UINT32_BE( ( orig_len >> 32 ), work_buf, 8 ); + PUT_UINT32_BE( ( orig_len ), work_buf, 12 ); + + for( i = 0; i < 16; i++ ) + ctx->buf[i] ^= work_buf[i]; + + gcm_mult( ctx, ctx->buf, ctx->buf ); + + for( i = 0; i < tag_len; i++ ) + tag[i] ^= ctx->buf[i]; + } + + return( 0 ); +} + +void crypto_gcm_free( crypto_gcm_context *ctx ) +{ + if( ctx == NULL ) + return; + crypto_aes_free( &ctx->cipher_ctx ); + memset( ctx, 0, sizeof( crypto_gcm_context ) ); +} + +int crypto_gcm_crypt_and_tag( crypto_gcm_context *ctx, int mode, uint32_t length, + const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len, + const uint8_t *input, uint8_t *output, uint32_t tag_len, uint8_t *tag ) +{ + int ret = 0; + + if (ctx == NULL || iv == NULL || input == NULL || output == NULL || tag == NULL || (add == NULL && add_len != 0)) + { + return( -1 ); + } + + if( ( ret = crypto_gcm_starts( ctx, mode, iv, iv_len, add, add_len ) ) != 0 ) + return( ret ); + + if( ( ret = crypto_gcm_update( ctx, length, input, output ) ) != 0 ) + return( ret ); + + if( ( ret = crypto_gcm_finish( ctx, tag, tag_len ) ) != 0 ) + return( ret ); + + return( 0 ); +} + +int crypto_gcm_auth_decrypt( crypto_gcm_context *ctx, uint32_t length, + const uint8_t *iv, uint32_t iv_len, const uint8_t *add, uint32_t add_len, + const uint8_t *tag, uint32_t tag_len, const uint8_t *input, uint8_t *output ) +{ + int ret = 0; + uint8_t check_tag[16]; + uint32_t i; + int diff; + + if (ctx == NULL || iv == NULL || input == NULL || output == NULL || tag == NULL || (add == NULL && add_len != 0)) + { + return( -1 ); + } + + if( ( ret = crypto_gcm_crypt_and_tag( ctx, AES_DECRYPT, length, + iv, iv_len, add, add_len, + input, output, tag_len, check_tag ) ) != 0 ) + { + return( ret ); + } + + /* Check tag in "constant-time" */ + for( diff = 0, i = 0; i < tag_len; i++ ) + diff |= tag[i] ^ check_tag[i]; + + if( diff != 0 ) + { + memset( output, 0, length ); + return( -1 ); + } + + return( 0 ); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc.c new file mode 100644 index 0000000..2a48f9b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc.c @@ -0,0 +1,280 @@ +#include "crypto_pkc.h" + +static pkc_handle_t pkc_handle = { 0 }; +static ecc_curve_init_t ECC_CurveInitStruct = LL_ECC_CURVE_DEFAULT_CONFIG; + +static void pkc_set_curve_secp256r1(void) +{ + uint32_t A[ECC_U32_LENGTH] = {0xFFFFFFFC, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFC}; + uint32_t B[ECC_U32_LENGTH] = {0xDC30061D, 0x04874834, 0xE5A220AB, 0xF7212ED6, 0xACF005CD, 0x78843090, 0xD89CDF62, 0x29C4BDDF}; + uint32_t P[ECC_U32_LENGTH] = {0xFFFFFFFF, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}; + uint32_t PRSquare[ECC_U32_LENGTH] = {0x00000004, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFB, 0xFFFFFFFF, 0x00000000, 0x00000003}; + uint32_t ConstP = 1; + uint32_t N[ECC_U32_LENGTH] = {0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xBCE6FAAD, 0xA7179E84, 0xF3B9CAC2, 0xFC632551}; + uint32_t NRSquare[ECC_U32_LENGTH] = {0x66E12D94, 0xF3D95620, 0x2845B239, 0x2B6BEC59, 0x4699799C, 0x49BD6FA6, 0x83244C95, 0xBE79EEA2}; + uint32_t ConstN = 0xEE00BC4F; + uint32_t H = 1; + uint32_t GX[ECC_U32_LENGTH] = {0x6B17D1F2, 0xE12C4247, 0xF8BCE6E5, 0x63A440F2, 0x77037D81, 0x2DEB33A0, 0xF4A13945, 0xD898C296}; + uint32_t GY[ECC_U32_LENGTH] = {0x4FE342E2, 0xFE1A7F9B, 0x8EE7EB4A, 0x7C0F9E16, 0x2BCE3357, 0x6B315ECE, 0xCBB64068, 0x37BF51F5}; + + memcpy(ECC_CurveInitStruct.A, A, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.B, B, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.P, P, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.PRSquare, PRSquare, sizeof(uint32_t) * ECC_U32_LENGTH); + ECC_CurveInitStruct.ConstP = ConstP; + memcpy(ECC_CurveInitStruct.N, N, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.NRSquare, NRSquare, sizeof(uint32_t) * ECC_U32_LENGTH); + ECC_CurveInitStruct.ConstN = ConstN; + ECC_CurveInitStruct.H = H; + memcpy(ECC_CurveInitStruct.G.X, GX, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.G.Y, GY, sizeof(uint32_t) * ECC_U32_LENGTH); +} + +static void pkc_set_curve_secp256k1(void) +{ + uint32_t A[ECC_U32_LENGTH] = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}; + uint32_t B[ECC_U32_LENGTH] = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00001AB7}; + uint32_t P[ECC_U32_LENGTH] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFC2F}; + uint32_t PRSquare[ECC_U32_LENGTH] = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x000007A2, 0x000E90A1}; + uint32_t ConstP = 0xD2253531; + uint32_t N[ECC_U32_LENGTH] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xBAAEDCE6, 0xAF48A03B, 0xBFD25E8C, 0xD0364141}; + uint32_t NRSquare[ECC_U32_LENGTH] = {0x9D671CD5, 0x81C69BC5, 0xE697F5E4, 0x5BCD07C6, 0x741496C2, 0x0E7CF878, 0x896CF214, 0x67D7D140}; + uint32_t ConstN = 0x5588B13F; + uint32_t H = 1; + uint32_t GX[ECC_U32_LENGTH] = {0x79BE667E, 0xF9DCBBAC, 0x55A06295, 0xCE870B07, 0x029BFCDB, 0x2DCE28D9, 0x59F2815B, 0x16F81798}; + uint32_t GY[ECC_U32_LENGTH] = {0x483ADA77, 0x26A3C465, 0x5DA4FBFC, 0x0E1108A8, 0xFD17B448, 0xA6855419, 0x9C47D08F, 0xFB10D4B8}; + + memcpy(ECC_CurveInitStruct.A, A, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.B, B, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.P, P, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.PRSquare, PRSquare, sizeof(uint32_t) * ECC_U32_LENGTH); + ECC_CurveInitStruct.ConstP = ConstP; + memcpy(ECC_CurveInitStruct.N, N, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.NRSquare, NRSquare, sizeof(uint32_t) * ECC_U32_LENGTH); + ECC_CurveInitStruct.ConstN = ConstN; + ECC_CurveInitStruct.H = H; + memcpy(ECC_CurveInitStruct.G.X, GX, sizeof(uint32_t) * ECC_U32_LENGTH); + memcpy(ECC_CurveInitStruct.G.Y, GY, sizeof(uint32_t) * ECC_U32_LENGTH); +} + +hal_status_t hal_pkc_modular_left_shift_handle( + uint32_t bits_len, uint32_t in_a[], uint32_t in_prime[], uint32_t shift_bits, uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + pkc_modular_shift_t pkc_left = { + .p_A = in_a, + .shift_bits = shift_bits, + .p_P = in_prime, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_modular_left_shift(&(pkc_handle), &pkc_left, 1000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_modular_compare_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_prime[], uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + + pkc_modular_compare_t pkc_comp = { + .p_A = in_a, + .p_P = in_prime, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_modular_compare(&(pkc_handle), &pkc_comp, 1000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_montgomery_inverse(uint32_t bits_len, uint32_t in_a[], uint32_t in_prime[], uint32_t constp, uint32_t out_x[]) +{ + hal_status_t ret = HAL_OK; + + pkc_montgomery_inversion_t pkc_inverse = { + .p_A = in_a, + .p_P = in_prime, + .ConstP = constp, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = out_x; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_montgomery_inversion(&pkc_handle, &pkc_inverse, 5000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_rsa_modular_exponent_handle(uint32_t bits_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t in_constp, + uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + pkc_rsa_modular_exponent_t pkc_rsa = { + .p_A = in_a, + .p_B = in_b, + .p_P = in_prime, + .p_P_R2 = r_square, + .ConstP = in_constp + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_rsa_modular_exponent(&(pkc_handle), &pkc_rsa, 1000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_montgomery_mul( + uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t constq, uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + pkc_montgomery_multi_t pkc_mul = { + .p_A = in_a, + .p_B = in_b, + .p_P = in_prime, + .ConstP = constq, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_montgomery_multi(&(pkc_handle), &pkc_mul, 5000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +ecc_curve_init_t *pkc_set_curve_p256_params(algo_ecc_curve_type_e curve) +{ + switch (curve) + { + case ECC_CURVE_SECP256R1: + pkc_set_curve_secp256r1(); + break; + case ECC_CURVE_SECP256K1: + pkc_set_curve_secp256k1(); + break; + default: + break; + } + return &ECC_CurveInitStruct; +} + +void hal_set_curve(ecc_curve_init_t *curve) +{ + if (NULL == curve) + { + pkc_handle.init.p_ecc_curve = (ecc_curve_init_t *)pkc_set_curve_p256_params(ECC_CURVE_SECP256R1); + } + else + { + pkc_handle.init.p_ecc_curve = curve; + } +} + +hal_status_t hal_pkc_ecc_point_mul_handle(uint32_t k[ECC_U32_LENGTH], ecc_point_t *Q, ecc_point_t *result) +{ + hal_status_t ret = HAL_OK; + pkc_ecc_point_multi_t pkc_point_mul; + + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + + if (NULL == pkc_handle.init.p_ecc_curve) + { + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + } + + pkc_handle.init.data_bits = 256; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = (uint32_t(*)(void))rand; + + hal_pkc_init(&pkc_handle); + + pkc_point_mul.p_K = k; + pkc_point_mul.p_ecc_point = Q; + + ret = hal_pkc_ecc_point_multi(&pkc_handle, &pkc_point_mul, 5000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_modular_sub_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + pkc_modular_sub_t pkc_sub = { + .p_A = in_a, + .p_B = in_b, + .p_P = in_prime, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_modular_sub(&(pkc_handle), &pkc_sub, 1000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} + +hal_status_t hal_pkc_modular_add_handle(uint32_t bits_len, uint32_t in_a[], uint32_t in_b[], uint32_t in_prime[], uint32_t result[]) +{ + hal_status_t ret = HAL_OK; + pkc_modular_add_t pkc_add = { + .p_A = in_a, + .p_B = in_b, + .p_P = in_prime, + }; + pkc_handle.p_instance = PKC; + pkc_handle.p_result = result; + pkc_handle.init.p_ecc_curve = &ECC_CurveInitStruct; + pkc_handle.init.data_bits = bits_len; + pkc_handle.init.secure_mode = PKC_SECURE_MODE_DISABLE; + pkc_handle.init.random_func = NULL; + + hal_pkc_init(&pkc_handle); + ret = hal_pkc_modular_add(&(pkc_handle), &pkc_add, 1000); + hal_pkc_deinit(&pkc_handle); + + return ret; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc_port.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc_port.c new file mode 100644 index 0000000..4da943f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_pkc_port.c @@ -0,0 +1,141 @@ +#include "crypto_pkc_port.h" + +static void pkc_random_delay(pkc_rng_func_ptr rng32_func) +{ + volatile uint32_t random = rng32_func(); + random &= 0x1F; + + while (random > 0) + { + random--; + } +} + +void pkc_setbit(uint32_t q[], uint32_t in_prime[], uint32_t k, uint32_t bits_len) +{ + uint32_t i = 0; + uint32_t n_u32 = 0; // the n-th u32 + uint32_t m_bit = 0; // the m-th bit + uint32_t prime_u32_length = bits_len >> 5; //(bits_len >> 5); + + if (k > bits_len) + { + return; + } + if (bits_len == k) + { + for (i = 0; i < prime_u32_length; i++) + { + q[i] = 0xFFFFFFFF ^ in_prime[i]; + } + q[prime_u32_length - 1]++; + return; + } + else + { + // 0 <= k < 2 ^ bits_len + for (i = 0; i < prime_u32_length; i++) + { + q[i] = 0; + } + + n_u32 = k >> 5; // k / 32; + m_bit = k & 0x1F; // k % 32 + q[n_u32] = 1 << m_bit; + } + + return; +} + +void pkc_zeroize(void *v, uint32_t u32_len) +{ + volatile uint32_t *p = (uint32_t *)v; + uint32_t i = 0; + for (i = 0; i < u32_len; i++) + { + p[i] = 0; + } + return; +} + +// ret: a > b ret 1; a == b ret 0; a < b ret -1; +int32_t pkc_number_compare_to_const(uint32_t a[], uint32_t b, uint32_t bits_len) +{ + uint32_t i = 0; + int32_t pkc_u32_len = bits_len >> 5; //(bits_len >> 5); + + if (a[0] > b) + { + return 1; + } + + for (i = pkc_u32_len - 1; i >= 1; i--) + { + if (a[i] > 0) + { + return 1; + } + } + + if (a[0] == b) + { + return 0; + } + + return -1; +} + +int32_t pkc_number_compare(uint32_t a[], uint32_t b[], uint32_t bits_len) +{ + int32_t i = 0; + uint32_t number_u32_len = bits_len >> 5; //(bits_len >> 5); + + for (i = number_u32_len - 1; i >= 0; i--) + { + if (a[i] > b[i]) + { + return 1; + } + else if (a[i] < b[i]) + { + return -1; + } + } + + return 0; +} + +uint8_t pkc_safe_compare(pkc_rng_func_ptr rng32, uint32_t *src, uint32_t *dest, uint32_t u32_len) +{ + uint8_t ret = 1; + + ret = pkc_number_compare(src, dest, u32_len * 32); + if (0 != ret) + { + return ret; + } + + pkc_random_delay(rng32); + + ret = pkc_number_compare(src, dest, u32_len * 32); + + if (0 != ret) + { + return ret; + } + + pkc_random_delay(rng32); + + return pkc_number_compare(src, dest, u32_len * 32); +} + +void pkc_read_oct_string(uint32_t *number, uint8_t *buffer, uint32_t byte_size) +{ + uint32_t i = 0; + uint8_t *x = (uint8_t *)number; + + for (i = 0; i < byte_size; i++) + { + x[i] = buffer[byte_size - 1 - i]; + } +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa.c new file mode 100644 index 0000000..41b0a7b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa.c @@ -0,0 +1,901 @@ +#include "crypto_rsa.h" +#include "crypto_rsa_port.h" +#include "crypto_pkc_port.h" + +#define ciL (sizeof(uint32_t)) /* chars in limb */ +#define biL (ciL << 3) /* bits in limb */ +#define biH (ciL << 2) /* half limb size */ +#define SHA256_SIZE 32 +#define ZERO_PADDING_SIZE 8 + +typedef struct rsa_public_key +{ + uint32_t *n; + uint32_t e; + uint32_t *rr; + uint32_t c; +} rsa_public_key_t; + +typedef struct rsa_private_key +{ + uint32_t *d; +} rsa_private_key_t; + +typedef struct +{ + algo_rsa_config_t rsa_config; + uint32_t len; /*!< size(N) in chars */ + rsa_public_key_t pk; + rsa_private_key_t sk; +} rsa_context_t; + +static void swap_endian(uint32_t *in, uint32_t len, uint32_t *out) +{ + uint32_t i = 0; + + for (i = 0; i < len; i++) + { + out[i] = ((in[i] & 0xFF000000) >> 24) + ((in[i] & 0xFF0000) >> 8) + + ((in[i] & 0xFF00) << 8) + ((in[i] & 0xFF) << 24); + } +} + +static void swap_order(uint8_t *in, uint32_t len) +{ + int i; + uint8_t temp; + for(i = 0; i < len/2; i++) + { + temp = in[i]; + in[i] = in[len-i-1]; + in[len-i-1] = temp; + } +} + +/* + * Count leading zero bits in a given integer + */ +static uint32_t rsa_clz(const uint32_t x) +{ + uint32_t j = 0; + uint32_t mask = (uint32_t)1 << (biL - 1); + + for (j = 0; j < biL; j++) + { + if (x & mask) + break; + + mask >>= 1; + } + + return j; +} + +/* + * Return the number of bits + */ +static uint32_t bl_mpi_bitlen(int n, const uint32_t *p) +{ + uint32_t i, j; + + for (i = n - 1; i > 0; i--) + { + if (p[i] != 0) + { + break; + } + } + + j = biL - rsa_clz(p[i]); + + return ((i * biL) + j); +} + +static int mgf_mask(uint8_t *dst, uint32_t dlen, uint8_t *src, uint32_t slen) +{ + uint32_t i = 0; + uint32_t use_len = 0; + uint8_t counter[4] = { 0 }; + uint8_t *p = dst; + uint32_t hlen = SHA256_SIZE; + uint8_t mask[SHA256_SIZE]; + uint8_t mhash[SHA256_SIZE + 4]; + + memset(mask, 0, SHA256_SIZE); + memset(counter, 0, 4); + memcpy(mhash, src, SHA256_SIZE); + + /* Generate and apply dbMask */ + while (dlen > 0) + { + use_len = hlen; + if (dlen < hlen) + { + use_len = dlen; + } + memcpy((mhash + SHA256_SIZE), counter, 4); + hw_rsa_sha(mhash, SHA256_SIZE + 4, mask); + + for (i = 0; i < use_len; ++i) + { + *p++ ^= mask[i]; + } + + counter[3]++; + + dlen -= use_len; + } + + pkc_zeroize(mask, sizeof(mask) / 4); + + return 0; +} + +static algo_rsa_ret_e rsa_short_modular_exponent(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_a[], + algo_rsa_public_exponent_e e, + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + uint32_t out_result[]) +{ + algo_rsa_ret_e err = RSA_OK; + uint32_t b[RSA_U32_LENGTH] = { 0 }; + uint32_t array_len = bits_len >> 5; + + if (NULL == rsa_config) + { + return RSA_ERROR_PARAMETER; + } + + switch (e) + { + case RSA_E_65537: + b[array_len - 1] = 65537; + break; + + case RSA_E_17: + b[array_len - 1] = 17; + break; + + case RSA_E_3: + b[array_len - 1] = 3; + break; + + default: + return RSA_ERROR_PARAMETER; + } + + rsa_modular_exponent(rsa_config, bits_len, in_a, b, in_prime, r_square, constp, out_result); + + return err; +} + +static algo_rsa_ret_e rsa_private_key_modular_exponent(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_d[], + algo_rsa_public_exponent_e e, + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + uint32_t out_result[]) +{ + uint32_t r[RSA_U32_LENGTH] = { 0 }; + uint32_t cx[RSA_U32_LENGTH] = { 0 }; + uint32_t r1[RSA_U32_LENGTH] = { 0 }; + uint32_t tmp[RSA_U32_LENGTH] = { 0 }; + uint32_t temp_a[RSA_U32_LENGTH] = { 0 }; + algo_rsa_ret_e err = RSA_OK; + uint32_t i = 0; + uint32_t u32_len = bits_len >> 5; + + if (NULL == rsa_config) + { + return RSA_ERROR_PARAMETER; + } + + for (i = 0; i < u32_len; i++) + { + r[i] = hw_rsa_rng32(); + } + + // calc cx = in_a * (r ^(-1)) ^ e + memcpy(r1, r, sizeof(uint32_t) * RSA_U32_LENGTH); + rsa_modular_inverse(rsa_config, bits_len, r, in_prime, r_square, constp, cx); + memcpy(r, r1, sizeof(uint32_t) * RSA_U32_LENGTH); + + rsa_short_modular_exponent(rsa_config, bits_len, cx, e, in_prime, r_square, constp, cx); + + hw_rsa_montgomery_mul(rsa_config, bits_len, in_a, cx, in_prime, constp, cx); + hw_rsa_montgomery_mul(rsa_config, bits_len, r_square, cx, in_prime, constp, cx); + + // calc cx = cx ^ in_d = in_a ^ in_d * (r ^ (-1)); + rsa_modular_exponent(rsa_config, bits_len, cx, in_d, in_prime, r_square, constp, cx); + + // calc tmp = in_a ^ in_d = cx * r; + hw_rsa_montgomery_mul(rsa_config, bits_len, cx, r, in_prime, constp, cx); + hw_rsa_montgomery_mul(rsa_config, bits_len, cx, r_square, in_prime, constp, tmp); + + // cx = tmp ^ e + rsa_short_modular_exponent(rsa_config, bits_len, tmp, e, in_prime, r_square, constp, cx); + + hw_rsa_modular_compare(rsa_config, bits_len, in_a, in_prime, temp_a); + + if (pkc_safe_compare(hw_rsa_rng32, cx, temp_a, u32_len) != 0) + { + pkc_zeroize(tmp, u32_len); + return RSA_ERROR_SIGN_FUNCTION; + } + else + { + memcpy(out_result, tmp, u32_len * 4); + } + + return err; +} + +static algo_rsa_ret_e rsa_sign_encrypt_em(rsa_context_t *ctx, uint8_t *sig, uint32_t *output) +{ + algo_rsa_ret_e err = RSA_OK; + uint32_t tmp[RSA_U32_LENGTH] = { 0 }; + uint32_t tmp2[RSA_U32_LENGTH] = { 0 }; + uint32_t tmp1[RSA_U32_LENGTH] = { 0 }; + uint32_t word_bit_len = ctx->len * 8; + + memcpy(tmp, sig, ctx->len); + memcpy(tmp2, sig, ctx->len); + hw_rsa_modular_compare(&ctx->rsa_config, word_bit_len, tmp, (uint32_t *)(ctx->pk.n), tmp); + if (ctx->rsa_config.sign_pkcs_type == RSA_PKCS1_V21) + { + if (memcmp(tmp, tmp2, ctx->len) != 0) + { + return RSA_ERROR_RANDOM; + } + } + +#ifdef RSA_OPENSSL_SEQ + uint32_t i = 0; + uint32_t j = 0; + uint32_t n = ctx->len; + for (i = (ctx->len) - 1, j = 0; n > 0; i--, j++, n--) + { + sig[i] = (uint8_t)(tmp[j / ciL] >> ((j % ciL) << 3)); + } +#else + swap_endian((uint32_t *)sig, ctx->len/4, (uint32_t *)sig); +#endif + + if (ctx->rsa_config.sign_pkcs_type == RSA_PKCS1_V21) + { + memcpy(tmp1, sig, ctx->len); + memcpy(tmp2, sig, ctx->len); + hw_rsa_modular_compare(&ctx->rsa_config, word_bit_len, tmp1, (uint32_t *)(ctx->pk.n), tmp1); + if (memcmp(tmp1, tmp2, ctx->len) != 0) + { + return RSA_ERROR_RANDOM; + } + } + + if ((err = rsa_private_key_modular_exponent(&ctx->rsa_config, + word_bit_len, + (uint32_t *)sig, + ctx->sk.d, + (algo_rsa_public_exponent_e)ctx->pk.e, + (uint32_t *)(ctx->pk.n), + (uint32_t *)(ctx->pk.rr), + ctx->pk.c, + (uint32_t *)output)) + != RSA_OK) + { + return err; + } + + return RSA_OK; +} + +static algo_rsa_ret_e rsa_rsassa_pss_sign(rsa_context_t *ctx, const uint8_t *hash, uint8_t *sig) +{ + uint32_t i = 0; + algo_rsa_ret_e err = RSA_OK; + uint32_t salt[8] = { 0 }; + unsigned char *p = NULL; + uint32_t msb = 0, olen = 0, hlen = 32, slen = 32, offset = 0; + uint8_t zero_hash_p[ZERO_PADDING_SIZE + 2 * SHA256_SIZE]; + + do + { + err = RSA_OK; + p = sig; + msb = 0; + olen = 0; + hlen = 32; + slen = 32; + offset = 0; + olen = ctx->len; + if (olen < hlen + slen + 2) + { + err = RSA_ERROR_PARAMETER; + break; + } + + memset(sig, 0x0, olen); + memset(salt, 0x0, 8); + memset(zero_hash_p, 0, ZERO_PADDING_SIZE + 2 * SHA256_SIZE); + for (i = 0; i < 8; i++) + { + salt[i] = hw_rsa_rng32(); + } + + /* Note: EMSA-PSS encoding is over the length of N - 1 bits */ +#ifdef RSA_OPENSSL_SEQ + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; +#else + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); +#endif + p += olen - hlen * 2 - 2; + *p++ = 0x01; + memcpy(p, salt, slen); + p += slen; + + memset(zero_hash_p, 0, ZERO_PADDING_SIZE); + memcpy(zero_hash_p + ZERO_PADDING_SIZE, hash, SHA256_SIZE); + memcpy(zero_hash_p + ZERO_PADDING_SIZE + SHA256_SIZE, (uint8_t *)salt, slen); + hw_rsa_sha(zero_hash_p, (ZERO_PADDING_SIZE + 2 * SHA256_SIZE), p); + + pkc_zeroize((uint32_t *)salt, slen / 4); + + /* Compensate for boundary condition when applying mask */ + if (msb % 8 == 0) + { + offset = 1; + } + + /* maskedDB: Apply dbMask to DB */ + if (olen != hlen) + { + if (mgf_mask(sig + offset, olen - hlen - 1 - offset, p, hlen) < 0) + { + err = RSA_ERROR_PARAMETER; + break; + } + } + +#ifdef RSA_OPENSSL_SEQ + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; +#else + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); +#endif + sig[0] &= 0xFF >> (olen * 8 - msb); + + p += hlen; + *p++ = 0xBC; + + err = rsa_sign_encrypt_em(ctx, sig, (uint32_t *)sig); + + } while (err == RSA_ERROR_RANDOM); + + if (err != RSA_OK) + { + return err; + } + +#ifdef RSA_OPENSSL_SEQ + // convert signature(number format) to oct string format. + for (i = 0; i < (uint32_t)(ctx->len / 2); i++) + { + uint8_t temp = sig[i]; + sig[i] = sig[ctx->len - 1 - i]; + sig[ctx->len - 1 - i] = temp; + } +#else + swap_endian((uint32_t *)sig, ctx->len/4, (uint32_t *)sig); +#endif + + return RSA_OK; +} + +static void rsa_compute_montgomery_constant(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_prime[], + uint32_t r[], + uint32_t r_square[], + uint32_t *constp) +{ + uint32_t i = 0; + uint32_t m0 = 0; + uint32_t x = 0; + if (NULL == rsa_config || NULL == in_prime || NULL == constp) + { + return; + } + + // get R + pkc_setbit(r, in_prime, bits_len, bits_len); + + // get R^2 mod p + hw_rsa_modular_left_shift(rsa_config, bits_len, r, in_prime, bits_len, r_square); + + // get constp + m0 = in_prime[(bits_len >> 5) - 1]; + x = m0; + x += ((m0 + 2) & 4) << 1; + for (i = 32; i >= 8; i /= 2) + { + x *= 2 - m0 * x; + } + + *constp = (~x + 1); +} + +#ifdef RSA_OPENSSL_SEQ +static void rsa_pkcs15_padding(const uint8_t *hash, uint32_t len, uint8_t *em) +{ + uint8_t sha256_oid[] = { 0x30, 0x31, 0x30, 0x0d, 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, + 0x65, 0x03, 0x04, 0x02, 0x01, 0x05, 0x00, 0x04, 0x20 }; + + if (len < 32 || len > 256) + { + return; + } + if (NULL == em) + { + return; + } + + memset(em, 0xff, len); + em[0] = 0x0; + em[1] = 0x01; + em[len - 32 - sizeof(sha256_oid) - 1] = 0x0; + + memcpy(&em[len - 32 - sizeof(sha256_oid)], sha256_oid, sizeof(sha256_oid)); + memcpy(&em[len - 32], hash, 32); +} +#else +static void rsa_pkcs15_padding(const uint8_t *hash, uint32_t len, uint8_t *em) +{ + size_t nb_pad = len; + uint8_t *p = em; + size_t hashlen = 32; + + if( nb_pad < hashlen ) + return; + + nb_pad -= hashlen; + + /* Need space for signature header and padding delimiter (3 bytes), + * and 8 bytes for the minimal padding */ + if( nb_pad < 3 + 8 ) + return; + nb_pad -= 3; + + /* Now nb_pad is the amount of memory to be filled + * with padding, and at least 8 bytes long. */ + + /* Write signature header and padding */ + *p++ = 0; + *p++ = 0x1; + memset( p, 0xFF, nb_pad ); + p += nb_pad; + *p++ = 0; + memcpy( p, hash, hashlen ); + + return; +} +#endif + +static algo_rsa_ret_e rsa_rsassa_pkcs1v15_sign(rsa_context_t *ctx, const uint8_t *hash, uint8_t *sig) +{ + algo_rsa_ret_e err = RSA_OK; + uint8_t *em = sig; + + rsa_pkcs15_padding(hash, ctx->len, em); + + if ((err = rsa_sign_encrypt_em(ctx, em, (uint32_t *)sig)) < 0) + { + return err; + } + +#ifdef RSA_OPENSSL_SEQ + uint32_t i = 0; + // convert signature(number format) to oct string format. + for (i = 0; i < ctx->len / 2; i++) + { + + uint8_t temp = sig[i]; + sig[i] = sig[ctx->len - 1 - i]; + sig[ctx->len - 1 - i] = temp; + } +#else + swap_endian((uint32_t *)sig, ctx->len/4, (uint32_t *)sig); +#endif + + return RSA_OK; +} + +algo_rsa_ret_e crypto_rsa_pkcs1_sign(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint8_t *message, + uint32_t message_len, + uint32_t private_key[], + algo_rsa_public_exponent_e e, + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + uint8_t sig[], + uint8_t is_hash) +{ + algo_rsa_ret_e ret = RSA_OK; + rsa_context_t ctx = { 0 }; + uint32_t rr[RSA_U32_LENGTH] = { 0 }; + uint8_t hash[32] = { 0 }; + if (is_hash == 1) + { + memcpy(hash, message, message_len); + } + else + { + hw_rsa_sha(message, message_len, hash); + } + + if (NULL == rsa_config || NULL == private_key || NULL == in_prime || bits_len < 1024 || bits_len > 2048) + { + return RSA_ERROR_PARAMETER; + } + + ctx.len = bits_len / 8; + ctx.sk.d = private_key; + ctx.pk.n = in_prime; + ctx.pk.rr = r_square; + ctx.pk.c = constp; + ctx.pk.e = e; + memcpy(&ctx.rsa_config, rsa_config, sizeof(algo_rsa_config_t)); + + // compute montgomery constants + if (NULL == r_square) + { + uint32_t r[RSA_U32_LENGTH] = { 0 }; + ctx.pk.rr = &rr[0]; + rsa_compute_montgomery_constant(&ctx.rsa_config, bits_len, in_prime, r, (uint32_t *)ctx.pk.rr, &ctx.pk.c); + } + + switch (e) + { + case RSA_E_65537: + case RSA_E_17: + case RSA_E_3: + ctx.pk.e = e; + break; + + default: + ret = RSA_ERROR_PARAMETER; + break; + } + + switch (rsa_config->sign_pkcs_type) + { + case RSA_PKCS1_V21: + ret = rsa_rsassa_pss_sign(&ctx, hash, sig); + rsa_config->sign_pkcs_type = RSA_PKCS1_V21; + break; + + case RSA_PKCS1_V15: + ret = rsa_rsassa_pkcs1v15_sign(&ctx, hash, sig); + rsa_config->sign_pkcs_type = RSA_PKCS1_V15; + break; + + default: + ret = RSA_ERROR_PARAMETER; + break; + } + + return ret; +} + +static algo_rsa_ret_e rsa_verify_decrypt_em(rsa_context_t *ctx, uint8_t *sig, uint8_t *output) +{ +#ifdef RSA_OPENSSL_SEQ + algo_rsa_ret_e ret; + int i, j; + int n = ctx->len; + uint32_t tmp[RSA_U32_LENGTH] = { 0 }; + uint32_t word_bit_len = ctx->len * 8; + + memcpy(tmp, sig, ctx->len); + + if ((ret = rsa_short_modular_exponent(&ctx->rsa_config, + word_bit_len, + (uint32_t *)sig, + (algo_rsa_public_exponent_e)ctx->pk.e, + (uint32_t *)(ctx->pk.n), + (uint32_t *)(ctx->pk.rr), + ctx->pk.c, + tmp)) + != RSA_OK) + { + + return ret; + } + + // convert to EM format(string data, big endian) + for (i = ctx->len - 1, j = 0; n > 0; i--, j++, n--) + { + output[i] = (uint8_t)(tmp[j / ciL] >> ((j % ciL) << 3)); + } +#else + algo_rsa_ret_e ret; + uint32_t word_bit_len = ctx->len * 8; + + if ((ret = rsa_short_modular_exponent(&ctx->rsa_config, + word_bit_len, + (uint32_t *)sig, + (algo_rsa_public_exponent_e)ctx->pk.e, + (uint32_t *)(ctx->pk.n), + (uint32_t *)(ctx->pk.rr), + ctx->pk.c, + (uint32_t *)output)) + != RSA_OK) + { + + return ret; + } + swap_endian((uint32_t *)output, ctx->len/4, (uint32_t *)output); +#endif + + return RSA_OK; +} + +/* + * Implementation of the PKCS#1 v2.1 RSASSA-PSS-VERIFY function + */ +static algo_rsa_ret_e rsa_rsassa_pss_verify(rsa_context_t *ctx, const uint8_t *hash, const uint8_t *sig) +{ + algo_rsa_ret_e ret = RSA_OK; + uint32_t siglen = 32; + uint8_t *p = NULL; + uint8_t result[SHA256_SIZE] = { 0 }; + uint8_t zeros[8] = { 0 }; + uint32_t hlen = 0; + uint32_t slen = 0, msb = 0; + uint8_t buf[RSA_U32_LENGTH * 4] = { 0 }; + uint32_t expected_salt_len = SHA256_SIZE; + uint32_t sig_number[RSA_U32_LENGTH] = { 0 }; + uint8_t zero_hash_p[ZERO_PADDING_SIZE + 2 * SHA256_SIZE] = { 0 }; + + siglen = ctx->len; + pkc_read_oct_string(sig_number, (uint8_t *)sig, siglen); + + if (siglen < 16 || siglen > sizeof(buf)) + { + return RSA_ERROR_PARAMETER; + } + + if ((ret = rsa_verify_decrypt_em(ctx, (uint8_t *)sig_number, buf)) < 0) + { + return ret; + } + + p = buf; + + if (buf[siglen - 1] != 0xBC) + return RSA_ERROR_VERIFY_FUNCTION; + + hlen = 32; + slen = siglen - hlen - 1; /* Currently length of salt + padding */ + memset(zeros, 0, 8); + + /* + * Note: EMSA-PSS verification is over the length of N - 1 bits + */ +#ifdef RSA_OPENSSL_SEQ + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; +#else + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); + msb = bl_mpi_bitlen(ctx->len >> 2, (const uint32_t *)ctx->pk.n) - 1; + swap_endian((uint32_t *)ctx->pk.n, ctx->len/4, (uint32_t *)ctx->pk.n); + swap_order((uint8_t *)ctx->pk.n, ctx->len); +#endif + + if (buf[0] >> (8 - siglen * 8 + msb)) + { + return RSA_ERROR_VERIFY_FUNCTION; + } + + /* Compensate for boundary condition when applying mask */ + if (msb % 8 == 0) + { + p++; + siglen -= 1; + } + + if (mgf_mask(p, siglen - hlen - 1, p + siglen - hlen - 1, hlen) < 0) + { + return RSA_ERROR_VERIFY_FUNCTION; + } + + buf[0] &= 0xFF >> (siglen * 8 - msb); + + while (p < buf + siglen) + { + if (*p != 0) + { + break; + } + p++; + } + + if ((p == buf + siglen) || (*p++ != 0x01)) + { + return RSA_ERROR_VERIFY_FUNCTION; + } + + /* Actual salt len */ + slen -= p - buf; + + if (slen != (uint32_t)expected_salt_len) + { + return RSA_ERROR_VERIFY_FUNCTION; + } + + /* + * Generate H = Hash( M' ) + */ + memset(zero_hash_p, 0, ZERO_PADDING_SIZE); + memcpy(zero_hash_p + ZERO_PADDING_SIZE, hash, SHA256_SIZE); + memcpy(zero_hash_p + ZERO_PADDING_SIZE + SHA256_SIZE, p, SHA256_SIZE); + hw_rsa_sha(zero_hash_p, (ZERO_PADDING_SIZE + 2 * SHA256_SIZE), result); + +#if 0 + if (memcmp(p + slen + 3, result, hlen - 4) == 0) +#else + if( memcmp( p + slen, result, hlen ) == 0 ) +#endif + { + return RSA_OK; + } + + return RSA_ERROR_VERIFY_FUNCTION; +} + +static algo_rsa_ret_e rsa_rsassa_pkcs1v15_verify(rsa_context_t *ctx, const uint8_t *hash, const uint8_t *sig) +{ + algo_rsa_ret_e err = RSA_OK; + uint8_t em_expect[RSA_U32_LENGTH * 4] = { 0 }; + uint8_t em_act[RSA_U32_LENGTH * 4] = { 0 }; + uint32_t sig_number[RSA_U32_LENGTH] = { 0 }; + + pkc_read_oct_string(sig_number, (uint8_t *)sig, ctx->len); + + rsa_pkcs15_padding(hash, ctx->len, em_expect); + +#ifdef RSA_OPENSSL_SEQ + uint32_t tmp[RSA_U32_LENGTH] = { 0 }; + uint32_t word_bit_len = ctx->len * 8; + uint32_t i = 0; + uint32_t j = 0; + uint32_t n = ctx->len; + uint32_t temp = 0; + + memcpy(tmp, em_expect, ctx->len); + hw_rsa_modular_compare(&ctx->rsa_config, word_bit_len, tmp, (uint32_t *)(ctx->pk.n), tmp); + + for (i = (ctx->len) - 1, j = 0; n > 0; i--, j++, n--) + { + em_expect[i] = (uint8_t)(tmp[j / ciL] >> ((j % ciL) << 3)); + } + memcpy(em_expect, tmp, ctx->len); + swap_endian((uint32_t *)em_expect, ctx->len/4, (uint32_t *)em_expect); + + hw_rsa_modular_compare(&ctx->rsa_config, word_bit_len, (uint32_t *)em_expect, + (uint32_t *)(ctx->pk.n), (uint32_t *)em_expect); + + for (i = 0; i < ctx->len / 2; i++) + { + temp = em_expect[i]; + em_expect[i] = em_expect[ctx->len - 1 - i]; + em_expect[ctx->len - 1 - i] = temp; + } +#endif + + if ((err = rsa_verify_decrypt_em(ctx, (uint8_t *)sig_number, em_act)) < 0) + { + return err; + } + +#ifdef RSA_OPENSSL_SEQ + if (memcmp(em_expect, em_act, ctx->len) != 0) + { + return RSA_ERROR_VERIFY_FUNCTION; + } +#else + if( ( err = (algo_rsa_ret_e)rsa_safer_memcmp( em_expect, em_act, ctx->len ) ) != 0 ) + { + return RSA_ERROR_VERIFY_FUNCTION; + } +#endif + + return err; +} + +algo_rsa_ret_e crypto_rsa_pkcs1_verify(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint8_t *message, + uint32_t message_len, + algo_rsa_public_exponent_e e, + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + const uint8_t sig[], + uint8_t is_hash) +{ + algo_rsa_ret_e ret = RSA_OK; + rsa_context_t ctx = { 0 }; + uint32_t rr[RSA_U32_LENGTH] = { 0 }; + uint8_t hash[32] = { 0 }; + if (is_hash == 1) + { + memcpy(hash, message, message_len); + } + else + { + hw_rsa_sha(message, message_len, hash); + } + + if (NULL == rsa_config || NULL == in_prime || bits_len < 1024 || bits_len > 2048) + { + return RSA_ERROR_PARAMETER; + } + + ctx.len = bits_len / 8; + ctx.pk.n = in_prime; + ctx.pk.rr = r_square; + ctx.pk.c = constp; + memcpy(&ctx.rsa_config, rsa_config, sizeof(algo_rsa_config_t)); + + // compute montgomery constants + if (NULL == r_square) + { + uint32_t r[RSA_U32_LENGTH] = { 0 }; + ctx.pk.rr = &rr[0]; + rsa_compute_montgomery_constant(rsa_config, bits_len, in_prime, r, (uint32_t *)ctx.pk.rr, &ctx.pk.c); + } + + switch (e) + { + case RSA_E_65537: + case RSA_E_17: + case RSA_E_3: + ctx.pk.e = e; + ret = RSA_OK; + break; + + default: + ret = RSA_ERROR_PARAMETER; + break; + } + + if (0 == ret) + { + + if (rsa_config->sign_pkcs_type == RSA_PKCS1_V21) + { + ret = rsa_rsassa_pss_verify(&ctx, (const uint8_t *)hash, (const uint8_t *)sig); + } + else if (rsa_config->sign_pkcs_type == RSA_PKCS1_V15) + { + ret = rsa_rsassa_pkcs1v15_verify(&ctx, (const uint8_t *)hash, (const uint8_t *)sig); + } + } + + return ret; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa_port.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa_port.c new file mode 100644 index 0000000..1632b83 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_rsa_port.c @@ -0,0 +1,146 @@ +#include "crypto_rsa_port.h" +#include "crypto_sha256.h" +#include "crypto_rsa.h" +#include "crypto_pkc.h" +#include "crypto_pkc_port.h" +#include "grx_hal.h" + +uint32_t hw_rsa_rng32(void) +{ + uint32_t rng32; + rng_handle_t g_rng_handle; + + g_rng_handle.p_instance = RNG; + g_rng_handle.init.seed_mode = RNG_SEED_FR0_S0; + g_rng_handle.init.lfsr_mode = RNG_LFSR_MODE_59BIT; + g_rng_handle.init.out_mode = RNG_OUTPUT_FR0_S0; + g_rng_handle.init.post_mode = RNG_POST_PRO_NOT; + + hal_rng_deinit(&g_rng_handle); + hal_rng_init(&g_rng_handle); + hal_rng_generate_random_number(&g_rng_handle, NULL, &rng32); + hal_rng_deinit(&g_rng_handle); + return rng32; +} + +void hw_rsa_sha(const uint8_t *message, uint32_t message_byte_length, uint8_t output[32]) +{ + crypto_sha256_context config = { 0 }; + crypto_sha256_init(&config); + crypto_sha256_starts(&config); + crypto_sha256_update(&config, (uint8_t *)message, message_byte_length); + crypto_sha256_finish(&config, output); + crypto_sha256_free(&config); +} + +void hw_rsa_modular_left_shift(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t shift_bits, + uint32_t result[]) +{ + hal_status_t err = HAL_ERROR; + + err = hal_pkc_modular_left_shift_handle(bits_len, in_a, in_prime, shift_bits, result); + + (void)err; +} + +void hw_rsa_modular_compare(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t result[]) +{ + hal_status_t err = HAL_ERROR; + + err = hal_pkc_modular_compare_handle(bits_len, in_a, in_prime, result); + (void)err; +} + +void hw_rsa_montgomery_inverse(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t constp, + uint32_t out_x[]) +{ + hal_status_t err = HAL_ERROR; + + err = hal_pkc_montgomery_inverse(bits_len, in_a, in_prime, constp, out_x); + (void)err; +} + +void rsa_modular_inverse(algo_rsa_config_t *ecc_config, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t out_a_inverse[]) +{ + // check if input a = 0 + if (pkc_number_compare_to_const(in_a, 0, bits_len) == 0) + { + return; + } + + hw_rsa_montgomery_inverse(ecc_config, bits_len, in_a, in_prime, constq, out_a_inverse); +} + +void hw_rsa_modular_exponent(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constq, + uint32_t result[]) +{ + hal_status_t err = HAL_ERROR; + + err = hal_pkc_rsa_modular_exponent_handle(bits_len, in_a, in_b, in_prime, r_square, constq, result); + + (void)err; +} + +//out_result in_a ^(in_b) mod in_prime +void rsa_modular_exponent(algo_rsa_config_t *rsa_config, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_d[], + uint32_t in_prime[], + uint32_t r_square[], + uint32_t constp, + uint32_t out_result[]) +{ + hw_rsa_modular_exponent(rsa_config, bits_len, in_a, in_d, in_prime, r_square, constp, out_result); +} + +void hw_rsa_montgomery_mul(algo_rsa_config_t *rsa_calc_options, + uint32_t bits_len, + uint32_t in_a[], + uint32_t in_b[], + uint32_t in_prime[], + uint32_t constp, + uint32_t result[]) +{ + hal_status_t err = HAL_ERROR; + + err = hal_pkc_montgomery_mul(bits_len, in_a, in_b, in_prime, constp, result); + (void)err; +} + +int rsa_safer_memcmp( const void *a, const void *b, size_t n ) +{ + size_t i; + const unsigned char *A = (const unsigned char *) a; + const unsigned char *B = (const unsigned char *) b; + unsigned char diff = 0; + + for( i = 0; i < n; i++ ) + diff |= A[i] ^ B[i]; + + return( diff ); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_sha256.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_sha256.c new file mode 100644 index 0000000..7231d81 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/crypto_lib/src/crypto_sha256.c @@ -0,0 +1,301 @@ +#include "crypto_sha256.h" +#include "grx_hal.h" +//#include "mbedtls/sha256.h" + +#define crypto_malloc malloc +#define crypto_free free + +/** + * @brief This defines the structure of sha256 hmac context. + */ +typedef struct crypto_sha256_hmac_context +{ +// uint8_t pad[2 * SHA256_BLOCK_SIZE]; +// mbedtls_sha256_context m_ctx; + hmac_handle_t hmac_handle; +} crypto_sha256_hmac_context_t; + +/* + * SHA256 context init + */ +void crypto_sha256_init(crypto_sha256_context *ctx) +{ + if (ctx == NULL) + { + return; + } + memset(ctx, 0x0, sizeof(crypto_sha256_context)); + ctx->instance = (crypto_sha256_hmac_context_t *)crypto_malloc(sizeof(crypto_sha256_hmac_context_t)); + if (NULL == ctx->instance) + { + return; + } + memset(ctx->instance, 0x0, sizeof(crypto_sha256_hmac_context_t)); +} + +/* + * SHA256 context free + */ +void crypto_sha256_free(crypto_sha256_context *ctx) +{ +// crypto_sha256_hmac_context_t *hmac_ctx = NULL; + + if (ctx == NULL) + { + return; + } + if (ctx->input != NULL) + { + crypto_free(ctx->input); + ctx->input = NULL; + } +// hmac_ctx = (crypto_sha256_hmac_context_t *)ctx->hmac_ctx; +// if (NULL != hmac_ctx->hmac_handle.init.p_key) +// { +// crypto_free(hmac_ctx->hmac_handle.init.p_key); +// hmac_ctx->hmac_handle.init.p_key = NULL; +// } + if (NULL != ctx->instance) + { + crypto_free(ctx->instance); + ctx->instance = NULL; + } + memset(ctx, 0x0, sizeof(crypto_sha256_context)); +} + +/* + * SHA256 context clone + */ +void crypto_sha256_clone(crypto_sha256_context *dst, const crypto_sha256_context *src) +{ + if (dst == NULL || src == NULL) + { + return; + } + + *dst = *src; +} + +/* + * SHA256 context setup + */ +int crypto_sha256_starts(crypto_sha256_context *ctx) +{ + crypto_sha256_hmac_context_t *hmac_ctx = NULL; + + if (ctx == NULL) + { + return -1; + } + + if (ctx->input != NULL) + { + crypto_free(ctx->input); + ctx->input = NULL; + ctx->block_size = 0; + ctx->total = 0; + } + + hmac_ctx = (crypto_sha256_hmac_context_t *)ctx->instance; + hmac_ctx->hmac_handle.p_instance = HMAC; + hmac_ctx->hmac_handle.init.mode = HMAC_MODE_SHA; + hmac_ctx->hmac_handle.init.p_key = NULL; + hmac_ctx->hmac_handle.init.p_user_hash = NULL; + hmac_ctx->hmac_handle.init.dpa_mode = DISABLE; + + return 0; +} + +/* + * SHA256 update + */ +int crypto_sha256_update(crypto_sha256_context *ctx, const uint8_t *input, size_t ilen) +{ + int total_len = ilen + ctx->total; + int i = 0; + uint8_t *new_input = NULL; + + if (ctx == NULL || input == NULL) + { + return -1; + } + + if (ctx->input == NULL || total_len > ctx->block_size) + { + ctx->block_size = (total_len / SHA256_BLOCK_SIZE + 1) * SHA256_BLOCK_SIZE; + new_input = crypto_malloc(ctx->block_size); + if (new_input == NULL) + { + return -1; + } + memset(new_input, 0, ctx->block_size); + for (i = 0; i < ctx->total; i++) + { + new_input[i] = ctx->input[i]; + } + for (int j = 0; j < ilen; j++) + { + new_input[i] = input[j]; + i++; + } + if (ctx->input != NULL) + { + crypto_free(ctx->input); + } + ctx->input = new_input; + } + else + { + i = ctx->total; + for (int j = 0; j < ilen; j++) + { + ctx->input[i] = input[j]; + i++; + } + } + + ctx->total = total_len; + return 0; +} + +static int crypto_internal_sha256_finish(crypto_sha256_context *ctx, uint8_t *output) +{ + crypto_sha256_hmac_context_t *hmac_ctx = NULL; + int ret = 0; + uint8_t buf[SHA256_SIZE] = {0}; + + if (ctx == NULL || output == NULL) + { + return -1; + } + + hmac_ctx = (crypto_sha256_hmac_context_t *)ctx->instance; + hal_hmac_deinit(&hmac_ctx->hmac_handle); + hal_hmac_init(&hmac_ctx->hmac_handle); + + ret = hal_hmac_sha256_digest(&hmac_ctx->hmac_handle, (uint32_t *)ctx->input, ctx->total, (uint32_t *)buf, 5000); + if (0 != ret) + { + return -1; + } + + memcpy(output, buf, SHA256_SIZE); + hal_hmac_deinit(&hmac_ctx->hmac_handle); + + return ret; +} + +/* + * SHA256 finish + */ +int crypto_sha256_finish(crypto_sha256_context *ctx, uint8_t output[32]) +{ + if (ctx == NULL || output == NULL) + { + return -1; + } + + return crypto_internal_sha256_finish(ctx, output); +} + +/* + * SHA256 compute + */ +int crypto_sha256(const uint8_t *input, size_t ilen, uint8_t output[32]) +{ + int ret = 0; + crypto_sha256_context ctx = { 0 }; + + if (NULL == input) + { + return (-1); + } + + crypto_sha256_init(&ctx); + + if ((ret = crypto_sha256_starts(&ctx)) != 0) + goto exit; + + if ((ret = crypto_sha256_update(&ctx, input, ilen)) != 0) + goto exit; + + if ((ret = crypto_sha256_finish(&ctx, output)) != 0) + goto exit; + +exit: + crypto_sha256_free(&ctx); + + return (ret); +} + +/*********************************************************************/ + +int crypto_hmac_sha256_starts(crypto_sha256_context *ctx, const uint8_t *key, size_t keylen) +{ + crypto_sha256_hmac_context_t *hmac_ctx = NULL; + + if (ctx == NULL || key == NULL || keylen != HMAC_SHA256_KEY_SIZE) + { + return -1; + } + + if (ctx->input != NULL) + { + crypto_free(ctx->input); + ctx->input = NULL; + ctx->block_size = 0; + ctx->total = 0; + } + + hmac_ctx = (crypto_sha256_hmac_context_t *)ctx->instance; + hmac_ctx->hmac_handle.p_instance = HMAC; + hmac_ctx->hmac_handle.init.mode = HMAC_MODE_HMAC; + hmac_ctx->hmac_handle.init.key_fetch_type = HAL_HMAC_KEYTYPE_MCU; + hmac_ctx->hmac_handle.init.p_key = (uint32_t *)key; + hmac_ctx->hmac_handle.init.p_user_hash = NULL; + hmac_ctx->hmac_handle.init.dpa_mode = DISABLE; + + return 0; +} + +int crypto_hmac_sha256_update(crypto_sha256_context *ctx, const uint8_t *input, size_t ilen) +{ + return (crypto_sha256_update(ctx, input, ilen)); +} + +int crypto_hmac_sha256_finish(crypto_sha256_context *ctx, uint8_t output[32]) +{ + if (ctx == NULL || output == NULL) + { + return -1; + } + + return crypto_internal_sha256_finish(ctx, output); +} + +int crypto_hmac_sha256(const uint8_t *key, size_t keylen, const uint8_t *input, size_t ilen, uint8_t output[32]) +{ + int ret = 0; + crypto_sha256_context ctx = { 0 }; + + if (NULL == input) + { + return (-1); + } + + crypto_sha256_init(&ctx); + + if ((ret = crypto_hmac_sha256_starts(&ctx, key, keylen)) != 0) + goto exit; + + if ((ret = crypto_hmac_sha256_update(&ctx, input, ilen)) != 0) + goto exit; + + if ((ret = crypto_hmac_sha256_finish(&ctx, output)) != 0) + goto exit; + +exit: + crypto_sha256_free(&ctx); + + return (ret); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/BUILD.gn new file mode 100644 index 0000000..84c9538 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("dfu_master") { + sources = [ "dfu_master.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.c new file mode 100644 index 0000000..5e888f1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.c @@ -0,0 +1,828 @@ +/** + ***************************************************************************************** + * + * @file dfu_master.c + * + * @brief DFU master Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include "dfu_master.h" +#include "flash_scatter_config.h" +#include +#include "app_log.h" +#include "hal_flash.h" + +/* + * DEFINES + **************************************************************************************** + */ +#define ONCE_SEND_LEN 1024 /**< DFU master once send length. */ +#define RECEIVE_MAX_LEN 2048 /**< DFU master receive max length. */ +#define CMD_FRAME_HEADER_L 0x44 /**< CMD header low byte. */ +#define CMD_FRAME_HEADER_H 0x47 /**< CMD header high byte. */ +#define GET_INFO 0x01 /**< Get info cmd. */ +#define PROGRAM_START 0x23 /**< Program start cmd. */ +#define PROGRAME_FLASH 0x24 /**< Program flash cmd. */ +#define PROGRAME_END 0x25 /**< Program end cmd. */ +#define SYSTEM_INFO 0x27 /**< System information cmd. */ +#define DFU_MODE_SET 0x41 /**< Dfu mode set cmd. */ +#define DFU_FW_INFO_GET 0x42 /**< Dfu fw info get cmd. */ +#define ACK_SUCCESS 0x01 /**< CMD ack success. */ +#define ACK_ERROR 0x02 /**< CMD ack error. */ + +#define DFU_ERASE_REGION_NOT_ALIGNED 0x00 /**< FW erase region not aligned. */ +#define DFU_ERASE_START_SUCCESS 0x01 /**< FW erase start sucess event. */ +#define DFU_ERASEING_SUCCESS 0x02 /**< FW erase flash sucess event. */ +#define DFU_ERASE_END_SUCCESS 0x03 /**< FW erase end sucess event. */ +#define DFU_ERASE_REGIONS_OVERLAP 0x04 /**< FW erase regions overlap. */ +#define DFU_ERASEING_FAIL 0x05 /**< FW erase flash fail event. */ +#define DFU_ERASE_REGIONS_NOT_EXIS 0x06 /**< FW erase regions not exist. */ +#define FAST_DFU_FLASH_SUCCESS 0xFF /**< FW write flash success. */ + +#define FLASH_OP_PAGE_SIZE 0x1000 /**< Flash page size. */ +#define PATTERN_VALUE (0x4744) /**< Pattern value. */ + +#define FW_SIGN_FLAG_OFFSET 72 /**< Firmware sign flag offset. */ +#define SIGN_FW_TYPE 0x10 /**< Sign Firmware Type. */ +#define NORMAL_FW_TYPE 0x00 /**< Normal Firmaware Type. */ + + +/* + * ENUMERATIONS + **************************************************************************************** + */ +/**@brief DFU master submachine state. */ +typedef enum +{ + CHECK_FRAME_L_STATE = 0x00, + CHECK_FRAME_H_STATE, + RECEIVE_CMD_TYPE_L_STATE, + RECEIVE_CMD_TYPE_H_STATE, + RECEIVE_LEN_L_STATE, + RECEIVE_LEN_H_STATE, + RECEIVE_DATA_STATE, + RECEIVE_CHECK_SUM_L_STATE, + RECEIVE_CHECK_SUM_H_STATE, +} cmd_parse_state_t; + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief DFU master receive frame structure define. */ +typedef struct +{ + uint16_t cmd_type; + uint16_t data_len; + uint8_t data[RECEIVE_MAX_LEN]; + uint16_t check_sum; +} receive_frame_t; + +/* + * LOCAL VARIABLE DEFINITIONS + **************************************************************************************** + */ +static receive_frame_t s_receive_frame; +static bool s_cmd_receive_flag; +static uint16_t s_receive_data_count; +static uint32_t s_receive_check_sum; + +static dfu_img_info_t s_now_img_info; +static uint32_t s_page_start_addr; +static uint32_t s_all_check_sum; +static uint32_t s_file_size; +static bool s_run_fw_flag; +static dfu_m_func_cfg_t *s_p_func_cfg; + +static uint16_t s_sended_len; +static uint16_t s_all_send_len; +static uint16_t s_once_size = 350; +static uint8_t* s_send_data_buffer; + +static cmd_parse_state_t s_parse_state = CHECK_FRAME_L_STATE; + +static bool s_sec_flag = false; +static bool s_version_flag = false; + +static uint16_t s_erase_all_count = 0; + +uint8_t dfu_mode_set = 0; +uint32_t dfu_save_addr = 0; +uint8_t fast_dfu_mode = 0; +uint32_t s_program_size; +/** + ***************************************************************************************** + * @brief Function for getting updated firmware information. + * + * @param[in] img_info: Pointer of firmware information + ***************************************************************************************** + */ +static void dfu_m_get_img_info(dfu_img_info_t *img_info) +{ + if(s_p_func_cfg -> dfu_m_get_img_info != NULL) + { + s_p_func_cfg -> dfu_m_get_img_info(img_info); + } +} + +/** + ***************************************************************************************** + * @brief Function for get updated firmware data.. + * + * @param[in] addr: Get data address. + * @param[in] data: Pointer of get data. + * @param[in] len: Get data length + ***************************************************************************************** + */ +static void dfu_m_get_img_data(uint32_t addr, uint8_t *data, uint16_t len) +{ + if(s_p_func_cfg -> dfu_m_get_img_data != NULL) + { + s_p_func_cfg -> dfu_m_get_img_data(addr, data, len); + } +} + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +static void dfu_m_send_data(uint8_t *data, uint16_t len) +{ + if(s_p_func_cfg -> dfu_m_send_data != NULL) + { + s_p_func_cfg -> dfu_m_send_data(data, len); + } +} + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +static void dfu_m_event_handler(dfu_m_event_t event, uint8_t pre) +{ + if(s_p_func_cfg -> dfu_m_event_handler != NULL) + { + s_p_func_cfg -> dfu_m_event_handler(event, pre); + } +} + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +static void dfu_m_cmd_check(void) +{ + uint16_t i = 0; + for(i=0; i= s_once_size) + { + s_sended_len = s_once_size; + } + else + { + s_sended_len = len; + } + + dfu_m_send_data(s_send_data_buffer,s_sended_len); +} + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +static void dfu_m_send_frame(uint8_t *data,uint16_t len,uint16_t cmd_type) +{ + uint8_t send_data[RECEIVE_MAX_LEN + 8]; + uint16_t i = 0; + uint32_t check_sum = 0; + send_data[0] = CMD_FRAME_HEADER_L; + send_data[1] = CMD_FRAME_HEADER_H; + send_data[2] = cmd_type; + send_data[3] = cmd_type >> 8; + send_data[4] = len; + send_data[5] = len >> 8; + + for(i=2; i<6; i++) + { + check_sum += send_data[i]; + } + + for(i=0; i> 8; + dfu_m_send(send_data,len+8); +} + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +static void dfu_m_program_flash(uint16_t len) +{ + uint16_t i=0; + s_program_size += len; + + dfu_m_get_img_data(s_page_start_addr, &s_receive_frame.data[7], len); + for(i=0; i>8; + s_receive_frame.data[3] = dfu_save_addr>>16; + s_receive_frame.data[4] = dfu_save_addr>>24; + + s_receive_frame.data[5] = len; + s_receive_frame.data[6] = len>>8; + + dfu_m_send_frame(s_receive_frame.data, len+7, PROGRAME_FLASH); + dfu_save_addr += len; + s_page_start_addr += len; +} + +static void dfu_m_fast_program_flash(void) +{ + uint16_t remain; + extern uint8_t ble_send_cplt_flag; + uint16_t i = 0; + + while (s_program_size != s_file_size) + { + if (ble_send_cplt_flag || s_program_size == 0) + { + ble_send_cplt_flag = 0; + + dfu_m_get_img_data(s_page_start_addr, &s_receive_frame.data[0], s_once_size); + + if (s_program_size + s_once_size > s_file_size) + { + remain = s_file_size - s_program_size; + dfu_m_send(&s_receive_frame.data[0], remain); + for (i = 0; i < remain; i++) + { + s_all_check_sum += s_receive_frame.data[i]; + } + s_program_size += remain; + } + else + { + s_program_size += s_once_size; + dfu_m_send(&s_receive_frame.data[0], s_once_size); + for (i = 0; i < s_once_size; i++) + { + s_all_check_sum += s_receive_frame.data[i]; + } + } + + s_page_start_addr += s_once_size; + } + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void dfu_m_send_data_cmpl_process(void) +{ + int remain = s_all_send_len - s_sended_len; + + if(remain >= s_once_size) + { + dfu_m_send_data(&s_send_data_buffer[s_sended_len], s_once_size); + s_sended_len += s_once_size; + } + else if(remain > 0) + { + dfu_m_send_data(&s_send_data_buffer[s_sended_len], remain); + s_sended_len += remain; + } +} + + +void dfu_m_cmd_prase(uint8_t* data,uint16_t len) +{ + uint16_t i = 0; + + if(s_cmd_receive_flag == 0) + { + for(i=0; i= RECEIVE_MAX_LEN) + { + s_parse_state = CHECK_FRAME_L_STATE; + } + else + { + s_receive_data_count = 0; + s_parse_state = RECEIVE_DATA_STATE; + } + } + break; + + case RECEIVE_DATA_STATE: + { + s_receive_frame.data[s_receive_data_count] = data[i]; + if(++s_receive_data_count == s_receive_frame.data_len) + { + s_parse_state = RECEIVE_CHECK_SUM_L_STATE; + } + } + break; + + case RECEIVE_CHECK_SUM_L_STATE: + { + s_receive_frame.check_sum = data[i]; + s_parse_state = RECEIVE_CHECK_SUM_H_STATE; + } + break; + + case RECEIVE_CHECK_SUM_H_STATE: + { + s_receive_frame.check_sum |= (data[i] << 8); + s_parse_state = CHECK_FRAME_L_STATE; + dfu_m_cmd_check(); + } + break; + + default:{s_parse_state=CHECK_FRAME_L_STATE;}break; + } + } + } +} + +void dfu_m_init(dfu_m_func_cfg_t *dfu_m_func_cfg, uint16_t once_send_size) +{ + if(once_send_size != 0) + { + s_once_size = once_send_size; + } + + if(dfu_m_func_cfg != NULL) + { + s_p_func_cfg = dfu_m_func_cfg; + } +} + + +void dfu_m_program_start(bool security, bool run_fw) +{ + uint16_t img_len = sizeof(dfu_img_info_t); + uint32_t fw_sign_flag_addr = 0; + uint8_t fw_sign_flag[4] = {0}; + + s_run_fw_flag = run_fw; + s_page_start_addr = 0; + s_all_check_sum = 0; + s_file_size = 0; + s_program_size = 0; + s_receive_frame.data[0] = 0; + + dfu_m_get_img_info(&s_now_img_info); + + if((s_now_img_info.pattern != PATTERN_VALUE) || \ + (s_now_img_info.boot_info.load_addr % FLASH_OP_PAGE_SIZE != 0)) + { + dfu_m_event_handler(IMG_INFO_CHECK_FAIL, 0); + } + + s_page_start_addr = (s_now_img_info.boot_info.load_addr & 0xfffff000); + + s_now_img_info.boot_info.load_addr = dfu_save_addr; + + if(security)//security mode + { + s_file_size = (s_now_img_info.boot_info.bin_size + 48 + 856); + } + else + { + fw_sign_flag_addr = s_page_start_addr + s_now_img_info.boot_info.bin_size + 48 + FW_SIGN_FLAG_OFFSET; + hal_flash_read(fw_sign_flag_addr, fw_sign_flag, sizeof(fw_sign_flag)); + + if (fw_sign_flag[0] == 0x53 && fw_sign_flag[1] == 0x49 && fw_sign_flag[2] == 0x47 && fw_sign_flag[3] == 0x4E) + { + s_file_size = (s_now_img_info.boot_info.bin_size + 48 + 856); + s_receive_frame.data[0] |= SIGN_FW_TYPE; + } + else + { + s_file_size = (s_now_img_info.boot_info.bin_size + 48); + s_receive_frame.data[0] |= NORMAL_FW_TYPE; + } + } + + s_receive_frame.data[0] |= fast_dfu_mode; + + memcpy(&s_receive_frame.data[1], &s_now_img_info, img_len); + + dfu_m_send_frame(s_receive_frame.data, img_len+1, PROGRAM_START); +} + +void dfu_m_parse_state_reset(void) +{ + s_parse_state = CHECK_FRAME_L_STATE; + s_cmd_receive_flag = false; + s_receive_data_count = 0; + s_receive_check_sum = 0; +} + +void dfu_m_get_info(void) +{ + dfu_m_send_frame(s_receive_frame.data, 0, GET_INFO); +} + +void dfu_m_dfu_mode_set(uint8_t dfu_mode) +{ + s_receive_frame.data[0] = dfu_mode; + dfu_m_send_frame(s_receive_frame.data, 1, DFU_MODE_SET); +} + +void dfu_m_dfu_fw_info_get(void) +{ + dfu_m_send_frame(s_receive_frame.data, 0, DFU_FW_INFO_GET); +} + +void dfu_m_system_info_get(void) +{ + // read + uint32_t addr = FLASH_START_ADDR; + s_receive_frame.data[0] = 0x00; + // address + s_receive_frame.data[1] = addr; + s_receive_frame.data[2] = addr >> 8; + s_receive_frame.data[3] = addr >> 16; + s_receive_frame.data[4] = addr >> 24; + //length + s_receive_frame.data[5] = 0x07; + s_receive_frame.data[6] = 0; + + dfu_m_send_frame(s_receive_frame.data, 7, SYSTEM_INFO); +} + +bool dfu_m_get_sec_flag(void) +{ + return s_sec_flag; +} + +void dfu_m_schedule(dfu_m_rev_cmd_cb_t rev_cmd_cb) +{ + uint8_t pre = 0; + uint16_t erase_count = 0; + + if(s_cmd_receive_flag) + { + if (rev_cmd_cb) + { + rev_cmd_cb(); + } + + switch (s_receive_frame.cmd_type) + { + case PROGRAM_START: + if(s_receive_frame.data[0] == ACK_SUCCESS) + { + if (0x00 == fast_dfu_mode) + { + dfu_m_program_flash(ONCE_SEND_LEN); + dfu_m_event_handler(PRO_START_SUCCESS, 0); + } + else if (0x02 == fast_dfu_mode) + { + switch (s_receive_frame.data[1]) + { + case DFU_ERASE_START_SUCCESS: + s_erase_all_count = 0; + s_erase_all_count |= (s_receive_frame.data[2] & 0xff); + s_erase_all_count |= ((s_receive_frame.data[3] << 8) & 0xff00); + dfu_m_event_handler(ERASE_START_SUCCESS, 0); + break; + + case DFU_ERASEING_SUCCESS: + erase_count |= (s_receive_frame.data[2] & 0xff); + erase_count |= ((s_receive_frame.data[3] << 8) & 0xff00); + pre = (erase_count * 100) / s_erase_all_count; + dfu_m_event_handler(ERASEING_SUCCESS, pre); + break; + + case DFU_ERASE_END_SUCCESS: + dfu_m_event_handler(ERASE_END_SUCCESS, 0); + dfu_m_fast_program_flash(); + break; + + case DFU_ERASE_REGION_NOT_ALIGNED: + dfu_m_event_handler(ERASE_REGION_NOT_ALIGNED, 0); + break; + + case DFU_ERASE_REGIONS_OVERLAP: + dfu_m_event_handler(ERASE_REGION_OVERLAP, 0); + break; + + case DFU_ERASEING_FAIL: + dfu_m_event_handler(ERASE_FLASH_FAIL, 0); + break; + + case DFU_ERASE_REGIONS_NOT_EXIS: + dfu_m_event_handler(ERASE_REGION_NOT_EXIST, 0); + break; + + default: + break; + } + } + } + else + { + dfu_m_event_handler(PRO_START_ERROR, 0); + } + break; + + case PROGRAME_FLASH: + if(s_receive_frame.data[0] == ACK_SUCCESS) + { + pre = (s_program_size * 100) / s_file_size; + dfu_m_event_handler(PRO_FLASH_SUCCESS, pre); + //pro success, precent + if(s_program_size == s_file_size) + { + s_receive_frame.data[0] = s_run_fw_flag; + s_receive_frame.data[1] = s_all_check_sum; + s_receive_frame.data[2] = s_all_check_sum>>8; + s_receive_frame.data[3] = s_all_check_sum>>16; + s_receive_frame.data[4] = s_all_check_sum>>24; + dfu_m_send_frame(s_receive_frame.data, 5, PROGRAME_END);//progem end + } + else if(s_program_size + ONCE_SEND_LEN > s_file_size) + { + dfu_m_program_flash(s_file_size - s_program_size); + } + else + { + dfu_m_program_flash(ONCE_SEND_LEN); + } + } + else + { + dfu_m_event_handler(PRO_FLASH_FAIL, pre); + } + break; + + case PROGRAME_END: + if(s_receive_frame.data[0] == ACK_SUCCESS) + { + if (fast_dfu_mode == 0x02) + { + uint32_t check_sum = 0; + check_sum |= (s_receive_frame.data[1] & 0xff); + check_sum |= ((s_receive_frame.data[2] << 8) & 0xff00); + check_sum |= ((s_receive_frame.data[3] << 16) & 0xff0000); + check_sum |= ((s_receive_frame.data[4] << 24) & 0xff000000); + + if (check_sum == s_all_check_sum) + { + dfu_m_event_handler(PRO_END_SUCCESS, 0); + } + else + { + dfu_m_event_handler(PRO_END_FAIL, 0); + } + } + else if (fast_dfu_mode == 0x00) + { + dfu_m_event_handler(PRO_END_SUCCESS, 0); + } + } + else + { + dfu_m_event_handler(PRO_END_FAIL, 0); + } + break; + + case GET_INFO: + dfu_save_addr = 0; + if(s_receive_frame.data[0] == ACK_SUCCESS) + { + // dfu version + if (s_receive_frame.data[17] == DFU_VERSION) + { + s_version_flag = 1; // new version + } + else + { + s_version_flag = 0; // old version + } + dfu_m_system_info_get(); + } + else + { + dfu_m_event_handler(GET_INFO_FAIL, 0); + } + break; + + case DFU_FW_INFO_GET: + if (s_receive_frame.data[0] == ACK_SUCCESS) + { + dfu_save_addr = 0; + dfu_save_addr |= (s_receive_frame.data[1] & 0xff); + dfu_save_addr |= ((s_receive_frame.data[2] << 8) & 0xff00); + dfu_save_addr |= ((s_receive_frame.data[3] << 16) & 0xff0000); + dfu_save_addr |= ((s_receive_frame.data[4] << 24) & 0xff000000); + + dfu_m_dfu_mode_set(0x01); + } + else + { + // error + } + break; + + case SYSTEM_INFO: + if(s_receive_frame.data[0] == ACK_SUCCESS) + { + // security mode + if (s_receive_frame.data[1]) + { + s_sec_flag = true; + } + else + { + s_sec_flag = false; + } + + if (s_version_flag) + { + dfu_m_dfu_fw_info_get(); + } + } + break; + + case FAST_DFU_FLASH_SUCCESS: + if (s_receive_frame.data[0] == ACK_SUCCESS) + { + s_receive_frame.data[0] = s_run_fw_flag; + s_receive_frame.data[1] = s_all_check_sum; + s_receive_frame.data[2] = s_all_check_sum>>8; + s_receive_frame.data[3] = s_all_check_sum>>16; + s_receive_frame.data[4] = s_all_check_sum>>24; + dfu_m_send_frame(s_receive_frame.data, 5, PROGRAME_END);//progem end + } + else + { + dfu_m_event_handler(FAST_DFU_FLASH_FAIL, 0); + } + break; + + default: + break; + } + + s_cmd_receive_flag = 0; + } +} + + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.h new file mode 100644 index 0000000..39c731b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_master/dfu_master.h @@ -0,0 +1,203 @@ +/** + ***************************************************************************************** + * + * @file dfu_master.h + * + * @brief DFU master API. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __DFU_MASTER_H__ +#define __DFU_MASTER_H__ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include +#include +#include "gr55xx_dfu.h" + + +#define DFU_VERSION 0x02 /**< The DFU Version. */ + +/** + * @defgroup DFU_MASTER_ENUM Enumerations + * @{ + */ +/**@brief DFU master event type definition. */ +typedef enum +{ + FRAM_CHECK_ERROR = 0, /**< Frame check error event. */ + IMG_INFO_CHECK_FAIL, /**< FW info check event. */ + GET_INFO_FAIL, /**< GET info error event. */ + PRO_START_ERROR, /**< FW program start error event. */ + PRO_START_SUCCESS, /**< FW program start success event. */ + PRO_FLASH_SUCCESS, /**< FW program success event. */ + PRO_FLASH_FAIL, /**< FW program fail event. */ + PRO_END_SUCCESS, /**< FW program end success event. */ + PRO_END_FAIL, /**< FW program end fail event. */ + ERASE_START_SUCCESS, /**< Erase Flash success. */ + ERASEING_SUCCESS, /**< Erasing Flash success. */ + ERASE_END_SUCCESS, /**< Erase end success. */ + ERASE_REGION_NOT_ALIGNED, /**< Erase regions not aligned. */ + ERASE_REGION_OVERLAP, /**< Erase regions overlap. */ + ERASE_FLASH_FAIL, /**< Erase flash fail. */ + ERASE_REGION_NOT_EXIST, /**< Erase region not exist. */ + FAST_DFU_FLASH_FAIL /**< FW write flash error. */ +}dfu_m_event_t; +/** @} */ + +/** + * @defgroup DFU_MASTER_STRUCT Structures + * @{ + */ +/**@brief IMG information definition. */ +typedef struct +{ + uint16_t pattern; /**< IMG info pattern. */ + uint16_t version; /**< IMG version. */ + dfu_boot_info_t boot_info; /**< IMG boot info. */ + uint8_t comments[12]; /**< IMG comments. */ +}dfu_img_info_t; + +/**@brief DFU master used function config definition. */ +typedef struct +{ + void(*dfu_m_get_img_info)(dfu_img_info_t *img_info); /**< This function is used to get updated firmware information. */ + void (*dfu_m_get_img_data)(uint32_t addr, uint8_t *data, uint16_t len); /**< This function is used to get updated firmware data. */ + void (*dfu_m_send_data)(uint8_t *data, uint16_t len); /**< This function is used to send data to peer device. */ + void (*dfu_m_event_handler)(dfu_m_event_t event, uint8_t pre); /**< This function is used to send event to app. */ +}dfu_m_func_cfg_t; +/** @} */ + +/** + * @defgroup DFU_MASTER_TYPEDEF Typedefs + * @{ + */ +/**@brief DFU Master Receive CMD Callback type. */ +typedef void (*dfu_m_rev_cmd_cb_t)(void); +/** @} */ + +/** + * @defgroup DFU_MASTER_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Function for reset the DFU cmd parse state. + ***************************************************************************************** + */ +void dfu_m_parse_state_reset(void); + +/** + ***************************************************************************************** + * @brief Function for checking DFU master cmd. + * + * @note This function should be called in loop. + ***************************************************************************************** + */ +void dfu_m_schedule(dfu_m_rev_cmd_cb_t rev_cmd_cb); + +/** + ***************************************************************************************** + * @brief Function for start update firmware. + * + * @param[in] security: Upgrade firmware is encrypted?. + * @param[in] run_fw: Whether to run the firmware immediately after the upgrade. + ***************************************************************************************** + */ +void dfu_m_program_start(bool security, bool run_fw); + +/** + ***************************************************************************************** + * @brief Function for get system information. + * + ***************************************************************************************** + */ +void dfu_m_system_info_get(void); + +/** + ***************************************************************************************** + * @brief Function for get information. + * + ***************************************************************************************** + */ +void dfu_m_get_info(void); + +/** + ***************************************************************************************** + * @brief Function for set dfu mode. + * + ***************************************************************************************** + */ +void dfu_m_dfu_mode_set(uint8_t dfu_mode); + +/** + ***************************************************************************************** + * @brief Function for get security mode. + * @return Result of security mode. + ***************************************************************************************** + */ +bool dfu_m_get_sec_flag(void); + +/** + ***************************************************************************************** + * @brief Function for initializing the DFU master. + * + * @note When APP wants to add DFU master feature,all functions in @ref dfu_m_func_cfg_t should be registered. + * + * @param[in] dfu_m_func_cfg: DFU master used functions. + * @param[in] once_send_size: DFU master once send size. + ***************************************************************************************** + */ +void dfu_m_init(dfu_m_func_cfg_t *dfu_m_func_cfg, uint16_t once_send_size); + +/** + ***************************************************************************************** + * @brief Function for prase received data. + * + * @param[in] data: Received data. + * @param[in] len: Data length. + ***************************************************************************************** + */ +void dfu_m_cmd_prase(uint8_t* data,uint16_t len); + +/** + ***************************************************************************************** + * @brief This function should be called when data sended completely. + * + * @retval void + ***************************************************************************************** + */ +void dfu_m_send_data_cmpl_process(void); + +/** @} */ +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/BUILD.gn new file mode 100644 index 0000000..ead8b87 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("dfu_port") { + sources = [ "dfu_port.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.c new file mode 100644 index 0000000..4fc29f1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.c @@ -0,0 +1,1179 @@ +/** + ***************************************************************************************** + * + * @file dfu_port.c + * + * @brief DFU port Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + /* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "dfu_port.h" +#include "hal_flash.h" +#include "grx_hal.h" +#include "otas.h" +#include "grx_sys.h" +#include "ring_buffer.h" +#include "flash_scatter_config.h" +#ifdef ENABLE_DFU_SPI_FLASH + #include "gr55xx_spi_flash.h" +#endif + + +#define FAST_DFU_INIT_STATE 0x00 +#define FAST_DFU_ERASE_FLASH_STATE 0x01 +#define FAST_DFU_PROGRAM_FLASH_STATE 0x02 + +#ifdef SOC_GR5332 +#define CATCH_BUFFER_SIZE (1024*4 + 32) +#define ENV_BUFFER_SIZE 400 +#define ENV_CHECK_SUM_OFFSET 0x28 +#endif + + +enum +{ + DFU_ACK_SUCCESS = 0x01, + DFU_ACK_ERROR, +}; + +enum +{ + DFU_FLASH_INNER, + DFU_FLASH_SPI = 0x01, + + FAST_DFU_INNER = 0x02, + FAST_DFU_SPI = 0X03, +}; + +enum +{ + NORMAL_FIRMWARE = 0x00, + SIGN_FIRMWARE = 0x01, + SECURITY_SIGN_FIRMWARE = 0x02, +}; + +enum +{ + DFU_ERASE_FLASH_ERROR = 0x00, + DFU_ERASE_FLASH_START, + DFU_ERASING_FLASH, + DFU_ERASE_FLASH_END, + DFU_ERASE_FLASH_OVERLAP, + DFU_ERASE_FLASH_OPER_FAILED, + DFU_ERASE_EXT_FLASH_NOT_EXIST, +}; + +#ifdef SOC_GR5332 +extern uint32_t dfu_env_all; +#else +extern uint32_t all_check_sum; +#endif + +extern uint8_t cmd_receive_flag; +extern uint32_t page_start_addr; + +extern void dfu_programing(uint16_t len); +extern void dfu_flash_type_set(uint8_t flash_type); +extern void dfu_program_start(uint32_t all_size); +extern uint32_t dfu_flash_write(const uint32_t addr,const uint8_t *buf, const uint32_t size); +extern uint32_t dfu_flash_read(const uint32_t addr,const uint8_t *buf, const uint32_t size); +extern bool dfu_flash_erase(const uint32_t addr, const uint32_t size); +extern void normal_dfu_schedule(void); + +#ifdef SOC_GR5526 +extern void send_frame_state(dfu_receive_frame_t *p_frame, uint8_t state); +extern uint32_t dfu_flash_cal_check_sum(uint32_t start_addr, uint16_t len); +extern uint32_t dfu_flash_programe(uint32_t address, uint8_t *p_write_buf, uint16_t write_len); +#endif + +#ifdef SOC_GR5332 +extern void dfu_programing_start(uint32_t all_size); +extern void dfu_programing_end(uint8_t status); +extern void dfu_frame_send(uint8_t *data,uint16_t len,uint16_t cmd_type); +#else +extern void dfu_program_start(uint32_t all_size); +extern void dfu_program_end(uint8_t status); +extern bool dfu_security_check_enable(void); +extern void dfu_send_frame(uint8_t *data,uint16_t len,uint16_t cmd_type); +#endif + +static void ble_send_data(uint8_t *p_data, uint16_t length); + +static dfu_info_t s_dfu_info; +static ring_buffer_t s_ble_rx_ring_buffer; +static uint8_t s_write_data[ONCE_WRITE_DATA_LEN]; +static bool s_ring_buffer_over_flag = false; +static uint8_t s_fast_dfu_state = FAST_DFU_INIT_STATE; +static bool s_program_end_flag = false; +static uint32_t s_program_address = 0x00; +static uint32_t s_file_size = 0x00; +static uint16_t s_erase_all_count = 0; +static uint32_t s_all_write_size = 0x00; +static uint16_t s_erase_count = 0; +static uint8_t s_fast_dfu_mode = 0x00; +static uint8_t s_data_buffer[DFU_BUFFER_SIZE]; +static dfu_image_info_t s_now_img_info; +static dfu_enter_callback s_dfu_enter_func = NULL; + +#ifdef SOC_GR5332 +static uint32_t all_check_sum; +static uint32_t *p_all_check_sum = NULL; +static uint8_t cache_data_buffer[CATCH_BUFFER_SIZE] = {0}; +static uint8_t env_data_buffer[ENV_BUFFER_SIZE] = {0}; + +static dfu_func_t s_dfu_func = +{ + .dfu_ble_send_data = ble_send_data, + .dfu_flash_read = hal_exflash_read, + .dfu_flash_write = hal_exflash_write, + .dfu_flash_erase = hal_exflash_erase, + .dfu_flash_get_info = hal_flash_get_info, + .dfu_flash_feat_enable = NULL, +}; + +static dfu_buf_table_t dfu_buffer = +{ + .frame_buf = s_data_buffer, + .frame_size = DFU_BUFFER_SIZE, + .jlink_buf = NULL, + .jlink_size = 0, + .cache_buf = cache_data_buffer, + .cache_size = CATCH_BUFFER_SIZE, + .env_buf = env_data_buffer, + .env_size = ENV_BUFFER_SIZE, +}; +#else +static bool s_flash_security_status = false; +static dfu_func_t s_dfu_func = +{ + .dfu_ble_send_data = ble_send_data, + .dfu_uart_send_data = NULL, + .dfu_flash_read = hal_flash_read, + .dfu_flash_write = hal_flash_write, + .dfu_flash_erase = hal_flash_erase, + .dfu_flash_erase_chip = hal_flash_erase_chip, + .dfu_flash_set_security = hal_flash_set_security, + .dfu_flash_get_security = hal_flash_get_security, + .dfu_flash_get_info = hal_flash_get_info, +}; +#endif + +#if defined(SOC_GR5526) || defined(SOC_GR5525) +static uint8_t s_flash_buffer[DFU_FLASH_SECTOR_SIZE]; + +static dfu_buffer_t dfu_buffer = +{ + .rec_data_buffer = s_data_buffer, + .rec_data_buffer_size = DFU_BUFFER_SIZE, + .flash_op_buffer = s_flash_buffer, + .flash_op_buffer_size = DFU_FLASH_SECTOR_SIZE +}; +#endif + + +#ifdef ENABLE_DFU_SPI_FLASH +static void dfu_spi_flash_init(uint8_t* p_data); /**< flash init. */ +static uint32_t dfu_spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes); /**< read flash data. */ +static uint32_t dfu_spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes); /**< write flash data. */ +static bool dfu_spi_flash_sector_erase(uint32_t address, uint32_t size); /**< erase flash sector. */ +static bool dfu_spi_flash_chip_erase(void); /**< erase flash chip. */ +static void dfu_spi_flash_device_info(uint32_t *id, uint32_t *size); /**< get flash device information. */ + +static dfu_spi_flash_func_t s_dfu_spi_flash_func= /**< SPI used functions config definition. */ +{ + .dfu_spi_flash_init = dfu_spi_flash_init, + .dfu_spi_flash_read = dfu_spi_flash_read, + .dfu_spi_flash_write = dfu_spi_flash_write, + .dfu_spi_flash_erase = dfu_spi_flash_sector_erase, + .dfu_spi_flash_erase_chip = dfu_spi_flash_chip_erase, + .dfu_spi_flash_get_info = dfu_spi_flash_device_info, +}; +#endif + + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +#ifdef SOC_GR5332 +static void dfu_program_start(uint32_t all_size) +{ + dfu_programing_start(all_size); +} + +static void dfu_program_end(uint8_t status) +{ + dfu_programing_end(status); +} + +static void dfu_send_frame(uint8_t *data,uint16_t len,uint16_t cmd_type) +{ + dfu_frame_send(data, len, cmd_type); +} +#endif + + +#ifdef ENABLE_DFU_SPI_FLASH + +static void dfu_spi_flash_init(uint8_t *p_data) +{ + flash_init_t flash_init; + flash_io_t *flash_io = (flash_io_t*)&flash_init.flash_io; + +#ifdef SOC_GR5515 + uint8_t flash_type = p_data[0]; + const app_io_type_t gpio_type[] = {APP_IO_TYPE_NORMAL,APP_IO_TYPE_AON,APP_IO_TYPE_MSIO}; + const uint32_t gpio_pin[] = {APP_IO_PIN_0,APP_IO_PIN_1,APP_IO_PIN_2,APP_IO_PIN_3,APP_IO_PIN_4,APP_IO_PIN_5,APP_IO_PIN_6,APP_IO_PIN_7,\ + APP_IO_PIN_8,APP_IO_PIN_9,APP_IO_PIN_10,APP_IO_PIN_11,APP_IO_PIN_12,APP_IO_PIN_13,APP_IO_PIN_14,APP_IO_PIN_15,\ + APP_IO_PIN_16,APP_IO_PIN_17,APP_IO_PIN_18,APP_IO_PIN_19,APP_IO_PIN_20,APP_IO_PIN_21,APP_IO_PIN_22,APP_IO_PIN_23,\ + APP_IO_PIN_24,APP_IO_PIN_25,APP_IO_PIN_26,APP_IO_PIN_27,APP_IO_PIN_28,APP_IO_PIN_29,APP_IO_PIN_30,APP_IO_PIN_31,}; + const app_io_mux_t gpio_pin_mux[] = {APP_IO_MUX_0,APP_IO_MUX_1,APP_IO_MUX_2,APP_IO_MUX_3,APP_IO_MUX_4,APP_IO_MUX_5,APP_IO_MUX_6,APP_IO_MUX_7,APP_IO_MUX_8}; + + if (flash_type == 0x01) + { + //SPI flash + flash_io->spi_cs.gpio = gpio_type[p_data[1]]; + flash_io->spi_cs.pin = gpio_pin[p_data[2]]; + flash_io->spi_cs.mux = gpio_pin_mux[p_data[3]]; + flash_io->spi_clk.gpio = gpio_type[p_data[4]]; + flash_io->spi_clk.pin = gpio_pin[p_data[5]]; + flash_io->spi_clk.mux = gpio_pin_mux[p_data[6]]; + flash_io->spi_io0.spim_mosi.gpio = gpio_type[p_data[7]]; + flash_io->spi_io0.spim_mosi.pin = gpio_pin[p_data[8]]; + flash_io->spi_io0.spim_mosi.mux = gpio_pin_mux[p_data[9]]; + flash_io->spi_io1.spim_miso.gpio = gpio_type[p_data[10]]; + flash_io->spi_io1.spim_miso.pin = gpio_pin[p_data[11]]; + flash_io->spi_io1.spim_miso.mux = gpio_pin_mux[p_data[12]]; + + flash_init.spi_type = FLASH_SPIM_ID; + flash_init.is_dual_line = false; + flash_init.is_high_freq = false; + + spi_flash_init(&flash_init); + } + else if (flash_type == 0x02)//QSPI flash + { + flash_io->spi_cs.gpio = gpio_type[p_data[1]]; + flash_io->spi_cs.pin = gpio_pin[p_data[2]]; + flash_io->spi_cs.mux = gpio_pin_mux[p_data[3]]; + flash_io->spi_clk.gpio = gpio_type[p_data[4]]; + flash_io->spi_clk.pin = gpio_pin[p_data[5]]; + flash_io->spi_clk.mux = gpio_pin_mux[p_data[6]]; + flash_io->spi_io0.qspi_io0.gpio = gpio_type[p_data[7]]; + flash_io->spi_io0.qspi_io0.pin = gpio_pin[p_data[8]]; + flash_io->spi_io0.qspi_io0.mux = gpio_pin_mux[p_data[9]]; + flash_io->spi_io1.qspi_io1.gpio = gpio_type[p_data[10]]; + flash_io->spi_io1.qspi_io1.pin = gpio_pin[p_data[11]]; + flash_io->spi_io1.qspi_io1.mux = gpio_pin_mux[p_data[12]]; + flash_io->qspi_io2.gpio = gpio_type[p_data[13]]; + flash_io->qspi_io2.pin = gpio_pin[p_data[14]]; + flash_io->qspi_io2.mux = gpio_pin_mux[p_data[15]]; + flash_io->qspi_io3.gpio = gpio_type[p_data[16]]; + flash_io->qspi_io3.pin = gpio_pin[p_data[17]]; + flash_io->qspi_io3.mux = gpio_pin_mux[p_data[18]]; + + flash_init.spi_type = p_data[19] ? FLASH_QSPI_ID1 : FLASH_QSPI_ID0; + flash_init.is_dual_line = false; + flash_init.is_high_freq = false; + + spi_flash_init(&flash_init); + } + else + { + //Unkown flash type + } +#endif + +#if defined(SOC_GR5525) || defined(SOC_GR5526) + uint8_t ssi_id; + + uint8_t flash_type = p_data[0]; + const app_io_type_t gpio_type[] = {APP_IO_TYPE_GPIOA, APP_IO_TYPE_GPIOB, APP_IO_TYPE_GPIOC, APP_IO_TYPE_AON, APP_IO_TYPE_MSIO, APP_IO_TYPE_NORMAL}; + const uint32_t gpio_pin[] = {APP_IO_PIN_0,APP_IO_PIN_1,APP_IO_PIN_2,APP_IO_PIN_3,APP_IO_PIN_4,APP_IO_PIN_5,APP_IO_PIN_6,APP_IO_PIN_7,\ + APP_IO_PIN_8,APP_IO_PIN_9,APP_IO_PIN_10,APP_IO_PIN_11,APP_IO_PIN_12,APP_IO_PIN_13,APP_IO_PIN_14,APP_IO_PIN_15}; + const app_io_mux_t gpio_pin_mux[] = {APP_IO_MUX_0,APP_IO_MUX_1,APP_IO_MUX_2,APP_IO_MUX_3,APP_IO_MUX_4,APP_IO_MUX_5,APP_IO_MUX_6,APP_IO_MUX_7,APP_IO_MUX_8}; + + if(flash_type == 0x01) + { + //SPI flash + flash_io->spi_cs.gpio = gpio_type[p_data[1]]; + flash_io->spi_cs.pin = gpio_pin[p_data[2]]; + flash_io->spi_cs.mux = gpio_pin_mux[p_data[3]]; + flash_io->spi_clk.gpio = gpio_type[p_data[4]]; + flash_io->spi_clk.pin = gpio_pin[p_data[5]]; + flash_io->spi_clk.mux = gpio_pin_mux[p_data[6]]; + flash_io->spi_io0.spim_mosi.gpio = gpio_type[p_data[7]]; + flash_io->spi_io0.spim_mosi.pin = gpio_pin[p_data[8]]; + flash_io->spi_io0.spim_mosi.mux = gpio_pin_mux[p_data[9]]; + flash_io->spi_io1.spim_miso.gpio = gpio_type[p_data[10]]; + flash_io->spi_io1.spim_miso.pin = gpio_pin[p_data[11]]; + flash_io->spi_io1.spim_miso.mux = gpio_pin_mux[p_data[12]]; + + flash_init.spi_type = FLASH_SPIM_ID; + flash_init.is_dual_line = false; + flash_init.is_high_freq = false; + + spi_flash_init(&flash_init); + } + else if(flash_type == 0x02) + { + //QSPI flash + flash_io->spi_cs.gpio = gpio_type[p_data[1]]; + flash_io->spi_cs.pin = gpio_pin[p_data[2]]; + flash_io->spi_cs.mux = gpio_pin_mux[p_data[3]]; + flash_io->spi_clk.gpio = gpio_type[p_data[4]]; + flash_io->spi_clk.pin = gpio_pin[p_data[5]]; + flash_io->spi_clk.mux = gpio_pin_mux[p_data[6]]; + flash_io->spi_io0.qspi_io0.gpio = gpio_type[p_data[7]]; + flash_io->spi_io0.qspi_io0.pin = gpio_pin[p_data[8]]; + flash_io->spi_io0.qspi_io0.mux = gpio_pin_mux[p_data[9]]; + flash_io->spi_io1.qspi_io1.gpio = gpio_type[p_data[10]]; + flash_io->spi_io1.qspi_io1.pin = gpio_pin[p_data[11]]; + flash_io->spi_io1.qspi_io1.mux = gpio_pin_mux[p_data[12]]; + flash_io->qspi_io2.gpio = gpio_type[p_data[13]]; + flash_io->qspi_io2.pin = gpio_pin[p_data[14]]; + flash_io->qspi_io2.mux = gpio_pin_mux[p_data[15]]; + flash_io->qspi_io3.gpio = gpio_type[p_data[16]]; + flash_io->qspi_io3.pin = gpio_pin[p_data[17]]; + flash_io->qspi_io3.mux = gpio_pin_mux[p_data[18]]; + + ssi_id = p_data[19] & 0x0F; + + flash_init.is_dual_line = false; + flash_init.is_high_freq = false; + flash_init.spi_type = (ssi_id == 0) ? FLASH_QSPI_ID0 : ((ssi_id == 1) ? FLASH_QSPI_ID1 : FLASH_QSPI_ID2); + + spi_flash_init(&flash_init); + } + else + { + //Unkown flash type + } +#endif +} + +static uint32_t dfu_spi_flash_read(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + return spi_flash_read(address, buffer, nbytes); +} + +static uint32_t dfu_spi_flash_write(uint32_t address, uint8_t *buffer, uint32_t nbytes) +{ + return spi_flash_write(address, buffer, nbytes); +} + +static bool dfu_spi_flash_sector_erase(uint32_t address, uint32_t size) +{ + return spi_flash_sector_erase(address, size); +} + +static bool dfu_spi_flash_chip_erase(void) +{ + return spi_flash_chip_erase(); +} + +static void dfu_spi_flash_device_info(uint32_t *id, uint32_t *size) +{ + spi_flash_device_info(id, size); +} +#endif + + +static void security_disable(void) +{ +#ifndef SOC_GR5332 + uint32_t sys_security = sys_security_enable_status_check(); + if(sys_security) + { + s_flash_security_status = hal_flash_get_security(); + hal_flash_set_security(false); + } +#endif +} + +static void security_state_recovery(void) +{ +#ifndef SOC_GR5332 + uint32_t sys_security = sys_security_enable_status_check(); + if(sys_security) + { + hal_flash_set_security(s_flash_security_status); + } +#endif +} + +static uint32_t hal_flash_read_judge_security(const uint32_t addr, uint8_t *buf, const uint32_t size) +{ + uint32_t read_bytes = 0; + + security_disable(); + read_bytes = hal_flash_read(addr, buf, size); + security_state_recovery(); + + return read_bytes; +} + +static void fast_dfu_write_data_to_buffer(uint8_t const *p_data, uint16_t length) +{ + ring_buffer_write(&s_ble_rx_ring_buffer, p_data, length); + + if(ring_buffer_surplus_space_get(&s_ble_rx_ring_buffer) < (ONCE_WRITE_DATA_LEN)) + { + if(!s_ring_buffer_over_flag) + { + extern uint8_t g_lld_con_heap_used_ratio_limit; + g_lld_con_heap_used_ratio_limit = 0; + s_ring_buffer_over_flag = true; + } + } +} + + +static void otas_evt_process(otas_evt_t *p_evt) +{ + switch (p_evt->evt_type) + { + case OTAS_EVT_TX_NOTIFICATION_ENABLED: + #ifndef SOC_GR5332 + dfu_cmd_parse_state_reset(); + #else + dfu_cmd_parse_reset(); + #endif + break; + + case OTAS_EVT_RX_RECEIVE_DATA: + if (!s_fast_dfu_mode || s_program_end_flag) + { + dfu_ble_receive_data_process(p_evt->p_data, p_evt->length); + } + else + { + s_fast_dfu_state = FAST_DFU_PROGRAM_FLASH_STATE; + fast_dfu_write_data_to_buffer(p_evt->p_data, p_evt->length); + } + break; + + case OTAS_EVT_NOTIFY_COMPLETE: + dfu_ble_send_data_cmpl_process(); + break; + + case OTAS_EVT_DFU_TASK_ENTER: + if(s_dfu_enter_func != NULL) + { + s_dfu_enter_func(); + } + break; + + default: + break; + } +} + + +static void ble_send_data(uint8_t *p_data, uint16_t length) +{ + otas_notify_tx_data(0, p_data, length); +} + +static bool check_system_info_address(uint32_t addr) +{ + return (addr >= FLASH_START_ADDR && addr < (FLASH_START_ADDR + 0x2000)); +} + +static void get_rom_version(uint8_t *p_read_buf) +{ + uint8_t i = 0; + uint32_t address = SYS_ROM_VERSION_ADDR; + while (i < 8) + { + *(p_read_buf + i) = *(__IO uint8_t*) address++; + i++; + } +} + +static void get_info_replace(dfu_receive_frame_t *p_frame) +{ + sdk_version_t sdk_version; + p_frame->data[0] = DFU_ACK_SUCCESS; + get_rom_version(&p_frame->data[1]); + + sys_sdk_verison_get(&sdk_version); + memcpy(&p_frame->data[9], &sdk_version, sizeof(sdk_version_t)); + + p_frame->data[17] = OTAS_VERSION; + + dfu_send_frame(p_frame->data, 20, p_frame->cmd_type); + cmd_receive_flag = 0; +} + +static void dfu_mode_set(dfu_receive_frame_t *p_frame) +{ + if (p_frame->data[0] == OTAS_DFU_MODE_COPY_UPGRADE) + { + s_dfu_info.dfu_mode_pattern = DFU_COPY_UPGRADE_MODE_PATTERN; + cmd_receive_flag = 0; + } + else + { + s_dfu_info.dfu_mode_pattern = DFU_NON_COPY_UPGRADE_MODE_PATTERN; + + security_disable(); + hal_flash_erase(DFU_INFO_START_ADDR, DFU_FLASH_SECTOR_SIZE); + hal_flash_write(DFU_INFO_START_ADDR, (uint8_t*)&s_dfu_info, sizeof(s_dfu_info)); + security_state_recovery(); + + hal_nvic_system_reset(); + } +} + +static void dfu_fw_info_get(dfu_receive_frame_t *p_frame) +{ + extern struct otas_env_t s_otas_env; + + p_frame->data[0] = DFU_ACK_SUCCESS; + p_frame->data[1] = s_dfu_info.dfu_fw_save_addr & 0xff; + p_frame->data[2] = (s_dfu_info.dfu_fw_save_addr >> 8) & 0xff; + p_frame->data[3] = (s_dfu_info.dfu_fw_save_addr >> 16) & 0xff; + p_frame->data[4] = (s_dfu_info.dfu_fw_save_addr >> 24) & 0xff; + +#ifdef BOOTLOADER_ENABLE + p_frame->data[5] = 0x00; // app bootloader +#else + p_frame->data[5] = 0x01; // app fw +#endif + + hal_flash_read_judge_security(APP_INFO_START_ADDR, (uint8_t *)&p_frame->data[6], sizeof(dfu_image_info_t)); + + dfu_send_frame(p_frame->data, 54, p_frame->cmd_type); + cmd_receive_flag = 0; +} + +static void fast_dfu_erase_flash(void) +{ + if (s_erase_count != s_erase_all_count) + { + uint32_t address = page_start_addr + (s_erase_count * DFU_FLASH_SECTOR_SIZE); +#ifdef SOC_GR5332 + if (!dfu_flash_erase(address, DFU_FLASH_SECTOR_SIZE)) +#else + if (dfu_flash_erase(address, DFU_FLASH_SECTOR_SIZE)) +#endif + { + s_erase_count++; + s_data_buffer[0] = DFU_ACK_SUCCESS; + s_data_buffer[1] = DFU_ERASING_FLASH; + s_data_buffer[2] = s_erase_count & 0xff; + s_data_buffer[3] = (s_erase_count >> 8) & 0xff; + } + else + { + s_data_buffer[0] = DFU_ACK_ERROR; + s_data_buffer[1] = DFU_ERASE_FLASH_OPER_FAILED; + } + } + else + { + s_fast_dfu_state = FAST_DFU_INIT_STATE; + s_data_buffer[0] = DFU_ACK_SUCCESS; + s_data_buffer[1] = DFU_ERASE_FLASH_END; + } + dfu_send_frame(s_data_buffer, 4, 0x23); +} + +static void fast_dfu_cal_check_sum(uint32_t address, uint16_t len) +{ + security_disable(); + dfu_flash_read(address, s_write_data, len); + security_state_recovery(); + + for(uint16_t i=0; idata[0] & 0x0F; + +#ifndef SOC_GR5332 + uint8_t firmware_type = (p_frame->data[0] & 0xF0) >> 4; +#else + p_all_check_sum = (uint32_t *)(dfu_env_all + ENV_CHECK_SUM_OFFSET); +#endif + + bool erase_state = false; + + s_fast_dfu_mode = 0x00; + + if (dfu_type == DFU_FLASH_INNER && p_frame->data_len == (sizeof(dfu_image_info_t) + 1)) // code in flash + { + memcpy(&s_now_img_info, &p_frame->data[1], sizeof(dfu_image_info_t)); + + if ((s_now_img_info.pattern != DFU_IMG_INFO_PATTERN) ||\ + (s_now_img_info.boot_info.load_addr % DFU_FLASH_SECTOR_SIZE != 0) ||\ + check_system_info_address(s_now_img_info.boot_info.load_addr)) + { + p_frame->data[0] = DFU_ACK_ERROR; + dfu_send_frame(p_frame->data, 1, p_frame->cmd_type); + return; + } + +#ifndef SOC_GR5332 + if (dfu_security_check_enable() == true)//security mode + { + s_file_size = s_now_img_info.boot_info.bin_size + 48 + 856; + } + else + { + s_file_size = s_now_img_info.boot_info.bin_size + 48; + } +#else + s_file_size = s_now_img_info.boot_info.bin_size + 48; +#endif + + page_start_addr = (s_now_img_info.boot_info.load_addr & 0xfffff000); + } + else if (dfu_type == FAST_DFU_INNER || dfu_type == FAST_DFU_SPI) + { + s_fast_dfu_mode = 0x01; + + if (p_frame->data_len == (sizeof(dfu_image_info_t) + 1)) // code in flash(fast) + { + memcpy(&s_now_img_info, &p_frame->data[1], sizeof(dfu_image_info_t)); + page_start_addr = (s_now_img_info.boot_info.load_addr & 0xfffff000); + +#ifndef SOC_GR5332 + if (dfu_security_check_enable() == true)//security mode + { + s_file_size = s_now_img_info.boot_info.bin_size + 48 + 856; + } + else + { + if (firmware_type == SIGN_FIRMWARE) + { + s_file_size = s_now_img_info.boot_info.bin_size + 48 + 856; + } + else if (firmware_type == SECURITY_SIGN_FIRMWARE) + { + s_file_size = s_now_img_info.boot_info.bin_size + 48 + 856; + } + else + { + s_file_size = s_now_img_info.boot_info.bin_size + 48; + } + } +#else + s_file_size = s_now_img_info.boot_info.bin_size + 48; +#endif + } + else // data or code in exflash or data in flash(fast) + { + page_start_addr = ((p_frame->data[4] << 24) | (p_frame->data[3] << 16) | (p_frame->data[2] << 8) | (p_frame->data[1])); + s_file_size = ((p_frame->data[8] << 24) | (p_frame->data[7] << 16) | (p_frame->data[6] << 8) | (p_frame->data[5])); + s_now_img_info.boot_info.load_addr = page_start_addr; + } + + if (s_file_size % DFU_FLASH_SECTOR_SIZE) + { + s_erase_all_count = (s_file_size / DFU_FLASH_SECTOR_SIZE) + 1; + } + else + { + s_erase_all_count = s_file_size / DFU_FLASH_SECTOR_SIZE; + } + + if (dfu_type == FAST_DFU_INNER) + { + dfu_flash_type_set(DFU_FLASH_INNER); + } + else + { + dfu_flash_type_set(DFU_FLASH_SPI); + } + + s_program_address = page_start_addr; + p_frame->data[0] = DFU_ACK_SUCCESS; + p_frame->data[1] = DFU_ERASE_FLASH_START; + p_frame->data[2] = s_erase_all_count & 0xff; + p_frame->data[3] = (s_erase_all_count >> 8) & 0xff; + dfu_send_frame(p_frame->data, 4, p_frame->cmd_type); + s_fast_dfu_state = FAST_DFU_ERASE_FLASH_STATE; + s_ring_buffer_over_flag = false; + s_all_write_size = 0; + s_erase_count = 0; + all_check_sum = 0; + s_program_end_flag = false; + ring_buffer_init(&s_ble_rx_ring_buffer, s_data_buffer, DFU_BUFFER_SIZE); + ring_buffer_clean(&s_ble_rx_ring_buffer); + dfu_program_start(s_file_size); + cmd_receive_flag = 0; + return ; + } + else// data in flash, data in exflash, code in exflash + { + page_start_addr = ((p_frame->data[4] << 24) | (p_frame->data[3] << 16) | (p_frame->data[2] << 8) | (p_frame->data[1])); + s_file_size = ((p_frame->data[8] << 24) | (p_frame->data[7] << 16) | (p_frame->data[6] << 8) | (p_frame->data[5])); + s_now_img_info.boot_info.load_addr = page_start_addr; + } + + if (dfu_type == DFU_FLASH_INNER) + { + dfu_flash_type_set(DFU_FLASH_INNER); + } + else + { + dfu_flash_type_set(DFU_FLASH_SPI); + } + + erase_state = dfu_flash_erase(page_start_addr, DFU_FLASH_SECTOR_SIZE); + + if (erase_state) + { + p_frame->data[0] = DFU_ACK_SUCCESS; + } + else + { + p_frame->data[0] = DFU_ACK_ERROR; + } + +#ifdef SOC_GR5332 + *p_all_check_sum = 0; +#else + all_check_sum = 0; +#endif + + dfu_send_frame(p_frame->data, 1, p_frame->cmd_type); + cmd_receive_flag = 0; + dfu_program_start(s_file_size); + dfu_flash_type_set(DFU_FLASH_INNER); +} + +#ifdef SOC_GR5526 +static void program_flash_replace(dfu_receive_frame_t *p_frame) +{ + bool flash_security_status = false; + uint8_t program_type = p_frame->data[0] & 0x0f; + uint8_t flash_type = (p_frame->data[0] & 0xf0)>>4; + uint32_t addr = ((p_frame->data[4] << 24) | (p_frame->data[3] << 16) | (p_frame->data[2] << 8) | (p_frame->data[1])); + uint16_t len = ((p_frame->data[6] << 8) | (p_frame->data[5])); + uint16_t program_state = 0; + uint32_t write_len = 0; + uint32_t write_addr = 0; + uint32_t write_offset = 0; + uint16_t temp_len = len; + + dfu_flash_type_set(flash_type); + if((flash_type == DFU_FLASH_INNER) && check_system_info_address(addr)) + { + send_frame_state(p_frame, DFU_ACK_ERROR); + return; + } + + if(dfu_security_check_enable() == true)//security mode + { + flash_security_status = hal_flash_get_security(); + hal_flash_set_security(false); //need Disable flash write Security auto + } + + if(program_type == 0x01)// 4k + { + write_addr = addr; + write_offset = 0; + + while(len) + { + write_len = len > DFU_FLASH_SECTOR_SIZE ? DFU_FLASH_SECTOR_SIZE : len; + + if((write_addr + write_len) >= (page_start_addr + DFU_FLASH_SECTOR_SIZE)) + { + dfu_flash_erase((page_start_addr + DFU_FLASH_SECTOR_SIZE),DFU_FLASH_SECTOR_SIZE); + page_start_addr += DFU_FLASH_SECTOR_SIZE; + } + program_state = dfu_flash_write(write_addr,&(p_frame->data[7+write_offset]),write_len); + if(program_state != 0) + { + all_check_sum += dfu_flash_cal_check_sum(write_addr, write_len); + } + else + { + break; + } + + write_addr += write_len; + write_offset += write_len; + len -= write_len; + } + } + else if(program_type == 0x00) + { + program_state = dfu_flash_programe(addr,&(p_frame->data[7]),len); + } + else if(program_type == 0x02) + { + program_state = dfu_flash_write(addr,&(p_frame->data[7]),len); + } + + if( program_state != 0) + { + p_frame->data[0] = DFU_ACK_SUCCESS; + if(program_type == 0x01) + { + dfu_programing(temp_len); + } + } + else + { + p_frame->data[0] = DFU_ACK_ERROR; + } + + dfu_send_frame(p_frame->data,1,p_frame->cmd_type); + cmd_receive_flag = 0; + + if(dfu_security_check_enable() == true)//security mode + { + hal_flash_set_security(flash_security_status); //recover + } + dfu_flash_type_set(DFU_FLASH_INNER); +} +#endif + +static void program_end_replace(dfu_receive_frame_t *p_frame) +{ + uint8_t check_result = false; + bool reset_device_flag = false; + uint32_t bin_check_sum = 0; + uint8_t end_flag = p_frame->data[0] & 0x0f; + + bin_check_sum = ((p_frame->data[4] << 24) | (p_frame->data[3] << 16) | (p_frame->data[2] << 8) | (p_frame->data[1])); + + if (bin_check_sum == all_check_sum) + { + check_result = true; + } + +#ifdef SOC_GR5332 + if (!s_fast_dfu_mode && bin_check_sum == (*p_all_check_sum)) + { + check_result = true; + } +#endif + + if (check_result) + { + p_frame->data[0] = 0x01; + } + else + { + p_frame->data[0] = 0x02; + } + + p_frame->data[1] = end_flag; + + if (s_fast_dfu_mode) + { + p_frame->data[1] = all_check_sum & 0xff; + p_frame->data[2] = (all_check_sum >> 8) & 0xff; + p_frame->data[3] = (all_check_sum >> 16) & 0xff; + p_frame->data[4] = (all_check_sum >> 24) & 0xff; + + dfu_send_frame(p_frame->data, 5, p_frame->cmd_type); + s_fast_dfu_mode = 0x00; + } + else + { + dfu_send_frame(p_frame->data,1,p_frame->cmd_type); + } + + if (check_result == 0x01) + { + if (end_flag == 0x01 || end_flag == 0x03) + { + ble_gatts_service_changed(); + dfu_program_end(check_result); + + security_disable(); + + s_dfu_info.dfu_fw_save_addr = s_now_img_info.boot_info.load_addr; + + uint32_t fw_img_info_addr = s_dfu_info.dfu_fw_save_addr + s_now_img_info.boot_info.bin_size; + hal_flash_read(fw_img_info_addr, (uint8_t *)&s_dfu_info.dfu_img_info, sizeof(dfu_image_info_t)); + + hal_flash_erase(DFU_INFO_START_ADDR, DFU_FLASH_SECTOR_SIZE); + +#ifdef BOOTLOADER_ENABLE + hal_flash_erase(APP_INFO_START_ADDR, DFU_FLASH_SECTOR_SIZE); + hal_flash_write(APP_INFO_START_ADDR, (uint8_t*)&s_dfu_info.dfu_img_info, sizeof(s_dfu_info.dfu_img_info)); +#else + hal_flash_write(DFU_INFO_START_ADDR, (uint8_t*)&s_dfu_info, sizeof(s_dfu_info)); +#endif + + security_state_recovery(); + if (end_flag == 0x01) + { + reset_device_flag = true; + delay_ms(200); + hal_nvic_system_reset(); + } + } + } + + if (reset_device_flag == false) + { + dfu_program_end(check_result); + } + dfu_flash_type_set(DFU_FLASH_INNER); + cmd_receive_flag = 0; +} + +uint16_t dfu_port_init(dfu_uart_send_data uart_send_data, uint32_t dfu_fw_save_addr, dfu_pro_callback_t *p_dfu_callback) +{ + memset(&s_dfu_info, 0, sizeof(s_dfu_info)); + + if (uart_send_data != NULL) + { + s_dfu_func.dfu_uart_send_data = uart_send_data; + } + +#ifdef SOC_GR5515 + dfu_init(&s_dfu_func, s_data_buffer, p_dfu_callback); + s_dfu_info.dfu_fw_save_addr = dfu_fw_save_addr; + + dfu_set_cmd_handler(0x00, 0x01, get_info_replace); + dfu_set_cmd_handler(0x06, 0X23, program_start_replace); + dfu_set_cmd_handler(0x08, 0x25, program_end_replace); + + dfu_set_cmd_handler(0x1C, 0X41, dfu_mode_set); + dfu_set_cmd_handler(0x1D, 0X42, dfu_fw_info_get); +#endif + +#ifdef SOC_GR5525 + dfu_init(&s_dfu_func, &dfu_buffer, p_dfu_callback); + s_dfu_info.dfu_fw_save_addr = dfu_fw_save_addr; + + dfu_set_cmd_handler(0x00, 0x01, get_info_replace); + dfu_set_cmd_handler(0x08, 0X23, program_start_replace); + dfu_set_cmd_handler(0x0A, 0x25, program_end_replace); + + dfu_set_cmd_handler(0x1C, 0X41, dfu_mode_set); + dfu_set_cmd_handler(0x1D, 0X42, dfu_fw_info_get); +#endif + +#ifdef SOC_GR5526 + dfu_init(&s_dfu_func, &dfu_buffer, p_dfu_callback); + s_dfu_info.dfu_fw_save_addr = dfu_fw_save_addr; + + dfu_set_cmd_handler(0x00, 0x01, get_info_replace); + dfu_set_cmd_handler(0x07, 0X23, program_start_replace); + dfu_set_cmd_handler(0x08, 0X24, program_flash_replace); + dfu_set_cmd_handler(0x09, 0x25, program_end_replace); + + dfu_set_cmd_handler(0x1C, 0X41, dfu_mode_set); + dfu_set_cmd_handler(0x1D, 0X42, dfu_fw_info_get); +#endif + +#ifdef SOC_GR5332 + if (SDK_SUCCESS != dfu_init(&s_dfu_func, &dfu_buffer, p_dfu_callback)) + { + return SDK_ERR_SDK_INTERNAL; + } + s_dfu_info.dfu_fw_save_addr = dfu_fw_save_addr; + + dfu_cmd_handler_set(0x00, 0x01, get_info_replace); + dfu_cmd_handler_set(0x08, 0X23, program_start_replace); + dfu_cmd_handler_set(0x0A, 0x25, program_end_replace); + + dfu_cmd_handler_set(0x1C, 0X41, dfu_mode_set); + dfu_cmd_handler_set(0x1D, 0X42, dfu_fw_info_get); +#endif + +#ifdef ENABLE_DFU_SPI_FLASH + dfu_spi_flash_func_config(&s_dfu_spi_flash_func); +#endif + + return SDK_SUCCESS; +} + +void dfu_service_init(dfu_enter_callback dfu_enter) +{ + otas_init_t otas_init; + + if (dfu_enter != NULL) + { + s_dfu_enter_func = dfu_enter; + } + + otas_init.evt_handler = otas_evt_process; + otas_service_init(&otas_init); +} + +#ifdef SOC_GR5332 +void dfu_ble_set_mtu_size(uint16_t mtu_size) +{ + +} +#endif + +static void fast_dfu_program_schedule(void) +{ + uint16_t read_len = 0; + uint16_t items_size = 0; + + items_size = ring_buffer_items_count_get(&s_ble_rx_ring_buffer); + if (items_size >= ONCE_WRITE_DATA_LEN) + { + read_len = ring_buffer_read(&s_ble_rx_ring_buffer, s_write_data, ONCE_WRITE_DATA_LEN); + + security_disable(); + dfu_flash_write(s_program_address, s_write_data, read_len); + security_state_recovery(); + + fast_dfu_cal_check_sum(s_program_address, read_len); + s_all_write_size += read_len; + s_program_address += read_len; + dfu_programing(read_len); + } + else + { + if (s_all_write_size + items_size == s_file_size) + { + read_len = ring_buffer_read(&s_ble_rx_ring_buffer, s_write_data, items_size); + if (read_len) + { + security_disable(); + dfu_flash_write(s_program_address, s_write_data, read_len); + security_state_recovery(); + + fast_dfu_cal_check_sum(s_program_address, read_len); + s_all_write_size += read_len; + } + dfu_programing(read_len); + + s_program_end_flag = true; + s_data_buffer[0] = DFU_ACK_SUCCESS; + dfu_send_frame(s_data_buffer, 1, 0xFF); // write over + s_fast_dfu_state = FAST_DFU_INIT_STATE; + } + } + + if (s_ring_buffer_over_flag && !s_program_end_flag) + { + if (ring_buffer_surplus_space_get(&s_ble_rx_ring_buffer) > ONCE_WRITE_DATA_LEN) + { + sys_lld_max_msg_usage_ratio_set(90); + s_ring_buffer_over_flag = false; + } + } +} + +void fast_dfu_schedule(void) +{ + switch (s_fast_dfu_state) + { + case FAST_DFU_ERASE_FLASH_STATE: + fast_dfu_erase_flash(); + break; + + case FAST_DFU_PROGRAM_FLASH_STATE: + fast_dfu_program_schedule(); + break; + + default: + break; + } +} + +void dfu_schedule(void) +{ + normal_dfu_schedule(); + fast_dfu_schedule(); +} + +uint16_t dfu_fw_image_info_get(uint32_t dfu_fw_save_addr, uint32_t fw_image_size, bool is_sign_fw, dfu_image_info_t *p_image_info) +{ + uint32_t fw_image_info_addr; + + if (!p_image_info) + { + return SDK_ERR_POINTER_NULL; + } + + if (is_sign_fw) + { + fw_image_info_addr = dfu_fw_save_addr + fw_image_size - 856; + if (sizeof(dfu_image_info_t) != hal_flash_read(fw_image_info_addr, (uint8_t *)&p_image_info, sizeof(dfu_image_info_t))) + { + return SDK_ERR_SDK_INTERNAL; + } + } + else + { + fw_image_info_addr = dfu_fw_save_addr + fw_image_size - 48; + if (sizeof(dfu_image_info_t) != hal_flash_read(fw_image_info_addr, (uint8_t *)&p_image_info, sizeof(dfu_image_info_t))) + { + return SDK_ERR_SDK_INTERNAL; + } + } + + return SDK_SUCCESS; +} + + +uint16_t dfu_info_update(uint32_t dfu_info_start_addr, dfu_image_info_t *p_image_info, uint32_t dfu_fw_save_addr, uint32_t dfu_mode_pattern) +{ + dfu_info_t dfu_info; + + if (!p_image_info) + { + return SDK_ERR_POINTER_NULL; + } + + dfu_info.dfu_fw_save_addr = dfu_fw_save_addr; + memcpy(&dfu_info.dfu_fw_save_addr, p_image_info, sizeof(dfu_image_info_t)); + dfu_info.dfu_mode_pattern = dfu_mode_pattern; + + if (!hal_flash_erase(dfu_info_start_addr, DFU_FLASH_SECTOR_SIZE)) + { + return SDK_ERR_SDK_INTERNAL; + } + + if (sizeof(dfu_image_info_t) != hal_flash_write(dfu_info_start_addr, (uint8_t *)&dfu_info, sizeof(dfu_info_t))) + { + return SDK_ERR_SDK_INTERNAL; + } + + return SDK_SUCCESS; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.h new file mode 100644 index 0000000..bf86993 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/dfu_port/dfu_port.h @@ -0,0 +1,133 @@ +/** + ***************************************************************************************** + * + * @file dfu_port.h + * + * @brief DFU port API. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef _DFU_PORT_H__ +#define _DFU_PORT_H__ + +#include "gr_includes.h" +#include "otas.h" + +#define ONCE_WRITE_DATA_LEN 2048 /**< The data length of flash write-once. */ +#define DFU_BUFFER_SIZE 8192 /**< The dfu buffer size. */ + +#define DFU_COPY_UPGRADE_MODE_PATTERN 0x44425942 /**< Double Bank update mode. */ +#define DFU_NON_COPY_UPGRADE_MODE_PATTERN 0x53424e42 /**< Single Bank update mode. */ + +#define DFU_FLASH_SECTOR_SIZE 4096 /**< Flash sector size. */ +#define DFU_INFO_START_ADDR (FLASH_START_ADDR + 0x3000) /**< The start address of dfu info. */ +#define APP_INFO_START_ADDR (FLASH_START_ADDR + 0x2000) /**< The address of app info. */ +#define CHIP_REGS_BASE_ADDR_SEC (PERIPH_BASE + 0x10000) /**< The address of chip regs. */ + + +/**@brief DFU info. */ +typedef struct +{ + uint32_t dfu_fw_save_addr; /**< The save addr of dfu firmware. */ + dfu_image_info_t dfu_img_info; /**< The img_info of dfu firmware. */ + uint32_t dfu_mode_pattern; /**< The dfu mode pattern. */ +} dfu_info_t; + +/**@brief DFU uart send data function definition. */ +typedef void (*dfu_uart_send_data)(uint8_t *p_data, uint16_t length); + +/**@brief DFU enter callback definition. */ +typedef void (*dfu_enter_callback)(void); + +/** + ***************************************************************************************** + * @brief DFU BLE service init. + * + * @param[in] dfu_enter: DFU enter callback. + ***************************************************************************************** + */ +void dfu_service_init(dfu_enter_callback dfu_enter); + +/** + ***************************************************************************************** + * @brief DFU port init. + * @details If not using serial port update function, uart_send_data can be set NULL. + if the user doesn't care about the upgrade status,p_dfu_callback can set NULL. + * + * @param[in] uart_send_data : Function is used to send data to master by UART. + * @param[in] dfu_fw_save_addr: The start address of the upgraded firmware stored in flash + * @param[in] p_dfu_callback : DFU program state callback functions. + ***************************************************************************************** + */ +uint16_t dfu_port_init(dfu_uart_send_data uart_send_data, uint32_t dfu_fw_save_addr, dfu_pro_callback_t *p_dfu_callback); + +/** + ***************************************************************************************** + * @brief Function for checking DFU cmd. + * + * @note This function should be called in main loop. + ***************************************************************************************** + */ +void dfu_schedule(void); + +/** + **************************************************************************************** + * @brief get the dfu firmware image info. + * + * @param[in] dfu_fw_save_addr: The dfu firmware save address + * @param[in] fw_image_size : The size of firmware + * @param[in] is_sign_fw : Whether it is an sign firware + * @param[out] p_image_info : The temporary variables that save imag_info + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t dfu_fw_image_info_get(uint32_t dfu_fw_save_addr, uint32_t fw_image_size, bool is_sign_fw, dfu_image_info_t *p_image_info); + + +/** + **************************************************************************************** + * @brief Update the dfu info + * + * @param[in] dfu_info_start_addr : The start address of dfu info + * @param[in] p_image_info : The image info of update + * @param[in] dfu_fw_save_addr : The start address of dfu firmware + * @param[in] dfu_mode_pattern : The dfu mode pattern + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t dfu_info_update(uint32_t dfu_info_start_addr, dfu_image_info_t *p_image_info, uint32_t dfu_fw_save_addr, uint32_t dfu_mode_pattern); +/** @} */ + + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/BUILD.gn new file mode 100644 index 0000000..a3713d9 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("fault_trace") { + sources = [ "fault_trace.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.c new file mode 100644 index 0000000..8fe5d6e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.c @@ -0,0 +1,480 @@ +/** + ***************************************************************************************** + * + * @file fault_trace.c + * + * @brief App Log Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "fault_trace.h" +#include "app_assert.h" +#include "grx_sys.h" +#include +#include +#include + +#if SYS_FAULT_TRACE_ENABLE + +/* + * DEFINES + ***************************************************************************************** + */ +#define FAULT_INFO_NVDS_TAG_BASE 0xA000 +#define FAULT_INFO_DB_ENV_TAG FAULT_INFO_NVDS_TAG_BASE + 0 +#define FAULT_INFO_DB_ENV_LEN sizeof(fault_info_db_env_t) +#define FAULT_INFO_LEN_MAX 1024 +#define ASSERT_FILE_NAME_LEN 64 +#define ASSERT_EXPR_NAME_LEN 64 + +#define ASSERT_ERROR 0x01 /**< Assert type: Error. */ +#define ASSERT_WARNING 0x02 /**< Assert type: Waring. */ +#define ASSERT_PARAM 0x03 /**< Assert type: Parameter check. */ + +/* + * STRUCTURES + ***************************************************************************************** + */ +/**@brief Assert information save. */ +typedef struct +{ + uint8_t assert_type; + char file_name[ASSERT_FILE_NAME_LEN]; + int file_line; + int param0; + int param1; + char expr[ASSERT_EXPR_NAME_LEN]; +} assert_info_t; + + + +/* + * LOCAL VARIABLE DEFINITIONS + **************************************************************************************** + */ +static fault_info_db_env_t s_fault_info_db_env; +static char s_fault_info[FAULT_INFO_LEN_MAX] = {0}; +static assert_info_t s_assert_info; + + + +/* + * LOCAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +/** + ***************************************************************************************** + * @brief Assert info save. + * + * @param[in] p_assert_info: Pointer to assert info. + ***************************************************************************************** + */ +SECTION_RAM_CODE static void assert_info_save(assert_info_t *p_assert_info) +{ + memset(s_fault_info, 0, FAULT_INFO_LEN_MAX); + + p_assert_info->file_name[ASSERT_FILE_NAME_LEN - 1] = ' '; + p_assert_info->expr[ASSERT_EXPR_NAME_LEN - 1] = ' '; + + + if (ASSERT_ERROR == p_assert_info->assert_type) + { + sprintf(s_fault_info, + "(%s: %d) [ERROR] %s\r\n", + p_assert_info->file_name, + p_assert_info->file_line, + p_assert_info->expr); + } + else if (ASSERT_WARNING == p_assert_info->assert_type) + { + sprintf(s_fault_info, + "(%s: %d) [WARNING] Param0:%d,Param1:%d\r\n", + p_assert_info->file_name, + p_assert_info->file_line, + p_assert_info->param0, + p_assert_info->param1); + } + else if (ASSERT_PARAM == p_assert_info->assert_type) + { + sprintf(s_fault_info,"(%s: %d) [PARAM] Param0:%d,Param1:%d\r\n", + p_assert_info->file_name, + p_assert_info->file_line, + p_assert_info->param0, + p_assert_info->param1); + } + + fault_db_record_add((uint8_t *)s_fault_info, strlen(s_fault_info)); +} + +/** + ***************************************************************************************** + * @brief Assert warning callback. + * + * @param[in] param0: Parameter 0. + * @param[in] param1: Parameter 1. + * @param[in] file: File name. + * @param[in] line: Line number. + ***************************************************************************************** + */ +SECTION_RAM_CODE void app_assert_warn_cb(int param0, int param1, const char *file, int line) +{ + uint32_t file_name_len = 0; + + file_name_len = (ASSERT_FILE_NAME_LEN < strlen(file)) ? ASSERT_FILE_NAME_LEN : strlen(file); + + memset(&s_assert_info, 0, sizeof(assert_info_t)); + memcpy(s_assert_info.file_name, file, file_name_len); + + s_assert_info.assert_type = ASSERT_WARNING; + s_assert_info.file_line = line; + s_assert_info.param0 = param0; + s_assert_info.param1 = param1; + + assert_info_save(&s_assert_info); +} + +/** + ***************************************************************************************** + * @brief Assert param callback. + * + * @param[in] param0: Parameter 0. + * @param[in] param1: Parameter 1. + * @param[in] file: File name. + * @param[in] line: Line number. + ***************************************************************************************** + */ +SECTION_RAM_CODE void app_assert_param_cb(int param0, int param1, const char *file, int line) +{ + __disable_irq(); + + uint32_t file_name_len = 0; + + file_name_len = (ASSERT_FILE_NAME_LEN < strlen(file)) ? ASSERT_FILE_NAME_LEN : strlen(file); + + memset(&s_assert_info, 0, sizeof(assert_info_t)); + memcpy(s_assert_info.file_name, file, file_name_len); + + s_assert_info.assert_type = ASSERT_PARAM; + s_assert_info.file_line = line; + s_assert_info.param0 = param0; + s_assert_info.param1 = param1; + + assert_info_save(&s_assert_info); + + while(1); +} + +/** + ***************************************************************************************** + * @brief Assert error callback. + * + * @param[in] expr: Pxpression. + * @param[in] file: File name. + * @param[in] line: Line number. + ***************************************************************************************** + */ +SECTION_RAM_CODE void app_assert_err_cb(const char *expr, const char *file, int line) +{ + __disable_irq(); + + uint32_t expre_len = 0; + uint32_t file_name_len = 0; + + file_name_len = (ASSERT_FILE_NAME_LEN < strlen(file)) ? ASSERT_FILE_NAME_LEN : strlen(file); + expre_len = (ASSERT_EXPR_NAME_LEN < strlen(expr)) ? ASSERT_EXPR_NAME_LEN : strlen(expr); + + memset(&s_assert_info, 0, sizeof(assert_info_t)); + memcpy(s_assert_info.file_name, file, file_name_len); + memcpy(s_assert_info.expr, expr, expre_len); + + s_assert_info.assert_type = ASSERT_ERROR; + s_assert_info.file_line = line; + + assert_info_save(&s_assert_info); + while(1); +} + + +/** + ***************************************************************************************** + * @brief Update fault info record database environment variables. + ***************************************************************************************** + */ +static sdk_err_t fault_info_db_env_update(void) +{ + if (nvds_put(FAULT_INFO_DB_ENV_TAG, FAULT_INFO_DB_ENV_LEN, (uint8_t *)&s_fault_info_db_env)) + { + return SDK_ERR_SDK_INTERNAL; + } + else + { + return SDK_SUCCESS; + } +} + +/** + ***************************************************************************************** + * @brief Database is already exist or not. + * + * @return True or False. + ***************************************************************************************** + */ +static bool fault_info_db_is_available(void) +{ + fault_info_db_env_t db_env; + uint16_t length = FAULT_INFO_DB_ENV_LEN; + + return (NVDS_TAG_NOT_EXISTED == nvds_get(FAULT_INFO_DB_ENV_TAG, &length, (uint8_t *)&db_env)) ? false : true; +} + +/** + ***************************************************************************************** + * @brief Get fault info record database environment variables. + * + * @return Result of get. + ***************************************************************************************** + */ +static sdk_err_t fault_info_db_get(void) +{ + fault_info_db_env_t db_env; + uint16_t length = FAULT_INFO_DB_ENV_LEN; + + if (nvds_get(FAULT_INFO_DB_ENV_TAG, &length, (uint8_t *)&db_env)) + { + return SDK_ERR_SDK_INTERNAL; + } + else + { + memcpy(&s_fault_info_db_env, &db_env, FAULT_INFO_DB_ENV_LEN); + return SDK_SUCCESS; + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +sdk_err_t fault_trace_db_init(void) +{ + app_assert_init(); + + if (fault_info_db_is_available()) + { + return fault_info_db_get(); + } + else + { + for (uint8_t i = 0; i < FAULT_INFO_RECORDS_MAX; i++) + { + s_fault_info_db_env.rec_tag[i] = 0xFFFF; + } + + s_fault_info_db_env.rec_num = 0; + s_fault_info_db_env.usable_tag = FAULT_INFO_DB_ENV_TAG + 1; + + return fault_info_db_env_update(); + } +} + +sdk_err_t fault_db_record_add(const uint8_t *p_data, uint16_t length) +{ + sdk_err_t error_code; + + if (FAULT_INFO_RECORDS_MAX <= s_fault_info_db_env.rec_num) + { + s_fault_info_db_env.usable_tag = s_fault_info_db_env.rec_tag[0]; + s_fault_info_db_env.rec_tag[FAULT_INFO_RECORDS_MAX - 1] = 0xFFFF; + s_fault_info_db_env.rec_num--; + memcpy(&s_fault_info_db_env.rec_tag[0], + &s_fault_info_db_env.rec_tag[1], + (FAULT_INFO_RECORDS_MAX - 1) * sizeof(NvdsTag_t)); + } + + if (nvds_put(s_fault_info_db_env.usable_tag, length, p_data)) + { + return SDK_ERR_SDK_INTERNAL; + } + + if (FAULT_INFO_RECORDS_MAX <= s_fault_info_db_env.rec_num) + { + s_fault_info_db_env.rec_num++; + s_fault_info_db_env.rec_tag[FAULT_INFO_RECORDS_MAX - 1] = s_fault_info_db_env.usable_tag; + } + else + { + s_fault_info_db_env.rec_tag[s_fault_info_db_env.rec_num] = s_fault_info_db_env.usable_tag; + s_fault_info_db_env.rec_num++; + s_fault_info_db_env.usable_tag++; + } + + error_code = fault_info_db_env_update(); + + if (error_code) + { + s_fault_info_db_env.rec_num--; + s_fault_info_db_env.usable_tag--; + s_fault_info_db_env.rec_tag[s_fault_info_db_env.rec_num] = 0xffff; + } + + return error_code; +} + +uint8_t fault_db_records_num_get(void) +{ + return s_fault_info_db_env.rec_num; +} + +uint32_t fault_db_records_total_len_get(void) +{ + uint32_t total_len = 0; + + for (uint8_t i = 0; i <= s_fault_info_db_env.rec_num; i++) + { + total_len += nvds_tag_length(s_fault_info_db_env.rec_tag[i]); + } + + return total_len; +} + + +sdk_err_t fault_db_records_dump(uint8_t *p_buffer, uint32_t *p_length) +{ + uint16_t dump_len = 0; + uint16_t resi_len = 0; + uint32_t buff_len = *p_length; + + if (buff_len < fault_db_records_total_len_get()) + { + return SDK_ERR_INVALID_BUFF_LENGTH; + } + + for (uint8_t i = 0; i < s_fault_info_db_env.rec_num; i++) + { + resi_len = ((buff_len - dump_len) >= FAULT_INFO_LEN_MAX) ? FAULT_INFO_LEN_MAX : buff_len - dump_len; + + if (nvds_get(s_fault_info_db_env.rec_tag[i], &resi_len, &p_buffer[dump_len])) + { + *p_length = dump_len; + + return SDK_ERR_SDK_INTERNAL; + } + else + { + dump_len += resi_len; + } + } + + *p_length = dump_len; + + return SDK_SUCCESS; +} + +sdk_err_t fault_db_record_clear(void) +{ + for (uint8_t i = 0; i < s_fault_info_db_env.rec_num; i++) + { + nvds_del(s_fault_info_db_env.rec_tag[i]); + s_fault_info_db_env.rec_tag[i] = 0xFFFF; + } + + s_fault_info_db_env.rec_num = 0; + s_fault_info_db_env.usable_tag = FAULT_INFO_DB_ENV_TAG + 1; + + return fault_info_db_env_update(); +} + +#if defined ( __CC_ARM ) +void hardfault_trace_handler(unsigned int sp) +{ + unsigned int stacked_r0; + unsigned int stacked_r1; + unsigned int stacked_r2; + unsigned int stacked_r3; + unsigned int stacked_r12; + unsigned int stacked_lr; + unsigned int stacked_pc; + unsigned int stacked_psr; + + stacked_r0 = ((unsigned long *)sp)[0]; + stacked_r1 = ((unsigned long *)sp)[1]; + stacked_r2 = ((unsigned long *)sp)[2]; + stacked_r3 = ((unsigned long *)sp)[3]; + stacked_r12 = ((unsigned long *)sp)[4]; + stacked_lr = ((unsigned long *)sp)[5]; + stacked_pc = ((unsigned long *)sp)[6]; + stacked_psr = ((unsigned long *)sp)[7]; + + memset(s_fault_info, 0, FAULT_INFO_LEN_MAX); + + sprintf(s_fault_info, "HARDFAULT CALLSTACK INFO: R0-%08X R1-%08X R2-%08X R3-%08X R12-%08X LR-%08X PC-%08X XPSR-%08X\r\n", + stacked_r0, stacked_r1, stacked_r2, stacked_r3, stacked_r12, stacked_lr, stacked_pc, stacked_psr); + + fault_db_record_add((uint8_t *)s_fault_info, strlen(s_fault_info)); +} + +#elif defined ( __GNUC__ ) + +void hardfault_trace_handler(unsigned int *args) +{ + unsigned int stacked_r0; + unsigned int stacked_r1; + unsigned int stacked_r2; + unsigned int stacked_r3; + unsigned int stacked_r12; + unsigned int stacked_lr; + unsigned int stacked_pc; + unsigned int stacked_psr; + + stacked_r0 = ((unsigned long)args[0]); + stacked_r1 = ((unsigned long)args[1]); + stacked_r2 = ((unsigned long)args[2]); + stacked_r3 = ((unsigned long)args[3]); + + stacked_r12 = ((unsigned long)args[4]); + stacked_lr = ((unsigned long)args[5]); + stacked_pc = ((unsigned long)args[6]); + stacked_psr = ((unsigned long)args[7]); + + memset(s_fault_info, 0, FAULT_INFO_LEN_MAX); + + sprintf(s_fault_info, "HARDFAULT CALLSTACK INFO: R0-%08X R1-%08X R2-%08X R3-%08X R12-%08X LR-%08X PC-%08X XPSR-%08X\r\n", + stacked_r0, stacked_r1, stacked_r2, stacked_r3, stacked_r12, stacked_lr, stacked_pc, stacked_psr); + + fault_db_record_add((uint8_t *)s_fault_info, strlen(s_fault_info)); +} +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.h new file mode 100644 index 0000000..8387d6d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fault_trace/fault_trace.h @@ -0,0 +1,153 @@ +/** + **************************************************************************************** + * + * @file fault_trace.h + * + * @brief System Fault Trace API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __FAULT_TRACE_H__ +#define __FAULT_TRACE_H__ + +#include "custom_config.h" +#include "grx_sys.h" +#include +#include + +#if SYS_FAULT_TRACE_ENABLE + +/** + * @defgroup FAULT_TRACE_MAROC Defines + * @{ + */ +#define FAULT_INFO_RECORDS_MAX 0x10 /**< Maximum number of fault info records. */ +/** @} */ + +/** + * @defgroup FAULT_TRACE_STRUCT Structures + * @{ + */ +/**@brief System fault info database environment variable. */ +typedef struct +{ + NvdsTag_t rec_tag[FAULT_INFO_RECORDS_MAX]; /**< System fault info record tags. */ + uint16_t rec_num; /**< Number of all fault info records in database. */ + NvdsTag_t usable_tag; /**< Current usable NVDS tag. */ +} fault_info_db_env_t; +/** @} */ + +/** + * @defgroup FAULT_TRACE_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize system fault info record database. + * + * @return Result of initialize. + ***************************************************************************************** + */ +sdk_err_t fault_trace_db_init(void); + +/** + ***************************************************************************************** + * @brief Add a record at the end of the database. + * + * @param[in] p_data: Pointer to log data. + * @param[in] length: Length of data. + * + * @return Result of add. + ***************************************************************************************** + */ +sdk_err_t fault_db_record_add(const uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Get the number of records in the database. + * + * @return Number of records in the database. + ***************************************************************************************** + */ +uint8_t fault_db_records_num_get(void); + +/** + ***************************************************************************************** + * @brief Get the length of all records info in the database. + * + * @return Length of all records info in the database. + ***************************************************************************************** + */ +uint32_t fault_db_records_total_len_get(void); + +/** + ***************************************************************************************** + * @brief Dump records from the database. + * + * @param[in,out] p_buffer: Pointer to buffer. + * @param[in,out] p_length: Pointer to buffer length + ***************************************************************************************** + */ +sdk_err_t fault_db_records_dump(uint8_t *p_buffer, uint32_t *p_length); + +/** + ***************************************************************************************** + * @brief Clear database. + ***************************************************************************************** + */ +sdk_err_t fault_db_record_clear(void); + +#if defined ( __CC_ARM ) +/** + ***************************************************************************************** + * @brief Hardfault trace handler. + * + * @param[in] sp: Stack Pointer. + ***************************************************************************************** + */ +void hardfault_trace_handler(unsigned int sp); + +#elif defined ( __GNUC__ ) + +/** + ***************************************************************************************** + * @brief Hardfault trace handler. + * + * @param[in] args: Hardfault args. + ***************************************************************************************** + */ +void hardfault_trace_handler(unsigned int *args); +#endif +/** @} */ +#endif +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/BUILD.gn new file mode 100644 index 0000000..c95817a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("fcc") { + sources = [ "dtm_fcc_test.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.c new file mode 100644 index 0000000..a73a1e5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.c @@ -0,0 +1,145 @@ +#include +#include +#include +#include +#include "dtm_fcc_test_int.h" + +void fcc_test_init(void) +{ + bb_watch_timer_start = bb_watch_timer_start_fcc; + g_bb_watch_alarm.cb_alarm = bb_watch_timer_cbk_fcc; +} + +void dtm_test_init(void) +{ + bb_watch_timer_start = bb_watch_timer_start_dtm; + g_bb_watch_alarm.cb_alarm = bb_watch_timer_cbk_dtm; +} + +void em_ble_txrxcntl_txpwr_setf(int elt_idx, uint8_t txpwr) +{ + EM_BLE_WR(EM_BLE_TXRXCNTL_ADDR + elt_idx * REG_EM_BLE_CS_SIZE, \ + (EM_BLE_RD(EM_BLE_TXRXCNTL_ADDR + elt_idx * REG_EM_BLE_CS_SIZE) & ~((uint16_t)0x000000FF)) | ((uint16_t)txpwr << 0)); +} + +uint32_t ble_rwblecntl_get(void) +{ + return REG_BLE_RD(BLE_RWBLECNTL_ADDR); +} + +void ble_rwblecntl_set(uint32_t value) +{ + REG_BLE_WR(BLE_RWBLECNTL_ADDR, value); +} + +void bb_watch_timer_cbk_fcc(struct sch_alarm_tag* elt) +{ + if(lld_test_env != NULL) + { + // Point to parameters + struct lld_test_env_tag* test_par = lld_test_env; + if ((test_par->type == TEST_TX) && (test_par->data_len < 255)) + { + // Abort the event + ble_rwblecntl_set(ble_rwblecntl_get() | BLE_RFTEST_ABORT_BIT); + } + } +} + +uint16_t em_ble_rxccmpktcnt0_get(int elt_idx) +{ + return EM_BLE_RD(EM_BLE_RXCCMPKTCNT0_ADDR + elt_idx * REG_EM_BLE_CS_SIZE); +} + +void lld_test_frm_isr_fcc(uint32_t timestamp, bool abort) +{ + if(lld_test_env != NULL) + { + // Point to parameters + struct lld_test_env_tag* test_par = lld_test_env; + struct sch_arb_elt_tag* evt = &(lld_test_env->evt); + + // Remove event + sch_arb_remove(evt, true); + + // Check test mode end + if(test_par->state == TEST_EVT_END) + { + // Report test mode end to LLM + struct lld_test_end_ind* ind = KE_MSG_ALLOC(LLD_TEST_END_IND, TASK_LLM, TASK_NONE, lld_test_end_ind); + ind->status = CO_ERROR_NO_ERROR; + ind->nb_pkt_recv = (test_par->type == TEST_RX) ? em_ble_rxccmpktcnt0_get(EM_BLE_CS_ACT_ID_TO_INDEX(TEST_LINK_ID)) : 0; + ke_msg_send(ind); + + if (test_par->type == TEST_TX) + { + // Release TX buffer + ble_util_buf_acl_tx_free(test_par->em_buf); + } + + // Free event memory + lld_test_cleanup(); + } + else + { + // update event priority + evt->current_prio = abort + ? (evt->current_prio + rwip_priority[RWIP_PRIO_ADV_IDX].increment) + : rwip_priority[RWIP_PRIO_ADV_IDX].value; + + do + { + // Reschedule ASAP + SCH_ARB_ASAP_STG_SET(evt, SCH_ARB_FLAG_NO_ASAP, SCH_ARB_NO_PHASE, 0, 0); + evt->time.hs = CLK_ADD_2(rwip_time_get().hs, FCC_IFS_HALF_SLOT); + + // Try to reschedule + if (sch_arb_insert(evt) == 0) + { + test_par->state = TEST_EVT_WAIT; + break; + } + }while(1); + } + } +} + +void lld_test_frm_cbk_fcc(uint32_t timestamp, uint32_t dummy, uint8_t irq_type) +{ + FPB_PATCH_OFF(); + switch(irq_type) + { + case SCH_FRAME_IRQ_EOF: + { + lld_test_frm_isr_fcc(timestamp, false); + } break; + case SCH_FRAME_IRQ_EOF_ABORT: + { + lld_test_frm_isr_fcc(timestamp, true); + } break; + case SCH_FRAME_IRQ_RX: + { + lld_test_rx_isr_patch(timestamp); + } break; + } + FPB_PATCH_ON(); +} + +void bb_watch_timer_start_fcc(struct sch_prog_params* params) +{ + FPB_PATCH_OFF(); + g_bb_watch_alarm.timestamp = CLK_ADD_2(rwip_time_get().hs, 1); + sch_alarm_clear(&g_bb_watch_alarm); + sch_alarm_set(&g_bb_watch_alarm); + + /*In general, DTM project will be used with 0dbm at most of time, + so we want to reset the txpower to 0dbm by reset the register, + why the code place at here is that we don't want to import more patch*/ + if(TEST_LINK_ID == params->cs_idx) + { + uint8_t et_idx = sch_prog_env.et_idx_next_prog; + sch_prog_env.tab[et_idx].frm_cbk = lld_test_frm_cbk_fcc; + em_ble_txrxcntl_txpwr_setf(0, rwip_rf.txpwr_cs_get(TX_Power_dbm, 0)); + } + FPB_PATCH_ON(); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.h new file mode 100644 index 0000000..34d2a5e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test.h @@ -0,0 +1,27 @@ +#ifndef __DTM_FCC_TEST_H__ +#define __DTM_FCC_TEST_H__ + +#include +#include +#include +#include + +/** + ***************************************************************************************** + * @brief Initialize the FCC test environment. + * + * @note This function is used to prepare the FCC test environment. + ***************************************************************************************** + */ +void fcc_test_init(void); + +/** + ***************************************************************************************** + * @brief Save system context. + * + * @note This function is used to prepare the DTM test environment. + ***************************************************************************************** + */ +void dtm_test_init(void); + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test_int.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test_int.h new file mode 100644 index 0000000..24599e7 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/fcc/dtm_fcc_test_int.h @@ -0,0 +1,550 @@ +#ifndef __DTM_FCC_TEST_INT_H__ +#define __DTM_FCC_TEST_INT_H__ + +#include +#include +#include +#include + +/// FCC IFS +#define FCC_IFS_HALF_SLOT 4 + +/// Alias +#define bb_watch_timer_start_dtm bb_watch_timer_start_patch +#define bb_watch_timer_cbk_dtm bb_watch_timer_cbk_patch + +/// Clock +#define RWIP_MAX_CLOCK_TIME ((1L<<28) - 1) +#define CLK_ADD_2(clock_a, clock_b) ((uint32_t)(((clock_a) + (clock_b)) & RWIP_MAX_CLOCK_TIME)) + +/// Register Operations +#define REG_BLE_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value) +#define REG_BLE_RD(addr) (*(volatile uint32_t *)(addr)) +#define EM_BLE_RD(addr) (*(volatile uint16_t *)(addr)) +#define EM_BLE_WR(addr, value) (*(volatile uint16_t *)(addr)) = (value) + +/// CS Index +#define TEST_LINK_ID (0) +#define EM_BLE_CS_ACT_ID_TO_INDEX(act_id) (act_id) + +/// Baseband Register Address +#define REG_EM_BLE_CS_SIZE (108) +#define CO_ALIGN2_HI(val) (((val)+1)&~1) +#define REG_CORE_BASE_ADDR (0xB0000000) +#define REG_EM_BASE_ADDR (0xB0008000) +#define BLE_RWBLECNTL_ADDR (REG_CORE_BASE_ADDR + 0x00000000) +#define EM_COMMON_OFFSET (0) + +/// Exchange table area definition +#define EM_EXCH_TABLE_LEN 16 +#define EM_ET_OFFSET (EM_COMMON_OFFSET) +#define EM_ET_END (EM_ET_OFFSET + EM_EXCH_TABLE_LEN * REG_EM_ET_SIZE) + +/// Frequency table area definition +#define EM_FT_OFFSET (EM_ET_END) +#define EM_RF_FREQ_TABLE_LEN 40 +#define EM_RF_VCO_TABLE_LEN 0 +#define EM_FT_END (EM_FT_OFFSET + (EM_RF_VCO_TABLE_LEN + EM_RF_FREQ_TABLE_LEN) * sizeof(uint8_t)) +#define EM_COMMON_END (EM_FT_END) + +/// Encryption area definition +#define EM_ENC_OFFSET CO_ALIGN2_HI(EM_COMMON_END) +#define EM_ENC_IN_OFFSET (EM_ENC_OFFSET) +#define EM_ENC_IN_SIZE (16) +#define EM_ENC_OUT_OFFSET (EM_ENC_IN_OFFSET + EM_ENC_IN_SIZE) +#define EM_ENC_OUT_SIZE (16) +#define EM_ENC_END (EM_ENC_OFFSET + EM_ENC_IN_SIZE + EM_ENC_OUT_SIZE) +#define EM_BLE_OFFSET (EM_ENC_END) +#define EM_BLE_CS_OFFSET (EM_BLE_OFFSET) +#define EM_BLE_RXCCMPKTCNT0_ADDR (REG_EM_BASE_ADDR + 0x00000056 + EM_BLE_CS_OFFSET) + +/// TXRXCNTL register definition +#define EM_BLE_TXRXCNTL_ADDR (REG_EM_BASE_ADDR + 0x00000020 + EM_BLE_CS_OFFSET) + +/// Baseband Register Bits +#define BLE_RFTEST_ABORT_BIT ((uint32_t)0x04000000) + +/// EM ET Size +#define REG_EM_ET_SIZE 16 + +/// Error Code +#define CO_ERROR_NO_ERROR 0x00 + +/// Convenient wrapper to ke_msg_alloc() +#define KE_MSG_ALLOC(id, dest, src, param_str) \ + (struct param_str*) ke_msg_alloc(id, dest, src, sizeof(struct param_str)) + +/// Build the first message ID of a task. (in fact a ke_msg_id_t) +#define TASK_FIRST_MSG(task) ((uint16_t)((task) << 8)) + +/// Tasks types definition, this value shall be in [0-254] range +#define TASK_ID_LLD (2) +#define TASK_NONE (0xFF) + +/// FPB Definitions +typedef enum +{ + FPB_PATCH_OFF=0, + FPB_PATCH_ON, +}fpb_t; + +void fpb_set_state(fpb_t state); + +fpb_t fpb_save_state(void); + +void fpb_load_state(fpb_t state); + +#define FPB_SAVE() fpb_t __fpb_state_local_var=fpb_save_state() +#define FPB_LOAD() fpb_load_state(__fpb_state_local_var) +#define FPB_PATCH_ON() fpb_save_state(); +#define FPB_PATCH_OFF() fpb_load_state(FPB_PATCH_OFF) + +/// Test mode event states +enum TEST_TYPE +{ + TEST_RX, + TEST_TX, +}; + +/// Message API of the LLM task +/*@TRACE*/ +enum lld_msg_id +{ + LLD_MSG_ID_FIRST = TASK_FIRST_MSG(TASK_ID_LLD), + + /* + * ************** Msg LD->LLM**************** + */ + LLD_ADV_REP_IND, + LLD_SCAN_REQ_IND, + LLD_SYNC_START_REQ, + LLD_PER_ADV_REP_IND, + LLD_PER_ADV_RX_END_IND, + LLD_SCAN_END_IND, + LLD_ADV_END_IND, + LLD_PER_ADV_END_IND, + LLD_INIT_END_IND, + LLD_TEST_END_IND, +}; + +enum KE_TASK_TYPE +{ + // Link Layer Tasks + TASK_LLM, +}; + +/// Frame type +enum SCH_FRAME_IRQ +{ + /// Normal End of Event + SCH_FRAME_IRQ_EOF = 0x00, + /// End of event due to an abort + SCH_FRAME_IRQ_EOF_ABORT = 0x01, + /// SKIP Event IRQ + SCH_FRAME_IRQ_SKIP = 0x04, + /// RX ACL IRQ + SCH_FRAME_IRQ_RX = 0x02, + /// TX ACL IRQ + SCH_FRAME_IRQ_TX = 0x03, +}; + +/// Priority index definition +enum rwip_prio_idx +{ + /// Default priority for scanning events + RWIP_PRIO_SCAN_IDX, + /// Default priority for auxillary scan/init (no_asap) rx events + RWIP_PRIO_AUX_RX_IDX, + /// Default priority for periodic adv rx events + RWIP_PRIO_PER_ADV_RX_DFT_IDX, + /// Default priority for initiating events + RWIP_PRIO_INIT_IDX, + /// LE connection events default priority + RWIP_PRIO_CONNECT_DFT_IDX, + /// LE connection events priority with activity + RWIP_PRIO_CONNECT_ACT_IDX, + /// Default priority for advertising events + RWIP_PRIO_ADV_IDX, + /// Default priority for advertising high duty cycle events + RWIP_PRIO_ADV_HDC_IDX, + /// Default priority for aux advertising events + RWIP_PRIO_ADV_AUX_IDX, + /// Default priority for periodic advertising events + RWIP_PRIO_PER_ADV_IDX, + /// Default priority for resolvable private addresses renewal event + RWIP_PRIO_RPA_RENEW_IDX, + + RWIP_PRIO_IDX_MAX +}; + +/// ASAP type definition +enum sch_arb_elt_asap_type +{ + /// 00: No ASAP + SCH_ARB_FLAG_NO_ASAP = 0, + /// 01: ASAP no limit + SCH_ARB_FLAG_ASAP_NO_LIMIT, + /// 10: ASAP with limit + SCH_ARB_FLAG_ASAP_LIMIT, + SCH_ARB_FLAG_MAX +}; + +/// ASAP slot parity definition +enum sch_arb_elt_asap_phase +{ + SCH_ARB_PHASE_0, + SCH_ARB_PHASE_1, + SCH_ARB_PHASE_2, + SCH_ARB_PHASE_3, + SCH_ARB_NO_PHASE, +}; + +/// Test mode event states +enum TEST_EVT_STATE +{ + TEST_EVT_WAIT, + TEST_EVT_ACTIVE, + TEST_EVT_END, +}; + +/// Set ASAP settings +#define SCH_ARB_ASAP_STG_SET(evt, type, phase, resched_att, prio_inc) \ +(evt->asap_settings = \ +( (((type) << 14) & 0xC000) | (((phase) << 11) & 0x3800) | \ + (((resched_att) << 4) & 0x03F0) | (((prio_inc) << 0) & 0x000F) )); + +/// List +struct co_list_hdr +{ + /// Pointer to next co_list_hdr + struct co_list_hdr *next; +}; + +/// simplify type name of list element header +typedef struct co_list_hdr co_list_hdr_t; + +/// Message Identifier. The number of messages is limited to 0xFFFF. +typedef uint16_t ke_msg_id_t; + +/// Task Identifier. Composed by the task type and the task index. +typedef uint16_t ke_task_id_t; + +/// Callback for interrupt related to the frame +typedef void (*frm_cbk_t)(uint32_t timestamp, uint32_t dummy, uint8_t irq_type); + +/// Alarm information +struct sch_alarm_tag +{ + /// List element for chaining in the Even Arbiter lists + struct co_list_hdr hdr; + + /// Timestamp of alarm expiry (in BT half-slots) + uint32_t timestamp; + + /// Call back function invoked upon alarm expiry + void (*cb_alarm)(struct sch_alarm_tag*); +}; + +/// Test mode end indication structure +struct lld_test_end_ind +{ + /// Status (BLE error code) + uint8_t status; + + /// Number of packets received + uint16_t nb_pkt_recv; +}; + +/// Time information +typedef struct +{ + /// Integer part of the time (in half-slot) + uint32_t hs; + /// Fractional part of the time (in half-us) (range: 0-624) + uint32_t hus; +} rwip_time_t; + +/// Additional parameters for BLE frame +struct sch_prog_params_ble +{ + /// Advertising channel type: 0x0: AE Start on Primary channel | 0x1: AE Start on Secondary channel + uint8_t ae_nps; + /// Reserved audio event (0: reTx, 1:primary) + uint8_t rsvd; + /// Isochronous event (0: normal event | 1: iso event) + uint8_t iso; + /// Start Instant Correction (SIC) bit value + uint8_t sic; +}; + +/// Parameters for a programmed frame +struct sch_prog_params +{ + /// Callback for handling interrupts related to the frame + frm_cbk_t frm_cbk; + /// Timestamp (in half-slots, based on local clock) and event offset (in half-us) of the programmed frame + rwip_time_t time; + /// Bandwidth duration of the event using priority 1 (in half us) + uint32_t bandwidth; + /// Dummy value reported when an event happen during the frame or the frame is completed + uint32_t dummy; + /// Priority during duration of bandwidth + uint8_t prio_1; + /// Priority after bandwidth elapsed + uint8_t prio_2; + /// Priority after trigger conditions + uint8_t prio_3; + /// Priority when specific action occurs during the event + uint8_t pti_prio; + /// Control structure index + uint8_t cs_idx; + /// Mode (0: BLE, 1:BT) + uint8_t mode; + + union + { + /// Additional parameters for BLE frame + struct sch_prog_params_ble ble; + } add; +}; + +/// Scheduling Arbiter Element +/*@TRACE*/ +struct sch_arb_elt_tag +{ + /// List element for chaining in the Even Arbiter lists + struct co_list_hdr hdr; + + /// Programming time expressed in half-slots and half-us + rwip_time_t time; + + /// Scheduling time limit in base time (half-slots) (only for ASAP LIMIT requests) + uint32_t asap_limit; + + /// Minimum duration of the event or frame (in half-us) + uint32_t duration_min; + + /** + * ASAP settings field + * bit |15 14|13 12 11| 10 | 9..4 | 3..0 | + * def | TYPE | Phase | To protect | Resched att | Prio inc | + * + * Type: + * - 00: No ASAP + * - 01: ASAP no limit + * - 10: ASAP with limit + * - 11: ASAP with limit, no parity check + * + * Phase: (only for ASAP requests) + * - 0: phase 0 + * - 1: phase 1 + * - 2: phase 2 + * - 3: phase 3 + * - 4: don't care + * + * Number of rescheduling attempts: + * - The remaining number of rescheduling attempts. + * - Rescheduling happens when the event is overlapped by a higher priority event + * - Only used for ASAP requests + * + * Priority increment: + * - The current priority value is incremented each time the event is overlapped by a new insertion and postponed + * - Only used for ASAP requests + */ + /*@trc_desc + *bit |15..14| 13..11 | 10 | 9..4 | 3..0 | + *def | Type | Phase | Rsvd | Resched_att | Prio_inc | + * + *Phase: only if Type = 01..11 + *Resched_att: only if Type = 01..11 + *Prio_inc: only if Type = 01..11 + * + *@trc_ref Type: + * - 00: No ASAP + * - 01: ASAP no limit + * - 10: ASAP with limit + * - 11: ASAP with limit and no parity check + * + *@trc_ref Phase: + * - 000: phase 0 + * - 001: phase 1 + * - 010: phase 2 + * - 011: phase 3 + * - 100: don-t care + */ + uint16_t asap_settings; + + /// Current priority + uint8_t current_prio; + /// Latency to notify to stop the activity before next activity is notified to start (in half-slots, 0 if no stop required) + uint8_t stop_latency; + // GDX Controller, Activity Role + uint8_t activity_role; + // GDX Controller, CS Index + uint8_t cs_idx; + + /************************************************************************************ + * ISR CALLBACKS + ************************************************************************************/ + + /// Start notification call back function + void (*cb_start)(struct sch_arb_elt_tag*); + /// Stop notification call back function + void (*cb_stop)(struct sch_arb_elt_tag*); + /// Cancel notification call back function + void (*cb_cancel)(struct sch_arb_elt_tag*); +}; + +/// LLD test mode environment structure +struct lld_test_env_tag +{ + /// Pointer to inquiry event + struct sch_arb_elt_tag evt; + + /// Buffer used for sending the test data + uint16_t em_buf; + + /// Type (0: RX | 1: TX) + uint8_t type; + + /// RF channel, N = (F - 2402) / 2 + uint8_t channel; + + /// Length of test data + uint8_t data_len; + + /** + * Packet payload + * 0x00 PRBS9 sequence "11111111100000111101" (in transmission order) as described in [Vol 6] Part F, Section 4.1.5 + * 0x01 Repeated "11110000" (in transmission order) sequence as described in [Vol 6] Part F, Section 4.1.5 + * 0x02 Repeated "10101010" (in transmission order) sequence as described in [Vol 6] Part F, Section 4.1.5 + * 0x03 PRBS15 sequence as described in [Vol 6] Part F, Section 4.1.5 + * 0x04 Repeated "11111111" (in transmission order) sequence + * 0x05 Repeated "00000000" (in transmission order) sequence + * 0x06 Repeated "00001111" (in transmission order) sequence + * 0x07 Repeated "01010101" (in transmission order) sequence + * 0x08-0xFF Reserved for future use + */ + uint8_t payload; + + /// current state of the test mode + uint8_t state; +}; + +/// Structure of a frame element +struct sch_prog_frm_elt +{ + /// Timestamp of the programmed frame (in BLE half slots, based on local clock) + uint32_t timestamp; + /// Callback for handling interrupts related to the frame + frm_cbk_t frm_cbk; + /// Dummy value (to be reported to the driver) + uint32_t dummy; + /// Indicate if the frame is valid (programmed and not skipped or finished) + bool valid; +}; + +/// SCH_PROG environment structure +struct sch_prog_env_tag +{ + /// Frame elements pool + struct sch_prog_frm_elt tab[REG_EM_ET_SIZE]; + + /// Exchange table index of the oldest entry currently used by the HW + uint8_t et_idx_current; + + /// Next exchange table index to program + uint8_t et_idx_next_prog; + + /// Number of programmed frames + uint8_t nb_prog; +}; + +/// API functions of the RF driver that are used by the BLE or BT software +struct rwip_rf_api +{ + /// Function called upon HCI reset command reception + void (*reset)(void); + /// Function called to enable/disable force AGC mechanism (true: en / false : dis) + void (*force_agc_enable)(bool); + /// Function called when TX power has to be decreased for a specific link id + bool (*txpwr_dec)(uint8_t); + /// Function called when TX power has to be increased for a specific link id + bool (*txpwr_inc)(uint8_t); + /// Function called when TX power has to be set to max for a specific link id + void (*txpwr_max_set)(uint8_t); + /// Function called to convert a TX power CS power field into the corresponding value in dBm + int8_t (*txpwr_dbm_get)(uint8_t, uint8_t); + /// Function called to convert a power in dBm into a control structure tx power field + uint8_t (*txpwr_cs_get)(int8_t, bool); + /// Function called to convert the RSSI read from the control structure into a real RSSI + int8_t (*rssi_convert)(uint8_t); + /// Function used to read a RF register + uint32_t (*reg_rd)(uint32_t); + /// Function used to write a RF register + void (*reg_wr)(uint32_t, uint32_t); + /// Function called to put the RF in deep sleep mode + void (*sleep)(void); + void (*default_tx_power_set)(int8_t); + int8_t (*default_tx_power_get)(); + /// Index of minimum TX power + uint8_t txpwr_min; + /// Index of maximum TX power + uint8_t txpwr_max; + /// RSSI high threshold ('real' signed value in dBm) + int8_t rssi_high_thr; + /// RSSI low threshold ('real' signed value in dBm) + int8_t rssi_low_thr; + /// interferer threshold ('real' signed value in dBm) + int8_t rssi_interf_thr; + /// RF wakeup delay (in slots) + uint8_t wakeup_delay; + /// GDX Controller : Index of default TX power + uint8_t txpwr_default; + /// Function called to change tx mode + uint8_t (*tx_mode_set)(uint8_t); + /// Function called to get tx mode + uint8_t (*tx_mode_get)(void); + /// Index of rf match circuit (ohm) + uint8_t mat_cir; + /// Function called to set rf match circuit (ohm) + void (*mat_cir_set)(uint8_t); + /// Function called to get rf match circuit (ohm) + uint8_t (*mat_cir_get)(void); +}; + +/// Internal API for priority +struct rwip_prio +{ + ///value + uint8_t value; + ///Increment + uint8_t increment; +}; + +/// External Objects +extern void (*bb_watch_timer_start)(struct sch_prog_params* params); +extern struct sch_alarm_tag g_bb_watch_alarm; +extern struct lld_test_env_tag* lld_test_env; +extern void bb_watch_timer_start_patch(struct sch_prog_params* params); +extern void bb_watch_timer_cbk_patch(struct sch_alarm_tag* elt); +extern void bb_watch_timer_start_fcc(struct sch_prog_params* params); +extern void bb_watch_timer_cbk_fcc(struct sch_alarm_tag* elt); +extern rwip_time_t rwip_time_get(void); +extern uint8_t sch_alarm_clear(struct sch_alarm_tag* elt); +extern void sch_alarm_set(struct sch_alarm_tag* elt); +extern int8_t TX_Power_dbm; +extern frm_cbk_t lld_test_frm_cbk; +extern struct sch_prog_env_tag sch_prog_env; +extern struct rwip_rf_api rwip_rf; +extern const struct rwip_prio rwip_priority[RWIP_PRIO_IDX_MAX]; +extern uint8_t sch_arb_remove(struct sch_arb_elt_tag *elt, bool not_waiting); +extern uint8_t (*sch_arb_insert)(struct sch_arb_elt_tag *); +extern void lld_test_cleanup(void); +extern void ble_util_buf_acl_tx_free(uint16_t buf); +extern void *ke_msg_alloc(ke_msg_id_t const id, ke_task_id_t const dest_id, + ke_task_id_t const src_id, uint16_t const param_len); +extern void ke_msg_send(void const *param_ptr); +extern void lld_test_rx_isr_patch(uint32_t timestamp); + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/font_gb2312.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/font_gb2312.c new file mode 100644 index 0000000..3d893ef --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/font_gb2312.c @@ -0,0 +1,24637 @@ +/**@brief gb2312 font define. */ +const uint8_t s_font_gb2312[]= +{ + /* 0xA1A1 [ ] [1]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A2 [?] [2]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x18,0x0C,0x04,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A3 [?] [3]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x24,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A4 [] [4]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A5 [] [5]*/ + 0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A6 [?] [6]*/ + 0x00,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A7 [] [7]*/ + 0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x60,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A8 [?] [8]*/ + 0x00,0x00,0x00,0x00,0x02,0x02,0x02,0x04,0x04,0x09,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1A9 [?] [9]*/ + 0x00,0x00,0x04,0x04,0x04,0x0F,0x08,0x10,0x20,0x05,0x02,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x20,0xF0,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1AA [] [10]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1AB [~] [11]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x23,0x40,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x88,0x70,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1AC [?] [12]*/ + 0x00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00, + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00, + /* 0xA1AD [] [13]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x63,0x63,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1AE [] [14]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x10,0x20,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1AF [] [15]*/ + 0x00,0x18,0x18,0x08,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B0 [] [16]*/ + 0x00,0x00,0x01,0x02,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x88,0x10,0x20,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B1 [] [17]*/ + 0x00,0x19,0x19,0x08,0x11,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B2 [?] [18]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x00, + /* 0xA1B3 [?] [19]*/ + 0x00,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B4 [<] [20]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x00,0x00, + /* 0xA1B5 [>] [21]*/ + 0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B6 [] [22]*/ + 0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x09,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00, + 0x10,0x24,0x48,0x90,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x90,0x48,0x24,0x10,0x00, + /* 0xA1B7 [] [23]*/ + 0x08,0x24,0x12,0x09,0x04,0x02,0x01,0x00,0x01,0x02,0x04,0x09,0x12,0x24,0x08,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x90,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA1B8 [?] [24]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + /* 0xA1B9 [?] [25]*/ + 0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x3C,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1BA [?] [26]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xFC,0x84,0xBC,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xA0,0xE0,0x00,0x00,0x00,0x00, + /* 0xA1BB [?] [27]*/ + 0x00,0x00,0x00,0x00,0x07,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x3D,0x21,0x3F,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1BC [?] [28]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0xFC,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0xFC,0x00, + /* 0xA1BD [?] [29]*/ + 0x00,0x3F,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x3F,0x00, + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + /* 0xA1BE [?] [30]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0xFC,0xF8,0xF0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,0xE0,0xE0,0xF0,0xF8,0xFC,0x00, + /* 0xA1BF [?] [31]*/ + 0x00,0x3F,0x1F,0x0F,0x07,0x07,0x03,0x03,0x03,0x03,0x07,0x07,0x0F,0x1F,0x3F,0x00, + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + /* 0xA1C0 [] [32]*/ + 0x00,0x00,0x01,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x01,0x00,0x1F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00, + /* 0xA1C1 [] [33]*/ + 0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0x00, + /* 0xA1C2 [] [34]*/ + 0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x3F,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1C3 [:] [35]*/ + 0x00,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x06,0x06,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1C4 [?] [36]*/ + 0x00,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x00,0x00, + 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x00,0x00, + /* 0xA1C5 [?] [37]*/ + 0x00,0x00,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x01,0x00, + 0x00,0x00,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00, + /* 0xA1C6 [?] [38]*/ + 0x00,0x7F,0x30,0x18,0x0C,0x06,0x03,0x01,0x01,0x02,0x04,0x08,0x10,0x20,0x7F,0x00, + 0x00,0xFC,0x04,0x04,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x04,0x04,0xFC,0x00, + /* 0xA1C7 [?] [39]*/ + 0x00,0x7F,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3C,0x00, + 0x00,0xF8,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0x60,0xF0,0x00, + /* 0xA1C8 [?] [40]*/ + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x07,0x00, + 0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0xC0,0x00, + /* 0xA1C9 [n] [41]*/ + 0x00,0x07,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + 0x00,0xC0,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00, + /* 0xA1CA [?] [42]*/ + 0x00,0x01,0x06,0x08,0x08,0x10,0x10,0x1F,0x10,0x10,0x10,0x08,0x08,0x06,0x01,0x00, + 0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x00, + /* 0xA1CB [?] [43]*/ + 0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00, + /* 0xA1CC [v] [44]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x0A,0x12,0x01,0x00,0x00, + 0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00, + /* 0xA1CD [?] [45]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00, + /* 0xA1CE [?] [46]*/ + 0x02,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x04,0x04,0x04,0x09,0x09,0x09,0x09,0x09, + 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA1CF [?] [47]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x7F,0x00,0x00, + 0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00, + /* 0xA1D0 [?] [48]*/ + 0x00,0x00,0x07,0x18,0x20,0x20,0x40,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x60,0x10,0x10,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1D1 [?] [49]*/ + 0x00,0x00,0x07,0x18,0x20,0x20,0x40,0x43,0x43,0x40,0x20,0x20,0x18,0x07,0x00,0x00, + 0x00,0x00,0x80,0x60,0x10,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x60,0x80,0x00,0x00, + /* 0xA1D2 [?] [50]*/ + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x09,0x06,0x00, + 0x00,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1D3 [?] [51]*/ + 0x00,0x01,0x01,0x01,0x01,0x07,0x09,0x09,0x09,0x09,0x07,0x01,0x01,0x01,0x09,0x06, + 0xC0,0x20,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00,0x00, + /* 0xA1D4 [=] [52]*/ + 0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x7F,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1D5 [?] [53]*/ + 0x00,0x00,0x18,0x20,0x41,0x41,0x42,0x22,0x1C,0x00,0x7F,0x00,0x7F,0x00,0x00,0x00, + 0x00,0x00,0x70,0x88,0x04,0x04,0x04,0x08,0x30,0x00,0xFC,0x00,0xFC,0x00,0x00,0x00, + /* 0xA1D6 [] [54]*/ + 0x00,0x00,0x00,0x00,0x00,0x1C,0x23,0x40,0x1C,0x23,0x40,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x04,0x88,0x70,0x04,0x88,0x70,0x00,0x00,0x00,0x00,0x00, + /* 0xA1D7 [?] [55]*/ + 0x00,0x00,0x00,0x00,0x38,0x40,0x80,0x81,0x81,0x82,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x78,0x84,0x82,0x02,0x02,0x02,0x04,0x38,0x00,0x00,0x00,0x00, + /* 0xA1D8 [?] [56]*/ + 0x00,0x00,0x00,0x00,0x3C,0x42,0x81,0x81,0x81,0x81,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x7E,0x80,0x00,0x00,0x00,0x00,0x80,0x7E,0x00,0x00,0x00,0x00, + /* 0xA1D9 [?] [57]*/ + 0x00,0x00,0x00,0x00,0x00,0x7F,0x01,0x01,0x02,0x7F,0x04,0x08,0x08,0x10,0x10,0x00, + 0x00,0x20,0x20,0x40,0x40,0xFC,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1DA [?] [58]*/ + 0x00,0x01,0x01,0x01,0x03,0x0D,0x31,0xC1,0x31,0x0D,0x03,0x01,0x01,0x01,0x00,0x00, + 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0x00,0x00, + /* 0xA1DB [?] [59]*/ + 0x00,0x61,0x19,0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x07,0x19,0x61,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x06,0x18,0x60,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA1DC [=] [60]*/ + 0x00,0x00,0x00,0x03,0x0C,0x30,0xC0,0x30,0xCC,0x33,0x0C,0x03,0x00,0x00,0x00,0x00, + 0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0xCC,0x30,0x0C,0x00, + /* 0xA1DD [=] [61]*/ + 0x60,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x19,0x66,0x18,0x60,0x00, + 0x00,0x00,0x00,0x80,0x60,0x18,0x06,0x18,0x66,0x98,0x60,0x80,0x00,0x00,0x00,0x00, + /* 0xA1DE [8] [62]*/ + 0x00,0x00,0x00,0x00,0x3C,0x42,0x81,0x81,0x81,0x42,0x3C,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x78,0x84,0x02,0x02,0x02,0x84,0x78,0x00,0x00,0x00,0x00,0x00, + /* 0xA1DF [?] [63]*/ + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1E0 [?] [64]*/ + 0x00,0x00,0x00,0x03,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00, + /* 0xA1E1 [?] [65]*/ + 0x00,0x01,0x03,0x05,0x09,0x11,0x01,0x01,0x01,0x01,0x03,0x04,0x04,0x04,0x03,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x80,0x00, + /* 0xA1E2 [?] [66]*/ + 0x00,0x03,0x04,0x04,0x04,0x03,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1E3 [] [67]*/ + 0x00,0x18,0x24,0x24,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1E4 ['] [68]*/ + 0x00,0x08,0x08,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1E5 [?] [69]*/ + 0x00,0x12,0x12,0x24,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1E6 [?] [70]*/ + 0x60,0x91,0x96,0x6C,0x08,0x18,0x18,0x18,0x18,0x18,0x18,0x08,0x0C,0x06,0x01,0x00, + 0x00,0xF4,0x0C,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x08,0xF0,0x00, + /* 0xA1E7 [$] [71]*/ + 0x01,0x0F,0x11,0x31,0x31,0x31,0x19,0x0F,0x03,0x01,0x01,0x01,0x11,0x0D,0x07,0x01, + 0x00,0xE0,0x30,0x10,0x00,0x00,0x00,0x00,0xC0,0x70,0x18,0x18,0x18,0x30,0xE0,0x00, + /* 0xA1E8 [] [72]*/ + 0x00,0x40,0x20,0x17,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x17,0x20,0x40,0x00, + 0x00,0x02,0x04,0xE8,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0xE8,0x04,0x02,0x00, + /* 0xA1E9 [?] [73]*/ + 0x00,0x00,0x07,0x18,0x30,0x60,0x61,0x61,0x62,0x62,0x64,0x38,0x18,0x17,0x20,0x40, + 0x10,0x20,0xE8,0x58,0x48,0x80,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0xE0,0x00,0x00, + /* 0xA1EA [?] [74]*/ + 0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x3F,0x04,0x04,0x08,0x08,0x08,0x10,0x7F,0x00, + 0xE0,0x10,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00, + /* 0xA1EB [] [75]*/ + 0x00,0x30,0x48,0x48,0x48,0x49,0x32,0x04,0x08,0x13,0x24,0x44,0x84,0x04,0x03,0x00, + 0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x0C,0x92,0x92,0x92,0x92,0x0C,0x00, + /* 0xA1EC [] [76]*/ + 0x03,0x04,0x04,0x04,0x02,0x05,0x09,0x08,0x08,0x04,0x05,0x02,0x01,0x00,0x08,0x07, + 0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00, + /* 0xA1ED [?] [77]*/ + 0x60,0x21,0x31,0x31,0x39,0x29,0x29,0x2D,0x2D,0x25,0x27,0x27,0x23,0x23,0xA1,0x41, + 0x80,0x40,0x00,0x00,0x18,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x18,0x00,0x7E,0x00, + /* 0xA1EE [?] [78]*/ + 0x01,0x01,0x02,0x02,0x02,0x04,0xFC,0x40,0x30,0x08,0x08,0x11,0x16,0x18,0x20,0x00, + 0x00,0x00,0x80,0x80,0x80,0x40,0x7E,0x04,0x18,0x20,0x20,0x90,0x50,0x30,0x08,0x00, + /* 0xA1EF [?] [79]*/ + 0x01,0x01,0x03,0x03,0x03,0x07,0xFF,0x7F,0x3F,0x0F,0x0F,0x1F,0x1E,0x18,0x20,0x00, + 0x00,0x00,0x80,0x80,0x80,0xC0,0xFE,0xFC,0xF8,0xE0,0xE0,0xF0,0xF0,0x30,0x08,0x00, + /* 0xA1F0 [?] [80]*/ + 0x00,0x07,0x1C,0x30,0x30,0x60,0x60,0x60,0x60,0x60,0x30,0x30,0x1C,0x07,0x00,0x00, + 0x00,0xC0,0x70,0x18,0x18,0x0C,0x0C,0x0C,0x0C,0x0C,0x18,0x18,0x70,0xC0,0x00,0x00, + /* 0xA1F1 [?] [81]*/ + 0x00,0x07,0x1F,0x3F,0x3F,0x7F,0x7F,0x7F,0x7F,0x7F,0x3F,0x3F,0x1F,0x07,0x00,0x00, + 0x00,0xC0,0xF0,0xF8,0xF8,0xFC,0xFC,0xFC,0xFC,0xFC,0xF8,0xF8,0xF0,0xC0,0x00,0x00, + /* 0xA1F2 [?] [82]*/ + 0x00,0x07,0x18,0x23,0x24,0x48,0x50,0x50,0x50,0x48,0x24,0x23,0x18,0x07,0x00,0x00, + 0x00,0xC0,0x30,0x88,0x48,0x24,0x14,0x14,0x14,0x24,0x48,0x88,0x30,0xC0,0x00,0x00, + /* 0xA1F3 [?] [83]*/ + 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00, + 0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xA1F4 [?] [84]*/ + 0x01,0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0x7F,0x3F,0x1F,0x0F,0x07,0x03,0x01,0x00, + 0x00,0x80,0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80,0x00,0x00, + /* 0xA1F5 [?] [85]*/ + 0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00,0x00, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x00,0x00, + /* 0xA1F6 [] [86]*/ + 0x00,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x00,0x00, + 0x00,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0x00,0x00, + /* 0xA1F7 [?] [87]*/ + 0x00,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x7F,0x00,0x00, + 0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x08,0xFC,0x00,0x00, + /* 0xA1F8 [?] [88]*/ + 0x00,0x01,0x01,0x03,0x03,0x07,0x07,0x0F,0x0F,0x1F,0x1F,0x3F,0x3F,0x7F,0x00,0x00, + 0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0xE0,0xE0,0xF0,0xF0,0xF8,0xF8,0xFC,0x00,0x00, + /* 0xA1F9 [?] [89]*/ + 0x00,0x43,0x23,0x10,0x08,0x04,0x02,0x61,0x62,0x04,0x08,0x10,0x23,0x43,0x80,0x00, + 0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x0C,0x8C,0x40,0x20,0x10,0x08,0x04,0x02,0x00, + /* 0xA1FA [?] [90]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x60,0x38,0xFE,0x38,0x60,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA1FB [?] [91]*/ + 0x00,0x00,0x00,0x00,0x02,0x0C,0x38,0xFF,0x38,0x0C,0x02,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1FC [?] [92]*/ + 0x01,0x01,0x03,0x03,0x07,0x05,0x09,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x80,0x80,0xC0,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA1FD [?] [93]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x09,0x05,0x07,0x03,0x03,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x40,0xC0,0x80,0x80,0x00,0x00, + /* 0xA1FE [?] [94]*/ + 0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xFC,0xFC,0xFC,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00, + /* 0xA2A1 [?] [95]*/ + 0x00,0x01,0x00,0x00,0x01,0x03,0x05,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00, + /* 0xA2A2 [?] [96]*/ + 0x00,0x08,0x00,0x00,0x08,0x18,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,0x00, + 0x00,0x40,0x00,0x00,0x40,0xC0,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,0x00, + /* 0xA2A3 [?] [97]*/ + 0x00,0x11,0x00,0x00,0x11,0x33,0x11,0x11,0x11,0x11,0x11,0x11,0x3B,0x00,0x00,0x00, + 0x00,0x10,0x00,0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0xB8,0x00,0x00,0x00, + /* 0xA2A4 [?] [98]*/ + 0x00,0x10,0x00,0x00,0x16,0x32,0x12,0x11,0x11,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x0C,0x08,0x08,0x10,0x10,0xA0,0xA0,0x40,0x40,0x00,0x00,0x00, + /* 0xA2A5 [?] [99]*/ + 0x00,0x00,0x00,0x00,0x18,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x30,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA2A6 [?] [100]*/ + 0x00,0x00,0x00,0x00,0xC1,0x41,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x00,0x00,0x00, + 0x00,0x10,0x00,0x00,0x90,0x30,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00, + /* 0xA2A7 [?] [101]*/ + 0x00,0x00,0x00,0x00,0xC6,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x00,0x00,0x00, + 0x00,0x44,0x00,0x00,0x44,0xCC,0x44,0x44,0x44,0x44,0x44,0x44,0xEE,0x00,0x00,0x00, + /* 0xA2A8 [?] [102]*/ + 0x00,0x01,0x00,0x00,0xC5,0x47,0x45,0x45,0x29,0x29,0x29,0x11,0x13,0x00,0x00,0x00, + 0x00,0x24,0x00,0x00,0x24,0x6C,0x24,0x24,0x24,0x24,0x24,0x24,0xAE,0x00,0x00,0x00, + /* 0xA2A9 [?] [103]*/ + 0x00,0x20,0x00,0x00,0x27,0x62,0x21,0x20,0x20,0x20,0x21,0x22,0x77,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x1C,0x08,0x10,0xA0,0x40,0xA0,0x10,0x08,0x1C,0x00,0x00,0x00, + /* 0xA2AA [?] [104]*/ + 0x00,0x00,0x00,0x00,0x1C,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x1C,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x70,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x70,0x00,0x00,0x00, + /* 0xA2AB [?] [105]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2AC [?] [106]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2AD [?] [107]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2AE [?] [108]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2AF [?] [109]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2B0 [?] [110]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2B1 [?] [111]*/ + 0x01,0x03,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B2 [?] [112]*/ + 0x0F,0x10,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x10,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x18,0x98,0x00,0x00,0x00,0x00, + /* 0xA2B3 [?] [113]*/ + 0x1F,0x00,0x01,0x02,0x06,0x01,0x00,0x00,0x00,0x00,0x11,0x0E,0x00,0x00,0x00,0x00, + 0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B4 [?] [114]*/ + 0x02,0x02,0x04,0x04,0x09,0x09,0x11,0x11,0x1F,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B5 [?] [115]*/ + 0x1F,0x10,0x10,0x10,0x1E,0x01,0x00,0x00,0x00,0x00,0x11,0x0E,0x00,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B6 [?] [116]*/ + 0x02,0x04,0x08,0x08,0x10,0x17,0x18,0x10,0x10,0x10,0x10,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x98,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B7 [?] [117]*/ + 0x1F,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, + 0xC0,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B8 [?] [118]*/ + 0x0F,0x10,0x10,0x10,0x09,0x06,0x09,0x10,0x10,0x10,0x10,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x98,0x18,0x00,0x00,0x00,0x00, + /* 0xA2B9 [?] [119]*/ + 0x0F,0x10,0x10,0x10,0x10,0x11,0x0E,0x00,0x01,0x01,0x02,0x04,0x00,0x00,0x00,0x00, + 0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00, + /* 0xA2BA [?] [120]*/ + 0x23,0x64,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x23,0x00,0x00,0x00,0x00, + 0xC0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x2C,0xCC,0x00,0x00,0x00,0x00, + /* 0xA2BB [?] [121]*/ + 0x20,0x61,0xA2,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x8C,0x8C,0x00,0x00,0x00,0x00, + /* 0xA2BC [?] [122]*/ + 0x23,0x64,0xA0,0x20,0x20,0x20,0x20,0x21,0x22,0x24,0x24,0x27,0x00,0x00,0x00,0x00, + 0xC0,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x0C,0xEC,0x00,0x00,0x00,0x00, + /* 0xA2BD [?] [123]*/ + 0x27,0x60,0xA0,0x20,0x21,0x20,0x20,0x20,0x20,0x20,0x24,0x23,0x00,0x00,0x00,0x00, + 0xE0,0x20,0x40,0x80,0x80,0x40,0x20,0x20,0x20,0x20,0x4C,0x8C,0x00,0x00,0x00,0x00, + /* 0xA2BE [?] [124]*/ + 0x20,0x60,0xA1,0x21,0x22,0x22,0x24,0x24,0x27,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + 0x80,0x80,0x00,0x00,0x40,0x40,0x40,0x40,0xF0,0x40,0x4C,0x4C,0x00,0x00,0x00,0x00, + /* 0xA2BF [?] [125]*/ + 0x27,0x64,0xA4,0x24,0x27,0x20,0x20,0x20,0x20,0x20,0x24,0x23,0x00,0x00,0x00,0x00, + 0xE0,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x4C,0x8C,0x00,0x00,0x00,0x00, + /* 0xA2C0 [?] [126]*/ + 0x20,0x61,0xA2,0x22,0x24,0x25,0x26,0x24,0x24,0x24,0x24,0x23,0x00,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x20,0x2C,0xCC,0x00,0x00,0x00,0x00, + /* 0xA2C1 [?] [127]*/ + 0x27,0x60,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + 0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x80,0x80,0x8C,0x8C,0x00,0x00,0x00,0x00, + /* 0xA2C2 [?] [128]*/ + 0x23,0x64,0xA4,0x24,0x22,0x21,0x22,0x24,0x24,0x24,0x24,0x23,0x00,0x00,0x00,0x00, + 0xC0,0x20,0x20,0x20,0x40,0x80,0x40,0x20,0x20,0x20,0x2C,0xCC,0x00,0x00,0x00,0x00, + /* 0xA2C3 [?] [129]*/ + 0x23,0x64,0xA4,0x24,0x24,0x24,0x23,0x20,0x20,0x20,0x20,0x21,0x00,0x00,0x00,0x00, + 0xC0,0x20,0x20,0x20,0x20,0x60,0xA0,0x20,0x40,0x40,0x8C,0x0C,0x00,0x00,0x00,0x00, + /* 0xA2C4 [?] [130]*/ + 0x38,0x45,0x05,0x05,0x05,0x09,0x11,0x21,0x21,0x41,0x41,0x7C,0x00,0x00,0x00,0x00, + 0xE0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x16,0xE6,0x00,0x00,0x00,0x00, + /* 0xA2C5 [?] [131]*/ + 0x10,0x20,0x41,0x43,0x85,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x41,0x41,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10, + /* 0xA2C6 [?] [132]*/ + 0x10,0x20,0x47,0x48,0x80,0x80,0x80,0x80,0x81,0x82,0x84,0x88,0x48,0x4F,0x20,0x10, + 0x10,0x08,0x84,0x44,0x42,0x42,0x42,0x82,0x02,0x02,0x02,0x02,0x04,0xC4,0x08,0x10, + /* 0xA2C7 [?] [133]*/ + 0x10,0x20,0x4F,0x40,0x80,0x81,0x83,0x80,0x80,0x80,0x80,0x80,0x48,0x47,0x20,0x10, + 0x10,0x08,0xC4,0x44,0x82,0x02,0x02,0x82,0x42,0x42,0x42,0x42,0x84,0x04,0x08,0x10, + /* 0xA2C8 [?] [134]*/ + 0x10,0x20,0x41,0x41,0x82,0x82,0x84,0x84,0x88,0x88,0x8F,0x80,0x40,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x82,0x82,0x82,0x82,0xE2,0x82,0x84,0x84,0x08,0x10, + /* 0xA2C9 [?] [135]*/ + 0x10,0x20,0x47,0x44,0x84,0x84,0x87,0x80,0x80,0x80,0x80,0x80,0x44,0x43,0x20,0x10, + 0x10,0x08,0xE4,0x04,0x02,0x02,0x82,0x42,0x22,0x22,0x22,0x22,0x44,0x84,0x08,0x10, + /* 0xA2CA [?] [136]*/ + 0x10,0x20,0x41,0x42,0x84,0x84,0x88,0x8B,0x8C,0x88,0x88,0x88,0x48,0x47,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x82,0x42,0x42,0x42,0x42,0x44,0x84,0x08,0x10, + /* 0xA2CB [?] [137]*/ + 0x10,0x20,0x4F,0x40,0x80,0x80,0x80,0x80,0x81,0x81,0x81,0x81,0x41,0x41,0x20,0x10, + 0x10,0x08,0xE4,0x24,0x42,0x42,0x82,0x82,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10, + /* 0xA2CC [?] [138]*/ + 0x10,0x20,0x47,0x48,0x88,0x88,0x84,0x83,0x84,0x88,0x88,0x88,0x48,0x47,0x20,0x10, + 0x10,0x08,0x84,0x44,0x42,0x42,0x82,0x02,0x82,0x42,0x42,0x42,0x44,0x84,0x08,0x10, + /* 0xA2CD [?] [139]*/ + 0x10,0x20,0x43,0x44,0x84,0x84,0x84,0x84,0x83,0x80,0x80,0x80,0x40,0x41,0x20,0x10, + 0x10,0x08,0xC4,0x24,0x22,0x22,0x22,0x62,0xA2,0x22,0x42,0x42,0x84,0x04,0x08,0x10, + /* 0xA2CE [?] [140]*/ + 0x10,0x20,0x48,0x59,0xA9,0x89,0x89,0x89,0x89,0x89,0x89,0x89,0x49,0x48,0x20,0x10, + 0x10,0x08,0xE4,0x14,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x14,0xE4,0x08,0x10, + /* 0xA2CF [?] [141]*/ + 0x10,0x20,0x48,0x58,0xA8,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x48,0x48,0x20,0x10, + 0x10,0x08,0x24,0x64,0xA2,0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x24,0x24,0x08,0x10, + /* 0xA2D0 [?] [142]*/ + 0x10,0x20,0x48,0x59,0xA8,0x88,0x88,0x88,0x88,0x88,0x88,0x89,0x49,0x49,0x20,0x10, + 0x10,0x08,0xE4,0x14,0x12,0x12,0x12,0x22,0x42,0x82,0x82,0x02,0x04,0xF4,0x08,0x10, + /* 0xA2D1 [?] [143]*/ + 0x10,0x20,0x4B,0x58,0xA8,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x4A,0x49,0x20,0x10, + 0x10,0x08,0xF4,0x14,0x22,0x42,0xC2,0x22,0x12,0x12,0x12,0x12,0x24,0xC4,0x08,0x10, + /* 0xA2D2 [?] [144]*/ + 0x10,0x20,0x48,0x58,0xA8,0x88,0x89,0x89,0x8A,0x8A,0x8B,0x88,0x48,0x48,0x20,0x10, + 0x10,0x08,0x44,0x44,0x82,0x82,0x22,0x22,0x22,0x22,0xFA,0x22,0x24,0x24,0x08,0x10, + /* 0xA2D3 [?] [145]*/ + 0x10,0x20,0x4B,0x5A,0xAA,0x8A,0x8B,0x88,0x88,0x88,0x88,0x88,0x4A,0x49,0x20,0x10, + 0x10,0x08,0xF4,0x04,0x02,0x02,0xC2,0x22,0x12,0x12,0x12,0x12,0x24,0xC4,0x08,0x10, + /* 0xA2D4 [?] [146]*/ + 0x10,0x20,0x48,0x58,0xA9,0x89,0x8A,0x8A,0x8B,0x8A,0x8A,0x8A,0x4A,0x49,0x20,0x10, + 0x10,0x08,0x44,0x84,0x02,0x02,0x02,0xE2,0x12,0x12,0x12,0x12,0x14,0xE4,0x08,0x10, + /* 0xA2D5 [?] [147]*/ + 0x10,0x20,0x4B,0x58,0xA8,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x48,0x48,0x20,0x10, + 0x10,0x08,0xF4,0x14,0x22,0x22,0x42,0x42,0x82,0x82,0x82,0x82,0x84,0x84,0x08,0x10, + /* 0xA2D6 [?] [148]*/ + 0x10,0x20,0x49,0x5A,0xAA,0x8A,0x89,0x88,0x89,0x8A,0x8A,0x8A,0x4A,0x49,0x20,0x10, + 0x10,0x08,0xE4,0x14,0x12,0x12,0x22,0xC2,0x22,0x12,0x12,0x12,0x14,0xE4,0x08,0x10, + /* 0xA2D7 [?] [149]*/ + 0x10,0x20,0x49,0x5A,0xAA,0x8A,0x8A,0x8A,0x89,0x88,0x88,0x88,0x48,0x48,0x20,0x10, + 0x10,0x08,0xE4,0x14,0x12,0x12,0x12,0x32,0xD2,0x12,0x22,0x22,0x44,0x84,0x08,0x10, + /* 0xA2D8 [?] [150]*/ + 0x10,0x20,0x4C,0x52,0x82,0x82,0x82,0x84,0x84,0x88,0x90,0x90,0x50,0x5E,0x20,0x10, + 0x10,0x08,0x64,0x94,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x92,0x94,0x64,0x08,0x10, + /* 0xA2D9 [?] [151]*/ + 0x07,0x18,0x20,0x41,0x43,0x85,0x81,0x81,0x81,0x81,0x41,0x41,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x04,0x04,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x30,0xC0,0x00, + /* 0xA2DA [?] [152]*/ + 0x07,0x18,0x20,0x43,0x44,0x80,0x80,0x80,0x81,0x82,0x44,0x47,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x84,0x44,0x42,0x42,0x82,0x02,0x02,0x04,0xC4,0x08,0x30,0xC0,0x00, + /* 0xA2DB [?] [153]*/ + 0x07,0x18,0x20,0x47,0x40,0x80,0x81,0x83,0x80,0x80,0x44,0x43,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0xC4,0x44,0x82,0x02,0x02,0x82,0x42,0x44,0x84,0x08,0x30,0xC0,0x00, + /* 0xA2DC [?] [154]*/ + 0x07,0x18,0x20,0x41,0x42,0x82,0x84,0x84,0x88,0x8F,0x40,0x40,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x04,0x04,0x02,0x82,0x82,0x82,0xE2,0x84,0x84,0x08,0x30,0xC0,0x00, + /* 0xA2DD [?] [155]*/ + 0x07,0x18,0x20,0x47,0x44,0x84,0x87,0x80,0x80,0x80,0x48,0x47,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0xC4,0x04,0x02,0x82,0x42,0x42,0x42,0x84,0x04,0x08,0x30,0xC0,0x00, + /* 0xA2DE [?] [156]*/ + 0x07,0x18,0x20,0x41,0x42,0x82,0x84,0x85,0x86,0x84,0x44,0x43,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x04,0x04,0x02,0x02,0x82,0x42,0x42,0x44,0x84,0x08,0x30,0xC0,0x00, + /* 0xA2DF [?] [157]*/ + 0x07,0x18,0x20,0x47,0x40,0x80,0x80,0x81,0x81,0x81,0x41,0x41,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0xC4,0x44,0x82,0x82,0x02,0x02,0x02,0x04,0x04,0x08,0x30,0xC0,0x00, + /* 0xA2E0 [?] [158]*/ + 0x07,0x18,0x20,0x43,0x44,0x84,0x84,0x83,0x84,0x84,0x44,0x43,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x84,0x44,0x42,0x42,0x82,0x42,0x42,0x44,0x84,0x08,0x30,0xC0,0x00, + /* 0xA2E1 [?] [159]*/ + 0x07,0x18,0x20,0x43,0x44,0x84,0x84,0x83,0x80,0x80,0x41,0x42,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0x84,0x44,0x42,0x42,0xC2,0x42,0x82,0x04,0x04,0x08,0x30,0xC0,0x00, + /* 0xA2E2 [?] [160]*/ + 0x07,0x18,0x20,0x49,0x5A,0xAA,0x8A,0x8A,0x8A,0x8A,0x4A,0x49,0x20,0x18,0x07,0x00, + 0xC0,0x30,0x08,0xC4,0x24,0x22,0x22,0x22,0x22,0x22,0x24,0xC4,0x08,0x30,0xC0,0x00, + /* 0xA2E3 [?] [161]*/ + 0x00,0x00,0x00,0x01,0x06,0x08,0x08,0x3F,0x18,0x1F,0x08,0x0C,0x06,0x01,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x10,0x00,0x00,0xE0,0x00,0xC0,0x00,0x00,0x30,0xC0,0x00,0x00, + /* 0xA2E4 [?] [162]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2E5 [?] [163]*/ + 0x10,0x20,0x40,0x40,0x80,0x80,0x80,0xBF,0x80,0x80,0x80,0x80,0x40,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x02,0xFA,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10, + /* 0xA2E6 [?] [164]*/ + 0x10,0x20,0x40,0x40,0x9F,0x80,0x80,0x80,0x80,0x80,0xBF,0x80,0x40,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0xF2,0x02,0x02,0x02,0x02,0x02,0xFA,0x02,0x04,0x04,0x08,0x10, + /* 0xA2E7 [?] [165]*/ + 0x10,0x20,0x40,0x5F,0x80,0x80,0x80,0x8F,0x80,0x80,0x80,0xBF,0x40,0x40,0x20,0x10, + 0x10,0x08,0x04,0xF4,0x02,0x02,0x02,0xE2,0x02,0x02,0x02,0xFA,0x04,0x04,0x08,0x10, + /* 0xA2E8 [?] [166]*/ + 0x10,0x20,0x40,0x40,0x9F,0x92,0x92,0x92,0x94,0x98,0x90,0x9F,0x50,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0xF2,0x92,0x92,0x92,0x72,0x12,0x12,0xF2,0x14,0x04,0x08,0x10, + /* 0xA2E9 [?] [167]*/ + 0x10,0x20,0x40,0x4F,0x81,0x81,0x81,0x8F,0x82,0x82,0x82,0x82,0x5F,0x40,0x20,0x10, + 0x10,0x08,0x04,0xE4,0x02,0x02,0x02,0xE2,0x22,0x22,0x22,0x22,0xFC,0x04,0x08,0x10, + /* 0xA2EA [?] [168]*/ + 0x10,0x20,0x40,0x42,0x81,0x80,0xBF,0x80,0x80,0x84,0x84,0x88,0x50,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0xFA,0x02,0x02,0x42,0x22,0x12,0x14,0x04,0x08,0x10, + /* 0xA2EB [?] [169]*/ + 0x10,0x20,0x42,0x42,0x82,0x82,0x82,0x83,0xBE,0x82,0x82,0x82,0x42,0x41,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x02,0xF2,0x02,0x02,0x22,0x22,0x24,0xE4,0x08,0x10, + /* 0xA2EC [?] [170]*/ + 0x10,0x20,0x40,0x44,0x84,0x84,0x84,0x84,0x84,0x88,0x88,0x90,0x40,0x40,0x20,0x10, + 0x10,0x08,0x84,0x84,0x82,0x82,0x82,0x42,0x42,0x22,0x22,0x12,0x04,0x04,0x08,0x10, + /* 0xA2ED [?] [171]*/ + 0x10,0x20,0x42,0x42,0x82,0x9F,0x82,0x82,0x82,0x84,0x84,0x88,0x50,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0xC2,0x42,0x42,0x42,0x42,0x4A,0x4A,0x3C,0x04,0x08,0x10, + /* 0xA2EE [?] [172]*/ + 0x10,0x20,0x41,0x41,0x81,0x81,0x81,0xBF,0x81,0x81,0x81,0x81,0x41,0x40,0x20,0x10, + 0x10,0x08,0x04,0x04,0x02,0x02,0x02,0xFA,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10, + /* 0xA2EF [?] [173]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2F0 [?] [174]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2F1 [?] [175]*/ + 0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00, + 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00, + /* 0xA2F2 [?] [176]*/ + 0x00,0x0E,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x0E,0x00, + 0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xE0,0x00, + /* 0xA2F3 [?] [177]*/ + 0x00,0x3B,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x3B,0x00, + 0x00,0xB8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xB8,0x00, + /* 0xA2F4 [?] [178]*/ + 0x00,0x77,0x22,0x22,0x22,0x21,0x21,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x70,0x00, + 0x00,0x1C,0x08,0x08,0x08,0x10,0x10,0x10,0x10,0xA0,0xA0,0xA0,0xA0,0x40,0x40,0x00, + /* 0xA2F5 [?] [179]*/ + 0x00,0x70,0x20,0x10,0x10,0x08,0x08,0x08,0x04,0x04,0x04,0x02,0x02,0x01,0x01,0x00, + 0x00,0x1C,0x08,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00, + /* 0xA2F6 [?] [180]*/ + 0x00,0x71,0x20,0x20,0x20,0x11,0x11,0x11,0x11,0x0A,0x0A,0x0A,0x0A,0x04,0x04,0x00, + 0x00,0xDC,0x88,0x88,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00, + /* 0xA2F7 [?] [181]*/ + 0x00,0xE3,0x41,0x41,0x41,0x22,0x22,0x22,0x22,0x14,0x14,0x14,0x14,0x08,0x08,0x00, + 0x00,0xFE,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x7E,0x00, + /* 0xA2F8 [?] [182]*/ + 0x00,0xE3,0x41,0x41,0x41,0x22,0x22,0x22,0x22,0x14,0x14,0x14,0x14,0x08,0x08,0x00, + 0x00,0xFE,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xA2F9 [?] [183]*/ + 0x00,0x77,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x77,0x00, + 0x00,0x1C,0x08,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x1C,0x00, + /* 0xA2FA [?] [184]*/ + 0x00,0x70,0x20,0x10,0x08,0x04,0x02,0x01,0x02,0x04,0x04,0x08,0x10,0x20,0x70,0x00, + 0x00,0x1C,0x08,0x10,0x20,0x40,0x80,0x00,0x80,0x40,0x40,0x20,0x10,0x08,0x1C,0x00, + /* 0xA2FB [?] [185]*/ + 0x00,0xE3,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x14,0x14,0x22,0x22,0x41,0xE3,0x00, + 0x00,0x9C,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x9C,0x00, + /* 0xA2FC [?] [186]*/ + 0x00,0xE3,0x41,0x22,0x22,0x14,0x14,0x08,0x08,0x14,0x14,0x22,0x22,0x41,0xE3,0x00, + 0x00,0xBE,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0x14,0xBE,0x00, + /* 0xA2FD [?] [187]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA2FE [?] [188]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3A1 [!] [189]*/ + 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3A2 ["] [190]*/ + 0x00,0x0C,0x0C,0x0C,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xC0,0xC0,0xC0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3A3 [#] [191]*/ + 0x00,0x02,0x02,0x02,0x02,0x3F,0x04,0x04,0x04,0x04,0x3F,0x08,0x08,0x08,0x08,0x00, + 0x00,0x20,0x20,0x20,0x20,0xFC,0x40,0x40,0x40,0x40,0xFC,0x80,0x80,0x80,0x80,0x00, + /* 0xA3A4 [?] [192]*/ + 0x00,0x00,0x10,0x08,0x04,0x02,0x01,0x01,0x01,0x0F,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3A5 [%] [193]*/ + 0x00,0x18,0x24,0x24,0x24,0x24,0x24,0x19,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00, + 0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x60,0x90,0x90,0x90,0x90,0x90,0x60,0x00, + /* 0xA3A6 [&] [194]*/ + 0x00,0x06,0x09,0x10,0x10,0x09,0x0A,0x04,0x0A,0x12,0x21,0x20,0x20,0x11,0x0E,0x00, + 0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x70,0x20,0xA0,0x40,0xA0,0x10,0x00, + /* 0xA3A7 ['] [195]*/ + 0x00,0x38,0x38,0x38,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3A8 [(] [196]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x10,0x20,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x10,0x08,0x00, + /* 0xA3A9 [)] [197]*/ + 0x00,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3AA [*] [198]*/ + 0x00,0x00,0x01,0x01,0x01,0x01,0x31,0x0D,0x03,0x02,0x04,0x08,0x10,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x60,0x80,0x80,0x40,0x20,0x10,0x00,0x00,0x00, + /* 0xA3AB [+] [199]*/ + 0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3AC [,] [200]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3AD [-] [201]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3AE [.] [202]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3AF [/] [203]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x00, + 0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3B0 [0] [204]*/ + 0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3B1 [1] [205]*/ + 0x01,0x03,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3B2 [2] [206]*/ + 0x07,0x08,0x10,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x80,0x40,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, + /* 0xA3B3 [3] [207]*/ + 0x0F,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x08,0x07,0x00,0x00,0x00,0x00, + 0xF0,0x20,0x40,0x80,0xC0,0x20,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3B4 [4] [208]*/ + 0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0xF0,0x80,0x80,0x80,0x00,0x00,0x00,0x00, + /* 0xA3B5 [5] [209]*/ + 0x1F,0x10,0x10,0x10,0x1F,0x00,0x00,0x00,0x00,0x00,0x10,0x0F,0x00,0x00,0x00,0x00, + 0xC0,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA3B6 [6] [210]*/ + 0x00,0x01,0x02,0x04,0x08,0x0F,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x80,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3B7 [7] [211]*/ + 0x1F,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, + 0xF0,0x20,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3B8 [8] [212]*/ + 0x07,0x08,0x10,0x10,0x08,0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x80,0x40,0x20,0x20,0x40,0x80,0x40,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3B9 [9] [213]*/ + 0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x01,0x02,0x04,0x00,0x00,0x00,0x00, + 0x80,0x40,0x20,0x20,0x20,0x20,0xC0,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3BA [:] [214]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3BB [;] [215]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3BC [<] [216]*/ + 0x00,0x00,0x00,0x00,0x03,0x0C,0x30,0xC0,0x30,0x0C,0x03,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0x00,0x00, + /* 0xA3BD [=] [217]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3BE [>] [218]*/ + 0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x18,0x60,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x06,0x18,0x60,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA3BF [?] [219]*/ + 0x00,0x0E,0x11,0x21,0x31,0x31,0x03,0x06,0x06,0x06,0x06,0x00,0x06,0x06,0x00,0x00, + 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3C0 [@] [220]*/ + 0x00,0x1F,0x20,0x00,0x0E,0x11,0x20,0x20,0x20,0x20,0x11,0x0E,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x10,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x90,0x60,0x00,0x00,0x00,0x00, + /* 0xA3C1 [A] [221]*/ + 0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x0F,0x10,0x10,0x20,0x70,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0xE0,0x10,0x10,0x08,0x1C,0x00,0x00,0x00,0x00, + /* 0xA3C2 [B] [222]*/ + 0x00,0x1F,0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x10,0x10,0x10,0x20,0xC0,0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x00, + /* 0xA3C3 [C] [223]*/ + 0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3C4 [D] [224]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3C5 [E] [225]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x80,0x80,0x80,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA3C6 [F] [226]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x40,0xC0,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3C7 [G] [227]*/ + 0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0xD0,0x30,0x10,0x00,0x00,0x00,0x78,0x10,0x10,0x30,0xD0,0x00,0x00,0x00,0x00, + /* 0xA3C8 [H] [228]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA3C9 [I] [229]*/ + 0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA3CA [J] [230]*/ + 0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x11,0x11,0x0E,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3CB [K] [231]*/ + 0x00,0x1C,0x08,0x08,0x09,0x0A,0x0E,0x09,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x70,0x40,0x80,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x38,0x00,0x00,0x00,0x00, + /* 0xA3CC [L] [232]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0x00,0x00,0x00,0x00, + /* 0xA3CD [M] [233]*/ + 0x00,0x30,0x18,0x14,0x14,0x12,0x12,0x11,0x11,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x18,0x30,0x50,0x50,0x90,0x90,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + /* 0xA3CE [N] [234]*/ + 0x00,0x30,0x18,0x14,0x14,0x12,0x11,0x11,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x60,0x20,0x00,0x00,0x00,0x00, + /* 0xA3CF [O] [235]*/ + 0x00,0x07,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3D0 [P] [236]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3D1 [Q] [237]*/ + 0x00,0x07,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x11,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0xA0,0x40,0xA0,0x18,0x00,0x00,0x00, + /* 0xA3D2 [R] [238]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x12,0x11,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x80,0x40,0x30,0x00,0x00,0x00,0x00, + /* 0xA3D3 [S] [239]*/ + 0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x00,0x00,0x10,0x18,0x17,0x00,0x00,0x00,0x00, + 0x00,0xD0,0x30,0x10,0x00,0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3D4 [T] [240]*/ + 0x00,0x3F,0x21,0x21,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA3D5 [U] [241]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3D6 [V] [242]*/ + 0x00,0x70,0x20,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00, + 0x00,0x1C,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA3D7 [W] [243]*/ + 0x00,0x73,0x21,0x21,0x21,0x22,0x12,0x12,0x14,0x14,0x08,0x08,0x00,0x00,0x00,0x00, + 0x00,0x9C,0x08,0x08,0x08,0x88,0x90,0x90,0x50,0x50,0x20,0x20,0x00,0x00,0x00,0x00, + /* 0xA3D8 [X] [244]*/ + 0x00,0x38,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x08,0x38,0x00,0x00,0x00,0x00, + 0x00,0x38,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x40,0x20,0x38,0x00,0x00,0x00,0x00, + /* 0xA3D9 [Y] [245]*/ + 0x00,0x38,0x10,0x08,0x04,0x04,0x02,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x38,0x10,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA3DA [Z] [246]*/ + 0x00,0x1F,0x10,0x10,0x00,0x00,0x01,0x02,0x02,0x04,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x80,0x00,0x00,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA3DB [[] [247]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x1C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1C,0x00, + /* 0xA3DC [\] [248]*/ + 0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x00, + /* 0xA3DD []] [249]*/ + 0x00,0x38,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x38,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3DE [^] [250]*/ + 0x00,0x01,0x02,0x04,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x40,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3DF [_] [251]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, + /* 0xA3E0 [`] [252]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x20,0x20,0x20,0x10,0x10,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3E1 [a] [253]*/ + 0x00,0x00,0x00,0x00,0x0F,0x10,0x00,0x0F,0x10,0x10,0x10,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x40,0xC0,0x40,0x40,0x40,0xA0,0x00,0x00,0x00,0x00, + /* 0xA3E2 [b] [254]*/ + 0x08,0x08,0x08,0x08,0x0B,0x0C,0x08,0x08,0x08,0x08,0x0C,0x0B,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3E3 [c] [255]*/ + 0x00,0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x20,0x00,0x00,0x00,0x00,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3E4 [d] [256]*/ + 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x20,0x20,0x20,0x20,0xA0,0x60,0x20,0x20,0x20,0x20,0x60,0xA0,0x00,0x00,0x00,0x00, + /* 0xA3E5 [e] [257]*/ + 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x0F,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x20,0xE0,0x00,0x00,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3E6 [f] [258]*/ + 0x00,0x00,0x01,0x01,0x01,0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0xC0,0x20,0x20,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3E7 [g] [259]*/ + 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x08,0x07,0x00, + 0x00,0x00,0x00,0x00,0xA0,0x60,0x20,0x20,0x20,0x60,0xA0,0x20,0x20,0x40,0x80,0x00, + /* 0xA3E8 [h] [260]*/ + 0x08,0x08,0x08,0x08,0x09,0x0A,0x0C,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + /* 0xA3E9 [i] [261]*/ + 0x01,0x01,0x00,0x00,0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3EA [j] [262]*/ + 0x01,0x01,0x00,0x00,0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x09,0x06,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3EB [k] [263]*/ + 0x00,0x08,0x08,0x08,0x08,0x08,0x09,0x0A,0x0D,0x08,0x08,0x08,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x80,0x40,0x20,0x00,0x00,0x00,0x00, + /* 0xA3EC [l] [264]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0xE0,0x00,0x00,0x00,0x00, + /* 0xA3ED [m] [265]*/ + 0x00,0x00,0x00,0x00,0x1A,0x0D,0x09,0x09,0x09,0x09,0x09,0x09,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + /* 0xA3EE [n] [266]*/ + 0x00,0x00,0x00,0x00,0x0B,0x0C,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00, + /* 0xA3EF [o] [267]*/ + 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3F0 [p] [268]*/ + 0x00,0x00,0x00,0x00,0x1B,0x0C,0x08,0x08,0x08,0x08,0x0C,0x0B,0x08,0x08,0x08,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3F1 [q] [269]*/ + 0x00,0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xA0,0x60,0x20,0x20,0x20,0x20,0x60,0xA0,0x20,0x20,0x30,0x00, + /* 0xA3F2 [r] [270]*/ + 0x00,0x00,0x00,0x00,0x05,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3F3 [s] [271]*/ + 0x00,0x00,0x00,0x00,0x07,0x08,0x08,0x06,0x01,0x00,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x40,0x00,0x00,0x80,0x40,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3F4 [t] [272]*/ + 0x01,0x01,0x01,0x01,0x07,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA3F5 [u] [273]*/ + 0x00,0x00,0x00,0x00,0x0C,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0xC0,0x40,0x00,0x00,0x00,0x00, + /* 0xA3F6 [v] [274]*/ + 0x00,0x00,0x00,0x00,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3F7 [w] [275]*/ + 0x00,0x00,0x00,0x00,0x11,0x11,0x11,0x09,0x0A,0x0A,0x04,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0xA0,0xA0,0x40,0x40,0x00,0x00,0x00,0x00, + /* 0xA3F8 [x] [276]*/ + 0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x00,0x00,0x00,0x00, + /* 0xA3F9 [y] [277]*/ + 0x00,0x00,0x00,0x00,0x08,0x04,0x04,0x02,0x02,0x01,0x01,0x02,0x02,0x04,0x08,0x00, + 0x00,0x00,0x00,0x00,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3FA [z] [278]*/ + 0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x01,0x02,0x04,0x08,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x40,0x80,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00, + /* 0xA3FB [{] [279]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x04,0x08,0x08,0x08,0x08,0x08,0x10,0x20,0x10,0x08,0x08,0x08,0x08,0x08,0x04,0x00, + /* 0xA3FC [|] [280]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3FD [}] [281]*/ + 0x20,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA3FE [?] [282]*/ + 0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4A1 [?] [283]*/ + 0x00,0x00,0x00,0x04,0x04,0x05,0x3E,0x04,0x07,0x0C,0x14,0x23,0x22,0x25,0x18,0x00, + 0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x40,0xE0,0x90,0x88,0x08,0x08,0x10,0x20,0xC0, + /* 0xA4A2 [?] [284]*/ + 0x04,0x04,0x04,0x07,0x7C,0x04,0x04,0x1F,0x24,0x44,0x45,0x42,0x26,0x19,0x00,0x00, + 0x00,0x00,0x60,0x80,0x00,0x40,0x40,0xF0,0x88,0x84,0x04,0x04,0x04,0x08,0x30,0x00, + /* 0xA4A3 [?] [285]*/ + 0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x08,0x08,0x08,0x08,0x09,0x0A,0x06,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x18,0x10,0x00,0x00,0x00,0x00, + /* 0xA4A4 [?] [286]*/ + 0x00,0x00,0x00,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x21,0x22,0x14,0x0C,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x10,0x28,0x04,0x02,0x02,0x06,0x04,0x00,0x00,0x00,0x00, + /* 0xA4A5 [?] [287]*/ + 0x00,0x08,0x07,0x00,0x01,0x00,0x11,0x0E,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x00, + 0x00,0x00,0x00,0x80,0x00,0x00,0xC0,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00, + /* 0xA4A6 [?] [288]*/ + 0x08,0x07,0x00,0x01,0x00,0x21,0x1E,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x0E,0x00, + 0x00,0x80,0x40,0x80,0x00,0xE0,0x10,0x10,0x10,0x10,0x20,0x20,0xC0,0x00,0x00,0x00, + /* 0xA4A7 [?] [289]*/ + 0x00,0x00,0x04,0x03,0x00,0x01,0x00,0x03,0x1C,0x01,0x03,0x04,0x08,0x10,0x20,0x00, + 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0xC0,0x80,0x00,0x00,0x80,0x80,0x40,0x38,0x00, + /* 0xA4A8 [?] [290]*/ + 0x08,0x07,0x00,0x01,0x00,0x03,0x3C,0x01,0x02,0x03,0x04,0x04,0x08,0x10,0x20,0x00, + 0x00,0x00,0x80,0x00,0x00,0xC0,0x80,0x00,0x00,0x00,0x80,0x80,0x80,0x40,0x3C,0x00, + /* 0xA4A9 [?] [291]*/ + 0x00,0x00,0x00,0x04,0x04,0x04,0x3F,0x04,0x05,0x06,0x0C,0x14,0x34,0x15,0x08,0x00, + 0x00,0x00,0x00,0x00,0x00,0x08,0x04,0x02,0xE4,0x10,0x08,0x08,0x08,0x30,0xC0,0x00, + /* 0xA4AA [?] [292]*/ + 0x00,0x04,0x04,0x07,0x3C,0x04,0x04,0x05,0x06,0x1C,0x24,0x64,0x35,0x0C,0x04,0x00, + 0x00,0x00,0x08,0x84,0x02,0x0C,0x00,0xF0,0x08,0x04,0x04,0x04,0x18,0xE0,0x00,0x00, + /* 0xA4AB [?] [293]*/ + 0x00,0x02,0x02,0x02,0x02,0x23,0x1C,0x04,0x04,0x04,0x08,0x08,0x10,0x24,0x43,0x00, + 0x00,0x00,0x00,0x00,0x10,0x88,0x44,0x42,0x42,0x44,0x40,0x40,0x80,0x80,0x00,0x00, + /* 0xA4AC [?] [294]*/ + 0x00,0x04,0x04,0x04,0x04,0x47,0x38,0x08,0x08,0x08,0x10,0x10,0x21,0x49,0x86,0x00, + 0x08,0x04,0x12,0x08,0x24,0x10,0x88,0x84,0x84,0x88,0x90,0x80,0x00,0x00,0x00,0x00, + /* 0xA4AD [?] [295]*/ + 0x02,0x02,0x02,0x03,0x1D,0x00,0x03,0x1C,0x00,0x03,0x00,0x10,0x10,0x08,0x07,0x00, + 0x00,0x00,0x60,0x80,0x00,0xE0,0x80,0x40,0x40,0xE0,0x20,0x00,0x00,0x00,0xC0,0x00, + /* 0xA4AE [?] [296]*/ + 0x04,0x04,0x04,0x07,0x3A,0x01,0x07,0x38,0x00,0x07,0x00,0x20,0x20,0x10,0x0F,0x00, + 0x00,0x08,0xC4,0x12,0x08,0xC4,0x00,0x80,0x80,0xC0,0x40,0x00,0x00,0x00,0x80,0x00, + /* 0xA4AF [?] [297]*/ + 0x00,0x01,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00, + /* 0xA4B0 [?] [298]*/ + 0x00,0x01,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x08,0x04,0x02,0x01,0x00,0x00,0x00, + 0x00,0x08,0x84,0x92,0x08,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00, + /* 0xA4B1 [?] [299]*/ + 0x00,0x20,0x10,0x10,0x10,0x20,0x20,0x47,0x40,0x40,0x50,0x50,0x60,0x20,0x01,0x00, + 0x00,0x80,0x40,0x40,0x40,0x40,0x7C,0xC0,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0x00, + /* 0xA4B2 [?] [300]*/ + 0x00,0x20,0x10,0x10,0x10,0x20,0x20,0x47,0x40,0x40,0x50,0x50,0x60,0x20,0x01,0x00, + 0x08,0x84,0x52,0x48,0x44,0x40,0x7C,0xC0,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0x00, + /* 0xA4B3 [?] [301]*/ + 0x00,0x00,0x10,0x0F,0x00,0x03,0x04,0x00,0x20,0x20,0x20,0x10,0x0F,0x00,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0xF8,0x00,0x00,0x00, + /* 0xA4B4 [?] [302]*/ + 0x00,0x00,0x10,0x0F,0x00,0x03,0x04,0x00,0x20,0x20,0x20,0x10,0x0F,0x00,0x00,0x00, + 0x00,0x08,0x04,0xD2,0x88,0x04,0x00,0x00,0x00,0x00,0x00,0x10,0xF8,0x00,0x00,0x00, + /* 0xA4B5 [?] [303]*/ + 0x00,0x04,0x02,0x02,0x3F,0x01,0x00,0x00,0x01,0x08,0x10,0x10,0x10,0x08,0x07,0x00, + 0x00,0x00,0x30,0xC0,0x00,0x00,0x80,0x40,0xE0,0x20,0x00,0x00,0x00,0x00,0xE0,0x00, + /* 0xA4B6 [?] [304]*/ + 0x00,0x04,0x02,0x02,0x3F,0x01,0x00,0x00,0x01,0x08,0x10,0x10,0x10,0x08,0x07,0x00, + 0x00,0x08,0x04,0xD2,0x08,0x04,0x80,0x40,0xE0,0x20,0x00,0x00,0x00,0x00,0xE0,0x00, + /* 0xA4B7 [?] [305]*/ + 0x00,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x09,0x06,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xA4B8 [?] [306]*/ + 0x00,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x09,0x06,0x00, + 0x00,0x10,0x08,0x24,0x10,0x08,0x00,0x00,0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xA4B9 [?] [307]*/ + 0x00,0x03,0x01,0x41,0x3F,0x01,0x07,0x09,0x09,0x09,0x06,0x00,0x00,0x00,0x01,0x06, + 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00, + /* 0xA4BA [?] [308]*/ + 0x03,0x01,0x01,0x41,0x3F,0x01,0x07,0x09,0x09,0x09,0x06,0x00,0x00,0x00,0x01,0x06, + 0x08,0x24,0x12,0x08,0xF0,0x00,0x00,0x80,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00, + /* 0xA4BB [?] [309]*/ + 0x00,0x00,0x10,0x08,0x08,0x0B,0x7C,0x08,0x08,0x0A,0x09,0x08,0x08,0x08,0x07,0x00, + 0x00,0x80,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0xF0,0x00, + /* 0xA4BC [?] [310]*/ + 0x00,0x00,0x10,0x08,0x08,0x0B,0x7C,0x08,0x08,0x0A,0x09,0x08,0x08,0x08,0x07,0x00, + 0x08,0x84,0x52,0x48,0x44,0xF0,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0x00,0xF0,0x00, + /* 0xA4BD [?] [311]*/ + 0x00,0x11,0x0E,0x00,0x01,0x06,0x18,0x7F,0x02,0x04,0x04,0x04,0x02,0x01,0x00,0x00, + 0x00,0x80,0x40,0x80,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, + /* 0xA4BE [?] [312]*/ + 0x00,0x11,0x0E,0x00,0x01,0x06,0x18,0x7F,0x02,0x04,0x04,0x04,0x02,0x01,0x00,0x00, + 0x08,0xA4,0x52,0x88,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, + /* 0xA4BF [?] [313]*/ + 0x00,0x04,0x04,0x47,0x3C,0x09,0x08,0x08,0x10,0x10,0x12,0x22,0x21,0x40,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xE0,0x30,0x40,0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00, + /* 0xA4C0 [?] [314]*/ + 0x00,0x04,0x04,0x47,0x3C,0x09,0x08,0x08,0x10,0x10,0x12,0x22,0x21,0x40,0x00,0x00, + 0x08,0x04,0x12,0x08,0x04,0xE0,0x30,0x40,0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00, + /* 0xA4C1 [?] [315]*/ + 0x00,0x04,0x04,0x05,0x07,0x7C,0x08,0x0B,0x0C,0x18,0x10,0x00,0x00,0x00,0x00,0x03, + 0x00,0x00,0x00,0x00,0x80,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0x20,0xC0,0x00, + /* 0xA4C2 [?] [316]*/ + 0x00,0x04,0x04,0x05,0x07,0x7C,0x08,0x0B,0x0C,0x18,0x10,0x00,0x00,0x00,0x00,0x03, + 0x00,0x08,0x04,0x12,0x88,0x04,0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0x20,0xC0,0x00, + /* 0xA4C3 [?] [317]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x08,0x00,0x00,0x00,0x00,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0x40,0x80,0x00, + /* 0xA4C4 [?] [318]*/ + 0x00,0x00,0x00,0x01,0x06,0x78,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0xC0,0x00,0x00,0x00, + /* 0xA4C5 [?] [319]*/ + 0x00,0x00,0x00,0x03,0x0C,0xF0,0x40,0x00,0x00,0x00,0x00,0x00,0x01,0x0E,0x00,0x00, + 0x08,0x04,0x12,0xC8,0x24,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xA4C6 [?] [320]*/ + 0x00,0x00,0x00,0x00,0x00,0x7F,0x21,0x02,0x04,0x04,0x04,0x04,0x04,0x02,0x01,0x00, + 0x00,0x00,0x00,0x08,0xFC,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + /* 0xA4C7 [?] [321]*/ + 0x00,0x00,0x00,0x00,0x00,0x7F,0x21,0x02,0x04,0x04,0x04,0x04,0x04,0x02,0x01,0x00, + 0x00,0x00,0x00,0x08,0xFC,0xC0,0x08,0x04,0x12,0x08,0x04,0x00,0x00,0x00,0xF0,0x00, + /* 0xA4C8 [?] [322]*/ + 0x00,0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00, + 0x00,0x00,0x00,0x00,0x00,0x20,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + /* 0xA4C9 [?] [323]*/ + 0x00,0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x07,0x08,0x10,0x10,0x10,0x08,0x07,0x00, + 0x08,0x04,0x12,0x08,0x04,0x20,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00, + /* 0xA4CA [?] [324]*/ + 0x00,0x04,0x04,0x04,0x07,0x3C,0x04,0x08,0x08,0x10,0x10,0x23,0x44,0x04,0x03,0x00, + 0x00,0x00,0x10,0x08,0x84,0x04,0x08,0x20,0x20,0x20,0x40,0xE0,0x50,0x48,0x84,0x00, + /* 0xA4CB [?] [325]*/ + 0x00,0x20,0x10,0x10,0x13,0x20,0x20,0x20,0x40,0x40,0x4A,0x52,0x51,0x20,0x20,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00, + /* 0xA4CC [?] [326]*/ + 0x00,0x02,0x02,0x11,0x11,0x13,0x15,0x19,0x11,0x2A,0x2A,0x44,0x44,0x4A,0x32,0x00, + 0x00,0x00,0x00,0x00,0xF0,0x08,0x04,0x04,0x04,0x04,0x68,0x98,0x94,0x62,0x02,0x00, + /* 0xA4CD [?] [327]*/ + 0x00,0x08,0x08,0x08,0x08,0x3E,0x09,0x0A,0x0C,0x18,0x28,0x48,0x49,0x29,0x18,0x00, + 0x00,0x00,0x00,0x00,0x60,0x90,0x08,0x08,0x08,0x08,0x10,0xF0,0x18,0x24,0xC2,0x00, + /* 0xA4CE [?] [328]*/ + 0x00,0x00,0x00,0x07,0x19,0x21,0x42,0x42,0x42,0x44,0x44,0x28,0x10,0x00,0x00,0x00, + 0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0xC0,0x00, + /* 0xA4CF [?] [329]*/ + 0x00,0x20,0x10,0x10,0x14,0x23,0x20,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x00,0x80,0x40,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4D0 [?] [330]*/ + 0x00,0x20,0x10,0x10,0x14,0x23,0x20,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x08,0x84,0x52,0x48,0x44,0xF0,0x40,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4D1 [?] [331]*/ + 0x00,0x20,0x10,0x10,0x14,0x23,0x20,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x0C,0x92,0x52,0x4C,0x40,0xF0,0x40,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4D2 [?] [332]*/ + 0x00,0x00,0x02,0x3E,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x0F,0x00, + 0x00,0x00,0x00,0x20,0x20,0x30,0x28,0x24,0x20,0x20,0x40,0x40,0x40,0x80,0x00,0x00, + /* 0xA4D3 [?] [333]*/ + 0x00,0x00,0x02,0x3E,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x0F,0x00, + 0x08,0x04,0x12,0x08,0x24,0x30,0x28,0x24,0x20,0x20,0x40,0x40,0x40,0x80,0x00,0x00, + /* 0xA4D4 [?] [334]*/ + 0x00,0x00,0x02,0x3E,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x20,0x20,0x10,0x0F,0x00, + 0x0C,0x12,0x12,0x0C,0x20,0x30,0x28,0x24,0x20,0x20,0x40,0x40,0x40,0x80,0x00,0x00, + /* 0xA4D5 [?] [335]*/ + 0x00,0x03,0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x03,0x04,0x44,0x58,0x26,0x01,0x00, + 0x00,0x00,0x80,0xC0,0x00,0x00,0x00,0x00,0xE0,0x98,0x84,0x8C,0x80,0x80,0x00,0x00, + /* 0xA4D6 [?] [336]*/ + 0x00,0x03,0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x03,0x04,0x44,0x58,0x26,0x01,0x00, + 0x08,0x04,0x92,0xC8,0x04,0x00,0x00,0x00,0xE0,0x98,0x84,0x8C,0x80,0x80,0x00,0x00, + /* 0xA4D7 [?] [337]*/ + 0x00,0x03,0x00,0x00,0x01,0x02,0x02,0x01,0x00,0x03,0x04,0x44,0x58,0x26,0x01,0x00, + 0x0C,0x12,0x92,0xCC,0x00,0x00,0x00,0x00,0xE0,0x98,0x84,0x8C,0x80,0x80,0x00,0x00, + /* 0xA4D8 [?] [338]*/ + 0x00,0x00,0x00,0x00,0x06,0x09,0x10,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4D9 [?] [339]*/ + 0x00,0x00,0x00,0x00,0x06,0x09,0x10,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x04,0x12,0x08,0x84,0x40,0x20,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4DA [?] [340]*/ + 0x00,0x00,0x00,0x00,0x06,0x09,0x10,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x18,0x24,0x24,0x18,0x80,0x40,0x20,0x18,0x06,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4DB [?] [341]*/ + 0x00,0x20,0x13,0x10,0x10,0x24,0x23,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x00,0x70,0xC0,0x40,0x40,0x40,0xF8,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4DC [?] [342]*/ + 0x00,0x20,0x13,0x10,0x10,0x24,0x23,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x08,0x64,0xC2,0x48,0x44,0x40,0xF8,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4DD [?] [343]*/ + 0x00,0x20,0x13,0x10,0x10,0x24,0x23,0x20,0x40,0x48,0x48,0x53,0x54,0x64,0x23,0x00, + 0x00,0x6C,0xD2,0x52,0x4C,0x40,0xF8,0x40,0x40,0x40,0x40,0xC0,0x70,0x48,0x84,0x00, + /* 0xA4DE [?] [344]*/ + 0x00,0x01,0x21,0x1F,0x01,0x01,0x11,0x0F,0x01,0x01,0x01,0x1D,0x23,0x21,0x1E,0x00, + 0x00,0x00,0x00,0xF0,0x20,0x00,0x00,0xE0,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x00, + /* 0xA4DF [?] [345]*/ + 0x00,0x00,0x13,0x0C,0x00,0x00,0x01,0x01,0x01,0x1A,0x27,0x44,0x48,0x30,0x00,0x01, + 0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x10,0x10,0x20,0xA0,0x70,0x48,0x44,0x80,0x00, + /* 0xA4E0 [?] [346]*/ + 0x00,0x08,0x04,0x04,0x07,0x7C,0x04,0x1C,0x26,0x26,0x16,0x0C,0x08,0x08,0x07,0x00, + 0x00,0x00,0x00,0x80,0xC0,0x08,0x04,0x02,0x06,0x08,0x00,0x10,0x10,0x18,0xF0,0x00, + /* 0xA4E1 [?] [347]*/ + 0x00,0x01,0x20,0x10,0x10,0x1F,0x11,0x29,0x45,0x42,0x45,0x48,0x30,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x80,0xC0,0x20,0x10,0x08,0x08,0x08,0x10,0x10,0x20,0xC0,0x00, + /* 0xA4E2 [?] [348]*/ + 0x02,0x02,0x02,0x02,0x23,0x1E,0x04,0x04,0x44,0x3F,0x04,0x04,0x04,0x04,0x03,0x00, + 0x00,0x00,0x00,0x00,0xC0,0x00,0x10,0x08,0xC8,0x08,0x08,0x08,0x08,0x08,0xF0,0x00, + /* 0xA4E3 [?] [349]*/ + 0x00,0x00,0x00,0x03,0x00,0x00,0x09,0x24,0x1F,0x02,0x02,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x70,0x88,0x08,0x10,0x60,0x00,0x80,0x80,0x40, + /* 0xA4E4 [?] [350]*/ + 0x00,0x02,0x01,0x00,0x00,0x09,0x10,0x11,0x7E,0x08,0x08,0x04,0x02,0x02,0x01,0x00, + 0x00,0x00,0x80,0x40,0x40,0x80,0x30,0xC8,0x04,0x04,0x88,0x70,0x00,0x00,0x00,0x80, + /* 0xA4E5 [?] [351]*/ + 0x00,0x00,0x00,0x01,0x00,0x10,0x11,0x12,0x24,0x24,0x28,0x2A,0x31,0x10,0x01,0x02, + 0x00,0x00,0x00,0x00,0x80,0x80,0xE0,0x90,0x88,0x88,0x88,0x88,0x90,0xE0,0x00,0x00, + /* 0xA4E6 [?] [352]*/ + 0x00,0x00,0x10,0x10,0x11,0x12,0x22,0x24,0x24,0x24,0x28,0x2A,0x31,0x10,0x00,0x03, + 0x00,0x80,0x40,0x40,0xF0,0x48,0x44,0x44,0x42,0x42,0x42,0x44,0x58,0xE0,0x80,0x00, + /* 0xA4E7 [?] [353]*/ + 0x00,0x00,0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x0F,0x11,0x11,0x0E,0x00, + 0x00,0x00,0x00,0x00,0x00,0x20,0xF0,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00, + /* 0xA4E8 [?] [354]*/ + 0x00,0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x1F,0x21,0x41,0x42,0x3C,0x00, + 0x00,0x00,0x00,0x00,0x10,0x38,0xC0,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00, + /* 0xA4E9 [?] [355]*/ + 0x00,0x18,0x04,0x02,0x02,0x04,0x08,0x10,0x10,0x13,0x14,0x18,0x00,0x00,0x00,0x03, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x30,0xC0,0x00, + /* 0xA4EA [?] [356]*/ + 0x00,0x10,0x08,0x09,0x0A,0x0A,0x0A,0x0C,0x0C,0x08,0x08,0x00,0x00,0x00,0x01,0x02, + 0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00, + /* 0xA4EB [?] [357]*/ + 0x00,0x00,0x07,0x04,0x00,0x00,0x01,0x02,0x07,0x08,0x00,0x01,0x02,0x02,0x01,0x00, + 0x00,0x40,0xA0,0x20,0x40,0x80,0x00,0xF0,0x08,0x04,0x04,0x84,0x44,0x48,0xF0,0x00, + /* 0xA4EC [?] [358]*/ + 0x00,0x08,0x08,0x08,0x0E,0x79,0x0A,0x0C,0x08,0x18,0x28,0x28,0x68,0x18,0x08,0x00, + 0x00,0x00,0x00,0xC0,0xA0,0x20,0x20,0x20,0x40,0x40,0x40,0x42,0x42,0x24,0x18,0x00, + /* 0xA4ED [?] [359]*/ + 0x00,0x03,0x1C,0x00,0x01,0x02,0x04,0x0F,0x18,0x20,0x00,0x00,0x00,0x00,0x01,0x00, + 0x00,0xC0,0x40,0x80,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0x10,0x60,0x80,0x00, + /* 0xA4EE [?] [360]*/ + 0x00,0x00,0x08,0x04,0x04,0x07,0x3C,0x07,0x0C,0x14,0x24,0x34,0x0C,0x04,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x08,0x08,0x08,0x08,0x10,0x20,0xC0,0x00,0x00, + /* 0xA4EF [?] [361]*/ + 0x00,0x10,0x08,0x08,0x0F,0x78,0x0B,0x0C,0x08,0x18,0x28,0x48,0x68,0x18,0x08,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xE0,0x18,0x04,0x04,0x04,0x04,0x08,0x10,0x60,0x00, + /* 0xA4F0 [?] [362]*/ + 0x00,0x00,0x07,0x18,0x00,0x00,0x07,0x08,0x10,0x21,0x41,0x42,0x24,0x18,0x00,0x00, + 0x00,0x00,0x80,0x80,0x80,0x80,0xE0,0x90,0x88,0x04,0x04,0x64,0x94,0x88,0x70,0x00, + /* 0xA4F1 [?] [363]*/ + 0x00,0x0F,0x00,0x01,0x07,0x08,0x10,0x03,0x04,0x03,0x02,0x04,0x18,0x26,0x21,0x00, + 0x00,0x80,0x80,0x00,0xE0,0x10,0x10,0x90,0xA0,0xC0,0x00,0x00,0x38,0x44,0x88,0x00, + /* 0xA4F2 [?] [364]*/ + 0x00,0x02,0x01,0x11,0x0F,0x01,0x01,0x02,0x04,0x04,0x08,0x01,0x02,0x02,0x01,0x00, + 0x00,0x00,0x10,0xE0,0x00,0x08,0x88,0x50,0x50,0x60,0xC0,0x40,0x40,0x00,0xF8,0x00, + /* 0xA4F3 [?] [365]*/ + 0x00,0x03,0x01,0x01,0x01,0x02,0x02,0x02,0x03,0x06,0x04,0x04,0x08,0x08,0x10,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x48,0x70,0x00,0x00, + /* 0xA4F4 [?] [366]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4F5 [?] [367]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4F6 [?] [368]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4F7 [?] [369]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4F8 [?] [370]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4F9 [?] [371]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4FA [?] [372]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4FB [?] [373]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4FC [?] [374]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4FD [?] [375]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA4FE [?] [376]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A1 [?] [377]*/ + 0x00,0x00,0x00,0x00,0x1F,0x00,0x02,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x08,0x00, + 0x00,0x00,0x00,0x00,0xF0,0x10,0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A2 [?] [378]*/ + 0x00,0x00,0x3F,0x00,0x00,0x00,0x02,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x08,0x00, + 0x00,0x00,0xF8,0x08,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A3 [?] [379]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x05,0x09,0x11,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A4 [?] [380]*/ + 0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x05,0x09,0x11,0x21,0x01,0x01,0x01,0x01,0x01, + 0x00,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A5 [?] [381]*/ + 0x00,0x00,0x01,0x01,0x11,0x1F,0x10,0x10,0x10,0x00,0x00,0x00,0x00,0x03,0x0C,0x00, + 0x00,0x00,0x00,0x00,0x10,0xF8,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00, + /* 0xA5A6 [?] [382]*/ + 0x00,0x01,0x01,0x21,0x3F,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x03,0x0C,0x00, + 0x00,0x00,0x00,0x08,0xFC,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xA5A7 [?] [383]*/ + 0x00,0x00,0x00,0x00,0x1F,0x01,0x01,0x01,0x01,0x01,0x3F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x20,0xF0,0x00,0x00,0x00,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00, + /* 0xA5A8 [?] [384]*/ + 0x00,0x00,0x00,0x00,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x7F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00, + /* 0xA5A9 [?] [385]*/ + 0x00,0x00,0x01,0x01,0x01,0x3F,0x03,0x05,0x09,0x11,0x21,0x01,0x05,0x02,0x00,0x00, + 0x00,0x00,0x00,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5AA [?] [386]*/ + 0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x42,0x01,0x00, + 0x00,0x80,0x80,0x80,0x88,0xFC,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00, + /* 0xA5AB [?] [387]*/ + 0x00,0x02,0x02,0x02,0x02,0x3F,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x21,0x40,0x00, + 0x00,0x00,0x00,0x00,0x20,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x00, + /* 0xA5AC [?] [388]*/ + 0x00,0x02,0x02,0x02,0x02,0x3F,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x21,0x40,0x00, + 0x08,0x04,0x12,0x08,0x24,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x00, + /* 0xA5AD [?] [389]*/ + 0x00,0x10,0x10,0x08,0x04,0x3F,0x02,0x02,0x01,0x3F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xE0,0x00,0x00,0x00,0x70,0x80,0x80,0x40,0x40,0x20,0x10,0x00, + /* 0xA5AE [?] [390]*/ + 0x00,0x10,0x10,0x08,0x04,0x3F,0x02,0x02,0x01,0x3F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x04,0x12,0x08,0xE4,0x00,0x00,0x00,0x70,0x80,0x80,0x40,0x40,0x20,0x10,0x00, + /* 0xA5AF [?] [391]*/ + 0x00,0x02,0x02,0x02,0x03,0x04,0x04,0x08,0x10,0x20,0x00,0x01,0x02,0x0C,0x30,0x00, + 0x00,0x00,0x00,0x10,0xF8,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B0 [?] [392]*/ + 0x00,0x04,0x04,0x04,0x07,0x08,0x08,0x10,0x20,0x40,0x01,0x02,0x04,0x18,0x60,0x00, + 0x08,0x04,0x12,0x08,0xE4,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B1 [?] [393]*/ + 0x00,0x08,0x08,0x08,0x0F,0x10,0x20,0x40,0x00,0x01,0x01,0x02,0x04,0x08,0x30,0x00, + 0x00,0x00,0x00,0x10,0xF8,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B2 [?] [394]*/ + 0x00,0x08,0x08,0x08,0x0F,0x10,0x20,0x40,0x00,0x01,0x01,0x02,0x04,0x08,0x30,0x00, + 0x08,0x04,0x12,0x08,0xF4,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B3 [?] [395]*/ + 0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x10,0xF8,0x10,0x10,0x10,0x20,0x20,0xF0,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B4 [?] [396]*/ + 0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 0x08,0x04,0x12,0x08,0x24,0xF0,0x20,0x20,0x20,0x40,0xE0,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B5 [?] [397]*/ + 0x00,0x00,0x04,0x04,0x04,0x04,0x7F,0x04,0x04,0x04,0x04,0x04,0x00,0x01,0x02,0x00, + 0x00,0x40,0x40,0x40,0x40,0x48,0xFC,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00, + /* 0xA5B6 [?] [398]*/ + 0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x7F,0x04,0x04,0x04,0x04,0x04,0x00,0x01,0x02, + 0x08,0x04,0x52,0x48,0x44,0x40,0x48,0xFC,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00, + /* 0xA5B7 [?] [399]*/ + 0x00,0x00,0x18,0x04,0x02,0x30,0x08,0x04,0x00,0x00,0x01,0x02,0x24,0x18,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B8 [?] [400]*/ + 0x00,0x00,0x00,0x18,0x04,0x02,0x30,0x08,0x04,0x00,0x00,0x01,0x02,0x24,0x18,0x00, + 0x08,0x04,0x12,0x08,0x04,0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA5B9 [?] [401]*/ + 0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x08,0x00,0x00, + /* 0xA5BA [?] [402]*/ + 0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00, + 0x08,0x04,0x12,0x08,0xE4,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x08,0x00, + /* 0xA5BB [?] [403]*/ + 0x00,0x04,0x04,0x04,0x04,0x07,0x7C,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xE0,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0xF0,0x00,0x00, + /* 0xA5BC [?] [404]*/ + 0x00,0x04,0x04,0x04,0x04,0x07,0x7C,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,0x00, + 0x08,0x04,0x12,0x08,0x04,0xE0,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0xF0,0x00,0x00, + /* 0xA5BD [?] [405]*/ + 0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x06,0x02,0x00,0x00,0x01,0x02,0x0C,0x30,0x00, + 0x00,0x00,0x20,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA5BE [?] [406]*/ + 0x00,0x00,0x00,0x00,0x00,0x20,0x10,0x08,0x0C,0x04,0x00,0x01,0x02,0x04,0x18,0x60, + 0x08,0x04,0x12,0x48,0x24,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA5BF [?] [407]*/ + 0x00,0x04,0x04,0x07,0x04,0x08,0x08,0x10,0x24,0x02,0x01,0x02,0x04,0x18,0x60,0x00, + 0x00,0x00,0x20,0xF0,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x80,0x40,0x00,0x00,0x00, + /* 0xA5C0 [?] [408]*/ + 0x00,0x08,0x08,0x0F,0x08,0x10,0x10,0x20,0x49,0x05,0x02,0x05,0x08,0x30,0xC0,0x00, + 0x08,0x04,0x52,0xE8,0x44,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C1 [?] [409]*/ + 0x00,0x00,0x01,0x1F,0x01,0x01,0x7F,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x00, + 0x00,0x20,0xF0,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C2 [?] [410]*/ + 0x00,0x00,0x00,0x03,0x3E,0x02,0x02,0xFF,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20, + 0x08,0x04,0x52,0xE8,0x04,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C3 [?] [411]*/ + 0x00,0x00,0x00,0x00,0x04,0x03,0x21,0x18,0x08,0x00,0x00,0x00,0x01,0x06,0x18,0x00, + 0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA5C4 [?] [412]*/ + 0x00,0x00,0x04,0x02,0x21,0x11,0x08,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x30,0x00, + 0x00,0x00,0x00,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C5 [?] [413]*/ + 0x00,0x00,0x08,0x04,0x42,0x22,0x10,0x10,0x00,0x01,0x02,0x04,0x08,0x10,0x60,0x00, + 0x08,0x04,0x12,0x28,0x24,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C6 [?] [414]*/ + 0x00,0x00,0x1F,0x00,0x00,0x00,0x7F,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20, + 0x00,0x20,0xF0,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C7 [?] [415]*/ + 0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0xFF,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20, + 0x08,0x04,0x52,0xE8,0x04,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C8 [?] [416]*/ + 0x00,0x04,0x04,0x04,0x04,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5C9 [?] [417]*/ + 0x00,0x04,0x04,0x04,0x04,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00, + 0x08,0x04,0x12,0x08,0x04,0x00,0x00,0xC0,0x60,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5CA [?] [418]*/ + 0x00,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x00, + 0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5CB [?] [419]*/ + 0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x20,0xF0,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00, + /* 0xA5CC [?] [420]*/ + 0x00,0x00,0x1F,0x00,0x00,0x0C,0x02,0x01,0x00,0x00,0x01,0x02,0x04,0x08,0x30,0x00, + 0x00,0x10,0xF8,0x10,0x20,0x20,0x40,0x40,0x80,0xC0,0x30,0x10,0x00,0x00,0x00,0x00, + /* 0xA5CD [?] [421]*/ + 0x02,0x01,0x00,0x00,0x1F,0x00,0x01,0x03,0x05,0x09,0x11,0x21,0x01,0x01,0x01,0x00, + 0x00,0x80,0x80,0x00,0xC0,0x80,0x00,0x00,0x40,0x30,0x10,0x00,0x00,0x00,0x00,0x00, + /* 0xA5CE [?] [422]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0x08,0x10,0x00, + 0x00,0x00,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5CF [?] [423]*/ + 0x00,0x00,0x00,0x00,0x04,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x00,0x00,0x00,0x00, + /* 0xA5D0 [?] [424]*/ + 0x00,0x00,0x00,0x00,0x04,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 0x08,0x04,0x12,0x08,0x44,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x00,0x00,0x00,0x00, + /* 0xA5D1 [?] [425]*/ + 0x00,0x00,0x00,0x00,0x04,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x00,0x00,0x00, + 0x00,0x0C,0x12,0x12,0x4C,0x20,0x10,0x08,0x08,0x04,0x04,0x04,0x00,0x00,0x00,0x00, + /* 0xA5D2 [?] [426]*/ + 0x00,0x00,0x08,0x08,0x08,0x08,0x09,0x0E,0x08,0x08,0x08,0x08,0x07,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0x60,0x80,0x00,0x00,0x00,0x00,0x20,0xF0,0x00,0x00,0x00, + /* 0xA5D3 [?] [427]*/ + 0x00,0x00,0x00,0x20,0x20,0x21,0x21,0x26,0x38,0x20,0x20,0x20,0x20,0x1F,0x00,0x00, + 0x08,0x04,0x12,0x08,0x04,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x00,0x00, + /* 0xA5D4 [?] [428]*/ + 0x00,0x00,0x00,0x20,0x20,0x21,0x21,0x26,0x38,0x20,0x20,0x20,0x20,0x1F,0x00,0x00, + 0x00,0x0C,0x12,0x12,0x0C,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x80,0xC0,0x00,0x00, + /* 0xA5D5 [?] [429]*/ + 0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00, + 0x00,0x00,0x20,0xF0,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5D6 [?] [430]*/ + 0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0x08,0x10,0x20,0x00, + 0x08,0x04,0x12,0x48,0xE4,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5D7 [?] [431]*/ + 0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0x08,0x10,0x20,0x00, + 0x00,0x0C,0x12,0x52,0xEC,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5D8 [?] [432]*/ + 0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0E,0x00,0x00,0x00,0x00,0x00, + /* 0xA5D9 [?] [433]*/ + 0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x08,0x04,0x12,0x08,0x04,0x00,0x00,0x00,0xC0,0x30,0x0E,0x00,0x00,0x00,0x00,0x00, + /* 0xA5DA [?] [434]*/ + 0x00,0x00,0x00,0x00,0x00,0x18,0x24,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x0C,0x12,0x12,0x0C,0x00,0x00,0x00,0xC0,0x30,0x0E,0x00,0x00,0x00,0x00,0x00, + /* 0xA5DB [?] [435]*/ + 0x00,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x09,0x09,0x11,0x21,0x01,0x05,0x02,0x00, + 0x00,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x20,0x10,0x08,0x08,0x00,0x00,0x00,0x00, + /* 0xA5DC [?] [436]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x11,0x11,0x21,0x41,0x05,0x02,0x00, + 0x08,0x04,0x12,0x08,0x04,0x00,0xFC,0x00,0x00,0x20,0x10,0x08,0x08,0x00,0x00,0x00, + /* 0xA5DD [?] [437]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x11,0x11,0x21,0x41,0x05,0x02,0x00, + 0x0C,0x12,0x12,0x0C,0x00,0x08,0xFC,0x00,0x00,0x20,0x10,0x08,0x08,0x00,0x00,0x00, + /* 0xA5DE [?] [438]*/ + 0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x10,0xF8,0x10,0x20,0x20,0x40,0x80,0x80,0x40,0x40,0x00,0x00,0x00, + /* 0xA5DF [?] [439]*/ + 0x00,0x00,0x0E,0x01,0x00,0x00,0x1C,0x03,0x00,0x00,0x1C,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x60,0x20,0x00,0x80,0x80,0x00,0x00,0x00,0xE0,0x20,0x00,0x00, + /* 0xA5E0 [?] [440]*/ + 0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x3F,0x10,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x10,0xF8,0x08,0x08,0x00, + /* 0xA5E1 [?] [441]*/ + 0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0x01,0x02,0x04,0x08,0x10,0x60,0x00, + 0x00,0x00,0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x60,0x20,0x00,0x00,0x00,0x00,0x00, + /* 0xA5E2 [?] [442]*/ + 0x00,0x00,0x03,0x3E,0x02,0x02,0x03,0x7E,0x02,0x02,0x02,0x02,0x02,0x01,0x00,0x00, + 0x00,0x40,0xE0,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x10,0xF8,0x00,0x00, + /* 0xA5E3 [?] [443]*/ + 0x00,0x00,0x00,0x00,0x10,0x08,0x08,0x24,0x1F,0x02,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x10,0x20,0x00,0x80,0x80,0x40,0x00, + /* 0xA5E4 [?] [444]*/ + 0x00,0x10,0x10,0x08,0x08,0x44,0x3F,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x78,0x88,0x10,0x20,0x00,0x00,0x80,0x80,0x40,0x20,0x00, + /* 0xA5E5 [?] [445]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x20,0xF0,0x20,0x20,0x20,0x40,0x48,0xFC,0x00,0x00,0x00, + /* 0xA5E6 [?] [446]*/ + 0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x10,0xF8,0x10,0x10,0x10,0x20,0x20,0x24,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xA5E7 [?] [447]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00,0x1F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x10,0xF8,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x00,0x00, + /* 0xA5E8 [?] [448]*/ + 0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x10,0xF8,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10,0x00,0x00,0x00,0x00, + /* 0xA5E9 [?] [449]*/ + 0x00,0x00,0x0F,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x18,0x00, + 0x00,0x40,0xE0,0x00,0x10,0xF8,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA5EA [?] [450]*/ + 0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x01,0x01,0x02,0x0C, + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00, + /* 0xA5EB [?] [451]*/ + 0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x00,0x00, + 0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x84,0x88,0x90,0xA0,0xC0,0x80,0x00,0x00, + /* 0xA5EC [?] [452]*/ + 0x00,0x00,0x00,0x20,0x10,0x10,0x10,0x10,0x10,0x11,0x12,0x14,0x18,0x10,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5ED [?] [453]*/ + 0x00,0x00,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x20,0xF0,0x20,0x20,0x20,0x20,0x40,0x40,0xE0,0x00,0x00,0x00,0x00,0x00, + /* 0xA5EE [?] [454]*/ + 0x00,0x00,0x10,0x1F,0x10,0x10,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x00,0x00,0x00, + 0x00,0x00,0x20,0xF0,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5EF [?] [455]*/ + 0x00,0x00,0x20,0x3F,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x00, + 0x00,0x00,0x10,0xF8,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA5F0 [?] [456]*/ + 0x00,0x01,0x01,0x01,0x1F,0x09,0x09,0x09,0x09,0x7F,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x40,0xE0,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F1 [?] [457]*/ + 0x00,0x00,0x00,0x1F,0x00,0x02,0x01,0x01,0x01,0x01,0x7F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x40,0x80,0x00,0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F2 [?] [458]*/ + 0x00,0x00,0x00,0x1F,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x00, + 0x00,0x00,0x10,0xF8,0x10,0x10,0xFC,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00, + /* 0xA5F3 [?] [459]*/ + 0x00,0x00,0x10,0x08,0x06,0x02,0x00,0x00,0x00,0x01,0x02,0x24,0x18,0x00,0x00,0x00, + 0x00,0x00,0x00,0x04,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F4 [?] [460]*/ + 0x00,0x02,0x02,0x22,0x3F,0x20,0x20,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0x08,0x00, + 0x08,0x04,0x12,0x48,0xE4,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F5 [?] [461]*/ + 0x00,0x00,0x01,0x01,0x01,0x0F,0x01,0x02,0x02,0x02,0x04,0x05,0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x20,0xF0,0x20,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00, + /* 0xA5F6 [?] [462]*/ + 0x00,0x00,0x04,0x04,0x04,0x07,0x08,0x10,0x01,0x01,0x02,0x04,0x08,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x40,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F7 [?] [463]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F8 [?] [464]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5F9 [?] [465]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5FA [?] [466]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5FB [?] [467]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5FC [?] [468]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5FD [?] [469]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA5FE [?] [470]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6A1 [?] [471]*/ + 0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x0F,0x10,0x10,0x20,0x70,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0xE0,0x10,0x10,0x08,0x1C,0x00,0x00,0x00,0x00, + /* 0xA6A2 [?] [472]*/ + 0x00,0x1F,0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x10,0x10,0x10,0x20,0xC0,0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x00, + /* 0xA6A3 [G] [473]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6A4 [?] [474]*/ + 0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x7F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0xFC,0x00,0x00,0x00,0x00, + /* 0xA6A5 [?] [475]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x80,0x80,0x80,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA6A6 [?] [476]*/ + 0x00,0x1F,0x00,0x00,0x00,0x00,0x01,0x02,0x02,0x04,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00, + /* 0xA6A7 [?] [477]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA6A8 [T] [478]*/ + 0x00,0x03,0x0C,0x10,0x10,0x24,0x27,0x24,0x10,0x10,0x0C,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x60,0x10,0x10,0x48,0xC8,0x48,0x10,0x10,0x60,0x80,0x00,0x00,0x00,0x00, + /* 0xA6A9 [?] [479]*/ + 0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA6AA [?] [480]*/ + 0x00,0x1C,0x08,0x08,0x09,0x0A,0x0E,0x09,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x70,0x40,0x80,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x38,0x00,0x00,0x00,0x00, + /* 0xA6AB [?] [481]*/ + 0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x70,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x1C,0x00,0x00,0x00,0x00, + /* 0xA6AC [?] [482]*/ + 0x00,0x30,0x18,0x14,0x14,0x12,0x12,0x11,0x11,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x18,0x30,0x50,0x50,0x90,0x90,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + /* 0xA6AD [?] [483]*/ + 0x00,0x30,0x18,0x14,0x14,0x12,0x11,0x11,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x60,0x20,0x00,0x00,0x00,0x00, + /* 0xA6AE [?] [484]*/ + 0x00,0x3F,0x20,0x20,0x00,0x08,0x0F,0x08,0x00,0x20,0x20,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x40,0xC0,0x40,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA6AF [?] [485]*/ + 0x00,0x03,0x0C,0x10,0x10,0x20,0x20,0x20,0x10,0x10,0x0C,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x60,0x10,0x10,0x08,0x08,0x08,0x10,0x10,0x60,0x80,0x00,0x00,0x00,0x00, + /* 0xA6B0 [?] [486]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA6B1 [?] [487]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6B2 [S] [488]*/ + 0x00,0x3F,0x10,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA6B3 [?] [489]*/ + 0x00,0x3F,0x21,0x21,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA6B4 [?] [490]*/ + 0x00,0x00,0x06,0x09,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x40,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA6B5 [F] [491]*/ + 0x00,0x03,0x01,0x0F,0x11,0x21,0x21,0x21,0x11,0x0F,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA6B6 [?] [492]*/ + 0x00,0x38,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x08,0x38,0x00,0x00,0x00,0x00, + 0x00,0x38,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x40,0x20,0x38,0x00,0x00,0x00,0x00, + /* 0xA6B7 [?] [493]*/ + 0x00,0x43,0x21,0x11,0x11,0x11,0x11,0x0F,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x84,0x08,0x10,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA6B8 [O] [494]*/ + 0x00,0x07,0x08,0x10,0x20,0x20,0x20,0x20,0x10,0x08,0x24,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x10,0x10,0x10,0x10,0x20,0x40,0x90,0xF0,0x00,0x00,0x00,0x00, + /* 0xA6B9 [?] [495]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BA [?] [496]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BB [?] [497]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BC [?] [498]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BD [?] [499]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BE [?] [500]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6BF [?] [501]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6C0 [?] [502]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6C1 [a] [503]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x60,0xC0,0x40,0x40,0x40,0x40,0x40,0xC0,0x30,0x00,0x00,0x00,0x00, + /* 0xA6C2 [] [504]*/ + 0x00,0x07,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x0C,0x0B,0x08,0x08,0x08,0x00, + 0x00,0x80,0x40,0x40,0x80,0x00,0xC0,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6C3 [?] [505]*/ + 0x00,0x00,0x00,0x0C,0x12,0x22,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6C4 [d] [506]*/ + 0x00,0x03,0x04,0x02,0x01,0x02,0x04,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6C5 [e] [507]*/ + 0x00,0x00,0x00,0x03,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x00,0x00,0x80,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6C6 [?] [508]*/ + 0x00,0x02,0x04,0x04,0x03,0x02,0x04,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x03,0x00, + 0x00,0x00,0x00,0x40,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0xC0,0x00, + /* 0xA6C7 [?] [509]*/ + 0x00,0x00,0x00,0x0D,0x16,0x14,0x04,0x04,0x04,0x04,0x04,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00, + /* 0xA6C8 [?] [510]*/ + 0x00,0x03,0x04,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6C9 [?] [511]*/ + 0x00,0x00,0x00,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6CA [?] [512]*/ + 0x00,0x00,0x00,0x18,0x08,0x08,0x0D,0x0A,0x09,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x40,0x80,0x00,0x00,0x00,0x80,0x40,0x70,0x00,0x00,0x00,0x00, + /* 0xA6CB [?] [513]*/ + 0x00,0x04,0x0A,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x50,0x20,0x00,0x00,0x00,0x00, + /* 0xA6CC [] [514]*/ + 0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0C,0x0B,0x08,0x08,0x08,0x00, + 0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xD0,0x20,0x00,0x00,0x00,0x00, + /* 0xA6CD [?] [515]*/ + 0x00,0x00,0x00,0x18,0x08,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x20,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA6CE [?] [516]*/ + 0x00,0x04,0x08,0x07,0x08,0x08,0x07,0x04,0x08,0x08,0x08,0x07,0x00,0x04,0x03,0x00, + 0x00,0x00,0x00,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0xC0,0x00, + /* 0xA6CF [?] [517]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6D0 [p] [518]*/ + 0x00,0x00,0x00,0x1F,0x24,0x04,0x04,0x04,0x04,0x04,0x08,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x40,0x40,0x40,0x40,0x40,0x40,0x50,0x20,0x00,0x00,0x00,0x00, + /* 0xA6D1 [?] [519]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x18,0x14,0x13,0x10,0x10,0x10,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6D2 [s] [520]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6D3 [t] [521]*/ + 0x00,0x00,0x00,0x07,0x09,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA6D4 [?] [522]*/ + 0x00,0x00,0x00,0x08,0x14,0x04,0x04,0x04,0x04,0x04,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA6D5 [f] [523]*/ + 0x00,0x01,0x01,0x07,0x09,0x11,0x11,0x11,0x11,0x11,0x09,0x07,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA6D6 [?] [524]*/ + 0x00,0x00,0x00,0x08,0x14,0x04,0x02,0x02,0x01,0x01,0x02,0x04,0x08,0x08,0x10,0x00, + 0x00,0x00,0x00,0x10,0x20,0x20,0x40,0x80,0x00,0x00,0x80,0x80,0x40,0x50,0x20,0x00, + /* 0xA6D7 [?] [525]*/ + 0x00,0x01,0x01,0x11,0x29,0x09,0x09,0x09,0x09,0x09,0x09,0x07,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x40,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA6D8 [?] [526]*/ + 0x00,0x00,0x00,0x04,0x08,0x10,0x11,0x11,0x11,0x11,0x0A,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0xA0,0x40,0x00,0x00,0x00,0x00, + /* 0xA6D9 [?] [527]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x30,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6DA [?] [528]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6DB [?] [529]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x40,0x20,0x30,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6DC [?] [530]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00, + /* 0xA6DD [?] [531]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6DE [?] [532]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x00,0x00,0x30,0x30,0x00,0x00, + /* 0xA6DF [?] [533]*/ + 0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x70,0x88,0x0C,0x8C,0x8C,0x18,0x30,0x30,0x30,0x30,0x00,0x30,0x30,0x00, + /* 0xA6E0 [?] [534]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x08,0x04,0x00,0x00,0x00, + /* 0xA6E1 [?] [535]*/ + 0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x04,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6E2 [?] [536]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x40,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x08,0x04,0x00,0x00,0x00, + /* 0xA6E3 [?] [537]*/ + 0x00,0x00,0x00,0x40,0x20,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x04,0x08,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6E4 [?] [538]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x18,0x60,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0x00,0x00, + /* 0xA6E5 [?] [539]*/ + 0x00,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6E6 [?] [540]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x18,0x61,0x06,0x18,0x60,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x30,0x0C,0xC0,0x30,0x0C,0x00,0x00, + /* 0xA6E7 [?] [541]*/ + 0x00,0x00,0x60,0x18,0x06,0x61,0x18,0x06,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x0C,0x30,0xC0,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6E8 [?] [542]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x00,0x00, + /* 0xA6E9 [?] [543]*/ + 0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6EA [?] [544]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x40,0x7F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x04,0xF4,0x14,0x1C,0x00,0x00, + /* 0xA6EB [?] [545]*/ + 0x00,0x00,0x70,0x50,0x5F,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xFC,0x04,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6EC [?] [546]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x40,0x47,0x58,0x60,0x40,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x04,0xC4,0x34,0x0C,0x04,0x00,0x00, + /* 0xA6ED [?] [547]*/ + 0x00,0x00,0x40,0x60,0x58,0x47,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x04,0x0C,0x34,0xC4,0x04,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6EE [?] [548]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x7F,0x7F,0x78,0x60,0x40,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0x3C,0x0C,0x04,0x00,0x00, + /* 0xA6EF [?] [549]*/ + 0x00,0x00,0x40,0x60,0x78,0x7F,0x7F,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x04,0x0C,0x3C,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F0 [?] [550]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x3C,0x40,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x78,0x04,0x00,0x00,0x00, + /* 0xA6F1 [?] [551]*/ + 0x00,0x00,0x00,0x40,0x3C,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x04,0x78,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F2 [?] [552]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F3 [?] [553]*/ + 0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F4 [?] [554]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F5 [?] [555]*/ + 0x01,0x02,0x02,0x01,0x01,0x02,0x02,0x01,0x01,0x02,0x02,0x01,0x01,0x02,0x02,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F6 [?] [556]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F7 [?] [557]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F8 [?] [558]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6F9 [?] [559]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6FA [?] [560]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6FB [?] [561]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6FC [?] [562]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6FD [?] [563]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA6FE [?] [564]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7A1 [?] [565]*/ + 0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x0F,0x10,0x10,0x20,0x70,0x00,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x40,0x40,0x20,0xE0,0x10,0x10,0x08,0x1C,0x00,0x00,0x00,0x00, + /* 0xA7A2 [?] [566]*/ + 0x00,0x1F,0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x00, + /* 0xA7A3 [?] [567]*/ + 0x00,0x1F,0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x10,0x10,0x10,0x20,0xC0,0x20,0x10,0x10,0x10,0xE0,0x00,0x00,0x00,0x00, + /* 0xA7A4 [?] [568]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7A5 [?] [569]*/ + 0x00,0x0F,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x1F,0x20,0x20,0x00,0x00, + 0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xF0,0x08,0x08,0x00,0x00, + /* 0xA7A6 [?] [570]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x00,0x80,0x80,0x80,0x00,0x10,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA7A7 [?] [571]*/ + 0x04,0x00,0x3F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x40,0x00,0xF0,0x10,0x00,0x40,0xC0,0x40,0x00,0x00,0x10,0xF0,0x00,0x00,0x00,0x00, + /* 0xA7A8 [?] [572]*/ + 0x00,0x23,0x51,0x09,0x09,0x05,0x03,0x05,0x09,0x11,0x11,0x63,0x00,0x00,0x00,0x00, + 0x00,0x88,0x14,0x20,0x20,0x40,0x80,0x40,0x20,0x10,0x10,0x8C,0x00,0x00,0x00,0x00, + /* 0xA7A9 [?] [573]*/ + 0x00,0x0B,0x0C,0x08,0x00,0x00,0x01,0x00,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7AA [?] [574]*/ + 0x00,0x38,0x10,0x10,0x10,0x11,0x11,0x12,0x14,0x14,0x18,0x30,0x00,0x00,0x00,0x00, + 0x00,0x30,0x60,0xA0,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7AB [?] [575]*/ + 0x04,0x04,0x73,0x20,0x20,0x20,0x21,0x22,0x24,0x28,0x30,0x60,0x00,0x00,0x00,0x00, + 0x40,0x40,0x98,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + /* 0xA7AC [?] [576]*/ + 0x00,0x38,0x10,0x11,0x11,0x12,0x1E,0x11,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x60,0x90,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x30,0x00,0x00,0x00,0x00, + /* 0xA7AD [?] [577]*/ + 0x00,0x1F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7AE [?] [578]*/ + 0x00,0x30,0x18,0x14,0x14,0x12,0x12,0x11,0x11,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x18,0x30,0x50,0x50,0x90,0x90,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + /* 0xA7AF [?] [579]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7B0 [?] [580]*/ + 0x00,0x07,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7B1 [?] [581]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7B2 [?] [582]*/ + 0x00,0x3F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7B3 [?] [583]*/ + 0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0xD0,0x30,0x10,0x00,0x00,0x00,0x00,0x08,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7B4 [?] [584]*/ + 0x00,0x3F,0x21,0x21,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA7B5 [?] [585]*/ + 0x00,0x1C,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x02,0x24,0x18,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7B6 [?] [586]*/ + 0x00,0x03,0x01,0x0F,0x11,0x21,0x21,0x21,0x11,0x0F,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA7B7 [?] [587]*/ + 0x00,0x38,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x04,0x08,0x38,0x00,0x00,0x00,0x00, + 0x00,0x38,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x40,0x20,0x38,0x00,0x00,0x00,0x00, + /* 0xA7B8 [?] [588]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xF0,0x08,0x08,0x00,0x00, + /* 0xA7B9 [?] [589]*/ + 0x00,0x38,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x60,0xA0,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7BA [?] [590]*/ + 0x00,0x3B,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xB8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF8,0x00,0x00,0x00,0x00, + /* 0xA7BB [?] [591]*/ + 0x00,0x3B,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xB8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF8,0x04,0x04,0x00,0x00, + /* 0xA7BC [?] [592]*/ + 0x00,0x3E,0x24,0x04,0x04,0x07,0x04,0x04,0x04,0x04,0x04,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x00, + /* 0xA7BD [?] [593]*/ + 0x00,0x70,0x20,0x20,0x20,0x3C,0x22,0x21,0x21,0x21,0x22,0x7C,0x00,0x00,0x00,0x00, + 0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7BE [?] [594]*/ + 0x00,0x1C,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7BF [?] [595]*/ + 0x00,0x2F,0x30,0x20,0x00,0x00,0x07,0x00,0x00,0x20,0x10,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x80,0x40,0x20,0x10,0x10,0xF0,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7C0 [?] [596]*/ + 0x00,0x71,0x22,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x22,0x71,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7C1 [?] [597]*/ + 0x00,0x07,0x08,0x10,0x10,0x08,0x07,0x01,0x02,0x04,0x08,0x30,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x20,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7C2 [?] [598]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C3 [?] [599]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C4 [?] [600]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C5 [?] [601]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C6 [?] [602]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C7 [?] [603]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C8 [?] [604]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7C9 [?] [605]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CA [?] [606]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CB [?] [607]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CC [?] [608]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CD [?] [609]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CE [?] [610]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7CF [?] [611]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7D0 [?] [612]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7D1 [?] [613]*/ + 0x00,0x00,0x00,0x07,0x08,0x00,0x0F,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0xC0,0x40,0x40,0xD0,0x20,0x00,0x00,0x00,0x00, + /* 0xA7D2 [?] [614]*/ + 0x00,0x07,0x08,0x10,0x17,0x18,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x20,0xC0,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7D3 [?] [615]*/ + 0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x40,0x40,0x80,0x40,0x40,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7D4 [?] [616]*/ + 0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7D5 [?] [617]*/ + 0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x1F,0x20,0x20,0x00,0x00, + 0x00,0x00,0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xF0,0x08,0x08,0x00,0x00, + /* 0xA7D6 [?] [618]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x1F,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0xE0,0x00,0x00,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7D7 [?] [619]*/ + 0x00,0x04,0x00,0x07,0x08,0x10,0x10,0x1F,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0x80,0x40,0x20,0x20,0xE0,0x00,0x00,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7D8 [?] [620]*/ + 0x00,0x00,0x00,0x33,0x09,0x09,0x05,0x07,0x09,0x09,0x11,0x23,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x98,0x20,0x20,0x40,0xC0,0x20,0x20,0x10,0x88,0x00,0x00,0x00,0x00, + /* 0xA7D9 [?] [621]*/ + 0x00,0x00,0x00,0x0B,0x0C,0x08,0x00,0x01,0x00,0x00,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0xC0,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7DA [?] [622]*/ + 0x00,0x00,0x00,0x38,0x10,0x10,0x10,0x11,0x12,0x14,0x18,0x30,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x60,0xA0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7DB [?] [623]*/ + 0x00,0x04,0x03,0x38,0x10,0x10,0x10,0x11,0x12,0x14,0x18,0x30,0x00,0x00,0x00,0x00, + 0x00,0x80,0x00,0x70,0x20,0x60,0xA0,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7DC [?] [624]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x09,0x0E,0x0A,0x09,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x60,0x80,0x80,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00, + /* 0xA7DD [?] [625]*/ + 0x00,0x00,0x00,0x0F,0x02,0x02,0x02,0x02,0x02,0x02,0x0A,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7DE [?] [626]*/ + 0x00,0x00,0x00,0x38,0x10,0x18,0x14,0x12,0x12,0x11,0x10,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x38,0x10,0x30,0x50,0x90,0x90,0x10,0x10,0x38,0x00,0x00,0x00,0x00, + /* 0xA7DF [?] [627]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7E0 [?] [628]*/ + 0x00,0x00,0x00,0x03,0x04,0x08,0x08,0x08,0x08,0x08,0x04,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7E1 [?] [629]*/ + 0x00,0x00,0x00,0x1F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7E2 [?] [630]*/ + 0x00,0x00,0x00,0x0B,0x1C,0x08,0x08,0x08,0x08,0x0C,0x0B,0x08,0x08,0x08,0x1C,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00, + /* 0xA7E3 [?] [631]*/ + 0x00,0x00,0x00,0x07,0x08,0x10,0x10,0x10,0x10,0x10,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x40,0x00,0x00,0x00,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7E4 [?] [632]*/ + 0x00,0x00,0x00,0x1F,0x11,0x01,0x01,0x01,0x01,0x01,0x01,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00, + /* 0xA7E5 [?] [633]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x04,0x04,0x02,0x02,0x01,0x02,0x24,0x18,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7E6 [?] [634]*/ + 0x00,0x01,0x01,0x01,0x0D,0x13,0x11,0x11,0x11,0x11,0x13,0x0D,0x01,0x01,0x03,0x00, + 0x00,0x00,0x00,0x00,0x60,0x90,0x10,0x10,0x10,0x10,0x90,0x60,0x00,0x00,0x80,0x00, + /* 0xA7E7 [?] [635]*/ + 0x00,0x00,0x00,0x1C,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x1C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7E8 [?] [636]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xF0,0x08,0x08,0x00,0x00, + /* 0xA7E9 [?] [637]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0xC0,0x40,0x40,0x40,0xE0,0x00,0x00,0x00,0x00, + /* 0xA7EA [?] [638]*/ + 0x00,0x00,0x00,0x3B,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xB8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF8,0x00,0x00,0x00,0x00, + /* 0xA7EB [?] [639]*/ + 0x00,0x00,0x00,0x3B,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xB8,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF8,0x04,0x04,0x00,0x00, + /* 0xA7EC [?] [640]*/ + 0x00,0x00,0x00,0x7C,0x48,0x08,0x08,0x0F,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7ED [?] [641]*/ + 0x00,0x00,0x00,0x38,0x10,0x10,0x10,0x1E,0x11,0x11,0x11,0x3E,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x70,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7EE [?] [642]*/ + 0x00,0x00,0x00,0x1C,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x1F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20,0x20,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7EF [?] [643]*/ + 0x00,0x00,0x00,0x07,0x08,0x00,0x00,0x03,0x00,0x00,0x08,0x07,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x40,0x20,0x20,0xE0,0x20,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xA7F0 [?] [644]*/ + 0x00,0x00,0x00,0x38,0x11,0x12,0x12,0x1E,0x12,0x12,0x11,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xC0,0x20,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00, + /* 0xA7F1 [?] [645]*/ + 0x00,0x00,0x00,0x03,0x04,0x04,0x04,0x03,0x01,0x02,0x0A,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF0,0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x70,0x00,0x00,0x00,0x00, + /* 0xA7F2 [?] [646]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F3 [?] [647]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F4 [?] [648]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F5 [?] [649]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F6 [?] [650]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F7 [?] [651]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F8 [?] [652]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7F9 [?] [653]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7FA [?] [654]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7FB [?] [655]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7FC [?] [656]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7FD [?] [657]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA7FE [?] [658]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A1 [a] [659]*/ + 0x00,0x00,0xFC,0x00,0x00,0x74,0x8C,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A2 [] [660]*/ + 0x08,0x10,0x20,0x00,0x00,0x74,0x8C,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A3 [a] [661]*/ + 0x44,0x28,0x10,0x00,0x00,0x74,0x8C,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A4 [] [662]*/ + 0x40,0x20,0x10,0x00,0x00,0x74,0x8C,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A5 [e] [663]*/ + 0x00,0x00,0xFC,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A6 [] [664]*/ + 0x08,0x10,0x20,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A7 [e] [665]*/ + 0x44,0x28,0x10,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A8 [] [666]*/ + 0x40,0x20,0x10,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8A9 [i] [667]*/ + 0x00,0x00,0x38,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AA [] [668]*/ + 0x08,0x10,0x20,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AB [i] [669]*/ + 0x44,0x28,0x10,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AC [] [670]*/ + 0x20,0x10,0x08,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AD [o] [671]*/ + 0x00,0x00,0xFC,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AE [] [672]*/ + 0x08,0x10,0x20,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8AF [o] [673]*/ + 0x44,0x28,0x10,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B0 [] [674]*/ + 0x20,0x10,0x08,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x44,0x38,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B1 [u] [675]*/ + 0x00,0x00,0xFC,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B2 [] [676]*/ + 0x08,0x10,0x20,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B3 [u] [677]*/ + 0x44,0x28,0x10,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B4 [] [678]*/ + 0x20,0x10,0x08,0x00,0x00,0x84,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B5 [u] [679]*/ + 0x00,0x00,0xFC,0x00,0x48,0x00,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B6 [u] [680]*/ + 0x10,0x20,0x40,0x00,0x48,0x00,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B7 [u] [681]*/ + 0x88,0x50,0x20,0x00,0x48,0x00,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B8 [u] [682]*/ + 0x40,0x20,0x10,0x00,0x48,0x00,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8B9 [] [683]*/ + 0x00,0x00,0x00,0x00,0x48,0x00,0x84,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BA [] [684]*/ + 0x10,0x28,0x44,0x00,0x00,0x38,0x44,0x82,0xFE,0x80,0x42,0x3C,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BB [?] [685]*/ + 0x00,0x00,0x00,0x00,0x00,0x74,0x8C,0x84,0x84,0x84,0x8C,0x76,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BC [?] [686]*/ + 0x08,0x10,0x20,0x00,0x00,0xAC,0xD2,0x92,0x92,0x92,0x92,0x92,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BD [n] [687]*/ + 0x08,0x10,0x20,0x00,0x00,0xB8,0xC4,0x84,0x84,0x84,0x84,0x84,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BE [n] [688]*/ + 0x44,0x28,0x10,0x00,0x00,0xB8,0xC4,0x84,0x84,0x84,0x84,0x84,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8BF [?] [689]*/ + 0x00,0x00,0x00,0x10,0x10,0x08,0x00,0x7C,0x42,0x42,0x42,0x42,0x42,0xE7,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C0 [g] [690]*/ + 0x00,0x00,0x00,0x00,0x00,0x3A,0x44,0x44,0x38,0x40,0x40,0x7C,0x82,0x82,0x7C,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C1 [?] [691]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C2 [?] [692]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C3 [?] [693]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C4 [?] [694]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8C5 [?] [695]*/ + 0x00,0x08,0x08,0x10,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0xA0,0x40, + /* 0xA8C6 [?] [696]*/ + 0x00,0x04,0x04,0x08,0x1F,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x03,0x0C,0x30,0x00, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x10,0x10,0xA0,0x40,0xA0,0x10,0x10,0x00,0x00, + /* 0xA8C7 [?] [697]*/ + 0x00,0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00, + /* 0xA8C8 [?] [698]*/ + 0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x00,0x00, + 0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00, + /* 0xA8C9 [?] [699]*/ + 0x00,0x04,0x04,0x08,0x1F,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x08,0x11,0x20,0x00, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0xA0,0x40, + /* 0xA8CA [?] [700]*/ + 0x00,0x01,0x01,0x01,0x01,0x7F,0x01,0x01,0x02,0x02,0x04,0x08,0x1F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x20,0xF0,0x08,0x00,0x00, + /* 0xA8CB [?] [701]*/ + 0x00,0x00,0x3F,0x00,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00, + 0x00,0x00,0xC0,0x40,0x80,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0xA0,0x40, + /* 0xA8CC [?] [702]*/ + 0x00,0x01,0x09,0x09,0x11,0x11,0x3F,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x50,0x20, + /* 0xA8CD [?] [703]*/ + 0x00,0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x11,0x08,0x08,0x04,0x04,0x02,0x02,0x00, + 0x00,0x00,0x20,0x20,0x40,0x40,0x80,0x80,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x00, + /* 0xA8CE [?] [704]*/ + 0x00,0x00,0x7F,0x04,0x04,0x04,0x08,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x20,0xA0,0x40, + /* 0xA8CF [?] [705]*/ + 0x00,0x00,0x3F,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8D0 [?] [706]*/ + 0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x09,0x0E,0x00,0x00,0x00,0x00,0x00, + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0xA0,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xA8D1 [?] [707]*/ + 0x00,0x00,0x00,0x00,0x01,0x01,0x02,0x04,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x00, + /* 0xA8D2 [?] [708]*/ + 0x00,0x00,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8D3 [?] [709]*/ + 0x00,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0x1F,0x01,0x01,0x01,0x7F,0x00,0x00, + 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0xFC,0x00,0x00, + /* 0xA8D4 [?] [710]*/ + 0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x11,0x03,0x05,0x09,0x11,0x01,0x01,0x01,0x01, + 0x00,0x40,0x80,0x00,0x00,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8D5 [?] [711]*/ + 0x00,0x00,0x1F,0x00,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8D6 [?] [712]*/ + 0x00,0x00,0x0F,0x08,0x08,0x08,0x0A,0x09,0x08,0x08,0x08,0x08,0x08,0x0F,0x00,0x00, + 0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0xA0,0x20,0x20,0x20,0x20,0xE0,0x00,0x00, + /* 0xA8D7 [?] [713]*/ + 0x00,0x00,0x3F,0x04,0x04,0x04,0x04,0x04,0x04,0x05,0x04,0x04,0x04,0x04,0x04,0x04, + 0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0xC0,0x00,0x00,0x00,0x00,0x00, + /* 0xA8D8 [?] [714]*/ + 0x00,0x02,0x02,0x02,0x7F,0x04,0x04,0x04,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x80,0x00, + /* 0xA8D9 [?] [715]*/ + 0x00,0x01,0x01,0x01,0x01,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x3F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0xF0,0x10,0x00,0x00, + /* 0xA8DA [?] [716]*/ + 0x00,0x10,0x08,0x04,0x02,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8DB [?] [717]*/ + 0x00,0x00,0x7F,0x01,0x01,0x01,0x0F,0x10,0x20,0x20,0x20,0x20,0x10,0x0F,0x00,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0xE0,0x00,0x00, + /* 0xA8DC [?] [718]*/ + 0x00,0x01,0x01,0x01,0x7F,0x01,0x01,0x0F,0x10,0x20,0x20,0x20,0x20,0x10,0x0F,0x00, + 0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x10,0xE0,0x00, + /* 0xA8DD [?] [719]*/ + 0x00,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x08,0x09,0x08,0x07,0x00,0x00, + 0x00,0x00,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x80,0x80,0x00,0x00,0xF0,0x00,0x00, + /* 0xA8DE [?] [720]*/ + 0x00,0x00,0x7F,0x09,0x09,0x11,0x1F,0x01,0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + /* 0xA8DF [?] [721]*/ + 0x00,0x00,0x1C,0x04,0x04,0x04,0x02,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x18,0x00, + /* 0xA8E0 [?] [722]*/ + 0x00,0x02,0x02,0x04,0x04,0x08,0x08,0x1F,0x01,0x02,0x04,0x08,0x1F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x20,0x20,0x40,0x40,0x80,0x00,0x00,0x40,0x20,0xF0,0x10,0x00,0x00, + /* 0xA8E1 [?] [723]*/ + 0x00,0x00,0x00,0x1F,0x00,0x00,0x04,0x02,0x01,0x00,0x00,0x01,0x02,0x04,0x08,0x00, + 0x00,0x00,0x00,0xF0,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x40,0x20,0x00,0x00,0x00, + /* 0xA8E2 [?] [724]*/ + 0x00,0x3F,0x08,0x08,0x08,0x08,0x10,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x20,0x20,0x40,0x40,0x40,0xF8,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00, + /* 0xA8E3 [?] [725]*/ + 0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x10,0x10,0x20,0x00, + /* 0xA8E4 [?] [726]*/ + 0x00,0x02,0x02,0x02,0x02,0x7F,0x02,0x02,0x02,0x04,0x04,0x04,0x08,0x10,0x60,0x00, + 0x00,0x00,0x00,0x00,0x00,0xFC,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7C,0x00, + /* 0xA8E5 [?] [727]*/ + 0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x3F,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00, + /* 0xA8E6 [?] [728]*/ + 0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x60,0x00, + 0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x7C,0x00, + /* 0xA8E7 [?] [729]*/ + 0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8E8 [?] [730]*/ + 0x00,0x00,0x00,0x00,0x08,0x04,0x02,0x01,0x00,0x00,0x01,0x02,0x04,0x18,0x60,0x00, + 0x00,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x80,0x40,0x20,0x10,0x00,0x00,0x00, + /* 0xA8E9 [?] [731]*/ + 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00, + /* 0xA8EA [?] [732]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8EB [?] [733]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8EC [?] [734]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8ED [?] [735]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8EE [?] [736]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8EF [?] [737]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F0 [?] [738]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F1 [?] [739]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F2 [?] [740]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F3 [?] [741]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F4 [?] [742]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F5 [?] [743]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F6 [?] [744]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F7 [?] [745]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F8 [?] [746]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8F9 [?] [747]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8FA [?] [748]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8FB [?] [749]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8FC [?] [750]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8FD [?] [751]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA8FE [?] [752]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A1 [?] [753]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A2 [?] [754]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A3 [?] [755]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A4 [-] [756]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A5 [?] [757]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A6 [] [758]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A7 [?] [759]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9A8 [?] [760]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9A9 [?] [761]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3B,0x3B,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xB8,0xB8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9AA [?] [762]*/ + 0x00,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9AB [?] [763]*/ + 0x00,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x00,0x00, + 0x00,0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x00, + /* 0xA9AC [?] [764]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9AD [?] [765]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0xEE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9AE [?] [766]*/ + 0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9AF [?] [767]*/ + 0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x01,0x00, + 0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00, + /* 0xA9B0 [+] [768]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9B1 [?] [769]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9B2 [?] [770]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9B3 [?] [771]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9B4 [+] [772]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9B5 [?] [773]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9B6 [?] [774]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9B7 [?] [775]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9B8 [+] [776]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9B9 [?] [777]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BA [?] [778]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BB [?] [779]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BC [+] [780]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BD [?] [781]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BE [?] [782]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9BF [?] [783]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C0 [+] [784]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C1 [?] [785]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C2 [?] [786]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C3 [?] [787]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9C4 [?] [788]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9C5 [?] [789]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C6 [?] [790]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9C7 [?] [791]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9C8 [] [792]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9C9 [?] [793]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9CA [?] [794]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9CB [?] [795]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9CC [?] [796]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9CD [?] [797]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9CE [?] [798]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9CF [?] [799]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9D0 [-] [800]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9D1 [?] [801]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9D2 [?] [802]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9D3 [?] [803]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9D4 [?] [804]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9D5 [?] [805]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9D6 [?] [806]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9D7 [?] [807]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9D8 [-] [808]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9D9 [?] [809]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DA [?] [810]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DB [?] [811]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DC [?] [812]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DD [?] [813]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DE [?] [814]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9DF [?] [815]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E0 [+] [816]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E1 [?] [817]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E2 [?] [818]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E3 [?] [819]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E4 [?] [820]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E5 [?] [821]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9E6 [?] [822]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9E7 [?] [823]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E8 [?] [824]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9E9 [?] [825]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9EA [?] [826]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9EB [?] [827]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9EC [?] [828]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9ED [?] [829]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9EE [?] [830]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9EF [?] [831]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xA9F0 [?] [832]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F1 [?] [833]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F2 [?] [834]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F3 [?] [835]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F4 [?] [836]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F5 [?] [837]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F6 [?] [838]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F7 [?] [839]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F8 [?] [840]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9F9 [?] [841]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9FA [?] [842]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9FB [?] [843]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9FC [?] [844]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9FD [?] [845]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xA9FE [?] [846]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA1 [?] [847]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA2 [?] [848]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA3 [?] [849]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA4 [?] [850]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA5 [?] [851]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA6 [?] [852]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA7 [?] [853]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA8 [?] [854]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAA9 [?] [855]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAA [?] [856]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAB [?] [857]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAC [?] [858]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAD [?] [859]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAE [?] [860]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAAF [?] [861]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB0 [?] [862]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB1 [?] [863]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB2 [?] [864]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB3 [?] [865]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB4 [?] [866]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB5 [?] [867]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB6 [?] [868]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB7 [?] [869]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB8 [?] [870]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAB9 [?] [871]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABA [?] [872]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABB [?] [873]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABC [?] [874]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABD [?] [875]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABE [?] [876]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAABF [?] [877]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC0 [?] [878]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC1 [?] [879]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC2 [?] [880]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC3 [?] [881]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC4 [?] [882]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC5 [?] [883]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC6 [?] [884]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC7 [?] [885]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC8 [?] [886]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAC9 [?] [887]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACA [?] [888]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACB [?] [889]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACC [?] [890]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACD [?] [891]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACE [?] [892]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAACF [?] [893]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD0 [?] [894]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD1 [?] [895]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD2 [?] [896]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD3 [?] [897]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD4 [?] [898]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD5 [?] [899]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD6 [?] [900]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD7 [?] [901]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD8 [?] [902]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAD9 [?] [903]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADA [?] [904]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADB [?] [905]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADC [?] [906]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADD [?] [907]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADE [?] [908]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAADF [?] [909]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE0 [?] [910]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE1 [?] [911]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE2 [?] [912]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE3 [?] [913]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE4 [?] [914]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE5 [?] [915]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE6 [?] [916]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE7 [?] [917]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE8 [?] [918]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAE9 [?] [919]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAEA [?] [920]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAEB [?] [921]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAEC [?] [922]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAED [?] [923]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAEE [?] [924]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAEF [?] [925]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAF0 [?] [926]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAAF1 [?] [927]*/ + 0x00,0x10,0x20,0x24,0x39,0x21,0x7F,0x21,0x21,0x3C,0x24,0x27,0x1C,0x10,0x10,0x00, + 0x00,0x10,0x90,0x94,0x1C,0x10,0x32,0x52,0x12,0x2C,0x20,0xFE,0x20,0x20,0x20,0x00, + /* 0xAAF2 [?] [928]*/ + 0x00,0x10,0x11,0x21,0x25,0x4B,0x79,0x11,0x21,0x5B,0x63,0x05,0x31,0x41,0x01,0x00, + 0x00,0x00,0x10,0x10,0x10,0xEC,0x18,0xD8,0x58,0x34,0x34,0x52,0x50,0x10,0x10,0x00, + /* 0xAAF3 [?] [929]*/ + 0x00,0x00,0x04,0x38,0x21,0x20,0x20,0x7F,0x24,0x20,0x20,0x21,0x18,0x60,0x03,0x00, + 0x00,0x00,0x90,0x96,0xF8,0x10,0x02,0xFC,0x08,0xF0,0x48,0xF0,0x50,0x40,0xFE,0x00, + /* 0xAAF4 [?] [930]*/ + 0x00,0x00,0x11,0x10,0x10,0x3C,0x10,0x18,0x10,0x70,0x50,0x10,0x11,0x12,0x34,0x00, + 0x00,0x00,0x20,0xA0,0xA0,0x22,0xFE,0x22,0x42,0x64,0x94,0x84,0x04,0x04,0x1C,0x00, + /* 0xAAF5 [?] [931]*/ + 0x00,0x02,0x05,0x39,0x20,0x23,0x3E,0x2B,0x6A,0x2A,0x2A,0x2A,0x12,0x04,0x04,0x08, + 0x00,0x00,0x10,0x20,0xFE,0x50,0x24,0xF8,0x90,0x90,0xAC,0x98,0x98,0xA4,0x22,0x40, + /* 0xAAF6 [?] [932]*/ + 0x00,0x00,0x7D,0x11,0x11,0x11,0x11,0x39,0x11,0x11,0x11,0x16,0x3A,0x44,0x08,0x00, + 0x00,0x00,0xFC,0x04,0xFC,0x10,0x50,0x54,0x54,0x7C,0x10,0x92,0x92,0x92,0x6E,0x00, + /* 0xAAF7 [?] [933]*/ + 0x00,0x00,0x7C,0x11,0x12,0x12,0x13,0x3A,0x11,0x13,0x13,0x17,0x3D,0x45,0x09,0x10, + 0x00,0x40,0x20,0xFC,0x04,0x04,0xF8,0x00,0xFC,0x54,0x54,0xFC,0x54,0x54,0x0C,0x04, + /* 0xAAF8 [?] [934]*/ + 0x00,0x01,0x21,0x23,0x22,0x22,0x3F,0x22,0x23,0x22,0x22,0x12,0x63,0x02,0x00,0x00, + 0x00,0x00,0x1E,0xE4,0x64,0x64,0xFC,0x64,0xE4,0x3C,0xA4,0x64,0xE4,0x24,0x44,0x00, + /* 0xAAF9 [?] [935]*/ + 0x00,0x00,0x04,0x79,0x11,0x11,0x11,0x7D,0x10,0x10,0x11,0x15,0x7A,0x44,0x00,0x00, + 0x00,0x0C,0x70,0x80,0x10,0x20,0x20,0xFE,0x20,0xA8,0xA4,0x26,0x22,0x22,0x60,0x00, + /* 0xAAFA [?] [936]*/ + 0x00,0x18,0x11,0x10,0x14,0x3B,0x12,0x1E,0x36,0x32,0x52,0x92,0x12,0x12,0x10,0x10, + 0x00,0x00,0xFE,0x00,0x12,0xFC,0x54,0x54,0xDC,0xD4,0x54,0x54,0x54,0x54,0x5C,0x00, + /* 0xAAFB [?] [937]*/ + 0x00,0x04,0x04,0x04,0x3F,0x08,0x37,0x02,0x12,0x1F,0x12,0x15,0x14,0x19,0x12,0x00, + 0x00,0x20,0x20,0x26,0xF8,0x08,0xF0,0x40,0x4C,0xF8,0x48,0xA8,0x88,0x08,0x28,0x10, + /* 0xAAFC [?] [938]*/ + 0x00,0x18,0x11,0x2E,0x43,0x0F,0x01,0x3E,0x0F,0x09,0x09,0x09,0x0A,0x04,0x08,0x70, + 0x00,0x60,0x44,0xB8,0x08,0xF0,0x00,0xF8,0xF0,0x10,0x10,0x10,0x90,0x70,0x0C,0x04, + /* 0xAAFD [?] [939]*/ + 0x00,0x00,0x04,0x3B,0x10,0x10,0x13,0x70,0x13,0x12,0x12,0x12,0x3F,0x42,0x02,0x00, + 0x00,0x90,0x90,0xFC,0x90,0x00,0xFC,0xA0,0xFC,0xA4,0xD4,0xAC,0x24,0x04,0x0C,0x00, + /* 0xAAFE [?] [940]*/ + 0x00,0x00,0x00,0x0F,0x08,0x28,0x29,0x08,0x18,0x6F,0x12,0x12,0x12,0x22,0x43,0x00, + 0x00,0x80,0x40,0xBC,0x40,0x4C,0xB0,0x20,0x26,0xD8,0x28,0x08,0x08,0x08,0xF8,0x00, + /* 0xABA1 [?] [941]*/ + 0x00,0x00,0x00,0x3C,0x44,0x44,0x45,0x44,0x7C,0x47,0x44,0x44,0x7C,0x00,0x00,0x00, + 0x00,0x20,0x20,0x26,0xF8,0x20,0xFC,0x20,0x20,0xFC,0x24,0x24,0x24,0x3C,0x20,0x20, + /* 0xABA2 [?] [942]*/ + 0x00,0x00,0x05,0x38,0x10,0x10,0x10,0x38,0x10,0x10,0x13,0x18,0x60,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x04,0xFC,0x10,0x16,0xF8,0x90,0x90,0x10,0x30,0x00, + /* 0xABA3 [?] [943]*/ + 0x00,0x00,0x01,0x7D,0x45,0x45,0x45,0x3D,0x45,0x45,0x45,0x44,0x7C,0x41,0x02,0x0C, + 0x00,0x00,0x0C,0xF8,0x28,0x48,0x48,0x48,0x48,0x50,0x60,0x62,0xA2,0x22,0x12,0x0C, + /* 0xABA4 [?] [944]*/ + 0x00,0x10,0x11,0x11,0x25,0x47,0x79,0x11,0x21,0x21,0x7D,0x01,0x06,0x7A,0x44,0x08, + 0x00,0x04,0x02,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x00,0x00, + /* 0xABA5 [?] [945]*/ + 0x00,0x01,0x00,0x3F,0x21,0x22,0x27,0x22,0x25,0x29,0x30,0x28,0x4F,0x48,0x40,0xBF, + 0x00,0x00,0x84,0xFE,0x10,0x24,0xF8,0x00,0x08,0x24,0x80,0x84,0xF8,0x88,0x86,0x78, + /* 0xABA6 [?] [946]*/ + 0x00,0x00,0x44,0x28,0x11,0x2A,0x4D,0x08,0x1B,0x2A,0x2A,0x4A,0x0A,0x0A,0x39,0x16, + 0x00,0x40,0x40,0xB0,0x4C,0x70,0xA0,0x48,0xB8,0x68,0x48,0x48,0x40,0xB0,0x0C,0x04, + /* 0xABA7 [?] [947]*/ + 0x00,0x02,0x02,0x3F,0x04,0x04,0x0F,0x70,0x1F,0x0C,0x08,0x0F,0x00,0x1F,0x00,0x00, + 0x00,0x60,0x24,0xD8,0x98,0xE0,0x82,0x7C,0xF0,0x10,0x24,0xDC,0x28,0xD8,0x78,0x10, + /* 0xABA8 [?] [948]*/ + 0x00,0x10,0x10,0x24,0x38,0x20,0x7C,0x10,0x10,0x7E,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x00,0x04,0xF8,0x80,0x80,0x80,0x82,0xFC,0x88,0x88,0x08,0x08,0x08,0x08,0x08,0x00, + /* 0xABA9 [?] [949]*/ + 0x00,0x08,0x0A,0x13,0x12,0x12,0x32,0x52,0x13,0x12,0x12,0x14,0x14,0x14,0x18,0x01, + 0x00,0x00,0x06,0xF8,0x20,0x24,0x78,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0x22,0xDC, + /* 0xABAA [?] [950]*/ + 0x00,0x00,0x21,0x21,0x3F,0x04,0x08,0x3E,0x08,0x0E,0x19,0x29,0x29,0x49,0x08,0x00, + 0x00,0x80,0x04,0x04,0xFC,0x20,0x20,0xFC,0x30,0x70,0x68,0xA8,0x24,0x20,0x20,0x20, + /* 0xABAB [?] [951]*/ + 0x00,0x00,0x3C,0x04,0x04,0x24,0x58,0x40,0x40,0x7E,0x04,0x04,0x04,0x04,0x19,0x00, + 0x00,0x00,0x86,0xF8,0x84,0xC4,0xA8,0x98,0x88,0x98,0xA4,0xC4,0xC0,0x80,0xFE,0x00, + /* 0xABAC [?] [952]*/ + 0x00,0x00,0x14,0x14,0x7F,0x14,0x14,0x7F,0x54,0x7F,0x14,0x14,0x24,0x24,0x44,0x80, + 0x00,0x00,0x3E,0x24,0xA4,0xA8,0xA8,0x28,0x24,0xE4,0xA4,0xA4,0xBC,0x20,0x20,0x00, + /* 0xABAD [?] [953]*/ + 0x00,0x00,0x46,0x34,0x09,0x19,0x6A,0x08,0x14,0x15,0x26,0x44,0x04,0x08,0x38,0x00, + 0x00,0x40,0x80,0xFC,0x88,0x90,0x50,0x20,0x58,0x8E,0x30,0x10,0x00,0x60,0x10,0x00, + /* 0xABAE [?] [954]*/ + 0x00,0x00,0x02,0x7C,0x28,0x28,0x67,0x1A,0x18,0x19,0x29,0x49,0x09,0x09,0x19,0x00, + 0x00,0x00,0x60,0x60,0x90,0x88,0x04,0xF8,0x00,0x08,0xF8,0x08,0x08,0x08,0xF8,0x00, + /* 0xABAF [?] [955]*/ + 0x00,0x00,0x10,0x10,0x14,0x14,0x08,0x51,0x50,0x10,0x10,0x1D,0x17,0x22,0x44,0x00, + 0x00,0x00,0x04,0xF8,0x40,0x40,0x42,0xFC,0x60,0xA0,0xA0,0x20,0x24,0x22,0x1E,0x00, + /* 0xABB0 [?] [956]*/ + 0x00,0x04,0x0C,0x09,0x08,0x10,0x10,0x33,0x50,0x10,0x17,0x10,0x10,0x10,0x10,0x00, + 0x00,0x00,0x1C,0xE0,0x40,0x40,0x4C,0xF0,0x40,0x46,0xF8,0x40,0x44,0x42,0x7E,0x00, + /* 0xABB1 [?] [957]*/ + 0x00,0x00,0x10,0x10,0x01,0x00,0x10,0x31,0x10,0x10,0x10,0x14,0x1A,0x1A,0x00,0x00, + 0x00,0x20,0x20,0x20,0xFC,0x20,0x20,0xFC,0x00,0x20,0xA4,0xC2,0x82,0x88,0xFC,0x00, + /* 0xABB2 [?] [958]*/ + 0x00,0x10,0x10,0x14,0x28,0x21,0x7E,0x10,0x10,0x7F,0x10,0x11,0x14,0x18,0x01,0x00, + 0x00,0x20,0x60,0x60,0x90,0x0C,0x0C,0x70,0x40,0xFC,0x40,0x44,0xC8,0xC0,0xFE,0x00, + /* 0xABB3 [?] [959]*/ + 0x00,0x00,0x08,0x0B,0x3C,0x1A,0x28,0x49,0x08,0x08,0x09,0x3E,0x1A,0x28,0x49,0x00, + 0x00,0x10,0x20,0x26,0x38,0x68,0xA4,0x20,0x20,0x20,0x22,0x3C,0x68,0xA4,0x22,0x00, + /* 0xABB4 [?] [960]*/ + 0x00,0x00,0x47,0x39,0x10,0x28,0x49,0x09,0x19,0x18,0x28,0xC8,0x09,0x08,0x38,0x00, + 0x00,0x00,0xFE,0x44,0x40,0x84,0xF8,0x20,0x20,0xF8,0x20,0x22,0xFC,0x20,0x20,0x00, + /* 0xABB5 [?] [961]*/ + 0x00,0x00,0x44,0x38,0x11,0x2A,0x48,0x08,0x19,0x1A,0x29,0xC9,0x09,0x09,0x38,0x00, + 0x00,0x00,0xC8,0x84,0x04,0x50,0x50,0x88,0x06,0x08,0xF8,0x08,0x08,0x08,0xF8,0x00, + /* 0xABB6 [?] [962]*/ + 0x00,0x10,0x11,0x11,0x55,0x7D,0x54,0x54,0x54,0x7C,0x50,0x14,0x1A,0x61,0x02,0x04, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xF8,0x40,0x44,0xFC,0x44,0x84,0x84,0x04,0x18,0x00, + /* 0xABB7 [?] [963]*/ + 0x00,0x00,0x01,0x0E,0x00,0x1F,0x00,0x03,0x1C,0x0B,0x08,0x0F,0x08,0x0F,0x08,0x37, + 0x00,0x30,0xC0,0x08,0x70,0x84,0x38,0xC0,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x12,0xEC, + /* 0xABB8 [?] [964]*/ + 0x00,0x00,0x10,0x20,0x26,0x3C,0x40,0x90,0x11,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x00,0x00,0x80,0x8C,0x90,0xA0,0xC0,0x80,0xFC,0xC0,0xA0,0x90,0x98,0xAE,0xC4,0x80, + /* 0xABB9 [?] [965]*/ + 0x00,0x00,0x01,0x39,0x13,0x11,0x11,0x7D,0x11,0x10,0x13,0x14,0x39,0x42,0x0C,0x00, + 0x00,0x48,0x48,0x4A,0xFC,0x48,0x38,0x00,0xFC,0x40,0xFE,0xD0,0x48,0x46,0x40,0x00, + /* 0xABBA [?] [966]*/ + 0x00,0x00,0x10,0x10,0x00,0x00,0x13,0x30,0x10,0x10,0x11,0x1E,0x1C,0x18,0x00,0x00, + 0x00,0x08,0xFC,0x40,0x40,0x40,0xFC,0x60,0xD0,0xD0,0x48,0x4C,0x46,0x40,0x40,0x00, + /* 0xABBB [?] [967]*/ + 0x00,0x10,0x10,0x10,0x2C,0x20,0x3D,0x51,0x16,0x7F,0x10,0x10,0x14,0x18,0x11,0x00, + 0x00,0x20,0x60,0x60,0x90,0x90,0x08,0x06,0x08,0xF0,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xABBC [?] [968]*/ + 0x00,0x20,0x10,0x11,0x00,0x00,0x73,0x10,0x10,0x10,0x13,0x14,0x18,0x10,0x01,0x00, + 0x00,0x10,0x70,0x9C,0x94,0x90,0xFE,0x94,0x94,0xF4,0x98,0x98,0xA8,0xC6,0x82,0x00, + /* 0xABBD [?] [969]*/ + 0x00,0x08,0x13,0x1D,0x11,0x6F,0x47,0x6B,0x5B,0x53,0x5B,0x67,0x43,0x42,0x7E,0x00, + 0x00,0x10,0x10,0x10,0x10,0x12,0x74,0x98,0x10,0x10,0x10,0x10,0x72,0x92,0x1E,0x00, + /* 0xABBE [?] [970]*/ + 0x00,0x00,0x01,0x79,0x53,0x51,0x51,0x49,0x49,0x49,0x7F,0x41,0x02,0x02,0x04,0x08, + 0x00,0x00,0x02,0x1E,0x94,0x14,0x58,0x98,0x14,0x12,0x92,0x12,0x1E,0x10,0x10,0x00, + /* 0xABBF [?] [971]*/ + 0x00,0x00,0x10,0x11,0x01,0x05,0x69,0x29,0x09,0x11,0x11,0x30,0x20,0x20,0x20,0x00, + 0x00,0x00,0x04,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xABC0 [?] [972]*/ + 0x00,0x10,0x10,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1F,0x61,0x01,0x03,0x04,0x00, + 0x00,0x00,0x38,0xC0,0x00,0x00,0xF8,0x10,0x10,0x10,0xFE,0x00,0x88,0x04,0x04,0x00, + /* 0xABC1 [?] [973]*/ + 0x00,0x10,0x12,0x22,0x3A,0x42,0x4E,0x32,0x14,0x7C,0x13,0x12,0x16,0x1A,0x07,0x00, + 0x00,0x80,0x90,0x92,0xAC,0xA0,0xD8,0x84,0x00,0x00,0xF8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xABC2 [?] [974]*/ + 0x00,0x00,0x18,0x08,0x01,0x45,0x2A,0x0D,0x09,0x10,0x10,0x30,0x10,0x10,0x13,0x0C, + 0x00,0x00,0x90,0x88,0x04,0x06,0x10,0x18,0x10,0x90,0xA0,0x60,0x60,0x90,0x0E,0x00, + /* 0xABC3 [?] [975]*/ + 0x00,0x00,0x31,0x20,0x5F,0x42,0x7A,0xA3,0x22,0x79,0x20,0x23,0x29,0x12,0x04,0x00, + 0x00,0x00,0xFC,0xA0,0xFC,0xA4,0xA4,0x5C,0x48,0x50,0x62,0xDC,0x50,0x4C,0x46,0x40, + /* 0xABC4 [?] [976]*/ + 0x00,0x00,0x21,0x10,0x16,0x0B,0x0B,0x0A,0x13,0x12,0x30,0x11,0x10,0x30,0x01,0x06, + 0x00,0x00,0xFC,0x30,0x24,0xFC,0xFC,0x24,0xFC,0x44,0x44,0xBC,0x84,0x84,0x28,0x18, + /* 0xABC5 [?] [977]*/ + 0x00,0x04,0x09,0x1E,0x09,0x1E,0x7F,0x41,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x23,0x00, + 0x00,0x00,0x0C,0x08,0x10,0x20,0x86,0x08,0x10,0x20,0x42,0x04,0x08,0x10,0x60,0x80, + /* 0xABC6 [?] [978]*/ + 0x00,0x00,0x1F,0x00,0x01,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x43,0x40,0x3F,0x00, + 0x00,0x10,0xF8,0x60,0x80,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xABC7 [?] [979]*/ + 0x00,0x00,0x22,0x3E,0x22,0x22,0x22,0x2A,0x2A,0x22,0x22,0x23,0x43,0x82,0x00,0x00, + 0x00,0x00,0x7E,0x44,0x48,0x50,0x50,0x4C,0x42,0x42,0x42,0xCA,0x44,0x40,0x40,0x00, + /* 0xABC8 [?] [980]*/ + 0x00,0x00,0x33,0x10,0x00,0x00,0x70,0x10,0x11,0x10,0x10,0x14,0x18,0x10,0x00,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x22,0xFC,0x20,0x20,0x20,0x20,0x20,0xE0,0x00, + /* 0xABC9 [?] [981]*/ + 0x00,0x00,0x00,0x7E,0x10,0x10,0x10,0x7E,0x10,0x10,0x10,0x12,0x3C,0x40,0x00,0x00, + 0x00,0x04,0x04,0x44,0x44,0x44,0x44,0x44,0x44,0x5C,0x64,0x04,0x04,0x04,0x04,0x00, + /* 0xABCA [?] [982]*/ + 0x00,0x08,0x08,0x08,0x7F,0x08,0x09,0x7F,0x49,0x49,0x49,0x49,0x09,0x08,0x08,0x08, + 0x00,0x00,0x44,0x7C,0x48,0x50,0x60,0x58,0x44,0x42,0x42,0x42,0x4C,0x40,0x40,0x40, + /* 0xABCB [?] [983]*/ + 0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x0B,0x36,0x22,0x1C,0x0C,0x16,0x22,0x41,0x00, + 0x00,0x00,0x46,0x7C,0xC8,0x50,0x50,0x48,0x46,0x42,0x42,0x42,0x46,0x40,0x40,0x00, + /* 0xABCC [?] [984]*/ + 0x00,0x08,0x08,0x10,0x10,0x10,0x31,0x51,0x91,0x12,0x12,0x14,0x14,0x18,0x10,0x00, + 0x00,0x00,0x40,0x40,0x26,0xE8,0xD0,0x60,0x50,0x50,0x48,0x44,0x43,0x40,0xC0,0x00, + /* 0xABCD [?] [985]*/ + 0x00,0x01,0x00,0x3F,0x20,0x21,0x2F,0x21,0x21,0x27,0x59,0x41,0x41,0x81,0x80,0x00, + 0x00,0x00,0x84,0x78,0x10,0xE0,0x00,0x00,0x0C,0xF0,0x00,0x08,0x08,0x08,0xF8,0x00, + /* 0xABCE [?] [986]*/ + 0x00,0x00,0x10,0x11,0x00,0x48,0x28,0x10,0x10,0x10,0x10,0x21,0x22,0x22,0x20,0x00, + 0x00,0x00,0x02,0xFC,0x80,0x80,0xFC,0x84,0x84,0x88,0x88,0x08,0x08,0x38,0x10,0x00, + /* 0xABCF [?] [987]*/ + 0x00,0x10,0x10,0x10,0x10,0x14,0x52,0x51,0x50,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x04,0x78,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00, + /* 0xABD0 [?] [988]*/ + 0x00,0x00,0x10,0x18,0x01,0x01,0x13,0x30,0x10,0x10,0x10,0x14,0x14,0x18,0x01,0x00, + 0x00,0x00,0x20,0x20,0x04,0xFE,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0xFC,0x00, + /* 0xABD1 [?] [989]*/ + 0x00,0x00,0x7C,0x4B,0x4A,0x52,0x52,0x4B,0x4A,0x46,0x4E,0x7A,0x42,0x41,0x00,0x00, + 0x00,0x08,0x7C,0xA0,0x20,0x20,0x24,0xF8,0x20,0x20,0x20,0x50,0x92,0x0A,0x06,0x00, + /* 0xABD2 [?] [990]*/ + 0x00,0x00,0x08,0x10,0x10,0x7E,0x13,0x12,0x24,0x24,0x24,0x28,0x1C,0x12,0x20,0x40, + 0x00,0x00,0x48,0x44,0x44,0x44,0xF8,0x40,0x40,0x20,0x20,0x20,0x12,0x0A,0x06,0x00, + /* 0xABD3 [?] [991]*/ + 0x00,0x00,0x02,0x3C,0x10,0x10,0x10,0x1C,0x11,0x10,0x10,0x12,0x1C,0x60,0x00,0x00, + 0x00,0x00,0xFE,0x08,0x10,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x60,0x00, + /* 0xABD4 [?] [992]*/ + 0x00,0x00,0x11,0x12,0x12,0x12,0x16,0x3A,0x12,0x12,0x12,0x12,0x1A,0x62,0x01,0x00, + 0x00,0x00,0xFE,0x00,0x04,0x88,0x48,0x30,0x10,0x28,0x44,0x84,0x00,0x02,0xFC,0x00, + /* 0xABD5 [?] [993]*/ + 0x00,0x00,0x10,0x20,0x20,0x21,0x2E,0x75,0x21,0x21,0x20,0x21,0x19,0xE1,0x00,0x00, + 0x00,0x40,0x40,0xA0,0x90,0x08,0x06,0x80,0x18,0x20,0xC0,0x00,0x08,0x04,0xFC,0x00, + /* 0xABD6 [?] [994]*/ + 0x00,0x10,0x09,0x20,0x20,0x2F,0x2B,0x28,0x29,0x2A,0x2A,0x2D,0x2C,0x33,0x20,0x00, + 0x00,0x00,0xFE,0x84,0x94,0xE4,0xF4,0xB4,0xE4,0xA4,0x14,0xF4,0x14,0xF4,0x0C,0x04, + /* 0xABD7 [?] [995]*/ + 0x00,0x02,0x04,0x3F,0x04,0x0D,0x09,0x0F,0x11,0x21,0x01,0x3F,0x01,0x01,0x01,0x00, + 0x00,0x20,0x44,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0x04,0xF8,0x00,0x00,0x00,0x00, + /* 0xABD8 [?] [996]*/ + 0x00,0x02,0x04,0x3F,0x10,0x08,0x09,0x3F,0x01,0x01,0x02,0x02,0x04,0x08,0x30,0x00, + 0x00,0x20,0x44,0xF8,0x80,0x80,0x00,0xFC,0x04,0x08,0x88,0x48,0x48,0x08,0x70,0x30, + /* 0xABD9 [?] [997]*/ + 0x00,0x10,0x10,0x11,0x6C,0x20,0x28,0x50,0x3C,0x10,0x14,0x78,0x09,0x09,0x0E,0x00, + 0x00,0x00,0x04,0xF8,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x1E,0x00, + /* 0xABDA [?] [998]*/ + 0x00,0x00,0x00,0x49,0x7A,0x48,0x48,0x49,0x49,0x48,0x78,0x40,0x40,0x01,0x0E,0x00, + 0x00,0x00,0x80,0x98,0x06,0x00,0x18,0x10,0x10,0xA0,0xA0,0x40,0xA0,0x18,0x04,0x00, + /* 0xABDB [?] [999]*/ + 0x00,0x00,0x11,0x21,0x21,0x25,0xA5,0xA5,0xA5,0xA5,0xA5,0xAE,0x76,0x02,0x05,0x00, + 0x00,0x00,0x02,0xFC,0x20,0x20,0x22,0x3C,0x24,0x24,0x24,0x24,0x44,0x84,0x0C,0x00, + /* 0xABDC [?] [1000]*/ + 0x00,0x18,0x10,0x1F,0x21,0x25,0x7D,0x25,0x25,0x39,0x21,0x23,0x20,0x20,0x1F,0x00, + 0x00,0x00,0x22,0xBE,0x24,0x24,0x28,0x28,0x24,0x22,0x22,0x22,0xAE,0x64,0xA0,0x20, + /* 0xABDD [?] [1001]*/ + 0x00,0x00,0x13,0x08,0x00,0x04,0x28,0x19,0x08,0x10,0x10,0x70,0x11,0x12,0x14,0x08, + 0x00,0x00,0xFC,0x40,0x40,0x40,0x44,0xF8,0x60,0xA0,0xA0,0xA0,0x24,0x22,0x1C,0x00, + /* 0xABDE [?] [1002]*/ + 0x00,0x00,0x10,0x10,0x03,0x00,0x2F,0x28,0x08,0x17,0x10,0x70,0x20,0x20,0x20,0x00, + 0x00,0x40,0x40,0x44,0xF8,0x40,0xF8,0x40,0x44,0xFC,0x44,0x44,0x44,0x48,0x40,0x40, + /* 0xABDF [?] [1003]*/ + 0x00,0x00,0x10,0x08,0x01,0x40,0x24,0x0B,0x08,0x10,0x10,0x30,0x10,0x20,0x10,0x00, + 0x00,0x20,0x20,0x40,0xF8,0x40,0x44,0xB8,0x80,0x88,0x78,0x10,0xA0,0x60,0x10,0x00, + /* 0xABE0 [?] [1004]*/ + 0x00,0x00,0x11,0x11,0x01,0x41,0x21,0x29,0x11,0x11,0x11,0x30,0x20,0x21,0x26,0x00, + 0x00,0x00,0xFC,0x08,0x28,0x48,0x48,0x48,0x48,0x48,0x40,0x60,0x98,0x06,0x02,0x00, + /* 0xABE1 [?] [1005]*/ + 0x00,0x00,0x20,0x10,0x10,0x00,0x11,0x70,0x17,0x10,0x10,0x14,0x18,0x11,0x16,0x00, + 0x00,0x40,0x90,0x88,0x88,0x70,0x80,0x4C,0xF0,0x48,0x50,0x20,0x60,0x94,0x0C,0x00, + /* 0xABE2 [?] [1006]*/ + 0x00,0x08,0x08,0x29,0x29,0x29,0x29,0x1F,0x0A,0x29,0x49,0x49,0x49,0x37,0x00,0x00, + 0x00,0x00,0x00,0x7E,0x44,0x48,0x48,0x50,0x48,0x44,0x44,0x44,0x5C,0x48,0x40,0x00, + /* 0xABE3 [?] [1007]*/ + 0x00,0x10,0x10,0x10,0x17,0x2C,0x25,0x24,0x24,0x4B,0x48,0x30,0x1C,0x20,0x40,0x80, + 0x00,0x20,0x40,0x46,0xF8,0x40,0xFC,0x40,0x40,0xFE,0x42,0x44,0x44,0x44,0x40,0x00, + /* 0xABE4 [?] [1008]*/ + 0x00,0x00,0x08,0x12,0x12,0x27,0x38,0x12,0x12,0x12,0x3F,0x12,0x12,0x22,0x42,0x00, + 0x00,0x00,0x22,0x3E,0x24,0x28,0x28,0x28,0x24,0xA4,0x24,0x22,0x3C,0x20,0x20,0x20, + /* 0xABE5 [?] [1009]*/ + 0x00,0x00,0x7C,0x04,0x27,0x25,0x24,0x48,0x7E,0x02,0x02,0xFC,0x04,0x04,0x1F,0x00, + 0x00,0x40,0x20,0x22,0xDC,0x08,0x88,0x88,0x90,0x50,0x60,0x20,0x50,0x88,0x06,0x00, + /* 0xABE6 [?] [1010]*/ + 0x00,0x00,0x10,0x10,0x21,0x26,0x4A,0x70,0x10,0x20,0x78,0x00,0x05,0x39,0x02,0x04, + 0x00,0x40,0x40,0x40,0xFC,0x48,0x40,0x60,0x60,0xA0,0xA0,0xA0,0x20,0x22,0x1E,0x00, + /* 0xABE7 [?] [1011]*/ + 0x00,0x00,0x7E,0x04,0x24,0x24,0x24,0x24,0x3E,0x03,0x06,0x7A,0x04,0x04,0x09,0x02, + 0x00,0x40,0x40,0x40,0xFC,0x48,0x48,0x48,0x4A,0xF4,0x60,0x50,0x88,0x8C,0x06,0x00, + /* 0xABE8 [?] [1012]*/ + 0x00,0x00,0x04,0x39,0x11,0x11,0x15,0x39,0x11,0x11,0x10,0x14,0x38,0x40,0x03,0x00, + 0x00,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x20,0x58,0x86,0x02,0x00, + /* 0xABE9 [?] [1013]*/ + 0x00,0x01,0x01,0x7D,0x11,0x11,0x11,0x15,0x39,0x11,0x11,0x12,0x1E,0x64,0x09,0x02, + 0x00,0x10,0x10,0x10,0x10,0x10,0x10,0xB0,0x70,0x28,0x28,0x28,0x44,0x84,0x02,0x00, + /* 0xABEA [?] [1014]*/ + 0x00,0x00,0x12,0x12,0x12,0x1F,0x12,0x12,0x7F,0x12,0x11,0x21,0x20,0x40,0x00,0x00, + 0x00,0x00,0x22,0x3E,0xA4,0x24,0x28,0x28,0xE4,0x24,0x22,0xA2,0xBE,0xA0,0x20,0x20, + /* 0xABEB [?] [1015]*/ + 0x00,0x04,0x04,0x7F,0x04,0x00,0x1F,0x10,0x10,0x10,0x0F,0x00,0x06,0x08,0x30,0x40, + 0x00,0x20,0x24,0xF8,0x20,0x10,0xF0,0x10,0x10,0x10,0xF0,0x40,0x30,0x0C,0x04,0x00, + /* 0xABEC [?] [1016]*/ + 0x00,0x10,0x10,0x11,0x7F,0x21,0x29,0x51,0x3F,0x11,0x17,0x79,0x09,0x09,0x09,0x00, + 0x00,0x00,0x1C,0xE0,0x20,0x20,0x20,0xFC,0x10,0x10,0x10,0x10,0x2A,0x46,0x82,0x00, + /* 0xABED [?] [1017]*/ + 0x00,0x00,0x10,0x10,0x22,0x3C,0x40,0x7D,0x90,0x12,0x7C,0x10,0x12,0x14,0x18,0x00, + 0x00,0x40,0x40,0x48,0x48,0x44,0x58,0xE0,0x40,0x20,0x20,0x20,0x10,0x1A,0x0E,0x02, + /* 0xABEE [?] [1018]*/ + 0x00,0x00,0x11,0x10,0x10,0x54,0x54,0x55,0x55,0x55,0x55,0x5C,0x64,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x14,0xE4,0x04,0xE4,0x24,0x24,0x24,0xC4,0x04,0x04,0x0C,0x08, + /* 0xABEF [?] [1019]*/ + 0x00,0x04,0x18,0x18,0x1F,0x28,0x28,0x09,0x16,0x14,0x14,0x14,0x15,0x22,0x20,0x00, + 0x00,0x00,0x04,0x7C,0x44,0x48,0x48,0x50,0x48,0x44,0x44,0xC4,0x5C,0x40,0x40,0x00, + /* 0xABF0 [?] [1020]*/ + 0x00,0x08,0x08,0x08,0x13,0x10,0x30,0x52,0x93,0x14,0x14,0x19,0x11,0x12,0x12,0x14, + 0x00,0x80,0x60,0x40,0xFE,0x90,0x90,0x90,0x94,0x96,0x92,0x12,0x10,0x10,0x30,0x00, + /* 0xABF1 [?] [1021]*/ + 0x00,0x08,0x0B,0x0A,0x10,0x10,0x31,0x51,0x91,0x10,0x10,0x10,0x11,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x40,0x40,0x84,0xF8,0x20,0x20,0xF8,0x20,0x20,0xFC,0x20,0x20,0x00, + /* 0xABF2 [?] [1022]*/ + 0x00,0x08,0x09,0x0B,0x14,0x14,0x32,0x51,0x90,0x10,0x12,0x12,0x12,0x12,0x13,0x10, + 0x00,0x00,0x24,0xC8,0x90,0x88,0x44,0x24,0x00,0x20,0x44,0x44,0x44,0x44,0xFC,0x00, + /* 0xABF3 [?] [1023]*/ + 0x00,0x00,0x04,0x0C,0x10,0x20,0x40,0x1F,0x08,0x0F,0x08,0x0F,0x08,0x77,0x00,0x00, + 0x00,0x40,0x40,0x20,0x18,0x0E,0x08,0xF0,0x20,0xE0,0x20,0xE0,0x24,0xF8,0x20,0x00, + /* 0xABF4 [?] [1024]*/ + 0x00,0x00,0x7E,0x42,0x46,0x5A,0x5A,0x4A,0x5B,0x56,0x66,0x45,0x80,0x80,0x00,0x00, + 0x00,0x20,0x20,0xFC,0x20,0x24,0x78,0x26,0xFA,0x24,0x24,0x3E,0xA2,0x62,0x1E,0x00, + /* 0xABF5 [?] [1025]*/ + 0x00,0x00,0x21,0x11,0x01,0x01,0x01,0x71,0x11,0x11,0x11,0x13,0x15,0x19,0x11,0x00, + 0x00,0x00,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x58,0x20,0x10,0x68,0x86,0x00, + /* 0xABF6 [?] [1026]*/ + 0x00,0x00,0x7F,0x01,0x3F,0x01,0x01,0x3F,0x01,0x02,0x3F,0x12,0x02,0x02,0x06,0x00, + 0x00,0x00,0x26,0x5C,0x44,0x48,0x50,0x48,0x48,0xC4,0x44,0x44,0x4C,0x40,0x40,0x00, + /* 0xABF7 [?] [1027]*/ + 0x00,0x00,0x3C,0x4A,0x4A,0x51,0x50,0x49,0x44,0x44,0x45,0x49,0x41,0x41,0x41,0x00, + 0x00,0x20,0x44,0x44,0x44,0xFC,0x00,0xFC,0x08,0x08,0xF0,0x00,0x00,0x04,0x86,0x78, + /* 0xABF8 [?] [1028]*/ + 0x00,0x00,0x3C,0x4B,0x49,0x50,0x50,0x48,0x45,0x47,0x45,0x79,0x41,0x42,0x46,0x08, + 0x00,0x80,0x40,0xFE,0x10,0xA0,0x60,0xE0,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xABF9 [?] [1029]*/ + 0x00,0x10,0x10,0x11,0x10,0x2C,0x24,0x24,0x45,0x4A,0x2C,0x18,0x14,0x20,0x43,0x00, + 0x00,0x00,0x04,0xF8,0x40,0x40,0xC0,0xD0,0x48,0x44,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xABFA [?] [1030]*/ + 0x00,0x18,0x10,0x10,0x10,0x2E,0x24,0x24,0x25,0x4A,0x28,0x18,0x14,0x20,0x40,0x00, + 0x00,0x10,0x20,0x20,0x5C,0x50,0x50,0xFC,0x94,0x94,0x94,0x94,0x94,0x1C,0x10,0x10, + /* 0xABFB [?] [1031]*/ + 0x00,0x10,0x10,0x10,0x10,0x2D,0x25,0x25,0x45,0x49,0x29,0x19,0x15,0x21,0x40,0x03, + 0x00,0x20,0x2C,0x24,0x22,0xFC,0x20,0x24,0x24,0x28,0x28,0x52,0x9A,0x2C,0xC6,0x00, + /* 0xABFC [?] [1032]*/ + 0x00,0x10,0x10,0x11,0x25,0x3F,0x24,0x24,0x28,0x48,0x48,0x30,0x1C,0x20,0x40,0x80, + 0x00,0x40,0x20,0x20,0xFE,0x04,0x00,0x06,0xF8,0x20,0x20,0x20,0x20,0x20,0xE0,0x40, + /* 0xABFD [?] [1033]*/ + 0x00,0x00,0x7C,0x0B,0x28,0x28,0x28,0x49,0x48,0x34,0x04,0x7C,0x04,0x04,0x38,0x01, + 0x00,0x00,0x04,0xF8,0x40,0x40,0xC0,0x50,0x48,0x44,0x40,0x40,0x40,0x40,0x06,0xF8, + /* 0xABFE [?] [1034]*/ + 0x00,0x00,0x1C,0x04,0x25,0x25,0x25,0x25,0x3F,0x03,0x03,0x7B,0x03,0x05,0x0D,0x01, + 0x00,0x20,0x20,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFE,0x04,0x04,0x04,0x1C,0x00, + /* 0xACA1 [?] [1035]*/ + 0x00,0x00,0x1D,0x05,0x25,0x25,0x25,0x25,0x3F,0x03,0x03,0x7B,0x03,0x05,0x0D,0x00, + 0x00,0x00,0xFE,0x02,0x02,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x02,0x02,0x02,0x0E,0x00, + /* 0xACA2 [?] [1036]*/ + 0x00,0x10,0x11,0x12,0x26,0x46,0x7A,0x12,0x22,0x2E,0x72,0x02,0x0E,0x72,0x02,0x00, + 0x00,0x00,0x02,0xFC,0x04,0x4C,0x74,0x54,0x54,0x54,0x74,0x44,0x04,0x04,0x0C,0x04, + /* 0xACA3 [?] [1037]*/ + 0x00,0x0C,0x09,0x3E,0x09,0x1E,0x7F,0x08,0x0B,0x02,0x7F,0x04,0x04,0x03,0x03,0x3C, + 0x00,0x00,0x00,0x3E,0x24,0x24,0x44,0x88,0x00,0x00,0xFC,0x20,0x40,0xE0,0x18,0x00, + /* 0xACA4 [?] [1038]*/ + 0x00,0x00,0x04,0x38,0x10,0x11,0x10,0x1C,0x31,0x11,0x11,0x12,0x1C,0x68,0x10,0x07, + 0x00,0x00,0x48,0x88,0x86,0xF8,0x80,0x84,0xFC,0x48,0x48,0x30,0x20,0x58,0x8E,0x00, + /* 0xACA5 [?] [1039]*/ + 0x00,0x00,0x04,0x38,0x10,0x11,0x11,0x1D,0x31,0x11,0x11,0x11,0x1E,0x62,0x04,0x08, + 0x00,0x20,0x40,0x46,0x78,0x44,0xBC,0x04,0x04,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xACA6 [?] [1040]*/ + 0x00,0x00,0x04,0x38,0x11,0x13,0x10,0x1C,0x30,0x10,0x13,0x11,0x19,0x62,0x04,0x08, + 0x00,0x00,0x40,0x80,0x0C,0xF4,0x00,0x90,0x90,0x92,0xFC,0x10,0x10,0x10,0x10,0x10, + /* 0xACA7 [?] [1041]*/ + 0x00,0x10,0x11,0x11,0x12,0x7F,0x14,0x18,0x1B,0x71,0x51,0x11,0x11,0x12,0x34,0x28, + 0x00,0x20,0x40,0x40,0x48,0xF0,0x40,0x44,0xB8,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xACA8 [?] [1042]*/ + 0x00,0x00,0x10,0x11,0x11,0x16,0x38,0x10,0x13,0x11,0x11,0x1D,0x63,0x00,0x00,0x00, + 0x00,0x80,0x88,0xF8,0x50,0x30,0x70,0xAE,0x30,0xFC,0x20,0x24,0xFE,0x20,0x20,0x20, + /* 0xACA9 [?] [1043]*/ + 0x00,0x04,0x04,0x7F,0x04,0x08,0x28,0x20,0x27,0x24,0x24,0x27,0x20,0x20,0x20,0x00, + 0x00,0x20,0x44,0xFE,0x20,0x04,0xF8,0x08,0xC8,0x48,0x48,0x88,0x08,0x08,0x18,0x08, + /* 0xACAA [?] [1044]*/ + 0x00,0x04,0x04,0x7F,0x04,0x00,0x3F,0x09,0x09,0x1F,0x09,0x1F,0x09,0x11,0x23,0x02, + 0x00,0x20,0x44,0xFE,0x20,0x00,0xFE,0x44,0x48,0x50,0x4C,0x44,0x5C,0x40,0x40,0x00, + /* 0xACAB [?] [1045]*/ + 0x00,0x08,0x10,0x10,0x12,0x3D,0x10,0x1C,0x35,0x30,0x50,0x91,0x11,0x12,0x13,0x00, + 0x00,0x20,0x40,0x40,0x44,0xF8,0x40,0x40,0xFE,0x40,0x80,0x10,0x08,0x04,0xF8,0x00, + /* 0xACAC [?] [1046]*/ + 0x00,0x00,0x00,0x3F,0x20,0x27,0x20,0x20,0x3F,0x2A,0x2B,0x29,0x29,0x4A,0x44,0x00, + 0x00,0x00,0xDE,0x22,0x24,0xE4,0x28,0x68,0xA4,0x62,0xA2,0x22,0x2E,0xA4,0x60,0x20, + /* 0xACAD [?] [1047]*/ + 0x00,0x00,0x00,0x3D,0x11,0x11,0x11,0x2D,0x25,0x65,0x25,0x25,0x25,0x39,0x01,0x00, + 0x00,0x00,0x06,0xF8,0x04,0x44,0x28,0x18,0x08,0x18,0x24,0x44,0x40,0x00,0xFE,0x00, + /* 0xACAE [?] [1048]*/ + 0x00,0x00,0x08,0x08,0x7F,0x2B,0x1A,0x1C,0x7F,0x0A,0x19,0x18,0x28,0x48,0x89,0x00, + 0x00,0x00,0x20,0x20,0x20,0x7E,0x22,0xA2,0xE2,0x22,0x24,0x44,0x44,0x84,0x1C,0x00, + /* 0xACAF [?] [1049]*/ + 0x00,0x00,0x3D,0x45,0x45,0x45,0x7D,0x45,0x45,0x7D,0x44,0x44,0x7C,0x01,0x02,0x0C, + 0x00,0x00,0xFC,0x04,0x24,0x44,0x44,0x44,0x44,0x70,0x60,0x60,0xA4,0x24,0x1E,0x00, + /* 0xACB0 [?] [1050]*/ + 0x00,0x00,0x11,0x11,0x3F,0x00,0x00,0x1F,0x10,0x1E,0x12,0x22,0x22,0x24,0x41,0x00, + 0x00,0x00,0x08,0x08,0xF8,0x90,0xAC,0x50,0x48,0x48,0x50,0x50,0x20,0x54,0x8E,0x00, + /* 0xACB1 [?] [1051]*/ + 0x00,0x00,0x10,0x10,0x51,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x4D,0x71,0x01,0x00, + 0x00,0x00,0x50,0x50,0x50,0xFC,0x54,0x54,0x54,0xFC,0x54,0x54,0x54,0x54,0xA8,0x00, + /* 0xACB2 [?] [1052]*/ + 0x00,0x10,0x10,0x24,0x38,0x21,0x7C,0x10,0x10,0x7F,0x10,0x10,0x14,0x19,0x12,0x04, + 0x00,0x20,0x20,0x20,0x24,0xF8,0x20,0x20,0x26,0xF8,0x50,0x50,0x88,0x0C,0x06,0x00, + /* 0xACB3 [?] [1053]*/ + 0x00,0x10,0x10,0x24,0x3B,0x20,0x7C,0x10,0x10,0x7F,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x20,0x20,0x26,0xF8,0x20,0xFC,0x20,0x22,0xFE,0x22,0x22,0x22,0x24,0x20,0x00, + /* 0xACB4 [?] [1054]*/ + 0x00,0x10,0x10,0x24,0x38,0x20,0x7C,0x10,0x11,0x7E,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x80,0x84,0x88,0x90,0xE0,0x80,0x86,0xF8,0xA0,0xA0,0x90,0x88,0xF6,0x80,0x00, + /* 0xACB5 [?] [1055]*/ + 0x00,0x00,0x02,0x3C,0x10,0x10,0x20,0x3E,0x64,0x64,0xA4,0x24,0x24,0x18,0x00,0x00, + 0x00,0x20,0x20,0x24,0xF8,0x20,0x24,0xF8,0x20,0x20,0x26,0xF8,0x20,0x20,0x20,0x20, + /* 0xACB6 [?] [1056]*/ + 0x00,0x00,0x10,0x24,0x38,0x41,0x46,0x38,0x10,0x14,0x38,0x10,0x14,0x18,0x10,0x00, + 0x00,0x60,0x40,0x60,0x90,0x08,0x06,0x80,0x98,0xA0,0xC0,0x80,0x88,0x88,0xF8,0x00, + /* 0xACB7 [?] [1057]*/ + 0x00,0x00,0x10,0x10,0x28,0x49,0x11,0x11,0x71,0x12,0x12,0x12,0x12,0x14,0x14,0x09, + 0x00,0x40,0x58,0x48,0x44,0xF8,0x48,0x48,0x48,0xA8,0x30,0x30,0x30,0x4C,0x84,0x00, + /* 0xACB8 [?] [1058]*/ + 0x00,0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x3C,0x24,0x25,0x46,0x46,0x48,0x00, + 0x00,0x00,0x0C,0xF0,0x00,0x00,0x06,0xF8,0x20,0xA8,0xAC,0x24,0x24,0x24,0x60,0x00, + /* 0xACB9 [?] [1059]*/ + 0x00,0x00,0x7E,0x42,0x46,0x5A,0x5A,0x49,0x5B,0x56,0x67,0x45,0x80,0x80,0x00,0x00, + 0x00,0x00,0x24,0x18,0x48,0x4C,0x52,0x62,0x44,0xC4,0x6C,0x12,0x82,0x62,0x1E,0x00, + /* 0xACBA [?] [1060]*/ + 0x00,0x00,0x11,0x11,0x13,0x15,0x49,0x51,0x11,0x10,0x19,0x15,0x13,0x22,0x42,0x00, + 0x00,0x00,0x02,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0x26,0x00, + /* 0xACBB [?] [1061]*/ + 0x00,0x00,0x10,0x10,0x0E,0x0B,0x6A,0x2A,0x13,0x12,0x12,0x22,0x22,0x24,0x20,0x03, + 0x00,0x20,0x58,0x40,0x42,0xBC,0x20,0x24,0xA4,0xA8,0x28,0x10,0x38,0x6E,0x86,0x00, + /* 0xACBC [?] [1062]*/ + 0x00,0x00,0x40,0x24,0x24,0x00,0x20,0x3E,0x24,0x24,0x24,0x24,0x3C,0x36,0x29,0x00, + 0x00,0x20,0x20,0x24,0x58,0x50,0xA0,0xA4,0x78,0x20,0xFE,0x20,0x20,0x20,0xFE,0x00, + /* 0xACBD [?] [1063]*/ + 0x00,0x10,0x10,0x10,0x11,0x2F,0x24,0x24,0x24,0x48,0x48,0x39,0x14,0x20,0x40,0x00, + 0x00,0x50,0x90,0x96,0x9C,0x90,0xB0,0xD2,0x92,0x2C,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xACBE [?] [1064]*/ + 0x00,0x00,0x19,0x11,0x23,0x25,0x59,0x29,0x11,0x21,0x39,0x01,0x01,0x7D,0x01,0x00, + 0x00,0x00,0x02,0xFC,0x24,0x24,0xFC,0x24,0x24,0x34,0x4C,0x4C,0x84,0x04,0xF8,0x00, + /* 0xACBF [?] [1065]*/ + 0x00,0x00,0x04,0x3C,0x24,0x29,0x28,0x28,0x4F,0x34,0x04,0x7C,0x04,0x09,0x1E,0x00, + 0x00,0x20,0xA0,0xA0,0xFC,0x20,0x20,0x22,0xDC,0x50,0x90,0x90,0x90,0x12,0x1E,0x00, + /* 0xACC0 [?] [1066]*/ + 0x00,0x00,0x13,0x10,0x21,0x4D,0x4A,0x71,0x20,0x20,0x73,0x01,0x09,0x72,0x04,0x00, + 0x00,0x00,0xBC,0x90,0x10,0x10,0x14,0xF8,0x90,0x90,0x10,0x3C,0x80,0x60,0x1C,0x00, + /* 0xACC1 [?] [1067]*/ + 0x00,0x10,0x10,0x21,0x21,0x4A,0x72,0x13,0x20,0x41,0x75,0x03,0x11,0x62,0x04,0x00, + 0x00,0x00,0x8E,0x70,0x10,0x10,0x34,0xD8,0xD0,0x50,0x50,0x7E,0x00,0xC0,0x3C,0x00, + /* 0xACC2 [?] [1068]*/ + 0x00,0x00,0x00,0x7C,0x12,0x13,0x12,0x7F,0x12,0x12,0x12,0x1E,0x65,0x04,0x08,0x10, + 0x00,0x00,0x24,0x24,0x22,0xFC,0x20,0xE6,0x54,0x54,0x58,0x98,0x98,0x2A,0x46,0x02, + /* 0xACC3 [?] [1069]*/ + 0x00,0x00,0x00,0x7C,0x11,0x11,0x11,0x15,0x39,0x11,0x10,0x10,0x1C,0x61,0x42,0x00, + 0x00,0x20,0x40,0x44,0xFC,0x44,0xFC,0x44,0x44,0xBC,0x24,0x28,0x30,0xD2,0x0E,0x02, + /* 0xACC4 [?] [1070]*/ + 0x00,0x00,0x09,0x1E,0x3F,0x09,0x36,0x21,0x3E,0x2A,0x2A,0x2A,0x0E,0x11,0x21,0x00, + 0x00,0x10,0x10,0x10,0x10,0xFE,0x12,0x12,0x22,0x22,0x22,0x24,0x44,0x44,0x8C,0x08, + /* 0xACC5 [?] [1071]*/ + 0x00,0x00,0x04,0x38,0x10,0x11,0x15,0x7A,0x10,0x11,0x10,0x1C,0x61,0x06,0x08,0x00, + 0x00,0x00,0xF8,0x90,0x90,0x10,0x0E,0x20,0x44,0xF8,0xE0,0xD0,0x4C,0x46,0x00,0x00, + /* 0xACC6 [?] [1072]*/ + 0x00,0x10,0x10,0x13,0x10,0x14,0x3B,0x12,0x10,0x11,0x14,0x68,0x40,0x01,0x02,0x0C, + 0x00,0x90,0x90,0xFE,0x90,0xA0,0xFE,0x48,0x40,0xFC,0x48,0x88,0x88,0x08,0x30,0x00, + /* 0xACC7 [?] [1073]*/ + 0x00,0x04,0x04,0x7F,0x05,0x03,0x06,0x08,0x37,0x00,0x1F,0x01,0x0D,0x11,0x27,0x01, + 0x00,0x20,0x24,0xF8,0xA0,0x80,0x60,0x18,0xE4,0x08,0xF0,0x00,0x30,0x0C,0x04,0x00, + /* 0xACC8 [?] [1074]*/ + 0x00,0x00,0x04,0x04,0x1B,0x01,0x01,0x3E,0x00,0x07,0x00,0x08,0x0F,0x08,0x0F,0x00, + 0x00,0x00,0x20,0x24,0xF8,0x80,0x08,0xF0,0x30,0xE0,0x00,0x10,0xF0,0x10,0xE0,0x00, + /* 0xACC9 [?] [1075]*/ + 0x00,0x18,0x10,0x10,0x14,0x38,0x19,0x14,0x35,0x33,0x50,0x50,0x10,0x11,0x12,0x14, + 0x00,0x20,0x20,0x20,0x26,0xF8,0x28,0xA8,0x30,0xFE,0x60,0x50,0x98,0x0C,0x06,0x00, + /* 0xACCA [?] [1076]*/ + 0x00,0x08,0x11,0x11,0x7F,0x10,0x12,0x7E,0x42,0x24,0x14,0x08,0x14,0x20,0x40,0x01, + 0x00,0x02,0xFC,0x20,0x20,0xDC,0x84,0x94,0x94,0x94,0x94,0x90,0x28,0x24,0xC2,0x02, + /* 0xACCB [?] [1077]*/ + 0x00,0x10,0x10,0x21,0x7E,0x20,0x50,0x53,0x7C,0x10,0x12,0x3C,0x50,0x11,0x12,0x00, + 0x00,0x20,0x24,0x24,0xA8,0xA8,0xB0,0xFE,0x90,0x90,0x90,0x90,0x90,0x12,0x1E,0x00, + /* 0xACCC [?] [1078]*/ + 0x00,0x00,0x11,0x11,0x0F,0x02,0x1F,0x0E,0x12,0x6F,0x09,0x0F,0x01,0x7F,0x01,0x00, + 0x00,0x80,0x08,0x08,0xF0,0x00,0xFC,0x30,0x0E,0xF0,0x00,0xF0,0x04,0xF8,0x00,0x00, + /* 0xACCD [?] [1079]*/ + 0x00,0x10,0x10,0x24,0x38,0x20,0x7F,0x10,0x10,0x7C,0x10,0x11,0x16,0x18,0x10,0x00, + 0x00,0x00,0x40,0x48,0x48,0x44,0xF8,0x60,0x50,0xD0,0xC8,0x44,0x46,0x40,0x40,0x00, + /* 0xACCE [?] [1080]*/ + 0x00,0x10,0x10,0x24,0x38,0x21,0x7D,0x11,0x11,0x7D,0x13,0x11,0x15,0x1A,0x12,0x04, + 0x00,0x20,0x20,0x26,0x38,0x20,0xDC,0x04,0x04,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xACCF [?] [1081]*/ + 0x00,0x10,0x10,0x24,0x39,0x21,0x7D,0x11,0x11,0x7D,0x13,0x11,0x14,0x18,0x10,0x00, + 0x00,0x20,0x20,0x20,0x24,0xFC,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xACD0 [?] [1082]*/ + 0x00,0x10,0x11,0x24,0x38,0x20,0x7C,0x10,0x13,0x7C,0x11,0x11,0x15,0x19,0x11,0x00, + 0x00,0x00,0xFE,0x44,0x44,0x44,0x84,0x9C,0x10,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00, + /* 0xACD1 [?] [1083]*/ + 0x00,0x10,0x10,0x24,0x38,0x20,0x7C,0x11,0x11,0x7D,0x11,0x11,0x15,0x18,0x10,0x00, + 0x00,0x00,0xFC,0x88,0xE8,0xA8,0xAA,0xFE,0x48,0x28,0x08,0x0A,0xFC,0x08,0x38,0x10, + /* 0xACD2 [?] [1084]*/ + 0x00,0x08,0x08,0x38,0x28,0x2F,0x59,0x88,0x88,0x0D,0x78,0x48,0x08,0x09,0x0A,0x04, + 0x00,0x00,0x50,0x50,0x50,0x56,0x58,0x50,0x50,0xDC,0x90,0x90,0x92,0x12,0x1E,0x00, + /* 0xACD3 [?] [1085]*/ + 0x00,0x09,0x08,0x10,0x12,0x13,0x32,0x53,0x12,0x13,0x10,0x10,0x13,0x10,0x10,0x00, + 0x00,0x08,0x90,0xA0,0x24,0xDC,0x44,0xFC,0x44,0xFC,0x40,0x42,0xFC,0x40,0x40,0x00, + /* 0xACD4 [?] [1086]*/ + 0x00,0x08,0x08,0x3E,0x22,0x22,0x3E,0x22,0x3E,0x22,0x1E,0x0B,0x12,0x22,0x46,0x00, + 0x00,0x10,0x10,0x10,0x10,0x50,0x54,0x54,0x92,0x92,0x92,0x12,0x10,0x10,0x70,0x20, + /* 0xACD5 [?] [1087]*/ + 0x00,0x08,0x08,0x0E,0x11,0x22,0x5C,0x48,0x3F,0x08,0x09,0x36,0x22,0x22,0x1C,0x00, + 0x00,0x00,0x7E,0x44,0x48,0x48,0x50,0x48,0xC4,0x42,0x42,0x42,0x5E,0x44,0x40,0x40, + /* 0xACD6 [?] [1088]*/ + 0x00,0x04,0x3C,0x24,0x24,0x3C,0x27,0x24,0x24,0x3C,0x24,0x24,0x44,0x45,0x8E,0x00, + 0x00,0x08,0x98,0x70,0x58,0x84,0x20,0x20,0x26,0xF8,0x70,0xA8,0xA4,0x22,0x20,0x00, + /* 0xACD7 [?] [1089]*/ + 0x00,0x00,0x10,0x21,0x20,0x5F,0x45,0x19,0x11,0x11,0x10,0x10,0x17,0x1A,0x14,0x00, + 0x00,0x20,0x20,0xFE,0x20,0x24,0xFC,0x24,0x24,0xF8,0x70,0xA8,0x2C,0x26,0x20,0x20, + /* 0xACD8 [?] [1090]*/ + 0x00,0x44,0x24,0x28,0x17,0x38,0x10,0x7D,0x11,0x11,0x7D,0x11,0x10,0x20,0x40,0x00, + 0x00,0x10,0x20,0x20,0xFE,0x20,0x22,0xFC,0x24,0x24,0x24,0x24,0x24,0x20,0x20,0x00, + /* 0xACD9 [?] [1091]*/ + 0x00,0x44,0x24,0x08,0x0A,0x34,0x10,0x3F,0x11,0x12,0x7C,0x10,0x10,0x10,0x21,0x46, + 0x00,0x40,0x40,0x40,0x86,0xF8,0x88,0x48,0x50,0x50,0x30,0x20,0x30,0xC8,0x06,0x00, + /* 0xACDA [?] [1092]*/ + 0x00,0x00,0x08,0x08,0x0A,0x2C,0x29,0x68,0x08,0x0B,0x08,0x14,0x10,0x20,0x20,0x40, + 0x00,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x10,0x12,0xFC,0x90,0x90,0x10,0x10,0x30,0x10, + /* 0xACDB [?] [1093]*/ + 0x00,0x00,0x11,0x09,0x09,0x3F,0x40,0x00,0x3F,0x08,0x1F,0x28,0x48,0x08,0x0F,0x00, + 0x00,0x10,0x10,0x20,0x20,0xFE,0x04,0x04,0xF8,0x00,0xF8,0x10,0x10,0x10,0xE0,0x00, + /* 0xACDC [?] [1094]*/ + 0x00,0x00,0x7C,0x4B,0x4A,0x52,0x53,0x4A,0x49,0x44,0x48,0x40,0x40,0x41,0x42,0x00, + 0x00,0x40,0x84,0x0C,0x04,0x44,0x8C,0x04,0xFC,0x60,0xA0,0xA0,0xA0,0x14,0x1C,0x00, + /* 0xACDD [?] [1095]*/ + 0x00,0x00,0x0C,0x7A,0x4B,0x52,0x50,0x49,0x48,0x45,0x46,0x7A,0x43,0x44,0x48,0x10, + 0x00,0x40,0x20,0x04,0xFC,0x10,0x08,0xF0,0x40,0x48,0x70,0x40,0x40,0xC0,0x7C,0x00, + /* 0xACDE [?] [1096]*/ + 0x00,0x00,0x11,0x10,0x10,0x7F,0x25,0x25,0x25,0x25,0x49,0x38,0x16,0x12,0x23,0x40, + 0x00,0x00,0xFC,0x00,0x00,0xFC,0x08,0x08,0x08,0xF8,0x08,0x88,0x50,0x90,0xFE,0x00, + /* 0xACDF [?] [1097]*/ + 0x00,0x10,0x10,0x10,0x10,0x2F,0x24,0x25,0x26,0x48,0x68,0x18,0x15,0x22,0x44,0x80, + 0x00,0x20,0x20,0x24,0xF8,0x24,0xA8,0x32,0xEC,0x60,0xB0,0xA8,0x2C,0x26,0x20,0x20, + /* 0xACE0 [?] [1098]*/ + 0x00,0x10,0x10,0x20,0x20,0x7D,0x26,0x48,0x48,0x49,0x48,0x30,0x1D,0x22,0x44,0x80, + 0x00,0x20,0x60,0x50,0x88,0x04,0x0A,0x70,0x20,0xFE,0x20,0xA8,0x24,0x22,0xE0,0x00, + /* 0xACE1 [?] [1099]*/ + 0x00,0x00,0x10,0x10,0x10,0x2E,0x25,0x26,0x24,0x45,0x49,0x38,0x14,0x20,0x40,0x00, + 0x00,0x20,0x20,0x60,0x50,0x88,0x06,0xF8,0x00,0x44,0x28,0xA8,0xB0,0x10,0x16,0xE8, + /* 0xACE2 [?] [1100]*/ + 0x00,0x00,0x10,0x10,0x10,0x2F,0x25,0x25,0x25,0x45,0x49,0x39,0x15,0x23,0x41,0x00, + 0x00,0x04,0xFC,0x50,0x30,0xFE,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0x0C,0x00, + /* 0xACE3 [?] [1101]*/ + 0x00,0x00,0x3C,0x04,0x24,0x24,0x25,0x24,0x26,0x1B,0x04,0x7C,0x05,0x06,0x1C,0x00, + 0x00,0x20,0x20,0x50,0x48,0x86,0x0A,0x30,0x20,0xFC,0x20,0xAC,0x22,0x22,0x60,0x00, + /* 0xACE4 [?] [1102]*/ + 0x00,0x10,0x10,0x10,0x24,0x44,0x78,0x11,0x21,0x21,0x7F,0x05,0x0D,0x70,0x00,0x00, + 0x00,0x08,0x70,0x38,0xC0,0x40,0x46,0xB8,0x20,0xFC,0x24,0x24,0x24,0x2C,0x20,0x20, + /* 0xACE5 [?] [1103]*/ + 0x00,0x00,0x08,0x10,0x11,0x27,0x3C,0x08,0x10,0x23,0x3C,0x00,0x04,0x38,0x03,0x04, + 0x00,0x20,0x10,0x22,0xDE,0x04,0x04,0x78,0x02,0xFC,0x50,0x50,0x50,0x92,0x0F,0x00, + /* 0xACE6 [?] [1104]*/ + 0x00,0x00,0x04,0x3C,0x25,0x25,0x25,0x25,0x27,0x1B,0x0D,0x75,0x05,0x05,0x1D,0x00, + 0x00,0x20,0x20,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF0,0x2C,0x30,0x10,0x68,0x86,0x00, + /* 0xACE7 [?] [1105]*/ + 0x00,0x0C,0x08,0x1E,0x0A,0x1C,0x09,0x3E,0x0B,0x00,0x1F,0x04,0x0B,0x38,0x08,0x07, + 0x00,0x00,0x04,0x3C,0x24,0x44,0x44,0xAC,0x18,0x06,0xF8,0x08,0xF8,0x08,0x08,0xF0, + /* 0xACE8 [?] [1106]*/ + 0x00,0x00,0x04,0x3B,0x11,0x11,0x15,0x3A,0x10,0x11,0x11,0x0E,0x74,0x00,0x00,0x07, + 0x00,0x20,0x20,0x24,0x38,0x20,0x20,0xDC,0x20,0xA0,0x24,0x2C,0x58,0x20,0xC0,0x00, + /* 0xACE9 [?] [1107]*/ + 0x00,0x00,0x00,0x04,0x38,0x11,0x12,0x10,0x38,0x11,0x10,0x11,0x15,0x6A,0x04,0x00, + 0x00,0x60,0x60,0xA0,0x90,0x0C,0x1C,0x60,0x24,0xF8,0x20,0x38,0x24,0x24,0xE0,0x00, + /* 0xACEA [?] [1108]*/ + 0x00,0x00,0x08,0x10,0x10,0x11,0x3D,0x11,0x11,0x10,0x10,0x14,0x3B,0x00,0x00,0x00, + 0x00,0x80,0x48,0x50,0x12,0xEC,0x24,0xFC,0x24,0xFC,0x20,0x21,0xFE,0x20,0x20,0x00, + /* 0xACEB [?] [1109]*/ + 0x00,0x00,0x11,0x22,0x21,0x21,0x7A,0x24,0x27,0x24,0x23,0x19,0x62,0x04,0x08,0x00, + 0x00,0x04,0xFC,0xA8,0x18,0x9C,0x24,0x40,0xFC,0xA4,0x28,0x18,0x90,0xA8,0xC6,0x00, + /* 0xACEC [?] [1110]*/ + 0x00,0x00,0x04,0x3F,0x05,0x0F,0x02,0x0C,0x00,0x1F,0x0F,0x10,0x10,0x0F,0x00,0x00, + 0x00,0x20,0x46,0xF8,0xC0,0xF0,0xC0,0x20,0x06,0xF8,0x90,0x90,0x90,0x90,0x70,0x00, + /* 0xACED [?] [1111]*/ + 0x00,0x00,0x04,0x3F,0x01,0x01,0x11,0x1E,0x10,0x1F,0x1F,0x01,0x7F,0x01,0x01,0x00, + 0x00,0x00,0x44,0xF8,0x00,0x08,0xF0,0x10,0x10,0xF0,0xF0,0x04,0xF8,0x00,0x00,0x00, + /* 0xACEE [?] [1112]*/ + 0x00,0x02,0x04,0x3F,0x24,0x3F,0x64,0x04,0x0F,0x11,0x01,0x3F,0x11,0x11,0x11,0x1E, + 0x00,0x20,0x44,0xF8,0x40,0xFE,0x00,0x10,0xF0,0x00,0x04,0xF8,0x08,0x10,0x10,0xE0, + /* 0xACEF [?] [1113]*/ + 0x00,0x00,0x04,0x3F,0x04,0x1F,0x10,0x1F,0x10,0x18,0x28,0x2F,0x28,0x48,0x4F,0x00, + 0x00,0x00,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x80,0x88,0x88,0xF0,0x84,0x88,0x70,0x00, + /* 0xACF0 [?] [1114]*/ + 0x00,0x00,0x00,0x3E,0x21,0x20,0x20,0x39,0x69,0x69,0xA9,0x29,0x29,0x3A,0x24,0x00, + 0x00,0x10,0x10,0x10,0x10,0x16,0x38,0x10,0x10,0x28,0x24,0x40,0x80,0x80,0x7E,0x00, + /* 0xACF1 [?] [1115]*/ + 0x00,0x00,0x01,0x7C,0x49,0x4A,0x4A,0x7B,0x4A,0x4B,0x49,0x48,0x70,0x40,0x01,0x0E, + 0x00,0x04,0xF8,0x40,0xFC,0x48,0x48,0xF8,0x48,0xF4,0x40,0xC0,0x40,0xA0,0x1E,0x00, + /* 0xACF2 [?] [1116]*/ + 0x00,0x00,0x00,0x05,0x7D,0x45,0x45,0x45,0x7D,0x45,0x45,0x45,0x45,0x7D,0x01,0x00, + 0x00,0x40,0x20,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF4,0x48,0x30,0x10,0x68,0x86,0x00, + /* 0xACF3 [?] [1117]*/ + 0x00,0x08,0x10,0x10,0x10,0x7E,0x52,0x52,0x52,0x7E,0x52,0x52,0x52,0x7E,0x40,0x03, + 0x00,0x00,0x7C,0x20,0xA4,0xDC,0x84,0xA4,0xA4,0xA4,0xA4,0xA0,0x38,0x44,0x82,0x02, + /* 0xACF4 [?] [1118]*/ + 0x00,0x10,0x10,0x10,0x50,0x7C,0x54,0x55,0x55,0x54,0x7C,0x14,0x17,0x7A,0x00,0x00, + 0x00,0x20,0x20,0x42,0xFC,0x80,0x90,0x10,0xFE,0x10,0xD8,0x96,0x12,0x10,0x70,0x00, + /* 0xACF5 [?] [1119]*/ + 0x00,0x10,0x10,0x52,0x7C,0x54,0x54,0x7C,0x54,0x54,0x6F,0x45,0x44,0x44,0x4C,0x00, + 0x00,0x00,0xEE,0x22,0x22,0xBA,0xAA,0x22,0x22,0xEE,0x2A,0x32,0x22,0x22,0x66,0x00, + /* 0xACF6 [?] [1120]*/ + 0x00,0x10,0x10,0x24,0x38,0x20,0x7C,0x11,0x10,0x7C,0x10,0x11,0x14,0x18,0x11,0x00, + 0x00,0x20,0x20,0x24,0xF8,0x20,0x20,0xFE,0x20,0x20,0x24,0xF8,0x20,0x20,0xFE,0x00, + /* 0xACF7 [?] [1121]*/ + 0x00,0x10,0x11,0x25,0x39,0x23,0x7D,0x11,0x11,0x7D,0x13,0x10,0x15,0x19,0x16,0x08, + 0x00,0x90,0x10,0x10,0x14,0xF8,0x10,0x10,0x10,0x10,0xFE,0x90,0x88,0x04,0x02,0x00, + /* 0xACF8 [?] [1122]*/ + 0x00,0x10,0x10,0x25,0x39,0x21,0x7C,0x13,0x11,0x7D,0x11,0x11,0x15,0x19,0x12,0x00, + 0x00,0x00,0x10,0x10,0x10,0xFE,0x10,0x90,0x18,0x24,0x24,0x40,0x80,0x80,0x7E,0x00, + /* 0xACF9 [?] [1123]*/ + 0x00,0x10,0x10,0x3F,0x25,0x44,0x08,0x08,0x3F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x00, + 0x00,0x40,0x40,0xBC,0x10,0x30,0x20,0x26,0xF8,0x20,0x20,0xE0,0x20,0x20,0xC0,0x00, + /* 0xACFA [?] [1124]*/ + 0x00,0x08,0x11,0x29,0x69,0x25,0x19,0x29,0x0D,0x35,0x4D,0x15,0x25,0x05,0x1D,0x02, + 0x00,0x00,0xFC,0x00,0x0C,0x88,0x48,0x30,0x10,0x28,0x4C,0x44,0x80,0x00,0x06,0xF8, + /* 0xACFB [?] [1125]*/ + 0x00,0x00,0x24,0x38,0x28,0x28,0x38,0x29,0x29,0x39,0x28,0x28,0x48,0x49,0x5E,0x88, + 0x00,0x88,0x48,0x50,0xAE,0x24,0xA4,0x78,0x20,0xFE,0x62,0x62,0xAA,0x24,0x20,0x20, + /* 0xACFC [?] [1126]*/ + 0x00,0x08,0x37,0x42,0x4A,0x75,0x20,0x3F,0x24,0x24,0x28,0x28,0x2B,0x10,0x20,0x40, + 0x00,0x00,0xE6,0xBC,0xA4,0xA8,0xB0,0xA8,0xA4,0xA2,0xA2,0xA2,0x2E,0xA4,0x20,0x20, + /* 0xACFD [?] [1127]*/ + 0x00,0x10,0x10,0x10,0x14,0x18,0x50,0x50,0x10,0x10,0x11,0x1D,0x26,0x20,0x40,0x00, + 0x00,0x20,0x20,0x26,0xF8,0x44,0xF8,0x42,0xFC,0x8A,0xFC,0x48,0x08,0x08,0x18,0x00, + /* 0xACFE [?] [1128]*/ + 0x00,0x00,0x12,0x05,0x04,0x44,0x2C,0x2C,0x14,0x14,0x14,0x34,0x25,0x24,0x27,0x00, + 0x00,0x00,0x02,0xFE,0x0A,0xF2,0x42,0x42,0x72,0x52,0x4A,0x4A,0xB2,0x02,0xFE,0x00, + /* 0xADA1 [?] [1129]*/ + 0x00,0x10,0x08,0x40,0x3D,0x08,0x09,0x32,0x15,0x16,0x00,0x1F,0x01,0x0F,0x3F,0x00, + 0x00,0x08,0xF0,0x40,0x84,0xFC,0xA4,0x44,0xC4,0x38,0x04,0xF8,0x08,0xF0,0xFE,0x00, + /* 0xADA2 [?] [1130]*/ + 0x00,0x10,0x10,0x10,0x18,0x14,0x57,0x50,0x11,0x12,0x11,0x12,0x14,0x10,0x10,0x17, + 0x00,0x20,0x20,0x2C,0xF0,0x22,0xDC,0x8C,0x42,0x88,0xF8,0x50,0x20,0x70,0x8E,0x00, + /* 0xADA3 [?] [1131]*/ + 0x00,0x00,0x17,0x00,0x00,0x07,0x14,0x34,0x14,0x13,0x10,0x18,0x17,0x10,0x07,0x00, + 0x00,0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xA4,0x58,0x40,0x44,0xF8,0x40,0xFE,0x00, + /* 0xADA4 [?] [1132]*/ + 0x00,0x00,0x10,0x00,0x03,0x02,0x12,0x33,0x13,0x13,0x15,0x1D,0x15,0x14,0x08,0x00, + 0x00,0x10,0x2C,0x24,0xFE,0x10,0x14,0xF4,0x14,0xF4,0x58,0x48,0xD8,0x26,0x46,0x80, + /* 0xADA5 [?] [1133]*/ + 0x00,0x00,0x11,0x01,0x01,0x01,0x11,0x31,0x10,0x13,0x11,0x1A,0x13,0x14,0x08,0x00, + 0x00,0x00,0xF8,0x08,0xF8,0x08,0x08,0xF0,0x02,0xFC,0x44,0x78,0x40,0xC0,0x3E,0x00, + /* 0xADA6 [?] [1134]*/ + 0x00,0x00,0x10,0x03,0x02,0x03,0x12,0x32,0x13,0x10,0x13,0x19,0x10,0x10,0x03,0x0C, + 0x00,0x40,0xC4,0x4C,0x44,0x5C,0x44,0x44,0xFC,0x48,0xB8,0x10,0xA0,0xE0,0x1E,0x00, + /* 0xADA7 [?] [1135]*/ + 0x00,0x00,0x0C,0x7B,0x4A,0x52,0x55,0x4F,0x48,0x47,0x46,0x4A,0x42,0x40,0x41,0x06, + 0x00,0x00,0x40,0xFC,0x48,0x48,0xF0,0xFE,0x08,0xF8,0x48,0x48,0x48,0xB8,0x0C,0x04, + /* 0xADA8 [?] [1136]*/ + 0x00,0x10,0x10,0x10,0x10,0x6C,0x25,0x24,0x25,0x49,0x49,0x39,0x15,0x20,0x40,0x03, + 0x00,0x20,0x24,0xF8,0x24,0x78,0xFE,0x00,0xFC,0x24,0x24,0x24,0x48,0x48,0x86,0x00, + /* 0xADA9 [?] [1137]*/ + 0x00,0x00,0x10,0x10,0x10,0x2C,0x25,0x26,0x24,0x48,0x29,0x19,0x15,0x21,0x41,0x01, + 0x00,0x20,0x20,0x66,0xB8,0xA8,0x2C,0x26,0x60,0xFC,0x04,0x04,0xFC,0x04,0xFC,0x00, + /* 0xADAA [?] [1138]*/ + 0x00,0x10,0x10,0x11,0x20,0x44,0x78,0x09,0x10,0x25,0x38,0x01,0x05,0x79,0x01,0x00, + 0x00,0x20,0x20,0xFE,0x20,0xFC,0x22,0xDC,0x04,0xFC,0xFC,0x04,0xFC,0x04,0x1C,0x08, + /* 0xADAB [?] [1139]*/ + 0x00,0x00,0x7C,0x08,0x29,0x28,0x28,0x48,0x48,0x34,0x04,0x7F,0x04,0x04,0x38,0x00, + 0x00,0x50,0x50,0x50,0xDE,0x50,0x50,0x52,0xDC,0x50,0x50,0xDC,0x50,0x50,0x50,0x00, + /* 0xADAC [?] [1140]*/ + 0x00,0x00,0x7C,0x09,0x29,0x2A,0x29,0x2A,0x2C,0x17,0x05,0x7D,0x05,0x08,0x18,0x00, + 0x00,0x80,0x80,0x02,0xFE,0x82,0xF2,0x44,0x4C,0xF4,0x4C,0x54,0x54,0xA4,0x1C,0x08, + /* 0xADAD [?] [1141]*/ + 0x00,0x00,0x10,0x10,0x21,0x45,0x79,0x11,0x11,0x21,0x79,0x00,0x09,0x72,0x04,0x00, + 0x00,0x40,0x20,0x26,0xD8,0xFC,0x04,0x04,0x04,0xF8,0x20,0xAC,0x26,0x22,0xE0,0x40, + /* 0xADAE [?] [1142]*/ + 0x00,0x00,0x10,0x13,0x21,0x45,0x79,0x11,0x10,0x21,0x78,0x03,0x0C,0x70,0x01,0x00, + 0x00,0x40,0x40,0xFE,0x08,0xF8,0x08,0xF8,0x0C,0xF8,0x20,0xFE,0x40,0x40,0xC0,0x40, + /* 0xADAF [?] [1143]*/ + 0x00,0x00,0x7C,0x08,0x28,0x28,0x28,0x48,0x49,0x36,0x04,0x7C,0x05,0x05,0x38,0x00, + 0x00,0x00,0xFC,0x08,0xF8,0x08,0x0A,0xF4,0x20,0xB6,0xB8,0xA8,0xA4,0x26,0xE0,0x00, + /* 0xADB0 [?] [1144]*/ + 0x00,0x00,0x07,0x3A,0x12,0x12,0x13,0x7E,0x12,0x13,0x12,0x16,0x7B,0x02,0x00,0x00, + 0x00,0x00,0xE0,0x7E,0x54,0x54,0xD4,0x54,0x54,0xD8,0x48,0x68,0xD4,0x54,0x62,0x00, + /* 0xADB1 [?] [1145]*/ + 0x00,0x00,0x04,0x3B,0x10,0x17,0x10,0x7C,0x10,0x11,0x11,0x16,0x78,0x00,0x01,0x06, + 0x00,0x40,0x40,0xF8,0x40,0xFE,0x24,0xA0,0xA0,0x20,0x20,0xFC,0x40,0x78,0x84,0x00, + /* 0xADB2 [?] [1146]*/ + 0x00,0x00,0x07,0x3A,0x12,0x12,0x12,0x7E,0x12,0x12,0x12,0x16,0x7A,0x02,0x01,0x00, + 0x00,0x00,0xFE,0x04,0xF4,0x24,0xFC,0x34,0x6C,0x6C,0xA4,0x24,0x24,0x04,0xF8,0x00, + /* 0xADB3 [?] [1147]*/ + 0x00,0x00,0x04,0x3B,0x10,0x13,0x11,0x7D,0x17,0x11,0x11,0x15,0x7A,0x00,0x01,0x00, + 0x00,0x08,0x78,0xC0,0x40,0xFC,0x48,0x48,0xFE,0x48,0x48,0x4A,0xF4,0x40,0xFC,0x00, + /* 0xADB4 [?] [1148]*/ + 0x00,0x00,0x05,0x38,0x10,0x11,0x10,0x39,0x12,0x11,0x10,0x10,0x3F,0x40,0x00,0x00, + 0x00,0x08,0xF0,0x20,0x22,0xFC,0xA8,0x26,0x48,0xB8,0x20,0x22,0xFC,0x20,0xE0,0x40, + /* 0xADB5 [?] [1149]*/ + 0x00,0x00,0x04,0x3B,0x10,0x11,0x11,0x7D,0x13,0x15,0x11,0x15,0x79,0x01,0x01,0x00, + 0x00,0x40,0x20,0xFE,0xA0,0x20,0x5C,0x64,0x58,0xC8,0x28,0x30,0x10,0x28,0x46,0x80, + /* 0xADB6 [?] [1150]*/ + 0x00,0x02,0x09,0x31,0x20,0x23,0x2A,0x73,0x22,0x22,0x24,0x2C,0x74,0x08,0x11,0x00, + 0x00,0x10,0x10,0x18,0x58,0xA4,0x26,0xC2,0x90,0x88,0x80,0x80,0x90,0x8C,0x04,0x00, + /* 0xADB7 [?] [1151]*/ + 0x00,0x10,0x11,0x10,0x15,0x3B,0x11,0x11,0x1C,0x73,0x12,0x12,0x12,0x12,0x32,0x02, + 0x00,0x0C,0xF0,0x20,0xFC,0x28,0x28,0xF0,0x22,0xFE,0x24,0x2C,0xD4,0x04,0x04,0x04, + /* 0xADB8 [?] [1152]*/ + 0x00,0x10,0x11,0x10,0x10,0x17,0x39,0x11,0x12,0x10,0x1F,0x11,0x60,0x00,0x00,0x07, + 0x00,0x20,0x48,0xD0,0x44,0xF8,0x48,0x46,0x40,0x80,0xFC,0x10,0xA0,0x78,0x84,0x00, + /* 0xADB9 [?] [1153]*/ + 0x00,0x10,0x10,0x11,0x11,0x15,0x39,0x11,0x11,0x11,0x13,0x1D,0x62,0x02,0x04,0x00, + 0x00,0x20,0x10,0x02,0xFC,0x04,0xF8,0x00,0x82,0xFE,0xB2,0xFE,0xAA,0xAA,0xA2,0x00, + /* 0xADBA [?] [1154]*/ + 0x00,0x10,0x10,0x13,0x14,0x39,0x10,0x1B,0x34,0x53,0x51,0x93,0x13,0x14,0x18,0x10, + 0x00,0x00,0x40,0xFE,0x40,0xFC,0x4A,0xFC,0x48,0xF0,0x40,0x3C,0x40,0xC0,0x7E,0x06, + /* 0xADBB [?] [1155]*/ + 0x00,0x10,0x10,0x13,0x16,0x3A,0x12,0x1A,0x32,0x52,0x52,0x92,0x14,0x14,0x18,0x10, + 0x00,0x04,0x38,0xE0,0x20,0x7C,0x20,0xDC,0x84,0x94,0xA4,0xA4,0xA0,0x4C,0x84,0x00, + /* 0xADBC [?] [1156]*/ + 0x00,0x08,0x0E,0x0B,0x7C,0x08,0x3F,0x49,0x49,0x7F,0x49,0x7F,0x49,0x49,0x0B,0x00, + 0x00,0x00,0x20,0xDC,0xA4,0x94,0x94,0x88,0x80,0x7E,0x02,0xFA,0x02,0x02,0x0E,0x00, + /* 0xADBD [?] [1157]*/ + 0x00,0x00,0x3F,0x01,0x3F,0x21,0x1F,0x40,0x7F,0x52,0x54,0x5F,0x48,0x48,0x41,0x40, + 0x00,0x80,0x26,0x3C,0x24,0x28,0x30,0x28,0xE4,0xA2,0xA2,0xA2,0xAE,0xA4,0xA0,0x20, + /* 0xADBE [?] [1158]*/ + 0x00,0x10,0x10,0x13,0x6D,0x21,0x29,0x51,0x7F,0x11,0x12,0x3C,0x48,0x08,0x09,0x02, + 0x00,0x00,0x60,0x9E,0x04,0x44,0x84,0x04,0xFC,0x50,0x50,0x50,0x50,0x94,0x1E,0x00, + /* 0xADBF [?] [1159]*/ + 0x00,0x08,0x08,0x28,0x2C,0x28,0x7F,0x08,0x08,0x49,0x59,0x55,0x65,0x61,0x5F,0x20, + 0x00,0x00,0x10,0x30,0x48,0x44,0x82,0x24,0x28,0x48,0x48,0x48,0x48,0x88,0x88,0x00, + /* 0xADC0 [?] [1160]*/ + 0x00,0x00,0x09,0x7A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x4B,0x7A,0x02,0x00, + 0x00,0x00,0x82,0x1C,0x04,0x14,0x64,0x44,0x54,0x64,0x44,0x4C,0xB4,0x04,0x0C,0x04, + /* 0xADC1 [?] [1161]*/ + 0x00,0x00,0x48,0x7E,0x4B,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x4A,0x7A,0x42,0x00, + 0x00,0x00,0x82,0x9E,0x04,0x04,0xFC,0x94,0x94,0xF4,0x94,0xF4,0x84,0x04,0x0C,0x04, + /* 0xADC2 [?] [1162]*/ + 0x00,0x00,0x3C,0x44,0x44,0x44,0x38,0x11,0x31,0x5D,0x51,0x51,0x4F,0x70,0x00,0x00, + 0x00,0x00,0xFC,0x88,0xE8,0xA8,0xAA,0xFE,0x48,0x28,0x08,0x0A,0xFC,0x08,0x38,0x10, + /* 0xADC3 [?] [1163]*/ + 0x00,0x08,0x08,0x4A,0x4A,0x4A,0x34,0x7E,0x02,0x02,0x3E,0x20,0x23,0x2C,0x30,0x03, + 0x00,0x00,0xFC,0x20,0xA4,0xDC,0x84,0xA4,0xA4,0xA4,0xA4,0xA0,0x38,0x46,0x82,0x00, + /* 0xADC4 [?] [1164]*/ + 0x00,0x10,0x10,0x24,0x3B,0x20,0x7C,0x10,0x11,0x79,0x11,0x16,0x14,0x18,0x11,0x06, + 0x00,0x20,0x40,0x44,0xF8,0x48,0xF0,0x44,0xB8,0x08,0xF8,0x90,0x60,0x70,0x8E,0x00, + /* 0xADC5 [?] [1165]*/ + 0x00,0x01,0x11,0x21,0x3D,0x43,0x49,0x31,0x23,0x2D,0x35,0x29,0x29,0x11,0x01,0x01, + 0x00,0x00,0x00,0x10,0x10,0x90,0x10,0xFC,0x50,0x50,0x10,0x10,0x10,0x12,0x6C,0x00, + /* 0xADC6 [?] [1166]*/ + 0x00,0x10,0x10,0x24,0x38,0x21,0x7E,0x11,0x10,0x78,0x10,0x13,0x14,0x18,0x10,0x00, + 0x00,0x20,0x58,0x48,0x44,0xB8,0x24,0x64,0x78,0x50,0xC8,0x48,0x46,0x40,0xC0,0x00, + /* 0xADC7 [?] [1167]*/ + 0x00,0x10,0x11,0x15,0x29,0x20,0x3C,0x51,0x11,0x7F,0x11,0x11,0x11,0x1D,0x11,0x00, + 0x00,0x00,0xFC,0x08,0x08,0xF0,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0x1C,0x08, + /* 0xADC8 [?] [1168]*/ + 0x00,0x10,0x10,0x25,0x3B,0x23,0x7C,0x10,0x10,0x78,0x10,0x10,0x15,0x1A,0x1C,0x00, + 0x00,0x40,0x20,0x20,0xDE,0x60,0x40,0x46,0xF8,0xA0,0xA0,0xA0,0x48,0x84,0xFC,0x00, + /* 0xADC9 [?] [1169]*/ + 0x00,0x00,0x14,0x18,0x59,0x5A,0x1C,0x18,0x1E,0x79,0x58,0x29,0x2A,0x24,0x40,0x83, + 0x00,0x00,0xFC,0x20,0xA4,0xDC,0x84,0xA4,0xA4,0xA4,0xA4,0xA0,0x38,0x44,0x82,0x00, + /* 0xADCA [?] [1170]*/ + 0x00,0x00,0x3D,0x2A,0x2A,0x2A,0x3A,0x2A,0x2A,0x3A,0x2A,0x4A,0x4A,0x4A,0x99,0x00, + 0x00,0x00,0x02,0xFC,0x24,0x2C,0x74,0x24,0x74,0xAC,0xA4,0x24,0x04,0x04,0xF8,0x00, + /* 0xADCB [?] [1171]*/ + 0x00,0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x25,0x3C,0x24,0x24,0x24,0x44,0x4C,0x00, + 0x00,0x40,0x20,0x24,0xD8,0x88,0x50,0x50,0xAC,0x00,0xF8,0x88,0x88,0x88,0xF0,0x00, + /* 0xADCC [?] [1172]*/ + 0x00,0x10,0x10,0x1E,0x24,0x7F,0x20,0x2E,0x32,0x32,0x32,0x30,0x53,0x4C,0x00,0x03, + 0x00,0x02,0x7C,0x20,0x22,0xDC,0x84,0x94,0x94,0x94,0x94,0x90,0x28,0x44,0x82,0x00, + /* 0xADCD [?] [1173]*/ + 0x00,0x00,0x10,0x1C,0x28,0x7E,0x2A,0x2B,0x3E,0x2A,0x2A,0x36,0x02,0x3C,0x01,0x02, + 0x00,0x20,0x20,0x30,0x50,0x48,0x86,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x08,0x00, + /* 0xADCE [?] [1174]*/ + 0x00,0x24,0x18,0x28,0x34,0x44,0x18,0x01,0x0F,0x09,0x08,0x08,0x07,0x7F,0x00,0x00, + 0x00,0x04,0xF8,0x48,0xF0,0x40,0xBC,0x00,0xF0,0x10,0x20,0x04,0xFC,0xE4,0x28,0x10, + /* 0xADCF [?] [1175]*/ + 0x00,0x00,0x44,0x38,0x08,0x3B,0x48,0x0B,0x1A,0x19,0x2A,0xCA,0x0B,0x0A,0x3A,0x00, + 0x00,0x60,0x60,0x90,0x88,0xF7,0x00,0xE2,0x54,0xD4,0x54,0x54,0xD4,0x54,0xCC,0x44, + /* 0xADD0 [?] [1176]*/ + 0x00,0x01,0x00,0x10,0x2F,0x24,0x25,0x2A,0x29,0x26,0x25,0x26,0x44,0x45,0x02,0x00, + 0x00,0x00,0x80,0x84,0x78,0x20,0x24,0x5C,0x50,0x10,0x30,0x28,0x28,0x44,0x86,0x00, + /* 0xADD1 [?] [1177]*/ + 0x00,0x10,0x08,0x08,0x2F,0x22,0x2F,0x2A,0x2A,0x2D,0x21,0x27,0x21,0x26,0x20,0x00, + 0x00,0x00,0xFC,0x04,0xF4,0x84,0xF4,0x94,0x94,0xE4,0x14,0xE4,0x14,0xE4,0x1C,0x08, + /* 0xADD2 [?] [1178]*/ + 0x00,0x00,0x08,0x10,0x13,0x15,0x49,0x51,0x11,0x11,0x10,0x1C,0x13,0x20,0x20,0x40, + 0x00,0x00,0xC8,0x50,0xFC,0x24,0x24,0xFC,0x24,0xFC,0x20,0x26,0xF8,0x20,0x20,0x00, + /* 0xADD3 [?] [1179]*/ + 0x00,0x00,0x10,0x08,0x09,0x02,0x25,0x08,0x08,0x10,0x11,0x30,0x11,0x15,0x14,0x00, + 0x00,0x80,0x80,0xF8,0x20,0x24,0xDC,0x04,0xFC,0x04,0xF8,0x28,0x04,0x12,0xF8,0x00, + /* 0xADD4 [?] [1180]*/ + 0x00,0x10,0x11,0x11,0x11,0x2D,0x25,0x24,0x24,0x4B,0x49,0x39,0x15,0x21,0x41,0x00, + 0x00,0x00,0xFC,0x24,0x24,0xFC,0x24,0xDC,0x00,0xFE,0x24,0x28,0x10,0x28,0xC6,0x00, + /* 0xADD5 [?] [1181]*/ + 0x00,0x01,0x11,0x21,0x22,0x7E,0x2E,0x4E,0x4A,0x4A,0x52,0x32,0x1A,0x22,0x42,0x80, + 0x00,0x80,0x02,0x3C,0x10,0xFC,0x94,0x7C,0x94,0x94,0xF8,0x50,0x20,0x30,0x4E,0x80, + /* 0xADD6 [?] [1182]*/ + 0x00,0x00,0x7C,0x08,0x28,0x28,0x48,0x48,0x4E,0x35,0x0C,0x75,0x06,0x28,0x18,0x00, + 0x00,0x20,0x22,0xFC,0x24,0x78,0x26,0xF8,0x22,0xDC,0x80,0xFC,0x84,0x84,0xFC,0x00, + /* 0xADD7 [?] [1183]*/ + 0x00,0x00,0x7C,0x04,0x24,0x28,0x28,0x28,0x47,0x3C,0x0C,0x74,0x05,0x26,0x1A,0x04, + 0x00,0x00,0xFC,0x88,0xF8,0x88,0xF0,0x00,0xFE,0x20,0xA4,0xB8,0xA0,0x60,0x3E,0x00, + /* 0xADD8 [?] [1184]*/ + 0x00,0x00,0x7B,0x08,0x31,0x52,0x52,0x52,0x52,0x29,0x08,0x7B,0x08,0x08,0x39,0x10, + 0x00,0x00,0xDE,0x42,0x8C,0x94,0x94,0x94,0x94,0x4A,0x42,0xDE,0x42,0x42,0xCE,0x84, + /* 0xADD9 [?] [1185]*/ + 0x00,0x00,0x04,0x3F,0x11,0x11,0x16,0x3D,0x1A,0x13,0x12,0x1B,0x62,0x02,0x02,0x00, + 0x00,0x00,0x80,0xFE,0x08,0xF0,0x20,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x08,0x1C,0x08, + /* 0xADDA [?] [1186]*/ + 0x00,0x00,0x00,0x07,0x38,0x10,0x13,0x1A,0x30,0x11,0x11,0x15,0x39,0x41,0x00,0x00, + 0x00,0x40,0x20,0xFC,0x88,0x90,0xFE,0x24,0x44,0xFC,0x48,0x48,0x48,0x48,0x40,0x00, + /* 0xADDB [?] [1187]*/ + 0x00,0x00,0x00,0x7E,0x13,0x10,0x11,0x7A,0x14,0x10,0x11,0x14,0x78,0x41,0x06,0x00, + 0x00,0x40,0x20,0x24,0xDC,0x90,0x0C,0x54,0x48,0x46,0xF8,0xA0,0x90,0x08,0x06,0x00, + /* 0xADDC [?] [1188]*/ + 0x00,0x00,0x1F,0x01,0x7F,0x02,0x0C,0x32,0x02,0x1E,0x02,0x1E,0x02,0x3E,0x02,0x00, + 0x00,0x10,0xE0,0x00,0xFC,0x40,0x38,0x44,0x8C,0xF0,0x88,0xF0,0x86,0x78,0x40,0x00, + /* 0xADDD [?] [1189]*/ + 0x00,0x10,0x10,0x11,0x15,0x38,0x10,0x1F,0x14,0x30,0x51,0x50,0x11,0x12,0x14,0x10, + 0x00,0x40,0x20,0xFC,0x08,0x90,0xA2,0x5C,0x20,0x22,0xFC,0xF0,0xA8,0x26,0x20,0x00, + /* 0xADDE [?] [1190]*/ + 0x00,0x00,0x7E,0x28,0x29,0xFF,0xAC,0xAC,0xAC,0xC5,0x84,0xFC,0x84,0x84,0x78,0x00, + 0x00,0x20,0x20,0x20,0xFE,0x24,0x60,0x50,0xD4,0x98,0x88,0x88,0x84,0xA6,0xC0,0x00, + /* 0xADDF [?] [1191]*/ + 0x00,0x00,0x04,0x38,0x10,0x20,0x27,0x3C,0x65,0x65,0xA5,0x25,0x3D,0x21,0x21,0x00, + 0x00,0x10,0x20,0xA4,0xB8,0xA2,0x5C,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x1C,0x00, + /* 0xADE0 [?] [1192]*/ + 0x00,0x00,0x02,0x3C,0x11,0x11,0x15,0x2D,0x65,0x64,0xA4,0x24,0x1F,0x20,0x00,0x00, + 0x00,0x88,0x48,0x50,0xAE,0x24,0x24,0xFC,0x24,0xF8,0x20,0x22,0xFC,0x20,0x20,0x00, + /* 0xADE1 [?] [1193]*/ + 0x00,0x00,0x04,0x38,0x23,0x24,0x3C,0x24,0x64,0x58,0x08,0x13,0x10,0x20,0x43,0x00, + 0x00,0x10,0x90,0x90,0x9E,0x90,0x90,0x94,0x98,0x90,0x90,0x9C,0x90,0x90,0xFC,0x00, + /* 0xADE2 [?] [1194]*/ + 0x00,0x09,0x10,0x14,0x2B,0x20,0x29,0x4D,0x39,0x09,0x0D,0x79,0x49,0x09,0x09,0x00, + 0x00,0x08,0x88,0x90,0xFE,0x50,0x54,0xFC,0x94,0x9C,0x04,0x04,0xFC,0x04,0xFC,0x00, + /* 0xADE3 [?] [1195]*/ + 0x00,0x08,0x10,0x10,0x2C,0x20,0x28,0x48,0x3F,0x08,0x0D,0x78,0x48,0x09,0x0E,0x00, + 0x00,0x00,0x7C,0x20,0x20,0xFC,0x60,0xA0,0x60,0x20,0xFC,0x70,0xA8,0x2C,0x20,0x20, + /* 0xADE4 [?] [1196]*/ + 0x00,0x04,0x14,0x15,0x04,0x7B,0x41,0x3F,0x21,0x1F,0x04,0x04,0x1F,0x04,0x3B,0x00, + 0x00,0x00,0xBE,0x24,0x64,0xA8,0x28,0x28,0x24,0x22,0x22,0xA2,0x2C,0x20,0x20,0x20, + /* 0xADE5 [?] [1197]*/ + 0x00,0x00,0x07,0x00,0x70,0x52,0x52,0x51,0x50,0x53,0x70,0x46,0x06,0x06,0x01,0x00, + 0x00,0x00,0xFC,0xA0,0xA4,0xA4,0xA8,0xB0,0xA2,0xDC,0x44,0x2A,0x0A,0x08,0xF8,0x00, + /* 0xADE6 [?] [1198]*/ + 0x00,0x00,0x03,0x7A,0x49,0x4A,0x4A,0x7B,0x48,0x4C,0x4F,0x7C,0x04,0x04,0x07,0x00, + 0x00,0x00,0xF8,0x08,0xF8,0x08,0x08,0xF8,0x00,0x04,0xF8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xADE7 [?] [1199]*/ + 0x00,0x08,0x0F,0x08,0x0F,0x1F,0x09,0x05,0x1A,0x02,0x1D,0x06,0x09,0x10,0x63,0x1C, + 0x00,0x10,0xF0,0x10,0xF0,0xE8,0x10,0x30,0xC0,0x0C,0xF0,0x30,0x40,0x80,0x7C,0x00, + /* 0xADE8 [?] [1200]*/ + 0x00,0x00,0x3C,0x44,0x45,0x44,0x38,0x10,0x50,0x58,0x51,0x50,0x54,0x38,0x41,0x06, + 0x00,0x20,0x20,0x24,0xF8,0x24,0xA4,0xA8,0x20,0x26,0xF8,0x50,0x50,0x88,0x06,0x00, + /* 0xADE9 [?] [1201]*/ + 0x00,0x10,0x10,0x13,0x7E,0x56,0x56,0x56,0x56,0x56,0x56,0x5A,0x13,0x15,0x16,0x18, + 0x00,0x04,0x78,0x90,0x20,0x38,0xE6,0xA8,0xF4,0x94,0x88,0xF0,0x50,0x52,0x4A,0x84, + /* 0xADEA [?] [1202]*/ + 0x00,0x10,0x10,0x12,0x2D,0x20,0x3E,0x50,0x10,0x7E,0x10,0x13,0x14,0x18,0x01,0x02, + 0x00,0x08,0x88,0x88,0xFC,0x88,0x78,0x88,0x88,0xF8,0x88,0x74,0x48,0x84,0x02,0x00, + /* 0xADEB [?] [1203]*/ + 0x00,0x00,0x11,0x22,0x3E,0x42,0x4F,0x32,0x12,0x1D,0x32,0x12,0x1A,0x12,0x15,0x00, + 0x00,0x00,0x72,0xDE,0x52,0x52,0xDE,0x52,0x52,0xDE,0x52,0x52,0x52,0x62,0xEE,0x00, + /* 0xADEC [?] [1204]*/ + 0x00,0x10,0x10,0x17,0x29,0x21,0x7D,0x10,0x10,0x3C,0x10,0x11,0x14,0x18,0x10,0x00, + 0x00,0x40,0x20,0xFE,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x20,0xFE,0x20,0x20,0xE0,0x00, + /* 0xADED [?] [1205]*/ + 0x00,0x20,0x22,0x29,0x31,0x45,0x7B,0x21,0x22,0x7A,0x26,0x22,0x22,0x39,0x02,0x00, + 0x00,0x08,0x10,0x10,0x7E,0x50,0x50,0x50,0x6C,0x64,0xA8,0x98,0x98,0x24,0x47,0x80, + /* 0xADEE [?] [1206]*/ + 0x00,0x10,0x10,0x2C,0x28,0x2A,0xFF,0x2A,0x3E,0x2A,0x2A,0x36,0x00,0x3C,0x40,0x00, + 0x00,0x40,0x40,0x40,0xBC,0x84,0x54,0xBC,0x94,0x94,0x94,0x74,0x04,0x04,0x1C,0x00, + /* 0xADEF [?] [1207]*/ + 0x00,0x10,0x10,0x2C,0x29,0x73,0x5E,0x52,0x7E,0x52,0x52,0x2E,0x00,0x3C,0x40,0x00, + 0x00,0x20,0x10,0x22,0xDC,0x00,0x40,0x44,0x4C,0x50,0x60,0x40,0x44,0x44,0x3C,0x00, + /* 0xADF0 [?] [1208]*/ + 0x00,0x00,0x39,0x29,0x29,0x28,0x38,0x29,0x2A,0x38,0x2B,0x29,0x48,0x48,0x58,0x07, + 0x00,0x00,0x4C,0x48,0x50,0xEC,0xD0,0x4C,0x46,0x40,0xFE,0x10,0xD0,0x38,0xC4,0x00, + /* 0xADF1 [?] [1209]*/ + 0x00,0x10,0x08,0x09,0x22,0x2D,0x2A,0x2D,0x22,0x21,0x27,0x25,0x29,0x31,0x20,0x00, + 0x00,0x00,0x04,0xFC,0x04,0xC4,0x44,0xC4,0x44,0x24,0xC4,0x64,0x24,0x04,0x1C,0x08, + /* 0xADF2 [?] [1210]*/ + 0x00,0x10,0x10,0x10,0x14,0x14,0x5B,0x52,0x10,0x11,0x10,0x1C,0x25,0x22,0x4C,0x00, + 0x00,0x10,0x90,0x96,0xF8,0x90,0x6E,0x20,0x40,0xFE,0x60,0xB0,0x28,0x26,0x20,0x20, + /* 0xADF3 [?] [1211]*/ + 0x00,0x00,0x18,0x00,0x04,0x38,0x08,0x17,0x19,0x79,0x15,0x13,0x11,0x10,0x11,0x02, + 0x00,0x20,0x24,0xF8,0x20,0xF8,0x26,0xDC,0x24,0x24,0x24,0x24,0x48,0x48,0x86,0x00, + /* 0xADF4 [?] [1212]*/ + 0x00,0x00,0x3E,0x12,0x13,0x3E,0x12,0x7E,0x10,0x32,0x2E,0x62,0x22,0x1E,0x00,0x01, + 0x00,0x02,0xFC,0x20,0x20,0xDC,0x84,0x94,0x94,0x94,0x94,0x10,0x28,0x26,0xC2,0x00, + /* 0xADF5 [?] [1213]*/ + 0x00,0x00,0x05,0x39,0x29,0x29,0x29,0x29,0x29,0x16,0x0E,0x76,0x0A,0x0A,0x1D,0x00, + 0x00,0x00,0xFE,0x10,0x20,0xDC,0x84,0xFC,0x84,0x7C,0x10,0x5C,0x76,0x92,0x70,0x20, + /* 0xADF6 [?] [1214]*/ + 0x00,0x00,0x04,0x39,0x28,0x28,0x28,0x29,0x28,0x15,0x0C,0x74,0x08,0x08,0x19,0x06, + 0x00,0x04,0xFC,0x24,0xA8,0x30,0x48,0xF0,0x48,0xFC,0x24,0x46,0xF8,0x90,0x0C,0x00, + /* 0xADF7 [?] [1215]*/ + 0x00,0x00,0x10,0x11,0x12,0x16,0x3A,0x12,0x12,0x12,0x16,0x1A,0x62,0x05,0x04,0x00, + 0x00,0x20,0x20,0xFE,0x20,0x78,0x2A,0x7C,0x28,0x30,0xF6,0x68,0xA8,0x24,0xE0,0x00, + /* 0xADF8 [?] [1216]*/ + 0x00,0x00,0x11,0x11,0x11,0x14,0x3B,0x10,0x10,0x11,0x1E,0x11,0x60,0x01,0x00,0x03, + 0x00,0x00,0xFC,0x4C,0x4C,0xDC,0x20,0x60,0x98,0x26,0x40,0x90,0x64,0x98,0x60,0x80, + /* 0xADF9 [?] [1217]*/ + 0x00,0x08,0x11,0x10,0x14,0x3B,0x12,0x1D,0x35,0x31,0x50,0x50,0x10,0x10,0x11,0x06, + 0x00,0x20,0x20,0xA8,0xB0,0x4E,0x08,0xF8,0x08,0x08,0xF8,0x60,0xA0,0xA2,0x12,0x0C, + /* 0xADFA [?] [1218]*/ + 0x00,0x00,0x43,0x7C,0x52,0x52,0x5E,0x5E,0x48,0x76,0x54,0x4D,0x4A,0x72,0x7F,0x00, + 0x00,0x20,0x20,0xDC,0xA4,0x94,0x88,0x98,0x90,0xEE,0x02,0xFC,0x04,0x04,0x0C,0x00, + /* 0xADFB [?] [1219]*/ + 0x00,0x00,0x0C,0x33,0x20,0x20,0x39,0x2A,0x69,0xA8,0xA8,0x2B,0x30,0x20,0x00,0x01, + 0x00,0x20,0x20,0xFE,0x50,0x88,0x46,0xB8,0x10,0x30,0xD2,0x2E,0xE4,0x08,0x30,0xC0, + /* 0xADFC [?] [1220]*/ + 0x00,0x00,0x06,0x3A,0x22,0x22,0x3C,0x28,0x29,0x69,0xA9,0x29,0x30,0x20,0x01,0x06, + 0x00,0x50,0x90,0xA4,0xB8,0xC8,0x84,0x80,0x7C,0x28,0x48,0x50,0x62,0xA2,0x12,0x0C, + /* 0xADFD [?] [1221]*/ + 0x00,0x00,0x07,0x3A,0x22,0x21,0x3C,0x28,0x28,0x69,0xA8,0x28,0x30,0x20,0x00,0x00, + 0x00,0x40,0xDC,0x54,0x54,0xD8,0x00,0xF8,0x02,0xFC,0x84,0x7C,0x04,0x08,0x38,0x00, + /* 0xADFE [?] [1222]*/ + 0x00,0x04,0x04,0x15,0x26,0x24,0x25,0x7A,0x02,0x05,0x1B,0x29,0x0F,0x08,0x1F,0x00, + 0x00,0x60,0x44,0x48,0xF0,0x40,0xC2,0x3E,0x20,0xC0,0x38,0x10,0xF0,0x00,0xFE,0x00, + /* 0xAEA1 [?] [1223]*/ + 0x00,0x00,0x1F,0x10,0x1F,0x0F,0x18,0x08,0x13,0x3C,0x0A,0x11,0x1F,0x24,0x22,0x40, + 0x00,0x00,0xF0,0x10,0xF0,0xF0,0x20,0x20,0x4C,0xF0,0x20,0x48,0xF4,0x88,0x44,0x00, + /* 0xAEA2 [?] [1224]*/ + 0x00,0x10,0x30,0x28,0x37,0x40,0x78,0x20,0x21,0x76,0x20,0x21,0x29,0x31,0x01,0x00, + 0x00,0x10,0x90,0x96,0xF8,0x60,0x60,0x90,0x1E,0xE2,0x08,0xF8,0x08,0x08,0xF8,0x00, + /* 0xAEA3 [?] [1225]*/ + 0x00,0x10,0x10,0x25,0x39,0x21,0x7D,0x11,0x12,0x7E,0x11,0x11,0x15,0x1A,0x14,0x00, + 0x00,0x20,0x40,0xFC,0x08,0xF8,0x08,0x08,0xF0,0xE4,0xD8,0x50,0x48,0x46,0xC0,0x40, + /* 0xAEA4 [?] [1226]*/ + 0x00,0x10,0x10,0x25,0x39,0x22,0x7D,0x13,0x11,0x7D,0x13,0x11,0x15,0x19,0x11,0x00, + 0x00,0x00,0xBC,0x08,0x0A,0x74,0x20,0x3C,0x50,0x90,0xFC,0x18,0x28,0x24,0x42,0x80, + /* 0xAEA5 [?] [1227]*/ + 0x00,0x10,0x11,0x2E,0x45,0x06,0x0F,0x01,0x1E,0x04,0x09,0x72,0x1D,0x06,0x09,0x1E, + 0x00,0x60,0x46,0xB8,0x04,0x20,0xF0,0x00,0xF8,0x40,0xBC,0x40,0x80,0x30,0xC0,0x00, + /* 0xAEA6 [?] [1228]*/ + 0x00,0x0C,0x0A,0x11,0x21,0xDE,0x3F,0x1A,0x29,0x49,0x09,0x01,0x1F,0x01,0x3F,0x00, + 0x00,0x08,0x48,0x28,0x08,0x68,0x4A,0x3C,0x08,0x08,0x08,0x08,0xF0,0x00,0xFE,0x00, + /* 0xAEA7 [?] [1229]*/ + 0x00,0x00,0x7D,0x49,0x48,0x48,0x79,0x49,0x4F,0x79,0x49,0x49,0x49,0x48,0x88,0x07, + 0x00,0x28,0x28,0x50,0xE8,0x46,0xB8,0x06,0xF8,0x28,0x48,0x48,0x48,0x48,0x86,0x02, + /* 0xAEA8 [?] [1230]*/ + 0x00,0x10,0x20,0x39,0x52,0x7E,0x5A,0x5A,0x7A,0x5A,0x5A,0x22,0x05,0x79,0x02,0x04, + 0x00,0x80,0x80,0x9C,0x90,0x92,0xFC,0xD4,0xD4,0xD4,0xD4,0xD4,0x10,0x10,0x10,0x00, + /* 0xAEA9 [?] [1231]*/ + 0x00,0x10,0x10,0x2C,0x28,0x2B,0xFE,0x2A,0x3E,0x2A,0x2B,0x36,0x00,0x3C,0x01,0x02, + 0x00,0x00,0x50,0x50,0x52,0xD4,0xC8,0x50,0x58,0xD6,0x52,0x50,0x52,0x92,0x0E,0x00, + /* 0xAEAA [?] [1232]*/ + 0x00,0x10,0x10,0x2C,0x28,0x2A,0xFF,0x2A,0x3E,0x2A,0x2A,0x36,0x00,0x3D,0x01,0x02, + 0x00,0x20,0x20,0x5C,0x90,0xD2,0xAC,0xA4,0xBC,0xA4,0xA4,0xA4,0xA0,0x22,0x3E,0x00, + /* 0xAEAB [?] [1233]*/ + 0x00,0x10,0x10,0x2C,0x28,0x2B,0xFE,0x2A,0x3E,0x2A,0x2A,0x36,0x00,0x3C,0x00,0x03, + 0x00,0x20,0x10,0xA2,0xDE,0x24,0x20,0x42,0x7C,0x48,0x88,0x70,0x18,0x26,0xC2,0x00, + /* 0xAEAC [?] [1234]*/ + 0x00,0x2A,0x11,0x72,0x1D,0x6A,0x11,0x20,0x01,0x0E,0x09,0x09,0x0F,0x00,0x1F,0x00, + 0x00,0x20,0x24,0x22,0xFC,0x28,0xC4,0x82,0x00,0xF0,0x20,0x20,0xFC,0x24,0xC8,0x18, + /* 0xAEAD [?] [1235]*/ + 0x00,0x20,0x10,0x13,0x7E,0x21,0x21,0x3D,0x25,0x25,0x25,0x24,0x44,0x48,0x98,0x00, + 0x00,0x28,0x2C,0xF0,0x24,0xFC,0x24,0xFC,0x24,0xFC,0x0A,0xFC,0x48,0x48,0x38,0x00, + /* 0xAEAE [?] [1236]*/ + 0x00,0x20,0x10,0x21,0x1E,0x0D,0x12,0x32,0x1B,0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08, + 0x00,0x40,0xC0,0x30,0x1E,0xE0,0x18,0x08,0xF8,0x20,0xFC,0x20,0xE0,0x20,0xE0,0x00, + /* 0xAEAF [?] [1237]*/ + 0x00,0x08,0x04,0x3B,0x3E,0x22,0x3C,0x22,0x3F,0x03,0x01,0x3F,0x02,0x0C,0x30,0x00, + 0x00,0x00,0x04,0xF8,0x78,0x88,0x78,0x88,0x88,0x00,0x02,0xFC,0xA0,0x98,0x84,0x00, + /* 0xAEB0 [?] [1238]*/ + 0x00,0x00,0x10,0x17,0x02,0x03,0x72,0x13,0x12,0x10,0x13,0x1C,0x15,0x15,0x0D,0x00, + 0x00,0x00,0x40,0xF8,0x40,0xFC,0x48,0xF8,0x48,0x48,0xF6,0x82,0x6E,0x0A,0xFA,0x00, + /* 0xAEB1 [?] [1239]*/ + 0x00,0x00,0x18,0x11,0x26,0x44,0x48,0x79,0x11,0x21,0x79,0x01,0x01,0x78,0x01,0x06, + 0x00,0x00,0x20,0xFE,0x04,0x04,0xF8,0x24,0xF8,0x28,0xF8,0x28,0xD8,0x8C,0x02,0x02, + /* 0xAEB2 [?] [1240]*/ + 0x00,0x00,0x00,0x7C,0x13,0x11,0x10,0x14,0x39,0x10,0x13,0x10,0x18,0x60,0x00,0x00, + 0x00,0x04,0xF8,0x22,0xFC,0xAC,0x20,0x20,0xFC,0x02,0xFC,0x84,0x7C,0x08,0x38,0x10, + /* 0xAEB3 [?] [1241]*/ + 0x00,0x00,0x20,0x20,0x27,0x78,0x68,0x69,0x6A,0x78,0x61,0x29,0x2D,0x54,0x00,0x00, + 0x00,0x28,0xA8,0xA8,0xFC,0xA8,0xA8,0xFE,0x24,0x24,0xFC,0x24,0x24,0x2C,0x20,0x20, + /* 0xAEB4 [?] [1242]*/ + 0x00,0x00,0x01,0x21,0x1E,0x08,0x08,0x77,0x3F,0x22,0x3E,0x2A,0x29,0x48,0x09,0x00, + 0x00,0x80,0x04,0x08,0xF0,0x20,0x48,0x48,0xFE,0x50,0x50,0x50,0x90,0x92,0x1E,0x00, + /* 0xAEB5 [?] [1243]*/ + 0x00,0x00,0x10,0x10,0x3D,0x22,0x44,0xB8,0x10,0x14,0x39,0x11,0x11,0x1E,0x11,0x00, + 0x00,0x10,0xD0,0x90,0x28,0x44,0x88,0xF8,0x44,0xCC,0x54,0x54,0xCC,0x74,0xDC,0x00, + /* 0xAEB6 [?] [1244]*/ + 0x00,0x10,0x10,0x3C,0x28,0x53,0xFD,0x55,0x3D,0x54,0x54,0x28,0x00,0x3C,0x41,0x02, + 0x00,0x00,0x40,0x88,0xF0,0x10,0xEE,0x24,0x24,0xFC,0x30,0x50,0x52,0x92,0x1E,0x00, + /* 0xAEB7 [?] [1245]*/ + 0x00,0x10,0x10,0x1C,0x28,0x2B,0x7E,0x2A,0x3E,0x2B,0x2B,0x36,0x00,0x1C,0x21,0x00, + 0x00,0x00,0x40,0x44,0xF8,0x50,0x30,0x28,0xE4,0x10,0xFE,0x20,0x6C,0xA2,0x20,0x00, + /* 0xAEB8 [?] [1246]*/ + 0x00,0x04,0x37,0x15,0x04,0x4C,0x34,0x34,0x16,0x16,0x25,0x24,0x29,0x29,0x2A,0x10, + 0x00,0x02,0xFC,0x48,0xD0,0xAE,0xD0,0xE8,0xC8,0xC8,0x98,0x98,0x18,0x24,0x46,0x00, + /* 0xAEB9 [?] [1247]*/ + 0x00,0x01,0x3F,0x44,0x3F,0x24,0x3F,0x09,0x3E,0x09,0x09,0x08,0x17,0x7F,0x00,0x00, + 0x00,0x00,0xFE,0x4C,0xF0,0x40,0xF8,0x10,0xFE,0x20,0x60,0x04,0xFC,0xE4,0x38,0x00, + /* 0xAEBA [?] [1248]*/ + 0x00,0x00,0x10,0x0F,0x00,0x3C,0x0B,0x0A,0x1A,0x36,0x52,0x12,0x12,0x12,0x12,0x10, + 0x00,0x40,0x20,0xFE,0x90,0xAC,0xD4,0x44,0x7C,0x54,0xB4,0x94,0xF4,0x04,0x1C,0x00, + /* 0xAEBB [?] [1249]*/ + 0x00,0x00,0x13,0x12,0x02,0x01,0x12,0x32,0x11,0x11,0x11,0x10,0x19,0x1E,0x10,0x00, + 0x00,0x00,0xFC,0x94,0x94,0x6C,0x90,0x00,0xF8,0x08,0xFA,0xA4,0x98,0xAC,0xC4,0x80, + /* 0xAEBC [?] [1250]*/ + 0x00,0x10,0x10,0x21,0x21,0x3E,0x2A,0x2D,0x48,0x49,0x4A,0x30,0x18,0x22,0x42,0x80, + 0x00,0x00,0x88,0x34,0xF2,0xB0,0xFC,0x58,0x98,0x24,0x42,0x80,0x94,0x5A,0x40,0x00, + /* 0xAEBD [?] [1251]*/ + 0x00,0x00,0x78,0x48,0x49,0x48,0x48,0x4B,0x7C,0x09,0x19,0x6B,0x08,0x09,0x12,0x04, + 0x00,0x20,0xA4,0xA8,0xFE,0x70,0xAC,0x20,0x80,0xDE,0x78,0x68,0x9E,0x08,0x08,0x00, + /* 0xAEBE [?] [1252]*/ + 0x00,0x00,0x04,0x3B,0x10,0x11,0x11,0x39,0x11,0x10,0x11,0x1F,0x61,0x01,0x00,0x00, + 0x00,0x48,0x92,0xEC,0x84,0x7C,0x84,0x04,0xF8,0xFE,0x22,0x32,0xCA,0x1A,0xFC,0x00, + /* 0xAEBF [?] [1253]*/ + 0x00,0x00,0x07,0x3A,0x13,0x13,0x11,0x3A,0x10,0x11,0x11,0x19,0x61,0x01,0x01,0x01, + 0x00,0x00,0xFE,0x98,0x28,0xDC,0x98,0xF6,0x20,0x0C,0xF8,0x08,0xF8,0x08,0xF8,0x00, + /* 0xAEC0 [?] [1254]*/ + 0x00,0x00,0x0D,0x33,0x24,0x24,0x2C,0x35,0x25,0x25,0x24,0x2A,0x73,0x02,0x02,0x00, + 0x00,0x00,0x7E,0x44,0x4C,0xF4,0x4C,0xFC,0x6C,0x4C,0xF4,0xCC,0x4C,0x04,0x0C,0x00, + /* 0xAEC1 [?] [1255]*/ + 0x00,0x00,0x03,0x39,0x12,0x12,0x12,0x7E,0x12,0x12,0x12,0x1E,0x65,0x04,0x08,0x01, + 0x00,0x00,0xFC,0xFC,0x08,0x78,0x12,0x7C,0x20,0x22,0x44,0x48,0xBC,0x88,0x98,0x80, + /* 0xAEC2 [?] [1256]*/ + 0x00,0x00,0x07,0x3A,0x13,0x12,0x11,0x38,0x10,0x11,0x10,0x18,0x61,0x00,0x03,0x04, + 0x00,0x40,0xFC,0x64,0xBC,0x12,0xDE,0x90,0x90,0xFC,0x90,0x90,0x6C,0xC4,0x02,0x00, + /* 0xAEC3 [?] [1257]*/ + 0x00,0x04,0x04,0x3F,0x0C,0x08,0x3A,0x2C,0x2A,0x1D,0x2A,0x2B,0x4C,0x08,0x30,0x43, + 0x00,0x20,0x46,0xF8,0x44,0xB8,0xC4,0xBC,0x84,0xB4,0xA4,0xA4,0xB4,0x4C,0x82,0x02, + /* 0xAEC4 [?] [1258]*/ + 0x00,0x09,0x12,0x0F,0x01,0x3F,0x21,0x1F,0x3F,0x52,0x3F,0x3F,0x11,0x0F,0x08,0x30, + 0x00,0x00,0xE4,0x3C,0x24,0x28,0x28,0x30,0xE8,0xA4,0xA2,0xA2,0x3E,0x24,0xA0,0x20, + /* 0xAEC5 [?] [1259]*/ + 0x00,0x10,0x10,0x22,0x31,0x20,0x50,0x54,0x7B,0x12,0x12,0x3E,0x51,0x16,0x10,0x00, + 0x00,0x00,0x44,0x28,0x12,0x2C,0x66,0x98,0x30,0x5C,0x2A,0x48,0xB0,0xA0,0x7E,0x00, + /* 0xAEC6 [?] [1260]*/ + 0x00,0x08,0x08,0x28,0x2C,0x28,0x7E,0x10,0x4B,0x52,0x5A,0x66,0x62,0x42,0x5E,0x20, + 0x00,0x20,0x20,0xFC,0x20,0x58,0x88,0x02,0xFC,0x78,0x98,0x98,0x78,0x08,0x08,0x08, + /* 0xAEC7 [?] [1261]*/ + 0x00,0x08,0x08,0x28,0x2C,0x28,0x2B,0x14,0x48,0x52,0x5A,0x5A,0x66,0x62,0x4E,0x71, + 0x00,0x20,0x44,0x84,0x84,0x84,0xC4,0x84,0x84,0xF8,0x50,0x50,0x52,0x52,0x8E,0x00, + /* 0xAEC8 [?] [1262]*/ + 0x00,0x01,0x01,0x78,0x57,0x52,0x53,0x70,0x53,0x52,0x53,0x72,0x43,0x02,0x02,0x00, + 0x00,0x08,0x08,0x50,0x90,0x6C,0xF4,0x54,0x94,0x98,0x98,0x88,0x88,0x94,0xA2,0x40, + /* 0xAEC9 [?] [1263]*/ + 0x00,0x01,0x21,0x21,0x22,0x7A,0x6E,0x6A,0x6A,0x6A,0x32,0x32,0x2A,0x72,0x02,0x02, + 0x00,0x10,0x22,0x7C,0x54,0x88,0xB6,0xC2,0xBC,0xA4,0xBC,0xA4,0xBC,0x24,0x2C,0x00, + /* 0xAECA [?] [1264]*/ + 0x00,0x10,0x10,0x11,0x55,0x7D,0x55,0x55,0x55,0x7D,0x59,0x16,0x3B,0x42,0x04,0x00, + 0x00,0x40,0x24,0xDC,0x04,0xFC,0x00,0xFE,0x24,0xBC,0xA4,0xEC,0x34,0x24,0x6C,0x00, + /* 0xAECB [?] [1265]*/ + 0x00,0x10,0x10,0x13,0x56,0x57,0x56,0x54,0x55,0x54,0x57,0x5C,0x67,0x00,0x03,0x00, + 0x00,0x00,0x92,0xEC,0x80,0x7E,0x0C,0x74,0xE8,0xCC,0x70,0xB8,0x58,0x94,0x70,0x20, + /* 0xAECC [?] [1266]*/ + 0x00,0x00,0x20,0x21,0x23,0x69,0x6E,0x6D,0x6F,0x6D,0x6D,0x5D,0x05,0x04,0x04,0x00, + 0x00,0x00,0x88,0x2E,0xCA,0x0A,0xFC,0xC8,0x4C,0x4C,0x54,0xD4,0x54,0x62,0x62,0x00, + /* 0xAECD [?] [1267]*/ + 0x00,0x10,0x10,0x27,0x38,0x21,0x7C,0x13,0x10,0x7D,0x12,0x10,0x14,0x18,0x13,0x00, + 0x00,0x88,0x88,0xDE,0x88,0xDC,0x88,0xDE,0xA8,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00, + /* 0xAECE [?] [1268]*/ + 0x00,0x10,0x10,0x25,0x38,0x20,0x7F,0x11,0x11,0x7D,0x11,0x11,0x15,0x19,0x12,0x04, + 0x00,0x90,0x90,0xFC,0x90,0x96,0x68,0x24,0xFC,0xFC,0x24,0x24,0xD8,0x84,0x02,0x00, + /* 0xAECF [?] [1269]*/ + 0x00,0x00,0x31,0x2B,0x37,0x41,0x7B,0x25,0x25,0x7D,0x27,0x27,0x2D,0x15,0x04,0x04, + 0x00,0x10,0x10,0x70,0x50,0xAC,0xF4,0x74,0xD4,0xD8,0x48,0x48,0x58,0x54,0xE2,0x00, + /* 0xAED0 [?] [1270]*/ + 0x00,0x18,0x11,0x2F,0x44,0x3F,0x08,0x0F,0x08,0x07,0x38,0x22,0x27,0x21,0x20,0x00, + 0x00,0x40,0x42,0xBC,0x10,0xFC,0x10,0xF0,0x10,0xE0,0x18,0x48,0xF8,0x08,0x38,0x00, + /* 0xAED1 [?] [1271]*/ + 0x00,0x00,0x10,0x20,0x27,0x3D,0x49,0x11,0x11,0x11,0x10,0x10,0x14,0x18,0x11,0x00, + 0x00,0x00,0x20,0x02,0xFC,0x04,0x74,0x54,0x24,0xDC,0xA4,0x88,0xF8,0x80,0xFE,0x00, + /* 0xAED2 [?] [1272]*/ + 0x00,0x10,0x0A,0x14,0x1A,0x12,0x2A,0x4F,0x08,0x09,0x09,0x0F,0x00,0x1F,0x00,0x00, + 0x00,0x40,0xB8,0x40,0xB8,0x70,0x48,0x84,0x70,0x50,0x20,0xFC,0x28,0xD8,0x38,0x00, + /* 0xAED3 [?] [1273]*/ + 0x00,0x20,0x21,0x23,0x10,0x28,0x68,0x67,0x20,0x23,0x22,0x23,0x22,0x22,0x22,0x01, + 0x00,0x00,0x10,0xFC,0x30,0x4C,0xF0,0xFE,0xC8,0x1C,0xE8,0xB4,0xA4,0xA4,0xA6,0x58, + /* 0xAED4 [?] [1274]*/ + 0x00,0x00,0x10,0x21,0x20,0x44,0x7B,0x10,0x21,0x29,0x11,0x01,0x18,0x62,0x00,0x00, + 0x00,0x00,0x20,0xFE,0x90,0x92,0x6C,0xFC,0x08,0xF8,0x00,0x20,0x82,0x82,0xF8,0x00, + /* 0xAED5 [?] [1275]*/ + 0x00,0x00,0x08,0x31,0x23,0x21,0x26,0x7D,0x27,0x25,0x25,0x25,0x3D,0x44,0x04,0x00, + 0x00,0x00,0x88,0x2E,0xCA,0x0A,0xFC,0xC8,0x4C,0x4C,0x54,0xD4,0x54,0x62,0x62,0x00, + /* 0xAED6 [?] [1276]*/ + 0x00,0x00,0x03,0x3E,0x22,0x23,0x21,0x2A,0x32,0x27,0x22,0x21,0x28,0x53,0x00,0x00, + 0x00,0x00,0xFC,0xA4,0xA4,0x5C,0x04,0xFA,0x52,0xF4,0x54,0xF4,0x54,0xAC,0x1C,0x00, + /* 0xAED7 [?] [1277]*/ + 0x00,0x10,0x10,0x27,0x38,0x21,0x44,0x39,0x10,0x14,0x38,0x11,0x15,0x19,0x11,0x00, + 0x00,0x20,0x20,0xFE,0x24,0xD8,0xFC,0x08,0xF8,0x48,0x50,0xAC,0x54,0x08,0x08,0xF0, + /* 0xAED8 [?] [1278]*/ + 0x00,0x10,0x10,0x25,0x39,0x21,0x45,0x38,0x10,0x14,0x38,0x10,0x14,0x1A,0x12,0x00, + 0x00,0x00,0xFE,0xAC,0x6C,0x54,0x24,0xFC,0x24,0xF8,0x20,0xDC,0x94,0x5A,0x4A,0x00, + /* 0xAED9 [?] [1279]*/ + 0x00,0x10,0x11,0x25,0x38,0x20,0x4F,0x30,0x11,0x1F,0x31,0x11,0x15,0x19,0x11,0x00, + 0x00,0x00,0xFC,0x24,0xA8,0x32,0xFC,0xA8,0x26,0x04,0xFC,0x24,0xFC,0x24,0xDC,0x00, + /* 0xAEDA [?] [1280]*/ + 0x00,0x10,0x10,0x24,0x39,0x20,0x4C,0x33,0x11,0x1D,0x33,0x11,0x14,0x19,0x12,0x04, + 0x00,0x20,0xAC,0xB0,0xFC,0x70,0xAE,0x28,0x88,0xDE,0x58,0x68,0xBC,0x08,0x08,0x00, + /* 0xAEDB [?] [1281]*/ + 0x00,0x10,0x10,0x24,0x3B,0x21,0x4D,0x31,0x11,0x1D,0x31,0x10,0x17,0x18,0x10,0x00, + 0x00,0x88,0x90,0x26,0xF8,0x64,0x54,0x9C,0x04,0xFC,0x08,0x0A,0xFC,0x08,0x38,0x00, + /* 0xAEDC [?] [1282]*/ + 0x00,0x00,0x30,0x2B,0x31,0x40,0x78,0x27,0x22,0x7E,0x22,0x22,0x2B,0x13,0x04,0x00, + 0x00,0x00,0x4C,0x30,0x16,0x28,0x22,0xD4,0x28,0x58,0x2E,0x4A,0x88,0x10,0xFE,0x00, + /* 0xAEDD [?] [1283]*/ + 0x00,0x10,0x10,0x24,0x39,0x20,0x4C,0x33,0x11,0x1D,0x31,0x11,0x15,0x19,0x11,0x00, + 0x00,0x04,0xF8,0x20,0xFE,0x64,0xA0,0x60,0xBE,0x4C,0xD4,0x74,0x54,0x24,0x0C,0x04, + /* 0xAEDE [?] [1284]*/ + 0x00,0x00,0x1E,0x2A,0x1A,0x05,0x3E,0x2B,0x2A,0x7F,0x2A,0x2A,0x3E,0x2A,0x34,0x00, + 0x00,0x10,0x20,0x7C,0xA4,0x94,0x84,0x88,0x80,0x7E,0x02,0x0A,0x72,0x02,0x1C,0x00, + /* 0xAEDF [?] [1285]*/ + 0x00,0x10,0x1C,0x24,0x28,0x36,0x7D,0x35,0x3D,0x34,0x35,0x2D,0x02,0x7C,0x00,0x00, + 0x00,0x00,0x84,0xA4,0xDC,0xAC,0xEC,0xAC,0xAC,0xEC,0x4C,0xAC,0x84,0x84,0x8C,0x00, + /* 0xAEE0 [?] [1286]*/ + 0x00,0x10,0x14,0x2D,0x28,0x73,0x5F,0x53,0x7F,0x53,0x53,0x2E,0x00,0x3F,0x02,0x00, + 0x00,0x20,0x20,0xFE,0x20,0x26,0xFC,0x6C,0xB4,0xFC,0x70,0x70,0xA8,0x26,0x20,0x20, + /* 0xAEE1 [?] [1287]*/ + 0x00,0x10,0x14,0x2D,0x29,0x73,0x5F,0x52,0x7E,0x52,0x53,0x2E,0x00,0x3C,0x00,0x03, + 0x00,0x20,0x60,0xAC,0x24,0xA4,0x24,0xFC,0x20,0x24,0xDC,0x48,0x30,0x70,0x8E,0x00, + /* 0xAEE2 [?] [1288]*/ + 0x00,0x10,0x25,0x3D,0x49,0x7F,0x55,0x55,0x7D,0x55,0x7D,0x55,0x56,0x97,0x0F,0x00, + 0x00,0x04,0x78,0x90,0x14,0x18,0xE6,0x94,0xFC,0x96,0xA8,0xB8,0xA8,0x28,0x4A,0x04, + /* 0xAEE3 [?] [1289]*/ + 0x00,0x00,0x3F,0x3E,0x22,0x3E,0x22,0x3E,0x27,0x08,0x11,0x7F,0x11,0x0E,0x3F,0x00, + 0x00,0x00,0xF8,0x80,0xA4,0x78,0x32,0x52,0xCE,0x40,0x88,0x78,0x88,0x78,0xFE,0x00, + /* 0xAEE4 [?] [1290]*/ + 0x00,0x00,0x11,0x12,0x27,0x4A,0x78,0x10,0x20,0x48,0x71,0x05,0x19,0x61,0x01,0x00, + 0x00,0x04,0xF8,0x20,0xFE,0x20,0x20,0x20,0x02,0xFC,0xFE,0x54,0x54,0x54,0x14,0x0C, + /* 0xAEE5 [?] [1291]*/ + 0x00,0x00,0x10,0x10,0x27,0x49,0x31,0x11,0x21,0x48,0x31,0x00,0x1F,0x60,0x02,0x00, + 0x00,0x00,0xF8,0x20,0xFC,0xFC,0xAC,0xB4,0xFC,0x24,0xF8,0x26,0xD8,0x72,0x52,0x00, + /* 0xAEE6 [?] [1292]*/ + 0x00,0x01,0x01,0x0F,0x31,0x10,0x11,0x1E,0x31,0x16,0x18,0x15,0x39,0x41,0x06,0x00, + 0x00,0x08,0x14,0xF8,0x10,0xF0,0x12,0xFC,0x48,0xB6,0x40,0xF8,0x40,0x4C,0xC4,0x40, + /* 0xAEE7 [?] [1293]*/ + 0x00,0x01,0x1E,0x11,0x1F,0x28,0x31,0x2E,0x1F,0x10,0x08,0x77,0x05,0x09,0x31,0x00, + 0x00,0x08,0x30,0xCC,0x30,0xC6,0x78,0x38,0xD0,0x90,0xA0,0xDC,0x20,0x18,0x06,0x00, + /* 0xAEE8 [?] [1294]*/ + 0x00,0x00,0x04,0x3F,0x02,0x1C,0x24,0x24,0x3C,0x7E,0x66,0x5E,0x52,0x52,0x46,0x40, + 0x00,0x20,0x46,0xB8,0x20,0x20,0xD8,0xA8,0x88,0x8C,0x82,0x7E,0x0A,0x74,0x04,0x0C, + /* 0xAEE9 [?] [1295]*/ + 0x00,0x01,0x21,0x23,0x24,0x78,0x69,0x69,0x6A,0x73,0x20,0x2F,0x2D,0x51,0x06,0x00, + 0x00,0x00,0x10,0x9C,0x22,0x44,0xB8,0x10,0x10,0xFC,0x90,0x10,0x3C,0x00,0xF6,0x08, + /* 0xAEEA [?] [1296]*/ + 0x00,0x00,0x3E,0x2C,0x3C,0x2C,0x53,0x42,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x0F,0x00, + 0x00,0x20,0x20,0xFC,0xA4,0xA4,0xFC,0xA4,0xFC,0x38,0x38,0x5C,0x5A,0x92,0x1E,0x00, + /* 0xAEEB [?] [1297]*/ + 0x00,0x08,0x11,0x2E,0x41,0x01,0x0E,0x02,0x3F,0x0F,0x11,0x1F,0x0F,0x01,0x0F,0x3F, + 0x00,0x60,0x46,0xB8,0x10,0x10,0xE0,0x40,0xFC,0xF0,0x10,0xF0,0xF0,0x18,0xE8,0xFC, + /* 0xAEEC [?] [1298]*/ + 0x00,0x10,0x08,0x34,0x14,0x09,0x36,0x49,0x4A,0x7E,0x3E,0x0A,0x3C,0x0B,0x3C,0x00, + 0x00,0x00,0x00,0x7E,0x24,0xA4,0x6C,0x64,0x24,0x2C,0xF4,0x24,0x24,0x24,0x64,0x00, + /* 0xAEED [?] [1299]*/ + 0x00,0x22,0x12,0x14,0x6B,0x4B,0x5D,0x49,0x37,0x02,0x3E,0x22,0x3E,0x22,0x3E,0x00, + 0x00,0x00,0x00,0x7E,0x24,0xA4,0x6C,0x64,0x24,0x2C,0xF4,0x24,0x24,0x24,0x64,0x00, + /* 0xAEEE [?] [1300]*/ + 0x00,0x10,0x10,0x11,0x21,0x3F,0x25,0x24,0x47,0x48,0x49,0x39,0x15,0x21,0x40,0x80, + 0x00,0x50,0x52,0xFC,0xFC,0x54,0x54,0xAA,0x56,0xFC,0x08,0xF8,0x08,0xF8,0xF8,0x00, + /* 0xAEEF [?] [1301]*/ + 0x00,0x00,0x11,0x11,0x27,0x24,0x78,0x08,0x11,0x21,0x3E,0x00,0x05,0x78,0x01,0x00, + 0x00,0x04,0xFC,0x74,0x24,0xF8,0x2C,0xF2,0x0C,0x56,0x42,0x20,0xFC,0x20,0xFE,0x00, + /* 0xAEF0 [?] [1302]*/ + 0x00,0x00,0x04,0x7F,0x0C,0x14,0x2D,0x55,0x75,0x55,0x27,0x05,0x08,0x08,0x10,0x60, + 0x00,0x04,0x04,0xD4,0x54,0x84,0x44,0xD4,0x54,0x46,0xFC,0x04,0x84,0x84,0x04,0x04, + /* 0xAEF1 [?] [1303]*/ + 0x00,0x10,0x13,0x10,0x7B,0x11,0x12,0x3C,0x30,0x50,0x53,0x14,0x10,0x13,0x10,0x00, + 0x00,0x40,0x90,0x9E,0xEA,0xCA,0xD2,0xEE,0x60,0xB8,0x26,0xF8,0x70,0xAC,0xE0,0x00, + /* 0xAEF2 [?] [1304]*/ + 0x00,0x00,0x10,0x10,0x13,0x7C,0x58,0x58,0x58,0x59,0x79,0x19,0x15,0x7D,0x01,0x00, + 0x00,0x00,0xF8,0x22,0xFC,0x20,0x20,0x20,0x04,0xFC,0x24,0xFC,0x24,0x24,0xDC,0x00, + /* 0xAEF3 [?] [1305]*/ + 0x00,0x2A,0x3B,0x2A,0x2A,0x3B,0x2A,0x14,0x14,0x2F,0x5F,0x24,0x1F,0x24,0x3B,0x00, + 0x00,0x80,0xBE,0xA4,0xA4,0xA8,0xA8,0x28,0xA4,0x24,0xA4,0x24,0xBC,0x20,0x20,0x00, + /* 0xAEF4 [?] [1306]*/ + 0x00,0x10,0x1C,0x25,0x28,0x7E,0xB4,0x34,0x3C,0x34,0x34,0x28,0x02,0x7C,0x00,0x00, + 0x00,0x10,0x22,0xFC,0x24,0x58,0xFC,0x84,0xFC,0x48,0x52,0xAC,0xFC,0x84,0xFC,0x00, + /* 0xAEF5 [?] [1307]*/ + 0x00,0x10,0x08,0x3F,0x24,0x19,0x19,0x21,0x41,0x02,0x0C,0x73,0x1F,0x05,0x3F,0x00, + 0x00,0x08,0x34,0xD4,0x78,0xB0,0xC8,0x04,0x04,0x80,0x7E,0x80,0xF8,0x20,0xFE,0x00, + /* 0xAEF6 [?] [1308]*/ + 0x00,0x00,0x10,0x10,0x17,0x19,0x10,0x51,0x11,0x12,0x16,0x2B,0x26,0x23,0x42,0x01, + 0x00,0x00,0xF8,0x42,0xFC,0xD8,0x40,0xC0,0x24,0xF8,0x24,0xF8,0x24,0xF8,0x26,0xD8, + /* 0xAEF7 [?] [1309]*/ + 0x00,0x00,0x10,0x11,0x22,0x4A,0x79,0x10,0x21,0x41,0x78,0x01,0x0C,0x73,0x04,0x00, + 0x00,0x40,0x24,0xD8,0x64,0x64,0xB8,0x94,0xF8,0xFC,0x92,0xEC,0xA8,0x98,0xE6,0x00, + /* 0xAEF8 [?] [1310]*/ + 0x00,0x02,0x02,0x3F,0x26,0x26,0x22,0x2B,0x34,0x28,0x23,0x21,0x10,0x60,0x03,0x04, + 0x00,0x40,0x58,0xAA,0xCC,0xE8,0xA8,0xEE,0xAA,0xD0,0x2C,0x18,0xB0,0x60,0x9C,0x04, + /* 0xAEF9 [?] [1311]*/ + 0x00,0x08,0x10,0x30,0x3F,0x30,0x4F,0x0A,0x52,0x5A,0x5A,0x46,0x42,0x3F,0x01,0x00, + 0x00,0x48,0x88,0x8A,0xFC,0xBC,0xAA,0x08,0x02,0x7C,0xA0,0x9C,0xA0,0x60,0x1E,0x00, + /* 0xAEFA [?] [1312]*/ + 0x00,0x00,0x00,0x79,0x48,0x4B,0x4A,0x79,0x49,0x49,0x4B,0x4D,0x71,0x41,0x01,0x00, + 0x00,0x90,0x90,0xFC,0xA4,0xBC,0xA4,0x98,0x20,0xFC,0x24,0xF8,0x24,0xF8,0xFE,0x00, + /* 0xAEFB [?] [1313]*/ + 0x00,0x00,0x03,0x7A,0x4B,0x4A,0x4A,0x49,0x79,0x49,0x4F,0x4D,0x49,0x71,0x01,0x00, + 0x00,0x00,0xFC,0x64,0xFC,0x64,0x64,0xB8,0x2C,0xF0,0x2C,0xF0,0xFC,0x20,0xFC,0x00, + /* 0xAEFC [?] [1314]*/ + 0x00,0x00,0x03,0x7A,0x4B,0x4A,0x7A,0x49,0x49,0x79,0x4F,0x4D,0x49,0x71,0x01,0x00, + 0x00,0x00,0xFC,0x64,0xFC,0x64,0x64,0xB8,0x2C,0xF0,0x2C,0xF0,0xFC,0x20,0xFC,0x00, + /* 0xAEFD [?] [1315]*/ + 0x00,0x08,0x10,0x10,0x13,0x15,0x49,0x51,0x11,0x11,0x19,0x15,0x13,0x20,0x40,0x00, + 0x00,0x00,0x00,0xFC,0x24,0x24,0x24,0x24,0xD8,0x00,0x00,0x00,0x02,0x82,0x7C,0x00, + /* 0xAEFE [?] [1316]*/ + 0x00,0x00,0x00,0x01,0x49,0x78,0x48,0x48,0x48,0x48,0x49,0x78,0x40,0x40,0x01,0x00, + 0x00,0x20,0x20,0x24,0xA8,0xB0,0x20,0xDC,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x00, + /* 0xAFA1 [?] [1317]*/ + 0x00,0x00,0x00,0x49,0x78,0x48,0x48,0x4B,0x48,0x48,0x78,0x40,0x41,0x03,0x04,0x08, + 0x00,0x00,0x3C,0xC0,0x40,0x40,0x40,0xFC,0x60,0x60,0x90,0x90,0x08,0x0C,0x06,0x00, + /* 0xAFA2 [?] [1318]*/ + 0x00,0x00,0x00,0x1F,0x50,0x30,0x31,0x10,0x31,0x53,0x10,0x10,0x10,0x20,0x40,0x00, + 0x00,0x80,0x80,0x78,0x00,0x08,0xF0,0x80,0x00,0xFC,0x08,0x08,0x10,0x10,0x70,0x00, + /* 0xAFA3 [?] [1319]*/ + 0x00,0x10,0x10,0x10,0x1B,0x1A,0x54,0x51,0x11,0x13,0x15,0x19,0x11,0x11,0x10,0x10, + 0x00,0x20,0x20,0x40,0xFE,0xC4,0xA0,0x24,0xAC,0x10,0x10,0x10,0x08,0x44,0x82,0x00, + /* 0xAFA4 [?] [1320]*/ + 0x00,0x10,0x13,0x22,0x22,0x4F,0x5A,0x72,0x22,0x23,0x73,0x02,0x0E,0x72,0x02,0x00, + 0x00,0x00,0xFE,0x02,0x46,0x66,0x9A,0x8A,0xCA,0x56,0x66,0x22,0x02,0x02,0x06,0x00, + /* 0xAFA5 [?] [1321]*/ + 0x00,0x00,0x10,0x10,0x10,0x11,0x78,0x12,0x12,0x11,0x11,0x19,0x60,0x40,0x07,0x00, + 0x00,0x00,0x88,0x90,0x14,0xF8,0x90,0x96,0x94,0x98,0x98,0x90,0x90,0x90,0xFE,0x00, + /* 0xAFA6 [?] [1322]*/ + 0x00,0x00,0x10,0x10,0x11,0x10,0x7C,0x11,0x11,0x13,0x15,0x15,0x39,0x40,0x00,0x00, + 0x00,0x40,0x40,0x40,0xBC,0xA0,0xA0,0xFE,0x24,0x24,0x24,0x24,0x24,0x24,0x20,0x20, + /* 0xAFA7 [?] [1323]*/ + 0x00,0x00,0x08,0x09,0x16,0x12,0x14,0x2F,0x49,0x08,0x7F,0x08,0x08,0x08,0x08,0x00, + 0x00,0x00,0x04,0xF8,0x40,0x48,0x78,0x48,0x68,0x48,0x48,0x48,0x94,0xB4,0xCE,0x00, + /* 0xAFA8 [?] [1324]*/ + 0x00,0x10,0x10,0x10,0x14,0x78,0x10,0x18,0x34,0x30,0x50,0x51,0x11,0x10,0x10,0x10, + 0x00,0x00,0x50,0x50,0x50,0x52,0xD4,0x48,0x50,0x50,0x50,0xD2,0x52,0x52,0x4C,0x00, + /* 0xAFA9 [?] [1325]*/ + 0x00,0x08,0x10,0x10,0x17,0x38,0x10,0x1D,0x14,0x30,0x50,0x53,0x10,0x10,0x10,0x00, + 0x00,0x20,0x20,0x24,0xF8,0x20,0x20,0xF8,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20, + /* 0xAFAA [?] [1326]*/ + 0x00,0x00,0x00,0x1F,0x50,0x30,0x17,0x10,0x72,0x54,0x15,0x19,0x21,0x22,0x44,0x00, + 0x00,0x80,0x40,0xB8,0x80,0x40,0xBC,0xA0,0xA8,0xA4,0x24,0x20,0x20,0x10,0x60,0x00, + /* 0xAFAB [?] [1327]*/ + 0x00,0x00,0x01,0x7F,0x41,0x7F,0x3F,0x09,0x09,0x2B,0x2C,0x28,0x0E,0x10,0x20,0x43, + 0x00,0x20,0x20,0x40,0x44,0x7C,0x98,0x10,0x30,0x30,0x30,0x30,0x48,0x44,0x86,0x00, + /* 0xAFAC [?] [1328]*/ + 0x00,0x10,0x19,0x09,0x01,0x01,0x71,0x11,0x11,0x11,0x11,0x11,0x29,0x46,0x01,0x00, + 0x00,0x00,0x04,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF0,0x00,0x00,0xFC,0x00, + /* 0xAFAD [?] [1329]*/ + 0x00,0x00,0x04,0x38,0x20,0x21,0x24,0x3F,0x67,0x25,0x24,0x25,0x3F,0x21,0x01,0x01, + 0x00,0x88,0x50,0x56,0xA8,0xFC,0x20,0xDC,0x10,0x20,0xDC,0x18,0x10,0x28,0x46,0x80, + /* 0xAFAE [?] [1330]*/ + 0x00,0x00,0x48,0x78,0x4B,0x48,0x79,0x49,0x4A,0x7A,0x4C,0x48,0x78,0x40,0x03,0x04, + 0x00,0x00,0x40,0x40,0xFC,0x40,0x48,0x24,0xAC,0xD0,0x60,0x50,0x90,0x88,0x06,0x00, + /* 0xAFAF [?] [1331]*/ + 0x00,0x00,0x10,0x10,0x21,0x46,0x48,0x78,0x10,0x21,0x78,0x00,0x04,0x38,0x40,0x00, + 0x00,0x40,0x80,0x84,0x78,0x00,0xA0,0xA4,0xFC,0xA4,0xA4,0xAC,0x82,0x82,0xFE,0x00, + /* 0xAFB0 [?] [1332]*/ + 0x00,0x00,0x11,0x11,0x21,0x46,0x48,0x79,0x11,0x23,0x7D,0x01,0x05,0x39,0x41,0x01, + 0x00,0x00,0x24,0x24,0xD8,0xA0,0xD0,0xFE,0x20,0x26,0xF8,0x24,0xF8,0x20,0xDC,0x00, + /* 0xAFB1 [?] [1333]*/ + 0x00,0x04,0x1E,0x30,0x10,0x11,0x3F,0x10,0x1C,0x37,0x52,0x90,0x10,0x11,0x12,0x04, + 0x00,0x10,0x90,0x90,0x94,0x94,0x98,0x90,0x90,0x9C,0x90,0x90,0x92,0x12,0x1E,0x00, + /* 0xAFB2 [?] [1334]*/ + 0x00,0x00,0x7E,0x08,0x7F,0x14,0x2B,0x48,0x16,0x25,0xEA,0x1C,0x3A,0x49,0x08,0x00, + 0x00,0x00,0x0E,0x30,0xD2,0x4C,0x84,0x10,0x6E,0x42,0x42,0x62,0x42,0x42,0x7E,0x00, + /* 0xAFB3 [?] [1335]*/ + 0x00,0x00,0x10,0x10,0x1B,0x56,0x56,0x51,0x12,0x12,0x12,0x11,0x10,0x11,0x12,0x04, + 0x00,0x10,0xA0,0xA4,0xFC,0xA4,0xA4,0xFC,0xA4,0xA4,0xA4,0x58,0x88,0x04,0x02,0x00, + /* 0xAFB4 [?] [1336]*/ + 0x00,0x08,0x08,0x08,0x10,0x10,0x3F,0x50,0x90,0x10,0x11,0x11,0x12,0x12,0x14,0x18, + 0x00,0x80,0x90,0x88,0x88,0x86,0xF8,0xA4,0xAC,0xA8,0x30,0x22,0x62,0xA2,0x3E,0x00, + /* 0xAFB5 [?] [1337]*/ + 0x00,0x10,0x10,0x24,0x38,0x41,0x7E,0x11,0x12,0x79,0x12,0x12,0x19,0x11,0x11,0x00, + 0x00,0x20,0x60,0x50,0x88,0x14,0xE0,0xE4,0x54,0xD4,0x54,0x54,0xC4,0x44,0xCC,0x00, + /* 0xAFB6 [?] [1338]*/ + 0x00,0x10,0x08,0x02,0x3C,0x24,0x14,0x0B,0x34,0x02,0x7E,0x42,0x42,0x3E,0x05,0x06, + 0x00,0x20,0x20,0x24,0x38,0x20,0x20,0xDC,0x88,0x88,0x50,0x50,0x20,0x50,0x8E,0x00, + /* 0xAFB7 [?] [1339]*/ + 0x00,0x14,0x24,0x3E,0x24,0x25,0x1A,0x3E,0x4A,0x3E,0x4A,0x4A,0x34,0x12,0x62,0x00, + 0x00,0x20,0x10,0xEC,0x84,0xFC,0x84,0x78,0x00,0x7C,0x10,0xFC,0x10,0x10,0x70,0x00, + /* 0xAFB8 [?] [1340]*/ + 0x00,0x10,0x30,0x24,0x38,0x40,0x7C,0x90,0x14,0x7C,0x10,0x10,0x14,0x18,0x11,0x00, + 0x00,0x04,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x8A,0x74,0x00, + /* 0xAFB9 [?] [1341]*/ + 0x00,0x00,0x18,0x08,0x20,0x21,0x22,0x2C,0x31,0x20,0x27,0x24,0x23,0x20,0x20,0x00, + 0x00,0x00,0x04,0xFC,0x04,0x84,0x44,0x7C,0x84,0x24,0xC4,0x44,0xC4,0x04,0x1C,0x08, + /* 0xAFBA [?] [1342]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFBB [?] [1343]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFBC [?] [1344]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFBD [?] [1345]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFBE [?] [1346]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFBF [?] [1347]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC0 [?] [1348]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC1 [?] [1349]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC2 [?] [1350]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC3 [?] [1351]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC4 [?] [1352]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC5 [?] [1353]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC6 [?] [1354]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC7 [?] [1355]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC8 [?] [1356]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFC9 [?] [1357]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCA [?] [1358]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCB [?] [1359]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCC [?] [1360]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCD [?] [1361]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCE [?] [1362]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFCF [?] [1363]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD0 [?] [1364]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD1 [?] [1365]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD2 [?] [1366]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD3 [?] [1367]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD4 [?] [1368]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD5 [?] [1369]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD6 [?] [1370]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD7 [?] [1371]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD8 [?] [1372]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFD9 [?] [1373]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDA [?] [1374]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDB [?] [1375]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDC [?] [1376]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDD [?] [1377]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDE [?] [1378]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFDF [?] [1379]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE0 [?] [1380]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE1 [?] [1381]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE2 [?] [1382]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE3 [?] [1383]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE4 [?] [1384]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE5 [?] [1385]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE6 [?] [1386]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE7 [?] [1387]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE8 [?] [1388]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFE9 [?] [1389]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFEA [?] [1390]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFEB [?] [1391]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFEC [?] [1392]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFED [?] [1393]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFEE [?] [1394]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFEF [?] [1395]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF0 [?] [1396]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF1 [?] [1397]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF2 [?] [1398]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF3 [?] [1399]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF4 [?] [1400]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF5 [?] [1401]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF6 [?] [1402]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF7 [?] [1403]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF8 [?] [1404]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFF9 [?] [1405]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFFA [?] [1406]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFFB [?] [1407]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFFC [?] [1408]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFFD [?] [1409]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xAFFE [?] [1410]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB0A1 [?] [1411]*/ + 0x00,0x0E,0xEA,0xAA,0xAA,0xAA,0xAC,0xAA,0xAA,0xAA,0xEA,0xAA,0x0C,0x08,0x08,0x08, + 0x00,0xFC,0x08,0x08,0xE8,0xA8,0xA8,0xA8,0xA8,0xA8,0xE8,0xA8,0x08,0x08,0x28,0x10, + /* 0xB0A2 [?] [1412]*/ + 0x00,0x7D,0x44,0x48,0x49,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x50,0x40,0x40,0x40, + 0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xB0A3 [?] [1413]*/ + 0x20,0x20,0x21,0x22,0x27,0xF9,0x21,0x23,0x24,0x20,0x27,0x38,0xE0,0x41,0x02,0x0C, + 0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xB0A4 [?] [1414]*/ + 0x20,0x20,0x21,0x22,0xF7,0x21,0x21,0x23,0x34,0xE0,0x2F,0x20,0x20,0x21,0xA2,0x4C, + 0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xB0A5 [?] [1415]*/ + 0x01,0x01,0x7B,0x49,0x49,0x48,0x4A,0x4A,0x49,0x49,0x78,0x48,0x00,0x01,0x02,0x0C, + 0x10,0x10,0xFC,0x10,0x10,0x00,0x08,0x08,0x10,0x10,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xB0A6 [?] [1416]*/ + 0x00,0x00,0xF1,0x92,0x97,0x91,0x91,0x93,0x94,0x90,0x9F,0xF0,0x90,0x01,0x02,0x0C, + 0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xB0A7 [?] [1417]*/ + 0x02,0x01,0xFF,0x00,0x00,0x1F,0x10,0x10,0x1F,0x02,0x04,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x80,0x44,0x28,0x10,0x08,0x06,0x00, + /* 0xB0A8 [?] [1418]*/ + 0x10,0x11,0x21,0x7D,0x45,0x44,0x45,0x44,0x7C,0x45,0x45,0x45,0x45,0x7D,0x44,0x00, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xB0A9 [?] [1419]*/ + 0x00,0x00,0x1F,0x10,0x93,0x52,0x53,0x10,0x37,0x54,0x97,0x10,0x24,0x24,0x47,0x80, + 0x80,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xBC,0xA4,0xBC,0x40,0x44,0x44,0xFC,0x04, + /* 0xB0AA [?] [1420]*/ + 0x08,0xFF,0x08,0x43,0x22,0x23,0x02,0xE3,0x21,0x23,0x24,0x22,0x2A,0x33,0x20,0x00, + 0x20,0xFE,0x20,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xA4,0x04,0xF4,0x14,0x08, + /* 0xB0AB [?] [1421]*/ + 0x20,0x21,0x3C,0x50,0x93,0x10,0x11,0xFE,0x10,0x13,0x10,0x29,0x24,0x44,0x40,0x81, + 0x1C,0xE0,0x20,0x20,0xFE,0xA8,0x24,0x42,0x40,0xFE,0x88,0x08,0xD0,0x30,0x48,0x84, + /* 0xB0AC [?] [1422]*/ + 0x04,0x04,0xFF,0x04,0x00,0x08,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x40,0x40,0xFE,0x40,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xB0AD [?] [1423]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3C,0x65,0x64,0xA7,0x24,0x25,0x3C,0x24,0x20,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x10,0xFE,0x10,0x10,0x90,0x10,0x50,0x20, + /* 0xB0AE [?] [1424]*/ + 0x00,0x01,0x7E,0x22,0x11,0x7F,0x42,0x82,0x7F,0x04,0x07,0x0A,0x11,0x20,0x43,0x1C, + 0x08,0xFC,0x10,0x10,0x20,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x10,0x20,0xC0,0x30,0x0E, + /* 0xB0AF [?] [1425]*/ + 0x02,0x79,0x49,0x48,0x57,0x50,0x61,0x52,0x4C,0x4B,0x4A,0x6A,0x52,0x42,0x4F,0x40, + 0x08,0x08,0x10,0x00,0xFC,0x00,0x10,0x08,0x04,0xF8,0xA8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xB0B0 [?] [1426]*/ + 0x28,0x28,0xFC,0x2B,0x3A,0x14,0x7C,0x57,0x54,0x7C,0x11,0xFC,0x10,0x10,0x10,0x13, + 0x40,0x20,0x20,0xFE,0x02,0x44,0x40,0xFE,0x88,0x88,0x08,0xD0,0x20,0x50,0x88,0x04, + /* 0xB0B1 [?] [1427]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x04,0x7F,0x40,0x08,0xFF,0x11,0x32,0x0C,0x1B,0x60, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x50,0x10,0xD0,0x12,0x0A,0x0A,0x06,0x82, + /* 0xB0B2 [?] [1428]*/ + 0x02,0x01,0x3F,0x20,0x42,0x02,0x02,0xFF,0x04,0x08,0x18,0x06,0x01,0x02,0x0C,0x70, + 0x00,0x00,0xFC,0x04,0x08,0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0x80,0x60,0x10,0x08, + /* 0xB0B3 [?] [1429]*/ + 0x08,0x08,0x0B,0x11,0x12,0x34,0x33,0x52,0x92,0x13,0x12,0x12,0x13,0x10,0x10,0x10, + 0x40,0x80,0xFC,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xB0B4 [?] [1430]*/ + 0x10,0x10,0x10,0x13,0xFA,0x14,0x10,0x1B,0x30,0xD0,0x11,0x10,0x10,0x10,0x50,0x23, + 0x40,0x20,0x20,0xFE,0x02,0x44,0x40,0xFE,0x88,0x88,0x08,0xD0,0x20,0x50,0x88,0x04, + /* 0xB0B5 [?] [1431]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4F,0x78,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0x80,0x40,0xFC,0x00,0x08,0x90,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB0B6 [?] [1432]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x20,0x2F,0x20,0x20,0x3F,0x20,0x40,0x40,0x80,0x00, + 0x00,0x08,0x08,0xF8,0x00,0xFC,0x00,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80, + /* 0xB0B7 [?] [1433]*/ + 0x00,0x78,0x48,0x4B,0x4A,0x7C,0x48,0x4B,0x48,0x78,0x49,0x48,0x48,0x48,0x48,0x9B, + 0x40,0x20,0x20,0xFE,0x02,0x44,0x40,0xFE,0x88,0x88,0x08,0xD0,0x20,0x50,0x88,0x04, + /* 0xB0B8 [?] [1434]*/ + 0x01,0x7F,0x40,0x04,0xFF,0x08,0x1E,0x03,0x3C,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xFC,0x04,0x00,0xFE,0x20,0x40,0xC0,0x38,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xB0B9 [?] [1435]*/ + 0x00,0x3C,0x24,0x25,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x45,0x55,0x8A, + 0x40,0x20,0x00,0xFC,0x00,0x00,0xF0,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xB0BA [?] [1436]*/ + 0x3F,0x20,0x3F,0x20,0x3F,0x00,0x0C,0x70,0x40,0x40,0x40,0x4C,0x70,0x40,0x00,0x00, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80, + /* 0xB0BB [?] [1437]*/ + 0x01,0x01,0x1F,0x11,0x11,0xFF,0x02,0x0C,0x30,0xC0,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0xF0,0x10,0x10,0xFE,0x80,0x60,0x18,0x06,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xB0BC [?] [1438]*/ + 0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x47,0x40,0x40,0x40,0x40,0x7F,0x40, + 0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xC4,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB0BD [?] [1439]*/ + 0x08,0x08,0x08,0x7F,0x08,0x3E,0x08,0xFF,0x10,0x1E,0x12,0x12,0x22,0x2A,0x44,0x81, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xB0BE [?] [1440]*/ + 0x08,0x08,0x7F,0x08,0x7E,0x08,0xFF,0x10,0x1E,0x22,0x46,0x80,0x24,0x22,0x42,0x80, + 0x20,0x20,0x20,0x7E,0x44,0xA4,0x28,0x10,0x28,0x44,0x82,0x00,0x88,0x44,0x44,0x04, + /* 0xB0BF [?] [1441]*/ + 0x10,0x21,0x7C,0x44,0x7D,0x44,0x7C,0x10,0xFE,0x28,0x55,0x92,0x7C,0x10,0x11,0x10, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0x44,0x4C,0xD4,0x64,0x44,0x44,0x44,0x54,0x88, + /* 0xB0C0 [?] [1442]*/ + 0x20,0x10,0x01,0xFC,0x08,0x10,0x11,0x34,0x58,0x94,0x14,0x10,0x10,0x10,0x11,0x12, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFE,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB0C1 [?] [1443]*/ + 0x12,0x12,0x1F,0x22,0x2F,0x62,0xBF,0x24,0x24,0x27,0x24,0x24,0x24,0x29,0x28,0x30, + 0x10,0x10,0xD0,0x20,0xBE,0x44,0xA4,0x24,0x24,0xA8,0xA8,0x90,0xA8,0xA8,0x44,0x82, + /* 0xB0C2 [?] [1444]*/ + 0x02,0x04,0x3F,0x20,0x29,0x25,0x2F,0x25,0x29,0x20,0x01,0xFF,0x02,0x0C,0x30,0xC0, + 0x00,0x00,0xF8,0x08,0x28,0x48,0xE8,0x48,0x28,0x08,0x00,0xFE,0x80,0x60,0x18,0x06, + /* 0xB0C3 [?] [1445]*/ + 0x20,0x21,0x27,0x24,0x35,0xAC,0xA7,0xA4,0xA5,0x24,0x20,0x2F,0x20,0x21,0x22,0x2C, + 0x80,0x00,0xFC,0x44,0x54,0x44,0xFC,0xE4,0x54,0x04,0x40,0xFE,0xA0,0x10,0x08,0x06, + /* 0xB0C4 [?] [1446]*/ + 0x00,0x21,0x17,0x14,0x85,0x44,0x47,0x14,0x15,0x24,0xE0,0x2F,0x20,0x21,0x22,0x0C, + 0x80,0x00,0xFC,0x44,0x54,0x44,0xFC,0xE4,0x54,0x04,0x40,0xFE,0xA0,0x10,0x08,0x06, + /* 0xB0C5 [?] [1447]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xB0C6 [?] [1448]*/ + 0x20,0x27,0x24,0x24,0xFC,0x27,0x22,0x2A,0x37,0xE2,0x22,0x22,0x24,0x24,0xA9,0x50, + 0x04,0xC4,0x44,0x54,0x54,0xD4,0x14,0x14,0xD4,0x54,0x54,0x54,0x44,0x44,0x54,0x88, + /* 0xB0C7 [?] [1449]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD2,0x12,0x12,0x14,0x54,0x28, + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x02, + /* 0xB0C8 [?] [1450]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x79,0x4A,0x02,0x04,0x08,0x10, + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x02, + /* 0xB0C9 [?] [1451]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4A,0x4A,0x4B,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x01,0x00, + 0x00,0xF8,0x48,0x48,0x48,0x48,0x48,0xF8,0x08,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xB0CA [?] [1452]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x1F, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x02,0x02,0x02,0xFE, + /* 0xB0CB [?] [1453]*/ + 0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x40, + 0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x08,0x08,0x04,0x02, + /* 0xB0CC [?] [1454]*/ + 0x00,0x00,0x1F,0x10,0x90,0x53,0x52,0x12,0x32,0x52,0x93,0x12,0x22,0x22,0x41,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xF8,0x00,0x02,0x02,0xFE,0x00, + /* 0xB0CD [?] [1455]*/ + 0x00,0x3F,0x21,0x21,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xB0CE [?] [1456]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x14,0x18,0x31,0xD1,0x11,0x11,0x12,0x12,0x54,0x21, + 0x50,0x48,0x48,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB0CF [?] [1457]*/ + 0x00,0x7C,0x44,0x44,0x47,0x7C,0x10,0x10,0x5D,0x51,0x51,0x51,0x5E,0xE2,0x04,0x01, + 0x50,0x48,0x48,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB0D0 [?] [1458]*/ + 0x28,0x29,0xFD,0x29,0x39,0x11,0x7D,0x55,0x55,0x7D,0x11,0xFD,0x11,0x11,0x10,0x10, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xB0D1 [?] [1459]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x50,0x20, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xB0D2 [?] [1460]*/ + 0x10,0x10,0x11,0xFD,0x11,0x79,0x11,0xFD,0x11,0x39,0x35,0x55,0x91,0x11,0x10,0x10, + 0x00,0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xB0D3 [?] [1461]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1C,0xE0,0x40,0x01,0x06, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x02,0x02, + /* 0xB0D4 [?] [1462]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x22,0x7F,0x22,0x3E,0x08,0x7F,0x49,0x7F,0x08,0xFF,0x08, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x54,0x88, + /* 0xB0D5 [?] [1463]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x04,0x08,0x10,0x3F,0x10, + 0x00,0xFC,0x44,0x44,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x20,0x10,0xF8,0x08, + /* 0xB0D6 [?] [1464]*/ + 0x04,0x08,0x18,0x24,0x03,0x0C,0x30,0xC0,0x1F,0x11,0x11,0x1F,0x10,0x10,0x10,0x0F, + 0x40,0x20,0x50,0x88,0x00,0xC0,0x30,0x0E,0xF0,0x10,0x10,0xF0,0x10,0x04,0x04,0xFC, + /* 0xB0D7 [?] [1465]*/ + 0x01,0x02,0x04,0x3F,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x3F,0x20, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB0D8 [?] [1466]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB0D9 [?] [1467]*/ + 0x00,0xFF,0x01,0x02,0x04,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x3F,0x20, + 0x00,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB0DA [?] [1468]*/ + 0x10,0x13,0x12,0x12,0xFB,0x10,0x14,0x19,0x30,0xD0,0x17,0x10,0x10,0x11,0x53,0x21, + 0x00,0xFE,0x52,0x52,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x40,0x88,0x04,0xFE,0x02, + /* 0xB0DB [?] [1469]*/ + 0x08,0x0B,0x08,0x10,0x10,0x31,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB0DC [?] [1470]*/ + 0x00,0x7C,0x44,0x54,0x54,0x55,0x56,0x54,0x54,0x54,0x54,0x10,0x28,0x24,0x45,0x82, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xB0DD [?] [1471]*/ + 0x04,0x1E,0xF0,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x11,0x10,0x20,0x20,0x40,0x80, + 0x00,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xB0DE [?] [1472]*/ + 0x08,0x1C,0xF1,0x11,0x11,0xFD,0x11,0x39,0x35,0x54,0x51,0x93,0x10,0x10,0x10,0x10, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xB0DF [?] [1473]*/ + 0x00,0x02,0xF9,0x21,0x2F,0x20,0x24,0xFA,0x22,0x21,0x21,0x3A,0xE2,0x44,0x08,0x00, + 0x00,0x00,0x3E,0x08,0xC8,0x88,0x88,0x88,0xBE,0x08,0x08,0x88,0x88,0x48,0x7E,0x00, + /* 0xB0E0 [?] [1474]*/ + 0x00,0x00,0xF8,0x22,0x22,0x22,0x22,0xFA,0x22,0x24,0x20,0x39,0xE1,0x42,0x04,0x08, + 0x80,0x80,0xBE,0x88,0x88,0x88,0x88,0xBE,0x88,0x88,0x88,0x08,0x08,0x3E,0x00,0x00, + /* 0xB0E1 [?] [1475]*/ + 0x21,0x22,0x27,0x24,0xF6,0x25,0x24,0x2F,0x34,0xE4,0x26,0x25,0x24,0x24,0xA4,0x49, + 0x00,0x3C,0xA4,0xA4,0xA4,0xA4,0xC2,0x80,0xBC,0xA4,0xA4,0xA4,0x94,0x88,0x94,0xA2, + /* 0xB0E2 [?] [1476]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xB0E3 [?] [1477]*/ + 0x08,0x10,0x3E,0x22,0x32,0x2A,0x2A,0xFE,0x22,0x32,0x2A,0x2A,0x22,0x42,0x4A,0x85, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB0E4 [?] [1478]*/ + 0x00,0x29,0x28,0x24,0x45,0x45,0x81,0x7D,0x25,0x25,0x25,0x25,0x24,0x44,0x55,0x8A, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xB0E5 [?] [1479]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xB0E6 [?] [1480]*/ + 0x08,0x48,0x49,0x49,0x49,0x7D,0x41,0x41,0x79,0x49,0x49,0x49,0x49,0x4A,0x4A,0x8C, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xB0E7 [?] [1481]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x12,0x15,0x18,0x30,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xB0E8 [?] [1482]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x11,0x14,0x18,0x30,0xD3,0x10,0x10,0x10,0x50,0x20, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xB0E9 [?] [1483]*/ + 0x08,0x0A,0x09,0x11,0x10,0x37,0x30,0x50,0x90,0x1F,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x44,0x48,0x50,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xB0EA [?] [1484]*/ + 0x40,0x21,0x27,0xFD,0x05,0x55,0x25,0xFD,0x25,0x25,0x75,0x25,0x25,0x49,0x49,0x91, + 0x90,0xC8,0x08,0x3E,0x80,0x54,0x48,0x7E,0x48,0x48,0x5C,0x28,0x08,0x48,0xA8,0x28, + /* 0xB0EB [?] [1485]*/ + 0x01,0x21,0x11,0x09,0x09,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x00,0x08,0x08,0x10,0x20,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xB0EC [?] [1486]*/ + 0x02,0x02,0x02,0x02,0x7F,0x02,0x02,0x12,0x12,0x24,0x44,0x08,0x08,0x10,0x20,0x40, + 0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x18,0x14,0x12,0x12,0x10,0x10,0x10,0xA0,0x40, + /* 0xB0ED [?] [1487]*/ + 0x10,0x10,0x21,0x24,0x44,0xF8,0x11,0x20,0x40,0xFC,0x43,0x00,0x1C,0xE0,0x40,0x00, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xB0EE [?] [1488]*/ + 0x08,0x08,0x08,0xFF,0x08,0x08,0x7E,0x08,0x08,0xFF,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xB0EF [?] [1489]*/ + 0x08,0x08,0xFF,0x08,0x7E,0x08,0xFF,0x10,0x20,0x41,0xBF,0x21,0x21,0x21,0x21,0x01, + 0x00,0x7C,0x48,0x50,0x48,0x44,0x54,0x48,0x40,0x00,0xF8,0x08,0x08,0x28,0x10,0x00, + /* 0xB0F0 [?] [1490]*/ + 0x21,0x21,0x21,0x2F,0xF1,0x21,0x27,0x71,0x69,0xAF,0xA1,0x21,0x22,0x22,0x24,0x28, + 0x00,0x1E,0x12,0xD2,0x14,0x14,0xD8,0x14,0x12,0xD2,0x12,0x1A,0x14,0x10,0x10,0x10, + /* 0xB0F1 [?] [1491]*/ + 0x10,0x10,0x13,0x11,0xFC,0x13,0x32,0x3C,0x54,0x53,0x90,0x10,0x10,0x11,0x11,0x12, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xB0F2 [?] [1492]*/ + 0x00,0x78,0x4B,0x49,0x48,0x7B,0x4A,0x4C,0x48,0x7B,0x48,0x48,0x48,0x49,0x49,0x9A, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xB0F3 [?] [1493]*/ + 0x21,0x21,0x21,0x47,0x51,0xF1,0x27,0x21,0x41,0xF7,0x41,0x01,0x31,0xC2,0x02,0x04, + 0x00,0x1E,0x12,0xD2,0x14,0x14,0xD8,0x14,0x12,0xD2,0x12,0x1A,0x14,0x10,0x10,0x10, + /* 0xB0F4 [?] [1494]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x33,0x38,0x55,0x52,0x90,0x10,0x13,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x24,0x22,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xB0F5 [?] [1495]*/ + 0x00,0x00,0xFB,0x21,0x20,0x43,0x7A,0x4C,0xC8,0x4B,0x48,0x48,0x78,0x49,0x01,0x02, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xB0F6 [?] [1496]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x54,0x55,0x7C,0x50,0x10,0x17,0x1C,0xE4,0x40,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xB0F7 [?] [1497]*/ + 0x20,0x20,0x3B,0x21,0x40,0x7B,0xA2,0x24,0xF8,0x23,0x20,0x20,0x28,0x31,0x21,0x02, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xB0F8 [?] [1498]*/ + 0x10,0x10,0x17,0x22,0x21,0x67,0x64,0xA8,0x20,0x27,0x21,0x21,0x21,0x22,0x22,0x24, + 0x80,0x40,0xFC,0x08,0x10,0xFE,0x02,0x84,0x40,0xFC,0x00,0xF8,0x08,0x08,0x28,0x10, + /* 0xB0F9 [?] [1499]*/ + 0x00,0x20,0x13,0x11,0x00,0x03,0xF2,0x14,0x10,0x13,0x10,0x10,0x14,0x19,0x11,0x02, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xB0FA [?] [1500]*/ + 0x04,0x04,0xFF,0x04,0x08,0x1F,0x20,0x5F,0x10,0x10,0x1F,0x10,0x10,0x10,0x0F,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF0,0x10,0x90,0x90,0x90,0x90,0x50,0x24,0x04,0xFC,0x00, + /* 0xB0FB [?] [1501]*/ + 0x00,0x78,0x49,0x49,0x4A,0x7D,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x49,0x48,0x98, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xB0FC [?] [1502]*/ + 0x08,0x08,0x1F,0x10,0x20,0x5F,0x90,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x0F,0x00, + 0x00,0x00,0xF0,0x10,0x10,0x90,0x90,0x90,0x90,0x90,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xB0FD [?] [1503]*/ + 0x01,0xFF,0x08,0x0B,0x12,0x33,0x50,0x97,0x11,0x12,0x03,0x04,0x0C,0x35,0xC6,0x04, + 0x00,0xFE,0x00,0xF8,0x08,0xF8,0x40,0xFE,0x50,0x48,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xB0FE [?] [1504]*/ + 0x00,0x7E,0x02,0x3E,0x02,0xFF,0x08,0x09,0x49,0x2A,0x1C,0x2A,0xC9,0x09,0x28,0x10, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB1A1 [?] [1505]*/ + 0x08,0xFF,0x08,0x00,0x27,0x10,0x13,0x82,0x43,0x4A,0x0B,0x12,0xF0,0x27,0x22,0x21, + 0x20,0xFE,0x20,0x48,0xFC,0x40,0xF8,0x48,0xF8,0x48,0xF8,0x48,0x10,0xFC,0x10,0x30, + /* 0xB1A2 [?] [1506]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x08,0x1F,0x20,0x5F,0x10,0x1F,0x10,0x10,0x0F, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF0,0x10,0x90,0x90,0xD0,0x20,0x04,0xFC, + /* 0xB1A3 [?] [1507]*/ + 0x08,0x0B,0x0A,0x12,0x12,0x33,0x30,0x50,0x97,0x10,0x11,0x12,0x14,0x18,0x10,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x40,0x40,0xFC,0xE0,0x50,0x48,0x44,0x42,0x40,0x40, + /* 0xB1A4 [?] [1508]*/ + 0x08,0x0B,0x12,0x33,0x50,0x97,0x11,0x12,0x14,0x11,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0xF8,0x08,0xF8,0x40,0xFC,0x50,0x48,0x46,0x40,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB1A5 [?] [1509]*/ + 0x20,0x20,0x21,0x39,0x4A,0x55,0x81,0x21,0x21,0x21,0x21,0x21,0x29,0x31,0x20,0x00, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xB1A6 [?] [1510]*/ + 0x02,0x01,0x7F,0x40,0x80,0x00,0x7F,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xFC,0x00,0x00,0x00,0xF8,0x00,0x20,0x10,0xFE,0x00, + /* 0xB1A7 [?] [1511]*/ + 0x10,0x10,0x11,0x11,0xFA,0x15,0x11,0x19,0x31,0xD1,0x11,0x11,0x11,0x11,0x50,0x20, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xB1A8 [?] [1512]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x00,0xFC,0x04,0x04,0x14,0x08,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB1A9 [?] [1513]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x08,0x7F,0x08,0xFF,0x08,0x31,0xC9,0x05,0x09,0x15,0x22, + 0xF0,0x10,0xF0,0x10,0xF0,0x20,0xFC,0x20,0xFE,0x20,0x18,0x26,0x40,0x20,0x10,0x08, + /* 0xB1AA [?] [1514]*/ + 0x0C,0x30,0xC2,0x14,0x49,0x32,0xC8,0x15,0x24,0xCC,0x14,0x24,0xC4,0x04,0x28,0x10, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xB1AB [?] [1515]*/ + 0x20,0x20,0x7C,0x44,0x89,0x7E,0x54,0x54,0x7C,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x40,0x40,0xFC,0x84,0x04,0xF4,0x94,0x94,0xF4,0x84,0x94,0x88,0x82,0x82,0x7E,0x00, + /* 0xB1AC [?] [1516]*/ + 0x11,0x11,0x11,0x15,0x59,0x50,0x53,0x90,0x17,0x10,0x11,0x2A,0x24,0x40,0x41,0x80, + 0xFC,0x04,0xFC,0x04,0xFC,0x88,0xFE,0x88,0xFE,0x88,0x24,0xAA,0x70,0xA8,0x24,0x60, + /* 0xB1AD [?] [1517]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x38,0x34,0x51,0x52,0x94,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40, + /* 0xB1AE [?] [1518]*/ + 0x00,0x00,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA4,0x25,0x27,0x3C,0x24,0x20,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xB1AF [?] [1519]*/ + 0x04,0x04,0x7C,0x04,0x04,0x3C,0x04,0x04,0x7C,0x04,0x01,0x08,0x48,0x48,0x87,0x00, + 0x40,0x40,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x40,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xB1B0 [?] [1520]*/ + 0x02,0x04,0x3F,0x21,0x21,0x3F,0x22,0x22,0x3F,0x08,0x10,0xFF,0x00,0x00,0x00,0x00, + 0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80,0x80, + /* 0xB1B1 [?] [1521]*/ + 0x04,0x04,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,0x04,0x04,0x04,0x1C,0xE4,0x44,0x04, + 0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xB1B2 [?] [1522]*/ + 0x04,0x7C,0x04,0x3C,0x04,0x7C,0x06,0x02,0x3F,0x05,0x09,0x1F,0x01,0xFF,0x01,0x01, + 0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x00,0xF8,0x00,0x00,0xF0,0x00,0xFE,0x00,0x00, + /* 0xB1B3 [?] [1523]*/ + 0x04,0x04,0x7C,0x04,0x1C,0xE4,0x40,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x80,0x98,0xE0,0x84,0x84,0x7C,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xB1B4 [?] [1524]*/ + 0x00,0x1F,0x10,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x12,0x02,0x04,0x08,0x10,0x20, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x80,0x40,0x20,0x10,0x08, + /* 0xB1B5 [?] [1525]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x10,0x14,0x18,0x11,0x06, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x02,0x02, + /* 0xB1B6 [?] [1526]*/ + 0x08,0x08,0x0B,0x10,0x12,0x31,0x31,0x57,0x90,0x10,0x13,0x12,0x12,0x12,0x13,0x12, + 0x80,0x40,0xFC,0x00,0x08,0x08,0x10,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB1B7 [?] [1527]*/ + 0x00,0x45,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x88,0x08,0x08,0x51,0x26, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x02,0x02, + /* 0xB1B8 [?] [1528]*/ + 0x04,0x04,0x0F,0x18,0x64,0x03,0x1C,0xE0,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x10, + 0x00,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xB1B9 [?] [1529]*/ + 0x08,0x0F,0x10,0x2C,0x03,0x1C,0xE0,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x48,0x48,0x87, + 0x00,0xF0,0x20,0x40,0x80,0x70,0x0E,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x84,0x12,0xF2, + /* 0xB1BA [?] [1530]*/ + 0x10,0x10,0x11,0x10,0x55,0x58,0x50,0x93,0x10,0x10,0x11,0x29,0x25,0x45,0x41,0x81, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB1BB [?] [1531]*/ + 0x20,0x10,0x00,0xF9,0x09,0x11,0x15,0x39,0x55,0x91,0x11,0x11,0x11,0x12,0x12,0x14, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB1BC [?] [1532]*/ + 0x02,0x02,0x7F,0x04,0x09,0x31,0xCF,0x01,0x09,0x08,0x7F,0x08,0x08,0x10,0x10,0x20, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xB1BD [?] [1533]*/ + 0x08,0x08,0xFF,0x08,0x01,0x01,0x7F,0x03,0x05,0x09,0x11,0x2F,0xC1,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xFC,0x80,0x40,0x20,0x10,0xE8,0x06,0x00,0x00,0x00, + /* 0xB1BE [?] [1534]*/ + 0x01,0x01,0x01,0x01,0x7F,0x03,0x05,0x05,0x09,0x11,0x21,0x4F,0x81,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0xFC,0x80,0x40,0x40,0x20,0x10,0x08,0xE4,0x02,0x00,0x00,0x00, + /* 0xB1BF [?] [1535]*/ + 0x10,0x10,0x3F,0x48,0x85,0x01,0x7F,0x03,0x05,0x09,0x11,0x2F,0xC1,0x01,0x01,0x01, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x80,0x40,0x20,0x10,0xE8,0x06,0x00,0x00,0x00, + /* 0xB1C0 [?] [1536]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x4A,0x85, + 0x00,0x08,0x08,0xF8,0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x44,0x94,0x08, + /* 0xB1C1 [?] [1537]*/ + 0x20,0x27,0x24,0x44,0x54,0xF7,0x24,0x24,0x44,0xF7,0x44,0x04,0x34,0xC4,0x0A,0x11, + 0x00,0xBC,0xA4,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0xA4,0xA4,0x4C, + /* 0xB1C2 [?] [1538]*/ + 0x7F,0x01,0x07,0x19,0xE1,0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x41,0x41,0x81, + 0xFC,0x00,0x70,0x0C,0x02,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x28,0x10, + /* 0xB1C3 [?] [1539]*/ + 0x00,0xFF,0x04,0x08,0x1F,0x28,0xC8,0x0F,0x01,0x01,0x7D,0x09,0x11,0x21,0xC5,0x02, + 0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x00,0x04,0x88,0x50,0x20,0x18,0x06,0x00, + /* 0xB1C4 [?] [1540]*/ + 0x00,0x7A,0x4A,0x4B,0x48,0x7B,0x12,0x12,0x53,0x5E,0x52,0x53,0x5A,0xE2,0x05,0x08, + 0x20,0x22,0x22,0xFE,0x00,0xDE,0x52,0x52,0xDE,0x52,0x52,0xDE,0x52,0x52,0x5A,0xA4, + /* 0xB1C5 [?] [1541]*/ + 0x02,0x21,0x10,0x17,0x01,0x01,0xF1,0x17,0x11,0x11,0x12,0x12,0x14,0x28,0x47,0x00, + 0x08,0x10,0x00,0xFC,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x00,0xFE,0x00, + /* 0xB1C6 [?] [1542]*/ + 0x00,0x27,0x10,0x13,0x02,0x03,0xF0,0x17,0x14,0x17,0x14,0x17,0x14,0x28,0x47,0x00, + 0x00,0xFC,0x00,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xFC,0x44,0xFC,0x04,0x00,0xFE,0x00, + /* 0xB1C7 [?] [1543]*/ + 0x02,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x21,0x3F,0x21,0x3F,0x00,0xFF,0x08,0x10, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x20,0x20, + /* 0xB1C8 [?] [1544]*/ + 0x00,0x20,0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0x20,0x20,0x26,0x38,0x20,0x00, + 0x80,0x80,0x80,0x84,0x88,0x90,0xA0,0xC0,0x80,0x80,0x80,0x82,0x82,0x82,0x7E,0x00, + /* 0xB1C9 [?] [1545]*/ + 0x1F,0x11,0x11,0x1F,0x04,0x7F,0x04,0x3F,0x20,0x2E,0x2A,0x2E,0x20,0x3F,0x20,0x00, + 0x00,0x3E,0x22,0x24,0x24,0xE8,0x24,0xA4,0xA2,0xA2,0xA2,0xB4,0xA8,0xA0,0xA0,0x20, + /* 0xB1CA [?] [1546]*/ + 0x10,0x10,0x3F,0x48,0x85,0x00,0x3F,0x01,0x01,0x3F,0x01,0x01,0x7F,0x01,0x01,0x00, + 0x40,0x40,0x7E,0x90,0x08,0xF8,0x00,0x00,0xF8,0x00,0x00,0xFC,0x02,0x02,0x02,0xFE, + /* 0xB1CB [?] [1547]*/ + 0x08,0x08,0x10,0x23,0x4A,0x0A,0x12,0x33,0x52,0x92,0x12,0x12,0x12,0x14,0x14,0x19, + 0x20,0x20,0x20,0xFE,0x22,0x24,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xB1CC [?] [1548]*/ + 0x00,0xFE,0x10,0x7C,0x10,0x1E,0xF0,0x00,0x7F,0x04,0x08,0x3F,0xC8,0x08,0x0F,0x08, + 0x20,0x40,0xFC,0x84,0xFC,0x84,0xFC,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xB1CD [?] [1549]*/ + 0x08,0xFF,0x08,0x02,0x3F,0x24,0x23,0x24,0x3F,0x00,0x20,0x3E,0x20,0x20,0x26,0x38, + 0x20,0xFE,0x20,0x00,0xF8,0x48,0x88,0x48,0xF8,0x00,0x84,0x98,0xE0,0x84,0x84,0x7C, + /* 0xB1CE [?] [1550]*/ + 0x04,0x04,0xFF,0x04,0x08,0x49,0x2A,0x7F,0x49,0x49,0x5D,0x6B,0x49,0x41,0x45,0x42, + 0x40,0x40,0xFE,0x40,0x20,0x20,0x3E,0x44,0xA4,0x24,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB1CF [?] [1551]*/ + 0x20,0x20,0x20,0x3E,0x20,0x20,0x26,0x38,0x21,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x80,0x88,0xB0,0xC0,0x80,0x84,0x84,0x7C,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xB1D0 [?] [1552]*/ + 0x41,0x41,0x7D,0x41,0x4D,0x70,0x00,0xFF,0x10,0x10,0x3E,0x42,0x14,0x08,0x30,0xC0, + 0x00,0x18,0xE0,0x04,0x04,0xFC,0x00,0xFE,0x80,0x88,0x90,0xE0,0x80,0x84,0x84,0x7C, + /* 0xB1D1 [?] [1553]*/ + 0x20,0x20,0x20,0x3E,0x20,0x20,0x26,0x38,0x01,0x00,0x48,0x48,0x89,0x0E,0x18,0xE7, + 0x80,0x88,0xB0,0xC0,0x80,0x84,0x84,0x7C,0x00,0x90,0xA4,0x42,0x82,0x10,0x10,0xF0, + /* 0xB1D2 [?] [1554]*/ + 0x00,0x01,0x7F,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x01,0x01,0x01, + 0x08,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00,0x00, + /* 0xB1D3 [?] [1555]*/ + 0x01,0x00,0x3F,0x20,0x24,0x24,0x24,0x24,0x27,0x24,0x24,0x24,0x45,0x46,0x84,0x00, + 0x00,0x80,0xFE,0x00,0x20,0x20,0x24,0x28,0x30,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xB1D4 [?] [1556]*/ + 0x00,0x00,0x1F,0x10,0x93,0x52,0x53,0x12,0x33,0x50,0x9F,0x11,0x21,0x21,0x42,0x84, + 0x80,0x40,0xFE,0x00,0xF8,0x48,0xF8,0x48,0xF8,0x00,0xFE,0x10,0x10,0x10,0x10,0x10, + /* 0xB1D5 [?] [1557]*/ + 0x20,0x17,0x00,0x40,0x40,0x5F,0x40,0x41,0x42,0x44,0x48,0x50,0x42,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x84,0x84,0xF4,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0x14,0x08, + /* 0xB1D6 [?] [1558]*/ + 0x08,0x49,0x29,0x2A,0x08,0x7F,0x49,0x49,0x5D,0x6B,0x49,0x49,0x49,0x41,0x45,0x42, + 0x10,0x10,0x10,0x20,0x3E,0x44,0x24,0x24,0x24,0x28,0x28,0x10,0x28,0x28,0x44,0x82, + /* 0xB1D7 [?] [1559]*/ + 0x08,0x49,0x2A,0x7F,0x49,0x5D,0x6B,0x49,0x43,0x08,0x08,0xFF,0x08,0x10,0x20,0x40, + 0x20,0x20,0x3E,0x48,0x48,0xA8,0x10,0x28,0x46,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xB1D8 [?] [1560]*/ + 0x00,0x04,0x02,0x01,0x01,0x08,0x28,0x28,0x28,0x49,0x4A,0x8C,0x08,0x18,0x27,0x40, + 0x00,0x00,0x10,0x10,0x20,0x20,0x48,0x44,0x84,0x02,0x02,0x12,0x10,0x10,0xF0,0x00, + /* 0xB1D9 [?] [1561]*/ + 0x00,0x7C,0x44,0x45,0x44,0x7C,0x40,0x41,0x7C,0x64,0xA5,0xA4,0x24,0x3C,0x24,0x00, + 0x40,0x20,0x20,0xFC,0x00,0x88,0x50,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xB1DA [?] [1562]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3D,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB1DB [?] [1563]*/ + 0x3E,0x22,0x3E,0x20,0x7E,0xA2,0x3E,0x22,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10, + 0x10,0xFE,0x44,0x28,0xFE,0x10,0xFC,0x10,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x30, + /* 0xB1DC [?] [1564]*/ + 0x00,0x47,0x24,0x24,0x04,0x07,0xE4,0x28,0x2F,0x34,0x24,0x27,0x24,0x50,0x8F,0x00, + 0x10,0x88,0xBE,0x80,0xA2,0x94,0x3E,0x08,0x88,0xBE,0x88,0x88,0x88,0x00,0xFE,0x00, + /* 0xB1DD [?] [1565]*/ + 0x02,0x7A,0x4A,0x53,0x52,0x62,0x52,0x4B,0x48,0x48,0x6B,0x50,0x40,0x40,0x47,0x40, + 0x20,0x24,0x28,0xB0,0x20,0x22,0xA2,0x1E,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xB1DE [?] [1566]*/ + 0x28,0x28,0xFE,0x29,0x39,0x13,0x7D,0x55,0x55,0x7D,0x11,0xFF,0x11,0x11,0x11,0x11, + 0x80,0xFE,0x90,0x7C,0x54,0x54,0x7C,0x54,0x54,0x7C,0x90,0x50,0x20,0x30,0x48,0x86, + /* 0xB1DF [?] [1567]*/ + 0x00,0x20,0x10,0x13,0x00,0x00,0xF0,0x10,0x10,0x11,0x11,0x12,0x14,0x28,0x47,0x00, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x84,0x84,0x04,0x04,0x28,0x10,0x00,0xFE,0x00, + /* 0xB1E0 [?] [1568]*/ + 0x10,0x10,0x23,0x22,0x4A,0xFB,0x12,0x22,0x43,0xFB,0x43,0x05,0x1D,0xE5,0x49,0x01, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x54,0x54,0xFC,0x54,0x54,0x44,0x0C, + /* 0xB1E1 [?] [1569]*/ + 0x00,0x7C,0x45,0x44,0x54,0x54,0x55,0x54,0x54,0x54,0x54,0x10,0x28,0x25,0x42,0x80, + 0x08,0x3C,0xC0,0x00,0x20,0x10,0xFC,0x04,0x08,0x10,0x20,0x40,0x80,0x40,0x3E,0x00, + /* 0xB1E2 [?] [1570]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x29,0x29,0x2F,0x49,0x49,0x89,0x08, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0x0C, + /* 0xB1E3 [?] [1571]*/ + 0x10,0x17,0x10,0x27,0x24,0x64,0x67,0xA4,0x24,0x27,0x22,0x21,0x20,0x21,0x22,0x2C, + 0x00,0xFE,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0x80,0x40,0x30,0x0E, + /* 0xB1E4 [?] [1572]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x44,0x00,0x3F,0x08,0x04,0x02,0x01,0x06,0x18,0xE0, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x00,0xF0,0x20,0x40,0x80,0x00,0xC0,0x30,0x0E, + /* 0xB1E5 [?] [1573]*/ + 0x02,0x01,0x01,0x00,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x40,0x20,0x10,0x10,0x00,0x00,0x00,0x00,0x00, + /* 0xB1E6 [?] [1574]*/ + 0x20,0x10,0x10,0x7C,0x00,0x2A,0x12,0xFE,0x12,0x10,0x7C,0x11,0x11,0x22,0x24,0x40, + 0x10,0x88,0x88,0xBE,0x80,0x94,0x88,0xBE,0x88,0x88,0x9C,0x08,0x08,0x08,0x08,0x08, + /* 0xB1E7 [?] [1575]*/ + 0x20,0x12,0x11,0x7D,0x00,0x2B,0x11,0xFD,0x11,0x11,0x7D,0x11,0x11,0x21,0x20,0x40, + 0x10,0x08,0x08,0x3E,0x00,0x14,0x08,0x3E,0x08,0x08,0x1C,0x48,0x88,0x08,0x08,0x08, + /* 0xB1E8 [?] [1576]*/ + 0x20,0x10,0x10,0x7D,0x01,0x2B,0x10,0xFC,0x11,0x13,0x7C,0x10,0x10,0x23,0x20,0x40, + 0x10,0x88,0x88,0x3E,0x40,0xD4,0x88,0xBE,0x08,0xC8,0x1C,0x08,0xC8,0x08,0x08,0x08, + /* 0xB1E9 [?] [1577]*/ + 0x00,0x20,0x13,0x12,0x02,0x03,0xF2,0x13,0x13,0x15,0x15,0x19,0x11,0x11,0x28,0x47, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x54,0x54,0xFC,0x54,0x44,0x0C,0x00,0xFE, + /* 0xB1EA [?] [1578]*/ + 0x10,0x11,0x10,0x10,0xFC,0x13,0x30,0x38,0x55,0x55,0x92,0x12,0x14,0x10,0x10,0x10, + 0x00,0xFC,0x00,0x00,0x00,0xFE,0x20,0x20,0x28,0x24,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xB1EB [?] [1579]*/ + 0x04,0x07,0x04,0x3F,0x24,0x27,0x3C,0x23,0x20,0x2F,0x29,0x29,0x49,0x51,0x90,0x20, + 0x00,0x84,0x04,0xC8,0x50,0x24,0x84,0x88,0x10,0x24,0x04,0x08,0x12,0x22,0xFE,0x00, + /* 0xB1EC [?] [1580]*/ + 0x00,0x7B,0x48,0x49,0x49,0x79,0x49,0x48,0x49,0x78,0x4B,0x48,0x48,0x49,0x4A,0x98, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xB1ED [?] [1581]*/ + 0x01,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x05,0x08,0x18,0x28,0xC9,0x0A,0x0C, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x88,0x50,0x20,0x18,0x06,0x00, + /* 0xB1EE [?] [1582]*/ + 0x49,0x2A,0x7F,0x49,0x5D,0x6B,0x49,0x4F,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF, + 0x20,0x3E,0x48,0x48,0xA8,0x10,0x28,0xC6,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xB1EF [?] [1583]*/ + 0x08,0x49,0x2A,0x7F,0x49,0x5D,0x6B,0x49,0x49,0x43,0x01,0x08,0x48,0x48,0x87,0x00, + 0x20,0x20,0x3E,0x44,0xA4,0x28,0x28,0x10,0x28,0x46,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xB1F0 [?] [1584]*/ + 0x00,0x7F,0x41,0x41,0x41,0x7F,0x10,0x10,0xFF,0x11,0x11,0x11,0x21,0x21,0x4A,0x84, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB1F1 [?] [1585]*/ + 0x00,0x3F,0x21,0x27,0xA4,0x67,0x24,0x27,0x64,0xA7,0x21,0x26,0x3A,0x43,0x42,0x81, + 0x80,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x18,0x66,0x88,0x08,0xF8, + /* 0xB1F2 [?] [1586]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x30,0x39,0x55,0x52,0x92,0x14,0x10,0x10,0x10,0x10, + 0x82,0x82,0x84,0x88,0xD0,0x82,0x82,0xC4,0xA8,0x90,0x82,0x82,0x84,0x88,0x90,0xA0, + /* 0xB1F3 [?] [1587]*/ + 0x00,0x20,0x11,0x00,0xFC,0x0B,0x08,0x48,0x28,0x12,0x12,0x2A,0x2A,0x4A,0x87,0x02, + 0x10,0x14,0xD2,0x12,0x10,0xFE,0x10,0x90,0x90,0xD0,0x90,0x90,0x8A,0xEA,0x06,0x02, + /* 0xB1F4 [?] [1588]*/ + 0x42,0x22,0x2A,0x8B,0x4A,0x4A,0x1F,0x20,0x22,0x4A,0xCA,0x4B,0x51,0x42,0x44,0x18, + 0x00,0x7E,0x10,0xA0,0x7C,0x44,0xD4,0x54,0x54,0xD4,0xD4,0x54,0x20,0x28,0x44,0x82, + /* 0xB1F5 [?] [1589]*/ + 0x00,0x20,0x17,0x14,0x88,0x43,0x4A,0x0A,0x13,0x12,0xE2,0x2F,0x20,0x21,0x22,0x04, + 0x80,0x40,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x10,0x08,0x04, + /* 0xB1F6 [?] [1590]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x10,0x10,0x1F,0x10,0x10,0xFF,0x00,0x08,0x10,0x20, + 0x00,0x00,0xFE,0x02,0x74,0x80,0x00,0x00,0xF8,0x80,0x80,0xFE,0x00,0x40,0x20,0x10, + /* 0xB1F7 [?] [1591]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x11,0x15,0x19,0x31,0xD1,0x17,0x10,0x10,0x51,0x22, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xB1F8 [?] [1592]*/ + 0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0xFF,0x00,0x08,0x10,0x20,0x40, + 0x20,0xF0,0x00,0x00,0x00,0xF8,0x80,0x80,0x80,0x80,0xFE,0x00,0x40,0x20,0x10,0x08, + /* 0xB1F9 [?] [1593]*/ + 0x00,0x40,0x20,0x20,0x00,0x07,0x11,0x11,0x21,0xE2,0x22,0x24,0x28,0x20,0x21,0x00, + 0x40,0x40,0x40,0x44,0x68,0x70,0x60,0x50,0x50,0x48,0x48,0x44,0x42,0x40,0x40,0x80, + /* 0xB1FA [?] [1594]*/ + 0x10,0x13,0x10,0x10,0xFC,0x13,0x32,0x3A,0x56,0x52,0x92,0x13,0x12,0x12,0x12,0x12, + 0x00,0xFE,0x20,0x20,0x20,0xFE,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xB1FB [?] [1595]*/ + 0x00,0xFF,0x01,0x01,0x01,0x7F,0x41,0x41,0x42,0x42,0x44,0x48,0x40,0x40,0x40,0x40, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x84,0x44,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB1FC [?] [1596]*/ + 0x00,0x3F,0x01,0x7F,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0xF8,0x00,0x00,0xFC,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xB1FD [?] [1597]*/ + 0x21,0x20,0x20,0x38,0x4B,0x50,0x80,0x20,0x20,0x27,0x20,0x20,0x29,0x31,0x22,0x04, + 0x04,0x84,0x88,0x00,0xFE,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xB1FE [?] [1598]*/ + 0x10,0x13,0x10,0x14,0x58,0x53,0x52,0x92,0x12,0x12,0x12,0x2B,0x26,0x42,0x42,0x82, + 0x00,0xFE,0x20,0x20,0x20,0xFE,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xB2A1 [?] [1599]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x37,0x54,0x94,0x15,0x26,0x24,0x44,0x84, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x40,0x40,0xFC,0x44,0xA4,0x14,0x14,0x04,0x14,0x08, + /* 0xB2A2 [?] [1600]*/ + 0x10,0x08,0x08,0x00,0x7F,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x10,0x10,0x20,0x40, + 0x10,0x10,0x20,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xB2A3 [?] [1601]*/ + 0x00,0x00,0xF8,0x23,0x22,0x22,0x22,0xFB,0x22,0x22,0x22,0x3A,0xE2,0x44,0x04,0x09, + 0x20,0x20,0x20,0xFE,0x22,0x24,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xB2A4 [?] [1602]*/ + 0x04,0x04,0xFF,0x04,0x20,0x10,0x13,0x82,0x42,0x4B,0x0A,0x12,0xE2,0x24,0x24,0x29, + 0x40,0x40,0xFE,0x40,0x20,0x20,0xFC,0x24,0x20,0xF8,0x88,0x88,0x50,0x20,0x50,0x8C, + /* 0xB2A5 [?] [1603]*/ + 0x20,0x27,0x22,0x21,0xFB,0x21,0x22,0x2C,0x33,0xE2,0x22,0x23,0x22,0x22,0xA3,0x42, + 0x78,0xC0,0x48,0x50,0xFC,0x50,0x48,0x06,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x08, + /* 0xB2A6 [?] [1604]*/ + 0x10,0x10,0x12,0x12,0xFB,0x10,0x14,0x18,0x31,0xD1,0x11,0x12,0x12,0x14,0x58,0x23, + 0x40,0x48,0x44,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xB2A7 [?] [1605]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBC,0x10,0x10,0xFD,0x11,0x12,0x10,0x14,0x18,0x10,0x00, + 0x20,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0xF8,0x20,0x20,0x20,0x20, + /* 0xB2A8 [?] [1606]*/ + 0x00,0x20,0x10,0x13,0x82,0x42,0x4A,0x0B,0x12,0x12,0xE2,0x22,0x22,0x24,0x24,0x09, + 0x20,0x20,0x20,0xFE,0x22,0x24,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xB2A9 [?] [1607]*/ + 0x20,0x20,0x2F,0x20,0x27,0xFC,0x27,0x24,0x27,0x24,0x20,0x2F,0x22,0x21,0x21,0x20, + 0x50,0x48,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x08,0xFE,0x08,0x08,0x28,0x10, + /* 0xB2AA [?] [1608]*/ + 0x08,0x08,0x7F,0x08,0x08,0x7F,0x41,0x82,0x3C,0x04,0x08,0x0F,0x78,0x08,0x29,0x12, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xB2AB [?] [1609]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x11,0x15,0x19,0x31,0xD0,0x13,0x10,0x10,0x50,0x20, + 0x28,0x24,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x08,0xFE,0x88,0x48,0x48,0x18, + /* 0xB2AC [?] [1610]*/ + 0x10,0x10,0x3C,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB2AD [?] [1611]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x09,0x49,0x21,0x25,0x05,0x09,0x71,0x11,0x11,0x11, + 0x40,0x40,0x7E,0x90,0x28,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB2AE [?] [1612]*/ + 0x08,0x08,0x08,0x13,0x12,0x32,0x32,0x52,0x93,0x12,0x12,0x12,0x12,0x12,0x13,0x12, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB2AF [?] [1613]*/ + 0x01,0x02,0x1F,0x10,0x1F,0x10,0x1F,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xB2B0 [?] [1614]*/ + 0x08,0x10,0x3E,0x22,0x32,0x2A,0x2A,0xFE,0x22,0x32,0x2A,0x2A,0x22,0x42,0x4A,0x84, + 0x10,0x10,0x20,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xB2B1 [?] [1615]*/ + 0x00,0x78,0x4B,0x48,0x48,0x7B,0x4A,0x4C,0x49,0x78,0x48,0x4B,0x48,0x48,0x48,0x98, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x02,0x04,0xF8,0x10,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xB2B2 [?] [1616]*/ + 0x00,0x78,0x4B,0x48,0x49,0x79,0x49,0x49,0x49,0x79,0x48,0x4B,0x48,0x48,0x48,0x98, + 0x28,0x24,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x08,0xFE,0x88,0x48,0x48,0x18, + /* 0xB2B3 [?] [1617]*/ + 0x02,0x82,0x5F,0x02,0x82,0x5F,0x50,0x20,0x2F,0x41,0xC2,0x43,0x5E,0x42,0x4A,0x04, + 0x10,0x10,0xD0,0x10,0x3E,0xD2,0x52,0x92,0x12,0x12,0x12,0x92,0x22,0x22,0x4A,0x84, + /* 0xB2B4 [?] [1618]*/ + 0x00,0x20,0x10,0x13,0x82,0x42,0x4A,0x0A,0x13,0x12,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB2B5 [?] [1619]*/ + 0x00,0xF8,0x08,0x48,0x48,0x48,0x49,0x7C,0x04,0x04,0x1C,0xE4,0x44,0x04,0x28,0x13, + 0x08,0x88,0x50,0x20,0x50,0x88,0x00,0x08,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xB2B6 [?] [1620]*/ + 0x10,0x10,0x17,0x10,0xFC,0x13,0x12,0x16,0x1B,0x32,0xD2,0x13,0x12,0x12,0x52,0x22, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xB2B7 [?] [1621]*/ + 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x20,0x10,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB2B8 [?] [1622]*/ + 0x00,0x00,0xF7,0x90,0x90,0x93,0x92,0x92,0x93,0x92,0xF2,0x93,0x02,0x02,0x02,0x02, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xB2B9 [?] [1623]*/ + 0x10,0x08,0x00,0x7E,0x02,0x04,0x08,0x1A,0x2C,0x4A,0x0A,0x08,0x08,0x08,0x08,0x08, + 0x40,0x40,0x40,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xB2BA [?] [1624]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x10,0x1C,0xE3,0x40,0x00,0x00,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xB2BB [?] [1625]*/ + 0x00,0x7F,0x00,0x00,0x01,0x01,0x03,0x05,0x09,0x11,0x21,0x41,0x81,0x01,0x01,0x01, + 0x00,0xFC,0x80,0x80,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x04,0x00,0x00,0x00,0x00, + /* 0xB2BC [?] [1626]*/ + 0x02,0x02,0x02,0xFF,0x04,0x09,0x11,0x3F,0x51,0x91,0x11,0x11,0x11,0x11,0x01,0x01, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xB2BD [?] [1627]*/ + 0x01,0x01,0x11,0x11,0x11,0x11,0xFF,0x01,0x01,0x11,0x11,0x21,0x40,0x03,0x1C,0xE0, + 0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x08,0x10,0x20,0xC0,0x00,0x00,0x00, + /* 0xB2BE [?] [1628]*/ + 0x20,0x3F,0x48,0x85,0x27,0x10,0x13,0x82,0x43,0x4A,0x0B,0x12,0xF0,0x27,0x22,0x21, + 0x40,0x7E,0x90,0x48,0xFC,0x40,0xF8,0x48,0xF8,0x48,0xF8,0x48,0x10,0xFC,0x10,0x30, + /* 0xB2BF [?] [1629]*/ + 0x10,0x08,0x7F,0x00,0x21,0x12,0xFF,0x00,0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x00, + 0x00,0x3E,0xA2,0x24,0x24,0x28,0xE4,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xB2C0 [?] [1630]*/ + 0x10,0x10,0x10,0x13,0x18,0x54,0x51,0x51,0x93,0x15,0x11,0x11,0x11,0x11,0x10,0x10, + 0x40,0x40,0x40,0xFE,0x80,0xA0,0x20,0xFC,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xB2C1 [?] [1631]*/ + 0x20,0x20,0x27,0x24,0xFA,0x23,0x24,0x2A,0x35,0xE2,0x24,0x2B,0x20,0x22,0xA4,0x40, + 0x80,0x40,0xFE,0x02,0x24,0xBC,0xA4,0xA8,0x10,0xE8,0x04,0xFA,0x40,0x48,0x44,0xC0, + /* 0xB2C2 [?] [1632]*/ + 0x00,0x44,0x2B,0x10,0x29,0x48,0x8B,0x08,0x19,0x29,0x49,0x89,0x09,0x09,0x51,0x21, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xB2C3 [?] [1633]*/ + 0x08,0x08,0x7F,0x08,0x08,0xFF,0x10,0x08,0xFF,0x10,0x29,0x66,0xA2,0x29,0x30,0x20, + 0x40,0x48,0x44,0x44,0x40,0xFE,0x40,0x44,0x44,0x44,0x28,0x2A,0x12,0x2A,0x46,0x82, + /* 0xB2C4 [?] [1634]*/ + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08,0x08, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x18,0x28,0x28,0x48,0x88,0x08,0x08,0x28,0x10, + /* 0xB2C5 [?] [1635]*/ + 0x00,0x00,0x00,0x00,0xFF,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x02,0x01, + 0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + /* 0xB2C6 [?] [1636]*/ + 0x00,0x7C,0x44,0x54,0x55,0x54,0x54,0x54,0x54,0x54,0x54,0x11,0x28,0x24,0x44,0x80, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x30,0x30,0x50,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xB2C7 [?] [1637]*/ + 0x00,0x00,0x7B,0x48,0x4A,0x79,0x49,0x48,0x7B,0x48,0x48,0x48,0x79,0x4A,0x04,0x00, + 0x08,0x3C,0xC0,0x44,0x24,0x28,0x00,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20, + /* 0xB2C8 [?] [1638]*/ + 0x00,0x7C,0x45,0x44,0x45,0x7C,0x10,0x10,0x5D,0x50,0x50,0x50,0x5D,0xE2,0x04,0x00, + 0x08,0x3C,0xC0,0x44,0x24,0xA8,0x80,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20, + /* 0xB2C9 [?] [1639]*/ + 0x00,0x00,0x3F,0x02,0x11,0x09,0x08,0x01,0x7F,0x03,0x05,0x09,0x11,0x21,0xC1,0x01, + 0x10,0xF8,0x00,0x00,0x10,0x10,0x20,0x00,0xFC,0x80,0x40,0x20,0x10,0x08,0x06,0x00, + /* 0xB2CA [?] [1640]*/ + 0x01,0x07,0x78,0x08,0x44,0x25,0x20,0x04,0x7F,0x0C,0x16,0x15,0x24,0x44,0x84,0x04, + 0x00,0x84,0x04,0x88,0x90,0x22,0x02,0x04,0x88,0x10,0x22,0x02,0x84,0x08,0x10,0x60, + /* 0xB2CB [?] [1641]*/ + 0x08,0x08,0xFF,0x08,0x00,0x00,0x3F,0x11,0x08,0x01,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0xFE,0x20,0x10,0xF8,0x00,0x10,0x20,0x00,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xB2CC [?] [1642]*/ + 0x04,0xFF,0x04,0x10,0x1E,0x22,0x54,0x28,0x17,0x20,0xDF,0x01,0x11,0x21,0x45,0x02, + 0x40,0xFE,0x40,0x80,0xF8,0x88,0x50,0x20,0xD8,0x06,0xF0,0x00,0x10,0x08,0x04,0x00, + /* 0xB2CD [?] [1643]*/ + 0x08,0x0F,0x28,0x7F,0xA1,0x17,0x3A,0xCD,0x3F,0xC8,0x0F,0x08,0x0F,0x08,0x0A,0x0C, + 0x00,0x78,0x08,0x28,0x10,0x28,0xC4,0x60,0xF8,0x26,0xE0,0x20,0xE8,0xD0,0x30,0x08, + /* 0xB2CE [?] [1644]*/ + 0x02,0x04,0x08,0x1F,0x02,0x7F,0x08,0x10,0x23,0xCC,0x01,0x06,0x18,0x00,0x07,0x78, + 0x00,0x40,0x20,0xF0,0x00,0xFC,0x20,0x90,0x08,0x46,0x80,0x10,0x20,0xC0,0x00,0x00, + /* 0xB2CF [?] [1645]*/ + 0x00,0x3F,0x01,0x02,0xFF,0x04,0x08,0x31,0xDF,0x11,0x11,0x1F,0x11,0x01,0x7F,0x20, + 0x00,0xF8,0x00,0x00,0xFE,0x40,0x20,0x18,0xF6,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xB2D0 [?] [1646]*/ + 0x00,0x00,0xFC,0x20,0x21,0x3C,0x44,0x47,0x64,0x94,0x08,0x08,0x10,0x20,0x43,0x80, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xB2D1 [?] [1647]*/ + 0x21,0x21,0x21,0x2F,0x32,0xAA,0xA5,0xA7,0xA1,0x21,0x21,0x2F,0x25,0x21,0x21,0x21, + 0x00,0x02,0x1C,0xD0,0x10,0x10,0x1E,0xD4,0x14,0x14,0xD4,0x14,0x14,0x24,0x24,0x44, + /* 0xB2D2 [?] [1648]*/ + 0x20,0x20,0x21,0x33,0xA8,0xA7,0xA1,0xA2,0x2C,0x23,0x20,0x20,0x23,0x20,0x20,0x27, + 0x80,0x90,0x08,0xFC,0x40,0xFE,0x10,0x48,0x86,0x10,0x20,0xC4,0x08,0x30,0xC0,0x00, + /* 0xB2D3 [?] [1649]*/ + 0x10,0x10,0x10,0x10,0x55,0x59,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x40,0x80, + 0x20,0x20,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00, + /* 0xB2D4 [?] [1650]*/ + 0x08,0x08,0xFF,0x08,0x09,0x02,0x04,0x08,0x30,0xCF,0x08,0x08,0x08,0x08,0x08,0x07, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x40,0x20,0x18,0xE6,0x20,0x20,0xA8,0x48,0x08,0xF8, + /* 0xB2D5 [?] [1651]*/ + 0x10,0x20,0x7C,0x44,0x64,0x55,0x56,0xFC,0x44,0x64,0x54,0x54,0x44,0x44,0x54,0x88, + 0x20,0x20,0x50,0x50,0x88,0x04,0x02,0xF8,0x88,0x88,0xA8,0x90,0x82,0x82,0x7E,0x00, + /* 0xB2D6 [?] [1652]*/ + 0x01,0x01,0x02,0x04,0x08,0x30,0xC0,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0x07,0x00, + 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0xE0,0x20,0x20,0xA0,0x44,0x04,0x04,0xFC,0x00, + /* 0xB2D7 [?] [1653]*/ + 0x00,0x40,0x20,0x21,0x02,0x84,0x4B,0x42,0x12,0x22,0xE2,0x22,0x22,0x22,0x21,0x00, + 0x40,0x40,0xA0,0x10,0x08,0x04,0xF2,0x10,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xB2D8 [?] [1654]*/ + 0x04,0xFF,0x04,0x00,0x1F,0x50,0x57,0x75,0x17,0xF4,0x57,0x55,0x95,0x27,0x20,0x40, + 0x40,0xFE,0x48,0x24,0xFE,0x20,0xA0,0x24,0xA4,0xA8,0xA8,0x10,0x12,0xAA,0x46,0x82, + /* 0xB2D9 [?] [1655]*/ + 0x23,0x22,0x22,0x23,0xF8,0x27,0x24,0x2C,0x37,0xE0,0x2F,0x21,0x22,0x24,0xB8,0x40, + 0xF8,0x08,0x08,0xF8,0x00,0xBC,0xA4,0xA4,0xBC,0x40,0xFE,0x60,0x50,0x48,0x46,0x40, + /* 0xB2DA [?] [1656]*/ + 0x10,0x10,0x96,0x55,0x58,0x10,0xFC,0x33,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x14, + 0x10,0x50,0x50,0x7C,0x90,0x10,0xFE,0x00,0x7C,0x44,0x44,0x7C,0x44,0x00,0xFE,0x00, + /* 0xB2DB [?] [1657]*/ + 0x10,0x10,0x17,0x10,0xFB,0x12,0x33,0x3A,0x57,0x50,0x91,0x11,0x11,0x11,0x11,0x11, + 0x90,0x90,0xFE,0x90,0xFC,0x94,0xFC,0x94,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xB2DC [?] [1658]*/ + 0x04,0x04,0xFF,0x04,0x3F,0x24,0x3F,0x24,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x40,0x40,0xFE,0x40,0xF8,0x48,0xF8,0x48,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xB2DD [?] [1659]*/ + 0x04,0x04,0xFF,0x04,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x40,0x40,0xFE,0x40,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xB2DE [?] [1660]*/ + 0x00,0x3F,0x20,0x2F,0x28,0x28,0x2A,0x2A,0x2A,0x2A,0x2A,0x22,0x25,0x44,0x48,0x90, + 0x00,0xFE,0x00,0x84,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x04,0x84,0x94,0x08, + /* 0xB2DF [?] [1661]*/ + 0x10,0x10,0x3F,0x48,0x85,0x01,0xFF,0x01,0x3F,0x21,0x23,0x25,0x09,0x11,0x61,0x01, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFE,0x00,0xF8,0x08,0x88,0x58,0x20,0x10,0x0C,0x00, + /* 0xB2E0 [?] [1662]*/ + 0x10,0x17,0x14,0x24,0x25,0x65,0x65,0xA5,0x25,0x25,0x25,0x21,0x22,0x22,0x24,0x28, + 0x04,0xC4,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x04,0x84,0x44,0x14,0x08, + /* 0xB2E1 [?] [1663]*/ + 0x00,0x1E,0x12,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x12,0x12,0x26,0x41, + 0x00,0x78,0x48,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x48,0x88,0xA8,0x10, + /* 0xB2E2 [?] [1664]*/ + 0x00,0x27,0x14,0x14,0x85,0x45,0x45,0x15,0x15,0x25,0xE5,0x21,0x22,0x22,0x24,0x08, + 0x04,0xC4,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x04,0x84,0x44,0x14,0x08, + /* 0xB2E3 [?] [1665]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x20,0x20,0x3F,0x21,0x22,0x44,0x4F,0x84, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x00,0x00,0xFE,0x00,0x10,0x08,0xFC,0x04, + /* 0xB2E4 [?] [1666]*/ + 0x01,0x78,0x48,0x4B,0x4A,0x7A,0x12,0x12,0x53,0x5C,0x51,0x51,0x59,0xE1,0x01,0x01, + 0x04,0x88,0x00,0xFE,0x22,0xAA,0x72,0x22,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xB2E5 [?] [1667]*/ + 0x20,0x20,0x27,0x20,0xF8,0x2F,0x20,0x29,0x36,0xE4,0x24,0x27,0x24,0x24,0xA7,0x44, + 0x08,0x3C,0xC0,0x40,0x40,0xFE,0x40,0x40,0x5C,0x44,0x44,0x5C,0x44,0x44,0xFC,0x04, + /* 0xB2E6 [?] [1668]*/ + 0x00,0x3F,0x10,0x12,0x11,0x09,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0xF0,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xB2E7 [?] [1669]*/ + 0x08,0x08,0xFF,0x0A,0x02,0x04,0xFF,0x08,0x10,0x30,0x53,0x90,0x10,0x10,0x17,0x10, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xFE,0x00,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xB2E8 [?] [1670]*/ + 0x08,0x08,0xFF,0x08,0x09,0x02,0x04,0x09,0x31,0xDF,0x01,0x09,0x11,0x21,0x05,0x02, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x40,0x20,0x18,0xF6,0x00,0x20,0x10,0x08,0x00,0x00, + /* 0xB2E9 [?] [1671]*/ + 0x01,0x01,0x7F,0x05,0x09,0x31,0xC1,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x00,0xFF,0x00, + 0x00,0x00,0xFC,0x40,0x20,0x18,0x06,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x00,0xFE,0x00, + /* 0xB2EA [?] [1672]*/ + 0x00,0x00,0xFB,0x20,0x20,0x41,0x7A,0x49,0xC9,0x49,0x49,0x49,0x79,0x48,0x03,0x00, + 0x20,0x20,0xFE,0x70,0xA8,0x24,0x22,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xB2EB [?] [1673]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x15,0x1A,0x31,0xD0,0x10,0x11,0x12,0x50,0x20, + 0x88,0x88,0xFE,0x88,0xA8,0x50,0x88,0x24,0x22,0xFC,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xB2EC [?] [1674]*/ + 0x01,0x7F,0x40,0x90,0x1E,0x22,0x54,0x28,0x17,0x20,0xDF,0x01,0x11,0x21,0x45,0x02, + 0x00,0xFE,0x02,0x84,0xF8,0x88,0x50,0x20,0xD8,0x06,0xF0,0x00,0x10,0x08,0x04,0x00, + /* 0xB2ED [?] [1675]*/ + 0x04,0x08,0x10,0x2F,0xC4,0x04,0x08,0x10,0x60,0x01,0x01,0x21,0x21,0x21,0x3F,0x00, + 0x40,0x20,0x10,0xE8,0x26,0x20,0x20,0xA0,0x40,0x00,0x00,0x08,0x08,0x08,0xF8,0x08, + /* 0xB2EE [?] [1676]*/ + 0x08,0x04,0x7F,0x01,0x01,0x3F,0x02,0x02,0xFF,0x04,0x08,0x17,0x20,0x40,0x80,0x1F, + 0x20,0x40,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0xF8,0x80,0x80,0x80,0xFC, + /* 0xB2EF [?] [1677]*/ + 0x00,0x20,0x10,0x13,0x02,0x04,0xF0,0x13,0x10,0x10,0x10,0x17,0x14,0x18,0x10,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x38,0xC0,0x40,0x40,0x7E,0xC0,0x40,0x42,0x42,0x3E, + /* 0xB2F0 [?] [1678]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x30,0x18,0x14,0x12,0x10,0x10,0x10, + /* 0xB2F1 [?] [1679]*/ + 0x08,0x08,0x28,0x2E,0x28,0x28,0x2E,0xF0,0x01,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x80,0x88,0x90,0xA0,0xC0,0x84,0x84,0x7C,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xB2F2 [?] [1680]*/ + 0x0C,0x30,0xC2,0x14,0x49,0x30,0xC8,0x14,0x24,0xCC,0x14,0x25,0xC4,0x04,0x28,0x10, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x30,0x30,0x50,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xB2F3 [?] [1681]*/ + 0x21,0x21,0x22,0x24,0xFB,0x22,0x22,0x2B,0x30,0xE1,0x26,0x20,0x20,0x21,0xA0,0x40, + 0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFC,0xA0,0x22,0x1E,0xC0,0x30,0x80,0x60,0x10, + /* 0xB2F4 [?] [1682]*/ + 0x10,0x10,0x11,0x13,0xFC,0x17,0x11,0x12,0x1C,0x33,0xD0,0x10,0x13,0x10,0x50,0x27, + 0x80,0x90,0x08,0xFC,0x40,0xFE,0x10,0x48,0x86,0x10,0x20,0xC4,0x08,0x30,0xC0,0x00, + /* 0xB2F5 [?] [1683]*/ + 0x11,0x10,0x10,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x10,0x14,0x1D,0xE4,0x40,0x00, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xB2F6 [?] [1684]*/ + 0x21,0x21,0x22,0x3C,0x4B,0x52,0x82,0x23,0x20,0x21,0x26,0x20,0x28,0x31,0x20,0x00, + 0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFC,0xA0,0x22,0x1E,0xC0,0x30,0x80,0x60,0x10, + /* 0xB2F7 [?] [1685]*/ + 0x01,0x21,0x12,0x14,0x03,0x02,0xF2,0x13,0x10,0x11,0x16,0x10,0x14,0x19,0x10,0x00, + 0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFC,0xA0,0x22,0x1E,0xC0,0x30,0x80,0x60,0x10, + /* 0xB2F8 [?] [1686]*/ + 0x20,0x20,0x27,0x44,0x55,0xF5,0x25,0x25,0x45,0xF5,0x45,0x04,0x35,0xC8,0x08,0x13, + 0x40,0x20,0xFE,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFC,0x20,0x20,0xFE, + /* 0xB2F9 [?] [1687]*/ + 0x20,0x20,0x3B,0x20,0x41,0x78,0xA3,0x22,0xFA,0x22,0x22,0x22,0x2A,0x34,0x24,0x08, + 0x40,0x20,0xFC,0x00,0x08,0x90,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB2FA [?] [1688]*/ + 0x02,0x01,0x7F,0x00,0x08,0x04,0x04,0x3F,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0x00,0xFC,0x00,0x20,0x20,0x40,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB2FB [?] [1689]*/ + 0x20,0x17,0x00,0x44,0x42,0x4F,0x49,0x4F,0x49,0x4F,0x41,0x5F,0x41,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x44,0x84,0xE4,0x24,0xE4,0x24,0xE4,0x04,0xF4,0x04,0x04,0x14,0x08, + /* 0xB2FC [?] [1690]*/ + 0x08,0xFF,0x00,0xFF,0x81,0xBD,0xA5,0xFF,0x00,0x7E,0x42,0x7E,0x42,0x7E,0x00,0xFE, + 0x00,0x7E,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xB2FD [?] [1691]*/ + 0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB2FE [?] [1692]*/ + 0x01,0x45,0x29,0x11,0x29,0x49,0x89,0x08,0x1B,0x2A,0x4A,0x8B,0x0A,0x0A,0x53,0x22, + 0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB3A1 [?] [1693]*/ + 0x20,0x23,0x20,0x20,0x20,0xF9,0x23,0x21,0x21,0x21,0x22,0x3A,0xE4,0x48,0x01,0x02, + 0x00,0xF0,0x20,0x40,0x80,0x00,0xFC,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xB3A2 [?] [1694]*/ + 0x01,0x11,0x09,0x01,0x7F,0x40,0x80,0x1F,0x00,0x00,0x7F,0x04,0x08,0x10,0x3F,0x10, + 0x00,0x10,0x20,0x00,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x00,0x20,0x10,0xF8,0x08, + /* 0xB3A3 [?] [1695]*/ + 0x01,0x11,0x09,0x7F,0x40,0x9F,0x10,0x1F,0x01,0x3F,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0x10,0x20,0xFE,0x02,0xF4,0x10,0xF0,0x00,0xF8,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xB3A4 [?] [1696]*/ + 0x08,0x08,0x08,0x08,0x08,0x09,0x08,0xFF,0x0A,0x09,0x08,0x08,0x09,0x0A,0x0C,0x08, + 0x00,0x10,0x20,0x40,0x80,0x00,0x00,0xFE,0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xB3A5 [?] [1697]*/ + 0x08,0x0A,0x09,0x10,0x17,0x34,0x38,0x51,0x90,0x10,0x17,0x10,0x11,0x12,0x17,0x12, + 0x40,0x48,0x50,0x40,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x80,0x10,0x08,0xFC,0x04, + /* 0xB3A6 [?] [1698]*/ + 0x00,0x3D,0x24,0x24,0x24,0x3C,0x25,0x24,0x24,0x3C,0x25,0x25,0x26,0x44,0x54,0x89, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xB3A7 [?] [1699]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB3A8 [?] [1700]*/ + 0x08,0x49,0x29,0x2A,0x08,0x7F,0x41,0x41,0x5D,0x55,0x55,0x55,0x5D,0x41,0x45,0x42, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xB3A9 [?] [1701]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x7D,0x54,0x54,0x54,0x7D,0x54,0x10,0x10,0x11,0x10, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFC,0x54,0x54,0x94,0x24,0x24,0x44,0x84,0x28,0x10, + /* 0xB3AA [?] [1702]*/ + 0x01,0x01,0x79,0x49,0x49,0x49,0x49,0x48,0x4B,0x4A,0x7A,0x4B,0x02,0x02,0x03,0x02, + 0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB3AB [?] [1703]*/ + 0x09,0x09,0x09,0x11,0x11,0x31,0x31,0x50,0x93,0x12,0x12,0x13,0x12,0x12,0x13,0x12, + 0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB3AC [?] [1704]*/ + 0x08,0x09,0x08,0x7E,0x08,0x08,0xFF,0x08,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x00,0xFC,0x44,0x44,0x44,0x94,0x08,0xFC,0x84,0x84,0x84,0xFC,0x00,0x00,0xFE,0x00, + /* 0xB3AD [?] [1705]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x11,0x15,0x1A,0x30,0xD0,0x10,0x10,0x10,0x50,0x23, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xB3AE [?] [1706]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x11,0x11,0xFE,0x10,0x10,0x10,0x14,0x18,0x10,0x03, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xB3AF [?] [1707]*/ + 0x08,0x08,0xFF,0x08,0x7F,0x41,0x7F,0x41,0x7F,0x49,0x08,0xFF,0x08,0x08,0x08,0x09, + 0x00,0x3E,0xA2,0x22,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22,0xA2,0x42,0x42,0x8A,0x04, + /* 0xB3B0 [?] [1708]*/ + 0x02,0x02,0xEF,0xA2,0xA2,0xAF,0xA8,0xAF,0xA8,0xAF,0xE2,0xA2,0x1F,0x02,0x02,0x02, + 0x00,0x3C,0xA4,0x24,0x24,0xBC,0xA4,0xA4,0xA4,0xBC,0x24,0x24,0xA4,0x44,0x54,0x88, + /* 0xB3B1 [?] [1709]*/ + 0x01,0x41,0x27,0x21,0x01,0x87,0x44,0x57,0x14,0x27,0xE1,0x21,0x2F,0x21,0x21,0x01, + 0x00,0x1E,0xD2,0x12,0x12,0xDE,0x52,0xD2,0x52,0xDE,0x12,0x12,0xD2,0x22,0x2A,0x44, + /* 0xB3B2 [?] [1710]*/ + 0x08,0x11,0x22,0x11,0x08,0x3F,0x21,0x3F,0x21,0x3F,0x01,0xFF,0x05,0x09,0x31,0xC1, + 0x88,0x10,0x20,0x10,0x88,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x40,0x20,0x18,0x06, + /* 0xB3B3 [?] [1711]*/ + 0x00,0x00,0x78,0x49,0x49,0x4A,0x4A,0x4C,0x48,0x48,0x78,0x48,0x00,0x00,0x01,0x06, + 0x40,0x40,0x40,0x48,0x44,0x42,0x42,0x48,0x48,0x48,0x10,0x10,0x20,0x40,0x80,0x00, + /* 0xB3B4 [?] [1712]*/ + 0x10,0x10,0x10,0x10,0x54,0x58,0x51,0x91,0x12,0x10,0x10,0x28,0x24,0x44,0x40,0x83, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xB3B5 [?] [1713]*/ + 0x02,0x02,0x02,0x7F,0x04,0x09,0x11,0x21,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xB3B6 [?] [1714]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x57,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB3B7 [?] [1715]*/ + 0x22,0x21,0x27,0x22,0xF4,0x2F,0x20,0x27,0x34,0xE7,0x24,0x27,0x24,0x24,0xA4,0x45, + 0x08,0x08,0xC8,0x10,0x9E,0xD4,0x64,0x94,0x94,0x94,0x94,0x88,0x88,0x94,0xA4,0xC2, + /* 0xB3B8 [?] [1716]*/ + 0x24,0x3F,0x44,0xFF,0x04,0x3F,0x24,0x25,0x00,0x1F,0x01,0x3F,0x01,0x7F,0x01,0x03, + 0x04,0xA4,0x24,0xA4,0x24,0x84,0x94,0x88,0x20,0xC0,0x00,0xF8,0x00,0xFC,0x00,0x00, + /* 0xB3B9 [?] [1717]*/ + 0x10,0x12,0x22,0x42,0x92,0x12,0x23,0x6E,0xA2,0x22,0x22,0x23,0x22,0x20,0x20,0x21, + 0x00,0x00,0xFC,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0xA4,0x24,0x44,0x44,0x94,0x08, + /* 0xB3BA [?] [1718]*/ + 0x02,0x21,0x17,0x12,0x84,0x4F,0x40,0x17,0x14,0x27,0xE4,0x27,0x24,0x24,0x24,0x05, + 0x08,0x08,0xC8,0x10,0x9E,0xD4,0x64,0x94,0x94,0x94,0x94,0x88,0x88,0x94,0xA4,0xC2, + /* 0xB3BB [?] [1719]*/ + 0x11,0x11,0x11,0x11,0x7B,0x11,0x11,0x33,0x3B,0x55,0x55,0x99,0x11,0x11,0x11,0x11, + 0x00,0x1E,0x12,0x12,0xD4,0x14,0x18,0x14,0x92,0x52,0x12,0x1A,0x14,0x10,0x10,0x10, + /* 0xB3BC [?] [1720]*/ + 0x00,0x3F,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x3F,0x21,0x21,0x21,0x3F,0x00, + 0x00,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,0xFC,0x00, + /* 0xB3BD [?] [1721]*/ + 0x00,0x3F,0x20,0x20,0x2F,0x20,0x20,0x3F,0x24,0x24,0x24,0x24,0x44,0x45,0x86,0x04, + 0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFC,0x80,0x88,0x50,0x20,0x10,0x08,0x06,0x00, + /* 0xB3BE [?] [1722]*/ + 0x01,0x01,0x09,0x09,0x11,0x21,0x41,0x00,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0x20,0x10,0x08,0x04,0x04,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xB3BF [?] [1723]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x20,0x2F,0x20,0x3F,0x29,0x28,0x48,0x4A,0x8C, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x08,0x90,0x60,0x18,0x06, + /* 0xB3C0 [?] [1724]*/ + 0x10,0x10,0x10,0x13,0x1A,0x54,0x50,0x50,0x90,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x40,0x40,0x40,0xFC,0x44,0x48,0x40,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xB3C1 [?] [1725]*/ + 0x00,0x20,0x13,0x12,0x84,0x40,0x41,0x11,0x11,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB3C2 [?] [1726]*/ + 0x00,0x78,0x48,0x57,0x50,0x61,0x51,0x4A,0x4B,0x48,0x69,0x51,0x42,0x44,0x40,0x40, + 0x40,0x40,0x40,0xFE,0x80,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xB3C3 [?] [1727]*/ + 0x08,0x08,0x08,0x7E,0x08,0x09,0xFE,0x08,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x20,0x20,0x50,0x50,0x88,0x24,0x42,0x90,0x20,0x44,0x88,0x10,0x20,0x40,0xFE,0x00, + /* 0xB3C4 [?] [1728]*/ + 0x20,0x10,0x00,0xFC,0x09,0x10,0x10,0x34,0x59,0x94,0x14,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xB3C5 [?] [1729]*/ + 0x11,0x10,0x13,0x12,0xFC,0x10,0x10,0x14,0x19,0x30,0xD1,0x10,0x13,0x10,0x50,0x20, + 0x24,0xA8,0xFE,0x02,0xF8,0x88,0xF8,0x0C,0xF0,0x20,0xFC,0x20,0xFE,0x20,0xA0,0x40, + /* 0xB3C6 [?] [1730]*/ + 0x08,0x1C,0xF0,0x10,0x11,0xFD,0x12,0x30,0x38,0x54,0x51,0x91,0x12,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x02,0x04,0x20,0x20,0xA8,0xA4,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xB3C7 [?] [1731]*/ + 0x20,0x20,0x20,0x27,0x24,0xFC,0x24,0x27,0x24,0x24,0x24,0x3C,0xE6,0x49,0x08,0x10, + 0x28,0x24,0x20,0xFE,0x20,0x20,0x24,0xA4,0xA4,0xA8,0xA8,0x90,0x92,0x2A,0x46,0x82, + /* 0xB3C8 [?] [1732]*/ + 0x10,0x17,0x10,0x12,0xF9,0x12,0x35,0x38,0x57,0x52,0x92,0x13,0x12,0x11,0x1F,0x10, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xB3C9 [?] [1733]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x3E,0x22,0x22,0x22,0x22,0x2A,0x44,0x40,0x81, + 0x50,0x48,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xB3CA [?] [1734]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x00,0x00,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB3CB [?] [1735]*/ + 0x00,0x3F,0x01,0x7F,0x01,0x09,0xF9,0x09,0x39,0xCB,0x05,0x09,0x31,0xC1,0x01,0x01, + 0xF8,0x00,0x00,0xFC,0x00,0x24,0x38,0x22,0x22,0x9E,0x40,0x20,0x18,0x06,0x00,0x00, + /* 0xB3CC [?] [1736]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x10,0x30,0x39,0x54,0x54,0x91,0x10,0x10,0x13,0x10, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xB3CD [?] [1737]*/ + 0x10,0x23,0x40,0x89,0x11,0x31,0x51,0x91,0x17,0x10,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xFE,0x20,0x20,0x3C,0x20,0x20,0x20,0xFE,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xB3CE [?] [1738]*/ + 0x00,0x27,0x10,0x12,0x81,0x42,0x55,0x18,0x13,0x22,0xE2,0x23,0x22,0x21,0x2F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xB3CF [?] [1739]*/ + 0x00,0x40,0x20,0x27,0x04,0x04,0xE4,0x27,0x24,0x24,0x24,0x2C,0x36,0x29,0x08,0x10, + 0x28,0x24,0x20,0xFE,0x20,0x20,0x24,0xA4,0xA4,0xA8,0xA8,0x90,0x92,0x2A,0x46,0x82, + /* 0xB3D0 [?] [1740]*/ + 0x1F,0x00,0x00,0x01,0x79,0x0F,0x09,0x11,0x17,0x21,0x21,0x4F,0x81,0x01,0x05,0x02, + 0xE0,0x40,0x80,0x04,0x28,0xF0,0x20,0x10,0xD0,0x08,0x08,0xE4,0x02,0x00,0x00,0x00, + /* 0xB3D1 [?] [1741]*/ + 0x03,0x22,0x12,0x12,0x03,0x00,0xF7,0x10,0x10,0x13,0x10,0x10,0x17,0x28,0x47,0x00, + 0xF8,0x08,0x08,0x08,0xF8,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFC,0x00,0xFE,0x00, + /* 0xB3D2 [?] [1742]*/ + 0x00,0xF8,0x09,0x49,0x49,0x49,0x49,0x7C,0x07,0x04,0x1D,0xE5,0x44,0x04,0x28,0x10, + 0x20,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE,0x80,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xB3D3 [?] [1743]*/ + 0x08,0x1D,0xF0,0x10,0x11,0xFC,0x10,0x30,0x3B,0x54,0x54,0x90,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xB3D4 [?] [1744]*/ + 0x00,0x00,0x79,0x49,0x4A,0x4C,0x49,0x48,0x48,0x48,0x78,0x49,0x02,0x02,0x01,0x00, + 0x80,0x80,0x00,0xFE,0x00,0x00,0xF8,0x08,0x10,0x60,0x80,0x00,0x02,0x02,0xFE,0x00, + /* 0xB3D5 [?] [1745]*/ + 0x00,0x00,0x1F,0x12,0x92,0x53,0x55,0x19,0x31,0x5F,0x91,0x11,0x22,0x22,0x44,0x88, + 0x80,0x40,0xFE,0x00,0x00,0xBC,0x24,0x24,0x24,0xE4,0x24,0x24,0xA4,0xBC,0x24,0x00, + /* 0xB3D6 [?] [1746]*/ + 0x10,0x10,0x10,0x11,0xFC,0x10,0x13,0x10,0x18,0x33,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x20,0x20,0x20,0xFC,0x20,0x20,0xFE,0x08,0x08,0xFE,0x08,0x88,0x48,0x08,0x28,0x10, + /* 0xB3D7 [?] [1747]*/ + 0x00,0x3E,0x22,0x3E,0x22,0x3E,0x00,0xFF,0x08,0x08,0x2F,0x28,0x28,0x58,0x4F,0x80, + 0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x40,0x44,0x44,0x44,0x3C,0x00,0x00,0xFE,0x00, + /* 0xB3D8 [?] [1748]*/ + 0x00,0x20,0x12,0x12,0x82,0x42,0x53,0x1E,0x12,0x22,0xE2,0x22,0x22,0x22,0x21,0x00, + 0x40,0x40,0x40,0x58,0x68,0xC8,0x48,0x48,0x48,0x48,0x58,0x42,0x02,0x02,0xFE,0x00, + /* 0xB3D9 [?] [1749]*/ + 0x00,0x21,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x12,0x12,0x14,0x10,0x28,0x47,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x20,0x10,0x08,0x04,0x04,0x00,0x00,0xFE,0x00, + /* 0xB3DA [?] [1750]*/ + 0x00,0xF8,0x08,0x09,0x09,0x79,0x41,0x43,0x41,0x79,0x09,0x09,0x09,0x09,0x50,0x20, + 0x20,0x20,0x20,0x20,0x2C,0x34,0x64,0xA4,0x24,0x34,0x28,0x22,0x22,0x02,0xFE,0x00, + /* 0xB3DB [?] [1751]*/ + 0x00,0xF8,0x08,0x49,0x49,0x49,0x49,0x7F,0x05,0x05,0x1D,0xE5,0x45,0x05,0x28,0x10, + 0x20,0x20,0x20,0x20,0x2C,0x34,0x64,0xA4,0x24,0x34,0x28,0x22,0x22,0x02,0xFE,0x00, + /* 0xB3DC [?] [1752]*/ + 0x00,0xFF,0x24,0x24,0x3C,0x24,0x24,0x3C,0x24,0x24,0x2E,0xF4,0x44,0x04,0x05,0x04, + 0x10,0x10,0x10,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xB3DD [?] [1753]*/ + 0x01,0x01,0x11,0x11,0x11,0x11,0xFF,0x00,0x21,0x21,0x22,0x24,0x28,0x20,0x3F,0x00, + 0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x08,0x08,0x88,0x48,0x28,0x08,0xF8,0x08, + /* 0xB3DE [?] [1754]*/ + 0x10,0x10,0x11,0x22,0x25,0x60,0x60,0xA3,0x2C,0x20,0x21,0x26,0x20,0x20,0x21,0x2E, + 0x80,0x80,0xF8,0x10,0x20,0xC0,0x90,0x20,0x7C,0x84,0x08,0x90,0x60,0x40,0x80,0x00, + /* 0xB3DF [?] [1755]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x80,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xB3E0 [?] [1756]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0xFF,0x04,0x04,0x24,0x24,0x44,0x88,0x08,0x11,0x20, + 0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x40,0x40,0x48,0x44,0x42,0x42,0x40,0x40,0x80, + /* 0xB3E1 [?] [1757]*/ + 0x10,0x11,0x10,0xFE,0x11,0x10,0xFC,0x44,0x45,0x28,0x28,0x11,0x18,0x24,0x43,0x80, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0xCC,0x54,0x44,0x44,0x54,0x88,0x00,0xFE,0x00, + /* 0xB3E2 [?] [1758]*/ + 0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x11,0x10,0x10,0x20,0x20,0x40,0x80, + 0x10,0xF8,0x00,0x00,0x00,0x00,0xFE,0x40,0x40,0xC0,0x60,0x50,0x48,0x40,0x40,0x40, + /* 0xB3E3 [?] [1759]*/ + 0x10,0x10,0x11,0x11,0x55,0x59,0x51,0x91,0x11,0x11,0x10,0x28,0x24,0x45,0x42,0x84, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xB3E4 [?] [1760]*/ + 0x02,0x01,0xFF,0x04,0x04,0x08,0x10,0x3F,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x60, + 0x00,0x00,0xFE,0x00,0x00,0x20,0x10,0xF8,0x48,0x40,0x40,0x40,0x44,0x44,0x44,0x3C, + /* 0xB3E5 [?] [1761]*/ + 0x00,0x40,0x20,0x20,0x07,0x04,0x14,0x14,0x24,0xE4,0x27,0x24,0x20,0x20,0x20,0x00, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x44,0x40,0x40,0x40,0x40, + /* 0xB3E6 [?] [1762]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x01,0x01,0x7E,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x10,0x08,0xFC,0x04,0x00, + /* 0xB3E7 [?] [1763]*/ + 0x01,0x21,0x21,0x3F,0x02,0x01,0x7F,0x40,0x9F,0x00,0x7F,0x01,0x11,0x21,0x45,0x02, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xFE,0x02,0xF4,0x00,0xFC,0x00,0x10,0x08,0x04,0x00, + /* 0xB3E8 [?] [1764]*/ + 0x02,0x01,0x7F,0x40,0x84,0x04,0x04,0xFF,0x04,0x08,0x08,0x10,0x10,0x20,0x41,0x86, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x10,0xFE,0x80,0x88,0x90,0xA0,0xC2,0x82,0x82,0x7E, + /* 0xB3E9 [?] [1765]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xB3EA [?] [1766]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAB,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x04,0x44,0x54,0x54,0x54,0x54,0xDC,0x74,0x54,0x54,0x54,0x54,0x54,0x54,0x84,0x04, + /* 0xB3EB [?] [1767]*/ + 0x00,0x00,0xFB,0xA8,0xA9,0xA8,0xFB,0xA8,0xA8,0xA8,0xA9,0xF9,0x8A,0x04,0x00,0x00, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x48,0x88,0xFE,0x08,0x48,0x28,0x08,0x28,0x10, + /* 0xB3EC [?] [1768]*/ + 0x00,0x7C,0x47,0x44,0x45,0x7C,0x13,0x10,0x5C,0x50,0x51,0x51,0x5E,0xE4,0x00,0x00, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x48,0x88,0xFE,0x08,0x48,0x28,0x08,0x28,0x10, + /* 0xB3ED [?] [1769]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x12,0x12,0x14, + 0x00,0xFC,0x24,0x24,0x74,0x24,0xFC,0x04,0x74,0x54,0x54,0x74,0x04,0x04,0x14,0x08, + /* 0xB3EE [?] [1770]*/ + 0x0E,0x78,0x08,0x08,0xFE,0x19,0x2C,0x4A,0x88,0x09,0x0A,0x01,0x28,0x28,0x48,0x07, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0x50,0x50,0x88,0x04,0x02,0x00,0x88,0xA4,0x24,0xE0, + /* 0xB3EF [?] [1771]*/ + 0x20,0x3F,0x48,0x85,0x01,0x7F,0x02,0x3F,0x04,0xFF,0x08,0x1F,0x24,0x42,0x80,0x00, + 0x40,0x7E,0x90,0x08,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0xFC,0x20,0x20,0xA0,0x40, + /* 0xB3F0 [?] [1772]*/ + 0x09,0x09,0x09,0x11,0x17,0x31,0x31,0x51,0x91,0x11,0x11,0x12,0x12,0x14,0x18,0x10, + 0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB3F1 [?] [1773]*/ + 0x10,0x13,0x22,0x22,0x4A,0xFA,0x12,0x23,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x42,0x04, + 0x00,0xFE,0x22,0x22,0xFA,0x22,0x22,0xFE,0x02,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xB3F2 [?] [1774]*/ + 0x00,0x01,0xF7,0x91,0x91,0xF1,0x97,0x91,0xF3,0x93,0x95,0x95,0xF9,0x91,0x01,0x01, + 0x88,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xB3F3 [?] [1775]*/ + 0x00,0x3F,0x02,0x02,0x02,0x02,0x02,0x3F,0x04,0x04,0x04,0x04,0x04,0x04,0xFF,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xB3F4 [?] [1776]*/ + 0x02,0x04,0x3F,0x20,0x3F,0x20,0x3F,0x20,0x3F,0x01,0x01,0xFF,0x02,0x04,0x18,0xE0, + 0x00,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x10,0xFE,0x80,0x40,0x30,0x0E, + /* 0xB3F5 [?] [1777]*/ + 0x20,0x10,0x01,0xFC,0x08,0x10,0x10,0x34,0x58,0x94,0x14,0x10,0x10,0x11,0x12,0x14, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xB3F6 [?] [1778]*/ + 0x01,0x01,0x21,0x21,0x21,0x21,0x3F,0x01,0x01,0x01,0x41,0x41,0x41,0x41,0x7F,0x00, + 0x00,0x00,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB3F7 [?] [1779]*/ + 0x20,0x27,0x24,0x24,0xF7,0x24,0x25,0x75,0x6D,0xA5,0xA4,0x25,0x24,0x24,0x2B,0x20, + 0x00,0xFE,0x00,0x04,0xE4,0x04,0xDE,0x44,0x44,0xD4,0x0C,0x44,0x84,0xE4,0x14,0x08, + /* 0xB3F8 [?] [1780]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x2F,0x29,0x29,0x29,0x2F,0x20,0x29,0x26,0x43,0x5C,0x88, + 0x00,0xFE,0x08,0x88,0x08,0x08,0x7E,0x08,0x08,0x48,0x28,0x08,0x08,0x88,0x28,0x10, + /* 0xB3F9 [?] [1781]*/ + 0x00,0x78,0x4B,0x48,0x48,0x79,0x10,0x10,0x53,0x5C,0x50,0x51,0x5A,0xE4,0x00,0x00, + 0x88,0x88,0xFE,0xA8,0x22,0xFA,0x24,0x28,0xFE,0x40,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xB3FA [?] [1782]*/ + 0x20,0x20,0x3B,0x22,0x42,0x7A,0xA3,0x22,0xFA,0x23,0x22,0x22,0x2A,0x33,0x26,0x00, + 0x08,0x08,0xC8,0x48,0x5E,0x4A,0xCA,0x4A,0x4A,0xCA,0x4A,0x4A,0x6A,0xD2,0x12,0x26, + /* 0xB3FB [?] [1783]*/ + 0x20,0x20,0x3E,0x42,0x85,0x0A,0xFE,0x02,0x02,0x7E,0x02,0x02,0x02,0xFE,0x02,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xB3FC [?] [1784]*/ + 0x40,0x2F,0x29,0x8A,0x4A,0x4C,0x0A,0x29,0x29,0x49,0xCD,0x4A,0x48,0x49,0x48,0x08, + 0x10,0x10,0x28,0x28,0x44,0xBA,0x10,0x10,0xFE,0x10,0x58,0x54,0x92,0x12,0x50,0x20, + /* 0xB3FD [?] [1785]*/ + 0x00,0x78,0x48,0x51,0x52,0x65,0x50,0x48,0x4F,0x48,0x6A,0x52,0x44,0x48,0x41,0x40, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xB3FE [?] [1786]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC8,0x00,0x7F,0x01,0x11,0x11,0x11,0x29,0x47,0x80, + 0x20,0x20,0xFC,0x20,0x70,0xA8,0x24,0x00,0xFC,0x04,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB4A1 [?] [1787]*/ + 0x00,0x00,0xFD,0x11,0x11,0x21,0x3D,0x64,0x64,0xA5,0x25,0x25,0x3D,0x25,0x21,0x00, + 0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xB4A2 [?] [1788]*/ + 0x10,0x10,0x18,0x24,0x24,0x61,0x60,0xBC,0x24,0x25,0x26,0x24,0x25,0x26,0x24,0x20, + 0x20,0x20,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xB4A3 [?] [1789]*/ + 0x01,0x3F,0x01,0x0F,0x08,0x09,0x09,0x7F,0x08,0x7E,0x08,0x3E,0x22,0x2A,0x2A,0xFF, + 0x00,0xF8,0x00,0xE0,0x20,0x20,0x20,0xFC,0x20,0xFC,0x20,0xF8,0x88,0xA8,0xA8,0xFE, + /* 0xB4A4 [?] [1790]*/ + 0x20,0x20,0x27,0x20,0xF9,0x23,0x20,0x29,0x37,0xE0,0x27,0x24,0x27,0x24,0xA7,0x44, + 0x80,0x40,0xFC,0x80,0x08,0xF0,0x60,0x84,0xFE,0x02,0xFC,0x44,0xFC,0x44,0xFC,0x04, + /* 0xB4A5 [?] [1791]*/ + 0x20,0x20,0x78,0x49,0x91,0x7D,0x55,0x55,0x7D,0x55,0x54,0x7C,0x54,0x57,0x45,0x8C, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x28,0x24,0xFE,0x02,0x00, + /* 0xB4A6 [?] [1792]*/ + 0x10,0x10,0x10,0x1E,0x12,0x22,0x22,0x52,0x94,0x14,0x08,0x08,0x14,0x23,0x40,0x80, + 0x40,0x40,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xB4A7 [?] [1793]*/ + 0x20,0x24,0x24,0x24,0xF7,0x20,0x2F,0x20,0x30,0xE7,0x24,0x24,0x24,0x24,0xA4,0x44, + 0x40,0x44,0x44,0x44,0xFC,0x00,0xFE,0x40,0x80,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0x0C, + /* 0xB4A8 [?] [1794]*/ + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x04,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0x04, + /* 0xB4A9 [?] [1795]*/ + 0x02,0x01,0x7F,0x48,0x90,0x00,0x3F,0x00,0x10,0x20,0x3F,0x01,0x06,0x18,0x61,0x00, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xFC,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x80, + /* 0xB4AA [?] [1796]*/ + 0x21,0x21,0x22,0x23,0xF8,0x27,0x20,0x71,0x6E,0xA0,0xA1,0x26,0x20,0x21,0x26,0x20, + 0x00,0xF8,0x08,0xF0,0x10,0xFE,0x80,0x44,0x68,0xB0,0x28,0x68,0xA4,0x22,0xA0,0x40, + /* 0xB4AB [?] [1797]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x37,0x50,0x91,0x13,0x10,0x11,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0xF8,0x40,0x80,0xFE,0x80,0x00,0xF8,0x08,0x10,0xA0,0x40,0x20,0x20, + /* 0xB4AC [?] [1798]*/ + 0x08,0x10,0x3E,0x22,0x32,0x2A,0x2A,0xFF,0x22,0x32,0x2A,0x2A,0x22,0x42,0x4A,0x84, + 0x00,0x78,0x48,0x48,0x48,0x48,0x8E,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xB4AD [?] [1799]*/ + 0x00,0x04,0xF4,0x94,0x97,0x90,0x9F,0x90,0x90,0x97,0xF4,0x94,0x04,0x04,0x04,0x04, + 0x40,0x44,0x44,0x44,0xFC,0x00,0xFE,0x40,0x80,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0x0C, + /* 0xB4AE [?] [1800]*/ + 0x01,0x01,0x3F,0x21,0x21,0x3F,0x01,0x01,0x7F,0x41,0x41,0x7F,0x41,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04,0x00,0x00,0x00, + /* 0xB4AF [?] [1801]*/ + 0x00,0x00,0x1F,0x10,0x90,0x51,0x52,0x14,0x3B,0x52,0x92,0x12,0x22,0x22,0x42,0x81, + 0x80,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC, + /* 0xB4B0 [?] [1802]*/ + 0x02,0x01,0x7F,0x48,0x92,0x04,0x3F,0x22,0x23,0x24,0x2A,0x21,0x22,0x24,0x3F,0x20, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xF8,0x08,0xC8,0x48,0x88,0x08,0x88,0x08,0xF8,0x08, + /* 0xB4B1 [?] [1803]*/ + 0x10,0x11,0x10,0x7C,0x57,0x54,0x55,0x55,0x55,0x55,0x55,0x5C,0x11,0x10,0x13,0x10, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xB4B2 [?] [1804]*/ + 0x01,0x00,0x3F,0x20,0x20,0x20,0x2F,0x20,0x21,0x22,0x22,0x24,0x48,0x50,0x80,0x00, + 0x00,0x80,0xFE,0x00,0x80,0x80,0xFC,0x80,0xC0,0xA0,0xA0,0x90,0x88,0x86,0x80,0x80, + /* 0xB4B3 [?] [1805]*/ + 0x20,0x13,0x10,0x40,0x5F,0x40,0x48,0x48,0x4F,0x40,0x40,0x5F,0x40,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x84,0x84,0x84,0x84,0xE4,0x24,0x24,0xA4,0x24,0x44,0x94,0x08, + /* 0xB4B4 [?] [1806]*/ + 0x08,0x08,0x14,0x12,0x21,0x40,0xBE,0x22,0x22,0x22,0x2A,0x24,0x20,0x20,0x1F,0x00, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x84,0x84,0x94,0x08, + /* 0xB4B5 [?] [1807]*/ + 0x00,0x00,0x78,0x48,0x49,0x49,0x4A,0x4C,0x48,0x48,0x78,0x49,0x01,0x02,0x04,0x08, + 0x80,0x80,0x80,0xFC,0x04,0x08,0x40,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xB4B6 [?] [1808]*/ + 0x10,0x10,0x10,0x12,0x52,0x54,0x59,0x90,0x10,0x10,0x28,0x28,0x24,0x44,0x41,0x82, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB4B7 [?] [1809]*/ + 0x10,0x10,0x13,0x10,0xF8,0x17,0x12,0x1A,0x37,0xD2,0x12,0x17,0x10,0x10,0x57,0x20, + 0x10,0x78,0xC0,0x40,0x40,0xFC,0x48,0x48,0xFE,0x48,0x48,0xFC,0x40,0x40,0xFC,0x00, + /* 0xB4B8 [?] [1810]*/ + 0x20,0x20,0x39,0x20,0x40,0x7B,0xA1,0x21,0xFB,0x21,0x21,0x23,0x28,0x30,0x23,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x24,0x24,0xFE,0x24,0x24,0xFE,0x20,0x20,0xFE,0x00, + /* 0xB4B9 [?] [1811]*/ + 0x00,0x00,0x3F,0x01,0x01,0x7F,0x09,0x09,0xFF,0x09,0x09,0x7F,0x01,0x01,0x3F,0x00, + 0x10,0xF8,0x00,0x00,0x00,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xF8,0x00, + /* 0xB4BA [?] [1812]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x08,0x10,0x2F,0xC8,0x08,0x0F,0x08,0x08,0x0F, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0x10,0xE8,0x26,0x20,0xE0,0x20,0x20,0xE0, + /* 0xB4BB [?] [1813]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x33,0x38,0x55,0x52,0x90,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x88,0x88,0xF8,0x88,0x88,0xF8, + /* 0xB4BC [?] [1814]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x10,0xFE,0x00,0x7C,0x44,0x7C,0x00,0x7C,0x08,0x10,0xFE,0x10,0x10,0x50,0x20, + /* 0xB4BD [?] [1815]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x3F,0x24,0x24,0x25,0x26,0x20,0x2F,0x48,0x48,0x8F,0x08, + 0x00,0xFC,0x00,0xF8,0x00,0xFE,0x88,0x50,0x30,0x0E,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB4BE [?] [1816]*/ + 0x00,0x20,0x17,0x10,0x83,0x42,0x4B,0x08,0x13,0x10,0xE0,0x27,0x20,0x20,0x21,0x00, + 0x80,0x40,0xFC,0x00,0xF8,0x08,0xF8,0x00,0xF8,0x10,0x20,0xFC,0x40,0x40,0x40,0x80, + /* 0xB4BF [?] [1817]*/ + 0x10,0x10,0x20,0x23,0x48,0xFA,0x12,0x22,0x42,0xFB,0x40,0x00,0x18,0xE0,0x40,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xB4C0 [?] [1818]*/ + 0x01,0x7F,0x01,0x3F,0x02,0xFF,0x08,0x3F,0xC8,0x0F,0x10,0x7C,0x54,0x7C,0x12,0xFE, + 0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0xF8,0x26,0xE0,0x20,0xF8,0xA8,0xF8,0x24,0xFC, + /* 0xB4C1 [?] [1819]*/ + 0x00,0xEE,0x22,0xAA,0x66,0xAA,0x01,0x24,0x7F,0xC8,0x7E,0x48,0x7E,0x48,0x7F,0x41, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xB4C2 [?] [1820]*/ + 0x10,0x10,0x20,0x20,0x4B,0xFA,0x13,0x22,0x43,0xFA,0x40,0x07,0x18,0xE0,0x40,0x00, + 0x40,0x40,0x7E,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x44,0x40,0xFE,0x40,0x40,0x40,0x40, + /* 0xB4C3 [?] [1821]*/ + 0x00,0x00,0x1F,0x10,0x91,0x51,0x55,0x15,0x35,0x55,0x95,0x15,0x25,0x25,0x5E,0x88, + 0x80,0x40,0xFE,0x00,0x10,0x10,0x12,0x14,0xD8,0x10,0x10,0x10,0x12,0xD2,0x12,0x0E, + /* 0xB4C4 [?] [1822]*/ + 0x08,0x08,0xFF,0x08,0x40,0x20,0x20,0x09,0x12,0x14,0x20,0xE0,0x20,0x21,0x22,0x2C, + 0x20,0x20,0xFE,0x20,0x80,0x80,0xFC,0x04,0x48,0x40,0x40,0xA0,0xA0,0x10,0x08,0x06, + /* 0xB4C5 [?] [1823]*/ + 0x01,0x00,0xF0,0x27,0x21,0x41,0x72,0xD2,0x54,0x57,0x51,0x52,0x72,0x54,0x07,0x00, + 0x08,0x88,0x90,0xFE,0x08,0x08,0x10,0x94,0xA4,0x38,0x08,0x10,0x10,0xA4,0xBC,0x84, + /* 0xB4C6 [?] [1824]*/ + 0x14,0x14,0x14,0x54,0x55,0x5E,0x54,0x54,0x54,0x54,0x54,0x54,0x5D,0x76,0xC4,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xB4C7 [?] [1825]*/ + 0x08,0x1C,0x70,0x11,0x10,0xFC,0x10,0x11,0x7C,0x44,0x45,0x44,0x44,0x7C,0x44,0x00, + 0x40,0x20,0x20,0xFC,0x00,0x88,0x50,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xB4C8 [?] [1826]*/ + 0x08,0x04,0xFF,0x10,0x10,0x24,0x78,0x10,0x24,0x7E,0x02,0x01,0x28,0x28,0x48,0x07, + 0x20,0x40,0xFE,0x20,0x20,0x48,0xF0,0x20,0x48,0xFC,0x04,0x00,0x88,0xA4,0x24,0xE0, + /* 0xB4C9 [?] [1827]*/ + 0x01,0x41,0x21,0x0A,0x14,0xE0,0x21,0x26,0x00,0x7F,0x08,0x0F,0x09,0x10,0x16,0x18, + 0x00,0x00,0xFC,0x44,0x48,0xA0,0x10,0x0C,0x00,0xFC,0x00,0xE0,0x20,0xA4,0x24,0x1C, + /* 0xB4CA [?] [1828]*/ + 0x00,0x23,0x10,0x10,0x07,0x00,0xF0,0x13,0x12,0x12,0x12,0x13,0x14,0x18,0x10,0x00, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x14,0x08, + /* 0xB4CB [?] [1829]*/ + 0x04,0x04,0x04,0x24,0x24,0x27,0x24,0x24,0x24,0x24,0x24,0x24,0x2F,0xF0,0x40,0x00, + 0x40,0x40,0x40,0x44,0x48,0x50,0x60,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xB4CC [?] [1830]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7F,0x49,0x49,0x4D,0x4A,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x04,0x04,0x84,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x84,0x14,0x08, + /* 0xB4CD [?] [1831]*/ + 0x00,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x12,0x28,0x25,0x44,0x80, + 0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x40,0xFE,0x2A,0x4A,0x92,0x22,0x4A,0x84, + /* 0xB4CE [?] [1832]*/ + 0x00,0x40,0x20,0x20,0x01,0x09,0x0A,0x14,0x10,0xE0,0x20,0x21,0x21,0x22,0x24,0x08, + 0x80,0x80,0x80,0xFC,0x04,0x08,0x40,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xB4CF [?] [1833]*/ + 0x00,0xFC,0x48,0x49,0x79,0x49,0x49,0x79,0x48,0x48,0x4C,0x79,0xC9,0x09,0x0A,0x08, + 0x88,0x48,0x50,0xFC,0x04,0x04,0x04,0xFC,0x20,0x10,0x54,0x42,0x42,0x4A,0x38,0x00, + /* 0xB4D0 [?] [1834]*/ + 0x04,0x04,0xFF,0x04,0x08,0x1F,0x2A,0x44,0x0A,0x11,0x22,0x04,0x01,0x48,0x48,0x87, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x48,0x48,0x88,0x08,0xA8,0x10,0x00,0x84,0x12,0xF2, + /* 0xB4D1 [?] [1835]*/ + 0x04,0x08,0x7F,0x42,0x42,0x47,0x48,0x52,0x41,0x40,0x41,0x46,0x58,0x40,0x7F,0x40, + 0x00,0x00,0xFC,0x04,0x04,0xF4,0x14,0x24,0x44,0x84,0x44,0x24,0x04,0x04,0xFC,0x04, + /* 0xB4D2 [?] [1836]*/ + 0x08,0x08,0x08,0x1F,0x12,0x22,0x42,0x9C,0x06,0x09,0x10,0x21,0x42,0x04,0x08,0x10, + 0x00,0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x84,0xC4,0x24,0x14,0x04,0x28,0x10, + /* 0xB4D3 [?] [1837]*/ + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x14,0x12,0x12,0x20,0x21,0x42,0x84, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x04,0x02, + /* 0xB4D4 [?] [1838]*/ + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x14,0x12,0x22,0x20,0x41,0x82,0x00,0xFF,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x50,0x50,0x88,0x88,0x04,0x02,0x00,0xFE,0x00, + /* 0xB4D5 [?] [1839]*/ + 0x00,0x40,0x27,0x20,0x03,0x00,0x17,0x11,0x22,0xE5,0x20,0x23,0x20,0x20,0x21,0x06, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x08,0xF6,0x40,0xF8,0x40,0xA0,0x10,0x08, + /* 0xB4D6 [?] [1840]*/ + 0x10,0x11,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x17,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xB4D7 [?] [1841]*/ + 0x00,0xFE,0x28,0x29,0xFE,0xAA,0xAB,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x48,0x48,0x48,0xFE,0x48,0x48,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xB4D8 [?] [1842]*/ + 0x20,0x3F,0x48,0x85,0x20,0x10,0xFE,0x21,0x20,0x3C,0x25,0x24,0x25,0x44,0x54,0x89, + 0x40,0x7E,0x90,0x08,0x40,0x40,0xFE,0x20,0x40,0xFC,0x20,0x20,0xFE,0x50,0x88,0x06, + /* 0xB4D9 [?] [1843]*/ + 0x08,0x0B,0x0A,0x12,0x12,0x32,0x33,0x50,0x90,0x12,0x12,0x12,0x12,0x15,0x18,0x10, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x00, + /* 0xB4DA [?] [1844]*/ + 0x00,0x78,0x4B,0x4A,0x49,0x7A,0x11,0x11,0x51,0x5C,0x53,0x52,0x5B,0xE2,0x00,0x00, + 0x40,0x20,0xFE,0x8A,0x24,0x22,0xFC,0x24,0xFC,0x20,0xFE,0x22,0xFE,0x22,0x20,0x20, + /* 0xB4DB [?] [1845]*/ + 0x20,0x3F,0x48,0x9F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x02,0x7F,0x04,0x1A,0xE4,0x0F, + 0x40,0x7E,0x90,0xF8,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x40,0x30,0x4E,0xE0, + /* 0xB4DC [?] [1846]*/ + 0x02,0x01,0x7F,0x48,0x91,0x01,0x3F,0x21,0x3F,0x01,0x7F,0x41,0x7F,0x41,0x01,0x01, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xF8,0x08,0xF8,0x00,0xFC,0x04,0xFC,0x04,0x00,0x00, + /* 0xB4DD [?] [1847]*/ + 0x10,0x12,0x13,0x10,0xFC,0x11,0x13,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x22,0xFE,0x90,0x88,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xB4DE [?] [1848]*/ + 0x01,0x41,0x7F,0x09,0x08,0x1F,0x10,0x30,0x5F,0x90,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x04,0xFC,0x00,0x80,0xFC,0x80,0x80,0xF8,0x80,0x80,0xF8,0x80,0x80,0xFC,0x00, + /* 0xB4DF [?] [1849]*/ + 0x08,0x0A,0x0B,0x10,0x10,0x31,0x33,0x55,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x22,0xFE,0x90,0x88,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xB4E0 [?] [1850]*/ + 0x00,0x3C,0x24,0x25,0x26,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x8A, + 0x40,0x40,0xFC,0x04,0x08,0xFE,0x00,0x7C,0x44,0x44,0x54,0x48,0x42,0x42,0x3E,0x00, + /* 0xB4E1 [?] [1851]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x51,0x11,0x32,0x54,0x90,0x1F,0x20,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x40,0xFC,0x10,0x10,0xA8,0x44,0x40,0xFE,0x40,0x40,0x40,0x40, + /* 0xB4E2 [?] [1852]*/ + 0x10,0x10,0x95,0x54,0x58,0x10,0xFD,0x32,0x38,0x54,0x55,0x90,0x10,0x10,0x10,0x10, + 0x40,0x20,0xFE,0x00,0x88,0x88,0x54,0x22,0x00,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xB4E3 [?] [1853]*/ + 0x00,0x20,0x17,0x10,0x81,0x41,0x42,0x14,0x10,0x20,0xE7,0x20,0x20,0x20,0x20,0x00, + 0x80,0x40,0xFC,0x00,0x10,0x10,0xA8,0x44,0x00,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xB4E4 [?] [1854]*/ + 0x00,0x7E,0x22,0x12,0x1A,0x62,0x02,0x01,0x7F,0x08,0x14,0x22,0x01,0xFF,0x01,0x01, + 0x00,0xFC,0x44,0x24,0x34,0xC4,0x04,0x00,0xFC,0x20,0x50,0x88,0x00,0xFE,0x00,0x00, + /* 0xB4E5 [?] [1855]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x38,0x55,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xB4E6 [?] [1856]*/ + 0x04,0x04,0xFF,0x08,0x08,0x13,0x10,0x30,0x50,0x97,0x10,0x10,0x10,0x10,0x11,0x10, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x10,0x20,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xB4E7 [?] [1857]*/ + 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x10,0x08,0x08,0x00,0x00,0x00,0x01,0x00, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xB4E8 [?] [1858]*/ + 0x00,0x00,0xFC,0x11,0x10,0x20,0x3C,0x65,0x64,0xA4,0x24,0x25,0x3E,0x24,0x21,0x00, + 0x84,0x44,0x48,0xFE,0x20,0xFC,0x20,0xFE,0x40,0x80,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xB4E9 [?] [1859]*/ + 0x20,0x23,0x22,0x23,0xFA,0x23,0x20,0x2F,0x34,0xE7,0x24,0x27,0x24,0x2F,0xA0,0x40, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x80,0xBC,0x94,0x94,0xD4,0x88,0x94,0xA2, + /* 0xB4EA [?] [1860]*/ + 0x11,0x10,0x10,0x13,0xFC,0x11,0x10,0x17,0x18,0x31,0xD1,0x12,0x14,0x18,0x53,0x20, + 0x08,0x88,0x90,0xFC,0x40,0xF8,0x40,0xFE,0x80,0x00,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xB4EB [?] [1861]*/ + 0x10,0x10,0x10,0x13,0xF8,0x10,0x17,0x18,0x31,0xD1,0x11,0x11,0x11,0x11,0x51,0x21, + 0x88,0x88,0x88,0xFE,0x88,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB4EC [?] [1862]*/ + 0x20,0x20,0x22,0x22,0xF2,0x25,0x28,0x20,0x30,0xE7,0x20,0x20,0x20,0x20,0xAF,0x40, + 0x40,0x40,0x48,0x48,0x48,0x54,0xE2,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xB4ED [?] [1863]*/ + 0x21,0x21,0x39,0x27,0x41,0x79,0xAF,0x20,0xFB,0x22,0x22,0x23,0x2A,0x32,0x23,0x02, + 0x10,0x10,0x10,0xFC,0x10,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB4EE [?] [1864]*/ + 0x21,0x21,0x27,0x21,0xF8,0x20,0x21,0x2A,0x35,0xE0,0x20,0x23,0x22,0x22,0xA3,0x42, + 0x10,0x10,0xFC,0x10,0x40,0xA0,0x10,0x08,0xF6,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB4EF [?] [1865]*/ + 0x00,0x20,0x10,0x10,0x07,0x00,0xF0,0x10,0x10,0x11,0x12,0x14,0x10,0x28,0x47,0x00, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0xA0,0x90,0x08,0x04,0x04,0x00,0x00,0xFE,0x00, + /* 0xB4F0 [?] [1866]*/ + 0x10,0x10,0x3F,0x28,0x45,0x82,0x0C,0x30,0xCF,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x80,0x60,0x18,0xE6,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xB4F1 [?] [1867]*/ + 0x00,0x00,0x1F,0x11,0x91,0x57,0x51,0x10,0x31,0x52,0x9C,0x13,0x22,0x22,0x43,0x82, + 0x80,0x40,0xFE,0x10,0x10,0xFC,0x50,0xA0,0x10,0xE8,0x06,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB4F2 [?] [1868]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x14,0x18,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB4F3 [?] [1869]*/ + 0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xB4F4 [?] [1870]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x01,0x01,0x7F,0x03,0x05,0x09,0x11,0x21,0xC1,0x01, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xFC,0x80,0x40,0x20,0x10,0x08,0x06,0x00, + /* 0xB4F5 [?] [1871]*/ + 0x00,0xFF,0x02,0x02,0x04,0x07,0x08,0x10,0x24,0x42,0x01,0x00,0x01,0x02,0x0C,0x70, + 0x00,0xFE,0x00,0x00,0x00,0xF8,0x08,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xB4F6 [?] [1872]*/ + 0x08,0x08,0x0F,0x10,0x13,0x30,0x37,0x51,0x92,0x14,0x12,0x11,0x12,0x14,0x11,0x10, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x48,0x46,0x48,0x50,0x48,0x44,0x40,0x80, + /* 0xB4F7 [?] [1873]*/ + 0x08,0x7F,0x08,0xFF,0x00,0x7F,0x49,0x7F,0x49,0x7F,0x22,0x7F,0x22,0xFF,0x22,0x41, + 0x20,0x28,0x24,0xFE,0x20,0x20,0x24,0x24,0x24,0x28,0x28,0x10,0x12,0xAA,0x46,0x82, + /* 0xB4F8 [?] [1874]*/ + 0x09,0x09,0x7F,0x09,0x09,0x00,0x7F,0x41,0x81,0x1F,0x11,0x11,0x11,0x11,0x01,0x01, + 0x20,0x20,0xFC,0x20,0x20,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0x50,0x20,0x00,0x00, + /* 0xB4F9 [?] [1875]*/ + 0x00,0xFC,0x20,0x20,0x20,0x3C,0x45,0x44,0x64,0x94,0x08,0x08,0x10,0x20,0x40,0x80, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xB4FA [?] [1876]*/ + 0x08,0x08,0x08,0x10,0x10,0x37,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x90,0x88,0x88,0x80,0xBE,0xC0,0x80,0x40,0x40,0x40,0x20,0x22,0x12,0x0A,0x06,0x02, + /* 0xB4FB [?] [1877]*/ + 0x08,0x10,0x30,0xD7,0x10,0x10,0x00,0x1F,0x10,0x11,0x11,0x11,0x12,0x04,0x18,0x60, + 0x90,0x88,0x7E,0xC0,0x22,0x1A,0x06,0xF0,0x10,0x10,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xB4FC [?] [1878]*/ + 0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x12,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0xA0,0x90,0xBE,0xC0,0x40,0x24,0x14,0x0C,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xB4FD [?] [1879]*/ + 0x08,0x08,0x10,0x23,0x48,0x08,0x17,0x30,0x50,0x97,0x10,0x12,0x11,0x11,0x10,0x10, + 0x40,0x40,0x40,0xFC,0x40,0x40,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xB4FE [?] [1880]*/ + 0x00,0x20,0x13,0x10,0x07,0x00,0xF3,0x14,0x12,0x11,0x12,0x14,0x11,0x28,0x47,0x00, + 0x40,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x44,0x48,0x50,0x48,0x44,0x40,0x80,0xFE,0x00, + /* 0xB5A1 [?] [1881]*/ + 0x02,0x04,0x08,0x10,0x3F,0x00,0x1F,0x10,0x10,0x1F,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0x20,0x10,0xF8,0x08,0xF0,0x10,0x10,0xF0,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xB5A2 [?] [1882]*/ + 0x00,0xFC,0x48,0x4B,0x7A,0x4C,0x48,0x78,0x48,0x48,0x4C,0x79,0xC9,0x0A,0x0C,0x08, + 0x40,0x40,0x40,0xFC,0x44,0x48,0x40,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xB5A3 [?] [1883]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x10,0x10,0x53,0x20, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xB5A4 [?] [1884]*/ + 0x00,0x1F,0x10,0x10,0x12,0x11,0x11,0x10,0xFF,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xB5A5 [?] [1885]*/ + 0x10,0x08,0x04,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01, + 0x10,0x20,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xB5A6 [?] [1886]*/ + 0x41,0x22,0x14,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x08,0x08,0xFF,0x08,0x08,0x08, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0xA8,0x20,0x20,0x20, + /* 0xB5A7 [?] [1887]*/ + 0x11,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD0,0x10,0x13,0x10,0x50,0x20, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xB5A8 [?] [1888]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x55,0x88, + 0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x00,0x00,0xFE,0x00, + /* 0xB5A9 [?] [1889]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x1F,0x00,0x00,0xFF,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0xFE,0x00, + /* 0xB5AA [?] [1890]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x04,0x24,0x0B,0x10,0x60,0x04,0x24,0x0B,0x10,0x60, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x10,0x90,0x50,0x12,0x8A,0x0A,0x86,0x42, + /* 0xB5AB [?] [1891]*/ + 0x08,0x08,0x0B,0x12,0x12,0x32,0x33,0x52,0x92,0x12,0x13,0x12,0x10,0x10,0x17,0x10, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xB5AC [?] [1892]*/ + 0x11,0x10,0x10,0x11,0x19,0x55,0x51,0x51,0x91,0x11,0x10,0x10,0x13,0x10,0x10,0x10, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xB5AD [?] [1893]*/ + 0x00,0x22,0x12,0x14,0x80,0x41,0x46,0x10,0x10,0x22,0xE2,0x24,0x20,0x21,0x22,0x0C, + 0x40,0x44,0x44,0x48,0xA0,0x10,0x08,0x44,0x40,0x48,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xB5AE [?] [1894]*/ + 0x00,0x40,0x2F,0x21,0x02,0x04,0xEF,0x21,0x29,0x29,0x25,0x2A,0x33,0x24,0x08,0x10, + 0x08,0x1C,0x70,0x10,0x10,0x50,0x5C,0x50,0x50,0x50,0x50,0x7C,0x00,0x80,0x7E,0x00, + /* 0xB5AF [?] [1895]*/ + 0x01,0xF8,0x08,0x09,0x09,0x79,0x41,0x41,0x41,0x79,0x08,0x08,0x0B,0x08,0x50,0x20, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xB5B0 [?] [1896]*/ + 0x7F,0x01,0x11,0x11,0x11,0x29,0x47,0x81,0x1F,0x11,0x11,0x1F,0x11,0x01,0x7F,0x20, + 0xFC,0x04,0x00,0xF8,0x00,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xB5B1 [?] [1897]*/ + 0x01,0x21,0x11,0x09,0x09,0x01,0x7F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x7F,0x00, + 0x00,0x08,0x08,0x10,0x20,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xB5B2 [?] [1898]*/ + 0x10,0x12,0x11,0x11,0xFD,0x10,0x17,0x10,0x18,0x30,0xD3,0x10,0x10,0x10,0x57,0x20, + 0x40,0x44,0x44,0x44,0x48,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB5B3 [?] [1899]*/ + 0x01,0x11,0x09,0x09,0x7F,0x40,0x80,0x1F,0x10,0x10,0x1F,0x04,0x04,0x08,0x30,0xC0, + 0x00,0x10,0x10,0x20,0xFE,0x02,0x04,0xF0,0x10,0x10,0xF0,0x40,0x40,0x42,0x42,0x3E, + /* 0xB5B4 [?] [1900]*/ + 0x08,0x08,0xFF,0x08,0x00,0x23,0x10,0x10,0x80,0x4B,0x48,0x11,0xE2,0x24,0x21,0x22, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x20,0x40,0x80,0xFC,0xA4,0x24,0x44,0x84,0x28,0x10, + /* 0xB5B5 [?] [1901]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x33,0x38,0x54,0x50,0x91,0x10,0x10,0x10,0x13,0x10, + 0x20,0x24,0xA4,0xA4,0xA8,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB5B6 [?] [1902]*/ + 0x00,0x00,0x3F,0x02,0x02,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB5B7 [?] [1903]*/ + 0x20,0x20,0x23,0x22,0xFA,0x22,0x22,0x2A,0x33,0xE0,0x24,0x24,0x27,0x20,0xA0,0x40, + 0x40,0x80,0xF8,0x08,0x88,0x48,0x18,0x00,0xFE,0x82,0x92,0x92,0xF2,0x02,0x14,0x08, + /* 0xB5B8 [?] [1904]*/ + 0x00,0x7D,0x44,0x45,0x44,0x7C,0x10,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01, + 0x1E,0xE0,0x22,0x12,0x94,0x80,0x20,0xCE,0x02,0x02,0xCE,0x02,0x02,0x02,0xFE,0x02, + /* 0xB5B9 [?] [1905]*/ + 0x10,0x10,0x1F,0x22,0x22,0x64,0x67,0xA1,0x21,0x27,0x21,0x21,0x21,0x2E,0x24,0x20, + 0x04,0x04,0xC4,0x14,0x14,0x94,0xD4,0x14,0x14,0xD4,0x14,0x14,0xC4,0x04,0x14,0x08, + /* 0xB5BA [?] [1906]*/ + 0x01,0x02,0x1F,0x10,0x12,0x11,0x10,0x10,0x1F,0x02,0x22,0x22,0x3F,0x00,0x00,0x00, + 0x00,0x00,0xF0,0x10,0x10,0x50,0x20,0x00,0xFC,0x04,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xB5BB [?] [1907]*/ + 0x20,0x10,0x13,0xF8,0x09,0x10,0x13,0x38,0x54,0x94,0x11,0x11,0x12,0x14,0x10,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x48,0x88,0xFE,0x08,0x48,0x28,0x08,0x28,0x10, + /* 0xB5BC [?] [1908]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x1F,0x00,0x00,0xFF,0x08,0x04,0x04,0x00,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xB5BD [?] [1909]*/ + 0x00,0xFF,0x08,0x10,0x22,0x41,0xFF,0x08,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF8,0x40, + 0x04,0x84,0x04,0x24,0x24,0x24,0xA4,0xA4,0x24,0x24,0x24,0x24,0x04,0x84,0x14,0x08, + /* 0xB5BE [?] [1910]*/ + 0x08,0x1D,0xF0,0x11,0x10,0xFC,0x10,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x1E,0xE0,0x22,0x12,0x94,0x80,0x20,0xCE,0x02,0x02,0xCE,0x02,0x02,0x02,0xFE,0x02, + /* 0xB5BF [?] [1911]*/ + 0x10,0x10,0x10,0x10,0x1B,0x56,0x53,0x52,0x93,0x12,0x10,0x17,0x10,0x10,0x10,0x10, + 0x40,0x40,0x7E,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x44,0x40,0xFE,0x40,0x40,0x40,0x40, + /* 0xB5C0 [?] [1912]*/ + 0x02,0x21,0x10,0x17,0x00,0x03,0xF2,0x13,0x12,0x13,0x12,0x13,0x12,0x28,0x47,0x00, + 0x08,0x10,0x00,0xFC,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xB5C1 [?] [1913]*/ + 0x40,0x20,0x09,0x12,0x24,0xE0,0x20,0x23,0x2C,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x80,0x80,0xFC,0x04,0x48,0x40,0xA0,0x18,0x06,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xB5C2 [?] [1914]*/ + 0x10,0x10,0x2F,0x40,0x97,0x14,0x24,0x67,0xA0,0x2F,0x20,0x20,0x25,0x25,0x29,0x20, + 0x40,0x40,0xFE,0x40,0xFC,0xA4,0xA4,0xFC,0x00,0xFE,0x40,0x24,0x22,0x0A,0x08,0xF8, + /* 0xB5C3 [?] [1915]*/ + 0x08,0x0B,0x12,0x23,0x4A,0x0B,0x10,0x33,0x50,0x97,0x10,0x12,0x11,0x10,0x10,0x10, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x10,0xFE,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xB5C4 [?] [1916]*/ + 0x10,0x10,0x20,0x7E,0x42,0x42,0x43,0x42,0x7E,0x42,0x42,0x42,0x42,0x7E,0x42,0x00, + 0x40,0x40,0x40,0x7C,0x84,0x84,0x04,0x44,0x24,0x24,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xB5C5 [?] [1917]*/ + 0x00,0x7B,0x48,0x49,0x48,0x79,0x12,0x14,0x51,0x5D,0x51,0x51,0x59,0xE0,0x07,0x00, + 0x10,0xD2,0x54,0x48,0x8A,0x04,0xFA,0x00,0xFC,0x04,0x04,0xFC,0x04,0x88,0xFE,0x00, + /* 0xB5C6 [?] [1918]*/ + 0x10,0x10,0x13,0x10,0x54,0x58,0x50,0x90,0x10,0x10,0x10,0x28,0x24,0x44,0x40,0x80, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB5C7 [?] [1919]*/ + 0x00,0x3E,0x02,0x24,0x14,0x08,0x17,0x20,0xDF,0x10,0x10,0x1F,0x08,0x04,0x7F,0x00, + 0x80,0x90,0xA4,0x48,0x50,0x20,0xD0,0x08,0xF6,0x10,0x10,0xF0,0x20,0x40,0xFC,0x00, + /* 0xB5C8 [?] [1920]*/ + 0x20,0x3F,0x48,0x85,0x01,0x3F,0x01,0x01,0xFF,0x00,0x00,0x7F,0x08,0x04,0x04,0x00, + 0x40,0x7E,0x90,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00,0x20,0xFC,0x20,0x20,0xA0,0x40, + /* 0xB5C9 [?] [1921]*/ + 0x00,0x07,0xF0,0x92,0x91,0xF2,0x95,0x98,0xF3,0x92,0x92,0x93,0xF2,0x91,0x0F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xB5CA [?] [1922]*/ + 0x00,0x7E,0x04,0x2B,0x10,0x2F,0xC8,0x0F,0x04,0x7F,0x00,0x0F,0x08,0x08,0x10,0x60, + 0x90,0xA0,0x44,0xA8,0x10,0xE8,0x26,0xE0,0x40,0xFC,0x00,0xE0,0x20,0x22,0x22,0x1E, + /* 0xB5CB [?] [1923]*/ + 0x00,0x7E,0x02,0x02,0x42,0x24,0x14,0x08,0x08,0x14,0x14,0x22,0x42,0x80,0x00,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xB5CC [?] [1924]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x10,0x13,0x10,0x1D,0xE1,0x41,0x02,0x04, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x20,0x20,0x3C,0x20,0xA0,0x7E, + /* 0xB5CD [?] [1925]*/ + 0x08,0x08,0x0B,0x12,0x12,0x32,0x32,0x53,0x92,0x12,0x12,0x12,0x12,0x12,0x13,0x12, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xB5CE [?] [1926]*/ + 0x00,0x20,0x17,0x11,0x80,0x47,0x44,0x15,0x14,0x25,0xE5,0x25,0x25,0x24,0x24,0x04, + 0x80,0x40,0xFC,0x10,0xA0,0xFC,0x44,0xF4,0x44,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xB5CF [?] [1927]*/ + 0x00,0x40,0x20,0x27,0x04,0x04,0xE4,0x27,0x24,0x24,0x24,0x27,0x20,0x50,0x8F,0x00, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x00,0x00,0xFE,0x00, + /* 0xB5D0 [?] [1928]*/ + 0x04,0x0E,0x38,0x08,0x08,0xFF,0x08,0x08,0x3E,0x22,0x22,0x22,0x22,0x3E,0x22,0x01, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xB5D1 [?] [1929]*/ + 0x10,0x10,0x3F,0x28,0x45,0x81,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x20, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xB5D2 [?] [1930]*/ + 0x00,0x44,0x28,0x10,0x29,0x49,0x89,0x0A,0x18,0x28,0x48,0x88,0x09,0x09,0x52,0x24, + 0x40,0x40,0x40,0x40,0x44,0x44,0x48,0x50,0x40,0xA0,0xA0,0x90,0x10,0x08,0x04,0x02, + /* 0xB5D3 [?] [1931]*/ + 0x00,0x20,0x11,0x13,0x84,0x40,0x41,0x16,0x10,0x27,0xE0,0x22,0x22,0x24,0x21,0x00, + 0x80,0x80,0xF8,0x08,0x90,0x60,0x98,0x46,0x40,0xFC,0x40,0x48,0x44,0x44,0x40,0x80, + /* 0xB5D4 [?] [1932]*/ + 0x00,0x7E,0x22,0x12,0x1A,0x62,0x02,0x09,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x10, + 0x00,0xFC,0x44,0x24,0x34,0xC4,0x04,0x00,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00, + /* 0xB5D5 [?] [1933]*/ + 0x20,0x20,0x23,0x20,0xF8,0x4B,0x4A,0x4A,0x4A,0x92,0x52,0x22,0x32,0x4A,0x4A,0x82, + 0x40,0x20,0xFE,0x88,0x50,0xFE,0x22,0xFA,0x22,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xB5D6 [?] [1934]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x12,0x13,0x1A,0x32,0xD2,0x12,0x12,0x12,0x53,0x22, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xB5D7 [?] [1935]*/ + 0x01,0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x27,0x24,0x24,0x24,0x45,0x46,0x84, + 0x00,0x80,0xFE,0x00,0x3C,0xC0,0x40,0x40,0x40,0xFE,0x20,0x20,0x12,0x0A,0x46,0x22, + /* 0xB5D8 [?] [1936]*/ + 0x10,0x10,0x10,0x11,0x11,0xFD,0x11,0x13,0x11,0x11,0x11,0x1D,0xE1,0x41,0x00,0x00, + 0x20,0x20,0x20,0x20,0x2C,0x34,0x64,0xA4,0x24,0x34,0x28,0x22,0x22,0x02,0xFE,0x00, + /* 0xB5D9 [?] [1937]*/ + 0x08,0xFF,0x0A,0x01,0x3F,0x08,0x04,0x7F,0x41,0x81,0x1F,0x11,0x11,0x11,0x01,0x01, + 0x20,0xFE,0x20,0x00,0xF8,0x20,0x40,0xFE,0x02,0x04,0xF0,0x10,0x50,0x20,0x00,0x00, + /* 0xB5DA [?] [1938]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x01,0x01,0x3F,0x21,0x21,0x3F,0x03,0x05,0x19,0xE1,0x01, + 0x40,0x7E,0x90,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x28,0x10,0x00, + /* 0xB5DB [?] [1939]*/ + 0x02,0x01,0x3F,0x00,0x08,0x04,0x7F,0x41,0x81,0x1F,0x11,0x11,0x11,0x11,0x01,0x01, + 0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x02,0x04,0xF0,0x10,0x10,0x50,0x20,0x00,0x00, + /* 0xB5DC [?] [1940]*/ + 0x08,0x04,0x04,0x7F,0x01,0x01,0x3F,0x21,0x21,0x3F,0x03,0x05,0x09,0x11,0x61,0x01, + 0x20,0x20,0x40,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x14,0x08,0x00,0x00, + /* 0xB5DD [?] [1941]*/ + 0x01,0x20,0x13,0x10,0x00,0x03,0xF2,0x12,0x13,0x10,0x11,0x12,0x14,0x28,0x47,0x00, + 0x10,0xA0,0xF8,0x48,0x48,0xF8,0x40,0x40,0xFC,0xC4,0x44,0x54,0x48,0x40,0xFE,0x00, + /* 0xB5DE [?] [1942]*/ + 0x10,0x10,0x21,0x24,0x44,0xF8,0x13,0x22,0x44,0xFD,0x41,0x01,0x1D,0xE1,0x40,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xB5DF [?] [1943]*/ + 0x08,0x08,0x7F,0x08,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x7F,0x14,0x22,0x41, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xB5E0 [?] [1944]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x12,0x12,0x1A,0x32,0xD2,0x12,0x12,0x14,0x54,0x28, + 0x40,0x20,0xFE,0x00,0x20,0x20,0x3E,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xB5E1 [?] [1945]*/ + 0x00,0x20,0x17,0x10,0x83,0x42,0x43,0x12,0x13,0x22,0xE3,0x22,0x2F,0x21,0x22,0x04, + 0x40,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFE,0x10,0x08,0x04, + /* 0xB5E2 [?] [1946]*/ + 0x00,0x00,0xFC,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x27,0x3C,0x24,0x21,0x02, + 0x50,0x50,0x50,0xFC,0x54,0x54,0x54,0xFC,0x54,0x54,0x54,0xFE,0x00,0x88,0x04,0x02, + /* 0xB5E3 [?] [1947]*/ + 0x02,0x02,0x02,0x03,0x02,0x02,0x3F,0x20,0x20,0x20,0x3F,0x00,0x24,0x22,0x42,0x80, + 0x00,0x00,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x88,0x44,0x44,0x04, + /* 0xB5E4 [?] [1948]*/ + 0x04,0x04,0x04,0x3F,0x24,0x24,0x24,0x3F,0x24,0x24,0x24,0xFF,0x04,0x08,0x10,0x20, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0xF8,0x48,0x48,0x48,0xFE,0x40,0x20,0x10,0x08, + /* 0xB5E5 [?] [1949]*/ + 0x10,0x10,0xFE,0x10,0x7D,0x10,0xFE,0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x55,0x4A, + 0x20,0x10,0xFE,0x82,0x04,0x00,0xFE,0x10,0x10,0x90,0x9E,0x90,0x90,0xD0,0x3E,0x00, + /* 0xB5E6 [?] [1950]*/ + 0x08,0x08,0x7D,0x08,0x0C,0x19,0x68,0x08,0x28,0x11,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x40,0x40,0xF8,0x48,0x48,0xC8,0x4A,0xAA,0x86,0x02,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB5E7 [?] [1951]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x0A,0x02,0x02,0xFE, + /* 0xB5E8 [?] [1952]*/ + 0x10,0x10,0x17,0x24,0x24,0x64,0x64,0xA7,0x24,0x24,0x24,0x24,0x24,0x27,0x24,0x20, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x04,0x00, + /* 0xB5E9 [?] [1953]*/ + 0x08,0x08,0x10,0x1F,0x20,0x40,0xBF,0x24,0x24,0x3F,0x24,0x24,0x3F,0x20,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x50,0x20, + /* 0xB5EA [?] [1954]*/ + 0x01,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x27,0x24,0x24,0x44,0x44,0x87,0x04, + 0x00,0x80,0xFE,0x80,0x80,0x80,0xFC,0x80,0x80,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB5EB [?] [1955]*/ + 0x10,0x10,0x13,0x12,0x1A,0x56,0x52,0x52,0x92,0x12,0x12,0x12,0x12,0x14,0x14,0x18, + 0x40,0x20,0xFE,0x00,0x20,0x20,0x3E,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xB5EC [?] [1956]*/ + 0x08,0x04,0xFF,0x04,0x3F,0x28,0x30,0x27,0x20,0x3F,0x01,0x7F,0x02,0x04,0x18,0xE0, + 0x20,0x40,0xFE,0x40,0xF8,0x48,0x38,0xC8,0x08,0xF8,0x00,0xFC,0x80,0x40,0x30,0x0E, + /* 0xB5ED [?] [1957]*/ + 0x00,0x20,0x13,0x12,0x84,0x40,0x43,0x10,0x10,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xB5EE [?] [1958]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x20,0x2A,0x2A,0x3F,0x2A,0x2A,0x3F,0x20,0x4A,0x91,0x21, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB5EF [?] [1959]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x22,0x02,0x04, + 0x00,0xFC,0x24,0x24,0x74,0x24,0xFC,0x04,0x74,0x54,0x54,0x74,0x04,0x04,0x14,0x08, + /* 0xB5F0 [?] [1960]*/ + 0x00,0x03,0x78,0x48,0x48,0x48,0x48,0x48,0x48,0x49,0x4A,0x78,0x48,0x00,0x00,0x00, + 0x00,0xFC,0x04,0x04,0x04,0x14,0x24,0x44,0x84,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xB5F1 [?] [1961]*/ + 0x00,0x7F,0x49,0x49,0x5D,0x49,0x7F,0x41,0x5D,0x55,0x55,0x5D,0x41,0x41,0x45,0x82, + 0x28,0x24,0x40,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x48,0x7E,0x40,0x40, + /* 0xB5F2 [?] [1962]*/ + 0x00,0x47,0x24,0x24,0x05,0x04,0x14,0x17,0x24,0xE5,0x25,0x25,0x25,0x24,0x24,0x08, + 0x00,0xFC,0x44,0x44,0xF4,0x44,0x44,0xFC,0x04,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xB5F3 [?] [1963]*/ + 0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x60,0x00,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x48,0x88,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB5F4 [?] [1964]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x15,0x19,0x31,0xD1,0x10,0x13,0x10,0x10,0x50,0x20, + 0x20,0x20,0x3E,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xB5F5 [?] [1965]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xB5F6 [?] [1966]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBE,0x10,0x11,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xB5F7 [?] [1967]*/ + 0x00,0x47,0x24,0x24,0x05,0x04,0xE4,0x27,0x24,0x25,0x25,0x2D,0x35,0x24,0x04,0x08, + 0x00,0xFC,0x44,0x44,0xF4,0x44,0x44,0xFC,0x04,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xB5F8 [?] [1968]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x12,0x10,0x11,0x5C,0x50,0x50,0x50,0x5C,0xE1,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB5F9 [?] [1969]*/ + 0x04,0x08,0x18,0x24,0x03,0x0C,0x32,0xC7,0x1A,0x01,0x1E,0x01,0x0E,0x00,0x03,0x3C, + 0x40,0x20,0x50,0x88,0x00,0xC0,0x30,0xCE,0x40,0xA0,0x78,0x88,0x90,0x60,0x80,0x00, + /* 0xB5FA [?] [1970]*/ + 0x00,0x02,0xFA,0x27,0x22,0x42,0x7A,0xCA,0x4B,0x48,0x4F,0x48,0x79,0x42,0x0C,0x00, + 0x90,0x90,0x90,0xFE,0x90,0x90,0xF0,0x00,0xFC,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xB5FB [?] [1971]*/ + 0x20,0x21,0x21,0xFB,0xA9,0xA9,0xA9,0xA9,0xF9,0xA0,0x23,0x28,0x38,0xE9,0x46,0x00, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xB5FC [?] [1972]*/ + 0x00,0x22,0x12,0x13,0x02,0x04,0xF0,0x17,0x10,0x10,0x10,0x11,0x12,0x28,0x47,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0xA0,0x90,0x08,0x08,0x00,0xFE,0x00, + /* 0xB5FD [?] [1973]*/ + 0x00,0x42,0x22,0x27,0x02,0x02,0xE2,0x22,0x23,0x20,0x27,0x20,0x29,0x32,0x2C,0x00, + 0x90,0x90,0x90,0xFE,0x90,0x90,0xF0,0x00,0xFC,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xB5FE [?] [1974]*/ + 0x1F,0x04,0x03,0x0C,0x7E,0x22,0x1C,0x62,0x00,0xFF,0x90,0x1F,0x10,0x1F,0x10,0xFF, + 0xE0,0x40,0x80,0x40,0xFC,0x44,0x38,0x44,0x00,0xFE,0x12,0xF0,0x10,0xF0,0x10,0xFE, + /* 0xB6A1 [?] [1975]*/ + 0x00,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB6A2 [?] [1976]*/ + 0x00,0x00,0x7B,0x48,0x48,0x78,0x48,0x48,0x78,0x48,0x48,0x48,0x78,0x48,0x00,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB6A3 [?] [1977]*/ + 0x00,0x00,0x7B,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB6A4 [?] [1978]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB6A5 [?] [1979]*/ + 0x00,0x01,0xFE,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x10,0x50,0x21,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xB6A6 [?] [1980]*/ + 0x0F,0x08,0x0F,0x48,0x4F,0x48,0x4F,0x40,0x7C,0x04,0x04,0xFC,0x24,0x24,0x44,0x84, + 0xE0,0x20,0xE0,0x24,0xE4,0x24,0xE4,0x04,0x7C,0x40,0x40,0x7C,0x44,0x44,0x44,0x44, + /* 0xB6A7 [?] [1981]*/ + 0x20,0x20,0x3B,0x22,0x44,0x78,0xA3,0x20,0xF8,0x21,0x21,0x21,0x2A,0x32,0x24,0x08, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xB6A8 [?] [1982]*/ + 0x02,0x01,0x7F,0x40,0x80,0x00,0x3F,0x01,0x01,0x11,0x11,0x11,0x11,0x29,0x47,0x80, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xB6A9 [?] [1983]*/ + 0x00,0x20,0x13,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xB6AA [?] [1984]*/ + 0x00,0x00,0x3F,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x02,0x04,0x08,0x10,0x3F,0x10, + 0x10,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x20,0x10,0xF8,0x08, + /* 0xB6AB [?] [1985]*/ + 0x02,0x02,0x02,0x7F,0x04,0x09,0x11,0x21,0x3F,0x01,0x09,0x11,0x21,0x41,0x05,0x02, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x20,0x10,0x08,0x04,0x00,0x00, + /* 0xB6AC [?] [1986]*/ + 0x04,0x04,0x0F,0x10,0x28,0x44,0x03,0x0C,0x30,0xC0,0x07,0x00,0x00,0x0E,0x01,0x00, + 0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x60,0x18,0x06,0x00,0xC0,0x20,0x00,0x80,0x40, + /* 0xB6AD [?] [1987]*/ + 0x08,0xFF,0x08,0x1F,0x01,0x7F,0x01,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x3F,0x01,0xFF, + 0x20,0xFE,0x20,0xF0,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x00,0xFE, + /* 0xB6AE [?] [1988]*/ + 0x21,0x27,0x21,0x23,0x30,0xAF,0xA0,0xA3,0xA2,0x23,0x22,0x23,0x20,0x27,0x20,0x2F, + 0x10,0xFE,0x10,0xF8,0x40,0xFC,0x40,0xF8,0x48,0xF8,0x48,0xF8,0x40,0xFC,0x40,0xFE, + /* 0xB6AF [?] [1989]*/ + 0x00,0x00,0x7C,0x00,0x01,0x00,0xFE,0x20,0x20,0x20,0x48,0x44,0xFD,0x45,0x02,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xB6B0 [?] [1990]*/ + 0x10,0x10,0x10,0x17,0xF8,0x11,0x31,0x3A,0x57,0x50,0x91,0x11,0x12,0x14,0x10,0x10, + 0x40,0x40,0x40,0xFE,0x80,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xB6B1 [?] [1991]*/ + 0x10,0x17,0x14,0x24,0x25,0x64,0x64,0xA5,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x04,0x14,0x08, + /* 0xB6B2 [?] [1992]*/ + 0x20,0x27,0x24,0x24,0x35,0xAC,0xA4,0xA5,0xA5,0x25,0x25,0x25,0x24,0x24,0x24,0x24, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x04,0x14,0x08, + /* 0xB6B3 [?] [1993]*/ + 0x00,0x40,0x20,0x27,0x00,0x09,0x09,0x12,0x13,0xE0,0x21,0x21,0x22,0x24,0x20,0x00, + 0x40,0x40,0x40,0xFE,0x80,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xB6B4 [?] [1994]*/ + 0x00,0x27,0x14,0x14,0x85,0x44,0x44,0x15,0x15,0x25,0xE5,0x25,0x24,0x24,0x24,0x04, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x04,0x14,0x08, + /* 0xB6B5 [?] [1995]*/ + 0x01,0x12,0x67,0x44,0x44,0x47,0x44,0x44,0x57,0x60,0x04,0x04,0x04,0x08,0x10,0x60, + 0x00,0x00,0xDC,0x44,0x44,0xC4,0x44,0x44,0xC4,0x1C,0x40,0x40,0x40,0x44,0x44,0x3C, + /* 0xB6B6 [?] [1996]*/ + 0x10,0x11,0x10,0x10,0xFC,0x11,0x10,0x14,0x18,0x30,0xD3,0x10,0x10,0x10,0x50,0x20, + 0x10,0x10,0x90,0x90,0x10,0x10,0x90,0x90,0x10,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10, + /* 0xB6B7 [?] [1997]*/ + 0x00,0x04,0x02,0x02,0x10,0x08,0x08,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xB6B8 [?] [1998]*/ + 0x00,0x7C,0x45,0x48,0x48,0x50,0x4B,0x48,0x44,0x45,0x45,0x69,0x52,0x42,0x44,0x48, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xB6B9 [?] [1999]*/ + 0x00,0x7F,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x00,0x10,0x08,0x04,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x00,0x10,0x20,0x40,0xFE,0x00, + /* 0xB6BA [?] [2000]*/ + 0x00,0x27,0x10,0x10,0x03,0x02,0xF2,0x13,0x10,0x12,0x11,0x17,0x10,0x28,0x47,0x00, + 0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x00,0x08,0x10,0xFC,0x00,0x00,0xFE,0x00, + /* 0xB6BB [?] [2001]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x13,0x32,0x52,0x93,0x10,0x21,0x20,0x4F,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x00,0xF8,0x08,0x08,0xF8,0x00,0x10,0xA0,0xFE,0x00, + /* 0xB6BC [?] [2002]*/ + 0x08,0x08,0x7E,0x09,0x0A,0xFF,0x08,0x10,0x3F,0x61,0xA1,0x3F,0x21,0x21,0x3F,0x21, + 0x00,0xBE,0xA2,0x24,0x24,0xE8,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xB6BD [?] [2003]*/ + 0x08,0x0E,0x08,0xFF,0x08,0x2A,0x49,0x08,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0xFC,0x44,0x44,0x28,0x10,0x28,0x44,0xF2,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xB6BE [?] [2004]*/ + 0x01,0x3F,0x01,0x1F,0x01,0x7F,0x00,0x1F,0x12,0x11,0xFF,0x22,0x21,0x3F,0x00,0x00, + 0x00,0xF8,0x00,0xF0,0x00,0xFC,0x00,0xF0,0x10,0x10,0xFE,0x10,0x10,0xFC,0x10,0x60, + /* 0xB6BF [?] [2005]*/ + 0x10,0x10,0x51,0x50,0x7C,0x53,0x90,0x10,0x1C,0xF1,0x50,0x13,0x10,0x10,0x10,0x13, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x10,0x90,0xFE,0x28,0x44,0x82,0x02, + /* 0xB6C0 [?] [2006]*/ + 0x00,0x44,0x28,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x48,0x88,0x08,0x0B,0x51,0x20, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x28,0x24,0xFE,0x02,0x00, + /* 0xB6C1 [?] [2007]*/ + 0x00,0x20,0x11,0x10,0x00,0x03,0xF0,0x10,0x10,0x11,0x10,0x13,0x14,0x18,0x10,0x03, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x10,0x90,0xFE,0x28,0x44,0x82,0x02, + /* 0xB6C2 [?] [2008]*/ + 0x20,0x20,0x23,0x20,0xF8,0x27,0x20,0x20,0x21,0x2B,0x35,0x21,0xC1,0x01,0x01,0x01, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB6C3 [?] [2009]*/ + 0x00,0x00,0x7B,0x48,0x48,0x7F,0x48,0x48,0x79,0x4B,0x4D,0x49,0x79,0x49,0x01,0x01, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB6C4 [?] [2010]*/ + 0x00,0x7C,0x45,0x54,0x54,0x57,0x54,0x54,0x54,0x55,0x56,0x10,0x28,0x24,0x44,0x80, + 0x20,0x22,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xB6C5 [?] [2011]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x17,0x10, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB6C6 [?] [2012]*/ + 0x20,0x20,0x3B,0x22,0x42,0x7B,0xA2,0x22,0xFA,0x22,0x22,0x22,0x2A,0x34,0x24,0x09, + 0x40,0x20,0xFE,0x48,0x48,0xFE,0x48,0x78,0x00,0xFC,0x44,0x48,0x28,0x10,0x68,0x86, + /* 0xB6C7 [?] [2013]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x25,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x57,0x88, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB6C8 [?] [2014]*/ + 0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x22,0x23,0x20,0x2F,0x24,0x42,0x41,0x86,0x38, + 0x00,0x80,0xFE,0x20,0x20,0xFC,0x20,0x20,0xE0,0x00,0xF0,0x10,0x20,0xC0,0x30,0x0E, + /* 0xB6C9 [?] [2015]*/ + 0x00,0x20,0x17,0x14,0x84,0x47,0x44,0x14,0x14,0x25,0xE4,0x24,0x24,0x28,0x28,0x13, + 0x40,0x20,0xFE,0x88,0x88,0xFE,0x88,0xF8,0x00,0xFC,0x84,0x88,0x50,0x20,0xD8,0x06, + /* 0xB6CA [?] [2016]*/ + 0x10,0x10,0x10,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x2A,0x46,0x84,0x08, + 0x40,0x20,0x20,0xFE,0x02,0x02,0x02,0xFE,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB6CB [?] [2017]*/ + 0x20,0x11,0x11,0xFD,0x01,0x08,0x8B,0x88,0x48,0x49,0x51,0x51,0x1D,0xE1,0x41,0x01, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFE,0x20,0x40,0xFC,0x54,0x54,0x54,0x54,0x54,0x0C, + /* 0xB6CC [?] [2018]*/ + 0x20,0x21,0x3C,0x50,0x90,0x10,0x10,0xFE,0x10,0x10,0x10,0x28,0x24,0x44,0x41,0x80, + 0x00,0xFE,0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x00,0x84,0x44,0x48,0x00,0xFE,0x00, + /* 0xB6CD [?] [2019]*/ + 0x20,0x23,0x3A,0x22,0x43,0x7A,0xA2,0x22,0xFB,0x22,0x22,0x23,0x2E,0x32,0x22,0x02, + 0x80,0x38,0x28,0x28,0xA8,0x46,0x00,0x7C,0xA4,0x24,0x28,0xA8,0x10,0x28,0x44,0x82, + /* 0xB6CE [?] [2020]*/ + 0x06,0x38,0x20,0x20,0x20,0x3C,0x21,0x20,0x3D,0x20,0x20,0x2C,0xF0,0x20,0x20,0x23, + 0x00,0xF8,0x88,0x88,0x88,0x86,0x00,0x00,0xFC,0x84,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xB6CF [?] [2021]*/ + 0x04,0x04,0x55,0x4E,0x44,0x7F,0x44,0x4E,0x55,0x65,0x44,0x44,0x40,0x7F,0x00,0x01, + 0x00,0x04,0x78,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xB6D0 [?] [2022]*/ + 0x10,0x13,0x22,0x22,0x4B,0xFA,0x12,0x22,0x43,0xFA,0x42,0x03,0x1E,0xE2,0x42,0x02, + 0x80,0x38,0x28,0x28,0xA8,0x46,0x00,0x7C,0xA4,0x24,0x28,0xA8,0x10,0x28,0x44,0x82, + /* 0xB6D1 [?] [2023]*/ + 0x21,0x21,0x21,0x23,0x22,0xFE,0x2B,0x22,0x22,0x23,0x22,0x3A,0xE2,0x43,0x02,0x02, + 0x40,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00, + /* 0xB6D2 [?] [2024]*/ + 0x10,0x08,0x04,0x00,0x1F,0x10,0x10,0x10,0x1F,0x14,0x04,0x04,0x08,0x08,0x10,0x60, + 0x10,0x20,0x40,0x00,0xF0,0x10,0x10,0x10,0xF0,0x50,0x40,0x40,0x44,0x44,0x44,0x3C, + /* 0xB6D3 [?] [2025]*/ + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x69,0x51,0x42,0x44,0x48, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xB6D4 [?] [2026]*/ + 0x00,0x00,0x00,0x7E,0x02,0x02,0x24,0x14,0x08,0x08,0x14,0x12,0x22,0x40,0x00,0x00, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x90,0x50,0x50,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xB6D5 [?] [2027]*/ + 0x22,0x21,0x2F,0x20,0x27,0xFC,0x27,0x20,0x27,0x20,0x21,0x39,0xEF,0x41,0x05,0x02, + 0x10,0x10,0xD0,0x10,0xBE,0xA4,0xD4,0x14,0x94,0x94,0x14,0xC8,0x08,0x14,0x14,0x22, + /* 0xB6D6 [?] [2028]*/ + 0x00,0x00,0x78,0x4B,0x48,0x4A,0x4A,0x4A,0x4A,0x4B,0x78,0x48,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xB6D7 [?] [2029]*/ + 0x00,0x78,0x4B,0x48,0x49,0x79,0x11,0x11,0x51,0x5D,0x50,0x53,0x59,0xE0,0x00,0x00, + 0x88,0x50,0xFE,0x50,0xFC,0x54,0x8C,0x74,0x04,0xFC,0x08,0xFE,0x08,0x88,0xA8,0x10, + /* 0xB6D8 [?] [2030]*/ + 0x10,0x08,0xFF,0x00,0x7E,0x42,0x7E,0x00,0x7E,0x04,0x08,0x0F,0xF8,0x08,0x28,0x11, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xB6D9 [?] [2031]*/ + 0x10,0x11,0x10,0xFE,0x11,0x55,0x55,0x55,0x55,0x7D,0x11,0x11,0x14,0x18,0x11,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xB6DA [?] [2032]*/ + 0x00,0x7F,0x41,0x41,0x5F,0x41,0x49,0x49,0x4F,0x41,0x41,0x41,0x40,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x24,0x24,0xE4,0x14,0x14,0x14,0xF4,0x04,0xFC,0x04, + /* 0xB6DB [?] [2033]*/ + 0x20,0x20,0x38,0x27,0x40,0x7A,0xA2,0x22,0xFA,0x23,0x20,0x20,0x28,0x30,0x20,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xB6DC [?] [2034]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x2F,0x28,0x28,0x2F,0x28,0x28,0x2F,0x48,0x48,0x8F,0x08, + 0x7C,0x80,0x80,0xFC,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB6DD [?] [2035]*/ + 0x00,0x23,0x12,0x12,0x03,0x02,0xF2,0x12,0x12,0x12,0x12,0x14,0x14,0x28,0x47,0x00, + 0x1E,0xE0,0x20,0x20,0xFE,0x20,0xFC,0x84,0xFC,0x84,0xFC,0x84,0xFC,0x00,0xFE,0x00, + /* 0xB6DE [?] [2036]*/ + 0x20,0x27,0x20,0x22,0xF9,0x22,0x24,0x28,0x30,0xE7,0x20,0x22,0x21,0x22,0xA4,0x48, + 0x00,0xBC,0x84,0x94,0x08,0x94,0xA4,0x40,0x00,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xB6DF [?] [2037]*/ + 0x00,0x00,0xF1,0x92,0x95,0x90,0x90,0x93,0x9C,0x90,0xF1,0x96,0x00,0x00,0x01,0x0E, + 0x80,0x80,0xF8,0x10,0x20,0xC0,0x90,0x20,0x7C,0x84,0x08,0x90,0x60,0x40,0x80,0x00, + /* 0xB6E0 [?] [2038]*/ + 0x02,0x02,0x07,0x08,0x38,0x04,0x03,0x0C,0x71,0x02,0x0C,0x32,0x01,0x01,0x0E,0x70, + 0x00,0x00,0xF0,0x20,0x40,0x80,0x40,0x80,0xF8,0x08,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xB6E1 [?] [2039]*/ + 0x01,0x01,0x7F,0x02,0x04,0x08,0x30,0xC0,0x00,0xFF,0x00,0x10,0x08,0x08,0x01,0x00, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x46,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xB6E2 [?] [2040]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x12,0x14,0x13,0x10,0x1C,0xE1,0x42,0x04,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x4E,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xB6E3 [?] [2041]*/ + 0x10,0x20,0x7C,0x44,0x7C,0x44,0x7D,0x46,0x45,0xFC,0x0C,0x14,0x25,0x46,0x94,0x08, + 0x00,0xF8,0x88,0x88,0x88,0x88,0x26,0x20,0xFE,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xB6E4 [?] [2042]*/ + 0x00,0x0F,0x08,0x08,0x08,0x10,0x20,0xC1,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x1E,0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xB6E5 [?] [2043]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x11,0x12,0x5D,0x50,0x50,0x50,0x5D,0xE2,0x00,0x00, + 0x00,0xF8,0x88,0x88,0x88,0x88,0x26,0x20,0xFE,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xB6E6 [?] [2044]*/ + 0x08,0x10,0x3E,0x22,0x32,0x2A,0x2A,0xFE,0x22,0x32,0x2A,0x2A,0x22,0x42,0x4A,0x84, + 0x20,0x10,0x10,0xFE,0x82,0x84,0x40,0x44,0x48,0x50,0x60,0x42,0x42,0x42,0x3E,0x00, + /* 0xB6E7 [?] [2045]*/ + 0x00,0x3E,0x22,0x22,0x22,0x49,0x88,0x08,0xFF,0x08,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0xA4,0x24,0x24,0x24,0x04,0x84,0x14,0x08, + /* 0xB6E8 [?] [2046]*/ + 0x10,0x10,0x13,0x10,0x19,0x56,0x55,0x50,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x40,0x40,0xFE,0x80,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xB6E9 [?] [2047]*/ + 0x00,0x7B,0x48,0x48,0x51,0x4A,0x48,0x68,0x50,0x41,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x20,0xFE,0x40,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x8C,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xB6EA [?] [2048]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xAB,0xA8,0xA8,0xF8,0xA0,0x23,0x28,0x38,0xE8,0x42,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x02, + /* 0xB6EB [?] [2049]*/ + 0x10,0x10,0x13,0x10,0x54,0x57,0x54,0x54,0x54,0x54,0x57,0x5C,0x64,0x00,0x02,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x02, + /* 0xB6EC [?] [2050]*/ + 0x04,0x36,0xE5,0x25,0x24,0xFF,0x24,0x25,0x25,0x36,0xE6,0x24,0x2A,0x32,0xA1,0x40, + 0x10,0x20,0x7C,0x44,0x64,0xD4,0x44,0x4C,0x40,0x7E,0x02,0x02,0xFA,0x82,0x8A,0x84, + /* 0xB6ED [?] [2051]*/ + 0x10,0x11,0x17,0x21,0x21,0x6F,0x61,0xA1,0x21,0x23,0x2D,0x21,0x21,0x21,0x25,0x22, + 0x28,0xA4,0x24,0x20,0x20,0xFE,0x20,0x24,0xA4,0x28,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xB6EE [?] [2052]*/ + 0x10,0x08,0x7F,0x41,0x10,0x1E,0x22,0x54,0x08,0x14,0x22,0x7F,0xA2,0x22,0x3E,0x22, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xB6EF [?] [2053]*/ + 0x00,0x20,0x10,0x11,0x01,0x03,0xF5,0x11,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0xA0,0xA0,0xA0,0x24,0x24,0x28,0x30,0x20,0x60,0xA0,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xB6F0 [?] [2054]*/ + 0x10,0x10,0x13,0x10,0xFC,0x27,0x24,0x24,0x24,0x48,0x2B,0x10,0x28,0x44,0x84,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x82, + /* 0xB6F1 [?] [2055]*/ + 0x00,0x7F,0x04,0x24,0x14,0x14,0x04,0xFF,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0xFC,0x40,0x48,0x48,0x50,0x40,0xFE,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xB6F2 [?] [2056]*/ + 0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x43,0x80, + 0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x50,0x20,0x04,0x04,0x04,0xFC,0x00, + /* 0xB6F3 [?] [2057]*/ + 0x20,0x23,0x22,0x22,0xFA,0x22,0x22,0x2A,0x32,0xE2,0x22,0x22,0x24,0x24,0xA8,0x50, + 0x00,0xFE,0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xA8,0x90,0x82,0x82,0x82,0x7E,0x00, + /* 0xB6F4 [?] [2058]*/ + 0x00,0x23,0x12,0x13,0x02,0x03,0xF1,0x13,0x14,0x1A,0x12,0x13,0x10,0x28,0x47,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xA4,0x04,0xF4,0x14,0x08,0xFE,0x00, + /* 0xB6F5 [?] [2059]*/ + 0x00,0x77,0x55,0x55,0x77,0x00,0x7F,0x00,0xFF,0x20,0x3F,0x01,0x01,0x01,0x0A,0x04, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0xA2,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xB6F6 [?] [2060]*/ + 0x20,0x20,0x23,0x3C,0x44,0x4B,0xA0,0x20,0x20,0x20,0x23,0x20,0x28,0x30,0x22,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x02, + /* 0xB6F7 [?] [2061]*/ + 0x00,0x3F,0x21,0x21,0x2F,0x21,0x22,0x24,0x28,0x3F,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xF8,0x08,0x08,0xE8,0x08,0x88,0x48,0x28,0xF8,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xB6F8 [?] [2062]*/ + 0x00,0x7F,0x01,0x01,0x02,0x3F,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x20,0x20, + 0x00,0xFC,0x00,0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x28,0x10, + /* 0xB6F9 [?] [2063]*/ + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xB6FA [?] [2064]*/ + 0x00,0x7F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x17,0xF8,0x00,0x00,0x00, + 0x00,0xFC,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0x3E,0xD0,0x10,0x10,0x10,0x10, + /* 0xB6FB [?] [2065]*/ + 0x08,0x08,0x08,0x1F,0x10,0x21,0x41,0x81,0x01,0x11,0x11,0x21,0x41,0x81,0x05,0x02, + 0x00,0x00,0x00,0xFC,0x04,0x08,0x00,0x00,0x00,0x10,0x08,0x04,0x02,0x02,0x00,0x00, + /* 0xB6FC [?] [2066]*/ + 0x20,0x23,0x21,0x3D,0x45,0x49,0xA1,0x21,0x21,0x21,0x21,0x21,0x2B,0x30,0x20,0x00, + 0x00,0xFE,0x08,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x1E,0xE8,0x08,0x08,0x08, + /* 0xB6FD [?] [2067]*/ + 0x00,0x27,0x12,0x12,0x83,0x42,0x42,0x13,0x12,0x22,0xE2,0x23,0x2E,0x20,0x20,0x00, + 0x00,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x0E,0xF8,0x08,0x08,0x08,0x08, + /* 0xB6FE [?] [2068]*/ + 0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xB7A1 [?] [2069]*/ + 0x00,0x00,0xFF,0x00,0x3F,0x00,0x7F,0x00,0x3F,0x20,0x24,0x24,0x24,0x0A,0x11,0x60, + 0x28,0x24,0xFE,0x20,0xA0,0x20,0xA0,0x20,0xA0,0x90,0x90,0x90,0x8A,0x0A,0x06,0x82, + /* 0xB7A2 [?] [2070]*/ + 0x01,0x11,0x11,0x22,0x3F,0x02,0x04,0x07,0x0A,0x09,0x11,0x10,0x20,0x40,0x03,0x1C, + 0x00,0x10,0x08,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xB7A3 [?] [2071]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x00,0x20,0x10,0x00,0xF0,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0xFC,0x44,0x44,0xFC,0x00,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x28,0x10, + /* 0xB7A4 [?] [2072]*/ + 0x10,0x10,0x3F,0x28,0x45,0x88,0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x10,0x11,0x16, + 0x40,0x40,0x7E,0x90,0x08,0xA0,0x90,0x80,0xFC,0x80,0x48,0x50,0x24,0x54,0x8C,0x04, + /* 0xB7A5 [?] [2073]*/ + 0x08,0x08,0x08,0x10,0x10,0x37,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x11,0x16,0x10, + 0x90,0x88,0x88,0x80,0xBE,0xC0,0x80,0x44,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xB7A6 [?] [2074]*/ + 0x00,0x01,0x7E,0x00,0x02,0x01,0x01,0x7F,0x00,0x00,0x03,0x0C,0x30,0x48,0x87,0x00, + 0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0xF8,0x30,0xC0,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xB7A7 [?] [2075]*/ + 0x20,0x17,0x00,0x45,0x45,0x49,0x59,0x6F,0x49,0x49,0x48,0x48,0x49,0x4A,0x48,0x40, + 0x00,0xFC,0x04,0x44,0x24,0x04,0xF4,0x04,0x24,0x24,0xC4,0x94,0x54,0x34,0x14,0x08, + /* 0xB7A8 [?] [2076]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x40,0x10,0x1F,0x20,0xE0,0x21,0x22,0x24,0x2F,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0x80,0x00,0x10,0x08,0xFC,0x04, + /* 0xB7A9 [?] [2077]*/ + 0x00,0x00,0xFC,0x11,0x10,0x10,0x10,0x7D,0x10,0x10,0x10,0x10,0x1C,0xE1,0x40,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00, + /* 0xB7AA [?] [2078]*/ + 0x08,0xFF,0x08,0x20,0x17,0x12,0x81,0x47,0x52,0x14,0x2B,0xE2,0x23,0x22,0x23,0x22, + 0x20,0xFE,0x20,0x38,0xC0,0x48,0x50,0xFC,0x48,0x04,0xFA,0x48,0xF8,0x48,0xF8,0x08, + /* 0xB7AB [?] [2079]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x11,0x12,0x12,0x14, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x50,0x50,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB7AC [?] [2080]*/ + 0x00,0x3F,0x11,0x09,0x01,0xFF,0x09,0x10,0x3F,0xD1,0x11,0x1F,0x11,0x11,0x1F,0x10, + 0xF8,0x00,0x10,0x20,0x00,0xFE,0x20,0x10,0xF8,0x16,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xB7AD [?] [2081]*/ + 0x0E,0xF1,0x92,0x54,0xFF,0x38,0x54,0x82,0x7C,0x54,0x55,0x7C,0x54,0x54,0x7D,0x44, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0x44,0x4C,0xD4,0x64,0x44,0x44,0x44,0x54,0x88, + /* 0xB7AE [?] [2082]*/ + 0x24,0x22,0xF9,0x22,0x64,0x72,0xA9,0x22,0x25,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x48,0x88,0x3E,0x88,0x58,0x9C,0x2A,0x88,0x48,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xB7AF [?] [2083]*/ + 0x00,0x01,0xF9,0x21,0x21,0x41,0x79,0xC9,0x49,0x49,0x49,0x49,0x7A,0x42,0x04,0x08, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x50,0x50,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB7B0 [?] [2084]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x50,0x50,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB7B1 [?] [2085]*/ + 0x20,0x3F,0x40,0xBE,0x2A,0xFF,0x4A,0x7F,0x04,0x08,0x1F,0x02,0x3F,0x01,0x15,0x22, + 0x20,0x20,0x3E,0x48,0xA8,0x28,0x10,0x28,0x46,0x80,0x00,0x10,0xF8,0x08,0x20,0x10, + /* 0xB7B2 [?] [2086]*/ + 0x00,0x0F,0x08,0x08,0x08,0x0A,0x09,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0xA0,0xA0,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xB7B3 [?] [2087]*/ + 0x10,0x13,0x10,0x10,0x55,0x59,0x51,0x91,0x11,0x11,0x11,0x29,0x24,0x44,0x41,0x82, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x04, + /* 0xB7B4 [?] [2088]*/ + 0x00,0x00,0x3F,0x20,0x20,0x3F,0x24,0x24,0x22,0x22,0x21,0x20,0x41,0x42,0x8C,0x30, + 0x10,0xF8,0x00,0x00,0x00,0xF8,0x08,0x10,0x10,0x20,0x40,0x80,0x40,0x20,0x18,0x06, + /* 0xB7B5 [?] [2089]*/ + 0x00,0x20,0x13,0x12,0x02,0x03,0xF2,0x12,0x12,0x12,0x12,0x14,0x15,0x28,0x47,0x00, + 0x08,0x3C,0xC0,0x00,0x00,0xFC,0x04,0x88,0x50,0x20,0x50,0x88,0x04,0x00,0xFE,0x00, + /* 0xB7B6 [?] [2090]*/ + 0x04,0x04,0xFF,0x04,0x10,0x09,0x49,0x21,0x25,0x05,0x09,0x71,0x11,0x11,0x10,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0x08,0x28,0x10,0x02,0x02,0x02,0xFE,0x00, + /* 0xB7B7 [?] [2091]*/ + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x29,0x25,0x42,0x80, + 0x04,0x0E,0xF0,0x80,0x80,0xFC,0xA4,0xA4,0xA4,0xA8,0xA8,0x90,0x10,0x28,0x44,0x82, + /* 0xB7B8 [?] [2092]*/ + 0x00,0x44,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x50,0x20, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xB7B9 [?] [2093]*/ + 0x20,0x20,0x21,0x3D,0x45,0x49,0xA1,0x21,0x21,0x21,0x21,0x21,0x29,0x32,0x22,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xB7BA [?] [2094]*/ + 0x00,0x20,0x17,0x10,0x80,0x40,0x47,0x10,0x10,0x20,0xE0,0x21,0x22,0x25,0x28,0x00, + 0x10,0x78,0x80,0x00,0x80,0x40,0xF8,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0xFC,0x00, + /* 0xB7BB [?] [2095]*/ + 0x10,0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x10,0x10,0x10,0x1C,0xE1,0x41,0x02,0x04, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xB7BC [?] [2096]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x01,0xFF,0x04,0x04,0x07,0x04,0x08,0x08,0x10,0x20,0x40, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xB7BD [?] [2097]*/ + 0x02,0x01,0x01,0xFF,0x04,0x04,0x04,0x07,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xB7BE [?] [2098]*/ + 0x00,0x3C,0x24,0x25,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x40,0x20,0x20,0xFE,0x40,0x40,0x40,0x7C,0x44,0x44,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xB7BF [?] [2099]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x21,0x20,0x3F,0x22,0x22,0x23,0x44,0x44,0x88,0x10, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x00,0x80,0xFC,0x00,0x00,0xF8,0x08,0x08,0x28,0x10, + /* 0xB7C0 [?] [2100]*/ + 0x00,0x7C,0x44,0x4B,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x51,0x41,0x42,0x44, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xB7C1 [?] [2101]*/ + 0x10,0x10,0x10,0x11,0xFC,0x24,0x24,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x81,0x02, + 0x40,0x20,0x20,0xFE,0x40,0x40,0x40,0x7C,0x44,0x44,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xB7C2 [?] [2102]*/ + 0x08,0x08,0x08,0x17,0x11,0x31,0x31,0x51,0x91,0x11,0x11,0x11,0x12,0x12,0x14,0x18, + 0x80,0x40,0x40,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB7C3 [?] [2103]*/ + 0x00,0x20,0x10,0x17,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x1A,0x12,0x04,0x08, + 0x80,0x40,0x40,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB7C4 [?] [2104]*/ + 0x10,0x10,0x20,0x27,0x44,0xF8,0x10,0x20,0x40,0xFC,0x40,0x00,0x1D,0xE1,0x42,0x04, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xB7C5 [?] [2105]*/ + 0x20,0x10,0x00,0xFE,0x20,0x21,0x3E,0x24,0x24,0x24,0x24,0x24,0x44,0x54,0x89,0x02, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xB7C6 [?] [2106]*/ + 0x08,0x08,0xFF,0x08,0x08,0x04,0x7C,0x04,0x04,0x7C,0x04,0x04,0xFC,0x04,0x04,0x04, + 0x20,0x20,0xFE,0x20,0x20,0x40,0x7C,0x40,0x40,0x7C,0x40,0x40,0x7E,0x40,0x40,0x40, + /* 0xB7C7 [?] [2107]*/ + 0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04, + 0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x7E,0x40,0x40,0x40, + /* 0xB7C8 [?] [2108]*/ + 0x00,0x00,0xF0,0x97,0x90,0x90,0x90,0x93,0x90,0x90,0xF0,0x97,0x00,0x00,0x00,0x00, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xB7C9 [?] [2109]*/ + 0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xC0,0x40,0x44,0x48,0x50,0x60,0x50,0x48,0x44,0x20,0x20,0x12,0x0A,0x06,0x02, + /* 0xB7CA [?] [2110]*/ + 0x00,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x54,0x88, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xB7CB [?] [2111]*/ + 0x00,0x7F,0x42,0x42,0x7E,0x42,0x42,0x5E,0x42,0x42,0x7E,0x42,0x42,0x42,0x7F,0x00, + 0x00,0xFC,0x40,0x40,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x00, + /* 0xB7CC [?] [2112]*/ + 0x00,0x20,0x10,0x17,0x00,0x00,0xF0,0x13,0x10,0x10,0x10,0x17,0x18,0x10,0x00,0x00, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xB7CD [?] [2113]*/ + 0x00,0x00,0x78,0x48,0x48,0x4F,0x48,0x48,0x48,0x48,0x48,0x79,0x49,0x02,0x04,0x08, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xB7CE [?] [2114]*/ + 0x00,0x3C,0x24,0x27,0x24,0x3C,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x44,0x54,0x88, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20,0x20, + /* 0xB7CF [?] [2115]*/ + 0x01,0x00,0x3F,0x20,0x24,0x28,0x2F,0x21,0x21,0x22,0x22,0x24,0x24,0x48,0x51,0x86, + 0x00,0x80,0xFE,0x80,0x90,0x88,0xFE,0x00,0xFC,0x84,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xB7D0 [?] [2116]*/ + 0x01,0x21,0x11,0x17,0x81,0x41,0x47,0x15,0x15,0x27,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x20,0x20,0x20,0xF8,0x28,0x28,0xF8,0x20,0x20,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xB7D1 [?] [2117]*/ + 0x04,0x7F,0x04,0x3F,0x24,0x3F,0x08,0x10,0x20,0x5F,0x10,0x11,0x11,0x02,0x0C,0x30, + 0x40,0xF8,0x48,0xF8,0x40,0xFC,0x44,0x54,0x08,0xF0,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xB7D2 [?] [2118]*/ + 0x08,0x08,0xFF,0x08,0x00,0x04,0x08,0x10,0x20,0xDF,0x04,0x04,0x08,0x10,0x21,0x40, + 0x20,0x20,0xFE,0x20,0x40,0x40,0x20,0x10,0x08,0xE6,0x20,0x20,0x20,0x20,0x40,0x80, + /* 0xB7D3 [?] [2119]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAB,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x08,0x28,0x28,0x28,0x44,0x44,0x82,0x7C,0x24,0x24,0x24,0x24,0x44,0x44,0x94,0x08, + /* 0xB7D4 [?] [2120]*/ + 0x00,0x00,0x78,0x48,0x49,0x49,0x4A,0x4D,0x48,0x48,0x48,0x78,0x49,0x01,0x02,0x04, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xB7D5 [?] [2121]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x12,0x21,0x40,0xBF,0x11,0x11,0x11,0x25,0x42, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x90,0x50,0x12,0x0A,0x0A,0x06,0x02, + /* 0xB7D6 [?] [2122]*/ + 0x00,0x04,0x04,0x08,0x10,0x20,0x40,0x9F,0x04,0x04,0x04,0x08,0x08,0x10,0x21,0x40, + 0x40,0x40,0x20,0x20,0x10,0x08,0x04,0xE2,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x80, + /* 0xB7D7 [?] [2123]*/ + 0x10,0x10,0x20,0x20,0x49,0xF9,0x12,0x25,0x40,0xF8,0x40,0x00,0x19,0xE1,0x42,0x04, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xB7D8 [?] [2124]*/ + 0x10,0x10,0x10,0x17,0x11,0xFD,0x11,0x11,0x11,0x10,0x10,0x1C,0xE0,0x41,0x02,0x0C, + 0x80,0x40,0x40,0xFC,0x10,0x10,0x10,0x10,0x10,0xA0,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xB7D9 [?] [2125]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC9,0x08,0x09,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x20,0x20,0xFC,0x30,0x68,0xA4,0x22,0x20,0x20,0x10,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xB7DA [?] [2126]*/ + 0x00,0x21,0x11,0x12,0x82,0x44,0x58,0x13,0x11,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x10,0x10,0x10,0x08,0x08,0x04,0x02,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB7DB [?] [2127]*/ + 0x10,0x10,0x94,0x54,0x58,0x10,0xFD,0x32,0x38,0x54,0x54,0x90,0x10,0x10,0x11,0x12, + 0x10,0x50,0x50,0x50,0x88,0x88,0x04,0xFA,0x48,0x48,0x48,0x48,0x88,0x88,0x28,0x10, + /* 0xB7DC [?] [2128]*/ + 0x01,0x01,0x7F,0x02,0x04,0x08,0x30,0xC0,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x10, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xB7DD [?] [2129]*/ + 0x08,0x08,0x08,0x10,0x11,0x31,0x32,0x55,0x90,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xB7DE [?] [2130]*/ + 0x04,0x08,0x10,0x2F,0xC4,0x04,0x08,0x10,0x60,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x40,0x20,0x10,0xE8,0x26,0x20,0x20,0xA0,0x40,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xB7DF [?] [2131]*/ + 0x10,0x11,0x10,0x10,0x1B,0x54,0x50,0x51,0x91,0x11,0x11,0x11,0x11,0x10,0x10,0x13, + 0x20,0xFC,0x20,0x88,0xFE,0x88,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xB7E0 [?] [2132]*/ + 0x01,0x11,0x09,0x7F,0x05,0x09,0x31,0xC4,0x04,0x3F,0x04,0x04,0xFF,0x08,0x10,0x20, + 0x00,0x10,0x20,0xFC,0x40,0x20,0x18,0x46,0x40,0xF8,0x40,0x40,0xFE,0x20,0x10,0x08, + /* 0xB7E1 [?] [2133]*/ + 0x01,0x01,0x01,0x7F,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xB7E2 [?] [2134]*/ + 0x08,0x08,0x08,0x7F,0x08,0x08,0xFF,0x00,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40, + 0x08,0x08,0x08,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xB7E3 [?] [2135]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x72,0x6A,0xA2,0xA2,0x23,0x24,0x24,0x28,0x30, + 0x00,0xF8,0x08,0x08,0x28,0xA8,0xA8,0x48,0x48,0xA8,0xA8,0x2A,0x0A,0x0A,0x06,0x02, + /* 0xB7E4 [?] [2136]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x57,0x7C,0x50,0x10,0x14,0x1F,0xE4,0x40,0x00, + 0x40,0x40,0xFC,0x88,0x50,0x20,0xD8,0x26,0xF8,0x20,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xB7E5 [?] [2137]*/ + 0x10,0x10,0x10,0x10,0x55,0x54,0x54,0x57,0x54,0x54,0x54,0x5C,0x67,0x00,0x00,0x00, + 0x40,0x40,0xFC,0x88,0x50,0x20,0xD8,0x26,0xF8,0x20,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xB7E6 [?] [2138]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBC,0x10,0x13,0xFC,0x10,0x10,0x10,0x17,0x18,0x10,0x00, + 0x40,0x40,0xFC,0x88,0x50,0x20,0xD8,0x26,0xF8,0x20,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xB7E7 [?] [2139]*/ + 0x00,0x3F,0x20,0x20,0x28,0x24,0x22,0x22,0x21,0x21,0x22,0x22,0x24,0x48,0x40,0x80, + 0x00,0xF0,0x10,0x10,0x50,0x50,0x90,0x90,0x10,0x10,0x90,0x92,0x4A,0x4A,0x06,0x02, + /* 0xB7E8 [?] [2140]*/ + 0x00,0x00,0x1F,0x10,0x90,0x53,0x52,0x13,0x32,0x52,0x92,0x12,0x25,0x24,0x48,0x90, + 0x80,0x40,0xFE,0x00,0x00,0xF8,0x08,0x28,0xA8,0x48,0x48,0xA8,0x2A,0x0A,0x06,0x02, + /* 0xB7E9 [?] [2141]*/ + 0x10,0x10,0x10,0x10,0x55,0x58,0x50,0x93,0x10,0x10,0x10,0x28,0x27,0x44,0x40,0x80, + 0x40,0x40,0xFC,0x88,0x50,0x20,0xD8,0x26,0xF8,0x20,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xB7EA [?] [2142]*/ + 0x01,0x21,0x13,0x14,0x00,0x01,0xF6,0x10,0x13,0x10,0x13,0x10,0x17,0x10,0x28,0x47, + 0x00,0xF8,0x08,0x90,0x60,0x98,0x06,0x40,0xF8,0x40,0xF8,0x40,0xFC,0x40,0x40,0xFE, + /* 0xB7EB [?] [2143]*/ + 0x00,0x47,0x20,0x20,0x02,0x0A,0x0A,0x13,0x10,0xE0,0x20,0x27,0x20,0x20,0x20,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xB7EC [?] [2144]*/ + 0x10,0x14,0x22,0x21,0x48,0xF8,0x16,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x45,0x08, + 0x20,0x7C,0x84,0x48,0x30,0xCE,0x10,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xB7ED [?] [2145]*/ + 0x00,0x43,0x22,0x22,0x03,0x02,0xE2,0x22,0x22,0x22,0x22,0x2B,0x34,0x24,0x08,0x10, + 0x00,0xF8,0x08,0x08,0x28,0xA8,0xA8,0x48,0x48,0xA8,0xA8,0x2A,0x0A,0x0A,0x06,0x02, + /* 0xB7EE [?] [2146]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x09,0x31,0xCF,0x01,0x01,0x3F,0x01,0x01, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0x18,0xE6,0x00,0x00,0xF8,0x00,0x00, + /* 0xB7EF [?] [2147]*/ + 0x00,0x3F,0x20,0x20,0x2F,0x20,0x28,0x24,0x22,0x21,0x22,0x24,0x28,0x40,0x40,0x80, + 0x00,0xF8,0x08,0x08,0xC8,0x48,0x48,0x88,0x88,0x08,0x88,0x4A,0x4A,0x0A,0x06,0x02, + /* 0xB7F0 [?] [2148]*/ + 0x11,0x11,0x11,0x2F,0x21,0x61,0x67,0xA5,0x29,0x2F,0x21,0x21,0x22,0x22,0x24,0x28, + 0x20,0x20,0x20,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xB7F1 [?] [2149]*/ + 0x00,0x7F,0x00,0x01,0x03,0x05,0x09,0x31,0xC1,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xFC,0x80,0x00,0x00,0x60,0x18,0x04,0x02,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xB7F2 [?] [2150]*/ + 0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xB7F3 [?] [2151]*/ + 0x0A,0x09,0xFF,0x08,0x7F,0x49,0x7F,0x49,0x7F,0x49,0x10,0xFF,0x20,0x3E,0x42,0x86, + 0x20,0x20,0xA0,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x90,0x28,0x28,0x44,0x82, + /* 0xB7F4 [?] [2152]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x27,0x3C,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB7F5 [?] [2153]*/ + 0x20,0xCE,0x8A,0xAA,0xAA,0xEE,0xAA,0xAA,0xAA,0xAA,0xEE,0xA8,0x28,0x48,0x48,0x88, + 0x0E,0xF0,0x22,0x92,0x54,0x00,0x7C,0x08,0x10,0x10,0xFE,0x10,0x10,0x10,0x50,0x20, + /* 0xB7F6 [?] [2154]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x10,0x14,0x1B,0x30,0xD0,0x10,0x10,0x10,0x51,0x22, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB7F7 [?] [2155]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x13,0x16,0x1A,0x33,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x90,0x90,0x90,0xFC,0x94,0x94,0xFC,0x90,0x90,0xFE,0x92,0x92,0x1A,0x14,0x10,0x10, + /* 0xB7F8 [?] [2156]*/ + 0x20,0x21,0x20,0xFC,0x40,0x50,0x90,0xFC,0x11,0x11,0x1D,0xF1,0x51,0x11,0x11,0x11, + 0x00,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xB7F9 [?] [2157]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x5D,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x00,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xB7FA [?] [2158]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x12,0x7F,0x12,0x7F,0x52,0x7F,0x12,0x13,0x22,0x42, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x90,0x90,0x10,0xD2,0x4A,0x4A,0x86,0x02, + /* 0xB7FB [?] [2159]*/ + 0x10,0x10,0x3F,0x48,0x85,0x08,0x08,0x13,0x30,0x51,0x90,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x10,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x10,0x50,0x20, + /* 0xB7FC [?] [2160]*/ + 0x08,0x08,0x08,0x10,0x10,0x37,0x30,0x50,0x90,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xB7FD [?] [2161]*/ + 0x08,0x08,0x0B,0x10,0x12,0x31,0x30,0x53,0x90,0x10,0x17,0x10,0x10,0x10,0x10,0x10, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xB7FE [?] [2162]*/ + 0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x42,0x4A,0x84, + 0x00,0xFC,0x84,0x84,0x94,0x88,0x80,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0xA8,0xC4,0x82, + /* 0xB8A1 [?] [2163]*/ + 0x00,0x20,0x13,0x10,0x82,0x41,0x48,0x0B,0x10,0x10,0xE7,0x20,0x20,0x20,0x20,0x00, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xB8A2 [?] [2164]*/ + 0x00,0x20,0x13,0x10,0x82,0x41,0x41,0x17,0x10,0x20,0xE3,0x22,0x22,0x22,0x23,0x02, + 0x80,0x40,0xFC,0x00,0x08,0x08,0x10,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xB8A3 [?] [2165]*/ + 0x40,0x23,0x20,0xF9,0x11,0x11,0x21,0x30,0x6B,0xAA,0x22,0x23,0x22,0x22,0x23,0x22, + 0x00,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xB8A4 [?] [2166]*/ + 0x20,0x10,0x00,0xF9,0x09,0x13,0x15,0x31,0x55,0x99,0x15,0x11,0x11,0x11,0x11,0x11, + 0x90,0x94,0x92,0x12,0x10,0x7E,0x10,0x10,0x10,0x28,0x28,0x28,0x28,0x44,0x44,0x82, + /* 0xB8A5 [?] [2167]*/ + 0x04,0x04,0x04,0x7F,0x04,0x04,0x3F,0x24,0x24,0x3F,0x04,0x08,0x08,0x10,0x20,0x40, + 0x40,0x40,0x40,0xF8,0x48,0x48,0xF8,0x40,0x40,0xFC,0x44,0x44,0x54,0x48,0x40,0x40, + /* 0xB8A6 [?] [2168]*/ + 0x01,0x01,0xFF,0x01,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21,0x21,0x21,0x20, + 0x20,0x10,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xB8A7 [?] [2169]*/ + 0x10,0x13,0x10,0x10,0xFC,0x10,0x17,0x10,0x18,0x30,0xD0,0x11,0x11,0x12,0x54,0x28, + 0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xB8A8 [?] [2170]*/ + 0x20,0x20,0x23,0xFC,0x40,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x11,0x11,0x11, + 0x28,0x24,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0x0C, + /* 0xB8A9 [?] [2171]*/ + 0x10,0x10,0x17,0x24,0x24,0x64,0x65,0xA5,0x27,0x25,0x25,0x25,0x29,0x29,0x31,0x21, + 0x40,0x20,0xFE,0x00,0x88,0x88,0x08,0x7E,0x08,0x48,0x28,0x28,0x08,0x08,0x28,0x10, + /* 0xB8AA [?] [2172]*/ + 0x04,0x08,0x18,0x24,0x03,0x0C,0x30,0xC0,0x1F,0x01,0x01,0x3F,0x01,0x11,0x09,0x7F, + 0x40,0x20,0x50,0x88,0x00,0xC0,0x30,0x0E,0xF0,0x00,0x00,0xF8,0x00,0x10,0x20,0xFC, + /* 0xB8AB [?] [2173]*/ + 0x04,0x08,0x18,0x24,0x03,0x0C,0x30,0xC0,0x1F,0x10,0x10,0x1F,0x10,0x10,0x20,0x40, + 0x40,0x20,0x50,0x88,0x00,0xC0,0x30,0xEE,0x00,0x00,0x00,0xF8,0x80,0x80,0x80,0x80, + /* 0xB8AC [?] [2174]*/ + 0x00,0x78,0x4B,0x48,0x48,0x7B,0x4A,0x4A,0x4B,0x7A,0x4A,0x4B,0x4A,0x4A,0x4A,0x9A, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xB8AD [?] [2175]*/ + 0x00,0x78,0x4B,0x4A,0x4A,0x7A,0x4A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4C,0x4C,0x48,0x98, + 0x20,0x10,0xFE,0x00,0x44,0x44,0x84,0xBE,0x84,0xA4,0x94,0x94,0x84,0x84,0x94,0x88, + /* 0xB8AE [?] [2176]*/ + 0x01,0x00,0x3F,0x20,0x22,0x22,0x24,0x24,0x2C,0x34,0x24,0x24,0x44,0x44,0x84,0x04, + 0x00,0x80,0xFE,0x00,0x08,0x08,0x08,0xFE,0x08,0x88,0x48,0x48,0x08,0x08,0x28,0x10, + /* 0xB8AF [?] [2177]*/ + 0x00,0x3F,0x22,0x22,0x25,0x2C,0x34,0x24,0x20,0x2F,0x29,0x2A,0x48,0x49,0x8A,0x08, + 0x80,0xFE,0x08,0x08,0xFE,0x88,0x48,0x58,0x80,0xFC,0x44,0xA4,0x84,0x44,0x24,0x0C, + /* 0xB8B0 [?] [2178]*/ + 0x04,0x04,0x04,0x3F,0x04,0x04,0x7F,0x04,0x04,0x24,0x27,0x24,0x24,0x54,0x4F,0x80, + 0x20,0x20,0x20,0x20,0x30,0x28,0xA4,0x24,0x20,0x20,0xA0,0x20,0x20,0x00,0xFE,0x00, + /* 0xB8B1 [?] [2179]*/ + 0x00,0x7F,0x00,0x3F,0x20,0x20,0x3F,0x00,0x7F,0x44,0x44,0x7F,0x44,0x44,0x7F,0x40, + 0x02,0xC2,0x02,0x82,0x92,0x92,0x92,0x12,0xD2,0x52,0x52,0xD2,0x42,0x42,0xCA,0x44, + /* 0xB8B2 [?] [2180]*/ + 0xFF,0x04,0x3F,0x24,0x3F,0x12,0x27,0x42,0x8B,0x12,0x33,0x51,0x93,0x15,0x10,0x17, + 0xFE,0x40,0xF8,0x48,0xF8,0x00,0xFC,0x08,0xF8,0x08,0xF8,0x00,0xF8,0x10,0xE0,0x1E, + /* 0xB8B3 [?] [2181]*/ + 0x00,0x7C,0x44,0x44,0x54,0x55,0x54,0x54,0x55,0x55,0x55,0x11,0x29,0x25,0x43,0x81, + 0x08,0x0C,0xEA,0x0A,0x08,0xFE,0x48,0x48,0x48,0x68,0x48,0x48,0x4A,0x6A,0x86,0x02, + /* 0xB8B4 [?] [2182]*/ + 0x10,0x10,0x1F,0x20,0x5F,0x90,0x1F,0x10,0x1F,0x04,0x0F,0x18,0x64,0x03,0x1C,0xE0, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E, + /* 0xB8B5 [?] [2183]*/ + 0x08,0x08,0x0F,0x10,0x17,0x34,0x37,0x54,0x97,0x14,0x10,0x1F,0x12,0x11,0x11,0x10, + 0x50,0x48,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x08,0xFE,0x08,0x08,0x28,0x10, + /* 0xB8B6 [?] [2184]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x50,0x91,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xB8B7 [?] [2185]*/ + 0x02,0x04,0x3F,0x20,0x3F,0x20,0x3F,0x20,0x20,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01, + 0x00,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xB8B8 [?] [2186]*/ + 0x04,0x08,0x10,0x20,0x40,0x08,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x40,0x20,0x10,0x08,0x24,0x20,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xB8B9 [?] [2187]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3E,0x24,0x24,0x24,0x3C,0x24,0x24,0x25,0x44,0x54,0x89, + 0x40,0x40,0xFE,0x80,0xFC,0x84,0xFC,0x84,0xFC,0x40,0x7C,0xC4,0x28,0x10,0x68,0x86, + /* 0xB8BA [?] [2188]*/ + 0x04,0x04,0x0F,0x10,0x20,0x5F,0x10,0x11,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0x00,0x00,0xE0,0x20,0x40,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xC0,0x20,0x10,0x08, + /* 0xB8BB [?] [2189]*/ + 0x02,0x01,0x7F,0x40,0xBF,0x00,0x1F,0x10,0x1F,0x00,0x3F,0x21,0x3F,0x21,0x3F,0x20, + 0x00,0x00,0xFE,0x02,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xB8BC [?] [2190]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x80,0x80,0x80,0x80,0x80,0xA0,0x90,0x88,0x84,0x84,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xB8BD [?] [2191]*/ + 0x00,0x7C,0x44,0x49,0x49,0x53,0x4D,0x49,0x45,0x45,0x45,0x69,0x51,0x41,0x41,0x41, + 0x88,0x88,0x88,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xB8BE [?] [2192]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x24,0x25,0x24,0x48,0x28,0x10,0x28,0x45,0x80,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xB8BF [?] [2193]*/ + 0x10,0x10,0x27,0x20,0x4B,0xFA,0x13,0x22,0x43,0xFA,0x40,0x03,0x19,0xE0,0x40,0x00, + 0x50,0x48,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x08,0xFE,0x08,0x88,0xA8,0x10, + /* 0xB8C0 [?] [2194]*/ + 0x00,0x00,0x78,0x49,0x49,0x4B,0x4D,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x88,0x88,0x88,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xB8C1 [?] [2195]*/ + 0x00,0x03,0x78,0x49,0x49,0x49,0x49,0x49,0x48,0x49,0x7A,0x4D,0x01,0x01,0x00,0x00, + 0x88,0xFE,0x88,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFE,0x22,0x52,0x02,0xFA,0x0A,0x04, + /* 0xB8C2 [?] [2196]*/ + 0x07,0x00,0x7B,0x4A,0x4B,0x4A,0x4B,0x4A,0x4B,0x49,0x79,0x4F,0x00,0x00,0x01,0x0E, + 0xFC,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x10,0x7C,0x80,0x90,0x62,0xB2,0x0E, + /* 0xB8C3 [?] [2197]*/ + 0x00,0x40,0x2F,0x20,0x01,0x01,0xE2,0x27,0x20,0x20,0x21,0x2A,0x34,0x20,0x03,0x0C, + 0x80,0x40,0xFE,0x80,0x10,0x10,0x24,0xE4,0x48,0x88,0x10,0x20,0x50,0x88,0x04,0x04, + /* 0xB8C4 [?] [2198]*/ + 0x00,0x00,0xFC,0x04,0x05,0x05,0x06,0x7C,0x40,0x40,0x40,0x44,0x58,0x60,0x41,0x02, + 0x40,0x40,0x80,0xFE,0x08,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xB8C5 [?] [2199]*/ + 0x20,0x27,0x24,0x24,0xFF,0x24,0x24,0x77,0x6C,0xA5,0xA4,0x25,0x26,0x24,0x20,0x20, + 0x00,0xBE,0x88,0x88,0xA8,0xA8,0xA8,0xBE,0x10,0x18,0x98,0xA8,0xAA,0x4A,0x46,0x80, + /* 0xB8C6 [?] [2200]*/ + 0x10,0x13,0x3C,0x20,0x41,0xBD,0x11,0x11,0xFD,0x11,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0xFE,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFE,0x02,0x02,0x02,0x02,0x14,0x08, + /* 0xB8C7 [?] [2201]*/ + 0x08,0x04,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00,0x00,0x3F,0x24,0x24,0x24,0xFF, + 0x20,0x40,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0xF8,0x48,0x48,0x48,0xFE, + /* 0xB8C8 [?] [2202]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x17,0x14,0x25,0xE4,0x25,0x26,0x24,0x20,0x00, + 0x00,0xBE,0x88,0x88,0xA8,0xA8,0xA8,0xBE,0x10,0x18,0x98,0xA8,0xAA,0x4A,0x46,0x80, + /* 0xB8C9 [?] [2203]*/ + 0x00,0x3F,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB8CA [?] [2204]*/ + 0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08,0x0F,0x08, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xB8CB [?] [2205]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x30,0x3B,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xB8CC [?] [2206]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xB8CD [?] [2207]*/ + 0x10,0x10,0x3F,0x48,0x85,0x00,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xB8CE [?] [2208]*/ + 0x00,0x3D,0x24,0x24,0x24,0x3C,0x24,0x27,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xB8CF [?] [2209]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFE,0x09,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB8D0 [?] [2210]*/ + 0x00,0x00,0x3F,0x20,0x2F,0x20,0x2F,0x28,0x28,0x4F,0x40,0x80,0x01,0x48,0x48,0x87, + 0x28,0x24,0xFE,0x20,0xA4,0x24,0xA8,0x98,0x92,0xAA,0x46,0x82,0x00,0x84,0x12,0xF2, + /* 0xB8D1 [?] [2211]*/ + 0x08,0x1D,0xF0,0x10,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xB8D2 [?] [2212]*/ + 0x00,0x7E,0x02,0x04,0xFF,0x22,0x22,0x3E,0x22,0x3E,0x22,0x22,0x2F,0xF2,0x42,0x02, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xB8D3 [?] [2213]*/ + 0x10,0xFE,0x44,0x29,0xFE,0x01,0x7C,0x44,0x7D,0x44,0x7C,0x10,0xFE,0x10,0x10,0x11, + 0x40,0x78,0xD0,0x20,0x58,0x86,0xF8,0x20,0xFC,0x00,0xF8,0x88,0xA8,0xA8,0x50,0x88, + /* 0xB8D4 [?] [2214]*/ + 0x00,0x7F,0x40,0x40,0x40,0x48,0x44,0x42,0x41,0x42,0x44,0x48,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x24,0x44,0x84,0x04,0x84,0x44,0x24,0x04,0x04,0x14,0x08, + /* 0xB8D5 [?] [2215]*/ + 0x00,0x7F,0x41,0x41,0x65,0x55,0x55,0x49,0x49,0x55,0x55,0x65,0x41,0x41,0x45,0x42, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB8D6 [?] [2216]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x04,0x04,0x94,0x54,0x54,0x24,0x24,0x54,0x54,0x94,0x04,0x04,0x14,0x08, + /* 0xB8D7 [?] [2217]*/ + 0x20,0x20,0x3F,0x48,0x88,0x08,0xFF,0x08,0x08,0x49,0x49,0x49,0x4F,0x79,0x01,0x00, + 0x00,0x00,0x7E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xB8D8 [?] [2218]*/ + 0x00,0x3C,0x25,0x24,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x57,0x88, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB8D9 [?] [2219]*/ + 0x10,0x13,0x22,0x22,0x4A,0xFA,0x12,0x22,0x42,0xFA,0x42,0x03,0x1A,0xE2,0x42,0x02, + 0x00,0xFC,0x04,0x04,0x94,0x54,0x24,0x24,0x54,0x54,0x94,0x04,0x04,0x04,0x14,0x08, + /* 0xB8DA [?] [2220]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x20,0x20,0x24,0x22,0x21,0x22,0x24,0x28,0x20,0x20, + 0x00,0x08,0x08,0xF8,0x00,0xF8,0x08,0x48,0x48,0x88,0x08,0x88,0x48,0x08,0x28,0x10, + /* 0xB8DB [?] [2221]*/ + 0x01,0x21,0x17,0x11,0x81,0x4F,0x41,0x12,0x17,0x2A,0xE2,0x23,0x22,0x22,0x21,0x00, + 0x10,0x10,0xFC,0x10,0x10,0xFE,0x10,0x08,0xF4,0x12,0x10,0xF0,0x04,0x04,0xFC,0x00, + /* 0xB8DC [?] [2222]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x13,0x10, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xB8DD [?] [2223]*/ + 0x20,0x3E,0x48,0x82,0xFF,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x4F,0x48,0x4F,0x40, + 0x40,0x7E,0x90,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x00,0xFC,0x04,0xE4,0x24,0xE4,0x0C, + /* 0xB8DE [?] [2224]*/ + 0x02,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x02,0x7F,0x04,0x09,0x31,0xCF,0x01,0x01,0x01, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x40,0x20,0x18,0xE6,0x00,0x00,0x00, + /* 0xB8DF [?] [2225]*/ + 0x02,0x01,0xFF,0x00,0x0F,0x08,0x08,0x0F,0x00,0x7F,0x40,0x4F,0x48,0x48,0x4F,0x40, + 0x00,0x00,0xFE,0x00,0xE0,0x20,0x20,0xE0,0x00,0xFC,0x04,0xE4,0x24,0x24,0xE4,0x0C, + /* 0xB8E0 [?] [2226]*/ + 0x01,0x7F,0x08,0x0F,0x00,0x7F,0x48,0x8F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10, + 0x00,0xFC,0x20,0xE0,0x00,0xFE,0x22,0xE4,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x30, + /* 0xB8E1 [?] [2227]*/ + 0x08,0x04,0x04,0x7F,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00,0x48,0x44,0x84, + 0x20,0x20,0x40,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x88,0x44,0x44, + /* 0xB8E2 [?] [2228]*/ + 0x11,0x10,0x94,0x54,0x5B,0x10,0xFC,0x31,0x38,0x54,0x57,0x90,0x12,0x12,0x14,0x10, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0xA4,0x52,0x52,0x00, + /* 0xB8E3 [?] [2229]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x11,0x14,0x1B,0x32,0xD2,0x12,0x12,0x12,0x52,0x22, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xB8E4 [?] [2230]*/ + 0x20,0x20,0x3B,0x20,0x41,0x79,0xA1,0x20,0xFB,0x22,0x22,0x22,0x2A,0x32,0x22,0x02, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xB8E5 [?] [2231]*/ + 0x08,0x1C,0xF3,0x10,0x11,0xFD,0x11,0x38,0x37,0x52,0x52,0x92,0x12,0x12,0x12,0x12, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xB8E6 [?] [2232]*/ + 0x01,0x11,0x11,0x1F,0x21,0x41,0x01,0xFF,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xB8E7 [?] [2233]*/ + 0x00,0x7F,0x00,0x1F,0x10,0x10,0x1F,0x00,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00, + 0x00,0xFC,0x10,0x90,0x90,0x90,0x90,0x00,0xFE,0x10,0x90,0x90,0x90,0x90,0x50,0x20, + /* 0xB8E8 [?] [2234]*/ + 0x00,0xFF,0x02,0x7A,0x4A,0x7A,0x00,0xFF,0x02,0x7A,0x4A,0x4A,0x7A,0x02,0x0A,0x04, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x82, + /* 0xB8E9 [?] [2235]*/ + 0x22,0x21,0x25,0x24,0xF4,0x25,0x26,0x24,0x34,0xE7,0x25,0x25,0x25,0x25,0xA5,0x44, + 0x00,0x7C,0x04,0x84,0xF4,0x14,0xA4,0x44,0xA4,0x1C,0xF4,0x14,0x14,0xF4,0x14,0x08, + /* 0xB8EA [?] [2236]*/ + 0x02,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x01,0x01,0x00,0x03,0x0C,0x70,0x00, + 0x20,0x10,0x10,0x00,0xFE,0x00,0x08,0x08,0x10,0x20,0x40,0x80,0x42,0x22,0x1A,0x06, + /* 0xB8EB [?] [2237]*/ + 0x10,0x10,0x28,0x24,0x42,0x80,0x7C,0x00,0x00,0x7C,0x44,0x44,0x45,0x7C,0x44,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xB8EC [?] [2238]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xB8ED [?] [2239]*/ + 0x00,0x00,0x1F,0x11,0x91,0x53,0x54,0x18,0x33,0x50,0x90,0x10,0x21,0x22,0x42,0x81, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x00,0x00,0xF8,0x10,0x60,0x80,0x00,0x02,0x02,0xFE, + /* 0xB8EE [?] [2240]*/ + 0x10,0x08,0xFF,0x80,0x09,0x7F,0x08,0x7F,0x08,0xFF,0x08,0x7F,0x41,0x41,0x7F,0x41, + 0x04,0x04,0x84,0xA4,0x24,0x24,0x24,0x24,0x24,0xA4,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB8EF [?] [2241]*/ + 0x08,0x08,0x7F,0x08,0x08,0x0F,0x01,0x3F,0x21,0x21,0x3F,0x01,0xFF,0x01,0x01,0x01, + 0x20,0x20,0xFC,0x20,0x20,0xE0,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x00,0x00,0x00, + /* 0xB8F0 [?] [2242]*/ + 0x08,0xFF,0x08,0x1F,0x10,0x1F,0x10,0x1F,0x08,0x1F,0x21,0x52,0x94,0x10,0x1F,0x00, + 0x20,0xFE,0x20,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x04,0x84,0x44,0x04,0xA8,0x10, + /* 0xB8F1 [?] [2243]*/ + 0x10,0x10,0x10,0x11,0xFB,0x14,0x30,0x38,0x55,0x52,0x95,0x11,0x11,0x11,0x11,0x11, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xB8F2 [?] [2244]*/ + 0x10,0x10,0x10,0x7C,0x54,0x55,0x56,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x20,0x20,0x50,0x50,0x88,0x04,0xFA,0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xB8F3 [?] [2245]*/ + 0x20,0x17,0x02,0x42,0x47,0x4C,0x52,0x41,0x42,0x4C,0x77,0x44,0x44,0x47,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x44,0x84,0x04,0x84,0x64,0xDC,0x44,0x44,0xC4,0x14,0x08, + /* 0xB8F4 [?] [2246]*/ + 0x00,0x7B,0x48,0x51,0x51,0x61,0x51,0x48,0x4B,0x4A,0x6A,0x53,0x42,0x42,0x42,0x42, + 0x00,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x8A,0x52,0xFE,0x22,0x22,0x2A,0x04, + /* 0xB8F5 [?] [2247]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBC,0x10,0x10,0xFD,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xB8F6 [?] [2248]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x21,0xC1,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB8F7 [?] [2249]*/ + 0x04,0x04,0x0F,0x18,0x24,0x03,0x0C,0x30,0xC0,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xF0,0x20,0xC0,0x00,0xC0,0x30,0x0E,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xB8F8 [?] [2250]*/ + 0x10,0x10,0x20,0x21,0x4A,0xF4,0x13,0x20,0x40,0xFB,0x42,0x02,0x1A,0xE2,0x43,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB8F9 [?] [2251]*/ + 0x10,0x13,0x12,0x12,0xFB,0x12,0x32,0x3B,0x56,0x52,0x92,0x12,0x12,0x12,0x13,0x12, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xB8FA [?] [2252]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xB8FB [?] [2253]*/ + 0x10,0x10,0x10,0xFE,0x11,0x7C,0x10,0xFE,0x13,0x38,0x34,0x54,0x50,0x91,0x11,0x12, + 0x88,0x88,0x88,0x88,0xFC,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xB8FC [?] [2254]*/ + 0x00,0xFF,0x01,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x11,0x0A,0x06,0x19,0xE0, + 0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0x00,0xC0,0x3E, + /* 0xB8FD [?] [2255]*/ + 0x01,0x00,0x3F,0x20,0x20,0x2F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x41,0x42,0x8C,0x30, + 0x00,0x80,0xFE,0x00,0x80,0xF8,0x88,0x88,0xFE,0x88,0x88,0xF8,0x40,0x20,0x18,0x06, + /* 0xB8FE [?] [2256]*/ + 0x04,0x7F,0x01,0x3F,0x01,0xFF,0x48,0x82,0x3F,0x01,0x1F,0x01,0xFF,0x02,0x0C,0x70, + 0x40,0xFC,0x00,0xF8,0x00,0xFE,0x24,0x82,0xF8,0x00,0xF0,0x00,0xFE,0x80,0x60,0x1C, + /* 0xB9A1 [?] [2257]*/ + 0x10,0x13,0x10,0x10,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE0,0x40,0x00,0x03, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xB9A2 [?] [2258]*/ + 0x00,0xFF,0x24,0x24,0x3C,0x24,0x24,0x3D,0x24,0x24,0x2E,0xF4,0x44,0x04,0x05,0x06, + 0x20,0x20,0x20,0x24,0xA4,0xA4,0xA8,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xB9A3 [?] [2259]*/ + 0x10,0x13,0x10,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x10,0x13, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xB9A4 [?] [2260]*/ + 0x00,0x00,0x7F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00, + /* 0xB9A5 [?] [2261]*/ + 0x00,0x00,0x00,0xFE,0x10,0x11,0x12,0x10,0x10,0x10,0x10,0x1E,0xF0,0x40,0x01,0x02, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xB9A6 [?] [2262]*/ + 0x00,0x00,0x00,0xFE,0x11,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0xF1,0x41,0x02,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xB9A7 [?] [2263]*/ + 0x04,0x04,0x3F,0x04,0x04,0xFF,0x04,0x08,0x12,0x22,0xC2,0x12,0x12,0x22,0x0A,0x04, + 0x40,0x40,0xF8,0x40,0x40,0xFE,0x40,0x20,0x10,0x08,0x26,0x90,0x48,0x48,0x00,0x00, + /* 0xB9A8 [?] [2264]*/ + 0x04,0x04,0x7F,0x09,0x09,0x17,0x20,0xC4,0x04,0x3F,0x04,0x04,0xFF,0x08,0x10,0x20, + 0x20,0x10,0xFC,0x20,0xC4,0x04,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x20,0x10,0x08, + /* 0xB9A9 [?] [2265]*/ + 0x09,0x09,0x09,0x11,0x13,0x31,0x31,0x51,0x91,0x17,0x10,0x11,0x11,0x12,0x14,0x18, + 0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0x10,0x10,0xFE,0x00,0x10,0x08,0x08,0x04,0x04, + /* 0xB9AA [?] [2266]*/ + 0x08,0x10,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x22,0xFE,0x06,0x0A,0x12,0x22,0x4A,0x04, + 0x00,0xFC,0x04,0x04,0x04,0x7C,0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xB9AB [?] [2267]*/ + 0x00,0x04,0x04,0x08,0x08,0x10,0x20,0x42,0x82,0x04,0x04,0x08,0x10,0x3F,0x10,0x00, + 0x80,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06,0x00,0x40,0x20,0x20,0xF0,0x10,0x00, + /* 0xB9AC [?] [2268]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x20,0x20,0x20,0x3F,0x20, + 0x00,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xB9AD [?] [2269]*/ + 0x00,0x7F,0x00,0x00,0x00,0x3F,0x20,0x20,0x40,0x7F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xB9AE [?] [2270]*/ + 0x00,0x01,0x7D,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04,0x08, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x50,0x50,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xB9AF [?] [2271]*/ + 0x00,0x3F,0x01,0x01,0x01,0xFF,0x00,0x01,0x01,0x7D,0x05,0x09,0x11,0x21,0xC5,0x02, + 0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x04,0x88,0x50,0x20,0x10,0x08,0x06,0x00, + /* 0xB9B0 [?] [2272]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x10,0x14,0x18,0x33,0xD0,0x10,0x10,0x11,0x52,0x24, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xFE,0x00,0x88,0x84,0x04,0x02,0x02, + /* 0xB9B1 [?] [2273]*/ + 0x00,0x3F,0x01,0x01,0x7F,0x00,0x00,0x1F,0x10,0x11,0x11,0x11,0x12,0x04,0x18,0x60, + 0x00,0xF8,0x00,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xB9B2 [?] [2274]*/ + 0x04,0x04,0x04,0x04,0x3F,0x04,0x04,0x04,0x04,0x04,0x7F,0x00,0x04,0x08,0x10,0x20, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00,0x20,0x10,0x08,0x04, + /* 0xB9B3 [?] [2275]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBD,0x12,0x10,0xFC,0x10,0x11,0x11,0x14,0x18,0x10,0x00, + 0x80,0x80,0x80,0xFC,0x04,0x04,0x44,0x44,0x84,0xA4,0x14,0xF4,0x14,0x04,0x28,0x10, + /* 0xB9B4 [?] [2276]*/ + 0x08,0x08,0x10,0x1F,0x20,0x42,0x82,0x04,0x04,0x08,0x10,0x3F,0x10,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x88,0x48,0xE8,0x28,0x08,0x50,0x20, + /* 0xB9B5 [?] [2277]*/ + 0x01,0x21,0x11,0x11,0x82,0x44,0x40,0x11,0x11,0x22,0xE7,0x22,0x20,0x20,0x20,0x00, + 0x00,0x00,0x00,0xFC,0x04,0x84,0x84,0x04,0x44,0x24,0xF4,0x14,0x04,0x04,0x28,0x10, + /* 0xB9B6 [?] [2278]*/ + 0x04,0x04,0xFF,0x04,0x10,0x1F,0x20,0x40,0x9F,0x10,0x10,0x1F,0x10,0x00,0x00,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0x88,0x88,0x08,0x50,0x20, + /* 0xB9B7 [?] [2279]*/ + 0x00,0x44,0x29,0x11,0x2A,0x4C,0x89,0x09,0x19,0x29,0x49,0x89,0x08,0x08,0x50,0x20, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x04,0x28,0x10, + /* 0xB9B8 [?] [2280]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0xFE,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x00, + /* 0xB9B9 [?] [2281]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x32,0x38,0x54,0x54,0x91,0x11,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFC,0x04,0x04,0x44,0x44,0x84,0xA4,0x14,0xF4,0x14,0x04,0x28,0x10, + /* 0xB9BA [?] [2282]*/ + 0x00,0x7C,0x44,0x54,0x55,0x55,0x56,0x54,0x54,0x54,0x55,0x11,0x28,0x24,0x44,0x80, + 0x80,0x80,0x80,0xFC,0x04,0x04,0x44,0x44,0x84,0xA4,0x14,0xF4,0x14,0x04,0x28,0x10, + /* 0xB9BB [?] [2283]*/ + 0x20,0x20,0x40,0x7E,0x82,0x02,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x14,0x08, + 0x20,0x20,0x7C,0x44,0xA8,0x10,0x20,0xD0,0x1E,0x22,0x64,0x94,0x08,0x10,0x20,0xC0, + /* 0xB9BC [?] [2284]*/ + 0x01,0x7F,0x01,0x1F,0x10,0x1F,0x01,0x3F,0x08,0x04,0xFF,0x01,0x3F,0x01,0x01,0x01, + 0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x20,0x40,0xFE,0x00,0xF8,0x00,0x00,0x00, + /* 0xB9BD [?] [2285]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0xFE,0x12,0x22,0x22,0x64,0x14,0x08,0x14,0x22,0xC0, + 0x40,0x40,0xFE,0x40,0x10,0x10,0xFE,0x10,0x10,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xB9BE [?] [2286]*/ + 0x00,0x00,0x78,0x48,0x4B,0x48,0x48,0x48,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB9BF [?] [2287]*/ + 0x20,0x3F,0x48,0x85,0x10,0x13,0x12,0xFE,0x12,0x12,0x1E,0xF2,0x12,0x12,0x52,0x23, + 0x40,0x7E,0x90,0x08,0x00,0xFE,0x20,0x20,0xFC,0xA4,0xA4,0xA4,0xB4,0xA8,0x20,0xFE, + /* 0xB9C0 [?] [2288]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x50,0x93,0x12,0x12,0x12,0x12,0x12,0x13,0x12, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB9C1 [?] [2289]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x48,0x08,0x13,0x12,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xB9C2 [?] [2290]*/ + 0x00,0xF8,0x0B,0x12,0x22,0x22,0x2A,0x32,0x22,0xE2,0x22,0x22,0x22,0x24,0xA4,0x48, + 0x08,0x3C,0xD0,0x90,0x90,0x90,0x90,0x90,0x90,0x88,0x88,0xC8,0xA4,0xD4,0x92,0x00, + /* 0xB9C3 [?] [2291]*/ + 0x10,0x10,0x10,0x10,0xFD,0x24,0x24,0x24,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xB9C4 [?] [2292]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7E,0x00,0x7E,0x42,0x42,0x7E,0x42,0x24,0x0F,0xF0,0x40, + 0x10,0x10,0x10,0xFE,0x10,0x10,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xB9C5 [?] [2293]*/ + 0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x1F,0x10,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xB9C6 [?] [2294]*/ + 0x01,0x01,0x3F,0x21,0x21,0x3F,0x01,0x01,0x7F,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0xF8,0x08,0x08,0xF8,0x00,0x08,0xFC,0x04,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xB9C7 [?] [2295]*/ + 0x1F,0x10,0x1F,0x10,0x10,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0xF0,0x10,0x90,0x90,0x90,0xFE,0x02,0xF4,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xB9C8 [?] [2296]*/ + 0x08,0x08,0x11,0x21,0x42,0x04,0x08,0x30,0xC0,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x20,0x10,0x08,0x04,0x80,0x40,0x20,0x18,0x06,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xB9C9 [?] [2297]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3D,0x26,0x25,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x8B, + 0x00,0xF8,0x88,0x88,0x88,0x06,0x00,0xFC,0x84,0x84,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xB9CA [?] [2298]*/ + 0x10,0x10,0x10,0x10,0xFE,0x11,0x12,0x10,0x7C,0x44,0x44,0x44,0x44,0x7C,0x45,0x02, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xB9CB [?] [2299]*/ + 0x00,0x7E,0x40,0x40,0x5E,0x52,0x52,0x52,0x5A,0x54,0x50,0x52,0x54,0x58,0x50,0x83, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xB9CC [?] [2300]*/ + 0x00,0x7F,0x41,0x41,0x5F,0x41,0x41,0x4F,0x48,0x48,0x48,0x4F,0x48,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0xFC,0x04, + /* 0xB9CD [?] [2301]*/ + 0x01,0x00,0x3F,0x20,0x3F,0x22,0x22,0x27,0x2C,0x37,0x24,0x27,0x44,0x44,0x87,0x04, + 0x00,0x80,0xFC,0x04,0xFC,0x80,0x40,0xFC,0x40,0xF8,0x40,0xF8,0x40,0x40,0xFC,0x00, + /* 0xB9CE [?] [2302]*/ + 0x02,0x0F,0x78,0x08,0x08,0xFF,0x08,0x08,0x08,0x7F,0x41,0x41,0x41,0x41,0x7F,0x41, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB9CF [?] [2303]*/ + 0x00,0x00,0x1F,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x22,0x22,0x43,0x42,0x80, + 0x10,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x90,0x50,0xA8,0x28,0x04,0x02, + /* 0xB9D0 [?] [2304]*/ + 0x00,0x7F,0x41,0x41,0x41,0x7F,0x08,0x08,0xFF,0x88,0x94,0xA2,0xC2,0x80,0x82,0x81, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0xA4,0xA4,0xA4,0xA4,0x84,0x84,0x94,0x08, + /* 0xB9D1 [?] [2305]*/ + 0x01,0x7F,0x40,0xBF,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x08,0x37,0xC2,0x0C, + 0x00,0xFE,0x02,0xF4,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xFE,0x20,0xD8,0x46,0xC0, + /* 0xB9D2 [?] [2306]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x13,0x10,0x18,0x30,0xD1,0x10,0x10,0x10,0x53,0x20, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xB9D3 [?] [2307]*/ + 0x21,0x11,0x07,0xF1,0x11,0x21,0x2F,0x68,0xB1,0x29,0x27,0x21,0x21,0x21,0x2E,0x24, + 0x10,0x10,0xD0,0x10,0x10,0x18,0xF4,0x12,0x12,0x10,0xD0,0x10,0x10,0xD0,0x10,0x10, + /* 0xB9D4 [?] [2308]*/ + 0x00,0x1F,0x01,0x01,0xFF,0x01,0x09,0x09,0x79,0x09,0x09,0x19,0xE9,0x01,0x01,0x01, + 0x70,0x80,0x00,0x00,0xFE,0x00,0x20,0x24,0x28,0x30,0x22,0x22,0x1E,0x00,0x00,0x00, + /* 0xB9D5 [?] [2309]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x10,0x14,0x1B,0x30,0xD0,0x10,0x10,0x11,0x52,0x24, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x40,0x40,0xFC,0x44,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xB9D6 [?] [2310]*/ + 0x10,0x17,0x12,0x11,0x18,0x54,0x50,0x53,0x9C,0x10,0x17,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x46,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xB9D7 [?] [2311]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB9D8 [?] [2312]*/ + 0x10,0x08,0x08,0x00,0x3F,0x01,0x01,0x01,0xFF,0x01,0x02,0x02,0x04,0x08,0x30,0xC0, + 0x10,0x10,0x20,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x80,0x80,0x40,0x20,0x18,0x06, + /* 0xB9D9 [?] [2313]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xB9DA [?] [2314]*/ + 0x00,0x7F,0x40,0x80,0x3E,0x00,0x00,0x7E,0x14,0x14,0x14,0x14,0x24,0x24,0x43,0x80, + 0x00,0xFE,0x02,0x04,0x08,0x08,0xFE,0x08,0x48,0x28,0x08,0x2A,0x12,0x02,0xFE,0x00, + /* 0xB9DB [?] [2315]*/ + 0x00,0x01,0x01,0xFD,0x05,0x05,0x49,0x29,0x11,0x11,0x28,0x24,0x44,0x81,0x02,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xB9DC [?] [2316]*/ + 0x20,0x3F,0x48,0x85,0x01,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x40,0x7E,0x90,0x08,0x00,0xFE,0x02,0xE4,0x20,0xE0,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xB9DD [?] [2317]*/ + 0x20,0x20,0x23,0x3A,0x4C,0x51,0x81,0x21,0x21,0x21,0x21,0x21,0x29,0x31,0x21,0x01, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xB9DE [?] [2318]*/ + 0x40,0x43,0x78,0xA3,0x22,0x23,0xF8,0x20,0x21,0xA9,0xAB,0xAD,0xB9,0xC9,0x01,0x01, + 0x88,0xFE,0x88,0xDE,0x52,0xDE,0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xB9DF [?] [2319]*/ + 0x11,0x11,0x11,0x13,0x19,0x55,0x51,0x50,0x91,0x11,0x11,0x11,0x11,0x10,0x10,0x13, + 0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x00,0xFC,0x04,0x24,0x24,0x24,0x58,0x84,0x02, + /* 0xB9E0 [?] [2320]*/ + 0x01,0x4F,0x21,0x27,0x04,0x87,0x41,0x51,0x13,0x22,0xE7,0x2A,0x23,0x22,0x23,0x02, + 0x10,0xFE,0x10,0xBC,0xA4,0xBC,0x40,0x20,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xB9E1 [?] [2321]*/ + 0x1F,0x11,0x11,0xFF,0x11,0x11,0x1F,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0xF0,0x10,0x10,0xFE,0x10,0x10,0xF0,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xB9E2 [?] [2322]*/ + 0x01,0x21,0x11,0x09,0x09,0x01,0xFF,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x08,0x08,0x10,0x20,0x00,0xFE,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xB9E3 [?] [2323]*/ + 0x01,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0x80,0x80,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xB9E4 [?] [2324]*/ + 0x00,0x48,0x25,0x22,0x0D,0x01,0xE1,0x23,0x2D,0x21,0x21,0x2A,0x24,0x50,0x8F,0x00, + 0x00,0x80,0x7C,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x7E,0x00,0x00,0xFE,0x00, + /* 0xB9E5 [?] [2325]*/ + 0x00,0x00,0xFB,0x22,0x22,0x23,0x22,0xFA,0x23,0x20,0x20,0x38,0xE1,0x41,0x02,0x04, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x40,0xA8,0xB4,0x3C,0x22,0x22,0x1E, + /* 0xB9E6 [?] [2326]*/ + 0x10,0x11,0x11,0x7D,0x11,0x11,0x11,0xFF,0x11,0x11,0x10,0x28,0x24,0x45,0x82,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xB9E7 [?] [2327]*/ + 0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xB9E8 [?] [2328]*/ + 0x00,0x00,0xF9,0x20,0x20,0x40,0x7B,0x48,0xC8,0x48,0x49,0x48,0x78,0x48,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xB9E9 [?] [2329]*/ + 0x08,0x08,0x4B,0x48,0x48,0x48,0x48,0x49,0x48,0x48,0x48,0x08,0x10,0x13,0x20,0x40, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xB9EA [?] [2330]*/ + 0x04,0x04,0x0F,0x10,0x20,0x7F,0xA1,0x21,0x3F,0x21,0x21,0x3F,0x21,0x01,0x01,0x00, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x02,0x02,0xFE, + /* 0xB9EB [?] [2331]*/ + 0x20,0x17,0x00,0x41,0x4F,0x41,0x41,0x5F,0x40,0x41,0x4F,0x41,0x41,0x5F,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x04,0x04,0xF4,0x04,0x04,0xE4,0x04,0x04,0xF4,0x04,0x0C, + /* 0xB9EC [?] [2332]*/ + 0x20,0x20,0x20,0xFC,0x43,0x50,0x90,0xFC,0x10,0x10,0x1C,0xF0,0x51,0x11,0x12,0x14, + 0x80,0x80,0x80,0x80,0xF0,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xB9ED [?] [2333]*/ + 0x02,0x04,0x3F,0x21,0x21,0x3F,0x22,0x22,0x3F,0x05,0x09,0x09,0x11,0x21,0x41,0x80, + 0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x10,0x20,0x48,0x7C,0x02,0x02,0xFE, + /* 0xB9EE [?] [2334]*/ + 0x01,0x41,0x23,0x22,0x04,0x0B,0xE2,0x22,0x22,0x22,0x22,0x22,0x2A,0x34,0x24,0x08, + 0x00,0x00,0xF8,0x08,0x10,0xFE,0x00,0xF8,0x88,0x88,0xA8,0x90,0x82,0x82,0x7E,0x00, + /* 0xB9EF [?] [2335]*/ + 0x00,0x7E,0x02,0x44,0x28,0x10,0x20,0xCF,0x01,0x01,0x7F,0x01,0x02,0x04,0x18,0x60, + 0x90,0xA0,0x44,0x48,0x30,0x10,0x08,0xE6,0x00,0x00,0xFC,0x00,0xC0,0x20,0x10,0x08, + /* 0xB9F0 [?] [2336]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x91,0x10,0x10,0x10,0x13,0x10, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xB9F1 [?] [2337]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x10, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xB9F2 [?] [2338]*/ + 0x00,0x7C,0x44,0x45,0x46,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x40,0x40,0xFC,0x04,0x08,0xFE,0x00,0x7C,0x44,0x44,0x54,0x48,0x42,0x42,0x3E,0x00, + /* 0xB9F3 [?] [2339]*/ + 0x01,0x1F,0x11,0x11,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0xFE,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xB9F4 [?] [2340]*/ + 0x08,0x08,0x14,0x22,0x41,0xBE,0x00,0x00,0xFF,0x10,0x10,0x22,0x41,0xFF,0x41,0x00, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0xA4,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xB9F5 [?] [2341]*/ + 0x20,0x21,0x21,0xFD,0x41,0x51,0x91,0xFD,0x10,0x11,0x1D,0xF1,0x51,0x11,0x11,0x11, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xB9F6 [?] [2342]*/ + 0x00,0x20,0x17,0x11,0x82,0x44,0x41,0x13,0x10,0x20,0xE1,0x23,0x25,0x29,0x21,0x01, + 0x80,0x40,0xFC,0x10,0x48,0x84,0x20,0xF0,0x10,0x88,0x50,0x20,0x10,0x48,0x86,0x00, + /* 0xB9F7 [?] [2343]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x54,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xB9F8 [?] [2344]*/ + 0x20,0x21,0x39,0x21,0x41,0x79,0xA0,0x20,0xFB,0x22,0x22,0x22,0x2B,0x32,0x22,0x02, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xB9F9 [?] [2345]*/ + 0x10,0x08,0xFF,0x00,0x7E,0x42,0x7E,0x00,0x7E,0x04,0x08,0x0F,0xF8,0x08,0x28,0x10, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xB9FA [?] [2346]*/ + 0x00,0x7F,0x40,0x40,0x5F,0x41,0x41,0x4F,0x41,0x41,0x41,0x5F,0x40,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x04,0x44,0x24,0xF4,0x04,0x04,0xFC,0x04, + /* 0xB9FB [?] [2347]*/ + 0x00,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x11,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xB9FC [?] [2348]*/ + 0x01,0xFF,0x00,0x1F,0x11,0x1F,0x11,0x1F,0x01,0xFF,0x13,0x65,0x0C,0x35,0xC6,0x04, + 0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0x88,0x50,0x30,0x0E,0x00, + /* 0xB9FD [?] [2349]*/ + 0x00,0x20,0x10,0x17,0x00,0x00,0xF2,0x11,0x11,0x10,0x10,0x10,0x10,0x28,0x47,0x00, + 0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20,0x00,0xFE,0x00, + /* 0xB9FE [?] [2350]*/ + 0x00,0x00,0x78,0x49,0x4A,0x4C,0x4B,0x48,0x48,0x4B,0x7A,0x4A,0x02,0x02,0x03,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xBAA1 [?] [2351]*/ + 0x00,0x7C,0x44,0x75,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7D,0x44,0x44,0x54,0x49, + 0x20,0x10,0x10,0xFE,0x20,0x24,0x44,0xF8,0x12,0x22,0x44,0x88,0x10,0x28,0x44,0x82, + /* 0xBAA2 [?] [2352]*/ + 0x00,0xFC,0x04,0x0B,0x10,0x10,0x14,0x19,0x30,0xD0,0x10,0x13,0x10,0x10,0x50,0x23, + 0x20,0x10,0x10,0xFE,0x20,0x42,0x84,0xF8,0x10,0x22,0xC4,0x08,0x10,0x28,0xC4,0x02, + /* 0xBAA3 [?] [2353]*/ + 0x01,0x21,0x11,0x12,0x85,0x41,0x49,0x09,0x17,0x11,0xE2,0x22,0x23,0x20,0x20,0x00, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xBAA4 [?] [2354]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x04,0x7F,0x08,0x11,0x3E,0x04,0x19,0x62,0x0D,0x30, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x10,0x10,0x10,0x92,0x0A,0x0A,0x06,0x82, + /* 0xBAA5 [?] [2355]*/ + 0x02,0x01,0x00,0x7F,0x02,0x04,0x08,0x10,0x3F,0x01,0x06,0x18,0x60,0x03,0x0C,0x70, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x20,0x40,0x88,0x10,0x20,0x40,0xA0,0x10,0x08,0x04, + /* 0xBAA6 [?] [2356]*/ + 0x02,0x01,0x7F,0x40,0x81,0x3F,0x01,0x1F,0x01,0xFF,0x01,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xBAA7 [?] [2357]*/ + 0x00,0xF8,0x08,0x49,0x48,0x48,0x48,0x7C,0x04,0x04,0x1C,0xE5,0x44,0x04,0x28,0x11, + 0x20,0x10,0x10,0xFE,0x20,0x24,0x44,0xF8,0x12,0x22,0x44,0x88,0x10,0x28,0x44,0x82, + /* 0xBAA8 [?] [2358]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x44,0x44,0x44,0x44,0xFE,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xBAA9 [?] [2359]*/ + 0x7C,0x04,0xFF,0x22,0x3E,0x22,0x3E,0x23,0xFE,0x42,0x02,0x01,0x28,0x28,0x48,0x07, + 0x20,0x20,0x3E,0x44,0xA4,0x28,0x28,0x90,0x28,0x44,0x82,0x00,0x88,0xA4,0x24,0xE0, + /* 0xBAAA [?] [2360]*/ + 0x22,0x22,0x22,0x22,0xFF,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x22,0x3E,0x22,0x00, + 0x00,0x3E,0x22,0x24,0xA4,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xBAAB [?] [2361]*/ + 0x10,0x10,0x10,0xFE,0x10,0x7C,0x44,0x7C,0x44,0x7D,0x10,0xFE,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xBAAC [?] [2362]*/ + 0x01,0x01,0x02,0x04,0x0A,0x31,0xC1,0x0F,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0xE0,0x40,0x80,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xBAAD [?] [2363]*/ + 0x00,0x23,0x10,0x10,0x84,0x45,0x44,0x14,0x14,0x25,0xE6,0x25,0x24,0x24,0x27,0x00, + 0x00,0xF8,0x10,0x20,0x44,0x54,0xE4,0x44,0xE4,0x54,0x4C,0x44,0x84,0x04,0xFC,0x04, + /* 0xBAAE [?] [2364]*/ + 0x02,0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x13,0x20,0xC0,0x06,0x01,0x00, + 0x00,0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0x10,0x88,0x46,0x00,0x80,0x40, + /* 0xBAAF [?] [2365]*/ + 0x00,0x3F,0x00,0x00,0x51,0x49,0x45,0x41,0x45,0x49,0x51,0x45,0x42,0x40,0x7F,0x00, + 0x00,0xF0,0x20,0x40,0x94,0x24,0x44,0x04,0x44,0x24,0x14,0x04,0x04,0x04,0xFC,0x04, + /* 0xBAB0 [?] [2366]*/ + 0x00,0x00,0x70,0x57,0x54,0x54,0x55,0x54,0x54,0x55,0x75,0x55,0x05,0x04,0x08,0x10, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD0,0x12,0x12,0xD4,0x54,0x48,0xDA,0x2A,0x46,0x82, + /* 0xBAB1 [?] [2367]*/ + 0x00,0x7F,0x40,0x88,0x10,0x20,0x1F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x00,0xFE,0x02,0x24,0x10,0x08,0xF0,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xBAB2 [?] [2368]*/ + 0x10,0x10,0x10,0xFE,0x11,0x7C,0x45,0x7C,0x45,0x7C,0x10,0xFE,0x11,0x10,0x11,0x10, + 0x20,0x20,0x50,0x88,0x06,0x00,0xDC,0x44,0x54,0xCC,0x44,0xCC,0x54,0x44,0x54,0x88, + /* 0xBAB3 [?] [2369]*/ + 0x20,0x20,0x27,0x24,0xF5,0x24,0x25,0x25,0x35,0xE4,0x24,0x28,0x22,0x22,0xA4,0x40, + 0x14,0x12,0xFE,0x10,0xD0,0x14,0xD4,0x58,0xCA,0x16,0x42,0x24,0xA2,0x8A,0x78,0x00, + /* 0xBAB4 [?] [2370]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x10,0x14,0x19,0x30,0xD0,0x13,0x10,0x10,0x50,0x20, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0x00,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xBAB5 [?] [2371]*/ + 0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01,0x01, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xBAB6 [?] [2372]*/ + 0x20,0x20,0x27,0x24,0x35,0xAC,0xA5,0xA5,0xA5,0x24,0x24,0x28,0x22,0x22,0x24,0x20, + 0x14,0x12,0xFE,0x10,0xD0,0x14,0xD4,0x58,0xCA,0x16,0x42,0x24,0xA2,0x8A,0x78,0x00, + /* 0xBAB7 [?] [2373]*/ + 0x10,0x11,0x11,0x11,0x19,0x55,0x50,0x50,0x91,0x10,0x10,0x13,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0x00,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xBAB8 [?] [2374]*/ + 0x10,0x11,0x11,0x11,0x55,0x59,0x50,0x90,0x11,0x10,0x10,0x2B,0x24,0x44,0x40,0x80, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0x00,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xBAB9 [?] [2375]*/ + 0x00,0x20,0x13,0x10,0x80,0x40,0x48,0x08,0x17,0x10,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xBABA [?] [2376]*/ + 0x00,0x27,0x12,0x12,0x82,0x41,0x49,0x09,0x10,0x10,0xE0,0x20,0x20,0x21,0x22,0x0C, + 0x00,0xF8,0x08,0x08,0x08,0x10,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0x10,0x08,0x06, + /* 0xBABB [?] [2377]*/ + 0x01,0x01,0x7F,0x02,0x04,0x08,0x30,0xC1,0x01,0x3F,0x02,0x02,0x04,0x08,0x10,0x60, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xBABC [?] [2378]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBABD [?] [2379]*/ + 0x10,0x20,0x7C,0x45,0x64,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x44,0x45,0x55,0x8A, + 0x40,0x20,0x00,0xFC,0x00,0x00,0xF0,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xBABE [?] [2380]*/ + 0x20,0x27,0x20,0x21,0xF9,0x21,0x20,0x27,0x24,0x23,0x29,0x36,0xE1,0x46,0x01,0x0E, + 0x40,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xFE,0x02,0xF8,0x80,0x44,0xB8,0x68,0xA6,0x60, + /* 0xBABF [?] [2381]*/ + 0x00,0x07,0xF0,0x91,0x91,0x91,0x90,0x97,0x94,0x93,0xF1,0x96,0x01,0x06,0x01,0x0E, + 0x40,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xFE,0x02,0xF8,0x80,0x44,0xB8,0x68,0xA6,0x60, + /* 0xBAC0 [?] [2382]*/ + 0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x9F,0x06,0x19,0x06,0x39,0x06,0x39, + 0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0x20,0xC0,0xB0,0x8C,0x80, + /* 0xBAC1 [?] [2383]*/ + 0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x81,0x3E,0x03,0x3E,0x03,0x7E,0x01, + 0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0xF0,0x00,0xFA,0x02,0xFE, + /* 0xBAC2 [?] [2384]*/ + 0x08,0x08,0x7F,0x08,0x08,0x08,0xFF,0x12,0x12,0x53,0x52,0x92,0x22,0x22,0x4A,0x84, + 0x00,0x3E,0x22,0x24,0x24,0x28,0xA4,0x24,0x22,0x22,0xA2,0xB4,0x28,0x20,0x20,0x20, + /* 0xBAC3 [?] [2385]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x24,0x25,0x24,0x48,0x28,0x10,0x28,0x44,0x84,0x00, + 0x00,0xFC,0x04,0x08,0x10,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xBAC4 [?] [2386]*/ + 0x10,0x10,0x10,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x38,0x35,0x54,0x50,0x90,0x10,0x10, + 0x08,0x1C,0xE0,0x20,0x20,0x3C,0xE0,0x20,0x20,0x3E,0xE0,0x20,0x22,0x22,0x22,0x1E, + /* 0xBAC5 [?] [2387]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x00,0xFF,0x08,0x10,0x1F,0x00,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0xA0,0x40, + /* 0xBAC6 [?] [2388]*/ + 0x00,0x22,0x12,0x13,0x84,0x48,0x40,0x17,0x10,0x20,0xE3,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBAC7 [?] [2389]*/ + 0x00,0x00,0x7B,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xBAC8 [?] [2390]*/ + 0x00,0x03,0x7A,0x4B,0x4A,0x4B,0x49,0x4B,0x4C,0x4A,0x7A,0x4A,0x03,0x00,0x00,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xBAC9 [?] [2391]*/ + 0x04,0x04,0xFF,0x04,0x10,0x17,0x20,0x60,0xA7,0x24,0x24,0x24,0x27,0x20,0x20,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xBACA [?] [2392]*/ + 0x04,0x04,0xFF,0x04,0x20,0x17,0x10,0x80,0x4B,0x4A,0x12,0xE3,0x22,0x20,0x20,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0xC8,0x48,0x08,0x28,0x10, + /* 0xBACB [?] [2393]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x30,0x39,0x54,0x54,0x90,0x13,0x10,0x10,0x10,0x13, + 0x20,0x10,0x10,0xFE,0x20,0x42,0x84,0xF8,0x10,0x22,0xC4,0x08,0x10,0x28,0xC4,0x02, + /* 0xBACC [?] [2394]*/ + 0x00,0x00,0x3F,0x01,0x01,0x01,0x7F,0x03,0x05,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x10,0xF8,0x00,0x00,0x00,0x00,0xFC,0x80,0x40,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xBACD [?] [2395]*/ + 0x04,0x0E,0x78,0x08,0x08,0xFF,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08, + 0x00,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + /* 0xBACE [?] [2396]*/ + 0x08,0x08,0x0F,0x10,0x10,0x33,0x32,0x52,0x92,0x12,0x13,0x12,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0xC8,0x48,0x08,0x08,0x28,0x10, + /* 0xBACF [?] [2397]*/ + 0x01,0x01,0x02,0x04,0x08,0x30,0xCF,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xBAD0 [?] [2398]*/ + 0x01,0x02,0x0C,0x30,0xCF,0x00,0x1F,0x10,0x1F,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x80,0x60,0x18,0xE6,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xBAD1 [?] [2399]*/ + 0x10,0x20,0xD4,0x09,0x53,0x24,0xD0,0x18,0x29,0xCA,0x1D,0x29,0xC9,0x09,0x51,0x21, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBAD2 [?] [2400]*/ + 0x20,0x17,0x00,0x42,0x41,0x5F,0x42,0x44,0x4F,0x41,0x46,0x58,0x43,0x4C,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x44,0x84,0x24,0x44,0x84,0x44,0x24,0x04,0x0C, + /* 0xBAD3 [?] [2401]*/ + 0x00,0x20,0x17,0x10,0x80,0x43,0x42,0x12,0x12,0x22,0xE3,0x22,0x20,0x20,0x20,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0xC8,0x48,0x08,0x08,0x28,0x10, + /* 0xBAD4 [?] [2402]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x15,0x15,0x25,0xE5,0x25,0x25,0x24,0x27,0x04, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xF4,0x14,0x14,0x14,0xF4,0x14,0x04,0xFC,0x04, + /* 0xBAD5 [?] [2403]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFE,0x14,0x14,0x56,0x55,0x94,0x24,0x24,0x54,0x89, + 0x20,0x20,0x20,0xF8,0x20,0x20,0xFE,0x50,0x50,0xD8,0x54,0x52,0x50,0x90,0x90,0x30, + /* 0xBAD6 [?] [2404]*/ + 0x20,0x13,0x02,0xF3,0x12,0x23,0x21,0x6B,0xB4,0x2A,0x22,0x22,0x23,0x20,0x20,0x20, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xBAD7 [?] [2405]*/ + 0x08,0x08,0x7F,0x55,0x12,0x3F,0x64,0xA4,0x3F,0x24,0x24,0x3F,0x24,0x24,0x3F,0x20, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xBAD8 [?] [2406]*/ + 0x10,0x10,0x7E,0x12,0x22,0x2A,0x44,0x9F,0x10,0x11,0x11,0x11,0x12,0x04,0x18,0x60, + 0x00,0x00,0x7C,0x44,0x44,0x7C,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xBAD9 [?] [2407]*/ + 0x00,0x07,0xF4,0x95,0x94,0x94,0x97,0x90,0x97,0x90,0xF0,0x9F,0x00,0x05,0x04,0x08, + 0x00,0xFC,0x44,0x54,0xE4,0x44,0xFC,0x40,0xFC,0x40,0x40,0xFE,0x00,0x24,0x92,0x92, + /* 0xBADA [?] [2408]*/ + 0x00,0x3F,0x21,0x29,0x25,0x3F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00,0x48,0x44,0x84, + 0x00,0xF8,0x08,0x28,0x48,0xF8,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x88,0x44,0x44, + /* 0xBADB [?] [2409]*/ + 0x00,0x00,0x1F,0x10,0x97,0x54,0x57,0x14,0x37,0x54,0x94,0x14,0x24,0x25,0x46,0x84, + 0x80,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x84,0x88,0x50,0x20,0x18,0x06,0x00, + /* 0xBADC [?] [2410]*/ + 0x08,0x0B,0x12,0x22,0x4B,0x0A,0x12,0x33,0x52,0x92,0x12,0x12,0x12,0x12,0x13,0x12, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xBADD [?] [2411]*/ + 0x00,0x45,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x51,0x21, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xBADE [?] [2412]*/ + 0x10,0x13,0x12,0x12,0x1B,0x56,0x52,0x53,0x92,0x12,0x12,0x12,0x12,0x12,0x13,0x12, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xBADF [?] [2413]*/ + 0x00,0x00,0x7B,0x48,0x49,0x49,0x49,0x49,0x48,0x4B,0x78,0x48,0x00,0x00,0x00,0x00, + 0x40,0x20,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x08,0x30,0x20,0x20,0xA0,0x40, + /* 0xBAE0 [?] [2414]*/ + 0x02,0x01,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x00,0x01,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x00,0xF0,0x60,0x80,0x00,0x00,0x00,0x00, + /* 0xBAE1 [?] [2415]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x11,0x12, + 0x88,0x88,0xFC,0x88,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0x88,0x04,0x02, + /* 0xBAE2 [?] [2416]*/ + 0x12,0x13,0x24,0x48,0x87,0x15,0x25,0x67,0xA5,0x25,0x27,0x21,0x2F,0x21,0x22,0x24, + 0x00,0xC0,0x4E,0x80,0xC0,0x40,0x5E,0xC4,0x44,0x44,0xC4,0x04,0xE4,0x04,0x94,0x48, + /* 0xBAE3 [?] [2417]*/ + 0x10,0x13,0x10,0x10,0x19,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x10,0x10,0x13,0x10, + 0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xBAE4 [?] [2418]*/ + 0x02,0x02,0x7F,0x08,0x11,0x3F,0x01,0xFF,0x01,0x01,0x3E,0x02,0x14,0x08,0x34,0xC2, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0xFE,0x00,0x00,0xF8,0x88,0x50,0x20,0x58,0x86, + /* 0xBAE5 [?] [2419]*/ + 0x01,0x01,0x79,0x49,0x4B,0x49,0x49,0x49,0x49,0x4F,0x78,0x49,0x01,0x02,0x04,0x08, + 0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0x10,0x10,0xFE,0x00,0x10,0x08,0x08,0x04,0x04, + /* 0xBAE6 [?] [2420]*/ + 0x10,0x10,0x10,0x10,0x55,0x58,0x50,0x90,0x10,0x13,0x10,0x28,0x24,0x45,0x42,0x84, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xFE,0x00,0x88,0x84,0x04,0x02,0x02, + /* 0xBAE7 [?] [2421]*/ + 0x10,0x10,0x11,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x43,0x00, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBAE8 [?] [2422]*/ + 0x00,0x80,0x40,0x1F,0x84,0x44,0x44,0x04,0x24,0x44,0xC4,0x47,0x5C,0x48,0x40,0x00, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xBAE9 [?] [2423]*/ + 0x01,0x21,0x11,0x11,0x87,0x41,0x41,0x11,0x11,0x2F,0xE0,0x21,0x21,0x22,0x24,0x08, + 0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0x10,0x10,0xFE,0x00,0x10,0x08,0x08,0x04,0x04, + /* 0xBAEA [?] [2424]*/ + 0x02,0x01,0x7F,0x40,0x82,0x02,0x7F,0x04,0x04,0x08,0x09,0x11,0x22,0x44,0x8F,0x04, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xFC,0x00,0x80,0x80,0x00,0x00,0x20,0x10,0xF8,0x08, + /* 0xBAEB [?] [2425]*/ + 0x00,0x7C,0x04,0x04,0x04,0x7C,0x40,0x40,0x40,0x7C,0x04,0x05,0x07,0x05,0x28,0x10, + 0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x80,0x88,0x84,0x04,0xFE,0x02,0x02,0x00, + /* 0xBAEC [?] [2426]*/ + 0x10,0x10,0x21,0x24,0x44,0xF8,0x10,0x20,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x43,0x00, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBAED [?] [2427]*/ + 0x01,0x01,0x71,0x52,0x52,0x56,0x5A,0x52,0x52,0x52,0x72,0x52,0x02,0x02,0x02,0x02, + 0x00,0x78,0x08,0x08,0xFE,0x40,0x40,0x7C,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xBAEE [?] [2428]*/ + 0x08,0x0B,0x08,0x10,0x17,0x31,0x31,0x53,0x94,0x10,0x1F,0x10,0x10,0x11,0x12,0x1C, + 0x00,0xF8,0x08,0x08,0xFE,0x00,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xBAEF [?] [2429]*/ + 0x01,0x89,0x51,0x22,0x52,0x96,0x1A,0x12,0x32,0x52,0x92,0x12,0x12,0x12,0xA2,0x42, + 0x00,0x78,0x08,0x08,0xFE,0x40,0x40,0x7C,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xBAF0 [?] [2430]*/ + 0x00,0x07,0x78,0x48,0x49,0x49,0x49,0x49,0x49,0x4F,0x79,0x49,0x01,0x01,0x05,0x02, + 0x10,0xD0,0x50,0x90,0x10,0x10,0x50,0x90,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBAF1 [?] [2431]*/ + 0x00,0x3F,0x20,0x27,0x24,0x27,0x24,0x27,0x20,0x27,0x20,0x20,0x2F,0x40,0x41,0x80, + 0x00,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xF8,0x10,0x20,0xFE,0x40,0x40,0x80, + /* 0xBAF2 [?] [2432]*/ + 0x10,0x13,0x10,0x28,0x2F,0x69,0x69,0xAB,0x2C,0x28,0x2F,0x28,0x28,0x21,0x22,0x2C, + 0x00,0xF8,0x08,0x08,0xFE,0x00,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xBAF3 [?] [2433]*/ + 0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x17,0x14,0x24,0x24,0x44,0x87,0x04, + 0x10,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xBAF4 [?] [2434]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x48,0x48,0x4B,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x08,0x3C,0xE0,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xBAF5 [?] [2435]*/ + 0x00,0x00,0x3F,0x01,0x11,0x09,0x09,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x10,0xF8,0x00,0x00,0x10,0x10,0x20,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xBAF6 [?] [2436]*/ + 0x08,0x08,0x1F,0x12,0x22,0x44,0x08,0x11,0x22,0x04,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0xF8,0x48,0x48,0x88,0x88,0x08,0x28,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xBAF7 [?] [2437]*/ + 0x01,0x01,0xF9,0x27,0x21,0x21,0x21,0xFB,0x22,0x22,0x22,0x3A,0xE3,0x40,0x00,0x00, + 0x00,0x3C,0x24,0xE4,0x24,0x3C,0x24,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0x44,0x54,0x88, + /* 0xBAF8 [?] [2438]*/ + 0x01,0x01,0x7F,0x01,0x01,0x1F,0x00,0x7F,0x40,0x84,0x04,0x24,0x14,0x14,0x04,0x7F, + 0x00,0x00,0xFC,0x00,0x00,0xF0,0x00,0xFE,0x02,0x44,0x40,0x48,0x48,0x50,0x40,0xFC, + /* 0xBAF9 [?] [2439]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x7F,0x08,0x08,0x3E,0x22,0x22,0x22,0x3E,0x22,0x01, + 0x40,0x40,0xFE,0x40,0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x84,0x94,0x08, + /* 0xBAFA [?] [2440]*/ + 0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x3E,0x22,0x22,0x22,0x22,0x3E,0x22,0x01,0x02, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x84,0x84,0x14,0x08, + /* 0xBAFB [?] [2441]*/ + 0x21,0x21,0x21,0xFB,0xA9,0xA9,0xA9,0xAB,0xFA,0xA2,0x22,0x2A,0x3B,0xE8,0x40,0x00, + 0x00,0x3C,0x24,0xA4,0x24,0x3C,0x24,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0x44,0x54,0x88, + /* 0xBAFC [?] [2442]*/ + 0x00,0x88,0x53,0x22,0x52,0x92,0x12,0x12,0x32,0x52,0x92,0x12,0x12,0x14,0xA4,0x48, + 0x08,0x3C,0xD0,0x90,0x90,0x90,0x90,0x90,0x90,0x88,0x88,0xC8,0xA4,0xD4,0x92,0x00, + /* 0xBAFD [?] [2443]*/ + 0x10,0x10,0x94,0x55,0x58,0x10,0xFC,0x31,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x10, + 0x80,0x9E,0x92,0xD2,0x92,0x9E,0x92,0xD2,0x52,0x5E,0x52,0x52,0xD2,0x22,0x2A,0x44, + /* 0xBAFE [?] [2444]*/ + 0x01,0x21,0x11,0x17,0x81,0x41,0x41,0x17,0x14,0x24,0xE4,0x27,0x24,0x20,0x20,0x00, + 0x00,0x1E,0x12,0xD2,0x12,0x1E,0x12,0xD2,0x52,0x5E,0x52,0xD2,0x52,0x22,0x2A,0x44, + /* 0xBBA1 [?] [2445]*/ + 0x00,0xF8,0x0B,0x0A,0x0A,0x7A,0x42,0x42,0x42,0x7A,0x0A,0x0A,0x0A,0x0C,0x54,0x28, + 0x08,0x3C,0xD0,0x90,0x90,0x90,0x90,0x90,0x90,0x88,0x88,0xC8,0xA4,0xD4,0x92,0x00, + /* 0xBBA2 [?] [2446]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x21,0x20,0x20,0x23,0x22,0x22,0x44,0x48,0x90, + 0x00,0xF8,0x00,0xFC,0x04,0x60,0x88,0x08,0xF8,0x00,0xE0,0x20,0x20,0x24,0x24,0x1C, + /* 0xBBA3 [?] [2447]*/ + 0x00,0x00,0x78,0x48,0x4B,0x4A,0x4A,0x4B,0x4A,0x4A,0x7A,0x4A,0x04,0x04,0x09,0x12, + 0x40,0x40,0x7C,0x40,0xFC,0x44,0x70,0xC0,0x44,0x3C,0x00,0xF0,0x90,0x92,0x12,0x0E, + /* 0xBBA4 [?] [2448]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x12,0x12,0x54,0x28, + 0x40,0x20,0x20,0xFE,0x02,0x02,0x02,0xFE,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xBBA5 [?] [2449]*/ + 0x00,0x7F,0x04,0x04,0x04,0x0F,0x08,0x08,0x10,0x10,0x1F,0x00,0x00,0x00,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x20,0xE0,0x20,0x40,0x40,0xFE,0x00, + /* 0xBBA6 [?] [2450]*/ + 0x00,0x20,0x10,0x13,0x82,0x42,0x42,0x13,0x12,0x22,0xE2,0x22,0x24,0x24,0x28,0x10, + 0x80,0x40,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xBBA7 [?] [2451]*/ + 0x02,0x01,0x01,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x20,0x20,0x40, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xBBA8 [?] [2452]*/ + 0x08,0x08,0xFF,0x08,0x00,0x08,0x08,0x10,0x30,0x50,0x91,0x12,0x14,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x00,0x88,0x90,0xA0,0xC0,0x80,0x80,0x82,0x82,0x82,0x7E,0x00, + /* 0xBBA9 [?] [2453]*/ + 0x00,0x00,0x79,0x49,0x4B,0x4D,0x49,0x49,0x49,0x48,0x7B,0x48,0x00,0x00,0x00,0x00, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xBBAA [?] [2454]*/ + 0x08,0x08,0x10,0x30,0x51,0x96,0x10,0x10,0x11,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x80,0x88,0x90,0xE0,0x80,0x84,0x84,0x7C,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xBBAB [?] [2455]*/ + 0x00,0x8B,0x52,0x23,0x52,0x9F,0x18,0x13,0x32,0x53,0x92,0x13,0x12,0x12,0xA2,0x42, + 0x00,0xF8,0x08,0xC8,0x48,0xFE,0x02,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xBBAC [?] [2456]*/ + 0x00,0x23,0x12,0x13,0x82,0x4F,0x48,0x13,0x12,0x23,0xE2,0x23,0x22,0x22,0x22,0x02, + 0x00,0xF8,0x08,0xC8,0x48,0xFE,0x02,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xBBAD [?] [2457]*/ + 0x00,0xFF,0x00,0x00,0x4F,0x49,0x49,0x4F,0x49,0x49,0x49,0x4F,0x40,0x40,0x7F,0x00, + 0x00,0xFE,0x00,0x00,0xE4,0x24,0x24,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0xFC,0x04, + /* 0xBBAE [?] [2458]*/ + 0x10,0x14,0x12,0x10,0x13,0xFC,0x10,0x11,0x11,0x12,0x0C,0x08,0x14,0x22,0xC1,0x00, + 0x04,0x04,0x04,0x24,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0xA4,0x84,0x84,0x94,0x88, + /* 0xBBAF [?] [2459]*/ + 0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x50,0x91,0x12,0x14,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x84,0x88,0x90,0xA0,0xC0,0x80,0x80,0x80,0x80,0x82,0x82,0x82,0x7E,0x00, + /* 0xBBB0 [?] [2460]*/ + 0x00,0x20,0x11,0x10,0x00,0x03,0xF0,0x10,0x10,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xBBB1 [?] [2461]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x40,0xB0,0xA4,0x3C,0x22,0x22,0x1E, + /* 0xBBB2 [?] [2462]*/ + 0x08,0x08,0x13,0x22,0x4A,0x0A,0x12,0x32,0x52,0x92,0x12,0x12,0x12,0x13,0x12,0x10, + 0x00,0x00,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0x94,0xF4,0x04,0x04,0xFC,0x04,0x00, + /* 0xBBB3 [?] [2463]*/ + 0x10,0x10,0x17,0x10,0x18,0x54,0x50,0x50,0x91,0x12,0x14,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x42,0x40,0x40,0x40,0x40,0x40, + /* 0xBBB4 [?] [2464]*/ + 0x01,0x21,0x11,0x13,0x82,0x46,0x4B,0x12,0x12,0x23,0xE2,0x22,0x22,0x23,0x22,0x02, + 0x40,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00, + /* 0xBBB5 [?] [2465]*/ + 0x10,0x10,0x13,0x10,0x10,0xFC,0x10,0x10,0x10,0x10,0x1D,0xE2,0x44,0x00,0x00,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x68,0x64,0xA4,0x22,0x22,0x20,0x20,0x20,0x20, + /* 0xBBB6 [?] [2466]*/ + 0x00,0x00,0xFC,0x04,0x05,0x49,0x2A,0x14,0x10,0x28,0x24,0x45,0x81,0x02,0x04,0x08, + 0x80,0x80,0x80,0xFC,0x04,0x08,0x40,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xBBB7 [?] [2467]*/ + 0x00,0x00,0xFD,0x10,0x10,0x10,0x10,0x7C,0x10,0x11,0x12,0x10,0x1C,0xE0,0x40,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x68,0xA4,0x22,0x22,0x20,0x20,0x20,0x20,0x20, + /* 0xBBB8 [?] [2468]*/ + 0x10,0x13,0x10,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x13,0x10, + 0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xBBB9 [?] [2469]*/ + 0x00,0x23,0x10,0x10,0x00,0x00,0xF0,0x11,0x12,0x14,0x10,0x10,0x10,0x28,0x47,0x00, + 0x00,0xFC,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x44,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xBBBA [?] [2470]*/ + 0x10,0x17,0x22,0x21,0x48,0xFB,0x10,0x20,0x47,0xF9,0x41,0x02,0x1A,0xE4,0x48,0x03, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xBBBB [?] [2471]*/ + 0x10,0x10,0x10,0x11,0xFA,0x15,0x11,0x19,0x31,0xD1,0x17,0x10,0x10,0x10,0x51,0x26, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0x24,0xFE,0x50,0x50,0x88,0x04,0x02, + /* 0xBBBC [?] [2472]*/ + 0x01,0x1F,0x11,0x11,0x1F,0x01,0x3F,0x21,0x21,0x3F,0x01,0x02,0x51,0x51,0x90,0x0F, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0x04,0x12,0x12,0xF0, + /* 0xBBBD [?] [2473]*/ + 0x01,0x01,0xF1,0x92,0x94,0x9B,0x92,0x92,0x92,0x92,0xF7,0x90,0x00,0x01,0x02,0x0C, + 0x00,0x00,0xF0,0x10,0x20,0xF8,0x48,0x48,0x48,0x48,0xFE,0xA0,0xA0,0x10,0x08,0x06, + /* 0xBBBE [?] [2474]*/ + 0x00,0x00,0x1F,0x11,0x91,0x52,0x54,0x1B,0x32,0x52,0x92,0x1F,0x20,0x21,0x42,0x8C, + 0x80,0x40,0xFE,0x00,0xF0,0x10,0x20,0xF8,0x48,0x48,0x48,0xFE,0xA0,0x10,0x08,0x06, + /* 0xBBBF [?] [2475]*/ + 0x11,0x09,0x7F,0x04,0xFF,0x10,0x2F,0xC6,0x19,0x62,0x0C,0x71,0x06,0x18,0xE2,0x01, + 0x10,0x20,0xFC,0x00,0xFE,0x10,0xC8,0x06,0x10,0xA0,0xC0,0xB0,0x88,0x84,0x80,0x00, + /* 0xBBC0 [?] [2476]*/ + 0x10,0x10,0x10,0x15,0x5A,0x55,0x51,0x91,0x11,0x11,0x13,0x28,0x24,0x44,0x41,0x86, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0x24,0xFE,0x50,0x50,0x88,0x04,0x02, + /* 0xBBC1 [?] [2477]*/ + 0x01,0x21,0x11,0x12,0x84,0x4B,0x42,0x12,0x12,0x22,0xEF,0x20,0x20,0x21,0x22,0x0C, + 0x00,0x00,0xF0,0x10,0x20,0xF8,0x48,0x48,0x48,0x48,0xFE,0xA0,0xA0,0x10,0x08,0x06, + /* 0xBBC2 [?] [2478]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3F,0x21,0x21,0x3F,0x20,0x20,0x20,0x3F,0x21,0x21,0x3F, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xFC, + /* 0xBBC3 [?] [2479]*/ + 0x08,0x08,0x11,0x10,0x22,0x42,0xFC,0x04,0x08,0x10,0x24,0x42,0xFE,0x42,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xBBC4 [?] [2480]*/ + 0x08,0x08,0xFF,0x0A,0x01,0xFF,0x10,0x10,0x1F,0x00,0x11,0x11,0x11,0x21,0x41,0x81, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x00,0x00,0xF8,0x00,0x10,0x10,0x10,0x12,0x12,0x0E, + /* 0xBBC5 [?] [2481]*/ + 0x21,0x21,0x27,0x21,0x30,0xAF,0xA2,0xA2,0xA3,0x20,0x22,0x22,0x22,0x24,0x24,0x28, + 0x08,0x08,0xFE,0x48,0x20,0xFE,0x00,0x00,0xFC,0x00,0x48,0x48,0x48,0x4A,0x4A,0x46, + /* 0xBBC6 [?] [2482]*/ + 0x04,0x3F,0x04,0x04,0xFF,0x01,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x04,0x08,0x10, + 0x40,0xF8,0x40,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x40,0x20,0x10, + /* 0xBBC7 [?] [2483]*/ + 0x00,0x00,0xFD,0x10,0x10,0x23,0x3C,0x65,0x65,0xA5,0x25,0x25,0x3C,0x24,0x21,0x02, + 0x88,0x88,0xFC,0x88,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0x88,0x04,0x02, + /* 0xBBC8 [?] [2484]*/ + 0x20,0x20,0x21,0xF9,0xA9,0xA9,0xA9,0xA8,0xFB,0xA0,0x20,0x29,0x38,0xE8,0x43,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xBBC9 [?] [2485]*/ + 0x20,0x3E,0x48,0x84,0x3F,0x04,0xFF,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x08,0x10,0x20, + 0x40,0x7E,0x90,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x10,0x08, + /* 0xBBCA [?] [2486]*/ + 0x02,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xBBCB [?] [2487]*/ + 0x00,0x3F,0x22,0x27,0x24,0x27,0x24,0x27,0x20,0x2F,0x21,0x27,0x21,0x4F,0x40,0x80, + 0x00,0xF8,0x08,0xC8,0x48,0xC8,0x48,0xC8,0x08,0xE8,0x08,0xCA,0x0A,0xEA,0x06,0x02, + /* 0xBBCC [?] [2488]*/ + 0x10,0x10,0x11,0x11,0x19,0x55,0x51,0x50,0x93,0x10,0x10,0x11,0x10,0x10,0x13,0x10, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xBBCD [?] [2489]*/ + 0x10,0x10,0x11,0x15,0x59,0x51,0x51,0x90,0x13,0x10,0x10,0x29,0x24,0x40,0x43,0x80, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xBBCE [?] [2490]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0x11,0x09,0x01,0xFF,0x04,0x04,0x08,0x10,0x60, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x10,0x20,0x00,0xFE,0x40,0x40,0x42,0x42,0x3E, + /* 0xBBCF [?] [2491]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x54,0x55,0x54,0x54,0x57,0x5C,0x10,0x11,0x12,0x14, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x24,0xA8,0x20,0xFE,0x90,0x90,0x12,0x12,0x0E, + /* 0xBBD0 [?] [2492]*/ + 0x10,0x10,0x12,0x19,0x55,0x50,0x57,0x90,0x10,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x40,0x44,0x44,0x48,0x50,0x40,0xFE,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xBBD1 [?] [2493]*/ + 0x01,0x41,0x27,0x21,0x00,0x07,0xE2,0x22,0x23,0x20,0x22,0x22,0x2A,0x34,0x24,0x08, + 0x08,0x08,0xFE,0x48,0x20,0xFE,0x00,0x00,0xFC,0x00,0x48,0x48,0x48,0x4A,0x4A,0x46, + /* 0xBBD2 [?] [2494]*/ + 0x04,0x04,0x04,0xFF,0x08,0x08,0x08,0x12,0x12,0x24,0x29,0x41,0x82,0x04,0x18,0x60, + 0x00,0x00,0x00,0xFE,0x00,0x80,0x84,0x84,0x88,0x90,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xBBD3 [?] [2495]*/ + 0x10,0x13,0x12,0x14,0xFC,0x13,0x10,0x14,0x19,0x31,0xD0,0x10,0x17,0x10,0x50,0x20, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xBBD4 [?] [2496]*/ + 0x10,0x13,0x92,0x54,0x58,0x13,0xFC,0x28,0x29,0x29,0x28,0x28,0x2B,0x4C,0x48,0x80, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xBBD5 [?] [2497]*/ + 0x12,0x1A,0x2A,0x4F,0x80,0x1F,0x24,0x68,0xAF,0x22,0x24,0x3F,0x22,0x2A,0x32,0x26, + 0x10,0x90,0x90,0xA0,0x3E,0xC4,0x24,0xA4,0x24,0x28,0xA8,0xD0,0x28,0xA8,0x44,0x82, + /* 0xBBD6 [?] [2498]*/ + 0x10,0x10,0x10,0x13,0x18,0x54,0x50,0x51,0x91,0x11,0x12,0x12,0x14,0x10,0x10,0x11, + 0x40,0x40,0x40,0xFE,0x80,0x90,0x90,0x12,0x52,0x54,0x90,0x28,0x28,0x44,0x84,0x02, + /* 0xBBD7 [?] [2499]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x00, + 0x00,0x00,0xFE,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x4A,0x7A,0x02,0x02,0xFE,0x02,0x00, + /* 0xBBD8 [?] [2500]*/ + 0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x20,0x3F,0x20,0x00, + 0x00,0xF8,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0x48,0xC8,0x08,0x08,0xF8,0x08,0x00, + /* 0xBBD9 [?] [2501]*/ + 0x20,0xCE,0x82,0x82,0xEE,0x82,0x82,0xFE,0x00,0x00,0xFE,0x10,0x10,0x1E,0xF0,0x41, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xBBDA [?] [2502]*/ + 0x11,0x11,0x11,0x1A,0x55,0x51,0x51,0x91,0x17,0x11,0x12,0x12,0x13,0x10,0x10,0x10, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xBBDB [?] [2503]*/ + 0x10,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x3F,0x00,0x1F,0x00,0x3F,0x01,0x48,0x48,0x87, + 0x10,0xFE,0x10,0x7C,0x10,0xFE,0x10,0xF8,0x08,0xF8,0x08,0xF8,0x00,0x84,0x12,0xF2, + /* 0xBBDC [?] [2504]*/ + 0x01,0x01,0x01,0x7F,0x01,0x01,0x09,0x08,0x08,0xFF,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBBDD [?] [2505]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x01,0xFF,0x01,0x28,0x28,0x48,0x07, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x04,0xFE,0x02,0x88,0xA4,0x24,0xE0, + /* 0xBBDE [?] [2506]*/ + 0x01,0x01,0x79,0x4A,0x4D,0x49,0x49,0x79,0x4F,0x49,0x4A,0x4A,0x7B,0x48,0x00,0x00, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xBBDF [?] [2507]*/ + 0x00,0x7C,0x45,0x54,0x54,0x54,0x54,0x55,0x56,0x54,0x54,0x10,0x28,0x24,0x44,0x80, + 0x20,0x20,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x94,0x88, + /* 0xBBE0 [?] [2508]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFC,0x10,0x38,0x35,0x52,0x50,0x90,0x10,0x10,0x10,0x13, + 0x20,0x24,0x24,0x24,0xFC,0x40,0x40,0xFC,0x04,0x84,0x48,0x50,0x20,0x40,0x80,0x00, + /* 0xBBE1 [?] [2509]*/ + 0x01,0x01,0x02,0x04,0x08,0x30,0xCF,0x00,0x00,0x7F,0x02,0x04,0x08,0x10,0x3F,0x10, + 0x00,0x00,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xFC,0x00,0x00,0x20,0x10,0xF8,0x08, + /* 0xBBE2 [?] [2510]*/ + 0x10,0x10,0x10,0x14,0x59,0x52,0x50,0x90,0x10,0x13,0x10,0x28,0x24,0x41,0x43,0x81, + 0x20,0x20,0x50,0x88,0x04,0x02,0xF8,0x00,0x00,0xFE,0x20,0x40,0x88,0x04,0xFE,0x02, + /* 0xBBE3 [?] [2511]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x22,0x22,0x23,0x00, + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xBBE4 [?] [2512]*/ + 0x00,0x20,0x10,0x17,0x00,0x00,0xF3,0x10,0x10,0x17,0x10,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x40,0x40,0xFE,0x42,0x42,0x4A,0x44,0x40,0x40, + /* 0xBBE5 [?] [2513]*/ + 0x01,0x21,0x11,0x12,0x05,0x01,0xF1,0x11,0x17,0x11,0x12,0x12,0x17,0x18,0x10,0x00, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xBBE6 [?] [2514]*/ + 0x10,0x10,0x20,0x21,0x4A,0xF4,0x11,0x20,0x40,0xFB,0x40,0x00,0x19,0xE2,0x47,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xBBE7 [?] [2515]*/ + 0x08,0xFF,0x08,0x00,0x7F,0x42,0x82,0x3F,0x09,0x11,0x1F,0x01,0x01,0xFF,0x01,0x01, + 0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF8,0x00,0x00,0xF0,0x00,0x00,0xFE,0x00,0x00, + /* 0xBBE8 [?] [2516]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x28,0x30,0x20,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F, + 0x78,0x80,0x80,0x80,0xFC,0x40,0x22,0x1A,0x06,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0, + /* 0xBBE9 [?] [2517]*/ + 0x20,0x23,0x22,0x23,0xFA,0x4A,0x4B,0x4A,0x49,0x91,0x51,0x21,0x31,0x49,0x49,0x81, + 0x1C,0xE0,0x20,0xFE,0x20,0x92,0x0A,0x06,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xBBEA [?] [2518]*/ + 0x00,0x00,0x7D,0x01,0x01,0x01,0xFF,0x21,0x21,0x20,0x48,0x44,0xFC,0x45,0x01,0x02, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x40,0x68,0xB2,0xBE,0x20,0x22,0x1E, + /* 0xBBEB [?] [2519]*/ + 0x00,0x23,0x12,0x14,0x80,0x43,0x48,0x08,0x11,0x11,0xE0,0x20,0x27,0x20,0x20,0x00, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xBBEC [?] [2520]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x17,0x10,0x24,0xE4,0x27,0x24,0x24,0x25,0x06, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x20,0x22,0xAC,0x30,0x22,0xA2,0x1E, + /* 0xBBED [?] [2521]*/ + 0x20,0x10,0xFE,0x82,0x11,0x7C,0x10,0x7C,0x11,0xFE,0x10,0x7C,0x44,0x44,0x7C,0x44, + 0x00,0x50,0x48,0x84,0x24,0x20,0x50,0x88,0x04,0xFA,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xBBEE [?] [2522]*/ + 0x00,0x20,0x13,0x10,0x80,0x47,0x40,0x10,0x10,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x10,0x78,0xC0,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xBBEF [?] [2523]*/ + 0x08,0x08,0x08,0x10,0x12,0x32,0x32,0x54,0x90,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x40,0x40,0x40,0x40,0x44,0x44,0x48,0x50,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xBBF0 [?] [2524]*/ + 0x01,0x01,0x01,0x11,0x11,0x11,0x21,0x21,0x42,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0x08,0x08,0x10,0x20,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xBBF1 [?] [2525]*/ + 0x08,0x08,0xFF,0x08,0x44,0x28,0x10,0x28,0x4F,0x98,0x28,0x48,0x89,0x09,0x52,0x24, + 0x20,0x20,0xFE,0x20,0x40,0x50,0x48,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x06, + /* 0xBBF2 [?] [2526]*/ + 0x00,0x00,0x00,0xFF,0x00,0x00,0x3E,0x22,0x22,0x22,0x3E,0x00,0x07,0x78,0x20,0x03, + 0x48,0x44,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xBBF3 [?] [2527]*/ + 0x00,0x00,0xFF,0x00,0x3E,0x22,0x3E,0x00,0x0E,0x70,0x03,0x01,0x28,0x28,0x48,0x07, + 0x50,0x48,0xFE,0x40,0x40,0x24,0x28,0x12,0x2A,0xC6,0x02,0x00,0x88,0xA4,0x24,0xE0, + /* 0xBBF4 [?] [2528]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x10, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00, + /* 0xBBF5 [?] [2529]*/ + 0x08,0x08,0x10,0x30,0x57,0x90,0x10,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x80,0x80,0x98,0xE0,0x84,0x84,0x7C,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xBBF6 [?] [2530]*/ + 0x20,0x11,0x11,0xF9,0x09,0x11,0x18,0x34,0x53,0x92,0x12,0x12,0x13,0x12,0x12,0x12, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xBBF7 [?] [2531]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x21,0x21,0x21,0x21,0x3F,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xBBF8 [?] [2532]*/ + 0x10,0x17,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x12,0x1E,0xE2,0x44,0x04,0x08,0x03, + 0x00,0xF8,0x08,0x10,0x10,0x20,0x3C,0x04,0x04,0x88,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBBF9 [?] [2533]*/ + 0x08,0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x08,0x11,0x21,0xCF,0x01,0x01,0x3F, + 0x20,0x20,0xFC,0x20,0xE0,0x20,0xE0,0x20,0xFE,0x20,0x10,0x08,0xE6,0x00,0x00,0xF8, + /* 0xBBFA [?] [2534]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBBFB [?] [2535]*/ + 0x00,0x00,0x7D,0x54,0x54,0x55,0x57,0x7C,0x55,0x55,0x55,0x55,0x7D,0x44,0x00,0x00, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFE,0x08,0xE8,0x28,0x28,0xE8,0x28,0x08,0x28,0x10, + /* 0xBBFC [?] [2536]*/ + 0x08,0x1C,0xF3,0x10,0x11,0xFE,0x11,0x31,0x39,0x54,0x54,0x91,0x11,0x11,0x11,0x11, + 0x50,0x48,0xFC,0xA0,0x22,0x1E,0x10,0xE0,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC, + /* 0xBBFD [?] [2537]*/ + 0x04,0x0E,0x78,0x08,0x08,0xFF,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x09, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84,0x00,0x48,0x44,0x84,0x82,0x02, + /* 0xBBFE [?] [2538]*/ + 0x20,0x3F,0x48,0x85,0x08,0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x08,0x10,0x20, + 0x40,0x7E,0x90,0x08,0x20,0x20,0xFC,0x20,0xE0,0x20,0xE0,0x20,0xFE,0x20,0x10,0x08, + /* 0xBCA1 [?] [2539]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x45,0x55,0x8A, + 0x00,0xF0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xBCA2 [?] [2540]*/ + 0x20,0x21,0x21,0x3D,0x45,0x49,0xA1,0x21,0x21,0x21,0x21,0x21,0x29,0x32,0x22,0x04, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBCA3 [?] [2541]*/ + 0x00,0x20,0x10,0x17,0x00,0x00,0xF2,0x12,0x14,0x11,0x11,0x12,0x14,0x28,0x47,0x00, + 0x40,0x20,0x20,0xFE,0x90,0x90,0x94,0x92,0x92,0x10,0x10,0x50,0x20,0x00,0xFE,0x00, + /* 0xBCA4 [?] [2542]*/ + 0x02,0x44,0x2F,0x28,0x0F,0x88,0x4F,0x54,0x12,0x2F,0xE4,0x27,0x24,0x28,0x2A,0x11, + 0x10,0x10,0x90,0x90,0xBE,0xA4,0xD4,0x14,0x14,0xD4,0x14,0x88,0x88,0x94,0x94,0x22, + /* 0xBCA5 [?] [2543]*/ + 0x00,0x21,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x12,0x02,0x04, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBCA6 [?] [2544]*/ + 0x00,0x00,0x00,0xFC,0x04,0x04,0x48,0x28,0x10,0x10,0x28,0x24,0x45,0x80,0x00,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xBCA7 [?] [2545]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x00, + 0x00,0xFE,0x10,0x10,0x10,0x7C,0x44,0x44,0x44,0x44,0x7C,0x10,0x10,0x10,0xFE,0x00, + /* 0xBCA8 [?] [2546]*/ + 0x10,0x10,0x27,0x20,0x4B,0xF0,0x17,0x20,0x43,0xFA,0x42,0x02,0x1A,0xE0,0x41,0x06, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0x48,0xA0,0x10,0x08, + /* 0xBCA9 [?] [2547]*/ + 0x10,0x11,0x21,0x21,0x49,0xF0,0x17,0x21,0x41,0xF9,0x41,0x01,0x19,0xE7,0x40,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x3E,0xC8,0x08,0x08, + /* 0xBCAA [?] [2548]*/ + 0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x3F,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xBCAB [?] [2549]*/ + 0x10,0x13,0x10,0x10,0xFC,0x10,0x30,0x38,0x55,0x55,0x91,0x11,0x12,0x12,0x14,0x11, + 0x00,0xFC,0x84,0x88,0x88,0x90,0x9C,0x84,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xBCAC [?] [2550]*/ + 0x10,0x10,0xFD,0x10,0x10,0x7C,0x54,0x54,0x54,0x5C,0x10,0x38,0x54,0x95,0x10,0x10, + 0x20,0x20,0xFC,0x20,0x20,0xF8,0xA8,0xA8,0xA8,0xB8,0x20,0x70,0xA8,0x26,0x20,0x20, + /* 0xBCAD [?] [2551]*/ + 0x20,0x21,0x21,0xFD,0x41,0x50,0x97,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x17,0x10,0x10, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x3E,0xC8,0x08,0x08, + /* 0xBCAE [?] [2552]*/ + 0x20,0x3F,0x48,0x85,0x10,0x7C,0x10,0x7C,0x11,0xFE,0x10,0x38,0x54,0x94,0x10,0x10, + 0x40,0x7E,0x90,0x08,0x48,0xFC,0x48,0x48,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xBCAF [?] [2553]*/ + 0x09,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x11,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xBCB0 [?] [2554]*/ + 0x00,0x3F,0x08,0x08,0x08,0x08,0x0C,0x0A,0x0A,0x09,0x11,0x10,0x20,0x20,0x43,0x8C, + 0x00,0xE0,0x20,0x20,0x40,0x40,0xF8,0x08,0x08,0x10,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xBCB1 [?] [2555]*/ + 0x08,0x0F,0x10,0x20,0x5F,0x00,0x00,0x1F,0x00,0x00,0x3F,0x02,0x51,0x51,0x90,0x0F, + 0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x04,0x12,0x12,0xF0, + /* 0xBCB2 [?] [2556]*/ + 0x00,0x00,0x1F,0x12,0x92,0x53,0x52,0x14,0x30,0x5F,0x90,0x10,0x20,0x21,0x42,0x8C, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x06, + /* 0xBCB3 [?] [2557]*/ + 0x00,0x27,0x11,0x11,0x81,0x41,0x49,0x09,0x11,0x12,0xE2,0x22,0x24,0x24,0x28,0x03, + 0x00,0xF8,0x08,0x10,0x10,0x20,0x3C,0x04,0x04,0x88,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBCB4 [?] [2558]*/ + 0x00,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x40,0x48,0x44,0x4A,0x52,0x60,0x00,0x00, + 0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x40,0x40,0x40,0x40, + /* 0xBCB5 [?] [2559]*/ + 0x20,0x20,0x21,0x21,0xF9,0x4D,0x4B,0x49,0x89,0x4B,0x35,0x11,0x29,0x4A,0x82,0x04, + 0x20,0x10,0xFE,0x00,0x20,0x20,0x3C,0x50,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xBCB6 [?] [2560]*/ + 0x10,0x13,0x20,0x20,0x48,0xF8,0x10,0x20,0x41,0xF9,0x41,0x01,0x1A,0xE2,0x44,0x01, + 0x00,0xFC,0x84,0x88,0x88,0x90,0x9C,0x84,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xBCB7 [?] [2561]*/ + 0x10,0x10,0x17,0x12,0xFD,0x10,0x14,0x19,0x36,0xD1,0x11,0x11,0x11,0x12,0x52,0x24, + 0x80,0x40,0xFE,0x08,0x10,0xA0,0x40,0xB0,0x0E,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xBCB8 [?] [2562]*/ + 0x00,0x0F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xBCB9 [?] [2563]*/ + 0x21,0x11,0x09,0x12,0x24,0x08,0x3F,0xC8,0x08,0x0F,0x08,0x08,0x0F,0x08,0x08,0x08, + 0x08,0x10,0x20,0x90,0x48,0x20,0xF8,0x26,0x20,0xE0,0x20,0x20,0xE0,0x20,0xA0,0x40, + /* 0xBCBA [?] [2564]*/ + 0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xBCBB [?] [2565]*/ + 0x04,0x04,0xFF,0x04,0x10,0x1F,0x22,0x7F,0xA4,0x3F,0x24,0x3F,0x00,0x07,0x78,0x20, + 0x40,0x40,0xFE,0x40,0x04,0x04,0x24,0xA4,0xA4,0xA4,0xA4,0xA4,0x04,0x84,0x14,0x08, + /* 0xBCBC [?] [2566]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x15,0x18,0x30,0xD0,0x10,0x10,0x10,0x51,0x26, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xBCBD [?] [2567]*/ + 0x04,0x7C,0x04,0x1C,0xE4,0x3F,0x21,0x3F,0x21,0x3F,0x04,0x3F,0x04,0xFF,0x10,0x20, + 0x44,0x78,0x42,0x3E,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xF8,0x40,0xFE,0x10,0x08, + /* 0xBCBE [?] [2568]*/ + 0x00,0x1F,0x01,0x01,0x7F,0x05,0x09,0x31,0xCF,0x00,0x00,0xFF,0x01,0x01,0x05,0x02, + 0x70,0x80,0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x40,0x80,0xFE,0x00,0x00,0x00,0x00, + /* 0xBCBF [?] [2569]*/ + 0x08,0x08,0x08,0x17,0x10,0x30,0x30,0x57,0x92,0x12,0x11,0x10,0x10,0x10,0x11,0x16, + 0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x08,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xBCC0 [?] [2570]*/ + 0x10,0x10,0x3E,0x62,0x94,0x48,0x30,0x27,0xC0,0x00,0x1F,0x01,0x09,0x11,0x25,0x02, + 0x80,0x80,0xFC,0x44,0x48,0x30,0x10,0xC8,0x06,0x00,0xF0,0x00,0x20,0x10,0x08,0x00, + /* 0xBCC1 [?] [2571]*/ + 0x10,0x08,0xFF,0x02,0x64,0x18,0x26,0xC1,0x22,0x22,0x22,0x22,0x22,0x42,0x42,0x82, + 0x04,0x04,0x84,0x24,0x24,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xBCC2 [?] [2572]*/ + 0x20,0x23,0x20,0x27,0x30,0xA9,0xA2,0xAC,0xA3,0x20,0x20,0x27,0x20,0x20,0x21,0x20, + 0x38,0xC0,0x40,0xFC,0xE0,0x50,0x48,0x46,0xF0,0x20,0x40,0xFC,0x40,0x40,0x40,0x80, + /* 0xBCC3 [?] [2573]*/ + 0x00,0x20,0x17,0x12,0x81,0x40,0x40,0x11,0x16,0x21,0xE1,0x21,0x21,0x22,0x22,0x04, + 0x80,0x40,0xFE,0x08,0x10,0xA0,0x40,0xB0,0x0E,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xBCC4 [?] [2574]*/ + 0x02,0x01,0x7F,0x42,0x82,0x3F,0x04,0x08,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x80,0x40,0xFE,0x10,0x90,0x90,0x90,0x90,0x50,0x20, + /* 0xBCC5 [?] [2575]*/ + 0x02,0x01,0x7F,0x40,0x88,0x0F,0x08,0x08,0xFF,0x00,0x08,0x2A,0x49,0x89,0x28,0x10, + 0x00,0x00,0xFE,0x02,0x04,0x7C,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xBCC6 [?] [2576]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF7,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xBCC7 [?] [2577]*/ + 0x00,0x20,0x11,0x10,0x00,0x00,0xF0,0x11,0x11,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xBCC8 [?] [2578]*/ + 0x00,0x7D,0x44,0x44,0x7D,0x45,0x45,0x7C,0x40,0x48,0x44,0x4A,0x52,0x60,0x41,0x02, + 0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x30,0x50,0x50,0x92,0x92,0x0E,0x00, + /* 0xBCC9 [?] [2579]*/ + 0x00,0x3F,0x00,0x00,0x3F,0x20,0x20,0x20,0x1F,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0x04,0x04,0xFC,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xBCCA [?] [2580]*/ + 0x00,0x79,0x48,0x50,0x50,0x63,0x50,0x48,0x49,0x49,0x6A,0x52,0x44,0x40,0x40,0x40, + 0x00,0xFC,0x00,0x00,0x00,0xFE,0x20,0x20,0x28,0x24,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xBCCB [?] [2581]*/ + 0x10,0x10,0x10,0x13,0xFC,0x24,0x24,0x25,0x24,0x48,0x28,0x10,0x28,0x44,0x81,0x06, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xBCCC [?] [2582]*/ + 0x10,0x12,0x22,0x23,0x4A,0xF2,0x13,0x22,0x42,0xFA,0x43,0x02,0x1A,0xE2,0x43,0x00, + 0x20,0x20,0x20,0x24,0xA8,0x20,0xFC,0x20,0x70,0xA8,0x24,0x20,0x20,0x20,0xFE,0x00, + /* 0xBCCD [?] [2583]*/ + 0x10,0x10,0x23,0x20,0x48,0xF0,0x10,0x23,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x41,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xBCCE [?] [2584]*/ + 0x01,0xFF,0x01,0x3F,0x00,0x1F,0x10,0x1F,0x08,0xFF,0x10,0x7F,0x11,0x21,0x45,0x82, + 0x00,0xFE,0x00,0xF8,0x00,0xF0,0x10,0xF0,0x20,0xFE,0x00,0x7C,0x44,0x44,0x7C,0x44, + /* 0xBCCF [?] [2585]*/ + 0x22,0x22,0x22,0xFA,0x27,0x22,0x72,0x6A,0xAA,0xA2,0x22,0x22,0x24,0x24,0x29,0x30, + 0x00,0x00,0x00,0x1E,0xD2,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x5E,0x52,0x80, + /* 0xBCD0 [?] [2586]*/ + 0x01,0x01,0x01,0x7F,0x01,0x11,0x09,0x01,0xFF,0x01,0x02,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xFC,0x00,0x10,0x20,0x00,0xFE,0x00,0x80,0x80,0x40,0x20,0x18,0x06, + /* 0xBCD1 [?] [2587]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x3F,0x50,0x90,0x10,0x13,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xBCD2 [?] [2588]*/ + 0x02,0x01,0x7F,0x40,0x80,0x7F,0x02,0x0D,0x71,0x02,0x0C,0x71,0x06,0x18,0xE2,0x01, + 0x00,0x00,0xFE,0x02,0x04,0xFC,0x00,0x08,0x90,0xA0,0xC0,0xA0,0x98,0x86,0x80,0x00, + /* 0xBCD3 [?] [2589]*/ + 0x10,0x10,0x10,0x10,0xFE,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x22,0x22,0x4A,0x84, + 0x00,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00, + /* 0xBCD4 [?] [2590]*/ + 0x08,0x08,0xFF,0x08,0x01,0x01,0x3F,0x01,0x11,0x09,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xF8,0x00,0x10,0x20,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xBCD5 [?] [2591]*/ + 0x08,0x08,0x08,0x7E,0x08,0x4A,0x2A,0x2C,0x08,0xFE,0x08,0x14,0x12,0x22,0x40,0x83, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xBCD6 [?] [2592]*/ + 0x00,0x7F,0x04,0x3F,0x24,0x24,0x3F,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0xFC,0x40,0xF8,0x48,0x48,0xF8,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xBCD7 [?] [2593]*/ + 0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x01,0x01,0x01, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00, + /* 0xBCD8 [?] [2594]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x10,0x14,0x18,0x10,0x00, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xBCD9 [?] [2595]*/ + 0x10,0x17,0x14,0x24,0x24,0x67,0x64,0xA4,0x27,0x24,0x24,0x27,0x24,0x24,0x24,0x24, + 0x00,0xBC,0x84,0x84,0x84,0xBC,0x00,0x00,0xBC,0x24,0x24,0xA8,0x10,0x28,0x44,0x82, + /* 0xBCDA [?] [2596]*/ + 0x08,0x1C,0xF3,0x12,0x10,0xFD,0x10,0x30,0x3B,0x54,0x50,0x93,0x10,0x10,0x13,0x10, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x40,0xA2,0x34,0x58,0x94,0x34,0x52,0x90,0x50,0x20, + /* 0xBCDB [?] [2597]*/ + 0x08,0x08,0x08,0x10,0x11,0x32,0x34,0x51,0x91,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xBCDC [?] [2598]*/ + 0x08,0x08,0x7F,0x09,0x11,0x11,0x25,0x42,0x01,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xBCDD [?] [2599]*/ + 0x08,0x08,0x7F,0x11,0x11,0x25,0x42,0x1F,0x00,0x08,0x08,0x0F,0x00,0x7F,0x00,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x7C,0x00,0xE0,0x20,0x20,0x20,0xFC,0x04,0xC4,0x14,0x08, + /* 0xBCDE [?] [2600]*/ + 0x20,0x20,0x23,0x22,0xF8,0x49,0x48,0x48,0x4B,0x90,0x50,0x23,0x30,0x48,0x4B,0x80, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x40,0xA2,0x34,0x58,0x94,0x34,0x52,0x90,0x50,0x20, + /* 0xBCDF [?] [2601]*/ + 0x00,0x00,0xFD,0x20,0x20,0x3C,0x44,0x47,0x64,0x94,0x08,0x08,0x10,0x20,0x40,0x80, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBCE0 [?] [2602]*/ + 0x04,0x24,0x24,0x24,0x24,0x24,0x25,0x04,0x00,0x3F,0x24,0x24,0x24,0x24,0xFF,0x00, + 0x40,0x40,0x7C,0x40,0x90,0x88,0x08,0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xBCE1 [?] [2603]*/ + 0x04,0x25,0x25,0x24,0x24,0x24,0x24,0x25,0x04,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0xFC,0x04,0x88,0x50,0x20,0x58,0x86,0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xBCE2 [?] [2604]*/ + 0x01,0x01,0x09,0x09,0x11,0x21,0x40,0x01,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x20,0x10,0x08,0x04,0x04,0x00,0x00,0xFE,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xBCE3 [?] [2605]*/ + 0x20,0x3F,0x48,0x85,0x02,0x02,0x03,0x7E,0x02,0x03,0xFE,0x01,0x00,0x07,0x38,0x00, + 0x40,0x7E,0x90,0x08,0x40,0x20,0xF8,0x00,0x00,0xFC,0x10,0x20,0xC0,0x44,0x34,0x0C, + /* 0xBCE4 [?] [2606]*/ + 0x20,0x13,0x10,0x40,0x47,0x44,0x44,0x44,0x47,0x44,0x44,0x44,0x47,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xC4,0x44,0x44,0x44,0xC4,0x44,0x44,0x44,0xC4,0x04,0x14,0x08, + /* 0xBCE5 [?] [2607]*/ + 0x10,0x08,0xFF,0x00,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x2A,0x24,0x00,0x48,0x44,0x84, + 0x10,0x20,0xFE,0x00,0x48,0x48,0x48,0x48,0x08,0x08,0x28,0x10,0x00,0x88,0x44,0x44, + /* 0xBCE6 [?] [2608]*/ + 0x10,0x08,0x7F,0x04,0x04,0x3F,0x04,0xFF,0x04,0x3F,0x0C,0x14,0x24,0xC4,0x04,0x04, + 0x20,0x40,0xFC,0x80,0x80,0xF0,0x90,0xFE,0x90,0xF0,0xC0,0xA0,0x98,0x86,0x80,0x80, + /* 0xBCE7 [?] [2609]*/ + 0x01,0x00,0x1F,0x10,0x10,0x1F,0x10,0x17,0x14,0x17,0x14,0x27,0x24,0x44,0x84,0x04, + 0x00,0x80,0xF8,0x08,0x08,0xF8,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xBCE8 [?] [2610]*/ + 0x00,0x01,0xFD,0x05,0x45,0x45,0x29,0x29,0x11,0x11,0x29,0x29,0x45,0x45,0x81,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xBCE9 [?] [2611]*/ + 0x10,0x11,0x10,0x10,0xFE,0x22,0x22,0x23,0x42,0x24,0x14,0x08,0x14,0x22,0x42,0x80, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBCEA [?] [2612]*/ + 0x20,0x20,0x20,0x47,0x54,0xF4,0x25,0x24,0x44,0xF5,0x45,0x05,0x35,0xC4,0x08,0x10, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD0,0x12,0x12,0xD4,0x54,0x48,0xDA,0x2A,0x46,0x82, + /* 0xBCEB [?] [2613]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x3F,0x21,0x21,0x21,0x3F,0x01,0x01,0x01,0x7F,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x10,0xF8,0x04,0x04, + /* 0xBCEC [?] [2614]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x35,0x38,0x54,0x50,0x92,0x11,0x11,0x10,0x17,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xBCED [?] [2615]*/ + 0x01,0x01,0xFF,0x01,0x01,0x3F,0x21,0x29,0x25,0x3F,0x23,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x28,0x48,0xF8,0x88,0x40,0x20,0x18,0x06,0x00, + /* 0xBCEE [?] [2616]*/ + 0x00,0x00,0xF0,0x27,0x24,0x44,0x75,0xD4,0x54,0x55,0x55,0x55,0x75,0x54,0x08,0x10, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD0,0x12,0x12,0xD4,0x54,0x48,0xDA,0x2A,0x46,0x82, + /* 0xBCEF [?] [2617]*/ + 0x00,0x00,0xF8,0x20,0x21,0x42,0x7D,0x48,0xC8,0x48,0x4A,0x49,0x79,0x48,0x07,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xBCF0 [?] [2618]*/ + 0x10,0x10,0x17,0x10,0xFC,0x13,0x11,0x12,0x1B,0x30,0xD1,0x11,0x12,0x14,0x50,0x20, + 0x40,0x40,0xFC,0x80,0x80,0xE0,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xBCF1 [?] [2619]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x15,0x10,0x18,0x30,0xD2,0x11,0x11,0x10,0x57,0x20, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xBCF2 [?] [2620]*/ + 0x20,0x3F,0x48,0x85,0x10,0x0B,0x20,0x27,0x24,0x24,0x27,0x24,0x24,0x27,0x20,0x20, + 0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0xC8,0x48,0x48,0xC8,0x48,0x48,0xC8,0x08,0x18, + /* 0xBCF3 [?] [2621]*/ + 0x08,0x08,0x08,0x10,0x11,0x32,0x35,0x50,0x90,0x10,0x12,0x11,0x11,0x10,0x17,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xBCF4 [?] [2622]*/ + 0x08,0xFF,0x00,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x26,0x00,0x7F,0x04,0x08,0x10,0x60, + 0x20,0xFE,0x00,0x08,0x48,0x48,0x48,0x48,0x08,0x18,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xBCF5 [?] [2623]*/ + 0x00,0x40,0x20,0x27,0x04,0x04,0x15,0x14,0x24,0xE5,0x25,0x25,0x25,0x24,0x28,0x10, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD0,0x12,0x12,0xD4,0x54,0x48,0xDA,0x2A,0x46,0x82, + /* 0xBCF6 [?] [2624]*/ + 0x08,0x08,0xFF,0x0A,0x02,0x7F,0x04,0x09,0x08,0x18,0x2B,0x48,0x88,0x08,0x08,0x08, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xBCF7 [?] [2625]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x38,0x54,0x55,0x91,0x11,0x11,0x11,0x17,0x10, + 0x48,0x48,0x4E,0x50,0x68,0x44,0x44,0x40,0x00,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xBCF8 [?] [2626]*/ + 0x04,0x24,0x24,0x24,0x24,0x25,0x02,0x0C,0x30,0xCF,0x01,0x3F,0x09,0x05,0x7F,0x00, + 0x40,0x40,0x7C,0x90,0x88,0x08,0x80,0x60,0x18,0xE6,0x00,0xF8,0x20,0x40,0xFC,0x00, + /* 0xBCF9 [?] [2627]*/ + 0x00,0x7C,0x44,0x44,0x45,0x7C,0x10,0x11,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x03,0x00, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xBCFA [?] [2628]*/ + 0x00,0x7C,0x44,0x44,0x55,0x54,0x54,0x57,0x54,0x54,0x54,0x10,0x28,0x24,0x43,0x80, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xBCFB [?] [2629]*/ + 0x00,0x1F,0x10,0x10,0x11,0x11,0x11,0x11,0x11,0x12,0x12,0x04,0x04,0x08,0x30,0xC0, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x90,0x80,0x80,0x82,0x82,0x7E, + /* 0xBCFC [?] [2630]*/ + 0x20,0x20,0x3B,0x21,0x41,0x7A,0xA2,0x27,0xF9,0x25,0x25,0x22,0x2A,0x35,0x28,0x00, + 0x10,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x10,0x00,0xFE,0x00, + /* 0xBCFD [?] [2631]*/ + 0x20,0x3F,0x48,0x85,0x10,0x08,0xFF,0x00,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x2A,0x24, + 0x40,0x7E,0x90,0x08,0x10,0x20,0xFE,0x00,0x48,0x48,0x48,0x48,0x08,0x08,0x28,0x10, + /* 0xBCFE [?] [2632]*/ + 0x08,0x08,0x09,0x11,0x11,0x32,0x32,0x54,0x90,0x17,0x10,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBDA1 [?] [2633]*/ + 0x10,0x10,0x10,0x2E,0x23,0x62,0x64,0xA4,0x2E,0x22,0x22,0x2B,0x24,0x26,0x29,0x30, + 0x20,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFE,0x00, + /* 0xBDA2 [?] [2634]*/ + 0x10,0x21,0x7D,0x45,0x65,0x55,0x55,0xFD,0x45,0x65,0x54,0x54,0x44,0x44,0x55,0x8A, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x50,0x90,0x92,0x12,0x0E, + /* 0xBDA3 [?] [2635]*/ + 0x08,0x08,0x14,0x12,0x21,0x40,0xBE,0x00,0x11,0x09,0x49,0x22,0x22,0x07,0x78,0x20, + 0x04,0x04,0x04,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x84,0x14,0x08, + /* 0xBDA4 [?] [2636]*/ + 0x20,0x20,0x20,0x3C,0x45,0x48,0xA0,0x23,0x20,0x20,0x20,0x20,0x28,0x30,0x23,0x00, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xBDA5 [?] [2637]*/ + 0x01,0x41,0x21,0x2F,0x02,0x82,0x45,0x57,0x11,0x21,0xE1,0x2F,0x25,0x21,0x21,0x01, + 0x00,0x02,0x1C,0xD0,0x10,0x10,0x1E,0xD4,0x14,0x14,0xD4,0x14,0x14,0x24,0x24,0x44, + /* 0xBDA6 [?] [2638]*/ + 0x00,0x4F,0x28,0x28,0x0A,0x8A,0x4A,0x5A,0x1A,0x2A,0xEA,0x22,0x25,0x24,0x28,0x10, + 0x10,0x94,0x92,0x90,0x9E,0xF0,0x90,0x9E,0xF0,0x94,0x94,0x08,0x0A,0x9A,0x26,0x42, + /* 0xBDA7 [?] [2639]*/ + 0x02,0x21,0x15,0x14,0x84,0x45,0x45,0x15,0x15,0x25,0xE5,0x25,0x24,0x24,0x24,0x04, + 0x00,0x7C,0x04,0x04,0x04,0xF4,0x14,0x14,0xF4,0x14,0x14,0xF4,0x04,0x04,0x14,0x08, + /* 0xBDA8 [?] [2640]*/ + 0x00,0x00,0xFB,0x08,0x17,0x10,0x23,0x78,0x0B,0x08,0x48,0x37,0x10,0x2C,0x43,0x80, + 0x40,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0xFE,0x00, + /* 0xBDA9 [?] [2641]*/ + 0x10,0x1F,0x10,0x27,0x24,0x67,0x64,0xAF,0x20,0x27,0x24,0x27,0x24,0x27,0x20,0x2F, + 0x00,0xFE,0x00,0xFC,0x44,0xFC,0x44,0xFE,0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE, + /* 0xBDAA [?] [2642]*/ + 0x08,0x04,0x7F,0x01,0x3F,0x01,0xFF,0x02,0x04,0xFF,0x08,0x10,0x1C,0x03,0x0C,0x70, + 0x20,0x40,0xFC,0x00,0xF8,0x00,0xFE,0x00,0x00,0xFE,0x20,0x20,0x40,0x80,0x70,0x08, + /* 0xBDAB [?] [2643]*/ + 0x08,0x08,0x09,0x4A,0x28,0x28,0x08,0x0B,0x18,0x2B,0xC8,0x09,0x08,0x08,0x08,0x08, + 0x80,0xF8,0x08,0x10,0xA0,0x40,0x90,0x10,0x10,0xFE,0x10,0x10,0x90,0x10,0x50,0x20, + /* 0xBDAC [?] [2644]*/ + 0x08,0x48,0x28,0x09,0x1A,0x28,0x48,0x89,0x01,0x7D,0x05,0x09,0x11,0x21,0xC5,0x02, + 0x40,0x40,0xFC,0x04,0x88,0x50,0x60,0x80,0x04,0x88,0x50,0x20,0x10,0x08,0x06,0x00, + /* 0xBDAD [?] [2645]*/ + 0x00,0x20,0x17,0x10,0x80,0x40,0x48,0x08,0x10,0x10,0xE0,0x20,0x20,0x2F,0x20,0x00, + 0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00,0x00, + /* 0xBDAE [?] [2646]*/ + 0x00,0xFB,0x08,0x09,0xF9,0x81,0x81,0xFB,0x48,0x49,0xE9,0x49,0x69,0x89,0x50,0x23, + 0x00,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE, + /* 0xBDAF [?] [2647]*/ + 0x08,0x08,0xFF,0x08,0x00,0x08,0x49,0x2A,0x28,0x08,0x1B,0x29,0x48,0x88,0x08,0x08, + 0x20,0x20,0xFE,0x20,0x80,0xF8,0x10,0xA0,0x50,0x90,0xFE,0x10,0x90,0x90,0x10,0x30, + /* 0xBDB0 [?] [2648]*/ + 0x08,0x48,0x28,0x09,0x1A,0x28,0x48,0x89,0x01,0xFF,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x40,0x40,0xFC,0x04,0x88,0x50,0x60,0x80,0x00,0xFE,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xBDB1 [?] [2649]*/ + 0x08,0x48,0x28,0x09,0x1A,0x28,0x48,0x88,0x09,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x40,0x40,0xFC,0x04,0x88,0x50,0x20,0x40,0x80,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xBDB2 [?] [2650]*/ + 0x01,0x21,0x11,0x11,0x07,0x01,0xF1,0x11,0x1F,0x11,0x11,0x15,0x19,0x12,0x02,0x04, + 0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xBDB3 [?] [2651]*/ + 0x00,0x7F,0x40,0x40,0x47,0x44,0x44,0x47,0x44,0x44,0x44,0x48,0x48,0x50,0x7F,0x00, + 0x00,0xFC,0x00,0x38,0xC0,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBDB4 [?] [2652]*/ + 0x08,0x48,0x29,0x1A,0x28,0xC9,0x08,0xFF,0x04,0x3F,0x24,0x28,0x30,0x3F,0x20,0x3F, + 0x40,0x80,0xFC,0x48,0x30,0xC0,0x00,0xFE,0x80,0xF8,0x88,0x78,0x08,0xF8,0x08,0xF8, + /* 0xBDB5 [?] [2653]*/ + 0x00,0x7C,0x44,0x49,0x4A,0x50,0x49,0x4E,0x44,0x45,0x44,0x6A,0x53,0x40,0x40,0x40, + 0x80,0x80,0xFC,0x08,0x90,0x60,0x98,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xBDB6 [?] [2654]*/ + 0x08,0x08,0xFF,0x09,0x08,0x1F,0x30,0x5F,0x10,0x1F,0x10,0x1F,0x10,0x24,0x22,0x42, + 0x20,0x20,0xFE,0x20,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00,0x88,0x44,0x44, + /* 0xBDB7 [?] [2655]*/ + 0x21,0x21,0x21,0x21,0xF9,0x21,0x27,0x70,0x69,0xA1,0xA5,0x25,0x29,0x21,0x25,0x22, + 0x00,0x00,0xDC,0x14,0x14,0x14,0xD4,0x14,0x14,0x14,0x88,0x48,0x48,0x14,0x14,0x22, + /* 0xBDB8 [?] [2656]*/ + 0x00,0x00,0xF9,0x21,0x23,0x45,0x79,0x49,0xC9,0x49,0x49,0x49,0x79,0x4A,0x02,0x04, + 0xA0,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0xA4,0x52,0x52, + /* 0xBDB9 [?] [2657]*/ + 0x09,0x08,0x1F,0x10,0x30,0x5F,0x90,0x10,0x1F,0x10,0x10,0x1F,0x10,0x48,0x44,0x84, + 0x00,0x80,0xFC,0x80,0x80,0xF8,0x80,0x80,0xF8,0x80,0x80,0xFC,0x00,0x88,0x44,0x44, + /* 0xBDBA [?] [2658]*/ + 0x00,0x78,0x48,0x4B,0x48,0x78,0x49,0x4A,0x48,0x78,0x48,0x48,0x48,0x48,0x48,0x9B, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDBB [?] [2659]*/ + 0x02,0x01,0x01,0xFF,0x00,0x10,0x10,0x20,0x48,0x04,0x02,0x01,0x02,0x0C,0x30,0xC0, + 0x00,0x00,0x00,0xFE,0x00,0x10,0x08,0x24,0x24,0x40,0x80,0x00,0x80,0x40,0x30,0x0E, + /* 0xBDBC [?] [2660]*/ + 0x10,0x08,0x00,0xFF,0x00,0x24,0x42,0x81,0x24,0x14,0x08,0x14,0x22,0x42,0x80,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xBDBD [?] [2661]*/ + 0x00,0x20,0x10,0x13,0x80,0x40,0x48,0x0B,0x10,0x17,0xE0,0x20,0x21,0x21,0x22,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xBDBE [?] [2662]*/ + 0x00,0xF8,0x09,0x48,0x48,0x4B,0x48,0x7C,0x05,0x06,0x1C,0xE4,0x44,0x05,0x29,0x12, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xBDBF [?] [2663]*/ + 0x10,0x10,0x10,0x10,0xFC,0x25,0x24,0x24,0x25,0x4A,0x28,0x10,0x28,0x44,0x84,0x01, + 0x08,0x1C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x88,0x88,0x08, + /* 0xBDC0 [?] [2664]*/ + 0x00,0x07,0x72,0x51,0x57,0x54,0x57,0x50,0x57,0x54,0x77,0x54,0x07,0x05,0x05,0x06, + 0x3C,0xC0,0x44,0x28,0xFC,0xA4,0xFC,0x08,0x88,0xFE,0x88,0xA8,0x98,0x08,0xA8,0x90, + /* 0xBDC1 [?] [2665]*/ + 0x24,0x22,0x22,0x27,0xFC,0x28,0x23,0x2A,0x32,0xE2,0x22,0x22,0x20,0x21,0xA2,0x4C, + 0x84,0x44,0x48,0xFE,0x02,0x04,0xF8,0x08,0x48,0x48,0x48,0xA8,0xA0,0x22,0x22,0x1E, + /* 0xBDC2 [?] [2666]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBC,0x11,0x12,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDC3 [?] [2667]*/ + 0x20,0x20,0x21,0x7C,0x50,0x93,0x10,0xFC,0x11,0x12,0x10,0x28,0x24,0x45,0x41,0x82, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xBDC4 [?] [2668]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x30,0x53,0x90,0x17,0x10,0x10,0x11,0x11,0x12,0x14, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xBDC5 [?] [2669]*/ + 0x01,0x79,0x49,0x4B,0x49,0x79,0x49,0x4F,0x49,0x79,0x4A,0x4A,0x4F,0x4A,0x48,0x98, + 0x00,0x00,0x1E,0x92,0x12,0x12,0x12,0xD2,0x12,0x12,0x1A,0x94,0xD0,0x50,0x10,0x10, + /* 0xBDC6 [?] [2670]*/ + 0x00,0x44,0x28,0x13,0x28,0x48,0x89,0x0A,0x18,0x28,0x48,0x88,0x08,0x08,0x50,0x23, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDC7 [?] [2671]*/ + 0x08,0x08,0x1F,0x20,0x40,0xBF,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21,0x41,0x41,0x80, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xBDC8 [?] [2672]*/ + 0x20,0x20,0x20,0x3D,0x44,0x48,0xA1,0x22,0x20,0x20,0x20,0x20,0x28,0x30,0x20,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDC9 [?] [2673]*/ + 0x21,0x22,0x27,0x44,0x57,0xF4,0x27,0x22,0x41,0xF7,0x42,0x03,0x32,0xC4,0x05,0x08, + 0x08,0x08,0xC8,0x50,0xDE,0x64,0xD4,0x14,0x14,0xD4,0x14,0xC8,0x48,0x54,0x54,0xA2, + /* 0xBDCA [?] [2674]*/ + 0x10,0x10,0x20,0x25,0x44,0xF8,0x11,0x22,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDCB [?] [2675]*/ + 0x49,0x92,0x49,0x00,0x7F,0x49,0x7F,0x49,0x7F,0x08,0xFF,0x1C,0x2A,0x49,0x88,0x08, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xA4,0x24,0x04,0x04,0x14,0x08, + /* 0xBDCC [?] [2676]*/ + 0x08,0x08,0x7E,0x09,0x0A,0xFF,0x08,0x7E,0x24,0x48,0x8F,0x78,0x08,0x08,0x28,0x11, + 0x20,0x20,0xA0,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xBDCD [?] [2677]*/ + 0x00,0xFE,0x29,0x28,0xFE,0xAB,0xAA,0xAA,0xAF,0xC2,0x83,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x22,0xFA,0x24,0x24,0xFE,0x10,0x20,0xFC,0x88,0x10,0xFE,0x10,0x10,0x50,0x20, + /* 0xBDCE [?] [2678]*/ + 0x20,0x20,0x21,0xFC,0x40,0x53,0x90,0xFC,0x11,0x12,0x1C,0xF0,0x50,0x11,0x11,0x12, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xBDCF [?] [2679]*/ + 0x20,0x20,0x20,0xFD,0x40,0x50,0x91,0xFE,0x10,0x10,0x1C,0xF0,0x50,0x10,0x10,0x13, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xBDD0 [?] [2680]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00,0x00,0x00, + 0x04,0x04,0x84,0x84,0x84,0x84,0x84,0x84,0x8C,0xB4,0xC4,0x84,0x04,0x04,0x04,0x04, + /* 0xBDD1 [?] [2681]*/ + 0x02,0x01,0x7F,0x48,0x91,0x09,0x0F,0x11,0x01,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xF0,0x00,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xBDD2 [?] [2682]*/ + 0x10,0x13,0x12,0x13,0xFE,0x13,0x11,0x13,0x1C,0x32,0xD2,0x12,0x13,0x10,0x50,0x20, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xBDD3 [?] [2683]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x17,0x10,0x18,0x37,0xD0,0x11,0x10,0x10,0x51,0x26, + 0x80,0x40,0xFC,0x00,0x08,0x90,0xFE,0x40,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xBDD4 [?] [2684]*/ + 0x20,0x20,0x3C,0x20,0x20,0x2C,0x31,0x02,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x80,0x88,0xB0,0xC0,0x84,0x84,0x7C,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xBDD5 [?] [2685]*/ + 0x08,0x1C,0xF0,0x13,0x10,0xFC,0x11,0x30,0x38,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xBDD6 [?] [2686]*/ + 0x11,0x11,0x27,0x41,0x81,0x17,0x20,0x61,0xA1,0x27,0x21,0x21,0x21,0x2E,0x24,0x20, + 0x00,0x00,0xDC,0x00,0x00,0xC0,0x3E,0x08,0x08,0xC8,0x08,0x08,0xC8,0x08,0x28,0x10, + /* 0xBDD7 [?] [2687]*/ + 0x00,0x7C,0x44,0x48,0x48,0x51,0x4A,0x48,0x44,0x44,0x44,0x68,0x50,0x41,0x41,0x42, + 0x20,0x20,0x50,0x50,0x88,0x04,0x02,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xBDD8 [?] [2688]*/ + 0x08,0x08,0x7F,0x08,0xFF,0x14,0x22,0x7F,0xA4,0x3F,0x24,0x3F,0x24,0x3F,0x20,0x20, + 0x20,0x28,0x24,0x20,0xFE,0x20,0x24,0xA4,0x24,0x28,0x28,0x10,0x12,0xAA,0x46,0x82, + /* 0xBDD9 [?] [2689]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0x08,0xFF,0x10,0x10,0x20,0x44,0xFE,0x42,0x01,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xBDDA [?] [2690]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20,0x00,0x00,0x00, + /* 0xBDDB [?] [2691]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x31,0x38,0x54,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xBDDC [?] [2692]*/ + 0x01,0x01,0x01,0x7F,0x03,0x05,0x09,0x11,0x21,0xC1,0x01,0x00,0x24,0x22,0x42,0x80, + 0x00,0x00,0x00,0xFC,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00,0x88,0x44,0x44,0x04, + /* 0xBDDD [?] [2693]*/ + 0x20,0x20,0x27,0x20,0xFB,0x20,0x27,0x28,0x33,0xE0,0x22,0x22,0x22,0x25,0xA4,0x48, + 0x40,0x40,0xFE,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x40,0x40,0x7C,0x40,0x40,0xFE,0x00, + /* 0xBDDE [?] [2694]*/ + 0x00,0x00,0x7B,0x48,0x49,0x78,0x4B,0x48,0x79,0x48,0x49,0x49,0x79,0x4A,0x02,0x04, + 0x20,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0x20,0x3E,0x20,0xA0,0x7E,0x00, + /* 0xBDDF [?] [2695]*/ + 0x20,0x11,0x11,0xFD,0x01,0x09,0x88,0x89,0x4A,0x49,0x51,0x51,0x1D,0xE0,0x40,0x00, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFE,0x22,0x22,0x52,0x02,0xFA,0x02,0x14,0x08, + /* 0xBDE0 [?] [2696]*/ + 0x00,0x40,0x20,0x2F,0x00,0x80,0x47,0x50,0x10,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xBDE1 [?] [2697]*/ + 0x10,0x10,0x20,0x27,0x44,0xF8,0x11,0x20,0x40,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xBDE2 [?] [2698]*/ + 0x10,0x10,0x3C,0x24,0x48,0xBE,0x2A,0x2A,0x3E,0x2A,0x2A,0x3E,0x2A,0x4A,0x42,0x86, + 0x00,0xFC,0x24,0x24,0x54,0x88,0x10,0x50,0x7C,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xBDE3 [?] [2699]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x87,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xBDE4 [?] [2700]*/ + 0x00,0x00,0x00,0xFF,0x00,0x12,0x12,0x12,0x7F,0x12,0x12,0x12,0x22,0x22,0x40,0x03, + 0x48,0x44,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xBDE5 [?] [2701]*/ + 0x08,0x08,0xFF,0x08,0x10,0x7C,0x10,0x7C,0x11,0xFE,0x10,0x38,0x54,0x94,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x48,0xFC,0x48,0x48,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xBDE6 [?] [2702]*/ + 0x08,0x08,0xFF,0x08,0x09,0x02,0x04,0x08,0x34,0xC4,0x04,0x04,0x08,0x08,0x10,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x40,0x20,0x58,0x46,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xBDE7 [?] [2703]*/ + 0x00,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x02,0x0C,0x34,0xC4,0x04,0x08,0x08,0x10, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x80,0x60,0x58,0x46,0x40,0x40,0x40,0x40, + /* 0xBDE8 [?] [2704]*/ + 0x09,0x09,0x09,0x17,0x11,0x31,0x3F,0x50,0x93,0x12,0x12,0x13,0x12,0x12,0x13,0x12, + 0x10,0x10,0x10,0xFC,0x10,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xBDE9 [?] [2705]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x20,0xC8,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x26,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBDEA [?] [2706]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x51,0x12,0x3D,0x51,0x91,0x11,0x21,0x22,0x42,0x84, + 0x80,0x40,0xFE,0x40,0x40,0xA0,0x10,0x08,0x16,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xBDEB [?] [2707]*/ + 0x00,0x40,0x20,0x2F,0x00,0x02,0xE2,0x22,0x2F,0x22,0x22,0x2A,0x32,0x24,0x04,0x08, + 0x14,0x12,0x10,0xFE,0x10,0x90,0x92,0x92,0xD2,0x94,0x94,0x88,0x8A,0x9A,0x26,0x42, + /* 0xBDEC [?] [2708]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x2F,0x28,0x28,0x2F,0x48,0x48,0x8F,0x08, + 0x00,0xF8,0x08,0x08,0xF8,0x80,0x80,0x80,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0x08, + /* 0xBDED [?] [2709]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x01,0x01,0x01, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00,0x00, + /* 0xBDEE [?] [2710]*/ + 0x10,0x10,0x3F,0x48,0x85,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x42,0x4A,0x85, + 0x40,0x40,0x7E,0x90,0x08,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x44,0x44,0x94,0x08, + /* 0xBDEF [?] [2711]*/ + 0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x10,0xF8,0x00,0x00,0x00,0x00,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xBDF0 [?] [2712]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x2F,0xC1,0x01,0x3F,0x01,0x11,0x09,0x09,0xFF,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0xE8,0x06,0x00,0xF8,0x00,0x10,0x10,0x20,0xFE,0x00, + /* 0xBDF1 [?] [2713]*/ + 0x01,0x01,0x02,0x04,0x08,0x12,0x21,0xC1,0x00,0x1F,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0xF0,0x10,0x20,0x20,0x40,0x80,0x00, + /* 0xBDF2 [?] [2714]*/ + 0x00,0x20,0x13,0x10,0x87,0x40,0x4B,0x08,0x10,0x13,0xE0,0x20,0x27,0x20,0x20,0x00, + 0x40,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x40,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40, + /* 0xBDF3 [?] [2715]*/ + 0x21,0x11,0x07,0xF1,0x13,0x25,0x29,0x68,0xB3,0x28,0x27,0x20,0x22,0x24,0x29,0x20, + 0x10,0x10,0xBC,0x10,0xB8,0x54,0x12,0x00,0xF8,0x00,0xFC,0x40,0x48,0x44,0x42,0x80, + /* 0xBDF4 [?] [2716]*/ + 0x04,0x25,0x24,0x24,0x24,0x24,0x02,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0xFC,0x88,0x50,0x20,0x50,0x8C,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xBDF5 [?] [2717]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x11,0x10,0xFC,0x13,0x12,0x12,0x16,0x1A,0x10,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xBDF6 [?] [2718]*/ + 0x08,0x0B,0x09,0x11,0x11,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x11,0x16, + 0x00,0xFC,0x04,0x04,0x04,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xBDF7 [?] [2719]*/ + 0x01,0x41,0x2F,0x21,0x01,0x00,0xE7,0x24,0x27,0x20,0x2F,0x20,0x2F,0x30,0x2F,0x00, + 0x10,0x10,0xFE,0x10,0xF0,0x40,0xFC,0x44,0xFC,0x40,0xFE,0x40,0xFC,0x40,0xFE,0x00, + /* 0xBDF8 [?] [2720]*/ + 0x00,0x20,0x10,0x13,0x00,0x00,0xF0,0x17,0x10,0x10,0x11,0x11,0x12,0x28,0x47,0x00, + 0x90,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x90,0x90,0x10,0x10,0x10,0x00,0xFE,0x00, + /* 0xBDF9 [?] [2721]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x08,0x7F,0x49,0x49,0x7F,0x08,0xFF,0x08,0x08,0x08,0x09, + 0x04,0x0E,0x70,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0xC8,0x48,0x88,0x88,0x08, + /* 0xBDFA [?] [2722]*/ + 0x00,0x7F,0x04,0x24,0x14,0x04,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0xFC,0x40,0x48,0x50,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xBDFB [?] [2723]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC8,0x00,0x3F,0x00,0x00,0xFF,0x01,0x11,0x25,0x42, + 0x20,0x20,0xFC,0x20,0x70,0xA8,0x26,0x00,0xF8,0x00,0x00,0xFE,0x00,0x10,0x08,0x04, + /* 0xBDFC [?] [2724]*/ + 0x00,0x20,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x12,0x12,0x14,0x28,0x47,0x00, + 0x08,0x1C,0xE0,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0xFE,0x00, + /* 0xBDFD [?] [2725]*/ + 0x10,0x11,0x11,0x15,0x59,0x51,0x51,0x91,0x11,0x12,0x14,0x28,0x24,0x44,0x40,0x80, + 0x00,0xFC,0x04,0x04,0xFC,0x10,0x10,0x08,0x04,0x62,0x10,0x00,0xE0,0x18,0x04,0x00, + /* 0xBDFE [?] [2726]*/ + 0x00,0x23,0x10,0x11,0x80,0x43,0x40,0x17,0x14,0x23,0xE1,0x21,0x20,0x20,0x21,0x06, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x04,0xF0,0x10,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xBEA1 [?] [2727]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x23,0x20,0x40,0x8C,0x03,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x48,0x40,0x20,0x10,0x88,0x06,0x00,0x00,0x80,0x40, + /* 0xBEA2 [?] [2728]*/ + 0x00,0x7E,0x04,0x08,0x18,0x24,0x42,0x81,0x00,0x7E,0x08,0x08,0x08,0x0E,0xF1,0x42, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xBEA3 [?] [2729]*/ + 0x12,0x12,0xFF,0x12,0x00,0x7F,0x12,0x12,0x12,0xFF,0x12,0x12,0x22,0x22,0x42,0x82, + 0x04,0x04,0xC4,0x24,0x24,0xA4,0x24,0x24,0x24,0xE4,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xBEA4 [?] [2730]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0x7E,0x42,0x42,0x7E,0x14,0x14,0x25,0x26,0x44,0x81, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0xFC,0x50,0x50,0x50,0x92,0x92,0x0E, + /* 0xBEA5 [?] [2731]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x00,0x01,0x0E,0x70,0x1F,0x01,0x01,0x01,0xFF,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF0,0x60,0x80,0x70,0x0C,0xF0,0x00,0x00,0x00,0xFE,0x00, + /* 0xBEA6 [?] [2732]*/ + 0x00,0x00,0x7B,0x48,0x49,0x78,0x4B,0x48,0x79,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xBEA7 [?] [2733]*/ + 0x0F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x00,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x42, + 0xE0,0x20,0x20,0xE0,0x20,0x20,0xE0,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xBEA8 [?] [2734]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x54,0x54,0x7C,0x54,0x54,0x7C,0x01,0x1E,0xE0,0x40, + 0x40,0x20,0xFE,0x00,0x00,0xF8,0x88,0x88,0x88,0xF8,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xBEA9 [?] [2735]*/ + 0x02,0x01,0xFF,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xBEAA [?] [2736]*/ + 0x10,0x10,0x13,0x10,0x18,0x55,0x51,0x51,0x91,0x10,0x11,0x11,0x12,0x14,0x10,0x10, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xBEAB [?] [2737]*/ + 0x10,0x10,0x95,0x54,0x58,0x10,0xFD,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x94,0x88, + /* 0xBEAC [?] [2738]*/ + 0x10,0x11,0x94,0x54,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x10,0x10,0x10,0x13, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xBEAD [?] [2739]*/ + 0x10,0x11,0x20,0x24,0x44,0xF8,0x10,0x23,0x40,0xFD,0x40,0x00,0x1C,0xE0,0x43,0x00, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBEAE [?] [2740]*/ + 0x08,0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x10,0x10,0x20,0x40, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBEAF [?] [2741]*/ + 0x24,0xFF,0x24,0x7E,0x82,0x7A,0x4A,0x7A,0x05,0xFF,0x00,0x3F,0x00,0x3F,0x20,0x3F, + 0x20,0x20,0x7E,0xC4,0x28,0x10,0x28,0xC6,0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8, + /* 0xBEB0 [?] [2742]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x01,0x21,0x45,0x02, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x00,0x08,0x04,0x00, + /* 0xBEB1 [?] [2743]*/ + 0x00,0x7E,0x04,0x08,0x18,0x24,0x42,0x81,0x00,0x7E,0x08,0x08,0x08,0x0E,0xF0,0x40, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xBEB2 [?] [2744]*/ + 0x10,0x10,0xFE,0x10,0x7C,0x11,0xFE,0x00,0x7D,0x44,0x7C,0x45,0x7C,0x44,0x54,0x48, + 0x40,0x40,0x78,0x88,0x10,0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x24,0x20,0xA0,0x40, + /* 0xBEB3 [?] [2745]*/ + 0x20,0x20,0x23,0x21,0xF8,0x27,0x20,0x23,0x22,0x23,0x22,0x3B,0xE1,0x41,0x02,0x0C, + 0x80,0x40,0xF8,0x10,0xA0,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x22,0x22,0x1E, + /* 0xBEB4 [?] [2746]*/ + 0x22,0x22,0xFF,0x22,0x40,0x7F,0x41,0x81,0x7D,0x45,0x45,0x7D,0x45,0x01,0x0A,0x04, + 0x20,0x20,0xA0,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xBEB5 [?] [2747]*/ + 0x20,0x20,0x3B,0x21,0x40,0x77,0xA0,0x23,0xFA,0x23,0x22,0x23,0x29,0x31,0x22,0x0C, + 0x80,0x40,0xF8,0x10,0xA0,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x22,0x22,0x1E, + /* 0xBEB6 [?] [2748]*/ + 0x08,0x0B,0x10,0x20,0x48,0x08,0x11,0x36,0x50,0x93,0x10,0x10,0x10,0x10,0x17,0x10, + 0x00,0xF8,0x10,0x20,0x60,0x98,0x04,0x02,0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xBEB7 [?] [2749]*/ + 0x00,0x00,0x1F,0x10,0x97,0x50,0x50,0x10,0x33,0x5C,0x93,0x10,0x20,0x20,0x4F,0x80, + 0x80,0x40,0xFE,0x00,0xF8,0x10,0x20,0xD8,0x04,0x02,0xF8,0x40,0x40,0x40,0xFE,0x00, + /* 0xBEB8 [?] [2750]*/ + 0x20,0x10,0x13,0xFC,0x01,0x08,0x8B,0x88,0x49,0x49,0x51,0x51,0x1D,0xE1,0x41,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xBEB9 [?] [2751]*/ + 0x02,0x01,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x04,0x08,0x10,0x60, + 0x00,0x00,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x40,0x42,0x42,0x3E, + /* 0xBEBA [?] [2752]*/ + 0x02,0x01,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x04,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x40,0x40,0x42,0x42,0x3E, + /* 0xBEBB [?] [2753]*/ + 0x01,0x41,0x23,0x24,0x00,0x17,0x10,0x10,0x2F,0x20,0xE0,0x27,0x20,0x20,0x21,0x00, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x44,0x40,0x40,0x80, + /* 0xBEBC [?] [2754]*/ + 0x10,0x11,0x11,0x15,0x59,0x51,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x81, + 0x00,0xFE,0x02,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x0A,0x04, + /* 0xBEBD [?] [2755]*/ + 0x02,0x01,0x7F,0x48,0x90,0x3F,0x04,0xFF,0x04,0x3F,0x08,0x1F,0x28,0x48,0x8F,0x08, + 0x00,0x00,0xFE,0x22,0x14,0xF8,0x08,0xFE,0x08,0xF8,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xBEBE [?] [2756]*/ + 0x20,0x21,0x27,0x21,0xF9,0x21,0x27,0x29,0x33,0xE3,0x25,0x25,0x29,0x21,0xA1,0x41, + 0x88,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xBEBF [?] [2757]*/ + 0x02,0x01,0x7F,0x40,0x88,0x12,0x22,0x02,0x3F,0x02,0x04,0x04,0x08,0x10,0x20,0x40, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x08,0x00,0xE0,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xBEC0 [?] [2758]*/ + 0x10,0x10,0x20,0x24,0x44,0xF8,0x10,0x20,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x04,0x04,0x84,0x84,0x84,0x84,0x84,0x84,0x8C,0xB4,0xC4,0x84,0x04,0x04,0x04,0x04, + /* 0xBEC1 [?] [2759]*/ + 0x00,0x00,0xFC,0x10,0x11,0x11,0x7D,0x12,0x10,0x10,0x10,0x1C,0xE0,0x41,0x02,0x04, + 0x80,0x80,0x80,0xF8,0x08,0x08,0x10,0x10,0x20,0x20,0x50,0x50,0x88,0x08,0x04,0x02, + /* 0xBEC2 [?] [2760]*/ + 0x04,0x04,0x7C,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,0x7C,0x04,0x04,0x04,0xFF,0x00, + 0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x00, + /* 0xBEC3 [?] [2761]*/ + 0x04,0x04,0x04,0x07,0x08,0x08,0x10,0x20,0x40,0x00,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xE0,0x20,0x20,0x40,0x40,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xBEC4 [?] [2762]*/ + 0x04,0x04,0x0F,0x10,0x20,0x03,0x0C,0x70,0x01,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xE0,0x40,0x80,0x60,0x18,0x04,0x00,0x10,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xBEC5 [?] [2763]*/ + 0x04,0x04,0x04,0x04,0x7F,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xBEC6 [?] [2764]*/ + 0x00,0x4F,0x20,0x20,0x07,0x84,0x44,0x54,0x15,0x26,0xE4,0x27,0x24,0x24,0x27,0x04, + 0x00,0xFE,0xA0,0xA0,0xFC,0xA4,0xA4,0xA4,0x1C,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xBEC7 [?] [2765]*/ + 0x00,0x3F,0x20,0x2F,0x29,0x29,0x2F,0x29,0x29,0x2F,0x28,0x2A,0x29,0x4B,0x4D,0x88, + 0x00,0xFE,0x00,0x7E,0x10,0x10,0x50,0x50,0x7E,0x10,0x28,0x28,0x28,0x4A,0x4A,0x86, + /* 0xBEC8 [?] [2766]*/ + 0x10,0x14,0x12,0x10,0xFE,0x11,0x10,0x92,0x54,0x10,0x38,0x54,0x92,0x10,0x51,0x22, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xBEC9 [?] [2767]*/ + 0x20,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x22,0x22,0x23,0x22,0x20, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xBECA [?] [2768]*/ + 0x00,0x04,0x38,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x00, + 0x00,0x00,0x78,0x08,0x08,0x08,0x08,0x78,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00, + /* 0xBECB [?] [2769]*/ + 0x3E,0x20,0x3C,0x20,0x3F,0x00,0x1F,0x11,0x1F,0x11,0x1F,0x02,0x7F,0x04,0x18,0x60, + 0x78,0x08,0x78,0x08,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x28,0x10, + /* 0xBECC [?] [2770]*/ + 0x10,0x10,0x1E,0x22,0x22,0x54,0x08,0x14,0x23,0xC0,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x40,0x50,0x48,0x44,0x44,0x40,0x40,0xFE,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xBECD [?] [2771]*/ + 0x20,0x10,0xFE,0x00,0x00,0x7D,0x44,0x44,0x44,0x7C,0x10,0x54,0x92,0x11,0x51,0x22, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x50,0x50,0x50,0x50,0x90,0x90,0x92,0x12,0x0E,0x00, + /* 0xBECE [?] [2772]*/ + 0x00,0x00,0x1F,0x11,0x91,0x51,0x53,0x12,0x34,0x58,0x90,0x10,0x20,0x21,0x46,0x98, + 0x80,0x40,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0xA0,0x10,0x08,0x06, + /* 0xBECF [?] [2773]*/ + 0x28,0x28,0xFE,0x29,0x3A,0x10,0x7C,0x54,0x55,0x7C,0x10,0xFE,0x11,0x10,0x10,0x10, + 0x80,0x80,0xFE,0x02,0x22,0xAA,0x72,0x22,0xFE,0x22,0x72,0xAA,0x22,0x22,0x0A,0x04, + /* 0xBED0 [?] [2774]*/ + 0x10,0x10,0x11,0x11,0xFA,0x14,0x11,0x19,0x31,0xD1,0x11,0x11,0x10,0x10,0x50,0x20, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x04,0x28,0x10, + /* 0xBED1 [?] [2775]*/ + 0x00,0x45,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x57,0x20, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xBED2 [?] [2776]*/ + 0x00,0x00,0x1F,0x10,0x90,0x53,0x52,0x12,0x33,0x52,0x92,0x13,0x22,0x22,0x4F,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00, + /* 0xBED3 [?] [2777]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x28,0x48,0x48,0x8F,0x08, + 0x00,0xF8,0x08,0x08,0xF8,0x80,0x80,0xFE,0x80,0x80,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBED4 [?] [2778]*/ + 0x00,0xF8,0x09,0x49,0x4A,0x4C,0x49,0x7D,0x05,0x05,0x1D,0xE5,0x44,0x04,0x28,0x10, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x04,0x28,0x10, + /* 0xBED5 [?] [2779]*/ + 0x04,0x04,0xFF,0x04,0x10,0x1F,0x22,0x52,0x8A,0x02,0x7F,0x07,0x0A,0x12,0x62,0x02, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x04,0x44,0x84,0x04,0xF4,0x04,0x84,0x44,0x14,0x08, + /* 0xBED6 [?] [2780]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x27,0x24,0x24,0x47,0x40,0x80,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xBED7 [?] [2781]*/ + 0x00,0x01,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x07,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xBED8 [?] [2782]*/ + 0x20,0x21,0x3D,0x51,0x91,0x11,0x11,0xFF,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x80, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xBED9 [?] [2783]*/ + 0x22,0x11,0x11,0x00,0xFF,0x08,0x11,0x21,0xCF,0x01,0x01,0x7F,0x01,0x01,0x01,0x01, + 0x08,0x08,0x10,0x20,0xFE,0x20,0x10,0x08,0xE6,0x00,0x00,0xFC,0x00,0x00,0x00,0x00, + /* 0xBEDA [?] [2784]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x4A,0x0A,0x12,0x13,0xE2,0x22,0x22,0x22,0x2F,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xBEDB [?] [2785]*/ + 0x7F,0x22,0x3E,0x22,0x3E,0x23,0xFE,0x02,0x00,0x7F,0x09,0x11,0x63,0x05,0x19,0xE1, + 0x00,0x7C,0x04,0x28,0x10,0xA8,0x44,0x00,0xF8,0x00,0x04,0x88,0x50,0x20,0x18,0x06, + /* 0xBEDC [?] [2786]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x20, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xBEDD [?] [2787]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x2B,0x32,0xE2,0x22,0x22,0x22,0x24,0xA4,0x48, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xBEDE [?] [2788]*/ + 0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x3F,0x00, + 0x00,0xF8,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xBEDF [?] [2789]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0xFF,0x04,0x08,0x10,0x20, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0xFE,0x40,0x20,0x10,0x08, + /* 0xBEE0 [?] [2790]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01,0x00, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xBEE1 [?] [2791]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x00,0xFE,0x02,0x02,0xFE,0x10,0x10,0xFE,0x10,0x10,0x7E,0x42,0x42,0x42,0x7E,0x42, + /* 0xBEE2 [?] [2792]*/ + 0x20,0x23,0x3A,0x22,0x43,0x7A,0xA2,0x23,0xFA,0x22,0x22,0x22,0x2A,0x34,0x24,0x08, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xBEE3 [?] [2793]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x32,0x33,0x52,0x93,0x12,0x12,0x1F,0x10,0x11,0x12,0x14, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00,0x10,0x08,0x04, + /* 0xBEE4 [?] [2794]*/ + 0x08,0x08,0x10,0x1F,0x20,0x40,0x9F,0x10,0x10,0x10,0x10,0x1F,0x10,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x50,0x20, + /* 0xBEE5 [?] [2795]*/ + 0x10,0x13,0x12,0x12,0x1B,0x56,0x53,0x52,0x93,0x12,0x12,0x1F,0x10,0x11,0x12,0x14, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00,0x10,0x08,0x04, + /* 0xBEE6 [?] [2796]*/ + 0x10,0x11,0x11,0x11,0x55,0x59,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x80, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xBEE7 [?] [2797]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x24,0x24,0x3F,0x24,0x24,0x3F,0x50,0x50,0x90,0x1F,0x10, + 0x04,0x84,0x84,0xA4,0xA4,0x24,0x24,0xA4,0x24,0x24,0xA4,0xA4,0x84,0x84,0x94,0x88, + /* 0xBEE8 [?] [2798]*/ + 0x10,0x11,0x11,0x11,0xFD,0x10,0x13,0x16,0x1A,0x33,0xD2,0x12,0x13,0x12,0x52,0x22, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x14,0x08, + /* 0xBEE9 [?] [2799]*/ + 0x00,0x3E,0x22,0x22,0x3E,0x00,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x41,0x45,0x42, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xBEEA [?] [2800]*/ + 0x20,0x21,0x21,0x21,0xF9,0x48,0x4B,0x4A,0x4A,0x93,0x52,0x22,0x33,0x4A,0x4A,0x82, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x14,0x08, + /* 0xBEEB [?] [2801]*/ + 0x10,0x12,0x11,0x27,0x20,0x61,0x6F,0xA2,0x24,0x2B,0x32,0x22,0x22,0x22,0x22,0x21, + 0x40,0x48,0x50,0xFC,0x80,0x00,0xFE,0x10,0x08,0xF4,0x12,0x10,0x50,0x24,0x04,0xFC, + /* 0xBEEC [?] [2802]*/ + 0x01,0x11,0x09,0x3F,0x02,0x7F,0x08,0x10,0x2F,0xC8,0x0F,0x08,0x0F,0x08,0x0F,0x08, + 0x00,0x10,0x20,0xF8,0x00,0xFC,0x20,0x10,0xE8,0x26,0xE0,0x20,0xE0,0x20,0xE0,0x20, + /* 0xBEED [?] [2803]*/ + 0x01,0x11,0x09,0x3F,0x02,0x02,0x7F,0x08,0x10,0x2F,0xC8,0x08,0x08,0x08,0x08,0x07, + 0x00,0x10,0x20,0xF8,0x00,0x00,0xFC,0x20,0x10,0xE8,0x26,0x20,0xA8,0x48,0x08,0xF8, + /* 0xBEEE [?] [2804]*/ + 0x10,0x11,0x21,0x21,0x49,0xF8,0x13,0x22,0x42,0xFB,0x42,0x02,0x1B,0xE2,0x42,0x02, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x14,0x08, + /* 0xBEEF [?] [2805]*/ + 0x20,0x2F,0x28,0x2A,0xF9,0x2B,0x28,0x28,0x3A,0xEA,0x2B,0x28,0x28,0x29,0xA9,0x52, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xBEF0 [?] [2806]*/ + 0x13,0x12,0x13,0x12,0xFB,0x10,0x11,0x1B,0x35,0xD1,0x11,0x10,0x11,0x10,0x50,0x27, + 0xDE,0x52,0xDE,0x52,0xDE,0xA0,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x70,0x8E, + /* 0xBEF1 [?] [2807]*/ + 0x10,0x10,0x10,0x13,0xF8,0x10,0x14,0x18,0x37,0xD0,0x10,0x10,0x11,0x11,0x52,0x24, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x06, + /* 0xBEF2 [?] [2808]*/ + 0x20,0x27,0x24,0x24,0xF7,0x24,0x25,0x25,0x35,0xE5,0x24,0x25,0x25,0x29,0xA9,0x50, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x24,0x24,0x24,0xFC,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xBEF3 [?] [2809]*/ + 0x10,0x17,0x14,0x24,0x27,0x64,0x65,0xA5,0x25,0x25,0x24,0x25,0x25,0x29,0x29,0x30, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x24,0x24,0x24,0xFC,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xBEF4 [?] [2810]*/ + 0x00,0x7F,0x22,0x11,0x7F,0x44,0x7F,0x00,0x7E,0x42,0x7E,0x42,0x7E,0x48,0x74,0x42, + 0xFC,0x00,0x08,0x10,0xFC,0x44,0xFC,0x08,0x08,0xFE,0x08,0x48,0x28,0x08,0x28,0x10, + /* 0xBEF5 [?] [2811]*/ + 0x22,0x11,0x00,0x7F,0x40,0x80,0x1F,0x10,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0x08,0x10,0x20,0xFE,0x02,0x04,0xF0,0x10,0x10,0x10,0x10,0x90,0x80,0x84,0x84,0x7C, + /* 0xBEF6 [?] [2812]*/ + 0x00,0x40,0x20,0x27,0x00,0x00,0x10,0x10,0x2F,0xE0,0x21,0x21,0x22,0x24,0x28,0x10, + 0x80,0x80,0x80,0xF8,0x88,0x88,0x88,0x88,0xFE,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xBEF7 [?] [2813]*/ + 0x00,0x20,0x10,0x13,0x00,0x00,0xF0,0x10,0x17,0x10,0x10,0x14,0x19,0x12,0x04,0x08, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x04,0x02, + /* 0xBEF8 [?] [2814]*/ + 0x10,0x10,0x20,0x21,0x4A,0xF5,0x11,0x21,0x41,0xF9,0x41,0x01,0x19,0xE1,0x40,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xBEF9 [?] [2815]*/ + 0x10,0x10,0x10,0x10,0x11,0xFE,0x10,0x10,0x10,0x10,0x10,0x1C,0xE1,0x40,0x00,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x84,0x44,0x44,0x14,0x24,0x44,0x84,0x04,0x28,0x10, + /* 0xBEFA [?] [2816]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x20,0x20,0x27,0x21,0x2F,0x23,0x25,0x29,0x21,0x3F,0x20, + 0x20,0xFE,0x20,0x00,0xF8,0x08,0xC8,0x08,0x08,0xE8,0x88,0x48,0x28,0x08,0xF8,0x08, + /* 0xBEFB [?] [2817]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBE,0x10,0x10,0xFC,0x10,0x10,0x10,0x15,0x18,0x10,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x84,0x44,0x44,0x14,0x24,0x44,0x84,0x04,0x28,0x10, + /* 0xBEFC [?] [2818]*/ + 0x00,0x7F,0x40,0x82,0x02,0x3F,0x04,0x09,0x11,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01, + 0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xBEFD [?] [2819]*/ + 0x00,0x3F,0x04,0x04,0xFF,0x04,0x04,0x3F,0x08,0x08,0x1F,0x18,0x28,0x48,0x8F,0x08, + 0x00,0xF8,0x08,0x08,0xFE,0x08,0x08,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBEFE [?] [2820]*/ + 0x20,0x20,0x20,0x21,0xAB,0xA8,0xA8,0xA9,0xAA,0xA8,0xA9,0xBA,0xC8,0x00,0x01,0x06, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBFA1 [?] [2821]*/ + 0x08,0x08,0x08,0x11,0x13,0x30,0x30,0x51,0x92,0x10,0x11,0x12,0x10,0x10,0x11,0x16, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBFA2 [?] [2822]*/ + 0x20,0x10,0x10,0xFD,0x03,0x08,0x88,0x89,0x4A,0x48,0x51,0x52,0x1C,0xE0,0x41,0x06, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBFA3 [?] [2823]*/ + 0x00,0x20,0x11,0x12,0x87,0x40,0x41,0x12,0x14,0x21,0xE3,0x24,0x20,0x20,0x23,0x0C, + 0x80,0x80,0x10,0x08,0xFC,0x04,0x10,0x88,0x84,0xF0,0x10,0xA0,0x40,0xA0,0x10,0x0C, + /* 0xBFA4 [?] [2824]*/ + 0x00,0x7F,0x11,0x11,0xFF,0x11,0x11,0x7F,0x20,0x20,0x7F,0xA1,0x21,0x21,0x3F,0x21, + 0x00,0x3E,0x22,0x24,0xE4,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xBFA5 [?] [2825]*/ + 0x00,0xF8,0x08,0x49,0x4B,0x48,0x48,0x7D,0x06,0x04,0x1D,0xE6,0x44,0x04,0x29,0x16, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xBFA6 [?] [2826]*/ + 0x00,0x00,0x7B,0x4A,0x48,0x48,0x49,0x4A,0x48,0x49,0x7E,0x49,0x01,0x01,0x01,0x01, + 0x40,0x20,0xFE,0x02,0x80,0xF8,0x08,0x90,0x60,0x98,0x06,0xF8,0x08,0x08,0xF8,0x08, + /* 0xBFA7 [?] [2827]*/ + 0x04,0x04,0xF4,0x94,0x9F,0x94,0x94,0x94,0x94,0x94,0xF4,0x94,0x08,0x08,0x12,0x21, + 0x00,0x00,0x00,0x3C,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xBC,0xA4,0x00, + /* 0xBFA8 [?] [2828]*/ + 0x02,0x02,0x03,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x40,0x20,0x10,0x08,0x00,0x00,0x00, + /* 0xBFA9 [?] [2829]*/ + 0x00,0x00,0x78,0x49,0x4B,0x4C,0x48,0x48,0x49,0x4A,0x7D,0x49,0x01,0x01,0x01,0x01, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBFAA [?] [2830]*/ + 0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xBFAB [?] [2831]*/ + 0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x14,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x10,0x12,0xD4,0x18,0x52,0x92,0x2E,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xBFAC [?] [2832]*/ + 0x11,0x11,0x11,0x11,0xFD,0x11,0x31,0x38,0x55,0x51,0x91,0x11,0x11,0x11,0x11,0x11, + 0x10,0x12,0xD4,0x18,0x52,0x92,0x2E,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xBFAD [?] [2833]*/ + 0x10,0x92,0x92,0x92,0xFE,0x00,0xFE,0x02,0x02,0x7E,0x40,0x40,0x46,0x59,0x61,0x02, + 0x00,0xF0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xBFAE [?] [2834]*/ + 0x20,0x27,0x24,0x24,0x37,0xAC,0xA4,0xA7,0xA4,0x25,0x24,0x25,0x26,0x24,0x20,0x20, + 0x00,0xBE,0x88,0x88,0xA8,0xA8,0xA8,0xBE,0x10,0x18,0x98,0xA8,0xAA,0x4A,0x46,0x80, + /* 0xBFAF [?] [2835]*/ + 0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xBFB0 [?] [2836]*/ + 0x10,0x10,0x13,0x10,0x10,0xFC,0x10,0x10,0x10,0x13,0x11,0x1D,0xE1,0x41,0x01,0x00, + 0x88,0x88,0xFE,0x88,0xF8,0x88,0xF8,0x88,0x88,0xFE,0x00,0x48,0x84,0x00,0xFE,0x00, + /* 0xBFB1 [?] [2837]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x22,0x3E,0x22,0x22,0xFF,0x40,0x54,0x62,0x40,0x7F,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xBFB2 [?] [2838]*/ + 0x10,0x10,0x10,0x10,0x11,0xFD,0x12,0x14,0x10,0x10,0x10,0x1D,0xE1,0x42,0x04,0x08, + 0x80,0x80,0x80,0xFC,0x04,0x08,0x40,0x40,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xBFB3 [?] [2839]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3D,0x64,0x64,0xA4,0x24,0x24,0x3C,0x24,0x21,0x02, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xBFB4 [?] [2840]*/ + 0x00,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x08,0x1F,0x28,0x4F,0x88,0x0F,0x08,0x0F,0x08, + 0xF8,0x00,0x00,0xF8,0x00,0xFE,0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xBFB5 [?] [2841]*/ + 0x01,0x00,0x3F,0x20,0x2F,0x20,0x3F,0x20,0x2F,0x28,0x24,0x22,0x44,0x48,0x92,0x01, + 0x00,0x80,0xFE,0x80,0xF8,0x88,0xFE,0x88,0xF8,0x80,0xC4,0xA8,0x90,0x88,0x86,0x00, + /* 0xBFB6 [?] [2842]*/ + 0x20,0x20,0x27,0x24,0x35,0xAC,0xA7,0xA4,0xA5,0x24,0x25,0x24,0x29,0x2A,0x30,0x20, + 0x40,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0x62,0xB4,0x28,0x26,0xA0,0x40, + /* 0xBFB7 [?] [2843]*/ + 0x10,0x10,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x12,0x12,0x14, + 0x20,0x10,0xFE,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x92,0x54,0x38,0x54,0x92,0x30, + /* 0xBFB8 [?] [2844]*/ + 0x10,0x10,0x11,0x10,0xFE,0x10,0x10,0x12,0x1C,0x30,0xD0,0x10,0x10,0x10,0x53,0x20, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBFB9 [?] [2845]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBFBA [?] [2846]*/ + 0x02,0x01,0x01,0xFF,0x00,0x00,0x0F,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0x00,0x00,0xFE,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xBFBB [?] [2847]*/ + 0x10,0x10,0x10,0x13,0x54,0x58,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x46,0x42,0x84, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBFBC [?] [2848]*/ + 0x02,0x02,0x3F,0x02,0x02,0xFF,0x01,0x02,0x0F,0x12,0x24,0x47,0x80,0x00,0x00,0x00, + 0x00,0x08,0xD0,0x20,0x40,0xFE,0x00,0x00,0xF8,0x00,0x00,0xF0,0x10,0x10,0xA0,0x40, + /* 0xBFBD [?] [2849]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x10,0x14,0x19,0x32,0xD4,0x10,0x10,0x10,0x50,0x20, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xBFBE [?] [2850]*/ + 0x10,0x10,0x11,0x10,0x54,0x5B,0x50,0x90,0x11,0x12,0x14,0x28,0x24,0x44,0x40,0x80, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xBFBF [?] [2851]*/ + 0x11,0x1F,0x21,0xFF,0x00,0x1F,0x10,0x1F,0x04,0x7C,0x04,0x3C,0x04,0x7C,0x04,0x04, + 0x00,0xF0,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x40, + /* 0xBFC0 [?] [2852]*/ + 0x20,0x20,0x27,0x20,0x20,0xFB,0x22,0x22,0x22,0x22,0x23,0x3A,0xE0,0x40,0x00,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0xC8,0x48,0x08,0x08,0x28,0x10, + /* 0xBFC1 [?] [2853]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x00,0x00,0x1F,0x11,0x11,0x1F,0x11,0x00,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xBFC2 [?] [2854]*/ + 0x10,0x10,0x17,0x10,0xFC,0x13,0x32,0x3A,0x56,0x52,0x93,0x12,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0xC8,0x48,0x08,0x08,0x28,0x10, + /* 0xBFC3 [?] [2855]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x54,0x53,0x90,0x10,0x11,0x12,0x10,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xBFC4 [?] [2856]*/ + 0x00,0x00,0xFC,0x10,0x10,0x21,0x3C,0x64,0x65,0xA4,0x25,0x25,0x3D,0x25,0x23,0x00, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x40,0x84,0xFE,0x02,0xFC,0x54,0x54,0x54,0xFE,0x00, + /* 0xBFC5 [?] [2857]*/ + 0x00,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x08,0xFF,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x00,0x7E,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xBFC6 [?] [2858]*/ + 0x08,0x1D,0xF0,0x10,0x10,0xFD,0x10,0x38,0x34,0x50,0x53,0x90,0x10,0x10,0x10,0x10, + 0x10,0x10,0x90,0x90,0x10,0x10,0x90,0x90,0x10,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10, + /* 0xBFC7 [?] [2859]*/ + 0x01,0x01,0x7F,0x01,0x01,0x1F,0x00,0x7F,0x40,0x80,0x0F,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xFC,0x00,0x00,0xF0,0x00,0xFE,0x02,0x04,0xE0,0x20,0x20,0x22,0x22,0x1E, + /* 0xBFC8 [?] [2860]*/ + 0x00,0x00,0xF0,0x97,0x90,0x90,0x91,0x93,0x90,0x90,0xF1,0x96,0x00,0x00,0x01,0x06, + 0x40,0x20,0x20,0xFE,0x40,0x84,0x08,0xF0,0x22,0x44,0x88,0x10,0x20,0x50,0x88,0x04, + /* 0xBFC9 [?] [2861]*/ + 0x00,0x7F,0x00,0x00,0x1F,0x11,0x11,0x11,0x11,0x11,0x1F,0x11,0x00,0x00,0x00,0x00, + 0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xBFCA [?] [2862]*/ + 0x00,0x23,0x12,0x13,0x82,0x43,0x49,0x0B,0x14,0x12,0xE2,0x22,0x23,0x20,0x20,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xBFCB [?] [2863]*/ + 0x01,0x01,0xFF,0x01,0x01,0x3F,0x20,0x20,0x20,0x3F,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xBFCC [?] [2864]*/ + 0x10,0x08,0x00,0xFF,0x08,0x11,0x21,0x7E,0x04,0x09,0x12,0x24,0xCC,0x12,0x21,0xC0, + 0x04,0x04,0x04,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x88, + /* 0xBFCD [?] [2865]*/ + 0x02,0x01,0x7F,0x40,0x88,0x0F,0x10,0x2C,0x03,0x1C,0xE0,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x02,0x04,0xF0,0x20,0x40,0x80,0x70,0x0E,0xF0,0x10,0x10,0xF0,0x10, + /* 0xBFCE [?] [2866]*/ + 0x00,0x43,0x22,0x22,0x03,0x02,0xE2,0x23,0x20,0x27,0x20,0x29,0x32,0x24,0x00,0x00, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xBFCF [?] [2867]*/ + 0x01,0x01,0x11,0x11,0x11,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xBFD0 [?] [2868]*/ + 0x00,0x01,0x79,0x49,0x49,0x4F,0x48,0x4B,0x4A,0x4B,0x7A,0x4B,0x02,0x02,0x02,0x02, + 0x20,0x20,0x3C,0x20,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xBFD1 [?] [2869]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x3F,0x22,0x21,0x2C,0x31,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x08,0x90,0x60,0x1C,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xBFD2 [?] [2870]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x3F,0x22,0x21,0x2C,0x30,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x08,0x90,0x60,0x1C,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xBFD3 [?] [2871]*/ + 0x10,0x10,0x10,0x13,0x10,0xFC,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBFD4 [?] [2872]*/ + 0x00,0x00,0x78,0x4F,0x48,0x48,0x49,0x49,0x49,0x49,0x79,0x49,0x02,0x02,0x04,0x08, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xBFD5 [?] [2873]*/ + 0x02,0x01,0x7F,0x40,0x88,0x10,0x20,0x00,0x1F,0x01,0x01,0x01,0x01,0x01,0x7F,0x00, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x08,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xBFD6 [?] [2874]*/ + 0x00,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE2,0x44,0x08,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xF0,0x10,0x10,0x90,0x50,0x12,0x12,0x0E,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xBFD7 [?] [2875]*/ + 0x00,0x7E,0x02,0x04,0x08,0x08,0x0A,0x0C,0x38,0xC8,0x08,0x08,0x08,0x08,0x28,0x10, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xBFD8 [?] [2876]*/ + 0x10,0x10,0x10,0x13,0xFA,0x14,0x11,0x1A,0x30,0xD1,0x10,0x10,0x10,0x10,0x57,0x20, + 0x40,0x20,0x20,0xFE,0x02,0x94,0x08,0x04,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBFD9 [?] [2877]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x20, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xBFDA [?] [2878]*/ + 0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00, + /* 0xBFDB [?] [2879]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x20, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xBFDC [?] [2880]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3E,0x00,0x00,0x7E,0x14,0x14,0x14,0x14,0x24,0x24,0x43, + 0x00,0x00,0xFE,0x02,0x24,0x38,0x20,0x20,0xF8,0x08,0x50,0x20,0x54,0x84,0x04,0xFC, + /* 0xBFDD [?] [2881]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x38,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xBFDE [?] [2882]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x00,0x01,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x78,0x48,0x48,0x48,0x78,0x00,0x10,0x08,0xFE,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xBFDF [?] [2883]*/ + 0x02,0x01,0x7F,0x48,0x90,0x3F,0x20,0x3F,0x20,0x24,0x24,0x27,0x20,0x48,0x48,0x8F, + 0x00,0x00,0xFE,0x22,0x14,0xF8,0x08,0xF8,0x80,0x90,0x90,0xF0,0x80,0x88,0x88,0xF8, + /* 0xBFE0 [?] [2884]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x01,0xFF,0x01,0x01,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xBFE1 [?] [2885]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x10,0x50,0x50,0x7C,0x50,0x90,0x10,0xFE,0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xBFE2 [?] [2886]*/ + 0x01,0x00,0x3F,0x21,0x21,0x3F,0x22,0x24,0x28,0x2F,0x20,0x20,0x5F,0x40,0x80,0x00, + 0x00,0x80,0xFE,0x00,0x00,0xFC,0x00,0x80,0x80,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80, + /* 0xBFE3 [?] [2887]*/ + 0x20,0x10,0x01,0xFD,0x09,0x11,0x11,0x35,0x59,0x95,0x15,0x11,0x11,0x12,0x12,0x14, + 0x10,0x08,0xFE,0x10,0x10,0xFE,0x20,0x28,0x48,0x7E,0x08,0x08,0xFE,0x08,0x08,0x08, + /* 0xBFE4 [?] [2888]*/ + 0x01,0x01,0x7F,0x04,0x08,0x17,0x20,0xC0,0x3F,0x04,0x08,0x0F,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x40,0x20,0xD0,0x08,0x06,0xF8,0x00,0x00,0xF0,0x10,0x10,0xA0,0x40, + /* 0xBFE5 [?] [2889]*/ + 0x20,0x20,0x27,0x20,0x21,0xFA,0x2D,0x20,0x27,0x20,0x21,0x3B,0xE0,0x40,0x00,0x00, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xF6,0x00,0xFC,0x80,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xBFE6 [?] [2890]*/ + 0x20,0x20,0x27,0x20,0xF1,0x22,0x2D,0x20,0x37,0xE0,0x21,0x23,0x20,0x20,0xA0,0x40, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xF6,0x00,0xFC,0x80,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xBFE7 [?] [2891]*/ + 0x00,0x78,0x4B,0x48,0x48,0x79,0x16,0x10,0x53,0x5C,0x50,0x51,0x58,0xE0,0x00,0x00, + 0x20,0x20,0xFE,0x50,0x88,0x04,0xFA,0x00,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xBFE8 [?] [2892]*/ + 0x00,0x3C,0x25,0x24,0x24,0x3D,0x26,0x24,0x27,0x3C,0x24,0x25,0x24,0x44,0x54,0x88, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFA,0x00,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xBFE9 [?] [2893]*/ + 0x10,0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x13,0x10,0x10,0x1C,0xE1,0x42,0x04,0x08, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x04,0x02, + /* 0xBFEA [?] [2894]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x11,0x18,0x54,0x50,0x53,0x90,0x10,0x11,0x12,0x14, + 0x40,0x40,0x7E,0x90,0x08,0x40,0xF8,0x48,0x48,0x48,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xBFEB [?] [2895]*/ + 0x08,0x08,0x08,0x11,0x12,0x34,0x31,0x50,0x90,0x17,0x10,0x10,0x11,0x12,0x17,0x12, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xBFEC [?] [2896]*/ + 0x10,0x10,0x10,0x13,0x18,0x54,0x50,0x50,0x97,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x06, + /* 0xBFED [?] [2897]*/ + 0x02,0x01,0x7F,0x40,0x84,0x3F,0x04,0x00,0x1F,0x10,0x11,0x11,0x12,0x04,0x18,0xE0, + 0x00,0x00,0xFE,0x02,0x44,0xF8,0x40,0x00,0xF0,0x10,0x10,0x10,0x90,0x82,0x82,0x7E, + /* 0xBFEE [?] [2898]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7E,0x00,0x7E,0x00,0xFF,0x08,0x4A,0x49,0x89,0x28,0x11, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xBFEF [?] [2899]*/ + 0x00,0x7F,0x40,0x40,0x4F,0x40,0x40,0x47,0x40,0x40,0x40,0x4F,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x00,0xF8,0x80,0x80,0xF0,0x80,0x80,0x80,0xF8,0x00,0x00,0xFE,0x00, + /* 0xBFF0 [?] [2900]*/ + 0x20,0x3F,0x48,0x85,0x00,0x3F,0x20,0x2F,0x20,0x20,0x27,0x20,0x20,0x2F,0x20,0x3F, + 0x40,0x7E,0x90,0x08,0x00,0xFE,0x00,0xFC,0x80,0x80,0xF8,0x80,0x80,0xFC,0x00,0xFE, + /* 0xBFF1 [?] [2901]*/ + 0x00,0x44,0x29,0x10,0x28,0x48,0x88,0x08,0x19,0x28,0x48,0x88,0x08,0x08,0x53,0x20, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xBFF2 [?] [2902]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x10, + 0x00,0xFE,0x00,0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0x10,0xFE,0x00,0x00,0xFE,0x00, + /* 0xBFF3 [?] [2903]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3C,0x25,0x21,0x02, + 0x20,0x10,0x10,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00, + /* 0xBFF4 [?] [2904]*/ + 0x00,0x01,0x7D,0x45,0x45,0x7D,0x45,0x45,0x7D,0x45,0x45,0x45,0x7D,0x45,0x01,0x00, + 0x00,0xFE,0x00,0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0x10,0xFE,0x00,0x00,0xFE,0x00, + /* 0xBFF5 [?] [2905]*/ + 0x00,0x00,0x78,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x49,0x79,0x49,0x02,0x02,0x04, + 0x40,0x20,0x20,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xBFF6 [?] [2906]*/ + 0x00,0x47,0x24,0x24,0x04,0x04,0x17,0x11,0x21,0xE1,0x21,0x22,0x22,0x24,0x28,0x10, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xBFF7 [?] [2907]*/ + 0x00,0x3F,0x00,0x00,0x00,0xFF,0x04,0x04,0x08,0x0F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xBFF8 [?] [2908]*/ + 0x04,0x04,0x7F,0x08,0x12,0x12,0x24,0x41,0x82,0x0C,0x00,0x3F,0x24,0x24,0x24,0xFF, + 0x00,0x00,0xFC,0x40,0x48,0x50,0xA0,0x10,0x08,0x06,0x00,0xF8,0x48,0x48,0x48,0xFE, + /* 0xBFF9 [?] [2909]*/ + 0x01,0x21,0x21,0x3F,0x00,0x08,0x4B,0x48,0x48,0x48,0x49,0x48,0x48,0x10,0x13,0x20, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xBFFA [?] [2910]*/ + 0x02,0x01,0x7F,0x48,0x90,0x00,0x11,0x7D,0x11,0x11,0xFD,0x11,0x28,0x24,0x41,0x86, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xFC,0x04,0x24,0x24,0x24,0x54,0x50,0x90,0x12,0x0E, + /* 0xBFFB [?] [2911]*/ + 0x08,0xFF,0x08,0x00,0x7E,0x04,0x28,0x10,0x2F,0xC1,0x01,0x7F,0x01,0x02,0x0C,0x70, + 0x20,0xFE,0x20,0x90,0xA0,0x44,0x28,0x10,0xE8,0x06,0x00,0xFC,0x00,0xC0,0x30,0x08, + /* 0xBFFC [?] [2912]*/ + 0x02,0x02,0x7F,0x04,0x09,0x31,0xCF,0x01,0x01,0x7F,0x00,0x01,0x3F,0x01,0x01,0xFF, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE, + /* 0xBFFD [?] [2913]*/ + 0x08,0x10,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x10,0x1A,0x2C,0x2F,0x48,0x48,0x87, + 0x08,0x48,0x28,0x28,0x08,0x48,0x28,0x28,0x0E,0xF8,0x08,0x88,0x88,0x08,0x02,0xFE, + /* 0xBFFE [?] [2914]*/ + 0x10,0x10,0x17,0x24,0x24,0x67,0x64,0xA4,0x27,0x20,0x21,0x21,0x22,0x24,0x28,0x30, + 0x40,0x80,0xFC,0x44,0x44,0xFC,0x44,0x84,0xFC,0x80,0x50,0x64,0x7C,0x42,0x42,0x3E, + /* 0xC0A1 [?] [2915]*/ + 0x20,0x20,0x21,0x3D,0x45,0x48,0x83,0x20,0x21,0x21,0x21,0x25,0x29,0x30,0x20,0x03, + 0x20,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xC0A2 [?] [2916]*/ + 0x20,0x20,0x27,0x24,0x34,0xAF,0xA4,0xA4,0xA7,0x20,0x21,0x21,0x22,0x24,0x28,0x30, + 0x40,0x80,0xFC,0x44,0x44,0xFC,0x44,0x84,0xFC,0x80,0x50,0x64,0x7C,0x42,0x42,0x3E, + /* 0xC0A3 [?] [2917]*/ + 0x00,0x20,0x13,0x12,0x83,0x40,0x4F,0x10,0x13,0x22,0xE2,0x22,0x22,0x20,0x21,0x06, + 0x40,0x40,0xF8,0x48,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0x48,0xA0,0x10,0x08, + /* 0xC0A4 [?] [2918]*/ + 0x10,0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x40,0x00,0x00, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xC0A5 [?] [2919]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x00,0x20,0x20,0x3E,0x20,0x20,0x26,0x38, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x80,0x84,0x98,0xE0,0x84,0x84,0x7C, + /* 0xC0A6 [?] [2920]*/ + 0x20,0x27,0x24,0x24,0xFC,0x27,0x24,0x2C,0x34,0xE5,0x26,0x24,0x24,0x24,0xA7,0x44, + 0x00,0xFC,0x44,0x44,0x44,0xFC,0x44,0xC4,0xE4,0x54,0x44,0x44,0x44,0x04,0xFC,0x04, + /* 0xC0A7 [?] [2921]*/ + 0x00,0x7F,0x41,0x41,0x41,0x5F,0x41,0x43,0x43,0x45,0x49,0x51,0x41,0x41,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x84,0x44,0x24,0x14,0x14,0x04,0x04,0xFC,0x04, + /* 0xC0A8 [?] [2922]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x10,0x14,0x18,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC0A9 [?] [2923]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x20,0x10,0x10,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC0AA [?] [2924]*/ + 0x00,0x3F,0x22,0x3F,0x20,0x2F,0x28,0x2F,0x20,0x2F,0x21,0x23,0x5E,0x42,0x8A,0x04, + 0x80,0xFE,0x00,0xBC,0x24,0xA4,0xA8,0xA8,0x24,0xA4,0x24,0xF4,0x28,0x20,0x20,0x20, + /* 0xC0AB [?] [2925]*/ + 0x20,0x17,0x00,0x48,0x45,0x64,0x50,0x51,0x44,0x48,0x79,0x49,0x49,0x49,0x40,0x40, + 0x00,0xFC,0x04,0x34,0xC4,0x44,0x44,0xF4,0x44,0x44,0xF4,0x14,0x14,0xF4,0x04,0x0C, + /* 0xC0AC [?] [2926]*/ + 0x10,0x10,0x10,0x10,0x13,0xFC,0x10,0x11,0x11,0x10,0x10,0x1C,0xE0,0x40,0x07,0x00, + 0x80,0x40,0x40,0x00,0xFC,0x00,0x08,0x08,0x08,0x90,0x90,0x90,0xA0,0x20,0xFE,0x00, + /* 0xC0AD [?] [2927]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x14,0x19,0x31,0xD0,0x10,0x10,0x10,0x10,0x57,0x20, + 0x40,0x20,0x20,0x00,0xFE,0x00,0x04,0x04,0x04,0x88,0x88,0x88,0x90,0x10,0xFE,0x00, + /* 0xC0AE [?] [2928]*/ + 0x01,0x01,0x77,0x51,0x51,0x57,0x55,0x55,0x57,0x51,0x73,0x55,0x09,0x01,0x01,0x01, + 0x04,0x04,0xC4,0x04,0x14,0xD4,0x54,0x54,0xD4,0x14,0x94,0x54,0x44,0x04,0x14,0x08, + /* 0xC0AF [?] [2929]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x55,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x48,0x48,0x48,0xFE,0x48,0x48,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xC0B0 [?] [2930]*/ + 0x00,0x78,0x48,0x4B,0x48,0x78,0x4F,0x48,0x49,0x79,0x49,0x49,0x49,0x49,0x49,0x99, + 0x88,0x88,0x88,0xFE,0x88,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xC0B1 [?] [2931]*/ + 0x20,0x10,0x11,0xFC,0x00,0x45,0x29,0xFD,0x11,0x10,0xFC,0x10,0x21,0x22,0x40,0x80, + 0x20,0x20,0xFC,0x20,0x20,0xFC,0x24,0x24,0xFC,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xC0B2 [?] [2932]*/ + 0x01,0x01,0x71,0x51,0x57,0x51,0x51,0x51,0x51,0x53,0x75,0x51,0x01,0x01,0x05,0x02, + 0x20,0x10,0x10,0x7E,0x80,0x04,0x44,0xC4,0x24,0x24,0x28,0x28,0x08,0x10,0x7E,0x00, + /* 0xC0B3 [?] [2933]*/ + 0x08,0x08,0xFF,0x09,0x01,0x3F,0x01,0x11,0x09,0x7F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0x10,0x20,0xFC,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xC0B4 [?] [2934]*/ + 0x01,0x01,0x01,0x7F,0x01,0x11,0x09,0x09,0xFF,0x03,0x05,0x09,0x31,0xC1,0x01,0x01, + 0x00,0x00,0x00,0xFC,0x00,0x10,0x10,0x20,0xFE,0x80,0x40,0x20,0x18,0x06,0x00,0x00, + /* 0xC0B5 [?] [2935]*/ + 0x10,0x10,0xFE,0x11,0x12,0x7D,0x55,0x55,0x55,0x7D,0x11,0x39,0x54,0x90,0x11,0x12, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x88,0x04,0x02, + /* 0xC0B6 [?] [2936]*/ + 0x08,0x08,0xFF,0x08,0x04,0x24,0x24,0x24,0x25,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x80,0x80,0xFC,0xA0,0x10,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xC0B7 [?] [2937]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC9,0x08,0x0A,0x7F,0x04,0x08,0x1C,0x03,0x06,0x38, + 0x20,0x20,0xFC,0x30,0x68,0xA4,0x22,0x20,0x20,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xC0B8 [?] [2938]*/ + 0x10,0x11,0x10,0x10,0xFC,0x13,0x30,0x38,0x54,0x55,0x90,0x10,0x10,0x10,0x13,0x10, + 0x00,0x08,0x88,0x90,0x00,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC0B9 [?] [2939]*/ + 0x10,0x11,0x10,0x10,0xFC,0x13,0x10,0x14,0x18,0x31,0xD0,0x10,0x10,0x10,0x53,0x20, + 0x00,0x08,0x88,0x90,0x00,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC0BA [?] [2940]*/ + 0x20,0x3F,0x48,0x85,0x04,0x24,0x24,0x24,0x25,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x40,0x7E,0x90,0x08,0x80,0x80,0xFC,0xA0,0x10,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xC0BB [?] [2941]*/ + 0x20,0x17,0x01,0x41,0x5F,0x41,0x5F,0x51,0x55,0x53,0x5F,0x45,0x49,0x51,0x41,0x41, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0xF4,0x14,0x54,0x94,0xF4,0x44,0x24,0x24,0x04,0x0C, + /* 0xC0BC [?] [2942]*/ + 0x10,0x08,0x04,0x04,0x00,0x7F,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x00, + 0x10,0x10,0x20,0x40,0x00,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC0BD [?] [2943]*/ + 0x02,0x21,0x15,0x14,0x85,0x44,0x45,0x15,0x15,0x25,0xE5,0x25,0x24,0x25,0x24,0x04, + 0x00,0x7C,0x04,0x44,0xF4,0x44,0xF4,0x54,0x74,0xD4,0x54,0xF4,0xE4,0x54,0x44,0x4C, + /* 0xC0BE [?] [2944]*/ + 0x02,0x41,0x25,0x24,0x05,0x04,0xE5,0x25,0x25,0x25,0x25,0x25,0x2C,0x35,0x24,0x04, + 0x00,0x7C,0x04,0x44,0xF4,0x44,0xF4,0x54,0x74,0xD4,0x54,0xF4,0xE4,0x54,0x44,0x4C, + /* 0xC0BF [?] [2945]*/ + 0x10,0x12,0x12,0x12,0xFA,0x10,0x15,0x19,0x31,0xD1,0x11,0x11,0x10,0x10,0x51,0x26, + 0x90,0x90,0x9E,0xA8,0xC4,0x80,0xFC,0x04,0x24,0x24,0x24,0x54,0x50,0x90,0x12,0x0E, + /* 0xC0C0 [?] [2946]*/ + 0x04,0x24,0x24,0x24,0x25,0x04,0x1F,0x10,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0x40,0x40,0x7C,0x90,0x08,0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x80,0x84,0x84,0x7C, + /* 0xC0C1 [?] [2947]*/ + 0x22,0x22,0x2F,0x22,0x32,0xAF,0xAA,0xAA,0xAF,0x22,0x27,0x2A,0x32,0x22,0x22,0x22, + 0x10,0x10,0x9C,0x24,0x48,0xBE,0xA2,0xAA,0xAA,0x2A,0x2A,0xAA,0x88,0x14,0x22,0x42, + /* 0xC0C2 [?] [2948]*/ + 0x10,0x12,0x22,0x22,0x4A,0xF8,0x11,0x21,0x41,0xF9,0x41,0x01,0x18,0xE0,0x41,0x06, + 0x90,0x90,0x9E,0xA8,0xC4,0x80,0xFC,0x04,0x24,0x24,0x24,0x54,0x50,0x90,0x12,0x0E, + /* 0xC0C3 [?] [2949]*/ + 0x10,0x11,0x10,0x14,0x58,0x53,0x50,0x90,0x10,0x11,0x10,0x28,0x24,0x40,0x43,0x80, + 0x00,0x08,0x88,0x90,0x00,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC0C4 [?] [2950]*/ + 0x00,0x24,0x14,0x14,0x84,0x44,0x44,0x10,0x10,0x27,0xE4,0x24,0x24,0x24,0x2F,0x00, + 0x90,0x90,0x9E,0x90,0xA8,0xA4,0xC4,0x80,0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xFE,0x00, + /* 0xC0C5 [?] [2951]*/ + 0x00,0x00,0xFD,0x11,0x11,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xC0C6 [?] [2952]*/ + 0x11,0x10,0x13,0x12,0xFE,0x13,0x32,0x3A,0x57,0x52,0x92,0x12,0x12,0x13,0x12,0x10, + 0x00,0x9E,0xD2,0x52,0x54,0xD4,0x58,0x54,0xD2,0x12,0x92,0x5A,0xD4,0x50,0x10,0x10, + /* 0xC0C7 [?] [2953]*/ + 0x00,0x44,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x51,0x21, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xC0C8 [?] [2954]*/ + 0x01,0x00,0x3F,0x22,0x21,0x2F,0x28,0x2F,0x28,0x2F,0x2A,0x29,0x2A,0x4C,0x48,0x80, + 0x00,0x80,0xFE,0x00,0x00,0xBE,0xA2,0xA4,0xA8,0xA4,0x22,0x22,0xAA,0xA4,0x20,0x20, + /* 0xC0C9 [?] [2955]*/ + 0x08,0x04,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x20,0x24,0x22,0x25,0x29,0x30,0x20, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xC0CA [?] [2956]*/ + 0x10,0x08,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x40,0x48,0x44,0x5A,0x62,0x41,0x02, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x84,0x84,0x14,0x08, + /* 0xC0CB [?] [2957]*/ + 0x00,0x20,0x13,0x12,0x82,0x43,0x4A,0x0A,0x13,0x12,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x80,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x40,0x44,0x28,0x10,0x88,0x06,0x00, + /* 0xC0CC [?] [2958]*/ + 0x10,0x10,0x13,0x10,0xFC,0x13,0x12,0x14,0x18,0x33,0xD0,0x10,0x10,0x11,0x52,0x24, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x44,0x40,0xFC,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xC0CD [?] [2959]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x42,0x82,0x3F,0x02,0x02,0x04,0x04,0x08,0x10,0x20, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xC0CE [?] [2960]*/ + 0x02,0x01,0x7F,0x40,0x81,0x11,0x11,0x1F,0x21,0x41,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0xFE,0x02,0x04,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xC0CF [?] [2961]*/ + 0x02,0x02,0x3F,0x02,0x02,0xFF,0x01,0x02,0x0C,0x18,0x2F,0x48,0x88,0x08,0x07,0x00, + 0x00,0x08,0xD0,0x20,0x40,0xFE,0x00,0x00,0x10,0xE0,0x00,0x08,0x08,0x08,0xF8,0x00, + /* 0xC0D0 [?] [2962]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x37,0x50,0x90,0x11,0x12,0x14,0x18,0x10,0x10,0x10, + 0x40,0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0x84,0x98,0xE0,0x82,0x82,0x7E,0x00, + /* 0xC0D1 [?] [2963]*/ + 0x10,0x10,0x10,0x11,0xFC,0x24,0x27,0x24,0x24,0x49,0x2A,0x10,0x28,0x44,0x84,0x00, + 0x40,0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0x84,0x98,0xE0,0x82,0x82,0x7E,0x00, + /* 0xC0D2 [?] [2964]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x20,0x3C,0x44,0xA8,0x10,0x28,0x44,0x82,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xC0D3 [?] [2965]*/ + 0x10,0x10,0x10,0x15,0x5B,0x54,0x50,0x90,0x11,0x12,0x15,0x29,0x25,0x45,0x41,0x81, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC0D4 [?] [2966]*/ + 0x01,0x21,0x17,0x11,0x80,0x47,0x54,0x18,0x10,0x27,0xE0,0x21,0x21,0x22,0x24,0x08, + 0x08,0x08,0xFE,0x08,0x00,0xFE,0x02,0x84,0x80,0xFC,0x84,0x04,0x04,0x04,0x28,0x10, + /* 0xC0D5 [?] [2967]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x08,0x7F,0x49,0x49,0x7F,0x08,0xFF,0x08,0x08,0x09,0x0A, + 0x20,0x20,0xA0,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0xC4,0x44,0x84,0x28,0x10, + /* 0xC0D6 [?] [2968]*/ + 0x00,0x00,0x1F,0x10,0x11,0x21,0x21,0x3F,0x01,0x09,0x09,0x11,0x21,0x41,0x05,0x02, + 0x20,0xF0,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x20,0x10,0x08,0x04,0x04,0x00,0x00, + /* 0xC0D7 [?] [2969]*/ + 0x00,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F, + 0x00,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8, + /* 0xC0D8 [?] [2970]*/ + 0x10,0x11,0x3C,0x23,0x42,0xBD,0x10,0x11,0xFC,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC, + /* 0xC0D9 [?] [2971]*/ + 0x08,0xFF,0x08,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x21,0x3F,0x21,0x3F, + 0x20,0xFE,0x20,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xC0DA [?] [2972]*/ + 0x7F,0x04,0x08,0x1F,0x28,0x48,0x8F,0x00,0x7E,0x10,0x20,0x7E,0xA3,0x22,0x3E,0x22, + 0xFC,0x00,0x00,0xF0,0x10,0x10,0xF0,0x00,0xFE,0x20,0x40,0xFC,0x44,0x44,0x7C,0x44, + /* 0xC0DB [?] [2973]*/ + 0x00,0x3F,0x21,0x3F,0x21,0x3F,0x02,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xC0DC [?] [2974]*/ + 0x13,0x12,0x12,0x23,0x22,0x62,0x63,0xA0,0x2F,0x2A,0x2A,0x2F,0x2A,0x2A,0x2F,0x28, + 0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x00,0xBE,0xAA,0xAA,0xBE,0xAA,0xAA,0xBE,0xA2, + /* 0xC0DD [?] [2975]*/ + 0x04,0x08,0x10,0x3F,0x08,0x10,0x24,0x7E,0x02,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x20,0x10,0xF8,0x10,0x20,0x48,0xFC,0x04,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xC0DE [?] [2976]*/ + 0x20,0x27,0x20,0x2F,0xF8,0x23,0x20,0x2B,0x30,0xE7,0x24,0x24,0x27,0x24,0xA4,0x47, + 0x00,0xFC,0x40,0xFE,0x42,0x58,0x40,0x58,0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC, + /* 0xC0DF [?] [2977]*/ + 0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x42,0x4A,0x85, + 0x20,0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x22,0x42,0x42,0x42,0x82,0x94,0x08, + /* 0xC0E0 [?] [2978]*/ + 0x01,0x11,0x09,0x01,0x7F,0x05,0x09,0x11,0x60,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x10,0x20,0x00,0xFC,0x40,0x20,0x10,0x08,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xC0E1 [?] [2979]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x4A,0x0A,0x12,0x13,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC0E2 [?] [2980]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x39,0x56,0x54,0x91,0x12,0x10,0x10,0x11,0x16, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xC0E3 [?] [2981]*/ + 0x10,0x13,0x12,0x12,0xFE,0x13,0x30,0x38,0x57,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x00,0xFC,0x94,0x94,0x94,0xFC,0x80,0x40,0xFE,0x80,0xF8,0x88,0x08,0x08,0x28,0x10, + /* 0xC0E4 [?] [2982]*/ + 0x00,0x40,0x20,0x20,0x01,0x02,0x14,0x10,0x23,0xE0,0x20,0x21,0x20,0x20,0x20,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xC0E5 [?] [2983]*/ + 0x00,0x3F,0x20,0x27,0x24,0x24,0x27,0x24,0x24,0x27,0x20,0x20,0x27,0x40,0x40,0x8F, + 0x00,0xFE,0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0xFC,0x40,0x40,0xFE, + /* 0xC0E6 [?] [2984]*/ + 0x03,0x3C,0x04,0x7F,0x0C,0x16,0x25,0x44,0x05,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x08,0x08,0x48,0x48,0x48,0x48,0x08,0x28,0x10,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC0E7 [?] [2985]*/ + 0x03,0x3C,0x04,0x7F,0x0C,0x16,0x25,0x44,0x05,0x11,0x1F,0x21,0x01,0xFF,0x01,0x01, + 0x08,0x08,0x48,0x48,0x48,0x48,0x08,0x28,0x10,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00, + /* 0xC0E8 [?] [2986]*/ + 0x06,0x38,0x08,0x7E,0x1C,0x2A,0x49,0x02,0x0C,0x31,0xC9,0x05,0x09,0x11,0x25,0x02, + 0x40,0x7C,0x94,0x24,0x44,0x94,0x08,0x80,0x60,0x18,0x26,0x40,0x20,0x10,0x08,0x00, + /* 0xC0E9 [?] [2987]*/ + 0x20,0x3F,0x48,0x85,0x00,0xFF,0x04,0x13,0x14,0x1F,0x01,0x7F,0x44,0x4F,0x44,0x40, + 0x40,0x7E,0x90,0x08,0x80,0xFE,0x40,0x90,0x50,0xF0,0x00,0xFC,0x44,0xE4,0x24,0x0C, + /* 0xC0EA [?] [2988]*/ + 0x00,0x45,0x29,0x11,0x29,0x49,0x89,0x09,0x18,0x28,0x49,0x88,0x08,0x08,0x53,0x20, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC0EB [?] [2989]*/ + 0x02,0x01,0xFF,0x00,0x14,0x13,0x14,0x1F,0x01,0x7F,0x42,0x44,0x4F,0x44,0x40,0x40, + 0x00,0x00,0xFE,0x00,0x50,0x90,0x50,0xF0,0x00,0xFC,0x04,0x44,0xE4,0x24,0x14,0x08, + /* 0xC0EC [?] [2990]*/ + 0x00,0x20,0x17,0x10,0x82,0x42,0x42,0x13,0x10,0x27,0xE4,0x25,0x25,0x24,0x24,0x04, + 0x80,0x40,0xFE,0x00,0xA8,0x48,0xA8,0xF8,0x40,0xFC,0x84,0x24,0xF4,0x14,0x04,0x0C, + /* 0xC0ED [?] [2991]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7D,0x10,0x10,0x11,0x10,0x1C,0xE0,0x43,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC0EE [?] [2992]*/ + 0x01,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x0F,0x00,0x00,0xFF,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00, + /* 0xC0EF [?] [2993]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xC0F0 [?] [2994]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7C,0x54,0x55,0x7C,0x00,0x1C,0xE3,0x40, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC0F1 [?] [2995]*/ + 0x20,0x10,0x10,0xF8,0x08,0x10,0x10,0x38,0x54,0x94,0x10,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xC0F2 [?] [2996]*/ + 0x04,0x04,0xFF,0x04,0x00,0x06,0x78,0x08,0x08,0xFF,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x40,0x40,0xFE,0x40,0x00,0x08,0x08,0x48,0x48,0x48,0x48,0x48,0x48,0x08,0x28,0x10, + /* 0xC0F3 [?] [2997]*/ + 0x08,0xFF,0x0A,0x02,0x3F,0x04,0x18,0x60,0x10,0x10,0x7E,0x12,0x22,0x22,0x4A,0x85, + 0x20,0xFE,0x20,0x00,0xF0,0x10,0xA0,0x40,0x20,0x20,0xFC,0x24,0x44,0x44,0x94,0x08, + /* 0xC0F4 [?] [2998]*/ + 0x01,0x01,0xFF,0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x11,0x09,0x06,0x05,0x18,0xE0, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,0x80,0x70,0x0E, + /* 0xC0F5 [?] [2999]*/ + 0x00,0x7F,0x04,0x04,0x3F,0x24,0x24,0x3F,0x01,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xFC,0x40,0x40,0xF8,0x48,0x48,0xF8,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC0F6 [?] [3000]*/ + 0x00,0xFF,0x00,0x00,0x3E,0x22,0x22,0x22,0x32,0x2A,0x2A,0x22,0x22,0x22,0x2A,0x24, + 0x00,0xFE,0x00,0x00,0xF8,0x88,0x88,0x88,0xC8,0xA8,0xA8,0x88,0x88,0x88,0xA8,0x90, + /* 0xC0F7 [?] [3001]*/ + 0x00,0x3F,0x20,0x20,0x2F,0x21,0x21,0x21,0x21,0x21,0x21,0x22,0x22,0x44,0x48,0x90, + 0x00,0xFE,0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC0F8 [?] [3002]*/ + 0x00,0x7F,0x40,0x40,0x5F,0x48,0x48,0x4F,0x49,0x49,0x49,0x49,0x49,0x51,0x95,0x22, + 0x10,0xD0,0x10,0x10,0x7E,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x22,0x2A,0x44, + /* 0xC0F9 [?] [3003]*/ + 0x00,0x00,0xFD,0x11,0x11,0x21,0x3D,0x65,0x64,0xA4,0x24,0x24,0x3D,0x26,0x20,0x00, + 0x08,0x1C,0xE0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xC0FA [?] [3004]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x2F,0x20,0x20,0x21,0x21,0x22,0x22,0x44,0x48,0x90, + 0x00,0xFE,0x00,0x80,0x80,0x80,0xFC,0x84,0x84,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC0FB [?] [3005]*/ + 0x01,0x07,0x7C,0x04,0x04,0x04,0xFF,0x0C,0x16,0x15,0x24,0x24,0x44,0x84,0x04,0x04, + 0x04,0x84,0x04,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0xA4,0x24,0x04,0x04,0x14,0x08, + /* 0xC0FC [?] [3006]*/ + 0x10,0x17,0x10,0x20,0x27,0x64,0x64,0xA7,0x20,0x20,0x27,0x20,0x21,0x22,0x2C,0x20, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xFC,0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xC0FD [?] [3007]*/ + 0x10,0x10,0x17,0x22,0x22,0x63,0x62,0xA4,0x26,0x25,0x28,0x20,0x21,0x22,0x24,0x28, + 0x04,0x04,0xC4,0x14,0x14,0xD4,0x54,0x54,0x54,0x54,0x94,0x94,0x04,0x04,0x14,0x08, + /* 0xC0FE [?] [3008]*/ + 0x10,0x11,0x17,0x21,0x21,0x61,0x6F,0xA1,0x23,0x23,0x25,0x25,0x29,0x21,0x21,0x21, + 0x84,0xC4,0x04,0x14,0x14,0x14,0xD4,0x14,0x14,0x94,0x54,0x04,0x04,0x04,0x14,0x08, + /* 0xC1A1 [?] [3009]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x51,0x11,0x3F,0x53,0x93,0x15,0x25,0x29,0x41,0x81, + 0x80,0x40,0xFE,0x00,0xC4,0x04,0x14,0x14,0xD4,0x14,0x94,0x54,0x04,0x04,0x14,0x08, + /* 0xC1A2 [?] [3010]*/ + 0x02,0x01,0x01,0x00,0x7F,0x00,0x00,0x10,0x08,0x08,0x04,0x04,0x04,0x00,0xFF,0x00, + 0x00,0x00,0x00,0x00,0xFC,0x00,0x10,0x10,0x20,0x20,0x40,0x40,0x80,0x00,0xFE,0x00, + /* 0xC1A3 [?] [3011]*/ + 0x08,0x08,0x4A,0x2A,0x2D,0x08,0xFE,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x09,0x08, + 0x20,0x10,0x10,0x00,0xFE,0x00,0x04,0x84,0x84,0x48,0x48,0x48,0x50,0x10,0xFE,0x00, + /* 0xC1A4 [?] [3012]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x24,0x24,0x29,0x12, + 0x00,0xFE,0x00,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xC1A5 [?] [3013]*/ + 0x01,0x01,0x3F,0x01,0x01,0xFF,0x01,0x01,0x3F,0x21,0x11,0x05,0x09,0x31,0xC5,0x02, + 0x00,0x00,0xF8,0x08,0x08,0xFE,0x08,0x08,0xF8,0x08,0x90,0x60,0x20,0x18,0x06,0x00, + /* 0xC1A6 [?] [3014]*/ + 0x02,0x02,0x02,0x02,0x7F,0x02,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0x50,0x20, + /* 0xC1A7 [?] [3015]*/ + 0x00,0x00,0xFB,0x20,0x21,0x21,0x21,0xF9,0x20,0x23,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x40,0x20,0xFE,0x00,0x54,0x24,0x54,0xFC,0x20,0xFE,0x42,0x92,0xFA,0x0A,0x02,0x06, + /* 0xC1A8 [?] [3016]*/ + 0x00,0x07,0xF4,0x94,0x97,0x94,0x94,0x97,0x90,0x90,0xF7,0x90,0x00,0x00,0x0F,0x00, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xC1A9 [?] [3017]*/ + 0x10,0x1F,0x11,0x21,0x21,0x6F,0x69,0xA9,0x29,0x2A,0x2A,0x2C,0x28,0x28,0x28,0x28, + 0x00,0xFE,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xA4,0x54,0x4C,0x84,0x04,0x14,0x08, + /* 0xC1AA [?] [3018]*/ + 0x00,0xFC,0x48,0x48,0x79,0x48,0x48,0x78,0x4B,0x48,0x4C,0x78,0xC8,0x08,0x09,0x0A, + 0x88,0x48,0x50,0x00,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC1AB [?] [3019]*/ + 0x08,0x08,0xFF,0x08,0x20,0x17,0x11,0x02,0x73,0x10,0x10,0x17,0x10,0x28,0x47,0x00, + 0x20,0x20,0xFE,0x20,0x80,0xFC,0x40,0x40,0xFC,0x40,0x40,0xFE,0x40,0x40,0xFE,0x00, + /* 0xC1AC [?] [3020]*/ + 0x00,0x20,0x17,0x10,0x00,0x01,0xF3,0x10,0x10,0x10,0x17,0x10,0x10,0x28,0x47,0x00, + 0x40,0x40,0xFE,0x80,0xA0,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFE,0x00, + /* 0xC1AD [?] [3021]*/ + 0x20,0x23,0x3A,0x22,0x43,0x7A,0xA2,0x22,0xFB,0x22,0x22,0x22,0x2A,0x35,0x26,0x08, + 0x20,0xFE,0x88,0x50,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50, + /* 0xC1AE [?] [3022]*/ + 0x01,0x00,0x3F,0x22,0x21,0x2F,0x21,0x27,0x21,0x3F,0x21,0x27,0x23,0x45,0x59,0x81, + 0x00,0x80,0xFE,0x08,0x10,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x30,0x28,0x26,0x20, + /* 0xC1AF [?] [3023]*/ + 0x10,0x10,0x10,0x18,0x55,0x52,0x54,0x90,0x13,0x10,0x10,0x11,0x10,0x10,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xC1B0 [?] [3024]*/ + 0x00,0x24,0x12,0x12,0x80,0x40,0x4E,0x12,0x12,0x22,0xE3,0x22,0x22,0x25,0x28,0x00, + 0x20,0x20,0x20,0xFE,0x40,0x50,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xC1B1 [?] [3025]*/ + 0x02,0x01,0x7F,0x40,0x88,0x10,0x21,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x08,0x00,0xF8,0x08,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xC1B2 [?] [3026]*/ + 0x08,0x08,0x14,0x12,0x21,0x40,0xBE,0x00,0x11,0x09,0x49,0x22,0x22,0x07,0x78,0x21, + 0x20,0x20,0x20,0x3E,0x44,0xC4,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xC1B3 [?] [3027]*/ + 0x00,0x78,0x48,0x48,0x48,0x79,0x4A,0x48,0x48,0x78,0x49,0x48,0x48,0x48,0x4B,0x98, + 0x20,0x20,0x50,0x50,0x88,0x04,0xFA,0x00,0x44,0x24,0x24,0xA8,0x88,0x10,0xFE,0x00, + /* 0xC1B4 [?] [3028]*/ + 0x20,0x22,0x39,0x21,0x40,0x78,0xA7,0x21,0xF9,0x21,0x21,0x21,0x29,0x32,0x24,0x00, + 0x10,0x10,0x10,0x7E,0x20,0x28,0x48,0x7E,0x08,0x08,0xFE,0x08,0x08,0x88,0x7E,0x00, + /* 0xC1B5 [?] [3029]*/ + 0x02,0x01,0xFF,0x04,0x14,0x14,0x24,0x44,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x44,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xC1B6 [?] [3030]*/ + 0x10,0x10,0x17,0x10,0x54,0x5B,0x51,0x92,0x13,0x10,0x11,0x29,0x26,0x44,0x40,0x80, + 0x40,0x40,0xFC,0x80,0x80,0xE0,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xC1B7 [?] [3031]*/ + 0x10,0x10,0x27,0x20,0x48,0xFB,0x11,0x22,0x43,0xF8,0x41,0x01,0x1A,0xE4,0x40,0x00, + 0x40,0x40,0xFC,0x80,0x80,0xE0,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xC1B8 [?] [3032]*/ + 0x10,0x10,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xC1B9 [?] [3033]*/ + 0x00,0x40,0x2F,0x20,0x00,0x03,0x12,0x12,0x23,0xE0,0x22,0x22,0x24,0x28,0x21,0x00, + 0x80,0x40,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xC1BA [?] [3034]*/ + 0x00,0x23,0x10,0x82,0x52,0x24,0xE1,0x22,0x25,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xF0,0x90,0x94,0x92,0x92,0x10,0x50,0x20,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC1BB [?] [3035]*/ + 0x00,0x23,0x90,0x42,0x12,0xE5,0x22,0x24,0x11,0x09,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xF0,0x90,0x94,0x92,0x12,0x50,0x20,0x10,0x20,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xC1BC [?] [3036]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x22,0x21,0x20,0x20,0x24,0x28,0x30, + 0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x08,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xC1BD [?] [3037]*/ + 0x00,0xFF,0x04,0x04,0x04,0x7F,0x44,0x44,0x44,0x4A,0x4A,0x51,0x42,0x40,0x40,0x40, + 0x00,0xFE,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0xA4,0x94,0x14,0x04,0x04,0x14,0x08, + /* 0xC1BE [?] [3038]*/ + 0x20,0x23,0x20,0xFC,0x40,0x53,0x92,0xFE,0x12,0x12,0x1E,0xF3,0x52,0x12,0x12,0x12, + 0x00,0xFE,0x50,0x50,0x50,0xFE,0x52,0x52,0x52,0xAA,0xA6,0x02,0x02,0x02,0x0A,0x04, + /* 0xC1BF [?] [3039]*/ + 0x00,0x1F,0x10,0x1F,0x10,0xFF,0x00,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x1F,0x01,0x7F, + 0x00,0xF0,0x10,0xF0,0x10,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF0,0x00,0xFC, + /* 0xC1C0 [?] [3040]*/ + 0x00,0x00,0x7B,0x48,0x48,0x49,0x49,0x79,0x49,0x49,0x48,0x48,0x79,0x4A,0x00,0x00, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xC1C1 [?] [3041]*/ + 0x02,0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x8F,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xE4,0x20,0x20,0x22,0x22,0x1E, + /* 0xC1C2 [?] [3042]*/ + 0x00,0x20,0x13,0x10,0x00,0x01,0xF1,0x11,0x11,0x11,0x10,0x14,0x19,0x12,0x00,0x00, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xC1C3 [?] [3043]*/ + 0x20,0x20,0x27,0x20,0xF5,0x22,0x27,0x2A,0x33,0xE2,0x23,0x20,0x22,0x24,0xA9,0x40, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xC1C4 [?] [3044]*/ + 0x00,0xFC,0x4B,0x4A,0x7A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4F,0x7A,0xC8,0x08,0x09,0x0A, + 0x00,0x80,0x1E,0x52,0x52,0x52,0x52,0x52,0x52,0xD2,0x5A,0x54,0x90,0x90,0x10,0x10, + /* 0xC1C5 [?] [3045]*/ + 0x10,0x10,0x17,0x20,0x25,0x62,0x67,0xAA,0x23,0x22,0x23,0x20,0x22,0x24,0x29,0x20, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xC1C6 [?] [3046]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x30,0x50,0x90,0x10,0x20,0x20,0x41,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xC1C7 [?] [3047]*/ + 0x20,0x20,0x27,0x20,0xAD,0xB2,0xA7,0xAA,0x23,0x22,0x23,0x20,0x52,0x4C,0x49,0x80, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xC1C8 [?] [3048]*/ + 0x01,0x7F,0x40,0xBC,0x24,0x14,0x25,0x06,0x18,0xE3,0x0C,0x31,0x06,0x38,0x07,0x38, + 0x00,0xFE,0x02,0xFC,0x48,0x28,0x48,0xC0,0x30,0x0E,0x40,0x80,0x30,0xC0,0x00,0x00, + /* 0xC1C9 [?] [3049]*/ + 0x00,0x23,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x11,0x10,0x28,0x47,0x00, + 0x00,0xF8,0x10,0x20,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x00,0xFE,0x00, + /* 0xC1CA [?] [3050]*/ + 0x00,0x20,0x17,0x10,0x85,0x42,0x47,0x1A,0x13,0x22,0xE3,0x20,0x22,0x24,0x29,0x00, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xC1CB [?] [3051]*/ + 0x00,0x7F,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC1CC [?] [3052]*/ + 0x20,0x27,0x24,0x27,0xFC,0x27,0x21,0x2B,0x35,0xE0,0x23,0x2C,0x23,0x22,0xA3,0x42, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06,0xF8,0x08,0xF8,0x08, + /* 0xC1CD [?] [3053]*/ + 0x20,0x20,0x3B,0x20,0x42,0x79,0xA3,0x25,0xF9,0x21,0x21,0x20,0x29,0x32,0x24,0x00, + 0x20,0x20,0xFE,0x50,0x8A,0x04,0xFE,0x04,0xFC,0x04,0xFC,0x20,0x24,0x22,0xA2,0x40, + /* 0xC1CE [?] [3054]*/ + 0x00,0x3F,0x20,0x2F,0x29,0x25,0x29,0x21,0x26,0x38,0x23,0x2C,0x41,0x4E,0x81,0x0E, + 0x80,0xFE,0x00,0x7C,0x24,0x14,0xA4,0x60,0x18,0x86,0x20,0x40,0x88,0x30,0xC0,0x00, + /* 0xC1CF [?] [3055]*/ + 0x08,0x08,0x4A,0x2A,0x2C,0x08,0xFE,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08, + 0x08,0x88,0x48,0x48,0x08,0x88,0x48,0x48,0x08,0x0E,0xF8,0x08,0x08,0x08,0x08,0x08, + /* 0xC1D0 [?] [3056]*/ + 0x00,0x7F,0x08,0x08,0x1F,0x11,0x21,0x21,0x52,0x8A,0x04,0x04,0x08,0x10,0x20,0x40, + 0x04,0x84,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xC1D1 [?] [3057]*/ + 0x00,0x7F,0x08,0x1F,0x21,0x52,0x0C,0x30,0xC2,0x01,0xFF,0x04,0x0C,0x34,0xC5,0x06, + 0x04,0x84,0x24,0x24,0x24,0x24,0x24,0x04,0x0C,0x00,0xFE,0x88,0x50,0x20,0x18,0x06, + /* 0xC1D2 [?] [3058]*/ + 0x00,0x7F,0x08,0x08,0x1F,0x21,0x51,0x0A,0x04,0x08,0x30,0xC0,0x24,0x22,0x42,0x80, + 0x04,0x84,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x14,0x08,0x00,0x88,0x44,0x44,0x04, + /* 0xC1D3 [?] [3059]*/ + 0x01,0x11,0x11,0x21,0x41,0x01,0x0E,0xF1,0x01,0x3F,0x02,0x02,0x04,0x08,0x10,0x60, + 0x00,0x10,0x08,0x24,0x44,0x80,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC1D4 [?] [3060]*/ + 0x00,0x44,0x28,0x13,0x28,0x48,0x8F,0x08,0x19,0x29,0x49,0x89,0x09,0x09,0x51,0x21, + 0x88,0x88,0x88,0xFE,0x88,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xC1D5 [?] [3061]*/ + 0x01,0x01,0xF9,0x21,0x27,0x21,0x21,0xFB,0x23,0x25,0x25,0x39,0xE1,0x41,0x01,0x01, + 0x10,0x10,0x10,0x10,0xBC,0x10,0x10,0x38,0xB8,0x54,0x54,0x92,0x10,0x10,0x10,0x10, + /* 0xC1D6 [?] [3062]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x38,0x54,0x50,0x91,0x12,0x14,0x10,0x10,0x10, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x70,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20,0x20,0x20, + /* 0xC1D7 [?] [3063]*/ + 0x00,0x01,0xF8,0x23,0x20,0x41,0x7A,0x49,0xC9,0x49,0x4A,0x4D,0x78,0x49,0x02,0x04, + 0x20,0x24,0xA8,0xFE,0xA8,0x24,0x22,0x04,0x04,0xDE,0x44,0x54,0x9E,0x04,0x04,0x04, + /* 0xC1D8 [?] [3064]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC9,0x08,0x08, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x20,0x20,0xFC,0x30,0x68,0xA4,0x22,0x20,0x20, + /* 0xC1D9 [?] [3065]*/ + 0x08,0x08,0x08,0x49,0x49,0x4A,0x4C,0x48,0x49,0x49,0x49,0x49,0x49,0x09,0x09,0x08, + 0x80,0x80,0x80,0xFE,0x40,0x20,0x20,0x00,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04,0x00, + /* 0xC1DA [?] [3066]*/ + 0x08,0x08,0x14,0x12,0x21,0x48,0x84,0x04,0x7F,0x01,0x22,0x14,0x08,0x04,0x04,0x00, + 0x00,0x7C,0x44,0x48,0x48,0xD0,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xC1DB [?] [3067]*/ + 0x40,0x41,0x78,0x8B,0x10,0xF9,0xAA,0xA9,0xF9,0xA9,0xAA,0xFD,0x00,0x19,0xE2,0x44, + 0x20,0x24,0xA8,0xFE,0xA8,0x24,0x22,0x04,0x04,0xDE,0x44,0x54,0x9E,0x04,0x04,0x04, + /* 0xC1DC [?] [3068]*/ + 0x01,0x21,0x11,0x11,0x87,0x41,0x41,0x13,0x13,0x25,0xE5,0x29,0x21,0x21,0x21,0x01, + 0x10,0x10,0x10,0x10,0xBC,0x10,0x10,0x38,0xB8,0x54,0x54,0x92,0x10,0x10,0x10,0x10, + /* 0xC1DD [?] [3069]*/ + 0x00,0x4F,0x20,0x27,0x04,0x05,0x15,0x15,0x24,0xE7,0x20,0x23,0x20,0x2F,0x22,0x04, + 0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xF4,0x04,0xFC,0x00,0xF8,0x00,0xFE,0x48,0xC4, + /* 0xC1DE [?] [3070]*/ + 0x08,0x13,0x30,0x50,0x97,0x10,0x10,0x13,0x00,0x1F,0x10,0x11,0x11,0x02,0x0C,0x30, + 0x38,0xC0,0x40,0x40,0xFC,0x40,0x40,0xF8,0x00,0xF0,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xC1DF [?] [3071]*/ + 0x02,0x01,0x7F,0x08,0x04,0x03,0x0C,0x30,0xC0,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFC,0x20,0x40,0x80,0x60,0x18,0x06,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xC1E0 [?] [3072]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x14,0x10,0x1B,0x30,0xD0,0x11,0x10,0x10,0x50,0x20, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xC1E1 [?] [3073]*/ + 0x00,0x00,0xFC,0x10,0x10,0x11,0x12,0x7C,0x11,0x10,0x10,0x10,0x1C,0xE0,0x40,0x00, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xC1E2 [?] [3074]*/ + 0x08,0x08,0xFF,0x08,0x01,0x3F,0x01,0xFF,0x10,0x22,0x47,0x08,0x14,0x03,0x1C,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0xFE,0x10,0x08,0xE4,0x20,0x40,0x80,0x70,0x0E, + /* 0xC1E3 [?] [3075]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x02,0x0C,0x32,0xC1,0x1F,0x00,0x06,0x01,0x00, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x80,0x60,0x18,0x06,0xE0,0x20,0x40,0x80,0x40, + /* 0xC1E4 [?] [3076]*/ + 0x10,0x10,0x50,0x5E,0x50,0x51,0xFE,0x00,0x93,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x02, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xC1E5 [?] [3077]*/ + 0x20,0x20,0x38,0x20,0x41,0x7A,0xA4,0x20,0xFB,0x20,0x20,0x21,0x28,0x30,0x20,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xC1E6 [?] [3078]*/ + 0x08,0x08,0x08,0x10,0x11,0x32,0x34,0x50,0x93,0x10,0x10,0x11,0x10,0x10,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xC1E7 [?] [3079]*/ + 0x44,0x24,0x28,0xFC,0x10,0x11,0x7E,0x10,0x11,0xFC,0x10,0x10,0x20,0x20,0x40,0x80, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xC1E8 [?] [3080]*/ + 0x00,0x40,0x23,0x20,0x00,0x07,0x11,0x12,0x24,0xE1,0x23,0x24,0x20,0x20,0x23,0x0C, + 0x40,0x40,0xF8,0x40,0x40,0xFE,0x10,0x88,0x84,0xF0,0x10,0xA0,0x40,0xA0,0x10,0x0C, + /* 0xC1E9 [?] [3081]*/ + 0x00,0x3F,0x00,0x00,0x1F,0x00,0x00,0x3F,0x01,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x10,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xC1EA [?] [3082]*/ + 0x00,0x78,0x49,0x50,0x50,0x63,0x50,0x49,0x4A,0x48,0x69,0x52,0x40,0x40,0x41,0x46, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xC1EB [?] [3083]*/ + 0x10,0x10,0x10,0x10,0x54,0x55,0x56,0x54,0x55,0x54,0x54,0x5C,0x64,0x00,0x00,0x00, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xC1EC [?] [3084]*/ + 0x10,0x11,0x28,0x24,0x43,0x91,0x09,0x01,0xFD,0x05,0x09,0x51,0x20,0x10,0x11,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xC1ED [?] [3085]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x02,0x02,0x7F,0x02,0x04,0x04,0x08,0x10,0x20,0x40, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC1EE [?] [3086]*/ + 0x01,0x01,0x02,0x04,0x0A,0x11,0x21,0xC0,0x1F,0x00,0x00,0x04,0x02,0x01,0x00,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x06,0xF0,0x10,0x20,0x40,0x80,0x00,0x80,0x80, + /* 0xC1EF [?] [3087]*/ + 0x00,0x27,0x14,0x15,0x84,0x45,0x46,0x10,0x17,0x24,0xE4,0x27,0x24,0x24,0x27,0x04, + 0x80,0x7C,0x24,0x24,0xA4,0x54,0x48,0x80,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x04, + /* 0xC1F0 [?] [3088]*/ + 0x00,0x00,0xFB,0x20,0x20,0x21,0x23,0xF8,0x21,0x21,0x21,0x39,0xE2,0x42,0x04,0x08, + 0x40,0x20,0xFC,0x40,0x90,0x08,0xFC,0x04,0x50,0x50,0x50,0x50,0x50,0x52,0x52,0x0E, + /* 0xC1F1 [?] [3089]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x33,0x38,0x57,0x52,0x92,0x13,0x12,0x12,0x13,0x12, + 0x40,0xBE,0x12,0x92,0x52,0xAA,0x24,0x40,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xC1F2 [?] [3090]*/ + 0x00,0x00,0xFB,0x20,0x20,0x41,0x7B,0x48,0xC9,0x49,0x49,0x49,0x7A,0x4A,0x04,0x08, + 0x40,0x20,0xFC,0x40,0x90,0x08,0xFC,0x04,0x50,0x50,0x50,0x50,0x50,0x52,0x52,0x0E, + /* 0xC1F3 [?] [3091]*/ + 0x20,0x23,0x22,0x3A,0x4A,0x52,0x83,0x20,0x23,0x22,0x22,0x23,0x2A,0x32,0x23,0x02, + 0x40,0xBE,0x12,0x92,0x52,0xAA,0x24,0x40,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xC1F4 [?] [3092]*/ + 0x06,0x78,0x40,0x48,0x44,0x5A,0x61,0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x20, + 0x00,0xFC,0x44,0x44,0x44,0x94,0x08,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC1F5 [?] [3093]*/ + 0x10,0x08,0x08,0xFF,0x02,0x42,0x22,0x14,0x14,0x08,0x08,0x14,0x24,0x42,0x82,0x00, + 0x04,0x04,0x04,0xA4,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xC1F6 [?] [3094]*/ + 0x00,0x00,0x1F,0x10,0x97,0x54,0x55,0x15,0x36,0x50,0x97,0x14,0x27,0x24,0x47,0x84, + 0x80,0x40,0xFE,0x80,0x7C,0x24,0xA4,0x54,0x48,0x80,0xFC,0x44,0xFC,0x44,0xFC,0x04, + /* 0xC1F7 [?] [3095]*/ + 0x00,0x20,0x17,0x10,0x81,0x42,0x47,0x10,0x10,0x22,0xE2,0x22,0x22,0x22,0x24,0x08, + 0x80,0x40,0xFE,0x80,0x10,0x08,0xFC,0x04,0x00,0x48,0x48,0x48,0x48,0x4A,0x4A,0x46, + /* 0xC1F8 [?] [3096]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x32,0x3A,0x56,0x52,0x93,0x12,0x10,0x10,0x11,0x12, + 0x00,0x80,0x1E,0x52,0x52,0x52,0x52,0x52,0x52,0xD2,0x5A,0x54,0x90,0x90,0x10,0x10, + /* 0xC1F9 [?] [3097]*/ + 0x02,0x01,0x00,0x00,0x00,0xFF,0x00,0x00,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x00, + 0x00,0x00,0x80,0x80,0x00,0xFE,0x00,0x00,0x40,0x20,0x10,0x08,0x08,0x04,0x04,0x00, + /* 0xC1FA [?] [3098]*/ + 0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x11,0x22,0x44,0x80, + 0x20,0x10,0x10,0x00,0xFE,0x80,0x88,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xC1FB [?] [3099]*/ + 0x04,0x04,0xFF,0x09,0x11,0x66,0x00,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x00,0x00, + 0x80,0x40,0xFE,0x40,0x84,0xFC,0x00,0xFC,0x20,0xE0,0x20,0xE0,0x3E,0xE0,0x20,0x20, + /* 0xC1FC [?] [3100]*/ + 0x00,0x00,0x78,0x48,0x4B,0x48,0x48,0x48,0x48,0x49,0x79,0x49,0x02,0x02,0x04,0x08, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0x28,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xC1FD [?] [3101]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x04,0x7F,0x04,0x04,0x08,0x08,0x10,0x23,0x4C,0x80, + 0x40,0x40,0x7E,0x90,0x08,0x40,0x20,0xFC,0x80,0x88,0x90,0xA0,0xC2,0x82,0x82,0x7E, + /* 0xC1FE [?] [3102]*/ + 0x01,0x7F,0x48,0x91,0x79,0x4A,0x50,0x61,0x56,0x49,0x4A,0x6B,0x54,0x43,0x40,0x47, + 0x00,0xFE,0x22,0x14,0xF0,0x90,0x60,0x98,0x06,0xF0,0x40,0xF8,0x40,0xF8,0x40,0xFC, + /* 0xC2A1 [?] [3103]*/ + 0x00,0x79,0x4A,0x55,0x50,0x63,0x5C,0x4B,0x48,0x4A,0x6B,0x54,0x43,0x40,0x4F,0x40, + 0x80,0xF8,0x08,0x10,0xE0,0x18,0x06,0xF8,0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00, + /* 0xC2A2 [?] [3104]*/ + 0x04,0x04,0xFF,0x09,0x11,0x11,0x23,0x4D,0x80,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x40,0x20,0xFE,0x10,0x20,0xC0,0x04,0x04,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xC2A3 [?] [3105]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x14,0x18,0x30,0xD1,0x11,0x11,0x12,0x12,0x54,0x28, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0x28,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xC2A4 [?] [3106]*/ + 0x00,0x7C,0x44,0x48,0x4B,0x50,0x48,0x48,0x44,0x45,0x45,0x69,0x52,0x42,0x44,0x48, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0x28,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xC2A5 [?] [3107]*/ + 0x20,0x21,0x20,0x20,0xFB,0x20,0x21,0x72,0x68,0xA7,0xA0,0x21,0x21,0x20,0x21,0x26, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xC2A6 [?] [3108]*/ + 0x01,0x11,0x09,0xFF,0x05,0x09,0x31,0xC0,0x02,0xFF,0x04,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0x10,0x20,0xFE,0x40,0x20,0x18,0x06,0x00,0xFE,0x20,0x20,0x40,0x80,0x70,0x08, + /* 0xC2A7 [?] [3109]*/ + 0x10,0x11,0x10,0x10,0xFB,0x10,0x11,0x1A,0x30,0xD7,0x10,0x11,0x11,0x10,0x51,0x26, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xC2A8 [?] [3110]*/ + 0x20,0x3F,0x48,0x85,0x11,0x09,0x7F,0x05,0x19,0x61,0x04,0xFF,0x08,0x1E,0x03,0x3C, + 0x40,0x7E,0x90,0x08,0x10,0x20,0xFC,0x40,0x30,0x0C,0x00,0xFE,0x20,0x40,0xC0,0x38, + /* 0xC2A9 [?] [3111]*/ + 0x00,0x47,0x24,0x24,0x07,0x84,0x47,0x54,0x17,0x26,0xE6,0x2A,0x2A,0x32,0x22,0x02, + 0x00,0xFE,0x02,0x02,0xFE,0x00,0xFE,0x20,0xFE,0x22,0xAA,0x22,0xAA,0x22,0x2A,0x04, + /* 0xC2AA [?] [3112]*/ + 0x00,0x7B,0x48,0x50,0x52,0x62,0x52,0x4A,0x4A,0x4A,0x6A,0x52,0x42,0x42,0x43,0x40, + 0x00,0xFE,0x20,0x20,0xFC,0xA4,0xA4,0xA4,0xD4,0x84,0x84,0x94,0x88,0x00,0xFE,0x00, + /* 0xC2AB [?] [3113]*/ + 0x08,0x08,0xFF,0x08,0x09,0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x40,0x40,0x80, + 0x20,0x20,0xFE,0x20,0x20,0x80,0xF8,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00, + /* 0xC2AC [?] [3114]*/ + 0x01,0x01,0x01,0x01,0x01,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00, + /* 0xC2AD [?] [3115]*/ + 0x10,0x10,0x1E,0x10,0x10,0x7C,0x44,0x44,0x44,0x7C,0x44,0x40,0x40,0x40,0x80,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xC2AE [?] [3116]*/ + 0x01,0x00,0x3F,0x21,0x20,0x27,0x24,0x24,0x24,0x27,0x24,0x24,0x44,0x48,0x88,0x10, + 0x00,0x80,0xFE,0x00,0x80,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00, + /* 0xC2AF [?] [3117]*/ + 0x10,0x10,0x10,0x15,0x59,0x51,0x51,0x91,0x11,0x11,0x11,0x29,0x26,0x42,0x44,0x88, + 0x80,0x40,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC2B0 [?] [3118]*/ + 0x20,0x20,0x20,0x23,0xFA,0x22,0x23,0x2A,0x32,0xE2,0x23,0x22,0x24,0x24,0xA9,0x42, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x40,0x40,0xFC,0x44,0x84,0x84,0x14,0x08, + /* 0xC2B1 [?] [3119]*/ + 0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x24,0x22,0x21,0x22,0x24,0x28,0x20,0x3F,0x20, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x48,0x88,0x08,0x88,0x48,0x28,0x08,0xF8,0x08, + /* 0xC2B2 [?] [3120]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x21,0x20,0x21,0x2F,0x21,0x21,0x42,0x44,0x98, + 0x00,0xF8,0x00,0xFC,0x04,0x60,0x88,0x08,0xF8,0x00,0xF8,0x08,0x08,0x08,0x50,0x20, + /* 0xC2B3 [?] [3121]*/ + 0x08,0x1F,0x20,0x7F,0xA1,0x3F,0x21,0x3F,0x00,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F, + 0x00,0xE0,0x20,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xC2B4 [?] [3122]*/ + 0x08,0x08,0x7E,0x1C,0x2A,0xC9,0x08,0x3F,0x22,0x3F,0x22,0x3F,0x28,0x2F,0x48,0x8F, + 0x20,0x20,0xFC,0x70,0xA8,0x26,0xA0,0xFC,0x40,0xF8,0x48,0xF8,0x44,0x78,0x42,0x3E, + /* 0xC2B5 [?] [3123]*/ + 0x00,0x01,0xF8,0x20,0x21,0x40,0x78,0x4B,0xC8,0x4A,0x49,0x48,0x79,0x4A,0x00,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x20,0x22,0x74,0xA8,0x24,0x22,0xA0,0x40, + /* 0xC2B6 [?] [3124]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x7C,0x45,0x7C,0x11,0x5C,0x50,0x5C,0xE0, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x40,0xF8,0x48,0x30,0xCE,0x00,0xF8,0x88,0xF8, + /* 0xC2B7 [?] [3125]*/ + 0x00,0x7C,0x44,0x44,0x45,0x7C,0x10,0x10,0x11,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x00, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xC2B8 [?] [3126]*/ + 0x00,0x7C,0x44,0x54,0x55,0x54,0x54,0x54,0x55,0x54,0x54,0x10,0x28,0x24,0x44,0x80, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xC2B9 [?] [3127]*/ + 0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x22,0x3F,0x28,0x28,0x2F,0x48,0x48,0x8B,0x0C, + 0x00,0x80,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x40,0x44,0x58,0x60,0x44,0x44,0x3C, + /* 0xC2BA [?] [3128]*/ + 0x00,0x27,0x14,0x14,0x84,0x47,0x41,0x11,0x11,0x25,0xE5,0x25,0x25,0x25,0x2E,0x00, + 0x10,0x90,0xBC,0xA4,0xC4,0xA8,0x10,0x28,0x46,0xC0,0x3C,0x24,0x24,0xA4,0x3C,0x24, + /* 0xC2BB [?] [3129]*/ + 0x40,0x21,0x20,0xF8,0x11,0x10,0x20,0x33,0x68,0xAA,0x21,0x20,0x21,0x22,0x20,0x20, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x20,0x22,0x74,0xA8,0x24,0x22,0xA0,0x40, + /* 0xC2BC [?] [3130]*/ + 0x00,0x3F,0x00,0x00,0x1F,0x00,0x00,0xFF,0x01,0x21,0x11,0x05,0x09,0x31,0xC5,0x02, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xFE,0x00,0x08,0x90,0x60,0x20,0x18,0x06,0x00, + /* 0xC2BD [?] [3131]*/ + 0x00,0x7C,0x44,0x49,0x48,0x50,0x48,0x4B,0x44,0x44,0x45,0x69,0x51,0x41,0x41,0x40, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xC2BE [?] [3132]*/ + 0x00,0x77,0x11,0x55,0x33,0x55,0x0C,0x33,0xC4,0x18,0x62,0x0C,0x71,0x06,0x18,0xE0, + 0x10,0x14,0x12,0x10,0x16,0x78,0x12,0x12,0x92,0x14,0x14,0x88,0x1A,0x2A,0x46,0x82, + /* 0xC2BF [?] [3133]*/ + 0x00,0xF8,0x08,0x48,0x48,0x48,0x48,0x7C,0x04,0x04,0x1C,0xE4,0x44,0x05,0x29,0x12, + 0x40,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84,0x80,0x80,0x80,0x80,0x00,0x00,0x00, + /* 0xC2C0 [?] [3134]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x3F,0x20, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2C1 [?] [3135]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x10,0x10,0xFC,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0xFE,0x02, + /* 0xC2C2 [?] [3136]*/ + 0x10,0x13,0x12,0x22,0x22,0x62,0x63,0xA0,0x20,0x27,0x24,0x24,0x24,0x24,0x27,0x24, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC2C3 [?] [3137]*/ + 0x20,0x10,0x10,0x01,0xFE,0x20,0x20,0x3C,0x24,0x24,0x24,0x24,0x24,0x44,0x54,0x88, + 0x80,0x80,0xFE,0x00,0x0C,0xF0,0x90,0x90,0x92,0x94,0x88,0x88,0x84,0xA4,0xC2,0x80, + /* 0xC2C4 [?] [3138]*/ + 0x3F,0x20,0x3F,0x21,0x29,0x32,0x21,0x25,0x29,0x39,0x29,0x28,0x49,0x4A,0x88,0x0B, + 0xFC,0x04,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFC,0x88,0x70,0x8E, + /* 0xC2C5 [?] [3139]*/ + 0x3F,0x20,0x3F,0x24,0x22,0x3F,0x22,0x24,0x28,0x21,0x3F,0x22,0x47,0x40,0x83,0x0C, + 0xFC,0x04,0xFC,0x90,0xA0,0xFC,0xA0,0x90,0x88,0x00,0xFC,0x10,0x20,0xC0,0x30,0x08, + /* 0xC2C6 [?] [3140]*/ + 0x10,0x11,0x20,0x20,0x4B,0xF8,0x11,0x22,0x40,0xFB,0x40,0x01,0x19,0xE0,0x41,0x06, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xC2C7 [?] [3141]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x21,0x20,0x20,0x20,0x20,0x2A,0x4A,0x52,0x81, + 0x00,0xF8,0x00,0xFC,0x04,0x60,0x88,0x08,0xF8,0x00,0x80,0x44,0x42,0x12,0x10,0xF0, + /* 0xC2C8 [?] [3142]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x7F,0x00,0x3F,0x00,0xFF,0x24,0x15,0x24,0x4C, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x90,0x90,0x90,0xF2,0x8A,0x0A,0x86,0x42, + /* 0xC2C9 [?] [3143]*/ + 0x08,0x08,0x13,0x20,0x4F,0x08,0x13,0x30,0x50,0x93,0x10,0x10,0x17,0x10,0x10,0x10, + 0x40,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x40,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40, + /* 0xC2CA [?] [3144]*/ + 0x02,0x01,0x7F,0x02,0x44,0x2F,0x11,0x22,0x4F,0x00,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0xFC,0x00,0x44,0x88,0x10,0x48,0xE4,0x20,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xC2CB [?] [3145]*/ + 0x00,0x20,0x10,0x17,0x84,0x44,0x47,0x14,0x14,0x24,0xE4,0x24,0x25,0x29,0x29,0x12, + 0x40,0x7C,0x40,0xFE,0x42,0x70,0xC4,0x44,0x3C,0x20,0x10,0x54,0x42,0x42,0x4A,0x38, + /* 0xC2CC [?] [3146]*/ + 0x10,0x11,0x20,0x20,0x49,0xF8,0x10,0x23,0x40,0xFA,0x41,0x00,0x19,0xE2,0x40,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x20,0x22,0x74,0xA8,0x24,0x22,0xA0,0x40, + /* 0xC2CD [?] [3147]*/ + 0x02,0x01,0xFF,0x04,0x14,0x14,0x24,0x44,0x01,0x01,0x21,0x21,0x21,0x21,0x3F,0x00, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x44,0x00,0x00,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2CE [?] [3148]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x44,0x00,0x3F,0x01,0x3F,0x01,0x7F,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0xF0,0x00,0x00,0xF8,0x00,0xFC,0x00,0x00,0x00, + /* 0xC2CF [?] [3149]*/ + 0x02,0x01,0xFF,0x04,0x14,0x14,0x24,0x44,0x00,0x3F,0x00,0x01,0xFF,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x44,0x00,0xE0,0x80,0x00,0xFE,0x00,0x00,0x00, + /* 0xC2D0 [?] [3150]*/ + 0x00,0x40,0x2F,0x20,0x02,0x82,0x44,0x50,0x10,0x27,0xE0,0x21,0x22,0x24,0x28,0x00, + 0x80,0x40,0xFE,0xA0,0xA8,0xA4,0xA4,0x40,0x40,0xFE,0xE0,0x50,0x48,0x44,0x42,0x40, + /* 0xC2D1 [?] [3151]*/ + 0x0C,0x70,0x44,0x44,0x64,0x54,0x54,0x44,0x44,0x4C,0x74,0x04,0x08,0x08,0x10,0x20, + 0x00,0xFC,0x84,0x84,0xA4,0x94,0x94,0x84,0x84,0x84,0xA8,0x90,0x80,0x80,0x80,0x80, + /* 0xC2D2 [?] [3152]*/ + 0x04,0x0E,0x38,0x08,0x08,0xFF,0x08,0x08,0x3E,0x22,0x22,0x22,0x22,0x3E,0x22,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xC2D3 [?] [3153]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x11,0x15,0x19,0x30,0xD1,0x11,0x12,0x14,0x50,0x20, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xC2D4 [?] [3154]*/ + 0x00,0x00,0xF8,0xA9,0xAB,0xAC,0xF8,0xA8,0xA9,0xAA,0xAD,0xF9,0x89,0x01,0x01,0x01, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2D5 [?] [3155]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x14,0x11,0x19,0x31,0xD1,0x11,0x11,0x11,0x50,0x20, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2D6 [?] [3156]*/ + 0x20,0x20,0x20,0xFC,0x41,0x52,0x94,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x11,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2D7 [?] [3157]*/ + 0x08,0x08,0x08,0x10,0x11,0x32,0x34,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2D8 [?] [3158]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x20,0xC8,0x08,0x08,0x0F,0x08,0x08,0x08,0x07,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x06,0x30,0xC0,0x00,0x08,0x08,0x08,0xF8,0x00, + /* 0xC2D9 [?] [3159]*/ + 0x00,0x20,0x10,0x10,0x81,0x42,0x44,0x11,0x11,0x21,0xE1,0x21,0x21,0x21,0x20,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2DA [?] [3160]*/ + 0x10,0x10,0x20,0x20,0x49,0xFA,0x14,0x21,0x41,0xF9,0x41,0x01,0x19,0xE1,0x40,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2DB [?] [3161]*/ + 0x00,0x20,0x10,0x10,0x01,0x02,0xF4,0x11,0x11,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0x10,0x20,0x40,0x80,0x00,0x04,0x04,0xFC,0x00, + /* 0xC2DC [?] [3162]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x24,0x24,0x3F,0x02,0x07,0x08,0x34,0x02,0x01,0x0E,0x70, + 0x20,0xFE,0x20,0x00,0xF8,0x48,0x48,0xF8,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xC2DD [?] [3163]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x54,0x54,0x7D,0x50,0x10,0x17,0x1C,0xE5,0x42,0x00, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x40,0x88,0xF0,0x20,0x44,0xFE,0x22,0x24,0x22,0x60, + /* 0xC2DE [?] [3164]*/ + 0x00,0x3F,0x24,0x24,0x24,0x3F,0x02,0x04,0x0F,0x10,0x68,0x04,0x02,0x03,0x1C,0xE0, + 0x00,0xF8,0x48,0x48,0x48,0xF8,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xC2DF [?] [3165]*/ + 0x00,0x47,0x24,0x24,0x07,0x00,0xE1,0x22,0x25,0x20,0x20,0x21,0x2E,0x50,0x8F,0x00, + 0x00,0xFC,0xA4,0xA4,0xFC,0x80,0xF8,0x08,0x10,0xA0,0x40,0x80,0x00,0x00,0xFE,0x00, + /* 0xC2E0 [?] [3166]*/ + 0x20,0x23,0x3A,0x22,0x42,0x7B,0xA0,0x20,0xF8,0x21,0x22,0x20,0x28,0x30,0x21,0x06, + 0x00,0xFE,0x52,0x52,0x52,0xFE,0x20,0x40,0xFC,0x04,0x88,0x50,0x20,0x40,0x80,0x00, + /* 0xC2E1 [?] [3167]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x24,0x24,0x3F,0x02,0x07,0x08,0x34,0x02,0x01,0x0E,0x70, + 0x40,0x7E,0x90,0x08,0xF8,0x48,0x48,0xF8,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xC2E2 [?] [3168]*/ + 0x00,0xF9,0x09,0x49,0x49,0x49,0x48,0x7C,0x05,0x04,0x1C,0xE7,0x44,0x05,0x2A,0x10, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x40,0x88,0xF0,0x20,0x44,0xFE,0x22,0x24,0x22,0x60, + /* 0xC2E3 [?] [3169]*/ + 0x20,0x11,0x01,0xF9,0x09,0x11,0x15,0x39,0x54,0x93,0x10,0x10,0x11,0x12,0x10,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xC2E4 [?] [3170]*/ + 0x08,0x08,0xFF,0x08,0x20,0x10,0x11,0x82,0x48,0x49,0x16,0xE1,0x21,0x21,0x21,0x21, + 0x20,0x20,0xFE,0x20,0x80,0xF8,0x08,0x90,0x60,0x98,0x06,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC2E5 [?] [3171]*/ + 0x00,0x20,0x11,0x12,0x85,0x40,0x40,0x10,0x13,0x2C,0xE3,0x22,0x22,0x22,0x23,0x02, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2E6 [?] [3172]*/ + 0x00,0xF8,0x08,0x49,0x4B,0x4C,0x48,0x7C,0x05,0x06,0x1D,0xE5,0x45,0x05,0x29,0x11, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2E7 [?] [3173]*/ + 0x10,0x10,0x20,0x21,0x4B,0xFC,0x10,0x20,0x41,0xFA,0x45,0x01,0x19,0xE1,0x41,0x01, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC2E8 [?] [3174]*/ + 0x10,0x13,0x10,0x10,0xFD,0x25,0x25,0x25,0x24,0x48,0x28,0x13,0x28,0x44,0x84,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xC2E9 [?] [3175]*/ + 0x01,0x00,0x3F,0x22,0x22,0x22,0x3F,0x22,0x26,0x27,0x2A,0x2A,0x52,0x42,0x82,0x02, + 0x00,0x80,0xFE,0x10,0x10,0x10,0xBE,0x10,0x10,0x38,0xB4,0x54,0x92,0x10,0x10,0x10, + /* 0xC2EA [?] [3176]*/ + 0x00,0x03,0xFC,0x10,0x11,0x11,0x11,0x7D,0x10,0x10,0x10,0x13,0x1C,0xE0,0x40,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xFE,0x02,0x02,0x02,0xFA,0x02,0x02,0x14,0x08, + /* 0xC2EB [?] [3177]*/ + 0x00,0x01,0xFC,0x10,0x10,0x20,0x3C,0x64,0x64,0xA4,0x24,0x25,0x3C,0x24,0x20,0x00, + 0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0xFE,0x02,0x02,0x02,0xFA,0x02,0x02,0x14,0x08, + /* 0xC2EC [?] [3178]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x15,0x1C,0xE4,0x40,0x00, + 0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0xFE,0x02,0x02,0x02,0xFA,0x02,0x02,0x14,0x08, + /* 0xC2ED [?] [3179]*/ + 0x00,0x7F,0x00,0x00,0x10,0x10,0x10,0x1F,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0xE4,0x04,0x04,0x28,0x10, + /* 0xC2EE [?] [3180]*/ + 0x00,0x7C,0x44,0x44,0x7C,0x00,0x3F,0x00,0x08,0x08,0x0F,0x00,0x7F,0x00,0x00,0x00, + 0x00,0xF8,0x88,0x88,0xF8,0x00,0xE0,0x20,0x20,0x20,0xFC,0x04,0xE4,0x04,0x28,0x10, + /* 0xC2EF [?] [3181]*/ + 0x00,0x00,0xF7,0x94,0x94,0x94,0x97,0x94,0x94,0x95,0xF5,0x96,0x08,0x08,0x10,0x00, + 0x40,0x20,0xFE,0x90,0x90,0x90,0xFC,0x90,0xD8,0xB8,0xB4,0xD4,0x92,0x90,0x90,0x90, + /* 0xC2F0 [?] [3182]*/ + 0x00,0x03,0x78,0x48,0x49,0x49,0x49,0x49,0x48,0x48,0x78,0x4B,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xC2F1 [?] [3183]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x10,0x10,0x11,0x1C,0xE0,0x40,0x03,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC2F2 [?] [3184]*/ + 0x00,0x7F,0x00,0x08,0x04,0x24,0x10,0x10,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0xFC,0x04,0x88,0x80,0x80,0x80,0x80,0x00,0xFE,0x00,0xC0,0x20,0x10,0x08,0x04, + /* 0xC2F3 [?] [3185]*/ + 0x01,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x08,0x1F,0x28,0x44,0x03,0x1C,0xE0, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E, + /* 0xC2F4 [?] [3186]*/ + 0x01,0x01,0x3F,0x01,0x01,0x7F,0x04,0x02,0x12,0x08,0x09,0xFF,0x02,0x04,0x18,0x60, + 0x00,0x00,0xF8,0x00,0x00,0xFC,0x04,0x88,0x80,0x80,0x00,0xFE,0x40,0x20,0x10,0x08, + /* 0xC2F5 [?] [3187]*/ + 0x00,0x20,0x17,0x10,0x00,0x00,0xF0,0x10,0x10,0x11,0x11,0x12,0x14,0x28,0x47,0x00, + 0x00,0x00,0xFE,0x80,0x80,0xFC,0x84,0x84,0x84,0x04,0x04,0x28,0x10,0x00,0xFE,0x00, + /* 0xC2F6 [?] [3188]*/ + 0x00,0x78,0x48,0x49,0x48,0x78,0x4B,0x48,0x48,0x78,0x49,0x49,0x4A,0x4C,0x48,0x98, + 0x40,0x20,0x10,0xE0,0x22,0x34,0xB8,0xB0,0xA8,0xA8,0x28,0x24,0x24,0x22,0xA0,0x40, + /* 0xC2F7 [?] [3189]*/ + 0x01,0x01,0xF7,0x91,0x90,0xF7,0x90,0x90,0xF7,0x94,0x94,0x95,0xF6,0x94,0x04,0x04, + 0x08,0x08,0xFE,0x08,0x00,0xFE,0x90,0x90,0xFE,0x92,0x92,0x6A,0x46,0x02,0x0A,0x04, + /* 0xC2F8 [?] [3190]*/ + 0x23,0x22,0x23,0x3A,0x4B,0x50,0x87,0x24,0x24,0x27,0x20,0x23,0x29,0x30,0x23,0x0C, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xC2F9 [?] [3191]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x44,0x01,0x1F,0x11,0x11,0x1F,0x11,0x01,0x7F,0x20, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x00,0xF0,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xC2FA [?] [3192]*/ + 0x01,0x21,0x17,0x11,0x80,0x47,0x40,0x10,0x17,0x24,0xE4,0x25,0x26,0x24,0x24,0x04, + 0x08,0x08,0xFE,0x08,0x00,0xFE,0x90,0x90,0xFE,0x92,0x92,0x6A,0x46,0x02,0x0A,0x04, + /* 0xC2FB [?] [3193]*/ + 0x08,0xFF,0x08,0x1F,0x10,0x1F,0x10,0x7F,0x44,0x7F,0x00,0x3F,0x08,0x07,0x18,0xE0, + 0x20,0xFE,0x20,0xF0,0x10,0xF0,0x10,0xFC,0x44,0xFC,0x00,0xF0,0x20,0xC0,0x30,0x0E, + /* 0xC2FC [?] [3194]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x7F,0x44,0x7F,0x00,0x3F,0x08,0x07,0x18,0xE0, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x44,0xFC,0x00,0xF0,0x20,0xC0,0x30,0x0E, + /* 0xC2FD [?] [3195]*/ + 0x23,0x22,0x23,0x32,0xAB,0xA0,0xA7,0xA4,0x24,0x27,0x20,0x23,0x21,0x20,0x23,0x2C, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xC2FE [?] [3196]*/ + 0x03,0x22,0x13,0x12,0x83,0x40,0x47,0x14,0x14,0x27,0xE0,0x23,0x21,0x20,0x23,0x0C, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xC3A1 [?] [3197]*/ + 0x03,0x42,0x23,0x22,0x03,0x00,0xE7,0x24,0x24,0x27,0x20,0x23,0x29,0x30,0x23,0x0C, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xC3A2 [?] [3198]*/ + 0x08,0x08,0xFF,0x08,0x08,0x02,0x01,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x0F,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xC3A3 [?] [3199]*/ + 0x08,0x08,0xFF,0x08,0x08,0x20,0x10,0x87,0x49,0x09,0x11,0xE1,0x21,0x21,0x21,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x40,0x20,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xC3A4 [?] [3200]*/ + 0x02,0x01,0xFF,0x10,0x10,0x10,0x1F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xC3A5 [?] [3201]*/ + 0x20,0x13,0x12,0x02,0xFA,0x43,0x42,0x42,0x43,0x42,0x42,0x42,0x7A,0x02,0x03,0x02, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x8A,0x06,0x02, + /* 0xC3A6 [?] [3202]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x20,0x10,0x10,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00, + /* 0xC3A7 [?] [3203]*/ + 0x08,0xFF,0x08,0x02,0x02,0x7F,0x04,0x08,0x30,0xC8,0x08,0x7F,0x08,0x10,0x20,0x40, + 0x20,0xFE,0x20,0x40,0x20,0xFC,0x40,0x20,0x18,0x26,0x20,0xFC,0x20,0x20,0x20,0x20, + /* 0xC3A8 [?] [3204]*/ + 0x00,0x44,0x2B,0x10,0x28,0x48,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x51,0x21, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x04, + /* 0xC3A9 [?] [3205]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x00,0x06,0x01,0xFF,0x02,0x04,0x08,0x30,0xC2,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x20,0x40,0x80,0xFE,0x82,0x84,0x80,0x80,0x80,0x00, + /* 0xC3AA [?] [3206]*/ + 0x20,0x20,0x3B,0x20,0x40,0x78,0xA1,0x21,0xF9,0x21,0x21,0x21,0x29,0x31,0x21,0x01, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x04, + /* 0xC3AB [?] [3207]*/ + 0x00,0x01,0x7E,0x02,0x02,0x03,0x3E,0x02,0x02,0x03,0xFE,0x02,0x02,0x02,0x02,0x01, + 0x10,0xF8,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xFC,0x00,0x00,0x04,0x04,0x04,0xFC, + /* 0xC3AC [?] [3208]*/ + 0x00,0x1F,0x00,0x02,0x01,0x00,0x7F,0x01,0x02,0x04,0x08,0x10,0x20,0xC0,0x02,0x01, + 0x00,0xF0,0x10,0x20,0x40,0x80,0xFE,0x82,0x84,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + /* 0xC3AD [?] [3209]*/ + 0x20,0x20,0x3B,0x22,0x42,0x7A,0xA2,0x22,0xFA,0x22,0x23,0x22,0x28,0x30,0x21,0x02, + 0x00,0x80,0x1E,0x52,0x52,0x52,0x52,0x52,0x52,0xD2,0x5A,0x54,0x90,0x90,0x10,0x10, + /* 0xC3AE [?] [3210]*/ + 0x0C,0x70,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x4C,0x74,0x04,0x08,0x08,0x10,0x20, + 0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0xA8,0x90,0x80,0x80,0x80,0x80, + /* 0xC3AF [?] [3211]*/ + 0x08,0x08,0xFF,0x08,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x41,0x86, + 0x20,0x20,0xFE,0x20,0x90,0x88,0xFC,0x80,0x88,0x88,0x50,0x50,0x24,0x54,0x8C,0x04, + /* 0xC3B0 [?] [3212]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x2F,0x20,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0xF8,0x08,0xE8,0x08,0xE8,0x08,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xC3B1 [?] [3213]*/ + 0x20,0x23,0x22,0xFA,0xAA,0xAA,0xAA,0xA8,0xA9,0xA9,0xA9,0xB9,0x21,0x21,0x21,0x21, + 0x00,0xFC,0x04,0xF4,0x04,0xF4,0x04,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xC3B2 [?] [3214]*/ + 0x0C,0x30,0xC3,0x15,0x49,0x31,0xC9,0x15,0x25,0xCC,0x14,0x24,0xC4,0x04,0x29,0x12, + 0x20,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x50,0x50,0x50,0x92,0x92,0x0E,0x00, + /* 0xC3B3 [?] [3215]*/ + 0x06,0x78,0x40,0x48,0x44,0x5A,0x61,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0xFC,0x44,0x44,0x44,0x94,0x08,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xC3B4 [?] [3216]*/ + 0x01,0x01,0x02,0x02,0x04,0x08,0x10,0x20,0x41,0x02,0x04,0x08,0x10,0x3F,0x10,0x00, + 0x00,0x00,0x00,0x00,0x40,0x40,0x80,0x80,0x00,0x00,0x20,0x10,0x08,0xFC,0x04,0x00, + /* 0xC3B5 [?] [3217]*/ + 0x00,0x00,0xFE,0x10,0x10,0x11,0x7E,0x10,0x10,0x10,0x10,0x1E,0xF0,0x40,0x01,0x02, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xC3B6 [?] [3218]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x32,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x11,0x12, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xC3B7 [?] [3219]*/ + 0x11,0x11,0x11,0x12,0xFD,0x11,0x39,0x35,0x57,0x51,0x92,0x12,0x13,0x10,0x10,0x10, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xC3B8 [?] [3220]*/ + 0x00,0xFE,0x28,0x28,0xFF,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x40,0x40,0x7E,0x80,0x7C,0x44,0x64,0x54,0xFE,0x44,0xA4,0x94,0xFE,0x04,0x28,0x10, + /* 0xC3B9 [?] [3221]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x10,0x1F,0x20,0x5F,0x12,0xFF,0x20,0x3F,0x00, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFC,0x00,0xF0,0x10,0xFE,0x90,0xFC,0x30, + /* 0xC3BA [?] [3222]*/ + 0x10,0x10,0x13,0x10,0x54,0x58,0x50,0x90,0x10,0x10,0x13,0x28,0x24,0x45,0x42,0x80, + 0x88,0x88,0xFE,0x88,0x88,0xF8,0x88,0x88,0xF8,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xC3BB [?] [3223]*/ + 0x00,0x21,0x11,0x11,0x81,0x42,0x54,0x18,0x13,0x22,0xE1,0x21,0x20,0x20,0x21,0x0E, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x0E,0x00,0xF8,0x08,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xC3BC [?] [3224]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x20,0x2F,0x28,0x28,0x2F,0x28,0x2F,0x48,0x48,0x8F,0x08, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xF8,0x08,0x08,0xF8,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC3BD [?] [3225]*/ + 0x10,0x10,0x13,0x10,0xFC,0x24,0x24,0x24,0x24,0x48,0x2B,0x10,0x28,0x45,0x86,0x00, + 0x88,0x88,0xFE,0x88,0x88,0xF8,0x88,0x88,0xF8,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xC3BE [?] [3226]*/ + 0x21,0x20,0x3B,0x20,0x40,0x79,0xA0,0x20,0xFB,0x20,0x20,0x23,0x28,0x30,0x20,0x03, + 0x04,0x88,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x20,0xFE,0x20,0x50,0x88,0x06, + /* 0xC3BF [?] [3227]*/ + 0x10,0x1F,0x20,0x20,0x5F,0x90,0x12,0x11,0xFF,0x20,0x22,0x21,0x3F,0x00,0x00,0x00, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0xFC,0x10,0xA0,0x40, + /* 0xC3C0 [?] [3228]*/ + 0x08,0x04,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x01,0x01,0x7F,0x02,0x04,0x18,0xE0, + 0x20,0x40,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0xFC,0x80,0x40,0x30,0x0E, + /* 0xC3C1 [?] [3229]*/ + 0x00,0x00,0x78,0x49,0x48,0x48,0x48,0x7B,0x48,0x48,0x48,0x49,0x79,0x4A,0x00,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xC3C2 [?] [3230]*/ + 0x02,0x01,0x7F,0x40,0x84,0x24,0x25,0x3C,0x04,0x07,0x7C,0x24,0x25,0x26,0x44,0x84, + 0x00,0x00,0xFE,0x02,0x24,0x20,0xFC,0x20,0x20,0xFE,0x60,0xB0,0x28,0x26,0x20,0x20, + /* 0xC3C3 [?] [3231]*/ + 0x10,0x10,0x10,0x11,0xFC,0x24,0x24,0x27,0x24,0x48,0x28,0x11,0x29,0x46,0x84,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xC3C4 [?] [3232]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x46,0x82,0x04, + 0x00,0xFC,0x24,0x24,0xFC,0x00,0x7C,0x44,0x44,0x7C,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xC3C5 [?] [3233]*/ + 0x20,0x13,0x10,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xC3C6 [?] [3234]*/ + 0x20,0x17,0x00,0x42,0x41,0x41,0x44,0x54,0x54,0x64,0x44,0x43,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x24,0x14,0x54,0x44,0xC4,0x04,0x04,0x14,0x08, + /* 0xC3C7 [?] [3235]*/ + 0x09,0x08,0x08,0x12,0x12,0x32,0x32,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x00,0x80,0xBC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xC3C8 [?] [3236]*/ + 0x08,0x08,0xFF,0x08,0x00,0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x01,0x02, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x14,0x08, + /* 0xC3C9 [?] [3237]*/ + 0x08,0xFF,0x08,0x7F,0x40,0x8F,0x00,0x7F,0x06,0x3B,0x04,0x19,0x62,0x0C,0x72,0x01, + 0x20,0xFE,0x20,0xFE,0x02,0xE4,0x00,0xFC,0x00,0x08,0xB0,0xC0,0xA0,0x98,0x86,0x00, + /* 0xC3CA [?] [3238]*/ + 0x21,0x27,0x21,0x27,0xF4,0x23,0x20,0x77,0x68,0xA1,0xA6,0x21,0x26,0x21,0x26,0x20, + 0x10,0xFC,0x10,0xFC,0x04,0xF8,0x00,0xFC,0x80,0x44,0xA8,0x70,0xA8,0x26,0xA0,0x40, + /* 0xC3CB [?] [3239]*/ + 0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x01,0x02,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x84,0x14,0x08,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xC3CC [?] [3240]*/ + 0x20,0x21,0x38,0x20,0x40,0x7B,0xA0,0x20,0xF8,0x21,0x21,0x21,0x29,0x31,0x27,0x00, + 0x00,0xFC,0x08,0x10,0x20,0xFE,0x20,0xA0,0x40,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xC3CD [?] [3241]*/ + 0x00,0x45,0x28,0x10,0x28,0x4B,0x88,0x08,0x18,0x29,0x49,0x89,0x09,0x09,0x57,0x20, + 0x00,0xFC,0x08,0x10,0x20,0xFE,0x20,0xA0,0x40,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xC3CE [?] [3242]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC8,0x04,0x07,0x08,0x14,0x22,0x01,0x02,0x0C,0x70, + 0x20,0x20,0xFC,0x20,0x70,0xA8,0x26,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xC3CF [?] [3243]*/ + 0x00,0x1F,0x00,0x01,0xFF,0x01,0x01,0x05,0x02,0x3F,0x24,0x24,0x24,0x24,0xFF,0x00, + 0x00,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xC3D0 [?] [3244]*/ + 0x00,0x00,0x79,0x48,0x48,0x78,0x48,0x4B,0x78,0x48,0x48,0x49,0x79,0x4A,0x00,0x00, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xC3D1 [?] [3245]*/ + 0x00,0xFE,0x29,0x28,0xFE,0xAA,0xAA,0xAB,0xAE,0xC2,0x82,0xFE,0x82,0x83,0xFE,0x82, + 0x08,0x4A,0x2A,0xAC,0x88,0x3E,0x08,0x98,0x9C,0xAA,0xCA,0x88,0x88,0x40,0x3E,0x00, + /* 0xC3D2 [?] [3246]*/ + 0x00,0x3F,0x24,0x3F,0x26,0x2D,0x34,0x21,0x21,0x3F,0x21,0x2F,0x21,0x5F,0x41,0x81, + 0x80,0xFE,0x10,0x7C,0x38,0x54,0x12,0x20,0x20,0x3E,0x20,0x3C,0x20,0x3E,0x20,0x20, + /* 0xC3D3 [?] [3247]*/ + 0x01,0x00,0x3F,0x22,0x2F,0x26,0x2B,0x32,0x20,0x24,0x22,0x3F,0x21,0x42,0x44,0x98, + 0x00,0x80,0xFE,0x10,0x7C,0x38,0x54,0x92,0x80,0x90,0xA0,0xFC,0xC0,0xA0,0x98,0x86, + /* 0xC3D4 [?] [3248]*/ + 0x00,0x22,0x11,0x11,0x00,0x07,0xF0,0x10,0x11,0x12,0x14,0x10,0x10,0x28,0x47,0x00, + 0x40,0x48,0x48,0x50,0x40,0xFC,0x40,0xE0,0x50,0x48,0x44,0x40,0x40,0x00,0xFE,0x00, + /* 0xC3D5 [?] [3249]*/ + 0x00,0x40,0x24,0x22,0x02,0x00,0xE0,0x26,0x22,0x22,0x23,0x22,0x2A,0x35,0x28,0x00, + 0x10,0x92,0x52,0x54,0x10,0xFE,0x10,0x38,0x54,0x92,0x10,0x10,0x10,0x00,0xFE,0x00, + /* 0xC3D6 [?] [3250]*/ + 0x00,0xF8,0x08,0x09,0x09,0x7A,0x44,0x40,0x41,0x79,0x0A,0x0A,0x0C,0x08,0x50,0x20, + 0x80,0x80,0x80,0xFE,0x02,0x04,0x20,0x20,0x28,0x24,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xC3D7 [?] [3251]*/ + 0x01,0x21,0x11,0x09,0x09,0x01,0x7F,0x03,0x05,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x00,0x08,0x08,0x10,0x20,0x00,0xFC,0x80,0x40,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xC3D8 [?] [3252]*/ + 0x08,0x1C,0xF0,0x10,0x10,0xFC,0x10,0x3A,0x36,0x52,0x54,0x90,0x11,0x12,0x14,0x10, + 0x00,0x40,0x20,0x28,0x08,0x88,0x90,0x94,0xA2,0xA2,0xC2,0x88,0x88,0x88,0x78,0x00, + /* 0xC3D9 [?] [3253]*/ + 0x01,0x7E,0x12,0x09,0x09,0x00,0x1F,0x10,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0xF8,0x00,0x10,0x10,0x20,0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x80,0x82,0x82,0x7E, + /* 0xC3DA [?] [3254]*/ + 0x00,0x20,0x10,0x10,0x81,0x41,0x41,0x15,0x15,0x25,0xE5,0x29,0x21,0x23,0x24,0x08, + 0x00,0x80,0x40,0x28,0x28,0x08,0x10,0x14,0x22,0x22,0x42,0x88,0x08,0x08,0xF8,0x00, + /* 0xC3DB [?] [3255]*/ + 0x02,0x01,0x7F,0x42,0x89,0x28,0x49,0x0E,0x77,0x01,0x3F,0x21,0x3F,0x01,0x7F,0x00, + 0x00,0x00,0xFE,0x02,0x24,0x48,0x94,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x08,0xFC,0x04, + /* 0xC3DC [?] [3256]*/ + 0x02,0x01,0x7F,0x40,0x82,0x09,0x28,0x4B,0x1C,0xE7,0x01,0x21,0x21,0x21,0x3F,0x00, + 0x00,0x00,0xFE,0x02,0x24,0x40,0x88,0x14,0x10,0xF0,0x00,0x08,0x08,0x08,0xF8,0x08, + /* 0xC3DD [?] [3257]*/ + 0x00,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x02,0xFF,0x09,0x3F,0xD1,0x11,0x11,0x01, + 0x00,0xFE,0x02,0xF4,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x20,0xF8,0x16,0x50,0x20,0x00, + /* 0xC3DE [?] [3258]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x38,0x54,0x53,0x92,0x12,0x12,0x12,0x10,0x10, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xC3DF [?] [3259]*/ + 0x00,0x01,0x7D,0x45,0x45,0x7D,0x45,0x45,0x7D,0x45,0x45,0x45,0x7D,0x45,0x01,0x01, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x4A,0x86,0x02, + /* 0xC3E0 [?] [3260]*/ + 0x10,0x10,0x21,0x21,0x49,0xF1,0x11,0x20,0x40,0xFB,0x42,0x02,0x1A,0xE2,0x40,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xC3E1 [?] [3261]*/ + 0x7F,0x40,0x5F,0x40,0x5F,0x04,0x0F,0x10,0x3F,0x51,0x11,0x1F,0x02,0x04,0x18,0x60, + 0xFC,0x04,0xF4,0x04,0xF4,0x00,0xE0,0x20,0xF8,0x08,0x08,0xF8,0x80,0x82,0x82,0x7E, + /* 0xC3E2 [?] [3262]*/ + 0x08,0x08,0x0F,0x10,0x20,0x7F,0xA1,0x21,0x21,0x3F,0x22,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0x08,0xF8,0x88,0x80,0x80,0x82,0x82,0x7E, + /* 0xC3E3 [?] [3263]*/ + 0x20,0x20,0x3E,0x44,0x88,0x7F,0x49,0x49,0x49,0x7F,0x14,0x14,0x25,0x24,0x43,0x80, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x44,0x44,0x94,0x0A,0x02,0xFE,0x00, + /* 0xC3E4 [?] [3264]*/ + 0x10,0x10,0x10,0x11,0xFE,0x25,0x25,0x25,0x25,0x49,0x28,0x10,0x28,0x44,0x81,0x02, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0xFC,0x50,0x50,0x90,0x92,0x12,0x0E, + /* 0xC3E5 [?] [3265]*/ + 0x10,0x17,0x20,0x20,0x4B,0xF2,0x12,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x43,0x02, + 0x00,0xFE,0x40,0x80,0xFC,0x94,0x94,0xF4,0x94,0x94,0xF4,0x94,0x94,0x94,0xFC,0x04, + /* 0xC3E6 [?] [3266]*/ + 0x00,0xFF,0x02,0x02,0x04,0x3F,0x24,0x24,0x27,0x24,0x24,0x27,0x24,0x24,0x3F,0x20, + 0x00,0xFE,0x00,0x00,0x00,0xF8,0x48,0x48,0xC8,0x48,0x48,0xC8,0x48,0x48,0xF8,0x08, + /* 0xC3E7 [?] [3267]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC3E8 [?] [3268]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x04, + /* 0xC3E9 [?] [3269]*/ + 0x00,0x00,0x7B,0x48,0x48,0x78,0x49,0x49,0x79,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x04, + /* 0xC3EA [?] [3270]*/ + 0x08,0xFF,0x08,0x08,0x30,0xCA,0x2C,0x30,0xC8,0x14,0x24,0xCC,0x14,0x24,0xD4,0x09, + 0x20,0xFE,0x20,0x10,0x20,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x48,0x4A,0x8A,0x06, + /* 0xC3EB [?] [3271]*/ + 0x08,0x1C,0xF0,0x10,0x10,0xFC,0x11,0x31,0x3A,0x54,0x54,0x90,0x10,0x10,0x10,0x13, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xC3EC [?] [3272]*/ + 0x40,0x20,0x2F,0x89,0x49,0x4F,0x09,0x29,0x2F,0x49,0xC9,0x4F,0x49,0x40,0x40,0x01, + 0x10,0x10,0x10,0x10,0x14,0x52,0x52,0x92,0x10,0x14,0x04,0x08,0x10,0x20,0x40,0x80, + /* 0xC3ED [?] [3273]*/ + 0x01,0x00,0x3F,0x20,0x20,0x20,0x2F,0x28,0x28,0x28,0x2F,0x28,0x48,0x48,0x8F,0x08, + 0x00,0x80,0xFE,0x00,0x80,0x80,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0xF8,0x08, + /* 0xC3EE [?] [3274]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x25,0x25,0x26,0x48,0x28,0x10,0x28,0x44,0x80,0x03, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xC3EF [?] [3275]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x24,0x24,0x3F,0x00,0x3F,0x20,0x30,0x28,0x24,0x40,0x83, + 0x20,0xFE,0x20,0x00,0xF8,0x48,0x48,0xF8,0x90,0xFC,0x80,0x48,0x50,0x24,0xD4,0x0C, + /* 0xC3F0 [?] [3276]*/ + 0x00,0xFF,0x01,0x01,0x11,0x11,0x11,0x21,0x42,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0xFE,0x00,0x00,0x08,0x08,0x10,0x20,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xC3F1 [?] [3277]*/ + 0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x24,0x28,0x30,0x20, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x80,0x80,0xFC,0x80,0x40,0x40,0x24,0x14,0x0C,0x04, + /* 0xC3F2 [?] [3278]*/ + 0x10,0x13,0x12,0x12,0xFE,0x13,0x12,0x16,0x1B,0x32,0xD2,0x12,0x12,0x12,0x53,0x22, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x8A,0x06,0x02, + /* 0xC3F3 [?] [3279]*/ + 0x00,0x00,0x3F,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFF,0x00,0x00, + 0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xFE,0x00,0x00, + /* 0xC3F4 [?] [3280]*/ + 0x40,0x40,0x7F,0x80,0x7E,0x42,0x52,0x4A,0xFF,0x42,0x92,0x8A,0xFF,0x02,0x14,0x09, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0xA8,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xC3F5 [?] [3281]*/ + 0x11,0x10,0x12,0x12,0x1A,0x56,0x53,0x52,0x92,0x12,0x12,0x12,0x13,0x12,0x12,0x12, + 0x00,0xBE,0x82,0x02,0x42,0x22,0xFE,0x92,0x52,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xC3F6 [?] [3282]*/ + 0x20,0x17,0x00,0x41,0x41,0x4F,0x49,0x49,0x49,0x4F,0x49,0x41,0x41,0x5E,0x48,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x24,0xF4,0x14,0x04,0x0C, + /* 0xC3F7 [?] [3283]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x01,0x01,0x02,0x04, + 0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x04,0x04,0x14,0x08, + /* 0xC3F8 [?] [3284]*/ + 0x20,0x23,0x22,0xF8,0xA9,0xA9,0xA9,0xA9,0xF9,0xA0,0x20,0x2B,0x38,0xE8,0x41,0x02, + 0x00,0xFE,0x02,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xFE,0x00,0x88,0x04,0x02, + /* 0xC3F9 [?] [3285]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x78,0x48,0x03,0x00,0x00,0x00, + 0x20,0x40,0xFC,0x04,0x44,0x24,0x24,0x0C,0x00,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xC3FA [?] [3286]*/ + 0x10,0x10,0x3C,0x21,0x42,0xBC,0x10,0x10,0xFC,0x11,0x12,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0xFC,0x04,0x88,0x50,0x20,0x40,0x80,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xC3FB [?] [3287]*/ + 0x02,0x02,0x07,0x08,0x14,0x62,0x02,0x01,0x06,0x1F,0xE8,0x08,0x08,0x08,0x0F,0x08, + 0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC3FC [?] [3288]*/ + 0x01,0x01,0x02,0x04,0x08,0x37,0xC0,0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x00,0x00, + 0x00,0x00,0x80,0x40,0x20,0xD8,0x06,0x00,0xF8,0x88,0x88,0x88,0xA8,0x90,0x80,0x80, + /* 0xC3FD [?] [3289]*/ + 0x00,0x47,0x20,0x24,0x02,0x04,0xE0,0x21,0x26,0x20,0x23,0x20,0x2B,0x30,0x20,0x07, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x50,0x88,0x26,0xC0,0x10,0x64,0x88,0x30,0xC0,0x00, + /* 0xC3FE [?] [3290]*/ + 0x11,0x11,0x17,0x11,0xFC,0x13,0x12,0x17,0x1A,0x33,0xD0,0x17,0x10,0x11,0x52,0x24, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xC4A1 [?] [3291]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x10,0x27,0xC1,0x1F,0x01,0x03, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x50,0x88,0x06,0xF0,0x00,0x00, + /* 0xC4A2 [?] [3292]*/ + 0x08,0xFF,0x08,0x3F,0x22,0x2F,0x23,0x26,0x2A,0x20,0x3F,0x44,0x4F,0x94,0x27,0x04, + 0x20,0xFE,0xA0,0xFE,0x10,0xBC,0x18,0xB4,0x52,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08, + /* 0xC4A3 [?] [3293]*/ + 0x11,0x11,0x17,0x11,0xFC,0x13,0x32,0x3B,0x56,0x53,0x90,0x17,0x10,0x11,0x12,0x14, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xC4A4 [?] [3294]*/ + 0x00,0x78,0x4B,0x48,0x48,0x79,0x49,0x49,0x49,0x79,0x48,0x4B,0x48,0x48,0x49,0x9A, + 0x88,0x88,0xFE,0x88,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xC4A5 [?] [3295]*/ + 0x00,0x3F,0x22,0x2F,0x22,0x27,0x2A,0x22,0x2F,0x21,0x22,0x27,0x4A,0x52,0x83,0x02, + 0x80,0xFE,0x10,0x7C,0x10,0x38,0xD4,0x10,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC4A6 [?] [3296]*/ + 0x00,0x3F,0x24,0x3F,0x26,0x2D,0x34,0x20,0x27,0x20,0x27,0x20,0x2F,0x40,0x41,0x80, + 0x80,0xFE,0x10,0x7C,0x38,0x54,0x12,0x38,0xC0,0x40,0xF8,0x40,0xFE,0x40,0x40,0x80, + /* 0xC4A7 [?] [3297]*/ + 0x00,0x3F,0x24,0x3F,0x26,0x2D,0x35,0x2F,0x28,0x2F,0x28,0x2F,0x21,0x42,0x4C,0xB0, + 0x80,0xFE,0x10,0x7C,0x38,0x54,0x12,0xF8,0x88,0xF8,0x88,0xF8,0x50,0xF8,0x8A,0x7E, + /* 0xC4A8 [?] [3298]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x15,0x18,0x30,0xD0,0x11,0x11,0x12,0x50,0x20, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xC4A9 [?] [3299]*/ + 0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x7F,0x03,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFC,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xC4AA [?] [3300]*/ + 0x08,0x08,0xFF,0x08,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0x7F,0x02,0x04,0x18,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x80,0x40,0x30,0x0E, + /* 0xC4AB [?] [3301]*/ + 0x00,0x3F,0x29,0x25,0x3F,0x01,0x3F,0x01,0xFF,0x24,0x42,0x01,0x3F,0x01,0x01,0xFF, + 0x00,0xF8,0x28,0x48,0xF8,0x00,0xF8,0x00,0xFE,0x48,0x24,0x00,0xF8,0x00,0x00,0xFE, + /* 0xC4AC [?] [3302]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x93,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA9,0x82, + 0x20,0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC4AD [?] [3303]*/ + 0x00,0x20,0x10,0x17,0x80,0x40,0x48,0x0B,0x10,0x10,0xE1,0x22,0x24,0x28,0x20,0x00, + 0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40,0x40, + /* 0xC4AE [?] [3304]*/ + 0x01,0x21,0x17,0x11,0x80,0x43,0x4A,0x0B,0x12,0x13,0xE0,0x27,0x20,0x21,0x22,0x0C, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xC4AF [?] [3305]*/ + 0x01,0x7F,0x40,0x84,0x3F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x02,0x7F,0x04,0x18,0xE0, + 0x00,0xFE,0x02,0x44,0xF8,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x40,0x30,0x0E, + /* 0xC4B0 [?] [3306]*/ + 0x00,0x7D,0x44,0x48,0x48,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x51,0x41,0x41,0x41, + 0x00,0xFE,0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC4B1 [?] [3307]*/ + 0x02,0x42,0x2F,0x22,0x02,0x03,0xE2,0x22,0x23,0x20,0x2F,0x20,0x29,0x32,0x2C,0x00, + 0x08,0x08,0xFE,0x08,0x08,0xF8,0x08,0x08,0xF8,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xC4B2 [?] [3308]*/ + 0x02,0x04,0x08,0x10,0x3F,0x00,0x01,0x11,0x1F,0x21,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0x20,0x10,0xF8,0x08,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xC4B3 [?] [3309]*/ + 0x08,0x08,0xFF,0x08,0x08,0x0F,0x08,0x08,0x0F,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0xFE,0x20,0x20,0xE0,0x20,0x20,0xE0,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC4B4 [?] [3310]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x17,0x1A,0x32,0xD2,0x12,0x13,0x10,0x50,0x20, + 0x00,0xF8,0x08,0x48,0x28,0x08,0x08,0xFE,0x08,0x88,0x48,0x08,0xFE,0x08,0x50,0x20, + /* 0xC4B5 [?] [3311]*/ + 0x08,0x08,0x48,0x48,0x7E,0x48,0x89,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08,0x0B,0x08, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xC4B6 [?] [3312]*/ + 0x02,0x01,0x01,0xFF,0x00,0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x20, + 0x00,0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC4B7 [?] [3313]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x24,0x27,0x25,0x49,0x29,0x11,0x29,0x44,0x84,0x00, + 0x00,0xFC,0x84,0xA4,0x94,0x84,0x84,0xFE,0x04,0x44,0x24,0x04,0xFE,0x04,0x28,0x10, + /* 0xC4B8 [?] [3314]*/ + 0x00,0x1F,0x10,0x12,0x11,0x11,0xFF,0x20,0x22,0x21,0x21,0x3F,0x00,0x00,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0xA0,0x40, + /* 0xC4B9 [?] [3315]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x10,0x21,0xCF,0x01,0x01,0x3F, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0x08,0xE6,0x00,0x00,0xF8, + /* 0xC4BA [?] [3316]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x10,0x2F,0xC8,0x0F,0x08,0x0F, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0xE8,0x26,0xE0,0x20,0xE0, + /* 0xC4BB [?] [3317]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x11,0x3F,0xD1,0x11,0x11,0x01, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0xF8,0x16,0x50,0x20,0x00, + /* 0xC4BC [?] [3318]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x10,0x22,0xDF,0x04,0x08,0x30, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0x08,0xF6,0x10,0x50,0x20, + /* 0xC4BD [?] [3319]*/ + 0x04,0x7F,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x12,0x22,0xCB,0x12,0x2A,0x04, + 0x40,0xFC,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x10,0x08,0x26,0x90,0x90,0x00, + /* 0xC4BE [?] [3320]*/ + 0x01,0x01,0x01,0x01,0x7F,0x03,0x05,0x05,0x09,0x11,0x21,0x41,0x81,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0xFC,0x80,0x40,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00, + /* 0xC4BF [?] [3321]*/ + 0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x3F,0x20, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC4C0 [?] [3322]*/ + 0x00,0x00,0x79,0x48,0x48,0x7B,0x48,0x49,0x7A,0x48,0x49,0x48,0x78,0x48,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x88,0x04,0x22,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC4C1 [?] [3323]*/ + 0x08,0x08,0x48,0x48,0x7E,0x49,0x8A,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08,0x09,0x0A, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xC4C2 [?] [3324]*/ + 0x08,0x1C,0xF1,0x11,0x11,0xFD,0x11,0x38,0x35,0x56,0x50,0x93,0x10,0x11,0x10,0x13, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x24,0x32,0xC0,0x18,0x60,0x8C,0x30,0xC0, + /* 0xC4C3 [?] [3325]*/ + 0x01,0x06,0x18,0xEF,0x00,0x1F,0x10,0x1F,0x00,0x1F,0x01,0x3F,0x01,0x7F,0x01,0x03, + 0x00,0xC0,0x30,0xEE,0x00,0xF0,0x10,0xF0,0x20,0xC0,0x00,0xF8,0x00,0xFC,0x00,0x00, + /* 0xC4C4 [?] [3326]*/ + 0x00,0x0F,0x72,0x52,0x52,0x57,0x52,0x52,0x52,0x5F,0x72,0x52,0x02,0x04,0x05,0x08, + 0x00,0xDE,0x52,0x52,0x54,0xD4,0x58,0x54,0x52,0xD2,0x52,0x5A,0x54,0x50,0x50,0x90, + /* 0xC4C5 [?] [3327]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7B,0x4A,0x02,0x02,0x02,0x02, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xA4,0x94,0x14,0x04,0x04,0x04,0x14,0x08, + /* 0xC4C6 [?] [3328]*/ + 0x10,0x10,0x3C,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xC4C7 [?] [3329]*/ + 0x00,0x7E,0x12,0x12,0x12,0x7E,0x12,0x12,0x7E,0x12,0x12,0x22,0x22,0x4A,0x84,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xC4C8 [?] [3330]*/ + 0x20,0x2F,0x22,0x22,0xF2,0x57,0x52,0x52,0x52,0x9F,0x52,0x22,0x22,0x54,0x55,0x88, + 0x00,0xDE,0x52,0x52,0x54,0xD4,0x58,0x54,0x52,0xD2,0x52,0x5A,0x54,0x50,0x50,0x90, + /* 0xC4C9 [?] [3331]*/ + 0x10,0x10,0x20,0x20,0x4B,0xF2,0x12,0x22,0x42,0xFA,0x42,0x03,0x1A,0xE2,0x42,0x02, + 0x20,0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xC4CA [?] [3332]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x3F,0x11,0x12,0x17,0x20,0x20,0x42,0x81, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x10,0xD0,0x4A,0x4A,0x86,0x02, + /* 0xC4CB [?] [3333]*/ + 0x00,0x3F,0x04,0x04,0x04,0x04,0x04,0x04,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0xF0,0x10,0x20,0x20,0x40,0x7C,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC4CC [?] [3334]*/ + 0x10,0x10,0x13,0x10,0xFC,0x24,0x24,0x24,0x24,0x48,0x29,0x11,0x29,0x46,0x82,0x04, + 0x00,0x00,0xF8,0x88,0x90,0x90,0xA0,0xBC,0x84,0x84,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC4CD [?] [3335]*/ + 0x00,0xFF,0x08,0x08,0x10,0x7F,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x41,0x43, + 0x08,0x88,0x08,0x08,0xFE,0x08,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x28,0x10, + /* 0xC4CE [?] [3336]*/ + 0x02,0x02,0x7F,0x04,0x08,0x30,0xCF,0x00,0x00,0x7F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x00,0x00,0xFC,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xC4CF [?] [3337]*/ + 0x01,0x01,0xFF,0x01,0x01,0x7F,0x48,0x44,0x4F,0x41,0x41,0x5F,0x41,0x41,0x41,0x40, + 0x00,0x00,0xFE,0x00,0x00,0xFC,0x24,0x44,0xE4,0x04,0x04,0xF4,0x04,0x04,0x14,0x08, + /* 0xC4D0 [?] [3338]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x01,0x01,0x7F,0x02,0x04,0x08,0x30,0xC0, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x04,0x28,0x10, + /* 0xC4D1 [?] [3339]*/ + 0x00,0x00,0xFC,0x05,0x05,0x4B,0x2D,0x29,0x11,0x11,0x29,0x25,0x45,0x81,0x01,0x01, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xC4D2 [?] [3340]*/ + 0x01,0x7F,0x11,0x1F,0x01,0xFF,0x92,0x1E,0x04,0x3F,0x04,0xFF,0x04,0x0C,0x35,0xC6, + 0x00,0xFC,0x10,0xF0,0x00,0xFE,0x92,0xF0,0x40,0xF8,0x40,0xFE,0x88,0x50,0x30,0x0E, + /* 0xC4D3 [?] [3341]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x13,0x18,0x33,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xC4D4 [?] [3342]*/ + 0x00,0x78,0x48,0x4F,0x48,0x78,0x48,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x4A,0x4B,0x98, + 0x40,0x20,0x20,0xFE,0x00,0x00,0x90,0x54,0x24,0x24,0x54,0x94,0x04,0x04,0xFC,0x04, + /* 0xC4D5 [?] [3343]*/ + 0x10,0x10,0x10,0x17,0x18,0x54,0x50,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x13,0x10, + 0x40,0x20,0x20,0xFE,0x00,0x00,0x90,0x54,0x24,0x24,0x54,0x94,0x04,0x04,0xFC,0x04, + /* 0xC4D6 [?] [3344]*/ + 0x20,0x17,0x00,0x42,0x41,0x5F,0x41,0x41,0x4F,0x49,0x49,0x49,0x49,0x41,0x41,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0xA4,0x44,0x04,0x14,0x08, + /* 0xC4D7 [?] [3345]*/ + 0x00,0x20,0x10,0x10,0x83,0x42,0x4B,0x0A,0x13,0x12,0xE0,0x27,0x20,0x20,0x20,0x00, + 0x40,0x40,0x7E,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x44,0x40,0xFE,0x40,0x40,0x40,0x40, + /* 0xC4D8 [?] [3346]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4B,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x04,0x04,0x08,0x10, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xC4D9 [?] [3347]*/ + 0x20,0x20,0x23,0x38,0x4A,0x51,0x81,0x20,0x23,0x20,0x21,0x23,0x28,0x30,0x21,0x06, + 0x08,0x3C,0xC0,0x44,0x24,0x28,0x00,0x40,0xFE,0x88,0x08,0x90,0x60,0x50,0x88,0x04, + /* 0xC4DA [?] [3348]*/ + 0x01,0x01,0x01,0x7F,0x41,0x41,0x41,0x42,0x42,0x44,0x48,0x50,0x40,0x40,0x40,0x40, + 0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x84,0x44,0x24,0x14,0x14,0x04,0x04,0x14,0x08, + /* 0xC4DB [?] [3349]*/ + 0x21,0x21,0x27,0x21,0xF1,0x57,0x55,0x55,0x57,0x91,0x53,0x25,0x29,0x51,0x51,0x81, + 0x08,0x08,0xC8,0x10,0x1E,0xE4,0x54,0x54,0xD4,0x14,0x94,0x48,0x48,0x14,0x14,0x22, + /* 0xC4DC [?] [3350]*/ + 0x10,0x24,0x42,0xFF,0x01,0x00,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x42,0x4A,0x44, + 0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00,0x44,0x48,0x70,0x40,0x42,0x42,0x3E, + /* 0xC4DD [?] [3351]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x46,0x82,0x04, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xC4DE [?] [3352]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x06,0x38,0x20,0x3C,0x20,0x3F,0x08,0x10,0xE0, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x42,0x42,0x3E, + /* 0xC4DF [?] [3353]*/ + 0x08,0x08,0x0B,0x12,0x12,0x33,0x32,0x52,0x93,0x10,0x10,0x10,0x10,0x11,0x12,0x14, + 0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0xFC,0x90,0x90,0x90,0x90,0x12,0x12,0x0E, + /* 0xC4E0 [?] [3354]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x24,0x24,0x28,0x10, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xC4E1 [?] [3355]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x12,0x12,0x12,0x13,0x12,0x22,0x22,0x41,0x80, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0x0C,0x30,0xC0,0x02,0x02,0x02,0xFE,0x00, + /* 0xC4E2 [?] [3356]*/ + 0x10,0x10,0x10,0x12,0xFA,0x12,0x12,0x1A,0x32,0xD2,0x12,0x12,0x13,0x12,0x50,0x20, + 0x08,0x88,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x08,0x10,0x98,0x24,0x24,0x42,0x82, + /* 0xC4E3 [?] [3357]*/ + 0x08,0x08,0x08,0x11,0x11,0x32,0x34,0x50,0x91,0x11,0x12,0x12,0x14,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x02,0x04,0x20,0x20,0x28,0x24,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xC4E4 [?] [3358]*/ + 0x00,0x7F,0x40,0x44,0x7F,0x44,0x41,0x7F,0x44,0x4F,0x54,0x64,0x47,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x10,0xFE,0x10,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x00, + /* 0xC4E5 [?] [3359]*/ + 0x00,0x78,0x4F,0x48,0x4B,0x78,0x4B,0x48,0x4B,0x7A,0x4A,0x4A,0x4A,0x49,0x4A,0x9C, + 0x18,0x14,0xFE,0x10,0xD0,0x10,0xF0,0x10,0xE8,0x28,0xA8,0xA8,0xAA,0x4A,0x26,0x22, + /* 0xC4E6 [?] [3360]*/ + 0x02,0x41,0x21,0x2F,0x00,0x00,0xE4,0x24,0x24,0x27,0x20,0x21,0x22,0x54,0x8F,0x00, + 0x08,0x08,0x10,0xFE,0x40,0x40,0x44,0x44,0x44,0xFC,0x84,0x00,0x00,0x00,0xFE,0x00, + /* 0xC4E7 [?] [3361]*/ + 0x00,0x27,0x10,0x10,0x87,0x44,0x44,0x17,0x10,0x24,0xE2,0x22,0x24,0x20,0x25,0x02, + 0x00,0xBC,0x84,0x84,0xBC,0x20,0x20,0xBC,0x84,0xA4,0x94,0x94,0xA4,0x84,0x28,0x10, + /* 0xC4E8 [?] [3362]*/ + 0x08,0xFF,0x08,0x7F,0x01,0x11,0x11,0xFF,0x10,0x1F,0x20,0x3F,0x00,0x49,0x84,0x00, + 0x20,0xFE,0x20,0xFC,0x00,0xF8,0x00,0xFE,0x00,0xF8,0x00,0xFC,0x04,0x24,0x94,0x08, + /* 0xC4E9 [?] [3363]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x14,0x18,0x33,0xD2,0x12,0x12,0x12,0x12,0x53,0x22, + 0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC4EA [?] [3364]*/ + 0x10,0x10,0x1F,0x20,0x20,0x40,0x1F,0x10,0x10,0x10,0xFF,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFE,0x80,0x80,0x80,0x80,0x80, + /* 0xC4EB [?] [3365]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x26,0x22,0x04, + 0x00,0xFE,0x02,0x02,0xFE,0x24,0x24,0x7E,0x24,0x24,0xFE,0x52,0x54,0x48,0x64,0x42, + /* 0xC4EC [?] [3366]*/ + 0x10,0x10,0x13,0x10,0xFB,0x10,0x11,0x1A,0x33,0xD0,0x11,0x13,0x10,0x17,0x50,0x20, + 0x88,0x88,0xDE,0x88,0xDE,0x88,0x54,0x22,0xFC,0x80,0x20,0xFC,0x20,0xFE,0x20,0x20, + /* 0xC4ED [?] [3367]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x11,0x14,0x18,0x30,0xD0,0x12,0x12,0x12,0x54,0x20, + 0x20,0x20,0x50,0x88,0x44,0x22,0xF8,0x08,0x50,0x20,0xA4,0x82,0x8A,0x8A,0x78,0x00, + /* 0xC4EE [?] [3368]*/ + 0x01,0x01,0x02,0x04,0x0A,0x31,0xC1,0x0F,0x00,0x00,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0xE0,0x40,0x80,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xC4EF [?] [3369]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xC4F0 [?] [3370]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x10,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0xA2,0xA4,0x98,0x90,0x88,0xC4,0x82, + /* 0xC4F1 [?] [3371]*/ + 0x01,0x02,0x1F,0x10,0x12,0x11,0x11,0x10,0x10,0x1F,0x00,0x00,0x7F,0x00,0x00,0x00, + 0x00,0x00,0xF0,0x10,0x10,0x10,0x50,0x20,0x00,0xFC,0x04,0x04,0xE4,0x04,0x28,0x10, + /* 0xC4F2 [?] [3372]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x2E,0x22,0x22,0x24,0x44,0x48,0x92,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x80,0x80,0x88,0xD0,0xE0,0xA0,0xA0,0x90,0x88,0x84,0x00, + /* 0xC4F3 [?] [3373]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x18,0x30,0xD1,0x10,0x10,0x10,0x53,0x20, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC4F4 [?] [3374]*/ + 0x00,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x00,0x3E,0x02,0x22,0x14,0x08,0x34,0xC3, + 0x00,0xFC,0x20,0xE0,0x20,0xE0,0x3E,0xE0,0x20,0xF8,0x88,0x88,0x50,0x20,0xD8,0x06, + /* 0xC4F5 [?] [3375]*/ + 0x08,0xFF,0x28,0x7D,0x44,0x7C,0x41,0x7C,0x45,0x7C,0x00,0x1F,0x00,0xFF,0x01,0x03, + 0x20,0xFE,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x00,0xE0,0x40,0xFE,0x00,0x00, + /* 0xC4F6 [?] [3376]*/ + 0x00,0x00,0xF2,0x92,0x92,0x92,0x9F,0x90,0x94,0x94,0xF4,0x94,0x05,0x04,0x07,0x00, + 0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x00,0x44,0x44,0xA4,0x94,0x14,0x04,0xFC,0x04, + /* 0xC4F7 [?] [3377]*/ + 0x20,0x23,0x39,0x21,0x41,0x79,0xA1,0x27,0xF8,0x27,0x20,0x22,0x29,0x32,0x24,0x08, + 0x00,0xFC,0x08,0xF8,0x08,0xF8,0x0E,0xF8,0x08,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xC4F8 [?] [3378]*/ + 0x20,0x20,0x3B,0x22,0x43,0x7A,0xA3,0x22,0xFB,0x20,0x27,0x20,0x29,0x32,0x24,0x00, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xC4F9 [?] [3379]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x17,0x10,0x20,0xE7,0x20,0x20,0x20,0x2F,0x00, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xC4FA [?] [3380]*/ + 0x09,0x09,0x11,0x32,0x54,0x99,0x11,0x12,0x14,0x11,0x10,0x02,0x51,0x51,0x90,0x0F, + 0x00,0x00,0xFC,0x04,0x48,0x50,0x48,0x44,0x44,0x40,0x80,0x00,0x04,0x12,0x12,0xF0, + /* 0xC4FB [?] [3381]*/ + 0x20,0x20,0x20,0x23,0xFA,0x24,0x20,0x70,0x6B,0xA0,0xA0,0x20,0x20,0x20,0x20,0x20, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xC4FC [?] [3382]*/ + 0x00,0x44,0x28,0x13,0x2A,0x4C,0x88,0x08,0x1B,0x28,0x48,0x88,0x08,0x08,0x50,0x20, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xC4FD [?] [3383]*/ + 0x04,0x45,0x26,0x24,0x03,0x10,0x14,0x17,0x2A,0x22,0xEF,0x22,0x25,0x24,0x28,0x01, + 0x00,0x7C,0x04,0xA8,0x90,0x7C,0x14,0x94,0x50,0x50,0xDC,0x50,0x50,0xB0,0x9E,0x00, + /* 0xC4FE [?] [3384]*/ + 0x02,0x01,0x01,0x7F,0x40,0x80,0x00,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0x00,0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC5A1 [?] [3385]*/ + 0x10,0x10,0x10,0x13,0xFA,0x14,0x10,0x18,0x33,0xD0,0x10,0x10,0x10,0x10,0x50,0x20, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xC5A2 [?] [3386]*/ + 0x00,0x20,0x10,0x17,0x84,0x48,0x40,0x10,0x17,0x20,0xE0,0x20,0x20,0x20,0x21,0x00, + 0x80,0x40,0x40,0xFC,0x04,0x08,0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xC5A3 [?] [3387]*/ + 0x01,0x11,0x11,0x11,0x1F,0x21,0x41,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC5A4 [?] [3388]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x10,0x15,0x18,0x30,0xD0,0x10,0x10,0x10,0x57,0x20, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFE,0x00, + /* 0xC5A5 [?] [3389]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBC,0x10,0x11,0xFC,0x10,0x10,0x10,0x14,0x18,0x13,0x00, + 0x00,0xF8,0x48,0x48,0x48,0x48,0x48,0xF8,0x88,0x88,0x88,0x88,0x88,0x88,0xFE,0x00, + /* 0xC5A6 [?] [3390]*/ + 0x10,0x11,0x20,0x24,0x44,0xF8,0x10,0x21,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x47,0x00, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFE,0x00, + /* 0xC5A7 [?] [3391]*/ + 0x00,0x78,0x48,0x4B,0x4A,0x7C,0x48,0x48,0x49,0x7A,0x4C,0x48,0x48,0x48,0x48,0x98, + 0x20,0x20,0x20,0xFE,0x42,0x44,0xA0,0xA2,0xA4,0x98,0x90,0x88,0x84,0xA2,0xC0,0x80, + /* 0xC5A8 [?] [3392]*/ + 0x00,0x20,0x10,0x17,0x84,0x48,0x41,0x11,0x13,0x25,0xE9,0x21,0x21,0x21,0x21,0x01, + 0x40,0x40,0x40,0xFC,0x84,0x88,0x40,0x44,0x48,0x30,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xC5A9 [?] [3393]*/ + 0x01,0x01,0x01,0x7F,0x42,0x82,0x05,0x05,0x08,0x18,0x28,0x48,0x88,0x0A,0x0C,0x08, + 0x00,0x00,0x00,0xFC,0x04,0x08,0x00,0x08,0x90,0xA0,0x40,0x20,0x10,0x08,0x06,0x00, + /* 0xC5AA [?] [3394]*/ + 0x00,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00,0x08,0x08,0xFF,0x08,0x10,0x20,0x40, + 0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xC5AB [?] [3395]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x24,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x81,0x02, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xC5AC [?] [3396]*/ + 0x10,0x10,0xFE,0x22,0x44,0x28,0x10,0x28,0xC5,0x02,0x02,0x7F,0x04,0x08,0x10,0x60, + 0x00,0x00,0xFC,0x84,0x88,0x50,0x20,0x58,0x86,0x00,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xC5AD [?] [3397]*/ + 0x10,0x10,0xFE,0x22,0x44,0x28,0x10,0x28,0xC5,0x00,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0xFC,0x84,0x88,0x50,0x20,0x58,0x86,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xC5AE [?] [3398]*/ + 0x02,0x02,0x02,0x02,0x04,0xFF,0x04,0x08,0x08,0x10,0x18,0x06,0x01,0x06,0x18,0x60, + 0x00,0x00,0x00,0x00,0x00,0xFE,0x20,0x20,0x20,0x40,0x40,0x80,0x80,0x60,0x10,0x08, + /* 0xC5AF [?] [3399]*/ + 0x00,0x07,0x7A,0x49,0x48,0x4B,0x78,0x48,0x4F,0x49,0x49,0x7A,0x4A,0x04,0x08,0x03, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xC5B0 [?] [3400]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x21,0x20,0x20,0x27,0x24,0x3F,0x44,0x47,0x80, + 0x00,0xF8,0x00,0xFC,0x04,0x60,0x88,0x08,0xF8,0x00,0xF8,0x00,0xFE,0x00,0xF8,0x00, + /* 0xC5B1 [?] [3401]*/ + 0x00,0x00,0x1F,0x10,0x90,0x53,0x52,0x12,0x32,0x5F,0x92,0x12,0x22,0x23,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00, + /* 0xC5B2 [?] [3402]*/ + 0x10,0x17,0x12,0x12,0xFA,0x17,0x12,0x1A,0x32,0xDF,0x12,0x12,0x12,0x14,0x55,0x28, + 0x00,0xDE,0x52,0x52,0x54,0xD4,0x58,0x54,0x52,0xD2,0x52,0x5A,0x54,0x50,0x50,0x90, + /* 0xC5B3 [?] [3403]*/ + 0x20,0x27,0x20,0x2F,0x38,0xAB,0xA0,0xA3,0xA0,0x2F,0x20,0x27,0x24,0x24,0x24,0x24, + 0x00,0xFC,0x40,0xFE,0x42,0x58,0x40,0x58,0x00,0xFE,0x40,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xC5B4 [?] [3404]*/ + 0x10,0x11,0x94,0x57,0x5A,0x11,0xFC,0x31,0x38,0x57,0x54,0x91,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFE,0x20,0xFC,0x54,0x54,0x54,0x0C, + /* 0xC5B5 [?] [3405]*/ + 0x01,0x41,0x27,0x21,0x01,0x00,0xE7,0x20,0x21,0x23,0x25,0x29,0x29,0x31,0x21,0x01, + 0x08,0x08,0xFE,0x08,0x48,0x40,0xFE,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5B6 [?] [3406]*/ + 0x00,0x01,0xF7,0x91,0x91,0x9F,0x91,0x91,0x91,0x93,0xFD,0x91,0x01,0x01,0x05,0x02, + 0x28,0xA4,0x24,0x20,0x20,0xFE,0x20,0x24,0xA4,0x28,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xC5B7 [?] [3407]*/ + 0x00,0x7E,0x40,0x44,0x64,0x54,0x49,0x48,0x54,0x54,0x64,0x40,0x40,0x7E,0x01,0x02, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC5B8 [?] [3408]*/ + 0x00,0x7E,0x40,0x44,0x64,0x54,0x48,0x48,0x54,0x54,0x64,0x40,0x41,0x7E,0x00,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xC5B9 [?] [3409]*/ + 0x00,0x7E,0x40,0x44,0x64,0x54,0x49,0x48,0x55,0x54,0x64,0x40,0x40,0x7E,0x00,0x03, + 0x00,0xF8,0x88,0x88,0x88,0x86,0x00,0x00,0xFC,0x84,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xC5BA [?] [3410]*/ + 0x08,0xFF,0x08,0x10,0x11,0x7D,0x11,0x7D,0x11,0xFC,0x13,0x3A,0x56,0x92,0x12,0x12, + 0x20,0xFE,0x20,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFE,0x22,0x2A,0xFA,0x0A,0x06, + /* 0xC5BB [?] [3411]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x03,0x02,0x03,0x00, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xC5BC [?] [3412]*/ + 0x10,0x17,0x14,0x24,0x27,0x64,0x64,0xA7,0x20,0x2F,0x28,0x28,0x2B,0x29,0x28,0x28, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0xFE,0x42,0x52,0xF2,0x12,0x0A,0x04, + /* 0xC5BD [?] [3413]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x23,0x22,0x23,0x00, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xC5BE [?] [3414]*/ + 0x02,0x02,0x72,0x52,0x5F,0x52,0x52,0x52,0x53,0x5E,0x72,0x52,0x02,0x02,0x0A,0x04, + 0x10,0x10,0x20,0x7C,0xC4,0x44,0x44,0xC4,0x7C,0x44,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xC5BF [?] [3415]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x52,0x5E,0xE4,0x08,0x10, + 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x02, + /* 0xC5C0 [?] [3416]*/ + 0x0E,0x74,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x52,0x52,0x51,0x90,0x10, + 0x00,0x00,0xFC,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00,0x00,0xFE,0x00, + /* 0xC5C1 [?] [3417]*/ + 0x10,0x10,0x10,0x7D,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x11,0x11,0x11,0x11, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5C2 [?] [3418]*/ + 0x10,0x10,0x10,0x11,0x19,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5C3 [?] [3419]*/ + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00,0x3F,0x21,0x21,0x3F,0x20,0x20,0x1F, + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x02,0x02,0xFE, + /* 0xC5C4 [?] [3420]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5C5 [?] [3421]*/ + 0x10,0x10,0x10,0x17,0xF8,0x10,0x10,0x1B,0x30,0xD0,0x10,0x17,0x10,0x10,0x50,0x20, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xC5C6 [?] [3422]*/ + 0x08,0x48,0x49,0x49,0x49,0x7D,0x41,0x41,0x79,0x48,0x49,0x4B,0x48,0x48,0x48,0x88, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xC5C7 [?] [3423]*/ + 0x08,0x08,0x10,0x27,0x48,0x08,0x10,0x33,0x50,0x90,0x10,0x17,0x10,0x10,0x10,0x10, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xC5C8 [?] [3424]*/ + 0x01,0x43,0x2E,0x22,0x02,0x8F,0x42,0x52,0x12,0x2F,0xE2,0x22,0x22,0x22,0x24,0x08, + 0x00,0xBC,0x10,0x10,0x3C,0x90,0x10,0x3C,0x10,0x90,0x7E,0x10,0x10,0x10,0x10,0x10, + /* 0xC5C9 [?] [3425]*/ + 0x00,0x20,0x17,0x14,0x84,0x45,0x45,0x15,0x15,0x25,0xE5,0x25,0x25,0x29,0x29,0x11, + 0x08,0x3C,0xC0,0x00,0x1C,0xE0,0x20,0x22,0x24,0x28,0x10,0x10,0x08,0x44,0x82,0x00, + /* 0xC5CA [?] [3426]*/ + 0x22,0x21,0xFA,0x20,0x72,0xA9,0x22,0xFF,0x08,0x37,0xC1,0x1F,0x01,0x7F,0x01,0x03, + 0x88,0x08,0xBE,0x08,0x9C,0x2A,0x88,0xFE,0x20,0xD8,0x06,0xF0,0x00,0xFC,0x00,0x00, + /* 0xC5CB [?] [3427]*/ + 0x00,0x27,0x12,0x11,0x87,0x41,0x42,0x14,0x13,0x22,0xE2,0x23,0x22,0x22,0x23,0x02, + 0x78,0xC0,0x48,0x50,0xFC,0x50,0x48,0x06,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x08, + /* 0xC5CC [?] [3428]*/ + 0x02,0x04,0x1F,0x11,0x10,0xFF,0x10,0x12,0x21,0x40,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0xF0,0x10,0x90,0xFE,0x10,0x10,0x50,0x20,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xC5CD [?] [3429]*/ + 0x08,0x3E,0x22,0x2A,0x7E,0x22,0x2A,0x46,0x00,0xFF,0x08,0x1F,0x28,0xC8,0x0F,0x08, + 0x78,0x48,0x8E,0x00,0xF8,0x48,0x30,0xCC,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC5CE [?] [3430]*/ + 0x00,0x00,0x78,0x48,0x49,0x79,0x4A,0x4D,0x78,0x48,0x48,0x48,0x79,0x49,0x02,0x04, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xC5CF [?] [3431]*/ + 0x00,0x00,0x7D,0x54,0x54,0x54,0x55,0x7C,0x54,0x54,0x57,0x54,0x7C,0x44,0x00,0x00, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xC5D0 [?] [3432]*/ + 0x04,0x44,0x24,0x25,0x04,0x7F,0x04,0x04,0x04,0xFF,0x04,0x08,0x08,0x10,0x20,0x40, + 0x04,0x84,0x84,0x24,0x24,0xA4,0x24,0x24,0x24,0xE4,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xC5D1 [?] [3433]*/ + 0x10,0x10,0x95,0x59,0x11,0x7D,0x11,0x11,0xFF,0x11,0x11,0x11,0x21,0x22,0x42,0x84, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xC5D2 [?] [3434]*/ + 0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0xFF,0x00,0x00,0x00,0x00,0x00, + 0x20,0xF0,0x00,0x00,0x00,0xF8,0x80,0x80,0x80,0x80,0xFE,0x00,0x40,0x20,0x10,0x08, + /* 0xC5D3 [?] [3435]*/ + 0x01,0x00,0x3F,0x22,0x22,0x22,0x2F,0x22,0x22,0x22,0x24,0x24,0x48,0x48,0x93,0x20, + 0x00,0x80,0xFE,0x20,0x10,0x00,0xFC,0x40,0x40,0x48,0x50,0x60,0x42,0xC2,0x3E,0x00, + /* 0xC5D4 [?] [3436]*/ + 0x02,0x01,0x3F,0x08,0x04,0x7F,0x42,0x81,0x3F,0x04,0x04,0x07,0x08,0x08,0x10,0x20, + 0x00,0x00,0xF8,0x20,0x40,0xFE,0x02,0x04,0xF8,0x00,0x00,0xF0,0x10,0x10,0x50,0x20, + /* 0xC5D5 [?] [3437]*/ + 0x10,0x10,0x13,0xFD,0x10,0x7B,0x12,0xFC,0x10,0x3B,0x34,0x54,0x90,0x11,0x11,0x12, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xC5D6 [?] [3438]*/ + 0x00,0x3C,0x25,0x24,0x24,0x3C,0x25,0x24,0x24,0x3C,0x27,0x24,0x24,0x44,0x54,0x88, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xC5D7 [?] [3439]*/ + 0x12,0x12,0x12,0x12,0xFA,0x17,0x12,0x1A,0x32,0xD2,0x12,0x12,0x14,0x14,0x58,0x30, + 0x10,0x10,0x10,0x7C,0x14,0x94,0x94,0x94,0xA4,0xA4,0xD4,0x8A,0x82,0x82,0x7E,0x00, + /* 0xC5D8 [?] [3440]*/ + 0x00,0x00,0x79,0x49,0x4A,0x4D,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x00,0x00, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xC5D9 [?] [3441]*/ + 0x10,0x10,0x3F,0x21,0x41,0xBD,0x25,0x25,0x3D,0x21,0x25,0x22,0x20,0x20,0x1F,0x00, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x84,0x84,0x94,0x08, + /* 0xC5DA [?] [3442]*/ + 0x10,0x10,0x11,0x15,0x5A,0x55,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x40,0x80, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xC5DB [?] [3443]*/ + 0x20,0x10,0x01,0xF9,0x0A,0x15,0x11,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x10,0x10, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xC5DC [?] [3444]*/ + 0x00,0x7C,0x45,0x45,0x46,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x00,0x00, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xC5DD [?] [3445]*/ + 0x01,0x21,0x11,0x12,0x82,0x47,0x4A,0x12,0x12,0x23,0xE2,0x22,0x22,0x22,0x21,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x14,0x08,0x02,0x02,0xFE,0x00, + /* 0xC5DE [?] [3446]*/ + 0x00,0x03,0x78,0x48,0x48,0x48,0x48,0x49,0x4A,0x4C,0x78,0x48,0x00,0x00,0x07,0x00, + 0x00,0xFC,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x44,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xC5DF [?] [3447]*/ + 0x00,0x7B,0x48,0x48,0x48,0x78,0x48,0x49,0x4A,0x7C,0x48,0x48,0x48,0x48,0x4F,0x98, + 0x00,0xFC,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x44,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xC5E0 [?] [3448]*/ + 0x10,0x10,0x11,0x10,0x11,0xFC,0x10,0x13,0x10,0x10,0x11,0x1D,0xE1,0x41,0x01,0x01, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5E1 [?] [3449]*/ + 0x04,0x04,0x7C,0x04,0x3C,0x04,0x7C,0x06,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x40,0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xC5E2 [?] [3450]*/ + 0x00,0x7C,0x45,0x54,0x55,0x54,0x54,0x57,0x54,0x54,0x55,0x11,0x29,0x25,0x45,0x81, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5E3 [?] [3451]*/ + 0x00,0x7C,0x45,0x48,0x49,0x50,0x48,0x4B,0x44,0x44,0x45,0x69,0x51,0x41,0x41,0x41, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xC5E4 [?] [3452]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x88,0x80,0x80,0x80,0x82,0x82,0x7E,0x00, + /* 0xC5E5 [?] [3453]*/ + 0x10,0x17,0x14,0x24,0x25,0x64,0x64,0xA5,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x28, + 0x00,0xFC,0x04,0x04,0xF4,0x44,0x44,0xF4,0x54,0x54,0x54,0x54,0x74,0x46,0x46,0x42, + /* 0xC5E6 [?] [3454]*/ + 0x00,0x40,0x20,0x2F,0x00,0x80,0x47,0x54,0x14,0x24,0xE4,0x24,0x24,0x20,0x20,0x00, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x54,0x48,0x40,0x40,0x40, + /* 0xC5E7 [?] [3455]*/ + 0x00,0x01,0x78,0x48,0x4B,0x48,0x48,0x49,0x49,0x49,0x79,0x49,0x01,0x00,0x00,0x03, + 0x20,0xFC,0x20,0x88,0xFE,0x88,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xC5E8 [?] [3456]*/ + 0x04,0x08,0x10,0x2F,0xC4,0x04,0x08,0x10,0x60,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x40,0x20,0x10,0xE8,0x26,0x20,0x20,0xA0,0x40,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xC5E9 [?] [3457]*/ + 0x00,0x01,0xFC,0x10,0x11,0x20,0x3C,0x64,0x67,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC5EA [?] [3458]*/ + 0x10,0x11,0x10,0x10,0xFD,0x10,0x10,0x14,0x1B,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC5EB [?] [3459]*/ + 0x01,0xFF,0x00,0x1F,0x10,0x1F,0x00,0x3F,0x00,0x01,0x01,0x05,0x02,0x48,0x44,0x84, + 0x00,0xFE,0x00,0xF0,0x10,0xF0,0x00,0xF0,0x60,0x80,0x00,0x00,0x00,0x88,0x44,0x44, + /* 0xC5EC [?] [3460]*/ + 0x01,0x41,0x2F,0x21,0x01,0x87,0x40,0x57,0x14,0x24,0xE7,0x24,0x22,0x20,0x2F,0x04, + 0x04,0x04,0xE8,0x10,0x00,0xC4,0x04,0xC8,0x50,0x42,0xC2,0x44,0x84,0xE8,0x10,0x20, + /* 0xC5ED [?] [3461]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7F,0x00,0x7F,0x41,0x41,0x7F,0x00,0x22,0x17,0xF8,0x40, + 0x00,0x04,0x84,0x08,0x10,0x22,0x02,0x04,0x08,0x10,0x22,0x02,0x04,0x88,0x10,0x60, + /* 0xC5EE [?] [3462]*/ + 0x08,0xFF,0x08,0x01,0x23,0x15,0x10,0x07,0x70,0x13,0x10,0x11,0x10,0x17,0x28,0x47, + 0x20,0xFE,0x20,0x00,0xF0,0x10,0xE0,0x1C,0x40,0xF8,0x40,0xF0,0x40,0xFC,0x40,0xFE, + /* 0xC5EF [?] [3463]*/ + 0x10,0x13,0x12,0x12,0xFE,0x13,0x32,0x3A,0x56,0x53,0x92,0x12,0x12,0x12,0x15,0x18, + 0x00,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0x52,0x52,0xA6, + /* 0xC5F0 [?] [3464]*/ + 0x00,0x03,0xFA,0x22,0x22,0x43,0x7A,0x4A,0xCA,0x4B,0x4A,0x4A,0x7A,0x4A,0x05,0x08, + 0x00,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0x52,0x52,0xA6, + /* 0xC5F1 [?] [3465]*/ + 0x20,0x3F,0x48,0x85,0x23,0x15,0x10,0x07,0x70,0x13,0x10,0x11,0x10,0x17,0x28,0x47, + 0x40,0x7E,0x90,0x08,0xF0,0x10,0xE0,0x1C,0x40,0xF8,0x40,0xF0,0x40,0xFC,0x40,0xFE, + /* 0xC5F2 [?] [3466]*/ + 0x00,0x78,0x4F,0x48,0x48,0x7B,0x48,0x4B,0x4A,0x7A,0x4B,0x4A,0x49,0x48,0x4F,0x9A, + 0x82,0x82,0xF4,0x88,0x80,0xE2,0x02,0xE4,0x28,0x20,0xE0,0x22,0x42,0x74,0x88,0x10, + /* 0xC5F3 [?] [3467]*/ + 0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x42,0x4A,0x85, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x84,0x94,0x08, + /* 0xC5F4 [?] [3468]*/ + 0x00,0x77,0x55,0x55,0x55,0x77,0x55,0x55,0x55,0x77,0x55,0x55,0x55,0xB5,0x89,0x13, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xC5F5 [?] [3469]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x13,0x14,0x19,0x32,0xD0,0x10,0x13,0x10,0x50,0x20, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x24,0x22,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xC5F6 [?] [3470]*/ + 0x01,0x00,0xF8,0x23,0x20,0x40,0x78,0x4C,0xCA,0x4A,0x48,0x48,0x78,0x48,0x07,0x00, + 0x08,0x90,0x00,0xFC,0x90,0x90,0x92,0x92,0x94,0x98,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xC5F7 [?] [3471]*/ + 0x10,0x13,0x10,0x10,0x10,0xFE,0x10,0x11,0x12,0x14,0x16,0x18,0xE0,0x40,0x07,0x00, + 0x00,0xFC,0x20,0x20,0x40,0x40,0xD0,0x48,0x44,0x44,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xC5F8 [?] [3472]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x00, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xC5F9 [?] [3473]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x7E,0x42,0x7E,0x40,0x7E,0x62,0xBE,0x22, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x10,0xFE,0x44,0x28,0xFE,0x10,0x7C,0x10,0x10, + /* 0xC5FA [?] [3474]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x20, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xC5FB [?] [3475]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xC5FC [?] [3476]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3C,0x00,0x7F,0x04,0x08,0x10,0x60, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xC5FD [?] [3477]*/ + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00,0x20,0x20,0x3E,0x20,0x20,0x26,0x38, + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00,0x80,0x84,0x98,0xE0,0x84,0x84,0x7C, + /* 0xC5FE [?] [3478]*/ + 0x00,0x01,0x7D,0x55,0x55,0x55,0x55,0x7D,0x55,0x55,0x55,0x55,0x7D,0x45,0x01,0x00, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xC6A1 [?] [3479]*/ + 0x00,0x00,0x7B,0x4A,0x4A,0x4B,0x4A,0x4A,0x4B,0x48,0x79,0x4F,0x00,0x00,0x00,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xC6A2 [?] [3480]*/ + 0x00,0x78,0x4B,0x4A,0x4A,0x7B,0x4A,0x4A,0x4B,0x78,0x49,0x4F,0x48,0x48,0x48,0x98, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xC6A3 [?] [3481]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x54,0x14,0x37,0x55,0x95,0x14,0x24,0x28,0x49,0x96, + 0x80,0x40,0xFE,0x40,0x40,0xFC,0x44,0x40,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xC6A4 [?] [3482]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x2F,0x24,0x24,0x22,0x21,0x20,0x41,0x46,0x98, + 0x80,0x80,0x80,0xFC,0x84,0x88,0x80,0xF0,0x10,0x10,0x20,0x40,0x80,0x40,0x30,0x0E, + /* 0xC6A5 [?] [3483]*/ + 0x00,0x7F,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x48,0x48,0x50,0x40,0x7F,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x44,0x44,0x44,0x3C,0x00,0x00,0xFE,0x00, + /* 0xC6A6 [?] [3484]*/ + 0x00,0x00,0x1F,0x10,0x97,0x50,0x50,0x11,0x36,0x50,0x90,0x13,0x22,0x22,0x42,0x83, + 0x80,0x40,0xFE,0x00,0xFC,0x20,0x40,0xD0,0x48,0x44,0x00,0xF8,0x08,0x08,0x08,0xF8, + /* 0xC6A7 [?] [3485]*/ + 0x10,0x10,0x17,0x24,0x24,0x64,0x67,0xA4,0x24,0x27,0x26,0x2A,0x2A,0x2B,0x32,0x20, + 0x10,0x08,0x88,0xBE,0x80,0x94,0x88,0x7E,0x08,0x88,0xBE,0x88,0x88,0x88,0x88,0x08, + /* 0xC6A8 [?] [3486]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x28,0x28,0x28,0x2F,0x28,0x28,0x48,0x49,0x8A,0x0C, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x40,0x40,0x44,0x48,0x50,0x60,0x44,0x44,0x44,0x3C, + /* 0xC6A9 [?] [3487]*/ + 0x3E,0x22,0x3E,0x20,0x7E,0xA2,0x3E,0x22,0x01,0xFF,0x00,0x3F,0x00,0x3F,0x20,0x3F, + 0x10,0xFE,0x44,0x28,0xFE,0x10,0xFC,0x10,0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8, + /* 0xC6AA [?] [3488]*/ + 0x20,0x3F,0x48,0x85,0x00,0x3F,0x20,0x3F,0x20,0x2F,0x29,0x29,0x2F,0x49,0x49,0x88, + 0x40,0x7E,0x90,0x08,0x80,0xFC,0x04,0xFC,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0x0C, + /* 0xC6AB [?] [3489]*/ + 0x10,0x10,0x17,0x24,0x24,0x67,0x64,0xA4,0x27,0x26,0x2A,0x2B,0x2A,0x2A,0x32,0x22, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0xA4,0xA4,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xC6AC [?] [3490]*/ + 0x00,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x20,0x20,0x40, + 0x40,0x40,0x40,0x40,0x40,0xFC,0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC6AD [?] [3491]*/ + 0x00,0xF8,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1E,0xE6,0x44,0x04,0x28,0x10, + 0x40,0x20,0xFE,0x02,0x02,0xFE,0x00,0x00,0xFE,0xAA,0xAA,0xFE,0xAA,0xAA,0xA2,0x86, + /* 0xC6AE [?] [3492]*/ + 0x00,0xFE,0x28,0xFE,0xAA,0xAA,0xFE,0x00,0x7C,0x00,0xFE,0x10,0x54,0x93,0x51,0x22, + 0x00,0xF8,0x88,0x88,0x88,0x98,0xD8,0xA8,0xA8,0xA8,0xD8,0x8A,0x8A,0x0A,0x06,0x02, + /* 0xC6AF [?] [3493]*/ + 0x00,0x4F,0x20,0x27,0x04,0x84,0x47,0x50,0x17,0x20,0xEF,0x20,0x22,0x24,0x29,0x00, + 0x00,0xFE,0xA0,0xFC,0xA4,0xA4,0xFC,0x00,0xFC,0x00,0xFE,0x40,0x48,0x44,0x42,0x80, + /* 0xC6B0 [?] [3494]*/ + 0x00,0xFE,0x28,0xFE,0xAA,0xAA,0xFE,0x00,0x7C,0x00,0xFE,0x10,0x54,0x93,0x51,0x22, + 0x08,0x1C,0xE8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA4,0xA4,0xA4,0xA2,0x28,0x34,0x24, + /* 0xC6B1 [?] [3495]*/ + 0x00,0x7F,0x04,0x3F,0x24,0x24,0x3F,0x00,0x3F,0x00,0xFF,0x01,0x11,0x21,0x45,0x02, + 0x00,0xFC,0x40,0xF8,0x48,0x48,0xF8,0x00,0xF8,0x00,0xFE,0x00,0x10,0x08,0x04,0x00, + /* 0xC6B2 [?] [3496]*/ + 0x21,0x21,0x25,0x23,0xF9,0x27,0x25,0x2D,0x35,0xE7,0x25,0x25,0x25,0x25,0xA4,0x44, + 0x08,0x08,0x48,0x90,0x1E,0xD4,0x64,0x54,0x54,0x54,0xD4,0x48,0x48,0x54,0x64,0xC2, + /* 0xC6B3 [?] [3497]*/ + 0x08,0x49,0x2A,0x7F,0x49,0x5D,0x6B,0x49,0x43,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F, + 0x20,0x20,0x3E,0x48,0x48,0xA8,0x10,0x28,0x46,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xC6B4 [?] [3498]*/ + 0x11,0x10,0x10,0x10,0xFD,0x10,0x10,0x14,0x18,0x33,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x04,0x84,0x88,0x00,0xFE,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xC6B5 [?] [3499]*/ + 0x10,0x11,0x50,0x5C,0x51,0x51,0xFF,0x01,0x11,0x55,0x55,0x55,0x84,0x08,0x31,0xC2, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xC6B6 [?] [3500]*/ + 0x04,0x08,0x30,0xDF,0x04,0x04,0x08,0x10,0x3F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x40,0x20,0x18,0xE6,0x20,0x20,0xA0,0x40,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xC6B7 [?] [3501]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xC6B8 [?] [3502]*/ + 0x00,0xFC,0x49,0x49,0x79,0x49,0x49,0x78,0x4B,0x48,0x4D,0x79,0xC8,0x08,0x08,0x08, + 0x20,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE,0x80,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xC6B9 [?] [3503]*/ + 0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0xFF,0x00,0x08,0x10,0x20,0x40, + 0x20,0xF0,0x00,0x00,0x00,0xF8,0x80,0x80,0x80,0x80,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xC6BA [?] [3504]*/ + 0x10,0x11,0x10,0x10,0x11,0xFC,0x10,0x10,0x13,0x10,0x10,0x1C,0xE0,0x40,0x00,0x00, + 0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC6BB [?] [3505]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x01,0x11,0x09,0x09,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0x10,0x10,0x20,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xC6BC [?] [3506]*/ + 0x08,0x08,0xFF,0x08,0x20,0x17,0x90,0x42,0x49,0x08,0x17,0xE0,0x20,0x20,0x20,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x40,0x48,0x50,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xC6BD [?] [3507]*/ + 0x00,0x7F,0x01,0x01,0x11,0x09,0x09,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0xFC,0x00,0x00,0x10,0x10,0x20,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC6BE [?] [3508]*/ + 0x08,0x0B,0x10,0x30,0x57,0x90,0x10,0x10,0x13,0x00,0x0F,0x08,0x08,0x10,0x20,0xC0, + 0x38,0xC0,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x00,0xE0,0x20,0x20,0x22,0x22,0x1E, + /* 0xC6BF [?] [3509]*/ + 0x42,0x24,0x00,0x7E,0x24,0x24,0x24,0x24,0xFE,0x24,0x24,0x24,0x24,0x44,0x44,0x84, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xC6C0 [?] [3510]*/ + 0x00,0x23,0x10,0x10,0x02,0x01,0xF1,0x10,0x17,0x10,0x10,0x14,0x18,0x10,0x00,0x00, + 0x00,0xF8,0x40,0x40,0x48,0x48,0x50,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xC6C1 [?] [3511]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x24,0x22,0x2F,0x22,0x22,0x3F,0x22,0x42,0x44,0x84,0x08, + 0x00,0xF8,0x08,0x08,0xF8,0x10,0x20,0xF8,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xC6C2 [?] [3512]*/ + 0x20,0x20,0x20,0x23,0x22,0xFA,0x22,0x23,0x22,0x22,0x22,0x3A,0xE2,0x44,0x04,0x09, + 0x20,0x20,0x20,0xFE,0x22,0x24,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xC6C3 [?] [3513]*/ + 0x00,0x20,0x12,0x12,0x83,0x40,0x48,0x08,0x11,0x11,0xE1,0x22,0x22,0x24,0x28,0x03, + 0x40,0x48,0x44,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xC6C4 [?] [3514]*/ + 0x08,0x08,0x08,0x7F,0x49,0x4A,0x48,0x7F,0x41,0x52,0x4A,0x44,0x4A,0x91,0x21,0x00, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xC6C5 [?] [3515]*/ + 0x20,0x13,0x92,0x42,0x4B,0x12,0xE4,0x24,0x29,0x04,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x20,0xFE,0x22,0x20,0xFC,0x84,0x48,0x30,0xCE,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xC6C6 [?] [3516]*/ + 0x00,0x00,0xFC,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x26,0x22,0x04, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xC6C7 [?] [3517]*/ + 0x10,0x10,0x21,0x7D,0x45,0x45,0x45,0x7D,0x45,0x44,0x44,0x44,0x7C,0x45,0x01,0x02, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x40,0x68,0xB2,0xBE,0x20,0x22,0x1E, + /* 0xC6C8 [?] [3518]*/ + 0x00,0x20,0x10,0x13,0x02,0x02,0xF2,0x13,0x12,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0x40,0x40,0x80,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xC6C9 [?] [3519]*/ + 0x10,0x10,0x94,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC6CA [?] [3520]*/ + 0x10,0x08,0x7F,0x00,0x21,0x12,0xFF,0x00,0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x00, + 0x04,0x04,0x84,0x24,0x24,0x24,0xE4,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xC6CB [?] [3521]*/ + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x12,0x1C,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x80,0x80,0x80,0x80,0x80,0xA0,0x90,0x88,0x84,0x84,0x80,0x80,0x80,0x80,0x80,0x80, + /* 0xC6CC [?] [3522]*/ + 0x20,0x20,0x3B,0x20,0x40,0x7B,0xA2,0x22,0xFB,0x22,0x22,0x23,0x2A,0x32,0x22,0x02, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xC6CD [?] [3523]*/ + 0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0x40,0x40,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xC6CE [?] [3524]*/ + 0x08,0x08,0xFF,0x09,0x01,0xFF,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x21,0x21,0x21, + 0x20,0x20,0xFE,0x20,0x10,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xC6CF [?] [3525]*/ + 0x04,0x04,0xFF,0x24,0x3F,0x42,0x7F,0x82,0x3F,0x22,0x3F,0x22,0x3F,0x22,0x22,0x20, + 0x40,0x40,0xFE,0x40,0xFC,0x24,0xF4,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0xA4,0x4C, + /* 0xC6D0 [?] [3526]*/ + 0x08,0x08,0xFF,0x08,0x01,0x3F,0x08,0x04,0xFF,0x00,0x00,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x20,0x40,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xC6D1 [?] [3527]*/ + 0x08,0x08,0xFF,0x08,0x40,0x27,0x20,0x87,0x44,0x57,0x14,0xE7,0x24,0x24,0x24,0x04, + 0x20,0x20,0xFE,0x28,0x44,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xC6D2 [?] [3528]*/ + 0x20,0x20,0x27,0x20,0x20,0xFB,0x22,0x22,0x23,0x22,0x22,0x3B,0xE2,0x42,0x02,0x02, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xC6D3 [?] [3529]*/ + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08,0x08, + 0x40,0x40,0x40,0x40,0x40,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xC6D4 [?] [3530]*/ + 0x00,0x7F,0x41,0x41,0x5F,0x41,0x4F,0x49,0x4F,0x49,0x4F,0x49,0x49,0x40,0x7F,0x40, + 0x00,0xFC,0x44,0x24,0xF4,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0x64,0x04,0xFC,0x04, + /* 0xC6D5 [?] [3531]*/ + 0x08,0x04,0x7F,0x04,0x24,0x14,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x40,0xFC,0x40,0x48,0x50,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xC6D6 [?] [3532]*/ + 0x00,0x40,0x2F,0x20,0x00,0x87,0x44,0x54,0x17,0x24,0xE4,0x27,0x24,0x24,0x24,0x04, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xC6D7 [?] [3533]*/ + 0x02,0x41,0x27,0x20,0x04,0x02,0xEF,0x20,0x23,0x22,0x22,0x23,0x2A,0x32,0x23,0x02, + 0x08,0x10,0xFC,0xA0,0xA4,0xA8,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC6D8 [?] [3534]*/ + 0x03,0x02,0xF3,0x92,0x93,0x91,0x97,0xF1,0x9F,0x91,0x92,0x95,0xF0,0x91,0x02,0x00, + 0xF8,0x08,0xF8,0x08,0xF8,0x10,0xFC,0x10,0xFE,0x10,0x48,0x54,0xE0,0x50,0x48,0xC0, + /* 0xC6D9 [?] [3535]*/ + 0x03,0x22,0x13,0x12,0x83,0x41,0x47,0x11,0x1F,0x21,0xE2,0x25,0x20,0x21,0x22,0x00, + 0xF8,0x08,0xF8,0x08,0xF8,0x10,0xFC,0x10,0xFE,0x10,0x48,0x54,0xE0,0x50,0x48,0xC0, + /* 0xC6DA [?] [3536]*/ + 0x22,0x22,0x7F,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0xFF,0x04,0x22,0x41,0x82, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x84,0x84,0x14,0x08, + /* 0xC6DB [?] [3537]*/ + 0x22,0x22,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0xFF,0x24,0x22,0x42,0x81, + 0x20,0x20,0xA0,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0xA8,0x48,0x44,0x84,0x02, + /* 0xC6DC [?] [3538]*/ + 0x10,0x17,0x10,0x10,0xFC,0x13,0x32,0x3A,0x56,0x52,0x92,0x13,0x12,0x12,0x13,0x12, + 0x00,0xFE,0x90,0x90,0x90,0xFC,0x94,0x94,0x94,0x94,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xC6DD [?] [3539]*/ + 0x00,0x00,0x00,0x3F,0x22,0x23,0x22,0x22,0x3F,0x20,0x22,0x2A,0x32,0x42,0x4A,0x84, + 0x28,0x24,0x20,0xFE,0x20,0xA0,0x24,0x24,0xE4,0x28,0x28,0x90,0x52,0x2A,0x46,0x82, + /* 0xC6DE [?] [3540]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x02,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xC6DF [?] [3541]*/ + 0x02,0x02,0x02,0x02,0x02,0x02,0x07,0xFA,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x00, + 0x00,0x00,0x00,0x00,0x00,0x3C,0xC0,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xC6E0 [?] [3542]*/ + 0x00,0x40,0x27,0x20,0x03,0x00,0x17,0x10,0x23,0xE0,0x27,0x21,0x23,0x20,0x21,0x06, + 0x40,0x40,0xFC,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x80,0xFE,0x08,0x90,0x60,0x98,0x04, + /* 0xC6E1 [?] [3543]*/ + 0x00,0x20,0x17,0x10,0x81,0x46,0x40,0x11,0x12,0x2C,0xE2,0x21,0x22,0x24,0x21,0x00, + 0x40,0x40,0xFC,0xE0,0x58,0x44,0xA0,0x10,0x48,0x46,0x48,0x50,0x48,0x44,0x40,0x80, + /* 0xC6E2 [?] [3544]*/ + 0x20,0x10,0x00,0x47,0x20,0x08,0x10,0x60,0x21,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x80,0x80,0x9C,0xE0,0x80,0x84,0x84,0x7C,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC6E3 [?] [3545]*/ + 0x00,0x22,0x12,0x12,0x82,0x42,0x53,0x1E,0x12,0x22,0xE2,0x23,0x22,0x20,0x20,0x01, + 0x00,0x00,0xFC,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0xA4,0x24,0x44,0x44,0x94,0x08, + /* 0xC6E4 [?] [3546]*/ + 0x08,0x08,0x7F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x08,0x08,0xFF,0x00,0x08,0x10,0x20, + 0x20,0x20,0xFC,0x20,0x20,0xE0,0x20,0x20,0xE0,0x20,0x20,0xFE,0x00,0x20,0x10,0x08, + /* 0xC6E5 [?] [3547]*/ + 0x11,0x11,0x13,0x11,0xFD,0x11,0x31,0x39,0x55,0x51,0x91,0x17,0x10,0x10,0x11,0x12, + 0x08,0x08,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00,0x90,0x08,0x04, + /* 0xC6E6 [?] [3548]*/ + 0x01,0x01,0x3F,0x02,0x04,0x08,0xFF,0x00,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00,0x00, + 0x00,0x00,0xF8,0x80,0x40,0x20,0xFE,0x10,0x10,0x90,0x90,0x90,0x90,0x10,0x50,0x20, + /* 0xC6E7 [?] [3549]*/ + 0x08,0x08,0x08,0x0B,0x48,0x4E,0x48,0x49,0x48,0x48,0x48,0x4E,0x58,0xE0,0x01,0x06, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xC6E8 [?] [3550]*/ + 0x00,0x00,0x7D,0x54,0x54,0x54,0x57,0x7C,0x54,0x54,0x55,0x54,0x7C,0x44,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xC6E9 [?] [3551]*/ + 0x10,0x10,0x11,0x10,0x54,0x55,0x57,0x54,0x55,0x55,0x55,0x5D,0x65,0x00,0x00,0x00, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFE,0x08,0xE8,0x28,0x28,0xE8,0x28,0x08,0x28,0x10, + /* 0xC6EA [?] [3552]*/ + 0x00,0x78,0x4B,0x49,0x48,0x78,0x48,0x48,0x4B,0x78,0x48,0x48,0x48,0x49,0x49,0x9A, + 0x40,0x20,0xFE,0x04,0x88,0x50,0x20,0xD8,0x06,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xC6EB [?] [3553]*/ + 0x02,0x01,0x7F,0x08,0x04,0x03,0x0C,0x30,0xC8,0x08,0x08,0x08,0x08,0x10,0x10,0x20, + 0x00,0x00,0xFC,0x20,0x40,0x80,0x60,0x18,0x26,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC6EC [?] [3554]*/ + 0x21,0x11,0x11,0x02,0xFC,0x21,0x20,0x3C,0x24,0x24,0x24,0x24,0x27,0x44,0x54,0x89, + 0x00,0x00,0xFE,0x00,0x88,0xFC,0x88,0xF8,0x88,0xF8,0x88,0x88,0xFE,0x50,0x88,0x04, + /* 0xC6ED [?] [3555]*/ + 0x20,0x10,0x11,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xC6EE [?] [3556]*/ + 0x20,0x10,0x10,0xFC,0x04,0x08,0x10,0x38,0x54,0x92,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x84,0x88,0x88,0x90,0x88,0x88,0x84,0x84,0xC4,0xA8,0x90,0x80,0x80,0x80, + /* 0xC6EF [?] [3557]*/ + 0x00,0xF8,0x09,0x48,0x48,0x49,0x4B,0x7C,0x05,0x05,0x1D,0xE5,0x45,0x04,0x28,0x10, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFE,0x08,0xE8,0x28,0x28,0xE8,0x28,0x08,0x28,0x10, + /* 0xC6F0 [?] [3558]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFE,0x08,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x88,0x80,0x80,0x84,0x84,0x7C,0x00,0xFE,0x00, + /* 0xC6F1 [?] [3559]*/ + 0x01,0x21,0x21,0x21,0x3F,0x00,0x00,0x3F,0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x1F, + 0x00,0x08,0x08,0x08,0xF8,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x04,0x04,0xFC, + /* 0xC6F2 [?] [3560]*/ + 0x08,0x08,0x1F,0x10,0x20,0x40,0x9F,0x00,0x00,0x01,0x06,0x08,0x10,0x10,0x0F,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xE0,0x20,0x40,0x80,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xC6F3 [?] [3561]*/ + 0x01,0x01,0x02,0x04,0x08,0x31,0xC1,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC6F4 [?] [3562]*/ + 0x01,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x17,0x24,0x24,0x44,0x87,0x04, + 0x00,0x80,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xC6F5 [?] [3563]*/ + 0x08,0x08,0x7F,0x08,0x3E,0x08,0x7F,0x08,0x09,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x7C,0x24,0x24,0x24,0x44,0x54,0x88,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xC6F6 [?] [3564]*/ + 0x00,0x01,0xF9,0x21,0x21,0x41,0x79,0x4F,0xC9,0x49,0x49,0x49,0x79,0x48,0x00,0x00, + 0x00,0x00,0x7E,0x12,0x12,0x12,0xD2,0x12,0x12,0x12,0x52,0x92,0x22,0x22,0x4A,0x84, + /* 0xC6F7 [?] [3565]*/ + 0x00,0x3E,0x22,0x22,0x3E,0x01,0x01,0xFF,0x02,0x0C,0x30,0xC0,0x3E,0x22,0x22,0x3E, + 0x00,0x7C,0x44,0x44,0x7C,0x20,0x10,0xFE,0x80,0x60,0x18,0x06,0x7C,0x44,0x44,0x7C, + /* 0xC6F8 [?] [3566]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x0A,0x0A,0x06,0x02, + /* 0xC6F9 [?] [3567]*/ + 0x01,0x21,0x11,0x12,0x04,0x01,0xF0,0x10,0x10,0x11,0x11,0x10,0x10,0x28,0x47,0x00, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x10,0x60,0x80,0x04,0x04,0xFC,0x00,0x00,0xFE,0x00, + /* 0xC6FA [?] [3568]*/ + 0x01,0x00,0x3F,0x02,0x04,0x08,0x1F,0x00,0x04,0x04,0x7F,0x04,0x04,0x08,0x10,0x20, + 0x00,0x80,0xFC,0x00,0x20,0x10,0xF8,0x08,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xC6FB [?] [3569]*/ + 0x01,0x21,0x11,0x12,0x84,0x41,0x48,0x08,0x13,0x10,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x0A,0x0A,0x06,0x02, + /* 0xC6FC [?] [3570]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x40,0x12,0x12,0x21,0xE1,0x21,0x21,0x20,0x2F,0x00, + 0x80,0x40,0x40,0x00,0xFC,0x00,0x08,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0xFE,0x00, + /* 0xC6FD [?] [3571]*/ + 0x00,0x20,0x11,0x11,0x02,0x04,0xF1,0x10,0x10,0x10,0x10,0x15,0x1A,0x12,0x01,0x00, + 0x80,0x80,0x00,0xFE,0x00,0x00,0xF8,0x08,0x10,0x60,0x80,0x00,0x02,0x02,0xFE,0x00, + /* 0xC6FE [?] [3572]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x10,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x40,0x40,0x7C,0x84,0x08,0x00,0x20,0xCE,0x02,0x02,0xCE,0x02,0x02,0x02,0xFE,0x02, + /* 0xC7A1 [?] [3573]*/ + 0x10,0x10,0x10,0x11,0x1A,0x54,0x53,0x50,0x90,0x13,0x12,0x12,0x12,0x12,0x13,0x12, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC7A2 [?] [3574]*/ + 0x00,0x20,0x10,0x11,0x82,0x44,0x43,0x10,0x10,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xC7A3 [?] [3575]*/ + 0x01,0x01,0x3F,0x02,0x04,0x08,0x7F,0x41,0x89,0x0F,0x11,0x01,0x7F,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x80,0x40,0x20,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x00,0x00,0x00, + /* 0xC7A4 [?] [3576]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x10,0x17,0x18,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC7A5 [?] [3577]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x13,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC7A6 [?] [3578]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x11,0x12,0xFC,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xF8,0x88,0x88,0x88,0x88,0x06,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC7A7 [?] [3579]*/ + 0x00,0x00,0x3F,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC7A8 [?] [3580]*/ + 0x00,0x20,0x13,0x10,0x00,0x00,0xF7,0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x47,0x00, + 0x10,0x78,0xC0,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0xFE,0x00, + /* 0xC7A9 [?] [3581]*/ + 0x10,0x10,0x3F,0x28,0x45,0x82,0x04,0x08,0x37,0xC0,0x02,0x11,0x09,0x08,0x7F,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x80,0x40,0x20,0xD8,0x06,0x10,0x10,0x20,0x40,0xFC,0x00, + /* 0xC7AA [?] [3582]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x57,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x78,0xC0,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xC7AB [?] [3583]*/ + 0x02,0x41,0x20,0x27,0x00,0x07,0xE0,0x2F,0x20,0x27,0x20,0x29,0x32,0x2C,0x00,0x00, + 0x08,0x10,0x00,0xFE,0xA0,0xFC,0xA4,0xFE,0xA4,0xFC,0xA0,0xB0,0xA8,0xA6,0xA0,0xA0, + /* 0xC7AC [?] [3584]*/ + 0x10,0x10,0x10,0xFE,0x11,0x7E,0x44,0x7C,0x44,0x7C,0x10,0xFE,0x11,0x11,0x10,0x10, + 0x40,0x40,0x80,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xC7AD [?] [3585]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x92,0xFF,0x12,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x20,0x20,0x20,0x50,0x50,0x88,0x44,0x22,0x20,0xF8,0x08,0x08,0x10,0x10,0x20,0x20, + /* 0xC7AE [?] [3586]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBC,0x10,0x11,0xFC,0x10,0x10,0x10,0x14,0x18,0x13,0x00, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xC7AF [?] [3587]*/ + 0x10,0x10,0x3C,0x20,0x43,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xC7B0 [?] [3588]*/ + 0x10,0x08,0x08,0xFF,0x00,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x2A,0x24, + 0x10,0x10,0x20,0xFE,0x00,0x08,0x48,0x48,0x48,0x48,0x48,0x48,0x08,0x08,0x28,0x10, + /* 0xC7B1 [?] [3589]*/ + 0x01,0x41,0x27,0x21,0x0F,0x81,0x42,0x54,0x13,0x22,0xE2,0x23,0x22,0x22,0x23,0x02, + 0x10,0x10,0xBC,0x10,0xFE,0x10,0xA8,0x44,0xFA,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC7B2 [?] [3590]*/ + 0x00,0x23,0x12,0x13,0x00,0x07,0xF0,0x13,0x12,0x13,0x12,0x13,0x12,0x13,0x28,0x47, + 0x40,0xF8,0x48,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xC7B3 [?] [3591]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x40,0x17,0x10,0x20,0xE0,0x20,0x20,0x21,0x26,0x00, + 0xA0,0x90,0x80,0xB8,0xC0,0x80,0xBC,0xC0,0x88,0x90,0x60,0x44,0xA4,0x14,0x0C,0x04, + /* 0xC7B4 [?] [3592]*/ + 0x00,0x44,0x22,0x22,0x00,0x01,0xE0,0x2E,0x22,0x22,0x22,0x22,0x2A,0x32,0x25,0x08, + 0x10,0xFE,0x92,0xFE,0x10,0xFE,0x00,0xFE,0x82,0xFE,0x80,0xFE,0x82,0xFE,0x00,0xFE, + /* 0xC7B5 [?] [3593]*/ + 0x10,0xFE,0x20,0x48,0x7E,0x08,0x0E,0xF9,0x4A,0x09,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xC7B6 [?] [3594]*/ + 0x01,0x21,0x21,0x3F,0x00,0x22,0x22,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x00, + 0x00,0x08,0x08,0xF8,0x20,0x20,0x3E,0x42,0x94,0x10,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xC7B7 [?] [3595]*/ + 0x08,0x08,0x08,0x0F,0x10,0x11,0x21,0x41,0x01,0x02,0x02,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0xFC,0x04,0x08,0x10,0x00,0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x06, + /* 0xC7B8 [?] [3596]*/ + 0x22,0x14,0xFF,0x14,0x14,0x7F,0x15,0xFF,0x15,0x7F,0x14,0x36,0x55,0x94,0x14,0x14, + 0x20,0x20,0xA0,0x7E,0x42,0x84,0x10,0x90,0x10,0x10,0x28,0x28,0x28,0xC4,0x44,0x82, + /* 0xC7B9 [?] [3597]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x34,0x39,0x55,0x51,0x91,0x11,0x11,0x11,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xC7BA [?] [3598]*/ + 0x00,0x00,0x78,0x48,0x49,0x4A,0x4C,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x00,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xC7BB [?] [3599]*/ + 0x00,0x78,0x48,0x4B,0x4A,0x7C,0x49,0x4A,0x48,0x79,0x48,0x48,0x48,0x48,0x4F,0x98, + 0x40,0x20,0x20,0xFE,0x02,0x94,0x08,0x04,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xC7BC [?] [3600]*/ + 0x08,0x04,0x04,0x7F,0x01,0x01,0x3F,0x02,0x02,0xFF,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x20,0x20,0x40,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x80,0x80,0x80,0x82,0x82,0x7E, + /* 0xC7BD [?] [3601]*/ + 0x20,0x20,0x27,0x20,0x22,0xF9,0x27,0x20,0x23,0x22,0x22,0x3A,0xE2,0x42,0x03,0x02, + 0x40,0x40,0xFC,0x40,0x48,0x50,0xFE,0x00,0xF8,0x08,0xE8,0xA8,0xE8,0x08,0xF8,0x08, + /* 0xC7BE [?] [3602]*/ + 0x08,0xFF,0x08,0x01,0x3F,0x11,0x09,0xFF,0x00,0x3F,0x20,0x27,0x24,0x27,0x20,0x3F, + 0x20,0xFE,0x20,0x00,0xF8,0x10,0x20,0xFE,0x00,0xF8,0x08,0xC8,0x48,0xC8,0x08,0xF8, + /* 0xC7BF [?] [3603]*/ + 0x00,0xF9,0x09,0x09,0x09,0x78,0x40,0x43,0x42,0x7A,0x0B,0x08,0x08,0x08,0x57,0x20, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x22,0xFE,0x20,0x24,0x22,0xFE,0x02, + /* 0xC7C0 [?] [3604]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x14,0x11,0x19,0x31,0xD1,0x11,0x11,0x11,0x50,0x20, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xC7C1 [?] [3605]*/ + 0x10,0x13,0x10,0x13,0xFC,0x13,0x38,0x34,0x50,0x57,0x91,0x17,0x11,0x17,0x11,0x11, + 0x38,0xC0,0x78,0xC0,0x78,0xC4,0x3C,0x00,0xC6,0x38,0xCE,0x38,0xCE,0x38,0x4A,0x86, + /* 0xC7C2 [?] [3606]*/ + 0x20,0x20,0x3B,0x21,0x41,0x79,0xA3,0x21,0xF9,0x23,0x25,0x21,0x29,0x31,0x21,0x01, + 0x08,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xC7C3 [?] [3607]*/ + 0x10,0x08,0xFF,0x00,0x7E,0x42,0x7E,0x00,0xFF,0x81,0xBD,0xA5,0xBD,0x81,0x85,0x82, + 0x10,0x10,0x10,0x1E,0x10,0x10,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xC7C4 [?] [3608]*/ + 0x10,0x11,0x10,0x10,0x18,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC7C5 [?] [3609]*/ + 0x20,0x20,0x23,0x20,0xF8,0x27,0x20,0x71,0x6A,0xA5,0xA1,0x21,0x21,0x22,0x22,0x24, + 0x10,0x78,0xC0,0x40,0x40,0xFE,0xA0,0x10,0x08,0x16,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xC7C6 [?] [3610]*/ + 0x00,0x00,0x79,0x49,0x4B,0x7D,0x49,0x49,0x79,0x49,0x49,0x49,0x79,0x4A,0x02,0x04, + 0xA0,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0xA4,0x52,0x52, + /* 0xC7C7 [?] [3611]*/ + 0x00,0x00,0x3F,0x01,0x02,0x7F,0x04,0x08,0x30,0xC8,0x08,0x08,0x08,0x10,0x10,0x20, + 0x10,0xF8,0x00,0x00,0x00,0xFC,0x40,0x20,0x18,0x26,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC7C8 [?] [3612]*/ + 0x08,0x08,0x0B,0x10,0x10,0x37,0x30,0x51,0x92,0x15,0x11,0x11,0x11,0x12,0x12,0x14, + 0x10,0x78,0xC0,0x40,0x40,0xFE,0xA0,0x10,0x08,0x16,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xC7C9 [?] [3613]*/ + 0x00,0x03,0xFC,0x10,0x10,0x10,0x11,0x11,0x10,0x10,0x1E,0xE0,0x40,0x00,0x00,0x00, + 0x00,0xFE,0x40,0x40,0x80,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC7CA [?] [3614]*/ + 0x28,0x28,0xFE,0x28,0x38,0x10,0x7C,0x54,0x54,0x7C,0x10,0xFE,0x10,0x10,0x10,0x10, + 0x10,0x92,0x52,0x54,0x10,0xFE,0x82,0x82,0xFE,0x82,0x82,0xFE,0x82,0x82,0x8A,0x84, + /* 0xC7CB [?] [3615]*/ + 0x10,0x13,0x10,0x13,0xFC,0x13,0x10,0x14,0x18,0x37,0xD1,0x17,0x11,0x17,0x51,0x21, + 0x38,0xC0,0x78,0xC0,0x78,0xC4,0x3C,0x00,0xC6,0x38,0xCE,0x38,0xCE,0x38,0x4A,0x86, + /* 0xC7CC [?] [3616]*/ + 0x20,0x21,0xFE,0x24,0x29,0x12,0x2A,0xC6,0x01,0xFC,0x28,0x29,0x28,0x48,0x47,0x80, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0xCC,0x54,0x44,0x44,0x54,0x8A,0x02,0xFE,0x00, + /* 0xC7CD [?] [3617]*/ + 0x10,0x11,0x10,0x10,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC7CE [?] [3618]*/ + 0x08,0x0A,0x09,0x11,0x10,0x33,0x32,0x52,0x93,0x12,0x12,0x13,0x12,0x12,0x12,0x12, + 0x40,0x48,0x48,0x50,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xC7CF [?] [3619]*/ + 0x02,0x01,0x7F,0x48,0x90,0x20,0x00,0x7D,0x10,0x10,0x11,0x10,0x1E,0xE0,0x40,0x00, + 0x00,0x00,0xFE,0x22,0x14,0x08,0x00,0xFE,0x40,0x80,0xFC,0x04,0x04,0x04,0x28,0x10, + /* 0xC7D0 [?] [3620]*/ + 0x10,0x10,0x11,0x10,0x10,0x1E,0xF0,0x10,0x10,0x12,0x14,0x18,0x10,0x01,0x02,0x04, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xC7D1 [?] [3621]*/ + 0x08,0x08,0xFF,0x08,0x00,0x10,0x10,0x7E,0x12,0x12,0x12,0x12,0x22,0x22,0x4A,0x84, + 0x20,0x20,0xFE,0x20,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xC7D2 [?] [3622]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0xFF,0x00, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xC7D3 [?] [3623]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x97,0x10,0x10,0x10,0x11,0x12,0x17,0x12, + 0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0x80,0x80,0x10,0x08,0xFC,0x04, + /* 0xC7D4 [?] [3624]*/ + 0x02,0x01,0x7F,0x48,0x90,0x20,0x21,0x2C,0xF0,0x20,0x20,0x24,0x28,0x31,0x22,0x04, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xC7D5 [?] [3625]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x11,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x11,0x02, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC7D6 [?] [3626]*/ + 0x08,0x0B,0x08,0x11,0x10,0x33,0x30,0x57,0x94,0x13,0x11,0x11,0x10,0x10,0x11,0x16, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x04,0xF0,0x10,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xC7D7 [?] [3627]*/ + 0x02,0x01,0x3F,0x00,0x08,0x04,0xFF,0x01,0x01,0x7F,0x01,0x09,0x11,0x21,0x45,0x02, + 0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00,0x00,0xFC,0x00,0x20,0x10,0x08,0x04,0x00, + /* 0xC7D8 [?] [3628]*/ + 0x01,0x7F,0x01,0x3F,0x02,0xFF,0x08,0x10,0x2F,0xC1,0x1F,0x05,0x09,0x11,0x61,0x01, + 0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0xD0,0x08,0x06,0xF0,0x40,0x20,0x10,0x08,0x00, + /* 0xC7D9 [?] [3629]*/ + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x01,0x06,0x1A,0xE1,0x1F,0x00,0x00,0x01, + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00,0xC0,0x30,0x0E,0xE0,0x40,0x80,0x00, + /* 0xC7DA [?] [3630]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x08,0x7F,0x49,0x7F,0x08,0x7F,0x08,0x7F,0x08,0x0F,0xF2, + 0x20,0x20,0xA0,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xC7DB [?] [3631]*/ + 0x08,0x08,0xFF,0x08,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x20,0x20,0xFE,0x20,0x38,0xC0,0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xC7DC [?] [3632]*/ + 0x20,0x20,0x21,0x22,0xFD,0x20,0x22,0x2A,0x33,0xE0,0x27,0x24,0x25,0x25,0xA4,0x44, + 0x40,0xA0,0x10,0x48,0xF6,0xA0,0x48,0xA8,0xF8,0x40,0xFC,0x84,0x24,0xF4,0x14,0x0C, + /* 0xC7DD [?] [3633]*/ + 0x01,0x02,0x0C,0x31,0xCF,0x04,0x13,0x14,0x1F,0x01,0x7F,0x42,0x44,0x4F,0x44,0x40, + 0x00,0x80,0x60,0x18,0xE6,0x40,0x90,0x50,0xF0,0x00,0xFC,0x04,0x44,0xE4,0x24,0x0C, + /* 0xC7DE [?] [3634]*/ + 0x01,0x7F,0x40,0x80,0x13,0x10,0x91,0x50,0x53,0x10,0x37,0x54,0x93,0x11,0x10,0x17, + 0x00,0xFE,0x02,0x04,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x04,0xF8,0x10,0xE0,0x1C, + /* 0xC7DF [?] [3635]*/ + 0x00,0x20,0x10,0x10,0x81,0x41,0x41,0x15,0x15,0x25,0xE5,0x29,0x21,0x21,0x20,0x00, + 0x00,0x80,0x40,0x20,0x20,0x00,0x00,0x04,0x02,0x02,0x02,0x08,0x08,0x08,0xF8,0x00, + /* 0xC7E0 [?] [3636]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x01,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x50,0x20, + /* 0xC7E1 [?] [3637]*/ + 0x20,0x21,0x20,0xFC,0x40,0x50,0x90,0xFF,0x10,0x11,0x1C,0xF0,0x50,0x10,0x13,0x10, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xC7E2 [?] [3638]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x3F,0x03,0x0C,0x70,0x1F,0x02,0x02,0x7F,0x00, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x10,0xD0,0x30,0xD2,0x0A,0x0A,0xF6,0x02, + /* 0xC7E3 [?] [3639]*/ + 0x10,0x10,0x14,0x24,0x24,0x64,0x67,0xA4,0x24,0x24,0x25,0x26,0x24,0x20,0x20,0x20, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xC7E4 [?] [3640]*/ + 0x08,0x73,0x42,0x4A,0x4A,0x4B,0x4A,0x4A,0x4A,0x5B,0x6A,0x4A,0x12,0x12,0x23,0x42, + 0x00,0xDE,0x52,0x52,0x52,0xD2,0x52,0x52,0x52,0xD2,0x12,0x9A,0x54,0xB0,0x10,0x10, + /* 0xC7E5 [?] [3641]*/ + 0x00,0x20,0x17,0x10,0x83,0x40,0x47,0x10,0x13,0x22,0xE3,0x22,0x23,0x22,0x22,0x02, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xC7E6 [?] [3642]*/ + 0x24,0xFF,0x24,0x7E,0x82,0x7A,0x4A,0x7A,0x04,0x1F,0x01,0x3F,0x01,0x7F,0x01,0x03, + 0x20,0x20,0x7E,0xC4,0x28,0x10,0x28,0xC6,0x20,0xC0,0x00,0xF8,0x00,0xFC,0x00,0x00, + /* 0xC7E7 [?] [3643]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4B,0x78,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xC7E8 [?] [3644]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x04,0x7F,0x04,0x3F,0x04,0xFF,0x20,0x3F,0x20,0x21, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x10,0x90,0x10,0xF2,0x8A,0x8A,0x86,0x82, + /* 0xC7E9 [?] [3645]*/ + 0x10,0x10,0x17,0x10,0x1B,0x54,0x57,0x50,0x93,0x12,0x13,0x12,0x13,0x12,0x12,0x12, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xC7EA [?] [3646]*/ + 0x00,0x21,0x20,0x20,0x21,0x3D,0x21,0x21,0x21,0x25,0x29,0x31,0x20,0x00,0x01,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xC7EB [?] [3647]*/ + 0x00,0x40,0x27,0x20,0x03,0x00,0xE7,0x20,0x23,0x22,0x23,0x22,0x2B,0x32,0x22,0x02, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xC7EC [?] [3648]*/ + 0x01,0x00,0x3F,0x20,0x20,0x20,0x20,0x2F,0x20,0x21,0x21,0x22,0x42,0x44,0x88,0x10, + 0x00,0x80,0xFE,0x00,0x80,0x80,0x80,0xFC,0x80,0x40,0x40,0x20,0x20,0x10,0x08,0x06, + /* 0xC7ED [?] [3649]*/ + 0x00,0x00,0xFB,0x20,0x20,0x21,0xF9,0x21,0x21,0x20,0x21,0x39,0xE2,0x44,0x00,0x00, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xC7EE [?] [3650]*/ + 0x02,0x01,0x7F,0x40,0x88,0x10,0x22,0x02,0x7F,0x02,0x04,0x04,0x08,0x10,0x20,0x40, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x08,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xC7EF [?] [3651]*/ + 0x08,0x1C,0xF0,0x10,0x11,0xFD,0x11,0x32,0x38,0x54,0x54,0x90,0x11,0x11,0x12,0x14, + 0x40,0x40,0x40,0x40,0x44,0x44,0x48,0x50,0x40,0xA0,0xA0,0x90,0x10,0x08,0x04,0x02, + /* 0xC7F0 [?] [3652]*/ + 0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0xFF,0x00, + 0x10,0x78,0x80,0x00,0x00,0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xC7F1 [?] [3653]*/ + 0x00,0x03,0x3C,0x20,0x20,0x20,0x3F,0x22,0x22,0x22,0x22,0x22,0x27,0xF8,0x40,0x00, + 0x00,0x3E,0x22,0x24,0x24,0x28,0xA4,0x24,0x22,0x22,0x22,0x34,0xA8,0x20,0x20,0x20, + /* 0xC7F2 [?] [3654]*/ + 0x00,0x00,0xFC,0x10,0x13,0x10,0x11,0x7C,0x10,0x10,0x10,0x11,0x1E,0xE0,0x40,0x00, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0xB2,0xB4,0x68,0xA8,0x24,0x22,0x20,0xA0,0x40, + /* 0xC7F3 [?] [3655]*/ + 0x01,0x01,0x01,0x7F,0x01,0x21,0x11,0x09,0x03,0x05,0x09,0x11,0x61,0x01,0x05,0x02, + 0x20,0x10,0x00,0xFC,0x00,0x08,0x10,0xA0,0x40,0x20,0x10,0x08,0x06,0x00,0x00,0x00, + /* 0xC7F4 [?] [3656]*/ + 0x00,0x7F,0x40,0x41,0x41,0x41,0x41,0x42,0x42,0x44,0x44,0x48,0x50,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x24,0x24,0x24,0x04,0xFC,0x04, + /* 0xC7F5 [?] [3657]*/ + 0x10,0x08,0x08,0xFF,0x04,0x04,0x7F,0x44,0x48,0x50,0x60,0x7F,0x40,0x40,0x7F,0x40, + 0x10,0x10,0x20,0xFE,0x40,0x40,0xFC,0x44,0x44,0x3C,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xC7F6 [?] [3658]*/ + 0x00,0x27,0x14,0x14,0x84,0x44,0x44,0x14,0x14,0x24,0xE4,0x25,0x26,0x24,0x27,0x04, + 0x00,0xFC,0x04,0x44,0x44,0x44,0x44,0x44,0x44,0xA4,0x94,0x14,0x04,0x04,0xFC,0x04, + /* 0xC7F7 [?] [3659]*/ + 0x08,0x08,0x08,0x7E,0x09,0x08,0xFE,0x08,0x28,0x28,0x2E,0x29,0x28,0x58,0x4F,0x80, + 0x40,0x40,0x78,0x88,0x10,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFE,0x00, + /* 0xC7F8 [?] [3660]*/ + 0x00,0x7F,0x40,0x40,0x44,0x42,0x41,0x40,0x41,0x42,0x44,0x48,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x10,0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x10,0x00,0x00,0xFE,0x00, + /* 0xC7F9 [?] [3661]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1C,0xE4,0x43,0x00, + 0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0xFE,0x00, + /* 0xC7FA [?] [3662]*/ + 0x04,0x04,0x04,0x04,0x7F,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x44,0x7F,0x40, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x44,0xFC,0x04, + /* 0xC7FB [?] [3663]*/ + 0x10,0x21,0x7D,0x45,0x7D,0x45,0x7D,0x45,0x45,0xFD,0x0D,0x15,0x25,0x45,0x95,0x08, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xC7FC [?] [3664]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x28,0x28,0x28,0x2F,0x20,0x30,0x50,0x50,0x9F,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x80,0x88,0x88,0x88,0xF8,0x80,0x84,0x84,0x84,0xFC,0x04, + /* 0xC7FD [?] [3665]*/ + 0x00,0xF9,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1D,0xE5,0x45,0x05,0x29,0x10, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xC7FE [?] [3666]*/ + 0x23,0x12,0x83,0x4A,0x0A,0x13,0xE2,0x23,0x21,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0xFC,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC8A1 [?] [3667]*/ + 0x00,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x27,0xFA,0x42,0x02,0x02,0x02, + 0x00,0x80,0xFC,0x44,0x44,0x44,0x44,0x44,0x28,0x28,0xA8,0x10,0x10,0x28,0x44,0x82, + /* 0xC8A2 [?] [3668]*/ + 0x00,0x7F,0x22,0x3E,0x22,0x3E,0x23,0xFE,0x02,0x04,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0x7C,0x44,0x44,0x28,0x10,0xA8,0x44,0x82,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xC8A3 [?] [3669]*/ + 0x10,0x11,0x50,0x5E,0x50,0x50,0xFE,0x00,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x02, + 0x0E,0xF0,0x10,0xFE,0x92,0x92,0xFE,0x10,0xFE,0x92,0x9A,0x96,0xFE,0x82,0x8A,0x84, + /* 0xC8A4 [?] [3670]*/ + 0x10,0x13,0x11,0x7D,0x11,0x11,0xFD,0x11,0x11,0x51,0x5D,0x53,0x70,0x50,0x4F,0x80, + 0x00,0xE0,0x5E,0x42,0xD2,0x4A,0x4A,0xC4,0x44,0x64,0xCA,0x4A,0x52,0x40,0xFE,0x00, + /* 0xC8A5 [?] [3671]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0xFF,0x02,0x02,0x04,0x08,0x10,0x3F,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x20,0x10,0xF8,0x08, + /* 0xC8A6 [?] [3672]*/ + 0x00,0x7F,0x49,0x45,0x5F,0x42,0x7F,0x48,0x57,0x64,0x44,0x44,0x43,0x40,0x7F,0x40, + 0x00,0xFC,0x24,0x44,0xF4,0x04,0xFC,0x24,0xD4,0x4C,0xC4,0x24,0xE4,0x04,0xFC,0x04, + /* 0xC8A7 [?] [3673]*/ + 0x22,0x22,0xFF,0x22,0x77,0x55,0x77,0x12,0x3F,0x64,0xBF,0x24,0x3F,0x24,0x3F,0x20, + 0x00,0x7E,0x90,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xC8A8 [?] [3674]*/ + 0x10,0x13,0x11,0x11,0xFD,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x11,0x16, + 0x00,0xFC,0x04,0x04,0x04,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xC8A9 [?] [3675]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x44,0x44,0xFE,0x44,0x10,0x28,0x44,0x82,0x7C,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00, + /* 0xC8AA [?] [3676]*/ + 0x01,0x02,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x01,0x7D,0x09,0x11,0x21,0xC5,0x02, + 0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x04,0x88,0x50,0x20,0x18,0x06,0x00, + /* 0xC8AB [?] [3677]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x2F,0xC1,0x01,0x01,0x1F,0x01,0x01,0x01,0x7F,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0xE8,0x06,0x00,0x00,0xF0,0x00,0x00,0x00,0xFC,0x00, + /* 0xC8AC [?] [3678]*/ + 0x00,0x00,0x1F,0x10,0x90,0x51,0x52,0x1D,0x30,0x50,0x93,0x10,0x20,0x20,0x4F,0x80, + 0x80,0x40,0xFE,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xF8,0x40,0x40,0x40,0xFE,0x00, + /* 0xC8AD [?] [3679]*/ + 0x01,0x11,0x09,0x3F,0x02,0x7F,0x08,0x10,0x3F,0xC1,0x1F,0x01,0x3F,0x01,0x05,0x02, + 0x00,0x10,0x20,0xF8,0x00,0xFC,0x20,0xF0,0x08,0x06,0xE0,0x00,0xF8,0x00,0x00,0x00, + /* 0xC8AE [?] [3680]*/ + 0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x20,0x10,0x10,0x00,0xFE,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xC8AF [?] [3681]*/ + 0x01,0x11,0x09,0x3F,0x02,0x02,0x7F,0x08,0x10,0x2F,0xC4,0x04,0x08,0x08,0x11,0x20, + 0x00,0x10,0x20,0xF8,0x00,0x00,0xFC,0x20,0x10,0xE8,0x26,0x20,0x20,0x20,0x40,0x80, + /* 0xC8B0 [?] [3682]*/ + 0x00,0x00,0x00,0xFC,0x05,0x04,0x48,0x28,0x10,0x10,0x28,0x24,0x45,0x81,0x02,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xC8B1 [?] [3683]*/ + 0x20,0x20,0x3C,0x51,0x90,0x10,0xFE,0x10,0x13,0x54,0x54,0x54,0x5C,0x64,0x05,0x02, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC8B2 [?] [3684]*/ + 0x10,0x10,0x10,0x17,0x58,0x50,0x50,0x90,0x17,0x10,0x10,0x28,0x25,0x41,0x42,0x84, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x06, + /* 0xC8B3 [?] [3685]*/ + 0x00,0x00,0x1F,0x12,0x97,0x52,0x54,0x15,0x38,0x57,0x94,0x15,0x24,0x24,0x45,0x84, + 0x80,0x40,0xFE,0x00,0xBC,0xA4,0xA4,0xBC,0x40,0xFC,0xA4,0x54,0x44,0xA4,0x14,0x0C, + /* 0xC8B4 [?] [3686]*/ + 0x08,0x08,0x08,0x7F,0x08,0x08,0x08,0xFF,0x10,0x10,0x24,0x42,0xFF,0x41,0x00,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0xC4,0x44,0x44,0x44,0x54,0x48,0x40,0x40,0x40, + /* 0xC8B5 [?] [3687]*/ + 0x24,0x24,0x24,0xFF,0x24,0x24,0xFF,0x00,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x42, + 0x10,0x20,0x7C,0x44,0x64,0x54,0xC4,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xC8B6 [?] [3688]*/ + 0x10,0x10,0x17,0x15,0xFD,0x13,0x36,0x3A,0x57,0x52,0x92,0x13,0x12,0x12,0x13,0x12, + 0x80,0x80,0xFE,0x22,0x10,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xC8B7 [?] [3689]*/ + 0x00,0x00,0xFC,0x10,0x11,0x22,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3C,0x25,0x21,0x02, + 0x40,0x40,0x7C,0x84,0x08,0xFE,0x92,0x92,0xFE,0x92,0x92,0xFE,0x92,0x12,0x0A,0x04, + /* 0xC8B8 [?] [3690]*/ + 0x01,0x11,0x11,0x21,0x40,0x03,0x0C,0x30,0xDF,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0x10,0x08,0x24,0xC0,0x00,0x80,0x40,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00, + /* 0xC8B9 [?] [3691]*/ + 0x20,0x11,0x00,0xF8,0x0B,0x10,0x10,0x35,0x58,0x94,0x15,0x12,0x14,0x10,0x10,0x10, + 0x00,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x80,0x80,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xC8BA [?] [3692]*/ + 0x00,0x7E,0x12,0x12,0xFF,0x12,0x12,0x7E,0x20,0x20,0x7E,0x62,0xA2,0x22,0x3E,0x22, + 0x82,0x44,0x28,0xFE,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xC8BB [?] [3693]*/ + 0x10,0x10,0x1E,0x22,0x33,0x4A,0xA4,0x14,0x08,0x10,0x21,0x42,0x00,0x48,0x44,0x84, + 0x20,0x28,0x24,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02,0x00,0x88,0x44,0x44, + /* 0xC8BC [?] [3694]*/ + 0x11,0x11,0x11,0x16,0x5A,0x55,0x50,0x92,0x11,0x11,0x12,0x2C,0x24,0x42,0x42,0x84, + 0x10,0x14,0xD2,0x50,0x7E,0x50,0x90,0xA8,0x28,0x44,0x44,0x82,0x08,0xA4,0x52,0x52, + /* 0xC8BD [?] [3695]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x21,0xFF,0x20,0x20,0x20,0x20,0x20, + 0x00,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x28,0x10, + /* 0xC8BE [?] [3696]*/ + 0x20,0x10,0x03,0x40,0x21,0x09,0x12,0x64,0x29,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x80,0x80,0xF0,0x90,0x10,0x12,0x12,0x0E,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC8BF [?] [3697]*/ + 0x10,0xFE,0x00,0xEE,0xAA,0xEE,0x44,0xFE,0x44,0xFE,0x44,0xFE,0x50,0xCB,0x65,0x42, + 0x08,0x1C,0xE8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA4,0xA4,0xA4,0xA2,0x28,0x34,0x24, + /* 0xC8C0 [?] [3698]*/ + 0x20,0x27,0x20,0x23,0xF2,0x23,0x21,0x27,0x21,0x27,0x31,0xEF,0x41,0x03,0x0D,0x01, + 0x40,0xFC,0x00,0xB8,0xA8,0xB8,0x10,0xFC,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xC8C1 [?] [3699]*/ + 0x20,0x27,0x20,0x23,0xFA,0x23,0x21,0x2F,0x31,0xE7,0x21,0x2F,0x21,0x23,0xAD,0x41, + 0x40,0xFC,0x00,0xB8,0xA8,0xB8,0x10,0xFC,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xC8C2 [?] [3700]*/ + 0x00,0x07,0xF0,0x93,0x92,0x93,0x91,0x97,0x91,0x97,0xF1,0x9F,0x01,0x03,0x0D,0x01, + 0x40,0xFC,0x00,0xB8,0xA8,0xB8,0x10,0xFC,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xC8C3 [?] [3701]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x0F,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xC8C4 [?] [3702]*/ + 0x20,0x20,0x20,0x3B,0x48,0x50,0x80,0x23,0x20,0x27,0x20,0x20,0x29,0x31,0x22,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xC8C5 [?] [3703]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x10,0x14,0x18,0x30,0xD0,0x10,0x10,0x11,0x51,0x22, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x50,0x50,0x50,0x50,0x90,0x90,0x92,0x12,0x0E,0x00, + /* 0xC8C6 [?] [3704]*/ + 0x10,0x10,0x20,0x23,0x48,0xF8,0x10,0x23,0x40,0xFB,0x40,0x00,0x19,0xE1,0x42,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xC8C7 [?] [3705]*/ + 0x08,0x7F,0x08,0x02,0xFF,0x08,0x1F,0x28,0xC8,0x0F,0x01,0x08,0x48,0x48,0x87,0x00, + 0x20,0xFC,0x20,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xC8C8 [?] [3706]*/ + 0x10,0x10,0x10,0xFD,0x10,0x10,0x1C,0x30,0xD0,0x10,0x51,0x22,0x00,0x48,0x44,0x84, + 0x40,0x40,0x40,0xF8,0x48,0x48,0xC8,0x48,0xAA,0xAA,0x06,0x02,0x00,0x88,0x44,0x44, + /* 0xC8C9 [?] [3707]*/ + 0x00,0x00,0x3F,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x00, + 0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00, + /* 0xC8CA [?] [3708]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x17,0x10,0x10,0x10, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xC8CB [?] [3709]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x08,0x04,0x02, + /* 0xC8CC [?] [3710]*/ + 0x00,0x3F,0x02,0x12,0x12,0x24,0x08,0x10,0x60,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x50,0x20,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xC8CD [?] [3711]*/ + 0x20,0x20,0x21,0xFC,0x20,0x20,0xF8,0x20,0x21,0xFC,0x24,0x24,0x34,0x28,0x21,0x22, + 0x00,0x00,0xFC,0x24,0x24,0xA4,0xA4,0xA4,0x24,0x24,0x24,0x44,0x44,0x84,0x14,0x08, + /* 0xC8CE [?] [3712]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x5F,0x90,0x10,0x10,0x10,0x10,0x10,0x17,0x10, + 0x10,0x78,0xC0,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0xFC,0x00, + /* 0xC8CF [?] [3713]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x15,0x19,0x12,0x04,0x08, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xC8D0 [?] [3714]*/ + 0x00,0x3F,0x02,0x02,0x02,0x22,0x22,0x22,0x42,0x02,0x04,0x04,0x08,0x08,0x10,0x60, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC8D1 [?] [3715]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x24,0x27,0x24,0x48,0x28,0x10,0x28,0x44,0x85,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x00, + /* 0xC8D2 [?] [3716]*/ + 0x10,0x10,0x23,0x20,0x48,0xFA,0x12,0x22,0x44,0xF8,0x40,0x01,0x19,0xE2,0x44,0x08, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x04,0x28,0x10, + /* 0xC8D3 [?] [3717]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x14,0x18,0x30,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x00,0x00,0xF8,0x88,0x90,0x90,0xA0,0xBC,0x84,0x84,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC8D4 [?] [3718]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x50,0x90,0x10,0x11,0x11,0x11,0x12,0x12,0x14, + 0x00,0x00,0xF8,0x88,0x90,0x90,0xA0,0xBC,0x84,0x84,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xC8D5 [?] [3719]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xC8D6 [?] [3720]*/ + 0x00,0x00,0x00,0xFF,0x00,0x08,0x08,0x08,0x7F,0x08,0x08,0x10,0x10,0x20,0x40,0x03, + 0x48,0x44,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xC8D7 [?] [3721]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x10,0x1F,0x10,0x1F,0x10,0x10,0xFF,0x00,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x10,0xF0,0x10,0xF0,0x10,0x3E,0xD0,0x10,0x10,0x10, + /* 0xC8D8 [?] [3722]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x7F,0x40,0x89,0x12,0x24,0x08,0x3F,0xC8,0x08,0x0F,0x08, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x24,0x90,0x48,0x20,0xF8,0x26,0x20,0xE0,0x20, + /* 0xC8D9 [?] [3723]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x81,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xC8DA [?] [3724]*/ + 0x00,0xFE,0x00,0x7C,0x44,0x7C,0x00,0xFE,0x82,0xAA,0x92,0xFE,0x92,0x92,0x92,0x86, + 0x20,0x20,0x20,0xFC,0xA4,0xA4,0xA4,0xA4,0xFC,0xA4,0x20,0x28,0x24,0xFE,0x42,0x00, + /* 0xC8DB [?] [3725]*/ + 0x10,0x10,0x13,0x16,0x58,0x50,0x51,0x90,0x10,0x11,0x12,0x28,0x24,0x44,0x40,0x80, + 0x40,0x20,0xFE,0x02,0x50,0x88,0x24,0x50,0x88,0x04,0xFA,0x88,0x88,0x88,0xF8,0x88, + /* 0xC8DC [?] [3726]*/ + 0x00,0x20,0x13,0x12,0x84,0x41,0x4A,0x08,0x11,0x12,0xE5,0x21,0x21,0x21,0x21,0x01, + 0x40,0x20,0xFE,0x02,0x94,0x08,0x64,0x90,0x08,0x04,0xFA,0x08,0x08,0x08,0xF8,0x08, + /* 0xC8DD [?] [3727]*/ + 0x02,0x01,0x7F,0x40,0x88,0x11,0x22,0x04,0x08,0x30,0xDF,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x88,0x40,0x20,0x18,0xF6,0x10,0x10,0x10,0xF0,0x10, + /* 0xC8DE [?] [3728]*/ + 0x10,0x10,0x20,0x20,0x4B,0xF8,0x11,0x21,0x41,0xFB,0x41,0x01,0x1A,0xE2,0x44,0x00, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x24,0x24,0x24,0xA8,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xC8DF [?] [3729]*/ + 0x00,0x00,0x7F,0x40,0x80,0x00,0x0F,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xC0,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xC8E0 [?] [3730]*/ + 0x20,0x21,0x20,0x20,0xFB,0x20,0x20,0x29,0x32,0xE0,0x23,0x20,0x20,0x21,0xA6,0x40, + 0x00,0xFC,0x48,0x30,0xFE,0x52,0x94,0x10,0x30,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xC8E1 [?] [3731]*/ + 0x00,0x1F,0x02,0x01,0x7F,0x04,0x18,0x62,0x01,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xF0,0x20,0x40,0xFC,0x84,0x88,0x80,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xC8E2 [?] [3732]*/ + 0x01,0x01,0x01,0x7F,0x41,0x42,0x44,0x49,0x51,0x41,0x42,0x42,0x44,0x48,0x40,0x40, + 0x00,0x00,0x00,0xFC,0x04,0x84,0x44,0x24,0x04,0x04,0x84,0x44,0x44,0x04,0x14,0x08, + /* 0xC8E3 [?] [3733]*/ + 0x08,0x08,0xFF,0x08,0x10,0x10,0xFE,0x12,0x22,0x22,0x64,0x14,0x08,0x14,0x22,0xC0, + 0x20,0x20,0xFE,0x20,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00, + /* 0xC8E4 [?] [3734]*/ + 0x20,0x21,0x20,0xFB,0xAA,0xA9,0xA8,0xA9,0xF8,0xA3,0x20,0x29,0x39,0xE9,0x41,0x01, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFE,0x20,0xFC,0x54,0x54,0x54,0x0C, + /* 0xC8E5 [?] [3735]*/ + 0x10,0x17,0x10,0x2F,0x28,0x63,0x60,0xA3,0x20,0x2F,0x20,0x27,0x24,0x24,0x24,0x24, + 0x00,0xFC,0x40,0xFE,0x42,0x58,0x40,0x58,0x00,0xFE,0x40,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xC8E6 [?] [3736]*/ + 0x00,0xFD,0x04,0x0B,0x12,0x11,0x14,0x19,0x30,0xD3,0x10,0x11,0x11,0x11,0x51,0x21, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFE,0x20,0xFC,0x54,0x54,0x54,0x0C, + /* 0xC8E7 [?] [3737]*/ + 0x10,0x10,0x10,0x10,0xFE,0x22,0x22,0x22,0x42,0x24,0x14,0x08,0x14,0x22,0x42,0x80, + 0x00,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00, + /* 0xC8E8 [?] [3738]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x3F,0x28,0x48,0x4A,0x8C,0x00,0xFF,0x08,0x04,0x04,0x00, + 0x00,0xFC,0x00,0xF8,0x00,0xFE,0x88,0x50,0x30,0x0E,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xC8E9 [?] [3739]*/ + 0x02,0x0F,0xF0,0x01,0x91,0x4A,0x00,0xFE,0x04,0x08,0x0F,0xF8,0x48,0x08,0x28,0x10, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xC8EA [?] [3740]*/ + 0x00,0x20,0x10,0x10,0x8F,0x41,0x41,0x12,0x12,0x26,0xE1,0x20,0x20,0x21,0x22,0x0C, + 0x80,0x80,0x80,0x80,0xFE,0x08,0x08,0x08,0x10,0x10,0xA0,0x40,0xA0,0x10,0x08,0x04, + /* 0xC8EB [?] [3741]*/ + 0x04,0x02,0x01,0x01,0x01,0x02,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x10,0x08,0x06, + /* 0xC8EC [?] [3742]*/ + 0x20,0x13,0x02,0xF2,0x12,0x23,0x22,0x6A,0xB2,0x2A,0x22,0x23,0x22,0x24,0x24,0x28, + 0x00,0xFE,0x00,0xFC,0x00,0xFE,0xA8,0x90,0xC8,0x86,0x08,0xFE,0x88,0x48,0x08,0x18, + /* 0xC8ED [?] [3743]*/ + 0x10,0x10,0x10,0xFE,0x20,0x28,0x49,0x7E,0x08,0x08,0x0E,0xF8,0x48,0x08,0x09,0x0A, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xC8EE [?] [3744]*/ + 0x00,0x7D,0x44,0x48,0x48,0x53,0x48,0x48,0x44,0x44,0x44,0x68,0x51,0x41,0x42,0x44, + 0x00,0xFC,0x00,0x00,0x00,0xFE,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xC8EF [?] [3745]*/ + 0x08,0x08,0xFF,0x08,0x08,0x01,0x24,0x24,0x43,0x00,0x24,0x12,0xA0,0xA4,0x1C,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x88,0x24,0xE4,0x00,0x24,0x12,0xA0,0xA4,0x1C,0x00, + /* 0xC8F0 [?] [3746]*/ + 0x00,0x02,0xFA,0x22,0x23,0x20,0x27,0xF8,0x20,0x23,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x20,0x22,0x22,0x22,0xFE,0x00,0xFE,0x20,0x40,0xFE,0x52,0x52,0x52,0x52,0x52,0x06, + /* 0xC8F1 [?] [3747]*/ + 0x22,0x21,0x39,0x40,0x43,0x7A,0xA2,0x22,0xFB,0x20,0x20,0x29,0x31,0x22,0x04,0x08, + 0x08,0x08,0x10,0x20,0xF8,0x08,0x08,0x08,0xF8,0xA0,0xA0,0x20,0x24,0x24,0x1C,0x00, + /* 0xC8F2 [?] [3748]*/ + 0x20,0x13,0x10,0x40,0x40,0x5F,0x41,0x41,0x4F,0x41,0x41,0x41,0x5F,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0xE4,0x04,0x04,0x04,0xF4,0x04,0x14,0x08, + /* 0xC8F3 [?] [3749]*/ + 0x02,0x21,0x15,0x14,0x85,0x44,0x44,0x14,0x15,0x24,0xE4,0x24,0x25,0x24,0x24,0x04, + 0x00,0x7C,0x04,0x04,0xF4,0x44,0x44,0x44,0xF4,0x44,0x44,0x44,0xF4,0x04,0x14,0x08, + /* 0xC8F4 [?] [3750]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x02,0xFF,0x04,0x08,0x1F,0x28,0x48,0x88,0x08,0x0F,0x08, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xC8F5 [?] [3751]*/ + 0x00,0x7E,0x02,0x02,0x7E,0x40,0x40,0x7E,0x22,0x12,0x06,0x1A,0x62,0x02,0x14,0x08, + 0x00,0xFC,0x04,0x04,0xFC,0x80,0x80,0xFC,0x44,0x24,0x0C,0x34,0xC4,0x04,0x28,0x10, + /* 0xC8F6 [?] [3752]*/ + 0x22,0x22,0x27,0x22,0xFA,0x27,0x20,0x2F,0x34,0xE7,0x24,0x27,0x24,0x24,0xA4,0x44, + 0x88,0x88,0xC8,0x90,0x9E,0xD4,0x24,0xD4,0x54,0xD4,0x54,0xC8,0x48,0x54,0x64,0xC2, + /* 0xC8F7 [?] [3753]*/ + 0x00,0x2F,0x10,0x10,0x87,0x44,0x44,0x14,0x14,0x24,0xE5,0x26,0x24,0x24,0x27,0x04, + 0x00,0xFE,0xA0,0xA0,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0x1C,0x04,0x04,0x04,0xFC,0x04, + /* 0xC8F8 [?] [3754]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7D,0x44,0x48,0x51,0x49,0x45,0x45,0x55,0x49,0x42,0x44, + 0x40,0x40,0xFE,0x40,0x20,0xFC,0x88,0x50,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC8F9 [?] [3755]*/ + 0x00,0x79,0x49,0x49,0x49,0x79,0x49,0x49,0x48,0x78,0x48,0x4A,0x4A,0x4C,0x48,0x98, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x00,0x40,0x24,0xA2,0x8A,0x88,0x78,0x00, + /* 0xC8FA [?] [3756]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7C,0x54,0x54,0x7D,0x01,0x1D,0xE2,0x40, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x10,0x54,0x42,0x42,0x4A,0x38,0x00, + /* 0xC8FB [?] [3757]*/ + 0x02,0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x11,0x21,0xDF,0x01,0x01,0x7F, + 0x00,0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0x10,0x08,0xF6,0x00,0x00,0xFC, + /* 0xC8FC [?] [3758]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x1F,0x29,0xC9,0x09,0x0A,0x04,0x18, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0xF0,0x28,0x26,0x20,0xA0,0x40,0x20, + /* 0xC8FD [?] [3759]*/ + 0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00, + /* 0xC8FE [?] [3760]*/ + 0x02,0x04,0x08,0x1F,0x02,0x7F,0x08,0x10,0x27,0xC0,0x00,0x0F,0x00,0x00,0x3F,0x00, + 0x00,0x40,0x20,0xF0,0x00,0xFC,0x20,0x10,0xC8,0x06,0x00,0xE0,0x00,0x00,0xF8,0x00, + /* 0xC9A1 [?] [3761]*/ + 0x01,0x01,0x02,0x04,0x08,0x30,0xC1,0x11,0x09,0x09,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0x80,0x40,0x20,0x18,0x06,0x10,0x10,0x20,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xC9A2 [?] [3762]*/ + 0x24,0x24,0x7E,0x24,0x24,0xFF,0x00,0x7E,0x42,0x7E,0x42,0x7E,0x42,0x42,0x4A,0x44, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xC9A3 [?] [3763]*/ + 0x1F,0x06,0x01,0x0E,0x00,0x7C,0x24,0x18,0x66,0x01,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0xE0,0x40,0x80,0x40,0x00,0xF8,0x48,0x30,0xCC,0x00,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xC9A4 [?] [3764]*/ + 0x03,0x01,0xF0,0x93,0x90,0x97,0x94,0x93,0x94,0x90,0xF7,0x90,0x01,0x02,0x0C,0x00, + 0xF0,0x10,0xE0,0x18,0x00,0xBC,0xA4,0x18,0xA4,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xC9A5 [?] [3765]*/ + 0x01,0x01,0x7F,0x01,0x11,0x09,0x09,0x01,0xFF,0x12,0x11,0x10,0x10,0x14,0x18,0x10, + 0x00,0x00,0xFC,0x00,0x10,0x10,0x20,0x00,0xFE,0x00,0x10,0xA0,0x40,0x30,0x0E,0x00, + /* 0xC9A6 [?] [3766]*/ + 0x20,0x23,0x21,0x21,0xF8,0x20,0x21,0x2E,0x30,0xE3,0x22,0x22,0x23,0x20,0xA7,0x40, + 0x00,0xF8,0x48,0x10,0xA0,0x40,0xB0,0x4E,0x40,0xF8,0x48,0x48,0xF8,0x44,0xFC,0x04, + /* 0xC9A7 [?] [3767]*/ + 0x00,0xF9,0x08,0x48,0x48,0x48,0x48,0x7F,0x04,0x05,0x1D,0xE5,0x45,0x04,0x2B,0x10, + 0x00,0xFC,0xA4,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x24,0x24,0xFC,0x22,0xFE,0x02, + /* 0xC9A8 [?] [3768]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x15,0x18,0x30,0xD0,0x10,0x10,0x13,0x50,0x20, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xC9A9 [?] [3769]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x24,0x49,0x28,0x10,0x28,0x44,0x80,0x03, + 0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x20,0xFC,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xC9AA [?] [3770]*/ + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x01,0x08,0x48,0x49,0x8E,0x18,0xE7,0x00, + 0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x10,0xA0,0x44,0x82,0x12,0x10,0xF0,0x00, + /* 0xC9AB [?] [3771]*/ + 0x08,0x08,0x1F,0x20,0x40,0xBF,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0x08,0xF8,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xC9AC [?] [3772]*/ + 0x00,0x23,0x10,0x12,0x82,0x44,0x40,0x11,0x12,0x20,0xE1,0x21,0x21,0x21,0x27,0x00, + 0x00,0xFC,0x44,0x44,0x44,0x84,0x94,0x08,0x20,0x20,0x3C,0x20,0x20,0x20,0xFE,0x00, + /* 0xC9AD [?] [3773]*/ + 0x01,0x01,0x7F,0x05,0x09,0x31,0xC1,0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC9,0x08,0x08, + 0x00,0x00,0xFC,0x40,0x20,0x18,0x06,0x20,0x20,0xFC,0x30,0x68,0xA4,0x22,0x20,0x20, + /* 0xC9AE [?] [3774]*/ + 0x09,0x08,0x08,0x13,0x12,0x32,0x32,0x52,0x93,0x10,0x11,0x11,0x11,0x11,0x11,0x11, + 0x04,0x88,0x00,0xFE,0x22,0xAA,0x72,0x22,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xC9AF [?] [3775]*/ + 0x08,0x08,0xFF,0x08,0x00,0x10,0x08,0x40,0x24,0x05,0x09,0x72,0x10,0x10,0x11,0x06, + 0x20,0x20,0xFE,0x20,0x00,0x20,0x20,0xA8,0xA4,0x22,0x22,0x28,0x10,0x60,0x80,0x00, + /* 0xC9B0 [?] [3776]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3D,0x65,0x66,0xA4,0x24,0x24,0x3C,0x24,0x20,0x03, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xC9B1 [?] [3777]*/ + 0x00,0x18,0x06,0x01,0x06,0x18,0x61,0x01,0xFF,0x01,0x11,0x11,0x21,0x21,0x45,0x02, + 0x08,0x10,0x60,0x80,0x60,0x18,0x04,0x00,0xFE,0x00,0x20,0x10,0x08,0x04,0x04,0x00, + /* 0xC9B2 [?] [3778]*/ + 0x01,0x62,0x14,0x08,0x14,0x22,0x49,0x08,0xFF,0x08,0x2A,0x29,0x48,0x88,0x28,0x10, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0x84,0x84,0x14,0x08, + /* 0xC9B3 [?] [3779]*/ + 0x00,0x20,0x10,0x11,0x81,0x42,0x42,0x14,0x10,0x20,0xE0,0x20,0x20,0x20,0x21,0x06, + 0x40,0x40,0x40,0x48,0x44,0x42,0x42,0x48,0x48,0x48,0x10,0x10,0x20,0x40,0x80,0x00, + /* 0xC9B4 [?] [3780]*/ + 0x10,0x10,0x20,0x21,0x49,0xFA,0x12,0x24,0x40,0xF8,0x40,0x00,0x18,0xE0,0x41,0x06, + 0x40,0x40,0x40,0x48,0x44,0x42,0x42,0x48,0x48,0x48,0x10,0x10,0x20,0x40,0x80,0x00, + /* 0xC9B5 [?] [3781]*/ + 0x08,0x08,0x0B,0x12,0x12,0x32,0x33,0x50,0x91,0x12,0x14,0x11,0x12,0x10,0x11,0x16, + 0x40,0x80,0xFC,0x94,0x64,0x94,0xFC,0x90,0x08,0x84,0xFA,0x08,0x90,0x60,0x98,0x06, + /* 0xC9B6 [?] [3782]*/ + 0x00,0x00,0x78,0x49,0x4A,0x4D,0x48,0x48,0x4F,0x48,0x78,0x4B,0x02,0x02,0x03,0x02, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x40,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC9B7 [?] [3783]*/ + 0x20,0x20,0x3C,0x44,0x88,0x7F,0x02,0x02,0x7E,0x02,0x02,0xFE,0x00,0x48,0x44,0x84, + 0x20,0x20,0x40,0x7E,0x84,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82,0x88,0x44,0x44, + /* 0xC9B8 [?] [3784]*/ + 0x20,0x3F,0x48,0x85,0x08,0x4B,0x48,0x48,0x49,0x49,0x49,0x49,0x11,0x11,0x20,0x40, + 0x40,0x7E,0x90,0x08,0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xC9B9 [?] [3785]*/ + 0x00,0x07,0x78,0x48,0x48,0x4B,0x4A,0x7A,0x4A,0x4A,0x4A,0x4B,0x7A,0x4A,0x03,0x02, + 0x00,0xFE,0x90,0x90,0x90,0xFC,0x94,0x94,0x94,0x94,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xC9BA [?] [3786]*/ + 0x00,0xF7,0x24,0x24,0x24,0x24,0xF4,0x2F,0x24,0x24,0x24,0x34,0xE4,0x45,0x08,0x10, + 0x00,0xBC,0xA4,0xA4,0xA4,0xA4,0xA4,0xFE,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x54,0x88, + /* 0xC9BB [?] [3787]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x20,0x20,0x3F,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFE,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xC9BC [?] [3788]*/ + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08,0x08, + 0x04,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x22,0x42,0x04,0x08,0x10,0x20,0xC0, + /* 0xC9BD [?] [3789]*/ + 0x01,0x01,0x01,0x01,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x3F,0x00,0x00, + 0x00,0x00,0x00,0x00,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00, + /* 0xC9BE [?] [3790]*/ + 0x00,0x7B,0x4A,0x4A,0x4A,0x4A,0x4A,0xFF,0x4A,0x4A,0x4A,0x4A,0x4A,0x5A,0x85,0x08, + 0x02,0xC2,0x42,0x4A,0x4A,0x4A,0x4A,0xEA,0x4A,0x4A,0x4A,0x4A,0x42,0x42,0x4A,0x84, + /* 0xC9BF [?] [3791]*/ + 0x10,0x10,0x11,0x15,0x59,0x51,0x51,0x91,0x11,0x11,0x11,0x29,0x25,0x42,0x42,0x84, + 0x20,0x10,0xFE,0x02,0x02,0xFE,0x00,0xEE,0x22,0xAA,0x66,0x22,0x66,0xAA,0x22,0x66, + /* 0xC9C0 [?] [3792]*/ + 0x10,0x08,0x00,0x7E,0x02,0x04,0x08,0x1A,0x2C,0x4A,0x0A,0x08,0x08,0x08,0x08,0x08, + 0x04,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x22,0x42,0x04,0x08,0x10,0x20,0xC0, + /* 0xC9C1 [?] [3793]*/ + 0x20,0x17,0x00,0x40,0x41,0x41,0x41,0x41,0x42,0x42,0x44,0x48,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x84,0x44,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xC9C2 [?] [3794]*/ + 0x00,0x78,0x48,0x57,0x50,0x62,0x51,0x48,0x4F,0x48,0x68,0x51,0x41,0x42,0x44,0x48, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x50,0x40,0xFE,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xC9C3 [?] [3795]*/ + 0x20,0x2F,0x20,0x27,0xFC,0x25,0x25,0x2F,0x30,0xE3,0x22,0x23,0x22,0x23,0xA0,0x4F, + 0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xC9C4 [?] [3796]*/ + 0x00,0x7C,0x45,0x47,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x11,0x29,0x26,0x42,0x84, + 0x80,0xF8,0x08,0xFE,0x44,0x92,0xFE,0x00,0x7C,0x00,0x7C,0x00,0x7C,0x44,0x7C,0x44, + /* 0xC9C5 [?] [3797]*/ + 0x00,0x78,0x4B,0x48,0x49,0x78,0x4B,0x49,0x48,0x7B,0x48,0x49,0x49,0x49,0x49,0x99, + 0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xC9C6 [?] [3798]*/ + 0x08,0x04,0x7F,0x01,0x3F,0x01,0xFF,0x11,0x09,0xFF,0x00,0x3F,0x20,0x20,0x3F,0x20, + 0x20,0x40,0xFC,0x00,0xF8,0x00,0xFE,0x10,0x20,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xC9C7 [?] [3799]*/ + 0x00,0x20,0x10,0x10,0x84,0x44,0x44,0x14,0x14,0x24,0xE4,0x24,0x24,0x27,0x20,0x00, + 0x40,0x40,0x40,0x40,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x04,0x00, + /* 0xC9C8 [?] [3800]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x21,0x29,0x25,0x49,0x51,0x85,0x02, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x7C,0x04,0x24,0x14,0x24,0x44,0x14,0x08, + /* 0xC9C9 [?] [3801]*/ + 0x10,0x10,0x23,0x20,0x49,0xF8,0x13,0x21,0x40,0xFB,0x40,0x01,0x19,0xE1,0x41,0x01, + 0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xC9CA [?] [3802]*/ + 0x20,0x20,0x23,0x20,0x20,0xFB,0x22,0x22,0x23,0x22,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x40,0x20,0xFE,0x88,0x50,0xFE,0x52,0x8A,0x06,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xC9CB [?] [3803]*/ + 0x08,0x08,0x09,0x11,0x12,0x34,0x30,0x53,0x90,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x80,0x80,0x00,0xFE,0x00,0x40,0x40,0xFC,0x44,0x44,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xC9CC [?] [3804]*/ + 0x02,0x01,0x7F,0x08,0x04,0x3F,0x20,0x24,0x28,0x37,0x24,0x24,0x27,0x20,0x20,0x20, + 0x00,0x00,0xFC,0x20,0x40,0xF8,0x08,0x48,0x28,0xD8,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xC9CD [?] [3805]*/ + 0x11,0x09,0x3F,0x20,0x4F,0x08,0x0F,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x10,0x20,0xFC,0x04,0xE8,0x20,0xE0,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xC9CE [?] [3806]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02, + 0x40,0x40,0x80,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xC9CF [?] [3807]*/ + 0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFF,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC9D0 [?] [3808]*/ + 0x01,0x21,0x11,0x09,0x01,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x27,0x20,0x20,0x20, + 0x00,0x08,0x10,0x20,0x00,0xF8,0x08,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xC9D1 [?] [3809]*/ + 0x01,0x11,0x09,0x7F,0x40,0x9F,0x10,0x1F,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x10,0x20,0xFE,0x02,0xF4,0x10,0xF0,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xC9D2 [?] [3810]*/ + 0x10,0x11,0x10,0x10,0xFC,0x11,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC9D3 [?] [3811]*/ + 0x10,0x11,0x10,0x10,0xFC,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC9D4 [?] [3812]*/ + 0x08,0x1D,0xF0,0x10,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC9D5 [?] [3813]*/ + 0x20,0x20,0x20,0x23,0xA8,0xB0,0xA0,0xA3,0x20,0x27,0x20,0x20,0x51,0x49,0x42,0x84, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xC9D6 [?] [3814]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x1F,0x20,0x40,0x88,0x04,0x02,0x02,0x00,0x00,0x00, + 0x40,0x40,0xFE,0x40,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC9D7 [?] [3815]*/ + 0x08,0x08,0x10,0x1F,0x20,0x40,0x80,0x04,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xC9D8 [?] [3816]*/ + 0x20,0x11,0x7C,0x00,0x44,0x28,0xFE,0x00,0x7D,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x94,0x88,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xC9D9 [?] [3817]*/ + 0x01,0x01,0x01,0x09,0x09,0x11,0x11,0x21,0x41,0x01,0x00,0x00,0x01,0x02,0x0C,0x70, + 0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x14,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xC9DA [?] [3818]*/ + 0x00,0x01,0x78,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xC9DB [?] [3819]*/ + 0x00,0x7F,0x11,0x11,0x21,0x25,0x42,0x80,0x3F,0x21,0x21,0x21,0x21,0x3F,0x21,0x00, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xC9DC [?] [3820]*/ + 0x10,0x13,0x20,0x20,0x48,0xF9,0x11,0x22,0x44,0xF9,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xC9DD [?] [3821]*/ + 0x02,0x02,0x7F,0x04,0x08,0x32,0xDF,0x02,0xFF,0x03,0x0F,0x38,0xCF,0x08,0x0F,0x08, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xD6,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xC9DE [?] [3822]*/ + 0x00,0x7C,0x44,0x54,0x55,0x56,0x54,0x54,0x57,0x54,0x55,0x11,0x2A,0x24,0x44,0x80, + 0x20,0x20,0x50,0x88,0x04,0xFA,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xC9DF [?] [3823]*/ + 0x10,0x10,0x10,0x7D,0x55,0x56,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xC9E0 [?] [3824]*/ + 0x00,0x00,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x10,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xC9E1 [?] [3825]*/ + 0x01,0x02,0x04,0x08,0x30,0xCF,0x01,0x01,0x3F,0x01,0x01,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xF8,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xC9E2 [?] [3826]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFF,0x14,0x14,0x56,0x55,0x95,0x24,0x24,0x54,0x88, + 0x20,0x20,0x20,0x40,0x7E,0x84,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xC9E3 [?] [3827]*/ + 0x10,0x13,0x11,0x11,0xFD,0x11,0x11,0x17,0x18,0x37,0xD0,0x12,0x11,0x12,0x54,0x28, + 0x00,0xFC,0x08,0xF8,0x08,0xF8,0x0E,0xF8,0x08,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xC9E4 [?] [3828]*/ + 0x08,0x10,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x22,0xFE,0x06,0x0A,0x12,0x22,0x4A,0x04, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x28,0x10, + /* 0xC9E5 [?] [3829]*/ + 0x20,0x23,0x21,0x21,0x31,0xA9,0xA1,0xA7,0xA0,0x27,0x20,0x22,0x21,0x22,0x24,0x28, + 0x00,0xFC,0x08,0xF8,0x08,0xF8,0x0E,0xF8,0x08,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xC9E6 [?] [3830]*/ + 0x00,0x20,0x11,0x11,0x81,0x41,0x47,0x10,0x10,0x21,0xE1,0x22,0x24,0x20,0x20,0x07, + 0x20,0x20,0x20,0x3C,0x20,0x20,0xFE,0x00,0x20,0x24,0x24,0x28,0x10,0x20,0xC0,0x00, + /* 0xC9E7 [?] [3831]*/ + 0x20,0x10,0x10,0xF8,0x08,0x10,0x13,0x38,0x54,0x94,0x10,0x10,0x10,0x10,0x17,0x10, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xC9E8 [?] [3832]*/ + 0x00,0x21,0x11,0x11,0x01,0x02,0xF4,0x13,0x11,0x11,0x10,0x14,0x18,0x10,0x03,0x0C, + 0x00,0xF0,0x10,0x10,0x10,0x0E,0x00,0xF8,0x08,0x10,0x90,0xA0,0x40,0xA0,0x18,0x06, + /* 0xC9E9 [?] [3833]*/ + 0x00,0x00,0xFC,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x24,0x20,0x00, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xC9EA [?] [3834]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x01, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00, + /* 0xC9EB [?] [3835]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4A,0x4B,0x4A,0x4A,0x7A,0x4B,0x02,0x00,0x00,0x00, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0xF8,0x48,0x48,0x48,0xF8,0x48,0x40,0x40,0x40, + /* 0xC9EC [?] [3836]*/ + 0x08,0x08,0x08,0x17,0x14,0x34,0x34,0x57,0x94,0x14,0x14,0x17,0x14,0x10,0x10,0x10, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x44,0x40,0x40,0x40, + /* 0xC9ED [?] [3837]*/ + 0x02,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x7F,0x00,0x00,0x03,0x1C,0xE0,0x00, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF2,0x14,0x18,0xF0,0x50,0x90,0x10,0x10,0x50,0x20, + /* 0xC9EE [?] [3838]*/ + 0x00,0x27,0x14,0x14,0x81,0x42,0x40,0x10,0x17,0x20,0xE0,0x21,0x22,0x2C,0x20,0x00, + 0x00,0xFC,0x04,0xA4,0x10,0x08,0x40,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xC9EF [?] [3839]*/ + 0x20,0x23,0x22,0x22,0xFA,0x4A,0x4A,0x4B,0x8A,0x4A,0x32,0x12,0x2A,0x4C,0x84,0x08, + 0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFC,0xA0,0xA4,0xA8,0x90,0x90,0x88,0xA4,0xC2, + /* 0xC9F0 [?] [3840]*/ + 0x10,0x10,0x20,0x25,0x45,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE0,0x40,0x00, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xC9F1 [?] [3841]*/ + 0x20,0x10,0x10,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x10,0x10,0x10, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xC9F2 [?] [3842]*/ + 0x00,0x20,0x10,0x17,0x84,0x48,0x40,0x10,0x10,0x20,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x40,0x40,0x40,0xFE,0x44,0x48,0x40,0xA0,0xA0,0xA0,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xC9F3 [?] [3843]*/ + 0x02,0x01,0x7F,0x41,0x81,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21,0x01,0x01,0x01, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x00,0x00,0x00, + /* 0xC9F4 [?] [3844]*/ + 0x20,0x20,0x23,0x22,0xF8,0x49,0x49,0x49,0x49,0x91,0x51,0x21,0x31,0x48,0x48,0x80, + 0x40,0x20,0xFE,0x22,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xC9F5 [?] [3845]*/ + 0x08,0x08,0x7F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x08,0x08,0xFF,0x12,0x14,0x10,0x1F, + 0x20,0x20,0xFC,0x20,0x20,0xE0,0x20,0x20,0xE0,0x20,0x20,0xFE,0x20,0x10,0x00,0xF8, + /* 0xC9F6 [?] [3846]*/ + 0x04,0x25,0x24,0x24,0x24,0x24,0x27,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10, + 0x00,0xF8,0x88,0x50,0x20,0xD8,0x06,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x50,0x20, + /* 0xC9F7 [?] [3847]*/ + 0x20,0x20,0x27,0x20,0x33,0xAA,0xA3,0xA2,0xA3,0x22,0x23,0x22,0x2F,0x21,0x22,0x24, + 0x40,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFE,0x10,0x08,0x04, + /* 0xC9F8 [?] [3848]*/ + 0x00,0x20,0x11,0x13,0x80,0x47,0x41,0x12,0x1C,0x23,0xE0,0x20,0x23,0x20,0x20,0x07, + 0x80,0x90,0x08,0xFC,0x40,0xFE,0x10,0x48,0x86,0x10,0x20,0xC4,0x08,0x30,0xC0,0x00, + /* 0xC9F9 [?] [3849]*/ + 0x01,0x01,0xFF,0x01,0x7F,0x00,0x3F,0x21,0x21,0x3F,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0x00,0xFE,0x00,0xFC,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xC9FA [?] [3850]*/ + 0x01,0x11,0x11,0x11,0x3F,0x21,0x41,0x81,0x01,0x3F,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xC9FB [?] [3851]*/ + 0x11,0x11,0x51,0x51,0x7D,0x51,0x91,0x10,0x7C,0x13,0x10,0x10,0x1C,0xE1,0x42,0x04, + 0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x40,0x40,0xFE,0x42,0x82,0x82,0x02,0x14,0x08, + /* 0xC9FC [?] [3852]*/ + 0x10,0x10,0x51,0x51,0x7D,0x51,0x92,0x10,0x1C,0xF1,0x50,0x10,0x10,0x10,0x13,0x10, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xC9FD [?] [3853]*/ + 0x01,0x07,0x3C,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x20,0xA0,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xC9FE [?] [3854]*/ + 0x10,0x11,0x21,0x21,0x49,0xF8,0x13,0x22,0x42,0xFB,0x42,0x02,0x1B,0xE0,0x40,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x40,0xF8,0x48,0x48,0xF8,0x48,0x48,0xFA,0x42,0x42,0x3E, + /* 0xCAA1 [?] [3855]*/ + 0x01,0x11,0x11,0x21,0x40,0x03,0x0C,0x3F,0xD0,0x1F,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x10,0x08,0x24,0xC0,0x00,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCAA2 [?] [3856]*/ + 0x00,0x00,0x3F,0x20,0x20,0x3E,0x22,0x22,0x4A,0x44,0x81,0x3F,0x24,0x24,0xFF,0x00, + 0x90,0x88,0xFC,0x80,0x88,0x48,0x50,0x24,0x54,0x8C,0x04,0xF8,0x48,0x48,0xFE,0x00, + /* 0xCAA3 [?] [3857]*/ + 0x07,0x78,0x08,0xFF,0x2A,0x2A,0xEB,0x2A,0x6A,0xA9,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x02,0x02,0x02,0x82,0x12,0x92,0x12,0x92,0x92,0x92,0x12,0x12,0x02,0x82,0x0A,0x04, + /* 0xCAA4 [?] [3858]*/ + 0x00,0x78,0x49,0x49,0x49,0x79,0x4A,0x48,0x48,0x79,0x48,0x48,0x48,0x48,0x4B,0x98, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xCAA5 [?] [3859]*/ + 0x00,0x3F,0x08,0x04,0x02,0x01,0x06,0x18,0xE1,0x01,0x1F,0x01,0x01,0x01,0x7F,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x00,0xC0,0x30,0x0E,0x00,0xF0,0x00,0x00,0x00,0xFC,0x00, + /* 0xCAA6 [?] [3860]*/ + 0x08,0x0B,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x09,0x11,0x10,0x20,0x40, + 0x00,0xFE,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20,0x20, + /* 0xCAA7 [?] [3861]*/ + 0x01,0x11,0x11,0x11,0x3F,0x21,0x41,0x01,0xFF,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xCAA8 [?] [3862]*/ + 0x01,0x89,0x51,0x25,0x55,0x95,0x15,0x15,0x35,0x55,0x95,0x11,0x12,0x12,0xA4,0x48, + 0x00,0xFE,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x5C,0x10,0x10,0x10, + /* 0xCAA9 [?] [3863]*/ + 0x20,0x10,0x10,0x01,0xFE,0x21,0x21,0x3D,0x27,0x25,0x25,0x25,0x25,0x45,0x54,0x88, + 0x80,0x80,0xFE,0x20,0x20,0x20,0x2C,0x74,0xA4,0x24,0x34,0x2A,0x22,0x02,0xFE,0x00, + /* 0xCAAA [?] [3864]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x17,0x11,0x21,0xE9,0x25,0x23,0x21,0x2F,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x20,0x20,0x24,0x28,0x30,0x20,0xFE,0x00, + /* 0xCAAB [?] [3865]*/ + 0x00,0x20,0x10,0x13,0x00,0x00,0xF7,0x10,0x10,0x17,0x10,0x12,0x15,0x19,0x10,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x40,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xCAAC [?] [3866]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xCAAD [?] [3867]*/ + 0x00,0x7F,0x00,0x03,0x7C,0x04,0x3F,0x24,0x24,0x24,0x3F,0x04,0x04,0x07,0x78,0x20, + 0x00,0xF0,0x90,0xD0,0x10,0x10,0x90,0x90,0x90,0x90,0x90,0x12,0x8A,0xCA,0x46,0x02, + /* 0xCAAE [?] [3868]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xCAAF [?] [3869]*/ + 0x00,0xFF,0x02,0x02,0x04,0x04,0x08,0x0F,0x18,0x28,0x48,0x88,0x08,0x08,0x0F,0x08, + 0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xCAB0 [?] [3870]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x11,0x14,0x18,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCAB1 [?] [3871]*/ + 0x00,0x00,0x7C,0x44,0x45,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x08,0x28,0x10, + /* 0xCAB2 [?] [3872]*/ + 0x08,0x08,0x08,0x10,0x10,0x30,0x37,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xCAB3 [?] [3873]*/ + 0x01,0x02,0x04,0x0A,0x31,0xDF,0x10,0x1F,0x10,0x1F,0x10,0x11,0x10,0x12,0x14,0x18, + 0x00,0x80,0x40,0x20,0x18,0xF6,0x10,0xF0,0x10,0xF0,0x08,0x90,0x60,0x10,0x08,0x04, + /* 0xCAB4 [?] [3874]*/ + 0x20,0x20,0x20,0x3D,0x45,0x49,0xA1,0x21,0x21,0x21,0x20,0x20,0x28,0x33,0x21,0x00, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x28,0x24,0xFE,0x02,0x00, + /* 0xCAB5 [?] [3875]*/ + 0x02,0x01,0x7F,0x40,0x88,0x04,0x04,0x10,0x08,0x08,0xFF,0x01,0x02,0x04,0x18,0x60, + 0x00,0x00,0xFE,0x02,0x84,0x80,0x80,0x80,0x80,0x80,0xFE,0x40,0x20,0x10,0x08,0x04, + /* 0xCAB6 [?] [3876]*/ + 0x00,0x20,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x10,0x14,0x18,0x11,0x02,0x04, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xCAB7 [?] [3877]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x11,0x09,0x06,0x05,0x18,0xE0, + 0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x80,0x70,0x0E, + /* 0xCAB8 [?] [3878]*/ + 0x08,0x08,0x08,0x1F,0x11,0x21,0x41,0x01,0xFF,0x01,0x02,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x80,0x80,0x40,0x20,0x18,0x06, + /* 0xCAB9 [?] [3879]*/ + 0x10,0x10,0x1F,0x20,0x20,0x67,0x64,0xA4,0x27,0x20,0x22,0x21,0x20,0x21,0x22,0x2C, + 0x40,0x40,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x40,0x40,0x40,0x80,0x40,0x30,0x0E, + /* 0xCABA [?] [3880]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x24,0x22,0x20,0x3F,0x21,0x22,0x24,0x48,0x50,0x80, + 0x00,0xFC,0x04,0x04,0xFC,0x80,0x90,0xA0,0x80,0xFC,0xC0,0xA0,0x90,0x88,0x86,0x80, + /* 0xCABB [?] [3881]*/ + 0x00,0xF8,0x08,0x49,0x49,0x49,0x49,0x7D,0x05,0x04,0x1C,0xE4,0x44,0x04,0x29,0x12, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x20,0xA0,0x60,0x60,0x90,0x08,0x06, + /* 0xCABC [?] [3882]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x25,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x80,0x00, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xCABD [?] [3883]*/ + 0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x0F,0x78,0x20,0x00, + 0x48,0x44,0x44,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x20,0x22,0x12,0x0A,0x06,0x02, + /* 0xCABE [?] [3884]*/ + 0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x11,0x11,0x21,0x41,0x81,0x05,0x02, + 0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x10,0x08,0x04,0x02,0x02,0x00,0x00, + /* 0xCABF [?] [3885]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00, + /* 0xCAC0 [?] [3886]*/ + 0x02,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x13,0x10,0x10,0x10,0x1F,0x00, + 0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0xFC,0x00, + /* 0xCAC1 [?] [3887]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x10,0x10, + 0x40,0x20,0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCAC2 [?] [3888]*/ + 0x01,0x01,0xFF,0x01,0x3F,0x21,0x3F,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0x00,0x00, + /* 0xCAC3 [?] [3889]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x14,0x1B,0x31,0xD1,0x11,0x11,0x11,0x17,0x52,0x20, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0xA0,0x20,0x10,0x10,0x10,0xCA,0x0A,0x06,0x02, + /* 0xCAC4 [?] [3890]*/ + 0x08,0x7E,0x08,0x0E,0x78,0x0A,0x19,0x7F,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x3F, + 0x0C,0xF0,0x80,0xFE,0x88,0x88,0x08,0xFC,0x00,0xF8,0x00,0xF8,0x00,0xF8,0x08,0xF8, + /* 0xCAC5 [?] [3891]*/ + 0x02,0x42,0x22,0x22,0x0F,0x02,0xE2,0x23,0x2E,0x22,0x22,0x2A,0x24,0x51,0x8F,0x00, + 0x08,0x1C,0x60,0x40,0xC0,0x7E,0xC8,0x48,0x48,0x48,0x48,0x48,0x88,0x00,0xFE,0x00, + /* 0xCAC6 [?] [3892]*/ + 0x08,0x08,0x7D,0x08,0x0C,0x19,0x68,0x08,0x28,0x13,0x02,0x7F,0x04,0x08,0x10,0x60, + 0x40,0x40,0xF8,0x48,0x48,0xC8,0x4A,0xAA,0x86,0x02,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xCAC7 [?] [3893]*/ + 0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x00,0xFF,0x01,0x11,0x11,0x11,0x29,0x45,0x83, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE, + /* 0xCAC8 [?] [3894]*/ + 0x00,0x00,0x79,0x48,0x4B,0x48,0x48,0x49,0x4A,0x4C,0x79,0x49,0x01,0x01,0x01,0x01, + 0x40,0x44,0xF8,0x50,0xFE,0x40,0xF8,0x82,0x7E,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xCAC9 [?] [3895]*/ + 0x02,0x02,0xF3,0x95,0x98,0x90,0x97,0x90,0x92,0x92,0xF2,0x95,0x08,0x00,0x0F,0x00, + 0x10,0x10,0xDE,0x28,0x84,0x00,0xFC,0x40,0x48,0x48,0x48,0x54,0xE2,0x40,0xFE,0x00, + /* 0xCACA [?] [3896]*/ + 0x00,0x23,0x10,0x10,0x07,0x00,0xF0,0x13,0x12,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0x78,0xC0,0x40,0x40,0xFE,0x40,0x40,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xCACB [?] [3897]*/ + 0x08,0x08,0x08,0x10,0x10,0x3F,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x17,0x10,0x10, + 0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFC,0x00,0x00, + /* 0xCACC [?] [3898]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x37,0x50,0x90,0x17,0x10,0x12,0x11,0x11,0x10,0x10, + 0x40,0x40,0x40,0xFC,0x40,0x40,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xCACD [?] [3899]*/ + 0x0C,0xF3,0x11,0x54,0x38,0x10,0xFC,0x13,0x30,0x39,0x54,0x50,0x93,0x10,0x10,0x10, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xCACE [?] [3900]*/ + 0x20,0x20,0x20,0x3C,0x45,0x4A,0x80,0x21,0x21,0x21,0x21,0x25,0x29,0x31,0x20,0x00, + 0x80,0x80,0x80,0xFE,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCACF [?] [3901]*/ + 0x00,0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x28,0x30,0x20, + 0x10,0xF8,0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x40,0x40,0x22,0x12,0x0A,0x06,0x02, + /* 0xCAD0 [?] [3902]*/ + 0x02,0x01,0x00,0x7F,0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xCAD1 [?] [3903]*/ + 0x10,0x10,0x10,0x1B,0x54,0x50,0x57,0x90,0x10,0x17,0x10,0x12,0x11,0x11,0x10,0x10, + 0x40,0x40,0x40,0xFC,0x40,0x40,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xCAD2 [?] [3904]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3F,0x04,0x08,0x1F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0x20,0xF0,0x10,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xCAD3 [?] [3905]*/ + 0x20,0x11,0x11,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x10,0x10,0x10,0x11,0x12,0x14, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xCAD4 [?] [3906]*/ + 0x00,0x20,0x10,0x10,0x07,0x00,0xF0,0x17,0x11,0x11,0x11,0x15,0x19,0x17,0x02,0x00, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0xE0,0x20,0x10,0x10,0x10,0xCA,0x0A,0x06,0x02, + /* 0xCAD5 [?] [3907]*/ + 0x08,0x08,0x48,0x48,0x48,0x49,0x4A,0x48,0x48,0x58,0x68,0x48,0x08,0x08,0x09,0x0A, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xCAD6 [?] [3908]*/ + 0x00,0x00,0x3F,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02, + 0x10,0xF8,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xCAD7 [?] [3909]*/ + 0x10,0x08,0xFF,0x02,0x04,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20, + 0x10,0x20,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCAD8 [?] [3910]*/ + 0x02,0x01,0x7F,0x40,0x80,0x00,0x00,0xFF,0x00,0x00,0x10,0x08,0x08,0x00,0x01,0x00, + 0x00,0x00,0xFE,0x02,0x44,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xCAD9 [?] [3911]*/ + 0x02,0x02,0x7F,0x02,0x3F,0x04,0xFF,0x08,0x08,0x1F,0x10,0x24,0x42,0x82,0x00,0x00, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xCADA [?] [3912]*/ + 0x10,0x13,0x10,0x12,0xFD,0x11,0x17,0x14,0x18,0x33,0xD1,0x11,0x10,0x10,0x51,0x26, + 0x1C,0xE0,0x84,0x44,0x48,0x10,0xFE,0x02,0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xCADB [?] [3913]*/ + 0x09,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x10,0x00,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCADC [?] [3914]*/ + 0x00,0x01,0x7E,0x22,0x11,0x7F,0x40,0x80,0x3F,0x10,0x08,0x04,0x03,0x0C,0x30,0xC0, + 0x08,0xFC,0x10,0x10,0x20,0xFE,0x02,0x04,0xF0,0x10,0x20,0x40,0x80,0x60,0x18,0x06, + /* 0xCADD [?] [3915]*/ + 0x00,0x00,0x1F,0x11,0x96,0x54,0x57,0x14,0x37,0x50,0x97,0x12,0x21,0x20,0x43,0x8C, + 0x80,0x40,0xFE,0x40,0x5C,0x44,0x5C,0x44,0xFC,0x40,0xFC,0x08,0x10,0xE0,0x18,0x06, + /* 0xCADE [?] [3916]*/ + 0x08,0x04,0x3F,0x21,0x3F,0x21,0x3F,0x00,0xFF,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x20,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xCADF [?] [3917]*/ + 0x08,0xFF,0x08,0x00,0x7D,0x04,0x18,0x51,0x50,0x5C,0x50,0x50,0x5D,0x71,0xC2,0x04, + 0x20,0xFE,0x20,0x10,0xFE,0x20,0x48,0xFE,0x02,0xA8,0xA8,0xA8,0x2A,0x2A,0x2A,0x06, + /* 0xCAE0 [?] [3918]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x32,0x3A,0x56,0x52,0x92,0x12,0x13,0x12,0x13,0x10, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xCAE1 [?] [3919]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x33,0x38,0x55,0x51,0x91,0x11,0x12,0x12,0x14,0x18, + 0x40,0x20,0xFC,0x40,0x90,0x08,0xFC,0x04,0x50,0x50,0x50,0x50,0x50,0x52,0x52,0x0E, + /* 0xCAE2 [?] [3920]*/ + 0x00,0x01,0xFD,0x21,0x21,0x3E,0x44,0x47,0x64,0x94,0x08,0x09,0x11,0x22,0x40,0x80, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xCAE3 [?] [3921]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x13,0x14,0x18,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x00,0xF8,0x08,0x50,0x20,0x10,0xFE,0x22,0x24,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xCAE4 [?] [3922]*/ + 0x20,0x20,0x21,0xFA,0x25,0x40,0x53,0x92,0xFA,0x13,0x1A,0xF2,0x53,0x12,0x12,0x12, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xCAE5 [?] [3923]*/ + 0x08,0x08,0x0E,0x08,0x08,0x08,0xFF,0x00,0x08,0x08,0x4A,0x49,0x89,0x08,0x28,0x11, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xCAE6 [?] [3924]*/ + 0x10,0x11,0x28,0x44,0x82,0x7C,0x13,0x10,0xFE,0x10,0x10,0x7C,0x44,0x44,0x7C,0x44, + 0x00,0xF8,0x08,0x50,0x20,0x10,0xFE,0x22,0x24,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xCAE7 [?] [3925]*/ + 0x01,0x21,0x11,0x11,0x81,0x41,0x47,0x10,0x11,0x21,0xE5,0x25,0x29,0x21,0x25,0x02, + 0x00,0x00,0xDC,0x14,0x14,0x14,0xD4,0x14,0x14,0x14,0x88,0x48,0x48,0x14,0x14,0x22, + /* 0xCAE8 [?] [3926]*/ + 0x00,0x00,0x7D,0x04,0x08,0x10,0x51,0x50,0x5C,0x50,0x50,0x50,0x5D,0x71,0xC2,0x04, + 0x20,0x10,0xFE,0x20,0x48,0x84,0xFE,0x02,0xA8,0xA8,0xA8,0xA8,0x2A,0x2A,0x2A,0x06, + /* 0xCAE9 [?] [3927]*/ + 0x02,0x02,0x02,0x3F,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x20,0x10,0x08,0xE0,0x20,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x28,0x10,0x00, + /* 0xCAEA [?] [3928]*/ + 0x00,0x7C,0x45,0x44,0x54,0x57,0x54,0x54,0x54,0x55,0x54,0x13,0x28,0x24,0x40,0x83, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x10,0x90,0xFE,0x28,0x44,0x82,0x02, + /* 0xCAEB [?] [3929]*/ + 0x10,0x08,0xFF,0x00,0x7E,0x42,0x7E,0x01,0x7E,0x04,0x08,0x0E,0xF8,0x08,0x29,0x12, + 0x40,0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0xC8,0x48,0x68,0x5A,0x8A,0x8A,0x06,0x02, + /* 0xCAEC [?] [3930]*/ + 0x10,0xFE,0x00,0x7D,0x44,0x7C,0x00,0x7C,0x08,0xFE,0x11,0x52,0x20,0x48,0x44,0x84, + 0x40,0x40,0x40,0xF8,0x48,0x48,0xC8,0x48,0xAA,0xAA,0x06,0x02,0x00,0x88,0x44,0x44, + /* 0xCAED [?] [3931]*/ + 0x08,0xFF,0x08,0x3F,0x24,0x3F,0x02,0x1F,0x02,0xFF,0x03,0x0F,0x38,0xCF,0x08,0x0F, + 0x20,0xFE,0x20,0xF8,0x48,0xF8,0x00,0xD0,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xCAEE [?] [3932]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x02,0x1F,0x02,0xFF,0x03,0x0F,0x38,0xCF,0x08,0x0F,0x08, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xD0,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xCAEF [?] [3933]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x48,0x49,0x78,0x4B,0x48,0x48,0x49,0x7A,0x48,0x00,0x00, + 0x00,0xFE,0x52,0x52,0xFE,0x24,0xFC,0x28,0xFE,0x20,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xCAF0 [?] [3934]*/ + 0x00,0x3F,0x24,0x24,0x3F,0x02,0x1F,0x02,0xFF,0x03,0x0F,0x38,0xCF,0x08,0x0F,0x08, + 0x00,0xF8,0x48,0x48,0xF8,0x00,0xD0,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xCAF1 [?] [3935]*/ + 0x00,0x3F,0x24,0x24,0x3F,0x10,0x1F,0x22,0x5F,0x92,0x12,0x1F,0x02,0x03,0x7C,0x20, + 0x00,0xF8,0x48,0x48,0xF8,0x00,0xFC,0x04,0xC4,0x44,0x44,0xC4,0x24,0xF4,0x14,0x08, + /* 0xCAF2 [?] [3936]*/ + 0x00,0x3F,0x01,0x7F,0x09,0x11,0x22,0xC4,0x09,0x31,0xCB,0x05,0x19,0x61,0x05,0x02, + 0xF8,0x00,0x00,0xFC,0x20,0x10,0x88,0x44,0x20,0x18,0x26,0xC0,0x30,0x08,0x00,0x00, + /* 0xCAF3 [?] [3937]*/ + 0x04,0x38,0x20,0x3C,0x20,0x20,0x3F,0x00,0x29,0x25,0x21,0x29,0x25,0x21,0x29,0x31, + 0x00,0x78,0x08,0x78,0x08,0x08,0xF8,0x00,0x48,0x28,0x08,0x48,0x2A,0x0A,0x46,0x82, + /* 0xCAF4 [?] [3938]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x2F,0x20,0x2F,0x28,0x2F,0x20,0x3F,0x50,0x57,0x90,0x10, + 0x00,0xFC,0x04,0xFC,0x00,0xF8,0x80,0xF8,0x88,0xF8,0x80,0xFC,0x94,0xF4,0x14,0x08, + /* 0xCAF5 [?] [3939]*/ + 0x01,0x01,0x01,0x01,0x7F,0x03,0x05,0x05,0x09,0x11,0x21,0x41,0x81,0x01,0x01,0x01, + 0x00,0x20,0x10,0x10,0xFC,0x80,0x40,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,0x00, + /* 0xCAF6 [?] [3940]*/ + 0x00,0x20,0x10,0x10,0x07,0x00,0xF0,0x11,0x11,0x12,0x14,0x10,0x10,0x28,0x47,0x00, + 0x40,0x50,0x48,0x40,0xFC,0xC0,0xE0,0x50,0x48,0x44,0x44,0x40,0x40,0x00,0xFE,0x00, + /* 0xCAF7 [?] [3941]*/ + 0x20,0x20,0x27,0x20,0xF8,0x24,0x22,0x72,0x69,0xA1,0xA2,0x22,0x24,0x28,0x20,0x20, + 0x04,0x04,0x84,0x84,0xBE,0x84,0x84,0xA4,0x14,0x14,0x84,0x84,0x84,0x04,0x14,0x08, + /* 0xCAF8 [?] [3942]*/ + 0x01,0x01,0xFF,0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x23,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x88,0x40,0x20,0x18,0x06,0x00, + /* 0xCAF9 [?] [3943]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x30,0x28,0x24,0x24,0x20,0x20,0x40,0x40,0x81, + 0x50,0x48,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xCAFA [?] [3944]*/ + 0x08,0x4B,0x4A,0x49,0x48,0x48,0x48,0x4B,0x0A,0x01,0x3F,0x00,0x08,0x04,0xFF,0x00, + 0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x0C,0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00, + /* 0xCAFB [?] [3945]*/ + 0x7F,0x49,0x7F,0x49,0x7F,0x08,0x7F,0x08,0x0F,0xF0,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x7C,0x04,0x28,0x10,0x7E,0x12,0x14,0x10,0x50,0x20,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xCAFC [?] [3946]*/ + 0x01,0x00,0x3F,0x20,0x22,0x22,0x3F,0x22,0x22,0x22,0x23,0x20,0x4A,0x49,0x91,0x00, + 0x00,0x80,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xE0,0x00,0x48,0x24,0x24,0x00, + /* 0xCAFD [?] [3947]*/ + 0x08,0x49,0x2A,0x08,0xFF,0x2A,0x49,0x88,0x10,0xFE,0x22,0x42,0x64,0x18,0x34,0xC2, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xCAFE [?] [3948]*/ + 0x01,0x21,0x17,0x11,0x81,0x47,0x45,0x15,0x17,0x21,0xE3,0x25,0x29,0x21,0x21,0x01, + 0x08,0x08,0xC8,0x08,0x1E,0xD2,0x64,0x40,0xC8,0x08,0x88,0x48,0x54,0x14,0x24,0x42, + /* 0xCBA1 [?] [3949]*/ + 0x10,0x10,0xFE,0x22,0x44,0x34,0x08,0x14,0x22,0xC0,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCBA2 [?] [3950]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x22,0x22,0x22,0x3F,0x52,0x52,0x52,0x93,0x12,0x02,0x02, + 0x02,0xC2,0x42,0x42,0xD2,0x12,0x12,0x12,0xD2,0x52,0x52,0x52,0x42,0x82,0x0A,0x04, + /* 0xCBA3 [?] [3951]*/ + 0x00,0xFF,0x02,0x04,0x3F,0x24,0x24,0x24,0x22,0x02,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0xFE,0x00,0x00,0xF8,0x88,0x88,0xA8,0x10,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xCBA4 [?] [3952]*/ + 0x10,0x10,0x13,0x10,0xFC,0x12,0x11,0x16,0x18,0x30,0xD0,0x13,0x10,0x10,0x50,0x20, + 0x40,0x20,0xFE,0x20,0x48,0xF2,0x24,0x52,0xF8,0x08,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xCBA5 [?] [3953]*/ + 0x02,0x01,0xFF,0x00,0x1F,0x10,0xFF,0x10,0x1F,0x02,0x04,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0xFE,0x00,0xF0,0x10,0xFE,0x10,0xF0,0x80,0x44,0x28,0x10,0x08,0x06,0x00, + /* 0xCBA6 [?] [3954]*/ + 0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x41,0x41,0x80, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x28,0x12,0x02,0xFE, + /* 0xCBA7 [?] [3955]*/ + 0x08,0x08,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x09,0x11,0x10,0x20,0x40, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20,0x20, + /* 0xCBA8 [?] [3956]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x31,0x38,0x54,0x50,0x91,0x10,0x10,0x10,0x13,0x10, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xCBA9 [?] [3957]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x11,0x14,0x18,0x30,0xD1,0x10,0x10,0x10,0x53,0x20, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xCBAA [?] [3958]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x08,0x7E,0x18,0x2C,0x4A,0x88,0x08,0x08, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xCBAB [?] [3959]*/ + 0x00,0x00,0xFD,0x04,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x44,0x81,0x02, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xCBAC [?] [3960]*/ + 0x01,0x01,0x7F,0x01,0x29,0x11,0x29,0x01,0x29,0x11,0x2A,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFC,0x00,0x28,0x10,0x28,0x00,0x28,0x10,0xA8,0x80,0x40,0x20,0x18,0x06, + /* 0xCBAD [?] [3961]*/ + 0x01,0x41,0x21,0x23,0x02,0x06,0xEB,0x22,0x22,0x23,0x22,0x22,0x2A,0x33,0x22,0x02, + 0x40,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00, + /* 0xCBAE [?] [3962]*/ + 0x01,0x01,0x01,0x01,0x01,0x7D,0x05,0x09,0x09,0x11,0x11,0x21,0x41,0x81,0x05,0x02, + 0x00,0x00,0x00,0x08,0x08,0x90,0xA0,0x40,0x40,0x20,0x10,0x08,0x06,0x00,0x00,0x00, + /* 0xCBAF [?] [3963]*/ + 0x00,0x00,0xF3,0x90,0x90,0xF7,0x92,0x92,0xF7,0x92,0x92,0x97,0xF0,0x90,0x07,0x00, + 0x10,0x78,0xC0,0x40,0x40,0xFC,0x48,0x48,0xFE,0x48,0x48,0xFC,0x40,0x40,0xFC,0x00, + /* 0xCBB0 [?] [3964]*/ + 0x09,0x1C,0xF0,0x10,0x11,0xFD,0x11,0x31,0x39,0x54,0x54,0x90,0x10,0x11,0x12,0x14, + 0x04,0x84,0x88,0x10,0xFC,0x04,0x04,0x04,0xFC,0x50,0x50,0x90,0x92,0x12,0x0E,0x00, + /* 0xCBB1 [?] [3965]*/ + 0x00,0x00,0x79,0x49,0x4A,0x4F,0x48,0x49,0x49,0x49,0x79,0x49,0x02,0x02,0x04,0x08, + 0x80,0x80,0x00,0x10,0x08,0xFC,0x04,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xCBB2 [?] [3966]*/ + 0x00,0x07,0xF0,0x92,0x91,0xF7,0x94,0x9A,0xF2,0x93,0x94,0x9A,0xF1,0x92,0x04,0x08, + 0x3C,0xC0,0x44,0x24,0x08,0xFE,0x02,0x08,0x08,0xBE,0x88,0xA8,0x3E,0x08,0x08,0x08, + /* 0xCBB3 [?] [3967]*/ + 0x04,0x45,0x54,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x54,0x85,0x06, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xCBB4 [?] [3968]*/ + 0x00,0x3F,0x01,0x10,0x08,0x7F,0x48,0x08,0x1E,0x22,0x52,0x0C,0x08,0x10,0x20,0x40, + 0x7C,0x80,0x08,0x88,0x90,0xFE,0x12,0x10,0xFC,0x10,0x90,0x90,0xFE,0x10,0x10,0x10, + /* 0xCBB5 [?] [3969]*/ + 0x02,0x21,0x11,0x10,0x03,0x02,0xF2,0x12,0x13,0x10,0x10,0x15,0x19,0x12,0x04,0x08, + 0x08,0x08,0x10,0x20,0xF8,0x08,0x08,0x08,0xF8,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xCBB6 [?] [3970]*/ + 0x00,0x03,0xFC,0x10,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3C,0x24,0x21,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x04, + /* 0xCBB7 [?] [3971]*/ + 0x42,0x22,0x24,0xFF,0x08,0x08,0x49,0x49,0x49,0x7F,0x09,0x10,0x10,0x20,0x41,0x82, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x84,0x84,0x14,0x08, + /* 0xCBB8 [?] [3972]*/ + 0x10,0x10,0x11,0x11,0x55,0x59,0x51,0x91,0x10,0x10,0x10,0x28,0x25,0x46,0x40,0x80, + 0x08,0x1C,0xE0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xCBB9 [?] [3973]*/ + 0x22,0x22,0x7F,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0xFF,0x04,0x22,0x41,0x81, + 0x00,0x04,0x78,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xCBBA [?] [3974]*/ + 0x24,0x24,0x24,0x2F,0xF4,0x27,0x24,0x27,0x34,0xE4,0x2F,0x20,0x25,0x28,0xB0,0x40, + 0x80,0x82,0x9C,0xD0,0x90,0x90,0x9E,0x94,0x94,0x94,0xD4,0x14,0x14,0xA4,0x24,0x44, + /* 0xCBBB [?] [3975]*/ + 0x04,0x04,0xE4,0xAF,0xA4,0xA7,0xA4,0xA7,0xA4,0xA4,0xEF,0xA0,0x05,0x08,0x10,0x00, + 0x80,0x82,0x9C,0xD0,0x90,0x90,0x9E,0x94,0x94,0x94,0xD4,0x14,0x14,0xA4,0x24,0x44, + /* 0xCBBC [?] [3976]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x20,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xCBBD [?] [3977]*/ + 0x04,0x0E,0x78,0x08,0x08,0xFF,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x89,0x08,0x08,0x08, + 0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x40,0x40,0x48,0x84,0x84,0xFE,0x82,0x02,0x00, + /* 0xCBBE [?] [3978]*/ + 0x00,0x3F,0x00,0x00,0x7F,0x00,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10,0x00,0x00, + 0x00,0xF8,0x08,0x08,0xE8,0x08,0x08,0x88,0x88,0x88,0x88,0x88,0x88,0x88,0x28,0x10, + /* 0xCBBF [?] [3979]*/ + 0x08,0x08,0x10,0x10,0x22,0x42,0x7C,0x04,0x08,0x10,0x20,0x7E,0x00,0x00,0xFF,0x00, + 0x10,0x10,0x20,0x20,0x44,0x84,0xF8,0x08,0x10,0x20,0x40,0xFC,0x00,0x00,0xFE,0x00, + /* 0xCBC0 [?] [3980]*/ + 0x00,0xFF,0x10,0x10,0x10,0x1E,0x22,0x22,0x52,0x8C,0x04,0x08,0x08,0x10,0x20,0x40, + 0x00,0xFC,0x80,0x80,0x84,0x88,0x90,0xA0,0xC0,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xCBC1 [?] [3981]*/ + 0x00,0x3E,0x20,0x20,0x3D,0x20,0x20,0x3C,0x20,0x21,0xFE,0x20,0x25,0x42,0xFE,0x42, + 0x20,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xCBC2 [?] [3982]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00,0x00,0x7F,0x08,0x04,0x04,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xCBC3 [?] [3983]*/ + 0x00,0x3E,0x22,0x22,0x3E,0x00,0x7F,0x55,0x55,0x55,0x7F,0x55,0x55,0x55,0x51,0x43, + 0x00,0x7C,0x04,0x04,0xF4,0x04,0x04,0x74,0x54,0x54,0x54,0x54,0x74,0x04,0x14,0x08, + /* 0xCBC4 [?] [3984]*/ + 0x00,0x00,0x7F,0x44,0x44,0x44,0x44,0x44,0x48,0x48,0x50,0x60,0x40,0x7F,0x40,0x00, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x3C,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xCBC5 [?] [3985]*/ + 0x08,0x0B,0x08,0x10,0x17,0x30,0x30,0x53,0x92,0x12,0x12,0x13,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x14,0x08, + /* 0xCBC6 [?] [3986]*/ + 0x10,0x11,0x10,0x24,0x24,0x64,0x64,0xA4,0x24,0x24,0x24,0x25,0x26,0x24,0x20,0x21, + 0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x08,0x10,0x10,0x10,0x28,0x24,0x44,0x82,0x02, + /* 0xCBC7 [?] [3987]*/ + 0x20,0x23,0x20,0x3C,0x47,0x48,0xA0,0x23,0x22,0x22,0x22,0x23,0x28,0x30,0x20,0x00, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x14,0x08, + /* 0xCBC8 [?] [3988]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xCBC9 [?] [3989]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x31,0x3A,0x54,0x54,0x90,0x10,0x11,0x13,0x11,0x10, + 0x10,0x90,0x90,0x88,0x88,0x24,0x24,0x22,0x40,0x40,0x88,0x84,0x04,0xFE,0x02,0x00, + /* 0xCBCA [?] [3990]*/ + 0x08,0x08,0x14,0x22,0x41,0x00,0x7F,0x10,0x1F,0x10,0x1F,0x10,0x10,0xFF,0x00,0x00, + 0x20,0x20,0x50,0x88,0x04,0x00,0xFC,0x10,0xF0,0x10,0xF0,0x10,0x3E,0xD0,0x10,0x10, + /* 0xCBCB [?] [3991]*/ + 0x08,0x08,0x08,0x08,0x14,0x12,0x22,0x20,0x41,0x82,0x01,0x08,0x48,0x48,0x87,0x00, + 0x20,0x20,0x20,0x20,0x50,0x50,0x88,0x88,0x04,0x02,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCBCC [?] [3992]*/ + 0x00,0x28,0x24,0x24,0x42,0x52,0x90,0x10,0x20,0x20,0x48,0x44,0xFC,0x44,0x00,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xCBCD [?] [3993]*/ + 0x02,0x21,0x11,0x17,0x00,0x00,0xF0,0x17,0x10,0x10,0x10,0x11,0x12,0x28,0x47,0x00, + 0x08,0x08,0x10,0xFC,0x40,0x40,0x40,0xFE,0x40,0xA0,0x90,0x08,0x08,0x00,0xFE,0x00, + /* 0xCBCE [?] [3994]*/ + 0x02,0x01,0x7F,0x40,0x81,0x01,0x01,0x7F,0x03,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x00,0x00,0xFE,0x02,0x04,0x00,0x00,0xFC,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xCBCF [?] [3995]*/ + 0x00,0x21,0x11,0x11,0x01,0x02,0xF2,0x14,0x18,0x10,0x11,0x15,0x1A,0x17,0x02,0x00, + 0x20,0x20,0x20,0x10,0x10,0x48,0x48,0x44,0x82,0x80,0x10,0x08,0x08,0xFC,0x04,0x00, + /* 0xCBD0 [?] [3996]*/ + 0x00,0x47,0x20,0x21,0x00,0x07,0xE4,0x24,0x27,0x24,0x24,0x27,0x2C,0x34,0x24,0x04, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xCBD1 [?] [3997]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x18,0x31,0xD0,0x10,0x10,0x10,0x50,0x23, + 0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x20,0xFC,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xCBD2 [?] [3998]*/ + 0x10,0x21,0x7D,0x45,0x65,0x55,0x55,0xFD,0x44,0x65,0x54,0x54,0x44,0x44,0x54,0x8B, + 0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x20,0xFC,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xCBD3 [?] [3999]*/ + 0x22,0x2A,0x27,0x22,0xFF,0x22,0x27,0x2A,0x32,0xEF,0x24,0x28,0x25,0x22,0xA5,0x48, + 0x10,0x90,0x10,0x20,0xBE,0x44,0xA4,0xA4,0x28,0xA8,0x90,0x90,0x28,0x28,0x44,0x82, + /* 0xCBD4 [?] [4000]*/ + 0x01,0x01,0xF7,0x91,0x91,0x97,0x95,0x95,0x97,0x91,0xF3,0x95,0x09,0x01,0x01,0x01, + 0x08,0x08,0xC8,0x08,0x1E,0xD2,0x64,0x40,0xC8,0x08,0x88,0x48,0x54,0x14,0x24,0x42, + /* 0xCBD5 [?] [4001]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x02,0x7F,0x02,0x02,0x22,0x22,0x24,0x44,0x08,0x10,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF0,0x10,0x14,0x12,0x12,0x12,0x10,0x10,0xA0,0x40, + /* 0xCBD6 [?] [4002]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x04,0x1E,0xF0,0x10,0x10,0x10,0xFE,0x10,0x38,0x34,0x54,0x52,0x90,0x10,0x10,0x10, + /* 0xCBD7 [?] [4003]*/ + 0x09,0x09,0x0A,0x14,0x10,0x30,0x31,0x52,0x9C,0x13,0x12,0x12,0x12,0x12,0x13,0x12, + 0x10,0x08,0x04,0x44,0x40,0xA0,0x10,0x08,0x06,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xCBD8 [?] [4004]*/ + 0x01,0x3F,0x01,0x1F,0x01,0xFF,0x02,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0xF8,0x00,0xF0,0x00,0xFE,0x00,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xCBD9 [?] [4005]*/ + 0x00,0x20,0x17,0x10,0x03,0x02,0xF2,0x13,0x10,0x11,0x12,0x14,0x10,0x28,0x47,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x48,0x48,0xF8,0xE0,0x50,0x48,0x44,0x40,0x00,0xFE,0x00, + /* 0xCBDA [?] [4006]*/ + 0x7F,0x04,0x04,0x3F,0x24,0x24,0x3F,0x00,0x11,0x09,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0xFC,0x40,0x40,0xF8,0x48,0x48,0xF8,0x00,0x10,0x20,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xCBDB [?] [4007]*/ + 0x10,0x17,0x10,0x20,0x27,0x64,0x64,0xA7,0x22,0x21,0x27,0x20,0x21,0x22,0x2C,0x20, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xFC,0x48,0x50,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xCBDC [?] [4008]*/ + 0x22,0x14,0xFF,0x08,0x49,0x49,0x7F,0x08,0x10,0x21,0x41,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x94,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xCBDD [?] [4009]*/ + 0x04,0x42,0x22,0x20,0x07,0x81,0x45,0x55,0x15,0x27,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x40,0x5E,0x92,0x12,0xD2,0x1E,0x52,0x52,0x52,0xDE,0x52,0x12,0x12,0x22,0x2A,0x44, + /* 0xCBDE [?] [4010]*/ + 0x02,0x01,0x7F,0x40,0x88,0x0F,0x10,0x30,0x53,0x92,0x12,0x13,0x12,0x12,0x13,0x12, + 0x00,0x00,0xFE,0x02,0x04,0xFC,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCBDF [?] [4011]*/ + 0x00,0x20,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x12,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x30,0x18,0x14,0x12,0x10,0x10,0x10, + /* 0xCBE0 [?] [4012]*/ + 0x01,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x21,0x25,0x25,0x25,0x29,0x41,0x41,0x81, + 0x00,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0x08,0x48,0x28,0x28,0x28,0x08,0x08,0x08, + /* 0xCBE1 [?] [4013]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x10,0x10,0x20,0x44,0xFE,0x28,0x44,0xA2,0x3C,0x44,0x44,0xA8,0x10,0x28,0x44,0x82, + /* 0xCBE2 [?] [4014]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7C,0x00,0x00,0xFE,0x10,0x10,0x54,0x52,0x92,0x50,0x20, + 0x20,0x20,0xFE,0x20,0x00,0x7C,0x00,0x00,0xFE,0x10,0x10,0x54,0x52,0x92,0x50,0x20, + /* 0xCBE3 [?] [4015]*/ + 0x20,0x3E,0x48,0x80,0x3F,0x20,0x3F,0x20,0x3F,0x20,0x3F,0x08,0xFF,0x08,0x10,0x20, + 0x40,0x7E,0x90,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x20,0xFE,0x20,0x20,0x20, + /* 0xCBE4 [?] [4016]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x01,0x01,0x3F,0x21,0x21,0x3F,0x01,0x01,0x01,0x7F,0x20, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0xF8,0x20,0x10,0xF8,0x04,0x04, + /* 0xCBE5 [?] [4017]*/ + 0x00,0x78,0x4B,0x50,0x51,0x62,0x55,0x48,0x49,0x49,0x69,0x51,0x41,0x41,0x41,0x41, + 0x40,0x40,0xFE,0x80,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xCBE6 [?] [4018]*/ + 0x00,0x78,0x49,0x54,0x52,0x60,0x51,0x48,0x4E,0x4A,0x6A,0x52,0x42,0x42,0x45,0x48, + 0x10,0x10,0xFE,0x20,0x40,0xFC,0x44,0x44,0x7C,0x44,0x7C,0x44,0x54,0x48,0x00,0xFE, + /* 0xCBE7 [?] [4019]*/ + 0x10,0x10,0x23,0x20,0x4A,0xF9,0x11,0x20,0x43,0xF8,0x41,0x03,0x18,0xE0,0x41,0x06, + 0x08,0x3C,0xC0,0x44,0x24,0x28,0x00,0x40,0xFE,0x88,0x08,0x90,0x60,0x50,0x88,0x04, + /* 0xCBE8 [?] [4020]*/ + 0x00,0x7C,0x45,0x74,0x54,0xFE,0x82,0x7D,0x44,0x7C,0x44,0x7C,0x44,0x44,0x55,0x4A, + 0x10,0x7E,0x20,0xBC,0xC8,0xBE,0x00,0xBC,0xA4,0xBC,0xA4,0xBC,0xA4,0xAC,0x40,0x3E, + /* 0xCBE9 [?] [4021]*/ + 0x00,0x00,0xFD,0x10,0x10,0x20,0x3D,0x66,0x64,0xA4,0x27,0x24,0x3C,0x24,0x20,0x00, + 0x40,0x20,0xFE,0x00,0x88,0x88,0x54,0x22,0x00,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xCBEA [?] [4022]*/ + 0x01,0x21,0x21,0x21,0x3F,0x02,0x02,0x07,0x08,0x14,0x22,0x01,0x00,0x03,0x1C,0xE0, + 0x00,0x08,0x08,0x08,0xF8,0x00,0x00,0xF0,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xCBEB [?] [4023]*/ + 0x08,0x1C,0xF3,0x10,0x11,0xFD,0x11,0x39,0x35,0x50,0x53,0x90,0x10,0x12,0x12,0x14, + 0x20,0x20,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x22,0xFE,0x42,0x24,0xA2,0x8A,0x78, + /* 0xCBEC [?] [4024]*/ + 0x01,0x20,0x10,0x17,0x00,0x01,0xF6,0x10,0x11,0x16,0x10,0x11,0x16,0x28,0x47,0x00, + 0x10,0x90,0xA0,0xFC,0x80,0x44,0x68,0xB0,0x28,0x68,0xA4,0x24,0xA0,0x40,0xFE,0x00, + /* 0xCBED [?] [4025]*/ + 0x00,0x7C,0x4A,0x50,0x50,0x60,0x56,0x4A,0x4A,0x4A,0x6A,0x52,0x42,0x42,0x45,0x48, + 0x88,0x48,0x50,0xFC,0x20,0x50,0x94,0x38,0x50,0x98,0x34,0x54,0x90,0x20,0xFE,0x00, + /* 0xCBEE [?] [4026]*/ + 0x01,0x11,0x11,0x1F,0x41,0x41,0x7F,0x00,0x3F,0x00,0xFF,0x01,0x11,0x21,0x45,0x02, + 0x00,0x10,0x10,0xF0,0x04,0x04,0xFC,0x00,0xF8,0x00,0xFE,0x00,0x10,0x08,0x04,0x00, + /* 0xCBEF [?] [4027]*/ + 0x00,0x7E,0x02,0x04,0x08,0x08,0x0A,0x0C,0x39,0xC9,0x0A,0x08,0x08,0x08,0x28,0x10, + 0x20,0x20,0x20,0x20,0x20,0xA8,0xA4,0xA4,0x22,0x22,0x22,0x20,0x20,0x20,0xA0,0x40, + /* 0xCBF0 [?] [4028]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x11,0x15,0x19,0x31,0xD1,0x11,0x10,0x10,0x50,0x23, + 0x00,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xCBF1 [?] [4029]*/ + 0x10,0x10,0x3F,0x48,0x85,0x3F,0x02,0x02,0xFF,0x02,0x04,0x3F,0x08,0x10,0x20,0xC0, + 0x40,0x40,0x7E,0x90,0x08,0xF0,0x10,0x10,0xFE,0x10,0x10,0xF0,0x10,0x00,0x00,0x00, + /* 0xCBF2 [?] [4030]*/ + 0x08,0xFF,0x08,0x01,0x7F,0x00,0x1F,0x10,0xFF,0x10,0x1F,0x04,0x08,0x38,0xCB,0x0C, + 0x20,0xFE,0x20,0x00,0xFC,0x00,0xF0,0x10,0xFE,0x10,0xF0,0x88,0x50,0x20,0x18,0x06, + /* 0xCBF3 [?] [4031]*/ + 0x10,0x10,0x10,0x11,0xFB,0x10,0x30,0x39,0x56,0x50,0x91,0x12,0x10,0x10,0x11,0x16, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xCBF4 [?] [4032]*/ + 0x00,0x00,0x78,0x49,0x4B,0x48,0x48,0x49,0x4A,0x48,0x79,0x4A,0x00,0x00,0x01,0x06, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xCBF5 [?] [4033]*/ + 0x20,0x20,0x27,0x44,0x51,0xF1,0x22,0x26,0x4A,0xF2,0x42,0x02,0x32,0xC2,0x02,0x02, + 0x40,0x20,0xFE,0x02,0x00,0xFE,0x10,0x20,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xCBF6 [?] [4034]*/ + 0x00,0x01,0xFC,0x10,0x10,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1C,0xE0,0x41,0x02, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x88,0x04,0x02, + /* 0xCBF7 [?] [4035]*/ + 0x01,0x01,0x3F,0x01,0x01,0x7F,0x42,0x84,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0x00,0xF8,0x00,0x00,0xFE,0x02,0x24,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xCBF8 [?] [4036]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x14,0x18,0x11,0x02, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x88,0x04,0x02, + /* 0xCBF9 [?] [4037]*/ + 0x02,0x07,0x38,0x20,0x20,0x3E,0x22,0x22,0x22,0x3E,0x20,0x20,0x41,0x41,0x82,0x04, + 0x08,0x1C,0xE0,0x80,0x80,0x80,0xFE,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xCBFA [?] [4038]*/ + 0x20,0x23,0x22,0x23,0x22,0xFB,0x20,0x20,0x27,0x20,0x24,0x3A,0xE4,0x40,0x02,0x01, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0x00,0xBC,0x84,0xA4,0x94,0xA4,0x84,0x94,0x08, + /* 0xCBFB [?] [4039]*/ + 0x08,0x08,0x0A,0x12,0x12,0x32,0x33,0x5E,0x92,0x12,0x12,0x12,0x12,0x12,0x11,0x10, + 0x40,0x40,0x40,0x58,0x68,0xC8,0x48,0x48,0x48,0x48,0x58,0x42,0x02,0x02,0xFE,0x00, + /* 0xCBFC [?] [4040]*/ + 0x02,0x01,0x7F,0x40,0x80,0x08,0x08,0x08,0x09,0x0E,0x08,0x08,0x08,0x08,0x07,0x00, + 0x00,0x00,0xFE,0x02,0x04,0x00,0x08,0x30,0xC0,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xCBFD [?] [4041]*/ + 0x10,0x10,0x10,0x11,0xFD,0x25,0x25,0x27,0x25,0x49,0x29,0x11,0x29,0x45,0x84,0x00, + 0x20,0x20,0x20,0x20,0x2C,0x34,0x64,0xA4,0x24,0x34,0x28,0x22,0x22,0x02,0xFE,0x00, + /* 0xCBFE [?] [4042]*/ + 0x21,0x21,0x27,0x21,0x20,0xF8,0x21,0x22,0x25,0x20,0x20,0x3B,0xE2,0x42,0x03,0x02, + 0x10,0x10,0xFC,0x10,0x40,0xA0,0x10,0x08,0xF6,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCCA1 [?] [4043]*/ + 0x02,0x92,0x5F,0x22,0x62,0xAF,0x2A,0x2A,0x6F,0xA2,0x27,0x2A,0x32,0x22,0xA2,0x42, + 0x10,0x10,0x9C,0x24,0x48,0xBE,0xA2,0xAA,0xAA,0x2A,0x2A,0xAA,0x88,0x14,0x22,0x42, + /* 0xCCA2 [?] [4044]*/ + 0x10,0x12,0x11,0x11,0xFC,0x10,0x13,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x54,0x20, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x28,0x24,0x44,0x42,0x82,0x00,0x80,0x7E,0x00, + /* 0xCCA3 [?] [4045]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x10,0x10,0x13,0x5C,0x52,0x51,0x52,0x5C,0xE1,0x00, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0x00,0xDE,0x42,0x52,0x4A,0x52,0x42,0x4A,0x84, + /* 0xCCA4 [?] [4046]*/ + 0x00,0x78,0x4B,0x48,0x48,0x79,0x12,0x10,0x51,0x5D,0x51,0x51,0x59,0xE1,0x01,0x01, + 0x20,0x22,0xB4,0xA8,0xA8,0x24,0xA2,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xCCA5 [?] [4047]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x25,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xCCA6 [?] [4048]*/ + 0x08,0x08,0xFF,0x08,0x04,0x08,0x10,0x3F,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x00,0x20,0x10,0xF8,0x08,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xCCA7 [?] [4049]*/ + 0x10,0x10,0x10,0x10,0xFD,0x13,0x10,0x14,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCA8 [?] [4050]*/ + 0x02,0x02,0x04,0x08,0x10,0x20,0x7F,0x20,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0x20,0x10,0x08,0xFC,0x04,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xCCA9 [?] [4051]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x09,0x31,0xCB,0x05,0x19,0x61,0x05,0x02, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0x18,0x26,0xC0,0x30,0x08,0x00,0x00, + /* 0xCCAA [?] [4052]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAB,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFF,0x82, + 0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0xC8,0x24,0x02, + /* 0xCCAB [?] [4053]*/ + 0x01,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x02,0x02,0x04,0x04,0x0A,0x11,0x21,0xC0, + 0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xCCAC [?] [4054]*/ + 0x01,0x01,0x7F,0x01,0x02,0x04,0x0A,0x31,0xC0,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0xFC,0x00,0x80,0x40,0x20,0x18,0x06,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xCCAD [?] [4055]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x48,0x08,0x10,0x10,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x88,0x48,0x44,0x02, + /* 0xCCAE [?] [4056]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x17,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x00,0xF8,0x08,0x08,0x48,0x28,0x28,0x08,0xFE,0x08,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xCCAF [?] [4057]*/ + 0x20,0x20,0x27,0x21,0xF1,0x29,0x25,0x25,0x32,0xE2,0x25,0x25,0x29,0x20,0xA0,0x40, + 0x28,0x24,0x40,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x48,0x7E,0x40,0x40, + /* 0xCCB0 [?] [4058]*/ + 0x01,0x02,0x04,0x09,0x30,0xCF,0x00,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0x80,0x40,0x20,0x98,0xE6,0x40,0x80,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xCCB1 [?] [4059]*/ + 0x01,0x00,0x3F,0x20,0x20,0xBE,0x72,0x2A,0x2B,0x64,0xA4,0x2A,0x2A,0x52,0x40,0x80, + 0x00,0x80,0xFE,0x50,0x48,0xFE,0x90,0x90,0xFE,0x90,0x90,0xFE,0x90,0x90,0xFE,0x80, + /* 0xCCB2 [?] [4060]*/ + 0x00,0x40,0x2E,0x22,0x03,0x92,0x4A,0x5A,0x14,0x24,0xEA,0x2A,0x32,0x20,0x20,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xCCB3 [?] [4061]*/ + 0x10,0x10,0x11,0x10,0x10,0xFC,0x13,0x10,0x10,0x10,0x10,0x1C,0xE1,0x43,0x01,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0x88,0x04,0xFE,0x02,0x00, + /* 0xCCB4 [?] [4062]*/ + 0x20,0x2F,0x20,0x27,0xFC,0x25,0x25,0x77,0x68,0xA3,0xA2,0x23,0x22,0x23,0x20,0x2F, + 0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xCCB5 [?] [4063]*/ + 0x00,0x00,0x1F,0x10,0x92,0x52,0x54,0x11,0x32,0x5C,0x92,0x12,0x24,0x21,0x42,0x8C, + 0x80,0x40,0xFE,0x40,0x48,0x50,0xA0,0x10,0x08,0x44,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xCCB6 [?] [4064]*/ + 0x00,0x27,0x10,0x17,0x84,0x47,0x40,0x13,0x12,0x23,0xE2,0x23,0x20,0x27,0x20,0x00, + 0x00,0xFC,0xA0,0xFC,0xA4,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0x40,0x40, + /* 0xCCB7 [?] [4065]*/ + 0x00,0x23,0x10,0x13,0x02,0x03,0xF0,0x11,0x11,0x11,0x11,0x15,0x18,0x13,0x00,0x00, + 0x00,0xFE,0x50,0xFE,0x52,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20, + /* 0xCCB8 [?] [4066]*/ + 0x00,0x22,0x12,0x14,0x00,0x01,0xF6,0x10,0x10,0x12,0x12,0x14,0x18,0x11,0x02,0x0C, + 0x40,0x44,0x44,0x48,0xA0,0x10,0x08,0x44,0x40,0x48,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xCCB9 [?] [4067]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE0,0x40,0x03,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xCCBA [?] [4068]*/ + 0x10,0x3A,0xE2,0x24,0x20,0x39,0xE6,0x20,0x20,0x3A,0xE2,0x24,0x20,0x21,0x22,0x1F, + 0x40,0x44,0x44,0x48,0xA0,0x10,0x08,0x44,0x40,0x48,0x48,0x50,0xA2,0x12,0x0A,0xFE, + /* 0xCCBB [?] [4069]*/ + 0x20,0x10,0x01,0xFD,0x09,0x11,0x11,0x35,0x59,0x95,0x15,0x11,0x10,0x10,0x13,0x10, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xCCBC [?] [4070]*/ + 0x00,0x01,0xF9,0x21,0x21,0x40,0x78,0x4B,0xC8,0x49,0x49,0x4A,0x7A,0x4C,0x08,0x00, + 0x20,0x24,0x24,0x24,0xFC,0x80,0x80,0xFE,0x90,0x10,0x52,0x54,0xA8,0x28,0x44,0x82, + /* 0xCCBD [?] [4071]*/ + 0x20,0x27,0x24,0x24,0xF9,0x22,0x20,0x28,0x37,0xE0,0x20,0x21,0x22,0x2C,0xA0,0x40, + 0x00,0xFC,0x04,0xA4,0x10,0x08,0x40,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xCCBE [?] [4072]*/ + 0x00,0x07,0x7A,0x4A,0x4A,0x49,0x49,0x49,0x48,0x48,0x78,0x48,0x00,0x01,0x02,0x0C, + 0x00,0xF8,0x08,0x08,0x08,0x10,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0x10,0x08,0x06, + /* 0xCCBF [?] [4073]*/ + 0x01,0x21,0x21,0x3F,0x08,0x08,0xFF,0x10,0x10,0x14,0x24,0x29,0x41,0x82,0x0C,0x30, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xFE,0x80,0x88,0x88,0x90,0x40,0x40,0x20,0x18,0x06, + /* 0xCCC0 [?] [4074]*/ + 0x00,0x23,0x10,0x10,0x80,0x41,0x43,0x11,0x11,0x21,0xE2,0x22,0x24,0x28,0x21,0x02, + 0x00,0xF0,0x20,0x40,0x80,0x00,0xFC,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xCCC1 [?] [4075]*/ + 0x20,0x20,0x27,0x24,0x25,0xFC,0x27,0x24,0x25,0x24,0x25,0x3D,0xE5,0x49,0x09,0x11, + 0x40,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCC2 [?] [4076]*/ + 0x20,0x20,0x27,0x24,0xFD,0x24,0x27,0x2C,0x35,0xE4,0x25,0x25,0x25,0x29,0xA9,0x51, + 0x40,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCC3 [?] [4077]*/ + 0x01,0x11,0x09,0x7F,0x40,0x9F,0x10,0x10,0x1F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x10,0x20,0xFE,0x02,0xF4,0x10,0x10,0xF0,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xCCC4 [?] [4078]*/ + 0x01,0x11,0x09,0x7F,0x40,0x9F,0x10,0x10,0x1F,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x10,0x20,0xFE,0x02,0xF4,0x10,0x10,0xF0,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xCCC5 [?] [4079]*/ + 0x00,0x79,0x48,0x4B,0x4A,0x78,0x48,0x48,0x48,0x78,0x48,0x49,0x48,0x48,0x4B,0x98, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xCCC6 [?] [4080]*/ + 0x01,0x00,0x3F,0x20,0x2F,0x20,0x3F,0x20,0x2F,0x20,0x2F,0x28,0x48,0x48,0x8F,0x08, + 0x00,0x80,0xFE,0x80,0xF8,0x88,0xFE,0x88,0xF8,0x80,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xCCC7 [?] [4081]*/ + 0x10,0x10,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x12,0x12,0x14, + 0x20,0x10,0xFE,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xCCC8 [?] [4082]*/ + 0x10,0x12,0x11,0x21,0x20,0x67,0x64,0xA4,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24, + 0x40,0x48,0x48,0x50,0x40,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xCCC9 [?] [4083]*/ + 0x10,0x21,0x7C,0x44,0x7C,0x45,0x7D,0x45,0x45,0xFD,0x0D,0x15,0x25,0x45,0x95,0x09, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0x74,0x54,0x54,0x54,0x74,0x04,0x14,0x08, + /* 0xCCCA [?] [4084]*/ + 0x00,0x22,0x11,0x11,0x80,0x47,0x44,0x14,0x15,0x25,0xE5,0x25,0x25,0x24,0x24,0x04, + 0x40,0x48,0x48,0x50,0x40,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xCCCB [?] [4085]*/ + 0x10,0x11,0x10,0x7C,0x11,0x11,0xFD,0x11,0x11,0x51,0x5D,0x51,0x71,0x50,0x4F,0x80, + 0x20,0x24,0xA4,0xA8,0xFC,0x04,0x04,0x74,0x54,0x54,0x74,0x04,0x0C,0x00,0xFE,0x00, + /* 0xCCCC [?] [4086]*/ + 0x23,0x10,0x80,0x43,0x11,0x21,0xE2,0x24,0x29,0x20,0x01,0x11,0x22,0x04,0x18,0xE0, + 0xF0,0x20,0xC0,0xFC,0x24,0x24,0x44,0x84,0x28,0x10,0x00,0x10,0xA0,0x40,0x30,0x0E, + /* 0xCCCD [?] [4087]*/ + 0x10,0x10,0x10,0x11,0xFE,0x10,0x11,0x14,0x1B,0x30,0xD1,0x11,0x11,0x10,0x50,0x20, + 0x80,0x80,0xFE,0x02,0x82,0xF2,0x42,0x42,0xFA,0x42,0x52,0x52,0xF2,0x02,0x14,0x08, + /* 0xCCCE [?] [4088]*/ + 0x00,0x20,0x17,0x10,0x83,0x40,0x47,0x10,0x11,0x21,0xE2,0x22,0x24,0x28,0x20,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFE,0x90,0x10,0xFE,0x10,0x90,0x50,0x10,0x50,0x20, + /* 0xCCCF [?] [4089]*/ + 0x00,0x4F,0x20,0x24,0x02,0x82,0x41,0x56,0x14,0x24,0xE7,0x24,0x24,0x24,0x27,0x04, + 0x3E,0xC0,0x84,0x44,0x48,0x10,0x00,0x1C,0x04,0x04,0x1C,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCD0 [?] [4090]*/ + 0x10,0x10,0x21,0x23,0x4C,0xF0,0x11,0x26,0x40,0xFB,0x40,0x02,0x1A,0xE4,0x41,0x00, + 0x80,0x80,0xF8,0x08,0x90,0x60,0x98,0x46,0x40,0xFC,0x40,0x48,0x44,0x44,0x40,0x80, + /* 0xCCD1 [?] [4091]*/ + 0x08,0xFF,0x08,0x20,0x3F,0x48,0x9F,0x22,0x02,0xFF,0x02,0x22,0x22,0x3F,0x00,0x00, + 0x20,0xFE,0x20,0x00,0xFC,0x04,0xE4,0x04,0x04,0xFC,0x04,0x24,0x24,0xE4,0x28,0x10, + /* 0xCCD2 [?] [4092]*/ + 0x10,0x10,0x10,0x12,0xFD,0x10,0x30,0x39,0x56,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xCCD3 [?] [4093]*/ + 0x00,0x20,0x14,0x12,0x01,0x00,0xF1,0x12,0x14,0x11,0x11,0x12,0x14,0x28,0x47,0x00, + 0xA0,0xA0,0xA4,0xA8,0xB0,0xA0,0xB0,0xA8,0xA4,0x20,0x24,0x24,0x1C,0x00,0xFE,0x00, + /* 0xCCD4 [?] [4094]*/ + 0x01,0x21,0x11,0x12,0x85,0x41,0x42,0x10,0x17,0x20,0xE2,0x22,0x23,0x20,0x20,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x84,0x84,0xF4,0x84,0xA4,0xA4,0xE4,0x04,0x28,0x10, + /* 0xCCD5 [?] [4095]*/ + 0x01,0x79,0x49,0x52,0x55,0x61,0x52,0x48,0x4F,0x48,0x6A,0x52,0x43,0x40,0x40,0x40, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x84,0x84,0xF4,0x84,0xA4,0xA4,0xE4,0x04,0x28,0x10, + /* 0xCCD6 [?] [4096]*/ + 0x00,0x20,0x10,0x10,0x03,0x00,0xF0,0x10,0x11,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xCCD7 [?] [4097]*/ + 0x01,0x01,0x7F,0x02,0x04,0x0F,0x34,0xC7,0x04,0x07,0x04,0xFF,0x04,0x08,0x1F,0x00, + 0x00,0x00,0xFC,0x80,0x40,0xF0,0x18,0xE6,0x00,0xE0,0x00,0xFE,0x00,0x10,0xF8,0x08, + /* 0xCCD8 [?] [4098]*/ + 0x10,0x10,0x50,0x51,0x7C,0x50,0x93,0x10,0x1C,0xF1,0x50,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0xFC,0x20,0x20,0xFE,0x08,0x08,0xFE,0x08,0x88,0x48,0x08,0x28,0x10, + /* 0xCCD9 [?] [4099]*/ + 0x04,0xFF,0x04,0x00,0x3D,0x24,0x25,0x3C,0x27,0x24,0x3D,0x26,0x24,0x44,0x55,0x8A, + 0x40,0xFE,0x40,0x20,0x24,0xA8,0xFC,0x40,0xFE,0x88,0x24,0xAA,0x70,0xA8,0x24,0x62, + /* 0xCCDA [?] [4100]*/ + 0x02,0x79,0x49,0x4F,0x48,0x7F,0x49,0x4A,0x4D,0x78,0x49,0x49,0x48,0x4B,0x48,0x98, + 0x48,0x48,0x50,0xFC,0x40,0xFE,0x10,0x08,0xF6,0x10,0x10,0xFC,0x04,0xE4,0x14,0x08, + /* 0xCCDB [?] [4101]*/ + 0x00,0x00,0x1F,0x11,0x91,0x53,0x56,0x19,0x30,0x53,0x9C,0x10,0x20,0x23,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xF8,0x10,0x20,0xC0,0x30,0x0E,0xC0,0x20,0x00,0xC0,0x20, + /* 0xCCDC [?] [4102]*/ + 0x11,0x09,0x09,0x7F,0x02,0xFF,0x09,0x3F,0xC0,0x1F,0x00,0x1F,0x00,0x1F,0x10,0x1F, + 0x10,0x10,0x20,0xFC,0x00,0xFE,0x20,0xF8,0x06,0xF0,0x00,0xF0,0x00,0xF0,0x10,0xF0, + /* 0xCCDD [?] [4103]*/ + 0x11,0x10,0x10,0x11,0xFC,0x10,0x31,0x39,0x55,0x51,0x90,0x10,0x11,0x12,0x14,0x10, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xCCDE [?] [4104]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x10,0x3F,0x4A,0x92,0x24,0x48,0x12,0x21, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0xA4,0xA4,0xA4,0x84,0x84,0x94,0x08, + /* 0xCCDF [?] [4105]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x10,0x10,0x5C,0x50,0x51,0x52,0x5C,0xE1,0x00,0x00, + 0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x40,0xFE,0x2A,0x4A,0x92,0x22,0x4A,0x84, + /* 0xCCE0 [?] [4106]*/ + 0x21,0x20,0x38,0x23,0x40,0x78,0xA3,0x22,0xFA,0x23,0x20,0x20,0x29,0x32,0x24,0x00, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xCCE1 [?] [4107]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x18,0x33,0xD0,0x11,0x11,0x11,0x52,0x24, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x20,0x20,0x3C,0x20,0xA0,0x7E, + /* 0xCCE2 [?] [4108]*/ + 0x00,0x3E,0x22,0x3E,0x22,0x3E,0x00,0xFF,0x08,0x08,0x2F,0x28,0x28,0x58,0x4F,0x80, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x28,0x44,0x82,0x00,0xFE,0x00, + /* 0xCCE3 [?] [4109]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7C,0x13,0x12,0x5C,0x51,0x51,0x51,0x5D,0xE1,0x00,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCCE4 [?] [4110]*/ + 0x00,0x00,0x79,0x48,0x48,0x48,0x4B,0x4A,0x4C,0x49,0x49,0x79,0x49,0x01,0x00,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCCE5 [?] [4111]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x50,0x91,0x11,0x12,0x15,0x18,0x10,0x10,0x10, + 0x40,0x40,0x40,0x40,0xFC,0x40,0xE0,0xE0,0x50,0x50,0x48,0xF4,0x42,0x40,0x40,0x40, + /* 0xCCE6 [?] [4112]*/ + 0x08,0x08,0x7E,0x08,0xFE,0x14,0x22,0x41,0x9F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFC,0x20,0xFE,0x50,0x88,0x06,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xCCE7 [?] [4113]*/ + 0x00,0x07,0xF0,0x97,0x94,0x9B,0x92,0x93,0x92,0x93,0xF0,0x97,0x02,0x02,0x05,0x08, + 0x40,0xFC,0x40,0xFE,0x02,0xFC,0x48,0xF8,0x48,0xF8,0x00,0xFC,0x44,0x78,0x40,0xFE, + /* 0xCCE8 [?] [4114]*/ + 0x10,0x11,0x11,0x11,0x19,0x55,0x50,0x50,0x91,0x12,0x14,0x10,0x11,0x12,0x10,0x11, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0x80,0xFE,0x4A,0x4A,0x92,0x22,0x42,0x94,0x08, + /* 0xCCE9 [?] [4115]*/ + 0x02,0x21,0x11,0x17,0x80,0x40,0x47,0x14,0x14,0x27,0xE0,0x21,0x22,0x24,0x28,0x00, + 0x10,0x10,0x20,0xF8,0x48,0x48,0xF8,0x40,0x40,0xFC,0xC4,0x44,0x54,0x48,0x40,0x40, + /* 0xCCEA [?] [4116]*/ + 0x42,0x22,0x24,0xFF,0x09,0x09,0xFF,0x88,0x88,0xFF,0x18,0x28,0x4A,0x89,0x08,0x08, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0xA4,0xA4,0xA4,0x84,0x04,0x14,0x08, + /* 0xCCEB [?] [4117]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x24,0x24,0x24,0x3F,0x24,0x24,0x44,0x44,0x84,0x07, + 0x00,0xF8,0x08,0x08,0xF8,0x90,0x90,0x90,0x90,0xFC,0x90,0x90,0xF0,0x00,0x00,0xFE, + /* 0xCCEC [?] [4118]*/ + 0x00,0x3F,0x01,0x01,0x01,0x01,0xFF,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xCCED [?] [4119]*/ + 0x00,0x23,0x10,0x10,0x87,0x40,0x41,0x12,0x14,0x20,0xE0,0x22,0x22,0x24,0x21,0x00, + 0x00,0xFC,0x40,0x40,0xFE,0xA0,0x10,0x08,0x46,0x40,0x48,0x64,0x52,0x52,0x40,0x80, + /* 0xCCEE [?] [4120]*/ + 0x20,0x20,0x27,0x20,0x23,0xFA,0x23,0x22,0x23,0x22,0x23,0x3A,0xEF,0x41,0x02,0x04, + 0x40,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFE,0x10,0x08,0x04, + /* 0xCCEF [?] [4121]*/ + 0x00,0x3F,0x21,0x21,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x21,0x21,0x3F,0x20,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00, + /* 0xCCF0 [?] [4122]*/ + 0x08,0x1C,0x70,0x10,0x11,0xFC,0x10,0x10,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x00, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xCCF1 [?] [4123]*/ + 0x10,0x10,0x11,0x10,0x18,0x55,0x50,0x50,0x90,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCF2 [?] [4124]*/ + 0x08,0x1D,0x70,0x10,0x11,0xFC,0x10,0x10,0x7D,0x46,0x44,0x44,0x44,0x7D,0x44,0x00, + 0x00,0xFC,0x20,0x20,0xFE,0x50,0x50,0x88,0x24,0x22,0x24,0xB2,0xAA,0x2A,0xA0,0x40, + /* 0xCCF3 [?] [4125]*/ + 0x00,0x78,0x48,0x49,0x49,0x79,0x49,0x49,0x49,0x79,0x49,0x4B,0x48,0x48,0x49,0x9A, + 0x50,0x50,0x50,0xFC,0x54,0x54,0x54,0xFC,0x54,0x54,0x54,0xFE,0x00,0x88,0x04,0x02, + /* 0xCCF4 [?] [4126]*/ + 0x10,0x10,0x10,0x12,0xFD,0x10,0x10,0x15,0x1A,0x34,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xCCF5 [?] [4127]*/ + 0x04,0x04,0x0F,0x18,0x64,0x03,0x1D,0xE1,0x01,0x7F,0x01,0x09,0x11,0x21,0x45,0x02, + 0x00,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E,0x00,0xFC,0x00,0x20,0x10,0x08,0x04,0x00, + /* 0xCCF6 [?] [4128]*/ + 0x00,0x23,0x10,0x10,0x00,0x01,0xF2,0x11,0x11,0x11,0x11,0x11,0x10,0x28,0x47,0x00, + 0x00,0xFC,0x84,0x84,0x84,0x14,0x08,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0xFE,0x00, + /* 0xCCF7 [?] [4129]*/ + 0x00,0x00,0x78,0x4A,0x49,0x78,0x48,0x49,0x7A,0x4C,0x48,0x48,0x79,0x49,0x02,0x04, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xCCF8 [?] [4130]*/ + 0x00,0x7C,0x44,0x45,0x44,0x7C,0x10,0x10,0x10,0x5D,0x50,0x50,0x50,0x5C,0xE1,0x02, + 0x50,0x50,0x50,0x52,0xD4,0x58,0x50,0x58,0xD4,0x52,0x50,0x50,0x92,0x92,0x12,0x0E, + /* 0xCCF9 [?] [4131]*/ + 0x00,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x11,0x29,0x25,0x45,0x81, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCFA [?] [4132]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x12,0x10,0xFD,0x10,0x10,0x10,0x14,0x18,0x11,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xCCFB [?] [4133]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x55,0x55,0x55,0x5D,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCCFC [?] [4134]*/ + 0x00,0x3F,0x20,0x20,0x20,0x2F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x41,0x80, + 0x00,0xFE,0x00,0x00,0x00,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xCCFD [?] [4135]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x02,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xCCFE [?] [4136]*/ + 0x10,0x11,0x10,0x10,0x54,0x58,0x50,0x93,0x10,0x11,0x10,0x28,0x24,0x44,0x43,0x80, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xCDA1 [?] [4137]*/ + 0x00,0x20,0x13,0x10,0x80,0x40,0x48,0x08,0x10,0x10,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xCDA2 [?] [4138]*/ + 0x00,0x00,0xF9,0x08,0x10,0x10,0x21,0x78,0x08,0x08,0x48,0x33,0x10,0x2C,0x43,0x80, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00,0x00,0xFE,0x00, + /* 0xCDA3 [?] [4139]*/ + 0x10,0x10,0x17,0x20,0x23,0x62,0x63,0xA0,0x2F,0x28,0x23,0x20,0x20,0x20,0x21,0x20, + 0x80,0x40,0xFC,0x00,0xF8,0x08,0xF8,0x00,0xFE,0x02,0xF8,0x40,0x40,0x40,0x40,0x80, + /* 0xCDA4 [?] [4140]*/ + 0x02,0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x9F,0x01,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0x00,0x00,0x00,0x00, + /* 0xCDA5 [?] [4141]*/ + 0x01,0x00,0x3F,0x20,0x2E,0x22,0x24,0x24,0x2E,0x22,0x22,0x2A,0x44,0x46,0x89,0x10, + 0x00,0x80,0xFE,0x00,0x0E,0xF0,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0x00,0xFE,0x00, + /* 0xCDA6 [?] [4142]*/ + 0x20,0x20,0x27,0x21,0xF9,0x22,0x22,0x2F,0x31,0xE5,0x25,0x22,0x22,0x25,0xA8,0x50, + 0x00,0x0C,0x70,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,0xFE,0x00, + /* 0xCDA7 [?] [4143]*/ + 0x10,0x20,0x7B,0x48,0x68,0x59,0x49,0xFB,0x48,0x4A,0x6A,0x59,0x49,0x4A,0x4C,0x98, + 0x00,0x06,0xB8,0x88,0x88,0x08,0x3E,0x88,0x88,0x88,0x88,0x3E,0x00,0x80,0x7E,0x00, + /* 0xCDA8 [?] [4144]*/ + 0x00,0x47,0x20,0x21,0x00,0x07,0xE4,0x24,0x27,0x24,0x24,0x27,0x24,0x24,0x54,0x8F, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x54,0x08,0xFE, + /* 0xCDA9 [?] [4145]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x32,0x3A,0x56,0x52,0x92,0x12,0x12,0x12,0x12,0x12, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xCDAA [?] [4146]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0xFE,0x82,0x82,0xBA,0x82,0x82,0xBA,0xAA,0xAA,0xAA,0xBA,0x82,0x82,0x8A,0x84, + /* 0xCDAB [?] [4147]*/ + 0x00,0x01,0x78,0x48,0x4B,0x78,0x49,0x49,0x79,0x49,0x49,0x48,0x79,0x48,0x03,0x00, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xCDAC [?] [4148]*/ + 0x00,0x3F,0x20,0x20,0x2F,0x20,0x20,0x27,0x24,0x24,0x24,0x27,0x24,0x20,0x20,0x20, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x14,0x08, + /* 0xCDAD [?] [4149]*/ + 0x20,0x23,0x3A,0x22,0x42,0x7A,0xA2,0x22,0xFA,0x22,0x22,0x22,0x2A,0x32,0x22,0x02, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xCDAE [?] [4150]*/ + 0x00,0x3F,0x21,0x21,0x29,0x25,0x25,0x21,0xFF,0x21,0x21,0x21,0x21,0x41,0x45,0x82, + 0x00,0x04,0x04,0x08,0x10,0x22,0x02,0x04,0xC8,0x10,0x22,0x02,0x04,0x08,0x10,0x60, + /* 0xCDAF [?] [4151]*/ + 0x02,0x01,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x3F,0x01,0xFF, + 0x00,0x00,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x00,0xFE, + /* 0xCDB0 [?] [4152]*/ + 0x20,0x27,0x20,0x21,0xF8,0x27,0x24,0x74,0x6F,0xA4,0xA4,0x27,0x24,0x24,0x24,0x24, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xCDB1 [?] [4153]*/ + 0x20,0x27,0x20,0x21,0xF8,0x27,0x24,0x2C,0x37,0xE4,0x24,0x27,0x24,0x24,0xA4,0x44, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xCDB2 [?] [4154]*/ + 0x10,0x10,0x3F,0x28,0x45,0xBF,0x20,0x2F,0x20,0x27,0x24,0x24,0x27,0x20,0x20,0x20, + 0x40,0x40,0x7E,0x90,0x08,0xF8,0x08,0xE8,0x08,0xC8,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xCDB3 [?] [4155]*/ + 0x10,0x10,0x20,0x23,0x48,0xF8,0x11,0x23,0x40,0xF8,0x40,0x00,0x19,0xE1,0x42,0x04, + 0x40,0x20,0x20,0xFE,0x40,0x88,0x04,0xFE,0x92,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xCDB4 [?] [4156]*/ + 0x00,0x00,0x1F,0x10,0x97,0x51,0x50,0x17,0x34,0x57,0x94,0x17,0x24,0x24,0x44,0x84, + 0x80,0x40,0xFE,0x00,0xF8,0x10,0xA0,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xCDB5 [?] [4157]*/ + 0x08,0x08,0x09,0x12,0x15,0x30,0x33,0x52,0x92,0x13,0x12,0x12,0x13,0x12,0x12,0x12, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xCDB6 [?] [4158]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x12,0x15,0x18,0x30,0xD0,0x10,0x10,0x10,0x50,0x23, + 0x00,0xF8,0x88,0x88,0x88,0x06,0x00,0xFC,0x84,0x84,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xCDB7 [?] [4159]*/ + 0x00,0x00,0x08,0x04,0x24,0x10,0x10,0x00,0xFF,0x01,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFE,0x00,0x40,0x20,0x10,0x08,0x04,0x04, + /* 0xCDB8 [?] [4160]*/ + 0x00,0x23,0x10,0x17,0x01,0x02,0xF4,0x13,0x11,0x11,0x11,0x12,0x14,0x28,0x47,0x00, + 0x38,0xC0,0x40,0xFC,0x50,0x48,0x46,0xF0,0x10,0x3C,0x04,0x14,0x08,0x00,0xFE,0x00, + /* 0xCDB9 [?] [4161]*/ + 0x00,0x0F,0x08,0x08,0x08,0x08,0x08,0x78,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x40, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x3C,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xCDBA [?] [4162]*/ + 0x00,0x1F,0x01,0x01,0x7F,0x05,0x09,0x31,0xC0,0x0F,0x08,0x08,0x08,0x10,0x20,0x40, + 0x70,0x80,0x00,0x00,0xFC,0x40,0x20,0x18,0x06,0xC0,0x40,0x40,0x44,0x44,0x3C,0x00, + /* 0xCDBB [?] [4163]*/ + 0x02,0x01,0x7F,0x40,0x88,0x11,0x21,0x01,0x01,0x7F,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x48,0x20,0x00,0xFC,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xCDBC [?] [4164]*/ + 0x00,0x7F,0x42,0x42,0x47,0x4C,0x52,0x41,0x46,0x78,0x43,0x40,0x46,0x41,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x44,0x84,0x04,0xC4,0x3C,0x04,0x84,0x04,0x84,0xFC,0x04, + /* 0xCDBD [?] [4165]*/ + 0x08,0x08,0x11,0x20,0x48,0x08,0x13,0x30,0x50,0x91,0x11,0x11,0x12,0x12,0x14,0x18, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xCDBE [?] [4166]*/ + 0x00,0x20,0x11,0x12,0x05,0x00,0xF0,0x17,0x10,0x12,0x12,0x14,0x11,0x28,0x47,0x00, + 0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x48,0x44,0x44,0x40,0x80,0xFE,0x00, + /* 0xCDBF [?] [4167]*/ + 0x00,0x20,0x10,0x11,0x82,0x45,0x40,0x10,0x17,0x20,0xE2,0x22,0x24,0x28,0x21,0x00, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xCDC0 [?] [4168]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x20,0x27,0x20,0x3F,0x20,0x23,0x26,0x5B,0x42,0x83,0x02, + 0x00,0xFC,0x04,0xFC,0x80,0x88,0xF0,0xA0,0xFE,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xCDC1 [?] [4169]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xCDC2 [?] [4170]*/ + 0x00,0x00,0x78,0x48,0x48,0x48,0x4F,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x0F,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xCDC3 [?] [4171]*/ + 0x08,0x08,0x0F,0x10,0x20,0x7F,0xA1,0x21,0x21,0x3F,0x22,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0x08,0xF8,0x88,0xA0,0x90,0x92,0x82,0x7E, + /* 0xCDC4 [?] [4172]*/ + 0x00,0x24,0x14,0x14,0x87,0x40,0x4F,0x10,0x10,0x27,0xE4,0x24,0x24,0x24,0x24,0x04, + 0x40,0x44,0x44,0x44,0xFC,0x00,0xFE,0x40,0x80,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0x0C, + /* 0xCDC5 [?] [4173]*/ + 0x00,0x7F,0x40,0x40,0x40,0x5F,0x40,0x41,0x42,0x44,0x48,0x50,0x42,0x41,0x7F,0x40, + 0x00,0xFC,0x04,0x84,0x84,0xF4,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0xFC,0x04, + /* 0xCDC6 [?] [4174]*/ + 0x10,0x10,0x10,0x11,0xFD,0x13,0x15,0x11,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xCDC7 [?] [4175]*/ + 0x0C,0x71,0x10,0xFE,0x11,0x39,0x55,0x93,0x01,0x39,0x29,0x29,0x2A,0x4C,0x49,0x82, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xCDC8 [?] [4176]*/ + 0x00,0x7A,0x49,0x49,0x48,0x78,0x4F,0x49,0x49,0x79,0x49,0x49,0x49,0x49,0x4A,0x9C, + 0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x50,0x4A,0x44,0x54,0x62,0x42,0x80,0x7E, + /* 0xCDC9 [?] [4177]*/ + 0x11,0x10,0x10,0x7C,0x55,0x55,0x55,0x55,0x7D,0x50,0x10,0x14,0x1C,0xE5,0x42,0x04, + 0x04,0x84,0x88,0x10,0xFC,0x04,0x04,0x04,0xFC,0x50,0x50,0x90,0x92,0x12,0x0E,0x00, + /* 0xCDCA [?] [4178]*/ + 0x20,0x12,0x01,0xF9,0x08,0x10,0x17,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x12,0x14, + 0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x50,0x4A,0x44,0x54,0x62,0x42,0x80,0x7E, + /* 0xCDCB [?] [4179]*/ + 0x03,0x22,0x12,0x13,0x02,0x02,0xF3,0x12,0x12,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x28,0x10,0x88,0x04,0x04,0x00,0xFE,0x00, + /* 0xCDCC [?] [4180]*/ + 0x00,0x3F,0x01,0x01,0xFF,0x02,0x04,0x08,0x30,0xDF,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0xF6,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xCDCD [?] [4181]*/ + 0x01,0x01,0x01,0xFF,0x01,0x21,0x21,0x21,0x21,0x3F,0x01,0x01,0x01,0x01,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x00,0x08,0x08,0x08,0x08,0xF8,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xCDCE [?] [4182]*/ + 0x7E,0x42,0x7E,0x54,0x7E,0x54,0x7E,0x94,0x62,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10, + 0x78,0x48,0x48,0x86,0x78,0x48,0x30,0xCE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x30, + /* 0xCDCF [?] [4183]*/ + 0x10,0x10,0x10,0x11,0xFE,0x11,0x11,0x15,0x1B,0x31,0xD1,0x11,0x11,0x11,0x50,0x20, + 0x80,0x80,0xFE,0x00,0x20,0x20,0x2C,0x74,0xA4,0x24,0x34,0x28,0x22,0x02,0xFE,0x00, + /* 0xCDD0 [?] [4184]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x14,0x1B,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x08,0x3C,0xC0,0x40,0x40,0x40,0x40,0x7E,0xC0,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xCDD1 [?] [4185]*/ + 0x01,0x78,0x48,0x48,0x49,0x79,0x49,0x49,0x49,0x78,0x48,0x48,0x48,0x49,0x4A,0x9C, + 0x04,0x84,0x88,0x10,0xFC,0x04,0x04,0x04,0xFC,0x50,0x50,0x90,0x92,0x12,0x0E,0x00, + /* 0xCDD2 [?] [4186]*/ + 0x10,0x20,0x7C,0x44,0x54,0x45,0x54,0x48,0x40,0x7E,0x02,0x02,0xFA,0x02,0x14,0x08, + 0x20,0x10,0x10,0xFE,0x82,0x04,0x40,0x48,0x50,0x60,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xCDD3 [?] [4187]*/ + 0x00,0x7C,0x44,0x49,0x49,0x52,0x49,0x49,0x45,0x45,0x45,0x69,0x51,0x41,0x40,0x40, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x08,0x10,0x20,0xC0,0x04,0x04,0x04,0xFC,0x00, + /* 0xCDD4 [?] [4188]*/ + 0x00,0x7C,0x04,0x24,0x24,0x25,0x24,0x3E,0x02,0x02,0x1A,0xE2,0x42,0x02,0x15,0x0A, + 0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xCDD5 [?] [4189]*/ + 0x00,0xF8,0x08,0x49,0x49,0x4A,0x48,0x7C,0x04,0x04,0x1C,0xE4,0x44,0x04,0x28,0x10, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xCDD6 [?] [4190]*/ + 0x20,0x27,0x24,0x25,0xFD,0x26,0x25,0x74,0x6C,0xA4,0xA6,0x25,0x24,0x24,0x24,0x24, + 0x10,0x90,0x90,0x7E,0x20,0x20,0x7C,0xA4,0xA4,0xBC,0xA4,0x3C,0x24,0x24,0x24,0x2C, + /* 0xCDD7 [?] [4191]*/ + 0x00,0x7F,0x02,0x21,0x11,0x10,0x02,0x02,0xFF,0x04,0x08,0x1E,0x01,0x06,0x18,0x60, + 0xFC,0x00,0x08,0x08,0x10,0x20,0x00,0x00,0xFE,0x20,0x20,0x40,0x80,0x60,0x18,0x04, + /* 0xCDD8 [?] [4192]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x10,0x14,0x19,0x32,0xD4,0x10,0x10,0x10,0x50,0x20, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xCDD9 [?] [4193]*/ + 0x00,0x00,0xF3,0x90,0x90,0x97,0x92,0x92,0x97,0x92,0xF2,0x97,0x00,0x00,0x07,0x00, + 0x10,0x78,0xC0,0x40,0x40,0xFC,0x48,0x48,0xFE,0x48,0x48,0xFC,0x40,0x40,0xFC,0x00, + /* 0xCDDA [?] [4194]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x12,0x14,0x18,0x30,0xD0,0x10,0x11,0x11,0x50,0x20, + 0x40,0x20,0xFE,0x02,0x88,0x04,0x02,0xF8,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xCDDB [?] [4195]*/ + 0x00,0x00,0x79,0x48,0x48,0x48,0x4B,0x48,0x48,0x48,0x79,0x48,0x00,0x00,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xCDDC [?] [4196]*/ + 0x10,0x10,0x11,0x7C,0x54,0x54,0x57,0x54,0x7C,0x50,0x11,0x14,0x1C,0xE4,0x43,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xCDDD [?] [4197]*/ + 0x00,0x20,0x13,0x10,0x80,0x40,0x47,0x10,0x10,0x20,0xE3,0x20,0x20,0x20,0x27,0x00, + 0x40,0x40,0xF8,0x40,0x40,0x40,0xFC,0x00,0x40,0x40,0xF8,0x40,0x40,0x40,0xFC,0x00, + /* 0xCDDE [?] [4198]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x27,0x24,0x24,0x48,0x29,0x10,0x28,0x44,0x83,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xCDDF [?] [4199]*/ + 0x00,0xFF,0x04,0x04,0x04,0x07,0x08,0x0A,0x09,0x09,0x08,0x10,0x13,0x1C,0x10,0x00, + 0x00,0xFE,0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xCDE0 [?] [4200]*/ + 0x20,0x10,0x00,0xFD,0x08,0x10,0x10,0x35,0x58,0x94,0x14,0x11,0x11,0x12,0x10,0x10, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xCDE1 [?] [4201]*/ + 0x00,0x7F,0x01,0x03,0x05,0x19,0x61,0x00,0x7F,0x01,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x60,0x18,0x04,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xCDE2 [?] [4202]*/ + 0x10,0x10,0x10,0x10,0x3E,0x22,0x42,0x42,0xA4,0x14,0x08,0x08,0x10,0x20,0x40,0x80, + 0x40,0x40,0x40,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xCDE3 [?] [4203]*/ + 0x00,0xFC,0x03,0x02,0x7D,0x49,0x49,0x4A,0x7A,0x03,0x8C,0x48,0x51,0x19,0xE2,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xCDE4 [?] [4204]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x44,0x00,0x3F,0x00,0x3F,0x20,0x3F,0x00,0x00,0x00, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x50,0x20, + /* 0xCDE5 [?] [4205]*/ + 0x01,0x20,0x1F,0x11,0x85,0x49,0x40,0x17,0x10,0x27,0xE4,0x27,0x20,0x20,0x20,0x00, + 0x00,0x80,0xFC,0x20,0x28,0x24,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xCDE6 [?] [4206]*/ + 0x00,0x00,0xFD,0x10,0x10,0x10,0x13,0x7C,0x10,0x10,0x10,0x10,0x1D,0xE1,0x42,0x04, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x90,0x90,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xCDE7 [?] [4207]*/ + 0x00,0x7C,0x00,0x00,0x00,0xFE,0x28,0x28,0x28,0x28,0x28,0x2A,0x4C,0x48,0x80,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xCDE8 [?] [4208]*/ + 0x02,0x02,0x02,0x02,0x7F,0x02,0x12,0x0A,0x04,0x04,0x0A,0x09,0x11,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xCDE9 [?] [4209]*/ + 0x10,0x10,0x13,0x16,0x5C,0x51,0x50,0x90,0x13,0x10,0x10,0x28,0x25,0x41,0x42,0x84, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xCDEA [?] [4210]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x00,0x00,0x7F,0x04,0x04,0x04,0x08,0x08,0x10,0x60, + 0x00,0x00,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x40,0x40,0x40,0x44,0x44,0x44,0x3C, + /* 0xCDEB [?] [4211]*/ + 0x00,0x00,0xFB,0x22,0x25,0x41,0x79,0x4A,0xCA,0x4B,0x4C,0x48,0x79,0x49,0x02,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xCDEC [?] [4212]*/ + 0x10,0x10,0x11,0x12,0xFC,0x13,0x12,0x16,0x1A,0x33,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x44,0x44,0x44,0xFC,0xA0,0xA0,0x22,0x22,0x1E,0x00, + /* 0xCDED [?] [4213]*/ + 0x00,0x00,0x79,0x4A,0x4C,0x4B,0x4A,0x7A,0x4A,0x4B,0x48,0x48,0x79,0x49,0x02,0x04, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x44,0x44,0x44,0xFC,0xA0,0xA0,0x22,0x22,0x1E,0x00, + /* 0xCDEE [?] [4214]*/ + 0x10,0x10,0x23,0x7A,0x4C,0x49,0x48,0x48,0x7B,0x48,0x48,0x48,0x49,0x79,0x4A,0x04, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xCDEF [?] [4215]*/ + 0x10,0x10,0x13,0x12,0x1D,0x55,0x51,0x52,0x92,0x13,0x14,0x10,0x11,0x11,0x12,0x14, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xCDF0 [?] [4216]*/ + 0x02,0x01,0x7F,0x40,0x90,0x1E,0x12,0x22,0x22,0x52,0x8C,0x04,0x08,0x10,0x20,0x40, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x88,0x88,0x88,0xA8,0x90,0x82,0x82,0x82,0x7E,0x00, + /* 0xCDF1 [?] [4217]*/ + 0x20,0x20,0x23,0x22,0xFD,0x49,0x49,0x4A,0x8A,0x4B,0x34,0x10,0x29,0x49,0x82,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xCDF2 [?] [4218]*/ + 0x00,0x00,0xFF,0x04,0x04,0x04,0x07,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0xFE,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xCDF3 [?] [4219]*/ + 0x00,0x78,0x4B,0x4A,0x4D,0x79,0x49,0x4A,0x4A,0x7B,0x4C,0x48,0x49,0x49,0x4A,0x9C, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xCDF4 [?] [4220]*/ + 0x00,0x27,0x10,0x10,0x80,0x40,0x40,0x13,0x10,0x20,0xE0,0x20,0x20,0x20,0x2F,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xCDF5 [?] [4221]*/ + 0x00,0x7F,0x01,0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xCDF6 [?] [4222]*/ + 0x02,0x01,0x01,0x00,0xFF,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x00, + 0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xCDF7 [?] [4223]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x30,0x38,0x55,0x50,0x90,0x10,0x10,0x10,0x17,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xCDF8 [?] [4224]*/ + 0x00,0x7F,0x40,0x40,0x42,0x52,0x4A,0x44,0x44,0x4A,0x4A,0x52,0x61,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x14,0x94,0x54,0x24,0x24,0x54,0x54,0x94,0x04,0x04,0x14,0x08, + /* 0xCDF9 [?] [4225]*/ + 0x08,0x08,0x10,0x27,0x48,0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x80,0x40,0x00,0xFC,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xCDFA [?] [4226]*/ + 0x00,0x07,0x78,0x48,0x48,0x48,0x78,0x4B,0x48,0x48,0x48,0x78,0x48,0x00,0x0F,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xCDFB [?] [4227]*/ + 0x10,0x08,0xFF,0x20,0x20,0x26,0x38,0x20,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x94,0x08,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE, + /* 0xCDFC [?] [4228]*/ + 0x02,0x01,0xFF,0x10,0x10,0x10,0x10,0x1F,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xCDFD [?] [4229]*/ + 0x02,0x01,0xFF,0x10,0x10,0x1F,0x02,0x02,0xFF,0x04,0x08,0x1E,0x01,0x06,0x18,0x60, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0xFE,0x20,0x20,0x40,0x80,0x60,0x18,0x04, + /* 0xCDFE [?] [4230]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x3F,0x22,0x22,0x3F,0x24,0x28,0x25,0x42,0x45,0x98, + 0x28,0x24,0x20,0xFE,0x20,0x20,0xE4,0x24,0x24,0xA8,0xA8,0x90,0x12,0x2A,0x46,0x82, + /* 0xCEA1 [?] [4231]*/ + 0x01,0x41,0x7F,0x00,0x7C,0x11,0xFF,0x39,0x55,0x93,0xFC,0x24,0x68,0x10,0x29,0xC6, + 0x00,0x04,0xFC,0x20,0x40,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x5A,0x5E,0x90,0x12,0x0E, + /* 0xCEA2 [?] [4232]*/ + 0x11,0x15,0x25,0x45,0x97,0x10,0x20,0x6F,0xA0,0x27,0x24,0x24,0x24,0x24,0x28,0x30, + 0x08,0x48,0x48,0x50,0xDE,0x24,0x14,0xD4,0x14,0x94,0x94,0xA8,0xC8,0x94,0x14,0x22, + /* 0xCEA3 [?] [4233]*/ + 0x04,0x04,0x0F,0x10,0x20,0x5F,0x10,0x13,0x12,0x12,0x12,0x12,0x22,0x22,0x41,0x80, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x00,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xCEA4 [?] [4234]*/ + 0x01,0x01,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0x7F,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0xFC,0x04,0x04,0x04,0x28,0x10,0x00, + /* 0xCEA5 [?] [4235]*/ + 0x00,0x40,0x2F,0x20,0x00,0x07,0xE0,0x20,0x2F,0x20,0x20,0x20,0x20,0x50,0x8F,0x00, + 0x80,0x80,0xFC,0x80,0x80,0xF8,0x80,0x80,0xFC,0x84,0x84,0x94,0x88,0x80,0xFE,0x00, + /* 0xCEA6 [?] [4236]*/ + 0x10,0x10,0x10,0x11,0xFE,0x11,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x12,0x12,0x14, + 0x40,0x40,0xFC,0x04,0x08,0xFE,0x00,0x7C,0x44,0x44,0x54,0x48,0x42,0x42,0x3E,0x00, + /* 0xCEA7 [?] [4237]*/ + 0x00,0x7F,0x41,0x41,0x5F,0x41,0x4F,0x41,0x5F,0x41,0x41,0x41,0x41,0x41,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0xE4,0x04,0xF4,0x14,0x14,0x54,0x24,0x04,0xFC,0x04, + /* 0xCEA8 [?] [4238]*/ + 0x00,0x00,0x78,0x49,0x49,0x4B,0x4D,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xCEA9 [?] [4239]*/ + 0x10,0x10,0x10,0x11,0x19,0x57,0x55,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xCEAA [?] [4240]*/ + 0x01,0x21,0x11,0x11,0x01,0x7F,0x02,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x08,0x50,0x20, + /* 0xCEAB [?] [4241]*/ + 0x04,0x84,0x44,0x08,0x8B,0x5E,0x44,0x04,0x28,0x5E,0xC8,0x40,0x46,0x58,0x40,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xCEAC [?] [4242]*/ + 0x10,0x10,0x20,0x25,0x45,0xFB,0x15,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xCEAD [?] [4243]*/ + 0x08,0x08,0xFF,0x09,0x01,0x7F,0x01,0x01,0x1F,0x01,0x01,0x7F,0x01,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0x00,0xF0,0x00,0x00,0xFC,0x04,0x04,0x14,0x08, + /* 0xCEAE [?] [4244]*/ + 0x08,0xFF,0x08,0x00,0x1F,0x01,0x7F,0x05,0x19,0xE1,0x04,0x7F,0x08,0x1C,0x03,0x7C, + 0x20,0xFE,0x20,0x70,0x80,0x00,0xFC,0x40,0x30,0x0E,0x00,0xFC,0x20,0x40,0x80,0x78, + /* 0xCEAF [?] [4245]*/ + 0x00,0x1F,0x01,0x01,0xFF,0x05,0x09,0x31,0xC2,0x02,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x70,0x80,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xCEB0 [?] [4246]*/ + 0x08,0x08,0x08,0x17,0x10,0x30,0x33,0x50,0x90,0x17,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x40,0x40,0xFE,0x42,0x42,0x4A,0x44,0x40,0x40, + /* 0xCEB1 [?] [4247]*/ + 0x08,0x0A,0x09,0x11,0x10,0x37,0x30,0x50,0x90,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x40,0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x84,0xA4,0x94,0x14,0x04,0x04,0x28,0x10, + /* 0xCEB2 [?] [4248]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x21,0x21,0x2F,0x21,0x21,0x5F,0x41,0x80, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0xF8,0x02,0x02,0xFE, + /* 0xCEB3 [?] [4249]*/ + 0x10,0x10,0x20,0x25,0x44,0xF8,0x10,0x20,0x40,0xFD,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xCEB4 [?] [4250]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x03,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xCEB5 [?] [4251]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x21,0x3F,0x20,0x2E,0x20,0x3F,0x44,0x55,0xA4,0x0C, + 0x20,0x20,0xFE,0x20,0x00,0x08,0x08,0x08,0xFE,0x08,0x48,0x28,0x28,0x08,0xA8,0x10, + /* 0xCEB6 [?] [4252]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x4F,0x48,0x49,0x79,0x4A,0x04,0x08,0x00,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40, + /* 0xCEB7 [?] [4253]*/ + 0x00,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x00,0xFF,0x11,0x10,0x10,0x14,0x18,0x10, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0xFE,0x10,0xA0,0x40,0x30,0x0E,0x00, + /* 0xCEB8 [?] [4254]*/ + 0x00,0x3F,0x21,0x3F,0x21,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xCEB9 [?] [4255]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x4A,0x4A,0x4B,0x48,0x4F,0x7A,0x4A,0x02,0x02,0x03,0x02, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x00,0xFE,0x40,0x44,0x28,0x90,0x08,0x06, + /* 0xCEBA [?] [4256]*/ + 0x0C,0x70,0x11,0xFF,0x39,0x55,0x93,0x01,0x11,0xFC,0x24,0x44,0x28,0x11,0x29,0xC6, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x40,0x68,0xB2,0xBE,0x20,0x22,0x1E, + /* 0xCEBB [?] [4257]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x52,0x92,0x11,0x11,0x11,0x11,0x10,0x1F,0x10, + 0x80,0x40,0x40,0x00,0xFC,0x00,0x08,0x08,0x08,0x10,0x10,0x10,0x20,0x20,0xFE,0x00, + /* 0xCEBC [?] [4258]*/ + 0x00,0x27,0x14,0x17,0x84,0x47,0x40,0x13,0x12,0x23,0xE2,0x23,0x22,0x22,0x22,0x02, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xCEBD [?] [4259]*/ + 0x00,0x47,0x24,0x27,0x04,0x07,0xE0,0x23,0x22,0x23,0x22,0x23,0x2A,0x32,0x22,0x02, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xCEBE [?] [4260]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x2F,0x20,0x20,0x3F,0x22,0x2A,0x4A,0x52,0x8A,0x04, + 0x04,0x84,0x84,0x84,0xBE,0x04,0x84,0x24,0x14,0xD4,0x04,0x84,0x44,0x44,0x14,0x08, + /* 0xCEBF [?] [4261]*/ + 0x3F,0x21,0x3F,0x20,0x2F,0x20,0x5F,0x44,0x95,0x2C,0x01,0x08,0x48,0x48,0x87,0x00, + 0x08,0x08,0x7E,0x08,0x48,0x28,0xA8,0x08,0x28,0x90,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCEC0 [?] [4262]*/ + 0x00,0x7F,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0xFF,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xCEC1 [?] [4263]*/ + 0x01,0x00,0x3F,0x20,0x27,0xA4,0x67,0x24,0x27,0x60,0xAF,0x29,0x29,0x49,0x7F,0x80, + 0x00,0x80,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x24,0x24,0x24,0xFE,0x00, + /* 0xCEC2 [?] [4264]*/ + 0x00,0x23,0x12,0x12,0x83,0x42,0x42,0x13,0x10,0x27,0xE4,0x24,0x24,0x24,0x2F,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xFE,0x00, + /* 0xCEC3 [?] [4265]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x01, + 0x40,0x20,0x20,0xFE,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x06, + /* 0xCEC4 [?] [4266]*/ + 0x02,0x01,0x01,0xFF,0x10,0x10,0x08,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xCEC5 [?] [4267]*/ + 0x20,0x17,0x00,0x40,0x5F,0x44,0x47,0x44,0x47,0x44,0x44,0x5F,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x44,0xC4,0x44,0xC4,0x44,0x74,0xC4,0x44,0x44,0x54,0x08, + /* 0xCEC6 [?] [4268]*/ + 0x10,0x10,0x20,0x27,0x49,0xF1,0x11,0x21,0x41,0xF8,0x40,0x00,0x18,0xE1,0x42,0x0C, + 0x80,0x40,0x40,0xFC,0x10,0x10,0x10,0x10,0x10,0xA0,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xCEC7 [?] [4269]*/ + 0x01,0x01,0x79,0x49,0x4A,0x4C,0x48,0x49,0x49,0x4A,0x7C,0x48,0x01,0x02,0x04,0x00, + 0x00,0x00,0x00,0xFC,0xA4,0xA4,0xA4,0x24,0x24,0x44,0x44,0x84,0x04,0x04,0x28,0x10, + /* 0xCEC8 [?] [4270]*/ + 0x08,0x1C,0xF1,0x12,0x11,0xFC,0x10,0x39,0x34,0x54,0x51,0x90,0x10,0x12,0x12,0x14, + 0x40,0xF8,0x08,0x10,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x40,0x24,0xA2,0x8A,0x78, + /* 0xCEC9 [?] [4271]*/ + 0x02,0x01,0x7F,0x08,0x07,0x18,0xE2,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0x00,0xFC,0x20,0xC0,0x30,0x0E,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xCECA [?] [4272]*/ + 0x20,0x17,0x00,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x44,0x47,0x44,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xC4,0x44,0x44,0x44,0x44,0x44,0xC4,0x44,0x04,0x14,0x08, + /* 0xCECB [?] [4273]*/ + 0x00,0x00,0x79,0x4A,0x4C,0x49,0x48,0x48,0x4B,0x48,0x7A,0x49,0x02,0x00,0x01,0x00, + 0x90,0x88,0x04,0x42,0x88,0xFC,0x04,0x00,0xDE,0x42,0x52,0x4A,0x52,0x42,0x4A,0x84, + /* 0xCECC [?] [4274]*/ + 0x04,0x08,0x12,0x24,0xC8,0x1F,0x00,0x00,0x7E,0x22,0x12,0x0A,0x12,0x22,0x4A,0x04, + 0x40,0x20,0x10,0x08,0x26,0xF0,0x10,0x00,0xFC,0x44,0x24,0x14,0x24,0x44,0x94,0x08, + /* 0xCECD [?] [4275]*/ + 0x04,0x08,0x10,0x22,0xC4,0x08,0x1F,0x00,0x00,0x7F,0x08,0x0F,0x09,0x10,0x16,0x18, + 0x40,0x20,0x10,0x08,0x46,0x20,0xF0,0x00,0x00,0xFC,0x00,0xE0,0x20,0xA4,0x24,0x1C, + /* 0xCECE [?] [4276]*/ + 0x24,0x22,0x22,0x20,0xF8,0x2E,0x22,0x2A,0x32,0xE2,0x22,0x22,0x22,0x25,0xA8,0x40, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x48,0x28,0x28,0x08,0x08,0x28,0x10,0x00,0xFE,0x00, + /* 0xCECF [?] [4277]*/ + 0x20,0x21,0x21,0xF9,0xA9,0xA9,0xA8,0xA8,0xFB,0xA2,0x22,0x2A,0x3B,0xEA,0x42,0x02, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xCED0 [?] [4278]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x40,0x10,0x17,0x24,0xE4,0x25,0x26,0x24,0x24,0x04, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x40,0x40,0xFC,0x44,0xA4,0x14,0x14,0x04,0x14,0x08, + /* 0xCED1 [?] [4279]*/ + 0x02,0x01,0x7F,0x48,0x90,0x2F,0x08,0x08,0x0F,0x01,0x3F,0x21,0x22,0x24,0x20,0x20, + 0x00,0x00,0xFE,0x22,0x14,0xE8,0x20,0x20,0xE0,0x00,0xF8,0x08,0x88,0x48,0x08,0x18, + /* 0xCED2 [?] [4280]*/ + 0x04,0x0E,0x78,0x08,0x08,0xFF,0x08,0x08,0x0A,0x0C,0x18,0x68,0x08,0x08,0x2B,0x10, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x40,0x44,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xCED3 [?] [4281]*/ + 0x10,0x10,0x10,0xFE,0x11,0x7C,0x44,0x7C,0x45,0x7C,0x10,0xFE,0x10,0x10,0x10,0x10, + 0x20,0x20,0x50,0x88,0x04,0x12,0x90,0x50,0x10,0x90,0x1E,0xF0,0x10,0x10,0x10,0x10, + /* 0xCED4 [?] [4282]*/ + 0x00,0x7F,0x48,0x48,0x48,0x7F,0x41,0x41,0x41,0x7F,0x48,0x48,0x48,0x7F,0x00,0x00, + 0x20,0xA0,0x20,0x20,0x20,0x30,0x28,0x24,0x22,0x22,0x20,0x20,0x20,0xA0,0x20,0x20, + /* 0xCED5 [?] [4283]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x23,0x2A,0x32,0xE3,0x22,0x22,0x25,0x24,0xA8,0x53, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x40,0x88,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE, + /* 0xCED6 [?] [4284]*/ + 0x00,0x20,0x17,0x10,0x80,0x40,0x40,0x17,0x10,0x20,0xE0,0x21,0x21,0x22,0x24,0x08, + 0x10,0x78,0xC0,0x40,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xCED7 [?] [4285]*/ + 0x00,0x00,0x7F,0x01,0x01,0x11,0x11,0x11,0x29,0x29,0x45,0x85,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x10,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0x00,0xFE,0x00, + /* 0xCED8 [?] [4286]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x78,0x48,0x03,0x00,0x00,0x00, + 0x20,0x40,0xFC,0x04,0x04,0x04,0x14,0x08,0x00,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xCED9 [?] [4287]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x15,0x18,0x10,0x00, + 0x20,0x40,0xFC,0x84,0x84,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xCEDA [?] [4288]*/ + 0x01,0x02,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x00,0x00,0x7F,0x00,0x00,0x00, + 0x00,0x00,0xF0,0x10,0x10,0x10,0x50,0x20,0x00,0xFC,0x04,0x04,0xE4,0x04,0x28,0x10, + /* 0xCEDB [?] [4289]*/ + 0x00,0x23,0x10,0x10,0x80,0x47,0x40,0x10,0x11,0x21,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0xF8,0x00,0x00,0x00,0xFE,0x80,0x80,0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xCEDC [?] [4290]*/ + 0x00,0x47,0x20,0x20,0x02,0x02,0xE2,0x25,0x24,0x28,0x20,0x28,0x30,0x20,0x0F,0x00, + 0x00,0xFC,0x40,0x40,0x48,0x48,0x48,0x54,0xD2,0x62,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xCEDD [?] [4291]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x2F,0x21,0x22,0x27,0x20,0x20,0x2F,0x40,0x40,0xBF, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x00,0x10,0xF8,0x88,0x80,0xFC,0x80,0x80,0xFE, + /* 0xCEDE [?] [4292]*/ + 0x00,0x3F,0x02,0x02,0x02,0x02,0x7F,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x00,0xF0,0x00,0x00,0x00,0x00,0xFC,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x7C,0x00, + /* 0xCEDF [?] [4293]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x02,0x02,0x7F,0x02,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x00,0x00,0xFC,0x80,0x80,0x80,0x84,0x84,0x7C,0x00, + /* 0xCEE0 [?] [4294]*/ + 0x10,0x13,0x10,0x10,0xFD,0x10,0x30,0x3B,0x54,0x50,0x91,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCEE1 [?] [4295]*/ + 0x00,0x7F,0x02,0x02,0x3F,0x04,0x04,0x08,0xFF,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0xFE,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xCEE2 [?] [4296]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x00,0x00,0x3F,0x01,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xCEE3 [?] [4297]*/ + 0x00,0x1F,0x11,0x11,0x11,0x11,0xFF,0x21,0x22,0x22,0x22,0x3F,0x04,0x08,0x10,0x20, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0xA0,0x40, + /* 0xCEE4 [?] [4298]*/ + 0x00,0x00,0x3F,0x00,0x00,0xFF,0x00,0x04,0x04,0x27,0x24,0x24,0x24,0x27,0xF8,0x40, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x40,0x40,0x40,0x40,0x20,0x22,0x12,0x8A,0x06,0x02, + /* 0xCEE5 [?] [4299]*/ + 0x00,0x7F,0x02,0x02,0x02,0x02,0x3F,0x04,0x04,0x04,0x04,0x08,0x08,0x08,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xCEE6 [?] [4300]*/ + 0x10,0x13,0x10,0x10,0xFD,0x10,0x10,0x17,0x18,0x30,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCEE7 [?] [4301]*/ + 0x08,0x08,0x08,0x1F,0x11,0x21,0x41,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xCEE8 [?] [4302]*/ + 0x10,0x3F,0x4A,0x0A,0x7F,0x0A,0x0A,0x7F,0x10,0x10,0x3E,0x42,0x14,0x08,0x30,0xC0, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA0,0xA0,0xFC,0x10,0x10,0xFC,0x10,0x90,0xFE,0x10,0x10, + /* 0xCEE9 [?] [4303]*/ + 0x08,0x0B,0x08,0x10,0x10,0x30,0x33,0x50,0x90,0x10,0x10,0x11,0x11,0x11,0x17,0x10, + 0x00,0xFC,0x40,0x40,0x40,0x40,0xF8,0x88,0x88,0x88,0x88,0x08,0x08,0x08,0xFE,0x00, + /* 0xCEEA [?] [4304]*/ + 0x09,0x09,0x09,0x12,0x15,0x31,0x31,0x51,0x97,0x11,0x12,0x12,0x13,0x10,0x10,0x10, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0x48,0x28,0xFE,0x08,0x48,0x28,0xFC,0x08,0x50,0x20, + /* 0xCEEB [?] [4305]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x10,0x1C,0xE3,0x40,0x00,0x00, + 0x20,0x40,0xFC,0x04,0x04,0x04,0x14,0x08,0x00,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xCEEC [?] [4306]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x43,0x8C, + 0x90,0x88,0x80,0xFE,0x80,0x80,0x84,0x44,0x48,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xCEED [?] [4307]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x04,0x0F,0x14,0x03,0x1C,0xE2,0x0F,0x04,0x18, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xE0,0x40,0x80,0x70,0x0E,0xE0,0x20,0x60, + /* 0xCEEE [?] [4308]*/ + 0x00,0x03,0x78,0x48,0x49,0x48,0x48,0x7B,0x48,0x48,0x49,0x49,0x79,0x49,0x01,0x01, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCEEF [?] [4309]*/ + 0x10,0x10,0x50,0x50,0x7D,0x52,0x90,0x10,0x1C,0xF1,0x52,0x10,0x10,0x10,0x11,0x10, + 0x80,0x80,0x80,0xFC,0x54,0x54,0x54,0x94,0x94,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xCEF0 [?] [4310]*/ + 0x08,0x08,0x08,0x1F,0x12,0x22,0x42,0x84,0x04,0x08,0x10,0x21,0x42,0x04,0x08,0x10, + 0x00,0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x04,0x04,0x04,0x28,0x10, + /* 0xCEF1 [?] [4311]*/ + 0x04,0x04,0x0F,0x18,0x24,0x03,0x0C,0x32,0xC2,0x1F,0x02,0x04,0x04,0x08,0x10,0x20, + 0x00,0x00,0xF0,0x20,0xC0,0x00,0xC0,0x30,0x0E,0xF0,0x10,0x10,0x10,0x10,0xA0,0x40, + /* 0xCEF2 [?] [4312]*/ + 0x10,0x13,0x10,0x10,0x19,0x54,0x50,0x53,0x90,0x10,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xCEF3 [?] [4313]*/ + 0x00,0x43,0x22,0x22,0x03,0x00,0xE0,0x27,0x20,0x20,0x2F,0x20,0x28,0x31,0x22,0x0C, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xCEF4 [?] [4314]*/ + 0x04,0x04,0x3F,0x04,0x04,0xFF,0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x40,0x40,0xF8,0x40,0x40,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xCEF5 [?] [4315]*/ + 0x00,0x7F,0x44,0x44,0x5F,0x51,0x51,0x5F,0x44,0x44,0x7F,0x00,0x24,0x22,0x42,0x80, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x40,0x40,0x42,0x42,0xBE,0x00,0x88,0x44,0x44,0x04, + /* 0xCEF6 [?] [4316]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xCEF7 [?] [4317]*/ + 0x00,0xFF,0x04,0x04,0x04,0x3F,0x24,0x24,0x24,0x24,0x28,0x30,0x20,0x20,0x3F,0x20, + 0x00,0xFE,0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0x38,0x08,0x08,0x08,0xF8,0x08, + /* 0xCEF8 [?] [4318]*/ + 0x00,0x03,0xFC,0x10,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x00,0xFE,0x50,0x50,0xFC,0x54,0x54,0x54,0x54,0x54,0x8C,0x04,0x04,0x04,0xFC,0x04, + /* 0xCEF9 [?] [4319]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3D,0x66,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x03, + 0x40,0x40,0x40,0x7E,0x82,0x82,0x42,0x24,0x14,0x08,0x08,0x10,0x20,0x40,0x80,0x00, + /* 0xCEFA [?] [4320]*/ + 0x02,0x02,0xF2,0x92,0x9F,0x92,0x92,0xF6,0x97,0x9A,0x9A,0x92,0xF2,0x92,0x02,0x02, + 0x00,0x0C,0x70,0x40,0x40,0x40,0x7E,0x48,0x48,0xC8,0x48,0x48,0x48,0x48,0x48,0x88, + /* 0xCEFB [?] [4321]*/ + 0x00,0x07,0xF0,0x93,0x90,0x93,0x92,0x93,0x91,0x9F,0xF0,0x93,0x02,0x02,0x03,0x02, + 0x40,0xFC,0x40,0xF8,0x00,0xF8,0x08,0xF8,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCEFC [?] [4322]*/ + 0x00,0x07,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x4A,0x7A,0x4A,0x04,0x04,0x08,0x03, + 0x00,0xF8,0x08,0x10,0x10,0x20,0x3C,0x04,0x04,0x88,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xCEFD [?] [4323]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFC,0x11,0x12,0x10,0x15,0x1A,0x10,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x80,0xFC,0x54,0x94,0x24,0x44,0x94,0x08, + /* 0xCEFE [?] [4324]*/ + 0x10,0x17,0x50,0x50,0x7C,0x53,0x92,0x12,0x1E,0xF2,0x52,0x13,0x12,0x12,0x13,0x12, + 0x00,0xFE,0x90,0x90,0x90,0xFC,0x94,0x94,0x94,0x94,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xCFA1 [?] [4325]*/ + 0x09,0x1C,0xF0,0x10,0x13,0xFC,0x13,0x38,0x35,0x53,0x55,0x91,0x11,0x11,0x10,0x10, + 0x84,0x68,0x30,0xC8,0x04,0x40,0xFE,0xA0,0x20,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCFA2 [?] [4326]*/ + 0x01,0x02,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCFA3 [?] [4327]*/ + 0x18,0x06,0x01,0x06,0x3A,0x02,0xFF,0x04,0x08,0x1F,0x28,0x48,0x88,0x08,0x00,0x00, + 0x18,0x60,0x80,0x60,0x18,0x00,0xFE,0x80,0x80,0xF8,0x88,0x88,0xA8,0x90,0x80,0x80, + /* 0xCFA4 [?] [4328]*/ + 0x00,0x3F,0x11,0x09,0x01,0xFF,0x09,0x11,0x21,0xC0,0x01,0x08,0x48,0x48,0x87,0x00, + 0xF8,0x00,0x10,0x20,0x00,0xFE,0x20,0x10,0x08,0x06,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCFA5 [?] [4329]*/ + 0x00,0x78,0x4B,0x48,0x48,0x7B,0x48,0x48,0x49,0x7A,0x49,0x48,0x49,0x4A,0x48,0x98, + 0x20,0x20,0xFE,0x70,0xAC,0x22,0x50,0x88,0x24,0x22,0x24,0xA8,0x24,0x22,0xA0,0x40, + /* 0xCFA6 [?] [4330]*/ + 0x02,0x02,0x02,0x02,0x07,0x04,0x08,0x10,0x24,0x42,0x01,0x00,0x01,0x02,0x0C,0x70, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x10,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xCFA7 [?] [4331]*/ + 0x10,0x10,0x10,0x13,0x18,0x54,0x57,0x50,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x88,0x88,0x88,0xFE,0x88,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xCFA8 [?] [4332]*/ + 0x10,0x10,0x11,0x15,0x59,0x51,0x51,0x91,0x11,0x10,0x10,0x28,0x26,0x42,0x44,0x80, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xA4,0x8A,0x8A,0x78,0x00, + /* 0xCFA9 [?] [4333]*/ + 0x11,0x10,0x10,0x14,0x5B,0x50,0x53,0x90,0x11,0x13,0x15,0x29,0x25,0x41,0x40,0x80, + 0x84,0x68,0x30,0xC8,0x04,0x40,0xFE,0xA0,0x20,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xCFAA [?] [4334]*/ + 0x00,0x27,0x12,0x11,0x80,0x41,0x43,0x10,0x11,0x23,0xE0,0x20,0x27,0x20,0x21,0x06, + 0x3C,0xC0,0x44,0x28,0x80,0x10,0xE0,0x40,0x88,0xFC,0x44,0x40,0xFC,0xA0,0x10,0x0E, + /* 0xCFAB [?] [4335]*/ + 0x00,0x20,0x10,0x10,0x81,0x41,0x42,0x14,0x10,0x20,0xE0,0x20,0x20,0x20,0x21,0x06, + 0x80,0x80,0x80,0xFC,0x04,0x04,0x84,0x48,0x28,0x10,0x10,0x20,0x40,0x80,0x00,0x00, + /* 0xCFAC [?] [4336]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x28,0x26,0x28,0x24,0x27,0x28,0x20,0x5F,0x40,0x80,0x00, + 0x00,0xFC,0x04,0xFC,0x00,0x88,0xB0,0x8C,0x80,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80, + /* 0xCFAD [?] [4337]*/ + 0x21,0x22,0x27,0x24,0xFF,0x24,0x27,0x72,0x69,0xA7,0xA2,0x23,0x22,0x24,0x25,0x28, + 0x08,0x08,0xC8,0x50,0xDE,0x64,0xD4,0x14,0x14,0xD4,0x14,0xC8,0x48,0x54,0x54,0xA2, + /* 0xCFAE [?] [4338]*/ + 0x04,0x04,0xFF,0x09,0x11,0x21,0x4F,0x82,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x40,0x20,0xFE,0x10,0x60,0x84,0x04,0xFC,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xCFAF [?] [4339]*/ + 0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x22,0x23,0x20,0x2F,0x28,0x48,0x48,0x88,0x00, + 0x00,0x80,0xFE,0x20,0x20,0xFC,0x20,0x20,0xE0,0x80,0xF8,0x88,0x88,0xA8,0x90,0x80, + /* 0xCFB0 [?] [4340]*/ + 0x00,0x7F,0x00,0x00,0x08,0x04,0x02,0x02,0x00,0x01,0x0E,0x70,0x20,0x00,0x00,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0x68,0x88,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xCFB1 [?] [4341]*/ + 0x20,0x20,0x21,0x21,0xF9,0x49,0x49,0x49,0x89,0x48,0x30,0x10,0x2A,0x4A,0x84,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xA4,0x8A,0x8A,0x78,0x00, + /* 0xCFB2 [?] [4342]*/ + 0x01,0x7F,0x01,0x3F,0x00,0x3F,0x20,0x3F,0x08,0xFF,0x00,0x3F,0x20,0x20,0x3F,0x20, + 0x00,0xFC,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x20,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xCFB3 [?] [4343]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBE,0x10,0x13,0xFC,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x90,0x90,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xCFB4 [?] [4344]*/ + 0x00,0x22,0x12,0x13,0x84,0x48,0x40,0x17,0x11,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xCFB5 [?] [4345]*/ + 0x00,0x3F,0x04,0x08,0x10,0x3F,0x01,0x06,0x18,0x7F,0x01,0x09,0x11,0x21,0x45,0x02, + 0xF8,0x00,0x00,0x20,0x40,0x80,0x00,0x10,0x08,0xFC,0x04,0x20,0x10,0x08,0x04,0x00, + /* 0xCFB6 [?] [4346]*/ + 0x00,0x7C,0x45,0x4A,0x48,0x51,0x49,0x49,0x45,0x45,0x44,0x68,0x51,0x42,0x40,0x40, + 0x20,0xA8,0x24,0x22,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xCFB7 [?] [4347]*/ + 0x00,0x00,0x00,0x7E,0x02,0x02,0x25,0x14,0x08,0x08,0x14,0x12,0x22,0x40,0x00,0x01, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xCFB8 [?] [4348]*/ + 0x10,0x10,0x21,0x25,0x45,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x00,0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xCFB9 [?] [4349]*/ + 0x00,0x00,0x7B,0x4A,0x4C,0x79,0x48,0x49,0x78,0x4B,0x48,0x49,0x79,0x49,0x01,0x01, + 0x40,0x20,0xFE,0x02,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x20,0xFC,0x04,0x04,0xFC,0x04, + /* 0xCFBA [?] [4350]*/ + 0x10,0x13,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x00,0xFE,0x40,0x40,0x40,0x40,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xCFBB [?] [4351]*/ + 0x00,0x7F,0x40,0x40,0x4F,0x48,0x48,0x4F,0x48,0x48,0x4F,0x48,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x00,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0x88,0x80,0x80,0xFE,0x00, + /* 0xCFBC [?] [4352]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3E,0x22,0x3E,0x20,0x3E,0x20,0x3E,0x20, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x08,0xF8,0x00,0xF8,0x48,0x30,0xCC, + /* 0xCFBD [?] [4353]*/ + 0x20,0x20,0x23,0xFE,0x44,0x51,0x90,0xFD,0x10,0x13,0x1C,0xF1,0x51,0x11,0x11,0x11, + 0x40,0x20,0xFE,0x02,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x20,0xFC,0x04,0x04,0xFC,0x04, + /* 0xCFBE [?] [4354]*/ + 0x00,0x07,0xF4,0x94,0x94,0x97,0x94,0xF4,0x97,0x94,0x94,0x97,0xF4,0x94,0x04,0x04, + 0x00,0xBC,0x84,0x84,0x84,0xBC,0x00,0x00,0xBC,0x24,0x24,0xA8,0x10,0x28,0x44,0x82, + /* 0xCFBF [?] [4355]*/ + 0x10,0x10,0x10,0x11,0x54,0x55,0x54,0x54,0x54,0x57,0x54,0x5C,0x64,0x00,0x01,0x02, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xCFC0 [?] [4356]*/ + 0x08,0x08,0x08,0x17,0x10,0x32,0x31,0x50,0x9F,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x50,0x40,0xFE,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xCFC1 [?] [4357]*/ + 0x00,0x44,0x28,0x11,0x28,0x49,0x88,0x08,0x18,0x2B,0x48,0x88,0x08,0x08,0x51,0x22, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xCFC2 [?] [4358]*/ + 0x00,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x00,0xFE,0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x08,0x00,0x00,0x00,0x00,0x00, + /* 0xCFC3 [?] [4359]*/ + 0x3F,0x20,0x3F,0x21,0x27,0x24,0x27,0x24,0x27,0x24,0x27,0x22,0x47,0x4A,0x81,0x1E, + 0xFE,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xF8,0x08,0xF0,0x0E, + /* 0xCFC4 [?] [4360]*/ + 0x7F,0x02,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x08,0x1F,0x28,0x44,0x03,0x1C,0xE0, + 0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E, + /* 0xCFC5 [?] [4361]*/ + 0x00,0x07,0x78,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x00,0xFE,0x40,0x40,0x40,0x40,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xCFC6 [?] [4362]*/ + 0x20,0x20,0x27,0x24,0xF4,0x24,0x27,0x25,0x35,0xE5,0x25,0x25,0x25,0x29,0xA9,0x50, + 0x10,0x90,0x10,0x3E,0x22,0x44,0x90,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x82, + /* 0xCFC7 [?] [4363]*/ + 0x20,0x20,0x3B,0x22,0x42,0x7A,0xA3,0x22,0xFA,0x22,0x22,0x22,0x2A,0x34,0x24,0x08, + 0x10,0x50,0x90,0x1E,0x12,0x24,0xC8,0x88,0x88,0x88,0x88,0x94,0x94,0x94,0x94,0x22, + /* 0xCFC8 [?] [4364]*/ + 0x01,0x11,0x11,0x1F,0x21,0x41,0x01,0xFF,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x40,0x40,0x40,0x40,0x42,0x42,0x3E,0x00, + /* 0xCFC9 [?] [4365]*/ + 0x10,0x10,0x10,0x20,0x24,0x64,0x64,0xA4,0x24,0x24,0x24,0x24,0x24,0x27,0x20,0x20, + 0x40,0x40,0x40,0x40,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x04,0x00, + /* 0xCFCA [?] [4366]*/ + 0x10,0x10,0x1E,0x22,0x24,0x7E,0xAA,0x2A,0x3E,0x2A,0x2A,0x3E,0x00,0x0E,0x70,0x20, + 0x82,0x44,0x28,0xFE,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xCFCB [?] [4367]*/ + 0x10,0x10,0x21,0x24,0x44,0xF8,0x10,0x23,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xCFCC [?] [4368]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x2F,0x20,0x20,0x2F,0x29,0x29,0x2F,0x49,0x40,0x81, + 0x50,0x48,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xCFCD [?] [4369]*/ + 0x04,0x25,0x24,0x24,0x24,0x24,0x27,0x04,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0xF8,0x88,0x50,0x20,0xD8,0x06,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xCFCE [?] [4370]*/ + 0x12,0x12,0x23,0x42,0x84,0x17,0x2A,0x62,0xAF,0x22,0x22,0x22,0x22,0x23,0x22,0x20, + 0x00,0x00,0x9C,0x00,0x00,0x80,0x3E,0x08,0x88,0x08,0x08,0x08,0x88,0x08,0x28,0x10, + /* 0xCFCF [?] [4371]*/ + 0x10,0x20,0x7C,0x45,0x64,0x54,0x54,0xFC,0x45,0x64,0x54,0x54,0x44,0x45,0x54,0x88, + 0x20,0x10,0x10,0xFE,0x20,0x20,0x44,0x84,0xF8,0x10,0x20,0x44,0x82,0xFE,0x82,0x00, + /* 0xCFD0 [?] [4372]*/ + 0x20,0x17,0x00,0x41,0x41,0x41,0x5F,0x41,0x43,0x45,0x49,0x51,0x41,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0xF4,0x04,0x84,0x44,0x24,0x14,0x04,0x04,0x14,0x08, + /* 0xCFD1 [?] [4373]*/ + 0x00,0x20,0x17,0x11,0x81,0x42,0x42,0x17,0x11,0x25,0xE5,0x22,0x22,0x25,0x28,0x10, + 0x08,0x1C,0x70,0x10,0x10,0x50,0x5C,0x50,0x50,0x50,0x50,0x7C,0x00,0x00,0xFE,0x00, + /* 0xCFD2 [?] [4374]*/ + 0x00,0xF8,0x08,0x0B,0x08,0x78,0x40,0x41,0x43,0x78,0x08,0x08,0x09,0x0B,0x51,0x20, + 0x40,0x20,0x20,0xFE,0x40,0x40,0x88,0x08,0xF0,0x20,0x40,0x88,0x04,0xFC,0x04,0x00, + /* 0xCFD3 [?] [4375]*/ + 0x10,0x10,0x10,0x13,0xFC,0x25,0x24,0x27,0x24,0x49,0x28,0x10,0x29,0x46,0x84,0x00, + 0x88,0x50,0x00,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50,0x50, + /* 0xCFD4 [?] [4376]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x04,0x44,0x24,0x14,0x14,0x04,0xFF,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x40,0x44,0x44,0x48,0x50,0x40,0xFE,0x00, + /* 0xCFD5 [?] [4377]*/ + 0x00,0x78,0x48,0x50,0x51,0x62,0x55,0x48,0x48,0x48,0x6A,0x51,0x41,0x40,0x47,0x40, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xCFD6 [?] [4378]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7D,0x11,0x11,0x10,0x10,0x1C,0xE1,0x42,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xCFD7 [?] [4379]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7F,0x41,0x55,0x49,0x5D,0x49,0x7F,0x49,0x49,0x45,0x42, + 0x10,0x14,0x92,0x12,0x10,0x7E,0x10,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x82, + /* 0xCFD8 [?] [4380]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0xFF,0x04,0x08,0x10,0x3F,0x10, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0xFE,0x00,0x20,0x10,0xF8,0x08, + /* 0xCFD9 [?] [4381]*/ + 0x00,0x78,0x49,0x49,0x49,0x79,0x49,0x48,0x48,0x7B,0x48,0x49,0x49,0x4A,0x4C,0x98, + 0x40,0x80,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x32,0xB4,0xA8,0x28,0x24,0x24,0xA2,0x40, + /* 0xCFDA [?] [4382]*/ + 0x20,0x20,0x20,0x39,0x4A,0x54,0x80,0x23,0x22,0x22,0x23,0x22,0x2A,0x32,0x23,0x02, + 0x80,0x80,0xF8,0x08,0x10,0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xCFDB [?] [4383]*/ + 0x08,0x04,0x7F,0x01,0x3F,0x01,0xFF,0x40,0x20,0x09,0x12,0x24,0xE0,0x20,0x23,0x2C, + 0x20,0x40,0xFC,0x00,0xF8,0x00,0xFE,0x80,0x80,0xFC,0x04,0x48,0x40,0xA0,0x18,0x06, + /* 0xCFDC [?] [4384]*/ + 0x02,0x01,0x7F,0x40,0x81,0x11,0x1F,0x21,0x01,0xFF,0x04,0x04,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0xFE,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xCFDD [?] [4385]*/ + 0x00,0x78,0x48,0x51,0x52,0x64,0x50,0x4B,0x4A,0x4A,0x6B,0x52,0x42,0x42,0x43,0x42, + 0x80,0x80,0xF8,0x08,0x10,0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xCFDE [?] [4386]*/ + 0x00,0x7B,0x4A,0x52,0x53,0x62,0x52,0x4B,0x4A,0x4A,0x6A,0x52,0x42,0x42,0x43,0x42, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xCFDF [?] [4387]*/ + 0x10,0x10,0x20,0x24,0x45,0xF8,0x10,0x23,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x43,0x00, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xCFE0 [?] [4388]*/ + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08,0x08, + 0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xCFE1 [?] [4389]*/ + 0x00,0x3F,0x22,0x22,0x22,0x2F,0x22,0x26,0x27,0x2A,0x2A,0x32,0x22,0x42,0x42,0x82, + 0x00,0xFE,0x00,0x00,0x7C,0x44,0x44,0x7C,0x44,0xC4,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xCFE2 [?] [4390]*/ + 0x20,0x27,0x38,0x23,0x42,0x7B,0xA1,0x27,0xF9,0x27,0x21,0x27,0x29,0x33,0x25,0x01, + 0x40,0xFC,0x00,0xB8,0xA8,0xB8,0x10,0xFC,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xCFE3 [?] [4391]*/ + 0x00,0x1F,0x01,0x01,0xFF,0x05,0x09,0x31,0xDF,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x70,0x80,0x00,0x00,0xFE,0x40,0x20,0x18,0xF6,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xCFE4 [?] [4392]*/ + 0x10,0x10,0x3F,0x28,0x45,0x88,0x08,0x7E,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC, + /* 0xCFE5 [?] [4393]*/ + 0x01,0xFF,0x00,0x3E,0x22,0x3E,0x04,0x7F,0x04,0x3F,0x04,0xFF,0x04,0x1C,0xE5,0x06, + 0x00,0xFE,0x00,0xF8,0x88,0xF8,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x44,0x28,0x18,0x06, + /* 0xCFE6 [?] [4394]*/ + 0x02,0x42,0x22,0x22,0x0F,0x82,0x42,0x57,0x16,0x2A,0xF2,0x22,0x22,0x22,0x22,0x02, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0xC4,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xCFE7 [?] [4395]*/ + 0x02,0x02,0x04,0x08,0x10,0x3F,0x01,0x02,0x04,0x1F,0x00,0x00,0x01,0x06,0x18,0xE0, + 0x00,0x00,0x20,0x20,0x40,0x80,0x08,0x08,0x10,0xE0,0x40,0x80,0x00,0x00,0x00,0x00, + /* 0xCFE8 [?] [4396]*/ + 0x44,0x25,0x28,0xFE,0x11,0x10,0x7C,0x10,0x10,0xFE,0x11,0x10,0x20,0x20,0x41,0x80, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0x44,0x4C,0xD4,0x64,0x44,0x44,0x44,0x54,0x88, + /* 0xCFE9 [?] [4397]*/ + 0x21,0x10,0x10,0xF8,0x0B,0x10,0x10,0x39,0x54,0x90,0x13,0x10,0x10,0x10,0x10,0x10, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xCFEA [?] [4398]*/ + 0x02,0x21,0x11,0x10,0x07,0x00,0xF0,0x13,0x10,0x10,0x17,0x10,0x14,0x18,0x10,0x00, + 0x08,0x08,0x10,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xCFEB [?] [4399]*/ + 0x08,0x08,0x08,0x7E,0x08,0x18,0x1C,0x2A,0x48,0x08,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xF8,0x88,0x88,0xF8,0x88,0xF8,0x88,0x88,0xF8,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xCFEC [?] [4400]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x02,0x02, + 0x40,0x40,0x80,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xCFED [?] [4401]*/ + 0x02,0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x1F,0x00,0x01,0xFF,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00, + /* 0xCFEE [?] [4402]*/ + 0x00,0x01,0x00,0xFC,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x1D,0xE0,0x40,0x01,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xCFEF [?] [4403]*/ + 0x04,0x04,0x3F,0x04,0x04,0xFF,0x04,0x08,0x1F,0x28,0xC8,0x0F,0x08,0x08,0x08,0x07, + 0x40,0x40,0xF8,0x40,0x40,0xFE,0x40,0x20,0xF0,0x28,0x26,0xE0,0x20,0x08,0x08,0xF8, + /* 0xCFF0 [?] [4404]*/ + 0x10,0x10,0x11,0x13,0xFD,0x11,0x39,0x34,0x50,0x53,0x90,0x13,0x10,0x10,0x13,0x10, + 0x80,0xF8,0x08,0xFE,0x12,0x22,0xFE,0x40,0xA2,0x54,0x98,0x34,0x54,0x92,0x50,0x20, + /* 0xCFF1 [?] [4405]*/ + 0x09,0x09,0x0A,0x17,0x1A,0x32,0x33,0x50,0x91,0x16,0x11,0x16,0x10,0x11,0x16,0x10, + 0x00,0xF0,0x10,0xFC,0x24,0x44,0xFC,0x80,0x44,0xA8,0x30,0x68,0xA8,0x24,0xA2,0x40, + /* 0xCFF2 [?] [4406]*/ + 0x02,0x04,0x08,0x7F,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x47,0x44,0x40,0x40,0x40, + 0x00,0x00,0x00,0xFC,0x04,0x04,0xC4,0x44,0x44,0x44,0x44,0xC4,0x44,0x04,0x14,0x08, + /* 0xCFF3 [?] [4407]*/ + 0x08,0x1F,0x20,0x7F,0xA1,0x22,0x3F,0x06,0x19,0x62,0x0C,0x71,0x06,0x18,0xE2,0x01, + 0x00,0xE0,0x20,0xF8,0x08,0x08,0xF8,0x00,0x10,0xA0,0xC0,0xA0,0x90,0x88,0x86,0x00, + /* 0xCFF4 [?] [4408]*/ + 0x08,0x08,0xFF,0x08,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x25,0x25,0x29,0x41,0x81, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0x48,0x28,0x28,0x08,0x08, + /* 0xCFF5 [?] [4409]*/ + 0x00,0x01,0xFC,0x10,0x10,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xCFF6 [?] [4410]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x11,0x09,0x3F,0x20,0x3F,0x20,0x3F,0x20,0x20, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x10,0x20,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x18, + /* 0xCFF7 [?] [4411]*/ + 0x08,0x49,0x29,0x2A,0x08,0x7F,0x41,0x41,0x7F,0x41,0x41,0x7F,0x41,0x41,0x45,0x42, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xCFF8 [?] [4412]*/ + 0x00,0x00,0x7B,0x48,0x48,0x4F,0x48,0x48,0x4B,0x49,0x7A,0x4D,0x08,0x00,0x00,0x00, + 0x40,0x44,0xF4,0x48,0x48,0xFE,0x20,0x40,0xF8,0x10,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xCFF9 [?] [4413]*/ + 0x3E,0x22,0x3E,0x00,0xFF,0x01,0x1F,0x10,0x11,0x02,0x0C,0x70,0x00,0x3E,0x22,0x3E, + 0xF8,0x88,0xF8,0x00,0xFE,0x00,0xF0,0x10,0x10,0xC0,0x30,0x08,0x00,0xF8,0x88,0xF8, + /* 0xCFFA [?] [4414]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xCFFB [?] [4415]*/ + 0x00,0x22,0x11,0x11,0x80,0x43,0x4A,0x0A,0x13,0x12,0xE2,0x23,0x22,0x22,0x22,0x02, + 0x40,0x48,0x48,0x50,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xCFFC [?] [4416]*/ + 0x02,0x01,0x7F,0x40,0x91,0x09,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x02,0x14,0x20,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xCFFD [?] [4417]*/ + 0x02,0x21,0x10,0x13,0x8C,0x40,0x4F,0x11,0x13,0x26,0xEB,0x22,0x23,0x22,0x22,0x02, + 0x10,0x20,0xC0,0x30,0x88,0x80,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xCFFE [?] [4418]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x7B,0x48,0x4B,0x48,0x48,0x79,0x49,0x02,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xD0A1 [?] [4419]*/ + 0x01,0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x21,0x21,0x41,0x81,0x01,0x01,0x05,0x02, + 0x00,0x00,0x00,0x00,0x00,0x10,0x08,0x04,0x04,0x02,0x02,0x02,0x00,0x00,0x00,0x00, + /* 0xD0A2 [?] [4420]*/ + 0x02,0x02,0x3F,0x02,0x02,0xFF,0x01,0x02,0x3F,0x10,0x20,0x5F,0x80,0x00,0x02,0x01, + 0x00,0x08,0xD0,0x20,0x40,0xFE,0x00,0x00,0xE0,0x40,0x80,0xFC,0x80,0x80,0x80,0x00, + /* 0xD0A3 [?] [4421]*/ + 0x10,0x10,0x10,0x11,0xFC,0x10,0x31,0x3A,0x54,0x50,0x90,0x10,0x10,0x10,0x10,0x13, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xD0A4 [?] [4422]*/ + 0x01,0x21,0x11,0x09,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x20, + 0x00,0x08,0x10,0x20,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xD0A5 [?] [4423]*/ + 0x00,0x00,0x7B,0x48,0x4F,0x48,0x4B,0x48,0x4A,0x4A,0x7A,0x4B,0x02,0x02,0x04,0x08, + 0x40,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x40,0x48,0x48,0xE8,0x58,0x48,0x48,0x48,0x48, + /* 0xD0A6 [?] [4424]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x01,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x40,0x40,0x7E,0x90,0x08,0xF0,0x00,0x00,0x00,0xFE,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xD0A7 [?] [4425]*/ + 0x10,0x08,0x00,0xFF,0x00,0x24,0x42,0x81,0x24,0x14,0x08,0x14,0x22,0x42,0x80,0x01, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xD0A8 [?] [4426]*/ + 0x21,0x21,0x27,0x21,0xFB,0x21,0x27,0x71,0x69,0xA0,0xA7,0x20,0x20,0x21,0x22,0x2C, + 0x00,0x3C,0xD4,0x14,0x94,0x14,0xD4,0x24,0x4C,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xD0A9 [?] [4427]*/ + 0x04,0x04,0x24,0x27,0x24,0x24,0x24,0x2F,0xF0,0x40,0x00,0x1F,0x00,0x00,0x7F,0x00, + 0x40,0x40,0x44,0x48,0x70,0x42,0x42,0x42,0x3E,0x00,0x00,0xF0,0x00,0x00,0xFC,0x00, + /* 0xD0AA [?] [4428]*/ + 0x00,0x7E,0x42,0x7E,0x42,0x7E,0x20,0x7F,0x89,0x49,0x55,0x41,0x7D,0x01,0x0A,0x04, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x82, + /* 0xD0AB [?] [4429]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x54,0x55,0x7E,0x51,0x11,0x15,0x1D,0xE4,0x40,0x00, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFE,0x22,0x22,0x52,0x02,0xFA,0x02,0x14,0x08, + /* 0xD0AC [?] [4430]*/ + 0x28,0x28,0xFE,0x28,0x38,0x10,0x7D,0x54,0x54,0x7C,0x10,0xFE,0x10,0x10,0x11,0x10, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xD0AD [?] [4431]*/ + 0x20,0x20,0x20,0x20,0xFB,0x20,0x20,0x22,0x22,0x24,0x28,0x20,0x21,0x21,0x22,0x24, + 0x80,0x80,0x80,0x80,0xF0,0x90,0x90,0x98,0x94,0x92,0x92,0x90,0x10,0x10,0x50,0x20, + /* 0xD0AE [?] [4432]*/ + 0x10,0x10,0x10,0x11,0xFC,0x11,0x10,0x14,0x18,0x33,0xD0,0x10,0x10,0x10,0x51,0x22, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xD0AF [?] [4433]*/ + 0x10,0x10,0x11,0x13,0xFD,0x11,0x11,0x15,0x19,0x31,0xD3,0x10,0x10,0x11,0x52,0x24, + 0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x9E,0x02,0x0A,0x04, + /* 0xD0B0 [?] [4434]*/ + 0x00,0x7F,0x02,0x22,0x22,0x22,0x42,0x7F,0x06,0x0A,0x12,0x22,0x42,0x82,0x0A,0x04, + 0x00,0xBE,0x22,0x24,0x24,0x28,0x24,0xE4,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xD0B1 [?] [4435]*/ + 0x08,0x08,0x14,0x22,0x41,0xBE,0x08,0x08,0x7F,0x08,0x2A,0x29,0x49,0x88,0x28,0x10, + 0x08,0x48,0x28,0x28,0x08,0x48,0x28,0x28,0x0E,0x78,0x08,0x08,0x08,0x08,0x08,0x08, + /* 0xD0B2 [?] [4436]*/ + 0x00,0x78,0x48,0x48,0x4B,0x78,0x48,0x4A,0x4A,0x7C,0x48,0x48,0x49,0x49,0x4A,0x9C, + 0x80,0x80,0x80,0x80,0xF0,0x90,0x90,0x98,0x94,0x92,0x92,0x90,0x10,0x10,0x50,0x20, + /* 0xD0B3 [?] [4437]*/ + 0x02,0x22,0x13,0x12,0x02,0x03,0xF2,0x10,0x13,0x12,0x12,0x13,0x16,0x1A,0x13,0x02, + 0x20,0x24,0xA8,0x30,0xA2,0x22,0x5E,0x80,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD0B4 [?] [4438]*/ + 0x00,0x7F,0x40,0x90,0x10,0x1F,0x10,0x20,0x3F,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, + 0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0xF8,0x08,0x08,0xC8,0x08,0x08,0x50,0x20, + /* 0xD0B5 [?] [4439]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x31,0x39,0x57,0x51,0x91,0x11,0x12,0x12,0x14,0x10, + 0x10,0x14,0x12,0x10,0xFE,0x10,0x50,0x54,0xF4,0x54,0x54,0x48,0x4A,0x5A,0x26,0x42, + /* 0xD0B6 [?] [4440]*/ + 0x20,0x20,0x3F,0x48,0x88,0x08,0x7F,0x08,0x08,0x2E,0x28,0x28,0x2F,0xF0,0x40,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x40,0x40,0x40, + /* 0xD0B7 [?] [4441]*/ + 0x20,0x3E,0x44,0xBE,0x2A,0x3E,0x2A,0x3E,0x2A,0x2A,0x45,0x3F,0x21,0x3F,0x01,0x7F, + 0x00,0xFC,0x24,0x54,0x98,0x50,0xFC,0x10,0xFE,0x10,0x10,0xF8,0x08,0xF8,0x04,0xFE, + /* 0xD0B8 [?] [4442]*/ + 0x22,0x23,0x24,0x29,0x37,0xAD,0xA5,0xA7,0xA5,0x25,0x27,0x25,0x25,0x25,0x24,0x28, + 0x00,0x9E,0x8A,0x0A,0xD2,0x66,0x40,0xD4,0x5E,0x64,0xC4,0x44,0x5E,0x44,0x44,0xC4, + /* 0xD0B9 [?] [4443]*/ + 0x00,0x22,0x12,0x12,0x82,0x4F,0x42,0x12,0x12,0x22,0xE2,0x22,0x22,0x22,0x23,0x00, + 0x48,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x78,0x00,0x00,0x00,0xFE,0x00, + /* 0xD0BA [?] [4444]*/ + 0x00,0x27,0x14,0x19,0x81,0x41,0x49,0x0A,0x13,0x10,0xE0,0x27,0x20,0x20,0x20,0x00, + 0x00,0xFE,0x02,0x04,0x00,0xFC,0x00,0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xD0BB [?] [4445]*/ + 0x01,0x42,0x27,0x24,0x07,0x04,0xE7,0x24,0x24,0x2F,0x21,0x2A,0x34,0x28,0x02,0x01, + 0x08,0x08,0x88,0x88,0xBE,0x88,0x88,0xC8,0xA8,0xA8,0x88,0x88,0x88,0x88,0xA8,0x10, + /* 0xD0BC [?] [4446]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x24,0x22,0x2F,0x28,0x2F,0x28,0x4F,0x48,0x88,0x08, + 0x00,0xF8,0x08,0x08,0xF8,0x80,0x90,0xA0,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xD0BD [?] [4447]*/ + 0x08,0xFF,0x08,0x10,0x08,0x7F,0x22,0x14,0xFF,0x08,0x7F,0x08,0x2A,0x49,0xA8,0x11, + 0x20,0xFE,0x20,0x00,0x04,0x78,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xD0BE [?] [4448]*/ + 0x08,0x08,0xFF,0x08,0x08,0x02,0x01,0x00,0x04,0x24,0x24,0x44,0x84,0x04,0x03,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0x80,0x08,0x04,0x02,0x02,0x10,0x10,0xF0,0x00, + /* 0xD0BF [?] [4449]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x13,0x10,0xFC,0x10,0x11,0x10,0x14,0x18,0x10,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xD0C0 [?] [4450]*/ + 0x02,0x07,0x38,0x20,0x20,0x20,0x3F,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x81, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xD0C1 [?] [4451]*/ + 0x02,0x01,0x3F,0x00,0x08,0x04,0xFF,0x01,0x01,0x01,0x7F,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00, + /* 0xD0C2 [?] [4452]*/ + 0x10,0x08,0x7F,0x00,0x22,0x14,0xFF,0x08,0x08,0x7F,0x08,0x2A,0x49,0x88,0x28,0x11, + 0x00,0x04,0x78,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xD0C3 [?] [4453]*/ + 0x10,0x10,0x11,0x11,0x19,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD0C4 [?] [4454]*/ + 0x00,0x02,0x01,0x00,0x00,0x04,0x04,0x24,0x24,0x24,0x44,0x44,0x84,0x04,0x03,0x00, + 0x00,0x00,0x00,0x80,0x80,0x00,0x08,0x04,0x04,0x02,0x02,0x12,0x10,0x10,0xF0,0x00, + /* 0xD0C5 [?] [4455]*/ + 0x08,0x08,0x0B,0x10,0x10,0x31,0x30,0x50,0x91,0x10,0x10,0x11,0x11,0x11,0x11,0x11, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD0C6 [?] [4456]*/ + 0x08,0x08,0x10,0x7F,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x57,0xFC,0x00,0x00, + 0x10,0x10,0x94,0x54,0x58,0x10,0xFC,0x10,0x10,0x10,0xFE,0x10,0x90,0x10,0x10,0x10, + /* 0xD0C7 [?] [4457]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0x11,0x1F,0x21,0x41,0x1F,0x01,0x01,0x7F,0x00, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x00,0xF8,0x00,0x00,0xF0,0x00,0x00,0xFC,0x00, + /* 0xD0C8 [?] [4458]*/ + 0x00,0x7B,0x4A,0x4B,0x4A,0x7B,0x48,0x4A,0x4B,0x7C,0x48,0x4B,0x48,0x48,0x4F,0x98, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0x40,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x00, + /* 0xD0C9 [?] [4459]*/ + 0x00,0x8B,0x52,0x23,0x52,0x93,0x10,0x12,0x33,0x54,0x90,0x13,0x10,0x10,0xA7,0x40, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0x40,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x00, + /* 0xD0CA [?] [4460]*/ + 0x10,0x11,0x11,0x11,0x19,0x55,0x50,0x51,0x91,0x12,0x10,0x11,0x10,0x10,0x13,0x10, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xD0CB [?] [4461]*/ + 0x04,0x02,0x21,0x11,0x08,0x08,0x00,0xFF,0x00,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x08,0x08,0x08,0x10,0x10,0x20,0x40,0xFE,0x00,0x40,0x20,0x10,0x08,0x08,0x04,0x04, + /* 0xD0CC [?] [4462]*/ + 0x00,0x7F,0x12,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x22,0x22,0x42,0x82, + 0x04,0x84,0x04,0x24,0x24,0x24,0x24,0xE4,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD0CD [?] [4463]*/ + 0x00,0x7F,0x12,0x12,0x12,0xFF,0x12,0x22,0x22,0x41,0x81,0x3F,0x01,0x01,0xFF,0x00, + 0x04,0x84,0x24,0x24,0x24,0xA4,0x24,0x04,0x14,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xD0CE [?] [4464]*/ + 0x00,0x7F,0x12,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x22,0x22,0x42,0x82, + 0x00,0x84,0x04,0x08,0x10,0x22,0x02,0xC4,0x08,0x10,0x22,0x02,0x04,0x08,0x10,0x60, + /* 0xD0CF [?] [4465]*/ + 0x00,0x7F,0x12,0x12,0x12,0x12,0x12,0xFF,0x12,0x12,0x12,0x12,0x22,0x22,0x42,0x82, + 0x00,0xBE,0x22,0x24,0x24,0x28,0x24,0xE4,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xD0D0 [?] [4466]*/ + 0x08,0x09,0x10,0x20,0x48,0x08,0x13,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x00,0x00,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xD0D1 [?] [4467]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x10,0x50,0x7C,0x90,0x10,0x7C,0x10,0x10,0xFE,0x00, + /* 0xD0D2 [?] [4468]*/ + 0x01,0x01,0x3F,0x01,0x01,0xFF,0x08,0x04,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x00,0x00,0xFE,0x20,0x40,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xD0D3 [?] [4469]*/ + 0x01,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xD0D4 [?] [4470]*/ + 0x10,0x10,0x11,0x11,0x19,0x55,0x52,0x50,0x90,0x11,0x10,0x10,0x10,0x10,0x13,0x10, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD0D5 [?] [4471]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x26,0x24,0x24,0x49,0x28,0x10,0x28,0x44,0x83,0x00, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD0D6 [?] [4472]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x3F,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0xC0, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xD0D7 [?] [4473]*/ + 0x00,0x00,0x10,0x08,0x44,0x42,0x41,0x42,0x44,0x48,0x50,0x60,0x40,0x40,0x7F,0x00, + 0x00,0x10,0x10,0x20,0x44,0x84,0x04,0x84,0x44,0x24,0x14,0x14,0x04,0x04,0xFC,0x04, + /* 0xD0D8 [?] [4474]*/ + 0x01,0x79,0x49,0x49,0x4A,0x7A,0x4D,0x48,0x4A,0x7A,0x4B,0x4A,0x4B,0x48,0x48,0x98, + 0x00,0x00,0x00,0xFE,0x02,0x02,0x12,0xA2,0x4A,0xAA,0x1A,0x0A,0xFA,0x02,0x14,0x08, + /* 0xD0D9 [?] [4475]*/ + 0x08,0x08,0x10,0x1F,0x20,0x40,0x88,0x25,0x22,0x25,0x28,0x20,0x3F,0x00,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x08,0x88,0x88,0x28,0x28,0x28,0xA8,0x28,0xE8,0x08,0x50,0x20, + /* 0xD0DA [?] [4476]*/ + 0x00,0x20,0x11,0x10,0x82,0x42,0x4A,0x0A,0x12,0x12,0xE3,0x22,0x22,0x23,0x20,0x00, + 0x00,0x08,0x08,0x88,0x52,0x52,0x22,0x22,0x52,0x92,0x0A,0x0A,0x02,0xFE,0x02,0x00, + /* 0xD0DB [?] [4477]*/ + 0x08,0x08,0x08,0x7E,0x11,0x12,0x20,0x28,0x48,0x48,0x90,0x14,0x22,0x7E,0x22,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xD0DC [?] [4478]*/ + 0x10,0x24,0x42,0x7E,0x00,0x7E,0x42,0x7E,0x42,0x7E,0x42,0x46,0x00,0x48,0x44,0x84, + 0x80,0x98,0xE0,0x84,0x84,0x7C,0x80,0x98,0xE0,0x84,0x84,0x7C,0x00,0x88,0x44,0x44, + /* 0xD0DD [?] [4479]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x50,0x91,0x11,0x12,0x14,0x18,0x10,0x10,0x10, + 0x40,0x40,0x40,0x40,0xFE,0x40,0xE0,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40,0x40, + /* 0xD0DE [?] [4480]*/ + 0x10,0x10,0x11,0x21,0x2A,0x6C,0xA9,0x2E,0x28,0x2B,0x28,0x28,0x2B,0x20,0x21,0x26, + 0x80,0x80,0xF8,0x08,0x90,0x60,0x98,0x26,0xC0,0x10,0x20,0xC8,0x10,0x60,0x80,0x00, + /* 0xD0DF [?] [4481]*/ + 0x08,0x04,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x0F,0x11,0x21,0xCF,0x02,0x02,0x3F,0x00, + 0x20,0x40,0xFC,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xFE,0x00, + /* 0xD0E0 [?] [4482]*/ + 0x10,0x13,0x10,0x10,0xFC,0x10,0x31,0x39,0x54,0x50,0x90,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFE,0x40,0x40,0x80,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xD0E1 [?] [4483]*/ + 0x00,0x00,0x7B,0x4A,0x4B,0x4A,0x4B,0x4A,0x4B,0x48,0x78,0x4F,0x00,0x01,0x02,0x0C, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x50,0x48,0xFE,0xA0,0x10,0x08,0x06, + /* 0xD0E2 [?] [4484]*/ + 0x10,0x11,0x3C,0x20,0x43,0xBC,0x11,0x12,0xFD,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x1C,0xE0,0x20,0x20,0xFE,0xA8,0x24,0x22,0xF8,0x88,0x90,0xBE,0x02,0x02,0x14,0x08, + /* 0xD0E3 [?] [4485]*/ + 0x00,0x1F,0x01,0x01,0x7F,0x05,0x09,0x31,0xCF,0x04,0x04,0x04,0x08,0x08,0x10,0x60, + 0x70,0x80,0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x20,0x40,0x78,0x08,0x08,0x50,0x20, + /* 0xD0E4 [?] [4486]*/ + 0x20,0x10,0x00,0xFC,0x09,0x11,0x11,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xD0E5 [?] [4487]*/ + 0x10,0x13,0x20,0x20,0x4F,0xF9,0x12,0x24,0x43,0xF9,0x41,0x01,0x1A,0xE2,0x44,0x08, + 0x38,0xC0,0x40,0x40,0xFC,0x50,0x48,0x46,0xF0,0x10,0x20,0x7C,0x04,0x04,0x28,0x10, + /* 0xD0E6 [?] [4488]*/ + 0x20,0x20,0x20,0x23,0x22,0xFA,0x23,0x22,0x22,0x22,0x22,0x3B,0xE4,0x44,0x09,0x00, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x00,0x50,0x54,0x54,0xD8,0x50,0xFE,0x00, + /* 0xD0E7 [?] [4489]*/ + 0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0x20,0x40,0x40,0x81, + 0x50,0x48,0x40,0xFE,0x40,0x40,0x44,0x44,0x44,0x28,0x28,0x12,0x32,0x4A,0x86,0x02, + /* 0xD0E8 [?] [4490]*/ + 0x00,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0xFF,0x02,0x3F,0x24,0x24,0x24,0x20, + 0x00,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFE,0x00,0xF8,0x88,0x88,0xA8,0x10, + /* 0xD0E9 [?] [4491]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x21,0x20,0x22,0x32,0x2A,0x2A,0x42,0x5F,0x80, + 0x00,0xF8,0x00,0xFC,0x04,0x60,0x88,0x08,0xF8,0x40,0x48,0x48,0x50,0x40,0xFC,0x00, + /* 0xD0EA [?] [4492]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4B,0x4A,0x4A,0x4A,0x7A,0x4B,0x04,0x04,0x09,0x00, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x00,0x50,0x54,0x54,0xD8,0x50,0xFE,0x00, + /* 0xD0EB [?] [4493]*/ + 0x08,0x09,0x10,0x20,0x41,0x89,0x09,0x11,0x21,0x45,0x85,0x09,0x10,0x20,0x41,0x82, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xD0EC [?] [4494]*/ + 0x10,0x10,0x20,0x41,0x92,0x15,0x20,0x60,0xA7,0x20,0x22,0x22,0x24,0x28,0x21,0x20, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xD0ED [?] [4495]*/ + 0x00,0x20,0x10,0x11,0x01,0x02,0xF0,0x10,0x13,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x80,0x80,0x80,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD0EE [?] [4496]*/ + 0x08,0xFF,0x08,0x01,0xFF,0x08,0x1F,0x03,0x0C,0x3F,0x00,0x3F,0x21,0x3F,0x21,0x3F, + 0x20,0xFE,0x20,0x00,0xFE,0x20,0xC0,0x10,0x08,0xFC,0x04,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xD0EF [?] [4497]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x44,0x44,0x28,0xAA,0xAA,0x92,0x92,0xAA,0xAA,0xA6,0xC6,0x82,0x82,0xFE,0x02, + /* 0xD0F0 [?] [4498]*/ + 0x08,0x08,0x14,0x22,0x41,0xBE,0x08,0x08,0x7F,0x08,0x2A,0x29,0x49,0x88,0x28,0x11, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x28,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xD0F1 [?] [4499]*/ + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x43,0x80, + 0x00,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xF8,0x8A,0x02,0x02,0xFE,0x00, + /* 0xD0F2 [?] [4500]*/ + 0x01,0x00,0x3F,0x20,0x23,0x20,0x20,0x20,0x2F,0x20,0x20,0x20,0x40,0x40,0x81,0x00, + 0x00,0x80,0xFE,0x00,0xF8,0x10,0xA0,0x40,0xFE,0x42,0x44,0x40,0x40,0x40,0x40,0x80, + /* 0xD0F3 [?] [4501]*/ + 0x02,0x01,0x7F,0x04,0x08,0x1F,0x03,0x0C,0x3F,0x00,0x3F,0x21,0x3F,0x21,0x3F,0x20, + 0x00,0x00,0xFC,0x00,0x20,0xC0,0x10,0x08,0xFC,0x04,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xD0F4 [?] [4502]*/ + 0x10,0x10,0x10,0x11,0x1B,0x56,0x52,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x17,0x10, + 0x40,0x40,0x80,0x00,0xFC,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0xFE,0x00, + /* 0xD0F5 [?] [4503]*/ + 0x08,0x7F,0x11,0x32,0x0C,0x32,0xC2,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xD0F6 [?] [4504]*/ + 0x10,0x13,0x10,0x11,0xFD,0x25,0x26,0x24,0x25,0x49,0x29,0x11,0x29,0x45,0x81,0x01, + 0x00,0xFE,0x22,0x20,0x3C,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xD0F7 [?] [4505]*/ + 0x10,0x10,0x23,0x20,0x48,0xF7,0x10,0x20,0x41,0xFB,0x45,0x01,0x19,0xE1,0x41,0x01, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD0F8 [?] [4506]*/ + 0x10,0x10,0x21,0x24,0x44,0xFB,0x10,0x20,0x40,0xFD,0x40,0x03,0x1C,0xE0,0x40,0x03, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x10,0x90,0xFE,0x28,0x44,0x82,0x02, + /* 0xD0F9 [?] [4507]*/ + 0x10,0x10,0x10,0xFE,0x20,0x28,0x48,0x7E,0x09,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08, + 0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD0FA [?] [4508]*/ + 0x00,0x00,0x7B,0x4A,0x4C,0x49,0x48,0x49,0x49,0x49,0x79,0x49,0x01,0x00,0x03,0x00, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xD0FB [?] [4509]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x00,0xFF,0x00, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x00,0xFE,0x00, + /* 0xD0FC [?] [4510]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x08,0x10,0x3F,0x10,0x01,0x28,0x28,0x48,0x07, + 0xF0,0x10,0xF0,0x10,0xF0,0x10,0xFE,0x20,0x10,0xF8,0x08,0x00,0x88,0xA4,0x24,0xE0, + /* 0xD0FD [?] [4511]*/ + 0x20,0x10,0x10,0x01,0xFE,0x21,0x20,0x3C,0x24,0x24,0x24,0x24,0x24,0x45,0x55,0x8A, + 0x80,0x80,0xFE,0x00,0x00,0xFC,0x24,0x24,0xA0,0xA0,0xBC,0xA0,0xA0,0x60,0x3E,0x00, + /* 0xD0FE [?] [4512]*/ + 0x02,0x01,0x01,0xFF,0x02,0x04,0x08,0x10,0x3F,0x11,0x02,0x04,0x08,0x3F,0x10,0x00, + 0x00,0x00,0x00,0xFE,0x00,0x20,0x20,0x40,0x80,0x00,0x00,0x20,0x10,0xF8,0x08,0x08, + /* 0xD1A1 [?] [4513]*/ + 0x00,0x22,0x12,0x13,0x04,0x00,0xF7,0x11,0x11,0x11,0x12,0x12,0x14,0x28,0x47,0x00, + 0x40,0x40,0x40,0xF8,0x40,0x40,0xFC,0x20,0x20,0x20,0x24,0x24,0x1C,0x00,0xFE,0x00, + /* 0xD1A2 [?] [4514]*/ + 0x01,0x00,0x3F,0x24,0x27,0xA9,0x72,0x2F,0x2A,0x6F,0xAA,0x2F,0x20,0x43,0x5C,0x80, + 0x00,0x80,0xFE,0x00,0x44,0x28,0x7E,0x90,0x90,0xBC,0x90,0x90,0x7E,0x90,0x10,0x10, + /* 0xD1A3 [?] [4515]*/ + 0x00,0x00,0x78,0x4B,0x48,0x78,0x48,0x49,0x7B,0x48,0x48,0x48,0x79,0x4B,0x01,0x00, + 0x40,0x20,0x20,0xFE,0x40,0x40,0x88,0x08,0xF0,0x20,0x40,0x88,0x04,0xFC,0x04,0x00, + /* 0xD1A4 [?] [4516]*/ + 0x10,0x10,0x21,0x21,0x4A,0xF4,0x13,0x22,0x42,0xFB,0x42,0x02,0x1B,0xE0,0x40,0x00, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xD1A5 [?] [4517]*/ + 0x28,0x28,0xFE,0x28,0x38,0x11,0x7E,0x54,0x54,0x7C,0x10,0xFE,0x10,0x10,0x10,0x10, + 0x50,0x50,0x50,0x92,0x92,0x94,0x98,0x90,0xB0,0xD0,0x90,0x90,0x92,0x92,0x8E,0x80, + /* 0xD1A6 [?] [4518]*/ + 0x08,0x08,0xFF,0x08,0x10,0x7C,0x45,0x44,0x7C,0x43,0x40,0x7C,0x45,0x44,0x7C,0x44, + 0x20,0x20,0xFE,0x20,0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20, + /* 0xD1A7 [?] [4519]*/ + 0x22,0x11,0x11,0x00,0x7F,0x40,0x80,0x1F,0x00,0x01,0xFF,0x01,0x01,0x01,0x05,0x02, + 0x08,0x08,0x10,0x20,0xFE,0x02,0x04,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xD1A8 [?] [4520]*/ + 0x02,0x01,0x01,0x7F,0x40,0x80,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0xFE,0x02,0x44,0x40,0x40,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x02, + /* 0xD1A9 [?] [4521]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x00,0x00,0x1F,0x00,0x00,0x3F,0x00, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD1AA [?] [4522]*/ + 0x01,0x01,0x02,0x3F,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0x00,0xF8,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xD1AB [?] [4523]*/ + 0x00,0x3E,0x22,0x22,0x3E,0x00,0x7F,0x41,0x49,0x49,0x49,0x49,0x14,0x12,0x21,0xC2, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xD1AC [?] [4524]*/ + 0x00,0x3F,0x01,0xFF,0x01,0x3F,0x29,0x25,0x3F,0x01,0x3F,0x01,0xFF,0x48,0x44,0x84, + 0xF8,0x00,0x00,0xFE,0x00,0xF8,0x28,0x48,0xF8,0x00,0xF8,0x00,0xFE,0x88,0x44,0x44, + /* 0xD1AD [?] [4525]*/ + 0x10,0x17,0x24,0x44,0x97,0x14,0x25,0x65,0xA5,0x25,0x25,0x25,0x29,0x29,0x31,0x21, + 0x3C,0xE0,0x20,0x20,0xFE,0x20,0xFC,0x04,0x04,0xFC,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD1AE [?] [4526]*/ + 0x08,0x08,0x0F,0x10,0x10,0x2F,0x48,0x88,0x0F,0x08,0x08,0x0F,0x08,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xC4,0x44,0x44,0xC4,0x44,0x44,0xC4,0x44,0x04,0x28,0x10, + /* 0xD1AF [?] [4527]*/ + 0x00,0x20,0x11,0x11,0x02,0x04,0xF3,0x12,0x12,0x13,0x12,0x12,0x17,0x18,0x10,0x00, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xD1B0 [?] [4528]*/ + 0x00,0x3F,0x00,0x00,0x1F,0x00,0x00,0x3F,0x00,0x00,0xFF,0x08,0x04,0x04,0x00,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x20,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xD1B1 [?] [4529]*/ + 0x01,0xF9,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1D,0xE5,0x45,0x06,0x2A,0x14, + 0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04, + /* 0xD1B2 [?] [4530]*/ + 0x00,0x21,0x11,0x11,0x02,0x02,0xF4,0x12,0x12,0x11,0x11,0x11,0x10,0x28,0x47,0x00, + 0x00,0x24,0x24,0x24,0x48,0x48,0x90,0x48,0x48,0x24,0x24,0x24,0x00,0x00,0xFE,0x00, + /* 0xD1B3 [?] [4531]*/ + 0x00,0x00,0xFD,0x21,0x22,0x3D,0x45,0x45,0x65,0x95,0x09,0x09,0x11,0x20,0x40,0x80, + 0x80,0x80,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x04,0x28,0x10, + /* 0xD1B4 [?] [4532]*/ + 0x00,0x27,0x11,0x11,0x81,0x41,0x41,0x17,0x11,0x21,0xE1,0x21,0x21,0x21,0x21,0x01, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xD0,0x10,0x10,0x10,0x12,0x0A,0x0A,0x06,0x02, + /* 0xD1B5 [?] [4533]*/ + 0x01,0x21,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x12,0x02,0x04, + 0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04, + /* 0xD1B6 [?] [4534]*/ + 0x00,0x27,0x11,0x11,0x01,0x01,0xF1,0x17,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xD0,0x10,0x10,0x10,0x12,0x0A,0x0A,0x06,0x02, + /* 0xD1B7 [?] [4535]*/ + 0x00,0x4F,0x20,0x21,0x02,0x02,0xE3,0x22,0x26,0x2A,0x23,0x22,0x2A,0x24,0x50,0x8F, + 0x10,0x90,0x90,0x10,0x10,0xD8,0x54,0x54,0x92,0x92,0x12,0x10,0x50,0x20,0x00,0xFE, + /* 0xD1B8 [?] [4536]*/ + 0x00,0x4F,0x22,0x22,0x02,0x02,0xEF,0x22,0x22,0x22,0x22,0x22,0x22,0x50,0x8F,0x00, + 0x00,0xE0,0x20,0x20,0x20,0x20,0xA0,0x20,0x24,0x14,0x14,0x0C,0x04,0x00,0xFE,0x00, + /* 0xD1B9 [?] [4537]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x2F,0x20,0x20,0x20,0x20,0x20,0x40,0x5F,0x80, + 0x00,0xFE,0x00,0x80,0x80,0x80,0x80,0xFC,0x80,0x80,0x90,0x88,0x88,0x80,0xFE,0x00, + /* 0xD1BA [?] [4538]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x10,0x10,0x10,0x50,0x20, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xD1BB [?] [4539]*/ + 0x00,0x7E,0x04,0x24,0x24,0x24,0x44,0x7F,0x0C,0x14,0x14,0x24,0x45,0x84,0x14,0x08, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xD1BC [?] [4540]*/ + 0x00,0xFE,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0xFE,0x92,0x10,0x11,0x10,0x10,0x10, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xD1BD [?] [4541]*/ + 0x00,0x03,0x78,0x49,0x49,0x49,0x4A,0x4B,0x48,0x48,0x78,0x49,0x02,0x04,0x00,0x00, + 0x00,0xFC,0x10,0x10,0x10,0x10,0x10,0xFE,0x30,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xD1BE [?] [4542]*/ + 0x00,0x20,0x10,0x08,0x04,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD1BF [?] [4543]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x00,0x10,0x20,0x3F,0x01,0x02,0x0C,0x30,0xC0,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xD1C0 [?] [4544]*/ + 0x00,0x3F,0x00,0x00,0x10,0x10,0x20,0x3F,0x01,0x02,0x04,0x08,0x10,0x60,0x01,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xD1C1 [?] [4545]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x55,0x55,0x7C,0x50,0x10,0x14,0x1D,0xE6,0x40,0x00, + 0x00,0xFE,0x08,0x88,0x88,0x88,0x08,0xFE,0x18,0x28,0x48,0x88,0x08,0x08,0x28,0x10, + /* 0xD1C2 [?] [4546]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x20,0x2F,0x20,0x3F,0x20,0x20,0x4F,0x40,0x9F,0x00, + 0x00,0x08,0x08,0xF8,0x00,0xFC,0x80,0xF8,0x80,0xFC,0x00,0x80,0xF8,0x80,0xFE,0x00, + /* 0xD1C3 [?] [4547]*/ + 0x10,0x1F,0x22,0x42,0x8F,0x14,0x24,0x6F,0xA0,0x20,0x27,0x24,0x24,0x24,0x27,0x24, + 0x00,0xC0,0x1C,0x00,0x80,0x80,0xBE,0xC8,0x08,0x08,0x88,0x88,0x88,0x88,0xA8,0x90, + /* 0xD1C4 [?] [4548]*/ + 0x00,0x27,0x14,0x14,0x85,0x44,0x44,0x17,0x14,0x24,0xE4,0x25,0x24,0x28,0x2B,0x10, + 0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xD1C5 [?] [4549]*/ + 0x00,0x7E,0x04,0x24,0x25,0x26,0x44,0x7F,0x0C,0x14,0x14,0x24,0x44,0x84,0x14,0x08, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xD1C6 [?] [4550]*/ + 0x00,0x03,0x78,0x48,0x48,0x48,0x4C,0x4A,0x4A,0x4A,0x78,0x48,0x00,0x00,0x07,0x00, + 0x00,0xFC,0x90,0x90,0x90,0x92,0x92,0x94,0x94,0x98,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xD1C7 [?] [4551]*/ + 0x00,0x7F,0x04,0x04,0x04,0x04,0x44,0x24,0x24,0x14,0x14,0x04,0x04,0x04,0xFF,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x40,0x44,0x44,0x48,0x48,0x50,0x40,0x40,0x40,0xFE,0x00, + /* 0xD1C8 [?] [4552]*/ + 0x00,0x23,0x10,0x11,0x01,0x01,0xF2,0x13,0x10,0x10,0x10,0x15,0x1A,0x14,0x00,0x00, + 0x00,0xFC,0x10,0x10,0x10,0x10,0x10,0xFE,0x30,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xD1C9 [?] [4553]*/ + 0x00,0x7F,0x01,0x11,0x11,0x11,0xFF,0x08,0x0F,0x10,0x1F,0x00,0x29,0x24,0x40,0x00, + 0x00,0xFC,0x00,0xF8,0x00,0x00,0xFE,0x00,0xF8,0x00,0xFC,0x04,0x24,0x94,0x28,0x10, + /* 0xD1CA [?] [4554]*/ + 0x00,0x07,0xF4,0x94,0x94,0x94,0x97,0x94,0x94,0x94,0xF4,0x95,0x06,0x04,0x07,0x04, + 0x00,0xFC,0x04,0x44,0x44,0x44,0xFC,0x44,0x44,0xA4,0x94,0x14,0x04,0x04,0xFC,0x04, + /* 0xD1CB [?] [4555]*/ + 0x20,0x17,0x00,0x42,0x5F,0x44,0x49,0x71,0x4F,0x49,0x4F,0x49,0x4F,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x44,0x24,0x1C,0xE4,0x24,0xE4,0x24,0xE4,0x14,0xF4,0x08, + /* 0xD1CC [?] [4556]*/ + 0x10,0x13,0x12,0x16,0x5A,0x52,0x53,0x92,0x12,0x12,0x12,0x2A,0x27,0x42,0x43,0x82, + 0x00,0xFE,0x02,0x22,0x22,0x22,0xFE,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0xFE,0x02, + /* 0xD1CD [?] [4557]*/ + 0x00,0x20,0x17,0x11,0x82,0x44,0x43,0x12,0x12,0x23,0xE2,0x22,0x23,0x20,0x20,0x00, + 0x40,0x80,0xFE,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xD1CE [?] [4558]*/ + 0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40,0x00,0x3F,0x24,0x24,0x24,0x24,0xFF,0x00, + 0x20,0x20,0x20,0x28,0x24,0x22,0x20,0x20,0x00,0xF8,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xD1CF [?] [4559]*/ + 0x00,0x7F,0x02,0x12,0x0A,0x02,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0xFC,0x40,0x48,0x50,0x40,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD1D0 [?] [4560]*/ + 0x00,0x01,0xFC,0x10,0x10,0x20,0x3C,0x67,0x64,0xA4,0x24,0x24,0x3C,0x25,0x21,0x02, + 0x00,0xFC,0x88,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xD1D1 [?] [4561]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xA9,0xA9,0xAB,0xF8,0xA2,0x22,0x29,0x39,0xEA,0x44,0x08, + 0x04,0x0E,0xB8,0x88,0x88,0x28,0x2E,0xA8,0xA8,0xA8,0xA8,0x3E,0x00,0x80,0x7E,0x00, + /* 0xD1D2 [?] [4562]*/ + 0x01,0x21,0x21,0x21,0x3F,0x00,0x00,0x7F,0x04,0x04,0x0F,0x18,0x28,0xC8,0x0F,0x08, + 0x00,0x08,0x08,0x08,0xF8,0x00,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xD1D3 [?] [4563]*/ + 0x00,0x00,0xF9,0x08,0x10,0x11,0x21,0x79,0x09,0x09,0x49,0x31,0x10,0x2C,0x43,0x80, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0xFC,0x00,0x00,0xFE,0x00, + /* 0xD1D4 [?] [4564]*/ + 0x02,0x01,0xFF,0x00,0x00,0x3F,0x00,0x00,0x3F,0x00,0x00,0x3F,0x20,0x20,0x3F,0x20, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD1D5 [?] [4565]*/ + 0x10,0x08,0x7F,0x22,0x14,0x7F,0x44,0x48,0x52,0x44,0x48,0x51,0x42,0x44,0x88,0x30, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xD1D6 [?] [4566]*/ + 0x20,0x17,0x02,0x42,0x47,0x48,0x52,0x4C,0x48,0x48,0x4E,0x48,0x48,0x4F,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x24,0x44,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x14,0x08, + /* 0xD1D7 [?] [4567]*/ + 0x01,0x11,0x11,0x21,0x02,0x04,0x18,0x60,0x01,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x00,0x08,0x10,0x20,0xC0,0x30,0x08,0x04,0x00,0x10,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xD1D8 [?] [4568]*/ + 0x00,0x21,0x11,0x11,0x81,0x41,0x42,0x14,0x10,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x0E,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD1D9 [?] [4569]*/ + 0x02,0x02,0x7F,0x04,0x09,0x31,0xDF,0x11,0x11,0x1F,0x11,0x11,0x1F,0x01,0x01,0x00, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xF6,0x10,0x10,0xF0,0x10,0x10,0xF4,0x04,0x04,0xFC, + /* 0xD1DA [?] [4570]*/ + 0x10,0x10,0x17,0x11,0xFE,0x14,0x13,0x16,0x1A,0x33,0xD2,0x12,0x13,0x10,0x50,0x20, + 0x40,0x80,0xFE,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xD1DB [?] [4571]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x7A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x03,0x02, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xD1DC [?] [4572]*/ + 0x10,0x12,0x21,0x41,0x80,0x14,0x22,0x62,0xA0,0x21,0x27,0x21,0x21,0x21,0x21,0x20, + 0x00,0x00,0x1C,0x00,0x00,0x00,0x3E,0x88,0x88,0x08,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xD1DD [?] [4573]*/ + 0x00,0x20,0x17,0x14,0x80,0x43,0x40,0x13,0x12,0x23,0xE2,0x23,0x20,0x21,0x22,0x04, + 0x80,0x40,0xFC,0x04,0x00,0xF8,0x40,0xF8,0x48,0xF8,0x48,0xF8,0x00,0x10,0x08,0x04, + /* 0xD1DE [?] [4574]*/ + 0x10,0x10,0x10,0xFD,0x12,0x15,0x11,0x7D,0x11,0x11,0x11,0xFD,0x11,0x11,0x10,0x10, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xD1DF [?] [4575]*/ + 0x20,0x23,0x22,0x22,0x22,0xFA,0x22,0x22,0x22,0x23,0x22,0x3A,0xE2,0x42,0x02,0x03, + 0x00,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x20,0xFE,0x48,0xC8,0x30,0x48,0x84,0xFE, + /* 0xD1E0 [?] [4576]*/ + 0x04,0xFF,0x04,0x04,0x17,0x10,0xF0,0x17,0x14,0x34,0xD7,0x10,0x00,0x48,0x44,0x84, + 0x40,0xFE,0x40,0x40,0xD0,0x12,0x1C,0xD0,0x50,0x52,0xD2,0x0E,0x00,0x88,0x44,0x44, + /* 0xD1E1 [?] [4577]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x2F,0x20,0x21,0x21,0x22,0x22,0x44,0x48,0x90, + 0x00,0xFE,0x00,0x80,0x90,0x88,0x80,0xFC,0x80,0x40,0x40,0x20,0x20,0x10,0x08,0x06, + /* 0xD1E2 [?] [4578]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x24,0x24,0x3C,0x25,0x22,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xD1E3 [?] [4579]*/ + 0x00,0x3F,0x20,0x22,0x22,0x24,0x24,0x2D,0x36,0x24,0x24,0x24,0x24,0x44,0x44,0x84, + 0x00,0xFE,0x00,0x50,0x48,0xFE,0x90,0x90,0xFE,0x90,0x90,0xFE,0x90,0x90,0xFE,0x80, + /* 0xD1E4 [?] [4580]*/ + 0x00,0x00,0x7B,0x48,0x48,0x49,0x48,0x48,0x49,0x48,0x78,0x49,0x01,0x01,0x01,0x01, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD1E5 [?] [4581]*/ + 0x02,0x01,0x3F,0x08,0x04,0x3F,0x20,0x20,0x21,0x2E,0x20,0x21,0x2E,0x40,0x43,0x9C, + 0x00,0x00,0xF8,0x20,0x40,0xFC,0x00,0x20,0xC0,0x10,0x60,0x88,0x10,0x60,0x80,0x00, + /* 0xD1E6 [?] [4582]*/ + 0x10,0x10,0x10,0x14,0x59,0x52,0x50,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x81, + 0x40,0x40,0x7C,0x84,0x08,0x00,0x20,0xCE,0x02,0x02,0xCE,0x02,0x02,0x02,0xFE,0x02, + /* 0xD1E7 [?] [4583]*/ + 0x02,0x01,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x04,0xFF,0x08,0x1C,0x03,0x0C,0x30, + 0x00,0x00,0xFE,0x02,0xF4,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xD1E8 [?] [4584]*/ + 0x00,0x20,0x13,0x10,0x01,0x00,0xF3,0x12,0x12,0x12,0x12,0x16,0x1A,0x14,0x04,0x09, + 0x40,0x20,0xFC,0x00,0x08,0x90,0xFE,0x10,0x20,0xC8,0x10,0x24,0xC8,0x10,0x60,0x80, + /* 0xD1E9 [?] [4585]*/ + 0x00,0xF8,0x08,0x48,0x48,0x49,0x4A,0x7C,0x04,0x04,0x1D,0xE4,0x44,0x04,0x2B,0x10, + 0x20,0x20,0x50,0x50,0x88,0x04,0xFA,0x00,0x44,0x24,0x24,0xA8,0x88,0x10,0xFE,0x00, + /* 0xD1EA [?] [4586]*/ + 0x00,0x00,0xFC,0x21,0x21,0x3D,0x45,0x45,0x65,0x97,0x08,0x08,0x10,0x20,0x41,0x82, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xD1EB [?] [4587]*/ + 0x01,0x01,0x01,0x1F,0x11,0x11,0x11,0x11,0x11,0xFF,0x02,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFE,0x80,0x80,0x40,0x20,0x18,0x06, + /* 0xD1EC [?] [4588]*/ + 0x01,0x1F,0x11,0x11,0xFF,0x02,0x1C,0xE2,0x04,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x00,0xF0,0x10,0x10,0xFE,0x80,0x70,0x0E,0x00,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xD1ED [?] [4589]*/ + 0x08,0x1C,0xF0,0x11,0x11,0xFD,0x11,0x31,0x39,0x57,0x54,0x90,0x10,0x10,0x11,0x12, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xD1EE [?] [4590]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x31,0x38,0x54,0x54,0x91,0x11,0x12,0x14,0x10,0x11, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xD1EF [?] [4591]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x11,0x14,0x18,0x30,0xD1,0x11,0x12,0x14,0x50,0x21, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xD1F0 [?] [4592]*/ + 0x0A,0x09,0x09,0x10,0x17,0x30,0x30,0x53,0x90,0x10,0x17,0x10,0x10,0x10,0x10,0x10, + 0x08,0x08,0x10,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xD1F1 [?] [4593]*/ + 0x00,0x00,0x1F,0x10,0x93,0x50,0x50,0x11,0x33,0x51,0x91,0x12,0x22,0x24,0x48,0x81, + 0x80,0x40,0xFE,0x00,0xF0,0x20,0xC0,0x00,0xFC,0x24,0x24,0x24,0x44,0x44,0xA8,0x10, + /* 0xD1F2 [?] [4594]*/ + 0x08,0x04,0x04,0x7F,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x20,0x20,0x40,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xD1F3 [?] [4595]*/ + 0x02,0x21,0x11,0x10,0x87,0x40,0x40,0x13,0x10,0x20,0xE7,0x20,0x20,0x20,0x20,0x00, + 0x08,0x08,0x10,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xD1F4 [?] [4596]*/ + 0x00,0x7C,0x45,0x49,0x49,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x51,0x41,0x41,0x41, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD1F5 [?] [4597]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x11,0x0A,0x7F,0x04,0x3F,0x04,0xFF,0x04,0x04,0x04, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0xD0,0x10,0x90,0x12,0xEA,0x0A,0x06,0x02, + /* 0xD1F6 [?] [4598]*/ + 0x08,0x08,0x0B,0x12,0x12,0x32,0x32,0x52,0x92,0x12,0x12,0x13,0x12,0x10,0x10,0x10, + 0x00,0x80,0x3C,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xB4,0x28,0x20,0x20,0x20,0x20, + /* 0xD1F7 [?] [4599]*/ + 0x00,0x00,0x1F,0x11,0x90,0x57,0x50,0x10,0x33,0x50,0x90,0x17,0x20,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x10,0xA0,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40,0x40, + /* 0xD1F8 [?] [4600]*/ + 0x08,0x04,0x00,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x08,0x34,0xC4,0x04,0x08,0x10,0x20, + 0x20,0x40,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0x58,0x46,0x40,0x40,0x40,0x40, + /* 0xD1F9 [?] [4601]*/ + 0x11,0x10,0x10,0x10,0xFB,0x10,0x30,0x39,0x54,0x50,0x93,0x10,0x10,0x10,0x10,0x10, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xD1FA [?] [4602]*/ + 0x02,0x21,0x17,0x10,0x83,0x40,0x47,0x10,0x10,0x21,0xE0,0x27,0x21,0x22,0x2D,0x00, + 0x08,0x10,0xFC,0x40,0xF8,0x40,0xFC,0x40,0x20,0xC0,0x44,0x68,0x50,0x48,0x46,0x80, + /* 0xD1FB [?] [4603]*/ + 0x02,0x44,0x2F,0x28,0x0F,0x08,0xEF,0x22,0x3F,0x24,0x27,0x28,0x32,0x21,0x50,0x8F, + 0x00,0x10,0x90,0x90,0x9E,0xA4,0xC4,0x14,0xD4,0x08,0x88,0x94,0xA2,0x42,0x00,0xFE, + /* 0xD1FC [?] [4604]*/ + 0x00,0x7B,0x48,0x48,0x4B,0x7A,0x4A,0x4B,0x48,0x78,0x4F,0x48,0x49,0x48,0x48,0x9B, + 0x00,0xFE,0x50,0x50,0xFE,0x52,0x52,0xFE,0x00,0x40,0xFE,0x88,0x90,0x60,0xD8,0x04, + /* 0xD1FD [?] [4605]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x25,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x81,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFE,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xD1FE [?] [4606]*/ + 0x00,0x00,0xFB,0x20,0x22,0x21,0xF9,0x22,0x20,0x23,0x20,0x39,0xE1,0x41,0x01,0x00, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0xFC,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xD2A1 [?] [4607]*/ + 0x10,0x10,0x13,0x10,0xFA,0x11,0x11,0x1A,0x30,0xD3,0x10,0x11,0x11,0x11,0x51,0x20, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0xFC,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xD2A2 [?] [4608]*/ + 0x02,0x02,0x02,0x7F,0x01,0x00,0x07,0x38,0x00,0xFF,0x04,0x04,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFC,0x20,0x40,0x84,0x64,0x1C,0x00,0xFE,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xD2A3 [?] [4609]*/ + 0x00,0x23,0x10,0x12,0x01,0x01,0xF2,0x10,0x13,0x10,0x11,0x11,0x11,0x11,0x28,0x47, + 0x3C,0xC0,0x04,0x44,0x28,0xFC,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x00,0xFE, + /* 0xD2A4 [?] [4610]*/ + 0x02,0x01,0x7F,0x48,0x90,0x20,0x08,0x1F,0x21,0x01,0xFF,0x01,0x21,0x21,0x3F,0x00, + 0x00,0x00,0xFE,0x22,0x14,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00,0x08,0x08,0xF8,0x08, + /* 0xD2A5 [?] [4611]*/ + 0x00,0x20,0x13,0x10,0x02,0x01,0xF1,0x12,0x10,0x13,0x10,0x11,0x15,0x19,0x11,0x00, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0xFC,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xD2A6 [?] [4612]*/ + 0x20,0x20,0x20,0x22,0xF9,0x48,0x48,0x49,0x8A,0x4C,0x30,0x10,0x29,0x49,0x82,0x04, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xD2A7 [?] [4613]*/ + 0x00,0x00,0xF0,0x97,0x90,0x91,0x92,0x94,0x91,0x91,0xF0,0x90,0x00,0x01,0x02,0x0C, + 0x80,0x40,0x40,0xFC,0x00,0x10,0x08,0x04,0x10,0x10,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xD2A8 [?] [4614]*/ + 0x00,0x7F,0x02,0x21,0x11,0x10,0x0C,0x30,0x20,0x20,0x3C,0x20,0x20,0x20,0x3F,0x20, + 0xFC,0x00,0x08,0x08,0x10,0x20,0x00,0x78,0x08,0x08,0x78,0x08,0x08,0x08,0xF8,0x08, + /* 0xD2A9 [?] [4615]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x20,0x45,0xFA,0x10,0x20,0xFC,0x00,0x1C,0xE0,0x40, + 0x40,0x40,0xFE,0x40,0x80,0x80,0xFC,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x28,0x10, + /* 0xD2AA [?] [4616]*/ + 0x00,0x7F,0x04,0x04,0x3F,0x24,0x24,0x3F,0x02,0x7F,0x04,0x08,0x1C,0x03,0x06,0x38, + 0x00,0xFC,0x40,0x40,0xF8,0x48,0x48,0xF8,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xD2AB [?] [4617]*/ + 0x10,0x11,0x90,0x55,0x58,0x11,0xFC,0x28,0x28,0x29,0x2A,0x28,0x2A,0x4C,0x48,0x80, + 0x00,0xDC,0x44,0x54,0xCC,0x54,0x00,0x48,0xFE,0x90,0xFC,0x90,0xFC,0x90,0xFE,0x80, + /* 0xD2AC [?] [4618]*/ + 0x20,0x2F,0x24,0x24,0xF4,0x27,0x24,0x74,0x6F,0xA4,0xA4,0x25,0x2E,0x20,0x20,0x20, + 0x00,0xDE,0x92,0x92,0x94,0x94,0x98,0x94,0x92,0x92,0x92,0xDA,0x94,0x90,0x90,0x90, + /* 0xD2AD [?] [4619]*/ + 0x00,0x03,0x78,0x49,0x48,0x4B,0x4A,0x49,0x48,0x49,0x79,0x49,0x01,0x00,0x03,0x00, + 0x20,0xFE,0x20,0xFC,0x00,0xFE,0x02,0xFC,0x00,0xFC,0x04,0xFC,0x04,0x88,0xFE,0x00, + /* 0xD2AE [?] [4620]*/ + 0x00,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x27,0xFA,0x42,0x02,0x02,0x02, + 0x00,0xBE,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0xA2,0x34,0x28,0x20,0x20,0x20, + /* 0xD2AF [?] [4621]*/ + 0x04,0x08,0x18,0x24,0x03,0x0C,0x30,0xC0,0x1F,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x40,0x20,0x50,0x88,0x00,0xC0,0x30,0x0E,0xF0,0x10,0x10,0x10,0x50,0x20,0x00,0x00, + /* 0xD2B0 [?] [4622]*/ + 0x00,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40, + 0x00,0x7C,0x04,0x28,0x10,0x08,0x7E,0x12,0x14,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xD2B1 [?] [4623]*/ + 0x00,0x40,0x20,0x21,0x02,0x07,0x10,0x10,0x23,0xE2,0x22,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD2B2 [?] [4624]*/ + 0x01,0x01,0x11,0x11,0x11,0x17,0x39,0xD1,0x11,0x11,0x11,0x11,0x10,0x10,0x0F,0x00, + 0x00,0x00,0x00,0x30,0xD0,0x10,0x10,0x10,0x10,0x50,0x20,0x02,0x02,0x02,0xFE,0x00, + /* 0xD2B3 [?] [4625]*/ + 0x00,0x7F,0x02,0x04,0x1F,0x10,0x11,0x11,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0x40,0x20,0x10,0x08, + /* 0xD2B4 [?] [4626]*/ + 0x10,0x10,0x17,0x11,0xFD,0x12,0x12,0x16,0x1A,0x33,0xD2,0x12,0x12,0x12,0x52,0x23, + 0x80,0x40,0xFE,0x20,0x20,0x3C,0x44,0x64,0x94,0x48,0x48,0x30,0x20,0x50,0x88,0x06, + /* 0xD2B5 [?] [4627]*/ + 0x04,0x04,0x04,0x04,0x44,0x24,0x24,0x14,0x14,0x14,0x04,0x04,0x04,0x04,0xFF,0x00, + 0x40,0x40,0x40,0x40,0x44,0x44,0x48,0x48,0x50,0x60,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xD2B6 [?] [4628]*/ + 0x00,0x00,0x78,0x48,0x48,0x48,0x4B,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD2B7 [?] [4629]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x00,0x00,0x00,0x01,0x0E,0xF0, + 0x00,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x90,0xA0,0x42,0xA2,0x1A,0x06, + /* 0xD2B8 [?] [4630]*/ + 0x00,0x78,0x4F,0x49,0x49,0x7A,0x4A,0x4E,0x4A,0x7B,0x4A,0x4A,0x4A,0x4A,0x4A,0x9B, + 0x80,0x40,0xFE,0x20,0x20,0x3C,0x44,0x64,0x94,0x48,0x48,0x30,0x20,0x50,0x88,0x06, + /* 0xD2B9 [?] [4631]*/ + 0x02,0x01,0xFF,0x08,0x08,0x10,0x11,0x31,0x52,0x95,0x11,0x10,0x10,0x10,0x11,0x16, + 0x00,0x00,0xFE,0x80,0x80,0xF8,0x08,0x48,0x28,0x10,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xD2BA [?] [4632]*/ + 0x00,0x20,0x17,0x11,0x81,0x42,0x42,0x16,0x12,0x23,0xE2,0x22,0x22,0x22,0x22,0x03, + 0x80,0x40,0xFE,0x20,0x20,0x3C,0x44,0x64,0x94,0x48,0x48,0x30,0x20,0x50,0x88,0x06, + /* 0xD2BB [?] [4633]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD2BC [?] [4634]*/ + 0x01,0x01,0x7F,0x01,0x1F,0x00,0x7F,0x40,0x9F,0x00,0x1F,0x10,0x1F,0x08,0x04,0xFF, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xFE,0x02,0xF4,0x00,0xF0,0x10,0xF0,0x20,0x40,0xFE, + /* 0xD2BD [?] [4635]*/ + 0x00,0x7F,0x44,0x44,0x4F,0x50,0x40,0x5F,0x40,0x41,0x42,0x44,0x58,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x00,0xF8,0x80,0x80,0xFC,0x80,0x40,0x20,0x10,0x08,0x00,0xFE,0x00, + /* 0xD2BE [?] [4636]*/ + 0x10,0x11,0x11,0x11,0xFD,0x10,0x17,0x15,0x19,0x31,0xD1,0x11,0x11,0x17,0x50,0x20, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x3E,0xC8,0x08,0x08, + /* 0xD2BF [?] [4637]*/ + 0x10,0x10,0x3C,0x23,0x40,0xBC,0x10,0x10,0xFD,0x12,0x14,0x10,0x14,0x18,0x10,0x00, + 0x40,0x20,0x20,0xFE,0x40,0x40,0xA0,0xA2,0xA4,0x98,0x90,0x88,0x84,0xA2,0xC0,0x80, + /* 0xD2C0 [?] [4638]*/ + 0x08,0x08,0x08,0x17,0x10,0x30,0x31,0x51,0x93,0x15,0x19,0x11,0x11,0x11,0x11,0x11, + 0x80,0x40,0x40,0xFE,0x80,0x80,0x40,0x44,0x48,0x30,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xD2C1 [?] [4639]*/ + 0x08,0x0B,0x08,0x10,0x10,0x37,0x30,0x50,0x90,0x13,0x10,0x10,0x11,0x11,0x12,0x14, + 0x00,0xF8,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0xF8,0x88,0x80,0x00,0x00,0x00,0x00, + /* 0xD2C2 [?] [4640]*/ + 0x02,0x01,0x01,0xFF,0x02,0x02,0x05,0x05,0x08,0x18,0x28,0x48,0x88,0x0A,0x0C,0x08, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x08,0x90,0xA0,0x40,0x20,0x10,0x08,0x06,0x00, + /* 0xD2C3 [?] [4641]*/ + 0x00,0x7D,0x48,0x48,0x49,0x5D,0x55,0x55,0x55,0x5D,0x49,0x49,0x48,0x7E,0x01,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xD2C4 [?] [4642]*/ + 0x01,0x01,0xFF,0x01,0x3F,0x01,0x01,0x3F,0x21,0x21,0x3F,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x84,0x4C,0x20,0x18,0x06, + /* 0xD2C5 [?] [4643]*/ + 0x00,0x23,0x12,0x13,0x00,0x0F,0xF0,0x13,0x12,0x12,0x12,0x10,0x11,0x2A,0x47,0x00, + 0x40,0xF8,0x48,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0xA0,0x10,0x08,0xFE,0x00, + /* 0xD2C6 [?] [4644]*/ + 0x08,0x1C,0xF0,0x10,0x11,0xFC,0x10,0x30,0x39,0x54,0x54,0x91,0x10,0x10,0x10,0x11, + 0x20,0x20,0x7C,0x84,0x48,0x30,0x20,0x48,0x90,0x3E,0x42,0xA4,0x18,0x10,0x60,0x80, + /* 0xD2C7 [?] [4645]*/ + 0x08,0x08,0x0A,0x12,0x12,0x31,0x31,0x51,0x90,0x10,0x10,0x10,0x10,0x11,0x12,0x14, + 0x80,0x48,0x48,0x08,0x08,0x10,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0x10,0x08,0x06, + /* 0xD2C8 [?] [4646]*/ + 0x00,0x78,0x4F,0x48,0x4B,0x78,0x4B,0x4A,0x4B,0x78,0x48,0x48,0x48,0x49,0x4A,0x9C, + 0x40,0x40,0xFC,0x40,0xF8,0x48,0xF8,0x40,0xFC,0x44,0x54,0xA8,0xA0,0x10,0x08,0x06, + /* 0xD2C9 [?] [4647]*/ + 0x40,0x4D,0x70,0x44,0x44,0x3D,0x40,0x7C,0x90,0x10,0xFE,0x10,0x28,0x25,0x45,0x82, + 0x00,0xFC,0x08,0x50,0x20,0xFE,0x24,0x28,0xA0,0xB8,0xA0,0xA0,0xE0,0x20,0x1E,0x00, + /* 0xD2CA [?] [4648]*/ + 0x00,0x20,0x13,0x12,0x82,0x42,0x43,0x12,0x12,0x22,0xE2,0x22,0x22,0x24,0x24,0x08, + 0x08,0x3C,0xC0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD2CB [?] [4649]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0xFF,0x00, + 0x00,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0xFE,0x00, + /* 0xD2CC [?] [4650]*/ + 0x20,0x20,0x27,0x20,0xFB,0x48,0x4B,0x4A,0x8B,0x48,0x30,0x10,0x28,0x49,0x82,0x04, + 0x40,0x40,0xFC,0x40,0xF8,0x48,0xF8,0x40,0xFC,0x44,0x54,0xA8,0xA0,0x10,0x08,0x06, + /* 0xD2CD [?] [4651]*/ + 0x08,0x0F,0x10,0x1F,0x00,0xFF,0x92,0x54,0xFE,0x38,0x54,0x92,0x08,0xFF,0x08,0x10, + 0x00,0xE0,0x20,0xC0,0x40,0xFE,0x24,0x78,0x12,0xFE,0x54,0x92,0x20,0xFE,0x20,0x20, + /* 0xD2CE [?] [4652]*/ + 0x20,0x20,0x23,0x20,0xF9,0x22,0x27,0x70,0x6B,0xA2,0xA2,0x22,0x23,0x20,0x20,0x20, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xFE,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xD2CF [?] [4653]*/ + 0x10,0x10,0x11,0x7D,0x55,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1C,0xE4,0x41,0x06, + 0x40,0x24,0x24,0x04,0x04,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xD2D0 [?] [4654]*/ + 0x08,0x08,0x0B,0x10,0x11,0x32,0x37,0x50,0x93,0x12,0x12,0x12,0x13,0x10,0x10,0x10, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xFE,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xD2D1 [?] [4655]*/ + 0x00,0x3F,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xD2D2 [?] [4656]*/ + 0x00,0x7F,0x00,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x10,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xD2D3 [?] [4657]*/ + 0x02,0x04,0x08,0x10,0x3F,0x08,0x08,0x1F,0x21,0x01,0x7F,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x20,0x10,0xF8,0x08,0x00,0xF0,0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06, + /* 0xD2D4 [?] [4658]*/ + 0x00,0x04,0x22,0x21,0x21,0x20,0x20,0x20,0x20,0x20,0x24,0x28,0x30,0x21,0x02,0x04, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x50,0x88,0x04,0x02,0x02, + /* 0xD2D5 [?] [4659]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x3F,0x00,0x03,0x04,0x08,0x10,0x20,0x20,0x1F,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xE0,0xC0,0x00,0x00,0x00,0x00,0x04,0x04,0xFC,0x00, + /* 0xD2D6 [?] [4660]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x12,0x16,0x1A,0x32,0xD2,0x13,0x12,0x10,0x50,0x20, + 0x00,0x80,0x3C,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xB4,0x28,0x20,0x20,0x20,0x20, + /* 0xD2D7 [?] [4661]*/ + 0x0F,0x08,0x08,0x0F,0x08,0x08,0x0F,0x04,0x08,0x1F,0x22,0x42,0x04,0x08,0x11,0x02, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xFC,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xD2D8 [?] [4662]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x1F,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x02,0x02,0xFE,0x00, + /* 0xD2D9 [?] [4663]*/ + 0x10,0x10,0x10,0x10,0x55,0x56,0x54,0x54,0x54,0x54,0x54,0x5C,0x65,0x01,0x00,0x00, + 0x40,0x40,0x80,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xD2DA [?] [4664]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x50,0x90,0x11,0x11,0x12,0x12,0x12,0x11,0x10, + 0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x80,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xD2DB [?] [4665]*/ + 0x08,0x09,0x11,0x21,0x49,0x0A,0x14,0x33,0x51,0x91,0x10,0x10,0x10,0x10,0x13,0x1C, + 0x00,0xF0,0x10,0x10,0x10,0x0E,0x00,0xF8,0x08,0x10,0x90,0xA0,0x40,0xA0,0x18,0x06, + /* 0xD2DC [?] [4666]*/ + 0x00,0x78,0x49,0x48,0x48,0x7B,0x48,0x49,0x49,0x79,0x49,0x49,0x48,0x4A,0x4A,0x9C, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x94,0x8A,0x7A, + /* 0xD2DD [?] [4667]*/ + 0x01,0x41,0x21,0x22,0x04,0x0F,0xE4,0x24,0x27,0x20,0x21,0x21,0x22,0x24,0x50,0x8F, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFC,0xA0,0x30,0x2A,0x22,0x1E,0x00,0xFE, + /* 0xD2DE [?] [4668]*/ + 0x40,0x4C,0x70,0x44,0x45,0x3C,0x40,0x7C,0x90,0x11,0xFE,0x10,0x29,0x24,0x44,0x80, + 0x20,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xD2DF [?] [4669]*/ + 0x00,0x00,0x1F,0x10,0x93,0x52,0x52,0x14,0x38,0x57,0x92,0x11,0x20,0x20,0x41,0x8E, + 0x80,0x40,0xFE,0x00,0xF0,0x10,0x10,0x0E,0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xD2E0 [?] [4670]*/ + 0x02,0x01,0x01,0xFF,0x04,0x04,0x24,0x24,0x24,0x44,0x44,0x88,0x08,0x10,0x21,0x40, + 0x00,0x00,0x00,0xFE,0x40,0x40,0x50,0x48,0x48,0x44,0x44,0x44,0x40,0x40,0x40,0x80, + /* 0xD2E1 [?] [4671]*/ + 0x02,0x01,0xFF,0x04,0x08,0x3A,0xCC,0x08,0x3F,0x24,0x28,0x37,0x24,0x27,0x20,0x20, + 0x00,0x00,0xFE,0x88,0x50,0x20,0x18,0x06,0xF8,0x48,0x28,0xD8,0x48,0xC8,0x28,0x10, + /* 0xD2E2 [?] [4672]*/ + 0x01,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x02,0x51,0x51,0x90,0x0F, + 0x00,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x04,0x12,0x12,0xF0, + /* 0xD2E3 [?] [4673]*/ + 0x10,0x08,0x7F,0x22,0x14,0xFF,0x10,0x29,0xCE,0x14,0x26,0xCD,0x15,0x24,0xD4,0x09, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xD2E4 [?] [4674]*/ + 0x10,0x10,0x13,0x10,0x18,0x54,0x50,0x50,0x90,0x11,0x11,0x12,0x12,0x12,0x11,0x10, + 0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x80,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xD2E5 [?] [4675]*/ + 0x02,0x01,0x21,0x20,0x10,0x10,0x08,0x08,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x10,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xD2E6 [?] [4676]*/ + 0x10,0x08,0x00,0xFF,0x00,0x08,0x10,0x20,0x40,0x3F,0x24,0x24,0x24,0x24,0xFF,0x00, + 0x10,0x20,0x00,0xFE,0x00,0x20,0x10,0x08,0x04,0xF8,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xD2E7 [?] [4677]*/ + 0x02,0x21,0x11,0x10,0x87,0x40,0x41,0x12,0x14,0x23,0xE2,0x22,0x22,0x22,0x2F,0x00, + 0x08,0x08,0x10,0x00,0xFC,0x00,0x10,0x08,0x04,0xF8,0xA8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xD2E8 [?] [4678]*/ + 0x01,0x21,0x11,0x11,0x01,0x01,0xF0,0x10,0x11,0x11,0x11,0x15,0x19,0x11,0x01,0x01, + 0x00,0x04,0x38,0xC0,0x02,0x02,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD2E9 [?] [4679]*/ + 0x00,0x20,0x12,0x12,0x02,0x01,0xF1,0x11,0x10,0x10,0x10,0x14,0x18,0x11,0x02,0x0C, + 0x80,0x48,0x48,0x08,0x08,0x10,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0x10,0x08,0x06, + /* 0xD2EA [?] [4680]*/ + 0x00,0x20,0x13,0x12,0x04,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x07,0x00, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00, + /* 0xD2EB [?] [4681]*/ + 0x00,0x23,0x11,0x10,0x00,0x00,0xF0,0x13,0x10,0x11,0x10,0x14,0x1B,0x10,0x00,0x00, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xD2EC [?] [4682]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x1F,0x00,0x08,0x08,0xFF,0x08,0x10,0x20,0x40, + 0x00,0xF0,0x10,0x10,0xF0,0x04,0x04,0xFC,0x00,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xD2ED [?] [4683]*/ + 0x7E,0x22,0x1A,0x62,0x02,0x3F,0x21,0x3F,0x21,0x3F,0x04,0x3F,0x04,0xFF,0x08,0x10, + 0xFC,0x44,0x34,0xC4,0x04,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xF8,0x40,0xFE,0x20,0x10, + /* 0xD2EE [?] [4684]*/ + 0x00,0x7E,0x22,0x12,0x06,0x1A,0x62,0x01,0x00,0x7F,0x00,0x10,0x08,0x04,0xFF,0x00, + 0x00,0xFC,0x44,0x24,0x0C,0x34,0xC4,0x00,0x80,0xFC,0x00,0x10,0x20,0x40,0xFE,0x00, + /* 0xD2EF [?] [4685]*/ + 0x10,0x13,0x21,0x20,0x48,0xF8,0x10,0x23,0x40,0xF9,0x40,0x00,0x1B,0xE0,0x40,0x00, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xD2F0 [?] [4686]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x21,0x21,0x2F,0x21,0x22,0x24,0x28,0x20,0x3F,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xE8,0x08,0x88,0x48,0x28,0x08,0xF8,0x08, + /* 0xD2F1 [?] [4687]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7C,0x44,0x48,0x50,0x48,0x44,0x44,0x54,0x48,0x41,0x42, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x14,0x08, + /* 0xD2F2 [?] [4688]*/ + 0x00,0x7F,0x40,0x41,0x41,0x41,0x5F,0x41,0x42,0x42,0x44,0x48,0x50,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0xF4,0x04,0x84,0x44,0x24,0x14,0x14,0x04,0xFC,0x04, + /* 0xD2F3 [?] [4689]*/ + 0x06,0x38,0x20,0x3E,0x22,0x3E,0x22,0x3E,0x20,0x3E,0x22,0x22,0x42,0x4A,0x84,0x01, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xD2F4 [?] [4690]*/ + 0x02,0x01,0x3F,0x00,0x08,0x04,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xD2F5 [?] [4691]*/ + 0x00,0x7D,0x45,0x49,0x49,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x52,0x42,0x44,0x48, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xD2F6 [?] [4692]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x81,0x01, + 0x00,0xFC,0x04,0x24,0x24,0x24,0xFC,0x24,0x24,0x54,0x4C,0x8C,0x04,0x04,0xFC,0x04, + /* 0xD2F7 [?] [4693]*/ + 0x00,0x00,0x78,0x48,0x49,0x4A,0x4C,0x48,0x48,0x4B,0x78,0x48,0x00,0x00,0x00,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x88,0x46,0x40,0x00,0xF8,0x08,0x10,0x10,0x20,0x20,0x40, + /* 0xD2F8 [?] [4694]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xD2F9 [?] [4695]*/ + 0x00,0x20,0x17,0x10,0x84,0x42,0x42,0x10,0x17,0x20,0xE0,0x2F,0x20,0x20,0x27,0x00, + 0x08,0x3C,0xC0,0x84,0x44,0x48,0x10,0x3C,0xC0,0x40,0x40,0xFE,0x40,0x40,0xFC,0x00, + /* 0xD2FA [?] [4696]*/ + 0x02,0x01,0x7F,0x40,0x9F,0x01,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x04,0x08,0x10, + 0x00,0x00,0xFE,0x02,0xF4,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x40,0x20,0x10, + /* 0xD2FB [?] [4697]*/ + 0x20,0x20,0x20,0x3E,0x44,0x48,0x81,0x10,0x10,0x10,0x10,0x12,0x14,0x18,0x11,0x02, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xD2FC [?] [4698]*/ + 0x00,0x00,0x3F,0x04,0x04,0xFF,0x04,0x04,0x3F,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x00,0x00,0xF0,0x10,0x10,0xFE,0x10,0x10,0xF0,0x10,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD2FD [?] [4699]*/ + 0x00,0x7F,0x01,0x01,0x01,0x3F,0x20,0x20,0x40,0x7F,0x01,0x01,0x01,0x01,0x0A,0x04, + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + /* 0xD2FE [?] [4700]*/ + 0x00,0x78,0x49,0x4A,0x54,0x53,0x60,0x51,0x48,0x4B,0x48,0x68,0x51,0x45,0x45,0x48, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x40,0x24,0x2A,0x0A,0xF8, + /* 0xD3A1 [?] [4701]*/ + 0x00,0x06,0x78,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0x4E,0x70,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0xA8,0x90,0x80,0x80,0x80, + /* 0xD3A2 [?] [4702]*/ + 0x08,0x08,0xFF,0x08,0x01,0x01,0x1F,0x11,0x11,0x11,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xF0,0x10,0x10,0x10,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xD3A3 [?] [4703]*/ + 0x20,0x2F,0x28,0x2A,0xFA,0x2A,0x25,0x78,0x68,0xAF,0xA1,0x22,0x23,0x20,0x21,0x2E, + 0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0x80,0xFE,0x10,0x10,0xA0,0x60,0x98,0x04, + /* 0xD3A4 [?] [4704]*/ + 0x00,0x3E,0x22,0x2A,0x2A,0x2A,0x14,0x62,0x02,0x7F,0x04,0x08,0x1C,0x03,0x06,0x38, + 0x00,0xF8,0x88,0xA8,0xA8,0xA8,0x50,0x88,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xD3A5 [?] [4705]*/ + 0x00,0x3F,0x22,0x24,0x2D,0x36,0x24,0x24,0x21,0x27,0x24,0x24,0x47,0x40,0x9F,0x00, + 0x80,0xFE,0x50,0xFC,0x90,0xFC,0x90,0xFC,0x00,0xF0,0x90,0x20,0xFC,0x04,0xD4,0x08, + /* 0xD3A6 [?] [4706]*/ + 0x01,0x00,0x3F,0x20,0x20,0x21,0x28,0x24,0x24,0x22,0x22,0x22,0x40,0x40,0x9F,0x00, + 0x00,0x80,0xFE,0x00,0x00,0x04,0x84,0x84,0x48,0x48,0x10,0x10,0x20,0x40,0xFE,0x00, + /* 0xD3A7 [?] [4707]*/ + 0x20,0x2F,0x28,0x4A,0x5A,0xFA,0x25,0x28,0x40,0xF7,0x41,0x02,0x33,0xC0,0x01,0x0E, + 0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0x80,0xFE,0x10,0x10,0xA0,0x60,0x98,0x04, + /* 0xD3A8 [?] [4708]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x80,0x3F,0x01,0x01,0x1F,0x01,0x01,0x01,0x7F, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF8,0x00,0x00,0xF0,0x00,0x40,0x20,0xFC, + /* 0xD3A9 [?] [4709]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x41,0x81,0x1F,0x11,0x11,0x1F,0x01,0x01,0x7F,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xD3AA [?] [4710]*/ + 0x08,0x08,0xFF,0x08,0x7F,0x40,0x9F,0x10,0x10,0x1F,0x00,0x3F,0x20,0x20,0x3F,0x20, + 0x20,0x20,0xFE,0x20,0xFE,0x02,0xF4,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD3AB [?] [4711]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x81,0x11,0x11,0x22,0x02,0x04,0x08,0x30,0xC0, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0x10,0x10,0xA0,0x80,0x40,0x20,0x18,0x06, + /* 0xD3AC [?] [4712]*/ + 0x20,0x21,0x21,0xF9,0xA9,0xA8,0xAB,0xAA,0xFA,0xA3,0x22,0x2A,0x3B,0xE8,0x40,0x00, + 0x00,0xF0,0x10,0x10,0xF0,0x40,0xF8,0x48,0x48,0xF8,0x48,0x48,0xFA,0x42,0x42,0x3E, + /* 0xD3AD [?] [4713]*/ + 0x00,0x20,0x13,0x12,0x02,0x02,0xF2,0x12,0x12,0x12,0x13,0x12,0x10,0x28,0x47,0x00, + 0x00,0x80,0x3C,0x24,0x24,0x24,0x24,0x24,0x24,0xB4,0x28,0x20,0x20,0x20,0xFE,0x00, + /* 0xD3AE [?] [4714]*/ + 0x01,0xFF,0x20,0x3F,0x00,0x3F,0x20,0x3F,0x00,0x77,0x54,0x75,0x55,0x75,0x52,0xB4, + 0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x00,0xDC,0x54,0x54,0x5C,0x56,0x96,0x62, + /* 0xD3AF [?] [4715]*/ + 0x00,0x3F,0x08,0x0F,0x08,0x12,0x11,0x22,0x44,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0xF0,0x10,0xA0,0xBC,0x84,0x04,0x94,0x48,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xD3B0 [?] [4716]*/ + 0x00,0x7F,0x41,0x7F,0x41,0x7F,0x08,0xFF,0x00,0x7F,0x41,0x7F,0x08,0x49,0x88,0x18, + 0x00,0x04,0x04,0x08,0x10,0x22,0x02,0xC4,0x08,0x10,0x22,0x02,0x04,0x08,0x90,0x60, + /* 0xD3B1 [?] [4717]*/ + 0x40,0x4D,0x70,0x44,0x45,0x3D,0x01,0x0D,0x71,0x11,0xFF,0x11,0x38,0x54,0x91,0x12, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xD3B2 [?] [4718]*/ + 0x00,0x01,0xFC,0x10,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3C,0x24,0x20,0x03, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xD3B3 [?] [4719]*/ + 0x00,0x00,0x78,0x49,0x49,0x49,0x79,0x49,0x49,0x4B,0x48,0x78,0x48,0x00,0x01,0x02, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xD3B4 [?] [4720]*/ + 0x02,0x02,0xF2,0x94,0x95,0x9F,0x92,0x92,0x94,0x9F,0xF4,0x90,0x01,0x0E,0x04,0x00, + 0x20,0x20,0x20,0x3C,0x44,0x44,0x84,0x24,0x14,0x94,0x04,0x04,0x84,0x04,0x28,0x10, + /* 0xD3B5 [?] [4721]*/ + 0x20,0x27,0x24,0x24,0xFC,0x27,0x24,0x2C,0x34,0xE7,0x24,0x24,0x24,0x28,0xA8,0x50, + 0x00,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x44,0x54,0x08, + /* 0xD3B6 [?] [4722]*/ + 0x10,0x17,0x14,0x24,0x24,0x67,0x64,0xA4,0x24,0x27,0x24,0x24,0x24,0x28,0x28,0x30, + 0x00,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x44,0x54,0x08, + /* 0xD3B7 [?] [4723]*/ + 0x00,0x78,0x4F,0x48,0x4A,0x7A,0x4C,0x4F,0x49,0x7A,0x4C,0x4F,0x49,0x4A,0x4C,0x98, + 0x40,0x20,0xFE,0x28,0x24,0x7E,0xC8,0x48,0x7E,0x48,0xC8,0x7E,0x48,0x48,0x7E,0x40, + /* 0xD3B8 [?] [4724]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x54,0x14,0x37,0x54,0x94,0x17,0x24,0x28,0x48,0x90, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xD3B9 [?] [4725]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x3F,0x20,0x2F,0x20,0x2F,0x28,0x2F,0x48,0x4F,0x88,0x08, + 0x80,0xFE,0x80,0xF8,0x88,0xFE,0x88,0xF8,0x80,0xF8,0x88,0xF8,0x88,0xF8,0x88,0x98, + /* 0xD3BA [?] [4726]*/ + 0x02,0x01,0xFF,0x10,0x10,0x24,0x45,0x7A,0x10,0x24,0x44,0x78,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xFE,0x50,0x48,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0xFE,0x80, + /* 0xD3BB [?] [4727]*/ + 0x00,0x7D,0x44,0x44,0x44,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01,0x01, + 0x00,0xF8,0x08,0xD0,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0x0C, + /* 0xD3BC [?] [4728]*/ + 0x10,0x11,0x10,0x7C,0x54,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x00,0xF8,0x08,0xD0,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0x0C, + /* 0xD3BD [?] [4729]*/ + 0x00,0x00,0x78,0x49,0x48,0x48,0x4B,0x48,0x48,0x48,0x79,0x49,0x02,0x04,0x00,0x00, + 0x40,0x20,0x10,0xE0,0x22,0x34,0xB8,0xB0,0xA8,0xA8,0x28,0x24,0x24,0x22,0xA0,0x40, + /* 0xD3BE [?] [4730]*/ + 0x00,0x20,0x10,0x13,0x80,0x40,0x4F,0x11,0x11,0x21,0xE2,0x24,0x28,0x30,0x21,0x00, + 0x80,0x40,0x20,0xC0,0x44,0x44,0x48,0x50,0x60,0x60,0x50,0x48,0x44,0x42,0x40,0x80, + /* 0xD3BF [?] [4731]*/ + 0x00,0x27,0x10,0x11,0x80,0x47,0x44,0x14,0x17,0x24,0xE4,0x27,0x24,0x24,0x24,0x04, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xD3C0 [?] [4732]*/ + 0x02,0x01,0x00,0x1F,0x01,0x01,0x7D,0x05,0x05,0x09,0x09,0x11,0x21,0xC1,0x05,0x02, + 0x00,0x00,0x80,0x00,0x04,0x08,0x90,0xA0,0x40,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xD3C1 [?] [4733]*/ + 0x3F,0x06,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x20,0x01,0x08,0x48,0x48,0x87,0x00, + 0xF0,0x60,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x18,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xD3C2 [?] [4734]*/ + 0x3F,0x06,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x22,0x02,0x7F,0x04,0x08,0x10,0x60, + 0xF0,0x60,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xD3C3 [?] [4735]*/ + 0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x41,0x41,0x80, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xD3C4 [?] [4736]*/ + 0x01,0x01,0x09,0x09,0x51,0x55,0x7D,0x49,0x49,0x55,0x7D,0x45,0x41,0x41,0x7F,0x00, + 0x00,0x00,0x20,0x20,0x44,0x54,0xF4,0x24,0x24,0x54,0xF4,0x14,0x04,0x04,0xFC,0x04, + /* 0xD3C5 [?] [4737]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x50,0x90,0x10,0x11,0x11,0x11,0x12,0x12,0x14, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xD3C6 [?] [4738]*/ + 0x10,0x10,0x24,0x64,0xA5,0x24,0x24,0x20,0x20,0x23,0x01,0x08,0x48,0x48,0x87,0x00, + 0x40,0x40,0x7E,0x88,0x48,0x50,0x20,0x58,0x86,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xD3C7 [?] [4739]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x90,0x10,0x11,0x11,0x11,0x12,0x12,0x14, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xD3C8 [?] [4740]*/ + 0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x20,0x10,0x10,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x82,0x82,0x7E,0x00, + /* 0xD3C9 [?] [4741]*/ + 0x01,0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x21,0x3F,0x20, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD3CA [?] [4742]*/ + 0x08,0x08,0x08,0x7F,0x49,0x49,0x49,0x49,0x7F,0x49,0x49,0x49,0x49,0x7F,0x41,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xD3CB [?] [4743]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xD3CC [?] [4744]*/ + 0x00,0x44,0x28,0x10,0x2B,0x48,0x88,0x08,0x18,0x28,0x49,0x89,0x09,0x0A,0x52,0x24, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xD3CD [?] [4745]*/ + 0x00,0x20,0x10,0x10,0x87,0x44,0x44,0x14,0x14,0x27,0xE4,0x24,0x24,0x24,0x27,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0x44,0xFC,0x04, + /* 0xD3CE [?] [4746]*/ + 0x02,0x21,0x11,0x17,0x82,0x42,0x43,0x12,0x12,0x22,0xE2,0x22,0x24,0x24,0x29,0x10, + 0x10,0x10,0x10,0xBE,0x20,0x40,0xBC,0x84,0x88,0x88,0xBE,0x88,0x88,0x88,0xA8,0x10, + /* 0xD3CF [?] [4747]*/ + 0x00,0xFF,0x04,0x04,0x7F,0x44,0x44,0x48,0x50,0x60,0x40,0x7F,0x40,0x40,0x7F,0x40, + 0x00,0xFE,0x40,0x40,0xFC,0x44,0x44,0x44,0x3C,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD3D0 [?] [4748]*/ + 0x02,0x02,0xFF,0x04,0x04,0x0F,0x08,0x18,0x2F,0x48,0x88,0x0F,0x08,0x08,0x08,0x08, + 0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xD3D1 [?] [4749]*/ + 0x02,0x02,0x02,0xFF,0x04,0x04,0x0F,0x0A,0x12,0x11,0x21,0x40,0x81,0x06,0x18,0x60, + 0x00,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x20,0x40,0x80,0x40,0x20,0x18,0x06, + /* 0xD3D2 [?] [4750]*/ + 0x02,0x02,0x02,0xFF,0x04,0x04,0x08,0x08,0x1F,0x28,0x48,0x88,0x08,0x08,0x0F,0x08, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD3D3 [?] [4751]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x30,0x51,0x93,0x15,0x19,0x11,0x11,0x11,0x11,0x11, + 0x40,0x40,0x40,0x40,0xFE,0x80,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD3D4 [?] [4752]*/ + 0x0C,0xF0,0x10,0x54,0x39,0x11,0xFD,0x11,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xD3D5 [?] [4753]*/ + 0x00,0x47,0x20,0x20,0x0F,0x01,0xE2,0x2C,0x23,0x21,0x21,0x21,0x2A,0x32,0x24,0x08, + 0x1C,0xE0,0x40,0x40,0xFE,0x50,0x48,0x46,0xF0,0x10,0x20,0x7C,0x04,0x04,0x28,0x10, + /* 0xD3D6 [?] [4754]*/ + 0x00,0x3F,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0xF0,0x10,0x10,0x20,0x20,0x20,0x40,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xD3D7 [?] [4755]*/ + 0x10,0x10,0x20,0x20,0x45,0x44,0xF8,0x08,0x10,0x10,0x28,0x44,0xFD,0x45,0x02,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xD3D8 [?] [4756]*/ + 0x00,0x23,0x10,0x10,0x00,0x00,0xF7,0x10,0x10,0x10,0x10,0x10,0x11,0x28,0x47,0x00, + 0x00,0xF8,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0xFE,0x00, + /* 0xD3D9 [?] [4757]*/ + 0x02,0x41,0x20,0x2F,0x04,0x84,0x44,0x57,0x14,0x24,0xE4,0x24,0x24,0x28,0x2A,0x11, + 0x10,0x10,0x10,0xA8,0x28,0x44,0x02,0x90,0x88,0x88,0x80,0xA0,0x90,0x88,0x88,0x00, + /* 0xD3DA [?] [4758]*/ + 0x00,0x3F,0x01,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD3DB [?] [4759]*/ + 0x00,0x3F,0x01,0x01,0xFF,0x01,0x01,0x05,0x02,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xD3DC [?] [4760]*/ + 0x10,0x10,0x11,0x12,0xFD,0x10,0x33,0x3A,0x56,0x53,0x92,0x12,0x13,0x12,0x12,0x12, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xD3DD [?] [4761]*/ + 0x01,0x01,0x01,0x3F,0x21,0x2F,0x21,0x27,0x24,0x27,0x20,0x2F,0x20,0x5F,0x42,0x9C, + 0x00,0xF8,0x00,0xFC,0x04,0xE0,0x08,0xF8,0x10,0xF0,0x00,0xF8,0x80,0xFC,0x20,0x1C, + /* 0xD3DE [?] [4762]*/ + 0x1F,0x11,0x1F,0x11,0x1F,0x01,0x3F,0x21,0x21,0x2F,0x24,0x20,0x01,0x48,0x48,0x87, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x48,0xE8,0x28,0x10,0x00,0x84,0x12,0xF2, + /* 0xD3DF [?] [4763]*/ + 0x11,0x61,0x47,0x42,0x75,0x47,0x41,0x77,0x41,0x41,0xFF,0x00,0x08,0x10,0x20,0x40, + 0x00,0x1C,0xC4,0x04,0x1C,0xC4,0x04,0xDC,0x04,0x04,0xFE,0x00,0x20,0x10,0x08,0x04, + /* 0xD3E0 [?] [4764]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x2F,0xC1,0x01,0x3F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0x80,0x40,0x20,0x10,0xE8,0x06,0x00,0xF8,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xD3E1 [?] [4765]*/ + 0x01,0x02,0x04,0x08,0x30,0xCF,0x00,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x22,0x2A,0x24, + 0x00,0x80,0x40,0x20,0x18,0xE6,0x00,0x08,0x48,0x48,0x48,0x48,0x48,0x08,0x28,0x10, + /* 0xD3E2 [?] [4766]*/ + 0x00,0x40,0x21,0x22,0x0D,0x00,0xE7,0x24,0x27,0x24,0x27,0x24,0x24,0x25,0x50,0x8F, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0x84,0xA4,0xA4,0xA4,0xA4,0x84,0x94,0x88,0x00,0xFE, + /* 0xD3E3 [?] [4767]*/ + 0x04,0x04,0x0F,0x10,0x20,0x7F,0xA1,0x21,0x3F,0x21,0x21,0x3F,0x00,0x00,0xFF,0x00, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFE,0x00, + /* 0xD3E4 [?] [4768]*/ + 0x10,0x10,0x11,0x12,0x1D,0x54,0x53,0x52,0x92,0x13,0x12,0x12,0x13,0x12,0x12,0x12, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xD3E5 [?] [4769]*/ + 0x00,0x20,0x11,0x12,0x85,0x48,0x47,0x14,0x14,0x27,0xE4,0x24,0x27,0x24,0x25,0x04, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0x88, + /* 0xD3E6 [?] [4770]*/ + 0x01,0x41,0x23,0x22,0x04,0x8F,0x54,0x54,0x17,0x24,0xE4,0x27,0x20,0x20,0x2F,0x00, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x00,0x00,0xFE,0x00, + /* 0xD3E7 [?] [4771]*/ + 0x01,0x79,0x49,0x49,0x51,0x51,0x61,0x50,0x48,0x4B,0x4A,0x6A,0x52,0x42,0x42,0x42, + 0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x22,0x2A,0xFA,0x0A,0x02,0x06, + /* 0xD3E8 [?] [4772]*/ + 0x00,0x1F,0x00,0x02,0x01,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x01, + 0x00,0xF0,0x10,0x20,0x40,0x80,0xFE,0x82,0x84,0x80,0x80,0x80,0x80,0x80,0x80,0x00, + /* 0xD3E9 [?] [4773]*/ + 0x20,0x23,0x22,0x22,0xFB,0x48,0x48,0x4B,0x88,0x48,0x37,0x10,0x28,0x49,0x82,0x04, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xD3EA [?] [4774]*/ + 0x00,0xFF,0x01,0x01,0x01,0x7F,0x41,0x41,0x49,0x45,0x41,0x49,0x45,0x41,0x41,0x40, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x44,0x24,0x04,0x44,0x24,0x04,0x14,0x08, + /* 0xD3EB [?] [4775]*/ + 0x10,0x10,0x10,0x1F,0x10,0x20,0x20,0x3F,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xC8,0x08,0x08,0x50,0x20, + /* 0xD3EC [?] [4776]*/ + 0x10,0x10,0x10,0x10,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x5D,0x64,0x00,0x00,0x00, + 0x40,0x40,0x40,0x7E,0x40,0x80,0x80,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xD3ED [?] [4777]*/ + 0x00,0x00,0x3F,0x01,0x1F,0x11,0x11,0x1F,0x01,0x7F,0x41,0x41,0x5F,0x48,0x40,0x40, + 0x10,0xF8,0x00,0x00,0xF0,0x10,0x10,0xF0,0x00,0xFC,0x04,0x24,0xF4,0x14,0x04,0x0C, + /* 0xD3EE [?] [4778]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD3EF [?] [4779]*/ + 0x00,0x47,0x20,0x20,0x03,0x00,0xE0,0x27,0x20,0x20,0x23,0x22,0x2A,0x32,0x23,0x02, + 0x00,0xFC,0x40,0x40,0xF8,0x88,0x88,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xD3F0 [?] [4780]*/ + 0x00,0x7E,0x02,0x02,0x22,0x12,0x12,0x02,0x0A,0x12,0x62,0x22,0x02,0x02,0x14,0x08, + 0x00,0xFC,0x04,0x04,0x44,0x24,0x24,0x04,0x14,0x24,0xC4,0x44,0x04,0x04,0x28,0x10, + /* 0xD3F1 [?] [4781]*/ + 0x00,0x7F,0x01,0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x20,0x10,0x10,0x00,0xFE,0x00, + /* 0xD3F2 [?] [4782]*/ + 0x20,0x20,0x20,0x27,0x20,0xF8,0x23,0x22,0x22,0x22,0x23,0x38,0xE0,0x47,0x02,0x00, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD2,0x52,0x52,0x54,0xD4,0x08,0xEA,0x1A,0x26,0x42, + /* 0xD3F3 [?] [4783]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD3F4 [?] [4784]*/ + 0x08,0x08,0xFF,0x10,0x10,0x3F,0x21,0x61,0xBF,0x21,0x21,0x3F,0x21,0x21,0x25,0x22, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xD3F5 [?] [4785]*/ + 0x00,0x01,0x78,0x48,0x48,0x48,0x48,0x4B,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xD3F6 [?] [4786]*/ + 0x00,0x23,0x12,0x13,0x02,0x03,0xF0,0x17,0x14,0x14,0x14,0x15,0x14,0x14,0x28,0x47, + 0x00,0xF8,0x48,0xF8,0x48,0xF8,0x40,0xFC,0x44,0x54,0x74,0x94,0x04,0x0C,0x00,0xFE, + /* 0xD3F7 [?] [4787]*/ + 0x00,0x00,0x79,0x4A,0x4D,0x48,0x4B,0x4A,0x4A,0x4B,0x7A,0x4A,0x03,0x02,0x02,0x02, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xD3F8 [?] [4788]*/ + 0x10,0x10,0x10,0x10,0x55,0x54,0x54,0x54,0x55,0x56,0x54,0x5C,0x64,0x00,0x00,0x00, + 0x00,0x50,0x48,0x84,0x24,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xD3F9 [?] [4789]*/ + 0x14,0x14,0x27,0x49,0x91,0x11,0x2F,0x61,0xA1,0x25,0x25,0x25,0x25,0x3E,0x28,0x20, + 0x00,0x00,0xDE,0x12,0x12,0x12,0xD2,0x12,0x12,0xD2,0x12,0x1A,0xD4,0x10,0x10,0x10, + /* 0xD3FA [?] [4790]*/ + 0x01,0x02,0x0C,0x37,0xC0,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x26,0x01,0x48,0x48,0x87, + 0x00,0x80,0x60,0xD8,0x06,0x08,0x48,0x48,0x48,0x48,0x08,0x18,0x00,0x84,0x12,0xF2, + /* 0xD3FB [?] [4791]*/ + 0x14,0x12,0x21,0x49,0x08,0x14,0x22,0x41,0xBE,0x22,0x22,0x22,0x22,0x3E,0x22,0x01, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xD3FC [?] [4792]*/ + 0x00,0x94,0x52,0x22,0x50,0x9E,0x12,0x12,0x32,0x52,0x92,0x13,0x12,0x10,0xA1,0x42, + 0x20,0x28,0x24,0x24,0x20,0x20,0xFC,0x20,0x20,0x50,0xD0,0x50,0x88,0x88,0x04,0x02, + /* 0xD3FD [?] [4793]*/ + 0x02,0x01,0xFF,0x08,0x10,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x00,0x10,0xF8,0x08,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xD3FE [?] [4794]*/ + 0x22,0x11,0x11,0x00,0xFF,0x08,0x11,0x2F,0xC0,0x1F,0x00,0x1F,0x00,0x1F,0x10,0x1F, + 0x08,0x08,0x10,0x20,0xFE,0x20,0x10,0xE8,0x06,0xF0,0x00,0xF0,0x00,0xF0,0x10,0xF0, + /* 0xD4A1 [?] [4795]*/ + 0x01,0x21,0x12,0x14,0x80,0x40,0x41,0x12,0x14,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x10,0x08,0x04,0x44,0x40,0xA0,0x10,0x08,0x06,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD4A2 [?] [4796]*/ + 0x02,0x01,0x7F,0x40,0x9F,0x11,0x1F,0x11,0x1F,0x01,0x3F,0x21,0x21,0x2F,0x24,0x20, + 0x00,0x00,0xFE,0x02,0xF4,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x48,0xE8,0x28,0x10, + /* 0xD4A3 [?] [4797]*/ + 0x20,0x10,0x00,0xFC,0x09,0x10,0x10,0x34,0x59,0x94,0x14,0x10,0x10,0x10,0x10,0x10, + 0x00,0x50,0x48,0x84,0x24,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xD4A4 [?] [4798]*/ + 0x00,0xF9,0x08,0x50,0x21,0x11,0xFD,0x25,0x29,0x21,0x21,0x21,0x20,0x20,0xA1,0x42, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xD4A5 [?] [4799]*/ + 0x00,0xF8,0x09,0x53,0x25,0x11,0xFD,0x24,0x28,0x23,0x20,0x23,0x20,0x20,0xA3,0x40, + 0x80,0xF8,0x08,0xFE,0x12,0x22,0xFE,0x40,0xA2,0x54,0x98,0x34,0x54,0x92,0x50,0x20, + /* 0xD4A6 [?] [4800]*/ + 0x00,0x7C,0x05,0x24,0x24,0x24,0x24,0x3E,0x02,0x02,0x1A,0xE2,0x42,0x02,0x15,0x0A, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xD4A7 [?] [4801]*/ + 0x10,0x3E,0x42,0xA2,0x14,0x18,0xE2,0x1F,0x14,0x12,0x10,0x1F,0x00,0x7F,0x00,0x00, + 0x00,0xF8,0x88,0xAA,0x92,0x7E,0x00,0xE0,0x20,0x60,0x00,0xF8,0x08,0x88,0x28,0x10, + /* 0xD4A8 [?] [4802]*/ + 0x04,0x24,0x16,0x15,0x85,0x44,0x47,0x14,0x14,0x24,0xE5,0x25,0x26,0x28,0x28,0x10, + 0x44,0x44,0x54,0x54,0x64,0x44,0xFC,0x44,0xC4,0xE4,0x54,0x54,0x44,0x44,0x44,0x44, + /* 0xD4A9 [?] [4803]*/ + 0x00,0x7F,0x40,0x88,0x0F,0x10,0x20,0x5F,0x11,0x11,0x1F,0x02,0x04,0x08,0x10,0x60, + 0x00,0xFE,0x02,0x04,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x80,0xA0,0x92,0x82,0x7E, + /* 0xD4AA [?] [4804]*/ + 0x00,0x3F,0x00,0x00,0x00,0xFF,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x00,0xF8,0x00,0x00,0x00,0xFE,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xD4AB [?] [4805]*/ + 0x10,0x13,0x10,0x10,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE0,0x40,0x03,0x00, + 0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xD4AC [?] [4806]*/ + 0x01,0x01,0x3F,0x01,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x05,0x08,0x38,0xCA,0x0C,0x08, + 0x00,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x04,0x88,0x50,0x20,0x18,0x06, + /* 0xD4AD [?] [4807]*/ + 0x00,0x3F,0x20,0x21,0x27,0x24,0x24,0x27,0x24,0x24,0x27,0x20,0x24,0x48,0x52,0x81, + 0x00,0xFE,0x80,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x80,0x90,0x88,0x84,0x00, + /* 0xD4AE [?] [4808]*/ + 0x20,0x27,0x22,0x21,0xF8,0x23,0x20,0x28,0x37,0xE1,0x21,0x22,0x22,0x24,0xA8,0x43, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xD4AF [?] [4809]*/ + 0x20,0x20,0x21,0xFC,0x43,0x50,0x91,0xFD,0x11,0x11,0x1C,0xF0,0x51,0x16,0x10,0x10, + 0x20,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x52,0x94,0x88,0xA4,0xC2,0x80, + /* 0xD4B0 [?] [4810]*/ + 0x00,0x7F,0x40,0x4F,0x40,0x40,0x5F,0x44,0x44,0x44,0x48,0x48,0x50,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0xE4,0x04,0x04,0xF4,0x84,0x84,0x84,0x94,0x94,0x74,0x04,0xFC,0x04, + /* 0xD4B1 [?] [4811]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x20,0x20,0x21,0x21,0x21,0x02,0x04,0x18,0xE0, + 0x00,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xC0,0x30,0x08,0x04, + /* 0xD4B2 [?] [4812]*/ + 0x00,0x7F,0x40,0x4F,0x48,0x4F,0x40,0x5F,0x50,0x51,0x51,0x52,0x44,0x48,0x7F,0x40, + 0x00,0xFC,0x04,0xE4,0x24,0xE4,0x04,0xF4,0x14,0x14,0x14,0x94,0x44,0x24,0xFC,0x04, + /* 0xD4B3 [?] [4813]*/ + 0x00,0x90,0x53,0x20,0x57,0x90,0x13,0x12,0x32,0x53,0x90,0x11,0x13,0x1D,0xA1,0x41, + 0x40,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x08,0xF8,0xA4,0x28,0x10,0x48,0x86,0x00, + /* 0xD4B4 [?] [4814]*/ + 0x00,0x27,0x14,0x14,0x85,0x45,0x45,0x15,0x15,0x25,0xE4,0x24,0x29,0x2A,0x30,0x00, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xD4B5 [?] [4815]*/ + 0x10,0x10,0x21,0x21,0x48,0xFB,0x10,0x20,0x43,0xF8,0x40,0x03,0x18,0xE0,0x43,0x00, + 0x80,0xFC,0x04,0xF8,0x08,0xFE,0x40,0xA2,0x34,0x58,0x94,0x34,0x52,0x90,0x50,0x20, + /* 0xD4B6 [?] [4816]*/ + 0x00,0x23,0x10,0x10,0x00,0x07,0xF1,0x11,0x11,0x11,0x11,0x12,0x12,0x14,0x28,0x47, + 0x00,0xF8,0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x24,0x24,0x24,0x1C,0x00,0xFE, + /* 0xD4B7 [?] [4817]*/ + 0x04,0x04,0xFF,0x04,0x10,0x1E,0x12,0x22,0x22,0x52,0x8C,0x04,0x08,0x10,0x20,0x40, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x88,0x88,0x88,0xA8,0x90,0x82,0x82,0x82,0x7E,0x00, + /* 0xD4B8 [?] [4818]*/ + 0x00,0x3F,0x20,0x27,0x24,0x27,0x24,0x27,0x22,0x24,0x29,0x20,0x20,0x4A,0x4A,0x91, + 0x00,0xFE,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x50,0x48,0x44,0x80,0x44,0x42,0x12,0xF0, + /* 0xD4B9 [?] [4819]*/ + 0x10,0x10,0x3E,0x42,0xA2,0x14,0x08,0x10,0x20,0xC0,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xF8,0x88,0x88,0xA8,0x90,0x84,0x84,0x7C,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xD4BA [?] [4820]*/ + 0x00,0x78,0x4B,0x52,0x54,0x61,0x50,0x48,0x4B,0x48,0x68,0x50,0x41,0x41,0x42,0x44, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xD4BB [?] [4821]*/ + 0x00,0x00,0x7F,0x40,0x40,0x40,0x40,0x7F,0x40,0x40,0x40,0x40,0x7F,0x40,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xE4,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x00, + /* 0xD4BC [?] [4822]*/ + 0x10,0x10,0x20,0x24,0x45,0xFA,0x10,0x21,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xD4BD [?] [4823]*/ + 0x10,0x10,0x10,0x7D,0x11,0x11,0xFD,0x11,0x11,0x51,0x5D,0x51,0x70,0x50,0x4F,0x80, + 0x28,0x24,0x20,0xFC,0x20,0x24,0x24,0x28,0x28,0x10,0x94,0x2C,0x44,0x00,0xFE,0x00, + /* 0xD4BE [?] [4824]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7C,0x13,0x10,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x01,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFE,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xD4BF [?] [4825]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x04,0x04,0x14,0x08, + /* 0xD4C0 [?] [4826]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0xFF,0x01,0x01,0x21,0x21,0x21,0x3F,0x00, + 0x70,0x80,0x00,0x00,0xF8,0x80,0x80,0x80,0xFE,0x00,0x00,0x08,0x08,0x08,0xF8,0x08, + /* 0xD4C1 [?] [4827]*/ + 0x02,0x3F,0x29,0x25,0x2F,0x23,0x25,0x29,0x3F,0x00,0xFF,0x10,0x1F,0x00,0x00,0x00, + 0x00,0xF8,0x28,0x48,0xE8,0x88,0x48,0x28,0xF8,0x00,0xFE,0x00,0xF8,0x08,0x50,0x20, + /* 0xD4C2 [?] [4828]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x20,0x20,0x40,0x80, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xD4C3 [?] [4829]*/ + 0x12,0x11,0x11,0x10,0x1B,0x56,0x52,0x52,0x93,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x08,0x08,0x10,0x20,0xF8,0x08,0x08,0x08,0xF8,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xD4C4 [?] [4830]*/ + 0x20,0x17,0x00,0x44,0x42,0x40,0x4F,0x48,0x48,0x4F,0x42,0x42,0x44,0x48,0x50,0x40, + 0x00,0xFC,0x04,0x44,0x84,0x04,0xE4,0x24,0x24,0xE4,0x84,0x84,0x84,0x94,0x74,0x08, + /* 0xD4C5 [?] [4831]*/ + 0x10,0x10,0x10,0xFE,0x10,0x7C,0x11,0xFE,0x10,0x38,0x34,0x54,0x50,0x91,0x10,0x10, + 0x00,0xFC,0x00,0x00,0x00,0x00,0xFE,0x20,0x20,0x40,0x48,0x84,0x84,0xFE,0x82,0x02, + /* 0xD4C6 [?] [4832]*/ + 0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x02,0x04,0x04,0x08,0x10,0x20,0x7F,0x20,0x00, + 0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x40,0x20,0x10,0xF8,0x08,0x08, + /* 0xD4C7 [?] [4833]*/ + 0x00,0x3E,0x22,0x22,0x3E,0x00,0x7F,0x41,0x49,0x49,0x49,0x49,0x14,0x12,0x21,0xC1, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xD4C8 [?] [4834]*/ + 0x08,0x08,0x0F,0x10,0x20,0x48,0x84,0x02,0x00,0x00,0x03,0x1C,0x08,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x24,0xC4,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xD4C9 [?] [4835]*/ + 0x00,0x7C,0x44,0x48,0x48,0x50,0x49,0x49,0x45,0x45,0x45,0x69,0x50,0x40,0x40,0x43, + 0x00,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xD4CA [?] [4836]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x3F,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x00,0x00,0x40,0x20,0x10,0xF8,0x48,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E, + /* 0xD4CB [?] [4837]*/ + 0x00,0x23,0x10,0x10,0x00,0x07,0xF0,0x10,0x11,0x12,0x17,0x12,0x10,0x28,0x47,0x00, + 0x00,0xF8,0x00,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xD4CC [?] [4838]*/ + 0x04,0x04,0xFF,0x04,0x21,0x21,0x45,0x89,0xF1,0x20,0x43,0xFA,0x02,0x1A,0xE7,0x40, + 0x40,0x40,0xFE,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0x94,0x94,0xFE,0x00, + /* 0xD4CD [?] [4839]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x00,0x7C,0x00,0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x44,0x42,0xFE,0x42,0x00, + /* 0xD4CE [?] [4840]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x00,0x7F,0x42,0x9F,0x04,0x09,0x1F,0x01,0x7F,0x01,0x01, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0x00,0xF0,0x00,0xFC,0x00,0x00, + /* 0xD4CF [?] [4841]*/ + 0x20,0x10,0x7C,0x00,0x45,0x2A,0xFE,0x00,0x7C,0x44,0x44,0x7C,0x45,0x44,0x7C,0x44, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x84,0x44,0x44,0x14,0x24,0x44,0x84,0x04,0x28,0x10, + /* 0xD4D0 [?] [4842]*/ + 0x00,0x3F,0x08,0x08,0x08,0x10,0x17,0x20,0x40,0x01,0xFF,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF0,0x10,0x20,0x3C,0x04,0xC4,0x54,0x88,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xD4D1 [?] [4843]*/ + 0x00,0x7F,0x40,0x40,0x40,0x4F,0x48,0x48,0x48,0x48,0x48,0x48,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x80,0x80,0x80,0xF8,0x88,0x88,0x88,0x88,0xA8,0x90,0x80,0x80,0xFE,0x00, + /* 0xD4D2 [?] [4844]*/ + 0x00,0x03,0xFA,0x22,0x22,0x42,0x7A,0x4A,0xCA,0x4A,0x4A,0x4A,0x7A,0x4A,0x03,0x00, + 0x00,0xFE,0x10,0x10,0x10,0xFE,0x92,0x92,0x92,0x92,0x9A,0x94,0x10,0x10,0xFE,0x00, + /* 0xD4D3 [?] [4845]*/ + 0x02,0x02,0x3F,0x04,0x04,0x08,0x11,0x61,0x01,0xFF,0x01,0x09,0x11,0x21,0x45,0x02, + 0x00,0x00,0xE0,0x20,0x22,0x22,0x1E,0x00,0x00,0xFE,0x00,0x20,0x10,0x08,0x04,0x00, + /* 0xD4D4 [?] [4846]*/ + 0x08,0x08,0x7F,0x08,0x08,0xFF,0x00,0x08,0x08,0xFF,0x18,0x2C,0x2A,0x49,0x88,0x08, + 0x40,0x48,0x44,0x44,0x40,0xFE,0x40,0x44,0x44,0x44,0x28,0x2A,0x12,0x2A,0x46,0x82, + /* 0xD4D5 [?] [4847]*/ + 0x08,0x08,0x08,0x7F,0x08,0x08,0xFF,0x00,0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x00, + 0x40,0x48,0x44,0x44,0x40,0x40,0xFE,0x40,0x44,0x44,0x28,0x2A,0x12,0x2A,0x46,0x82, + /* 0xD4D6 [?] [4848]*/ + 0x02,0x01,0x7F,0x40,0x81,0x01,0x11,0x11,0x11,0x21,0x02,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFE,0x02,0x04,0x00,0x08,0x08,0x10,0x20,0x80,0x80,0x40,0x20,0x18,0x06, + /* 0xD4D7 [?] [4849]*/ + 0x02,0x01,0x7F,0x42,0x81,0x3F,0x00,0x08,0x04,0xFF,0x01,0x01,0x7F,0x01,0x01,0x01, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0x20,0x40,0xFE,0x00,0x00,0xFC,0x00,0x00,0x00, + /* 0xD4D8 [?] [4850]*/ + 0x08,0x08,0x7F,0x08,0xFF,0x10,0x10,0xFF,0x20,0x48,0x7F,0x08,0x0F,0xF8,0x08,0x08, + 0x20,0x28,0x24,0x20,0xFE,0x20,0x24,0x24,0x24,0x28,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xD4D9 [?] [4851]*/ + 0x00,0xFF,0x01,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0xFF,0x20,0x20,0x20,0x20,0x20, + 0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x08,0x08,0x08,0x28,0x10, + /* 0xD4DA [?] [4852]*/ + 0x02,0x02,0x04,0xFF,0x08,0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0xFE,0x00,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xD4DB [?] [4853]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01, + 0x20,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xD4DC [?] [4854]*/ + 0x21,0x25,0x27,0x29,0xF7,0x23,0x25,0x29,0x30,0xE3,0x22,0x22,0x22,0x20,0xA1,0x46, + 0x08,0x28,0xBE,0x48,0xBE,0x18,0xAA,0x46,0x00,0xF8,0x08,0x48,0x48,0xB0,0x08,0x04, + /* 0xD4DD [?] [4855]*/ + 0x10,0xFE,0x20,0x48,0x7E,0x08,0x0E,0xF9,0x4A,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0xF8,0x10,0x10,0xF0,0x10,0x10,0xF0, + /* 0xD4DE [?] [4856]*/ + 0x08,0x28,0x3E,0x48,0x7E,0x14,0x25,0x46,0x81,0x1F,0x10,0x11,0x11,0x02,0x0C,0x30, + 0x10,0x50,0x7C,0x90,0xFE,0x28,0x48,0x8A,0x06,0xF0,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xD4DF [?] [4857]*/ + 0x00,0x7C,0x44,0x45,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x11,0x29,0x26,0x42,0x84, + 0x20,0x10,0x10,0xFE,0x00,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xD4E0 [?] [4858]*/ + 0x00,0x78,0x48,0x49,0x49,0x79,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x4A,0x4A,0x9C, + 0x20,0x10,0x10,0xFE,0x00,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xD4E1 [?] [4859]*/ + 0x08,0xFF,0x08,0xFF,0x10,0x3E,0x42,0x24,0x18,0xE0,0x08,0x08,0xFF,0x08,0x10,0x20, + 0x20,0xFE,0x20,0xFE,0x80,0x98,0xE0,0x84,0x84,0x7C,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xD4E2 [?] [4860]*/ + 0x00,0x2F,0x10,0x17,0x04,0x07,0xF4,0x17,0x10,0x13,0x12,0x13,0x12,0x13,0x28,0x47, + 0xA0,0xFE,0xA0,0xFC,0xA4,0xFC,0xA4,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xD4E3 [?] [4861]*/ + 0x20,0x20,0x27,0xA8,0x73,0x22,0xFB,0x22,0x73,0x68,0xA9,0x21,0x21,0x21,0x21,0x21, + 0x90,0x90,0xFE,0x90,0xFC,0x94,0xFC,0x94,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xD4E4 [?] [4862]*/ + 0x04,0x24,0x14,0x04,0xFF,0x00,0x04,0x22,0x2F,0x21,0x21,0x2F,0x21,0x21,0x3F,0x00, + 0x40,0x48,0x50,0x40,0xFE,0x00,0x40,0x88,0xE8,0x08,0x08,0xE8,0x08,0x08,0xF8,0x08, + /* 0xD4E5 [?] [4863]*/ + 0x08,0xFF,0x08,0x23,0x12,0x13,0x80,0x47,0x54,0x17,0x20,0xEF,0x21,0x22,0x2C,0x20, + 0x20,0xFE,0x20,0xF8,0x08,0xF8,0x00,0xBC,0xA4,0xBC,0x40,0xFE,0x50,0x48,0x46,0x40, + /* 0xD4E6 [?] [4864]*/ + 0x01,0x01,0xFF,0x01,0x3F,0x21,0x23,0x25,0x09,0x30,0xC6,0x01,0x00,0x0E,0x01,0x00, + 0x00,0x00,0xFE,0x00,0xF8,0x08,0x88,0x48,0x20,0x18,0x06,0x80,0x40,0x00,0x80,0x40, + /* 0xD4E7 [?] [4865]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xD4E8 [?] [4866]*/ + 0x03,0x42,0x22,0x23,0x00,0x87,0x44,0x54,0x17,0x20,0xEF,0x21,0x22,0x24,0x38,0x00, + 0xF8,0x08,0x08,0xF8,0x00,0xBC,0xA4,0xA4,0xBC,0x40,0xFE,0x60,0x50,0x48,0x46,0x40, + /* 0xD4E9 [?] [4867]*/ + 0x00,0x3F,0x12,0x09,0x04,0x03,0x1C,0xE1,0x1F,0x11,0x11,0x1F,0x11,0x01,0x7F,0x20, + 0x00,0xF0,0x10,0x20,0x40,0x80,0x70,0x0E,0xF0,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xD4EA [?] [4868]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7D,0x11,0x11,0x5D,0x50,0x53,0x50,0x5C,0xE1,0x02,0x00, + 0xF8,0x88,0x88,0xF8,0x00,0xDC,0x54,0x54,0xDC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xD4EB [?] [4869]*/ + 0x03,0x02,0xF2,0x93,0x90,0x97,0x94,0x94,0x97,0x90,0xFF,0x91,0x02,0x04,0x18,0x00, + 0xF8,0x08,0x08,0xF8,0x00,0xBC,0xA4,0xA4,0xBC,0x40,0xFE,0x60,0x50,0x48,0x46,0x40, + /* 0xD4EC [?] [4870]*/ + 0x00,0x22,0x13,0x14,0x00,0x07,0xF0,0x10,0x13,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0x40,0x40,0xF8,0x40,0x40,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xD4ED [?] [4871]*/ + 0x01,0x02,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x02,0x02,0x03,0xFE,0x02,0x02,0x01, + 0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xFC,0x00,0x04,0x04,0xFC, + /* 0xD4EE [?] [4872]*/ + 0x10,0x10,0x10,0x10,0x54,0x58,0x51,0x90,0x10,0x10,0x10,0x28,0x24,0x44,0x43,0x80, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD4EF [?] [4873]*/ + 0x10,0x10,0x10,0x14,0x58,0x51,0x51,0x91,0x11,0x10,0x13,0x28,0x24,0x41,0x42,0x80, + 0xF8,0x88,0x88,0xF8,0x00,0xDC,0x54,0x54,0xDC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xD4F0 [?] [4874]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x01,0xFF,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xD4F1 [?] [4875]*/ + 0x20,0x27,0x22,0x21,0xF0,0x20,0x21,0x26,0x30,0xE3,0x20,0x20,0x27,0x20,0xA0,0x40, + 0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x4E,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40, + /* 0xD4F2 [?] [4876]*/ + 0x00,0x7F,0x41,0x41,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x14,0x12,0x21,0x40,0x80, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x94,0x88, + /* 0xD4F3 [?] [4877]*/ + 0x00,0x27,0x12,0x11,0x80,0x40,0x41,0x16,0x10,0x23,0xE0,0x20,0x27,0x20,0x20,0x00, + 0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x4E,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40, + /* 0xD4F4 [?] [4878]*/ + 0x00,0x7C,0x44,0x45,0x54,0x54,0x54,0x54,0x57,0x54,0x54,0x10,0x28,0x25,0x41,0x82, + 0x14,0x12,0x10,0xFE,0x10,0x90,0x92,0x92,0xF2,0x94,0x94,0x88,0x8A,0x1A,0x26,0x42, + /* 0xD4F5 [?] [4879]*/ + 0x08,0x08,0x0F,0x14,0x24,0x47,0x04,0x04,0x07,0x04,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0x00,0xFC,0x00,0x00,0xF0,0x00,0x00,0xF8,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xD4F6 [?] [4880]*/ + 0x22,0x21,0x20,0x27,0x24,0xFD,0x24,0x24,0x27,0x20,0x23,0x3A,0xE3,0x42,0x03,0x02, + 0x08,0x10,0x00,0xFC,0x44,0x54,0xE4,0x44,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xD4F7 [?] [4881]*/ + 0x11,0x10,0x10,0x13,0x1A,0x56,0x52,0x52,0x93,0x10,0x11,0x11,0x11,0x11,0x11,0x11, + 0x04,0x88,0x00,0xFE,0x22,0xAA,0x72,0x22,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xD4F8 [?] [4882]*/ + 0x08,0x04,0x3F,0x21,0x29,0x25,0x3F,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x40,0xF8,0x08,0x28,0x48,0xF8,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xD4F9 [?] [4883]*/ + 0x00,0x7C,0x44,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x54,0x10,0x28,0x24,0x44,0x80, + 0x88,0x48,0x50,0xFC,0x24,0xAC,0x74,0x24,0xFC,0x00,0xF8,0x88,0xF8,0x88,0xF8,0x88, + /* 0xD4FA [?] [4884]*/ + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x12,0x1C,0x30,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xD4FB [?] [4885]*/ + 0x00,0x00,0xF7,0x90,0x91,0x92,0x94,0x93,0x92,0x93,0xF2,0x93,0x02,0x00,0x0F,0x00, + 0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xD4FC [?] [4886]*/ + 0x00,0x20,0x17,0x10,0x81,0x42,0x44,0x13,0x12,0x23,0xE2,0x23,0x22,0x20,0x2F,0x00, + 0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xD4FD [?] [4887]*/ + 0x08,0x08,0x08,0x08,0xFE,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08,0x08,0x08, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xD4FE [?] [4888]*/ + 0x10,0x10,0x10,0xFE,0x20,0x28,0x48,0x7E,0x08,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xD5A1 [?] [4889]*/ + 0x20,0x23,0x3A,0x22,0x42,0x7A,0xA2,0x22,0xFA,0x22,0x22,0x20,0x29,0x31,0x22,0x04, + 0x02,0xE2,0x22,0x2A,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x82,0x42,0x22,0x0A,0x04, + /* 0xD5A2 [?] [4890]*/ + 0x20,0x17,0x00,0x40,0x4F,0x49,0x49,0x4F,0x49,0x49,0x4F,0x49,0x41,0x41,0x41,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x24,0x04,0x04,0x14,0x08, + /* 0xD5A3 [?] [4891]*/ + 0x00,0x00,0x7B,0x48,0x48,0x78,0x4B,0x48,0x78,0x48,0x48,0x48,0x79,0x4A,0x04,0x00, + 0x08,0x3C,0xC0,0x00,0x40,0x20,0xFC,0x08,0x10,0x20,0x40,0x80,0x00,0x80,0x7E,0x00, + /* 0xD5A4 [?] [4892]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x3B,0x55,0x51,0x91,0x11,0x11,0x12,0x12,0x14, + 0x00,0xDC,0x54,0x54,0x54,0x54,0x54,0xFE,0x54,0x54,0x54,0x54,0x54,0xD4,0x24,0x4C, + /* 0xD5A5 [?] [4893]*/ + 0x10,0x10,0x13,0x12,0xFD,0x10,0x30,0x39,0x56,0x50,0x90,0x10,0x10,0x10,0x10,0x10, + 0x40,0x20,0xFE,0x8A,0x04,0x80,0xFE,0x40,0x40,0x7C,0x40,0x40,0x7E,0x40,0x40,0x40, + /* 0xD5A6 [?] [4894]*/ + 0x01,0x01,0x79,0x49,0x4A,0x4A,0x4C,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80, + /* 0xD5A7 [?] [4895]*/ + 0x08,0x08,0x0F,0x12,0x12,0x22,0x43,0x82,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x02, + 0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0x00, + /* 0xD5A8 [?] [4896]*/ + 0x11,0x11,0x11,0x15,0x5A,0x52,0x54,0x90,0x10,0x10,0x10,0x28,0x24,0x44,0x40,0x80, + 0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80, + /* 0xD5A9 [?] [4897]*/ + 0x01,0x21,0x11,0x11,0x02,0x02,0xF4,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80, + /* 0xD5AA [?] [4898]*/ + 0x20,0x20,0x27,0x21,0xF8,0x27,0x24,0x2D,0x34,0xE5,0x25,0x25,0x25,0x24,0xA4,0x44, + 0x80,0x40,0xFC,0x10,0xA0,0xFC,0x44,0xF4,0x44,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xD5AB [?] [4899]*/ + 0x02,0x01,0x7F,0x08,0x04,0x03,0x1C,0xE0,0x1F,0x02,0x04,0x3F,0x24,0x24,0x24,0x20, + 0x00,0x00,0xFC,0x20,0x40,0x80,0x70,0x0E,0xF0,0x00,0x00,0xF8,0x88,0x88,0xA8,0x10, + /* 0xD5AC [?] [4900]*/ + 0x02,0x01,0x7F,0x40,0x80,0x00,0x03,0x3E,0x02,0x03,0xFE,0x02,0x02,0x02,0x01,0x00, + 0x00,0x00,0xFE,0x02,0x04,0x20,0xF0,0x00,0x00,0xFC,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xD5AD [?] [4901]*/ + 0x02,0x01,0x7F,0x48,0x90,0x28,0x0F,0x14,0x24,0x47,0x04,0x04,0x07,0x04,0x04,0x04, + 0x00,0x00,0xFE,0x22,0x14,0x08,0xF8,0x00,0x00,0xF0,0x00,0x00,0xF8,0x00,0x00,0x00, + /* 0xD5AE [?] [4902]*/ + 0x08,0x08,0x0F,0x10,0x13,0x30,0x37,0x50,0x93,0x12,0x12,0x12,0x12,0x10,0x11,0x16, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0x48,0xA0,0x10,0x08, + /* 0xD5AF [?] [4903]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x11,0x2F,0xC1,0x09,0x11,0x25,0x02, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0x10,0xE8,0x06,0x20,0x10,0x08,0x00, + /* 0xD5B0 [?] [4904]*/ + 0x01,0x01,0x7A,0x4F,0x4A,0x7B,0x4B,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x4C,0x04,0x08, + 0x00,0xF8,0x08,0xFE,0x88,0x24,0xFE,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x84,0xFC,0x84, + /* 0xD5B1 [?] [4905]*/ + 0x08,0x1C,0x70,0x10,0x10,0x1C,0x70,0x11,0x11,0x1D,0xF1,0x11,0x11,0x10,0x0F,0x00, + 0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xF8,0x08,0x08,0x08,0xFA,0x0A,0x02,0xFE,0x00, + /* 0xD5B2 [?] [4906]*/ + 0x08,0x0F,0x10,0x3F,0x65,0xA8,0x3F,0x20,0x27,0x20,0x27,0x20,0x27,0x44,0x47,0x84, + 0x00,0xF0,0x20,0xFE,0x08,0x84,0xFE,0x00,0xF8,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x08, + /* 0xD5B3 [?] [4907]*/ + 0x10,0x10,0x94,0x54,0x58,0x10,0xFC,0x30,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5B4 [?] [4908]*/ + 0x00,0x20,0x10,0x10,0x80,0x40,0x48,0x08,0x13,0x12,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5B5 [?] [4909]*/ + 0x02,0x02,0x03,0x7E,0x03,0xFE,0x01,0x03,0x1C,0xE0,0x00,0x3F,0x24,0x24,0x24,0xFF, + 0x40,0x20,0xF8,0x00,0xFC,0x10,0x60,0x82,0x62,0x1E,0x00,0xF8,0x48,0x48,0x48,0xFE, + /* 0xD5B6 [?] [4910]*/ + 0x20,0x20,0x21,0xFD,0x41,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD5B7 [?] [4911]*/ + 0x20,0x23,0x22,0xFA,0x43,0x52,0x92,0xFE,0x12,0x12,0x1F,0xF2,0x52,0x14,0x14,0x18, + 0x00,0xFC,0x04,0x04,0xFC,0x48,0x48,0xFC,0x48,0x48,0xFE,0xA4,0xA8,0x90,0xC8,0x86, + /* 0xD5B8 [?] [4912]*/ + 0x01,0x21,0x21,0x3F,0x10,0x10,0xFE,0x20,0x48,0x7E,0x08,0x0E,0xF8,0x49,0x09,0x0A, + 0x00,0x08,0x08,0xF8,0x00,0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xD5B9 [?] [4913]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x22,0x22,0x2F,0x22,0x22,0x3F,0x24,0x24,0x45,0x46,0x84, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xF8,0x20,0x20,0xFE,0x88,0x50,0x30,0x0E,0x00, + /* 0xD5BA [?] [4914]*/ + 0x08,0xFF,0x08,0x00,0xFE,0x10,0x11,0x7C,0x54,0x54,0x6C,0x44,0x7C,0x45,0x7D,0x46, + 0x20,0xFE,0x20,0x50,0x48,0xFE,0x90,0xFC,0x90,0xFC,0x90,0xFE,0x80,0x54,0x2A,0x2A, + /* 0xD5BB [?] [4915]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x39,0x54,0x50,0x90,0x10,0x10,0x10,0x13,0x10, + 0x50,0x48,0x40,0x5C,0xE0,0x40,0x5E,0xE0,0x44,0x48,0x30,0x22,0x52,0x8A,0x06,0x02, + /* 0xD5BC [?] [4916]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x20,0x20,0x20,0x20,0x3F,0x20, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD5BD [?] [4917]*/ + 0x10,0x10,0x10,0x1E,0x10,0x10,0x11,0x10,0x7E,0x42,0x42,0x42,0x42,0x7E,0x42,0x01, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xD5BE [?] [4918]*/ + 0x10,0x08,0x08,0x7E,0x00,0x04,0x44,0x44,0x25,0x29,0x29,0x0F,0xF1,0x41,0x01,0x01, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5BF [?] [4919]*/ + 0x01,0x21,0x17,0x11,0x81,0x41,0x49,0x09,0x11,0x17,0xE2,0x22,0x23,0x22,0x23,0x00, + 0x08,0x08,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x50,0x88,0x04,0x00,0xFC,0x00, + /* 0xD5C0 [?] [4920]*/ + 0x10,0x10,0x23,0x22,0x4C,0xF8,0x13,0x20,0x40,0xF9,0x41,0x01,0x1A,0xE2,0x44,0x08, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xD5C1 [?] [4921]*/ + 0x10,0x11,0x10,0x10,0xFB,0x10,0x31,0x39,0x55,0x51,0x91,0x10,0x13,0x10,0x10,0x10, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xD5C2 [?] [4922]*/ + 0x02,0x01,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x01,0x01, + 0x00,0x00,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0x00, + /* 0xD5C3 [?] [4923]*/ + 0x10,0x08,0x7F,0x22,0x14,0xFF,0x00,0x7F,0x41,0x7F,0x41,0x7F,0x08,0xFF,0x08,0x08, + 0x00,0x04,0x04,0x08,0x10,0xA2,0x02,0x04,0x08,0x10,0x22,0x02,0x04,0x88,0x10,0x60, + /* 0xD5C4 [?] [4924]*/ + 0x00,0x27,0x11,0x10,0x8F,0x40,0x43,0x12,0x13,0x22,0xE3,0x20,0x2F,0x20,0x20,0x00, + 0x40,0xFC,0x10,0xA0,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFE,0x40,0x40,0x40, + /* 0xD5C5 [?] [4925]*/ + 0x01,0xF9,0x09,0x09,0x09,0x79,0x41,0x47,0x41,0x79,0x09,0x09,0x09,0x09,0x51,0x21, + 0x00,0x08,0x08,0x10,0x20,0x40,0x00,0xFE,0x40,0x20,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xD5C6 [?] [4926]*/ + 0x11,0x09,0x3F,0x20,0x4F,0x08,0x0F,0x00,0x3F,0x01,0x3F,0x01,0x7F,0x01,0x05,0x02, + 0x10,0x20,0xFC,0x04,0xE8,0x20,0xE0,0xF0,0x00,0x00,0xF8,0x00,0xFC,0x00,0x00,0x00, + /* 0xD5C7 [?] [4927]*/ + 0x00,0x4F,0x21,0x21,0x01,0x8F,0x48,0x58,0x18,0x2F,0xE1,0x21,0x21,0x21,0x2A,0x04, + 0x40,0x44,0x44,0x48,0x48,0x50,0x40,0xFE,0x50,0x50,0x48,0x48,0x44,0x44,0x62,0x40, + /* 0xD5C8 [?] [4928]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x30,0x39,0x55,0x54,0x90,0x10,0x10,0x10,0x11,0x16, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x50,0x20,0x50,0x88,0x06, + /* 0xD5C9 [?] [4929]*/ + 0x00,0x00,0x00,0x00,0x7F,0x00,0x10,0x10,0x08,0x04,0x02,0x01,0x02,0x04,0x18,0xE0, + 0x80,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x80,0x40,0x30,0x0E, + /* 0xD5CA [?] [4930]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x57,0x54,0x54,0x54,0x5C,0x10,0x10,0x10,0x10, + 0x80,0x84,0x84,0x88,0x90,0xA0,0x80,0xFE,0xA0,0x90,0x90,0x88,0x84,0xA2,0xC0,0x80, + /* 0xD5CB [?] [4931]*/ + 0x00,0x7C,0x44,0x54,0x54,0x54,0x54,0x55,0x54,0x54,0x54,0x10,0x28,0x24,0x44,0x80, + 0x80,0x84,0x84,0x88,0x90,0xA0,0x80,0xFE,0xA0,0xA0,0x90,0x90,0x88,0xA4,0xC2,0x80, + /* 0xD5CC [?] [4932]*/ + 0x08,0x08,0x08,0x10,0x13,0x30,0x30,0x51,0x91,0x10,0x10,0x10,0x10,0x10,0x11,0x16, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x50,0x20,0x50,0x88,0x06, + /* 0xD5CD [?] [4933]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x27,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x80,0x84,0x84,0x88,0x90,0xA0,0x80,0xFE,0xA0,0x90,0x90,0x88,0x84,0xA2,0xC0,0x80, + /* 0xD5CE [?] [4934]*/ + 0x00,0x3F,0x20,0x27,0xA1,0x6F,0x20,0x23,0x62,0xA3,0x22,0x23,0x20,0x4F,0x40,0x80, + 0x80,0xFE,0x40,0xFC,0x10,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFE,0x40,0x40, + /* 0xD5CF [?] [4935]*/ + 0x00,0x7D,0x44,0x48,0x4B,0x50,0x49,0x49,0x45,0x45,0x45,0x68,0x53,0x40,0x40,0x40, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xD5D0 [?] [4936]*/ + 0x10,0x13,0x10,0x10,0xFC,0x11,0x11,0x12,0x1C,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5D1 [?] [4937]*/ + 0x00,0x03,0x78,0x48,0x48,0x49,0x49,0x7A,0x4C,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5D2 [?] [4938]*/ + 0x10,0x10,0x10,0x10,0xFC,0x13,0x10,0x14,0x18,0x30,0xD0,0x10,0x10,0x11,0x52,0x20, + 0x90,0x88,0x88,0x80,0xBC,0xC0,0x80,0x88,0x88,0x90,0x60,0x44,0xA4,0x14,0x0C,0x04, + /* 0xD5D3 [?] [4939]*/ + 0x00,0x27,0x10,0x10,0x80,0x41,0x41,0x12,0x14,0x23,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5D4 [?] [4940]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFE,0x08,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x00,0x04,0x84,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0x00,0xFE,0x00, + /* 0xD5D5 [?] [4941]*/ + 0x00,0x7D,0x44,0x44,0x44,0x44,0x7D,0x44,0x44,0x44,0x44,0x7C,0x00,0x48,0x44,0x84, + 0x00,0xFC,0x44,0x44,0x44,0x94,0x08,0xFC,0x84,0x84,0x84,0xFC,0x00,0x88,0x44,0x44, + /* 0xD5D6 [?] [4942]*/ + 0x00,0x7F,0x44,0x7F,0x01,0x01,0x01,0x3F,0x20,0x3F,0x20,0x3F,0x01,0xFF,0x01,0x01, + 0x00,0xFC,0x44,0xFC,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x00,0x00, + /* 0xD5D7 [?] [4943]*/ + 0x04,0x04,0x44,0x24,0x14,0x14,0x04,0x0C,0x14,0x24,0x44,0x08,0x08,0x10,0x20,0x40, + 0x40,0x40,0x44,0x48,0x50,0x40,0x60,0x50,0x48,0x44,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xD5D8 [?] [4944]*/ + 0x08,0x3E,0x22,0x3E,0x20,0x41,0x9F,0x01,0xFF,0x01,0x1F,0x01,0x3F,0x01,0xFF,0x01, + 0x40,0x7E,0xA8,0x10,0x6E,0x00,0xF0,0x10,0xFE,0x10,0xF0,0x00,0xF8,0x00,0xFE,0x00, + /* 0xD5D9 [?] [4945]*/ + 0x00,0x7F,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x9F,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x50,0x20,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD5DA [?] [4946]*/ + 0x00,0x40,0x27,0x24,0x04,0x04,0xE7,0x24,0x24,0x24,0x28,0x2A,0x32,0x24,0x50,0x8F, + 0x40,0x20,0xFE,0x00,0x88,0x88,0xFE,0x88,0x88,0xF8,0x00,0xA4,0x52,0x52,0x00,0xFE, + /* 0xD5DB [?] [4947]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD5DC [?] [4948]*/ + 0x08,0x08,0x7E,0x08,0x0E,0x78,0x08,0x29,0x12,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xD5DD [?] [4949]*/ + 0x10,0x10,0xFB,0x10,0x19,0xF0,0x11,0x52,0x25,0x1F,0x11,0x11,0x1F,0x01,0x7F,0x20, + 0x80,0x80,0xF0,0x90,0x90,0x94,0x54,0x0C,0x04,0xF0,0x10,0x10,0xF0,0x08,0xFC,0x04, + /* 0xD5DE [?] [4950]*/ + 0x22,0x21,0x27,0xFA,0x24,0x4F,0x50,0x97,0xFC,0x17,0x1C,0xF7,0x54,0x14,0x14,0x15, + 0x08,0x08,0xC8,0x10,0x9E,0xD4,0x64,0x94,0x94,0x94,0x94,0x88,0x88,0x94,0xA4,0xC2, + /* 0xD5DF [?] [4951]*/ + 0x02,0x02,0x3F,0x02,0x02,0xFF,0x01,0x02,0x0F,0x18,0x28,0x4F,0x88,0x08,0x0F,0x08, + 0x00,0x08,0xD0,0x20,0x40,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xD5E0 [?] [4952]*/ + 0x20,0x20,0x39,0x20,0x40,0x7B,0xA0,0x20,0xF8,0x21,0x22,0x20,0x28,0x30,0x20,0x00, + 0x20,0x22,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xD5E1 [?] [4953]*/ + 0x08,0x08,0xFF,0x09,0x00,0x3F,0x22,0x22,0x3F,0x22,0x22,0x23,0x20,0x4A,0x49,0x91, + 0x20,0x20,0xFE,0x20,0x80,0xFC,0x20,0x20,0xFC,0x20,0x20,0xE0,0x00,0x48,0x24,0x24, + /* 0xD5E2 [?] [4954]*/ + 0x00,0x20,0x10,0x17,0x00,0x02,0xF1,0x10,0x10,0x10,0x11,0x12,0x14,0x28,0x47,0x00, + 0x80,0x40,0x40,0xFC,0x10,0x10,0x20,0xA0,0x40,0xA0,0x10,0x08,0x08,0x00,0xFE,0x00, + /* 0xD5E3 [?] [4955]*/ + 0x02,0x42,0x22,0x22,0x0F,0x82,0x42,0x52,0x13,0x2E,0xE2,0x22,0x22,0x22,0x2A,0x05, + 0x08,0x1C,0x60,0x40,0xC0,0x40,0x7E,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x08, + /* 0xD5E4 [?] [4956]*/ + 0x00,0x00,0xFC,0x10,0x11,0x12,0x7C,0x10,0x11,0x10,0x10,0x1C,0xE1,0x40,0x00,0x03, + 0x20,0x20,0x50,0x88,0x04,0x12,0x20,0x40,0x88,0x10,0x20,0x44,0x88,0x10,0x60,0x80, + /* 0xD5E5 [?] [4957]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x22,0x3E,0x22,0x22,0xFF,0x40,0x54,0x62,0x40,0x7E,0x00, + 0x08,0x48,0x28,0x28,0x08,0x48,0x28,0x28,0x0E,0x78,0x08,0x08,0x08,0x08,0x08,0x08, + /* 0xD5E6 [?] [4958]*/ + 0x01,0x01,0x7F,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x08,0x10,0x20, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xFE,0x20,0x10,0x08, + /* 0xD5E7 [?] [4959]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xFE,0x10,0x10,0xFE,0x10,0x10,0x1E,0xF0,0x40, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xD5E8 [?] [4960]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3C,0x64,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD5E9 [?] [4961]*/ + 0x00,0xF8,0x23,0x40,0x51,0x88,0xFB,0x28,0x21,0xFA,0x20,0x21,0x38,0xE0,0x43,0x00, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x34,0xE2,0x20,0xFC,0x70,0xAC,0x22,0x20, + /* 0xD5EA [?] [4962]*/ + 0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x21,0x21,0x21,0x22,0x22,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0xC0,0x30,0x08,0x04, + /* 0xD5EB [?] [4963]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x93,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD5EC [?] [4964]*/ + 0x08,0x08,0x08,0x10,0x10,0x33,0x32,0x52,0x92,0x12,0x12,0x12,0x10,0x11,0x12,0x14, + 0x40,0x40,0x7E,0x40,0x40,0xF8,0x08,0x48,0x48,0x48,0x48,0x48,0xA0,0x10,0x08,0x04, + /* 0xD5ED [?] [4965]*/ + 0x10,0x10,0x10,0x13,0xFA,0x14,0x30,0x38,0x54,0x50,0x90,0x11,0x11,0x12,0x14,0x18, + 0x40,0x40,0x40,0xFC,0x44,0x48,0x40,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xD5EE [?] [4966]*/ + 0x00,0x00,0x1F,0x10,0x90,0x51,0x52,0x14,0x30,0x53,0x90,0x10,0x23,0x20,0x40,0x87, + 0x80,0x40,0xFE,0x40,0xA0,0x10,0x08,0x26,0xC0,0x10,0x20,0xC0,0x08,0x10,0xE0,0x00, + /* 0xD5EF [?] [4967]*/ + 0x00,0x40,0x20,0x21,0x02,0x04,0xE0,0x20,0x23,0x20,0x20,0x28,0x33,0x20,0x00,0x07, + 0x40,0x40,0xA0,0x10,0x08,0x26,0x40,0x80,0x10,0x20,0x40,0x88,0x10,0x20,0xC0,0x00, + /* 0xD5F0 [?] [4968]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x20,0x2F,0x20,0x3F,0x24,0x44,0x86, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFC,0x00,0xF8,0x00,0xFC,0x48,0x30,0x0E, + /* 0xD5F1 [?] [4969]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x12,0x17,0x1A,0x32,0xD2,0x12,0x12,0x14,0x54,0x28, + 0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFC,0xA0,0xA4,0xA8,0x90,0x90,0x88,0xA4,0xC2, + /* 0xD5F2 [?] [4970]*/ + 0x20,0x20,0x3B,0x40,0x41,0x79,0xA1,0x21,0xF9,0x21,0x21,0x29,0x37,0x20,0x01,0x02, + 0x20,0x20,0xFE,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFE,0x88,0x04,0x02, + /* 0xD5F3 [?] [4971]*/ + 0x00,0x7C,0x44,0x4B,0x48,0x50,0x49,0x49,0x44,0x44,0x44,0x6B,0x50,0x40,0x40,0x40, + 0x40,0x40,0x40,0xFE,0x80,0xA0,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xD5F4 [?] [4972]*/ + 0x08,0x08,0xFF,0x08,0x1F,0x00,0x7D,0x05,0x09,0x31,0xC5,0x02,0x3F,0x00,0x24,0x42, + 0x20,0x20,0xFE,0x20,0xC0,0x44,0x88,0x50,0x20,0x18,0x06,0x00,0xF8,0x00,0x88,0x44, + /* 0xD5F5 [?] [4973]*/ + 0x10,0x10,0x11,0x12,0xF8,0x13,0x10,0x18,0x37,0xD0,0x10,0x13,0x10,0x10,0x51,0x20, + 0x80,0x80,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x44,0x40,0x40,0x80, + /* 0xD5F6 [?] [4974]*/ + 0x01,0x01,0x79,0x4A,0x4C,0x7B,0x48,0x48,0x7B,0x48,0x48,0x4B,0x78,0x48,0x01,0x00, + 0x00,0x00,0xF0,0x10,0x20,0xF8,0x48,0x48,0xFE,0x48,0x48,0xF8,0x48,0x40,0x40,0x80, + /* 0xD5F7 [?] [4975]*/ + 0x08,0x08,0x13,0x20,0x48,0x08,0x11,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x17,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD5F8 [?] [4976]*/ + 0x00,0x44,0x29,0x12,0x28,0x4B,0x88,0x08,0x1F,0x28,0x48,0x8B,0x08,0x08,0x51,0x20, + 0x80,0x80,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x44,0x40,0x40,0x80, + /* 0xD5F9 [?] [4977]*/ + 0x08,0x08,0x1F,0x20,0x40,0xBF,0x01,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0x05,0x02, + 0x00,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xFE,0x08,0x08,0xF8,0x08,0x00,0x00,0x00, + /* 0xD5FA [?] [4978]*/ + 0x10,0x10,0x13,0x10,0x18,0x54,0x51,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x17,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD5FB [?] [4979]*/ + 0x08,0x08,0xFF,0x08,0x7F,0x49,0x7F,0x2A,0x49,0x88,0x00,0x7F,0x01,0x11,0x11,0xFF, + 0x20,0x20,0xBE,0x44,0xA4,0x24,0x28,0x10,0x28,0x46,0x00,0xFC,0x00,0xF8,0x00,0xFE, + /* 0xD5FC [?] [4980]*/ + 0x10,0x11,0x10,0x10,0xFC,0x13,0x10,0x14,0x19,0x31,0xD2,0x14,0x10,0x10,0x57,0x20, + 0x00,0xFC,0x08,0x10,0x22,0xB2,0xB4,0xA8,0x28,0x24,0x22,0xA0,0x40,0x00,0xFE,0x00, + /* 0xD5FD [?] [4981]*/ + 0x00,0x7F,0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD5FE [?] [4982]*/ + 0x00,0x00,0xFF,0x08,0x08,0x08,0x48,0x4E,0x48,0x48,0x48,0x48,0x4F,0xF0,0x00,0x01, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xD6A1 [?] [4983]*/ + 0x10,0x10,0x10,0x7C,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x10,0x10,0x10,0x11, + 0x20,0x20,0x3E,0x20,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xD6A2 [?] [4984]*/ + 0x00,0x00,0x1F,0x10,0x90,0x5F,0x50,0x10,0x32,0x52,0x92,0x12,0x22,0x22,0x5F,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xD6A3 [?] [4985]*/ + 0x22,0x12,0x14,0x7F,0x08,0x08,0x08,0xFF,0x08,0x08,0x14,0x12,0x21,0x41,0x80,0x00, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0xA4,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xD6A4 [?] [4986]*/ + 0x00,0x20,0x13,0x10,0x00,0x00,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x07,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6A5 [?] [4987]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x01,0x01,0x7F,0x00,0x00,0x03,0x0C,0x30,0x48,0x87,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xF8,0x30,0xC0,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD6A6 [?] [4988]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x30,0x39,0x54,0x54,0x90,0x10,0x10,0x10,0x11,0x16, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xD6A7 [?] [4989]*/ + 0x01,0x01,0x01,0x7F,0x01,0x01,0x01,0x3F,0x10,0x08,0x04,0x02,0x01,0x06,0x18,0xE0, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0xC0,0x30,0x0E, + /* 0xD6A8 [?] [4990]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x49,0x48,0x48,0x78,0x48,0x00,0x00,0x01,0x06, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xD6A9 [?] [4991]*/ + 0x21,0x21,0x21,0xFB,0xAA,0xAC,0xA8,0xA8,0xFB,0xA0,0x20,0x29,0x39,0xEA,0x44,0x08, + 0x00,0x00,0x00,0xDE,0x92,0x92,0x92,0x92,0xF2,0x92,0x92,0x52,0x5E,0x20,0x20,0x00, + /* 0xD6AA [?] [4992]*/ + 0x20,0x20,0x20,0x7E,0x48,0x88,0x08,0x08,0xFF,0x08,0x14,0x14,0x22,0x22,0x42,0x80, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + /* 0xD6AB [?] [4993]*/ + 0x00,0x3C,0x24,0x25,0x24,0x3C,0x24,0x25,0x24,0x3C,0x24,0x24,0x24,0x44,0x55,0x8E, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xD6AC [?] [4994]*/ + 0x01,0x3D,0x25,0x25,0x25,0x3D,0x24,0x24,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x89, + 0x00,0x04,0x38,0xC0,0x02,0x02,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD6AD [?] [4995]*/ + 0x00,0x20,0x10,0x10,0x80,0x40,0x47,0x10,0x10,0x20,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xD6AE [?] [4996]*/ + 0x02,0x01,0x01,0x00,0x7F,0x00,0x00,0x00,0x00,0x01,0x02,0x04,0x18,0x24,0x43,0x00, + 0x00,0x00,0x00,0x00,0xF8,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD6AF [?] [4997]*/ + 0x10,0x10,0x21,0x25,0x45,0xF9,0x11,0x21,0x41,0xFD,0x40,0x00,0x1C,0xE1,0x42,0x04, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xD6B0 [?] [4998]*/ + 0x00,0xFF,0x24,0x24,0x3C,0x24,0x24,0x3C,0x24,0x24,0x2E,0xF4,0x44,0x04,0x04,0x05, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84,0x00,0x48,0x44,0x84,0x82,0x02, + /* 0xD6B1 [?] [4999]*/ + 0x01,0x01,0x7F,0x01,0x1F,0x10,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0xFF,0x00, + 0x00,0x00,0xFC,0x00,0xF0,0x10,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0xFE,0x00, + /* 0xD6B2 [?] [5000]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x17,0x10, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0xFE,0x00, + /* 0xD6B3 [?] [5001]*/ + 0x00,0xFC,0x23,0x20,0x20,0x3D,0x45,0x45,0x65,0x95,0x09,0x09,0x11,0x21,0x47,0x80, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0xFE,0x00, + /* 0xD6B4 [?] [5002]*/ + 0x10,0x10,0x10,0x10,0xFD,0x10,0x10,0x14,0x19,0x30,0xD0,0x10,0x10,0x11,0x52,0x24, + 0x40,0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0xC8,0x48,0xA8,0xAA,0x0A,0x06,0x02, + /* 0xD6B5 [?] [5003]*/ + 0x08,0x08,0x0F,0x10,0x10,0x33,0x32,0x53,0x92,0x13,0x12,0x13,0x12,0x12,0x1F,0x10, + 0x40,0x40,0xFC,0x40,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00, + /* 0xD6B6 [?] [5004]*/ + 0x10,0x17,0x10,0x20,0x21,0x62,0x67,0xA0,0x20,0x20,0x27,0x20,0x20,0x20,0x2F,0x20, + 0x00,0xFE,0x40,0x80,0x10,0x08,0xFC,0x44,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xD6B7 [?] [5005]*/ + 0x10,0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x07,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6B8 [?] [5006]*/ + 0x11,0x11,0x11,0x11,0xFD,0x11,0x10,0x14,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x00,0x04,0x38,0xC0,0x02,0x02,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD6B9 [?] [5007]*/ + 0x01,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD6BA [?] [5008]*/ + 0x00,0x7C,0x44,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x07,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6BB [?] [5009]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x10,0x10,0x1F,0x10,0x00,0x08,0x08,0x10,0x20,0x40, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x10,0x00,0x20,0x10,0x08,0x04,0x04, + /* 0xD6BC [?] [5010]*/ + 0x20,0x20,0x23,0x3C,0x20,0x20,0x1F,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x70,0x80,0x08,0x08,0x08,0xF8,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xD6BD [?] [5011]*/ + 0x10,0x10,0x23,0x22,0x4A,0xFA,0x12,0x23,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x43,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x06,0x02, + /* 0xD6BE [?] [5012]*/ + 0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x3F,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xD6BF [?] [5013]*/ + 0x10,0xFB,0x10,0x19,0xF0,0x11,0x52,0x24,0x1F,0x01,0x3F,0x01,0x7F,0x01,0x05,0x02, + 0x80,0xF0,0x90,0x90,0x94,0x54,0x0C,0xE4,0x00,0x00,0xF8,0x00,0xFC,0x00,0x00,0x00, + /* 0xD6C0 [?] [5014]*/ + 0x24,0x22,0x22,0x20,0xFF,0x21,0x21,0x29,0x37,0xE1,0x21,0x21,0x22,0x22,0xA4,0x48, + 0x40,0x5E,0x92,0x12,0xD4,0x14,0x18,0x14,0xF2,0x12,0x12,0x1A,0x94,0x50,0x50,0x10, + /* 0xD6C1 [?] [5015]*/ + 0x00,0x7F,0x02,0x04,0x08,0x10,0x3F,0x00,0x01,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0x20,0x10,0xF8,0x08,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xD6C2 [?] [5016]*/ + 0x00,0xFE,0x10,0x20,0x28,0x45,0xFE,0x12,0x10,0x10,0x7C,0x10,0x10,0x1E,0xF1,0x42, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xD6C3 [?] [5017]*/ + 0x7F,0x44,0x7F,0x01,0x7F,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x00, + 0xFC,0x44,0xFC,0x00,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xFE,0x00, + /* 0xD6C4 [?] [5018]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x5C,0x10,0x11,0x12,0x14, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xD6C5 [?] [5019]*/ + 0x10,0x10,0x10,0x11,0x54,0x54,0x57,0x54,0x54,0x55,0x54,0x5C,0x64,0x00,0x00,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0xFE,0x08,0x08,0xFE,0x08,0x88,0x48,0x08,0x28,0x10, + /* 0xD6C6 [?] [5020]*/ + 0x04,0x24,0x24,0x3F,0x44,0x04,0xFF,0x04,0x04,0x3F,0x24,0x24,0x26,0x25,0x04,0x04, + 0x04,0x04,0x04,0xA4,0x24,0x24,0xE4,0x24,0x24,0xA4,0xA4,0xA4,0x84,0x04,0x14,0x08, + /* 0xD6C7 [?] [5021]*/ + 0x20,0x3E,0x48,0x08,0xFF,0x14,0x22,0x40,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xD6C8 [?] [5022]*/ + 0x08,0x1C,0xF1,0x11,0x11,0xFD,0x12,0x30,0x39,0x54,0x54,0x90,0x10,0x10,0x11,0x12, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xD6C9 [?] [5023]*/ + 0x08,0x1C,0xF0,0x11,0x11,0xFF,0x15,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0xA0,0x90,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xD6CA [?] [5024]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x41,0x46,0x98, + 0x7C,0xC0,0x40,0x40,0xFE,0x40,0x40,0xFC,0x04,0x44,0x44,0x44,0xB4,0x08,0x04,0x02, + /* 0xD6CB [?] [5025]*/ + 0x02,0x04,0x0F,0x12,0x69,0x04,0x03,0x0C,0x71,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xF8,0x10,0x20,0xC0,0x00,0x00,0x00,0x10,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xD6CC [?] [5026]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x3F,0x50,0x90,0x1F,0x22,0x21,0x41,0x80, + 0x80,0x40,0xFE,0x40,0x40,0xFC,0x40,0x40,0xFE,0x10,0x10,0xFE,0x10,0x10,0x50,0x20, + /* 0xD6CD [?] [5027]*/ + 0x01,0x21,0x17,0x11,0x81,0x40,0x47,0x14,0x18,0x23,0xE2,0x22,0x22,0x22,0x20,0x00, + 0x50,0x50,0xFC,0x50,0x50,0x00,0xFE,0x42,0x44,0xF8,0x48,0x48,0x48,0x58,0x40,0x40, + /* 0xD6CE [?] [5028]*/ + 0x00,0x20,0x10,0x11,0x82,0x47,0x40,0x10,0x13,0x22,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x40,0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD6CF [?] [5029]*/ + 0x02,0x01,0x7F,0x48,0x90,0x00,0x7F,0x04,0x08,0x1F,0x01,0x01,0x3F,0x01,0x01,0xFF, + 0x00,0x00,0xFE,0x22,0x14,0x00,0xFC,0x00,0x20,0xF0,0x10,0x00,0xF8,0x00,0x00,0xFE, + /* 0xD6D0 [?] [5030]*/ + 0x01,0x01,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00, + /* 0xD6D1 [?] [5031]*/ + 0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xD6D2 [?] [5032]*/ + 0x01,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x01,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xD6D3 [?] [5033]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x10,0x14,0x18,0x10,0x00, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xD6D4 [?] [5034]*/ + 0x02,0x01,0xFF,0x01,0x3F,0x21,0x21,0x3F,0x01,0x02,0x04,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x00,0x80,0x44,0x28,0x10,0x08,0x06,0x00, + /* 0xD6D5 [?] [5035]*/ + 0x10,0x10,0x20,0x21,0x4B,0xFC,0x10,0x20,0x43,0xFC,0x40,0x00,0x18,0xE1,0x40,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xC0,0x20,0x10,0x80,0x60,0x10, + /* 0xD6D6 [?] [5036]*/ + 0x08,0x1C,0xF0,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xD6D7 [?] [5037]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x24,0x24,0x44,0x54,0x88, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xD6D8 [?] [5038]*/ + 0x00,0x00,0x3F,0x01,0xFF,0x01,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x3F,0x01,0xFF,0x00, + 0x10,0xF8,0x00,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x00,0xFE,0x00, + /* 0xD6D9 [?] [5039]*/ + 0x08,0x08,0x08,0x10,0x17,0x34,0x34,0x54,0x94,0x14,0x17,0x14,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x44,0x40,0x40,0x40,0x40, + /* 0xD6DA [?] [5040]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x28,0xC8,0x08,0x08,0x08,0x14,0x12,0x22,0x41,0x82, + 0x00,0x00,0x80,0x40,0x20,0x10,0x28,0x26,0x20,0x20,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xD6DB [?] [5041]*/ + 0x02,0x04,0x1F,0x10,0x12,0x11,0x11,0xFF,0x10,0x12,0x11,0x11,0x20,0x20,0x40,0x80, + 0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xD6DC [?] [5042]*/ + 0x00,0x3F,0x21,0x21,0x2F,0x21,0x21,0x3F,0x20,0x27,0x24,0x24,0x27,0x40,0x40,0x80, + 0x00,0xF8,0x08,0x08,0xE8,0x08,0x08,0xF8,0x08,0xC8,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xD6DD [?] [5043]*/ + 0x10,0x10,0x10,0x10,0x10,0x54,0x52,0x52,0x90,0x10,0x10,0x10,0x20,0x20,0x40,0x80, + 0x04,0x84,0x84,0x84,0x84,0xA4,0x94,0x94,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0x04, + /* 0xD6DE [?] [5044]*/ + 0x01,0x21,0x11,0x11,0x81,0x41,0x45,0x15,0x19,0x21,0xE1,0x21,0x21,0x22,0x22,0x04, + 0x04,0x24,0x24,0x24,0x24,0x24,0xB4,0x6C,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04, + /* 0xD6DF [?] [5045]*/ + 0x00,0x20,0x10,0x11,0x02,0x04,0xF3,0x10,0x10,0x10,0x11,0x10,0x14,0x18,0x13,0x00, + 0x80,0x80,0xF8,0x08,0x10,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xD6E0 [?] [5046]*/ + 0x01,0xF9,0x09,0x0D,0x0B,0x79,0x41,0x47,0x41,0x79,0x0B,0x0D,0x09,0x09,0x51,0x21, + 0x00,0x3C,0x04,0x44,0x84,0x3C,0x20,0xE0,0x20,0x3C,0x84,0x44,0x04,0x04,0x28,0x10, + /* 0xD6E1 [?] [5047]*/ + 0x20,0x20,0x20,0xFC,0x41,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xD6E2 [?] [5048]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x08,0x28,0x10, + /* 0xD6E3 [?] [5049]*/ + 0x00,0x1F,0x00,0x0F,0x00,0x1F,0x00,0x7F,0x41,0x81,0x1F,0x11,0x11,0x11,0x11,0x01, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x02,0x04,0xF0,0x10,0x10,0x50,0x20,0x00, + /* 0xD6E4 [?] [5050]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x00,0x0F,0x08,0x08,0x08,0x10,0x10,0x20,0xC0, + 0x00,0xF8,0x88,0x88,0x88,0xF8,0x00,0x00,0xC0,0x40,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xD6E5 [?] [5051]*/ + 0x20,0x20,0x3E,0x42,0x84,0x08,0xFE,0x02,0x02,0x7E,0x02,0x02,0x02,0xFF,0x02,0x00, + 0x10,0x10,0x10,0xFE,0x92,0x94,0x90,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0x28,0x44,0x82, + /* 0xD6E6 [?] [5052]*/ + 0x02,0x01,0x7F,0x40,0x81,0x01,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x20, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xD6E7 [?] [5053]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x20,0x2F,0x48,0x8F,0x08,0x0F,0x00,0x7F,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x40,0x20,0x10,0xE8,0x26,0xE0,0x20,0xE0,0x00,0xFC,0x00, + /* 0xD6E8 [?] [5054]*/ + 0x07,0xF2,0x13,0x52,0x53,0x52,0x57,0x78,0x08,0x0F,0x39,0xCA,0x08,0x09,0x2E,0x10, + 0xE0,0x5C,0xC4,0x54,0xC8,0x68,0xD4,0x64,0x3C,0xC0,0x44,0x68,0xD0,0x48,0x46,0x40, + /* 0xD6E9 [?] [5055]*/ + 0x00,0x01,0xFD,0x11,0x11,0x12,0x7C,0x13,0x10,0x10,0x10,0x1D,0xE1,0x42,0x00,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xD6EA [?] [5056]*/ + 0x10,0x11,0x11,0x11,0xFD,0x12,0x30,0x3B,0x54,0x54,0x90,0x11,0x11,0x12,0x10,0x10, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xD6EB [?] [5057]*/ + 0x10,0x11,0x11,0x7D,0x55,0x56,0x54,0x57,0x7C,0x50,0x10,0x15,0x1D,0xE6,0x40,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xD6EC [?] [5058]*/ + 0x01,0x11,0x11,0x1F,0x21,0x41,0x01,0xFF,0x03,0x05,0x09,0x11,0x21,0xC1,0x01,0x01, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x80,0x40,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xD6ED [?] [5059]*/ + 0x00,0x88,0x53,0x20,0x50,0x97,0x10,0x10,0x31,0x53,0x95,0x11,0x11,0x11,0xA1,0x41, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD6EE [?] [5060]*/ + 0x00,0x40,0x23,0x20,0x00,0x07,0xE0,0x20,0x21,0x23,0x25,0x21,0x29,0x31,0x21,0x01, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD6EF [?] [5061]*/ + 0x00,0x21,0x11,0x11,0x01,0x02,0xF0,0x13,0x10,0x10,0x10,0x15,0x19,0x12,0x00,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xD6F0 [?] [5062]*/ + 0x00,0x23,0x10,0x10,0x01,0x06,0xF0,0x11,0x16,0x10,0x11,0x16,0x10,0x28,0x47,0x00, + 0x00,0xFC,0x40,0x80,0x44,0x68,0xB0,0x28,0x68,0xA4,0x24,0x20,0xA0,0x40,0xFE,0x00, + /* 0xD6F1 [?] [5063]*/ + 0x10,0x10,0x10,0x10,0x3E,0x28,0x49,0x8A,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x40,0x40,0x40,0x40,0xFE,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xD6F2 [?] [5064]*/ + 0x10,0x10,0x10,0x11,0x55,0x59,0x51,0x91,0x11,0x11,0x10,0x28,0x24,0x45,0x40,0x80, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x28,0x24,0xFE,0x82,0x00, + /* 0xD6F3 [?] [5065]*/ + 0x02,0x02,0x3F,0x02,0xFF,0x01,0x0F,0x38,0xCF,0x08,0x08,0x0F,0x00,0x48,0x44,0x84, + 0x00,0x08,0xD0,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0x10,0xF0,0x00,0x88,0x44,0x44, + /* 0xD6F4 [?] [5066]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x14,0x19,0x30,0xD0,0x10,0x10,0x10,0x53,0x20, + 0x40,0x20,0x00,0xFE,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6F5 [?] [5067]*/ + 0x00,0x07,0xF4,0x97,0x94,0xF5,0x94,0x95,0xF5,0x95,0x94,0x97,0xF6,0x96,0x0A,0x12, + 0x00,0xFC,0x04,0xFC,0x00,0xFC,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x2A,0xFA,0x0A,0x06, + /* 0xD6F6 [?] [5068]*/ + 0x00,0x07,0xF4,0x97,0x94,0x95,0x94,0x95,0x95,0x95,0xF4,0x97,0x06,0x06,0x0A,0x12, + 0x00,0xFC,0x04,0xFC,0x00,0xFC,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x2A,0xFA,0x0A,0x06, + /* 0xD6F7 [?] [5069]*/ + 0x02,0x01,0x00,0x7F,0x01,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD6F8 [?] [5070]*/ + 0x08,0xFF,0x08,0x02,0x3F,0x02,0x02,0xFF,0x03,0x0C,0x3F,0xC8,0x0F,0x08,0x0F,0x08, + 0x20,0xFE,0x20,0x08,0xD0,0x20,0x40,0xFE,0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xD6F9 [?] [5071]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x30,0x38,0x55,0x54,0x90,0x10,0x10,0x10,0x13,0x10, + 0x40,0x20,0x00,0xFE,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6FA [?] [5072]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x44,0x44,0x4E,0xF0,0x01,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xD6FB [?] [5073]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x54,0x54,0x7D,0x50,0x10,0x14,0x1C,0xE4,0x43,0x00, + 0x40,0x20,0x00,0xFE,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD6FC [?] [5074]*/ + 0x00,0x7C,0x44,0x54,0x55,0x55,0x56,0x54,0x54,0x54,0x54,0x10,0x28,0x25,0x44,0x80, + 0x40,0x20,0x20,0x00,0xFE,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00, + /* 0xD6FD [?] [5075]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x11,0x10,0xFC,0x10,0x10,0x11,0x15,0x1A,0x10,0x00, + 0x20,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x48,0x48,0xFE,0x88,0x48,0x28,0x08,0x28,0x10, + /* 0xD6FE [?] [5076]*/ + 0x10,0x10,0x3F,0x48,0x85,0x00,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE2,0x42,0x04,0x08, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF0,0x10,0x10,0x90,0x50,0x12,0x12,0x12,0x0E,0x00, + /* 0xD7A1 [?] [5077]*/ + 0x08,0x08,0x08,0x17,0x10,0x30,0x30,0x50,0x97,0x10,0x10,0x10,0x10,0x10,0x1F,0x10, + 0x80,0x40,0x00,0xFC,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xD7A2 [?] [5078]*/ + 0x00,0x20,0x10,0x17,0x80,0x40,0x40,0x10,0x13,0x20,0xE0,0x20,0x20,0x20,0x2F,0x00, + 0x80,0x40,0x00,0xFC,0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xD7A3 [?] [5079]*/ + 0x20,0x13,0x12,0xFA,0x0A,0x12,0x13,0x38,0x54,0x94,0x10,0x11,0x11,0x12,0x14,0x18, + 0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x90,0x90,0x90,0x90,0x12,0x12,0x12,0x0E,0x00, + /* 0xD7A4 [?] [5080]*/ + 0x00,0xF8,0x08,0x4B,0x48,0x48,0x48,0x7C,0x05,0x04,0x1C,0xE4,0x44,0x04,0x2B,0x10, + 0x40,0x20,0x00,0xFE,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD7A5 [?] [5081]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x31,0xD1,0x11,0x11,0x12,0x52,0x24, + 0x08,0x1C,0xF0,0x50,0x50,0x50,0x50,0x50,0x50,0x48,0x48,0x48,0x44,0x44,0x42,0x00, + /* 0xD7A6 [?] [5082]*/ + 0x00,0x00,0x1F,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x12,0x22,0x22,0x42,0x42,0x80, + 0x10,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x02, + /* 0xD7A7 [?] [5083]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x11,0x15,0x19,0x30,0xD0,0x10,0x10,0x10,0x53,0x20, + 0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x24,0x18,0x32,0xCA,0x06,0x02, + /* 0xD7A8 [?] [5084]*/ + 0x01,0x01,0x01,0x3F,0x02,0x02,0xFF,0x04,0x08,0x0F,0x00,0x00,0x06,0x01,0x00,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x40,0x20, + /* 0xD7A9 [?] [5085]*/ + 0x00,0x00,0xFC,0x11,0x10,0x20,0x3D,0x64,0x64,0xA5,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x40,0xFE,0x40,0x80,0xFC,0x04,0x88,0x50,0x20,0x10,0x10, + /* 0xD7AA [?] [5086]*/ + 0x20,0x20,0x20,0xFD,0x40,0x50,0x93,0xFC,0x10,0x11,0x1C,0xF0,0x50,0x10,0x10,0x10, + 0x20,0x20,0x20,0xFC,0x20,0x40,0xFE,0x40,0x80,0xFC,0x04,0x88,0x50,0x20,0x10,0x10, + /* 0xD7AB [?] [5087]*/ + 0x20,0x27,0x24,0x27,0xFC,0x24,0x23,0x28,0x31,0xE7,0x21,0x21,0x2F,0x21,0xA2,0x44, + 0x00,0xBC,0xA4,0xBC,0x20,0xA4,0x9C,0x00,0x10,0xFC,0x10,0x10,0xFE,0x10,0x08,0x04, + /* 0xD7AC [?] [5088]*/ + 0x00,0x7C,0x44,0x55,0x54,0x55,0x54,0x57,0x54,0x55,0x54,0x10,0x29,0x26,0x44,0x80, + 0x88,0x50,0x00,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50,0x50, + /* 0xD7AD [?] [5089]*/ + 0x20,0x3E,0x48,0x88,0x0F,0x10,0x1F,0x00,0xFF,0x06,0x3B,0x04,0x19,0x62,0x0C,0x73, + 0x40,0x7E,0x90,0x00,0xE0,0x20,0xC0,0x40,0xFE,0x00,0x08,0xB0,0xC0,0xA0,0x98,0x06, + /* 0xD7AE [?] [5090]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x20,0x10,0x10,0xFE,0x00,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xD7AF [?] [5091]*/ + 0x01,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x2F,0x20,0x20,0x20,0x20,0x40,0x5F,0x80, + 0x00,0x80,0x80,0xFC,0x00,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80,0x80,0xFE,0x00, + /* 0xD7B0 [?] [5092]*/ + 0x08,0x48,0x2B,0x08,0x18,0x28,0xC9,0x0A,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x00,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xD7B1 [?] [5093]*/ + 0x08,0x08,0x08,0x48,0x2B,0x28,0x08,0x08,0x18,0x29,0xC8,0x08,0x08,0x08,0x08,0x0B, + 0x40,0x40,0x40,0x40,0xFE,0x88,0x88,0x88,0x88,0x08,0x90,0x50,0x20,0x50,0x88,0x04, + /* 0xD7B2 [?] [5094]*/ + 0x10,0x11,0x10,0x10,0xFD,0x10,0x11,0x15,0x19,0x31,0xD1,0x10,0x11,0x10,0x53,0x20, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xD7B3 [?] [5095]*/ + 0x08,0x08,0x08,0x48,0x28,0x28,0x0B,0x18,0x28,0x48,0x88,0x08,0x08,0x08,0x09,0x08, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x00, + /* 0xD7B4 [?] [5096]*/ + 0x08,0x08,0x08,0x48,0x28,0x2F,0x08,0x08,0x18,0x28,0xC8,0x08,0x09,0x09,0x0A,0x0C, + 0x40,0x48,0x44,0x44,0x40,0xFE,0x40,0x40,0x40,0xA0,0xA0,0x90,0x10,0x08,0x04,0x02, + /* 0xD7B5 [?] [5097]*/ + 0x10,0x10,0x10,0x11,0xFD,0x13,0x35,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0xA0,0x90,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xD7B6 [?] [5098]*/ + 0x10,0x10,0x3C,0x20,0x41,0xBE,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xD7B7 [?] [5099]*/ + 0x00,0x20,0x13,0x12,0x02,0x03,0xF2,0x12,0x13,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0x20,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFE,0x02,0x02,0xFE,0x02,0x00,0xFE,0x00, + /* 0xD7B8 [?] [5100]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x10,0x1E,0x22,0x46,0x9F,0x10,0x11,0x02,0x0C,0x70, + 0x20,0x20,0x7E,0x44,0xA4,0x28,0x10,0x28,0x44,0x82,0xF0,0x10,0x10,0xC0,0x30,0x08, + /* 0xD7B9 [?] [5101]*/ + 0x00,0x7C,0x44,0x48,0x44,0x44,0x55,0x49,0x42,0x45,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x40,0x40,0x40,0x40,0xA0,0xA0,0x10,0x08,0x04,0x02,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xD7BA [?] [5102]*/ + 0x20,0x27,0x20,0x42,0x51,0xF2,0x24,0x28,0x40,0xF7,0x40,0x02,0x31,0xC2,0x04,0x08, + 0x00,0xBC,0x84,0x94,0x08,0x94,0xA4,0x40,0x00,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xD7BB [?] [5103]*/ + 0x00,0x20,0x17,0x10,0x03,0x02,0xF3,0x10,0x13,0x10,0x10,0x17,0x18,0x10,0x01,0x00, + 0x80,0x40,0xFC,0x00,0xF8,0x08,0xF8,0x00,0xF8,0x10,0x20,0xFC,0x40,0x40,0x40,0x80, + /* 0xD7BC [?] [5104]*/ + 0x01,0x41,0x21,0x23,0x02,0x16,0x1B,0x12,0x22,0x23,0xE2,0x22,0x22,0x23,0x22,0x02, + 0x40,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00, + /* 0xD7BD [?] [5105]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x10,0x14,0x19,0x31,0xD1,0x11,0x12,0x12,0x54,0x28, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0x20,0x3C,0x20,0x20,0xA0,0x60,0x3E,0x00, + /* 0xD7BE [?] [5106]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x15,0x18,0x30,0xD0,0x12,0x12,0x12,0x12,0x53,0x20, + 0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x22,0x22,0x22,0x22,0xFE,0x02, + /* 0xD7BF [?] [5107]*/ + 0x01,0x01,0x01,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x11,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xD7C0 [?] [5108]*/ + 0x01,0x01,0x01,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xD7C1 [?] [5109]*/ + 0x00,0x03,0xF8,0x20,0x21,0x22,0x20,0xFA,0x21,0x22,0x20,0x38,0xE1,0x42,0x00,0x00, + 0x00,0xFE,0x40,0x80,0x44,0x24,0x68,0xB0,0x30,0xA8,0x68,0xA4,0x22,0x20,0xA0,0x40, + /* 0xD7C2 [?] [5110]*/ + 0x08,0x08,0xFF,0x08,0x09,0x21,0x21,0x21,0x3F,0x01,0x01,0x41,0x41,0x41,0x7F,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x08,0x08,0x08,0xF8,0x08,0x00,0x04,0x04,0x04,0xFC,0x04, + /* 0xD7C3 [?] [5111]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x20,0x20,0x7C,0x44,0x84,0x04,0x44,0x24,0x14,0x14,0x04,0x04,0x04,0x28,0x10, + /* 0xD7C4 [?] [5112]*/ + 0x00,0x03,0x78,0x48,0x49,0x4A,0x48,0x4A,0x49,0x4A,0x78,0x48,0x01,0x02,0x00,0x00, + 0x00,0xFE,0x40,0x80,0x44,0x24,0x68,0xB0,0x30,0xA8,0x68,0xA4,0x22,0x20,0xA0,0x40, + /* 0xD7C5 [?] [5113]*/ + 0x08,0x04,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x0F,0x18,0x2F,0xC8,0x0F,0x08,0x0F,0x08, + 0x20,0x40,0xFC,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xD7C6 [?] [5114]*/ + 0x10,0x10,0x10,0x10,0x55,0x5A,0x50,0x91,0x10,0x10,0x10,0x28,0x24,0x44,0x40,0x80, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xD7C7 [?] [5115]*/ + 0x00,0x20,0x10,0x17,0x84,0x44,0x44,0x14,0x17,0x24,0xE0,0x20,0x20,0x2F,0x24,0x00, + 0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0xFC,0x44,0x40,0x48,0x44,0xFE,0x02,0x00, + /* 0xD7C8 [?] [5116]*/ + 0x08,0x04,0x04,0xFF,0x10,0x10,0x20,0x24,0x44,0x78,0x08,0x10,0x14,0x22,0x7E,0x02, + 0x20,0x20,0x40,0xFE,0x20,0x20,0x40,0x48,0x88,0xF0,0x10,0x20,0x28,0x44,0xFC,0x04, + /* 0xD7C9 [?] [5117]*/ + 0x40,0x20,0x09,0x12,0x24,0xE0,0x20,0x23,0x2C,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x80,0x80,0xFC,0x04,0x48,0x40,0xA0,0x18,0x06,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xD7CA [?] [5118]*/ + 0x01,0x41,0x21,0x0A,0x14,0xE0,0x21,0x26,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0x00,0xFC,0x44,0x48,0xA0,0x10,0x0C,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xD7CB [?] [5119]*/ + 0x40,0x20,0x09,0x12,0x24,0xE0,0x20,0x23,0x2C,0x04,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x80,0x80,0xFC,0x04,0x48,0x40,0xA0,0x18,0x06,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xD7CC [?] [5120]*/ + 0x01,0x20,0x10,0x17,0x81,0x41,0x42,0x12,0x14,0x27,0xE1,0x22,0x22,0x24,0x27,0x00, + 0x08,0x88,0x90,0xFE,0x08,0x08,0x10,0x94,0xA4,0x38,0x08,0x10,0x10,0xA4,0xBC,0x84, + /* 0xD7CD [?] [5121]*/ + 0x01,0x21,0x12,0x14,0x82,0x41,0x41,0x10,0x17,0x24,0xE4,0x27,0x24,0x24,0x27,0x04, + 0x24,0x24,0x48,0x90,0x48,0x24,0x24,0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x04, + /* 0xD7CE [?] [5122]*/ + 0x00,0xFC,0x04,0x08,0x10,0x11,0x16,0x18,0x30,0xD0,0x10,0x10,0x10,0x10,0x51,0x22, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xD7CF [?] [5123]*/ + 0x08,0x28,0x2E,0x28,0x2E,0xF0,0x02,0x04,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x80,0x88,0xF0,0x84,0x84,0x7C,0x00,0x20,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xD7D0 [?] [5124]*/ + 0x08,0x0B,0x08,0x10,0x10,0x30,0x30,0x57,0x90,0x10,0x10,0x10,0x10,0x10,0x11,0x10, + 0x00,0xF8,0x08,0x10,0x20,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xD7D1 [?] [5125]*/ + 0x10,0x11,0x94,0x54,0x58,0x10,0xFC,0x33,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x04,0x08,0x10,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xD7D2 [?] [5126]*/ + 0x00,0x20,0x17,0x14,0x80,0x43,0x41,0x10,0x17,0x20,0xE0,0x23,0x20,0x20,0x20,0x00, + 0x80,0x40,0xFC,0x84,0x40,0xF8,0x10,0xA0,0xFC,0x40,0x40,0xF8,0x40,0x40,0x40,0x40, + /* 0xD7D3 [?] [5127]*/ + 0x00,0x7F,0x00,0x00,0x00,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x10,0x20,0x40,0x80,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7D4 [?] [5128]*/ + 0x01,0x02,0x04,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xD7D5 [?] [5129]*/ + 0x00,0x20,0x17,0x10,0x83,0x40,0x47,0x10,0x13,0x22,0xE2,0x22,0x22,0x20,0x21,0x06, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0x48,0xA0,0x10,0x08, + /* 0xD7D6 [?] [5130]*/ + 0x02,0x01,0x7F,0x40,0x80,0x1F,0x00,0x00,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0x00,0xFE,0x02,0x04,0xE0,0x40,0x80,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7D7 [?] [5131]*/ + 0x3F,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x01,0x7F,0x40,0x1F,0x00,0x7F,0x11,0x25,0x42, + 0x08,0x30,0xC4,0x18,0x62,0x0C,0x70,0x00,0xFC,0x04,0xF0,0x00,0xFC,0x10,0x08,0x04, + /* 0xD7D8 [?] [5132]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x30,0x38,0x57,0x54,0x91,0x11,0x12,0x14,0x10,0x10, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xD7D9 [?] [5133]*/ + 0x00,0x78,0x4B,0x4A,0x4C,0x79,0x10,0x10,0x53,0x5C,0x51,0x51,0x5A,0xE4,0x00,0x00, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xD7DA [?] [5134]*/ + 0x02,0x01,0x01,0x7F,0x40,0x80,0x1F,0x00,0x00,0x7F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0x00,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xD7DB [?] [5135]*/ + 0x10,0x10,0x23,0x22,0x48,0xF9,0x10,0x20,0x43,0xF8,0x41,0x01,0x1A,0xE4,0x40,0x00, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xD7DC [?] [5136]*/ + 0x10,0x08,0x04,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10,0x01,0x08,0x48,0x48,0x87,0x00, + 0x10,0x20,0x40,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xD7DD [?] [5137]*/ + 0x11,0x11,0x21,0x21,0x49,0xF9,0x11,0x21,0x41,0xFA,0x42,0x02,0x1C,0xE4,0x48,0x11, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xA8,0x68,0x28,0x44,0x44,0x84,0x02, + /* 0xD7DE [?] [5138]*/ + 0x20,0x20,0x3E,0x42,0x84,0x08,0xFE,0x02,0x02,0x7E,0x02,0x02,0x02,0xFE,0x02,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xD7DF [?] [5139]*/ + 0x01,0x01,0x01,0x3F,0x01,0x01,0xFF,0x01,0x01,0x11,0x11,0x11,0x11,0x29,0x47,0x80, + 0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xD7E0 [?] [5140]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x08,0x37,0xC1,0x1F,0x01,0x02,0x0C,0x30, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0xD8,0x06,0xF0,0x00,0xC0,0x30,0x08, + /* 0xD7E1 [?] [5141]*/ + 0x20,0x20,0x27,0x20,0xFB,0x20,0x27,0x29,0x32,0xE5,0x20,0x23,0x20,0x20,0xA1,0x46, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x08,0xF6,0x40,0xF8,0x40,0xA0,0x10,0x08, + /* 0xD7E2 [?] [5142]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x17,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD7E3 [?] [5143]*/ + 0x00,0x1F,0x10,0x10,0x10,0x10,0x1F,0x01,0x01,0x11,0x11,0x11,0x29,0x25,0x43,0x80, + 0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xD7E4 [?] [5144]*/ + 0x02,0x01,0x7F,0x08,0x08,0x08,0x14,0x22,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x50,0x88,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xD7E5 [?] [5145]*/ + 0x20,0x10,0x10,0x01,0xFE,0x20,0x20,0x3C,0x25,0x24,0x27,0x24,0x24,0x44,0x54,0x89, + 0x80,0x80,0xFE,0x00,0x80,0x80,0xFC,0xA0,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x06, + /* 0xD7E6 [?] [5146]*/ + 0x20,0x11,0x11,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x11,0x17,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD7E7 [?] [5147]*/ + 0x00,0x21,0x11,0x11,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x07,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD7E8 [?] [5148]*/ + 0x00,0x7D,0x45,0x49,0x49,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x51,0x41,0x47,0x40, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD7E9 [?] [5149]*/ + 0x10,0x11,0x21,0x21,0x49,0xF9,0x11,0x21,0x41,0xF9,0x41,0x01,0x19,0xE1,0x47,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD7EA [?] [5150]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x10,0x10,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD7EB [?] [5151]*/ + 0x20,0x3E,0x48,0xBF,0x24,0x22,0x3F,0x02,0xFF,0x09,0x12,0x2F,0xC2,0x1F,0x09,0x13, + 0x40,0x7E,0x90,0xF8,0x88,0x48,0xF8,0x00,0xFE,0x20,0x50,0x88,0x26,0xF0,0x48,0x20, + /* 0xD7EC [?] [5152]*/ + 0x00,0x02,0xF2,0x92,0x92,0x97,0x91,0x92,0x97,0x9A,0xF3,0x92,0x03,0x04,0x04,0x08, + 0x90,0x94,0xD8,0x92,0xD2,0x0E,0xF0,0x10,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x54,0x08, + /* 0xD7ED [?] [5153]*/ + 0x00,0xFE,0x29,0x28,0xFE,0xAA,0xAB,0xAA,0xAE,0xC2,0x83,0xFE,0x82,0x82,0xFE,0x82, + 0x40,0x20,0xFE,0x00,0x88,0x88,0x54,0x22,0x00,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xD7EE [?] [5154]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x00,0xFF,0x22,0x3E,0x22,0x3E,0x22,0x2F,0xF2,0x42,0x03, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0xF8,0x88,0x90,0x50,0x20,0x50,0x88,0x06, + /* 0xD7EF [?] [5155]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x00,0x04,0x7C,0x04,0x04,0x7C,0x04,0x04,0xFC,0x04,0x04, + 0x00,0xFC,0x44,0x44,0xFC,0x00,0x40,0x7C,0x40,0x40,0x7C,0x40,0x40,0x7E,0x40,0x40, + /* 0xD7F0 [?] [5156]*/ + 0x08,0x04,0xFF,0x04,0x3F,0x28,0x30,0x27,0x20,0x3F,0x00,0xFF,0x08,0x04,0x04,0x00, + 0x20,0x40,0xFE,0x40,0xF8,0x48,0x38,0xC8,0x08,0xF8,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xD7F1 [?] [5157]*/ + 0x01,0x4F,0x20,0x27,0x04,0x05,0xE6,0x27,0x24,0x27,0x20,0x2F,0x21,0x20,0x50,0x8F, + 0x10,0xFE,0xA0,0xFC,0xA4,0x1C,0x04,0xFC,0x04,0xFC,0x10,0xFE,0x10,0xB0,0x00,0xFE, + /* 0xD7F2 [?] [5158]*/ + 0x01,0x01,0x79,0x49,0x4A,0x4A,0x4C,0x78,0x48,0x48,0x48,0x48,0x78,0x48,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80, + /* 0xD7F3 [?] [5159]*/ + 0x02,0x02,0x02,0xFF,0x04,0x04,0x04,0x08,0x0F,0x10,0x10,0x20,0x40,0x80,0x3F,0x00, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0xF8,0x80,0x80,0x80,0x80,0x80,0xFE,0x00, + /* 0xD7F4 [?] [5160]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x31,0x51,0x91,0x12,0x12,0x14,0x14,0x18,0x13,0x10, + 0x80,0x80,0x80,0x80,0xFE,0x80,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD7F5 [?] [5161]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x32,0x38,0x54,0x50,0x90,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xD7F6 [?] [5162]*/ + 0x12,0x12,0x12,0x2F,0x22,0x62,0x62,0xAF,0x28,0x28,0x28,0x28,0x2F,0x28,0x20,0x20, + 0x10,0x10,0x10,0xA0,0x3E,0x44,0x24,0xA4,0xA4,0xA8,0xA8,0x90,0xA8,0x28,0x44,0x82, + /* 0xD7F7 [?] [5163]*/ + 0x09,0x09,0x09,0x11,0x12,0x32,0x34,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x80,0x80,0x80,0x80, + /* 0xD7F8 [?] [5164]*/ + 0x01,0x11,0x11,0x11,0x11,0x29,0x25,0x45,0x81,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x00,0x10,0x10,0x10,0x10,0x28,0x24,0x44,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xD7F9 [?] [5165]*/ + 0x01,0x00,0x3F,0x20,0x24,0x24,0x24,0x2A,0x31,0x20,0x2F,0x20,0x40,0x40,0xBF,0x00, + 0x00,0x80,0xFE,0x80,0x90,0x90,0x90,0xA8,0xC4,0x80,0xF8,0x80,0x80,0x80,0xFE,0x00, + /* 0xD7FA [?] [5166]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7FB [?] [5167]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7FC [?] [5168]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7FD [?] [5169]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD7FE [?] [5170]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD8A1 [?] [5171]*/ + 0x00,0x3F,0x00,0x00,0x00,0x00,0xFF,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD8A2 [?] [5172]*/ + 0x00,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD8A3 [?] [5173]*/ + 0x00,0x00,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x44,0x44,0x44,0x3C,0x00, + /* 0xD8A4 [?] [5174]*/ + 0x00,0xFF,0x01,0x01,0x21,0x21,0x21,0x21,0x21,0x3F,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xD8A5 [?] [5175]*/ + 0x08,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0F,0x08, + 0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xF0,0x10, + /* 0xD8A6 [?] [5176]*/ + 0x10,0x11,0x11,0x11,0x11,0x11,0xFF,0x11,0x11,0x11,0x11,0x11,0x11,0x21,0x20,0x40, + 0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD8A7 [?] [5177]*/ + 0x00,0x7F,0x00,0x01,0x01,0x03,0x05,0x09,0x31,0xC1,0x01,0x01,0x01,0x00,0xFF,0x00, + 0x00,0xFC,0x80,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD8A8 [?] [5178]*/ + 0x00,0x7F,0x00,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x00,0x00,0xFF,0x00, + 0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x00,0x00,0xFE,0x00, + /* 0xD8A9 [?] [5179]*/ + 0x00,0x3F,0x00,0x00,0x00,0x7D,0x05,0x09,0x09,0x11,0x21,0x41,0x85,0x02,0xFF,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x04,0x88,0x50,0x20,0x10,0x08,0x06,0x00,0x00,0xFE,0x00, + /* 0xD8AA [?] [5180]*/ + 0x00,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x00,0x7F,0x48,0x44,0x5F,0x41,0x41,0x41,0x40, + 0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x00,0xFC,0x24,0x44,0xF4,0x04,0x04,0x14,0x08, + /* 0xD8AB [?] [5181]*/ + 0x7F,0x00,0x03,0x0D,0x71,0x01,0x10,0x10,0xFE,0x22,0x22,0x64,0x14,0x08,0x34,0xC2, + 0xFC,0x80,0x60,0x18,0x04,0x00,0x00,0xFC,0x04,0x08,0x10,0xFE,0x10,0x10,0x50,0x20, + /* 0xD8AC [?] [5182]*/ + 0x00,0x7F,0x01,0x3D,0x25,0x25,0x3D,0x01,0x7F,0x01,0x3D,0x25,0x25,0x3D,0x01,0xFF, + 0x00,0xFC,0x00,0x78,0x48,0x48,0x78,0x00,0xFC,0x00,0x78,0x48,0x48,0x78,0x00,0xFE, + /* 0xD8AD [?] [5183]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD8AE [?] [5184]*/ + 0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x01,0x7F,0x41,0x41,0x5F,0x48,0x40,0x40, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x24,0xE4,0x24,0x14,0x08, + /* 0xD8AF [?] [5185]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x02,0x04,0x04,0x08,0x10,0x20, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD8B0 [?] [5186]*/ + 0x10,0x10,0x10,0x10,0x10,0x10,0x13,0x1C,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x00, + 0x00,0x00,0x00,0x08,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xD8B1 [?] [5187]*/ + 0x00,0x03,0x3E,0x02,0x02,0x02,0x02,0x03,0xFE,0x02,0x02,0x02,0x02,0x02,0x01,0x00, + 0x20,0xF0,0x00,0x00,0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xD8B2 [?] [5188]*/ + 0x00,0x00,0x3F,0x01,0x01,0x01,0x01,0xFF,0x01,0x02,0x02,0x04,0x08,0x10,0x20,0xC0, + 0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x80,0x80,0x40,0x20,0x10,0x08,0x06, + /* 0xD8B3 [?] [5189]*/ + 0x00,0x18,0x06,0x01,0x06,0x18,0x60,0x00,0x08,0x04,0x02,0x01,0x02,0x0C,0x30,0xC0, + 0x08,0x10,0x60,0x80,0x60,0x18,0x04,0x20,0x20,0x40,0x80,0x00,0x80,0x40,0x30,0x0E, + /* 0xD8B4 [?] [5190]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x44,0x43,0x80, + 0x7C,0x80,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x50,0x24,0x04,0x04,0xFC,0x00, + /* 0xD8B5 [?] [5191]*/ + 0x00,0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x21,0x28,0x30,0x20, + 0x10,0xF8,0x80,0x80,0x80,0x80,0xFE,0x80,0x80,0x40,0x40,0x22,0x12,0x8A,0x46,0x42, + /* 0xD8B6 [?] [5192]*/ + 0x02,0x02,0x04,0x7F,0x40,0x48,0x44,0x42,0x41,0x42,0x44,0x48,0x40,0x40,0x7F,0x40, + 0x00,0x00,0x00,0xFC,0x04,0x24,0x44,0x84,0x04,0x84,0x44,0x24,0x04,0x04,0xFC,0x04, + /* 0xD8B7 [?] [5193]*/ + 0x01,0x22,0x24,0x27,0x21,0x22,0x27,0x20,0x27,0x24,0x27,0x24,0x27,0x44,0x44,0x84, + 0x00,0x08,0x48,0x88,0x08,0x48,0xC8,0x08,0xC8,0x48,0xC8,0x48,0xCA,0x4A,0x4A,0xC6, + /* 0xD8B8 [?] [5194]*/ + 0x21,0x20,0x20,0x23,0xFC,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x25,0x44,0x43,0x80, + 0x10,0xA0,0x00,0xFC,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFA,0x0A,0x02,0xFE,0x00, + /* 0xD8B9 [?] [5195]*/ + 0x40,0x40,0x7D,0x80,0x7C,0x44,0x65,0x54,0xFE,0x44,0xA4,0x94,0xFE,0x05,0x29,0x12, + 0x20,0x10,0xFE,0x20,0x48,0x84,0xFE,0x02,0xA8,0xA8,0xA8,0xA8,0xAA,0x2A,0x26,0x00, + /* 0xD8BA [?] [5196]*/ + 0x04,0x08,0x7F,0x44,0x7F,0x01,0x3F,0x01,0xFF,0x08,0x04,0x3F,0x01,0xFF,0x01,0x01, + 0x00,0x00,0xFC,0x44,0xFC,0x00,0xF8,0x00,0xFE,0x20,0x40,0xF8,0x00,0xFE,0x00,0x00, + /* 0xD8BB [?] [5197]*/ + 0x24,0x14,0x24,0x08,0x70,0x08,0xFF,0x08,0x7E,0x00,0x7E,0x42,0x7E,0x24,0x1E,0xE0, + 0x90,0xA0,0x94,0x84,0x7C,0x10,0x10,0xFE,0x10,0xFC,0x44,0x48,0x28,0x10,0x28,0xC6, + /* 0xD8BC [?] [5198]*/ + 0x00,0x00,0x00,0x00,0x00,0x04,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x40,0x40,0x00,0x00,0x00,0x00,0x00, + /* 0xD8BD [?] [5199]*/ + 0x00,0x3F,0x00,0x00,0x01,0x79,0x49,0x49,0x49,0x49,0x79,0x01,0x05,0x02,0xFF,0x00, + 0x00,0xF0,0x20,0x40,0x80,0x3C,0x04,0x44,0x28,0x10,0x28,0x44,0x00,0x00,0xFE,0x00, + /* 0xD8BE [?] [5200]*/ + 0x7F,0x10,0x10,0x2F,0x48,0x8F,0x08,0x4F,0x48,0x4F,0x40,0x7C,0x04,0xFC,0x24,0x44, + 0xF8,0x08,0x1E,0xE2,0x2A,0xE4,0x20,0xE4,0x24,0xE4,0x04,0x7C,0x40,0x7C,0x44,0x44, + /* 0xD8BF [?] [5201]*/ + 0x00,0x00,0x10,0x10,0x10,0x17,0x38,0xD0,0x10,0x10,0x10,0x10,0x10,0x10,0x0F,0x00, + 0x00,0x00,0x00,0x30,0xD0,0x10,0x10,0x10,0x10,0x50,0x20,0x02,0x02,0x02,0xFE,0x00, + /* 0xD8C0 [?] [5202]*/ + 0x08,0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x7F,0x41,0x41,0x41,0x41,0x41,0x7F,0x41, + 0x20,0x20,0x20,0x20,0xA0,0x20,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x22,0x1E,0x00, + /* 0xD8C1 [?] [5203]*/ + 0x00,0x3F,0x00,0x00,0x00,0xFF,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0xF8,0x00,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD8C2 [?] [5204]*/ + 0x09,0x09,0xF9,0x09,0x09,0x01,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x20,0x20,0x3E,0x20,0x20,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xD8C3 [?] [5205]*/ + 0x01,0x01,0x3F,0x01,0x01,0x7F,0x40,0x80,0x0F,0x00,0x00,0xFF,0x01,0x01,0x05,0x02, + 0x00,0x00,0xF8,0x00,0x00,0xFE,0x02,0x04,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00, + /* 0xD8C4 [?] [5206]*/ + 0x01,0x01,0x7F,0x01,0x11,0x09,0xFF,0x00,0x3F,0x20,0x27,0x24,0x27,0x20,0x3F,0x20, + 0x00,0x00,0xFC,0x00,0x10,0x20,0xFE,0x00,0xF8,0x08,0xC8,0x48,0xC8,0x08,0xF8,0x08, + /* 0xD8C5 [?] [5207]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x7D,0x45,0x45,0x45,0x45,0x7D,0x45,0x01, + 0x00,0xDC,0x44,0x44,0x44,0xDC,0x00,0x00,0xDC,0x14,0x14,0xD4,0x08,0x08,0x14,0x22, + /* 0xD8C6 [?] [5208]*/ + 0x00,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x21,0x21,0x22,0x42,0x44,0x88,0x10, + 0x00,0xFE,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x20,0x20,0x10,0x08,0x06, + /* 0xD8C7 [?] [5209]*/ + 0x00,0x3F,0x20,0x20,0x20,0x2F,0x21,0x22,0x24,0x27,0x20,0x20,0x4F,0x40,0x80,0x00, + 0x00,0xFE,0x00,0x80,0x80,0xFC,0x00,0x40,0x40,0xFC,0x40,0x40,0xFE,0x40,0x40,0x40, + /* 0xD8C8 [?] [5210]*/ + 0x00,0x3F,0x22,0x22,0x2F,0x22,0x22,0x3F,0x20,0x27,0x24,0x24,0x47,0x44,0x84,0x07, + 0x00,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8, + /* 0xD8C9 [?] [5211]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x21,0x26,0x38,0x2F,0x28,0x2F,0x28,0x4F,0x48,0x80,0x00, + 0x00,0xFE,0xA0,0x90,0xFE,0x40,0x30,0x0E,0xF8,0x88,0xF8,0x88,0xF8,0x88,0x80,0x80, + /* 0xD8CA [?] [5212]*/ + 0x00,0x3F,0x20,0x28,0x25,0x2F,0x22,0x22,0x2A,0x2A,0x2F,0x22,0x42,0x44,0x84,0x08, + 0x00,0xFE,0x00,0x90,0x10,0xBE,0x22,0x44,0x90,0x90,0x90,0x10,0x28,0x28,0x44,0x82, + /* 0xD8CB [?] [5213]*/ + 0x00,0x3F,0x29,0x29,0x3F,0x29,0x29,0x2F,0x29,0x2F,0x29,0x29,0x5F,0x40,0x8A,0x11, + 0x00,0xFE,0x00,0x0C,0xB0,0x20,0x20,0x3E,0x28,0x28,0x28,0x28,0xA8,0x48,0x88,0x08, + /* 0xD8CC [?] [5214]*/ + 0x3F,0x20,0x3F,0x21,0x26,0x38,0x27,0x20,0x2F,0x2A,0x2B,0x2A,0x4B,0x4A,0x8F,0x08, + 0xFC,0x90,0xFC,0x40,0x30,0x0C,0xF0,0x80,0xF8,0x28,0xE8,0x28,0xE8,0x28,0xF8,0x08, + /* 0xD8CD [?] [5215]*/ + 0x3F,0x22,0x24,0x2D,0x36,0x24,0x24,0x24,0x24,0x20,0x27,0x24,0x44,0x40,0x83,0x1C, + 0xFE,0x50,0xFE,0x90,0xFC,0x90,0xFC,0x90,0xFE,0x00,0xFC,0x44,0x44,0xB0,0x0C,0x02, + /* 0xD8CE [?] [5216]*/ + 0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xD8CF [?] [5217]*/ + 0x00,0x7F,0x40,0x40,0x40,0x47,0x44,0x44,0x44,0x44,0x47,0x44,0x40,0x40,0x7F,0x00, + 0x00,0xFC,0x00,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xF0,0x10,0x00,0x00,0xFE,0x00, + /* 0xD8D0 [?] [5218]*/ + 0x00,0x7F,0x44,0x44,0x5F,0x48,0x52,0x5F,0x42,0x43,0x5E,0x4A,0x42,0x42,0x7F,0x00, + 0x00,0xFC,0x20,0x20,0xA0,0x78,0x28,0xA8,0x28,0xA8,0x2A,0x2A,0x46,0x80,0xFE,0x00, + /* 0xD8D1 [?] [5219]*/ + 0x00,0x7F,0x40,0x4F,0x48,0x4F,0x40,0x7F,0x40,0x4F,0x48,0x49,0x42,0x4C,0x7F,0x00, + 0x00,0xFC,0x80,0xF8,0x88,0xF8,0x80,0xFE,0x00,0xF8,0x88,0x68,0x10,0x08,0xFE,0x00, + /* 0xD8D2 [?] [5220]*/ + 0x00,0x7F,0x40,0x4F,0x48,0x4F,0x48,0x4F,0x59,0x69,0x4F,0x49,0x49,0x40,0x7F,0x00, + 0x00,0xFC,0x80,0xF8,0x08,0xF8,0x00,0xFC,0x24,0x24,0xFC,0x24,0x2C,0x00,0xFE,0x00, + /* 0xD8D3 [?] [5221]*/ + 0x00,0x7D,0x48,0x48,0x48,0x5D,0x54,0x55,0x55,0x5D,0x49,0x49,0x49,0x7E,0x00,0x03, + 0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xD8D4 [?] [5222]*/ + 0x08,0x08,0x7F,0x08,0x08,0x08,0xFF,0x00,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40, + 0x20,0x20,0x20,0x20,0x20,0x30,0xA8,0x24,0x22,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xD8D5 [?] [5223]*/ + 0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0x88,0x08,0x08,0xF8,0x08, + /* 0xD8D6 [?] [5224]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x04,0x04,0x04,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x04,0x04,0x04,0x14,0x08, + /* 0xD8D7 [?] [5225]*/ + 0x00,0x01,0x01,0x21,0x11,0x0A,0x0A,0x04,0x04,0x0A,0x0A,0x11,0x21,0x40,0x80,0x00, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8D8 [?] [5226]*/ + 0x20,0x20,0x20,0x3F,0x54,0x94,0x14,0x24,0x24,0x48,0x88,0x10,0x20,0x40,0x85,0x02, + 0x04,0x04,0x04,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x84,0x84,0x14,0x08, + /* 0xD8D9 [?] [5227]*/ + 0x00,0x7F,0x02,0x04,0x0C,0x12,0x21,0xC0,0x00,0x7F,0x08,0x08,0x08,0x0F,0xF0,0x40, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0xA4,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DA [?] [5228]*/ + 0x08,0x08,0xFF,0x14,0x22,0x41,0xBE,0x00,0xFF,0x10,0x20,0x7F,0x01,0x01,0x0A,0x04, + 0x04,0x04,0x84,0x24,0x24,0x24,0xA4,0x24,0xA4,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DB [?] [5229]*/ + 0x08,0x49,0x49,0x49,0x7F,0x10,0x10,0x3F,0x41,0xA1,0x12,0x14,0x08,0x10,0x20,0xC0, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DC [?] [5230]*/ + 0x08,0x49,0x49,0x49,0x7F,0x00,0x7F,0x01,0x01,0x3F,0x20,0x20,0x23,0x2C,0x30,0x00, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DD [?] [5231]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7F,0x49,0x49,0x7F,0x08,0x1C,0x2A,0x49,0x88,0x08,0x08, + 0x04,0x04,0x84,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DE [?] [5232]*/ + 0x08,0x08,0x7F,0x14,0x22,0x41,0xFF,0x01,0x79,0x49,0x49,0x49,0x79,0x01,0x05,0x02, + 0x04,0x04,0x84,0x24,0x24,0x24,0xE4,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD8DF [?] [5233]*/ + 0x08,0x09,0x49,0x4A,0x88,0x14,0x22,0x49,0x88,0x49,0x49,0x8A,0x14,0x22,0x41,0x80, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x88, + /* 0xD8E0 [?] [5234]*/ + 0x08,0x04,0x7F,0x40,0x20,0x3B,0x2A,0x2A,0x2A,0x5A,0x4B,0x8A,0x12,0x12,0x23,0x42, + 0x04,0x04,0x84,0xA4,0x24,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x04,0x84,0x14,0x08, + /* 0xD8E1 [?] [5235]*/ + 0x11,0x11,0xFF,0x11,0x00,0x7B,0x4A,0x4A,0x7B,0x4A,0x4A,0x7B,0x4A,0x4A,0xAB,0x14, + 0x02,0x02,0xE2,0x0A,0x0A,0xCA,0x4A,0x4A,0xCA,0x4A,0x4A,0xCA,0x42,0x42,0x4A,0x84, + /* 0xD8E2 [?] [5236]*/ + 0x00,0xFF,0x0A,0x7F,0x4A,0x4A,0x7F,0x00,0x7F,0x00,0xFF,0x04,0x24,0x44,0x94,0x08, + 0x02,0xE2,0x02,0xC2,0x52,0x52,0xD2,0x12,0xD2,0x12,0xF2,0x12,0x82,0x42,0x2A,0x04, + /* 0xD8E3 [?] [5237]*/ + 0x00,0x7F,0x40,0x51,0x4A,0x5F,0x44,0x44,0x55,0x55,0x5F,0x44,0x44,0x48,0x49,0x92, + 0x02,0xF2,0x02,0x4A,0x4A,0x7A,0x9A,0x2A,0x0A,0x4A,0x4A,0x4A,0xA2,0xA2,0x2A,0x04, + /* 0xD8E4 [?] [5238]*/ + 0x12,0x11,0x3F,0x22,0x62,0xBF,0x22,0x22,0x3F,0x22,0x22,0x3F,0x20,0x54,0x4A,0x8A, + 0x02,0x02,0xC2,0x02,0x12,0xD2,0x12,0x12,0xD2,0x12,0x12,0xD2,0x02,0x82,0x4A,0x44, + /* 0xD8E5 [?] [5239]*/ + 0x11,0x7F,0x15,0x12,0x3F,0x64,0xBF,0x24,0x3F,0x24,0x3F,0x20,0x7F,0x11,0x0E,0x71, + 0x02,0xC2,0x02,0x02,0xD2,0x12,0x92,0x12,0x92,0x12,0xD2,0x12,0x82,0x02,0x0A,0x84, + /* 0xD8E6 [?] [5240]*/ + 0x08,0x3F,0x20,0x3F,0x20,0x3F,0x00,0x7F,0x44,0x7F,0x44,0x7F,0x00,0xFF,0x11,0x21, + 0x02,0x82,0x82,0x82,0x92,0x92,0x12,0xD2,0x52,0xD2,0x52,0xD2,0x02,0xE2,0x0A,0x04, + /* 0xD8E7 [?] [5241]*/ + 0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xD8E8 [?] [5242]*/ + 0x00,0x7F,0x40,0x48,0x44,0x5F,0x41,0x40,0x5F,0x44,0x44,0x44,0x47,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x24,0x44,0xF4,0x04,0x84,0xF4,0x04,0x04,0x04,0xE4,0x04,0x14,0x08, + /* 0xD8E9 [?] [5243]*/ + 0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD8EA [?] [5244]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xD8EB [?] [5245]*/ + 0x08,0x09,0x09,0x11,0x11,0x31,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xD8EC [?] [5246]*/ + 0x08,0x08,0x08,0x10,0x13,0x30,0x30,0x50,0x90,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xD8ED [?] [5247]*/ + 0x08,0x08,0x0B,0x10,0x10,0x30,0x30,0x51,0x90,0x10,0x10,0x10,0x10,0x17,0x10,0x10, + 0x00,0x00,0xFC,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00, + /* 0xD8EE [?] [5248]*/ + 0x08,0x08,0x09,0x11,0x12,0x34,0x31,0x50,0x90,0x10,0x10,0x11,0x12,0x12,0x11,0x10, + 0x80,0x80,0x00,0xFE,0x00,0x00,0xF8,0x08,0x10,0x60,0x80,0x00,0x02,0x02,0xFE,0x00, + /* 0xD8EF [?] [5249]*/ + 0x08,0x08,0x08,0x10,0x11,0x31,0x32,0x54,0x90,0x10,0x10,0x11,0x12,0x17,0x12,0x10, + 0x40,0x40,0x80,0x80,0x00,0x10,0x10,0x20,0x20,0x40,0x80,0x08,0x04,0xFE,0x02,0x00, + /* 0xD8F0 [?] [5250]*/ + 0x08,0x08,0x0B,0x10,0x10,0x32,0x32,0x52,0x94,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x04,0x28,0x10, + /* 0xD8F1 [?] [5251]*/ + 0x08,0x0B,0x0A,0x12,0x12,0x32,0x32,0x52,0x92,0x12,0x12,0x12,0x13,0x12,0x13,0x10, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xD8F2 [?] [5252]*/ + 0x08,0x0A,0x0A,0x12,0x12,0x32,0x33,0x52,0x92,0x12,0x12,0x12,0x12,0x13,0x12,0x10, + 0x20,0x20,0x20,0x22,0x22,0x24,0xA8,0x30,0x20,0x20,0x20,0x22,0xA2,0x22,0x1E,0x00, + /* 0xD8F3 [?] [5253]*/ + 0x08,0x0B,0x08,0x11,0x11,0x31,0x32,0x53,0x90,0x10,0x10,0x11,0x12,0x14,0x10,0x10, + 0x00,0xFC,0x10,0x10,0x10,0x10,0x10,0xFE,0x30,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xD8F4 [?] [5254]*/ + 0x08,0x08,0x0F,0x11,0x11,0x31,0x31,0x51,0x91,0x12,0x12,0x12,0x12,0x12,0x13,0x12, + 0x00,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0x90,0x50,0x50,0x10,0x12,0x92,0x12,0x0E, + /* 0xD8F5 [?] [5255]*/ + 0x11,0x11,0x11,0x23,0x22,0x62,0x64,0xA0,0x20,0x2F,0x20,0x20,0x20,0x20,0x20,0x20, + 0x00,0x00,0x00,0xF8,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xD8F6 [?] [5256]*/ + 0x09,0x09,0x09,0x11,0x11,0x31,0x31,0x57,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x08,0x08,0x10,0x20,0x40,0x00,0xFE,0x40,0x20,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xD8F7 [?] [5257]*/ + 0x08,0x08,0x08,0x11,0x12,0x34,0x3B,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x11,0x10, + 0x40,0x40,0xA0,0x10,0x08,0x04,0xF2,0x10,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xD8F8 [?] [5258]*/ + 0x08,0x08,0x08,0x13,0x10,0x30,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xD8F9 [?] [5259]*/ + 0x08,0x08,0x08,0x10,0x13,0x32,0x34,0x50,0x90,0x10,0x10,0x10,0x10,0x13,0x10,0x10, + 0x40,0x20,0x20,0x00,0xFE,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00, + /* 0xD8FA [?] [5260]*/ + 0x10,0x13,0x10,0x20,0x2F,0x60,0x60,0xAF,0x21,0x22,0x26,0x21,0x20,0x20,0x23,0x2C, + 0x00,0xF8,0x00,0x00,0xFE,0x80,0x80,0xFE,0x08,0x10,0x10,0xA0,0x60,0x90,0x08,0x04, + /* 0xD8FB [?] [5261]*/ + 0x08,0x08,0x08,0x10,0x10,0x30,0x30,0x57,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x40,0x40,0x50,0x48,0x44,0x40,0x40,0x40, + /* 0xD8FC [?] [5262]*/ + 0x08,0x08,0x08,0x10,0x12,0x32,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x10,0x10,0x11, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xD8FD [?] [5263]*/ + 0x10,0x10,0x12,0x22,0x23,0x62,0x64,0xA0,0x2F,0x20,0x20,0x20,0x21,0x22,0x24,0x28, + 0x40,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x04,0x02, + /* 0xD8FE [?] [5264]*/ + 0x11,0x11,0x12,0x23,0x24,0x68,0x63,0xA2,0x22,0x22,0x22,0x23,0x22,0x20,0x20,0x20, + 0x00,0x00,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0x24,0xE4,0x24,0x04,0x28,0x10, + /* 0xD9A1 [?] [5265]*/ + 0x08,0x08,0x08,0x11,0x13,0x34,0x30,0x50,0x93,0x1C,0x10,0x10,0x10,0x11,0x10,0x10, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xC0,0x20,0x10,0x80,0x60,0x10, + /* 0xD9A2 [?] [5266]*/ + 0x08,0x08,0x08,0x13,0x12,0x34,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x10,0x10, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x08,0x10,0x20,0xC0,0x02,0x02,0x02,0xFE,0x00, + /* 0xD9A3 [?] [5267]*/ + 0x08,0x0B,0x0A,0x12,0x12,0x33,0x32,0x52,0x92,0x12,0x12,0x12,0x14,0x14,0x18,0x10, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xD9A4 [?] [5268]*/ + 0x14,0x14,0x14,0x24,0x2F,0x64,0x64,0xA4,0x24,0x24,0x24,0x24,0x28,0x28,0x32,0x21, + 0x00,0x00,0x00,0x3C,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xBC,0xA4,0x00, + /* 0xD9A5 [?] [5269]*/ + 0x08,0x08,0x08,0x1F,0x10,0x30,0x37,0x50,0x90,0x13,0x12,0x12,0x12,0x12,0x13,0x12, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xD9A6 [?] [5270]*/ + 0x08,0x0B,0x09,0x11,0x11,0x31,0x31,0x51,0x91,0x11,0x11,0x11,0x17,0x10,0x10,0x10, + 0x00,0xFE,0x08,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x1E,0xE8,0x08,0x08,0x08, + /* 0xD9A7 [?] [5271]*/ + 0x08,0x08,0x0F,0x10,0x11,0x31,0x33,0x55,0x99,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x40,0x40,0xFE,0x80,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xD9A8 [?] [5272]*/ + 0x10,0x10,0x17,0x20,0x21,0x62,0x6D,0xA0,0x27,0x20,0x21,0x23,0x20,0x20,0x20,0x20, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xF6,0x00,0xFC,0x80,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xD9A9 [?] [5273]*/ + 0x10,0x17,0x14,0x24,0x24,0x67,0x60,0xA2,0x22,0x22,0x22,0x22,0x22,0x24,0x24,0x28, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x48,0x48,0x48,0x48,0x48,0x4A,0x4A,0x4A,0x06, + /* 0xD9AA [?] [5274]*/ + 0x08,0x0A,0x0A,0x13,0x14,0x30,0x30,0x57,0x90,0x11,0x11,0x12,0x14,0x18,0x10,0x10, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40, + /* 0xD9AB [?] [5275]*/ + 0x08,0x09,0x09,0x12,0x14,0x3B,0x32,0x52,0x93,0x12,0x12,0x13,0x12,0x12,0x12,0x12, + 0x10,0x10,0x08,0x08,0x04,0xFA,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xD9AC [?] [5276]*/ + 0x08,0x08,0x08,0x14,0x12,0x30,0x30,0x51,0x92,0x14,0x10,0x10,0x11,0x11,0x12,0x14, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xD9AD [?] [5277]*/ + 0x08,0x08,0x0F,0x12,0x11,0x30,0x30,0x51,0x96,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x80,0x40,0xFE,0x08,0x10,0xA0,0x40,0xB0,0x0E,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xD9AE [?] [5278]*/ + 0x10,0x10,0x10,0x27,0x20,0x61,0x62,0xA4,0x21,0x21,0x20,0x20,0x20,0x21,0x22,0x2C, + 0x80,0x40,0x40,0xFC,0x00,0x10,0x08,0x04,0x10,0x10,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xD9AF [?] [5279]*/ + 0x10,0x10,0x10,0x27,0x24,0x68,0x61,0xA1,0x23,0x25,0x29,0x21,0x21,0x21,0x21,0x21, + 0x40,0x40,0x40,0xFC,0x84,0x88,0x40,0x44,0x48,0x30,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xD9B0 [?] [5280]*/ + 0x08,0x08,0x08,0x11,0x13,0x30,0x31,0x51,0x91,0x12,0x10,0x17,0x10,0x10,0x10,0x10, + 0x40,0x40,0x90,0x08,0xFC,0x24,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xD9B1 [?] [5281]*/ + 0x10,0x10,0x17,0x20,0x23,0x60,0x67,0xA0,0x21,0x21,0x22,0x22,0x24,0x28,0x20,0x20, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFE,0x90,0x10,0xFE,0x10,0x90,0x50,0x10,0x50,0x20, + /* 0xD9B2 [?] [5282]*/ + 0x08,0x0B,0x08,0x12,0x11,0x30,0x33,0x52,0x92,0x12,0x12,0x12,0x12,0x14,0x14,0x18, + 0x00,0xFC,0x90,0x94,0x98,0x90,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD9B3 [?] [5283]*/ + 0x10,0x1F,0x10,0x20,0x27,0x64,0x64,0xA4,0x26,0x25,0x24,0x24,0x24,0x24,0x24,0x25, + 0x00,0xFE,0x00,0x00,0xBC,0xA4,0xA4,0xA4,0xB4,0xAC,0xA4,0xA4,0xA4,0xA4,0xA4,0xAC, + /* 0xD9B4 [?] [5284]*/ + 0x08,0x08,0x08,0x10,0x17,0x30,0x32,0x51,0x91,0x10,0x11,0x12,0x14,0x10,0x11,0x10, + 0x50,0x48,0x48,0x40,0xFE,0x40,0x44,0x64,0x68,0xD0,0x50,0x48,0x44,0x42,0x40,0x80, + /* 0xD9B5 [?] [5285]*/ + 0x10,0x17,0x14,0x24,0x27,0x64,0x64,0xA7,0x20,0x20,0x27,0x20,0x20,0x20,0x2F,0x20, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xD9B6 [?] [5286]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x30,0x30,0x57,0x90,0x10,0x1F,0x10,0x10,0x11,0x12,0x14, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xD9B7 [?] [5287]*/ + 0x10,0x10,0x17,0x24,0x27,0x64,0x67,0xA0,0x3F,0x21,0x22,0x23,0x20,0x20,0x20,0x20, + 0x40,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xD9B8 [?] [5288]*/ + 0x10,0x17,0x10,0x21,0x20,0x67,0x64,0xA4,0x27,0x24,0x24,0x27,0x24,0x24,0x24,0x24, + 0x00,0xF8,0x10,0xA0,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xD9B9 [?] [5289]*/ + 0x10,0x10,0x11,0x22,0x27,0x61,0x61,0xA3,0x24,0x20,0x2F,0x20,0x20,0x21,0x22,0x2C, + 0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xD9BA [?] [5290]*/ + 0x08,0x08,0x0F,0x10,0x13,0x30,0x37,0x51,0x92,0x14,0x11,0x10,0x17,0x10,0x10,0x10, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x48,0x46,0xF0,0x40,0xFC,0x40,0x40,0x40, + /* 0xD9BB [?] [5291]*/ + 0x08,0x08,0x0F,0x10,0x13,0x30,0x37,0x50,0x93,0x12,0x13,0x12,0x13,0x12,0x12,0x12, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xD9BC [?] [5292]*/ + 0x11,0x11,0x17,0x21,0x21,0x60,0x67,0xA0,0x21,0x23,0x25,0x29,0x21,0x21,0x21,0x21, + 0x08,0x08,0xFE,0x08,0x48,0x40,0xFE,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xD9BD [?] [5293]*/ + 0x08,0x08,0x08,0x17,0x10,0x30,0x30,0x53,0x90,0x10,0x10,0x17,0x10,0x10,0x10,0x10, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xD9BE [?] [5294]*/ + 0x08,0x08,0x08,0x10,0x13,0x32,0x33,0x52,0x93,0x12,0x10,0x17,0x10,0x10,0x10,0x10, + 0x40,0x40,0x7E,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x44,0x40,0xFE,0x40,0x40,0x40,0x40, + /* 0xD9BF [?] [5295]*/ + 0x10,0x10,0x11,0x21,0x2A,0x6C,0xA9,0x2E,0x28,0x28,0x2B,0x28,0x28,0x21,0x22,0x24, + 0x80,0x80,0xF8,0x08,0x90,0x60,0x98,0x46,0x50,0x48,0xFC,0x40,0xA0,0x10,0x08,0x04, + /* 0xD9C0 [?] [5296]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x32,0x32,0x53,0x90,0x17,0x10,0x11,0x12,0x14,0x10,0x10, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xD9C1 [?] [5297]*/ + 0x08,0x0B,0x08,0x10,0x17,0x31,0x32,0x54,0x90,0x17,0x11,0x12,0x11,0x10,0x10,0x13, + 0x38,0xC0,0x40,0x40,0xFC,0x50,0x48,0x86,0x80,0xFC,0x10,0x10,0xA0,0x60,0x90,0x08, + /* 0xD9C2 [?] [5298]*/ + 0x08,0x08,0x0B,0x12,0x12,0x33,0x32,0x52,0x93,0x10,0x11,0x17,0x10,0x10,0x10,0x10, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xD9C3 [?] [5299]*/ + 0x10,0x17,0x14,0x24,0x25,0x64,0x64,0xA7,0x24,0x25,0x25,0x25,0x25,0x24,0x24,0x28, + 0x00,0xFC,0x44,0x44,0xF4,0x44,0x44,0xFC,0x04,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xD9C4 [?] [5300]*/ + 0x08,0x08,0x0B,0x12,0x14,0x31,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD9C5 [?] [5301]*/ + 0x08,0x08,0x08,0x13,0x12,0x34,0x31,0x52,0x90,0x11,0x10,0x10,0x10,0x10,0x17,0x10, + 0x40,0x20,0x20,0xFE,0x02,0x94,0x08,0x04,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xD9C6 [?] [5302]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x32,0x32,0x53,0x92,0x12,0x12,0x12,0x12,0x14,0x14,0x18, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xD9C7 [?] [5303]*/ + 0x10,0x10,0x17,0x20,0x22,0x6F,0x62,0xA0,0x27,0x24,0x24,0x24,0x24,0x20,0x23,0x2C, + 0x40,0x40,0xFC,0x40,0x48,0xFE,0x08,0x00,0xFC,0x04,0x44,0x44,0x44,0xB0,0x0C,0x02, + /* 0xD9C8 [?] [5304]*/ + 0x08,0x0B,0x0A,0x12,0x12,0x32,0x32,0x52,0x92,0x13,0x12,0x12,0x12,0x12,0x12,0x13, + 0x00,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x20,0xFE,0x48,0xC8,0x30,0x48,0x84,0xFE, + /* 0xD9C9 [?] [5305]*/ + 0x0A,0x0A,0x0B,0x12,0x12,0x33,0x32,0x50,0x93,0x12,0x12,0x13,0x12,0x12,0x13,0x12, + 0x20,0x24,0xA8,0x30,0xA2,0x22,0x5E,0x80,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xD9CA [?] [5306]*/ + 0x08,0x0B,0x0A,0x13,0x12,0x33,0x31,0x53,0x94,0x12,0x12,0x12,0x13,0x10,0x10,0x10, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xD9CB [?] [5307]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x32,0x32,0x53,0x90,0x17,0x12,0x12,0x12,0x12,0x13,0x12, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x00,0xFE,0x40,0x44,0x28,0x90,0x08,0x06, + /* 0xD9CC [?] [5308]*/ + 0x11,0x11,0x13,0x24,0x2B,0x61,0x62,0xA4,0x21,0x22,0x20,0x21,0x25,0x25,0x28,0x20, + 0x00,0x00,0xFC,0x94,0x94,0x64,0x54,0x84,0x28,0x10,0x40,0x24,0x2A,0x0A,0xF8,0x00, + /* 0xD9CD [?] [5309]*/ + 0x08,0x09,0x08,0x10,0x13,0x30,0x31,0x52,0x90,0x17,0x10,0x11,0x11,0x10,0x11,0x16, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xD9CE [?] [5310]*/ + 0x08,0x0A,0x09,0x10,0x17,0x34,0x38,0x53,0x92,0x12,0x13,0x10,0x11,0x11,0x12,0x14, + 0x40,0x48,0x50,0x40,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0xA0,0x20,0x24,0x24,0x1C, + /* 0xD9CF [?] [5311]*/ + 0x10,0x10,0x17,0x24,0x28,0x63,0x62,0xA2,0x23,0x22,0x22,0x2F,0x20,0x21,0x22,0x24, + 0x80,0x40,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x10,0x08,0x04, + /* 0xD9D0 [?] [5312]*/ + 0x10,0x10,0x17,0x21,0x21,0x69,0x65,0xA5,0x22,0x22,0x25,0x25,0x29,0x20,0x20,0x20, + 0x28,0x24,0x40,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x48,0x7E,0x40,0x40, + /* 0xD9D1 [?] [5313]*/ + 0x09,0x09,0x0B,0x12,0x15,0x32,0x31,0x52,0x94,0x10,0x13,0x10,0x11,0x12,0x15,0x10, + 0x00,0x10,0xDC,0x54,0x54,0x88,0x08,0xF4,0x02,0x00,0xFC,0x40,0x50,0x48,0x44,0x80, + /* 0xD9D2 [?] [5314]*/ + 0x10,0x17,0x10,0x23,0x20,0x63,0x62,0xA3,0x21,0x2F,0x20,0x23,0x22,0x22,0x23,0x22, + 0x40,0xFC,0x40,0xF8,0x00,0xF8,0x08,0xF8,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xD9D3 [?] [5315]*/ + 0x12,0x12,0x17,0x22,0x24,0x67,0x64,0xA8,0x27,0x25,0x25,0x27,0x25,0x20,0x22,0x21, + 0x88,0x88,0xE8,0x90,0x1E,0xE4,0x54,0x54,0x54,0x54,0x54,0x48,0x48,0x54,0x94,0x22, + /* 0xD9D4 [?] [5316]*/ + 0x10,0x17,0x11,0x25,0x27,0x63,0x65,0xA9,0x20,0x23,0x22,0x22,0x23,0x22,0x22,0x23, + 0x00,0xBC,0x08,0x28,0xBC,0x18,0xAA,0x46,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8, + /* 0xD9D5 [?] [5317]*/ + 0x11,0x11,0x13,0x22,0x26,0x6B,0x62,0xA2,0x23,0x22,0x22,0x23,0x22,0x25,0x24,0x28, + 0x40,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x24,0x92,0x92, + /* 0xD9D6 [?] [5318]*/ + 0x14,0x12,0x1F,0x20,0x20,0x6F,0x68,0xA8,0x2F,0x22,0x2B,0x2A,0x32,0x22,0x2A,0x24, + 0x14,0x12,0x92,0x10,0x7E,0x90,0x90,0x90,0x90,0x28,0x28,0xA8,0x28,0x4A,0x4A,0x86, + /* 0xD9D7 [?] [5319]*/ + 0x08,0x0B,0x09,0x10,0x17,0x30,0x33,0x52,0x93,0x12,0x13,0x10,0x13,0x10,0x17,0x10, + 0x40,0xF8,0x10,0xA0,0xFC,0x00,0xF8,0x48,0xF8,0x48,0xF8,0x40,0xF8,0x40,0xFE,0x00, + /* 0xD9D8 [?] [5320]*/ + 0x08,0x0B,0x0A,0x12,0x13,0x30,0x37,0x50,0x93,0x12,0x13,0x10,0x11,0x13,0x1D,0x11, + 0x00,0xFC,0x94,0x94,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0xA2,0x14,0x08,0x44,0x82, + /* 0xD9D9 [?] [5321]*/ + 0x12,0x13,0x14,0x27,0x2D,0x76,0x67,0xA4,0x25,0x24,0x25,0x24,0x25,0x29,0x29,0x31, + 0x00,0xF8,0x10,0xFE,0x48,0x24,0xFE,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x04,0xFC,0x04, + /* 0xD9DA [?] [5322]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x20,0xC0,0x1F,0x01,0x01,0x01,0x01,0x01,0x7F,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x06,0xF0,0x00,0x00,0x00,0x00,0x00,0xFC,0x00, + /* 0xD9DB [?] [5323]*/ + 0x01,0x02,0x04,0x08,0x31,0xC1,0x01,0x3D,0x05,0x09,0x09,0x11,0x21,0xC1,0x05,0x02, + 0x00,0x80,0x40,0x20,0x18,0x06,0x00,0x84,0x88,0x50,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xD9DC [?] [5324]*/ + 0x01,0x01,0x02,0x04,0x08,0x30,0xCF,0x00,0x00,0x7F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xFC,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xD9DD [?] [5325]*/ + 0x01,0x01,0x02,0x04,0x08,0x10,0x2F,0xC0,0x02,0x11,0x09,0x09,0x08,0x00,0x7F,0x00, + 0x00,0x00,0x80,0x40,0x20,0x10,0xE8,0x06,0x10,0x10,0x10,0x20,0x20,0x40,0xFC,0x00, + /* 0xD9DE [?] [5326]*/ + 0x10,0x11,0x11,0x29,0x25,0x45,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x81,0x07,0x00, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xD9DF [?] [5327]*/ + 0x01,0x02,0x0C,0x30,0xDF,0x00,0x3B,0x2A,0x3B,0x00,0x3F,0x24,0x3F,0x24,0x24,0x20, + 0x00,0x80,0x60,0x18,0xF6,0x00,0xB8,0xA8,0xB8,0x00,0xF8,0x88,0xF8,0x88,0xA8,0x10, + /* 0xD9E0 [?] [5328]*/ + 0x06,0x01,0x02,0x0C,0x31,0xC1,0x01,0x3D,0x05,0x09,0x09,0x11,0x21,0xC1,0x05,0x02, + 0x00,0x00,0x80,0x60,0x18,0x06,0x00,0x84,0x88,0x50,0x20,0x10,0x08,0x06,0x00,0x00, + /* 0xD9E1 [?] [5329]*/ + 0x06,0x01,0x02,0x04,0x18,0xE1,0x11,0x09,0x05,0x7F,0x05,0x09,0x11,0x21,0xC1,0x01, + 0x00,0x00,0x80,0x40,0x30,0x0E,0x10,0x20,0x40,0xFC,0x40,0x20,0x10,0x08,0x06,0x00, + /* 0xD9E2 [?] [5330]*/ + 0x04,0x04,0x08,0x08,0x10,0x20,0xDF,0x04,0x08,0x0F,0x00,0x00,0x00,0x00,0x01,0x00, + 0x40,0x40,0x20,0x20,0x10,0x08,0xF6,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x40,0x80, + /* 0xD9E3 [?] [5331]*/ + 0x00,0x7C,0x44,0x7C,0x40,0x42,0x3E,0x04,0x04,0x3F,0x04,0x04,0xFF,0x08,0x10,0x20, + 0x00,0xF8,0x88,0xF8,0x80,0x84,0x7C,0x40,0x40,0xF8,0x40,0x40,0xFE,0x20,0x10,0x08, + /* 0xD9E4 [?] [5332]*/ + 0x11,0x08,0x7F,0x44,0x9F,0x04,0x7F,0x01,0x1F,0x11,0x1F,0x11,0x1F,0x04,0x08,0x10, + 0x08,0x90,0xFE,0x42,0xF4,0x40,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x40,0x20,0x10, + /* 0xD9E5 [?] [5333]*/ + 0x44,0x24,0x28,0xFD,0x10,0x20,0x7D,0x45,0x45,0x7D,0x45,0x7C,0x44,0x47,0x7C,0x44, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD2,0x52,0x52,0x54,0xD4,0x08,0xCA,0x1A,0x26,0x42, + /* 0xD9E6 [?] [5334]*/ + 0x44,0x25,0x29,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x11,0x11,0xFD,0x12,0x12,0x14, + 0x00,0xFE,0x02,0x02,0xFE,0x24,0x24,0x7E,0x24,0x24,0xFE,0x52,0x54,0x48,0x64,0x42, + /* 0xD9E7 [?] [5335]*/ + 0x04,0xFF,0x11,0x13,0x52,0x5B,0x52,0x53,0x5A,0xE3,0x24,0x4F,0x94,0x03,0x1C,0xE0, + 0x40,0xFE,0x00,0xDC,0x54,0xD4,0x5C,0xD0,0x52,0xCE,0x08,0xE4,0x42,0x80,0x70,0x0E, + /* 0xD9E8 [?] [5336]*/ + 0x10,0x10,0x3F,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xD9E9 [?] [5337]*/ + 0x10,0x10,0x1F,0x22,0x42,0xBF,0x02,0x3F,0x22,0x3F,0x22,0x3F,0x22,0x22,0x22,0x20, + 0x00,0x00,0xFC,0x44,0x24,0xF4,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0x24,0xB4,0x48, + /* 0xD9EA [?] [5338]*/ + 0x10,0x10,0x1F,0x20,0x42,0xBF,0x00,0x1F,0x00,0x1F,0x00,0x1F,0x10,0x1F,0x10,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x04,0xC4,0x04,0xC4,0x04,0xC4,0x44,0xC4,0x54,0x08, + /* 0xD9EB [?] [5339]*/ + 0x10,0x10,0x1F,0x20,0x7F,0x80,0x1F,0x10,0x1F,0x00,0x3F,0x22,0x3F,0x22,0x3F,0x20, + 0x00,0x00,0xFC,0x04,0xE4,0x04,0xC4,0x44,0xC4,0x04,0xE4,0x24,0xE4,0x24,0xF4,0x28, + /* 0xD9EC [?] [5340]*/ + 0x02,0x04,0x3F,0x20,0x24,0x22,0x20,0x3F,0x00,0x1F,0x10,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0xE0,0x20,0x20,0xA0,0x40,0xF8,0x08,0x88,0xA8,0x90,0x82,0x82,0x7E,0x00, + /* 0xD9ED [?] [5341]*/ + 0x00,0x3F,0x20,0x20,0x2F,0x22,0x22,0x27,0x24,0x28,0x34,0x22,0x21,0x42,0x44,0x88, + 0x00,0xF8,0x08,0x08,0xE8,0x08,0x08,0xC8,0x48,0x48,0x88,0x8A,0x0A,0x0A,0x06,0x02, + /* 0xD9EE [?] [5342]*/ + 0x00,0x3C,0x24,0x24,0x24,0x27,0x20,0x20,0x3F,0x24,0x04,0x04,0x08,0x10,0x20,0xC0, + 0x00,0x78,0x48,0x48,0x48,0xC8,0x08,0x08,0xF8,0x48,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xD9EF [?] [5343]*/ + 0x02,0x01,0x01,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD9F0 [?] [5344]*/ + 0x02,0x01,0xFF,0x08,0x11,0x22,0x44,0x08,0x1F,0x04,0x04,0x08,0x08,0x10,0x20,0xC0, + 0x00,0x00,0xFE,0x20,0x10,0x08,0x44,0x20,0xF0,0x50,0x40,0x40,0x40,0x42,0x42,0x3E, + /* 0xD9F1 [?] [5345]*/ + 0x01,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x80,0x3F,0x02,0x03,0x7E,0x02,0x01, + 0x00,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0x00,0xF8,0x02,0x02,0xFE, + /* 0xD9F2 [?] [5346]*/ + 0x02,0x01,0xFF,0x00,0x08,0x12,0x24,0x48,0x1F,0x02,0x04,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0xFE,0x00,0x20,0x10,0x48,0x24,0xF0,0x90,0x44,0x28,0x10,0x08,0x06,0x00, + /* 0xD9F3 [?] [5347]*/ + 0x01,0xFF,0x00,0x1F,0x02,0x01,0x7F,0x04,0x18,0x62,0x03,0x04,0x0C,0x35,0xC6,0x04, + 0x00,0xFE,0x00,0xF0,0x20,0x40,0xFC,0x84,0x88,0x80,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xD9F4 [?] [5348]*/ + 0x01,0xFF,0x00,0x08,0x7D,0x08,0x0C,0x78,0x08,0x29,0x13,0x04,0x0C,0x35,0xC6,0x04, + 0x00,0xFE,0x00,0x40,0xF8,0x48,0xC8,0x4A,0xAA,0x06,0x02,0x88,0x50,0x30,0x0E,0x00, + /* 0xD9F5 [?] [5349]*/ + 0x02,0x01,0xFF,0x04,0x14,0x25,0x41,0x3F,0x22,0x24,0x29,0x21,0x22,0x24,0x20,0x20, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x04,0xF8,0x88,0x48,0x28,0x08,0x88,0x48,0x08,0x18, + /* 0xD9F6 [?] [5350]*/ + 0x02,0x01,0xFF,0x04,0x38,0x20,0x3C,0x20,0x3F,0x02,0x04,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0xFE,0x00,0x78,0x08,0x78,0x08,0xF8,0x80,0x44,0x28,0x10,0x08,0x06,0x00, + /* 0xD9F7 [?] [5351]*/ + 0x01,0xFF,0x00,0x3F,0x20,0x27,0x24,0x27,0x20,0x3F,0x00,0x3F,0x00,0xFF,0x11,0x23, + 0x00,0xFE,0x00,0xF8,0x08,0xC8,0x48,0xC8,0x08,0xF8,0x00,0xF8,0x00,0xFE,0x10,0x08, + /* 0xD9F8 [?] [5352]*/ + 0x01,0xFF,0x20,0x3F,0x00,0x3F,0x20,0x3F,0x01,0x79,0x4F,0x7A,0x4A,0x79,0x4A,0x9C, + 0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x00,0x38,0xA8,0xA8,0xB8,0x2A,0xAA,0x46, + /* 0xD9F9 [?] [5353]*/ + 0x01,0xFF,0x20,0x3F,0x00,0x3F,0x20,0x3F,0x00,0x71,0x57,0x75,0x57,0x71,0x57,0xB0, + 0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x00,0x1C,0xD4,0x54,0xDC,0x56,0xD6,0x62, + /* 0xD9FA [?] [5354]*/ + 0x01,0xFF,0x20,0x3F,0x00,0x3F,0x20,0x3F,0x04,0x72,0x57,0x71,0x53,0x71,0x57,0xB1, + 0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x40,0x9C,0xD4,0x14,0x9C,0x16,0xD6,0x22, + /* 0xD9FB [?] [5355]*/ + 0x00,0x40,0x20,0x20,0x00,0x08,0x08,0x10,0x10,0xE0,0x20,0x20,0x20,0x20,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xD9FC [?] [5356]*/ + 0x00,0x47,0x20,0x20,0x00,0x08,0x09,0x11,0x11,0x22,0xE3,0x20,0x20,0x20,0x27,0x00, + 0x00,0xFE,0x80,0x80,0x80,0xF8,0x08,0x08,0x08,0x08,0xF8,0x10,0x10,0x10,0xFE,0x00, + /* 0xD9FD [?] [5357]*/ + 0x00,0x40,0x2F,0x22,0x02,0x03,0x12,0x14,0x26,0xE5,0x29,0x21,0x22,0x22,0x24,0x08, + 0x04,0x04,0xC4,0x24,0x24,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xD9FE [?] [5358]*/ + 0x00,0x42,0x22,0x23,0x04,0x00,0x10,0x17,0x21,0xE1,0x21,0x21,0x22,0x22,0x24,0x08, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xDAA1 [?] [5359]*/ + 0x02,0x42,0x22,0x22,0x0F,0x02,0x12,0x16,0x27,0xEA,0x2A,0x32,0x22,0x22,0x22,0x02, + 0x08,0x28,0x28,0x28,0xA4,0x44,0x54,0x92,0x10,0xA0,0x20,0x28,0x44,0xFC,0x44,0x00, + /* 0xDAA2 [?] [5360]*/ + 0x00,0x7F,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xFE,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDAA3 [?] [5361]*/ + 0x00,0x7F,0x40,0x80,0x7F,0x02,0x06,0x19,0x6A,0x04,0x1B,0x62,0x0C,0x30,0xC2,0x01, + 0x00,0xFE,0x02,0x04,0xFC,0x00,0x08,0x10,0xA0,0xC0,0xA0,0x98,0x86,0x80,0x80,0x00, + /* 0xDAA4 [?] [5362]*/ + 0x00,0x7F,0x40,0x80,0x1F,0x10,0x1F,0x10,0x1F,0x12,0x01,0xFF,0x00,0x08,0x10,0x20, + 0x00,0xFE,0x02,0x04,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x00,0xFE,0x00,0x20,0x10,0x08, + /* 0xDAA5 [?] [5363]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDAA6 [?] [5364]*/ + 0x00,0x20,0x13,0x10,0x00,0x00,0xF0,0x10,0x17,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xDAA7 [?] [5365]*/ + 0x00,0x20,0x13,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x14,0x18,0x10,0x07,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xDAA8 [?] [5366]*/ + 0x00,0x20,0x10,0x10,0x01,0x01,0xF1,0x11,0x11,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x20,0x20,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00, + /* 0xDAA9 [?] [5367]*/ + 0x00,0x23,0x12,0x12,0x02,0x02,0xF2,0x12,0x12,0x12,0x12,0x12,0x17,0x1A,0x13,0x00, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xDAAA [?] [5368]*/ + 0x00,0x23,0x12,0x12,0x02,0x03,0xF2,0x12,0x12,0x12,0x13,0x12,0x16,0x1A,0x13,0x00, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xDAAB [?] [5369]*/ + 0x00,0x20,0x10,0x10,0x03,0x02,0xF2,0x12,0x12,0x12,0x12,0x13,0x16,0x1A,0x12,0x02, + 0x20,0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xDAAC [?] [5370]*/ + 0x00,0x20,0x10,0x10,0x03,0x00,0xF0,0x10,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAAD [?] [5371]*/ + 0x00,0x20,0x17,0x10,0x00,0x03,0xF2,0x12,0x12,0x12,0x13,0x12,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0x48,0x48,0xC8,0x48,0x08,0x08,0x28,0x10, + /* 0xDAAE [?] [5372]*/ + 0x00,0x20,0x13,0x12,0x02,0x02,0xF2,0x13,0x12,0x12,0x12,0x12,0x16,0x1A,0x13,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xDAAF [?] [5373]*/ + 0x00,0x23,0x10,0x10,0x00,0x01,0xF1,0x12,0x14,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAB0 [?] [5374]*/ + 0x00,0x20,0x11,0x11,0x01,0x01,0xF1,0x10,0x10,0x11,0x11,0x11,0x15,0x19,0x11,0x00, + 0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xDAB1 [?] [5375]*/ + 0x00,0x20,0x10,0x10,0x01,0x03,0xF0,0x10,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAB2 [?] [5376]*/ + 0x00,0x23,0x12,0x12,0x03,0x02,0xF2,0x12,0x12,0x12,0x12,0x13,0x16,0x1A,0x13,0x00, + 0x00,0xFE,0x00,0x00,0xFC,0x20,0x20,0xF8,0x20,0x20,0x20,0xFC,0x00,0x00,0xFE,0x00, + /* 0xDAB3 [?] [5377]*/ + 0x00,0x40,0x27,0x20,0x00,0x03,0xE0,0x20,0x27,0x20,0x21,0x29,0x32,0x24,0x08,0x00, + 0x40,0x40,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40, + /* 0xDAB4 [?] [5378]*/ + 0x00,0x20,0x11,0x10,0x00,0x00,0xF3,0x10,0x10,0x10,0x11,0x10,0x14,0x18,0x13,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xDAB5 [?] [5379]*/ + 0x00,0x20,0x10,0x17,0x00,0x00,0xF3,0x10,0x10,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAB6 [?] [5380]*/ + 0x00,0x20,0x10,0x17,0x01,0x01,0xF2,0x12,0x14,0x15,0x1A,0x10,0x14,0x19,0x12,0x04, + 0x80,0x80,0x80,0xFE,0x00,0x20,0x20,0xA4,0xA4,0x28,0x50,0x50,0x88,0x08,0x04,0x02, + /* 0xDAB7 [?] [5381]*/ + 0x00,0x21,0x11,0x11,0x01,0x02,0xF0,0x13,0x10,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x90,0x90,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xDAB8 [?] [5382]*/ + 0x00,0x40,0x23,0x22,0x02,0x03,0xE2,0x22,0x22,0x22,0x22,0x2A,0x34,0x24,0x08,0x00, + 0x08,0x3C,0xC0,0x00,0x00,0xFE,0x00,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xDAB9 [?] [5383]*/ + 0x00,0x20,0x10,0x11,0x02,0x04,0xF3,0x10,0x10,0x10,0x13,0x10,0x14,0x18,0x17,0x00, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x40,0x40,0x40,0xF8,0x40,0x40,0x40,0xFE,0x00, + /* 0xDABA [?] [5384]*/ + 0x00,0x20,0x11,0x12,0x00,0x03,0xF0,0x10,0x17,0x10,0x10,0x13,0x14,0x18,0x11,0x00, + 0x80,0x80,0xF0,0x10,0x20,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x44,0x40,0x40,0x80, + /* 0xDABB [?] [5385]*/ + 0x00,0x23,0x12,0x14,0x00,0x03,0xF0,0x10,0x11,0x11,0x10,0x14,0x1B,0x10,0x00,0x00, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xDABC [?] [5386]*/ + 0x00,0x47,0x20,0x20,0x04,0x02,0xE2,0x20,0x21,0x22,0x24,0x20,0x28,0x30,0x22,0x01, + 0x00,0xBC,0x84,0x84,0xA4,0x94,0x94,0x84,0x8C,0x94,0xA4,0x84,0x84,0x84,0x94,0x08, + /* 0xDABD [?] [5387]*/ + 0x00,0x21,0x10,0x10,0x00,0x01,0xF1,0x11,0x11,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xDABE [?] [5388]*/ + 0x00,0x21,0x11,0x11,0x02,0x04,0xF0,0x13,0x10,0x10,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xDABF [?] [5389]*/ + 0x00,0x44,0x22,0x21,0x02,0x04,0xE0,0x20,0x21,0x22,0x24,0x20,0x28,0x30,0x25,0x02, + 0x00,0x40,0xBE,0x08,0x88,0x88,0x88,0xBE,0x88,0x88,0x88,0x88,0x88,0x88,0x3E,0x00, + /* 0xDAC0 [?] [5390]*/ + 0x00,0x40,0x21,0x22,0x07,0x01,0xE1,0x23,0x24,0x20,0x2F,0x20,0x28,0x31,0x22,0x0C, + 0x40,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xDAC1 [?] [5391]*/ + 0x00,0x4F,0x24,0x24,0x04,0x07,0xE4,0x24,0x27,0x24,0x24,0x25,0x2E,0x30,0x20,0x00, + 0x00,0xC0,0xBC,0xA4,0xA4,0xA4,0xA4,0xA8,0xA8,0xA8,0x90,0xD0,0xA8,0xA8,0xC4,0x82, + /* 0xDAC2 [?] [5392]*/ + 0x00,0x4F,0x20,0x21,0x02,0x04,0xEA,0x21,0x22,0x24,0x28,0x21,0x2A,0x34,0x20,0x00, + 0x00,0xFE,0x80,0x84,0x44,0x68,0xB0,0x30,0xA8,0x68,0xA4,0x24,0x22,0x20,0xA0,0x40, + /* 0xDAC3 [?] [5393]*/ + 0x00,0x43,0x20,0x20,0x07,0x01,0xE2,0x24,0x20,0x27,0x21,0x2A,0x31,0x20,0x00,0x03, + 0x38,0xC0,0x40,0x40,0xFC,0x50,0x48,0x86,0x80,0xFC,0x10,0x10,0xA0,0x60,0x90,0x08, + /* 0xDAC4 [?] [5394]*/ + 0x00,0x41,0x26,0x24,0x04,0x07,0xE4,0x24,0x27,0x24,0x20,0x20,0x29,0x32,0x24,0x08, + 0x40,0x40,0x5C,0x44,0x44,0x5C,0x44,0x44,0xFC,0x44,0xA0,0xA0,0x10,0x08,0x04,0x02, + /* 0xDAC5 [?] [5395]*/ + 0x00,0x40,0x20,0x21,0x02,0x04,0xE8,0x23,0x20,0x20,0x20,0x29,0x35,0x25,0x09,0x00, + 0x40,0x40,0xA0,0x10,0x88,0x46,0x00,0xF0,0x10,0x20,0x40,0x24,0x22,0x0A,0x08,0xF8, + /* 0xDAC6 [?] [5396]*/ + 0x00,0x40,0x20,0x21,0x02,0x04,0xE0,0x23,0x22,0x22,0x23,0x22,0x2A,0x32,0x23,0x02, + 0x80,0x80,0xF8,0x08,0x10,0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAC7 [?] [5397]*/ + 0x00,0x40,0x27,0x20,0x01,0x01,0xE2,0x24,0x20,0x20,0x27,0x20,0x28,0x30,0x20,0x00, + 0x80,0x40,0xFC,0x00,0x10,0x10,0xA8,0x44,0x00,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xDAC8 [?] [5398]*/ + 0x01,0x41,0x27,0x21,0x01,0x01,0xE1,0x21,0x21,0x27,0x22,0x22,0x2B,0x32,0x23,0x00, + 0x10,0x10,0xFC,0x10,0xF0,0x10,0xF0,0x10,0x10,0xFE,0x00,0x90,0x08,0x00,0xFC,0x00, + /* 0xDAC9 [?] [5399]*/ + 0x00,0x40,0x2F,0x20,0x07,0x04,0xE5,0x24,0x24,0x27,0x20,0x29,0x32,0x24,0x00,0x00, + 0x40,0x40,0xFE,0x40,0xFC,0x44,0x54,0xE4,0x44,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xDACA [?] [5400]*/ + 0x00,0x20,0x10,0x13,0x02,0x02,0xF3,0x12,0x12,0x12,0x12,0x16,0x1B,0x14,0x04,0x08, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC0,0x44,0x3C,0x00,0xFC,0x80,0xFE,0x80,0x80,0xFC, + /* 0xDACB [?] [5401]*/ + 0x00,0x43,0x22,0x23,0x02,0x03,0xE1,0x23,0x24,0x22,0x22,0x22,0x2B,0x30,0x20,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0x44,0xA4,0x04,0xF4,0x04,0x28,0x10, + /* 0xDACC [?] [5402]*/ + 0x00,0x47,0x24,0x24,0x07,0x00,0xE3,0x20,0x2F,0x21,0x22,0x23,0x28,0x30,0x20,0x00, + 0x00,0xBC,0xA4,0xA4,0xBC,0x00,0xF8,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xDACD [?] [5403]*/ + 0x00,0x20,0x11,0x12,0x05,0x00,0xF3,0x12,0x12,0x13,0x12,0x12,0x17,0x1A,0x12,0x02, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xDACE [?] [5404]*/ + 0x00,0x47,0x22,0x21,0x00,0x03,0xE0,0x20,0x27,0x21,0x21,0x2A,0x32,0x24,0x08,0x03, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xDACF [?] [5405]*/ + 0x00,0x40,0x27,0x20,0x02,0x01,0xEF,0x20,0x23,0x22,0x22,0x23,0x2A,0x32,0x23,0x02, + 0x80,0x40,0xFC,0x00,0x08,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xDAD0 [?] [5406]*/ + 0x00,0x20,0x11,0x10,0x00,0x00,0xF3,0x12,0x14,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xDAD1 [?] [5407]*/ + 0x00,0x22,0x11,0x10,0x01,0x06,0xF2,0x12,0x12,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x40,0x40,0x7C,0x84,0x08,0x20,0x20,0x50,0x88,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDAD2 [?] [5408]*/ + 0x00,0x40,0x27,0x24,0x04,0x07,0xE4,0x24,0x27,0x26,0x2A,0x2B,0x3A,0x2A,0x12,0x02, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0xA4,0xA4,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xDAD3 [?] [5409]*/ + 0x01,0x41,0x27,0x21,0x00,0x03,0xE2,0x23,0x22,0x23,0x20,0x27,0x28,0x31,0x22,0x0C, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xDAD4 [?] [5410]*/ + 0x00,0x42,0x21,0x20,0x07,0x04,0xE8,0x23,0x22,0x22,0x23,0x20,0x29,0x31,0x22,0x04, + 0x40,0x48,0x50,0x40,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0xA0,0x20,0x24,0x24,0x1C, + /* 0xDAD5 [?] [5411]*/ + 0x00,0x47,0x24,0x27,0x04,0x07,0xE1,0x22,0x24,0x21,0x22,0x25,0x30,0x20,0x01,0x0E, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x10,0x08,0x84,0xF8,0x08,0x08,0x90,0x60,0x98,0x06, + /* 0xDAD6 [?] [5412]*/ + 0x02,0x41,0x21,0x20,0x07,0x00,0xE1,0x22,0x24,0x23,0x22,0x22,0x2A,0x32,0x2F,0x00, + 0x08,0x08,0x10,0x00,0xFC,0x00,0x10,0x08,0x04,0xF8,0xA8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xDAD7 [?] [5413]*/ + 0x00,0x40,0x20,0x22,0x02,0x04,0xE1,0x26,0x20,0x23,0x22,0x22,0x2A,0x32,0x27,0x00, + 0x40,0x28,0x90,0xA4,0xC2,0x8A,0x88,0x78,0x00,0xFC,0x94,0x94,0x94,0x94,0xFE,0x00, + /* 0xDAD8 [?] [5414]*/ + 0x00,0x40,0x27,0x21,0x00,0x07,0xE4,0x25,0x24,0x25,0x25,0x25,0x2D,0x34,0x24,0x04, + 0x80,0x40,0xFC,0x10,0xA0,0xFC,0x44,0xF4,0x44,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xDAD9 [?] [5415]*/ + 0x01,0x20,0x17,0x10,0x03,0x02,0xF3,0x12,0x13,0x12,0x12,0x14,0x1B,0x10,0x01,0x06, + 0x08,0x90,0xFE,0x00,0xC4,0x54,0xD4,0x54,0xD4,0x44,0xCC,0x00,0xFC,0x84,0x14,0x08, + /* 0xDADA [?] [5416]*/ + 0x00,0x47,0x21,0x25,0x07,0x03,0xE5,0x29,0x20,0x23,0x22,0x22,0x2B,0x32,0x22,0x03, + 0x00,0xBC,0x08,0x28,0xBC,0x18,0xAA,0x46,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8, + /* 0xDADB [?] [5417]*/ + 0x01,0x41,0x23,0x22,0x06,0x0B,0xE2,0x22,0x23,0x22,0x22,0x2B,0x32,0x25,0x04,0x08, + 0x40,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x24,0x92,0x92, + /* 0xDADC [?] [5418]*/ + 0x00,0x47,0x20,0x20,0x07,0x00,0xE1,0x26,0x20,0x27,0x24,0x25,0x2E,0x34,0x24,0x04, + 0x00,0xF8,0x90,0x60,0xFC,0xA4,0x28,0xA0,0x40,0xFC,0xA4,0x14,0xEC,0xA4,0xE4,0x0C, + /* 0xDADD [?] [5419]*/ + 0x01,0x41,0x27,0x21,0x01,0x07,0xE4,0x26,0x25,0x27,0x25,0x27,0x2D,0x35,0x24,0x04, + 0x08,0x08,0xCC,0x0A,0x08,0xDE,0x48,0xC8,0x48,0xC8,0x54,0xD4,0x54,0x54,0x54,0xE2, + /* 0xDADE [?] [5420]*/ + 0x02,0x43,0x24,0x27,0x0D,0x16,0xE7,0x24,0x25,0x24,0x25,0x2C,0x35,0x29,0x09,0x11, + 0x00,0xF8,0x10,0xFE,0x48,0x24,0xFE,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x04,0xFC,0x04, + /* 0xDADF [?] [5421]*/ + 0x04,0x44,0x2A,0x20,0x0F,0x02,0xEE,0x22,0x2E,0x22,0x2E,0x2A,0x32,0x2F,0x04,0x00, + 0x48,0x4C,0xAA,0x08,0xFE,0x88,0xE8,0x8A,0xEA,0x8C,0xEC,0x88,0xEA,0x1A,0x26,0x42, + /* 0xDAE0 [?] [5422]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x54,0x48,0x40,0x40,0x40, + /* 0xDAE1 [?] [5423]*/ + 0x1F,0x00,0x7D,0x05,0x09,0x31,0xC5,0x02,0x3F,0x00,0x1F,0x10,0x10,0x10,0x10,0x0F, + 0xC0,0x44,0x88,0x50,0x20,0x18,0x06,0x00,0xF8,0x00,0xF0,0x10,0x50,0x24,0x04,0xFC, + /* 0xDAE2 [?] [5424]*/ + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDAE3 [?] [5425]*/ + 0x00,0x7C,0x47,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x51,0x41,0x42,0x44, + 0x00,0x00,0xFC,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xDAE4 [?] [5426]*/ + 0x00,0x7C,0x45,0x48,0x48,0x50,0x48,0x4B,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xDAE5 [?] [5427]*/ + 0x00,0x7C,0x44,0x48,0x4B,0x50,0x48,0x48,0x44,0x47,0x44,0x68,0x50,0x41,0x41,0x42, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xDAE6 [?] [5428]*/ + 0x00,0x7C,0x45,0x49,0x49,0x51,0x49,0x49,0x45,0x45,0x45,0x69,0x51,0x42,0x42,0x44, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xDAE7 [?] [5429]*/ + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x45,0x45,0x45,0x69,0x51,0x41,0x41,0x41, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDAE8 [?] [5430]*/ + 0x00,0x7C,0x44,0x48,0x49,0x51,0x4A,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xDAE9 [?] [5431]*/ + 0x00,0x78,0x48,0x53,0x52,0x62,0x52,0x4B,0x4A,0x4A,0x6A,0x52,0x42,0x44,0x44,0x49, + 0x20,0x20,0x20,0xFE,0x22,0x24,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xDAEA [?] [5432]*/ + 0x00,0x7D,0x44,0x48,0x48,0x50,0x48,0x4B,0x44,0x45,0x44,0x68,0x50,0x40,0x43,0x40, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xDAEB [?] [5433]*/ + 0x00,0x78,0x48,0x57,0x50,0x60,0x51,0x4B,0x48,0x48,0x69,0x56,0x40,0x40,0x41,0x46, + 0x40,0x20,0x20,0xFE,0x40,0x84,0x08,0xF0,0x22,0x44,0x88,0x10,0x20,0x50,0x88,0x04, + /* 0xDAEC [?] [5434]*/ + 0x00,0x78,0x49,0x51,0x51,0x61,0x57,0x48,0x48,0x49,0x69,0x52,0x44,0x40,0x40,0x47, + 0x20,0x20,0x20,0x3C,0x20,0x20,0xFE,0x00,0x20,0x24,0x24,0x28,0x10,0x20,0xC0,0x00, + /* 0xDAED [?] [5435]*/ + 0x00,0x7D,0x45,0x49,0x49,0x51,0x49,0x49,0x44,0x44,0x45,0x68,0x50,0x40,0x43,0x40, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xDAEE [?] [5436]*/ + 0x00,0x7F,0x4A,0x52,0x52,0x63,0x52,0x4A,0x4B,0x4A,0x6A,0x52,0x47,0x40,0x40,0x40, + 0x00,0xE0,0x5E,0x52,0x52,0xD2,0x52,0x54,0xD4,0x54,0x48,0xE8,0x54,0x54,0x62,0x40, + /* 0xDAEF [?] [5437]*/ + 0x00,0x78,0x49,0x50,0x50,0x63,0x51,0x49,0x4F,0x49,0x69,0x53,0x40,0x40,0x43,0x40, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x24,0x24,0xFE,0x24,0x24,0xFE,0x20,0x20,0xFE,0x00, + /* 0xDAF0 [?] [5438]*/ + 0x00,0x78,0x4B,0x52,0x52,0x63,0x52,0x4A,0x4B,0x48,0x69,0x57,0x40,0x40,0x40,0x40, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xDAF1 [?] [5439]*/ + 0x00,0x7B,0x4A,0x4A,0x53,0x52,0x62,0x53,0x48,0x4F,0x4A,0x6A,0x52,0x42,0x43,0x42, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x00,0xFE,0x40,0x44,0x28,0x90,0x08,0x06, + /* 0xDAF2 [?] [5440]*/ + 0x00,0x7C,0x45,0x49,0x49,0x51,0x49,0x48,0x47,0x44,0x44,0x69,0x50,0x40,0x43,0x40, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xDAF3 [?] [5441]*/ + 0x00,0x78,0x4B,0x4A,0x52,0x53,0x62,0x52,0x4B,0x48,0x48,0x68,0x51,0x41,0x42,0x44, + 0x20,0x40,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x40,0xA8,0xB4,0x3C,0x22,0x22,0x1E, + /* 0xDAF4 [?] [5442]*/ + 0x00,0x7B,0x4A,0x4B,0x52,0x53,0x61,0x52,0x4B,0x49,0x4A,0x6B,0x50,0x42,0x42,0x44, + 0x00,0xFE,0x02,0xFE,0x02,0xFE,0x08,0x52,0x9C,0x08,0x52,0xDE,0x00,0xA4,0x52,0x52, + /* 0xDAF5 [?] [5443]*/ + 0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0xC8,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDAF6 [?] [5444]*/ + 0x00,0x00,0x7F,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x0F,0xF0,0x40,0x00,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDAF7 [?] [5445]*/ + 0x08,0x04,0x04,0x3F,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x40,0x40,0x80, + 0x00,0x3E,0x22,0xA4,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDAF8 [?] [5446]*/ + 0x10,0x08,0x08,0x00,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x00,0x00, + 0x00,0x3E,0x22,0x24,0xA4,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDAF9 [?] [5447]*/ + 0x10,0x20,0x7E,0x42,0x42,0x4A,0x44,0x40,0x7F,0x01,0x01,0x1D,0xE1,0x41,0x0A,0x04, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDAFA [?] [5448]*/ + 0x10,0x08,0x08,0xFF,0x10,0x10,0x1F,0x11,0x11,0x11,0x11,0x11,0x21,0x25,0x42,0x80, + 0x00,0x3E,0x22,0xA4,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDAFB [?] [5449]*/ + 0x00,0x7F,0x08,0x08,0x08,0x7F,0x48,0x48,0x54,0x52,0x62,0x40,0x40,0x40,0x42,0x41, + 0x00,0xBE,0x22,0x24,0x24,0xA8,0xA4,0xA4,0xA2,0xA2,0xA2,0xB4,0xA8,0xA0,0xA0,0x20, + /* 0xDAFC [?] [5450]*/ + 0x00,0xFF,0x08,0x08,0x10,0x14,0x32,0x51,0x90,0x10,0x10,0x00,0x0E,0xF0,0x40,0x00, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDAFD [?] [5451]*/ + 0x12,0x12,0x12,0x12,0x12,0xF3,0x12,0x12,0x12,0x12,0x12,0x32,0x52,0x93,0x12,0x00, + 0x00,0x3E,0x22,0x24,0x24,0xA8,0x24,0x24,0x22,0x22,0x22,0x34,0xA8,0x20,0x20,0x20, + /* 0xDAFE [?] [5452]*/ + 0x14,0x14,0x14,0x14,0x94,0x55,0x55,0x56,0x14,0x14,0x14,0x17,0xF8,0x40,0x00,0x00, + 0x00,0x3E,0x22,0xA4,0xA4,0x28,0x24,0x24,0x22,0x22,0x22,0xB4,0x28,0x20,0x20,0x20, + /* 0xDBA1 [?] [5453]*/ + 0x01,0x07,0x7C,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x42,0x42,0x52,0x69,0x44, + 0x00,0xBE,0x22,0x24,0x24,0x28,0x24,0xA4,0x22,0x22,0x22,0x34,0xA8,0xA0,0xA0,0xA0, + /* 0xDBA2 [?] [5454]*/ + 0x08,0x08,0x10,0x22,0x41,0xFF,0x00,0x00,0x7F,0x41,0x41,0x41,0x41,0x41,0x7F,0x41, + 0x00,0x3E,0x22,0x24,0x24,0xA8,0xA4,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBA3 [?] [5455]*/ + 0x08,0x08,0x08,0xFF,0x08,0x49,0x29,0x2A,0xFF,0x08,0x08,0x14,0x12,0x21,0x41,0x80, + 0x00,0x3E,0x22,0xA4,0x24,0x28,0x24,0x24,0xA2,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBA4 [?] [5456]*/ + 0x00,0xFF,0x08,0x10,0x22,0x41,0xFF,0x08,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF8,0x40, + 0x00,0xBE,0x22,0x24,0x24,0x28,0xA4,0xA4,0x22,0x22,0x22,0x34,0x28,0xA0,0x20,0x20, + /* 0xDBA5 [?] [5457]*/ + 0x08,0x48,0x48,0x7F,0x48,0x88,0x08,0xFF,0x18,0x1C,0x2A,0x29,0x49,0x88,0x08,0x08, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0xC8,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDBA6 [?] [5458]*/ + 0x08,0x08,0x14,0x22,0x41,0xBE,0x00,0x00,0xFF,0x10,0x10,0x22,0x41,0xFF,0x41,0x00, + 0x00,0x3E,0x22,0x24,0x24,0xA8,0x24,0x24,0xA2,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBA7 [?] [5459]*/ + 0x01,0x32,0x0C,0x12,0x69,0x08,0xFF,0x10,0x24,0x24,0x48,0x8A,0x11,0x3F,0x11,0x00, + 0x00,0x3E,0x22,0x24,0x24,0x28,0xA4,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBA8 [?] [5460]*/ + 0x20,0x20,0x7F,0x41,0x81,0x79,0x49,0x49,0x79,0x49,0x49,0x79,0x41,0x01,0x0A,0x04, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBA9 [?] [5461]*/ + 0x00,0x7F,0x48,0x08,0x7F,0x10,0x14,0x24,0x7F,0x04,0x04,0x07,0xFC,0x44,0x04,0x04, + 0x00,0xBE,0xA2,0x24,0xA4,0x28,0x24,0x24,0xA2,0x22,0x22,0xB4,0x28,0x20,0x20,0x20, + /* 0xDBAA [?] [5462]*/ + 0x00,0x7F,0x00,0x00,0x7B,0x4A,0x4A,0x4A,0x6B,0x5A,0x4A,0x4A,0x4A,0x4A,0x4A,0x5A, + 0x00,0xDE,0x12,0x12,0xD4,0x54,0x58,0x54,0x52,0xD2,0x52,0x5A,0x54,0x50,0x50,0xD0, + /* 0xDBAB [?] [5463]*/ + 0x00,0x7F,0x41,0x41,0x41,0x7F,0x00,0x7F,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDBAC [?] [5464]*/ + 0x08,0x48,0x48,0x7F,0x48,0x88,0x08,0xFF,0x00,0x00,0x7F,0x41,0x41,0x41,0x7F,0x41, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0xA4,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBAD [?] [5465]*/ + 0x30,0x0D,0x06,0x19,0x60,0x08,0x7F,0x14,0x24,0x7F,0xA4,0x24,0x26,0x25,0x04,0x04, + 0x80,0x3E,0x22,0x24,0xA4,0x28,0xE4,0x24,0x22,0xA2,0xA2,0xB4,0xA8,0x20,0x20,0x20, + /* 0xDBAE [?] [5466]*/ + 0x02,0x0F,0xF0,0x01,0x91,0x4A,0x00,0xFE,0x04,0x08,0x0F,0xF8,0x48,0x08,0x28,0x10, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBAF [?] [5467]*/ + 0x10,0x20,0x7F,0x49,0x49,0x7F,0x49,0x51,0x7F,0x24,0x44,0xFF,0x04,0x04,0x04,0x04, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0xB4,0x28,0x20,0x20,0x20, + /* 0xDBB0 [?] [5468]*/ + 0x08,0x09,0x49,0x4A,0x88,0x14,0x22,0x49,0x88,0x49,0x49,0x8A,0x14,0x22,0x41,0x80, + 0x00,0x3E,0x22,0x24,0x24,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0xA0, + /* 0xDBB1 [?] [5469]*/ + 0x00,0x7F,0x40,0x5F,0x50,0x5F,0x50,0x5F,0x44,0x7F,0x49,0x59,0x46,0x49,0x50,0x7F, + 0x00,0xDE,0x12,0x92,0x94,0x94,0x98,0x94,0x12,0xD2,0x12,0x1A,0x14,0x10,0x90,0xD0, + /* 0xDBB2 [?] [5470]*/ + 0x00,0xFF,0x14,0x14,0x7F,0x55,0x55,0x7F,0x08,0x08,0x7F,0x08,0x08,0x0F,0xF0,0x40, + 0x00,0x7C,0x44,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDBB3 [?] [5471]*/ + 0x00,0x7F,0x04,0x27,0x24,0xFF,0x20,0x3F,0x40,0x7F,0x00,0xAA,0xAA,0x00,0x05,0x02, + 0x00,0xBE,0x22,0x24,0x24,0xA8,0x24,0xA4,0x22,0xA2,0xA2,0xB4,0xA8,0xA0,0x20,0x20, + /* 0xDBB4 [?] [5472]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x08,0x7F,0x49,0x7F,0x08,0x7F,0x08,0x7F,0x08,0x0F,0xF0, + 0x00,0x7C,0xC4,0x48,0x48,0x50,0x48,0x48,0x44,0x44,0x44,0x68,0x50,0x40,0x40,0x40, + /* 0xDBB5 [?] [5473]*/ + 0x08,0x7F,0x22,0x14,0xFF,0x00,0x7F,0x41,0x7F,0x41,0x7F,0x08,0xFF,0x08,0x08,0x08, + 0x00,0x3E,0x22,0x24,0xA4,0x28,0x24,0x24,0x22,0x22,0x22,0x34,0xA8,0x20,0x20,0x20, + /* 0xDBB6 [?] [5474]*/ + 0x0F,0xF8,0x49,0x2A,0xFF,0x2A,0x49,0x80,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x41, + 0x00,0x3E,0x22,0x24,0xA4,0x28,0x24,0xA4,0x22,0x22,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBB7 [?] [5475]*/ + 0x22,0x14,0xFF,0x08,0x7F,0x08,0xFF,0x49,0x2A,0xFF,0x00,0x7F,0x41,0x41,0x7F,0x41, + 0x00,0x3E,0xA2,0x24,0x24,0x28,0xA4,0x24,0x22,0xA2,0x22,0x34,0x28,0x20,0x20,0x20, + /* 0xDBB8 [?] [5476]*/ + 0xFC,0x4B,0x78,0x4A,0x79,0x4D,0xFA,0x0C,0x07,0xF8,0x28,0x4D,0x1A,0x29,0xC8,0x08, + 0x00,0xBE,0xA2,0xA4,0x24,0x28,0xA4,0xA4,0xA2,0x22,0xA2,0x34,0x28,0x20,0xA0,0x20, + /* 0xDBB9 [?] [5477]*/ + 0x00,0x7F,0x04,0xFF,0x84,0x35,0x04,0x35,0x00,0x00,0xEE,0xAA,0xAA,0xAA,0xEE,0xAA, + 0x00,0xCE,0x0A,0xEA,0x2A,0x8A,0x0C,0x8A,0x0A,0x0A,0xEA,0xAA,0xAC,0xA8,0xE8,0xA8, + /* 0xDBBA [?] [5478]*/ + 0x2A,0x7F,0xAA,0xFF,0xAA,0xFF,0xAA,0xFF,0x00,0xFF,0x00,0x7F,0x41,0x7F,0x22,0xFF, + 0x00,0x3E,0xA2,0xA4,0xA4,0xA8,0xA4,0xA4,0x22,0xA2,0x22,0x34,0x28,0x20,0x20,0xA0, + /* 0xDBBB [?] [5479]*/ + 0x04,0x04,0x0F,0x10,0x20,0x40,0xBF,0x00,0x00,0x00,0x1F,0x00,0x00,0x00,0x3F,0x00, + 0x00,0x00,0xF0,0x10,0x20,0x40,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDBBC [?] [5480]*/ + 0x08,0x08,0x0F,0x10,0x20,0x5F,0x91,0x11,0x11,0x11,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xE0,0x20,0x40,0xF0,0x10,0x10,0x10,0x10,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xDBBD [?] [5481]*/ + 0x00,0x00,0xFF,0x20,0x20,0x20,0x3E,0x22,0x22,0x22,0x22,0x22,0x42,0x42,0x94,0x09, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0xA8,0x10, + /* 0xDBBE [?] [5482]*/ + 0x20,0x20,0x20,0x7E,0x42,0x82,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x15,0x0A, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xDBBF [?] [5483]*/ + 0x00,0x7E,0x12,0x12,0x22,0x2A,0x44,0x80,0x3E,0x22,0x22,0x22,0x22,0x3E,0x22,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0xA8,0x10, + /* 0xDBC0 [?] [5484]*/ + 0x10,0x08,0x08,0xFF,0x08,0x10,0x22,0x7C,0x09,0x12,0x24,0xC8,0x14,0x22,0xC0,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0xA8,0x10, + /* 0xDBC1 [?] [5485]*/ + 0x08,0x08,0x7F,0x11,0x11,0x25,0x42,0x00,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0xFE,0x10,0x90,0x90,0x90,0x90,0x50,0x20, + /* 0xDBC2 [?] [5486]*/ + 0x00,0x3E,0x04,0x08,0x7E,0x08,0x08,0x28,0x10,0x7F,0x55,0x55,0x55,0x57,0xFD,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xDBC3 [?] [5487]*/ + 0x00,0xFF,0x81,0xBD,0x81,0xBD,0x81,0x00,0x7E,0x42,0x7E,0x42,0x7E,0x42,0x7E,0x43, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0xA8,0x10, + /* 0xDBC4 [?] [5488]*/ + 0x10,0x10,0x7E,0x12,0x22,0x2A,0x44,0x80,0x44,0xFF,0x55,0x55,0x55,0x55,0x59,0xB3, + 0x00,0xFE,0x92,0x92,0xFE,0x92,0x92,0xFE,0x10,0x08,0x28,0x20,0x64,0xAA,0x28,0x18, + /* 0xDBC5 [?] [5489]*/ + 0x01,0x05,0x39,0x21,0x21,0x3D,0x21,0x21,0x3F,0x01,0x3F,0x08,0x04,0x03,0x1C,0xE0, + 0x00,0x00,0x78,0x08,0x08,0x78,0x08,0x08,0xF8,0x00,0xF0,0x20,0x40,0x80,0x70,0x0E, + /* 0xDBC6 [?] [5490]*/ + 0x21,0x27,0x20,0x6B,0xB0,0x23,0x20,0x53,0x4A,0x8B,0x00,0x3F,0x08,0x04,0x07,0xF8, + 0x08,0xC8,0x08,0x9A,0x2C,0x88,0x08,0x94,0x92,0xA2,0x00,0xF0,0x20,0xC0,0x80,0x7E, + /* 0xDBC7 [?] [5491]*/ + 0x7C,0x44,0x7C,0x44,0x7C,0x09,0x1F,0x31,0x5F,0x91,0x1F,0x10,0x3F,0x08,0x07,0xF8, + 0xF8,0x88,0xF8,0x88,0xF8,0x00,0xF8,0x00,0xF0,0x00,0xFC,0x00,0xF0,0x20,0xC0,0x3E, + /* 0xDBC8 [?] [5492]*/ + 0x00,0x00,0xF8,0x08,0x10,0x10,0x20,0x78,0x08,0x08,0x48,0x30,0x10,0x2C,0x43,0x80, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xDBC9 [?] [5493]*/ + 0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x00, + 0x00,0x00,0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDBCA [?] [5494]*/ + 0x01,0x01,0x01,0x01,0x5D,0x45,0x45,0x49,0x49,0x51,0x61,0x45,0x42,0x40,0x7F,0x00, + 0x00,0x00,0x00,0x10,0x24,0x44,0x84,0x44,0x24,0x14,0x14,0x04,0x04,0x04,0xFC,0x04, + /* 0xDBCB [?] [5495]*/ + 0x09,0x24,0x22,0x29,0x22,0x24,0x29,0x3F,0x10,0x10,0x11,0x1E,0x10,0x10,0x0F,0x00, + 0x20,0x48,0x88,0x28,0x88,0x48,0x28,0xF8,0x00,0x38,0xC0,0x04,0x04,0x04,0xFC,0x00, + /* 0xDBCC [?] [5496]*/ + 0x02,0x02,0x02,0x02,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x7F,0x20,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x20,0x10,0x10,0xF8,0x08,0x08,0x00, + /* 0xDBCD [?] [5497]*/ + 0x02,0x04,0x08,0x10,0x3F,0x00,0x08,0x08,0x08,0xFF,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0x00,0x20,0x10,0xF8,0x08,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xDBCE [?] [5498]*/ + 0x02,0x04,0x08,0x1F,0x02,0x7F,0x08,0x10,0x3F,0xD1,0x11,0x1F,0x11,0x11,0x1F,0x10, + 0x00,0x40,0x20,0xF0,0x00,0xFC,0x20,0x10,0xF8,0x16,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xDBCF [?] [5499]*/ + 0x00,0x7C,0x05,0x08,0x10,0x28,0x45,0x82,0x00,0x7C,0x10,0x10,0x10,0x1D,0xE1,0x42, + 0x20,0x10,0xFE,0x20,0x48,0x84,0xFE,0x02,0xA8,0xA8,0xA8,0xA8,0xAA,0x2A,0x26,0x00, + /* 0xDBD0 [?] [5500]*/ + 0x04,0x08,0x10,0x2F,0xC4,0x04,0x08,0x10,0x61,0x01,0x3F,0x01,0x01,0x01,0xFF,0x00, + 0x40,0x20,0x10,0xE8,0x26,0x20,0x20,0xA0,0x40,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xDBD1 [?] [5501]*/ + 0x00,0x7F,0x04,0x24,0x14,0x14,0x04,0xFF,0x00,0x01,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0xFC,0x40,0x48,0x48,0x50,0x40,0xFE,0x00,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00, + /* 0xDBD2 [?] [5502]*/ + 0x08,0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x10,0x11,0x16,0x01,0x3F,0x01,0x01,0xFF, + 0xA0,0x90,0x80,0xFC,0x80,0x48,0x50,0x24,0x54,0x8C,0x04,0x00,0xF8,0x00,0x00,0xFE, + /* 0xDBD3 [?] [5503]*/ + 0x10,0xFE,0x00,0x7D,0x44,0x7C,0x00,0x7C,0x08,0xFE,0x11,0x52,0x21,0x3F,0x01,0xFF, + 0x40,0x40,0x40,0xF8,0x48,0x48,0xC8,0x48,0xAA,0xAA,0x06,0x02,0x00,0xF8,0x00,0xFE, + /* 0xDBD4 [?] [5504]*/ + 0x08,0xFF,0x08,0x7F,0x49,0x7F,0x49,0x7F,0x08,0xFF,0x49,0x7F,0x01,0x3F,0x01,0xFF, + 0x00,0x78,0x48,0x48,0x86,0x00,0x78,0x48,0x28,0x90,0x28,0x44,0x00,0xF8,0x00,0xFE, + /* 0xDBD5 [?] [5505]*/ + 0x02,0x01,0xFF,0x10,0x24,0x79,0x10,0x22,0x7C,0x08,0x30,0xC0,0x01,0x3F,0x01,0xFF, + 0x00,0x00,0xFE,0x48,0xFE,0x90,0xFC,0x90,0xFC,0x90,0xFE,0x80,0x00,0xF8,0x00,0xFE, + /* 0xDBD6 [?] [5506]*/ + 0x08,0x0F,0x08,0xFF,0x80,0x7F,0x49,0x94,0x22,0x7F,0xA2,0x3E,0x01,0x3F,0x01,0xFF, + 0x00,0x00,0x7C,0xA4,0xA4,0x24,0x24,0xA8,0x10,0x28,0x44,0x02,0x00,0xF8,0x00,0xFE, + /* 0xDBD7 [?] [5507]*/ + 0x10,0x11,0x10,0x10,0x10,0xFC,0x10,0x13,0x10,0x10,0x10,0x1C,0xE0,0x40,0x00,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xDBD8 [?] [5508]*/ + 0x20,0x21,0x20,0x20,0x20,0xFB,0x20,0x20,0x21,0x21,0x20,0x38,0xE0,0x40,0x00,0x00, + 0x00,0xFC,0x00,0x00,0x00,0xFE,0x80,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xDBD9 [?] [5509]*/ + 0x10,0x10,0x10,0x10,0x11,0xFE,0x10,0x10,0x10,0x10,0x10,0x1C,0xE1,0x41,0x00,0x00, + 0x40,0x40,0x80,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xDBDA [?] [5510]*/ + 0x11,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04, + /* 0xDBDB [?] [5511]*/ + 0x10,0x10,0x10,0x13,0x12,0xFE,0x12,0x12,0x12,0x12,0x1E,0xE2,0x42,0x04,0x04,0x08, + 0x40,0x20,0x20,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDBDC [?] [5512]*/ + 0x10,0x10,0x11,0x10,0x10,0xFC,0x10,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x00,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xDBDD [?] [5513]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x00,0x00, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xDBDE [?] [5514]*/ + 0x20,0x23,0x22,0x22,0x22,0xFA,0x22,0x22,0x22,0x22,0x22,0x3A,0xE4,0x44,0x09,0x12, + 0x00,0xFE,0x00,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xDBDF [?] [5515]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xDBE0 [?] [5516]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xDBE1 [?] [5517]*/ + 0x11,0x11,0x11,0x11,0x17,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01,0x01, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xDBE2 [?] [5518]*/ + 0x10,0x10,0x10,0x10,0x13,0xFC,0x10,0x10,0x10,0x10,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0xA8,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xDBE3 [?] [5519]*/ + 0x10,0x10,0x10,0x10,0x10,0xFC,0x10,0x10,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01,0x01, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDBE4 [?] [5520]*/ + 0x20,0x20,0x20,0x20,0x20,0xFB,0x22,0x22,0x22,0x23,0x22,0x3A,0xE2,0x44,0x04,0x08, + 0x40,0x40,0x7E,0x40,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00, + /* 0xDBE5 [?] [5521]*/ + 0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x30,0x18,0x14,0x12,0x10,0x10,0x10, + /* 0xDBE6 [?] [5522]*/ + 0x10,0x10,0x13,0x12,0x12,0xFE,0x12,0x13,0x12,0x12,0x12,0x1E,0xE2,0x42,0x03,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xDBE7 [?] [5523]*/ + 0x10,0x10,0x10,0x13,0x12,0xFC,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x00,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x08,0x10,0x20,0xC0,0x02,0x02,0x02,0xFE,0x00, + /* 0xDBE8 [?] [5524]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x42,0x02,0x04, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xDBE9 [?] [5525]*/ + 0x20,0x21,0x21,0x21,0x21,0xF9,0x21,0x27,0x22,0x22,0x22,0x3A,0xE3,0x40,0x00,0x00, + 0x00,0xF8,0x08,0x48,0x28,0x08,0x08,0xFE,0x08,0x88,0x48,0x08,0xFE,0x08,0x50,0x20, + /* 0xDBEA [?] [5526]*/ + 0x20,0x21,0x21,0x22,0x22,0xF4,0x27,0x21,0x22,0x22,0x24,0x37,0xE0,0x40,0x00,0x01, + 0x20,0x20,0x20,0x20,0xFC,0xA4,0x24,0x24,0x24,0x24,0xA4,0xA4,0xC4,0x44,0x94,0x08, + /* 0xDBEB [?] [5527]*/ + 0x20,0x23,0x20,0x20,0x20,0xF8,0x24,0x22,0x22,0x22,0x20,0x38,0xE0,0x40,0x07,0x00, + 0x00,0xFC,0x90,0x90,0x90,0x92,0x92,0x94,0x94,0x98,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xDBEC [?] [5528]*/ + 0x20,0x27,0x20,0x20,0x21,0xFA,0x27,0x20,0x20,0x20,0x27,0x38,0xE0,0x40,0x0F,0x00, + 0x00,0xFE,0x40,0x80,0x10,0x08,0xFC,0x44,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xDBED [?] [5529]*/ + 0x20,0x23,0x22,0x22,0x22,0xFA,0x22,0x22,0x22,0x22,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x00,0xFE,0x02,0x02,0xFA,0x02,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x02,0x0A,0x04, + /* 0xDBEE [?] [5530]*/ + 0x10,0x11,0x11,0x11,0x11,0xFC,0x11,0x10,0x10,0x11,0x11,0x1D,0xE1,0x41,0x00,0x00, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xDBEF [?] [5531]*/ + 0x20,0x20,0x27,0x21,0x21,0xFA,0x22,0x27,0x21,0x25,0x25,0x3A,0xE2,0x45,0x08,0x10, + 0x08,0x1C,0x70,0x10,0x10,0x50,0x5C,0x50,0x50,0x50,0x50,0x7C,0x00,0x00,0xFE,0x00, + /* 0xDBF0 [?] [5532]*/ + 0x20,0x20,0x20,0x23,0x22,0xFA,0x22,0x22,0x22,0x22,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x40,0x40,0x80,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xDBF1 [?] [5533]*/ + 0x20,0x20,0x20,0x27,0x20,0xF8,0x20,0x22,0x22,0x22,0x22,0x3A,0xE2,0x42,0x03,0x00, + 0x40,0x20,0x20,0xFE,0x00,0x00,0x90,0x54,0x24,0x24,0x54,0x94,0x04,0x04,0xFC,0x04, + /* 0xDBF2 [?] [5534]*/ + 0x20,0x20,0x20,0x27,0x20,0xF8,0x21,0x23,0x20,0x20,0x39,0xE6,0x40,0x00,0x01,0x06, + 0x40,0x20,0x20,0xFE,0x40,0x84,0x08,0xF0,0x22,0x44,0x88,0x10,0x20,0x50,0x88,0x04, + /* 0xDBF3 [?] [5535]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01,0x01, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xDBF4 [?] [5536]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x10,0x10,0x13,0x10,0x10,0x1D,0xE0,0x40,0x03,0x00, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xDBF5 [?] [5537]*/ + 0x20,0x20,0x27,0x24,0x24,0xFC,0x24,0x27,0x24,0x24,0x24,0x3C,0xE7,0x44,0x00,0x00, + 0x08,0x08,0x88,0x88,0xFE,0x88,0x88,0xC8,0xA8,0xA8,0x88,0x88,0x88,0x88,0x28,0x10, + /* 0xDBF6 [?] [5538]*/ + 0x20,0x23,0x22,0x22,0x22,0xFB,0x20,0x20,0x27,0x24,0x24,0x3D,0xE6,0x44,0x04,0x04, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x40,0x40,0xFC,0x44,0xA4,0x14,0x14,0x04,0x14,0x08, + /* 0xDBF7 [?] [5539]*/ + 0x20,0x23,0x22,0x22,0x23,0xF8,0x20,0x27,0x24,0x24,0x24,0x3C,0xE4,0x41,0x06,0x18, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x44,0x44,0x44,0xB4,0x08,0x04,0x02, + /* 0xDBF8 [?] [5540]*/ + 0x10,0x10,0x13,0x10,0x12,0xFD,0x11,0x10,0x13,0x10,0x11,0x1C,0xE0,0x40,0x00,0x00, + 0x08,0x3C,0xC0,0x44,0x24,0x28,0x00,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x50,0x20, + /* 0xDBF9 [?] [5541]*/ + 0x10,0x10,0x13,0x12,0x14,0xFD,0x10,0x10,0x13,0x10,0x10,0x1C,0xE1,0x41,0x02,0x04, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xDBFA [?] [5542]*/ + 0x20,0x20,0x27,0x20,0x20,0xFB,0x22,0x23,0x22,0x23,0x22,0x3B,0xE2,0x42,0x0F,0x00, + 0x40,0x40,0xFC,0x40,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00, + /* 0xDBFB [?] [5543]*/ + 0x20,0x20,0x27,0x21,0x22,0xFC,0x23,0x22,0x22,0x23,0x22,0x3A,0xE3,0x40,0x00,0x00, + 0x40,0x80,0xFE,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xDBFC [?] [5544]*/ + 0x10,0x11,0x11,0x11,0x11,0xFD,0x10,0x10,0x11,0x12,0x14,0x1C,0xE1,0x42,0x00,0x01, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0x80,0xFE,0x4A,0x4A,0x92,0x22,0x42,0x94,0x08, + /* 0xDBFD [?] [5545]*/ + 0x20,0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x23,0x20,0x39,0xE7,0x40,0x00,0x00,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xDBFE [?] [5546]*/ + 0x20,0x20,0x20,0x20,0x21,0xFA,0x21,0x20,0x20,0x20,0x20,0x3A,0xE2,0x42,0x04,0x00, + 0x20,0x20,0x50,0x88,0x44,0x22,0xF8,0x08,0x50,0x20,0xA4,0x82,0x8A,0x8A,0x78,0x00, + /* 0xDCA1 [?] [5547]*/ + 0x20,0x23,0x22,0x22,0x22,0xFB,0x22,0x22,0x22,0x23,0x22,0x3A,0xE2,0x42,0x05,0x08, + 0x00,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0xDE,0x52,0x52,0x52,0x52,0x52,0xA6, + /* 0xDCA2 [?] [5548]*/ + 0x21,0x21,0x21,0x22,0xFA,0x27,0x2A,0x22,0x22,0x23,0x22,0x38,0xE1,0x42,0x04,0x08, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0x44,0xFC,0xA4,0xB0,0x28,0x2A,0x22,0x1E, + /* 0xDCA3 [?] [5549]*/ + 0x20,0x23,0x20,0x21,0x20,0xFB,0x20,0x27,0x24,0x28,0x23,0x3A,0xE2,0x42,0x02,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x42,0x44,0xF8,0x48,0x48,0x48,0x58,0x40, + /* 0xDCA4 [?] [5550]*/ + 0x20,0x20,0x23,0x20,0xF8,0x27,0x20,0x20,0x23,0x24,0x22,0x39,0xE2,0x44,0x01,0x00, + 0x40,0x40,0xF8,0x48,0x48,0xFE,0x48,0x48,0xF8,0x44,0xE8,0x50,0x48,0x46,0x40,0x80, + /* 0xDCA5 [?] [5551]*/ + 0x10,0x13,0x12,0x12,0x13,0xFE,0x12,0x12,0x12,0x12,0x12,0x1E,0xE2,0x44,0x04,0x08, + 0x00,0xFE,0x02,0x02,0xFE,0x10,0x92,0x92,0x92,0xFE,0x10,0x92,0x92,0x92,0xFE,0x02, + /* 0xDCA6 [?] [5552]*/ + 0x20,0x22,0x22,0x27,0x22,0xFA,0x22,0x22,0x23,0x20,0x27,0x38,0xE1,0x42,0x0C,0x00, + 0x90,0x90,0x90,0xFE,0x90,0x90,0xF0,0x00,0xFC,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xDCA7 [?] [5553]*/ + 0x20,0x27,0x20,0x20,0x27,0xFC,0x24,0x24,0x27,0x20,0x38,0xE7,0x40,0x00,0x0F,0x00, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xA4,0xFC,0x40,0x40,0xFC,0x40,0x40,0xFE,0x00, + /* 0xDCA8 [?] [5554]*/ + 0x20,0x23,0x22,0x22,0x22,0xFB,0x20,0x20,0x27,0x20,0x20,0x38,0xE1,0x41,0x02,0x04, + 0x00,0xFC,0x94,0x94,0x94,0xFC,0x80,0x40,0xFE,0x80,0xF8,0x88,0x08,0x08,0x28,0x10, + /* 0xDCA9 [?] [5555]*/ + 0x21,0x21,0x21,0x22,0xFA,0x26,0x2A,0x22,0x22,0x22,0x22,0x3A,0xE2,0x42,0x02,0x02, + 0x00,0x78,0x08,0x08,0xFE,0x40,0x40,0x7C,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xDCAA [?] [5556]*/ + 0x20,0x23,0x20,0x21,0x21,0xF9,0x21,0x20,0x23,0x22,0x22,0x3B,0xE2,0x42,0x02,0x02, + 0x00,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x8A,0x52,0xFE,0x22,0x22,0x2A,0x04, + /* 0xDCAB [?] [5557]*/ + 0x20,0x27,0x24,0x24,0x25,0xFD,0x25,0x25,0x25,0x25,0x3C,0xE4,0x49,0x0A,0x10,0x00, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xDCAC [?] [5558]*/ + 0x23,0x22,0x23,0x22,0x23,0xF8,0x27,0x24,0x24,0x27,0x20,0x3B,0xE1,0x40,0x03,0x0C, + 0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0xA4,0xA4,0xFC,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xDCAD [?] [5559]*/ + 0x20,0x27,0x24,0x25,0xF4,0x27,0x24,0x25,0x24,0x25,0x35,0xE5,0x45,0x09,0x09,0x11, + 0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x2C, + /* 0xDCAE [?] [5560]*/ + 0x22,0x21,0x24,0x22,0x20,0xF9,0x22,0x20,0x20,0x27,0x20,0x39,0xE2,0x4C,0x00,0x00, + 0x78,0x28,0x6C,0xAA,0x2A,0x48,0x98,0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xDCAF [?] [5561]*/ + 0x20,0x27,0x24,0x27,0x24,0xFC,0x24,0x24,0x25,0x24,0x3C,0xE5,0x44,0x0B,0x08,0x10, + 0x00,0xFC,0x04,0xFC,0x20,0xA8,0x70,0xA8,0x04,0xA0,0xFC,0x20,0x20,0xFE,0x20,0x20, + /* 0xDCB0 [?] [5562]*/ + 0x08,0xFF,0x08,0x3E,0x2A,0x3E,0x40,0x9F,0x01,0x7F,0x09,0x3F,0xC8,0x0F,0x08,0x0F, + 0x78,0x48,0x86,0x78,0x48,0x30,0x48,0xE4,0x00,0xFC,0x20,0xF8,0x26,0xE0,0x20,0xE0, + /* 0xDCB1 [?] [5563]*/ + 0x08,0xFF,0x08,0x7F,0x41,0x7F,0x22,0x1F,0xFF,0x11,0x1F,0x12,0x1F,0x04,0x7F,0x00, + 0x10,0x7E,0x10,0x7C,0x44,0x28,0x10,0x28,0xF6,0x10,0xF0,0x10,0xF0,0x40,0xFC,0x40, + /* 0xDCB2 [?] [5564]*/ + 0x10,0xFF,0x10,0x7C,0x00,0xFE,0x83,0x7C,0x00,0x7C,0x44,0x7C,0x45,0x2F,0xF1,0x42, + 0x20,0x20,0xBE,0x44,0x50,0x90,0x90,0xA8,0xA4,0xC2,0x20,0x10,0x54,0x42,0x4A,0x38, + /* 0xDCB3 [?] [5565]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDCB4 [?] [5566]*/ + 0x08,0x08,0xFF,0x08,0x08,0x04,0x04,0x7F,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xDCB5 [?] [5567]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20,0x40,0x80, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x10,0x20,0x7C,0x04,0x04,0x04,0x44,0x28,0x10, + /* 0xDCB6 [?] [5568]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x01,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xDCB7 [?] [5569]*/ + 0x04,0x04,0xFF,0x04,0x00,0x00,0x3F,0x01,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x01, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xDCB8 [?] [5570]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x08,0x08,0x0C,0x0A,0x11,0x10,0x20,0x20,0x43,0x8C, + 0x40,0x40,0xFE,0x40,0x00,0xF0,0x20,0x40,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xDCB9 [?] [5571]*/ + 0x08,0x08,0xFF,0x08,0x08,0x02,0x02,0x7F,0x02,0x0A,0x04,0x06,0x09,0x10,0x20,0x40, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xDCBA [?] [5572]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x00,0x00,0x3F,0x20,0x20,0x3F,0x00,0x00,0x00,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xDCBB [?] [5573]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x00,0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xDCBC [?] [5574]*/ + 0x08,0x08,0xFF,0x0A,0x04,0x08,0x1F,0x00,0x03,0x0C,0x3F,0x10,0x00,0x01,0x0E,0x70, + 0x20,0x20,0xFE,0x20,0x00,0x10,0xE0,0xC0,0x04,0x08,0xF0,0x20,0x40,0x80,0x00,0x00, + /* 0xDCBD [?] [5575]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x3F,0x01,0x01,0xFF,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x00,0x00,0xFE,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xDCBE [?] [5576]*/ + 0x08,0x08,0xFF,0x08,0x00,0x1F,0x00,0x00,0x7F,0x04,0x04,0x04,0x08,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x00,0x00,0xFC,0x40,0x40,0x40,0x44,0x44,0x44,0x3C, + /* 0xDCBF [?] [5577]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x3F,0x00,0x00,0xFF,0x02,0x04,0x08,0x10,0x3F,0x10, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x20,0x10,0xF8,0x08, + /* 0xDCC0 [?] [5578]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0xFF,0x01,0x01,0x3F,0x21,0x21,0x21,0x21,0x21,0x01, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0x28,0x10,0x00, + /* 0xDCC1 [?] [5579]*/ + 0x08,0x08,0xFF,0x09,0x01,0x7F,0x01,0x01,0x3F,0x08,0x04,0x02,0x01,0x06,0x18,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0x00,0xF0,0x20,0x40,0x80,0x00,0xC0,0x30,0x0E, + /* 0xDCC2 [?] [5580]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x21,0x21,0x2F,0x21,0x21,0x22,0x22,0x44,0x48,0x90, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xDCC3 [?] [5581]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x24,0x44,0x44,0x83, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x00,0x00,0xE0,0x20,0x20,0xA0,0x44,0x04,0x04,0xFC, + /* 0xDCC4 [?] [5582]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x3F, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0x00,0xF0,0x10,0x10,0xF0,0x00,0x00,0x00,0xFC, + /* 0xDCC5 [?] [5583]*/ + 0x08,0x08,0xFF,0x08,0x08,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x24,0x28,0x30,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x80,0x88,0x90,0xA0,0xC0,0x84,0x84,0x84,0x7C,0x00, + /* 0xDCC6 [?] [5584]*/ + 0x08,0x08,0xFF,0x08,0x08,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xDCC7 [?] [5585]*/ + 0x08,0x08,0xFF,0x08,0x09,0x01,0x3F,0x21,0x21,0x22,0x24,0x28,0x20,0x20,0x20,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x08,0x08,0x88,0x48,0x28,0x08,0x08,0x28,0x10, + /* 0xDCC8 [?] [5586]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x1F,0x10,0x11,0x11,0x11,0x12,0x02,0x04,0x18,0x60, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x80,0x82,0x82,0x7E, + /* 0xDCC9 [?] [5587]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x09,0x0E,0x08,0xFF,0x09,0x08,0x08,0x0A,0x0C,0x08, + 0x40,0x40,0xFE,0x40,0x00,0x30,0xC0,0x00,0x00,0xFE,0x00,0x80,0x40,0x30,0x0E,0x00, + /* 0xDCCA [?] [5588]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x08,0x08,0x08,0x08,0x08,0x14,0x12,0x22,0x41,0x82, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x20,0x20,0x20,0x20,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xDCCB [?] [5589]*/ + 0x08,0x08,0xFF,0x08,0x09,0x02,0x04,0x0A,0x31,0xC1,0x1F,0x00,0x00,0x00,0x00,0x01, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x40,0x20,0x18,0x06,0xE0,0x20,0x40,0x40,0x80,0x00, + /* 0xDCCC [?] [5590]*/ + 0x08,0x08,0xFF,0x08,0x10,0x10,0x1F,0x22,0x42,0x84,0x08,0x11,0x22,0x44,0x08,0x10, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xF8,0x48,0x48,0x88,0x88,0x08,0x08,0x08,0x50,0x20, + /* 0xDCCD [?] [5591]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x0F,0x10,0x21,0x41,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x40,0x40,0xFE,0x40,0x00,0x00,0xFC,0x04,0x08,0x00,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xDCCE [?] [5592]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x28,0x30,0x20, + 0x20,0x20,0xFE,0x20,0x78,0x80,0x80,0x80,0x80,0xFE,0x40,0x40,0x24,0x14,0x0C,0x04, + /* 0xDCCF [?] [5593]*/ + 0x08,0x08,0xFF,0x08,0x00,0x0F,0x08,0x10,0x60,0x00,0x1F,0x08,0x04,0x03,0x1C,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0xE0,0x20,0x20,0x1C,0x00,0xE0,0x20,0x40,0x80,0x70,0x0E, + /* 0xDCD0 [?] [5594]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x01,0x01,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, + 0x20,0x20,0xFE,0x20,0x20,0x00,0x00,0xFE,0x00,0x00,0x40,0x20,0x10,0x00,0x00,0x00, + /* 0xDCD1 [?] [5595]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x01,0x7F,0x40,0x80,0x00,0x00,0x00,0x00,0x7F,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFE,0x02,0x04,0x00,0x00,0x00,0x00,0xFC,0x00,0x00, + /* 0xDCD2 [?] [5596]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7F,0x02,0x04,0x08,0x0F,0xF8,0x48,0x08,0x08,0x28,0x10, + 0x40,0x40,0xFE,0x40,0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xDCD3 [?] [5597]*/ + 0x08,0x08,0xFF,0x08,0x00,0x24,0x22,0x21,0x21,0x20,0x20,0x24,0x28,0x30,0x21,0x06, + 0x20,0x20,0xFE,0x20,0x00,0x10,0x10,0x10,0x10,0x10,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xDCD4 [?] [5598]*/ + 0x08,0x08,0xFF,0x09,0x01,0x01,0xFF,0x01,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xFE,0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xDCD5 [?] [5599]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0xFF,0x10,0x10,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x40,0xFE,0x40,0x10,0x10,0xFE,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xDCD6 [?] [5600]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x00,0x01,0x03,0x05,0x19,0x61,0x01,0x01,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x80,0x00,0x60,0x10,0x08,0x04,0x00,0x00,0xFE,0x00, + /* 0xDCD7 [?] [5601]*/ + 0x08,0x08,0xFF,0x08,0x08,0x00,0x04,0x7F,0x04,0x04,0x08,0x08,0x10,0x23,0x4C,0x80, + 0x20,0x20,0xFE,0x20,0x20,0x40,0x20,0xFC,0x80,0x88,0x90,0xA0,0xC2,0x82,0x82,0x7E, + /* 0xDCD8 [?] [5602]*/ + 0x04,0x04,0xFF,0x04,0x02,0x02,0xFF,0x04,0x04,0x0F,0x08,0x14,0x22,0x41,0x86,0x38, + 0x40,0x40,0xFE,0x40,0x10,0x08,0xFE,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x70,0x0E, + /* 0xDCD9 [?] [5603]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xDCDA [?] [5604]*/ + 0x08,0x08,0xFF,0x08,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10,0x10,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10,0x10,0xFE,0x00, + /* 0xDCDB [?] [5605]*/ + 0x08,0x08,0xFF,0x08,0x08,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0xFF,0x20,0x20,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x08,0x28,0x10, + /* 0xDCDC [?] [5606]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x24,0x27,0x20,0x20,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xDCDD [?] [5607]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x10,0x10,0x37,0x50,0x90,0x10,0x10,0x10,0x13,0x10, + 0x40,0x40,0xFE,0x40,0x00,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0xFC,0x00, + /* 0xDCDE [?] [5608]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x10,0x13,0x30,0x51,0x90,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0xFE,0x40,0x10,0x10,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x10,0x50,0x20, + /* 0xDCDF [?] [5609]*/ + 0x08,0x08,0xFF,0x09,0x02,0x04,0x0A,0x31,0xC1,0x1F,0x00,0x00,0x0C,0x03,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x80,0x40,0x20,0x18,0x06,0xE0,0x20,0x40,0x80,0x00,0x80,0x40, + /* 0xDCE0 [?] [5610]*/ + 0x08,0x08,0xFF,0x09,0x02,0x1F,0x12,0x11,0x11,0x10,0x1F,0x00,0x7F,0x00,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0x10,0x50,0x20,0xFC,0x04,0xE4,0x04,0x28,0x10, + /* 0xDCE1 [?] [5611]*/ + 0x08,0x08,0xFF,0x08,0x06,0x78,0x40,0x40,0x7E,0x40,0x40,0x40,0x4E,0x70,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80,0x80, + /* 0xDCE2 [?] [5612]*/ + 0x08,0x08,0xFF,0x08,0x00,0x0C,0x70,0x40,0x44,0x44,0x5C,0x64,0x48,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80,0x80, + /* 0xDCE3 [?] [5613]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x81,0x01,0x3F,0x01,0x01,0x01,0x01,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xDCE4 [?] [5614]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x80,0x1F,0x04,0x04,0x3F,0x04,0x04,0x04,0x04, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xE0,0x20,0x20,0xA0,0x20,0x14,0x0C,0x04, + /* 0xDCE5 [?] [5615]*/ + 0x08,0x08,0xFF,0x08,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x20,0x20,0x24,0x28,0x30, + 0x20,0x20,0xFE,0x20,0xF8,0x08,0x08,0xF8,0x80,0x80,0xFC,0x40,0x24,0x14,0x0C,0x04, + /* 0xDCE6 [?] [5616]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x04,0x08,0x10,0x20,0xDF,0x10,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0x08,0x50,0x20,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDCE7 [?] [5617]*/ + 0x04,0x04,0xFF,0x04,0x00,0xFF,0x04,0x04,0x3F,0x24,0x24,0x28,0x30,0x20,0x3F,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xFE,0x40,0x40,0xF8,0x48,0x48,0x48,0x38,0x08,0xF8,0x08, + /* 0xDCE8 [?] [5618]*/ + 0x08,0x08,0xFF,0x08,0x01,0xFF,0x01,0x7F,0x01,0x3F,0x21,0x3F,0x02,0x04,0x18,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xFC,0x84,0x4C,0x30,0x0E, + /* 0xDCE9 [?] [5619]*/ + 0x08,0x08,0xFF,0x0A,0x02,0x7F,0x01,0x00,0x07,0x38,0x00,0x7F,0x04,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0x40,0x84,0x64,0x1C,0x00,0xFC,0x40,0x42,0x42,0x3E, + /* 0xDCEA [?] [5620]*/ + 0x08,0x08,0xFF,0x08,0x20,0x20,0x3E,0x20,0x20,0x26,0x39,0x01,0xFF,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x80,0x88,0xB0,0xC4,0x84,0x7C,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xDCEB [?] [5621]*/ + 0x08,0x08,0xFF,0x08,0x04,0x04,0x24,0x24,0x27,0x24,0x24,0x24,0x24,0x2F,0xF0,0x40, + 0x20,0x20,0xFE,0x20,0x40,0x40,0x44,0x48,0x50,0x60,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xDCEC [?] [5622]*/ + 0x08,0x08,0xFF,0x08,0x00,0x1F,0x10,0x10,0x1F,0x00,0x3F,0x20,0x20,0x20,0x3F,0x20, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDCED [?] [5623]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x20,0x2F,0x20,0x27,0x24,0x24,0x27,0x20,0x20,0x20, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0xE8,0x08,0xC8,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xDCEE [?] [5624]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x20,0x20,0x27,0x24,0x24,0x27,0x20,0x20,0x3F,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xC8,0x48,0x48,0xC8,0x08,0x08,0xF8,0x08, + /* 0xDCEF [?] [5625]*/ + 0x04,0x04,0xFF,0x05,0x11,0x11,0x3F,0x41,0x01,0xFF,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x40,0x40,0xFE,0x40,0x00,0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xDCF0 [?] [5626]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7B,0x08,0x10,0x23,0x78,0x08,0x2B,0x10,0x28,0x47,0x80, + 0x40,0x40,0xFE,0x40,0x38,0xC0,0x40,0x40,0xF8,0x40,0x40,0xFC,0x00,0x00,0xFE,0x00, + /* 0xDCF1 [?] [5627]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3F,0x02,0xFF,0x04,0x08,0x34,0xC4,0x04,0x04,0x08,0x10, + 0x20,0x20,0xFE,0x20,0xF0,0x00,0x00,0xFE,0x40,0x20,0x58,0x46,0x40,0x40,0x40,0x40, + /* 0xDCF2 [?] [5628]*/ + 0x08,0x08,0xFF,0x08,0x00,0x08,0x08,0x10,0x37,0x50,0x90,0x10,0x11,0x11,0x12,0x14, + 0x20,0x20,0xFE,0x20,0x00,0x50,0x48,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x06, + /* 0xDCF3 [?] [5629]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x13,0x30,0x50,0x9F,0x10,0x10,0x10,0x10,0x17,0x10, + 0x40,0x40,0xFE,0x40,0x10,0x78,0xC0,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0xFC,0x00, + /* 0xDCF4 [?] [5630]*/ + 0x04,0x04,0xFF,0x04,0x10,0x21,0x40,0x88,0x13,0x30,0x50,0x90,0x10,0x10,0x10,0x10, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xDCF5 [?] [5631]*/ + 0x08,0x08,0xFF,0x09,0x02,0x04,0x08,0x30,0xCF,0x01,0x01,0x1F,0x01,0x01,0x7F,0x00, + 0x20,0x20,0xFE,0x20,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xF0,0x00,0x00,0xFC,0x00, + /* 0xDCF6 [?] [5632]*/ + 0x08,0x08,0xFF,0x09,0x02,0x04,0x08,0x37,0xC0,0x00,0x3F,0x02,0x04,0x08,0x1F,0x08, + 0x20,0x20,0xFE,0x20,0x80,0x40,0x20,0xD8,0x06,0x00,0xF8,0x00,0x40,0x20,0xF0,0x10, + /* 0xDCF7 [?] [5633]*/ + 0x04,0x04,0xFF,0x14,0x10,0x1F,0x20,0x5F,0x90,0x1F,0x10,0x1F,0x10,0x00,0x00,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0xC8,0x48,0xC8,0x48,0xC8,0x48,0x08,0x50,0x20, + /* 0xDCF8 [?] [5634]*/ + 0x08,0x08,0xFF,0x08,0x02,0x07,0x08,0x34,0x02,0x01,0x0F,0x18,0xE8,0x08,0x0F,0x08, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x10,0x20,0x40,0x80,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDCF9 [?] [5635]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x7F,0x08,0x04,0x03,0x0C,0x30,0xC4,0x04,0x04,0x08,0x10, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x20,0x40,0x80,0x60,0x18,0x46,0x40,0x40,0x40,0x40, + /* 0xDCFA [?] [5636]*/ + 0x08,0x08,0xFF,0x08,0x0A,0x01,0x7F,0x08,0x10,0x24,0x44,0x02,0x01,0x06,0x18,0xE0, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFC,0x20,0x10,0x48,0x44,0x80,0x00,0xC0,0x30,0x0E, + /* 0xDCFB [?] [5637]*/ + 0x08,0x08,0xFF,0x0A,0x01,0xFF,0x04,0x08,0x10,0x3F,0x04,0x04,0x04,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x00,0x20,0x10,0xF8,0x48,0x40,0x40,0x44,0x44,0x3C, + /* 0xDCFC [?] [5638]*/ + 0x08,0x08,0xFF,0x08,0x08,0x20,0x17,0x90,0x40,0x48,0x08,0x10,0xE0,0x20,0x2F,0x20, + 0x20,0x20,0xFE,0x20,0x20,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xDCFD [?] [5639]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x81,0x11,0x1F,0x21,0x01,0xFF,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xDCFE [?] [5640]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x40,0x81,0x01,0x7D,0x05,0x09,0x11,0x21,0xC5,0x02, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0x04,0x88,0x50,0x20,0x10,0x08,0x06,0x00, + /* 0xDDA1 [?] [5641]*/ + 0x08,0x08,0xFF,0x08,0x3F,0x00,0x1F,0x00,0x3F,0x00,0xFF,0x08,0x04,0x04,0x00,0x00, + 0x20,0x20,0xFE,0x20,0xF0,0x10,0xF0,0x10,0xF0,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xDDA2 [?] [5642]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x20,0x3F,0x20,0x3F,0x22,0x21,0x20,0x24,0x28,0x30, + 0x40,0x40,0xFE,0x40,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x08,0x10,0xA0,0x40,0x30,0x0E, + /* 0xDDA3 [?] [5643]*/ + 0x04,0x04,0xFF,0x04,0x1F,0x10,0x10,0x1F,0x10,0x10,0x16,0x21,0x20,0x46,0x81,0x00, + 0x40,0x40,0xFE,0x40,0xF0,0x10,0x10,0xF0,0x80,0x40,0x20,0x10,0x88,0x06,0x80,0x40, + /* 0xDDA4 [?] [5644]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7F,0x04,0x02,0x12,0x08,0x09,0xFF,0x02,0x04,0x18,0x60, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x04,0x88,0x80,0x80,0x00,0xFE,0x40,0x20,0x10,0x08, + /* 0xDDA5 [?] [5645]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7C,0x04,0x08,0x10,0x10,0x1D,0xF1,0x12,0x10,0x50,0x20, + 0x40,0x40,0xFE,0x40,0x00,0x20,0x20,0x20,0xA8,0xA4,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xDDA6 [?] [5646]*/ + 0x08,0x08,0xFF,0x08,0x10,0x10,0x21,0x44,0xF8,0x10,0x20,0xFC,0x40,0x1C,0xE3,0x40, + 0x20,0x20,0xFE,0x20,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xDDA7 [?] [5647]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x20,0x45,0xF8,0x10,0x20,0xFC,0x40,0x1C,0xE0,0x40, + 0x40,0x40,0xFE,0x40,0x08,0x08,0x08,0xFE,0x08,0x88,0x48,0x48,0x08,0x08,0x28,0x10, + /* 0xDDA8 [?] [5648]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x10,0x7D,0x12,0x10,0x10,0x1C,0xE0,0x41,0x02,0x0C, + 0x40,0x40,0xFE,0x40,0x80,0x80,0xFC,0x04,0x48,0x40,0x40,0xA0,0xA0,0x10,0x08,0x06, + /* 0xDDA9 [?] [5649]*/ + 0x08,0x08,0xFF,0x09,0x01,0x3F,0x01,0x7F,0x40,0x9F,0x00,0x01,0xFF,0x01,0x05,0x02, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0xFE,0x02,0xE4,0x40,0x80,0xFE,0x00,0x00,0x00, + /* 0xDDAA [?] [5650]*/ + 0x04,0x04,0xFF,0x04,0x00,0x7C,0x44,0x45,0x44,0x7D,0x44,0x44,0x44,0x7C,0x44,0x00, + 0x40,0x40,0xFE,0x40,0x10,0x10,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x10,0x50,0x20, + /* 0xDDAB [?] [5651]*/ + 0x04,0x04,0xFF,0x04,0x1F,0x10,0x10,0x1F,0x01,0x7F,0x41,0x42,0x44,0x48,0x40,0x40, + 0x40,0x40,0xFE,0x40,0xF0,0x10,0x10,0xF0,0x00,0xFC,0x04,0x84,0x44,0x44,0x14,0x08, + /* 0xDDAC [?] [5652]*/ + 0x04,0x04,0xFF,0x04,0x1F,0x01,0x7F,0x05,0x09,0x31,0xCF,0x04,0x04,0x08,0x10,0x60, + 0x40,0x40,0xFE,0x70,0x80,0x00,0xFC,0x40,0x20,0x18,0xC6,0x40,0xF0,0x10,0x50,0x20, + /* 0xDDAD [?] [5653]*/ + 0x08,0x08,0xFF,0x08,0x06,0x38,0x08,0xFF,0x08,0x08,0x0E,0x78,0x08,0x08,0x28,0x13, + 0x20,0x20,0xFE,0x20,0x40,0x50,0x48,0xFE,0x40,0x40,0x24,0x28,0x12,0x2A,0xC6,0x02, + /* 0xDDAE [?] [5654]*/ + 0x04,0x04,0xFF,0x14,0x10,0x3F,0x40,0x9F,0x12,0x11,0xFF,0x22,0x21,0x3F,0x00,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x00,0xF0,0x10,0x10,0xFE,0x10,0x10,0xFC,0x10,0x60, + /* 0xDDAF [?] [5655]*/ + 0x08,0x08,0xFF,0x08,0x00,0x10,0x10,0x24,0x24,0x64,0xA5,0x24,0x24,0x20,0x20,0x23, + 0x20,0x20,0xFE,0x20,0x00,0x40,0x40,0x7E,0x88,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xDDB0 [?] [5656]*/ + 0x08,0x08,0xFF,0x08,0x08,0x08,0x10,0x33,0x50,0x90,0x12,0x11,0x11,0x10,0x17,0x10, + 0x20,0x20,0xFE,0x20,0x80,0x40,0x40,0xFC,0x00,0x08,0x08,0x10,0x10,0x20,0xFE,0x00, + /* 0xDDB1 [?] [5657]*/ + 0x08,0x08,0xFF,0x09,0x02,0x04,0x08,0x37,0xC1,0x01,0x3F,0x01,0x11,0x21,0x45,0x02, + 0x20,0x20,0xFE,0x20,0x80,0x40,0x20,0xD8,0x06,0x00,0xF8,0x00,0x10,0x08,0x04,0x00, + /* 0xDDB2 [?] [5658]*/ + 0x08,0x08,0xFF,0x08,0x09,0x02,0x04,0x08,0x37,0xC0,0x02,0x11,0x09,0x08,0x7F,0x00, + 0x20,0x20,0xFE,0x20,0x20,0x80,0x40,0x20,0xD8,0x06,0x10,0x10,0x20,0x40,0xFC,0x00, + /* 0xDDB3 [?] [5659]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x22,0x11,0x3F,0x00,0x00,0xFF,0x01,0x01,0x05,0x02, + 0x20,0x20,0xFE,0x20,0xF8,0x00,0x10,0x20,0xE0,0x40,0x80,0xFE,0x00,0x00,0x00,0x00, + /* 0xDDB4 [?] [5660]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x22,0x11,0x02,0xFF,0x04,0x08,0x1C,0x03,0x0C,0x70, + 0x20,0x20,0xFE,0x20,0xF8,0x00,0x10,0x20,0x00,0xFE,0x20,0x20,0x40,0x80,0x70,0x08, + /* 0xDDB5 [?] [5661]*/ + 0x04,0x04,0xFF,0x04,0x44,0x28,0x10,0x2B,0x48,0x98,0x28,0x49,0x89,0x0A,0x52,0x24, + 0x40,0x40,0xFE,0x40,0x90,0x88,0x88,0xFE,0xA0,0xA0,0xA0,0x20,0x20,0x22,0x22,0x1E, + /* 0xDDB6 [?] [5662]*/ + 0x04,0x04,0xFF,0x04,0x44,0x28,0x10,0x28,0x48,0x99,0x28,0x48,0x88,0x08,0x51,0x22, + 0x40,0x40,0xFE,0x40,0x20,0x20,0xA4,0xA4,0xA8,0x20,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xDDB7 [?] [5663]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x3F,0x00,0x08,0x04,0xFF,0x01,0x01,0x7F,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00,0x00,0xFC,0x00,0x00,0x00, + /* 0xDDB8 [?] [5664]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x3F,0x20,0x40,0x1F,0x00,0x7F,0x04,0x04,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x04,0x08,0xE0,0x00,0xFC,0x40,0x40,0x44,0x44,0x3C, + /* 0xDDB9 [?] [5665]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x1F,0x10,0x1F,0x10,0x1F,0x11,0x10,0x10,0x12,0x14,0x18, + 0x20,0x20,0xFE,0x20,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x04,0x88,0x50,0x20,0x18,0x06, + /* 0xDDBA [?] [5666]*/ + 0x08,0x08,0xFF,0x08,0x7F,0x42,0x9F,0x10,0x12,0x11,0x10,0x1F,0x00,0x00,0x7F,0x00, + 0x20,0x20,0xFE,0x20,0xFE,0x02,0xF4,0x10,0x10,0x50,0x20,0xFC,0x04,0x04,0xD4,0x08, + /* 0xDDBB [?] [5667]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x23,0x44,0x79,0x11,0x21,0x7D,0x00,0x1C,0xE0,0x40, + 0x40,0x40,0xFE,0x40,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x22,0x22,0x22,0x1E, + /* 0xDDBC [?] [5668]*/ + 0x08,0xFF,0x09,0x3F,0x01,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10, + 0x20,0xFE,0x20,0xF8,0x00,0xF0,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x30, + /* 0xDDBD [?] [5669]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x08,0x10,0x20, + 0x40,0x40,0xFE,0x40,0x20,0x20,0xFC,0x20,0xE0,0x20,0xE0,0x20,0xFE,0x20,0x10,0x08, + /* 0xDDBE [?] [5670]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x51,0x92,0x12,0x14, + 0x40,0x40,0xFE,0x40,0x00,0x0C,0xF0,0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xDDBF [?] [5671]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0x10,0xFD,0x31,0x3A,0x54,0x50,0x90,0x11,0x13,0x11, + 0x40,0x40,0xFE,0x40,0x10,0x90,0x90,0x08,0x48,0x44,0x42,0x90,0x88,0x08,0xFC,0x04, + /* 0xDDC0 [?] [5672]*/ + 0x08,0x08,0xFF,0x08,0x0F,0x01,0x3F,0x21,0x3F,0x01,0x7F,0x01,0x3F,0x01,0xFF,0x00, + 0x20,0x20,0xFE,0x20,0xE0,0x00,0xF8,0x08,0xF8,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x00, + /* 0xDDC1 [?] [5673]*/ + 0x08,0x08,0xFF,0x0A,0x02,0x7F,0x04,0x08,0x37,0xC0,0x3F,0x01,0x09,0x11,0x25,0x02, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x40,0x20,0xD8,0x06,0xF8,0x00,0x20,0x10,0x08,0x00, + /* 0xDDC2 [?] [5674]*/ + 0x08,0xFF,0x09,0x7F,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x02,0xFF,0x08,0x1C,0x03,0x7C, + 0x20,0xFE,0x20,0xFC,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0xFE,0x20,0x40,0xC0,0x38, + /* 0xDDC3 [?] [5675]*/ + 0x08,0x08,0xFF,0x08,0x10,0x10,0xFD,0x10,0x14,0x18,0x30,0xD1,0x11,0x12,0x54,0x20, + 0x20,0x20,0xFE,0x20,0x48,0x44,0xFE,0x40,0x40,0xFC,0xA4,0x28,0x28,0x10,0x28,0xC6, + /* 0xDDC4 [?] [5676]*/ + 0x04,0x04,0xFF,0x04,0x08,0x0F,0x08,0x08,0xFF,0x00,0x08,0x2A,0x49,0x89,0x28,0x10, + 0x40,0x40,0xFE,0x40,0x00,0x7C,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xDDC5 [?] [5677]*/ + 0x04,0x04,0xFF,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x20,0x3F,0x20,0x3F,0x20, + 0x40,0x40,0xFE,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xDDC6 [?] [5678]*/ + 0x04,0x04,0xFF,0x04,0x10,0x10,0xFE,0x92,0x92,0x92,0x92,0x9A,0x94,0x10,0x10,0x10, + 0x40,0x40,0xFE,0x40,0x20,0x20,0x3E,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xDDC7 [?] [5679]*/ + 0x08,0x08,0xFF,0x08,0x05,0x39,0x21,0x21,0x3D,0x21,0x21,0x3F,0x02,0x04,0x18,0xE0, + 0x20,0x20,0xFE,0x20,0x00,0x78,0x08,0x08,0x78,0x08,0x08,0xF8,0x80,0x40,0x30,0x0E, + /* 0xDDC8 [?] [5680]*/ + 0x08,0x08,0xFF,0x09,0x08,0x1F,0x10,0x30,0x5F,0x90,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x80,0xFC,0x80,0x80,0xF8,0x80,0x80,0xF8,0x80,0x80,0xFC,0x00, + /* 0xDDC9 [?] [5681]*/ + 0x08,0x08,0xFF,0x0A,0x04,0x3F,0x21,0x3F,0x22,0x3F,0x08,0x10,0xFF,0x00,0x00,0x00, + 0x20,0x20,0xFE,0x20,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80, + /* 0xDDCA [?] [5682]*/ + 0x08,0x08,0xFF,0x08,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x22,0x4A,0x84, + 0x20,0x20,0xFE,0x20,0xFC,0x84,0x94,0x88,0x80,0xFC,0xA4,0xA4,0xA8,0x90,0xA8,0xC6, + /* 0xDDCB [?] [5683]*/ + 0x04,0xFF,0x04,0x08,0x0F,0x10,0x20,0x5F,0x11,0x11,0x1F,0x02,0x04,0x08,0x10,0x60, + 0x40,0xFE,0x40,0x00,0xE0,0x20,0x40,0xF8,0x08,0x08,0xF8,0x80,0xA0,0x92,0x82,0x7E, + /* 0xDDCC [?] [5684]*/ + 0x04,0x04,0xFF,0x04,0x08,0x1F,0x20,0x44,0xB8,0x20,0x20,0x3C,0x20,0x20,0x3F,0x20, + 0x40,0x40,0xFE,0x40,0x00,0xE0,0x20,0x40,0x78,0x08,0x08,0x78,0x08,0x08,0xF8,0x08, + /* 0xDDCD [?] [5685]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x7F,0x08,0x08,0x14,0x22,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x20,0x20,0xFE,0x20,0x00,0xFC,0x20,0x20,0x50,0x88,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xDDCE [?] [5686]*/ + 0x04,0x04,0xFF,0x04,0x10,0x08,0x7E,0x10,0x10,0x1F,0x12,0x12,0x22,0x22,0x4A,0x84, + 0x40,0x40,0xFE,0x40,0x20,0x20,0x50,0x50,0x88,0x06,0x60,0x10,0x00,0xC0,0x30,0x08, + /* 0xDDCF [?] [5687]*/ + 0x04,0x04,0xFF,0x04,0x10,0x09,0x09,0x41,0x21,0x29,0x09,0x11,0x71,0x11,0x17,0x10, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00, + /* 0xDDD0 [?] [5688]*/ + 0x08,0xFF,0x0A,0x01,0x7F,0x40,0x80,0x3F,0x04,0x08,0x1F,0x28,0x48,0x08,0x0F,0x08, + 0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF0,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xDDD1 [?] [5689]*/ + 0x08,0x08,0xFF,0x08,0x01,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0xE4,0x20,0xE0,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xDDD2 [?] [5690]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x7F,0x40,0x90,0x1E,0x22,0x24,0x54,0x08,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x04,0xF8,0x88,0x88,0xA8,0x90,0x84,0x84,0x7C, + /* 0xDDD3 [?] [5691]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x44,0x88,0x1F,0x03,0x0C,0x3F,0x01,0x11,0x25,0x42, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x44,0x80,0x20,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xDDD4 [?] [5692]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7D,0x09,0x11,0x11,0x1D,0x31,0xD1,0x11,0x12,0x52,0x24, + 0x20,0x20,0xFE,0x20,0x1C,0xF0,0x50,0x50,0x50,0x50,0x48,0x48,0x44,0x54,0x5A,0x68, + /* 0xDDD5 [?] [5693]*/ + 0x04,0x04,0xFF,0x04,0x00,0x1F,0x40,0x51,0x49,0x43,0x45,0x49,0x55,0x42,0x7F,0x00, + 0x40,0x40,0xFE,0x40,0x00,0xE0,0x44,0x94,0x24,0xC4,0x44,0x24,0x14,0x04,0xFC,0x04, + /* 0xDDD6 [?] [5694]*/ + 0x04,0xFF,0x04,0x08,0x7F,0x08,0x3E,0x08,0x7F,0x08,0x01,0xFF,0x02,0x0C,0x30,0xC0, + 0x40,0xFE,0x40,0x00,0x7C,0x24,0x24,0x44,0x54,0x88,0x00,0xFE,0x80,0x60,0x18,0x06, + /* 0xDDD7 [?] [5695]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x7F,0x08,0xFF,0x08,0x08,0x7F,0x08,0x0F,0xF0,0x40, + 0x40,0x40,0xFE,0x40,0x00,0x08,0x08,0xFE,0x08,0x48,0x28,0x28,0x08,0x08,0x28,0x10, + /* 0xDDD8 [?] [5696]*/ + 0x04,0x04,0xFF,0x04,0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x12,0x14,0x10,0x1F, + 0x40,0x40,0xFE,0x40,0x20,0xFC,0x20,0xE0,0x20,0xE0,0x20,0xFE,0x40,0x20,0x00,0xF8, + /* 0xDDD9 [?] [5697]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x7E,0x08,0x18,0x1C,0x2A,0x2A,0x48,0x88,0x08,0x08, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xDDDA [?] [5698]*/ + 0x04,0x04,0xFF,0x04,0x00,0x00,0x3F,0x20,0x2F,0x22,0x2F,0x24,0x2D,0x42,0x45,0x88, + 0x40,0x40,0xFE,0x40,0x28,0x24,0xFE,0x20,0xA4,0x24,0xA8,0x98,0x12,0x2A,0x46,0x82, + /* 0xDDDB [?] [5699]*/ + 0x04,0x04,0xFF,0x04,0x00,0x3F,0x20,0x2F,0x28,0x2A,0x2A,0x2A,0x2A,0x45,0x49,0x90, + 0x40,0x40,0xFE,0x48,0x24,0xFE,0x20,0xA4,0xA4,0xA8,0xA8,0x90,0x92,0x2A,0x46,0x82, + /* 0xDDDC [?] [5700]*/ + 0x04,0x04,0xFF,0x04,0x20,0x3C,0x20,0x2C,0x30,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x40,0x40,0xFE,0x40,0x88,0x90,0xE4,0x84,0x7C,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xDDDD [?] [5701]*/ + 0x08,0xFF,0x08,0x1F,0x10,0x1F,0x00,0x7F,0x10,0x1F,0x10,0x1F,0x10,0xFF,0x00,0x00, + 0x20,0xFE,0x20,0xF0,0x10,0xF0,0x00,0xFC,0x10,0xF0,0x10,0xF0,0x3E,0xD0,0x10,0x10, + /* 0xDDDE [?] [5702]*/ + 0x08,0xFF,0x08,0x01,0x1F,0x11,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x11,0x02,0x0C,0x70, + 0x20,0xFE,0x20,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x00,0xF0,0x10,0x10,0xC0,0x30,0x08, + /* 0xDDDF [?] [5703]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x02,0x51,0x51,0x90,0x0F, + 0x20,0xFE,0x20,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x04,0x12,0x12,0xF0, + /* 0xDDE0 [?] [5704]*/ + 0x08,0xFF,0x08,0x00,0x3E,0x22,0x3E,0x00,0x3F,0x00,0xFF,0x08,0x0F,0x00,0x00,0x00, + 0x20,0xFE,0x20,0x00,0xF8,0x88,0xF8,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xA0,0x40, + /* 0xDDE1 [?] [5705]*/ + 0x04,0x04,0xFF,0x04,0x08,0x0B,0x12,0x32,0x53,0x90,0x17,0x10,0x11,0x12,0x1C,0x10, + 0x40,0x40,0xFE,0x40,0x00,0xF8,0x08,0x08,0xF8,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xDDE2 [?] [5706]*/ + 0x04,0x04,0xFF,0x04,0x10,0x21,0x7D,0x45,0x45,0x45,0x7D,0x45,0x45,0x45,0x7D,0x44, + 0x40,0x40,0xFE,0x40,0x00,0xFC,0x24,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE, + /* 0xDDE3 [?] [5707]*/ + 0x08,0xFF,0x09,0x7F,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x9F,0x01,0x01,0x05,0x02, + 0x20,0xFE,0x20,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x02,0xF4,0x00,0x00,0x00,0x00, + /* 0xDDE4 [?] [5708]*/ + 0x04,0x04,0xFF,0x04,0x11,0x09,0x7F,0x05,0x19,0x61,0x04,0xFF,0x08,0x1E,0x03,0x3C, + 0x40,0x40,0xFE,0x40,0x10,0x20,0xFC,0x40,0x30,0x0C,0x00,0xFE,0x20,0x40,0xC0,0x38, + /* 0xDDE5 [?] [5709]*/ + 0x04,0x04,0xFF,0x04,0x20,0x13,0x92,0x42,0x4A,0x0A,0x12,0xE2,0x22,0x24,0x24,0x28, + 0x40,0x40,0xFE,0x40,0x1C,0xE0,0x0E,0xF0,0x90,0x90,0x92,0x94,0x88,0x88,0xA4,0xC2, + /* 0xDDE6 [?] [5710]*/ + 0x08,0x08,0xFF,0x0A,0x01,0x7F,0x40,0x9F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0xFF, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0xF4,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xDDE7 [?] [5711]*/ + 0x08,0xFF,0x08,0x00,0x7C,0x44,0x44,0x7C,0x40,0x41,0x7C,0x40,0x40,0x7C,0x40,0x43, + 0x20,0xFE,0x20,0x00,0xF8,0x08,0x08,0xF8,0x00,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xDDE8 [?] [5712]*/ + 0x08,0xFF,0x08,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x08,0x17,0x21,0xDF,0x05,0x09,0x11, + 0x20,0xFE,0x20,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0xD0,0x08,0xF6,0x40,0x20,0x10, + /* 0xDDE9 [?] [5713]*/ + 0x08,0xFF,0x0A,0x3F,0x02,0xFF,0x02,0x0F,0x34,0xC3,0x00,0x1F,0x10,0x1F,0x10,0x1F, + 0x20,0xFE,0x20,0xC0,0x80,0xFE,0x20,0xC0,0x08,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xDDEA [?] [5714]*/ + 0x08,0xFF,0x08,0x3F,0x20,0x2F,0x20,0x3F,0x24,0x24,0x26,0x20,0x5F,0x44,0x82,0x00, + 0x20,0xFE,0x20,0xFC,0x00,0xF8,0x00,0xFC,0x48,0x30,0x0E,0x20,0xFC,0x20,0xA0,0x40, + /* 0xDDEB [?] [5715]*/ + 0x04,0xFF,0x04,0x1F,0x10,0x1F,0x10,0xFF,0x10,0x2F,0xC0,0x08,0x0F,0x00,0x7F,0x00, + 0x40,0xFE,0x40,0xF0,0x10,0xF0,0x10,0xFE,0x10,0xC8,0x46,0x40,0xF8,0x08,0xA8,0x10, + /* 0xDDEC [?] [5716]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x21,0x2F,0x22,0x24,0x28,0x3F,0x01,0x08,0x48,0x48,0x87, + 0x20,0xFE,0x20,0x00,0xF8,0x08,0xE8,0x88,0x48,0x28,0xF8,0x00,0x84,0x92,0x12,0xF0, + /* 0xDDED [?] [5717]*/ + 0x08,0x08,0xFF,0x08,0x10,0x17,0x20,0x62,0xA1,0x2F,0x20,0x23,0x22,0x22,0x23,0x22, + 0x20,0x20,0xFE,0xA0,0x40,0xFC,0x00,0x08,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xDDEE [?] [5718]*/ + 0x08,0xFF,0x08,0x04,0x08,0x32,0xC4,0x0F,0x00,0x7E,0x22,0x12,0x0A,0x12,0x2A,0x44, + 0x20,0xFE,0x20,0x40,0x20,0x18,0x46,0xE0,0x20,0xFC,0x44,0x24,0x14,0x24,0x54,0x88, + /* 0xDDEF [?] [5719]*/ + 0x08,0xFF,0x08,0x02,0xFF,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x4F,0x48,0x4F,0x40, + 0x20,0xFE,0x20,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x00,0xFC,0x04,0xE4,0x24,0xE4,0x0C, + /* 0xDDF0 [?] [5720]*/ + 0x08,0xFF,0x09,0x00,0x1F,0x10,0x92,0x53,0x54,0x10,0x3F,0x50,0x90,0x21,0x22,0x4C, + 0x20,0xFE,0x20,0x80,0xFC,0x00,0x00,0xF8,0x40,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xDDF1 [?] [5721]*/ + 0x08,0x08,0xFF,0x09,0x00,0xFF,0x04,0x13,0x14,0x1F,0x01,0x7F,0x44,0x4F,0x44,0x40, + 0x20,0x20,0xFE,0x20,0x80,0xFE,0x40,0x90,0x50,0xF0,0x00,0xFC,0x44,0xE4,0x24,0x0C, + /* 0xDDF2 [?] [5722]*/ + 0x08,0xFF,0x08,0x01,0x3F,0x08,0x04,0x7F,0x42,0x81,0x3F,0x04,0x07,0x08,0x10,0x20, + 0x20,0xFE,0x20,0x00,0xF8,0x20,0x40,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x10,0x50,0x20, + /* 0xDDF3 [?] [5723]*/ + 0x08,0xFF,0x08,0x10,0x08,0xFF,0x04,0x3F,0x04,0xFF,0x04,0x3F,0x0C,0x34,0xC4,0x04, + 0x20,0xFE,0x20,0x10,0x20,0xFE,0x40,0xF8,0x48,0xFE,0x48,0xF8,0x60,0x58,0x46,0x40, + /* 0xDDF4 [?] [5724]*/ + 0x08,0x08,0xFF,0x08,0x41,0x22,0xFF,0x08,0x49,0x49,0x49,0x7F,0x11,0x20,0x40,0x81, + 0x20,0x20,0xFE,0x20,0x00,0x7C,0xC4,0x44,0x7C,0x44,0x44,0x7C,0x44,0x44,0x94,0x08, + /* 0xDDF5 [?] [5725]*/ + 0x08,0x08,0xFF,0x08,0x20,0x13,0x92,0x43,0x4A,0x0B,0x12,0xE2,0x22,0x22,0x23,0x22, + 0x20,0x20,0xFE,0xA0,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x42,0x44,0x28,0x90,0x08,0x06, + /* 0xDDF6 [?] [5726]*/ + 0x08,0x08,0xFF,0x08,0x00,0x7F,0x41,0x82,0x0C,0x30,0xDF,0x01,0x3F,0x11,0x09,0x7F, + 0x20,0x20,0xFE,0x20,0x00,0xFE,0x02,0x84,0x60,0x18,0xF6,0x00,0xF8,0x10,0x20,0xFC, + /* 0xDDF7 [?] [5727]*/ + 0x08,0xFF,0x08,0x00,0x7D,0x04,0x28,0x11,0xFD,0x15,0x11,0x11,0x11,0x10,0x50,0x23, + 0x20,0xFE,0x20,0x00,0xFC,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xDDF8 [?] [5728]*/ + 0x08,0xFF,0x08,0x00,0x08,0xFF,0x08,0x7F,0x49,0x49,0x7F,0x1C,0x2A,0x49,0x88,0x08, + 0x20,0xFE,0x20,0x00,0x20,0xA0,0x3E,0x42,0x94,0x10,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xDDF9 [?] [5729]*/ + 0x08,0xFF,0x08,0x3F,0x24,0x3F,0x00,0x7F,0x40,0xBF,0x08,0x0F,0x09,0x10,0x16,0x18, + 0x20,0xFE,0x20,0xF8,0x48,0xF8,0x00,0xFE,0x02,0xF4,0x00,0xE0,0x20,0xA4,0x24,0x1C, + /* 0xDDFA [?] [5730]*/ + 0x08,0x08,0xFF,0x09,0x12,0x67,0x44,0x47,0x44,0x57,0x60,0x04,0x04,0x08,0x10,0x60, + 0x20,0x20,0xFE,0x20,0x00,0xDC,0x44,0xC4,0x44,0xDC,0x00,0x40,0x40,0x42,0x42,0x3E, + /* 0xDDFB [?] [5731]*/ + 0x04,0x04,0xFF,0x04,0x10,0x21,0x41,0x89,0x17,0x30,0x50,0x91,0x11,0x11,0x12,0x14, + 0x40,0x40,0xFE,0x40,0x20,0x3C,0x20,0x20,0xFE,0x00,0x20,0x20,0x3E,0x20,0xA0,0x7E, + /* 0xDDFC [?] [5732]*/ + 0x04,0x04,0xFF,0x04,0x08,0x08,0x14,0x22,0x5D,0x80,0x11,0x09,0x4A,0x27,0xF8,0x40, + 0x40,0x40,0xFE,0x40,0x20,0x20,0x3E,0x44,0xA4,0x24,0x28,0x28,0x10,0xA8,0x44,0x82, + /* 0xDDFD [?] [5733]*/ + 0x08,0x08,0xFF,0x08,0x20,0x10,0xFE,0x21,0x20,0x3C,0x25,0x24,0x25,0x44,0x54,0x89, + 0x20,0x20,0xFE,0x20,0x40,0x40,0xFE,0x20,0x40,0xFC,0x20,0x20,0xFE,0x50,0x88,0x06, + /* 0xDDFE [?] [5734]*/ + 0x08,0xFF,0x08,0x20,0x17,0x05,0x44,0x4F,0x59,0x6F,0x49,0x4F,0x49,0x4F,0x48,0x40, + 0x20,0xFE,0x20,0x00,0xFC,0x04,0x84,0xF4,0x04,0xE4,0x04,0xE4,0x04,0xF4,0x14,0x08, + /* 0xDEA1 [?] [5735]*/ + 0x08,0xFF,0x08,0x23,0x12,0x43,0x2A,0x0B,0x72,0x13,0x11,0xFF,0x05,0x19,0xE1,0x01, + 0x20,0xFE,0x20,0xFC,0x00,0xF8,0x08,0xF8,0x00,0xFC,0x00,0xFE,0x40,0x30,0x0E,0x00, + /* 0xDEA2 [?] [5736]*/ + 0x08,0xFF,0x0A,0x01,0x7F,0x40,0x80,0x3E,0x00,0x7E,0x14,0x14,0x14,0x24,0x24,0x43, + 0x20,0xFE,0x20,0x00,0xFE,0x02,0x24,0x38,0x20,0xF8,0x08,0x50,0x24,0x54,0x84,0xFC, + /* 0xDEA3 [?] [5737]*/ + 0x08,0xFF,0x08,0x01,0x7F,0x48,0x8B,0x10,0x33,0x52,0x92,0x13,0x12,0x12,0x13,0x12, + 0x20,0xFE,0x20,0x00,0xFE,0x02,0xF4,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xDEA4 [?] [5738]*/ + 0x08,0xFF,0x08,0x3C,0x24,0x14,0x25,0x06,0x18,0xE3,0x0C,0x31,0x06,0x38,0x07,0x38, + 0x20,0xFE,0x20,0xF8,0x48,0x28,0x48,0xC0,0x30,0x0E,0x40,0x80,0x30,0xC0,0x00,0x00, + /* 0xDEA5 [?] [5739]*/ + 0x08,0xFF,0x09,0x3F,0x01,0x1F,0x11,0x1F,0x11,0x1F,0x01,0x7F,0x02,0x49,0x48,0x87, + 0x20,0xFE,0x20,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x08,0xFC,0x04,0x08,0x24,0xE4, + /* 0xDEA6 [?] [5740]*/ + 0x08,0xFF,0x08,0x7F,0x04,0x3F,0x24,0x3F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x01,0x01, + 0x20,0xFE,0x20,0xFC,0x40,0xF8,0x48,0xF8,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0x00, + /* 0xDEA7 [?] [5741]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x28,0x25,0x2F,0x22,0x2A,0x2A,0x2F,0x22,0x44,0x44,0x88, + 0x20,0xFE,0x20,0x00,0xFE,0x90,0x10,0xBE,0x22,0xD4,0x90,0x90,0x28,0x28,0x44,0x82, + /* 0xDEA8 [?] [5742]*/ + 0x08,0xFF,0x08,0x00,0xFF,0x10,0x29,0x4E,0x96,0x25,0xCD,0x14,0x24,0xC4,0x14,0x08, + 0x20,0xFE,0x20,0x10,0x50,0x7C,0x90,0x10,0x7C,0x10,0x10,0xFE,0x40,0x30,0x0E,0x00, + /* 0xDEA9 [?] [5743]*/ + 0x08,0xFF,0x08,0x1F,0x10,0x1F,0x10,0xFF,0x22,0x3E,0x22,0x3E,0x22,0x2F,0xF2,0x42, + 0x20,0xFE,0x20,0xF0,0x10,0xF0,0x10,0xFE,0x00,0xFC,0x44,0x44,0x28,0x10,0x28,0xC6, + /* 0xDEAA [?] [5744]*/ + 0x04,0xFF,0x04,0x3E,0x22,0x3E,0x00,0xFF,0x22,0x3E,0x22,0x3E,0x22,0x2F,0xF2,0x42, + 0x40,0xFE,0x40,0x28,0x24,0x24,0x20,0xFE,0x20,0x28,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xDEAB [?] [5745]*/ + 0x08,0xFF,0x08,0x3F,0x24,0x3F,0x00,0x7F,0x40,0x9F,0x10,0x1F,0x10,0x1F,0x10,0x1F, + 0x20,0xFE,0x20,0xF8,0x48,0xF8,0x00,0xFE,0x02,0xF4,0x10,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xDEAC [?] [5746]*/ + 0x08,0xFF,0x08,0x00,0x3F,0x11,0x09,0xFF,0x09,0x30,0xDF,0x11,0x1F,0x11,0x1F,0x10, + 0x20,0xFE,0x20,0xF8,0x00,0x10,0x20,0xFE,0x20,0x18,0xF6,0x10,0xF0,0x10,0xF0,0x10, + /* 0xDEAD [?] [5747]*/ + 0x08,0xFF,0x08,0x22,0x14,0x7F,0x49,0x7F,0x49,0x7F,0x08,0xFF,0x08,0x08,0x08,0x09, + 0x20,0xFE,0x20,0x0C,0x70,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xDEAE [?] [5748]*/ + 0x08,0x08,0xFF,0x08,0x00,0x3E,0x20,0x3C,0x20,0x3C,0x20,0xFE,0x20,0x44,0xFE,0x43, + 0x20,0x20,0xFE,0x20,0x48,0x48,0x48,0xFC,0x48,0x48,0x48,0xFE,0x00,0x48,0x84,0x02, + /* 0xDEAF [?] [5749]*/ + 0x08,0xFF,0x08,0x00,0x7E,0x11,0x10,0x3C,0x25,0x64,0x94,0x09,0x08,0x10,0x23,0x40, + 0x20,0xFE,0x20,0x50,0x50,0xDC,0x50,0x50,0xDC,0x50,0x50,0xDC,0x50,0x50,0xFE,0x00, + /* 0xDEB0 [?] [5750]*/ + 0x08,0xFF,0x08,0x7F,0x44,0x7F,0x00,0x7F,0x40,0xBF,0x08,0x1F,0x62,0x14,0x18,0xE0, + 0x20,0xFE,0x20,0xFC,0x44,0xFC,0x00,0xFE,0x02,0xF4,0x40,0x48,0x50,0x62,0x42,0x3E, + /* 0xDEB1 [?] [5751]*/ + 0x04,0x04,0xFF,0x04,0x22,0x4A,0x8A,0x1F,0x20,0x6F,0xA0,0x2F,0x29,0x29,0x29,0x30, + 0x40,0x40,0xFE,0x40,0x20,0xA0,0xBE,0xC4,0xA4,0x24,0x28,0x28,0x10,0xA8,0x44,0x82, + /* 0xDEB2 [?] [5752]*/ + 0x08,0xFF,0x08,0x01,0x3F,0x08,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x49,0x48,0x87, + 0x20,0xFE,0x20,0x00,0xF8,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x04,0x92,0xF2, + /* 0xDEB3 [?] [5753]*/ + 0x08,0xFF,0x0A,0x01,0xFF,0x10,0x20,0x45,0x7B,0x11,0x25,0x7D,0x09,0x11,0x21,0xC1, + 0x20,0xFE,0x20,0x00,0xFE,0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xDEB4 [?] [5754]*/ + 0x04,0xFF,0x04,0x00,0x49,0x2A,0xFF,0x2A,0x49,0x10,0xFE,0x22,0x64,0x18,0x24,0xC2, + 0x40,0xFE,0x40,0x00,0x20,0x20,0x3E,0x44,0xA4,0x24,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xDEB5 [?] [5755]*/ + 0x08,0xFF,0x08,0x00,0x3E,0x22,0x22,0x3E,0x21,0x20,0x3E,0x52,0x52,0x9E,0x12,0x00, + 0x20,0xFE,0x20,0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0x20,0xFC,0x20,0x20,0x20,0x20, + /* 0xDEB6 [?] [5756]*/ + 0x08,0xFF,0x08,0x23,0x22,0xFA,0x4A,0x4B,0x4A,0x92,0x52,0x22,0x53,0x4A,0x84,0x08, + 0x20,0xFE,0x20,0xFE,0x00,0xFC,0x00,0xFE,0xA4,0x98,0xC6,0x08,0xFE,0x88,0x48,0x18, + /* 0xDEB7 [?] [5757]*/ + 0x08,0xFF,0x09,0xFF,0x01,0x3F,0x00,0x1F,0x10,0x7F,0x48,0x9F,0x01,0x3F,0x01,0xFF, + 0x20,0xFE,0x20,0xFE,0x00,0xF8,0x00,0xF0,0x10,0xFE,0x22,0xF4,0x00,0xF8,0x00,0xFE, + /* 0xDEB8 [?] [5758]*/ + 0x08,0xFF,0x08,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x7F,0x02,0x3F,0x24,0x24, + 0x20,0xFE,0x20,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFC,0x00,0xF8,0x48,0x58, + /* 0xDEB9 [?] [5759]*/ + 0x08,0xFF,0x08,0x3F,0x01,0xFF,0x01,0x3F,0x29,0x3F,0x01,0x3F,0x01,0xFF,0x24,0x42, + 0x20,0xFE,0x20,0xF8,0x00,0xFE,0x00,0xF8,0x28,0xF8,0x00,0xF8,0x00,0xFE,0x48,0x24, + /* 0xDEBA [?] [5760]*/ + 0x08,0x08,0xFF,0x08,0x20,0x3E,0x44,0xFF,0x49,0x7F,0x49,0x7F,0x00,0x0F,0xF0,0x40, + 0x20,0x20,0xFE,0x20,0x44,0x28,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x10,0x10,0x10, + /* 0xDEBB [?] [5761]*/ + 0x08,0xFF,0x08,0x01,0x7F,0x08,0x0F,0x00,0x7F,0x48,0x4F,0x01,0x7F,0x05,0x19,0xE1, + 0x20,0xFE,0x20,0x00,0xFC,0x20,0xE0,0x00,0xFC,0x24,0xEC,0x00,0xFC,0x40,0x30,0x0E, + /* 0xDEBC [?] [5762]*/ + 0x08,0xFF,0x08,0x06,0x38,0x08,0x7E,0x1C,0x2A,0x49,0x02,0x1D,0xE9,0x05,0x09,0x13, + 0x20,0xFE,0x20,0x40,0x7C,0x94,0x24,0x44,0x94,0x08,0xC0,0x30,0x2E,0x40,0x20,0x10, + /* 0xDEBD [?] [5763]*/ + 0x08,0xFF,0x08,0x3F,0x01,0x7F,0x41,0x9D,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F, + 0x20,0xFE,0x20,0xF8,0x00,0xFE,0x02,0x74,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC, + /* 0xDEBE [?] [5764]*/ + 0x08,0xFF,0x08,0x00,0x40,0x2F,0x28,0x0B,0xE8,0x2B,0x29,0x2A,0x31,0x22,0x51,0x8F, + 0x20,0xFE,0xA0,0xF8,0x80,0xFC,0x84,0xF0,0x88,0xF8,0x40,0xA8,0x70,0xA8,0x60,0xFE, + /* 0xDEBF [?] [5765]*/ + 0x08,0xFF,0x08,0x22,0x47,0x88,0x17,0x25,0x67,0xA5,0x27,0x21,0x2F,0x21,0x22,0x24, + 0x20,0xFE,0x20,0x00,0xDC,0x80,0xC0,0x7E,0xC8,0x48,0xC8,0x08,0xE8,0x08,0xA8,0x50, + /* 0xDEC0 [?] [5766]*/ + 0x08,0xFF,0x28,0x3F,0x40,0xBE,0x2A,0xFF,0x4A,0x7F,0x08,0x1F,0x02,0x3F,0x11,0x23, + 0x20,0xFE,0x20,0x20,0x3E,0x48,0xA8,0x28,0x10,0x28,0x46,0x80,0x10,0xF8,0x10,0x08, + /* 0xDEC1 [?] [5767]*/ + 0x04,0xFF,0x04,0x20,0x7D,0x44,0x7C,0x41,0x7C,0x45,0x7C,0x01,0x7F,0x05,0x19,0xE1, + 0x40,0xFE,0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x00,0xFC,0x40,0x30,0x0E, + /* 0xDEC2 [?] [5768]*/ + 0x08,0xFF,0x08,0x3F,0x24,0x3F,0x26,0x2D,0x34,0x21,0x3F,0x21,0x2F,0x41,0x5F,0x81, + 0x20,0xFE,0xA0,0xFE,0x10,0x7C,0x38,0x54,0x12,0x20,0x3E,0x20,0x3C,0x20,0x3E,0x20, + /* 0xDEC3 [?] [5769]*/ + 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0xFF,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xDEC4 [?] [5770]*/ + 0x02,0x01,0x7F,0x04,0x24,0x44,0x89,0x10,0x00,0x08,0x08,0xFF,0x08,0x10,0x20,0x40, + 0x00,0x00,0xFC,0x40,0x50,0x48,0x44,0x80,0x00,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xDEC5 [?] [5771]*/ + 0x01,0x01,0x7F,0x02,0x04,0x08,0x30,0xC9,0x09,0x09,0x09,0x09,0x11,0x11,0x21,0x40, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x26,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xDEC6 [?] [5772]*/ + 0x02,0x02,0x7F,0x04,0x08,0x30,0xDF,0x10,0x12,0x11,0x10,0x11,0x12,0x10,0x1F,0x00, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xF6,0x00,0x20,0x40,0x80,0x40,0x20,0x00,0xF8,0x00, + /* 0xDEC7 [?] [5773]*/ + 0x01,0x01,0x7F,0x02,0x04,0x08,0x3F,0xC8,0x0F,0x08,0x0F,0x08,0x09,0x7E,0x00,0x00, + 0x00,0x00,0xFC,0x80,0x40,0x20,0xF8,0x26,0xE0,0x20,0xE0,0x20,0xF8,0x20,0x20,0x20, + /* 0xDEC8 [?] [5774]*/ + 0x02,0x01,0x7F,0x04,0x24,0x44,0x89,0x10,0x01,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0xFC,0x40,0x50,0x48,0x44,0x80,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xDEC9 [?] [5775]*/ + 0x00,0x7F,0x22,0x15,0x08,0x1F,0x03,0x0C,0x3F,0x01,0x01,0x7F,0x02,0x04,0x18,0xE0, + 0xFC,0x00,0x08,0x10,0x40,0x80,0x20,0x10,0xF8,0x08,0x00,0xFC,0x80,0x40,0x30,0x0E, + /* 0xDECA [?] [5776]*/ + 0x24,0x24,0x24,0x3D,0x04,0xFC,0x24,0x24,0x45,0x01,0xFF,0x02,0x04,0x08,0x30,0xC0, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06, + /* 0xDECB [?] [5777]*/ + 0x10,0x10,0xFE,0x28,0x45,0x82,0x7C,0x00,0xFE,0x20,0x40,0x7C,0x04,0x04,0x28,0x10, + 0x40,0x40,0xFC,0x84,0x04,0xF4,0x94,0x94,0xF4,0x84,0x94,0x88,0x82,0x82,0x7E,0x00, + /* 0xDECC [?] [5778]*/ + 0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x00,0x00,0x00,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x82,0x82,0x82,0x7E,0x00, + /* 0xDECD [?] [5779]*/ + 0x20,0x20,0x20,0x21,0xFD,0x2A,0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x48,0x47,0x80, + 0x80,0x80,0x80,0xF8,0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x50,0x22,0x02,0xFE,0x00, + /* 0xDECE [?] [5780]*/ + 0x20,0x20,0x20,0x20,0xFD,0x2A,0x28,0x28,0x28,0x28,0x29,0x29,0x2A,0x48,0x47,0x80, + 0x20,0x20,0x50,0x88,0x04,0x02,0x88,0x88,0x88,0x88,0x08,0x08,0x0A,0x02,0xFE,0x00, + /* 0xDECF [?] [5781]*/ + 0x20,0x22,0x22,0x22,0xFE,0x2A,0x28,0x2B,0x2A,0x2A,0x2A,0x2F,0x28,0x48,0x47,0x80, + 0x90,0x90,0xBC,0xD0,0x88,0x88,0x00,0xF8,0xA8,0xA8,0xA8,0xFE,0x02,0x02,0xFE,0x00, + /* 0xDED0 [?] [5782]*/ + 0x10,0x10,0x10,0x10,0xF8,0x10,0x14,0x18,0x30,0xD0,0x10,0x10,0x10,0x10,0x50,0x20, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xDED1 [?] [5783]*/ + 0x11,0x10,0x10,0x12,0xFA,0x12,0x16,0x1A,0x32,0xD2,0x12,0x12,0x12,0x12,0x52,0x22, + 0x00,0x80,0xBC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xDED2 [?] [5784]*/ + 0x10,0x10,0x10,0x11,0xFC,0x10,0x11,0x14,0x18,0x31,0xD0,0x10,0x10,0x10,0x50,0x20, + 0x20,0x20,0x20,0xFC,0x20,0x40,0xFE,0x40,0x80,0xFC,0x04,0x88,0x50,0x20,0x10,0x10, + /* 0xDED3 [?] [5785]*/ + 0x10,0x10,0x10,0x13,0xFA,0x12,0x16,0x1B,0x32,0xD2,0x12,0x13,0x12,0x10,0x50,0x20, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0xFE,0x22,0x20,0x20,0x20, + /* 0xDED4 [?] [5786]*/ + 0x10,0x10,0x10,0x11,0xFD,0x13,0x15,0x11,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x88,0x88,0x88,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xDED5 [?] [5787]*/ + 0x10,0x10,0x10,0x10,0xFD,0x13,0x10,0x14,0x18,0x33,0xD0,0x10,0x11,0x11,0x52,0x24, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x88,0x88,0xFE,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xDED6 [?] [5788]*/ + 0x20,0x21,0x21,0x22,0xFA,0x24,0x27,0x29,0x32,0xE2,0x24,0x27,0x20,0x20,0xA0,0x41, + 0x20,0x20,0x20,0x20,0xFC,0xA4,0x24,0x24,0x24,0x24,0xA4,0xA4,0xC4,0x44,0x94,0x08, + /* 0xDED7 [?] [5789]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x11,0x14,0x18,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDED8 [?] [5790]*/ + 0x20,0x20,0x23,0x20,0xF8,0x27,0x20,0x29,0x32,0xE5,0x21,0x21,0x21,0x22,0xA2,0x44, + 0x10,0x78,0xC0,0x40,0x40,0xFE,0xA0,0x10,0x08,0x16,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xDED9 [?] [5791]*/ + 0x11,0x11,0x12,0x11,0xFD,0x10,0x10,0x14,0x19,0x31,0xD2,0x14,0x10,0x10,0x50,0x23, + 0x24,0x24,0x48,0x24,0x24,0x00,0x80,0xFC,0x04,0x84,0x48,0x28,0x10,0x20,0xC0,0x00, + /* 0xDEDA [?] [5792]*/ + 0x10,0x11,0x11,0x11,0xFD,0x10,0x13,0x12,0x1A,0x32,0xD3,0x12,0x12,0x12,0x51,0x20, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x44,0x44,0x44,0xFC,0x00,0x02,0x02,0xFE,0x00, + /* 0xDEDB [?] [5793]*/ + 0x10,0x10,0x13,0x10,0xFA,0x11,0x15,0x18,0x33,0xD0,0x11,0x10,0x10,0x10,0x50,0x20, + 0x08,0x3C,0xC0,0x44,0x24,0x28,0x00,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x50,0x20, + /* 0xDEDC [?] [5794]*/ + 0x10,0x11,0x10,0x10,0xFB,0x10,0x14,0x19,0x30,0xD0,0x11,0x12,0x14,0x10,0x50,0x20, + 0x00,0xFC,0x44,0x44,0xFE,0x44,0x44,0xFC,0x80,0x80,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xDEDD [?] [5795]*/ + 0x20,0x23,0x20,0x20,0xFB,0x20,0x21,0x2A,0x34,0xE0,0x20,0x22,0x22,0x24,0xA1,0x40, + 0x00,0xFC,0x40,0x40,0xFE,0xA0,0x10,0x08,0x46,0x40,0x48,0x64,0x52,0x52,0x40,0x80, + /* 0xDEDE [?] [5796]*/ + 0x20,0x2F,0x24,0x24,0xF4,0x27,0x24,0x24,0x37,0xE4,0x24,0x25,0x2E,0x20,0xA0,0x40, + 0x00,0xDE,0x92,0x92,0x94,0x94,0x98,0x94,0x92,0x92,0x92,0xDA,0x94,0x90,0x90,0x90, + /* 0xDEDF [?] [5797]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x12,0x17,0x1A,0x32,0xD2,0x12,0x12,0x14,0x55,0x28, + 0x00,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xDEE0 [?] [5798]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x12,0x10,0x18,0x33,0xD0,0x11,0x11,0x12,0x50,0x20, + 0x20,0x20,0xFE,0x50,0x88,0x04,0xFA,0x00,0x00,0xFE,0x20,0x24,0x22,0x22,0xA0,0x40, + /* 0xDEE1 [?] [5799]*/ + 0x10,0x10,0x13,0x10,0xFD,0x12,0x17,0x10,0x1B,0x32,0xD2,0x12,0x13,0x10,0x50,0x20, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xFE,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xDEE2 [?] [5800]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x2A,0x32,0xE2,0x22,0x23,0x22,0x22,0xA3,0x42, + 0x00,0xFE,0x02,0x02,0xFE,0x22,0x22,0xFA,0x22,0x32,0x2A,0xFE,0x02,0x02,0xFE,0x02, + /* 0xDEE3 [?] [5801]*/ + 0x10,0x10,0x13,0x12,0xFA,0x13,0x16,0x1A,0x33,0xD0,0x11,0x17,0x10,0x10,0x50,0x20, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xDEE4 [?] [5802]*/ + 0x11,0x11,0x11,0x12,0xFC,0x11,0x14,0x18,0x33,0xD0,0x10,0x11,0x12,0x10,0x50,0x20, + 0x00,0x00,0xFC,0x04,0x44,0x54,0xE4,0x44,0xFC,0x44,0xE4,0x54,0x44,0x44,0x14,0x08, + /* 0xDEE5 [?] [5803]*/ + 0x10,0x10,0x11,0x10,0xFD,0x10,0x10,0x13,0x18,0x30,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xDEE6 [?] [5804]*/ + 0x10,0x10,0x13,0x12,0xFA,0x13,0x16,0x1A,0x32,0xD3,0x12,0x12,0x12,0x14,0x55,0x2A, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x00,0x28,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xDEE7 [?] [5805]*/ + 0x10,0x10,0x13,0x12,0xFE,0x13,0x12,0x12,0x1A,0x32,0xD2,0x12,0x14,0x14,0x58,0x20, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x84,0x94,0x88, + /* 0xDEE8 [?] [5806]*/ + 0x11,0x11,0x11,0x13,0xFD,0x11,0x11,0x14,0x19,0x31,0xD1,0x11,0x11,0x10,0x50,0x23, + 0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x00,0xFC,0x04,0x24,0x24,0x24,0x58,0x84,0x02, + /* 0xDEE9 [?] [5807]*/ + 0x10,0x11,0x11,0x13,0xFD,0x11,0x11,0x15,0x19,0x30,0xD3,0x10,0x10,0x11,0x56,0x20, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xDEEA [?] [5808]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x12,0x11,0x19,0x31,0xD1,0x11,0x11,0x10,0x57,0x20, + 0x20,0x20,0xFE,0x70,0xA8,0x24,0x22,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xDEEB [?] [5809]*/ + 0x10,0x13,0x12,0x12,0xFA,0x12,0x16,0x1A,0x32,0xD3,0x12,0x12,0x12,0x12,0x52,0x23, + 0x00,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x20,0xFE,0x48,0xC8,0x30,0x48,0x84,0xFE, + /* 0xDEEC [?] [5810]*/ + 0x22,0x22,0x22,0x23,0xF4,0x24,0x27,0x2A,0x32,0xEF,0x22,0x22,0x22,0x23,0xA2,0x40, + 0x10,0x10,0x10,0xBE,0x22,0x44,0x90,0x10,0x10,0x90,0x28,0x28,0xA8,0x44,0x44,0x82, + /* 0xDEED [?] [5811]*/ + 0x20,0x20,0x21,0x22,0xFD,0x20,0x23,0x2A,0x32,0xE3,0x22,0x22,0x23,0x22,0xA2,0x42, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xDEEE [?] [5812]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x17,0x10,0x19,0x31,0xD1,0x11,0x11,0x11,0x51,0x21, + 0x40,0x20,0xFE,0x00,0x04,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xDEEF [?] [5813]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x14,0x19,0x31,0xD1,0x11,0x11,0x11,0x10,0x53,0x20, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xDEF0 [?] [5814]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x2A,0x32,0xE2,0x22,0x23,0x24,0x24,0xA8,0x51, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x84,0x48,0xFC,0x48,0x48,0xFE,0x48,0x48,0x88,0x08, + /* 0xDEF1 [?] [5815]*/ + 0x10,0x13,0x10,0x12,0xFD,0x10,0x11,0x12,0x18,0x30,0xD3,0x10,0x10,0x10,0x51,0x22, + 0x10,0xD4,0x58,0x52,0x8C,0x88,0x04,0xFA,0x20,0x20,0xFE,0x20,0x50,0x88,0x04,0x02, + /* 0xDEF2 [?] [5816]*/ + 0x21,0x21,0x22,0x23,0xF8,0x27,0x20,0x29,0x36,0xE0,0x21,0x26,0x20,0x21,0xA6,0x40, + 0x00,0xF8,0x08,0xF0,0x10,0xFE,0x80,0x44,0x68,0xB0,0x28,0x68,0xA4,0x22,0xA0,0x40, + /* 0xDEF3 [?] [5817]*/ + 0x20,0x20,0x20,0x27,0xF4,0x24,0x27,0x24,0x34,0xE4,0x24,0x24,0x25,0x29,0xA9,0x52, + 0x40,0x7C,0x40,0xFE,0x42,0x70,0xC4,0x44,0x3C,0x20,0x10,0x54,0x42,0x42,0x4A,0x38, + /* 0xDEF4 [?] [5818]*/ + 0x20,0x27,0x24,0x24,0xF7,0x24,0x24,0x25,0x34,0xE7,0x20,0x20,0x25,0x25,0xA9,0x40, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0xA4,0x14,0x04,0xFC,0x40,0x24,0x22,0x0A,0x08,0xF8, + /* 0xDEF5 [?] [5819]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x12,0x16,0x1A,0x32,0xD2,0x12,0x12,0x14,0x55,0x2A, + 0x04,0x1E,0xF0,0x1E,0x10,0xFE,0x92,0x98,0xF2,0x8E,0x80,0xB8,0xA8,0xAA,0x4A,0x86, + /* 0xDEF6 [?] [5820]*/ + 0x11,0x10,0x10,0x17,0xF8,0x13,0x10,0x1F,0x30,0xD3,0x10,0x11,0x12,0x14,0x50,0x20, + 0x10,0xA0,0x00,0xFE,0xA0,0xF8,0xA8,0xFE,0xA8,0xF8,0xA0,0xB0,0xA8,0xA6,0xA0,0xA0, + /* 0xDEF7 [?] [5821]*/ + 0x24,0x22,0x22,0x20,0xF7,0x21,0x25,0x25,0x35,0xE7,0x21,0x21,0x22,0x22,0xA4,0x48, + 0x40,0x5E,0x92,0x12,0xD2,0x1E,0x52,0x52,0x52,0xDE,0x52,0x12,0x12,0x22,0x2A,0x44, + /* 0xDEF8 [?] [5822]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x2A,0x32,0xE2,0x23,0x22,0x22,0x24,0xA4,0x48, + 0x00,0xFC,0x04,0x04,0xFC,0x48,0x48,0xFC,0x48,0x48,0xFE,0xA4,0xA8,0x90,0xC8,0x86, + /* 0xDEF9 [?] [5823]*/ + 0x20,0x27,0x20,0x20,0xF7,0x24,0x24,0x27,0x30,0xE4,0x22,0x22,0x24,0x20,0xA5,0x42, + 0x00,0xBC,0x84,0x84,0xBC,0x20,0x20,0xBC,0x84,0xA4,0x94,0x94,0xA4,0x84,0x28,0x10, + /* 0xDEFA [?] [5824]*/ + 0x23,0x21,0x20,0x23,0xF8,0x27,0x24,0x2B,0x34,0xE0,0x27,0x20,0x21,0x22,0xAC,0x40, + 0xF0,0x10,0xE0,0x18,0x00,0xBC,0xA4,0x18,0xA4,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xDEFB [?] [5825]*/ + 0x10,0x13,0x12,0x13,0xFE,0x13,0x10,0x15,0x1B,0x30,0xD1,0x13,0x10,0x11,0x52,0x24, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x80,0x10,0xE0,0x48,0x84,0xFE,0x22,0x28,0xA4,0x42, + /* 0xDEFC [?] [5826]*/ + 0x20,0x2F,0x28,0x2A,0xFA,0x2A,0x25,0x28,0x30,0xEF,0x21,0x22,0x23,0x20,0xA1,0x4E, + 0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0x80,0xFE,0x10,0x10,0xA0,0x60,0x98,0x04, + /* 0xDEFD [?] [5827]*/ + 0x20,0x20,0x23,0x22,0xFA,0x22,0x23,0x2A,0x32,0xE2,0x22,0x22,0x25,0x25,0xAA,0x50, + 0x40,0x20,0xFE,0x00,0x48,0x48,0xFE,0x48,0x48,0x48,0x78,0x00,0x54,0x2A,0x2A,0x00, + /* 0xDEFE [?] [5828]*/ + 0x20,0x27,0x20,0x21,0xFF,0x24,0x24,0x27,0x34,0xE7,0x24,0x24,0x27,0x2C,0xA0,0x40, + 0x08,0x88,0x88,0x10,0xDE,0x94,0xA4,0x94,0x94,0x94,0x94,0xC8,0x88,0x94,0xA4,0xC2, + /* 0xDFA1 [?] [5829]*/ + 0x20,0x27,0x20,0x24,0xFA,0x24,0x20,0x28,0x33,0xE2,0x22,0x23,0x22,0x22,0xA3,0x42, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x84,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xDFA2 [?] [5830]*/ + 0x22,0x22,0x22,0x2F,0xF2,0x22,0x27,0x20,0x30,0xE7,0x25,0x25,0x25,0x27,0xA5,0x40, + 0x00,0xFE,0x10,0xA0,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xDFA3 [?] [5831]*/ + 0x21,0x23,0x24,0x2F,0xF4,0x27,0x24,0x27,0x30,0xEF,0x20,0x23,0x22,0x23,0xA2,0x43, + 0x00,0xF0,0x10,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xDFA4 [?] [5832]*/ + 0x21,0x20,0x27,0x20,0xFB,0x22,0x23,0x2A,0x33,0xE2,0x23,0x20,0x27,0x21,0xA0,0x40, + 0x08,0x90,0xFE,0x90,0xFC,0x94,0x1C,0x04,0xFC,0x04,0xFC,0x08,0xFE,0x08,0xA8,0x10, + /* 0xDFA5 [?] [5833]*/ + 0x20,0x20,0x27,0x25,0xFA,0x24,0x23,0x2A,0x33,0xE0,0x27,0x24,0x27,0x24,0xA0,0x40, + 0x80,0x40,0xFC,0x14,0x48,0x44,0xF8,0x48,0xF8,0x40,0xFC,0x44,0xFC,0x44,0x40,0x40, + /* 0xDFA6 [?] [5834]*/ + 0x21,0x21,0x21,0x2F,0xF1,0x27,0x24,0x27,0x34,0xE7,0x21,0x2F,0x21,0x21,0xA1,0x41, + 0x08,0x08,0x14,0xD4,0x22,0xC0,0x5C,0xC8,0x48,0xC8,0x3E,0xC8,0x08,0x08,0x08,0x08, + /* 0xDFA7 [?] [5835]*/ + 0x10,0x13,0x12,0x12,0xFB,0x10,0x17,0x18,0x33,0xD2,0x13,0x10,0x11,0x13,0x5D,0x21, + 0x00,0xFC,0x94,0x94,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0xA2,0x14,0x08,0x44,0x82, + /* 0xDFA8 [?] [5836]*/ + 0x20,0x20,0x27,0x24,0xF4,0x24,0x27,0x24,0x34,0xE7,0x26,0x2A,0x2A,0x2B,0xB2,0x40, + 0x10,0x08,0x88,0xBE,0x80,0x94,0x88,0x7E,0x08,0x88,0xBE,0x88,0x88,0x88,0x88,0x08, + /* 0xDFA9 [?] [5837]*/ + 0x20,0x23,0x22,0x23,0xFA,0x23,0x20,0x2F,0x34,0xE7,0x24,0x27,0x20,0x2F,0xA1,0x42, + 0x80,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x10,0x10, + /* 0xDFAA [?] [5838]*/ + 0x20,0x27,0x20,0x24,0xFA,0x24,0x21,0x2A,0x37,0xEA,0x23,0x22,0x23,0x22,0xA3,0x42, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x20,0x10,0xFC,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xDFAB [?] [5839]*/ + 0x27,0x20,0x27,0x24,0xFB,0x20,0x27,0x29,0x33,0xE6,0x2B,0x22,0x23,0x22,0xA3,0x42, + 0xFC,0x40,0xFE,0x42,0x5C,0x40,0x5C,0x20,0xFC,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xDFAC [?] [5840]*/ + 0x22,0x23,0x25,0x20,0xFB,0x22,0x22,0x2B,0x30,0xE7,0x22,0x25,0x28,0x23,0xA1,0x42, + 0x10,0xDE,0x28,0x84,0xFC,0xA4,0x54,0xFC,0x80,0xFE,0xA8,0xE4,0x52,0xF8,0x50,0xC8, + /* 0xDFAD [?] [5841]*/ + 0x20,0x27,0x22,0x23,0xF0,0x2F,0x2A,0x23,0x31,0xE7,0x21,0x2F,0x21,0x23,0xAD,0x41, + 0x40,0xFC,0x48,0xF8,0x40,0xFE,0xAA,0xB8,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xDFAE [?] [5842]*/ + 0x02,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x00, + 0x20,0x10,0x10,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x42,0x22,0x1A,0x06, + /* 0xDFAF [?] [5843]*/ + 0x00,0x00,0x00,0x00,0xFF,0x00,0x08,0x04,0x14,0x55,0x50,0x50,0x92,0x12,0x0E,0x00, + 0x48,0x44,0x44,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0xA0,0xA2,0x92,0x0A,0x06,0x02, + /* 0xDFB0 [?] [5844]*/ + 0x00,0x00,0x00,0xFF,0x00,0x22,0x22,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x00, + 0x50,0x48,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x20,0x20,0x12,0x12,0x0A,0x06,0x02, + /* 0xDFB1 [?] [5845]*/ + 0x00,0x44,0x28,0x13,0x28,0x44,0x10,0x11,0xFC,0x10,0x58,0x54,0x94,0x13,0x51,0x20, + 0x14,0x12,0x10,0xFE,0x10,0x10,0x10,0xF0,0x90,0x90,0x90,0x88,0xEA,0x8A,0x06,0x02, + /* 0xDFB2 [?] [5846]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xDFB3 [?] [5847]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7D,0x44,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0x42,0x44,0x48,0x50,0x60,0x40,0xC0,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xDFB4 [?] [5848]*/ + 0x00,0x01,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x7A,0x4A,0x02,0x04,0x04,0x08, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xDFB5 [?] [5849]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00,0x00,0x00, + 0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80,0x80,0x80, + /* 0xDFB6 [?] [5850]*/ + 0x00,0x00,0x7D,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x01,0x02,0x04, + 0x00,0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xDFB7 [?] [5851]*/ + 0x00,0x00,0x78,0x48,0x4B,0x48,0x48,0x48,0x48,0x48,0x78,0x48,0x01,0x01,0x02,0x04, + 0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x44,0x44,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xDFB8 [?] [5852]*/ + 0x00,0x00,0x7B,0x48,0x48,0x48,0x48,0x48,0x4B,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x08,0x3C,0xC0,0x40,0x40,0x40,0x40,0x7E,0xC0,0x40,0x40,0x42,0x42,0x42,0x3E,0x00, + /* 0xDFB9 [?] [5853]*/ + 0x00,0x02,0x79,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x00,0x02,0x04,0x88,0x50,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xDFBA [?] [5854]*/ + 0x00,0x00,0x78,0x48,0x48,0x48,0x49,0x4B,0x49,0x48,0x78,0x48,0x00,0x01,0x03,0x01, + 0x20,0x20,0x40,0x40,0x84,0x84,0x08,0xF8,0x10,0x10,0x20,0x40,0x88,0x04,0xFE,0x02, + /* 0xDFBB [?] [5855]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x4F,0x48,0x48,0x78,0x49,0x01,0x02,0x04,0x08, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xDFBC [?] [5856]*/ + 0x00,0x03,0x78,0x48,0x48,0x48,0x4F,0x48,0x48,0x48,0x78,0x49,0x01,0x02,0x04,0x08, + 0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xDFBD [?] [5857]*/ + 0x00,0x00,0x7B,0x48,0x48,0x48,0x4B,0x48,0x48,0x48,0x78,0x49,0x02,0x02,0x01,0x00, + 0x90,0x90,0xFE,0x90,0x90,0x00,0xF8,0x10,0x20,0x40,0x80,0x00,0x02,0x02,0xFE,0x00, + /* 0xDFBE [?] [5858]*/ + 0x00,0x00,0x78,0x48,0x4F,0x48,0x48,0x48,0x48,0x48,0x79,0x49,0x02,0x02,0x04,0x08, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0xA0,0xA0,0xA0,0x10,0x10,0x88,0x48,0x44,0x02, + /* 0xDFBF [?] [5859]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x04,0x04,0x09,0x12, + 0x00,0xFE,0x00,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xDFC0 [?] [5860]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x04,0x04,0x08,0x10, + 0x00,0xFE,0x00,0x00,0xF8,0x88,0x88,0x88,0x88,0xA8,0x90,0x82,0x82,0x82,0x7E,0x00, + /* 0xDFC1 [?] [5861]*/ + 0x00,0x02,0x7A,0x4A,0x4A,0x4A,0x4B,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x03,0x02,0x00, + 0x20,0x20,0x20,0x22,0x22,0x24,0xA8,0x30,0x20,0x20,0x20,0x22,0xA2,0x22,0x1E,0x00, + /* 0xDFC2 [?] [5862]*/ + 0x00,0x01,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x49,0x79,0x48,0x00,0x00,0x01,0x06, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x02,0x02, + /* 0xDFC3 [?] [5863]*/ + 0x00,0x1F,0x10,0x10,0x10,0x1F,0x01,0x01,0x7F,0x41,0x42,0x44,0x48,0x40,0x40,0x40, + 0x00,0xF0,0x10,0x10,0x10,0xF0,0x00,0x00,0xFC,0x04,0x84,0x44,0x24,0x04,0x14,0x08, + /* 0xDFC4 [?] [5864]*/ + 0x00,0x00,0xF0,0x90,0x90,0x90,0x90,0x92,0x92,0x92,0xF2,0x94,0x00,0x00,0x00,0x00, + 0x00,0x40,0x20,0x10,0x90,0x80,0x80,0x84,0x82,0x82,0x82,0x88,0x88,0x88,0x78,0x00, + /* 0xDFC5 [?] [5865]*/ + 0x00,0x03,0x78,0x48,0x48,0x49,0x49,0x49,0x4A,0x4B,0x78,0x48,0x00,0x00,0x01,0x00, + 0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0xE4,0x24,0x24,0x24,0x24,0x44,0x84, + /* 0xDFC6 [?] [5866]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x03,0x00, + 0x00,0xFE,0x10,0x10,0x10,0xFE,0x92,0x92,0x92,0x92,0x9A,0x94,0x10,0x10,0xFE,0x00, + /* 0xDFC7 [?] [5867]*/ + 0x00,0x00,0x78,0x48,0x48,0x48,0x48,0x4F,0x48,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x40,0x40,0x50,0x48,0x44,0x40,0x40,0x40, + /* 0xDFC8 [?] [5868]*/ + 0x00,0x07,0xF4,0x94,0x94,0x97,0x94,0x94,0x94,0x97,0xF4,0x90,0x00,0x00,0x00,0x00, + 0x00,0xFC,0x44,0x44,0x44,0xFC,0x44,0x44,0x44,0xFC,0x44,0x40,0x40,0x40,0x40,0x40, + /* 0xDFC9 [?] [5869]*/ + 0x00,0x00,0x7B,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x02,0x04,0x04,0x08, + 0x08,0x3C,0xD0,0x90,0x90,0x90,0x90,0x90,0x90,0x88,0x88,0xC8,0xA4,0xD4,0x92,0x00, + /* 0xDFCA [?] [5870]*/ + 0x00,0x00,0x78,0x48,0x49,0x4A,0x4C,0x48,0x4B,0x48,0x78,0x49,0x00,0x00,0x00,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xDFCB [?] [5871]*/ + 0x00,0x00,0x78,0x49,0x4B,0x4C,0x48,0x48,0x4B,0x4C,0x78,0x48,0x00,0x01,0x00,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xC0,0x20,0x10,0x80,0x60,0x10, + /* 0xDFCC [?] [5872]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4C,0x48,0x48,0x4B,0x48,0x78,0x48,0x00,0x00,0x00,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xDFCD [?] [5873]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x48,0x48,0x48,0x7A,0x4A,0x02,0x02,0x03,0x00, + 0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x22,0x22,0x22,0x22,0xFE,0x02, + /* 0xDFCE [?] [5874]*/ + 0x02,0x02,0xE2,0xA2,0xAF,0xA4,0xA4,0xA4,0xA4,0xA9,0xE5,0xA2,0x05,0x09,0x10,0x01, + 0x00,0x00,0x7C,0x24,0xA4,0xA4,0xA4,0xA8,0xA8,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xDFCF [?] [5875]*/ + 0x00,0x01,0x71,0x52,0x52,0x54,0x57,0x51,0x52,0x52,0x74,0x47,0x00,0x00,0x00,0x01, + 0x20,0x20,0x20,0x20,0xFC,0xA4,0x24,0x24,0x24,0x24,0xA4,0xA4,0xC4,0x44,0x94,0x08, + /* 0xDFD0 [?] [5876]*/ + 0x01,0x01,0x71,0x52,0x52,0x54,0x57,0x51,0x51,0x52,0x74,0x57,0x00,0x00,0x0F,0x00, + 0x08,0x08,0x08,0x10,0x94,0xA4,0xBC,0x08,0x08,0x10,0x20,0xBC,0x00,0x00,0xFE,0x00, + /* 0xDFD1 [?] [5877]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4B,0x02,0x02,0x03,0x00, + 0x00,0xFE,0x00,0x00,0xFC,0x20,0x20,0xF8,0x20,0x20,0x20,0xFC,0x00,0x00,0xFE,0x00, + /* 0xDFD2 [?] [5878]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x49,0x48,0x48,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDFD3 [?] [5879]*/ + 0x00,0x07,0x78,0x48,0x48,0x4B,0x4A,0x4A,0x4A,0x4A,0x7A,0x4B,0x02,0x02,0x03,0x02, + 0x00,0xFE,0x90,0x90,0x90,0xFC,0x94,0x94,0x94,0x94,0x9C,0x04,0x04,0x04,0xFC,0x04, + /* 0xDFD4 [?] [5880]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x49,0x49,0x49,0x7A,0x4A,0x04,0x00,0x00,0x01, + 0x40,0x40,0x40,0xFE,0x80,0x90,0x90,0x12,0x52,0x54,0x90,0x28,0x28,0x44,0x84,0x02, + /* 0xDFD5 [?] [5881]*/ + 0x00,0x02,0x79,0x49,0x48,0x48,0x4B,0x49,0x49,0x49,0x79,0x49,0x01,0x02,0x04,0x00, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x28,0x24,0x44,0x42,0x82,0x00,0x80,0x7E,0x00, + /* 0xDFD6 [?] [5882]*/ + 0x00,0x00,0xEF,0xA2,0xA2,0xA3,0xA2,0xA4,0xA6,0xA5,0xE8,0xA0,0x01,0x02,0x04,0x08, + 0x04,0x04,0xC4,0x14,0x14,0xD4,0x54,0x54,0x54,0x54,0x94,0x94,0x04,0x04,0x14,0x08, + /* 0xDFD7 [?] [5883]*/ + 0x00,0x00,0xF7,0x90,0x97,0x90,0x93,0x92,0x94,0x97,0xF0,0x90,0x00,0x01,0x02,0x0C, + 0x40,0x40,0xFE,0x40,0xFC,0x44,0xFC,0x40,0x40,0xFE,0x42,0xAA,0xA4,0x10,0x08,0x06, + /* 0xDFD8 [?] [5884]*/ + 0x00,0x00,0x78,0x4B,0x48,0x48,0x48,0x4B,0x48,0x4B,0x78,0x48,0x01,0x01,0x02,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xDFD9 [?] [5885]*/ + 0x01,0x01,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x48,0x7B,0x48,0x00,0x00,0x00,0x00, + 0x10,0x12,0x14,0xD8,0x10,0x12,0x52,0x8E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xDFDA [?] [5886]*/ + 0x00,0x00,0x78,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4A,0x7A,0x4A,0x03,0x0E,0x04,0x00, + 0x90,0x90,0x90,0x90,0x92,0xD4,0x98,0x90,0x90,0x90,0x90,0x92,0xD2,0x12,0x0E,0x00, + /* 0xDFDB [?] [5887]*/ + 0x00,0x00,0x7A,0x49,0x49,0x48,0x4F,0x48,0x48,0x48,0x78,0x48,0x01,0x01,0x02,0x04, + 0x40,0x44,0x44,0x48,0x50,0x40,0xFE,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xDFDC [?] [5888]*/ + 0x00,0x01,0x79,0x49,0x49,0x48,0x48,0x48,0x49,0x4A,0x78,0x48,0x00,0x00,0x00,0x03, + 0x20,0x24,0x24,0x24,0xFC,0x40,0x40,0xFC,0x04,0x84,0x48,0x50,0x20,0x40,0x80,0x00, + /* 0xDFDD [?] [5889]*/ + 0x00,0x00,0x78,0x49,0x49,0x4B,0x4D,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x90,0x90,0x90,0x10,0xFE,0x10,0x10,0x38,0x38,0x54,0x54,0x92,0x10,0x10,0x10,0x10, + /* 0xDFDE [?] [5890]*/ + 0x01,0x01,0xF1,0x92,0x92,0x96,0x9A,0x92,0x92,0x92,0xF2,0x92,0x02,0x02,0x02,0x02, + 0x00,0x7C,0x24,0x24,0x24,0xFE,0x24,0x24,0x24,0x7C,0x24,0x20,0x20,0x20,0x40,0x80, + /* 0xDFDF [?] [5891]*/ + 0x00,0x00,0xF7,0x94,0x94,0x95,0x95,0x95,0x95,0x95,0xF5,0x95,0x05,0x09,0x09,0x11, + 0x08,0x3C,0xC0,0x00,0x1C,0xE0,0x20,0x22,0x24,0x28,0x10,0x10,0x08,0x44,0x82,0x00, + /* 0xDFE0 [?] [5892]*/ + 0x00,0x00,0x78,0x49,0x4A,0x4C,0x49,0x48,0x48,0x4F,0x78,0x48,0x01,0x02,0x07,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xDFE1 [?] [5893]*/ + 0x00,0x01,0x79,0x49,0x49,0x49,0x4A,0x4C,0x4B,0x48,0x78,0x49,0x02,0x04,0x00,0x00, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x4E,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xDFE2 [?] [5894]*/ + 0x00,0x00,0x7B,0x49,0x48,0x48,0x48,0x48,0x4B,0x48,0x78,0x48,0x00,0x01,0x01,0x02, + 0x40,0x20,0xFE,0x04,0x88,0x50,0x20,0xD8,0x06,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xDFE3 [?] [5895]*/ + 0x01,0x00,0x78,0x48,0x4B,0x48,0x48,0x49,0x48,0x48,0x7B,0x48,0x00,0x00,0x00,0x00, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xDFE4 [?] [5896]*/ + 0x00,0x00,0x7A,0x49,0x49,0x48,0x4F,0x48,0x48,0x49,0x79,0x4A,0x04,0x08,0x00,0x00, + 0x40,0x40,0x48,0x48,0x50,0x40,0xFE,0x40,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40, + /* 0xDFE5 [?] [5897]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4C,0x48,0x4B,0x48,0x48,0x78,0x4F,0x00,0x00,0x00,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x38,0xC0,0x40,0x40,0x7E,0xC0,0x40,0x42,0x42,0x3E, + /* 0xDFE6 [?] [5898]*/ + 0x00,0x00,0xF0,0x97,0x94,0x98,0x91,0x91,0x93,0x95,0xF9,0x91,0x01,0x01,0x01,0x01, + 0x40,0x40,0x40,0xFC,0x84,0x88,0x40,0x44,0x48,0x30,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xDFE7 [?] [5899]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x4A,0x4A,0x4B,0x4A,0x4A,0x7A,0x4A,0x02,0x02,0x03,0x02, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x88,0x06,0x00, + /* 0xDFE8 [?] [5900]*/ + 0x00,0x00,0x78,0x49,0x4B,0x48,0x49,0x49,0x49,0x4A,0x78,0x4F,0x00,0x00,0x00,0x00, + 0x40,0x40,0x90,0x08,0xFC,0x24,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xDFE9 [?] [5901]*/ + 0x00,0x00,0xF7,0x90,0x93,0x90,0x97,0x90,0x90,0x91,0xF3,0x94,0x00,0x00,0x03,0x0C, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xDFEA [?] [5902]*/ + 0x00,0x00,0x79,0x48,0x48,0x48,0x4B,0x48,0x48,0x49,0x79,0x4A,0x00,0x00,0x01,0x02, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x48,0x48,0x4C,0x4A,0x4A,0x88,0x88,0x28,0x10, + /* 0xDFEB [?] [5903]*/ + 0x00,0x00,0x7B,0x48,0x48,0x4B,0x4A,0x4C,0x48,0x4B,0x78,0x48,0x00,0x01,0x02,0x04, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x44,0x40,0xFC,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xDFEC [?] [5904]*/ + 0x00,0x07,0xF0,0x97,0x94,0x94,0x97,0x94,0x94,0x97,0xF2,0x91,0x00,0x01,0x02,0x0C, + 0x00,0xFE,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0x80,0x40,0x30,0x0E, + /* 0xDFED [?] [5905]*/ + 0x00,0x07,0xF0,0x90,0x93,0x90,0x90,0x97,0x90,0x90,0xF3,0x92,0x02,0x02,0x03,0x02, + 0x00,0xFC,0x40,0x40,0xF8,0x88,0x88,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xDFEE [?] [5906]*/ + 0x02,0x02,0x72,0x52,0x5F,0x52,0x52,0x52,0x53,0x5E,0x72,0x52,0x02,0x02,0x0A,0x05, + 0x08,0x1C,0x60,0x40,0xC0,0x40,0x7E,0xC8,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x08, + /* 0xDFEF [?] [5907]*/ + 0x00,0x01,0x78,0x48,0x48,0x49,0x49,0x49,0x49,0x49,0x79,0x49,0x00,0x00,0x01,0x02, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x88,0x04,0x02, + /* 0xDFF0 [?] [5908]*/ + 0x00,0x00,0x79,0x49,0x49,0x49,0x49,0x49,0x49,0x48,0x78,0x48,0x07,0x00,0x00,0x00, + 0x20,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x40,0x40,0x7E,0xC0,0x42,0x42,0x3E, + /* 0xDFF1 [?] [5909]*/ + 0x01,0x00,0x78,0x48,0x4B,0x48,0x4B,0x48,0x49,0x4B,0x7D,0x49,0x01,0x01,0x00,0x00, + 0x84,0x68,0x30,0xC8,0x04,0x40,0xFE,0xA0,0x20,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xDFF2 [?] [5910]*/ + 0x00,0x00,0xF2,0x92,0x92,0x95,0x98,0x90,0x90,0x97,0xF0,0x90,0x00,0x00,0x0F,0x00, + 0x40,0x40,0x48,0x48,0x48,0x54,0xE2,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xDFF3 [?] [5911]*/ + 0x00,0x07,0x74,0x54,0x54,0x57,0x54,0x54,0x54,0x57,0x74,0x55,0x04,0x05,0x06,0x00, + 0x00,0xBC,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x34,0x28,0xA0,0x60,0x20,0x20, + /* 0xDFF4 [?] [5912]*/ + 0x00,0x00,0xF7,0x90,0x93,0x90,0x97,0x91,0x92,0x94,0xF1,0x90,0x07,0x00,0x00,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x48,0x46,0xF0,0x40,0xFC,0x40,0x40,0x40, + /* 0xDFF5 [?] [5913]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4B,0x48,0x49,0x49,0x79,0x49,0x01,0x00,0x00,0x03, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xDFF6 [?] [5914]*/ + 0x01,0x01,0xF7,0x91,0x91,0x90,0x97,0x90,0x91,0x93,0xF5,0x99,0x01,0x01,0x01,0x01, + 0x08,0x08,0xFE,0x08,0x48,0x40,0xFE,0x80,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xDFF7 [?] [5915]*/ + 0x00,0x00,0x7B,0x48,0x48,0x48,0x49,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x04, + /* 0xDFF8 [?] [5916]*/ + 0x01,0x01,0x71,0x51,0x57,0x51,0x51,0x53,0x53,0x55,0x75,0x59,0x01,0x01,0x01,0x01, + 0x10,0x10,0x10,0x10,0xBC,0x10,0x10,0x38,0xB8,0x54,0x54,0x92,0x10,0x10,0x10,0x10, + /* 0xDFF9 [?] [5917]*/ + 0x02,0x02,0x72,0x5F,0x52,0x55,0x55,0x57,0x51,0x51,0x71,0x5F,0x05,0x01,0x01,0x01, + 0x10,0x10,0x10,0xBC,0x10,0x10,0x7E,0x90,0x20,0x3C,0xC4,0x08,0x28,0x10,0x08,0x04, + /* 0xDFFA [?] [5918]*/ + 0x00,0x07,0xF4,0x94,0x95,0x94,0x94,0x97,0x94,0x95,0xF5,0x95,0x05,0x04,0x04,0x08, + 0x00,0xFC,0x44,0x44,0xF4,0x44,0x44,0xFC,0x04,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xDFFB [?] [5919]*/ + 0x01,0x01,0x79,0x4A,0x4D,0x49,0x4A,0x48,0x4F,0x48,0x7A,0x4A,0x03,0x00,0x00,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x84,0x84,0xF4,0x84,0xA4,0xA4,0xE4,0x04,0x28,0x10, + /* 0xDFFC [?] [5920]*/ + 0x01,0x01,0xF3,0x94,0x98,0x91,0x92,0x94,0x91,0x92,0xF0,0x91,0x05,0x05,0x08,0x00, + 0x00,0x00,0xFC,0x94,0x94,0x24,0x44,0x84,0x28,0x10,0x40,0x24,0x2A,0x0A,0xF8,0x00, + /* 0xDFFD [?] [5921]*/ + 0x00,0x00,0xF7,0x90,0x91,0x91,0x92,0x94,0x90,0x90,0xF7,0x90,0x00,0x00,0x00,0x00, + 0x80,0x40,0xFC,0x00,0x10,0x10,0xA8,0x44,0x00,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xDFFE [?] [5922]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4F,0x48,0x48,0x4F,0x78,0x49,0x00,0x00,0x01,0x06, + 0x80,0x40,0xFC,0x00,0x08,0x90,0xFE,0x40,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xE0A1 [?] [5923]*/ + 0x00,0x00,0x7B,0x48,0x49,0x4B,0x48,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x40,0x20,0xFE,0x80,0x04,0xFE,0x02,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xE0A2 [?] [5924]*/ + 0x00,0x02,0xF2,0x94,0x90,0x91,0x96,0x90,0x90,0x92,0xF2,0x94,0x00,0x01,0x02,0x0C, + 0x40,0x44,0x44,0x48,0xA0,0x10,0x08,0x44,0x40,0x48,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xE0A3 [?] [5925]*/ + 0x00,0x04,0x72,0x52,0x58,0x54,0x54,0x52,0x52,0x54,0x7C,0x54,0x04,0x05,0x05,0x02, + 0x10,0x10,0x10,0xFE,0x92,0x94,0x90,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0x28,0x44,0x82, + /* 0xE0A4 [?] [5926]*/ + 0x00,0x00,0x7B,0x4A,0x4C,0x48,0x4B,0x48,0x48,0x49,0x79,0x49,0x02,0x02,0x04,0x08, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xE0A5 [?] [5927]*/ + 0x01,0x00,0x7B,0x4A,0x4A,0x4B,0x4A,0x4A,0x4B,0x4A,0x7A,0x4A,0x02,0x03,0x02,0x00, + 0x00,0x9E,0xD2,0x52,0x54,0xD4,0x58,0x54,0xD2,0x12,0x92,0x5A,0xD4,0x50,0x10,0x10, + /* 0xE0A6 [?] [5928]*/ + 0x00,0x00,0x7B,0x4A,0x4A,0x4B,0x4A,0x4A,0x4A,0x4B,0x7A,0x4A,0x02,0x04,0x05,0x0A, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x00,0x28,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xE0A7 [?] [5929]*/ + 0x00,0x07,0x74,0x54,0x57,0x54,0x54,0x54,0x57,0x56,0x76,0x5A,0x0A,0x12,0x00,0x00, + 0x02,0xE2,0x22,0x2A,0xEA,0x8A,0x8A,0x8A,0xEA,0xAA,0xAA,0xAA,0xA2,0xE2,0x8A,0x84, + /* 0xE0A8 [?] [5930]*/ + 0x00,0x07,0x70,0x52,0x51,0x52,0x54,0x58,0x50,0x57,0x70,0x52,0x01,0x02,0x04,0x08, + 0x00,0xBC,0x84,0x94,0x08,0x94,0xA4,0x40,0x00,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xE0A9 [?] [5931]*/ + 0x00,0x01,0x79,0x4B,0x49,0x49,0x49,0x49,0x49,0x48,0x7B,0x48,0x00,0x01,0x06,0x00, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xE0AA [?] [5932]*/ + 0x01,0x01,0xF7,0x91,0x90,0x90,0x91,0x92,0x95,0x90,0xF0,0x93,0x02,0x02,0x03,0x02, + 0x10,0x10,0xFC,0x10,0x40,0xA0,0x10,0x08,0xF6,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE0AB [?] [5933]*/ + 0x00,0x00,0xF7,0x90,0x90,0x97,0x95,0x94,0x95,0x94,0xF4,0x95,0x04,0x04,0x04,0x04, + 0x40,0x40,0xFC,0x40,0x40,0xFC,0x14,0xA4,0xF4,0x44,0x44,0xF4,0x44,0x44,0x54,0x08, + /* 0xE0AC [?] [5934]*/ + 0x00,0x07,0xF4,0x95,0x95,0x95,0x95,0x95,0x95,0x95,0xF4,0x94,0x05,0x08,0x08,0x13, + 0x00,0xFE,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE, + /* 0xE0AD [?] [5935]*/ + 0x00,0x00,0xF7,0x90,0x91,0x92,0x9D,0x90,0x90,0x97,0xF0,0x90,0x03,0x00,0x00,0x0F, + 0x40,0x40,0xFC,0xA0,0x10,0x48,0xF6,0x40,0x40,0xFC,0x00,0x40,0xF8,0x40,0x40,0xFE, + /* 0xE0AE [?] [5936]*/ + 0x02,0x02,0x7B,0x4A,0x4A,0x4B,0x4A,0x48,0x4B,0x4A,0x7A,0x4B,0x02,0x02,0x03,0x02, + 0x20,0x24,0xA8,0x30,0xA2,0x22,0x5E,0x80,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xE0AF [?] [5937]*/ + 0x01,0x01,0x79,0x49,0x49,0x49,0x49,0x48,0x48,0x4B,0x7A,0x4A,0x02,0x02,0x02,0x02, + 0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x22,0x2A,0xFA,0x0A,0x02,0x06, + /* 0xE0B0 [?] [5938]*/ + 0x00,0x03,0x7A,0x4B,0x4A,0x4B,0x48,0x49,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x00,0xFE,0x22,0xFE,0x22,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xE0B1 [?] [5939]*/ + 0x00,0x01,0x77,0x51,0x51,0x51,0x57,0x51,0x53,0x53,0x75,0x55,0x09,0x01,0x01,0x01, + 0x88,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xE0B2 [?] [5940]*/ + 0x01,0x06,0xF4,0x94,0x97,0x94,0x94,0x97,0x90,0x97,0xF2,0x91,0x00,0x00,0x01,0x0E, + 0x40,0x5C,0x44,0x44,0x5C,0x44,0x44,0xFC,0x40,0xFC,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xE0B3 [?] [5941]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4F,0x48,0x49,0x49,0x79,0x49,0x01,0x01,0x01,0x01, + 0x80,0x40,0xFC,0x00,0x08,0x90,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE0B4 [?] [5942]*/ + 0x01,0x3F,0x08,0x04,0x7F,0x41,0x9F,0x11,0x11,0x11,0x01,0x3F,0x20,0x20,0x3F,0x20, + 0x00,0xF8,0x20,0x40,0xFE,0x02,0xF4,0x10,0x50,0x20,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE0B5 [?] [5943]*/ + 0x01,0x00,0x78,0x4B,0x48,0x49,0x48,0x4B,0x48,0x49,0x79,0x4A,0x04,0x08,0x03,0x00, + 0x08,0x88,0x90,0xFC,0x40,0xF8,0x40,0xFE,0x80,0x00,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE0B6 [?] [5944]*/ + 0x00,0x01,0x78,0x48,0x4B,0x48,0x49,0x4A,0x48,0x4F,0x78,0x49,0x01,0x00,0x01,0x06, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xE0B7 [?] [5945]*/ + 0x22,0x11,0x00,0x7F,0x41,0x91,0x1F,0x21,0x01,0xFF,0x00,0x1F,0x10,0x10,0x1F,0x10, + 0x08,0x10,0x20,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xE0B8 [?] [5946]*/ + 0x00,0x03,0x7A,0x4A,0x4B,0x4A,0x4B,0x4A,0x4A,0x4B,0x7A,0x4A,0x05,0x04,0x08,0x13, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x40,0x88,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE, + /* 0xE0B9 [?] [5947]*/ + 0x01,0x01,0xF2,0x93,0x90,0x97,0x90,0x91,0x96,0x90,0xF1,0x96,0x00,0x01,0x06,0x00, + 0x00,0xF8,0x08,0xF0,0x10,0xFE,0x80,0x44,0x68,0xB0,0x28,0x68,0xA4,0x22,0xA0,0x40, + /* 0xE0BA [?] [5948]*/ + 0x00,0x00,0xF7,0x90,0x93,0x90,0x97,0x91,0x92,0x95,0xF0,0x93,0x00,0x01,0x06,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x68,0xC6,0x40,0xF8,0xE0,0x58,0x44,0x40, + /* 0xE0BB [?] [5949]*/ + 0x01,0x01,0x71,0x57,0x51,0x57,0x51,0x5F,0x52,0x53,0x72,0x52,0x02,0x04,0x04,0x08, + 0x08,0x08,0x08,0xD0,0x1E,0x94,0x24,0xD4,0x14,0xD4,0x54,0x48,0x48,0xD4,0x24,0x42, + /* 0xE0BC [?] [5950]*/ + 0x00,0x00,0x7B,0x48,0x49,0x48,0x4B,0x48,0x48,0x49,0x78,0x4B,0x00,0x01,0x02,0x00, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x40,0x88,0xF0,0x24,0xFE,0x22,0x24,0xA2,0x40, + /* 0xE0BD [?] [5951]*/ + 0x02,0x02,0xEF,0xA2,0xA2,0xAF,0xA1,0xA2,0xA7,0xAC,0xF4,0xA7,0x04,0x04,0x07,0x04, + 0x00,0x3E,0x62,0x64,0xA4,0xE8,0x24,0x24,0xA2,0xA2,0xA2,0xB4,0xA8,0xA0,0xA0,0xA0, + /* 0xE0BE [?] [5952]*/ + 0x00,0x00,0x79,0x48,0x48,0x4B,0x48,0x49,0x4B,0x48,0x7B,0x4A,0x02,0x02,0x07,0x00, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x80,0x04,0xFE,0x02,0xFC,0x94,0x94,0x94,0xFE,0x00, + /* 0xE0BF [?] [5953]*/ + 0x00,0x03,0x79,0x49,0x49,0x49,0x49,0x4F,0x48,0x4F,0x78,0x4A,0x01,0x02,0x04,0x08, + 0x00,0xFC,0x08,0xF8,0x08,0xF8,0x0E,0xF8,0x08,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xE0C0 [?] [5954]*/ + 0x01,0x01,0xF7,0x91,0x91,0x92,0x92,0x96,0x9A,0x92,0xF2,0x92,0x02,0x02,0x02,0x02, + 0x10,0x10,0xFE,0x10,0x00,0xFE,0x08,0x08,0xE8,0xA8,0xA8,0xE8,0xA8,0x08,0x28,0x10, + /* 0xE0C1 [?] [5955]*/ + 0x00,0x00,0xF7,0x90,0x93,0x92,0x93,0x92,0x93,0x92,0xF3,0x92,0x0F,0x01,0x02,0x04, + 0x40,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFE,0x10,0x08,0x04, + /* 0xE0C2 [?] [5956]*/ + 0x00,0x00,0xF7,0x90,0x97,0x94,0x99,0x93,0x90,0x90,0xF7,0x90,0x02,0x04,0x09,0x00, + 0x40,0x40,0xFC,0x40,0xFC,0x84,0x18,0xE0,0x40,0x88,0xFC,0x44,0x50,0x48,0x48,0x80, + /* 0xE0C3 [?] [5957]*/ + 0x00,0x0F,0xF0,0x93,0x92,0x92,0x93,0x90,0x97,0x95,0xF4,0x97,0x04,0x04,0x04,0x04, + 0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x14,0xA4,0xFC,0x44,0x44,0x54,0x08, + /* 0xE0C4 [?] [5958]*/ + 0x07,0x00,0xF3,0x92,0x93,0x92,0x93,0x92,0x93,0x90,0xF1,0x93,0x04,0x00,0x01,0x0E, + 0xFC,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x80,0xF8,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xE0C5 [?] [5959]*/ + 0x00,0x07,0xF4,0x94,0x97,0x94,0x94,0x95,0x94,0x97,0xF0,0x90,0x05,0x05,0x09,0x00, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0xA4,0x14,0x04,0xFC,0x40,0x24,0x22,0x0A,0x08,0xF8, + /* 0xE0C6 [?] [5960]*/ + 0x00,0x00,0xF3,0x92,0x93,0x92,0x93,0x90,0x97,0x91,0xF2,0x94,0x0B,0x00,0x00,0x00, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x80,0xFC,0x10,0x48,0x44,0xFA,0x40,0x40,0x40, + /* 0xE0C7 [?] [5961]*/ + 0x00,0x01,0xF2,0x90,0x91,0x96,0x90,0x93,0x90,0x90,0xF7,0x90,0x03,0x00,0x00,0x07, + 0x90,0x08,0x94,0x60,0x98,0x46,0xFC,0x08,0xB0,0xD0,0x3E,0xC2,0x24,0x18,0x60,0x80, + /* 0xE0C8 [?] [5962]*/ + 0x00,0x03,0x78,0x4A,0x49,0x4B,0x4A,0x48,0x4B,0x48,0x78,0x49,0x01,0x02,0x04,0x01, + 0x0E,0xF0,0x44,0x24,0x08,0xFE,0x42,0x40,0xFE,0x80,0xFC,0x44,0x28,0x10,0x68,0x86, + /* 0xE0C9 [?] [5963]*/ + 0x02,0x01,0xF1,0x90,0x97,0x90,0x91,0x92,0x94,0x93,0xF2,0x92,0x02,0x02,0x0F,0x00, + 0x08,0x08,0x10,0x00,0xFC,0x00,0x10,0x08,0x04,0xF8,0xA8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xE0CA [?] [5964]*/ + 0x04,0x02,0x72,0x50,0x57,0x51,0x55,0x55,0x55,0x57,0x71,0x51,0x02,0x02,0x04,0x08, + 0x40,0x5E,0x92,0x12,0xD2,0x1E,0x52,0x52,0x52,0xDE,0x52,0x12,0x12,0x22,0x2A,0x44, + /* 0xE0CB [?] [5965]*/ + 0x00,0x08,0xE4,0xA1,0xAA,0xA4,0xA4,0xA0,0xA3,0xA4,0xED,0xA5,0x05,0x04,0x04,0x00, + 0x80,0x80,0xFE,0x00,0xFC,0x84,0xA4,0x94,0xFE,0x84,0x24,0x14,0xFE,0x04,0x28,0x10, + /* 0xE0CC [?] [5966]*/ + 0x01,0x08,0xE4,0xA4,0xA1,0xA1,0xBD,0xA5,0xA5,0xA5,0xE5,0xA5,0x05,0x0A,0x11,0x00, + 0xFC,0x08,0x50,0x20,0xFC,0x24,0x24,0xFC,0x24,0xFC,0x24,0x24,0x2C,0x00,0xFE,0x00, + /* 0xE0CD [?] [5967]*/ + 0x00,0x01,0x79,0x49,0x48,0x4B,0x48,0x48,0x49,0x49,0x79,0x49,0x00,0x00,0x03,0x01, + 0x20,0x24,0x24,0xFC,0x20,0xFE,0x00,0x20,0xFC,0x24,0x24,0xFC,0x20,0x24,0xFE,0x02, + /* 0xE0CE [?] [5968]*/ + 0x22,0x22,0x47,0x8A,0xF5,0x27,0x41,0xF9,0x07,0x19,0xE1,0x3F,0x20,0x20,0x3F,0x20, + 0x08,0x08,0xD0,0x22,0x3C,0xC8,0x10,0x3E,0xC0,0x3E,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE0CF [?] [5969]*/ + 0x02,0x02,0x77,0x52,0x53,0x51,0x57,0x55,0x55,0x57,0x71,0x57,0x01,0x01,0x01,0x01, + 0x90,0x90,0xD0,0x90,0xBC,0x14,0xD4,0x54,0x54,0xD4,0x14,0xD4,0x24,0x24,0x54,0x88, + /* 0xE0D0 [?] [5970]*/ + 0x00,0x00,0x77,0x50,0x57,0x54,0x57,0x54,0x57,0x50,0x73,0x52,0x03,0x02,0x03,0x02, + 0xA0,0xA0,0xFE,0xA0,0xFC,0xA4,0xFC,0xA4,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xE0D1 [?] [5971]*/ + 0x00,0x0F,0xE0,0xA7,0xA4,0xA4,0xA7,0xA0,0xA7,0xA0,0xEF,0xA0,0x02,0x04,0x09,0x00, + 0x00,0xFE,0xA0,0xFC,0xA4,0xA4,0xFC,0x00,0xFC,0x00,0xFE,0x40,0x48,0x44,0x42,0x80, + /* 0xE0D2 [?] [5972]*/ + 0x00,0x00,0x70,0x57,0x54,0x54,0x54,0x54,0x57,0x54,0x74,0x55,0x0A,0x08,0x11,0x00, + 0x14,0x12,0x10,0xFE,0x10,0x90,0xD2,0x92,0xF2,0x94,0x94,0xC8,0xAA,0x9A,0xA6,0x42, + /* 0xE0D3 [?] [5973]*/ + 0x00,0x0F,0xE8,0xAA,0xAA,0xAA,0xA5,0xA8,0xA0,0xAF,0xE1,0xA2,0x03,0x00,0x01,0x0E, + 0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0x80,0xFE,0x10,0x10,0xA0,0x60,0x98,0x04, + /* 0xE0D4 [?] [5974]*/ + 0x00,0x04,0x74,0x57,0x50,0x57,0x54,0x54,0x57,0x54,0x74,0x57,0x04,0x04,0x0A,0x11, + 0x40,0x44,0x44,0xFC,0x00,0xBC,0xA4,0xA4,0xBC,0xA4,0xA4,0xBC,0xA4,0xA4,0xB4,0x48, + /* 0xE0D5 [?] [5975]*/ + 0x04,0x02,0x72,0x5F,0x54,0x54,0x57,0x55,0x55,0x55,0x75,0x55,0x05,0x09,0x0B,0x10, + 0x20,0x20,0x3E,0x40,0xA0,0x20,0x3C,0x50,0x10,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xE0D6 [?] [5976]*/ + 0x00,0x00,0xF7,0x91,0x90,0x97,0x94,0x95,0x94,0x95,0xF5,0x95,0x05,0x04,0x04,0x04, + 0x80,0x40,0xFC,0x10,0xA0,0xFC,0x44,0xF4,0x44,0xF4,0x14,0x14,0xF4,0x04,0x14,0x08, + /* 0xE0D7 [?] [5977]*/ + 0x00,0x00,0xF7,0x94,0x98,0x90,0x95,0x95,0x98,0x93,0xF0,0x94,0x04,0x04,0x07,0x00, + 0x80,0x40,0xFE,0x02,0x94,0x50,0x24,0x4A,0xFA,0x00,0x40,0x44,0x44,0x44,0xFC,0x04, + /* 0xE0D8 [?] [5978]*/ + 0x01,0x01,0x77,0x51,0x51,0x57,0x50,0x57,0x54,0x54,0x77,0x54,0x02,0x00,0x0F,0x04, + 0x04,0x04,0xE8,0x10,0x00,0xC4,0x04,0xC8,0x50,0x42,0xC2,0x44,0x84,0xE8,0x10,0x20, + /* 0xE0D9 [?] [5979]*/ + 0x00,0x0F,0xE8,0xAA,0xA9,0xAB,0xA8,0xA8,0xAA,0xAA,0xEB,0xA8,0x08,0x09,0x09,0x12, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xE0DA [?] [5980]*/ + 0x00,0x00,0xF7,0x90,0x95,0x92,0x97,0x9A,0x93,0x92,0xF3,0x90,0x02,0x04,0x09,0x00, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xE0DB [?] [5981]*/ + 0x00,0x04,0xF2,0x90,0x97,0x91,0x90,0x97,0x90,0x93,0xF0,0x97,0x00,0x01,0x02,0x0C, + 0xA0,0xA4,0xA8,0xA0,0xFC,0x10,0xA0,0xFC,0x40,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xE0DC [?] [5982]*/ + 0x00,0x03,0xF2,0x93,0x92,0x93,0x90,0x9F,0x94,0x97,0xF4,0x97,0x04,0x0F,0x00,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x80,0xBC,0x94,0x94,0xD4,0x88,0x94,0xA2, + /* 0xE0DD [?] [5983]*/ + 0x01,0x01,0xF3,0x92,0x96,0x9B,0x92,0x92,0x93,0x92,0xF2,0x93,0x02,0x05,0x04,0x08, + 0x40,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x24,0x92,0x92, + /* 0xE0DE [?] [5984]*/ + 0x00,0x01,0xF7,0x94,0x95,0x94,0x97,0x94,0x95,0x94,0xF0,0x97,0x00,0x01,0x02,0x0C, + 0x80,0x00,0xFC,0x44,0x54,0x44,0xFC,0xE4,0x54,0x04,0x40,0xFE,0xA0,0x10,0x08,0x06, + /* 0xE0DF [?] [5985]*/ + 0x00,0x00,0xF1,0x92,0x9D,0x90,0x92,0x92,0x93,0x90,0xF7,0x94,0x05,0x05,0x04,0x04, + 0x40,0xA0,0x10,0x48,0xF6,0xA0,0x48,0xA8,0xF8,0x40,0xFC,0x84,0x24,0xF4,0x14,0x0C, + /* 0xE0E0 [?] [5986]*/ + 0x01,0x03,0xF4,0x9F,0x94,0x97,0x94,0x97,0x90,0x9F,0xF0,0x93,0x02,0x03,0x02,0x03, + 0x00,0xF0,0x10,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xE0E1 [?] [5987]*/ + 0x02,0x01,0xF0,0x97,0x94,0x95,0x94,0x94,0x97,0x90,0xF3,0x92,0x03,0x02,0x03,0x02, + 0x08,0x10,0x00,0xFC,0x44,0x54,0xE4,0x44,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xE0E2 [?] [5988]*/ + 0x00,0x07,0xF0,0x92,0x91,0x92,0x95,0x98,0x93,0x92,0xF2,0x93,0x02,0x01,0x0F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xE0E3 [?] [5989]*/ + 0x01,0x07,0xF1,0x90,0x97,0x90,0x91,0x91,0x91,0x90,0xF7,0x94,0x05,0x05,0x05,0x04, + 0x08,0xFE,0x08,0x20,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xFE,0x02,0xFA,0x0A,0xFA,0x06, + /* 0xE0E4 [?] [5990]*/ + 0x01,0x01,0xF7,0x91,0x93,0x95,0x99,0x90,0x93,0x90,0xF7,0x90,0x02,0x04,0x09,0x00, + 0x10,0x10,0xBC,0x10,0xB8,0x54,0x12,0x00,0xF8,0x00,0xFC,0x40,0x48,0x44,0x42,0x80, + /* 0xE0E5 [?] [5991]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x4A,0x4B,0x4A,0x4A,0x4B,0x7A,0x4B,0x02,0x05,0x04,0x09, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x00,0xFE,0x40,0xA4,0x58,0xB4,0x52,0xB0, + /* 0xE0E6 [?] [5992]*/ + 0x00,0x00,0x7B,0x49,0x48,0x4F,0x48,0x4B,0x4A,0x4B,0x7A,0x4B,0x00,0x05,0x05,0x08, + 0x80,0x40,0xFC,0x08,0x90,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x24,0x0A,0xFA, + /* 0xE0E7 [?] [5993]*/ + 0x00,0x00,0xF7,0x95,0x9B,0x91,0x97,0x91,0x97,0x91,0xF2,0x95,0x08,0x00,0x07,0x00, + 0x80,0x40,0xFE,0x12,0xFC,0x10,0xFC,0x10,0xFE,0x10,0x48,0xF4,0x42,0x40,0xFC,0x00, + /* 0xE0E8 [?] [5994]*/ + 0x00,0x00,0x77,0x54,0x54,0x54,0x57,0x54,0x54,0x57,0x76,0x5A,0x0A,0x0B,0x12,0x00, + 0x10,0x08,0x88,0xBE,0x80,0x94,0x88,0x7E,0x08,0x88,0xBE,0x88,0x88,0x88,0x88,0x08, + /* 0xE0E9 [?] [5995]*/ + 0x00,0x07,0xE0,0xAF,0xA8,0xA3,0xA0,0xA3,0xA0,0xAF,0xE0,0xA7,0x04,0x04,0x04,0x04, + 0x00,0xFC,0x40,0xFE,0x42,0x58,0x40,0x58,0x00,0xFE,0x40,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xE0EA [?] [5996]*/ + 0x00,0x00,0x77,0x54,0x5A,0x53,0x54,0x5A,0x55,0x52,0x74,0x5B,0x00,0x02,0x04,0x00, + 0x80,0x40,0xFE,0x02,0x24,0xBC,0xA4,0xA8,0x10,0xE8,0x04,0xFA,0x40,0x48,0x44,0xC0, + /* 0xE0EB [?] [5997]*/ + 0x07,0x00,0xF7,0x94,0x9B,0x90,0x97,0x91,0x93,0x96,0xFB,0x92,0x03,0x02,0x03,0x02, + 0xFC,0x40,0xFE,0x42,0x5C,0x40,0x5C,0x20,0xFC,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE0EC [?] [5998]*/ + 0x00,0x07,0x72,0x53,0x50,0x5F,0x5A,0x53,0x51,0x57,0x71,0x4F,0x01,0x03,0x0D,0x01, + 0x40,0xFC,0x48,0xF8,0x40,0xFE,0xAA,0xB8,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xE0ED [?] [5999]*/ + 0x00,0x7F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE0EE [?] [6000]*/ + 0x00,0x7F,0x40,0x40,0x4F,0x40,0x40,0x41,0x5F,0x41,0x41,0x41,0x45,0x42,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x44,0x84,0x04,0xF4,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE0EF [?] [6001]*/ + 0x00,0x7F,0x42,0x42,0x42,0x7F,0x44,0x44,0x48,0x46,0x41,0x42,0x44,0x48,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x44,0x44,0x84,0x84,0x04,0x84,0x44,0x24,0xFC,0x04, + /* 0xE0F0 [?] [6002]*/ + 0x00,0x7F,0x41,0x41,0x42,0x44,0x48,0x54,0x65,0x46,0x44,0x44,0x43,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x84,0x44,0x24,0x9C,0x04,0x04,0x24,0x24,0xE4,0x04,0xFC,0x04, + /* 0xE0F1 [?] [6003]*/ + 0x00,0x7F,0x44,0x44,0x47,0x49,0x49,0x52,0x42,0x44,0x49,0x42,0x44,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x54,0x54,0x54,0x94,0x94,0x14,0xA4,0x44,0x04,0xFC,0x04, + /* 0xE0F2 [?] [6004]*/ + 0x00,0x7F,0x41,0x41,0x42,0x44,0x4A,0x51,0x6F,0x40,0x40,0x42,0x41,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0x84,0x44,0x24,0x1C,0xE4,0x24,0x44,0x84,0x04,0x84,0xFC,0x04, + /* 0xE0F3 [?] [6005]*/ + 0x00,0x7F,0x42,0x42,0x5F,0x44,0x4F,0x54,0x67,0x44,0x47,0x44,0x44,0x44,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0xA4,0x44,0xFC,0x04, + /* 0xE0F4 [?] [6006]*/ + 0x00,0x7F,0x40,0x5F,0x42,0x4F,0x44,0x7F,0x40,0x4F,0x48,0x48,0x4F,0x40,0x7F,0x40, + 0x00,0xFC,0x04,0xF4,0x04,0xE4,0x24,0xFC,0x04,0xE4,0x24,0x24,0xE4,0x04,0xFC,0x04, + /* 0xE0F5 [?] [6007]*/ + 0x7F,0x41,0x4F,0x41,0x4F,0x41,0x7F,0x40,0x4F,0x48,0x4F,0x48,0x4F,0x48,0x48,0x7F, + 0xFC,0x04,0xE4,0x04,0xE4,0x04,0xFC,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0x64,0xFC, + /* 0xE0F6 [?] [6008]*/ + 0x00,0x7F,0x41,0x41,0x4F,0x41,0x5F,0x44,0x42,0x4F,0x41,0x5F,0x41,0x41,0x7F,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x04,0xF4,0x44,0x84,0xE4,0x04,0xF4,0x04,0x04,0xFC,0x04, + /* 0xE0F7 [?] [6009]*/ + 0x7F,0x40,0x5F,0x52,0x5F,0x40,0x7F,0x40,0x4F,0x48,0x4F,0x45,0x4C,0x74,0x46,0x7F, + 0xFC,0x04,0xF4,0x94,0xF4,0x04,0xFC,0x04,0xE4,0x24,0xE4,0x14,0xA4,0x44,0x24,0xFC, + /* 0xE0F8 [?] [6010]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x54,0x54,0x54,0x55,0x54,0x5C,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xE0F9 [?] [6011]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x56,0x54,0x57,0x54,0x54,0x5C,0x10,0x10,0x11,0x12, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xE0FA [?] [6012]*/ + 0x10,0x10,0x10,0x7D,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x11,0x12,0x12,0x14, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xE0FB [?] [6013]*/ + 0x10,0x10,0xFE,0x22,0x64,0x18,0x24,0xC3,0x01,0x3F,0x21,0x21,0x21,0x21,0x01,0x01, + 0x00,0x00,0xFC,0x44,0x28,0x10,0x28,0x46,0x00,0xF8,0x08,0x08,0x28,0x10,0x00,0x00, + /* 0xE0FC [?] [6014]*/ + 0x20,0x20,0x27,0xF8,0xAB,0xA8,0xAF,0xA8,0xA9,0xA9,0xAA,0xBA,0x24,0x28,0x20,0x20, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFE,0x90,0x10,0xFE,0x10,0x90,0x50,0x10,0x50,0x20, + /* 0xE0FD [?] [6015]*/ + 0x20,0x20,0x27,0xF8,0xAB,0xA8,0xAF,0xA8,0xAB,0xAA,0xAA,0xBA,0x22,0x20,0x21,0x26, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x00,0xF8,0x08,0x48,0x48,0x48,0xA0,0x10,0x08, + /* 0xE0FE [?] [6016]*/ + 0x20,0x23,0x22,0xFA,0xAB,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xBB,0x22,0x22,0x23,0x22, + 0x00,0xFE,0x02,0x02,0xFE,0x22,0x22,0xFA,0x22,0x32,0x2A,0xFE,0x02,0x02,0xFE,0x02, + /* 0xE1A1 [?] [6017]*/ + 0x10,0x10,0x10,0x7C,0x55,0x56,0x54,0x54,0x54,0x54,0x54,0x5C,0x10,0x10,0x10,0x10, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xE1A2 [?] [6018]*/ + 0x20,0x23,0x22,0xFA,0xAB,0xAA,0xAB,0xAA,0xAA,0xAB,0xAA,0xBA,0x25,0x24,0x28,0x33, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x40,0x88,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE, + /* 0xE1A3 [?] [6019]*/ + 0x20,0x21,0x21,0xF9,0xA9,0xA9,0xA8,0xAB,0xAA,0xAB,0xA8,0xB9,0x20,0x20,0x21,0x26, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0xFC,0x00,0xF8,0x90,0x60,0x98,0x06, + /* 0xE1A4 [?] [6020]*/ + 0x10,0x11,0x10,0x7C,0x57,0x54,0x55,0x55,0x55,0x55,0x55,0x5C,0x13,0x10,0x10,0x10, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xE1A5 [?] [6021]*/ + 0x20,0x22,0x21,0xF8,0xAB,0xA8,0xA8,0xAB,0xA8,0xA9,0xA8,0xBB,0x20,0x20,0x21,0x26, + 0x50,0x52,0x54,0x50,0xFE,0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xE1A6 [?] [6022]*/ + 0x20,0x27,0x22,0xF9,0xAB,0xA9,0xAA,0xAC,0xAB,0xAA,0xAA,0xBB,0x22,0x22,0x23,0x22, + 0x78,0xC0,0x48,0x50,0xFC,0x50,0x48,0x06,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x08, + /* 0xE1A7 [?] [6023]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x08,0x08,0x0C,0x0A,0x11,0x10,0x20,0x20,0x43,0x8C, + 0x00,0x08,0x08,0xF8,0x00,0xF0,0x20,0x40,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xE1A8 [?] [6024]*/ + 0x10,0x10,0x11,0x10,0x54,0x54,0x54,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x00,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE1A9 [?] [6025]*/ + 0x10,0x11,0x10,0x10,0x54,0x54,0x54,0x57,0x54,0x54,0x54,0x5C,0x64,0x01,0x01,0x02, + 0x00,0xFC,0x88,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xE1AA [?] [6026]*/ + 0x10,0x10,0x10,0x13,0x54,0x54,0x54,0x55,0x54,0x54,0x54,0x5C,0x64,0x00,0x01,0x06, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xE1AB [?] [6027]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x00, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xE1AC [?] [6028]*/ + 0x10,0x11,0x10,0x10,0x54,0x54,0x55,0x55,0x54,0x54,0x54,0x5C,0x65,0x02,0x00,0x00, + 0x00,0xFE,0x08,0x88,0x88,0x88,0x08,0xFE,0x18,0x28,0x48,0x88,0x08,0x08,0x28,0x10, + /* 0xE1AD [?] [6029]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x5C,0x64,0x01,0x02,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xE1AE [?] [6030]*/ + 0x00,0x00,0x3F,0x01,0x02,0x7F,0x04,0x08,0x30,0xC1,0x01,0x21,0x21,0x21,0x3F,0x00, + 0x10,0xF8,0x00,0x00,0x00,0xFC,0x40,0x20,0x18,0x06,0x00,0x08,0x08,0x08,0xF8,0x08, + /* 0xE1AF [?] [6031]*/ + 0x01,0x21,0x21,0x3F,0x01,0x02,0x04,0x0A,0x31,0xC1,0x1F,0x00,0x00,0x00,0x00,0x01, + 0x00,0x08,0x08,0xF8,0x00,0x80,0x40,0x20,0x18,0x06,0xE0,0x20,0x40,0x40,0x80,0x00, + /* 0xE1B0 [?] [6032]*/ + 0x01,0x21,0x21,0x3F,0x00,0x1F,0x10,0x10,0x14,0x12,0x11,0x12,0x24,0x28,0x40,0x80, + 0x00,0x08,0x08,0xF8,0x00,0xF0,0x10,0x50,0x50,0x90,0x10,0x92,0x4A,0x4A,0x06,0x02, + /* 0xE1B1 [?] [6033]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x21,0x21,0x21,0x3F,0x20,0x20,0x20,0x20,0x1F,0x00, + 0x00,0x08,0x08,0xF8,0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xE1B2 [?] [6034]*/ + 0x10,0x10,0x10,0x10,0x55,0x54,0x54,0x54,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE1B3 [?] [6035]*/ + 0x01,0x21,0x21,0x3F,0x00,0x00,0xFF,0x00,0x00,0x1F,0x10,0x10,0x1F,0x00,0x00,0x00, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xFE,0x10,0x10,0x90,0x90,0x90,0x90,0x10,0x50,0x20, + /* 0xE1B4 [?] [6036]*/ + 0x01,0x21,0x21,0x3F,0x02,0x02,0x7F,0x04,0x09,0x11,0x3F,0x01,0x11,0x21,0x45,0x02, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x00,0x10,0x08,0x04,0x00, + /* 0xE1B5 [?] [6037]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5C,0x64,0x00,0x00,0x00, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xE1B6 [?] [6038]*/ + 0x10,0x10,0x10,0x10,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xE1B7 [?] [6039]*/ + 0x08,0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x11,0x01,0x21,0x21,0x21,0x21,0x3F,0x00, + 0x90,0x88,0x80,0x9E,0xE0,0x80,0x44,0x34,0x0C,0x00,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xE1B8 [?] [6040]*/ + 0x10,0x10,0x11,0x11,0x56,0x54,0x55,0x55,0x55,0x55,0x55,0x5D,0x64,0x00,0x00,0x00, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x04,0x28,0x10, + /* 0xE1B9 [?] [6041]*/ + 0x01,0x21,0x21,0x3F,0x00,0x0C,0x70,0x40,0x44,0x44,0x5C,0x64,0x48,0x08,0x10,0x60, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80,0x80, + /* 0xE1BA [?] [6042]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x01, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x4A,0x86,0x02, + /* 0xE1BB [?] [6043]*/ + 0x10,0x13,0x11,0x10,0x54,0x54,0x54,0x57,0x54,0x55,0x54,0x5C,0x67,0x00,0x00,0x00, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE1BC [?] [6044]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x01,0x01,0x01, + 0x00,0xFE,0x02,0x02,0x7A,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x7A,0x02,0x02,0x0A,0x04, + /* 0xE1BD [?] [6045]*/ + 0x10,0x10,0x11,0x10,0x54,0x57,0x54,0x54,0x55,0x56,0x54,0x5C,0x64,0x01,0x01,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xE1BE [?] [6046]*/ + 0x10,0x10,0x11,0x11,0x56,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x65,0x00,0x00,0x00, + 0x80,0x80,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x04,0x28,0x10, + /* 0xE1BF [?] [6047]*/ + 0x10,0x10,0x10,0x11,0x56,0x55,0x54,0x54,0x55,0x54,0x54,0x5D,0x64,0x00,0x00,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x24,0x20,0xA0,0x40, + /* 0xE1C0 [?] [6048]*/ + 0x20,0x20,0x23,0x20,0xA8,0xAB,0xAA,0xAC,0xA8,0xAB,0xA8,0xB8,0xC8,0x01,0x02,0x04, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x44,0x40,0xFC,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xE1C1 [?] [6049]*/ + 0x20,0x20,0x20,0x27,0xA8,0xAA,0xA9,0xA9,0xAF,0xA8,0xA9,0xB9,0xCA,0x04,0x08,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x50,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40, + /* 0xE1C2 [?] [6050]*/ + 0x01,0x21,0x21,0x3F,0x10,0x10,0x10,0xFD,0x31,0x3A,0x54,0x50,0x90,0x11,0x13,0x11, + 0x00,0x08,0x08,0xF8,0x10,0x90,0x90,0x08,0x48,0x44,0x42,0x90,0x88,0x08,0xFC,0x04, + /* 0xE1C3 [?] [6051]*/ + 0x20,0x20,0x27,0x21,0xAA,0xAC,0xAB,0xAA,0xAA,0xAB,0xAA,0xBA,0xCB,0x00,0x00,0x00, + 0x40,0x80,0xFE,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xE1C4 [?] [6052]*/ + 0x01,0x21,0x21,0x3F,0x00,0x3F,0x21,0x21,0x2F,0x21,0x27,0x24,0x27,0x20,0x3F,0x20, + 0x00,0x08,0x08,0xF8,0x00,0xF8,0x08,0x08,0xE8,0x08,0xC8,0x48,0xC8,0x08,0xF8,0x08, + /* 0xE1C5 [?] [6053]*/ + 0x21,0x20,0x20,0x20,0xAB,0xA8,0xAB,0xA8,0xA8,0xA9,0xAA,0xB8,0xC8,0x00,0x00,0x00, + 0x84,0x68,0x30,0xC8,0x24,0x20,0xFE,0x40,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x94,0x88, + /* 0xE1C6 [?] [6054]*/ + 0x20,0x20,0x23,0x20,0xA9,0xA9,0xA9,0xA8,0xA9,0xA8,0xA8,0xBB,0xC8,0x00,0x00,0x00, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFC,0x08,0x10,0xFE,0x20,0x20,0xA0,0x40, + /* 0xE1C7 [?] [6055]*/ + 0x20,0x20,0x20,0x23,0xAA,0xAC,0xA9,0xAA,0xA8,0xA9,0xA8,0xB8,0xC8,0x00,0x07,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x94,0x08,0x04,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xE1C8 [?] [6056]*/ + 0x20,0x23,0x22,0x22,0xAB,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xBA,0xCA,0x04,0x04,0x08, + 0x00,0xFE,0x02,0x02,0xFE,0x10,0x92,0x92,0x92,0xFE,0x10,0x92,0x92,0x92,0xFE,0x02, + /* 0xE1C9 [?] [6057]*/ + 0x20,0x20,0x23,0x20,0xA8,0xAB,0xAA,0xAC,0xA8,0xAB,0xA8,0xB8,0xC8,0x01,0x02,0x00, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x24,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20, + /* 0xE1CA [?] [6058]*/ + 0x20,0x23,0x20,0x20,0xAB,0xAA,0xAA,0xAB,0xA8,0xA8,0xAF,0xB8,0xC9,0x00,0x00,0x03, + 0x00,0xFE,0x50,0x50,0xFE,0x52,0x52,0xFE,0x00,0x40,0xFE,0x88,0x90,0x60,0xD8,0x04, + /* 0xE1CB [?] [6059]*/ + 0x01,0x21,0x21,0x3F,0x00,0x00,0x3F,0x20,0x2F,0x22,0x2F,0x24,0x2D,0x42,0x45,0x88, + 0x00,0x08,0x08,0xF8,0x28,0x24,0xFE,0x20,0xA4,0x24,0xA8,0x98,0x12,0x2A,0x46,0x82, + /* 0xE1CC [?] [6060]*/ + 0x01,0x21,0x21,0x3F,0x00,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x01,0x48,0x48,0x87, + 0x00,0x08,0x08,0xF8,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x84,0x12,0xF2, + /* 0xE1CD [?] [6061]*/ + 0x01,0x21,0x21,0x3F,0x02,0x04,0x3F,0x21,0x3F,0x21,0x3F,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x08,0x08,0xF8,0x00,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x90,0xA8,0xFA,0x8A,0x7E, + /* 0xE1CE [?] [6062]*/ + 0x01,0x21,0x21,0x3F,0x02,0x0C,0x37,0xC0,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x22,0x26, + 0x00,0x08,0x08,0xF8,0x80,0x60,0xD8,0x06,0x08,0x48,0x48,0x48,0x48,0x08,0x28,0x10, + /* 0xE1CF [?] [6063]*/ + 0x11,0x10,0x10,0x13,0x54,0x55,0x54,0x57,0x54,0x55,0x55,0x5E,0x64,0x08,0x03,0x00, + 0x08,0x88,0x90,0xFC,0x40,0xF8,0x40,0xFE,0x80,0x00,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE1D0 [?] [6064]*/ + 0x20,0x21,0x20,0x20,0xAB,0xA8,0xA9,0xAA,0xA8,0xAF,0xA8,0xB9,0xC9,0x00,0x01,0x06, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xE1D1 [?] [6065]*/ + 0x20,0x20,0x20,0x23,0xA8,0xA8,0xA9,0xA9,0xAA,0xAB,0xA8,0xB9,0xC9,0x02,0x03,0x00, + 0x84,0x44,0x48,0xFE,0x84,0x84,0x08,0x4A,0x52,0x9C,0x84,0x08,0x08,0x52,0xDE,0x42, + /* 0xE1D2 [?] [6066]*/ + 0x10,0x11,0x11,0x11,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5D,0x62,0x02,0x04,0x08, + 0x00,0xFE,0x12,0x12,0xFE,0x00,0x7E,0x42,0x42,0x7E,0x42,0x7E,0x42,0x42,0x7E,0x42, + /* 0xE1D3 [?] [6067]*/ + 0x20,0x23,0x20,0x27,0xA9,0xA9,0xAF,0xA9,0xAB,0xAD,0xA8,0xB9,0xCA,0x04,0x08,0x00, + 0x38,0xC0,0x40,0xFC,0x50,0x54,0x58,0x54,0x54,0x4C,0xE0,0x50,0x48,0x44,0x42,0x40, + /* 0xE1D4 [?] [6068]*/ + 0x01,0x41,0x7F,0x02,0xFF,0x00,0x1F,0x10,0x1F,0x00,0x7F,0x40,0x4F,0x48,0x4F,0x40, + 0x00,0x04,0xFC,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x00,0xFC,0x04,0xE4,0x24,0xE4,0x0C, + /* 0xE1D5 [?] [6069]*/ + 0x20,0x22,0x21,0x22,0xAC,0xA9,0xAE,0xAB,0xAA,0xAB,0xAA,0xBB,0xCA,0x02,0x02,0x02, + 0x40,0x48,0x50,0x48,0xA4,0x18,0x06,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xE1D6 [?] [6070]*/ + 0x10,0x11,0x10,0x10,0x57,0x54,0x55,0x55,0x55,0x55,0x55,0x5C,0x67,0x00,0x00,0x00, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xE1D7 [?] [6071]*/ + 0x20,0x21,0x20,0x23,0xA8,0xA9,0xAA,0xA9,0xA9,0xA9,0xAA,0xBD,0xC8,0x01,0x02,0x04, + 0x20,0x24,0xA8,0xFE,0xA8,0x24,0x22,0x04,0x04,0xDE,0x44,0x54,0x9E,0x04,0x04,0x04, + /* 0xE1D8 [?] [6072]*/ + 0x20,0x27,0x20,0x22,0xA9,0xAA,0xAD,0xA8,0xAB,0xAA,0xAA,0xBB,0xCA,0x01,0x0F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xE1D9 [?] [6073]*/ + 0x01,0x41,0x7D,0x49,0x51,0x6B,0x4D,0x59,0x6D,0x4B,0x59,0x69,0x59,0x41,0x7F,0x00, + 0x00,0x04,0xF4,0x24,0x44,0xAC,0x34,0x64,0xB4,0x2C,0x64,0xA4,0x64,0x04,0xFC,0x04, + /* 0xE1DA [?] [6074]*/ + 0x01,0x41,0x7F,0x00,0x24,0x3A,0x22,0x1E,0x20,0x3E,0x48,0x08,0x7F,0x14,0x22,0x41, + 0x00,0x04,0xFC,0x00,0x7C,0x04,0x28,0x10,0xFE,0x12,0x50,0x5E,0x50,0xB0,0x9E,0x00, + /* 0xE1DB [?] [6075]*/ + 0x21,0x3F,0x08,0x7E,0x08,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x3E,0x22,0xFF,0x24,0x42, + 0x08,0xF8,0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x28,0x44,0x82, + /* 0xE1DC [?] [6076]*/ + 0x08,0x08,0x10,0x20,0x48,0x08,0x10,0x30,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE1DD [?] [6077]*/ + 0x08,0x08,0x10,0x23,0x48,0x08,0x10,0x30,0x50,0x90,0x10,0x10,0x11,0x11,0x12,0x14, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xE1DE [?] [6078]*/ + 0x08,0x09,0x11,0x21,0x49,0x09,0x11,0x31,0x51,0x91,0x11,0x11,0x11,0x11,0x17,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xE1DF [?] [6079]*/ + 0x08,0x08,0x11,0x21,0x4A,0x0C,0x13,0x32,0x52,0x93,0x12,0x12,0x13,0x10,0x10,0x10, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xE1E0 [?] [6080]*/ + 0x09,0x08,0x10,0x20,0x4B,0x08,0x10,0x31,0x50,0x90,0x13,0x10,0x10,0x10,0x10,0x10, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xE1E1 [?] [6081]*/ + 0x08,0x08,0x10,0x21,0x4B,0x08,0x10,0x33,0x50,0x90,0x11,0x13,0x14,0x10,0x11,0x16, + 0x20,0x40,0x88,0x10,0xE0,0x40,0x88,0xFC,0x84,0x80,0xF8,0x08,0x90,0x60,0x98,0x06, + /* 0xE1E2 [?] [6082]*/ + 0x10,0x10,0x20,0x47,0x90,0x12,0x21,0x61,0xAF,0x20,0x21,0x21,0x22,0x24,0x28,0x20, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x50,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40, + /* 0xE1E3 [?] [6083]*/ + 0x08,0x08,0x11,0x21,0x49,0x09,0x17,0x30,0x50,0x91,0x11,0x11,0x12,0x14,0x18,0x10, + 0x20,0x20,0x20,0x3C,0x20,0x20,0xFE,0x00,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xE1E4 [?] [6084]*/ + 0x08,0x09,0x10,0x20,0x48,0x0B,0x12,0x32,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x12, + 0x20,0x24,0xA4,0xA8,0x20,0xFE,0x02,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE1E5 [?] [6085]*/ + 0x08,0x08,0x13,0x22,0x4B,0x0A,0x13,0x30,0x57,0x90,0x10,0x13,0x10,0x10,0x17,0x10, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFC,0x00, + /* 0xE1E6 [?] [6086]*/ + 0x08,0x08,0x13,0x20,0x4A,0x09,0x11,0x32,0x50,0x93,0x10,0x11,0x11,0x11,0x11,0x10, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0xFC,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xE1E7 [?] [6087]*/ + 0x11,0x15,0x25,0x45,0x97,0x10,0x27,0x60,0xA7,0x21,0x27,0x21,0x21,0x2F,0x20,0x20, + 0x08,0x48,0x48,0x50,0xDE,0x14,0xE4,0x14,0xD4,0x14,0xD4,0x08,0x08,0xD4,0x24,0x42, + /* 0xE1E8 [?] [6088]*/ + 0x12,0x14,0x2F,0x48,0x9F,0x18,0x2F,0x64,0xA2,0x2F,0x24,0x27,0x24,0x28,0x2A,0x31, + 0x10,0x10,0x90,0x90,0xBE,0xA4,0xD4,0x14,0x14,0xD4,0x14,0x88,0x88,0x94,0x94,0x22, + /* 0xE1E9 [?] [6089]*/ + 0x2E,0x2A,0x4E,0x4A,0x8E,0x1A,0x2E,0x64,0xAF,0x34,0x27,0x24,0x27,0x24,0x27,0x24, + 0xE0,0xA0,0xEE,0xA0,0xE0,0xA0,0xFE,0x44,0xF4,0x84,0xE4,0x84,0xE4,0x84,0xF4,0x08, + /* 0xE1EA [?] [6090]*/ + 0x04,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x20,0x40, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE1EB [?] [6091]*/ + 0x00,0x44,0x28,0x10,0x28,0x48,0x88,0x08,0x18,0x28,0x48,0x88,0x08,0x08,0x50,0x20, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE1EC [?] [6092]*/ + 0x00,0x44,0x28,0x10,0x2B,0x48,0x88,0x08,0x18,0x28,0x48,0x88,0x09,0x09,0x52,0x24, + 0x80,0x80,0x80,0x80,0xF0,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xE1ED [?] [6093]*/ + 0x00,0x45,0x28,0x10,0x28,0x48,0x88,0x0B,0x18,0x28,0x48,0x88,0x08,0x08,0x50,0x20, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xE1EE [?] [6094]*/ + 0x00,0x44,0x28,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x0A,0x52,0x24, + 0x20,0x10,0x10,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE1EF [?] [6095]*/ + 0x00,0x47,0x28,0x10,0x29,0x49,0x89,0x09,0x18,0x28,0x48,0x8B,0x08,0x08,0x50,0x20, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xE1F0 [?] [6096]*/ + 0x00,0x45,0x28,0x10,0x28,0x48,0x88,0x0B,0x18,0x28,0x48,0x88,0x08,0x08,0x53,0x20, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x44,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFE,0x00, + /* 0xE1F1 [?] [6097]*/ + 0x00,0x44,0x28,0x10,0x29,0x4B,0x88,0x08,0x18,0x28,0x48,0x88,0x09,0x09,0x52,0x24, + 0x40,0x40,0x80,0x88,0x04,0xFE,0x02,0x90,0x90,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xE1F2 [?] [6098]*/ + 0x00,0x45,0x29,0x11,0x29,0x49,0x89,0x09,0x19,0x29,0x49,0x88,0x08,0x08,0x50,0x20, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xE1F3 [?] [6099]*/ + 0x00,0x44,0x29,0x11,0x2A,0x4D,0x89,0x09,0x19,0x29,0x49,0x89,0x09,0x09,0x50,0x20, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xE1F4 [?] [6100]*/ + 0x00,0x44,0x28,0x13,0x28,0x48,0x8B,0x0A,0x1A,0x2B,0x48,0x88,0x09,0x09,0x52,0x24, + 0x90,0x90,0x90,0xFC,0x94,0x94,0xFC,0x90,0x90,0xFE,0x92,0x92,0x1A,0x14,0x10,0x10, + /* 0xE1F5 [?] [6101]*/ + 0x00,0x44,0x28,0x10,0x2B,0x48,0x89,0x09,0x19,0x2B,0x49,0x89,0x0A,0x0A,0x54,0x20, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x24,0x24,0x24,0xA8,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xE1F6 [?] [6102]*/ + 0x00,0x88,0x50,0x21,0x52,0x94,0x11,0x10,0x30,0x57,0x90,0x10,0x11,0x12,0xA7,0x42, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xE1F7 [?] [6103]*/ + 0x00,0x88,0x53,0x22,0x54,0x90,0x10,0x13,0x30,0x51,0x90,0x10,0x10,0x10,0xA0,0x40, + 0x40,0x20,0xFE,0x02,0x14,0x10,0x10,0xFE,0x10,0x10,0x90,0x90,0x10,0x10,0x50,0x20, + /* 0xE1F8 [?] [6104]*/ + 0x00,0x88,0x57,0x20,0x51,0x92,0x12,0x13,0x32,0x56,0x9A,0x13,0x12,0x12,0xA2,0x46, + 0x00,0x10,0x90,0x90,0x10,0x10,0xD8,0x54,0x54,0x92,0x92,0x12,0x10,0x10,0x50,0x20, + /* 0xE1F9 [?] [6105]*/ + 0x02,0x8A,0x52,0x23,0x52,0x92,0x12,0x13,0x30,0x50,0x93,0x10,0x10,0x10,0xA7,0x40, + 0x20,0x24,0x28,0xB0,0x20,0x22,0xA2,0x1E,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xE1FA [?] [6106]*/ + 0x00,0x45,0x29,0x11,0x29,0x48,0x8B,0x0A,0x1A,0x2B,0x4A,0x8A,0x0B,0x0A,0x52,0x22, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x14,0x08, + /* 0xE1FB [?] [6107]*/ + 0x00,0x89,0x57,0x21,0x51,0x91,0x1F,0x11,0x33,0x53,0x95,0x15,0x19,0x11,0xA1,0x41, + 0x84,0xC4,0x04,0x14,0x14,0x14,0xD4,0x14,0x14,0x94,0x54,0x04,0x04,0x04,0x14,0x08, + /* 0xE1FC [?] [6108]*/ + 0x00,0x88,0x50,0x21,0x52,0x95,0x10,0x10,0x37,0x50,0x92,0x12,0x14,0x18,0xA1,0x40, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xE1FD [?] [6109]*/ + 0x00,0x88,0x50,0x20,0x51,0x92,0x15,0x10,0x30,0x50,0x92,0x11,0x11,0x10,0xA7,0x40, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xE1FE [?] [6110]*/ + 0x00,0x44,0x2B,0x10,0x28,0x49,0x88,0x08,0x19,0x28,0x48,0x89,0x09,0x09,0x51,0x21, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x00,0x00,0xFC,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xE2A1 [?] [6111]*/ + 0x00,0x44,0x28,0x11,0x2B,0x48,0x88,0x09,0x1A,0x28,0x49,0x8A,0x08,0x08,0x51,0x26, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xE2A2 [?] [6112]*/ + 0x00,0x88,0x53,0x20,0x51,0x92,0x17,0x10,0x33,0x52,0x92,0x12,0x13,0x10,0xA0,0x40, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xFE,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xE2A3 [?] [6113]*/ + 0x00,0x8B,0x52,0x22,0x53,0x92,0x12,0x13,0x30,0x57,0x90,0x11,0x12,0x14,0xA0,0x40, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xE2A4 [?] [6114]*/ + 0x00,0x8B,0x52,0x22,0x52,0x93,0x10,0x10,0x30,0x51,0x92,0x10,0x10,0x10,0xA1,0x46, + 0x00,0xFE,0x52,0x52,0x52,0xFE,0x20,0x40,0xFC,0x04,0x88,0x50,0x20,0x40,0x80,0x00, + /* 0xE2A5 [?] [6115]*/ + 0x00,0x90,0x53,0x22,0x52,0x93,0x12,0x12,0x33,0x50,0x90,0x10,0x10,0x11,0xA2,0x44, + 0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0xFC,0x90,0x90,0x90,0x90,0x12,0x12,0x0E, + /* 0xE2A6 [?] [6116]*/ + 0x00,0x88,0x50,0x21,0x52,0x95,0x10,0x10,0x37,0x50,0x90,0x13,0x12,0x12,0xA3,0x42, + 0x40,0x40,0xA0,0x10,0x08,0xF6,0x40,0x40,0xFC,0x40,0x40,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE2A7 [?] [6117]*/ + 0x00,0x88,0x57,0x20,0x51,0x91,0x12,0x14,0x30,0x50,0x97,0x10,0x10,0x10,0xA0,0x40, + 0x80,0x40,0xFC,0x00,0x10,0x10,0xA8,0x44,0x00,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xE2A8 [?] [6118]*/ + 0x00,0x97,0x51,0x21,0x51,0x97,0x14,0x14,0x34,0x57,0x91,0x11,0x11,0x11,0xA5,0x42, + 0x20,0x20,0x20,0x3E,0x42,0x44,0x90,0x10,0x10,0x54,0x52,0x52,0x92,0x10,0x50,0x20, + /* 0xE2A9 [?] [6119]*/ + 0x01,0x89,0x51,0x27,0x51,0x91,0x11,0x17,0x34,0x54,0x94,0x17,0x14,0x10,0xA0,0x40, + 0x00,0x1E,0x12,0xD2,0x12,0x1E,0x12,0xD2,0x52,0x5E,0x52,0xD2,0x52,0x22,0x2A,0x44, + /* 0xE2AA [?] [6120]*/ + 0x00,0x90,0x57,0x20,0x51,0x92,0x14,0x13,0x32,0x53,0x92,0x13,0x12,0x10,0xA7,0x40, + 0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xE2AB [?] [6121]*/ + 0x00,0x8B,0x52,0x22,0x53,0x92,0x12,0x13,0x30,0x57,0x92,0x12,0x12,0x12,0xA3,0x42, + 0x00,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x00,0xFE,0x40,0x44,0x28,0x90,0x08,0x06, + /* 0xE2AC [?] [6122]*/ + 0x00,0x97,0x54,0x27,0x54,0x97,0x10,0x13,0x32,0x53,0x92,0x13,0x12,0x12,0xA2,0x42, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xE2AD [?] [6123]*/ + 0x00,0x8B,0x52,0x22,0x53,0x92,0x12,0x12,0x32,0x52,0x92,0x12,0x12,0x12,0xA4,0x48, + 0x00,0xFC,0x24,0x24,0xFC,0x00,0xFC,0x84,0x84,0xFC,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xE2AE [?] [6124]*/ + 0x00,0x8B,0x50,0x20,0x57,0x90,0x11,0x12,0x34,0x50,0x97,0x10,0x11,0x12,0xAC,0x40, + 0x00,0xF8,0x90,0x60,0xFC,0xA4,0x28,0x20,0x60,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xE2AF [?] [6125]*/ + 0x00,0x45,0x28,0x10,0x2B,0x48,0x89,0x09,0x19,0x29,0x49,0x88,0x0B,0x08,0x50,0x20, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xE2B0 [?] [6126]*/ + 0x00,0x88,0x53,0x21,0x50,0x97,0x10,0x13,0x32,0x53,0x92,0x13,0x11,0x11,0xA2,0x4C, + 0x80,0x40,0xF8,0x10,0xA0,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x20,0x22,0x22,0x1E, + /* 0xE2B1 [?] [6127]*/ + 0x00,0x9F,0x58,0x2A,0x69,0xAB,0x28,0x28,0x6A,0xAA,0x2B,0x28,0x28,0x29,0xA9,0x52, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xE2B2 [?] [6128]*/ + 0x00,0x90,0x57,0x20,0x55,0x92,0x17,0x1A,0x33,0x52,0x93,0x10,0x12,0x14,0xA9,0x40, + 0x40,0x40,0xFC,0xA0,0x14,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x40,0x48,0x44,0x44,0x80, + /* 0xE2B3 [?] [6129]*/ + 0x02,0x93,0x54,0x29,0x67,0xA5,0x25,0x27,0x65,0xA5,0x27,0x25,0x25,0x25,0xA4,0x48, + 0x00,0x9E,0x8A,0x0A,0xD2,0x66,0x40,0xD4,0x5E,0x64,0xC4,0x44,0x5E,0x44,0x44,0xC4, + /* 0xE2B4 [?] [6130]*/ + 0x00,0x97,0x50,0x2F,0x50,0x97,0x15,0x14,0x37,0x50,0x97,0x10,0x1F,0x10,0xA5,0x48, + 0x3C,0xC0,0x40,0xFE,0x40,0xFC,0x54,0xE4,0xFC,0x40,0xFC,0x40,0xFE,0x00,0x24,0x92, + /* 0xE2B5 [?] [6131]*/ + 0x01,0x8F,0x51,0x27,0x54,0x97,0x11,0x11,0x33,0x52,0x97,0x1A,0x13,0x12,0xA3,0x42, + 0x10,0xFE,0x10,0xBC,0xA4,0xBC,0x40,0x20,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE2B6 [?] [6132]*/ + 0x10,0x10,0x10,0x1E,0x12,0x22,0x22,0x52,0x8A,0x04,0x04,0x08,0x08,0x10,0x20,0x40, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x90,0x90,0x90,0x90,0xFE,0x10,0x10,0x10,0x10,0x10, + /* 0xE2B7 [?] [6133]*/ + 0x00,0x7E,0x4A,0x4A,0x7E,0x4A,0x4A,0x7E,0x08,0xFF,0x18,0x2C,0x2A,0x4A,0x88,0x08, + 0x20,0x20,0x7C,0x44,0xA8,0x10,0x20,0xD0,0x1E,0x22,0x64,0x94,0x08,0x10,0x20,0xC0, + /* 0xE2B8 [?] [6134]*/ + 0x20,0x20,0x20,0x3C,0x24,0x45,0x46,0xA4,0x14,0x08,0x08,0x10,0x10,0x20,0x40,0x80, + 0x20,0x20,0x50,0x48,0xA4,0xFA,0x88,0xF8,0x88,0xF8,0xA2,0x94,0x88,0xA4,0xC4,0x80, + /* 0xE2B9 [?] [6135]*/ + 0x02,0x0F,0x34,0x03,0x1D,0x7F,0x40,0xBF,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x10,0x20, + 0x00,0xF0,0x60,0x80,0x00,0xFE,0x02,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x10,0x08, + /* 0xE2BA [?] [6136]*/ + 0x04,0x04,0x04,0x0F,0x08,0x10,0x30,0x48,0x84,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xF0,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xE2BB [?] [6137]*/ + 0x20,0x20,0x20,0x3E,0x44,0x48,0x80,0x10,0x10,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE2BC [?] [6138]*/ + 0x20,0x21,0x20,0x3C,0x44,0x48,0xA1,0x20,0x20,0x20,0x21,0x21,0x2A,0x34,0x20,0x01, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xE2BD [?] [6139]*/ + 0x20,0x20,0x20,0x3B,0x48,0x52,0x82,0x22,0x22,0x23,0x20,0x20,0x28,0x30,0x20,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xE2BE [?] [6140]*/ + 0x20,0x20,0x20,0x3D,0x46,0x48,0x80,0x20,0x21,0x20,0x20,0x24,0x28,0x30,0x20,0x00, + 0x80,0x80,0xFC,0x00,0x00,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x0A,0x0A,0x06,0x02, + /* 0xE2BF [?] [6141]*/ + 0x20,0x20,0x21,0x3C,0x44,0x48,0x80,0x23,0x20,0x20,0x20,0x24,0x28,0x30,0x21,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x00, + /* 0xE2C0 [?] [6142]*/ + 0x20,0x20,0x21,0x3C,0x44,0x48,0x83,0x20,0x20,0x20,0x20,0x24,0x28,0x30,0x21,0x02, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFE,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xE2C1 [?] [6143]*/ + 0x20,0x20,0x21,0x39,0x4A,0x54,0x80,0x23,0x20,0x20,0x20,0x20,0x29,0x31,0x22,0x04, + 0x80,0x80,0x00,0xFE,0x00,0x40,0x40,0xFC,0x44,0x44,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xE2C2 [?] [6144]*/ + 0x20,0x20,0x20,0x3C,0x45,0x4B,0x80,0x20,0x21,0x21,0x21,0x25,0x29,0x31,0x21,0x01, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE2C3 [?] [6145]*/ + 0x20,0x20,0x20,0x3B,0x4A,0x52,0x82,0x22,0x22,0x22,0x22,0x22,0x2A,0x32,0x22,0x02, + 0x40,0x40,0x80,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xE2C4 [?] [6146]*/ + 0x20,0x20,0x23,0x3C,0x44,0x4B,0xA2,0x24,0x21,0x20,0x20,0x23,0x28,0x30,0x20,0x00, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x02,0x04,0xF8,0x10,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xE2C5 [?] [6147]*/ + 0x20,0x20,0x20,0x3C,0x45,0x4A,0xA0,0x20,0x23,0x20,0x21,0x21,0x2A,0x34,0x20,0x00, + 0x20,0x20,0x50,0x88,0x04,0xFA,0x20,0x20,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xE2C6 [?] [6148]*/ + 0x20,0x21,0x21,0x3D,0x45,0x49,0xA1,0x21,0x20,0x21,0x21,0x21,0x29,0x31,0x21,0x01, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xE2C7 [?] [6149]*/ + 0x20,0x20,0x27,0x38,0x49,0x52,0x84,0x23,0x22,0x23,0x22,0x23,0x2A,0x30,0x27,0x00, + 0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xE2C8 [?] [6150]*/ + 0x20,0x23,0x22,0x3E,0x47,0x4A,0xA2,0x23,0x20,0x23,0x21,0x20,0x28,0x30,0x20,0x07, + 0xA0,0x2E,0x22,0x22,0xAE,0x22,0x22,0xFE,0x20,0xFE,0x04,0x88,0x50,0x20,0xD8,0x06, + /* 0xE2C9 [?] [6151]*/ + 0x21,0x21,0x27,0x39,0x48,0x53,0x82,0x23,0x22,0x23,0x20,0x23,0x28,0x31,0x22,0x04, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xE2CA [?] [6152]*/ + 0x22,0x21,0x27,0x38,0x4B,0x50,0x87,0x21,0x23,0x24,0x28,0x23,0x29,0x31,0x27,0x00, + 0x08,0x10,0xFC,0x40,0xF8,0x80,0xFC,0x00,0xF8,0x88,0x88,0xF8,0x08,0x08,0xFE,0x00, + /* 0xE2CB [?] [6153]*/ + 0x20,0x20,0x23,0x3C,0x44,0x48,0xA1,0x21,0x21,0x20,0x23,0x20,0x29,0x30,0x23,0x00, + 0x88,0x88,0xFE,0x88,0xF8,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE2CC [?] [6154]*/ + 0x22,0x22,0x27,0x3A,0x4A,0x57,0x80,0x27,0x24,0x27,0x24,0x27,0x2C,0x34,0x24,0x04, + 0x88,0x88,0xC8,0x90,0x9E,0xD4,0x24,0xD4,0x54,0xD4,0x54,0xC8,0x48,0x54,0x64,0xC2, + /* 0xE2CD [?] [6155]*/ + 0x20,0x23,0x22,0x3B,0x4A,0x52,0x81,0x20,0x20,0x23,0x20,0x20,0x2B,0x30,0x21,0x02, + 0x00,0xDE,0x52,0xDE,0x10,0x52,0xCE,0x00,0x88,0xFE,0x88,0x88,0xFE,0x88,0x04,0x02, + /* 0xE2CE [?] [6156]*/ + 0x20,0x27,0x22,0x3B,0x48,0x5F,0x8A,0x23,0x21,0x27,0x21,0x2F,0x29,0x33,0x2D,0x01, + 0x40,0xFC,0x48,0xF8,0x40,0xFE,0xAA,0xB8,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xE2CF [?] [6157]*/ + 0x01,0x00,0x3F,0x20,0x20,0x22,0x22,0x22,0x22,0x23,0x22,0x22,0x22,0x42,0x41,0x80, + 0x00,0x80,0xFE,0x00,0x00,0x00,0x04,0x18,0x60,0x80,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xE2D0 [?] [6158]*/ + 0x01,0x00,0x3F,0x20,0x20,0x2F,0x20,0x20,0x3F,0x21,0x21,0x22,0x42,0x44,0x88,0x10, + 0x00,0x80,0xFE,0x00,0x00,0xFC,0x80,0x80,0xFE,0x40,0x40,0x40,0x42,0x42,0x3E,0x00, + /* 0xE2D1 [?] [6159]*/ + 0x01,0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x24,0x22,0x21,0x40,0x41,0x86,0x38, + 0x00,0x80,0xFE,0x80,0x80,0xFC,0x80,0x80,0xF0,0x10,0x20,0x40,0x80,0x60,0x18,0x06, + /* 0xE2D2 [?] [6160]*/ + 0x01,0x00,0x3F,0x22,0x22,0x27,0x28,0x37,0x24,0x24,0x27,0x24,0x24,0x44,0x43,0x80, + 0x00,0x80,0xFE,0x00,0x00,0xF8,0x08,0xC8,0x48,0x48,0xC8,0x28,0x12,0x02,0xFE,0x00, + /* 0xE2D3 [?] [6161]*/ + 0x01,0x00,0x3F,0x20,0x22,0x22,0x24,0x2D,0x34,0x24,0x24,0x25,0x26,0x44,0x44,0x84, + 0x00,0x80,0xFE,0x00,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20,0x20, + /* 0xE2D4 [?] [6162]*/ + 0x01,0x00,0x3F,0x24,0x22,0x3F,0x20,0x20,0x2F,0x20,0x20,0x3F,0x20,0x40,0x40,0x80, + 0x00,0x80,0xFE,0x10,0x20,0xFC,0x80,0x80,0xF8,0x80,0x80,0xFE,0x80,0x80,0x80,0x80, + /* 0xE2D5 [?] [6163]*/ + 0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x23,0x20,0x27,0x24,0x27,0x44,0x44,0x88,0x10, + 0x00,0x80,0xFE,0x10,0x10,0xFE,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x20,0x10,0x08,0x06, + /* 0xE2D6 [?] [6164]*/ + 0x01,0x00,0x3F,0x20,0x20,0x2F,0x21,0x22,0x24,0x2F,0x34,0x27,0x24,0x47,0x40,0x80, + 0x00,0x80,0xFE,0x00,0x80,0xFC,0x20,0x10,0x88,0xF6,0x90,0xF0,0x90,0xF2,0x82,0x7E, + /* 0xE2D7 [?] [6165]*/ + 0x01,0x00,0x3F,0x20,0x22,0x2C,0x28,0x28,0x2E,0x28,0x28,0x2F,0x41,0x42,0x8C,0x30, + 0x00,0x80,0xFE,0x00,0x80,0xB8,0x88,0x88,0xB8,0x88,0x88,0xF8,0x40,0x20,0x18,0x06, + /* 0xE2D8 [?] [6166]*/ + 0x01,0x00,0x3F,0x20,0x21,0x27,0x24,0x27,0x24,0x27,0x21,0x22,0x3F,0x40,0x40,0x80, + 0x00,0x80,0xFE,0x80,0x00,0xFC,0x44,0xFC,0x84,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE2D9 [?] [6167]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x3F,0x21,0x2F,0x24,0x2F,0x34,0x24,0x44,0x41,0x82,0x0C, + 0x80,0xFE,0x80,0xF8,0x88,0xFE,0x08,0xF8,0x10,0xF8,0x16,0x90,0x90,0x60,0x10,0x08, + /* 0xE2DA [?] [6168]*/ + 0x01,0x00,0x3F,0x22,0x2F,0x22,0x2F,0x22,0x3F,0x24,0x27,0x24,0x44,0x48,0x8A,0x11, + 0x00,0x80,0xFE,0x10,0x90,0x1E,0xA4,0x24,0xD4,0x14,0x94,0x88,0x88,0x94,0xA4,0x42, + /* 0xE2DB [?] [6169]*/ + 0x00,0x3F,0x24,0x3F,0x24,0x27,0x20,0x2F,0x28,0x2F,0x20,0x3F,0x40,0x4F,0x80,0x3F, + 0x80,0xFE,0x10,0xFE,0x10,0xF0,0x80,0xF8,0x88,0xF8,0x80,0xFC,0x80,0xF8,0x80,0xFE, + /* 0xE2DC [?] [6170]*/ + 0x00,0x3F,0x20,0x2F,0x28,0x2F,0x28,0x2F,0x20,0x2F,0x20,0x3F,0x48,0x53,0x80,0x3F, + 0x80,0xFE,0x00,0xF8,0x88,0xF8,0x88,0xF8,0x80,0xF8,0x80,0xFE,0x88,0xE4,0x80,0xFE, + /* 0xE2DD [?] [6171]*/ + 0x00,0x3F,0x24,0x2F,0x31,0x22,0x2F,0x2A,0x2F,0x2A,0x2F,0x2A,0x4A,0x4A,0x88,0x11, + 0x80,0xFE,0x00,0x3C,0x14,0x24,0xCC,0x80,0xA8,0xBE,0xC8,0x88,0xBE,0x88,0x88,0x88, + /* 0xE2DE [?] [6172]*/ + 0x00,0x3F,0x20,0x2F,0x20,0x27,0x24,0x25,0x25,0x27,0x20,0x27,0x40,0x4F,0x82,0x04, + 0x80,0xFE,0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xFC,0x00,0xFC,0x00,0xFE,0x48,0xC4, + /* 0xE2DF [?] [6173]*/ + 0x00,0x3F,0x22,0x24,0x2D,0x36,0x24,0x24,0x20,0x27,0x24,0x27,0x44,0x47,0x84,0x04, + 0x80,0xFE,0x50,0xFC,0x90,0xFC,0x90,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x18, + /* 0xE2E0 [?] [6174]*/ + 0x10,0x10,0x10,0x10,0x18,0x54,0x50,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE2E1 [?] [6175]*/ + 0x10,0x10,0x17,0x10,0x18,0x54,0x50,0x50,0x90,0x10,0x11,0x11,0x12,0x12,0x14,0x18, + 0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0x84,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xE2E2 [?] [6176]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x91,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xE2E3 [?] [6177]*/ + 0x10,0x10,0x13,0x10,0x18,0x54,0x50,0x57,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x10,0x78,0xC0,0x40,0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xE2E4 [?] [6178]*/ + 0x10,0x13,0x10,0x18,0x54,0x50,0x57,0x90,0x10,0x10,0x10,0x11,0x11,0x12,0x14,0x18, + 0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xE2E5 [?] [6179]*/ + 0x10,0x10,0x10,0x17,0x18,0x54,0x50,0x57,0x92,0x12,0x11,0x10,0x10,0x10,0x11,0x16, + 0x40,0x40,0x40,0xFE,0x40,0x40,0x40,0xF8,0x08,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06, + /* 0xE2E6 [?] [6180]*/ + 0x10,0x13,0x12,0x12,0x1A,0x56,0x52,0x52,0x92,0x12,0x12,0x12,0x13,0x12,0x13,0x10, + 0x00,0xFC,0x00,0x08,0x88,0x50,0x50,0x20,0x20,0x50,0x50,0x88,0x08,0x00,0xFE,0x00, + /* 0xE2E7 [?] [6181]*/ + 0x10,0x10,0x10,0x10,0x1B,0x56,0x52,0x52,0x92,0x12,0x13,0x12,0x10,0x10,0x10,0x10, + 0x20,0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x22,0xFE,0x22,0x20,0x20,0x20,0x20, + /* 0xE2E8 [?] [6182]*/ + 0x10,0x10,0x10,0x11,0x19,0x56,0x50,0x50,0x93,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xE2E9 [?] [6183]*/ + 0x11,0x11,0x11,0x1A,0x54,0x51,0x50,0x90,0x13,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x0A,0x0A,0x06,0x02, + /* 0xE2EA [?] [6184]*/ + 0x11,0x11,0x11,0x11,0x19,0x55,0x51,0x57,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x08,0x08,0x10,0x20,0x40,0x00,0xFE,0x40,0x20,0x20,0x10,0x08,0x44,0x82,0x00, + /* 0xE2EB [?] [6185]*/ + 0x10,0x10,0x10,0x18,0x55,0x52,0x54,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x10,0x10, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xE2EC [?] [6186]*/ + 0x10,0x11,0x11,0x19,0x55,0x52,0x52,0x94,0x18,0x10,0x11,0x11,0x12,0x17,0x12,0x10, + 0x20,0x20,0x20,0x10,0x10,0x48,0x48,0x44,0x82,0x80,0x10,0x08,0x08,0xFC,0x04,0x00, + /* 0xE2ED [?] [6187]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x40,0x20,0x20,0x00,0xFE,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40, + /* 0xE2EE [?] [6188]*/ + 0x10,0x13,0x10,0x10,0x18,0x54,0x50,0x57,0x91,0x11,0x11,0x11,0x11,0x11,0x17,0x10, + 0x00,0xF8,0x88,0x88,0x88,0x88,0x88,0xF8,0x08,0x08,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xE2EF [?] [6189]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x91,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE2F0 [?] [6190]*/ + 0x10,0x10,0x10,0x10,0x1B,0x54,0x50,0x50,0x90,0x10,0x11,0x12,0x14,0x10,0x10,0x10, + 0x20,0x28,0x24,0x20,0xFE,0x20,0x70,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20,0x20,0x20, + /* 0xE2F1 [?] [6191]*/ + 0x10,0x13,0x10,0x10,0x1A,0x55,0x51,0x50,0x97,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0xF8,0x40,0x40,0x48,0x48,0x50,0x40,0xFE,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xE2F2 [?] [6192]*/ + 0x10,0x10,0x11,0x11,0x19,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x10,0x10,0x13,0x10, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xE2F3 [?] [6193]*/ + 0x10,0x10,0x10,0x13,0x1A,0x56,0x52,0x52,0x92,0x17,0x10,0x10,0x10,0x11,0x12,0x14, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0x48,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x06, + /* 0xE2F4 [?] [6194]*/ + 0x10,0x10,0x10,0x18,0x55,0x51,0x52,0x90,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xE2F5 [?] [6195]*/ + 0x10,0x11,0x11,0x11,0x19,0x55,0x51,0x51,0x91,0x11,0x11,0x11,0x11,0x12,0x12,0x14, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xE2F6 [?] [6196]*/ + 0x10,0x10,0x10,0x13,0x18,0x54,0x53,0x52,0x92,0x13,0x10,0x10,0x11,0x11,0x12,0x14, + 0x90,0x90,0x90,0xFC,0x94,0x94,0xFC,0x90,0x90,0xFE,0x92,0x92,0x1A,0x14,0x10,0x10, + /* 0xE2F7 [?] [6197]*/ + 0x10,0x13,0x10,0x10,0x18,0x55,0x51,0x52,0x94,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x84,0x84,0x84,0x04,0x14,0x08,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE2F8 [?] [6198]*/ + 0x10,0x17,0x12,0x11,0x18,0x54,0x51,0x56,0x90,0x13,0x10,0x10,0x17,0x10,0x10,0x10, + 0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x4E,0x40,0xF8,0x40,0x40,0xFC,0x40,0x40,0x40, + /* 0xE2F9 [?] [6199]*/ + 0x10,0x10,0x10,0x18,0x54,0x51,0x53,0x90,0x10,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x40,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE2FA [?] [6200]*/ + 0x20,0x20,0x27,0x30,0xA8,0xA0,0xAF,0xA2,0x22,0x24,0x25,0x28,0x2F,0x20,0x20,0x21, + 0x10,0x10,0x90,0x10,0x7E,0x12,0xD2,0x12,0x12,0x22,0x22,0xA2,0xC2,0x42,0x94,0x08, + /* 0xE2FB [?] [6201]*/ + 0x10,0x13,0x12,0x12,0x1A,0x56,0x53,0x52,0x92,0x12,0x12,0x12,0x14,0x14,0x19,0x12, + 0x00,0xFE,0x20,0x28,0x24,0x20,0xFE,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xE2FC [?] [6202]*/ + 0x20,0x27,0x24,0x24,0x35,0xAD,0xA5,0xA5,0xA5,0x25,0x25,0x21,0x22,0x22,0x24,0x28, + 0x04,0xC4,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x04,0x84,0x44,0x14,0x08, + /* 0xE2FD [?] [6203]*/ + 0x10,0x11,0x11,0x11,0x19,0x54,0x51,0x50,0x90,0x11,0x11,0x11,0x11,0x11,0x10,0x10, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE2FE [?] [6204]*/ + 0x10,0x10,0x11,0x11,0x1A,0x54,0x53,0x52,0x92,0x13,0x12,0x12,0x13,0x10,0x10,0x10, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xE3A1 [?] [6205]*/ + 0x10,0x10,0x10,0x11,0x1B,0x54,0x50,0x50,0x91,0x12,0x15,0x11,0x11,0x11,0x11,0x11, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xE3A2 [?] [6206]*/ + 0x10,0x13,0x12,0x1C,0x54,0x53,0x50,0x90,0x11,0x11,0x10,0x10,0x17,0x10,0x10,0x10, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE3A3 [?] [6207]*/ + 0x10,0x10,0x13,0x18,0x54,0x53,0x52,0x94,0x11,0x10,0x10,0x13,0x10,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x02,0x04,0xF8,0x10,0x20,0xFE,0x20,0x20,0xA0,0x40, + /* 0xE3A4 [?] [6208]*/ + 0x10,0x10,0x13,0x10,0x18,0x55,0x51,0x51,0x91,0x10,0x10,0x10,0x11,0x12,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xE3A5 [?] [6209]*/ + 0x10,0x12,0x12,0x12,0x1A,0x56,0x52,0x50,0x90,0x10,0x11,0x10,0x10,0x10,0x13,0x10, + 0x80,0xFC,0xA4,0xA4,0xA8,0x90,0xA8,0xC6,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE3A6 [?] [6210]*/ + 0x20,0x27,0x24,0x24,0x37,0xAC,0xA4,0xA7,0xA0,0x20,0x27,0x20,0x20,0x20,0x2F,0x20, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0x00, + /* 0xE3A7 [?] [6211]*/ + 0x20,0x27,0x24,0x24,0x34,0xAF,0xA4,0xA4,0xA4,0x25,0x26,0x24,0x24,0x24,0x27,0x24, + 0x00,0xFC,0x44,0x44,0x44,0xFC,0x44,0xC4,0xE4,0x54,0x44,0x44,0x44,0x04,0xFC,0x04, + /* 0xE3A8 [?] [6212]*/ + 0x10,0x11,0x11,0x11,0x19,0x54,0x53,0x52,0x92,0x12,0x13,0x12,0x12,0x12,0x11,0x10, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x44,0x44,0x44,0xFC,0x00,0x02,0x02,0xFE,0x00, + /* 0xE3A9 [?] [6213]*/ + 0x11,0x10,0x10,0x13,0x18,0x54,0x53,0x52,0x92,0x13,0x10,0x10,0x11,0x12,0x14,0x10, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xE3AA [?] [6214]*/ + 0x10,0x10,0x10,0x11,0x1B,0x54,0x50,0x51,0x92,0x10,0x11,0x12,0x10,0x10,0x11,0x16, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xE3AB [?] [6215]*/ + 0x20,0x27,0x24,0x24,0x35,0xAC,0xA5,0xA4,0xA7,0x24,0x24,0x24,0x24,0x25,0x27,0x20, + 0x00,0xFE,0x20,0x20,0xFC,0x20,0x24,0xA8,0xFE,0x20,0x50,0x48,0x84,0x04,0xFE,0x00, + /* 0xE3AC [?] [6216]*/ + 0x10,0x10,0x13,0x10,0x18,0x57,0x50,0x50,0x93,0x10,0x10,0x17,0x10,0x10,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x88,0x50,0xFE,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE3AD [?] [6217]*/ + 0x10,0x10,0x10,0x17,0x18,0x54,0x50,0x53,0x90,0x10,0x10,0x17,0x10,0x10,0x10,0x10, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xE3AE [?] [6218]*/ + 0x10,0x11,0x10,0x10,0x18,0x57,0x52,0x52,0x92,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x20,0x24,0xA4,0xA8,0x20,0xFE,0x02,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE3AF [?] [6219]*/ + 0x10,0x13,0x12,0x12,0x1A,0x57,0x52,0x52,0x93,0x12,0x12,0x12,0x12,0x12,0x12,0x12, + 0x00,0xFE,0x02,0x8A,0x52,0xFE,0x42,0x22,0xFE,0x82,0x82,0x82,0xFA,0x02,0x0A,0x04, + /* 0xE3B0 [?] [6220]*/ + 0x10,0x13,0x12,0x12,0x1A,0x56,0x52,0x53,0x92,0x12,0x12,0x12,0x12,0x12,0x12,0x14, + 0x00,0xFE,0x22,0x22,0xFA,0x22,0x22,0xFE,0x02,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE3B1 [?] [6221]*/ + 0x10,0x10,0x10,0x11,0x1A,0x54,0x51,0x52,0x90,0x11,0x10,0x10,0x12,0x12,0x14,0x10, + 0x80,0x80,0xFC,0x54,0x54,0xA4,0x24,0x44,0x94,0x08,0x40,0xA4,0xAA,0x8A,0x78,0x00, + /* 0xE3B2 [?] [6222]*/ + 0x10,0x10,0x13,0x18,0x55,0x51,0x52,0x94,0x10,0x10,0x17,0x10,0x10,0x10,0x10,0x10, + 0x80,0x40,0xFC,0x00,0x10,0x10,0xA8,0x44,0x00,0x40,0xFE,0x40,0x40,0x40,0x40,0x40, + /* 0xE3B3 [?] [6223]*/ + 0x10,0x11,0x11,0x11,0x19,0x55,0x51,0x51,0x90,0x13,0x12,0x12,0x12,0x12,0x17,0x10, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x94,0x94,0x94,0x94,0xFE,0x00, + /* 0xE3B4 [?] [6224]*/ + 0x10,0x10,0x11,0x19,0x55,0x50,0x53,0x90,0x11,0x11,0x11,0x11,0x11,0x10,0x10,0x13, + 0x20,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xE3B5 [?] [6225]*/ + 0x20,0x27,0x24,0x24,0x37,0xA8,0xA3,0xA0,0xA7,0x21,0x22,0x23,0x20,0x20,0x20,0x20, + 0x00,0xBC,0xA4,0xA4,0xBC,0x00,0xF8,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xE3B6 [?] [6226]*/ + 0x10,0x13,0x12,0x1A,0x56,0x53,0x50,0x90,0x17,0x10,0x10,0x10,0x11,0x11,0x12,0x14, + 0x00,0xFC,0x94,0x94,0x94,0xFC,0x80,0x40,0xFE,0x80,0xF8,0x88,0x08,0x08,0x28,0x10, + /* 0xE3B7 [?] [6227]*/ + 0x20,0x24,0x24,0x34,0xAF,0xA0,0xAF,0xA0,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x24, + 0x40,0x44,0x44,0x44,0xFC,0x00,0xFE,0x40,0x80,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0x0C, + /* 0xE3B8 [?] [6228]*/ + 0x20,0x21,0x27,0x31,0xA9,0xA1,0xA7,0xA1,0x23,0x23,0x25,0x25,0x29,0x21,0x21,0x21, + 0x88,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xE3B9 [?] [6229]*/ + 0x11,0x11,0x11,0x1A,0x55,0x51,0x51,0x91,0x11,0x10,0x10,0x11,0x12,0x10,0x11,0x16, + 0x00,0x00,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFC,0x08,0x90,0x60,0x98,0x06, + /* 0xE3BA [?] [6230]*/ + 0x10,0x10,0x17,0x10,0x1B,0x54,0x57,0x50,0x91,0x13,0x10,0x17,0x10,0x12,0x15,0x10, + 0x40,0x40,0xFC,0x40,0xF8,0x40,0xFE,0x80,0x10,0xE0,0x48,0xFC,0x44,0x48,0x44,0x80, + /* 0xE3BB [?] [6231]*/ + 0x21,0x20,0x20,0x27,0x30,0xAB,0xA0,0xA7,0xA0,0x23,0x20,0x21,0x22,0x2C,0x20,0x20, + 0x10,0xA0,0x00,0xFE,0xA0,0xF8,0xA8,0xFE,0xA8,0xF8,0xA0,0xB0,0xA8,0xA6,0xA0,0xA0, + /* 0xE3BC [?] [6232]*/ + 0x20,0x27,0x24,0x25,0x34,0xAF,0xA4,0xA5,0xA4,0x25,0x25,0x25,0x25,0x29,0x29,0x31, + 0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x2C, + /* 0xE3BD [?] [6233]*/ + 0x10,0x13,0x12,0x1B,0x56,0x53,0x50,0x97,0x10,0x13,0x12,0x13,0x10,0x12,0x14,0x10, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFE,0x00,0xF8,0x08,0xF8,0x40,0x48,0x44,0xC0, + /* 0xE3BE [?] [6234]*/ + 0x21,0x21,0x23,0x22,0x36,0xAB,0xA2,0xA2,0xA3,0x22,0x22,0x23,0x22,0x25,0x24,0x28, + 0x40,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0x24,0x92,0x92, + /* 0xE3BF [?] [6235]*/ + 0x10,0x11,0x10,0x10,0x1B,0x54,0x51,0x51,0x91,0x11,0x11,0x10,0x11,0x10,0x13,0x10, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE3C0 [?] [6236]*/ + 0x21,0x21,0x27,0x31,0xAB,0xA5,0xA9,0xA0,0x27,0x20,0x22,0x22,0x22,0x25,0x28,0x30, + 0x10,0x10,0xBC,0x10,0xB8,0x54,0x12,0x00,0xFC,0x44,0x40,0x78,0x40,0x40,0xFE,0x00, + /* 0xE3C1 [?] [6237]*/ + 0x20,0x2F,0x20,0x37,0xAC,0xA5,0xA5,0xA5,0x24,0x27,0x20,0x23,0x20,0x2F,0x22,0x24, + 0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xF4,0x04,0xFC,0x00,0xF8,0x00,0xFE,0x48,0xC4, + /* 0xE3C2 [?] [6238]*/ + 0x11,0x17,0x11,0x13,0x1A,0x57,0x50,0x57,0x94,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x08,0xFE,0x08,0xFC,0x94,0xFC,0x00,0xFE,0x02,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xE3C3 [?] [6239]*/ + 0x00,0x3F,0x01,0x01,0xFF,0x02,0x04,0x09,0x31,0xC1,0x11,0x11,0x21,0x41,0x05,0x02, + 0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06,0x90,0x48,0x24,0x24,0x00,0x00, + /* 0xE3C4 [?] [6240]*/ + 0x00,0x7B,0x48,0x51,0x4A,0x4D,0x68,0x50,0x41,0x46,0x19,0xE1,0x11,0x21,0x45,0x02, + 0x40,0xFC,0x80,0xF8,0x20,0xFC,0x88,0xF8,0x88,0xC0,0x30,0x0E,0x90,0x48,0x24,0x00, + /* 0xE3C5 [?] [6241]*/ + 0x20,0x17,0x00,0x40,0x40,0x40,0x40,0x5F,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xF4,0x04,0x04,0x04,0x04,0x04,0x04,0x14,0x08, + /* 0xE3C6 [?] [6242]*/ + 0x20,0x17,0x00,0x40,0x5F,0x40,0x40,0x40,0x4F,0x40,0x40,0x40,0x5F,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0x04,0xE4,0x04,0x04,0x04,0xF4,0x04,0x14,0x08, + /* 0xE3C7 [?] [6243]*/ + 0x20,0x17,0x01,0x41,0x5F,0x41,0x41,0x4F,0x41,0x41,0x5F,0x41,0x41,0x41,0x41,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x04,0x04,0xF4,0x14,0x14,0x54,0x24,0x0C, + /* 0xE3C8 [?] [6244]*/ + 0x20,0x17,0x02,0x42,0x42,0x5F,0x44,0x44,0x48,0x49,0x51,0x52,0x67,0x42,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x84,0x84,0x04,0x44,0x24,0xF4,0x14,0x14,0x08, + /* 0xE3C9 [?] [6245]*/ + 0x20,0x17,0x00,0x42,0x41,0x5F,0x40,0x44,0x42,0x41,0x42,0x44,0x48,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x44,0x44,0x84,0x04,0x84,0x44,0x44,0x04,0x14,0x08, + /* 0xE3CA [?] [6246]*/ + 0x20,0x17,0x00,0x42,0x41,0x5F,0x40,0x40,0x47,0x44,0x44,0x44,0x48,0x50,0x40,0x40, + 0x00,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0xC4,0x44,0x44,0x54,0x34,0x04,0x14,0x08, + /* 0xE3CB [?] [6247]*/ + 0x20,0x17,0x00,0x48,0x44,0x45,0x40,0x5C,0x44,0x44,0x45,0x4A,0x51,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x44,0x44,0xF4,0x44,0x44,0xA4,0x94,0x14,0x04,0xF4,0x04,0x14,0x08, + /* 0xE3CC [?] [6248]*/ + 0x20,0x17,0x00,0x40,0x47,0x44,0x44,0x47,0x40,0x4F,0x48,0x48,0x4F,0x40,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xC4,0x44,0x44,0xC4,0x04,0xE4,0x24,0x24,0xE4,0x04,0x14,0x08, + /* 0xE3CD [?] [6249]*/ + 0x20,0x17,0x00,0x40,0x5F,0x51,0x51,0x5F,0x51,0x53,0x55,0x59,0x51,0x5F,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xF4,0x14,0x14,0xF4,0x14,0x94,0x54,0x34,0x14,0xF4,0x04,0x0C, + /* 0xE3CE [?] [6250]*/ + 0x20,0x17,0x00,0x44,0x47,0x48,0x51,0x6F,0x49,0x4F,0x49,0x4F,0x41,0x41,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xC4,0x84,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x14,0x14,0xF4,0x0C, + /* 0xE3CF [?] [6251]*/ + 0x20,0x17,0x02,0x41,0x4F,0x48,0x4F,0x48,0x4F,0x49,0x48,0x4A,0x4C,0x48,0x40,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x14,0xA4,0x44,0x24,0x14,0x04,0x0C, + /* 0xE3D0 [?] [6252]*/ + 0x20,0x17,0x00,0x40,0x40,0x5F,0x40,0x4E,0x4A,0x4E,0x40,0x46,0x58,0x41,0x42,0x40, + 0x00,0xFC,0x84,0xA4,0x94,0xF4,0x84,0xA4,0xA4,0xA4,0xC4,0x54,0xB4,0x14,0x04,0x0C, + /* 0xE3D1 [?] [6253]*/ + 0x20,0x17,0x00,0x4F,0x48,0x4F,0x48,0x4F,0x40,0x5F,0x50,0x5F,0x50,0x5F,0x40,0x40, + 0x00,0xFC,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x04,0xF4,0x14,0xF4,0x14,0xF4,0x04,0x0C, + /* 0xE3D2 [?] [6254]*/ + 0x20,0x17,0x00,0x42,0x4C,0x48,0x4E,0x48,0x4F,0x42,0x42,0x44,0x44,0x48,0x50,0x40, + 0x00,0xFC,0x04,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x84,0x84,0x94,0x94,0x74,0x04,0x0C, + /* 0xE3D3 [?] [6255]*/ + 0x20,0x17,0x00,0x40,0x5F,0x4A,0x45,0x5F,0x50,0x47,0x40,0x46,0x41,0x42,0x44,0x48, + 0x00,0xFC,0x04,0xE4,0x04,0x24,0x44,0xF4,0x14,0xC4,0x44,0x84,0x04,0x84,0x44,0x2C, + /* 0xE3D4 [?] [6256]*/ + 0x20,0x17,0x00,0x40,0x5F,0x51,0x5F,0x50,0x5C,0x50,0x4F,0x48,0x4F,0x48,0x4F,0x48, + 0x00,0xFC,0x04,0x64,0x84,0x04,0xF4,0x84,0x54,0x34,0xE4,0x24,0xE4,0x24,0xE4,0x2C, + /* 0xE3D5 [?] [6257]*/ + 0x20,0x17,0x00,0x48,0x44,0x5E,0x48,0x49,0x4E,0x4A,0x4A,0x4A,0x4A,0x52,0x56,0x60, + 0x00,0xFC,0x04,0x44,0x44,0xA4,0xA4,0x14,0x0C,0x44,0x24,0x04,0x84,0x44,0x24,0x0C, + /* 0xE3D6 [?] [6258]*/ + 0x20,0x17,0x00,0x4F,0x48,0x4F,0x48,0x4F,0x48,0x4F,0x41,0x5F,0x41,0x42,0x44,0x48, + 0x00,0xFC,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0xE4,0x44,0xF4,0x04,0x84,0x44,0x2C, + /* 0xE3D7 [?] [6259]*/ + 0x20,0x17,0x00,0x40,0x5E,0x42,0x4A,0x44,0x48,0x57,0x61,0x4F,0x41,0x42,0x44,0x58, + 0x00,0xFC,0x04,0x84,0x94,0xA4,0x4C,0x54,0x24,0xD4,0x0C,0xE4,0x04,0x84,0x44,0x2C, + /* 0xE3D8 [?] [6260]*/ + 0x20,0x13,0x11,0x4F,0x41,0x5F,0x42,0x44,0x4F,0x40,0x4F,0x4A,0x4A,0x5F,0x40,0x40, + 0x00,0xFC,0x04,0xE4,0x04,0xF4,0x04,0x44,0xE4,0x04,0xE4,0xA4,0xA4,0xF4,0x14,0x08, + /* 0xE3D9 [?] [6261]*/ + 0x20,0x17,0x01,0x5F,0x41,0x4F,0x48,0x4F,0x48,0x4F,0x48,0x4F,0x48,0x7F,0x44,0x48, + 0x00,0xFC,0x04,0xF4,0x04,0xE4,0x24,0xE4,0x24,0xE4,0x24,0xE4,0x24,0xFC,0x44,0x2C, + /* 0xE3DA [?] [6262]*/ + 0x20,0x17,0x00,0x51,0x4A,0x5F,0x44,0x55,0x55,0x5F,0x44,0x48,0x49,0x52,0x40,0x40, + 0x00,0xFC,0x04,0x44,0x44,0x74,0x94,0x24,0x44,0x44,0x44,0xA4,0x14,0x04,0x14,0x08, + /* 0xE3DB [?] [6263]*/ + 0x20,0x17,0x00,0x5C,0x44,0x7F,0x52,0x5E,0x52,0x5E,0x53,0x7E,0x42,0x43,0x40,0x40, + 0x00,0xFC,0x04,0x44,0x7C,0x54,0x94,0x14,0x54,0x24,0xA4,0x54,0x94,0x04,0x14,0x08, + /* 0xE3DC [?] [6264]*/ + 0x01,0x01,0x01,0x11,0x09,0x09,0x01,0x03,0x05,0x09,0x31,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE3DD [?] [6265]*/ + 0x00,0x08,0x08,0x08,0x0F,0x00,0x00,0x00,0x7F,0x08,0x08,0x08,0x10,0x10,0x20,0x40, + 0x10,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xE3DE [?] [6266]*/ + 0x04,0x24,0x24,0x24,0x24,0x3C,0x05,0x04,0xFC,0x24,0x24,0x24,0x24,0x44,0x84,0x05, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xE3DF [?] [6267]*/ + 0x00,0x20,0x10,0x10,0x80,0x40,0x48,0x08,0x10,0x10,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE3E0 [?] [6268]*/ + 0x00,0x20,0x11,0x11,0x82,0x44,0x41,0x10,0x10,0x20,0xE0,0x21,0x22,0x22,0x21,0x00, + 0x80,0x80,0x00,0xFE,0x00,0x00,0xF8,0x08,0x10,0x60,0x80,0x00,0x02,0x02,0xFE,0x00, + /* 0xE3E1 [?] [6269]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x4A,0x0B,0x12,0x12,0xE2,0x22,0x22,0x22,0x21,0x00, + 0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xE3E2 [?] [6270]*/ + 0x00,0x27,0x12,0x12,0x82,0x41,0x49,0x09,0x10,0x10,0xE0,0x20,0x20,0x21,0x22,0x0C, + 0x00,0xF8,0x08,0x88,0x48,0x50,0x10,0x10,0xA0,0xA0,0x40,0x40,0xA0,0x10,0x08,0x06, + /* 0xE3E3 [?] [6271]*/ + 0x00,0x20,0x10,0x13,0x80,0x40,0x48,0x09,0x10,0x10,0xE0,0x27,0x20,0x20,0x20,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE3E4 [?] [6272]*/ + 0x00,0x20,0x13,0x10,0x80,0x40,0x47,0x11,0x11,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x00,0x00,0xF8,0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xE3E5 [?] [6273]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x48,0x08,0x11,0x11,0xE2,0x24,0x28,0x20,0x20,0x00, + 0x40,0x40,0x40,0x40,0xFE,0x40,0xE0,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40,0x40, + /* 0xE3E6 [?] [6274]*/ + 0x00,0x27,0x10,0x10,0x82,0x42,0x4A,0x0A,0x12,0x13,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x00,0xFE,0x40,0x40,0x40,0x7C,0x44,0x44,0x44,0xFC,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xE3E7 [?] [6275]*/ + 0x00,0x20,0x10,0x17,0x80,0x42,0x4A,0x0A,0x12,0x13,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xE3E8 [?] [6276]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x4A,0x0B,0x12,0x12,0xE2,0x22,0x22,0x23,0x22,0x00, + 0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xE3E9 [?] [6277]*/ + 0x00,0x20,0x17,0x14,0x84,0x44,0x44,0x17,0x14,0x24,0xE4,0x24,0x24,0x27,0x24,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xF4,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xE3EA [?] [6278]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x48,0x08,0x10,0x10,0xE0,0x20,0x20,0x20,0x20,0x00, + 0x80,0x40,0x40,0x00,0xFE,0x80,0x80,0xC0,0xA0,0x90,0x88,0x88,0x80,0x80,0x80,0x80, + /* 0xE3EB [?] [6279]*/ + 0x00,0x20,0x10,0x17,0x81,0x41,0x49,0x09,0x11,0x10,0xE0,0x20,0x20,0x21,0x22,0x0C, + 0x80,0x40,0x40,0xFC,0x10,0x10,0x10,0x10,0x10,0xA0,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xE3EC [?] [6280]*/ + 0x00,0x20,0x10,0x17,0x80,0x40,0x49,0x09,0x11,0x11,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x80,0x40,0x40,0xFC,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xE3ED [?] [6281]*/ + 0x00,0x22,0x11,0x11,0x80,0x47,0x40,0x10,0x10,0x20,0xE0,0x21,0x21,0x22,0x24,0x08, + 0x40,0x40,0x40,0x40,0x40,0xFC,0x44,0x44,0x84,0xA4,0x94,0x14,0x04,0x04,0x28,0x10, + /* 0xE3EE [?] [6282]*/ + 0x00,0x47,0x24,0x25,0x05,0x86,0x45,0x54,0x14,0x24,0xE6,0x25,0x24,0x24,0x24,0x04, + 0x10,0x90,0x90,0x10,0x7E,0x12,0x12,0x92,0x92,0x92,0x92,0x12,0x22,0x22,0x4A,0x84, + /* 0xE3EF [?] [6283]*/ + 0x01,0x21,0x11,0x11,0x87,0x41,0x41,0x11,0x11,0x21,0xE1,0x21,0x21,0x21,0x21,0x01, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xE3F0 [?] [6284]*/ + 0x00,0x20,0x10,0x10,0x87,0x40,0x40,0x10,0x11,0x21,0xE2,0x24,0x28,0x20,0x20,0x00, + 0x40,0x50,0x48,0x40,0xFC,0x40,0xE0,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40,0x40, + /* 0xE3F1 [?] [6285]*/ + 0x01,0x21,0x11,0x11,0x87,0x41,0x49,0x09,0x11,0x12,0xE2,0x22,0x24,0x24,0x29,0x10, + 0x20,0x10,0x10,0x00,0xFE,0x40,0x40,0x48,0x48,0x50,0x50,0x62,0x42,0xC2,0x3E,0x00, + /* 0xE3F2 [?] [6286]*/ + 0x00,0x20,0x10,0x10,0x80,0x43,0x4A,0x0A,0x12,0x13,0xE2,0x22,0x22,0x24,0x24,0x08, + 0x40,0x40,0x7E,0x40,0x40,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00, + /* 0xE3F3 [?] [6287]*/ + 0x00,0x20,0x10,0x13,0x82,0x42,0x4A,0x0A,0x12,0x17,0xE0,0x20,0x20,0x21,0x22,0x04, + 0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0x48,0xFE,0x40,0xA0,0xA0,0x10,0x08,0x06, + /* 0xE3F4 [?] [6288]*/ + 0x00,0x20,0x17,0x14,0x84,0x44,0x44,0x14,0x14,0x25,0xE5,0x26,0x24,0x24,0x27,0x04, + 0x00,0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x24,0x1C,0x04,0x04,0x04,0xFC,0x04, + /* 0xE3F5 [?] [6289]*/ + 0x01,0x21,0x13,0x12,0x84,0x48,0x42,0x12,0x13,0x2E,0xE2,0x22,0x22,0x22,0x21,0x00, + 0x00,0x00,0xFC,0x00,0x40,0x40,0x78,0xC8,0x48,0x48,0x48,0x5A,0x42,0x02,0xFE,0x00, + /* 0xE3F6 [?] [6290]*/ + 0x00,0x20,0x10,0x10,0x81,0x42,0x44,0x10,0x13,0x20,0xE0,0x21,0x20,0x20,0x20,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x48,0x26,0x20,0xF8,0x08,0x10,0x10,0xA0,0x40,0x20,0x20, + /* 0xE3F7 [?] [6291]*/ + 0x00,0x21,0x16,0x14,0x84,0x44,0x44,0x14,0x14,0x25,0xE6,0x24,0x21,0x21,0x22,0x04, + 0x00,0x00,0x3C,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xB4,0xA8,0x20,0x20,0x20,0x20, + /* 0xE3F8 [?] [6292]*/ + 0x00,0x20,0x17,0x14,0x84,0x44,0x44,0x17,0x10,0x20,0xE2,0x22,0x24,0x28,0x21,0x00, + 0x08,0x3C,0xC0,0x00,0x40,0x40,0x40,0xFE,0x40,0x40,0x48,0x44,0x42,0x42,0x40,0x80, + /* 0xE3F9 [?] [6293]*/ + 0x00,0x20,0x10,0x17,0x80,0x40,0x41,0x12,0x17,0x20,0xE0,0x21,0x22,0x27,0x22,0x00, + 0x80,0x40,0x40,0xFE,0x40,0x80,0x08,0x10,0xE0,0x40,0x80,0x08,0x04,0xFE,0x02,0x00, + /* 0xE3FA [?] [6294]*/ + 0x00,0x20,0x12,0x11,0x81,0x40,0x4B,0x08,0x10,0x10,0xE7,0x20,0x20,0x20,0x20,0x00, + 0x40,0x40,0x48,0x48,0x50,0x40,0xF8,0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0x40,0x40, + /* 0xE3FB [?] [6295]*/ + 0x00,0x20,0x10,0x17,0x84,0x48,0x42,0x12,0x12,0x22,0xE3,0x22,0x22,0x22,0x21,0x00, + 0x80,0x40,0x40,0xFC,0x04,0x08,0x00,0x10,0x20,0x40,0x80,0x04,0x04,0x04,0xFC,0x00, + /* 0xE3FC [?] [6296]*/ + 0x00,0x27,0x10,0x10,0x80,0x47,0x44,0x14,0x14,0x27,0xE0,0x20,0x20,0x20,0x25,0x02, + 0x08,0x88,0x88,0x88,0x88,0x88,0x08,0x10,0x10,0x90,0x94,0xA4,0xA2,0xBE,0x02,0x00, + /* 0xE3FD [?] [6297]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x4A,0x0A,0x13,0x12,0xE2,0x22,0x22,0x22,0x23,0x02, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x8A,0x06,0x02, + /* 0xE3FE [?] [6298]*/ + 0x00,0x27,0x10,0x10,0x80,0x40,0x41,0x16,0x10,0x23,0xE0,0x20,0x20,0x20,0x27,0x00, + 0x00,0xF8,0x10,0x20,0x60,0x98,0x04,0x02,0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x00, + /* 0xE4A1 [?] [6299]*/ + 0x00,0x27,0x10,0x10,0x83,0x42,0x42,0x13,0x12,0x22,0xE3,0x22,0x20,0x20,0x2F,0x00, + 0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x00,0x00,0xFE,0x00, + /* 0xE4A2 [?] [6300]*/ + 0x00,0x20,0x17,0x10,0x81,0x41,0x43,0x15,0x19,0x21,0xE1,0x21,0x21,0x21,0x21,0x01, + 0x40,0x40,0xFE,0x80,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xE4A3 [?] [6301]*/ + 0x00,0x40,0x2F,0x22,0x02,0x83,0x42,0x54,0x16,0x25,0xE8,0x20,0x21,0x22,0x24,0x08, + 0x02,0x02,0xC2,0x12,0x12,0xD2,0x52,0x52,0x52,0x52,0x92,0x92,0x02,0x02,0x0A,0x04, + /* 0xE4A4 [?] [6302]*/ + 0x00,0x20,0x10,0x17,0x80,0x42,0x51,0x10,0x1F,0x20,0xE0,0x21,0x21,0x22,0x24,0x08, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x50,0x40,0xFE,0xA0,0xA0,0x10,0x10,0x08,0x04,0x02, + /* 0xE4A5 [?] [6303]*/ + 0x00,0x20,0x10,0x10,0x80,0x43,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x20,0x21,0x22,0x04, + 0x40,0x40,0x7E,0x40,0x40,0xF8,0x08,0x48,0x48,0x48,0x48,0x48,0xA0,0x10,0x08,0x04, + /* 0xE4A6 [?] [6304]*/ + 0x00,0x27,0x14,0x14,0x84,0x44,0x47,0x14,0x14,0x24,0xE4,0x25,0x26,0x24,0x27,0x04, + 0x00,0xFC,0x04,0x44,0x44,0x44,0xFC,0x44,0x44,0xA4,0x94,0x14,0x04,0x04,0xFC,0x04, + /* 0xE4A7 [?] [6305]*/ + 0x00,0x27,0x14,0x14,0x84,0x44,0x44,0x14,0x14,0x24,0xE4,0x24,0x24,0x24,0x27,0x04, + 0x00,0xFE,0x02,0x02,0xF2,0x92,0x92,0x92,0x92,0x92,0xF2,0x92,0x02,0x02,0xFE,0x02, + /* 0xE4A8 [?] [6306]*/ + 0x00,0x22,0x12,0x13,0x84,0x40,0x40,0x17,0x10,0x21,0xE1,0x22,0x24,0x28,0x20,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40, + /* 0xE4A9 [?] [6307]*/ + 0x00,0x20,0x13,0x12,0x82,0x42,0x4B,0x0A,0x12,0x12,0xE3,0x22,0x22,0x22,0x23,0x02, + 0x40,0x80,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE4AA [?] [6308]*/ + 0x00,0x20,0x10,0x11,0x83,0x42,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x22,0x22,0x2F,0x00, + 0x40,0x40,0x80,0x00,0xFC,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0x94,0xFE,0x00, + /* 0xE4AB [?] [6309]*/ + 0x00,0x20,0x10,0x11,0x82,0x44,0x41,0x10,0x10,0x27,0xE0,0x20,0x21,0x22,0x27,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x00,0x00,0xFC,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xE4AC [?] [6310]*/ + 0x00,0x20,0x10,0x14,0x82,0x40,0x40,0x11,0x12,0x24,0xE0,0x20,0x21,0x21,0x22,0x04, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xE4AD [?] [6311]*/ + 0x00,0x20,0x11,0x11,0x82,0x44,0x43,0x12,0x12,0x23,0xE2,0x22,0x23,0x20,0x20,0x00, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10, + /* 0xE4AE [?] [6312]*/ + 0x01,0x21,0x11,0x13,0x84,0x40,0x51,0x16,0x10,0x23,0xE0,0x24,0x27,0x20,0x20,0x00, + 0x00,0x00,0xF8,0x10,0xA0,0x40,0xB0,0x4E,0x40,0xFC,0x40,0x40,0xFE,0x40,0x40,0x40, + /* 0xE4AF [?] [6313]*/ + 0x02,0x41,0x21,0x2F,0x00,0x84,0x42,0x52,0x11,0x21,0xE2,0x22,0x24,0x28,0x30,0x00, + 0x04,0x04,0x04,0xE4,0x94,0x94,0x94,0x94,0x14,0x14,0x94,0x94,0x44,0x44,0x14,0x08, + /* 0xE4B0 [?] [6314]*/ + 0x00,0x44,0x22,0x22,0x00,0x80,0x4E,0x52,0x12,0x22,0xE2,0x22,0x23,0x22,0x20,0x00, + 0x40,0x40,0x40,0x7C,0x50,0x90,0x10,0x10,0xFE,0x10,0x10,0x90,0x10,0x10,0x10,0x10, + /* 0xE4B1 [?] [6315]*/ + 0x00,0x27,0x10,0x10,0x83,0x40,0x40,0x17,0x10,0x20,0xEF,0x22,0x21,0x21,0x20,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x10,0x10,0xFE,0x10,0x10,0x10,0x50,0x20, + /* 0xE4B2 [?] [6316]*/ + 0x01,0x21,0x11,0x11,0x87,0x42,0x42,0x12,0x12,0x24,0xE2,0x21,0x22,0x22,0x24,0x08, + 0x00,0x00,0x00,0x1E,0xD2,0x52,0x52,0x52,0x52,0x92,0x92,0x12,0x92,0x5E,0x52,0x00, + /* 0xE4B3 [?] [6317]*/ + 0x00,0x40,0x2F,0x20,0x00,0x87,0x44,0x54,0x17,0x20,0xE0,0x21,0x22,0x2C,0x20,0x00, + 0x40,0x40,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xE4B4 [?] [6318]*/ + 0x00,0x27,0x10,0x10,0x83,0x40,0x40,0x17,0x10,0x20,0xE3,0x22,0x22,0x22,0x23,0x02, + 0x00,0xFC,0x40,0x40,0xF8,0x88,0x88,0xFE,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xE4B5 [?] [6319]*/ + 0x00,0x20,0x10,0x17,0x80,0x42,0x41,0x11,0x17,0x20,0xE1,0x21,0x22,0x24,0x28,0x00, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x50,0xFE,0xE0,0x50,0x50,0x48,0x44,0x42,0x40, + /* 0xE4B6 [?] [6320]*/ + 0x00,0x27,0x14,0x14,0x85,0x44,0x44,0x14,0x15,0x24,0xE4,0x24,0x24,0x24,0x27,0x04, + 0x00,0xFC,0x44,0x44,0xF4,0x44,0xE4,0x44,0xF4,0x54,0x54,0x74,0x44,0x44,0xFC,0x04, + /* 0xE4B7 [?] [6321]*/ + 0x00,0x23,0x12,0x12,0x82,0x42,0x43,0x10,0x10,0x22,0xE2,0x22,0x22,0x25,0x28,0x10, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x00, + /* 0xE4B8 [?] [6322]*/ + 0x00,0x21,0x11,0x11,0x81,0x40,0x4B,0x0A,0x12,0x13,0xE2,0x22,0x23,0x22,0x22,0x02, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x14,0x08, + /* 0xE4B9 [?] [6323]*/ + 0x00,0x22,0x12,0x12,0x83,0x40,0x48,0x09,0x12,0x14,0xE0,0x23,0x20,0x20,0x20,0x00, + 0x40,0x48,0x48,0x48,0xF8,0x40,0xA0,0x10,0x88,0x46,0x40,0xF0,0x10,0x20,0x20,0x40, + /* 0xE4BA [?] [6324]*/ + 0x00,0x20,0x13,0x12,0x82,0x43,0x42,0x12,0x12,0x22,0xEF,0x20,0x21,0x22,0x24,0x08, + 0x10,0x38,0xC0,0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00,0x20,0x10,0x08,0x04, + /* 0xE4BB [?] [6325]*/ + 0x02,0x21,0x10,0x11,0x82,0x40,0x4F,0x11,0x12,0x27,0xEA,0x22,0x22,0x22,0x20,0x00, + 0x08,0x10,0xE0,0x10,0x08,0x80,0xFE,0x40,0x40,0xFC,0x44,0x44,0x54,0x48,0x40,0x40, + /* 0xE4BC [?] [6326]*/ + 0x01,0x21,0x11,0x12,0x82,0x47,0x4A,0x12,0x12,0x23,0xE2,0x20,0x21,0x22,0x24,0x08, + 0x00,0x00,0xF0,0x10,0x20,0xFC,0x44,0x44,0x44,0xFC,0xA4,0xA0,0x20,0x22,0x22,0x1E, + /* 0xE4BD [?] [6327]*/ + 0x00,0x20,0x17,0x14,0x88,0x43,0x40,0x10,0x17,0x21,0xE1,0x21,0x22,0x22,0x24,0x08, + 0x80,0x40,0xFC,0x04,0x08,0xF0,0x00,0x00,0xFC,0x20,0x20,0x20,0x24,0x24,0x1C,0x00, + /* 0xE4BE [?] [6328]*/ + 0x00,0x20,0x17,0x10,0x80,0x4F,0x40,0x11,0x13,0x26,0xEA,0x23,0x22,0x22,0x23,0x02, + 0x80,0x88,0xE8,0x90,0xA0,0xFE,0x80,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE4BF [?] [6329]*/ + 0x01,0x21,0x17,0x11,0x81,0x41,0x49,0x09,0x11,0x11,0xE1,0x27,0x20,0x20,0x21,0x02, + 0x08,0x08,0xFE,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00,0x90,0x08,0x04, + /* 0xE4C0 [?] [6330]*/ + 0x02,0x42,0x22,0x22,0x0F,0x82,0x42,0x56,0x17,0x2A,0xEA,0x32,0x22,0x22,0x22,0x02, + 0x00,0x0C,0x70,0x40,0x40,0x40,0x7E,0x48,0x48,0xC8,0x48,0x48,0x48,0x48,0x48,0x88, + /* 0xE4C1 [?] [6331]*/ + 0x02,0x42,0x22,0x22,0x0F,0x82,0x42,0x56,0x17,0x2A,0xEA,0x32,0x22,0x22,0x22,0x02, + 0x08,0x28,0x28,0x28,0xA4,0x44,0x54,0x92,0x10,0xA0,0x20,0x28,0x44,0xFC,0x44,0x00, + /* 0xE4C2 [?] [6332]*/ + 0x00,0x20,0x13,0x10,0x80,0x47,0x40,0x11,0x10,0x22,0xE1,0x27,0x20,0x20,0x21,0x06, + 0x40,0x40,0xF8,0x40,0x40,0xFC,0x04,0x28,0xA0,0x20,0x20,0xFC,0x50,0x88,0x04,0x04, + /* 0xE4C3 [?] [6333]*/ + 0x00,0x4F,0x20,0x21,0x02,0x84,0x4A,0x41,0x12,0x24,0xE8,0x21,0x22,0x24,0x20,0x00, + 0x00,0xFE,0x80,0x84,0x44,0x68,0xB0,0x30,0xA8,0x68,0xA4,0x24,0x22,0x20,0xA0,0x40, + /* 0xE4C4 [?] [6334]*/ + 0x00,0x27,0x14,0x14,0x87,0x44,0x44,0x17,0x10,0x20,0xEF,0x22,0x22,0x22,0x24,0x08, + 0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x00,0x00,0xFE,0x08,0x08,0x08,0x08,0x08, + /* 0xE4C5 [?] [6335]*/ + 0x00,0x23,0x12,0x12,0x83,0x40,0x47,0x14,0x14,0x27,0xE4,0x24,0x27,0x20,0x20,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x42,0x42,0x3E, + /* 0xE4C6 [?] [6336]*/ + 0x00,0x20,0x10,0x11,0x82,0x44,0x41,0x10,0x10,0x23,0xE0,0x22,0x21,0x21,0x2F,0x00, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF0,0x40,0x40,0xF8,0x40,0x48,0x48,0x50,0xFE,0x00, + /* 0xE4C7 [?] [6337]*/ + 0x00,0x27,0x14,0x14,0x84,0x47,0x44,0x14,0x14,0x27,0xE4,0x24,0x24,0x28,0x2A,0x11, + 0x00,0xBE,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xBE,0xA0,0xA0,0xA0,0xA2,0xA2,0xA2,0x1E, + /* 0xE4C8 [?] [6338]*/ + 0x00,0x40,0x27,0x24,0x08,0x83,0x40,0x50,0x17,0x20,0xE2,0x22,0x24,0x28,0x21,0x00, + 0x80,0x40,0xFE,0x02,0x04,0xF0,0x00,0x00,0xFC,0x40,0x50,0x48,0x44,0x44,0x40,0x80, + /* 0xE4C9 [?] [6339]*/ + 0x00,0x20,0x17,0x14,0x80,0x43,0x42,0x12,0x13,0x22,0xE2,0x23,0x22,0x20,0x20,0x00, + 0x80,0x40,0xFC,0x44,0x40,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x48,0x40,0x40,0x40, + /* 0xE4CA [?] [6340]*/ + 0x00,0x40,0x27,0x24,0x08,0x83,0x42,0x52,0x13,0x22,0xE2,0x23,0x22,0x22,0x23,0x02, + 0x80,0x40,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xE4CB [?] [6341]*/ + 0x00,0x23,0x10,0x10,0x83,0x40,0x40,0x17,0x10,0x24,0xE2,0x21,0x22,0x24,0x21,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x40,0x44,0xE8,0x50,0x48,0x46,0x40,0x80, + /* 0xE4CC [?] [6342]*/ + 0x00,0x47,0x24,0x24,0x07,0x84,0x44,0x54,0x17,0x26,0xE6,0x2A,0x2A,0x32,0x20,0x00, + 0x02,0xE2,0x22,0x2A,0xEA,0x8A,0x8A,0x8A,0xEA,0xAA,0xAA,0xAA,0xA2,0xE2,0x8A,0x84, + /* 0xE4CD [?] [6343]*/ + 0x00,0x22,0x12,0x17,0x82,0x42,0x42,0x12,0x13,0x20,0xE7,0x20,0x21,0x22,0x2C,0x00, + 0x90,0x90,0x90,0xFE,0x90,0x90,0xF0,0x00,0xFC,0x40,0xFE,0xE0,0x50,0x48,0x46,0x40, + /* 0xE4CE [?] [6344]*/ + 0x00,0x27,0x10,0x10,0x87,0x44,0x44,0x14,0x17,0x20,0xE0,0x27,0x20,0x20,0x2F,0x00, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xA4,0xFC,0x40,0x40,0xFC,0x40,0x40,0xFE,0x00, + /* 0xE4CF [?] [6345]*/ + 0x00,0x27,0x10,0x10,0x87,0x44,0x44,0x14,0x14,0x24,0xE4,0x24,0x24,0x24,0x27,0x04, + 0x00,0xFE,0x40,0x80,0xFE,0x92,0x92,0xF2,0x92,0x92,0xF2,0x92,0x92,0x92,0xFE,0x02, + /* 0xE4D0 [?] [6346]*/ + 0x43,0x2E,0x22,0x82,0x42,0x4F,0x02,0x26,0x27,0x4A,0xCA,0x52,0x42,0x42,0x42,0x03, + 0x90,0x10,0x10,0x12,0x52,0xD4,0x58,0x90,0x10,0xA8,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xE4D1 [?] [6347]*/ + 0x00,0x21,0x16,0x14,0x84,0x47,0x44,0x14,0x17,0x20,0xE7,0x21,0x20,0x20,0x23,0x1C, + 0x40,0x40,0x5C,0x44,0x44,0x5C,0x44,0x44,0xFC,0x40,0xF8,0x10,0xA0,0x60,0x98,0x06, + /* 0xE4D2 [?] [6348]*/ + 0x00,0x20,0x13,0x12,0x83,0x42,0x4B,0x08,0x17,0x10,0xE0,0x23,0x20,0x20,0x27,0x00, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x40,0x40,0xF8,0x40,0x40,0xFC,0x00, + /* 0xE4D3 [?] [6349]*/ + 0x42,0x22,0x25,0x84,0x48,0x57,0x02,0x22,0x2F,0x42,0xCB,0x4A,0x52,0x42,0x4A,0x04, + 0x00,0x00,0x7C,0xA4,0x24,0x24,0x24,0x28,0xA8,0x28,0x10,0x90,0xA8,0x28,0x44,0x82, + /* 0xE4D4 [?] [6350]*/ + 0x00,0x21,0x11,0x12,0x85,0x40,0x41,0x12,0x14,0x23,0xE2,0x22,0x22,0x22,0x2F,0x00, + 0x10,0x10,0x08,0x04,0xFA,0x88,0x08,0x28,0x10,0xF8,0xA8,0xA8,0xA8,0xA8,0xFE,0x00, + /* 0xE4D5 [?] [6351]*/ + 0x02,0x41,0x21,0x2F,0x00,0x87,0x44,0x54,0x17,0x24,0xE4,0x27,0x24,0x24,0x25,0x04, + 0x08,0x08,0x10,0xFE,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x54,0x44,0x54,0x88, + /* 0xE4D6 [?] [6352]*/ + 0x00,0x40,0x27,0x24,0x08,0x83,0x40,0x53,0x12,0x23,0xE2,0x23,0x22,0x20,0x27,0x00, + 0x80,0x40,0xFC,0x04,0x08,0xF8,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x00,0xFC,0x00, + /* 0xE4D7 [?] [6353]*/ + 0x00,0x23,0x12,0x12,0x83,0x42,0x4B,0x0A,0x12,0x13,0xE2,0x22,0x25,0x24,0x28,0x13, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0xFC,0x40,0x88,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE, + /* 0xE4D8 [?] [6354]*/ + 0x00,0x23,0x12,0x12,0x83,0x42,0x4A,0x0A,0x12,0x12,0xE2,0x22,0x24,0x24,0x28,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x00,0xFC,0x84,0x84,0xFC,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xE4D9 [?] [6355]*/ + 0x04,0x84,0x44,0x1F,0x84,0x44,0x44,0x1E,0x24,0x44,0xC4,0x5F,0x44,0x44,0x44,0x04, + 0x20,0x20,0x78,0x48,0x90,0x7C,0x54,0x54,0x54,0x7C,0x40,0x40,0x42,0x42,0x3E,0x00, + /* 0xE4DA [?] [6356]*/ + 0x00,0x20,0x17,0x10,0x83,0x40,0x47,0x11,0x12,0x25,0xE0,0x23,0x20,0x21,0x26,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x68,0xC6,0x40,0xF8,0xE0,0x58,0x44,0x40, + /* 0xE4DB [?] [6357]*/ + 0x00,0x20,0x13,0x10,0x80,0x4F,0x40,0x11,0x13,0x20,0xE7,0x24,0x24,0x24,0x2F,0x00, + 0x40,0x40,0xFC,0x40,0x40,0xFE,0x80,0x10,0xF8,0x08,0xFC,0xA4,0xA4,0xA4,0xFE,0x00, + /* 0xE4DC [?] [6358]*/ + 0x00,0x23,0x11,0x11,0x81,0x41,0x41,0x17,0x10,0x27,0xE0,0x22,0x21,0x22,0x24,0x08, + 0x00,0xFC,0x08,0xF8,0x08,0xF8,0x0E,0xF8,0x08,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xE4DD [?] [6359]*/ + 0x01,0x21,0x17,0x11,0x80,0x47,0x40,0x11,0x12,0x25,0xE1,0x27,0x21,0x21,0x22,0x04, + 0x10,0x10,0xFC,0x10,0x48,0xFC,0xA0,0x10,0x08,0x14,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xE4DE [?] [6360]*/ + 0x01,0x21,0x17,0x11,0x80,0x4F,0x48,0x10,0x17,0x20,0xE0,0x23,0x20,0x20,0x2F,0x00, + 0x10,0x10,0xFE,0x10,0x00,0xFE,0x02,0x00,0xFC,0x40,0x40,0xF8,0x50,0x48,0xFE,0x00, + /* 0xE4DF [?] [6361]*/ + 0x00,0x40,0x2F,0x20,0x07,0x84,0x47,0x54,0x17,0x24,0xE0,0x2F,0x22,0x21,0x21,0x00, + 0x50,0x48,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x08,0xFE,0x08,0x08,0x28,0x10, + /* 0xE4E0 [?] [6362]*/ + 0x00,0x27,0x10,0x10,0x87,0x44,0x44,0x17,0x10,0x20,0xE7,0x20,0x21,0x22,0x2C,0x00, + 0x00,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xFC,0x40,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xE4E1 [?] [6363]*/ + 0x00,0x23,0x12,0x12,0x82,0x43,0x4A,0x0A,0x12,0x12,0xE2,0x23,0x22,0x24,0x24,0x08, + 0x00,0xFE,0x00,0xFC,0x00,0xFE,0xA8,0x90,0xC8,0x86,0x08,0xFE,0x88,0x48,0x08,0x18, + /* 0xE4E2 [?] [6364]*/ + 0x00,0x23,0x12,0x13,0x82,0x43,0x40,0x17,0x10,0x24,0xE2,0x21,0x26,0x20,0x22,0x01, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xBC,0x84,0xA4,0x94,0x8C,0xB4,0x84,0x94,0x08, + /* 0xE4E3 [?] [6365]*/ + 0x00,0x27,0x14,0x15,0x84,0x44,0x45,0x14,0x14,0x25,0xE4,0x24,0x25,0x24,0x27,0x04, + 0x00,0xFE,0x02,0xFA,0x42,0xC2,0x2A,0x6A,0xB2,0x2A,0x6A,0xAA,0x22,0x42,0xFE,0x02, + /* 0xE4E4 [?] [6366]*/ + 0x02,0x22,0x13,0x15,0x88,0x40,0x47,0x10,0x10,0x27,0xE0,0x20,0x2F,0x20,0x20,0x00, + 0x10,0x10,0xDE,0x28,0x84,0x78,0x80,0x80,0xF8,0x80,0x80,0xF8,0x84,0x84,0x84,0x7C, + /* 0xE4E5 [?] [6367]*/ + 0x00,0x20,0x13,0x12,0x83,0x42,0x43,0x12,0x13,0x20,0xE0,0x27,0x20,0x21,0x22,0x0C, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x50,0x48,0xFE,0xA0,0x10,0x08,0x06, + /* 0xE4E6 [?] [6368]*/ + 0x01,0x42,0x25,0x20,0x00,0x83,0x4C,0x53,0x10,0x20,0xE7,0x20,0x22,0x21,0x2F,0x00, + 0x10,0x08,0x14,0xA0,0xE0,0x18,0x06,0xF8,0x40,0x40,0xFC,0x40,0x48,0x50,0xFE,0x00, + /* 0xE4E7 [?] [6369]*/ + 0x00,0x20,0x17,0x14,0x85,0x44,0x47,0x14,0x15,0x24,0xE5,0x25,0x25,0x29,0x29,0x11, + 0x40,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE4E8 [?] [6370]*/ + 0x00,0x40,0x27,0x22,0x01,0x8F,0x48,0x50,0x17,0x21,0xE1,0x21,0x21,0x22,0x22,0x04, + 0x80,0x40,0xFC,0x10,0x20,0xFE,0x82,0x44,0xFC,0x00,0x00,0xF8,0x08,0x08,0x28,0x10, + /* 0xE4E9 [?] [6371]*/ + 0x00,0x27,0x14,0x10,0x83,0x42,0x4B,0x0A,0x13,0x10,0xE0,0x27,0x20,0x21,0x22,0x04, + 0x00,0xFC,0x04,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x80,0x40,0xFC,0x00,0x10,0x08,0x04, + /* 0xE4EA [?] [6372]*/ + 0x01,0x21,0x17,0x11,0x81,0x4F,0x40,0x17,0x14,0x27,0xE4,0x27,0x20,0x21,0x22,0x04, + 0x10,0x10,0xFC,0x10,0x10,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x00,0x10,0x08,0x04, + /* 0xE4EB [?] [6373]*/ + 0x01,0x4F,0x21,0x20,0x0F,0x88,0x51,0x43,0x10,0x20,0xE7,0x20,0x22,0x24,0x29,0x00, + 0x10,0xFE,0x10,0x00,0xFE,0x82,0x14,0xE0,0x40,0x88,0xFC,0x44,0x50,0x48,0x44,0x80, + /* 0xE4EC [?] [6374]*/ + 0x01,0x41,0x2F,0x21,0x00,0x87,0x40,0x5F,0x10,0x27,0xE0,0x25,0x25,0x26,0x28,0x10, + 0x10,0x10,0xFE,0x10,0x40,0xFC,0x44,0xFE,0x44,0xFC,0x40,0x64,0x54,0x54,0x44,0x44, + /* 0xE4ED [?] [6375]*/ + 0x01,0x41,0x27,0x21,0x03,0x85,0x49,0x40,0x10,0x2F,0xE1,0x22,0x21,0x20,0x23,0x0C, + 0x10,0x10,0xBC,0x10,0xB8,0x54,0x12,0x80,0x80,0xFC,0x10,0x10,0x20,0xC0,0x30,0x08, + /* 0xE4EE [?] [6376]*/ + 0x00,0x20,0x17,0x10,0x87,0x44,0x47,0x14,0x17,0x20,0xE3,0x22,0x23,0x22,0x23,0x02, + 0xA0,0xA0,0xFE,0xA0,0xFC,0xA4,0xFC,0xA4,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xE4EF [?] [6377]*/ + 0x00,0x20,0x10,0x17,0x84,0x44,0x45,0x14,0x14,0x24,0xE5,0x24,0x27,0x28,0x28,0x10, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x08,0xF0,0x24,0xA8,0xFE,0x20,0xA0,0x40, + /* 0xE4F0 [?] [6378]*/ + 0x00,0x27,0x14,0x17,0x84,0x47,0x41,0x12,0x17,0x20,0xE3,0x2F,0x20,0x22,0x25,0x08, + 0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0x10,0xE0,0xC8,0x04,0xFE,0x42,0x48,0x44,0x82, + /* 0xE4F1 [?] [6379]*/ + 0x00,0x20,0x13,0x12,0x83,0x40,0x47,0x14,0x17,0x20,0xE0,0x20,0x25,0x25,0x28,0x00, + 0x40,0x40,0xF8,0x48,0xF8,0x40,0xFC,0x44,0xFC,0x40,0x80,0x48,0x44,0x14,0xF0,0x00, + /* 0xE4F2 [?] [6380]*/ + 0x42,0x22,0x25,0x84,0x48,0x57,0x00,0x24,0x32,0x4A,0xC8,0x41,0x43,0x5C,0x40,0x00, + 0x10,0x10,0x10,0xA0,0x3E,0x44,0x24,0xA4,0xA4,0xA8,0xA8,0x10,0xA8,0x28,0x44,0x82, + /* 0xE4F3 [?] [6381]*/ + 0x00,0x49,0x25,0x22,0x06,0x8B,0x42,0x52,0x16,0x2B,0xE2,0x22,0x22,0x22,0x2A,0x04, + 0x20,0x20,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xE4F4 [?] [6382]*/ + 0x00,0x49,0x25,0x22,0x06,0x8A,0x43,0x52,0x16,0x2A,0xE2,0x22,0x22,0x22,0x2A,0x04, + 0x20,0x20,0xFC,0x20,0x50,0x88,0xFE,0x08,0xE8,0xA8,0xA8,0xE8,0xA8,0x08,0x28,0x10, + /* 0xE4F5 [?] [6383]*/ + 0x00,0x20,0x17,0x14,0x84,0x47,0x44,0x14,0x17,0x24,0xE5,0x25,0x25,0x29,0x29,0x11, + 0x80,0x40,0xFC,0xA0,0xA0,0xFC,0xA4,0xA4,0xFC,0x00,0x24,0xA8,0x30,0x24,0xA4,0x1C, + /* 0xE4F6 [?] [6384]*/ + 0x04,0x42,0x22,0x2F,0x04,0x84,0x47,0x55,0x15,0x25,0xE5,0x25,0x29,0x2B,0x30,0x21, + 0x20,0x20,0x20,0x7E,0x80,0x00,0x7C,0x14,0x10,0x50,0x5C,0x50,0x50,0x50,0xBE,0x00, + /* 0xE4F7 [?] [6385]*/ + 0x00,0x47,0x20,0x21,0x0F,0x84,0x44,0x57,0x14,0x27,0xE4,0x24,0x27,0x2C,0x20,0x00, + 0x08,0x88,0x88,0x10,0xDE,0x94,0xA4,0x94,0x94,0x94,0x94,0xC8,0x88,0x94,0xA4,0xC2, + /* 0xE4F8 [?] [6386]*/ + 0x01,0x41,0x2F,0x21,0x01,0x87,0x40,0x57,0x14,0x24,0xE7,0x24,0x22,0x20,0x2F,0x04, + 0x04,0x04,0xE4,0x04,0x3E,0xC4,0x04,0xE4,0x54,0x54,0xC4,0x44,0x84,0xE4,0x14,0x08, + /* 0xE4F9 [?] [6387]*/ + 0x04,0x44,0x24,0x2F,0x04,0x87,0x44,0x57,0x14,0x24,0xEF,0x20,0x25,0x28,0x30,0x00, + 0x80,0x82,0x9C,0xD0,0x90,0x90,0x9E,0x94,0x94,0x94,0xD4,0x14,0x14,0xA4,0x24,0x44, + /* 0xE4FA [?] [6388]*/ + 0x04,0x84,0x5F,0x04,0x95,0x55,0x65,0x00,0x2F,0x48,0xCF,0x48,0x4F,0x48,0x48,0x08, + 0x20,0x20,0xFC,0x20,0x68,0xAA,0x26,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xE4FB [?] [6389]*/ + 0x01,0x4E,0x22,0x22,0x02,0x8F,0x42,0x53,0x16,0x26,0xEA,0x22,0x22,0x22,0x22,0x02, + 0x10,0x10,0x54,0x38,0x10,0x7C,0x44,0x44,0xFC,0x44,0x44,0x7C,0x44,0x44,0x54,0x48, + /* 0xE4FC [?] [6390]*/ + 0x00,0x23,0x11,0x10,0x87,0x40,0x4B,0x0A,0x13,0x12,0xE3,0x20,0x23,0x20,0x27,0x00, + 0x40,0xF8,0x10,0xA0,0xFC,0x00,0xF8,0x48,0xF8,0x48,0xF8,0x40,0xF8,0x40,0xFE,0x00, + /* 0xE4FD [?] [6391]*/ + 0x07,0x24,0x17,0x14,0x85,0x44,0x47,0x14,0x14,0x27,0xE4,0x25,0x29,0x2F,0x31,0x03, + 0xFC,0x04,0xFC,0x00,0xF8,0x10,0xFE,0x20,0x60,0x9C,0x84,0x08,0xDE,0x08,0x08,0x18, + /* 0xE4FE [?] [6392]*/ + 0x02,0x42,0x2F,0x22,0x02,0x8F,0x4A,0x5A,0x1F,0x22,0xE7,0x2A,0x32,0x22,0x22,0x02, + 0x10,0x10,0x9C,0x24,0x48,0xBE,0xA2,0xAA,0xAA,0x2A,0x2A,0xAA,0x88,0x14,0x22,0x42, + /* 0xE5A1 [?] [6393]*/ + 0x00,0x40,0x2F,0x29,0x09,0x8F,0x49,0x59,0x1F,0x29,0xE9,0x29,0x2F,0x29,0x20,0x00, + 0x28,0x24,0x40,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x48,0x7E,0x40,0x40, + /* 0xE5A2 [?] [6394]*/ + 0x00,0x20,0x17,0x14,0x87,0x44,0x47,0x10,0x17,0x20,0xE3,0x22,0x23,0x21,0x20,0x0F, + 0xA0,0xA0,0xFC,0xA4,0xFC,0xA4,0xFC,0x00,0xFC,0x00,0xF8,0x08,0xF8,0x10,0xA0,0xFE, + /* 0xE5A3 [?] [6395]*/ + 0x02,0x43,0x24,0x27,0x0D,0x96,0x47,0x54,0x15,0x24,0xE5,0x24,0x25,0x29,0x29,0x11, + 0x00,0xF8,0x10,0xFE,0x48,0x24,0xFE,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x04,0xFC,0x04, + /* 0xE5A4 [?] [6396]*/ + 0x00,0x4F,0x20,0x27,0x04,0x85,0x45,0x57,0x10,0x23,0xE2,0x23,0x22,0x23,0x20,0x0F, + 0x40,0xFE,0x00,0xFC,0x04,0xF4,0x14,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xE5A5 [?] [6397]*/ + 0x00,0x27,0x15,0x14,0x87,0x44,0x45,0x14,0x17,0x24,0xE5,0x24,0x24,0x29,0x2A,0x10, + 0x20,0xFE,0x08,0x90,0xFC,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50, + /* 0xE5A6 [?] [6398]*/ + 0x00,0x47,0x20,0x2F,0x08,0x83,0x40,0x53,0x10,0x2F,0xE0,0x27,0x24,0x24,0x24,0x04, + 0x00,0xFC,0x40,0xFE,0x42,0x58,0x40,0x58,0x00,0xFE,0x40,0xFC,0xA4,0xA4,0xA4,0x0C, + /* 0xE5A7 [?] [6399]*/ + 0x01,0x21,0x11,0x12,0x82,0x46,0x56,0x1A,0x12,0x22,0xE2,0x22,0x22,0x22,0x22,0x02, + 0x28,0xAA,0x6C,0x28,0xFE,0x44,0x28,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x28,0x44,0x82, + /* 0xE5A8 [?] [6400]*/ + 0x00,0x23,0x12,0x13,0x82,0x43,0x40,0x17,0x14,0x27,0xE4,0x27,0x20,0x2F,0x21,0x02, + 0x80,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x10,0x10, + /* 0xE5A9 [?] [6401]*/ + 0x00,0x27,0x10,0x11,0x81,0x41,0x40,0x17,0x14,0x23,0xE1,0x26,0x21,0x26,0x21,0x0E, + 0x40,0xFE,0x00,0xF8,0x08,0xF8,0x00,0xFE,0x02,0xF8,0x80,0x44,0xB8,0x68,0xA6,0x60, + /* 0xE5AA [?] [6402]*/ + 0x00,0x27,0x10,0x14,0x82,0x44,0x41,0x12,0x17,0x2A,0xE3,0x22,0x23,0x22,0x23,0x02, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x20,0x10,0xFC,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE5AB [?] [6403]*/ + 0x04,0x84,0x44,0x1F,0x84,0x5F,0x51,0x1F,0x31,0x5F,0xC4,0x5F,0x44,0x44,0x44,0x04, + 0x10,0x10,0x28,0x44,0x82,0x00,0xEE,0x22,0xAA,0x66,0x22,0x66,0xAA,0x22,0xAA,0x44, + /* 0xE5AC [?] [6404]*/ + 0x01,0x41,0x25,0x27,0x04,0x8A,0x41,0x52,0x17,0x20,0xE3,0x20,0x27,0x20,0x2F,0x00, + 0x00,0xBC,0x24,0xA8,0x90,0xA8,0x46,0xA0,0xBC,0xA0,0xB8,0xA0,0xBC,0xA0,0xFE,0x00, + /* 0xE5AD [?] [6405]*/ + 0x00,0xBF,0x48,0x0F,0x80,0x4F,0x48,0x0F,0x20,0x5C,0xD7,0x5D,0x55,0x5C,0x55,0x2E, + 0x80,0xFC,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x80,0x9C,0xD4,0x54,0x5C,0x96,0x56,0x22, + /* 0xE5AE [?] [6406]*/ + 0x40,0x20,0x21,0x82,0x4D,0x40,0x0E,0x2A,0x2E,0x40,0xCF,0x49,0x4F,0x49,0x49,0x08, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xEE,0xAA,0xEE,0x00,0xFE,0x22,0xFE,0x22,0x2A,0x04, + /* 0xE5AF [?] [6407]*/ + 0x02,0x21,0x17,0x11,0x86,0x43,0x42,0x13,0x12,0x23,0xE1,0x27,0x21,0x2F,0x22,0x04, + 0x48,0x50,0xFC,0x50,0x4C,0xF8,0x48,0xF8,0x48,0xF8,0x10,0xFC,0x10,0xFE,0x08,0x04, + /* 0xE5B0 [?] [6408]*/ + 0x40,0x2F,0x28,0x8F,0x48,0x4F,0x02,0x3F,0x20,0x4F,0xC8,0x4F,0x42,0x4A,0x52,0x06, + 0x00,0xBE,0x88,0x90,0xBE,0xA2,0x22,0xEA,0x2A,0xAA,0xAA,0xAA,0x08,0x94,0x52,0x22, + /* 0xE5B1 [?] [6409]*/ + 0x47,0x20,0x2F,0x88,0x43,0x45,0x0F,0x25,0x27,0x42,0xCF,0x4A,0x4F,0x42,0x5F,0x02, + 0xFC,0x40,0xFE,0x42,0x58,0x00,0xBC,0x24,0x24,0x3C,0xA4,0xA4,0xBC,0x24,0xA4,0x4C, + /* 0xE5B2 [?] [6410]*/ + 0x02,0x01,0x01,0x7F,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xFE,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE5B3 [?] [6411]*/ + 0x02,0x01,0x01,0x7F,0x40,0x82,0x02,0x1F,0x02,0x02,0x04,0x04,0x08,0x10,0x20,0x40, + 0x00,0x00,0x00,0xFE,0x02,0x04,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xE5B4 [?] [6412]*/ + 0x02,0x01,0x7F,0x40,0x80,0x00,0x7F,0x04,0x04,0x08,0x1F,0x28,0xC8,0x08,0x0F,0x08, + 0x00,0x00,0xFE,0x02,0x04,0x00,0xFC,0x00,0x00,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xE5B5 [?] [6413]*/ + 0x02,0x01,0x01,0x7F,0x40,0x81,0x00,0x08,0x48,0x48,0x48,0x89,0x0E,0x18,0xE7,0x00, + 0x00,0x00,0x00,0xFE,0x02,0x04,0x90,0x90,0x24,0x42,0x82,0x02,0x10,0x10,0xF0,0x00, + /* 0xE5B6 [?] [6414]*/ + 0x02,0x01,0x7F,0x42,0x82,0x7F,0x04,0x0F,0x18,0x2F,0x48,0x8F,0x08,0x08,0x08,0x08, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xE5B7 [?] [6415]*/ + 0x02,0x01,0x7F,0x40,0x80,0x3F,0x20,0x2F,0x20,0x3F,0x24,0x24,0x44,0x45,0x86,0x04, + 0x00,0x00,0xFE,0x02,0x04,0xF8,0x00,0xF0,0x00,0xFC,0x88,0x50,0x20,0x18,0x06,0x00, + /* 0xE5B8 [?] [6416]*/ + 0x02,0x01,0x7F,0x41,0x94,0x14,0x23,0x00,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x21,0x20, + 0x00,0x00,0xFE,0x02,0x94,0x28,0xE8,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xE5B9 [?] [6417]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x1F,0x20,0xC8,0x0F,0x00,0x7F,0x00, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0xD0,0x48,0x46,0xF8,0x08,0xA8,0x10, + /* 0xE5BA [?] [6418]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x17,0x21,0xDF,0x01,0x7F,0x01,0x03, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0xD0,0x08,0xF6,0x00,0xF8,0x00,0x00, + /* 0xE5BB [?] [6419]*/ + 0x02,0x01,0x7F,0x40,0x85,0x24,0x24,0x3C,0x04,0x05,0x7C,0x24,0x24,0x24,0x44,0x84, + 0x00,0x00,0xFE,0x02,0xFC,0x20,0xF8,0x48,0x48,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x84, + /* 0xE5BC [?] [6420]*/ + 0x01,0x7F,0x40,0x81,0x7F,0x04,0x28,0x1F,0x28,0xCF,0x08,0x0F,0x01,0x11,0x25,0x02, + 0x00,0xFE,0x02,0x04,0xFC,0x40,0x28,0xF0,0x28,0xE6,0x20,0xE0,0x00,0x10,0x08,0x00, + /* 0xE5BD [?] [6421]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x0A,0x11,0x2F,0xC2,0x04,0x1C,0x65,0x06, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0x10,0xE8,0x8E,0x50,0x20,0x18,0x06, + /* 0xE5BE [?] [6422]*/ + 0x01,0x7F,0x40,0xBF,0x24,0x3F,0x00,0xFF,0x00,0x1F,0x10,0x1F,0x05,0x18,0xEA,0x0C, + 0x00,0xFE,0x02,0xFC,0x48,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x08,0x90,0x60,0x1C, + /* 0xE5BF [?] [6423]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x08,0x1F,0x28,0xCF,0x01,0x09,0x15,0x23, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0xF0,0x28,0xE6,0x00,0xF0,0x00,0xFC, + /* 0xE5C0 [?] [6424]*/ + 0x01,0x7F,0x44,0x9F,0x04,0x3F,0x04,0xFF,0x09,0x1F,0x20,0xDF,0x00,0x1F,0x10,0x1F, + 0x00,0xFE,0x42,0xF4,0x40,0xF8,0x40,0xFE,0x20,0xF0,0x08,0xF6,0x00,0xF0,0x10,0xF0, + /* 0xE5C1 [?] [6425]*/ + 0x00,0x20,0x10,0x10,0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x47,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xE5C2 [?] [6426]*/ + 0x00,0x23,0x10,0x11,0x01,0x02,0xF3,0x10,0x10,0x10,0x11,0x16,0x10,0x28,0x47,0x00, + 0x00,0xFC,0x10,0x10,0x10,0x10,0xFE,0x30,0x50,0x90,0x10,0x50,0x20,0x00,0xFE,0x00, + /* 0xE5C3 [?] [6427]*/ + 0x00,0x20,0x10,0x11,0x01,0x02,0xF0,0x10,0x17,0x10,0x10,0x10,0x10,0x28,0x47,0x00, + 0x80,0x80,0x80,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xE5C4 [?] [6428]*/ + 0x00,0x23,0x12,0x12,0x02,0x02,0xF2,0x12,0x12,0x12,0x12,0x12,0x12,0x28,0x47,0x00, + 0x00,0xFC,0x04,0x04,0xF4,0x94,0x94,0x94,0xF4,0x94,0x04,0x14,0x08,0x00,0xFE,0x00, + /* 0xE5C5 [?] [6429]*/ + 0x01,0x21,0x11,0x13,0x02,0x04,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x28,0x47,0x00, + 0x00,0x00,0x00,0xFE,0x80,0x80,0xF8,0x80,0x80,0xFC,0x80,0x80,0x80,0x00,0xFE,0x00, + /* 0xE5C6 [?] [6430]*/ + 0x02,0x22,0x13,0x14,0x04,0x0A,0xF2,0x17,0x12,0x12,0x12,0x12,0x11,0x28,0x47,0x00, + 0x00,0x00,0xFC,0x40,0x40,0x58,0xE8,0x48,0x68,0x50,0x44,0x04,0xFC,0x00,0xFE,0x00, + /* 0xE5C7 [?] [6431]*/ + 0x00,0x20,0x11,0x11,0x02,0x04,0xF0,0x11,0x11,0x12,0x14,0x10,0x10,0x28,0x47,0x00, + 0x80,0x80,0x00,0xFE,0x02,0x24,0x20,0x28,0x24,0x22,0x22,0xA0,0x40,0x00,0xFE,0x00, + /* 0xE5C8 [?] [6432]*/ + 0x04,0x44,0x24,0x2F,0x04,0x04,0xE4,0x24,0x24,0x28,0x28,0x32,0x21,0x50,0x8F,0x00, + 0x00,0x00,0x3C,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xBC,0xA4,0x00,0x00,0xFE,0x00, + /* 0xE5C9 [?] [6433]*/ + 0x00,0x23,0x10,0x10,0x00,0x01,0xF6,0x13,0x10,0x10,0x10,0x17,0x10,0x28,0x47,0x00, + 0x00,0xF8,0x10,0x20,0x50,0x88,0x04,0xF8,0x40,0x40,0x40,0xFC,0x00,0x00,0xFE,0x00, + /* 0xE5CA [?] [6434]*/ + 0x00,0x20,0x11,0x12,0x07,0x02,0xF0,0x13,0x12,0x12,0x12,0x13,0x12,0x28,0x47,0x00, + 0x80,0x80,0x10,0x08,0xFC,0x04,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x00,0xFE,0x00, + /* 0xE5CB [?] [6435]*/ + 0x00,0x23,0x12,0x12,0x03,0x02,0xF2,0x12,0x12,0x14,0x14,0x18,0x10,0x28,0x47,0x00, + 0x3C,0xC0,0x00,0x00,0xFE,0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x00,0xFE,0x00, + /* 0xE5CC [?] [6436]*/ + 0x00,0x20,0x10,0x11,0x02,0x00,0xF1,0x16,0x10,0x11,0x10,0x12,0x13,0x10,0x28,0x47, + 0x80,0x80,0xFC,0x08,0x90,0x60,0x98,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFE, + /* 0xE5CD [?] [6437]*/ + 0x00,0x40,0x2F,0x20,0x07,0x04,0xE7,0x24,0x27,0x24,0x24,0x24,0x24,0x50,0x8F,0x00, + 0x48,0x44,0xFE,0x40,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x44,0x54,0x08,0x00,0xFE,0x00, + /* 0xE5CE [?] [6438]*/ + 0x00,0x4F,0x20,0x20,0x07,0x04,0xE4,0x26,0x25,0x24,0x24,0x24,0x25,0x50,0x8F,0x00, + 0x00,0xFE,0x00,0x00,0xBC,0xA4,0xA4,0xB4,0xAC,0xA4,0xA4,0xA4,0xAC,0x00,0xFE,0x00, + /* 0xE5CF [?] [6439]*/ + 0x00,0x20,0x10,0x17,0x00,0x02,0xF1,0x10,0x11,0x12,0x14,0x11,0x10,0x28,0x47,0x00, + 0x40,0x50,0x48,0xFC,0x40,0x48,0x50,0xE0,0x50,0x48,0x44,0x40,0x80,0x00,0xFE,0x00, + /* 0xE5D0 [?] [6440]*/ + 0x00,0x22,0x11,0x11,0x00,0x03,0xF2,0x12,0x13,0x12,0x12,0x13,0x12,0x12,0x2A,0x47, + 0x40,0x48,0x48,0x50,0x40,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x28,0x10,0xFE, + /* 0xE5D1 [?] [6441]*/ + 0x09,0x45,0x22,0x26,0x0A,0x02,0xE2,0x26,0x2A,0x32,0x22,0x2A,0x25,0x50,0x8F,0x00, + 0x10,0x10,0x10,0x52,0x52,0x54,0x90,0x28,0x24,0x44,0x42,0x82,0x00,0x00,0xFE,0x00, + /* 0xE5D2 [?] [6442]*/ + 0x00,0x21,0x12,0x17,0x00,0x01,0xF2,0x15,0x11,0x12,0x15,0x10,0x11,0x2E,0x47,0x00, + 0x80,0x10,0x08,0xFC,0x04,0x10,0x08,0x04,0xF8,0x08,0x90,0x60,0x90,0x08,0xFE,0x00, + /* 0xE5D3 [?] [6443]*/ + 0x00,0x20,0x13,0x10,0x00,0x07,0xF1,0x12,0x14,0x13,0x10,0x10,0x17,0x10,0x28,0x47, + 0x40,0x40,0xF8,0x40,0x40,0xFC,0x10,0x48,0x44,0xF8,0x40,0x40,0xFC,0x00,0x00,0xFE, + /* 0xE5D4 [?] [6444]*/ + 0x00,0x23,0x10,0x17,0x01,0x02,0xF4,0x10,0x1F,0x11,0x13,0x10,0x11,0x16,0x28,0x47, + 0x38,0xC0,0x40,0xFC,0x50,0x48,0x44,0x80,0xFE,0x08,0x90,0x60,0x98,0x04,0x00,0xFE, + /* 0xE5D5 [?] [6445]*/ + 0x00,0x20,0x17,0x14,0x03,0x02,0xF2,0x13,0x12,0x13,0x12,0x12,0x13,0x28,0x47,0x00, + 0x80,0x40,0xFC,0x04,0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x00, + /* 0xE5D6 [?] [6446]*/ + 0x00,0x47,0x20,0x23,0x00,0x0F,0xE0,0x24,0x22,0x21,0x22,0x24,0x21,0x50,0x8F,0x00, + 0x00,0xF8,0x08,0xF8,0x08,0xFE,0x40,0x44,0xE8,0x50,0x48,0x44,0x40,0x80,0xFE,0x00, + /* 0xE5D7 [?] [6447]*/ + 0x00,0x44,0x24,0x24,0x07,0x00,0xEF,0x20,0x27,0x24,0x24,0x24,0x24,0x24,0x50,0x8F, + 0x40,0x44,0x44,0x44,0xFC,0x00,0xFE,0x80,0xFC,0xA4,0xA4,0xA4,0xA4,0x0C,0x00,0xFE, + /* 0xE5D8 [?] [6448]*/ + 0x00,0x20,0x13,0x12,0x03,0x02,0xF3,0x10,0x17,0x10,0x13,0x10,0x17,0x28,0x47,0x00, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x40,0xF8,0x40,0xFC,0x00,0xFE,0x00, + /* 0xE5D9 [?] [6449]*/ + 0x02,0x41,0x2F,0x20,0x07,0x04,0xE4,0x25,0x26,0x24,0x27,0x24,0x27,0x50,0x8F,0x00, + 0x08,0x10,0xFE,0xA0,0xFC,0xA4,0xA4,0x24,0x1C,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x00, + /* 0xE5DA [?] [6450]*/ + 0x00,0x47,0x24,0x24,0x07,0x04,0xE4,0x27,0x24,0x24,0x27,0x24,0x24,0x54,0x8F,0x00, + 0x00,0xBC,0x84,0x84,0xBC,0x00,0x00,0xBC,0x04,0x04,0xA8,0x10,0x28,0x44,0xFE,0x00, + /* 0xE5DB [?] [6451]*/ + 0x02,0x42,0x2F,0x22,0x07,0x02,0xEF,0x24,0x27,0x24,0x24,0x2A,0x29,0x50,0x8F,0x00, + 0x10,0x10,0x90,0x1E,0xA4,0x44,0x94,0x14,0x88,0x88,0x94,0xA2,0x42,0x00,0xFE,0x00, + /* 0xE5DC [?] [6452]*/ + 0x01,0x27,0x11,0x13,0x01,0x07,0xF0,0x13,0x12,0x13,0x12,0x17,0x12,0x12,0x2A,0x47, + 0x10,0xFC,0x10,0xF8,0x10,0xFC,0x40,0xF8,0x48,0xF8,0x48,0xFE,0x08,0x28,0x10,0xFE, + /* 0xE5DD [?] [6453]*/ + 0x00,0x23,0x12,0x13,0x02,0x03,0xF0,0x17,0x10,0x14,0x12,0x14,0x12,0x11,0x28,0x47, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xBC,0x84,0xA4,0x94,0xA4,0x94,0x08,0x00,0xFE, + /* 0xE5DE [?] [6454]*/ + 0x00,0x47,0x24,0x25,0x04,0x05,0xE6,0x20,0x27,0x24,0x27,0x24,0x27,0x50,0x8F,0x00, + 0x80,0x7C,0x24,0x24,0xA4,0x54,0x48,0x80,0xFC,0x44,0xFC,0x44,0xFC,0x00,0xFE,0x00, + /* 0xE5DF [?] [6455]*/ + 0x07,0x44,0x27,0x24,0x07,0x02,0xE7,0x2C,0x37,0x24,0x27,0x24,0x27,0x54,0x8F,0x00, + 0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0x40,0xF8,0x40,0xF8,0x40,0xFC,0x00,0xFE,0x00, + /* 0xE5E0 [?] [6456]*/ + 0x00,0x22,0x11,0x17,0x01,0x02,0xF4,0x12,0x13,0x14,0x1A,0x11,0x11,0x12,0x2A,0x47, + 0x40,0x48,0x50,0xFC,0x50,0x48,0x44,0x10,0x90,0xBC,0x90,0x50,0x7E,0x10,0x10,0xFE, + /* 0xE5E1 [?] [6457]*/ + 0x00,0x40,0x20,0x27,0x04,0x05,0xE4,0x27,0x24,0x27,0x28,0x2B,0x30,0x23,0x50,0x8F, + 0x40,0x7C,0x40,0xFE,0x42,0xF8,0x44,0xFC,0xC0,0x22,0xD4,0x18,0x74,0x92,0x20,0xFE, + /* 0xE5E2 [?] [6458]*/ + 0x04,0x4F,0x29,0x32,0x0F,0x0A,0xEA,0x2F,0x2A,0x2A,0x2F,0x2A,0x2A,0x31,0x50,0x8F, + 0x00,0x3C,0x14,0x14,0x94,0xA8,0xA8,0xBC,0xC8,0x88,0xBE,0x88,0x88,0x88,0x08,0xFE, + /* 0xE5E3 [?] [6459]*/ + 0x01,0x42,0x2D,0x25,0x02,0x0D,0xE3,0x25,0x29,0x23,0x25,0x29,0x25,0x52,0x8F,0x00, + 0x10,0x20,0x7C,0xC4,0x44,0x7C,0x44,0x44,0x7C,0x28,0x28,0x2A,0x46,0x80,0xFE,0x00, + /* 0xE5E4 [?] [6460]*/ + 0x00,0x40,0x2F,0x2A,0x14,0x01,0xE7,0x20,0x21,0x26,0x21,0x26,0x21,0x26,0x50,0x8F, + 0x80,0x40,0xFE,0x12,0x0C,0x20,0xFC,0x80,0x44,0x68,0xB0,0x68,0xA4,0xA4,0x40,0xFE, + /* 0xE5E5 [?] [6461]*/ + 0x02,0x44,0x22,0x27,0x05,0x04,0xE5,0x27,0x24,0x26,0x24,0x26,0x24,0x26,0x50,0x8F, + 0x48,0x90,0x48,0xF8,0x28,0xC8,0x28,0xF8,0x90,0xD0,0x90,0xD4,0x8C,0xC4,0x00,0xFE, + /* 0xE5E6 [?] [6462]*/ + 0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00, + /* 0xE5E7 [?] [6463]*/ + 0x10,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x00,0x7F,0x00,0x00,0x3F,0x00,0x00,0x7F,0x00, + 0x10,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE5E8 [?] [6464]*/ + 0x08,0x0F,0x10,0x1F,0x00,0xFF,0x02,0x0D,0x71,0x02,0x0C,0x71,0x06,0x18,0xE2,0x01, + 0x00,0xF0,0x10,0xE0,0x20,0xFE,0x00,0x08,0x90,0xA0,0xC0,0xA0,0x98,0x86,0x80,0x00, + /* 0xE5E9 [?] [6465]*/ + 0x08,0x0F,0x10,0x1F,0x00,0xFF,0x02,0x42,0x43,0x75,0x41,0x4F,0x41,0x62,0x44,0x08, + 0x00,0xF0,0x10,0xE0,0x20,0xFE,0x00,0x10,0xD2,0x14,0x18,0xD0,0x12,0x92,0x4E,0x20, + /* 0xE5EA [?] [6466]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x21,0x21,0x2F,0x21,0x21,0x22,0x22,0x44,0x44,0x88,0x10, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x1E,0x00, + /* 0xE5EB [?] [6467]*/ + 0x00,0x3E,0x22,0x22,0x22,0x22,0x3E,0x2A,0x28,0x28,0x28,0x24,0x24,0x42,0x41,0x80, + 0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x00,0x28,0x24,0x44,0x42,0x82,0x00,0x80,0x7E, + /* 0xE5EC [?] [6468]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x24,0x29,0x30,0x22,0x25,0x2C,0x34,0x44,0x44,0x84,0x07, + 0x00,0xFC,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x88,0x50,0x20,0xD8,0x06, + /* 0xE5ED [?] [6469]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x2E,0x2A,0x2A,0x2C,0x2A,0x2A,0x2A,0x4A,0x4E,0x88,0x08, + 0x00,0xFC,0x04,0xFC,0x00,0xFC,0x08,0xE8,0xA8,0xA8,0xA8,0xE8,0xA8,0x08,0x28,0x10, + /* 0xE5EE [?] [6470]*/ + 0x3F,0x20,0x3F,0x20,0x23,0x20,0x3F,0x20,0x20,0x2F,0x21,0x23,0x5E,0x42,0x8A,0x04, + 0xFC,0x04,0xFC,0x00,0xF0,0x20,0xFE,0x40,0xC0,0xBE,0x04,0x88,0x7E,0x08,0x28,0x10, + /* 0xE5EF [?] [6471]*/ + 0x3F,0x20,0x3F,0x22,0x24,0x28,0x30,0x22,0x25,0x2C,0x34,0x24,0x44,0x45,0x86,0x04, + 0xFC,0x04,0xFC,0x10,0x10,0x9C,0x90,0x90,0xFE,0x10,0x90,0x9C,0x90,0x50,0x3E,0x00, + /* 0xE5F0 [?] [6472]*/ + 0x00,0x3F,0x20,0x3F,0x20,0x25,0x28,0x31,0x24,0x29,0x38,0x2B,0x48,0x49,0x88,0x0B, + 0x00,0xFC,0x04,0xFC,0x00,0x24,0xA8,0xFC,0xA8,0x24,0x40,0xFE,0x88,0x90,0x70,0x8C, + /* 0xE5F1 [?] [6473]*/ + 0x3F,0x20,0x3F,0x22,0x2F,0x20,0x27,0x20,0x3F,0x2A,0x3F,0x24,0x5F,0x44,0xBF,0x08, + 0xFC,0x04,0xFC,0x20,0xF8,0x80,0xF0,0x80,0xFC,0xA8,0x7C,0x10,0x7C,0x10,0x7E,0x10, + /* 0xE5F2 [?] [6474]*/ + 0x00,0x7D,0x04,0x04,0x04,0x7C,0x40,0x43,0x40,0x7D,0x04,0x04,0x04,0x04,0x2B,0x10, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xE5F3 [?] [6475]*/ + 0x08,0x7F,0x11,0x32,0x0C,0x12,0x61,0x00,0x3F,0x00,0x3F,0x20,0x3F,0x00,0x00,0x00, + 0x00,0x7C,0x44,0x28,0x10,0x28,0x46,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x50,0x20, + /* 0xE5F4 [?] [6476]*/ + 0x00,0xFB,0x09,0x09,0x09,0x79,0x41,0x41,0x41,0x79,0x09,0x09,0x0B,0x08,0x50,0x20, + 0x00,0xFE,0x08,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x1E,0xE8,0x08,0x08,0x08, + /* 0xE5F5 [?] [6477]*/ + 0x28,0x28,0x28,0xFE,0x2A,0x2A,0xFE,0xA8,0xA8,0xFF,0x29,0x29,0x2D,0x4A,0x48,0x88, + 0x20,0x20,0x7C,0x44,0x88,0x7C,0x54,0x54,0x54,0x7C,0x40,0x40,0x42,0x42,0x3E,0x00, + /* 0xE5F6 [?] [6478]*/ + 0x00,0xF0,0x17,0x11,0x12,0xF7,0x84,0x84,0x84,0xF7,0x14,0x14,0x14,0x17,0xA4,0x40, + 0x00,0x1E,0xC2,0x02,0x02,0xDE,0x50,0x50,0x50,0xDE,0x42,0x42,0x42,0xC2,0x54,0x08, + /* 0xE5F7 [?] [6479]*/ + 0x71,0x15,0x71,0x47,0x73,0x15,0x31,0x00,0xFF,0x10,0x1F,0x00,0x7F,0x44,0x4F,0x41, + 0x1C,0x44,0x1C,0xD0,0x9C,0x44,0x0C,0x00,0xFE,0x10,0xF0,0x00,0xFC,0x44,0xE4,0x0C, + /* 0xE5F8 [?] [6480]*/ + 0x01,0x01,0x21,0x21,0x21,0x21,0x21,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0x08,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE5F9 [?] [6481]*/ + 0x10,0x10,0x10,0x10,0xFD,0x26,0x24,0x25,0x24,0x48,0x28,0x10,0x28,0x44,0x84,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xE5FA [?] [6482]*/ + 0x10,0x10,0x11,0x10,0xFC,0x24,0x24,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x84,0x00, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE5FB [?] [6483]*/ + 0x10,0x13,0x10,0x10,0xFC,0x24,0x24,0x27,0x24,0x48,0x28,0x10,0x28,0x44,0x81,0x02, + 0x00,0xFE,0x88,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x08, + /* 0xE5FC [?] [6484]*/ + 0x20,0x23,0x20,0x20,0xF8,0x48,0x4F,0x48,0x88,0x48,0x30,0x11,0x29,0x4A,0x84,0x08, + 0x00,0xFC,0x40,0x40,0x40,0x40,0xFE,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xE5FD [?] [6485]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x00, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xE5FE [?] [6486]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x00, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xE6A1 [?] [6487]*/ + 0x10,0x10,0x10,0x10,0xFC,0x25,0x26,0x24,0x24,0x49,0x28,0x10,0x28,0x44,0x84,0x00, + 0x20,0x20,0x50,0x50,0x88,0x44,0x22,0x20,0x00,0xFC,0x04,0x08,0x08,0x10,0x10,0x20, + /* 0xE6A2 [?] [6488]*/ + 0x10,0x10,0x10,0x11,0xFD,0x25,0x25,0x25,0x24,0x48,0x28,0x11,0x2E,0x44,0x84,0x00, + 0x20,0x20,0x2E,0xF0,0x20,0x20,0x20,0xFE,0x22,0x62,0xA2,0x2A,0x24,0x20,0x20,0x20, + /* 0xE6A3 [?] [6489]*/ + 0x10,0x11,0x10,0x10,0xFC,0x27,0x24,0x24,0x24,0x48,0x28,0x10,0x28,0x45,0x82,0x04, + 0x20,0x20,0xA0,0xA0,0x20,0xFE,0x22,0x22,0x42,0x52,0x4A,0x8A,0x82,0x02,0x14,0x08, + /* 0xE6A4 [?] [6490]*/ + 0x10,0x11,0x10,0x10,0xFC,0x24,0x24,0x25,0x24,0x48,0x28,0x10,0x28,0x44,0x83,0x00, + 0x00,0xF8,0x48,0x48,0x48,0x48,0x48,0xF8,0x88,0x88,0x88,0x88,0x88,0x88,0xFE,0x00, + /* 0xE6A5 [?] [6491]*/ + 0x10,0x11,0x10,0x10,0xFC,0x24,0x27,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x84,0x00, + 0x00,0xF8,0x08,0x50,0x20,0x10,0xFE,0x22,0x24,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xE6A6 [?] [6492]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x44,0x84,0x00, + 0x08,0x48,0x28,0x28,0x28,0x08,0x08,0x08,0x08,0x08,0x48,0x94,0x14,0x22,0x42,0x82, + /* 0xE6A7 [?] [6493]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x24,0x24,0x24,0x48,0x28,0x10,0x28,0x44,0x85,0x00, + 0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x00,0x00,0xFE,0x00, + /* 0xE6A8 [?] [6494]*/ + 0x10,0x10,0x10,0x10,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xE6A9 [?] [6495]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x27,0x25,0x49,0x29,0x11,0x29,0x46,0x82,0x04, + 0x00,0xDC,0x54,0x54,0x54,0x54,0x54,0xFE,0x54,0x54,0x54,0x54,0x54,0xD4,0x24,0x4C, + /* 0xE6AA [?] [6496]*/ + 0x02,0x01,0x3F,0x00,0x08,0x04,0xFF,0x02,0x02,0x7F,0x04,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0x00,0xF8,0x00,0x20,0x40,0xFE,0x00,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xE6AB [?] [6497]*/ + 0x20,0x23,0x20,0x20,0xF8,0x48,0x4C,0x4A,0x8A,0x4A,0x30,0x10,0x28,0x48,0x87,0x00, + 0x00,0xFC,0x90,0x90,0x90,0x92,0x92,0x94,0x94,0x98,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xE6AC [?] [6498]*/ + 0x20,0x20,0x20,0x23,0xF8,0x48,0x48,0x4B,0x88,0x4B,0x30,0x10,0x29,0x49,0x82,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xE6AD [?] [6499]*/ + 0x20,0x21,0x21,0x21,0xF9,0x4A,0x48,0x4B,0x48,0x90,0x50,0x21,0x31,0x4A,0x48,0x80, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xE6AE [?] [6500]*/ + 0x02,0x01,0xFF,0x04,0x14,0x14,0x24,0x42,0x02,0x7F,0x04,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x04,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xE6AF [?] [6501]*/ + 0x10,0x10,0x10,0x11,0xFC,0x24,0x25,0x26,0x24,0x48,0x28,0x10,0x28,0x44,0x80,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xE6B0 [?] [6502]*/ + 0x11,0x10,0x10,0x10,0xFD,0x24,0x24,0x24,0x24,0x4B,0x28,0x10,0x29,0x45,0x82,0x04, + 0x04,0x84,0x88,0x00,0xFE,0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xE6B1 [?] [6503]*/ + 0x10,0x10,0x10,0x11,0xFD,0x26,0x24,0x25,0x24,0x48,0x28,0x13,0x28,0x44,0x84,0x00, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x18,0xE0,0x40,0x40,0x7E,0xC0,0x40,0x44,0x44,0x3C, + /* 0xE6B2 [?] [6504]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x25,0x25,0x24,0x48,0x29,0x10,0x28,0x44,0x87,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE6B3 [?] [6505]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x25,0x24,0x27,0x48,0x29,0x11,0x28,0x44,0x84,0x00, + 0x20,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE,0x80,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xE6B4 [?] [6506]*/ + 0x20,0x21,0x21,0x21,0xF9,0x49,0x48,0x48,0x4B,0x92,0x52,0x22,0x33,0x4A,0x4A,0x82, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xE6B5 [?] [6507]*/ + 0x11,0x10,0x10,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x00,0xBC,0x04,0x24,0x24,0x24,0xFC,0x24,0x74,0xAC,0x24,0x24,0x24,0x04,0x14,0x08, + /* 0xE6B6 [?] [6508]*/ + 0x10,0x08,0x40,0x24,0x09,0x72,0x10,0x17,0x02,0x7F,0x04,0x08,0x1C,0x03,0x0C,0x70, + 0x20,0x20,0xA8,0xA4,0x2A,0x30,0xC0,0x00,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xE6B7 [?] [6509]*/ + 0x11,0x10,0x10,0x11,0xFC,0x24,0x25,0x25,0x25,0x49,0x28,0x10,0x29,0x46,0x84,0x00, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xE6B8 [?] [6510]*/ + 0x20,0x23,0x22,0x22,0xFB,0x4A,0x4A,0x4A,0x8A,0x4A,0x32,0x13,0x2A,0x4C,0x84,0x08, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x18,0xE0,0x38,0xE0,0x3C,0xE0,0x22,0x22,0x1E,0x00, + /* 0xE6B9 [?] [6511]*/ + 0x20,0x27,0x25,0x25,0xF5,0x55,0x56,0x55,0x55,0x95,0x55,0x25,0x26,0x54,0x54,0x84, + 0x00,0x7E,0x04,0x04,0x74,0x54,0x54,0x54,0x54,0x54,0x74,0x54,0x04,0x04,0x14,0x08, + /* 0xE6BA [?] [6512]*/ + 0x10,0x10,0x13,0x10,0xFD,0x24,0x27,0x24,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xE6BB [?] [6513]*/ + 0x10,0x10,0x13,0x10,0xFC,0x25,0x24,0x24,0x27,0x48,0x28,0x11,0x2A,0x44,0x84,0x00, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x40,0xA4,0xA8,0x90,0x88,0xC6,0x80, + /* 0xE6BC [?] [6514]*/ + 0x20,0x20,0x23,0x20,0xF9,0x48,0x4B,0x48,0x89,0x48,0x31,0x11,0x29,0x4A,0x82,0x04, + 0x20,0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0x20,0x3E,0x20,0xA0,0x7E,0x00, + /* 0xE6BD [?] [6515]*/ + 0x10,0x10,0x10,0x10,0xFC,0x24,0x24,0x24,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x00,0xFE,0x02,0x02,0xFE,0x02,0x02,0xFE,0x02, + /* 0xE6BE [?] [6516]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x25,0x25,0x25,0x48,0x29,0x13,0x28,0x44,0x84,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xE6BF [?] [6517]*/ + 0x11,0x10,0x10,0x11,0xFD,0x25,0x25,0x25,0x25,0x49,0x28,0x10,0x2B,0x44,0x84,0x00, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE6C0 [?] [6518]*/ + 0x10,0x10,0xFE,0x22,0x64,0x18,0x24,0xC2,0x01,0x3F,0x22,0x24,0x21,0x22,0x24,0x20, + 0x00,0x00,0xFC,0x44,0x28,0x10,0x28,0xC6,0x00,0xF8,0x88,0x48,0x08,0x88,0x48,0x18, + /* 0xE6C1 [?] [6519]*/ + 0x20,0x21,0x21,0x21,0xF9,0x49,0x49,0x49,0x88,0x4B,0x32,0x12,0x2A,0x4A,0x87,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x94,0x94,0x94,0x94,0xFE,0x00, + /* 0xE6C2 [?] [6520]*/ + 0x20,0x27,0x22,0x21,0xF8,0x4B,0x48,0x48,0x4F,0x91,0x51,0x22,0x32,0x4C,0x48,0x83, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xE6C3 [?] [6521]*/ + 0x10,0x10,0x13,0x10,0xFD,0x25,0x25,0x24,0x27,0x4A,0x29,0x10,0x28,0x44,0x84,0x00, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFC,0x20,0x20,0x20,0xA0,0x40, + /* 0xE6C4 [?] [6522]*/ + 0x00,0x7E,0x24,0x18,0xFF,0x29,0x4A,0x98,0x02,0x7F,0x04,0x08,0x1C,0x03,0x06,0x38, + 0x20,0x20,0x7E,0xA4,0x28,0x10,0x28,0xC6,0x00,0xFC,0x20,0x40,0x80,0x80,0x70,0x08, + /* 0xE6C5 [?] [6523]*/ + 0x10,0x10,0x13,0x10,0xFD,0x24,0x27,0x24,0x25,0x49,0x29,0x11,0x2B,0x45,0x85,0x01, + 0x88,0x88,0xFE,0x88,0xFC,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFE,0x04,0x14,0x08, + /* 0xE6C6 [?] [6524]*/ + 0x21,0x21,0x27,0x21,0xF8,0x4B,0x4A,0x4B,0x8A,0x4B,0x30,0x17,0x28,0x49,0x82,0x04, + 0x10,0x10,0xFC,0x10,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xE6C7 [?] [6525]*/ + 0x10,0x10,0x11,0x11,0xFD,0x25,0x25,0x25,0x24,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x20,0x40,0xFC,0x54,0x24,0x54,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xE6C8 [?] [6526]*/ + 0x20,0x23,0x20,0x22,0xF9,0x4B,0x4A,0x48,0x4B,0x90,0x50,0x21,0x31,0x4A,0x4C,0x81, + 0x0E,0xF0,0x44,0x24,0x08,0xFE,0x42,0x40,0xFE,0x80,0xFC,0x44,0x28,0x10,0x68,0x86, + /* 0xE6C9 [?] [6527]*/ + 0x20,0x20,0x23,0x22,0xFC,0x49,0x49,0x49,0x49,0x91,0x51,0x27,0x30,0x48,0x49,0x82, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xE6CA [?] [6528]*/ + 0x20,0x21,0x21,0x21,0xF8,0x4B,0x48,0x48,0x49,0x91,0x51,0x21,0x30,0x48,0x4B,0x81, + 0x20,0x24,0x24,0xFC,0x20,0xFE,0x00,0x20,0xFC,0x24,0x24,0xFC,0x20,0x24,0xFE,0x02, + /* 0xE6CB [?] [6529]*/ + 0x08,0x3E,0x08,0x7F,0x1C,0x2A,0x49,0x3F,0x21,0x21,0x3F,0x22,0x27,0x40,0x43,0x8C, + 0x20,0x7E,0xA4,0x28,0x10,0x28,0x44,0xFE,0x00,0x00,0xFE,0x10,0x20,0xC0,0x30,0x0C, + /* 0xE6CC [?] [6530]*/ + 0x20,0x27,0x20,0x22,0xFA,0x4F,0x49,0x49,0x4A,0x93,0x50,0x25,0x35,0x48,0x48,0x80, + 0x00,0xFC,0x40,0x78,0x40,0xFE,0x00,0xFC,0x00,0xFC,0x04,0x54,0x54,0x04,0x28,0x10, + /* 0xE6CD [?] [6531]*/ + 0x10,0x10,0x13,0x10,0xFD,0x24,0x27,0x24,0x25,0x49,0x29,0x11,0x29,0x45,0x85,0x01, + 0x20,0x20,0xFE,0x20,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x74,0x54,0x74,0x04,0xFC,0x04, + /* 0xE6CE [?] [6532]*/ + 0x10,0x13,0x10,0x11,0xFD,0x25,0x25,0x24,0x25,0x48,0x2B,0x10,0x28,0x45,0x82,0x00, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xE6CF [?] [6533]*/ + 0x20,0x21,0x20,0x23,0xFA,0x48,0x48,0x48,0x48,0x90,0x51,0x21,0x31,0x49,0x49,0x80, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0xFC,0x24,0x24,0x34,0x28,0x20, + /* 0xE6D0 [?] [6534]*/ + 0x10,0x11,0x11,0x11,0xFD,0x25,0x24,0x24,0x25,0x48,0x28,0x13,0x28,0x45,0x82,0x00, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x40,0x88,0xF0,0x20,0x44,0xFE,0x22,0x24,0x22,0x60, + /* 0xE6D1 [?] [6535]*/ + 0x20,0x21,0x20,0x20,0xFB,0x48,0x49,0x49,0x49,0x91,0x51,0x20,0x33,0x48,0x48,0x80, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xE6D2 [?] [6536]*/ + 0x10,0x13,0x10,0x11,0xFC,0x25,0x25,0x25,0x24,0x4B,0x28,0x11,0x29,0x45,0x85,0x01, + 0x20,0xFE,0x20,0xFC,0x00,0xFC,0x04,0xFC,0x88,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xE6D3 [?] [6537]*/ + 0x20,0x23,0x20,0x23,0xFA,0x4A,0x4A,0x4B,0x48,0x91,0x51,0x21,0x31,0x49,0x48,0x83, + 0x20,0xFE,0x00,0xFC,0x04,0xF4,0x94,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xE6D4 [?] [6538]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3C,0x02,0xFF,0x08,0x1C,0x03,0x3C, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xFE,0x20,0x40,0xC0,0x38, + /* 0xE6D5 [?] [6539]*/ + 0x00,0xF9,0xA9,0xA9,0xF9,0xAF,0xAA,0xFA,0x42,0x44,0xFA,0x49,0x49,0x4A,0xAC,0x10, + 0x00,0x3E,0x2A,0x2A,0x3E,0xAA,0xAA,0xBE,0x90,0x90,0xBE,0x12,0x12,0x92,0xAA,0x44, + /* 0xE6D6 [?] [6540]*/ + 0x20,0x20,0x27,0x24,0xF7,0x54,0x55,0x56,0x54,0x94,0x54,0x25,0x24,0x54,0x55,0x88, + 0x40,0x20,0xFE,0x88,0xDE,0x88,0xDC,0xAA,0x88,0x40,0x90,0x20,0x48,0x84,0xFC,0x84, + /* 0xE6D7 [?] [6541]*/ + 0x21,0x20,0x23,0x22,0xF9,0x48,0x49,0x48,0x48,0x93,0x50,0x21,0x32,0x4C,0x48,0x80, + 0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0x9E,0xF2,0x9E,0xD2,0xBE,0x92,0x9E,0x92, + /* 0xE6D8 [?] [6542]*/ + 0x00,0x3F,0x08,0x08,0x08,0x10,0x10,0x21,0x41,0x09,0x09,0x11,0x21,0x41,0x05,0x02, + 0x00,0xF0,0x10,0x20,0x3C,0x04,0x04,0x14,0x08,0x20,0x10,0x08,0x04,0x04,0x00,0x00, + /* 0xE6D9 [?] [6543]*/ + 0x01,0x09,0x11,0x21,0x00,0x01,0xFF,0x02,0x0C,0x30,0xC1,0x09,0x09,0x11,0x25,0x02, + 0x00,0x20,0x10,0x08,0x00,0x00,0xFE,0x80,0x60,0x18,0x06,0x20,0x10,0x08,0x08,0x00, + /* 0xE6DA [?] [6544]*/ + 0x00,0x7F,0x22,0x11,0x11,0x00,0x1F,0x00,0x00,0x01,0xFF,0x01,0x01,0x01,0x05,0x02, + 0xF8,0x00,0x10,0x10,0x20,0x00,0xE0,0x40,0x80,0x00,0xFE,0x00,0x00,0x00,0x00,0x00, + /* 0xE6DB [?] [6545]*/ + 0x10,0x10,0xFE,0x22,0x64,0x18,0x24,0xC2,0x00,0x3F,0x00,0x01,0xFF,0x01,0x05,0x02, + 0x00,0x00,0xFC,0x44,0x28,0x10,0x28,0xC6,0x00,0xE0,0x80,0x00,0xFE,0x00,0x00,0x00, + /* 0xE6DC [?] [6546]*/ + 0x08,0x04,0x7F,0x12,0x3C,0x08,0x14,0x3E,0x00,0x3F,0x00,0x01,0xFF,0x01,0x05,0x02, + 0x20,0x40,0xFC,0x48,0xF0,0x20,0x50,0xF8,0x00,0xE0,0x80,0x00,0xFE,0x00,0x00,0x00, + /* 0xE6DD [?] [6547]*/ + 0x00,0x7F,0x00,0x00,0x00,0x01,0x01,0x01,0x03,0x1D,0xE1,0x41,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x10,0x20,0x40,0x84,0x18,0x60,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE6DE [?] [6548]*/ + 0x00,0x7F,0x00,0x00,0x20,0x11,0x09,0x05,0x03,0x01,0x01,0x01,0x01,0x01,0x05,0x02, + 0x00,0xF8,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x00,0x80,0x40,0x30,0x0C,0x00,0x00, + /* 0xE6DF [?] [6549]*/ + 0x00,0xFC,0x05,0x09,0x12,0x15,0x15,0x19,0x31,0xD1,0x11,0x11,0x11,0x11,0x50,0x20, + 0x80,0x80,0xFC,0x04,0x04,0xF4,0x14,0x14,0x14,0xF4,0x04,0x28,0x12,0x02,0xFE,0x00, + /* 0xE6E0 [?] [6550]*/ + 0x00,0xF8,0x08,0x48,0x48,0x48,0x48,0x7C,0x04,0x04,0x1C,0xE4,0x44,0x04,0x2B,0x10, + 0x00,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xFE,0x00, + /* 0xE6E1 [?] [6551]*/ + 0x00,0xF9,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1D,0xE5,0x45,0x05,0x29,0x10, + 0x00,0xFC,0x54,0x54,0x54,0x54,0x54,0x54,0x94,0x8C,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xE6E2 [?] [6552]*/ + 0x00,0xF8,0x08,0x49,0x49,0x4B,0x4D,0x7D,0x05,0x05,0x1D,0xE5,0x45,0x05,0x29,0x11, + 0x88,0x88,0x88,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xE6E3 [?] [6553]*/ + 0x00,0xF8,0x08,0x49,0x4A,0x4C,0x4B,0x7C,0x04,0x04,0x1D,0xE4,0x44,0x04,0x2B,0x10, + 0x80,0x80,0xF8,0x08,0x10,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE6E4 [?] [6554]*/ + 0x00,0xFB,0x09,0x48,0x48,0x48,0x48,0x7F,0x04,0x05,0x1C,0xE4,0x47,0x04,0x28,0x10, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE6E5 [?] [6555]*/ + 0x08,0x7F,0x11,0x32,0x0C,0x12,0x61,0x1F,0x00,0x08,0x08,0x0F,0x00,0x7F,0x00,0x00, + 0x00,0x7C,0x44,0x28,0x10,0x28,0x46,0xE0,0x20,0x20,0x20,0xFC,0x04,0xC4,0x14,0x08, + /* 0xE6E6 [?] [6556]*/ + 0x00,0xF8,0x08,0x48,0x49,0x4B,0x48,0x7C,0x05,0x05,0x1D,0xE5,0x45,0x05,0x29,0x11, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE6E7 [?] [6557]*/ + 0x00,0xF8,0x08,0x4B,0x48,0x48,0x48,0x7F,0x04,0x07,0x1C,0xE4,0x45,0x05,0x2A,0x14, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xE6E8 [?] [6558]*/ + 0x00,0xF8,0x09,0x49,0x4B,0x4D,0x49,0x7D,0x05,0x04,0x1F,0xE4,0x44,0x04,0x28,0x10, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xE6E9 [?] [6559]*/ + 0x00,0xF8,0x08,0x48,0x49,0x48,0x48,0x7C,0x04,0x07,0x1C,0xE4,0x44,0x04,0x28,0x11, + 0x84,0x44,0x48,0x00,0xFE,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x88,0x08, + /* 0xE6EA [?] [6560]*/ + 0x00,0xF3,0x10,0x50,0x53,0x52,0x52,0x7A,0x0B,0x0A,0x3A,0xCA,0x0A,0x0A,0x2A,0x12, + 0x00,0xFE,0x00,0x00,0xDE,0x52,0x52,0x52,0x5A,0xD6,0x52,0x52,0x52,0x52,0x52,0xD6, + /* 0xE6EB [?] [6561]*/ + 0x00,0xF8,0x0B,0x48,0x48,0x48,0x48,0x7C,0x04,0x04,0x1C,0xE7,0x44,0x04,0x28,0x11, + 0x88,0x88,0xFE,0x88,0x88,0xF8,0x88,0x88,0xF8,0x88,0x88,0xFE,0x00,0x88,0x84,0x04, + /* 0xE6EC [?] [6562]*/ + 0x00,0xF9,0x09,0x49,0x49,0x49,0x49,0x7D,0x04,0x07,0x1C,0xE4,0x45,0x06,0x28,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xE6ED [?] [6563]*/ + 0x00,0xF8,0x08,0x48,0x49,0x4A,0x48,0x7C,0x04,0x04,0x1C,0xE4,0x44,0x04,0x28,0x10, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xE6EE [?] [6564]*/ + 0x00,0xF8,0x08,0x49,0x48,0x4B,0x48,0x7D,0x06,0x05,0x1C,0xE4,0x45,0x04,0x28,0x13, + 0x40,0x48,0x84,0xFE,0x20,0xFE,0x88,0x24,0x42,0x88,0x10,0x62,0x84,0x18,0x60,0x80, + /* 0xE6EF [?] [6565]*/ + 0x00,0x79,0x49,0x53,0x48,0x6B,0x50,0x43,0x1F,0x00,0x08,0x0F,0x00,0x7F,0x00,0x00, + 0x20,0x3C,0x20,0xFE,0xA4,0x28,0x70,0x80,0xE0,0x20,0x20,0xFC,0x04,0xC4,0x14,0x08, + /* 0xE6F0 [?] [6566]*/ + 0x7E,0x24,0x18,0xFF,0x29,0x4A,0x98,0x00,0x1F,0x00,0x08,0x0F,0x00,0x7F,0x00,0x00, + 0x20,0x3E,0x48,0xA8,0x10,0x28,0x46,0x00,0xE0,0x20,0x20,0xFC,0x04,0xC4,0x14,0x08, + /* 0xE6F1 [?] [6567]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x10,0x1E,0x22,0x5F,0x80,0x08,0x0F,0x00,0x7F,0x00, + 0x20,0x20,0x7E,0x44,0xA4,0x28,0x10,0x28,0x44,0xE2,0x20,0x20,0xFC,0x04,0xD4,0x08, + /* 0xE6F2 [?] [6568]*/ + 0x00,0xF9,0x09,0x49,0x49,0x49,0x49,0x7C,0x05,0x05,0x1D,0xE5,0x45,0x05,0x29,0x11, + 0x40,0xBC,0x14,0x94,0x54,0xA4,0x4C,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xE6F3 [?] [6569]*/ + 0x00,0xF8,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1D,0xE5,0x45,0x06,0x2A,0x14, + 0x20,0x10,0xFE,0x02,0x02,0xFE,0x00,0xEE,0x22,0xAA,0x66,0x22,0x66,0xAA,0x22,0x66, + /* 0xE6F4 [?] [6570]*/ + 0x00,0xFB,0x08,0x49,0x49,0x49,0x49,0x7C,0x05,0x04,0x1F,0xE4,0x44,0x05,0x2A,0x10, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xE6F5 [?] [6571]*/ + 0x00,0xF8,0x09,0x49,0x49,0x49,0x49,0x7D,0x05,0x05,0x1C,0xE4,0x45,0x05,0x29,0x12, + 0x20,0x40,0xFC,0x24,0x7C,0x8C,0x54,0x24,0x54,0xFC,0x20,0x10,0x54,0x42,0x4A,0x38, + /* 0xE6F6 [?] [6572]*/ + 0x03,0xF2,0x13,0x52,0x52,0x52,0x53,0x7A,0x0A,0x0B,0x3A,0xCA,0x0C,0x0F,0x28,0x11, + 0xFE,0x02,0xFE,0x00,0xFC,0x08,0xFE,0x10,0x30,0xCE,0x42,0x84,0xEE,0x84,0x84,0x8C, + /* 0xE6F7 [?] [6573]*/ + 0x00,0xFB,0x08,0x49,0x4A,0x49,0x49,0x7D,0x05,0x05,0x1C,0xE5,0x44,0x07,0x28,0x11, + 0x94,0x98,0x92,0x8E,0x80,0xFC,0x24,0xFC,0x24,0xFC,0x88,0xFC,0x88,0xFE,0x88,0x04, + /* 0xE6F8 [?] [6574]*/ + 0x00,0xF3,0x10,0x51,0x51,0x51,0x50,0x7B,0x08,0x0B,0x38,0xCB,0x08,0x09,0x2A,0x10, + 0x20,0xFE,0x00,0xDC,0x54,0xDC,0x88,0xFE,0x88,0xFE,0x88,0xFE,0x94,0x88,0xA4,0xC2, + /* 0xE6F9 [?] [6575]*/ + 0x10,0x10,0x20,0x24,0x44,0xF8,0x10,0x20,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE6FA [?] [6576]*/ + 0x10,0x11,0x20,0x24,0x44,0xF8,0x10,0x23,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xE6FB [?] [6577]*/ + 0x10,0x10,0x20,0x24,0x45,0xF8,0x10,0x20,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x88,0x48,0x48,0x08,0x08,0x08,0x28,0x10, + /* 0xE6FC [?] [6578]*/ + 0x10,0x10,0x20,0x24,0x45,0xFA,0x10,0x20,0x40,0xFC,0x40,0x00,0x1D,0xE1,0x40,0x00, + 0x40,0x40,0x80,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xE6FD [?] [6579]*/ + 0x10,0x10,0x20,0x24,0x45,0xF8,0x10,0x20,0x41,0xFC,0x40,0x00,0x1C,0xE1,0x42,0x04, + 0x40,0x40,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0xC8,0x48,0xA8,0xAA,0x0A,0x06,0x02, + /* 0xE6FE [?] [6580]*/ + 0x10,0x10,0x20,0x25,0x45,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE2,0x42,0x04, + 0x20,0x10,0x10,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xE7A1 [?] [6581]*/ + 0x10,0x10,0x21,0x24,0x44,0xF8,0x13,0x20,0x40,0xFC,0x40,0x00,0x1D,0xE3,0x41,0x00, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0x88,0x04,0xFE,0x02,0x00, + /* 0xE7A2 [?] [6582]*/ + 0x10,0x11,0x21,0x25,0x45,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x00, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xE7A3 [?] [6583]*/ + 0x10,0x11,0x20,0x24,0x44,0xF8,0x13,0x20,0x40,0xFC,0x40,0x00,0x1C,0xE0,0x40,0x00, + 0x00,0xF8,0x08,0x50,0x20,0x10,0xFE,0x22,0x24,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xE7A4 [?] [6584]*/ + 0x11,0x11,0x21,0x25,0x47,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xE7A5 [?] [6585]*/ + 0x10,0x12,0x22,0x22,0x4A,0xF7,0x12,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x43,0x00, + 0x48,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x78,0x00,0x00,0x00,0xFE,0x00, + /* 0xE7A6 [?] [6586]*/ + 0x10,0x10,0x20,0x20,0x4B,0xF8,0x10,0x20,0x41,0xF9,0x41,0x01,0x1A,0xE2,0x44,0x01, + 0x50,0x48,0x48,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xE7A7 [?] [6587]*/ + 0x10,0x10,0x20,0x21,0x4A,0xFC,0x13,0x20,0x40,0xF8,0x41,0x00,0x18,0xE0,0x43,0x00, + 0x80,0x80,0xF8,0x08,0x10,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE7A8 [?] [6588]*/ + 0x10,0x10,0x20,0x23,0x48,0xF8,0x13,0x22,0x42,0xFB,0x40,0x00,0x19,0xE1,0x42,0x04, + 0x90,0x90,0x90,0xFC,0x94,0x94,0xFC,0x90,0x90,0xFE,0x92,0x92,0x1A,0x14,0x10,0x10, + /* 0xE7A9 [?] [6589]*/ + 0x10,0x10,0x21,0x25,0x45,0xF9,0x11,0x20,0x40,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x00, + 0x20,0x20,0x24,0x24,0x24,0x24,0xFC,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xE7AA [?] [6590]*/ + 0x10,0x10,0x20,0x24,0x45,0xFB,0x10,0x20,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x20,0x20,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE7AB [?] [6591]*/ + 0x10,0x10,0x27,0x20,0x49,0xFA,0x1D,0x20,0x47,0xF8,0x41,0x03,0x18,0xE0,0x40,0x00, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xF6,0x00,0xFC,0x80,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xE7AC [?] [6592]*/ + 0x10,0x10,0x21,0x22,0x4C,0xF0,0x11,0x23,0x45,0xF9,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x80,0x80,0x3C,0x00,0x80,0x80,0x7E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xE7AD [?] [6593]*/ + 0x10,0x10,0x20,0x21,0x4A,0xF8,0x11,0x26,0x40,0xF9,0x40,0x02,0x1B,0xE0,0x40,0x00, + 0x80,0x80,0xFC,0x08,0x90,0x60,0x98,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE7AE [?] [6594]*/ + 0x10,0x13,0x20,0x24,0x45,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1C,0xE0,0x40,0x03, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xE7AF [?] [6595]*/ + 0x10,0x11,0x20,0x24,0x44,0xF9,0x11,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xE7B0 [?] [6596]*/ + 0x11,0x10,0x20,0x23,0x48,0xF8,0x13,0x22,0x42,0xFB,0x40,0x00,0x19,0xE2,0x44,0x00, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xE7B1 [?] [6597]*/ + 0x10,0x10,0x21,0x20,0x48,0xFB,0x10,0x21,0x42,0xF8,0x41,0x02,0x18,0xE0,0x41,0x06, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xE7B2 [?] [6598]*/ + 0x10,0x10,0x21,0x24,0x44,0xF9,0x13,0x20,0x41,0xFD,0x41,0x01,0x1D,0xE0,0x40,0x00, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFE,0x08,0xE8,0x28,0x28,0xE8,0x28,0x08,0x28,0x10, + /* 0xE7B3 [?] [6599]*/ + 0x10,0x10,0x20,0x27,0x48,0xF8,0x10,0x23,0x40,0xF8,0x40,0x07,0x18,0xE0,0x40,0x00, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xE7B4 [?] [6600]*/ + 0x10,0x11,0x20,0x20,0x48,0xFB,0x12,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x42,0x02, + 0x20,0x24,0xA4,0xA8,0x20,0xFE,0x02,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE7B5 [?] [6601]*/ + 0x10,0x11,0x21,0x25,0x45,0xF9,0x11,0x21,0x40,0xFD,0x41,0x01,0x1D,0xE1,0x41,0x01, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xE7B6 [?] [6602]*/ + 0x10,0x10,0x21,0x20,0x48,0xFB,0x11,0x21,0x47,0xF9,0x41,0x03,0x18,0xE0,0x43,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x24,0x24,0xFE,0x24,0x24,0xFE,0x20,0x20,0xFE,0x00, + /* 0xE7B7 [?] [6603]*/ + 0x10,0x13,0x20,0x22,0x49,0xF9,0x17,0x24,0x40,0xFB,0x41,0x01,0x18,0xE0,0x41,0x06, + 0x1C,0xE0,0x84,0x44,0x48,0x10,0xFE,0x02,0x00,0xF8,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xE7B8 [?] [6604]*/ + 0x10,0x10,0x21,0x21,0x4A,0xF5,0x10,0x21,0x46,0xF8,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x88,0x88,0xEC,0x2A,0x28,0x48,0x88,0x7E,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE7B9 [?] [6605]*/ + 0x10,0x12,0x21,0x20,0x4B,0xF8,0x17,0x21,0x42,0xFD,0x49,0x01,0x19,0xE1,0x41,0x00, + 0x40,0x48,0x50,0x40,0xF8,0x80,0xFC,0x10,0x08,0xF4,0x12,0x10,0x50,0x24,0x04,0xFC, + /* 0xE7BA [?] [6606]*/ + 0x10,0x10,0x23,0x22,0x4C,0xF9,0x11,0x21,0x41,0xF9,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xE7BB [?] [6607]*/ + 0x11,0x11,0x22,0x24,0x4A,0xF9,0x11,0x20,0x43,0xFA,0x42,0x03,0x1A,0xE2,0x43,0x02, + 0x24,0x24,0x48,0x90,0x48,0x24,0x24,0x00,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x04, + /* 0xE7BC [?] [6608]*/ + 0x10,0x10,0x23,0x24,0x44,0xF8,0x11,0x21,0x41,0xFD,0x40,0x03,0x1C,0xE0,0x40,0x00, + 0x88,0x88,0xFE,0x88,0xF8,0x20,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE7BD [?] [6609]*/ + 0x11,0x11,0x21,0x21,0x4F,0xF1,0x11,0x23,0x43,0xFD,0x49,0x01,0x19,0xE1,0x41,0x01, + 0x00,0x00,0x3E,0x22,0xA2,0x22,0x3E,0xA2,0x62,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22, + /* 0xE7BE [?] [6610]*/ + 0x10,0x11,0x21,0x21,0x49,0xF9,0x11,0x21,0x40,0xFB,0x40,0x01,0x19,0xE1,0x42,0x04, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x20,0x20,0x3C,0x20,0xA0,0x7E, + /* 0xE7BF [?] [6611]*/ + 0x20,0x20,0x27,0x45,0x55,0xF7,0x25,0x25,0x47,0xF5,0x45,0x07,0x35,0xC0,0x00,0x03, + 0x10,0x10,0x10,0x10,0x14,0x52,0x52,0x92,0x10,0x14,0x08,0x10,0x20,0x40,0x80,0x00, + /* 0xE7C0 [?] [6612]*/ + 0x10,0x10,0x21,0x25,0x45,0xF8,0x13,0x20,0x41,0xFD,0x41,0x01,0x1D,0xE0,0x40,0x03, + 0x20,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xE7C1 [?] [6613]*/ + 0x10,0x11,0x21,0x21,0x49,0xF9,0x11,0x21,0x40,0xF8,0x40,0x02,0x1A,0xE4,0x40,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x00,0x40,0x24,0xA2,0x8A,0x88,0x78,0x00, + /* 0xE7C2 [?] [6614]*/ + 0x11,0x11,0x21,0x22,0x4A,0xF2,0x16,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x42,0x02, + 0x00,0xFE,0x10,0x10,0xFE,0x92,0x92,0xFE,0x92,0x92,0xFE,0x90,0x50,0x20,0x58,0x86, + /* 0xE7C3 [?] [6615]*/ + 0x11,0x11,0x21,0x22,0x4A,0xF6,0x1A,0x22,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x42,0x02, + 0x00,0x78,0x08,0x08,0xFE,0x40,0x40,0x7C,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xE7C4 [?] [6616]*/ + 0x10,0x12,0x21,0x25,0x44,0xF8,0x13,0x21,0x41,0xFD,0x41,0x01,0x1D,0xE2,0x44,0x00, + 0x10,0x20,0x7C,0x44,0x44,0x7C,0x40,0x40,0x7C,0x44,0x44,0x7C,0x44,0x80,0x7E,0x00, + /* 0xE7C5 [?] [6617]*/ + 0x10,0x13,0x22,0x23,0x4A,0xFB,0x12,0x22,0x43,0xF8,0x43,0x02,0x1B,0xE2,0x43,0x02, + 0x00,0xFC,0x04,0xFC,0x20,0xFE,0x10,0x8A,0x06,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xE7C6 [?] [6618]*/ + 0x10,0x13,0x20,0x22,0x49,0xF8,0x17,0x20,0x41,0xF9,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x00,0xFC,0x90,0x94,0x98,0x90,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08, + /* 0xE7C7 [?] [6619]*/ + 0x10,0x10,0x27,0x20,0x4B,0xFA,0x13,0x22,0x43,0xFA,0x43,0x02,0x1F,0xE1,0x42,0x04, + 0x40,0x40,0xFC,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xFE,0x10,0x08,0x04, + /* 0xE7C8 [?] [6620]*/ + 0x10,0x13,0x22,0x22,0x4A,0xFB,0x12,0x22,0x42,0xFA,0x42,0x03,0x1A,0xE4,0x44,0x08, + 0x00,0xFE,0x00,0xFC,0x00,0xFE,0xA8,0x90,0xC8,0x86,0x08,0xFE,0x88,0x48,0x08,0x18, + /* 0xE7C9 [?] [6621]*/ + 0x10,0x10,0x23,0x20,0x49,0xF9,0x11,0x20,0x43,0xFA,0x42,0x02,0x1A,0xE2,0x42,0x02, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE7CA [?] [6622]*/ + 0x10,0x10,0x23,0x20,0x49,0xF9,0x11,0x21,0x40,0xFB,0x42,0x02,0x1A,0xE2,0x42,0x02, + 0x40,0x20,0xFE,0x00,0x54,0x24,0x54,0xFC,0x20,0xFE,0x42,0x92,0xFA,0x0A,0x02,0x06, + /* 0xE7CB [?] [6623]*/ + 0x11,0x10,0x20,0x20,0x4B,0xF8,0x10,0x21,0x42,0xF9,0x41,0x01,0x19,0xE1,0x47,0x00, + 0x04,0x84,0x88,0x00,0xFE,0x00,0x88,0x04,0x02,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xE7CC [?] [6624]*/ + 0x10,0x10,0x20,0x25,0x44,0xF9,0x10,0x23,0x40,0xFD,0x40,0x00,0x1D,0xE2,0x40,0x00, + 0x88,0x50,0x00,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50,0x50, + /* 0xE7CD [?] [6625]*/ + 0x10,0x10,0x23,0x22,0x4C,0xF9,0x11,0x21,0x41,0xF9,0x41,0x07,0x18,0xE0,0x41,0x02, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xE7CE [?] [6626]*/ + 0x10,0x13,0x20,0x25,0x45,0xF9,0x11,0x20,0x41,0xFC,0x43,0x00,0x1C,0xE1,0x42,0x00, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xE7CF [?] [6627]*/ + 0x10,0x11,0x21,0x21,0x49,0xF9,0x10,0x23,0x42,0xFB,0x40,0x01,0x18,0xE0,0x41,0x06, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0xFC,0x00,0xF8,0x90,0x60,0x98,0x06, + /* 0xE7D0 [?] [6628]*/ + 0x10,0x11,0x21,0x25,0x45,0xF9,0x10,0x20,0x41,0xFC,0x40,0x03,0x1C,0xE1,0x42,0x00, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x40,0x88,0xF0,0x20,0x44,0xFE,0x22,0x24,0x22,0x60, + /* 0xE7D1 [?] [6629]*/ + 0x10,0x17,0x20,0x24,0x4A,0xF4,0x10,0x21,0x46,0xF8,0x43,0x00,0x1B,0xE0,0x40,0x07, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x50,0x88,0x26,0xC0,0x10,0x64,0x88,0x30,0xC0,0x00, + /* 0xE7D2 [?] [6630]*/ + 0x11,0x12,0x21,0x24,0x45,0xF9,0x11,0x21,0x41,0xFC,0x43,0x00,0x1C,0xE1,0x46,0x00, + 0x24,0x48,0x24,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xE7D3 [?] [6631]*/ + 0x22,0x22,0x22,0x4F,0x52,0xF2,0x27,0x20,0x40,0xF7,0x45,0x05,0x35,0xC7,0x05,0x00, + 0x00,0xFE,0x10,0xA0,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xE7D4 [?] [6632]*/ + 0x10,0x10,0x23,0x20,0x4A,0xF9,0x13,0x25,0x41,0xF9,0x41,0x00,0x19,0xE2,0x44,0x00, + 0x20,0x20,0xFE,0x50,0x8A,0x04,0xFE,0x04,0xFC,0x04,0xFC,0x20,0x24,0x22,0xA2,0x40, + /* 0xE7D5 [?] [6633]*/ + 0x11,0x10,0x20,0x23,0x4A,0xFA,0x12,0x22,0x43,0xF8,0x41,0x01,0x19,0xE1,0x41,0x01, + 0x04,0x88,0x00,0xFE,0x22,0xAA,0x72,0x22,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xE7D6 [?] [6634]*/ + 0x10,0x13,0x20,0x25,0x45,0xF9,0x11,0x23,0x40,0xFD,0x41,0x01,0x1D,0xE1,0x40,0x03, + 0x00,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE, + /* 0xE7D7 [?] [6635]*/ + 0x10,0x14,0x22,0x22,0x48,0xF9,0x10,0x2E,0x42,0xFA,0x42,0x02,0x1A,0xE2,0x45,0x08, + 0x10,0xFE,0x92,0xFE,0x10,0xFE,0x00,0xFE,0x82,0xFE,0x80,0xFE,0x82,0xFE,0x00,0xFE, + /* 0xE7D8 [?] [6636]*/ + 0x11,0x11,0x21,0x21,0x48,0xFB,0x12,0x22,0x43,0xF8,0x47,0x00,0x18,0xE1,0x46,0x00, + 0xFC,0x04,0x04,0xFC,0x00,0xDE,0x52,0x52,0xDE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xE7D9 [?] [6637]*/ + 0x10,0x13,0x22,0x22,0x4B,0xF8,0x17,0x20,0x43,0xFA,0x43,0x00,0x19,0xE3,0x4D,0x01, + 0x00,0xFC,0x94,0x94,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0xA2,0x14,0x08,0x44,0x82, + /* 0xE7DA [?] [6638]*/ + 0x21,0x25,0x27,0x49,0x57,0xF3,0x25,0x29,0x40,0xF3,0x42,0x02,0x32,0xC0,0x01,0x06, + 0x08,0x28,0xBE,0x48,0xBE,0x18,0xAA,0x46,0x00,0xF8,0x08,0x48,0x48,0xB0,0x08,0x04, + /* 0xE7DB [?] [6639]*/ + 0x02,0x02,0x04,0x08,0x10,0x20,0x7F,0x20,0x01,0x02,0x04,0x08,0x10,0x3F,0x10,0x00, + 0x00,0x00,0x00,0x10,0x10,0x20,0xC0,0x80,0x00,0x00,0x00,0x20,0x10,0xF8,0x08,0x00, + /* 0xE7DC [?] [6640]*/ + 0x11,0x21,0x45,0x79,0x11,0x25,0x7D,0x05,0x01,0xFF,0x00,0x7C,0x54,0x7C,0x54,0x7D, + 0x10,0x20,0x44,0x78,0x10,0x24,0x7C,0x24,0x10,0xFE,0x80,0x88,0x52,0x22,0x5A,0x86, + /* 0xE7DD [?] [6641]*/ + 0x00,0x00,0x08,0x08,0x08,0x11,0x11,0x22,0x22,0x11,0x11,0x08,0x08,0x08,0x00,0x00, + 0x00,0x00,0x88,0x88,0x88,0x10,0x10,0x20,0x20,0x10,0x10,0x88,0x88,0x88,0x00,0x00, + /* 0xE7DE [?] [6642]*/ + 0x08,0x11,0x22,0x11,0x08,0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x20, + 0x88,0x10,0x20,0x10,0x88,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xE7DF [?] [6643]*/ + 0x08,0x11,0x22,0x11,0x08,0x1F,0x10,0x1F,0x00,0x3F,0x21,0x21,0x3F,0x20,0x20,0x1F, + 0x88,0x10,0x20,0x10,0x88,0xF0,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x02,0x02,0xFE, + /* 0xE7E0 [?] [6644]*/ + 0x00,0x00,0xFE,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x1E,0xF0,0x40,0x00,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xE7E1 [?] [6645]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE2,0x42,0x04, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xE7E2 [?] [6646]*/ + 0x00,0x00,0xFC,0x13,0x10,0x10,0x11,0x7C,0x10,0x13,0x10,0x10,0x1C,0xE0,0x40,0x00, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x40,0x40,0xFE,0x42,0x42,0x4A,0x44,0x40,0x40, + /* 0xE7E3 [?] [6647]*/ + 0x00,0x00,0xFC,0x10,0x11,0x11,0x12,0x7D,0x10,0x10,0x10,0x10,0x1D,0xE1,0x42,0x04, + 0x10,0x90,0x90,0x88,0x08,0x04,0x04,0xFA,0x88,0x88,0x88,0x88,0x08,0x08,0x28,0x10, + /* 0xE7E4 [?] [6648]*/ + 0x00,0x00,0xFC,0x13,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x1C,0xE0,0x41,0x06, + 0x40,0x20,0x20,0xFE,0x88,0x88,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xE7E5 [?] [6649]*/ + 0x00,0x00,0xFD,0x10,0x10,0x10,0x10,0x7C,0x11,0x10,0x10,0x10,0x1C,0xE0,0x43,0x00, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x24,0x20,0xFE,0x00, + /* 0xE7E6 [?] [6650]*/ + 0x00,0x00,0xFD,0x10,0x10,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1C,0xE0,0x40,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xE7E7 [?] [6651]*/ + 0x00,0x00,0xFC,0x10,0x13,0x10,0x10,0x7C,0x10,0x10,0x11,0x11,0x1D,0xE2,0x42,0x04, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0xA8,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xE7E8 [?] [6652]*/ + 0x00,0x00,0xFC,0x10,0x10,0x10,0x10,0x7C,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE7E9 [?] [6653]*/ + 0x00,0x00,0xFC,0x10,0x10,0x11,0x11,0x7E,0x10,0x10,0x10,0x10,0x1C,0xE0,0x40,0x00, + 0x50,0x54,0x52,0x92,0x90,0x9E,0xF0,0x90,0x90,0x90,0x90,0x90,0x8A,0x8A,0x86,0x82, + /* 0xE7EA [?] [6654]*/ + 0x00,0x00,0xFC,0x11,0x11,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE7EB [?] [6655]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0x10,0x12,0x4A,0x86,0x02, + /* 0xE7EC [?] [6656]*/ + 0x02,0x02,0xFA,0x22,0x27,0x22,0x22,0xFA,0x22,0x22,0x22,0x3A,0xE4,0x44,0x09,0x10, + 0x00,0x00,0x00,0x1E,0xD2,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x52,0x5E,0x52,0x80, + /* 0xE7ED [?] [6657]*/ + 0x00,0x03,0xFD,0x11,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE3,0x40,0x00,0x00, + 0x00,0xFE,0x08,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x1E,0xE8,0x08,0x08,0x08, + /* 0xE7EE [?] [6658]*/ + 0x00,0x00,0xFC,0x10,0x13,0x10,0x10,0x7C,0x10,0x17,0x10,0x10,0x1C,0xE1,0x42,0x04, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xFE,0x00,0x88,0x84,0x04,0x02,0x02, + /* 0xE7EF [?] [6659]*/ + 0x00,0x01,0x7C,0x10,0x11,0x11,0x7D,0x11,0x11,0x11,0x11,0x1D,0xE0,0x40,0x01,0x02, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xE7F0 [?] [6660]*/ + 0x00,0x07,0xF8,0x24,0x24,0x24,0x27,0xF8,0x21,0x21,0x22,0x3A,0xE4,0x48,0x02,0x01, + 0x00,0xDE,0x92,0x92,0x94,0x94,0xD8,0x94,0x92,0x92,0x92,0x9A,0x94,0x90,0x90,0x10, + /* 0xE7F1 [?] [6661]*/ + 0x00,0x00,0xF9,0x22,0x24,0x20,0x21,0xFB,0x25,0x21,0x21,0x39,0xE1,0x41,0x01,0x01, + 0x80,0x80,0x3C,0x00,0x80,0x80,0x7E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xE7F2 [?] [6662]*/ + 0x00,0x00,0xF8,0x22,0x21,0x20,0x20,0xF9,0x22,0x24,0x20,0x20,0x39,0xE1,0x02,0x04, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xE7F3 [?] [6663]*/ + 0x00,0x00,0xF8,0x21,0x23,0x24,0x20,0xF8,0x21,0x22,0x25,0x21,0x39,0xE1,0x01,0x01, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xE7F4 [?] [6664]*/ + 0x08,0x08,0x1F,0x21,0x41,0x09,0x11,0x25,0x02,0x7F,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x00,0x00,0xFC,0x04,0x08,0x20,0x10,0x08,0x00,0xFC,0x00,0xF8,0x20,0x10,0xFE,0x00, + /* 0xE7F5 [?] [6665]*/ + 0x00,0x03,0xFA,0x24,0x20,0x23,0x20,0xF8,0x21,0x21,0x20,0x38,0xE3,0x40,0x00,0x00, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE7F6 [?] [6666]*/ + 0x00,0x04,0xFA,0x22,0x20,0x20,0x2E,0xFA,0x22,0x22,0x23,0x3A,0xE2,0x45,0x08,0x00, + 0x20,0x20,0x20,0xFE,0x40,0x50,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xE7F7 [?] [6667]*/ + 0x01,0x01,0xFB,0x21,0x21,0x21,0x21,0xF9,0x21,0x21,0x21,0x3B,0xE0,0x40,0x01,0x02, + 0x08,0x08,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00,0x90,0x08,0x04, + /* 0xE7F8 [?] [6668]*/ + 0x00,0x00,0xFB,0x20,0x20,0x20,0x21,0xF9,0x21,0x21,0x23,0x38,0xE0,0x40,0x01,0x02, + 0x88,0x88,0xFE,0x88,0xA8,0x20,0xFC,0x24,0x24,0x24,0xFE,0x20,0x50,0x88,0x04,0x02, + /* 0xE7F9 [?] [6669]*/ + 0x00,0x00,0xFB,0x20,0x21,0x22,0x27,0xF8,0x23,0x22,0x22,0x3A,0xE3,0x40,0x00,0x00, + 0x40,0x40,0xFC,0xA0,0x10,0x08,0xFE,0x08,0xC8,0x48,0x48,0x48,0xC8,0x08,0x28,0x10, + /* 0xE7FA [?] [6670]*/ + 0x00,0x00,0xF8,0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x22,0x3A,0xE4,0x44,0x09,0x12, + 0x40,0x40,0x7C,0x40,0xFC,0x44,0x70,0xC0,0x44,0x3C,0x00,0xF0,0x90,0x92,0x12,0x0E, + /* 0xE7FB [?] [6671]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7D,0x10,0x11,0x11,0x11,0x1D,0xE1,0x41,0x01, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xE7FC [?] [6672]*/ + 0x00,0x01,0xF9,0x22,0x20,0x20,0x23,0xF8,0x20,0x21,0x21,0x22,0x38,0xE0,0x01,0x06, + 0x20,0x22,0x22,0x24,0x50,0x88,0x04,0x22,0x20,0x24,0x24,0x28,0x50,0x88,0x04,0x02, + /* 0xE7FD [?] [6673]*/ + 0x00,0x00,0xFB,0x22,0x20,0x21,0x20,0xF8,0x23,0x20,0x21,0x39,0xE2,0x44,0x00,0x00, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xE7FE [?] [6674]*/ + 0x00,0x00,0xFB,0x22,0x25,0x21,0x21,0xFA,0x22,0x23,0x24,0x38,0xE1,0x41,0x02,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xE8A1 [?] [6675]*/ + 0x00,0x07,0xFC,0x24,0x21,0x22,0x20,0xF8,0x27,0x20,0x20,0x39,0xE2,0x4C,0x00,0x00, + 0x00,0xFC,0x04,0xA4,0x10,0x08,0x40,0x40,0xFC,0x40,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xE8A2 [?] [6676]*/ + 0x00,0x03,0xFA,0x22,0x23,0x22,0x22,0xFB,0x22,0x22,0x22,0x3A,0xE2,0x44,0x04,0x08, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xE8A3 [?] [6677]*/ + 0x00,0x01,0xFD,0x11,0x11,0x11,0x11,0x7C,0x10,0x10,0x10,0x10,0x1C,0xE0,0x40,0x00, + 0x00,0xFE,0x02,0x7A,0x02,0x7A,0x02,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0xFC,0x84, + /* 0xE8A4 [?] [6678]*/ + 0x00,0x00,0xF9,0x22,0x25,0x20,0x23,0xFA,0x22,0x23,0x22,0x3A,0xE3,0x42,0x02,0x02, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xE8A5 [?] [6679]*/ + 0x00,0x07,0xFA,0x21,0x20,0x23,0x20,0xF8,0x27,0x21,0x21,0x3A,0xE2,0x44,0x08,0x03, + 0x3C,0xC0,0x44,0x28,0x00,0xFC,0x80,0x80,0xFE,0x00,0xF8,0x88,0x50,0x20,0xD8,0x06, + /* 0xE8A6 [?] [6680]*/ + 0x00,0x03,0xFA,0x22,0x22,0x23,0x22,0xFA,0x23,0x22,0x22,0x3B,0xE2,0x42,0x02,0x02, + 0x00,0xDE,0x42,0x42,0x42,0xDE,0x00,0x3E,0xD2,0x12,0x14,0xD4,0x08,0x14,0x24,0x42, + /* 0xE8A7 [?] [6681]*/ + 0x00,0x01,0xFA,0x21,0x20,0x20,0x20,0xFB,0x22,0x22,0x22,0x3A,0xE2,0x42,0x03,0x02, + 0x92,0x24,0x48,0x24,0x92,0x40,0x80,0xFE,0x02,0x8A,0x52,0x22,0x52,0x8A,0xFE,0x02, + /* 0xE8A8 [?] [6682]*/ + 0x00,0x03,0xF8,0x22,0x21,0x23,0x22,0xF8,0x23,0x20,0x20,0x39,0xE1,0x42,0x04,0x01, + 0x0E,0xF0,0x44,0x24,0x08,0xFE,0x42,0x40,0xFE,0x80,0xFC,0x44,0x28,0x10,0x68,0x86, + /* 0xE8A9 [?] [6683]*/ + 0x00,0x00,0xFB,0x22,0x22,0x22,0x23,0xFA,0x22,0x22,0x22,0x3A,0xE2,0x44,0x04,0x08, + 0x20,0x10,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xE8AA [?] [6684]*/ + 0x00,0x00,0xFB,0x20,0x20,0x20,0x21,0xF9,0x21,0x20,0x23,0x38,0xE1,0x40,0x03,0x00, + 0x88,0x88,0xFE,0x88,0xF8,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE8AB [?] [6685]*/ + 0x00,0x00,0xFD,0x10,0x10,0x13,0x10,0x7D,0x11,0x11,0x11,0x11,0x1C,0xE0,0x41,0x02, + 0x88,0x88,0xFC,0x88,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0x88,0x04,0x02, + /* 0xE8AC [?] [6686]*/ + 0x00,0x0F,0xF8,0x2A,0x2A,0x2A,0x25,0xF8,0x20,0x2F,0x21,0x3A,0xE3,0x40,0x01,0x0E, + 0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0x80,0xFE,0x10,0x10,0xA0,0x60,0x98,0x04, + /* 0xE8AD [?] [6687]*/ + 0x00,0x02,0xFB,0x20,0x20,0x21,0x23,0xFD,0x21,0x21,0x21,0x39,0xE1,0x41,0x01,0x01, + 0x20,0x22,0xFE,0x90,0x88,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xE8AE [?] [6688]*/ + 0x00,0x00,0xFB,0x22,0x22,0x23,0x22,0xFA,0x22,0x23,0x20,0x38,0xE5,0x45,0x09,0x00, + 0x40,0x80,0xFC,0x44,0xF4,0x14,0xA4,0x44,0xA4,0xFC,0x40,0x24,0x22,0x0A,0x08,0xF8, + /* 0xE8AF [?] [6689]*/ + 0x02,0x01,0xF9,0x27,0x22,0x22,0x23,0xFA,0x22,0x22,0x22,0x3A,0xE4,0x45,0x08,0x10, + 0x10,0x10,0x10,0xBE,0x40,0x00,0xBE,0x8A,0x88,0xA8,0xAE,0xA8,0xA8,0xA8,0x5E,0x80, + /* 0xE8B0 [?] [6690]*/ + 0x00,0x01,0xFC,0x10,0x13,0x10,0x7D,0x11,0x11,0x11,0x11,0x1C,0xE3,0x40,0x00,0x00, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xE8B1 [?] [6691]*/ + 0x00,0x02,0xF9,0x20,0x23,0x20,0x20,0xFB,0x20,0x21,0x20,0x3B,0xE0,0x40,0x01,0x06, + 0x50,0x52,0x54,0x50,0xFE,0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xE8B2 [?] [6692]*/ + 0x00,0x00,0xFA,0x23,0x24,0x2A,0x23,0xFC,0x22,0x21,0x27,0x38,0xE1,0x42,0x0C,0x00, + 0x80,0xDC,0x84,0xD4,0x48,0x94,0x24,0x40,0x48,0x50,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xE8B3 [?] [6693]*/ + 0x00,0x00,0xF8,0x23,0x22,0x22,0x23,0xFA,0x22,0x23,0x22,0x3B,0xE2,0x45,0x04,0x09, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x00,0xFE,0x40,0xA4,0x58,0xB4,0x52,0xB0, + /* 0xE8B4 [?] [6694]*/ + 0x00,0x07,0xFC,0x24,0x24,0x27,0x21,0xF9,0x21,0x25,0x25,0x3D,0xE5,0x45,0x0E,0x00, + 0x10,0x90,0xBC,0xA4,0xC4,0xA8,0x10,0x28,0x46,0xC0,0x3C,0x24,0x24,0xA4,0x3C,0x24, + /* 0xE8B5 [?] [6695]*/ + 0x3E,0x22,0x3E,0x20,0x7E,0xA2,0x3E,0x22,0x00,0x7F,0x01,0x3F,0x01,0x01,0xFF,0x00, + 0x10,0xFE,0x44,0x28,0xFE,0x10,0xFC,0x10,0x00,0xFC,0x00,0xF8,0x20,0x10,0xFE,0x00, + /* 0xE8B6 [?] [6696]*/ + 0x01,0x05,0xFF,0x29,0x27,0x23,0x25,0xF9,0x20,0x23,0x22,0x3A,0xE2,0x40,0x01,0x06, + 0x08,0x28,0xBE,0x48,0xBE,0x18,0xAA,0x46,0x00,0xF8,0x08,0x48,0x48,0xB0,0x08,0x04, + /* 0xE8B7 [?] [6697]*/ + 0x2F,0x48,0x4B,0x68,0x4B,0x6A,0x4B,0x48,0xFF,0x80,0x7F,0x01,0x3F,0x01,0x01,0xFF, + 0xEC,0x24,0xA4,0x2C,0xA4,0xAC,0xA4,0x24,0xFE,0x02,0xFC,0x00,0xF8,0x20,0x10,0xFE, + /* 0xE8B8 [?] [6698]*/ + 0x00,0x3E,0x22,0x3E,0x22,0x3E,0x00,0xFF,0x08,0x08,0x2F,0x28,0x28,0x58,0x4F,0x80, + 0x20,0x20,0xFC,0x20,0x20,0xF8,0x20,0x20,0xFC,0x24,0x24,0x34,0x28,0x20,0xFE,0x00, + /* 0xE8B9 [?] [6699]*/ + 0x20,0x20,0x20,0xFC,0x20,0x20,0xF8,0x20,0x20,0xFD,0x25,0x25,0x35,0x29,0x23,0x20, + 0x00,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xE8BA [?] [6700]*/ + 0x20,0x21,0x20,0xFD,0x20,0x20,0xF8,0x21,0x21,0xFD,0x25,0x25,0x35,0x29,0x21,0x21, + 0x1E,0xE0,0x22,0x12,0x94,0x80,0x20,0xCE,0x02,0x02,0xCE,0x02,0x02,0x02,0xFE,0x02, + /* 0xE8BB [?] [6701]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x00,0x00,0xFC,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xE8BC [?] [6702]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x30,0x39,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xE8BD [?] [6703]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x30,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x10,0x10, + 0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE8BE [?] [6704]*/ + 0x10,0x13,0x11,0x11,0xFD,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x11,0x16, + 0x00,0xFC,0x04,0x44,0x24,0xA8,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xE8BF [?] [6705]*/ + 0x10,0x13,0x10,0x10,0xFD,0x11,0x31,0x39,0x54,0x54,0x90,0x13,0x10,0x10,0x10,0x10, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xFC,0x04,0x04,0x04,0xF4,0x04,0x04,0x28,0x10, + /* 0xE8C0 [?] [6706]*/ + 0x20,0x23,0x22,0x22,0xFA,0x22,0x22,0x72,0x6A,0xA2,0xA2,0x22,0x24,0x24,0x29,0x32, + 0x00,0xFE,0x00,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xE8C1 [?] [6707]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x10, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xE8C2 [?] [6708]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x31,0x39,0x56,0x54,0x90,0x10,0x10,0x10,0x10,0x13, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xE8C3 [?] [6709]*/ + 0x01,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xE8C4 [?] [6710]*/ + 0x10,0x10,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xE8C5 [?] [6711]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x10,0x10,0x11,0x12,0x14, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xE8C6 [?] [6712]*/ + 0x10,0x10,0x10,0x11,0xFD,0x12,0x30,0x38,0x57,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xE8C7 [?] [6713]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x30,0x3B,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x80,0x84,0x84,0x88,0x90,0xA0,0x80,0xFE,0xA0,0x90,0x90,0x88,0x84,0xA2,0xC0,0x80, + /* 0xE8C8 [?] [6714]*/ + 0x11,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x52,0x92,0x12,0x14,0x14,0x18,0x11, + 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xA8,0x68,0x28,0x44,0x44,0x84,0x02, + /* 0xE8C9 [?] [6715]*/ + 0x01,0x02,0x1F,0x10,0x12,0x11,0x10,0x1F,0x01,0x01,0x7F,0x03,0x05,0x19,0xE1,0x01, + 0x00,0x00,0xF0,0x10,0x10,0x50,0x20,0xFC,0x04,0x04,0xF4,0x88,0x40,0x30,0x0E,0x00, + /* 0xE8CA [?] [6716]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x30,0x38,0x54,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xE8CB [?] [6717]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x10,0x10, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE8CC [?] [6718]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x00,0xF8,0x08,0x50,0x20,0x10,0xFE,0x22,0x24,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xE8CD [?] [6719]*/ + 0x01,0x01,0x7F,0x05,0x09,0x31,0xCF,0x00,0x00,0x7F,0x01,0x11,0x11,0x21,0x45,0x02, + 0x00,0x00,0xFC,0x40,0x20,0x18,0xE6,0x00,0x00,0xFC,0x00,0x10,0x08,0x04,0x04,0x00, + /* 0xE8CE [?] [6720]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x88,0x88,0xFE,0x88,0x88,0x00,0xFE,0x42,0x42,0x42,0x42,0x4A,0x44,0x40,0x40,0x40, + /* 0xE8CF [?] [6721]*/ + 0x10,0x10,0x13,0x10,0xFC,0x10,0x30,0x38,0x55,0x52,0x94,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xE8D0 [?] [6722]*/ + 0x10,0x10,0x10,0x10,0xFB,0x10,0x30,0x38,0x54,0x51,0x91,0x11,0x12,0x12,0x14,0x18, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0x28,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xE8D1 [?] [6723]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x32,0x3A,0x57,0x52,0x92,0x12,0x13,0x12,0x13,0x10, + 0x00,0xFC,0x00,0x40,0x40,0x78,0x88,0x90,0x10,0x20,0x50,0x88,0x04,0x00,0xFE,0x00, + /* 0xE8D2 [?] [6724]*/ + 0x10,0x11,0x10,0x10,0xFD,0x10,0x30,0x38,0x57,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xE8D3 [?] [6725]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x20,0x20,0x3E,0x20,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00, + /* 0xE8D4 [?] [6726]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x10,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xE8D5 [?] [6727]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x30,0x3B,0x54,0x55,0x91,0x10,0x10,0x10,0x10,0x10, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x00,0xFE,0x80,0x00,0xF8,0x08,0x08,0x08,0x50,0x20, + /* 0xE8D6 [?] [6728]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xE8D7 [?] [6729]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x10,0x10,0x11,0x12,0x14, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xE8D8 [?] [6730]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x08,0x1C,0xE0,0x00,0x00,0x00,0xFE,0x10,0x10,0x30,0x18,0x14,0x12,0x10,0x10,0x10, + /* 0xE8D9 [?] [6731]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x12,0x14, + 0x1C,0xE0,0x00,0x00,0xFE,0x00,0x00,0x7C,0x44,0x44,0x54,0x48,0x42,0x42,0x3E,0x00, + /* 0xE8DA [?] [6732]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x32,0x38,0x55,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xE8DB [?] [6733]*/ + 0x10,0x10,0x10,0x11,0xFD,0x12,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0x24,0xE4,0x24,0x04,0x28,0x10, + /* 0xE8DC [?] [6734]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x32,0x3B,0x56,0x52,0x92,0x12,0x12,0x12,0x13,0x12, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xE8DD [?] [6735]*/ + 0x10,0x10,0x13,0x12,0xFE,0x12,0x32,0x3B,0x54,0x54,0x91,0x11,0x12,0x14,0x10,0x10, + 0x08,0x3C,0xC0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xE8DE [?] [6736]*/ + 0x10,0x10,0x10,0x11,0xFD,0x12,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x10,0x10,0x10, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xE8DF [?] [6737]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x30,0x38,0x57,0x50,0x91,0x10,0x10,0x10,0x13,0x10, + 0x00,0xFC,0x84,0x88,0x50,0x20,0x50,0x88,0x26,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE8E0 [?] [6738]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x38,0x55,0x52,0x94,0x10,0x10,0x10,0x10,0x10, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xE8E1 [?] [6739]*/ + 0x10,0x10,0x10,0x11,0xFC,0x10,0x33,0x38,0x54,0x55,0x92,0x14,0x10,0x10,0x10,0x10, + 0x40,0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0x84,0x98,0xE0,0x82,0x82,0x7E,0x00, + /* 0xE8E2 [?] [6740]*/ + 0x10,0x11,0x10,0x10,0xFC,0x10,0x32,0x39,0x55,0x55,0x90,0x10,0x10,0x10,0x13,0x10, + 0x00,0xFE,0x48,0x48,0x48,0x48,0x48,0x4A,0x4A,0x4C,0x48,0x48,0x48,0x48,0xFE,0x00, + /* 0xE8E3 [?] [6741]*/ + 0x10,0x10,0x10,0x13,0xFC,0x10,0x30,0x3B,0x54,0x53,0x90,0x10,0x11,0x11,0x12,0x14, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xE8E4 [?] [6742]*/ + 0x10,0x13,0x10,0x10,0xFC,0x11,0x33,0x38,0x54,0x54,0x93,0x10,0x10,0x10,0x17,0x10, + 0x00,0xFE,0x20,0x40,0x88,0x04,0xFE,0x22,0x20,0x20,0xFE,0x20,0x20,0x20,0xFE,0x00, + /* 0xE8E5 [?] [6743]*/ + 0x10,0x10,0x10,0x10,0xFC,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x10,0x11, + 0x20,0x20,0x3E,0x20,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xE8E6 [?] [6744]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x90,0x10,0x11,0x11,0x12,0x14, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xE8E7 [?] [6745]*/ + 0x10,0x11,0x11,0x11,0xFD,0x10,0x31,0x38,0x54,0x55,0x91,0x11,0x11,0x11,0x10,0x10, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xE8E8 [?] [6746]*/ + 0x20,0x20,0x27,0x21,0xF9,0x22,0x32,0x6F,0x61,0xA5,0xA5,0x22,0x22,0x25,0x28,0x30, + 0x00,0x0C,0x70,0x10,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,0xFE,0x00, + /* 0xE8E9 [?] [6747]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x38,0x54,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xE8EA [?] [6748]*/ + 0x10,0x10,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x10, + 0x00,0x40,0x9C,0x04,0x04,0x04,0x04,0xDC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00, + /* 0xE8EB [?] [6749]*/ + 0x10,0x10,0x11,0x11,0xFB,0x15,0x31,0x39,0x55,0x50,0x93,0x10,0x10,0x10,0x10,0x10, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xE8EC [?] [6750]*/ + 0x10,0x10,0x11,0x12,0xFC,0x10,0x31,0x3B,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x80,0x80,0x3C,0x00,0x80,0x80,0x7E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xE8ED [?] [6751]*/ + 0x10,0x10,0x10,0x10,0xFD,0x12,0x38,0x34,0x50,0x53,0x90,0x10,0x10,0x11,0x13,0x11, + 0x20,0x20,0x50,0x88,0x04,0x02,0xF8,0x00,0x00,0xFE,0x20,0x40,0x88,0x04,0xFE,0x02, + /* 0xE8EE [?] [6752]*/ + 0x10,0x10,0x3E,0x42,0xA4,0x14,0x08,0x10,0x20,0x41,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x10,0x10,0xFC,0x10,0x90,0x90,0xFE,0x10,0x10,0x10,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE8EF [?] [6753]*/ + 0x02,0x01,0xFF,0x04,0x14,0x14,0x24,0x44,0x00,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x44,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE8F0 [?] [6754]*/ + 0x01,0x11,0x09,0x3F,0x02,0x02,0x7F,0x08,0x11,0x21,0xDF,0x03,0x05,0x19,0x61,0x01, + 0x00,0x10,0x20,0xF8,0x00,0x00,0xFC,0x20,0x10,0x08,0xF6,0x00,0xC0,0x30,0x08,0x00, + /* 0xE8F1 [?] [6755]*/ + 0x10,0x10,0x10,0x13,0xFE,0x14,0x30,0x3B,0x54,0x54,0x91,0x10,0x10,0x10,0x10,0x13, + 0x40,0x20,0x20,0xFE,0x02,0x44,0x40,0xFE,0x88,0x88,0x08,0xD0,0x20,0x50,0x88,0x04, + /* 0xE8F2 [?] [6756]*/ + 0x10,0x13,0x10,0x10,0xFE,0x11,0x31,0x38,0x54,0x51,0x92,0x10,0x10,0x10,0x11,0x10, + 0x00,0xDE,0x42,0x42,0x52,0x4A,0x4A,0x42,0xC6,0x4A,0x52,0x42,0x42,0x42,0x4A,0x84, + /* 0xE8F3 [?] [6757]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC8,0x00,0x0F,0x08,0x08,0x0A,0x09,0x11,0x20,0x40, + 0x20,0x20,0xFC,0x20,0x70,0xA8,0x26,0x00,0xE0,0x20,0x20,0x20,0x20,0x22,0x22,0x1E, + /* 0xE8F4 [?] [6758]*/ + 0x10,0x11,0x11,0x11,0xFD,0x12,0x30,0x3B,0x54,0x54,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xE8F5 [?] [6759]*/ + 0x10,0x10,0x11,0x10,0xFD,0x10,0x30,0x39,0x54,0x50,0x93,0x10,0x10,0x10,0x10,0x10, + 0x08,0x3C,0xC0,0x04,0x44,0xA8,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xE8F6 [?] [6760]*/ + 0x10,0x10,0x10,0x11,0xFA,0x15,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x12,0x12,0x14, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x24,0x24,0x14,0x08, + /* 0xE8F7 [?] [6761]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x33,0x38,0x54,0x54,0x91,0x10,0x10,0x10,0x10,0x10, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20, + /* 0xE8F8 [?] [6762]*/ + 0x20,0x22,0x21,0x21,0xF4,0x22,0x22,0x70,0x68,0xA1,0xA6,0x22,0x22,0x22,0x22,0x20, + 0x10,0x10,0x10,0x10,0x54,0x52,0x52,0x90,0x10,0x14,0x04,0x08,0x08,0x10,0x20,0xC0, + /* 0xE8F9 [?] [6763]*/ + 0x10,0x13,0x10,0x10,0xFD,0x10,0x30,0x3B,0x54,0x51,0x91,0x12,0x10,0x11,0x12,0x14, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x40,0x48,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xE8FA [?] [6764]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x38,0x54,0x51,0x92,0x10,0x10,0x10,0x10,0x10, + 0x20,0x22,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xE8FB [?] [6765]*/ + 0x08,0x08,0x7E,0x08,0x1C,0x2A,0xC8,0x04,0x08,0x10,0x2F,0xC4,0x04,0x08,0x10,0x60, + 0x20,0x20,0xFC,0x20,0x70,0xA8,0x24,0x40,0x20,0x10,0xE8,0x26,0x20,0x20,0xA0,0x40, + /* 0xE8FC [?] [6766]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x30,0x38,0x54,0x55,0x90,0x13,0x10,0x10,0x10,0x13, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x10,0x90,0xFE,0x28,0x44,0x82,0x02, + /* 0xE8FD [?] [6767]*/ + 0x10,0xFE,0x20,0x48,0x7E,0x08,0x0E,0xF9,0x4A,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE8FE [?] [6768]*/ + 0x10,0x10,0x10,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x13,0x10,0x10,0x10,0x10, + 0x20,0x20,0x3E,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE9A1 [?] [6769]*/ + 0x10,0x13,0x12,0x12,0xFE,0x13,0x30,0x38,0x54,0x51,0x92,0x10,0x10,0x10,0x11,0x16, + 0x00,0xFE,0x52,0x52,0x52,0xFE,0x20,0x40,0xFC,0x04,0x88,0x50,0x20,0x40,0x80,0x00, + /* 0xE9A2 [?] [6770]*/ + 0x20,0x20,0x23,0x20,0xF8,0x27,0x22,0x72,0x6F,0xA2,0xA2,0x27,0x20,0x20,0x27,0x20, + 0x10,0x78,0xC0,0x40,0x40,0xFC,0x48,0x48,0xFE,0x48,0x48,0xFC,0x40,0x40,0xFC,0x00, + /* 0xE9A3 [?] [6771]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x31,0x39,0x55,0x54,0x91,0x11,0x12,0x14,0x10,0x10, + 0x40,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xE9A4 [?] [6772]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x31,0x38,0x55,0x54,0x90,0x13,0x10,0x10,0x10,0x10, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFC,0x08,0x10,0xFE,0x20,0x20,0xA0,0x40, + /* 0xE9A5 [?] [6773]*/ + 0x20,0x20,0x20,0x2E,0xFB,0x22,0x24,0x74,0x6E,0xA2,0xA2,0x2B,0x24,0x26,0x29,0x30, + 0x20,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFE,0x00, + /* 0xE9A6 [?] [6774]*/ + 0x10,0x10,0x11,0x10,0xFC,0x13,0x38,0x34,0x51,0x52,0x91,0x10,0x11,0x12,0x10,0x10, + 0x20,0x20,0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x22,0x74,0xA8,0x24,0x22,0xA0,0x40, + /* 0xE9A7 [?] [6775]*/ + 0x10,0x13,0x12,0x12,0xFB,0x12,0x32,0x3B,0x56,0x52,0x92,0x12,0x12,0x14,0x14,0x18, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xE9A8 [?] [6776]*/ + 0x20,0x20,0x27,0x20,0xFB,0x20,0x27,0x71,0x6A,0xA5,0xA0,0x23,0x20,0x20,0x21,0x26, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x08,0xF6,0x40,0xF8,0x40,0xA0,0x10,0x08, + /* 0xE9A9 [?] [6777]*/ + 0x11,0x11,0x17,0x11,0xFD,0x11,0x39,0x35,0x51,0x57,0x92,0x12,0x13,0x12,0x13,0x10, + 0x10,0x10,0xFC,0x10,0xF0,0x10,0xF0,0x10,0x10,0xFE,0x00,0x90,0x08,0x00,0xFC,0x00, + /* 0xE9AA [?] [6778]*/ + 0x10,0x10,0x13,0x10,0xFC,0x13,0x32,0x3A,0x56,0x52,0x92,0x12,0x12,0x12,0x12,0x12, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x8A,0x52,0xFA,0x22,0x22,0xFA,0x22,0x22,0x2A,0x04, + /* 0xE9AB [?] [6779]*/ + 0x10,0x10,0x13,0x10,0xFC,0x11,0x32,0x39,0x55,0x51,0x91,0x11,0x11,0x10,0x13,0x10, + 0x20,0x20,0xFE,0x70,0xA8,0x24,0x22,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xE9AC [?] [6780]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x10,0x10,0x11,0x12,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x24,0xAC,0x74,0x24,0xFC,0x20,0x70,0xA8,0x24,0x22,0x20, + /* 0xE9AD [?] [6781]*/ + 0x10,0x12,0x12,0x12,0xFE,0x10,0x31,0x39,0x55,0x55,0x91,0x11,0x10,0x10,0x11,0x16, + 0x90,0x90,0x9E,0xA8,0xC4,0x80,0xFC,0x04,0x24,0x24,0x24,0x54,0x50,0x90,0x12,0x0E, + /* 0xE9AE [?] [6782]*/ + 0x10,0x11,0x11,0x11,0xFD,0x10,0x37,0x39,0x55,0x55,0x91,0x11,0x11,0x17,0x10,0x10, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0xFE,0x08,0xF8,0x08,0xF8,0x08,0x3E,0xC8,0x08,0x08, + /* 0xE9AF [?] [6783]*/ + 0x10,0x10,0x10,0x10,0xFC,0x10,0x30,0x38,0x54,0x53,0x92,0x12,0x12,0x12,0x13,0x12, + 0x00,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88,0x00,0xDE,0x52,0x52,0x52,0x52,0xDE,0x52, + /* 0xE9B0 [?] [6784]*/ + 0x20,0x20,0x3E,0x48,0x88,0x7E,0x14,0x22,0x40,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0xFC,0x80,0xF8,0x88,0xF8,0x80,0xFC,0x00,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE9B1 [?] [6785]*/ + 0x20,0x21,0x27,0x21,0xF9,0x21,0x27,0x71,0x6B,0xA3,0xA5,0x25,0x29,0x21,0x21,0x21, + 0x88,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xE9B2 [?] [6786]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x17,0x11,0x11,0x11, + 0x20,0xDC,0x14,0x14,0x14,0xD4,0x26,0x00,0xDC,0x14,0x14,0xD4,0x08,0x08,0x14,0x22, + /* 0xE9B3 [?] [6787]*/ + 0x10,0x12,0x11,0x11,0xFC,0x10,0x33,0x39,0x55,0x55,0x91,0x11,0x11,0x12,0x14,0x10, + 0x10,0x20,0x7C,0x44,0x44,0x7C,0x40,0x40,0x7C,0x44,0x44,0x7C,0x44,0x80,0x7E,0x00, + /* 0xE9B4 [?] [6788]*/ + 0x10,0x10,0x11,0x10,0xFC,0x10,0x33,0x38,0x54,0x55,0x90,0x10,0x11,0x12,0x10,0x10, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x20,0x20,0xFC,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xE9B5 [?] [6789]*/ + 0x11,0x10,0x12,0x12,0xFE,0x12,0x32,0x3A,0x56,0x52,0x92,0x12,0x12,0x12,0x12,0x12, + 0x00,0xBC,0x84,0x04,0xF4,0x94,0x94,0xF4,0x04,0xF4,0x94,0x94,0xF4,0x04,0x14,0x08, + /* 0xE9B6 [?] [6790]*/ + 0x11,0x10,0x10,0x13,0xFC,0x11,0x30,0x3B,0x54,0x55,0x91,0x12,0x14,0x18,0x13,0x10, + 0x08,0x88,0x90,0xFC,0x40,0xF8,0x40,0xFE,0x80,0x00,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE9B7 [?] [6791]*/ + 0x10,0x11,0x10,0x10,0xFB,0x10,0x31,0x3A,0x54,0x50,0x90,0x13,0x10,0x10,0x10,0x10, + 0x44,0x24,0x88,0x10,0xFE,0x88,0x24,0x22,0xF8,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE9B8 [?] [6792]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x30,0x39,0x55,0x55,0x91,0x11,0x11,0x10,0x13,0x10, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xE9B9 [?] [6793]*/ + 0x10,0x13,0x12,0x12,0xFB,0x12,0x32,0x3A,0x56,0x52,0x92,0x12,0x12,0x12,0x14,0x18, + 0x00,0xFC,0x24,0x24,0xFC,0x00,0xFC,0x84,0x84,0xFC,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xE9BA [?] [6794]*/ + 0x10,0x13,0x11,0x11,0xFD,0x12,0x32,0x3A,0x54,0x51,0x93,0x12,0x12,0x12,0x17,0x10, + 0x00,0xF8,0x08,0x10,0x1C,0xE4,0xA4,0x54,0xA8,0x00,0xFC,0x94,0x94,0x94,0xFE,0x00, + /* 0xE9BB [?] [6795]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x3B,0x34,0x51,0x52,0x90,0x11,0x10,0x10,0x13,0x10, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x34,0xE2,0x20,0xFC,0x70,0xAC,0x22,0x20, + /* 0xE9BC [?] [6796]*/ + 0x10,0x13,0x12,0x12,0xFE,0x12,0x32,0x3A,0x56,0x52,0x92,0x12,0x12,0x12,0x13,0x10, + 0x00,0xFE,0x28,0x28,0xEE,0x28,0x28,0xEE,0x28,0x28,0xEE,0x28,0x28,0x28,0xFE,0x00, + /* 0xE9BD [?] [6797]*/ + 0x10,0x11,0x11,0x11,0xFD,0x11,0x38,0x34,0x53,0x50,0x92,0x11,0x12,0x10,0x11,0x10, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0x00,0xDE,0x42,0x52,0x4A,0x52,0x42,0x4A,0x84, + /* 0xE9BE [?] [6798]*/ + 0x10,0x10,0x11,0x13,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x13,0x10,0x10,0x10,0x10, + 0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xE9BF [?] [6799]*/ + 0x20,0x21,0x23,0x22,0xFB,0x22,0x33,0x6A,0x62,0xA7,0xA0,0x21,0x22,0x24,0x21,0x20, + 0x84,0x04,0xC4,0x44,0xDE,0x44,0xC4,0x64,0x54,0xD4,0xC4,0x44,0x44,0x44,0x54,0x88, + /* 0xE9C0 [?] [6800]*/ + 0x10,0x10,0x13,0x12,0xFB,0x12,0x33,0x38,0x57,0x51,0x92,0x14,0x1B,0x10,0x10,0x10, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x80,0xFC,0x10,0x48,0x44,0xFA,0x40,0x40,0x40, + /* 0xE9C1 [?] [6801]*/ + 0x20,0x20,0x27,0x20,0xFB,0x22,0x2F,0x72,0x6B,0xA0,0xA1,0x23,0x25,0x29,0x21,0x21, + 0x80,0x40,0xFE,0x00,0xF8,0x08,0xFE,0x08,0xF8,0xA4,0x28,0x10,0x10,0x48,0x86,0x00, + /* 0xE9C2 [?] [6802]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x31,0x38,0x57,0x52,0x92,0x12,0x12,0x12,0x12,0x12, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xE9C3 [?] [6803]*/ + 0x22,0x14,0xFF,0x08,0x49,0x49,0x7F,0x08,0x10,0x21,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x94,0x08,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE9C4 [?] [6804]*/ + 0x10,0x10,0x13,0x12,0xFC,0x11,0x31,0x39,0x55,0x51,0x91,0x17,0x10,0x10,0x11,0x12, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xE9C5 [?] [6805]*/ + 0x10,0x10,0x13,0x12,0xFC,0x10,0x31,0x38,0x54,0x51,0x92,0x10,0x10,0x10,0x10,0x10, + 0x40,0x20,0xFE,0x02,0x50,0x88,0x24,0x50,0x88,0x04,0xFA,0x88,0x88,0x88,0xF8,0x88, + /* 0xE9C6 [?] [6806]*/ + 0x20,0x24,0x22,0x22,0xF8,0x21,0x2E,0x72,0x6A,0xA3,0xA2,0x22,0x22,0x23,0x22,0x20, + 0x20,0x20,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x44,0x44,0x7C,0xC4,0x44,0x7C,0x44, + /* 0xE9C7 [?] [6807]*/ + 0x20,0x23,0x22,0x22,0xFB,0x22,0x22,0x72,0x6A,0xA2,0xA2,0x22,0x22,0x24,0x24,0x28, + 0x00,0xFE,0x02,0x02,0xFE,0x10,0x92,0x54,0xFE,0x82,0xFE,0x82,0xFE,0x82,0x8A,0x84, + /* 0xE9C8 [?] [6808]*/ + 0x10,0x10,0x17,0x10,0xFC,0x10,0x31,0x39,0x55,0x50,0x93,0x10,0x11,0x10,0x17,0x10, + 0x88,0x88,0xFE,0x88,0xF8,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00, + /* 0xE9C9 [?] [6809]*/ + 0x10,0x10,0x13,0x10,0xFD,0x10,0x33,0x38,0x55,0x55,0x91,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0xFE,0x20,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x74,0x54,0x74,0x04,0xFC,0x04, + /* 0xE9CA [?] [6810]*/ + 0x20,0x20,0x20,0x27,0xFC,0x24,0x24,0x74,0x6F,0xA4,0xA4,0x25,0x2A,0x28,0x31,0x20, + 0x14,0x12,0x10,0xFE,0x10,0x90,0xD2,0x92,0xF2,0x94,0x94,0xC8,0xAA,0x9A,0xA6,0x42, + /* 0xE9CB [?] [6811]*/ + 0x11,0x10,0x13,0x12,0xFD,0x10,0x31,0x38,0x55,0x50,0x93,0x10,0x10,0x10,0x10,0x10, + 0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFC,0x00,0xFE,0x80,0xFC,0x04,0x28,0x10, + /* 0xE9CC [?] [6812]*/ + 0x10,0x11,0x10,0x13,0xFE,0x10,0x30,0x38,0x54,0x54,0x90,0x11,0x10,0x10,0x13,0x10, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xE9CD [?] [6813]*/ + 0x28,0x11,0x28,0x4B,0x98,0x29,0x4E,0x88,0x28,0x10,0x01,0x7F,0x05,0x19,0xE1,0x01, + 0x22,0xFC,0x28,0xFE,0x40,0xFC,0x84,0xFC,0x84,0xFC,0x00,0xFC,0x40,0x30,0x0E,0x00, + /* 0xE9CE [?] [6814]*/ + 0x22,0x22,0x27,0x24,0xF9,0x27,0x25,0x75,0x6F,0xA5,0xA5,0x27,0x25,0x25,0x24,0x28, + 0x04,0x04,0x84,0x94,0x0C,0xC4,0x64,0x54,0xC4,0x46,0x7C,0xC4,0x44,0x44,0x44,0xC4, + /* 0xE9CF [?] [6815]*/ + 0x20,0x27,0x20,0x21,0xFF,0x24,0x24,0x77,0x6C,0xA7,0xA4,0x24,0x27,0x2C,0x20,0x20, + 0x08,0x88,0x88,0x10,0xDE,0x94,0xA4,0x94,0x94,0x94,0x94,0xC8,0x88,0x94,0xA4,0xC2, + /* 0xE9D0 [?] [6816]*/ + 0x21,0x21,0x21,0x27,0xF9,0x21,0x2F,0x71,0x69,0xA5,0xA5,0x25,0x27,0x25,0x24,0x28, + 0x14,0x12,0x12,0x90,0x7E,0x50,0xD4,0x54,0x54,0x48,0xEA,0x56,0x22,0x00,0xFE,0x00, + /* 0xE9D1 [?] [6817]*/ + 0x24,0xFF,0x24,0x7E,0x82,0x7A,0x4A,0x7A,0x04,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x20,0x20,0x3E,0x44,0x84,0x28,0x10,0x28,0x44,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xE9D2 [?] [6818]*/ + 0x01,0x7F,0x11,0x1F,0x01,0xFF,0x80,0x3F,0x04,0x1F,0x68,0x0F,0x01,0xFF,0x09,0x71, + 0x00,0xFC,0x10,0xF0,0x00,0xFE,0x02,0xF8,0x00,0xF0,0x10,0xF0,0x00,0xFE,0x20,0x1C, + /* 0xE9D3 [?] [6819]*/ + 0x20,0x2F,0x28,0x2A,0xF9,0x2B,0x28,0x78,0x6A,0xAA,0xAB,0x28,0x28,0x29,0x29,0x32, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xE9D4 [?] [6820]*/ + 0x10,0x10,0x11,0x11,0xFB,0x15,0x31,0x39,0x55,0x51,0x91,0x11,0x11,0x12,0x12,0x14, + 0x90,0x88,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0xA4,0x52,0x52, + /* 0xE9D5 [?] [6821]*/ + 0x10,0x10,0x10,0x11,0xFE,0x10,0x31,0x39,0x55,0x50,0x93,0x12,0x12,0x12,0x12,0x12, + 0x20,0x50,0x88,0x24,0xFA,0x50,0x24,0x54,0xFC,0x20,0xFE,0x42,0x92,0xFA,0x0A,0x06, + /* 0xE9D6 [?] [6822]*/ + 0x10,0x10,0x11,0x13,0xFD,0x11,0x39,0x35,0x50,0x53,0x90,0x11,0x11,0x11,0x11,0x11, + 0x80,0xF8,0x10,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC, + /* 0xE9D7 [?] [6823]*/ + 0x10,0x10,0x13,0x10,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x13,0x11,0x10,0x10,0x10, + 0x88,0x50,0xFE,0x50,0xFC,0x54,0x8C,0x74,0x04,0xFC,0x08,0xFE,0x08,0x88,0xA8,0x10, + /* 0xE9D8 [?] [6824]*/ + 0x20,0x23,0x22,0x23,0xFA,0x22,0x22,0x72,0x6A,0xA2,0xA2,0x22,0x22,0x25,0x24,0x28, + 0x00,0xFE,0x02,0xFE,0x10,0x54,0x38,0x54,0x82,0x50,0x7C,0x90,0x10,0xFE,0x10,0x10, + /* 0xE9D9 [?] [6825]*/ + 0x10,0x13,0x10,0x10,0xFB,0x10,0x30,0x3B,0x54,0x53,0x92,0x12,0x13,0x12,0x12,0x12, + 0x00,0xFC,0x48,0x30,0xFE,0x52,0x94,0x50,0x20,0xFE,0x52,0x8A,0x76,0x52,0x72,0x06, + /* 0xE9DA [?] [6826]*/ + 0x22,0x22,0x24,0x25,0xF9,0x2E,0x22,0x74,0x68,0xAF,0xA0,0x20,0x23,0x2C,0x20,0x20, + 0x20,0x3C,0x44,0x78,0x08,0xFE,0x20,0xD2,0x1A,0x2C,0xCC,0x1A,0x2A,0xC8,0x28,0x10, + /* 0xE9DB [?] [6827]*/ + 0x10,0x11,0x10,0x13,0xFA,0x11,0x30,0x39,0x54,0x51,0x91,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC, + /* 0xE9DC [?] [6828]*/ + 0x11,0x11,0x12,0x17,0xFA,0x13,0x33,0x3A,0x56,0x52,0x92,0x12,0x12,0x14,0x14,0x18, + 0x00,0xF8,0x08,0xFE,0x88,0x24,0xFE,0x00,0xFC,0x00,0xFC,0x00,0xFC,0x84,0xFC,0x84, + /* 0xE9DD [?] [6829]*/ + 0x10,0x13,0x10,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x90,0x11,0x10,0x13,0x11,0x12, + 0x20,0xFE,0x00,0xFC,0x04,0x74,0x54,0x74,0x04,0xFC,0x00,0xFC,0x00,0xFE,0x24,0x62, + /* 0xE9DE [?] [6830]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3C,0x01,0x7F,0x05,0x19,0xE1,0x01, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xFC,0x40,0x30,0x0E,0x00, + /* 0xE9DF [?] [6831]*/ + 0x20,0x20,0x27,0x24,0xFA,0x23,0x34,0x6A,0x65,0xA2,0xA4,0x2B,0x20,0x22,0x24,0x20, + 0x80,0x40,0xFE,0x02,0x24,0xBC,0xA4,0xA8,0x10,0xE8,0x04,0xFA,0x40,0x48,0x44,0xC0, + /* 0xE9E0 [?] [6832]*/ + 0x22,0x12,0x14,0xFF,0x14,0x14,0x7F,0x55,0x55,0x63,0x41,0x7F,0x41,0x41,0x7F,0x41, + 0x10,0x14,0x12,0x92,0x10,0xFE,0x10,0x10,0x10,0x28,0x28,0x28,0x44,0x44,0x84,0x02, + /* 0xE9E1 [?] [6833]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x20,0x3E,0x42,0x87,0x01,0x7F,0x02,0x04,0x18,0xE0, + 0x20,0x20,0x3E,0x44,0x84,0x28,0x10,0x28,0x44,0x22,0x10,0xFC,0x80,0x40,0x30,0x0E, + /* 0xE9E2 [?] [6834]*/ + 0x00,0x00,0xFC,0x20,0x20,0x3D,0x46,0x45,0x64,0x94,0x08,0x08,0x10,0x20,0x40,0x83, + 0x00,0xF8,0x88,0x88,0x88,0x06,0x00,0xFC,0x84,0x84,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xE9E3 [?] [6835]*/ + 0x00,0x01,0xFD,0x21,0x21,0x3D,0x45,0x45,0x65,0x95,0x09,0x09,0x11,0x21,0x47,0x80, + 0x00,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0x08,0xFE,0x00, + /* 0xE9E4 [?] [6836]*/ + 0x00,0x00,0xFC,0x21,0x22,0x3C,0x44,0x44,0x65,0x94,0x08,0x09,0x12,0x24,0x40,0x81, + 0x80,0x80,0xFE,0x00,0xF8,0x10,0x20,0x40,0xFC,0x94,0x94,0x24,0x24,0x44,0xA8,0x10, + /* 0xE9E5 [?] [6837]*/ + 0x00,0x00,0xFC,0x20,0x21,0x3E,0x44,0x44,0x65,0x94,0x08,0x08,0x11,0x20,0x40,0x83, + 0x20,0x20,0x50,0x88,0x04,0x12,0x20,0x40,0x88,0x10,0x20,0x44,0x88,0x10,0x60,0x80, + /* 0xE9E6 [?] [6838]*/ + 0x00,0x00,0xFC,0x20,0x20,0x3C,0x45,0x45,0x65,0x95,0x09,0x09,0x10,0x20,0x40,0x83, + 0x00,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xE9E7 [?] [6839]*/ + 0x00,0x00,0xFC,0x20,0x20,0x3D,0x46,0x44,0x64,0x94,0x09,0x08,0x10,0x20,0x43,0x80, + 0x20,0x20,0x50,0x50,0x88,0x04,0xFA,0x00,0x44,0x24,0x24,0xA8,0x88,0x10,0xFE,0x00, + /* 0xE9E8 [?] [6840]*/ + 0x00,0x00,0xFD,0x20,0x21,0x3C,0x44,0x45,0x64,0x94,0x0B,0x08,0x10,0x20,0x40,0x80, + 0x08,0x3C,0xC0,0x04,0x44,0xA8,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xE9E9 [?] [6841]*/ + 0x01,0x00,0xFC,0x21,0x21,0x3D,0x45,0x45,0x65,0x95,0x08,0x08,0x13,0x20,0x40,0x80, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xE9EA [?] [6842]*/ + 0x00,0x03,0xF8,0x20,0x20,0x3B,0x4A,0x4A,0x6A,0x9A,0x0B,0x10,0x10,0x20,0x47,0x80, + 0x00,0xFC,0x08,0x10,0x20,0xAE,0xA2,0xAA,0xA4,0xA4,0xAA,0x32,0xA0,0x40,0xFE,0x00, + /* 0xE9EB [?] [6843]*/ + 0x00,0x00,0xFB,0x22,0x24,0x39,0x49,0x49,0x69,0x99,0x09,0x17,0x10,0x20,0x41,0x82, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xE9EC [?] [6844]*/ + 0x00,0x03,0xF8,0x21,0x20,0x3B,0x4A,0x49,0x68,0x99,0x09,0x11,0x11,0x20,0x43,0x80, + 0x20,0xFE,0x20,0xFC,0x00,0xFE,0x02,0xFC,0x00,0xFC,0x04,0xFC,0x04,0x88,0xFE,0x00, + /* 0xE9ED [?] [6845]*/ + 0x10,0x10,0x10,0xFE,0x20,0x28,0x48,0x7E,0x08,0x09,0x0E,0xF8,0x48,0x08,0x09,0x0A, + 0x00,0x00,0xFC,0x24,0x24,0xA4,0xA4,0xA4,0xA4,0x24,0x24,0x44,0x44,0x84,0x28,0x10, + /* 0xE9EE [?] [6846]*/ + 0x20,0x21,0x21,0xFD,0x41,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x11,0x12,0x14, + 0x00,0xFE,0x00,0x00,0x78,0x48,0x48,0x48,0x48,0x68,0x50,0x42,0x42,0x42,0x3E,0x00, + /* 0xE9EF [?] [6847]*/ + 0x10,0x10,0x10,0xFE,0x21,0x28,0x48,0x7E,0x08,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xE9F0 [?] [6848]*/ + 0x20,0x20,0x21,0xFC,0x40,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x50,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xE9F1 [?] [6849]*/ + 0x20,0x20,0x20,0xFC,0x40,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x12,0x12,0x14, + 0x20,0x20,0x3E,0x20,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x00,0x00,0x00, + /* 0xE9F2 [?] [6850]*/ + 0x20,0x20,0x21,0xFD,0x41,0x51,0x91,0xFD,0x11,0x11,0x1C,0xF0,0x50,0x11,0x12,0x14, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x90,0x88,0x04,0x02,0x02, + /* 0xE9F3 [?] [6851]*/ + 0x20,0x20,0x21,0xFD,0x41,0x51,0x92,0xFC,0x13,0x10,0x1C,0xF0,0x50,0x10,0x11,0x12, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xE9F4 [?] [6852]*/ + 0x20,0x20,0x20,0xFC,0x41,0x52,0x90,0xFC,0x11,0x10,0x1C,0xF0,0x51,0x10,0x10,0x13, + 0x20,0x20,0x50,0x88,0x04,0x12,0x20,0x40,0x88,0x10,0x20,0x44,0x88,0x10,0x60,0x80, + /* 0xE9F5 [?] [6853]*/ + 0x20,0x20,0x23,0xFC,0x41,0x50,0x90,0xFC,0x13,0x10,0x1C,0xF0,0x50,0x10,0x10,0x10, + 0x08,0x3C,0xE0,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xE9F6 [?] [6854]*/ + 0x20,0x20,0x21,0xFD,0x41,0x51,0x91,0xFD,0x10,0x10,0x1C,0xF0,0x51,0x12,0x10,0x10, + 0x08,0x1C,0xE0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xE9F7 [?] [6855]*/ + 0x10,0x11,0x10,0xFE,0x20,0x28,0x48,0x7E,0x09,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x94,0x88,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xE9F8 [?] [6856]*/ + 0x20,0x20,0x20,0xFC,0x41,0x50,0x90,0xFD,0x10,0x10,0x1C,0xF0,0x50,0x13,0x10,0x10, + 0x10,0x14,0x12,0x10,0xFE,0x10,0x10,0xD0,0x90,0x90,0x90,0x88,0xEA,0x8A,0x06,0x02, + /* 0xE9F9 [?] [6857]*/ + 0x10,0x10,0x10,0xFE,0x20,0x28,0x48,0x7E,0x08,0x08,0x0E,0xF8,0x48,0x08,0x09,0x08, + 0x00,0xFE,0x10,0x20,0x44,0x82,0xFE,0x12,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xE9FA [?] [6858]*/ + 0x20,0x20,0x20,0xFC,0x41,0x52,0x91,0xFC,0x10,0x10,0x1D,0xF0,0x50,0x10,0x13,0x10, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xE9FB [?] [6859]*/ + 0x10,0x10,0x10,0xFE,0x21,0x28,0x48,0x7E,0x09,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xE9FC [?] [6860]*/ + 0x20,0x23,0x21,0xFD,0x41,0x51,0x91,0xFD,0x11,0x11,0x1D,0xF1,0x51,0x13,0x10,0x10, + 0x00,0xFE,0x20,0x28,0x28,0xE8,0x28,0x28,0x28,0xE8,0x28,0x2A,0x3A,0xEA,0x26,0x20, + /* 0xE9FD [?] [6861]*/ + 0x08,0x08,0x7E,0x08,0xFE,0x14,0x22,0x42,0xBF,0x05,0x09,0x1F,0x01,0xFF,0x01,0x01, + 0x20,0x20,0xFC,0x20,0xFE,0x50,0x88,0x06,0xF8,0x00,0x00,0xF0,0x00,0xFE,0x00,0x00, + /* 0xE9FE [?] [6862]*/ + 0x20,0x23,0x22,0xFA,0x42,0x53,0x92,0xFE,0x13,0x12,0x1E,0xF2,0x52,0x12,0x12,0x12, + 0x00,0xFE,0x02,0x8A,0x52,0xFE,0x42,0x22,0xFE,0x82,0x82,0x82,0xFA,0x02,0x0A,0x04, + /* 0xEAA1 [?] [6863]*/ + 0x20,0x23,0x20,0xFD,0x40,0x51,0x92,0xFC,0x10,0x13,0x1C,0xF1,0x50,0x11,0x12,0x14, + 0x00,0xDE,0x42,0x4A,0x84,0x4A,0x52,0x20,0x00,0xDE,0x52,0x52,0x94,0x48,0x54,0x22, + /* 0xEAA2 [?] [6864]*/ + 0x20,0x20,0x21,0xFA,0x41,0x50,0x90,0xFC,0x11,0x11,0x1D,0xF1,0x51,0x11,0x11,0x11, + 0x92,0x92,0x24,0x48,0x24,0x92,0x92,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xEAA3 [?] [6865]*/ + 0x20,0x20,0x23,0xFC,0x41,0x50,0x93,0xFC,0x11,0x12,0x1C,0xF1,0x50,0x10,0x10,0x13, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x20,0xFC,0x20,0x50,0x88,0x04, + /* 0xEAA4 [?] [6866]*/ + 0x20,0x20,0x23,0xFA,0x42,0x53,0x92,0xFE,0x13,0x12,0x1E,0xF2,0x52,0x14,0x14,0x18, + 0x40,0x20,0xFE,0x50,0x50,0xFE,0x52,0x52,0xFE,0x00,0x92,0xD4,0x98,0x92,0xD2,0x8E, + /* 0xEAA5 [?] [6867]*/ + 0x20,0x21,0x20,0xFB,0x20,0x41,0x52,0x91,0xF9,0x11,0x1A,0xF5,0x50,0x11,0x12,0x14, + 0x20,0x24,0xA8,0xFE,0xA8,0x24,0x22,0x04,0x04,0xDE,0x44,0x54,0x9E,0x04,0x04,0x04, + /* 0xEAA6 [?] [6868]*/ + 0x01,0x7F,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x01,0xFF,0x01,0x3F,0x20,0x20,0x3F,0x20, + 0x00,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xEAA7 [?] [6869]*/ + 0x02,0x02,0x02,0x02,0x7F,0x02,0x02,0x02,0xFF,0x02,0x01,0x01,0x01,0x0E,0x70,0x00, + 0x40,0x20,0x20,0xFC,0x00,0x00,0x00,0x3E,0xC0,0x10,0x20,0x40,0x84,0x44,0x34,0x0C, + /* 0xEAA8 [?] [6870]*/ + 0x08,0x08,0x14,0x12,0x21,0x40,0xBE,0x22,0x22,0x22,0x2A,0x24,0x21,0x21,0x1F,0x00, + 0x28,0x24,0x24,0x20,0x2E,0xF0,0x20,0x24,0x24,0x28,0x28,0x10,0x12,0x2A,0x46,0x82, + /* 0xEAA9 [?] [6871]*/ + 0x7F,0x02,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x02,0x03,0x7E,0x01,0x00,0x07,0x38, + 0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x40,0xF8,0x20,0x40,0x84,0x64,0x1C, + /* 0xEAAA [?] [6872]*/ + 0x08,0x08,0xFF,0x08,0x7F,0x41,0x7F,0x41,0x7F,0x49,0x08,0xFF,0x08,0x08,0x08,0x09, + 0x20,0x28,0xA4,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x90,0x32,0x4A,0x86,0x02, + /* 0xEAAB [?] [6873]*/ + 0x3F,0x21,0x21,0x3F,0x00,0xFF,0x21,0x3F,0x21,0x3F,0x21,0x27,0xF9,0x41,0x01,0x01, + 0x28,0x24,0x24,0x20,0x20,0xFE,0x20,0x24,0x24,0x28,0x28,0xD0,0x12,0x2A,0x46,0x82, + /* 0xEAAC [?] [6874]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x22,0x3F,0x22,0x22,0xFF,0x40,0x54,0x62,0x40,0x7E,0x01, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xEAAD [?] [6875]*/ + 0x00,0x7E,0x42,0x7E,0x42,0x7E,0x09,0x48,0x7F,0x88,0x7E,0x08,0x0F,0xF0,0x40,0x01, + 0x20,0x28,0x24,0x24,0x20,0x3E,0xE0,0x24,0x24,0x28,0x28,0x10,0x32,0x4A,0x86,0x02, + /* 0xEAAE [?] [6876]*/ + 0x00,0x7E,0x22,0x24,0x3F,0x55,0x49,0x55,0xA2,0x00,0x7F,0x55,0x55,0x57,0xFC,0x00, + 0x10,0x14,0x12,0x10,0x16,0x78,0x12,0x12,0x12,0x14,0x14,0x08,0x1A,0xAA,0x46,0x82, + /* 0xEAAF [?] [6877]*/ + 0x00,0x7F,0x12,0x52,0x33,0x12,0xFF,0x00,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21, + 0x10,0x94,0x12,0x90,0x16,0x78,0xD2,0x12,0x12,0x14,0x14,0x08,0x1A,0x2A,0x46,0x82, + /* 0xEAB0 [?] [6878]*/ + 0x00,0x00,0x5F,0x50,0x57,0x75,0x15,0x17,0xF4,0x54,0x57,0x55,0x95,0x27,0x20,0x40, + 0x28,0x24,0xFE,0x20,0xA0,0x20,0x20,0xA4,0xA4,0xA8,0xA8,0x10,0x12,0xAA,0x46,0x82, + /* 0xEAB1 [?] [6879]*/ + 0x00,0x7E,0x40,0x44,0x64,0x54,0x48,0x48,0x54,0x54,0x64,0x40,0x40,0x7E,0x00,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xEAB2 [?] [6880]*/ + 0x10,0x10,0x28,0x24,0x42,0x91,0x08,0x08,0xFE,0x02,0x44,0x28,0x10,0x08,0x08,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xEAB3 [?] [6881]*/ + 0x10,0x08,0x7F,0x00,0x22,0x14,0xFF,0x00,0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x00, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xEAB4 [?] [6882]*/ + 0x08,0x7F,0x08,0x3E,0x00,0x3E,0x22,0x3E,0x14,0x7F,0x00,0x7F,0x08,0x0F,0x11,0x1C, + 0x04,0x08,0x10,0x64,0x08,0x10,0x64,0x08,0x10,0x60,0x00,0xFC,0x00,0xE0,0x24,0x9C, + /* 0xEAB5 [?] [6883]*/ + 0x44,0x24,0x28,0xFE,0x92,0xD6,0xBA,0x92,0xFE,0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44, + 0x00,0xFC,0x40,0x40,0x40,0x78,0x48,0x48,0xA8,0x98,0x88,0x88,0xAA,0xCA,0x8A,0x06, + /* 0xEAB6 [?] [6884]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3C,0x00,0x7F,0x08,0x0F,0x11,0x1C, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xFC,0x00,0xE0,0x24,0x9C, + /* 0xEAB7 [?] [6885]*/ + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x3F,0x10,0x08,0x04,0x02,0x01,0x06,0x18,0xE0, + 0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0xC0,0x30,0x0E, + /* 0xEAB8 [?] [6886]*/ + 0x02,0x02,0x3F,0x04,0x08,0x30,0xC0,0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x00,0xE0,0x20,0x22,0x22,0x1E,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xEAB9 [?] [6887]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x02,0x02,0x7F,0x04,0x04,0x08,0x10,0x60, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xE0,0x20,0x20,0x22,0x22,0x1E, + /* 0xEABA [?] [6888]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7D,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xEABB [?] [6889]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x00,0x3F,0x01,0x01,0xFF,0x02,0x04,0x18,0xE0, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x30,0x0E, + /* 0xEABC [?] [6890]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x00,0x00,0xFF,0x04,0x08,0x10,0x3F,0x10, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xF8,0x00,0x00,0xFE,0x00,0x20,0x10,0xF8,0x08, + /* 0xEABD [?] [6891]*/ + 0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x01,0x01,0x7F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xFC,0x80,0x40,0x20,0x18,0x06,0x00, + /* 0xEABE [?] [6892]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x20,0x20,0x21,0x21,0x22,0x44,0x48,0x90, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x80,0x80,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xEABF [?] [6893]*/ + 0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0x7C,0x45,0x01,0x02, + 0x04,0x0E,0xF0,0x80,0x80,0x80,0xFE,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xEAC0 [?] [6894]*/ + 0x00,0x00,0x7C,0x44,0x45,0x46,0x44,0x7C,0x44,0x44,0x44,0x44,0x7D,0x44,0x00,0x00, + 0x40,0x40,0x80,0xFC,0x04,0x04,0x84,0x44,0x44,0x14,0x24,0x44,0x84,0x04,0x28,0x10, + /* 0xEAC1 [?] [6895]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x01,0x11,0x11,0x22,0x04,0x08,0x30,0xC0, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x08,0x10,0x80,0x40,0x20,0x18,0x06, + /* 0xEAC2 [?] [6896]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x08,0x08,0x1F,0x21,0x52,0x94,0x10,0x1F,0x00,0x00, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x00,0xFC,0x04,0x84,0x44,0x04,0x84,0x28,0x10, + /* 0xEAC3 [?] [6897]*/ + 0x10,0x10,0x3E,0x22,0x54,0x08,0x17,0x20,0xDF,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x40,0x40,0x50,0x48,0x44,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xEAC4 [?] [6898]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x0C,0x70,0x44,0x44,0x5C,0x64,0x48,0x10,0x60, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0x00,0xFC,0x84,0x84,0x84,0x94,0x88,0x80,0x80, + /* 0xEAC5 [?] [6899]*/ + 0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x02,0x01,0x01,0x7F,0x00,0x10,0x08,0x04,0xFF, + 0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0x00,0xFC,0x00,0x10,0x20,0x40,0xFE, + /* 0xEAC6 [?] [6900]*/ + 0x08,0x04,0x02,0x3C,0x04,0x04,0x75,0x16,0x16,0x15,0x25,0x24,0x44,0x84,0x14,0x08, + 0x00,0x00,0x7C,0x44,0x44,0xC4,0x7C,0x44,0x44,0x44,0x7C,0x80,0x40,0x30,0x0E,0x00, + /* 0xEAC7 [?] [6901]*/ + 0x00,0x01,0x79,0x49,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x49,0x79,0x4A,0x02,0x04, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xEAC8 [?] [6902]*/ + 0x02,0x3F,0x02,0xFF,0x02,0x0C,0x3F,0xC8,0x07,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x08,0xD0,0x20,0xFE,0x00,0x70,0x84,0x04,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xEAC9 [?] [6903]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x00,0x3F,0x20,0x20,0x3E,0x22,0x22,0x2A,0x44,0x41,0x86, + 0xF0,0x10,0xF0,0x10,0xF0,0x88,0xFC,0x80,0x88,0x88,0x50,0x50,0x24,0x54,0x8C,0x04, + /* 0xEACA [?] [6904]*/ + 0x00,0x00,0x79,0x49,0x4B,0x4D,0x49,0x79,0x49,0x48,0x4B,0x48,0x78,0x48,0x00,0x00, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xEACB [?] [6905]*/ + 0x00,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x24,0x14,0x0C,0x14,0x64,0x08,0x10,0x60, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x48,0x50,0x60,0x50,0x48,0x42,0x42,0x3E, + /* 0xEACC [?] [6906]*/ + 0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0x7F,0x42,0x02,0xFF,0x08,0x1C,0x03,0x0C,0x70, + 0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x04,0x00,0xFE,0x20,0x40,0x80,0x70,0x08, + /* 0xEACD [?] [6907]*/ + 0x00,0x03,0x7A,0x4C,0x48,0x4B,0x48,0x78,0x49,0x49,0x48,0x48,0x7B,0x48,0x00,0x00, + 0x00,0xFE,0x02,0x44,0x40,0xFC,0x80,0xA0,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xEACE [?] [6908]*/ + 0x00,0x00,0x7B,0x48,0x48,0x4B,0x4A,0x7A,0x4B,0x4A,0x4A,0x4B,0x7A,0x4A,0x02,0x02, + 0x48,0x44,0xFE,0x40,0x40,0xFC,0x44,0x44,0xFC,0x44,0x44,0xFC,0x44,0x44,0x54,0x08, + /* 0xEACF [?] [6909]*/ + 0x00,0x00,0x78,0x49,0x4A,0x4C,0x49,0x78,0x48,0x48,0x4B,0x4A,0x7A,0x4A,0x03,0x02, + 0x40,0x40,0xA0,0x10,0x88,0x46,0xF0,0x10,0x20,0x40,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xEAD0 [?] [6910]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x08,0x1F,0x22,0x54,0x08,0x37,0xC0,0x1F,0x10,0x10,0x1F, + 0xF0,0x10,0xF0,0x10,0xF0,0x40,0x60,0x50,0x48,0x40,0xFE,0x00,0xF0,0x10,0x10,0xF0, + /* 0xEAD1 [?] [6911]*/ + 0x00,0x00,0x7B,0x4A,0x4C,0x49,0x48,0x79,0x49,0x49,0x49,0x49,0x79,0x48,0x03,0x00, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xEAD2 [?] [6912]*/ + 0x00,0x03,0x78,0x4A,0x49,0x48,0x49,0x7A,0x48,0x48,0x4B,0x48,0x78,0x48,0x01,0x02, + 0x10,0xD4,0x58,0x52,0x8C,0x88,0x04,0xFA,0x20,0x20,0xFE,0x20,0x50,0x88,0x04,0x02, + /* 0xEAD3 [?] [6913]*/ + 0x00,0x03,0x78,0x4A,0x49,0x4B,0x7A,0x48,0x4B,0x48,0x48,0x79,0x49,0x02,0x04,0x01, + 0x0E,0xF0,0x44,0x24,0x08,0xFE,0x42,0x40,0xFE,0x80,0xFC,0x44,0x28,0x10,0x68,0x86, + /* 0xEAD4 [?] [6914]*/ + 0x00,0x03,0x7A,0x48,0x49,0x49,0x49,0x79,0x49,0x48,0x48,0x4B,0x78,0x48,0x01,0x02, + 0x00,0xFE,0x02,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xFE,0x00,0x88,0x04,0x02, + /* 0xEAD5 [?] [6915]*/ + 0x02,0x01,0xF7,0x90,0x97,0x94,0x97,0xF0,0x97,0x90,0x91,0x91,0xF7,0x91,0x05,0x02, + 0x08,0x08,0xC8,0x10,0x9E,0x94,0xA4,0x14,0x94,0x94,0x14,0xC8,0x08,0x14,0x24,0x42, + /* 0xEAD6 [?] [6916]*/ + 0x00,0x07,0xF0,0x9F,0x90,0x97,0x95,0xF4,0x97,0x90,0x97,0x90,0xFF,0x90,0x05,0x08, + 0x3C,0xC0,0x40,0xFE,0x40,0xFC,0x54,0xE4,0xFC,0x40,0xFC,0x40,0xFE,0x00,0x24,0x92, + /* 0xEAD7 [?] [6917]*/ + 0x00,0x07,0xF0,0x94,0x92,0x94,0x91,0xF2,0x97,0x9A,0x93,0x92,0xF3,0x92,0x03,0x02, + 0x00,0xBC,0x84,0xA4,0x94,0xA4,0x20,0x10,0xFC,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xEAD8 [?] [6918]*/ + 0x01,0x07,0xF0,0x93,0x90,0x97,0x90,0xF3,0x91,0x97,0x93,0x95,0xF3,0x90,0x02,0x01, + 0x10,0xFC,0x40,0xF8,0x40,0xFC,0x00,0xD4,0x12,0xFE,0x50,0x34,0x8C,0x8A,0x96,0x02, + /* 0xEAD9 [?] [6919]*/ + 0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x22,0x3E,0x04,0x3F,0x04,0xFF,0x04,0x1C,0x67, + 0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x88,0xF8,0x40,0xF8,0x40,0xFE,0x90,0x60,0x1C, + /* 0xEADA [?] [6920]*/ + 0x01,0x3F,0x01,0x08,0xFF,0x08,0x00,0x1F,0x10,0x11,0x11,0x11,0x12,0x04,0x18,0x60, + 0x00,0xF8,0x00,0x20,0xFE,0x20,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xEADB [?] [6921]*/ + 0x12,0x12,0xFF,0x12,0x13,0x10,0x1F,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x20,0x20,0xFE,0x20,0xE0,0x00,0xF8,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xEADC [?] [6922]*/ + 0x00,0x7D,0x45,0x45,0x55,0x55,0x55,0x54,0x54,0x54,0x54,0x10,0x28,0x25,0x42,0x84, + 0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x50,0x50,0x50,0x50,0x92,0x92,0x12,0x0E,0x00, + /* 0xEADD [?] [6923]*/ + 0x00,0x7C,0x44,0x54,0x54,0x54,0x55,0x54,0x54,0x54,0x54,0x10,0x28,0x24,0x44,0x80, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xEADE [?] [6924]*/ + 0x10,0x10,0xFB,0x10,0x19,0xF0,0x11,0x52,0x24,0x1F,0x10,0x11,0x11,0x02,0x0C,0x30, + 0x80,0x80,0xF0,0x90,0x90,0x94,0x54,0x0C,0x04,0xF0,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xEADF [?] [6925]*/ + 0x08,0x08,0x2E,0x28,0x28,0x2E,0xF0,0x00,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x80,0x88,0x90,0xE0,0x84,0x84,0x7C,0x00,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xEAE0 [?] [6926]*/ + 0x00,0x7C,0x44,0x47,0x54,0x54,0x54,0x55,0x54,0x54,0x54,0x13,0x28,0x24,0x40,0x83, + 0x20,0x10,0x10,0xFE,0x20,0x42,0x84,0xF8,0x10,0x22,0xC4,0x08,0x10,0x28,0xC4,0x02, + /* 0xEAE1 [?] [6927]*/ + 0x00,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x55,0x55,0x12,0x28,0x24,0x44,0x80, + 0x00,0xFC,0x84,0x84,0xFC,0x90,0x90,0x88,0x84,0x32,0x08,0x00,0x60,0x18,0x04,0x00, + /* 0xEAE2 [?] [6928]*/ + 0x00,0x7D,0x45,0x45,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x11,0x29,0x26,0x42,0x84, + 0x00,0xFE,0x00,0x00,0x7C,0x00,0x00,0xFE,0x50,0x52,0x54,0x48,0x48,0x44,0x52,0x60, + /* 0xEAE3 [?] [6929]*/ + 0x01,0x01,0x7F,0x11,0x09,0xFF,0x05,0x09,0x30,0xDF,0x10,0x11,0x11,0x02,0x0C,0x30, + 0x00,0x00,0xFC,0x10,0x20,0xFE,0x40,0x20,0x18,0xF6,0x10,0x10,0x10,0xC0,0x30,0x08, + /* 0xEAE4 [?] [6930]*/ + 0x00,0x7C,0x44,0x54,0x55,0x54,0x55,0x54,0x54,0x54,0x54,0x11,0x2A,0x24,0x44,0x80, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0xB2,0xB4,0x68,0xA8,0x24,0x22,0x20,0xA0,0x40, + /* 0xEAE5 [?] [6931]*/ + 0x01,0x7F,0x09,0x09,0x15,0x7F,0x40,0x80,0x1F,0x10,0x11,0x11,0x11,0x02,0x0C,0x70, + 0x00,0xFC,0x20,0x20,0x50,0xFE,0x02,0x04,0xF0,0x10,0x10,0x10,0x10,0x60,0x18,0x04, + /* 0xEAE6 [?] [6932]*/ + 0x00,0x7C,0x44,0x45,0x54,0x54,0x57,0x54,0x54,0x54,0x54,0x11,0x28,0x24,0x41,0x82, + 0x20,0xA2,0xA2,0x24,0x50,0x88,0x04,0x22,0x20,0xA4,0xA4,0x28,0x50,0x88,0x04,0x02, + /* 0xEAE7 [?] [6933]*/ + 0x00,0x7C,0x47,0x54,0x55,0x55,0x55,0x55,0x55,0x55,0x54,0x13,0x28,0x24,0x44,0x80, + 0x28,0x24,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x08,0xFE,0x88,0x48,0x48,0x18, + /* 0xEAE8 [?] [6934]*/ + 0x10,0x11,0x11,0x1F,0x11,0x11,0x11,0x11,0x7D,0x45,0x44,0x44,0x44,0x7D,0x46,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xEAE9 [?] [6935]*/ + 0x08,0x49,0x49,0x49,0x7F,0x00,0x7F,0x01,0x01,0x3F,0x20,0x20,0x23,0x2C,0x30,0x01, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x8A,0x06, + /* 0xEAEA [?] [6936]*/ + 0x00,0x00,0x7F,0x08,0x08,0x2A,0x2A,0x2A,0x5D,0x49,0x88,0x08,0x0F,0xF0,0x40,0x01, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x8A,0x06, + /* 0xEAEB [?] [6937]*/ + 0x08,0x08,0x7E,0x08,0x08,0xFF,0x01,0x2A,0x18,0x48,0x28,0xFF,0x14,0x22,0x41,0x81, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x4A,0x86, + /* 0xEAEC [?] [6938]*/ + 0x10,0x28,0x44,0x82,0x7D,0x00,0xF1,0x95,0x95,0xF5,0x95,0x95,0xF5,0x91,0x95,0xB2, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x4A,0x86, + /* 0xEAED [?] [6939]*/ + 0x24,0x24,0xFF,0x24,0x7E,0x24,0xFF,0x08,0x7E,0x4A,0x7E,0x4A,0xFF,0x42,0x4A,0x44, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x4A,0x86, + /* 0xEAEE [?] [6940]*/ + 0x22,0x22,0xFF,0x22,0x3E,0x08,0x7F,0x49,0x7F,0x08,0x7F,0x08,0x7F,0x08,0x0F,0xF0, + 0x00,0x7C,0xC4,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x10,0x28,0x28,0x4A,0x4A,0x86, + /* 0xEAEF [?] [6941]*/ + 0x10,0x1E,0x10,0x7F,0x51,0x5C,0x72,0x4E,0x40,0x4A,0x6A,0x5B,0x4A,0x8F,0x78,0x00, + 0x00,0x7C,0x44,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x90,0x28,0x28,0x4A,0x4A,0x86, + /* 0xEAF0 [?] [6942]*/ + 0x08,0x10,0x30,0x57,0x90,0x10,0x10,0x11,0x09,0x1F,0x21,0x01,0xFF,0x01,0x01,0x01, + 0xA0,0x90,0xBE,0xC0,0x40,0x24,0x14,0x0C,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xEAF1 [?] [6943]*/ + 0x7C,0x04,0x04,0x7C,0x41,0x7D,0x05,0x04,0x2B,0x10,0x11,0x1F,0x21,0xFF,0x01,0x01, + 0xF8,0x88,0xF8,0x20,0xFC,0x24,0xFC,0x28,0xFC,0x04,0x00,0xF8,0x00,0xFE,0x00,0x00, + /* 0xEAF2 [?] [6944]*/ + 0x08,0x08,0x48,0x48,0x7E,0x48,0x88,0x08,0x0E,0xF8,0x48,0x08,0x08,0x08,0x08,0x08, + 0x80,0x80,0x80,0x84,0x88,0x90,0xA0,0xC0,0x80,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xEAF3 [?] [6945]*/ + 0x08,0x08,0x49,0x48,0x7E,0x48,0x89,0x08,0x0E,0xF8,0x4B,0x08,0x08,0x08,0x08,0x08, + 0x08,0x3C,0xE0,0x20,0x20,0x3C,0xE0,0x20,0x20,0x3E,0xE0,0x20,0x22,0x22,0x22,0x1E, + /* 0xEAF4 [?] [6946]*/ + 0x10,0x10,0x50,0x50,0x7D,0x50,0x90,0x10,0x1D,0xF1,0x51,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xEAF5 [?] [6947]*/ + 0x10,0x13,0x50,0x50,0x7D,0x50,0x90,0x13,0x1C,0xF0,0x51,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEAF6 [?] [6948]*/ + 0x10,0x11,0x51,0x51,0x7D,0x52,0x90,0x13,0x1C,0xF0,0x51,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEAF7 [?] [6949]*/ + 0x10,0x10,0x51,0x50,0x7C,0x51,0x93,0x10,0x1D,0xF1,0x51,0x11,0x11,0x10,0x10,0x10, + 0x20,0x20,0xFC,0x50,0x88,0x04,0xFE,0x08,0xE8,0x28,0x28,0xE8,0x28,0x08,0x28,0x10, + /* 0xEAF8 [?] [6950]*/ + 0x10,0x11,0x51,0x51,0x7D,0x51,0x91,0x11,0x1D,0xF1,0x51,0x17,0x10,0x10,0x11,0x12, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x08,0xFE,0x00,0x90,0x08,0x04, + /* 0xEAF9 [?] [6951]*/ + 0x10,0x10,0x57,0x51,0x7D,0x52,0x92,0x17,0x1D,0xF5,0x55,0x12,0x12,0x15,0x18,0x10, + 0x10,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x10,0x00,0xFE,0x00, + /* 0xEAFA [?] [6952]*/ + 0x10,0x10,0x53,0x52,0x7E,0x53,0x92,0x12,0x1F,0xF3,0x53,0x15,0x15,0x15,0x19,0x11, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x54,0x54,0xFC,0x54,0x54,0x44,0x0C, + /* 0xEAFB [?] [6953]*/ + 0x10,0x10,0x53,0x50,0x7D,0x51,0x91,0x10,0x1F,0xF2,0x52,0x12,0x12,0x12,0x12,0x12, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xFA,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xEAFC [?] [6954]*/ + 0x08,0x7F,0x08,0x3E,0x08,0x7F,0x08,0x08,0x3F,0x01,0x3F,0x01,0x7F,0x01,0x05,0x02, + 0x00,0x7C,0x24,0x24,0x24,0x44,0x54,0xF8,0x00,0x00,0xF8,0x00,0xFC,0x00,0x00,0x00, + /* 0xEAFD [?] [6955]*/ + 0x20,0x12,0x44,0x20,0x08,0x73,0x20,0x00,0x3F,0x01,0x3F,0x01,0x7F,0x01,0x05,0x02, + 0x40,0x48,0x44,0x14,0x60,0x80,0x00,0xF0,0x00,0x00,0xF8,0x00,0xFC,0x00,0x00,0x00, + /* 0xEAFE [?] [6956]*/ + 0x10,0x3A,0xE2,0x24,0x24,0xF8,0x20,0x27,0x22,0xFA,0x22,0x24,0x24,0x2A,0x51,0x80, + 0x00,0x86,0xB8,0x88,0x48,0x5E,0x28,0x88,0x88,0xBE,0x88,0x88,0x88,0x88,0x28,0x10, + /* 0xEBA1 [?] [6957]*/ + 0x11,0x39,0xE2,0x22,0x24,0xF8,0x23,0x20,0x20,0xFB,0x22,0x22,0x22,0x23,0x42,0x80, + 0x00,0x06,0xB8,0x88,0x48,0x5E,0x88,0x08,0x08,0xBE,0x88,0x88,0x88,0x88,0xA8,0x10, + /* 0xEBA2 [?] [6958]*/ + 0x3E,0x22,0x3E,0x20,0x7E,0xA2,0x3E,0x22,0x00,0x1F,0x01,0x3F,0x01,0x7F,0x01,0x03, + 0x10,0xFE,0x44,0x28,0xFE,0x10,0xFC,0x10,0x20,0xC0,0x00,0xF8,0x00,0xFC,0x00,0x00, + /* 0xEBA3 [?] [6959]*/ + 0x02,0x3F,0x02,0xFF,0x02,0x0F,0x34,0xC3,0x00,0x01,0x3E,0x03,0x3E,0x03,0x7E,0x01, + 0x20,0xC0,0x80,0xFE,0x20,0xC0,0x08,0xF8,0x00,0xF0,0x00,0xF0,0x00,0xFA,0x02,0xFE, + /* 0xEBA4 [?] [6960]*/ + 0x10,0x38,0xE0,0x21,0x23,0x38,0xE1,0x21,0x21,0x3A,0xE7,0x20,0x20,0x20,0x20,0x1F, + 0x40,0x40,0x90,0x08,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE,0x20,0x22,0x22,0x22,0xFE, + /* 0xEBA5 [?] [6961]*/ + 0x01,0x3E,0x03,0x3E,0x03,0x7E,0x01,0x00,0x18,0x71,0x1C,0x71,0x1C,0x71,0x14,0x18, + 0xF0,0x00,0xF0,0x00,0xFA,0x02,0xFE,0x00,0x30,0xC0,0x78,0xC0,0x78,0xC4,0x44,0x3C, + /* 0xEBA6 [?] [6962]*/ + 0x10,0x38,0xE7,0x21,0x22,0x3A,0xE7,0x21,0x21,0x39,0xE6,0x22,0x25,0x28,0x20,0x1F, + 0x10,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x12,0xFE,0x02,0xFE, + /* 0xEBA7 [?] [6963]*/ + 0x08,0x10,0x24,0x7E,0x10,0xFF,0x24,0x42,0x89,0x30,0xC4,0x08,0x32,0xC4,0x38,0xC0, + 0x08,0x1C,0xE0,0x20,0x20,0x3C,0xE0,0x20,0x20,0x3C,0xE0,0x22,0x22,0x22,0x1E,0x00, + /* 0xEBA8 [?] [6964]*/ + 0x08,0x14,0x22,0x41,0xBE,0x00,0x78,0x4A,0x4A,0x7A,0x4A,0x4A,0x7A,0x48,0x4A,0x59, + 0x04,0x0E,0x70,0x10,0x90,0x1C,0xF0,0x90,0x90,0x9E,0xF0,0x90,0x92,0x92,0x92,0x0E, + /* 0xEBA9 [?] [6965]*/ + 0x08,0x49,0x2A,0x7F,0x41,0x5D,0x55,0x5D,0x42,0x3F,0x01,0x3F,0x01,0x7F,0x01,0x00, + 0x20,0x20,0x3E,0x48,0xA8,0x28,0x10,0x28,0xF6,0x00,0xF0,0x00,0xF8,0x02,0x02,0xFE, + /* 0xEBAA [?] [6966]*/ + 0x11,0x3B,0xE4,0x2B,0x22,0x3B,0xE2,0x27,0x20,0x3B,0xE2,0x23,0x22,0x23,0x20,0x1F, + 0x00,0xF0,0x10,0xF8,0x48,0xF8,0x48,0xFC,0x00,0xF8,0x08,0xF8,0x0A,0xFA,0x02,0xFE, + /* 0xEBAB [?] [6967]*/ + 0x11,0x38,0xE3,0x20,0x22,0x39,0xE0,0x27,0x20,0x39,0xE1,0x21,0x21,0x21,0x20,0x1F, + 0x08,0x90,0xFC,0x90,0x94,0x98,0x90,0xFE,0x00,0xF8,0x08,0xF8,0x0A,0xFA,0x02,0xFE, + /* 0xEBAC [?] [6968]*/ + 0x77,0x55,0x77,0x55,0x77,0x55,0x77,0x22,0x7F,0xA4,0x3F,0x24,0x3F,0x24,0x3F,0x20, + 0x04,0x0E,0x70,0x10,0x10,0x1C,0x70,0x10,0x90,0x1E,0x70,0x10,0x12,0x12,0x92,0x0E, + /* 0xEBAD [?] [6969]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x04,0x04,0x04,0x04,0x08,0x08,0x10,0x20, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x0A,0x0A,0x06,0x02, + /* 0xEBAE [?] [6970]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x00,0x11,0x11,0x11,0x21,0x21,0x41,0x81, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x0A,0x0A,0x06,0x02, + /* 0xEBAF [?] [6971]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x04,0x04,0x44,0x44,0x44,0x7F,0x00,0x00, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x10,0x10,0x50,0x50,0x4A,0xCA,0x46,0x02, + /* 0xEBB0 [?] [6972]*/ + 0x10,0x10,0x3F,0x20,0x4F,0x80,0x3F,0x00,0x24,0x24,0x24,0x24,0x24,0x44,0x44,0x80, + 0x00,0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x90,0x90,0x90,0x8A,0x8A,0x86,0x82, + /* 0xEBB1 [?] [6973]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x10,0x1F,0x20,0x51,0x0E,0x31,0xCC,0x03,0x1C,0x03, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x90,0x10,0x10,0x92,0x6A,0x0A,0x06,0x02, + /* 0xEBB2 [?] [6974]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x7F,0x12,0x12,0x92,0x53,0x52,0x12,0xFF,0x00, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x10,0x50,0x90,0x12,0x0A,0x0A,0xC6,0x02, + /* 0xEBB3 [?] [6975]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x7F,0x44,0x44,0x5F,0x44,0x4A,0x51,0x7F,0x40, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x50,0x50,0x50,0x52,0x4A,0x4A,0xC6,0x42, + /* 0xEBB4 [?] [6976]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x04,0x7F,0x04,0x3F,0x20,0x3F,0x0A,0x12,0x22,0x41, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0xD0,0x10,0x90,0x90,0x92,0x0A,0x4A,0x46,0xC2, + /* 0xEBB5 [?] [6977]*/ + 0x20,0x3F,0x40,0x9F,0x00,0x7F,0x00,0x3F,0x20,0x3F,0x20,0x3F,0x00,0x7F,0x4A,0xFF, + 0x00,0xFC,0x00,0xF0,0x00,0xF0,0x10,0x90,0x90,0x90,0x90,0x92,0x0A,0xCA,0x46,0xE2, + /* 0xEBB6 [?] [6978]*/ + 0x04,0x04,0x04,0x0F,0x08,0x10,0x30,0x48,0x84,0x02,0x01,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x40,0x80,0x00,0x80,0x40,0x20,0x18,0x06, + /* 0xEBB7 [?] [6979]*/ + 0x08,0x08,0xFF,0x08,0x08,0x7F,0x49,0x49,0x7F,0x08,0x1C,0x2A,0x49,0x88,0x08,0x09, + 0x20,0x20,0xA0,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xEBB8 [?] [6980]*/ + 0x08,0x10,0x7E,0x42,0x7E,0x42,0x7E,0x10,0x08,0xFF,0x20,0x3E,0x22,0x42,0x4A,0x85, + 0x20,0x20,0x20,0x3E,0x44,0x44,0x44,0xA4,0x28,0x28,0x10,0x10,0x28,0x48,0x84,0x02, + /* 0xEBB9 [?] [6981]*/ + 0x08,0x48,0x48,0x48,0x48,0x7D,0x40,0x40,0x78,0x48,0x48,0x49,0x48,0x48,0x48,0x89, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x02,0x94,0x50,0x90,0x50,0xFE,0x28,0x44,0x82,0x02, + /* 0xEBBA [?] [6982]*/ + 0x08,0x49,0x49,0x4B,0x49,0x7D,0x41,0x41,0x79,0x48,0x4B,0x48,0x48,0x49,0x4E,0x88, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xEBBB [?] [6983]*/ + 0x08,0x48,0x4B,0x4A,0x4B,0x7E,0x43,0x42,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x4C,0x88, + 0x40,0x20,0xFE,0x02,0xFE,0x14,0xFE,0x10,0xFE,0x92,0xFE,0x92,0xFE,0x92,0x92,0x96, + /* 0xEBBC [?] [6984]*/ + 0x00,0x01,0x7E,0x22,0x11,0x3F,0x02,0x02,0x7F,0x04,0x0F,0x14,0x22,0x41,0x86,0x38, + 0x08,0xFC,0x10,0x10,0x20,0xF8,0x00,0x00,0xFC,0x00,0xE0,0x20,0x40,0x80,0x60,0x1C, + /* 0xEBBD [?] [6985]*/ + 0x04,0x1E,0xE0,0x22,0x92,0x54,0x40,0x04,0xFF,0x04,0x44,0x24,0x24,0x05,0x15,0x0A, + 0x10,0x1E,0x10,0xFE,0x92,0x9C,0xF0,0x92,0x8E,0x80,0xB8,0xA8,0xA8,0x2A,0x2A,0x46, + /* 0xEBBE [?] [6986]*/ + 0x00,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x3F,0x21,0x21,0x21,0x41,0x45,0x82, + 0x04,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04,0x14,0x08, + /* 0xEBBF [?] [6987]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3D,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x00,0xFC,0x00,0x00,0x00,0xFE,0x40,0x40,0x80,0xFC,0x04,0x04,0x04,0x04,0x28,0x10, + /* 0xEBC0 [?] [6988]*/ + 0x00,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x3E,0x22,0x22,0x22,0x42,0x4A,0x84, + 0x04,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x22,0x42,0x04,0x08,0x10,0x20,0xC0, + /* 0xEBC1 [?] [6989]*/ + 0x02,0x01,0xFF,0x10,0x10,0x1F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xEBC2 [?] [6990]*/ + 0x00,0x78,0x48,0x48,0x4B,0x78,0x48,0x48,0x4F,0x78,0x48,0x48,0x48,0x49,0x49,0x9A, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xEBC3 [?] [6991]*/ + 0x00,0x78,0x49,0x48,0x48,0x78,0x4B,0x48,0x48,0x78,0x48,0x48,0x48,0x49,0x49,0x9A, + 0x00,0x00,0xFC,0x00,0x00,0x00,0xFE,0x90,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E, + /* 0xEBC4 [?] [6992]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3D,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0xC8,0x24,0x02, + /* 0xEBC5 [?] [6993]*/ + 0x00,0x78,0x48,0x48,0x4B,0x78,0x48,0x48,0x48,0x79,0x49,0x4A,0x4A,0x4C,0x49,0x98, + 0x40,0x40,0x40,0x40,0xFE,0x40,0x80,0x90,0x90,0x20,0x20,0x48,0x44,0x84,0xFE,0x82, + /* 0xEBC6 [?] [6994]*/ + 0x00,0x78,0x48,0x4B,0x48,0x7A,0x4A,0x4A,0x4A,0x7B,0x48,0x48,0x48,0x48,0x48,0x98, + 0x40,0x40,0x40,0xFC,0x40,0x48,0x48,0x48,0x48,0xF8,0x48,0x40,0x42,0x42,0x3E,0x00, + /* 0xEBC7 [?] [6995]*/ + 0x00,0x3C,0x24,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x89, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xEBC8 [?] [6996]*/ + 0x18,0x06,0x01,0x06,0x3A,0x02,0xFF,0x04,0x0F,0x18,0x2F,0x48,0x8F,0x08,0x08,0x08, + 0x18,0x60,0x80,0x60,0x18,0x00,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xEBC9 [?] [6997]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x25,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x40,0x40,0x40,0x7C,0x84,0x88,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEBCA [?] [6998]*/ + 0x00,0x78,0x48,0x48,0x4B,0x78,0x48,0x48,0x48,0x78,0x49,0x49,0x49,0x4A,0x4A,0x9C, + 0x90,0x88,0x88,0x80,0xFE,0xA0,0xA0,0xA4,0xA4,0xA8,0x28,0x32,0x22,0x62,0x9E,0x00, + /* 0xEBCB [?] [6999]*/ + 0x00,0x78,0x48,0x4F,0x48,0x79,0x49,0x4A,0x4B,0x78,0x49,0x49,0x4A,0x4C,0x48,0x98, + 0x40,0x40,0x40,0xFE,0x80,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xEBCC [?] [7000]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x27,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0xFE,0x40,0x40,0x50,0x48,0x44,0x40,0x40,0x40, + /* 0xEBCD [?] [7001]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x45,0x55,0x8A, + 0x20,0x20,0x3C,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84,0x80,0x80,0x00,0x00,0x00, + /* 0xEBCE [?] [7002]*/ + 0x00,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x24,0x24,0x44,0x54,0x88, + 0x00,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xEBCF [?] [7003]*/ + 0x00,0x3C,0x24,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x44,0x54,0x88, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20, + /* 0xEBD0 [?] [7004]*/ + 0x01,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10, + 0x00,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x50,0x20, + /* 0xEBD1 [?] [7005]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3D,0x26,0x24,0x24,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xEBD2 [?] [7006]*/ + 0x00,0x78,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x79,0x49,0x49,0x49,0x4A,0x4A,0x9C, + 0x08,0x1C,0xF0,0x50,0x50,0x50,0x50,0x50,0x50,0x48,0x48,0x68,0x54,0x74,0x52,0x00, + /* 0xEBD3 [?] [7007]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3E,0x24,0x24,0x25,0x3C,0x24,0x24,0x25,0x44,0x54,0x8B, + 0x20,0x20,0x50,0x88,0x04,0x12,0x20,0x40,0x88,0x10,0x20,0x44,0x88,0x10,0x60,0x80, + /* 0xEBD4 [?] [7008]*/ + 0x00,0x3C,0x25,0x25,0x26,0x3C,0x25,0x25,0x25,0x3D,0x25,0x25,0x24,0x44,0x54,0x88, + 0x80,0x80,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x24,0x04,0x04,0x28,0x10, + /* 0xEBD5 [?] [7009]*/ + 0x00,0x3C,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x89, + 0x04,0x1E,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x08,0x0A,0x4A,0xA6,0x12, + /* 0xEBD6 [?] [7010]*/ + 0x00,0x79,0x48,0x48,0x48,0x78,0x48,0x4B,0x48,0x79,0x48,0x48,0x48,0x48,0x4B,0x98, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xEBD7 [?] [7011]*/ + 0x00,0x78,0x4A,0x49,0x49,0x78,0x4F,0x48,0x48,0x78,0x48,0x48,0x49,0x49,0x4A,0x9C, + 0x40,0x44,0x44,0x48,0x50,0x40,0xFE,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xEBD8 [?] [7012]*/ + 0x00,0x7B,0x4A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x9A, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xF4,0x94,0x94,0x94,0xF4,0x04,0x04,0x14,0x08, + /* 0xEBD9 [?] [7013]*/ + 0x00,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x89, + 0x00,0xFC,0x04,0x24,0x24,0x24,0xFC,0x24,0x24,0x54,0x4C,0x8C,0x04,0x04,0xFC,0x04, + /* 0xEBDA [?] [7014]*/ + 0x00,0x78,0x48,0x48,0x49,0x7A,0x48,0x48,0x48,0x7B,0x48,0x48,0x48,0x49,0x4B,0x99, + 0x20,0x20,0x50,0x88,0x04,0x02,0xF8,0x00,0x00,0xFE,0x20,0x40,0x88,0x04,0xFE,0x02, + /* 0xEBDB [?] [7015]*/ + 0x00,0x79,0x48,0x48,0x48,0x78,0x49,0x48,0x4B,0x78,0x48,0x48,0x49,0x4A,0x48,0x98, + 0x04,0x88,0x50,0x20,0x50,0x88,0x24,0x20,0xFE,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xEBDC [?] [7016]*/ + 0x00,0x78,0x4B,0x48,0x48,0x78,0x49,0x4B,0x48,0x78,0x48,0x49,0x4A,0x48,0x48,0x9B, + 0x40,0x20,0xFE,0x40,0x90,0x90,0x24,0xE4,0x44,0x48,0x88,0x10,0x30,0x48,0x84,0x04, + /* 0xEBDD [?] [7017]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x24,0x44,0x54,0x89, + 0x84,0x48,0x00,0xFC,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xEBDE [?] [7018]*/ + 0x00,0x3C,0x24,0x24,0x25,0x3C,0x24,0x24,0x27,0x3C,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x88,0x48,0x50,0x00,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEBDF [?] [7019]*/ + 0x00,0x3C,0x25,0x24,0x24,0x3C,0x24,0x27,0x24,0x3C,0x24,0x25,0x25,0x46,0x54,0x88, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xEBE0 [?] [7020]*/ + 0x00,0x7B,0x48,0x48,0x49,0x7A,0x48,0x48,0x49,0x7A,0x48,0x48,0x49,0x4A,0x48,0x98, + 0x00,0xFE,0x40,0x80,0x44,0x24,0x68,0xB0,0x30,0x28,0x68,0xA4,0x22,0x20,0xA0,0x40, + /* 0xEBE1 [?] [7021]*/ + 0x00,0x79,0x49,0x49,0x49,0x79,0x48,0x48,0x4B,0x7A,0x4A,0x4A,0x4B,0x4A,0x4A,0x9A, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x52,0x8A,0x0A,0x02,0x0A,0x04, + /* 0xEBE2 [?] [7022]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3D,0x26,0x24,0x24,0x3D,0x24,0x24,0x24,0x44,0x57,0x88, + 0x20,0x20,0xA8,0xA8,0xA8,0x74,0x22,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xEBE3 [?] [7023]*/ + 0x00,0x78,0x4B,0x48,0x4A,0x79,0x48,0x4B,0x48,0x78,0x4F,0x48,0x48,0x48,0x48,0x98, + 0x08,0x3C,0xC0,0x04,0x44,0x28,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xEBE4 [?] [7024]*/ + 0x00,0x78,0x4B,0x4A,0x4C,0x79,0x48,0x48,0x4B,0x78,0x48,0x48,0x49,0x49,0x4A,0x9C, + 0x40,0x20,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xEBE5 [?] [7025]*/ + 0x00,0x7B,0x4A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4D,0x4D,0x4A,0x98, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x20,0x22,0xB2,0xB4,0xA8,0xA8,0x24,0x24,0xA2,0x40, + /* 0xEBE6 [?] [7026]*/ + 0x00,0x78,0x4B,0x48,0x49,0x78,0x4B,0x48,0x49,0x79,0x49,0x49,0x49,0x49,0x49,0x99, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xEBE7 [?] [7027]*/ + 0x00,0x78,0x4B,0x49,0x4A,0x7C,0x4B,0x4A,0x4A,0x7B,0x4A,0x4A,0x4B,0x48,0x48,0x98, + 0x40,0x80,0xFC,0x10,0x48,0x46,0xF8,0x48,0x48,0xF8,0x48,0x48,0xF8,0x42,0x42,0x3E, + /* 0xEBE8 [?] [7028]*/ + 0x00,0x78,0x48,0x4F,0x48,0x78,0x48,0x4B,0x48,0x78,0x48,0x4F,0x48,0x48,0x48,0x98, + 0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x9C,0x90,0x90,0x90,0x9E,0x90,0x90,0x90,0x90, + /* 0xEBE9 [?] [7029]*/ + 0x00,0x3C,0x24,0x25,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x24,0x24,0x44,0x55,0x8A, + 0x20,0x20,0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x24,0x50,0x50,0x88,0x04,0x02, + /* 0xEBEA [?] [7030]*/ + 0x00,0x78,0x4B,0x4A,0x48,0x79,0x48,0x48,0x4B,0x78,0x49,0x49,0x4A,0x4C,0x48,0x98, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xEBEB [?] [7031]*/ + 0x00,0x78,0x4B,0x4A,0x4C,0x78,0x4B,0x48,0x48,0x79,0x49,0x49,0x4A,0x4A,0x4C,0x98, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xEBEC [?] [7032]*/ + 0x00,0x78,0x48,0x4B,0x49,0x79,0x4A,0x4A,0x4F,0x79,0x49,0x4D,0x4A,0x4B,0x4C,0x98, + 0x10,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x10,0x00,0xFE,0x00, + /* 0xEBED [?] [7033]*/ + 0x00,0x78,0x4B,0x48,0x49,0x78,0x4B,0x48,0x49,0x7A,0x48,0x49,0x48,0x48,0x48,0x9B, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x20,0xFC,0x20,0x50,0x88,0x04, + /* 0xEBEE [?] [7034]*/ + 0x00,0x78,0x4B,0x48,0x48,0x7B,0x4A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x4A,0x4A,0x9A, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x8A,0x52,0xFA,0x22,0x22,0xFA,0x22,0x22,0x2A,0x04, + /* 0xEBEF [?] [7035]*/ + 0x00,0x3D,0x24,0x24,0x25,0x3D,0x25,0x25,0x25,0x3D,0x25,0x25,0x25,0x45,0x55,0x89, + 0x00,0xFE,0x20,0x40,0xFC,0x54,0x54,0x74,0x54,0x54,0x74,0x54,0x54,0x54,0xFC,0x04, + /* 0xEBF0 [?] [7036]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3C,0x24,0x24,0x24,0x3D,0x25,0x25,0x25,0x45,0x57,0x88, + 0x00,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xEBF1 [?] [7037]*/ + 0x00,0x3D,0x25,0x25,0x25,0x3C,0x25,0x24,0x25,0x3C,0x24,0x24,0x24,0x44,0x54,0x88, + 0x00,0xDC,0x54,0x54,0xDC,0x00,0xFC,0x00,0xFE,0x80,0xFC,0x04,0x04,0x04,0x28,0x10, + /* 0xEBF2 [?] [7038]*/ + 0x00,0x78,0x49,0x4A,0x4D,0x78,0x4B,0x4A,0x4A,0x7B,0x4A,0x4A,0x4B,0x4A,0x4A,0x9A, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xEBF3 [?] [7039]*/ + 0x00,0x79,0x48,0x48,0x49,0x78,0x4B,0x48,0x49,0x7A,0x4C,0x49,0x48,0x48,0x4B,0x98, + 0x20,0x24,0xA8,0x20,0xFC,0x40,0xFE,0x88,0x24,0x22,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEBF4 [?] [7040]*/ + 0x00,0x79,0x48,0x48,0x49,0x78,0x4B,0x48,0x49,0x7A,0x4D,0x48,0x49,0x48,0x48,0x99, + 0x20,0x24,0xA8,0x20,0xFC,0x40,0xFE,0x88,0x44,0x42,0xFC,0x88,0xD0,0x30,0x48,0x84, + /* 0xEBF5 [?] [7041]*/ + 0x00,0x7B,0x48,0x49,0x49,0x79,0x49,0x48,0x4B,0x7A,0x4A,0x4B,0x4A,0x4A,0x4A,0x9A, + 0x00,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x8A,0x52,0xFE,0x22,0x22,0x2A,0x04, + /* 0xEBF6 [?] [7042]*/ + 0x20,0xFE,0x21,0x3C,0x24,0x44,0x54,0x88,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10, + 0x40,0xFE,0x00,0x1C,0xE0,0x94,0xA8,0xC6,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x50,0x20, + /* 0xEBF7 [?] [7043]*/ + 0x00,0x78,0x4B,0x4A,0x4C,0x79,0x49,0x49,0x49,0x79,0x49,0x4F,0x48,0x48,0x49,0x9A, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xEBF8 [?] [7044]*/ + 0x00,0x79,0x48,0x49,0x48,0x78,0x4B,0x48,0x49,0x7A,0x4D,0x48,0x49,0x4A,0x48,0x98, + 0x20,0x24,0xA8,0xFC,0x20,0x40,0xFE,0x88,0x24,0x22,0x24,0xA8,0x24,0x22,0xA0,0x40, + /* 0xEBF9 [?] [7045]*/ + 0x00,0x78,0x4B,0x4A,0x49,0x7B,0x48,0x48,0x49,0x78,0x48,0x49,0x48,0x48,0x4B,0x98, + 0x40,0x20,0xFE,0x8A,0x04,0xFE,0x40,0x88,0xFC,0x24,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEBFA [?] [7046]*/ + 0x00,0x78,0x49,0x48,0x48,0x7B,0x4A,0x4C,0x49,0x79,0x49,0x48,0x49,0x49,0x49,0x99, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x2C,0x20,0xFC,0x04,0xFC,0x04, + /* 0xEBFB [?] [7047]*/ + 0x00,0x78,0x4F,0x48,0x48,0x7B,0x48,0x4B,0x4A,0x7A,0x4B,0x4A,0x49,0x48,0x4F,0x9A, + 0x88,0x88,0xC8,0xBE,0x88,0xC8,0x1C,0xD4,0x54,0x54,0xD4,0x48,0x88,0xD4,0x14,0x22, + /* 0xEBFC [?] [7048]*/ + 0x00,0x7B,0x48,0x4B,0x4A,0x79,0x48,0x4B,0x48,0x78,0x4B,0x48,0x4B,0x48,0x4B,0x98, + 0x88,0xFE,0x88,0xFE,0x02,0xFC,0x00,0xFE,0x40,0xA2,0x54,0xB8,0x54,0x92,0x50,0x20, + /* 0xEBFD [?] [7049]*/ + 0x00,0x3C,0x24,0x24,0x24,0x3D,0x25,0x25,0x25,0x3C,0x27,0x24,0x24,0x45,0x56,0x88, + 0xF8,0x88,0x88,0xF8,0x00,0xDC,0x54,0x54,0xDC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xEBFE [?] [7050]*/ + 0x00,0x7B,0x48,0x4B,0x4A,0x7A,0x4A,0x4B,0x48,0x79,0x49,0x49,0x49,0x49,0x48,0x9B, + 0x20,0xFE,0x00,0xFC,0x04,0xF4,0x94,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE, + /* 0xECA1 [?] [7051]*/ + 0x00,0x7B,0x4A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4A,0x4D,0x4E,0x98, + 0x20,0xFE,0x88,0x50,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50, + /* 0xECA2 [?] [7052]*/ + 0x00,0x79,0x48,0x4B,0x48,0x79,0x4A,0x49,0x49,0x79,0x4A,0x4D,0x48,0x49,0x4A,0x9C, + 0x20,0x24,0xA8,0xFE,0xA8,0x24,0x22,0x04,0x04,0xDE,0x44,0x54,0x9E,0x04,0x04,0x04, + /* 0xECA3 [?] [7053]*/ + 0x20,0x20,0x20,0x3F,0x20,0x40,0x40,0x7E,0x02,0x02,0x1A,0xE2,0x42,0x02,0x14,0x09, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xECA4 [?] [7054]*/ + 0x42,0x24,0x18,0x24,0x52,0x10,0xFF,0x20,0x28,0x7E,0xAA,0x2A,0x2A,0x2E,0x08,0x09, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xECA5 [?] [7055]*/ + 0x08,0x08,0x7F,0x14,0x22,0x41,0xFF,0x02,0x7A,0x4A,0x4A,0x7A,0x4A,0x02,0x0A,0x04, + 0x20,0x20,0x20,0x3E,0x22,0x44,0x50,0x90,0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, + /* 0xECA6 [?] [7056]*/ + 0x02,0x0F,0x78,0x08,0x08,0xFF,0x28,0x4B,0x49,0x49,0x6B,0x49,0x49,0x7F,0x41,0x01, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xECA7 [?] [7057]*/ + 0x10,0x08,0xFF,0x00,0x42,0x24,0xFF,0x00,0x7E,0x42,0x42,0x7E,0x42,0x42,0x7E,0x43, + 0x20,0x20,0x20,0x7E,0x42,0x84,0x10,0x10,0x10,0x10,0x28,0x28,0x48,0x44,0x84,0x02, + /* 0xECA8 [?] [7058]*/ + 0x08,0x14,0x22,0x5D,0x80,0x3E,0x22,0x3E,0x00,0x77,0x11,0x55,0x33,0x55,0x11,0x33, + 0x20,0x20,0x20,0x3E,0xA2,0x44,0x50,0x90,0x10,0x10,0x10,0x28,0x28,0x44,0x44,0x82, + /* 0xECA9 [?] [7059]*/ + 0x00,0x7C,0x44,0x45,0x46,0x4C,0x6C,0x54,0x54,0x54,0x6C,0x44,0x44,0x42,0x41,0x80, + 0x40,0x40,0xFC,0x04,0xF4,0x94,0xF4,0x84,0x94,0x8A,0x82,0x7E,0x00,0x02,0xFE,0x00, + /* 0xECAA [?] [7060]*/ + 0x20,0x13,0x12,0xFE,0x03,0x0A,0x8A,0x8A,0x4A,0x4A,0x52,0x53,0x1C,0xE4,0x48,0x10, + 0x00,0xF8,0x08,0x08,0x28,0xA8,0xA8,0x48,0x48,0xA8,0xA8,0x2A,0x0A,0x0A,0x06,0x02, + /* 0xECAB [?] [7061]*/ + 0x00,0x7C,0x44,0x44,0x44,0x4C,0x6C,0x54,0x54,0x55,0x6C,0x44,0x44,0x42,0x41,0x80, + 0x00,0xF8,0x88,0xF8,0x88,0xF8,0x88,0xF8,0x88,0xFC,0x00,0x50,0x88,0x02,0xFE,0x00, + /* 0xECAC [?] [7062]*/ + 0x00,0x7D,0x45,0x45,0x45,0x4D,0x6C,0x55,0x54,0x54,0x6C,0x44,0x45,0x42,0x41,0x80, + 0xA0,0x2C,0x24,0xAC,0x24,0xFC,0x20,0xFC,0x04,0xC8,0x30,0x48,0x84,0x02,0xFE,0x00, + /* 0xECAD [?] [7063]*/ + 0x00,0x14,0x10,0xFE,0x28,0x44,0x82,0x24,0x36,0x24,0xFF,0x24,0x54,0x4B,0x89,0x12, + 0x00,0xF8,0x88,0x88,0x88,0x98,0xD8,0xA8,0xA8,0xA8,0xD8,0x8A,0x8A,0x0A,0x06,0x02, + /* 0xECAE [?] [7064]*/ + 0x00,0x7C,0x44,0x45,0x44,0x4C,0x6D,0x54,0x56,0x55,0x6C,0x45,0x46,0x42,0x41,0x80, + 0x20,0xA4,0xA4,0x28,0x50,0x88,0x04,0x88,0xAA,0xDC,0x88,0x54,0x22,0x02,0xFE,0x00, + /* 0xECAF [?] [7065]*/ + 0x00,0x0F,0x08,0x08,0x08,0x10,0x20,0xC0,0x3F,0x10,0x08,0x04,0x03,0x0C,0x30,0xC0, + 0x00,0xE0,0x20,0x20,0x20,0x20,0x1E,0x00,0xF0,0x10,0x20,0x40,0x80,0x60,0x18,0x06, + /* 0xECB0 [?] [7066]*/ + 0x10,0xFE,0x10,0x7C,0x00,0xFE,0x82,0x7C,0x00,0x7C,0x04,0x7C,0x40,0x7C,0x04,0x0D, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xECB1 [?] [7067]*/ + 0x10,0xFE,0x10,0x7C,0x00,0xFE,0x82,0x10,0x7C,0x20,0x50,0x7C,0x10,0xFE,0x10,0x11, + 0x00,0x78,0x48,0x48,0x48,0x86,0x00,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xECB2 [?] [7068]*/ + 0x08,0xFF,0x08,0x7F,0x00,0xFF,0xA0,0x3E,0x42,0xFF,0x49,0x7F,0x49,0x7F,0x49,0x8B, + 0x00,0xB8,0x28,0x28,0x28,0xC6,0x80,0x7C,0x24,0x24,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xECB3 [?] [7069]*/ + 0x04,0x7C,0x04,0x04,0x3C,0x04,0x04,0x7C,0x04,0x01,0xFF,0x08,0x04,0x03,0x1C,0xE0, + 0x40,0x7C,0x40,0x40,0x78,0x40,0x40,0x7C,0x40,0x00,0xFE,0x20,0x40,0x80,0x70,0x0E, + /* 0xECB4 [?] [7070]*/ + 0x02,0x01,0x7F,0x08,0x04,0x03,0x1C,0xE2,0x2E,0x22,0x2E,0x22,0x2E,0x22,0x5F,0x80, + 0x00,0x00,0xFC,0x20,0x40,0x80,0x70,0x8E,0xE8,0x88,0xE8,0x88,0xE8,0x88,0xF8,0x08, + /* 0xECB5 [?] [7071]*/ + 0x02,0x41,0x25,0x04,0xFD,0x14,0x15,0x15,0x95,0x55,0x25,0x25,0x54,0x55,0x84,0x04, + 0x00,0x7C,0x04,0x44,0xF4,0x44,0xF4,0x54,0x74,0xD4,0x54,0xF4,0xE4,0x54,0x44,0x4C, + /* 0xECB6 [?] [7072]*/ + 0x20,0x10,0x00,0xFE,0x20,0x20,0x3D,0x26,0x24,0x24,0x24,0x24,0x44,0x54,0x88,0x00, + 0x20,0x20,0x20,0x50,0x50,0x88,0x04,0x02,0x60,0x10,0x00,0xC0,0x20,0x10,0x08,0x00, + /* 0xECB7 [?] [7073]*/ + 0x20,0x10,0x10,0x01,0xFE,0x21,0x20,0x3C,0x25,0x25,0x25,0x25,0x25,0x45,0x54,0x88, + 0x80,0x80,0xFE,0x20,0x20,0xFE,0x20,0x20,0xFC,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xECB8 [?] [7074]*/ + 0x20,0x10,0x10,0x01,0xFE,0x21,0x20,0x3C,0x25,0x24,0x24,0x27,0x24,0x44,0x54,0x88, + 0x80,0x80,0xFE,0x00,0x1C,0xE0,0x20,0x3C,0xE0,0x20,0x3E,0xE0,0x20,0x22,0x22,0x1E, + /* 0xECB9 [?] [7075]*/ + 0x20,0x10,0x10,0x01,0xFE,0x20,0x20,0x3C,0x24,0x24,0x25,0x24,0x24,0x45,0x55,0x8A, + 0x80,0x80,0xFE,0x00,0x00,0xFC,0x84,0xA4,0x94,0x84,0xFE,0x84,0x84,0x04,0x14,0x08, + /* 0xECBA [?] [7076]*/ + 0x20,0x10,0x10,0x01,0xFE,0x20,0x20,0x3C,0x25,0x24,0x24,0x24,0x24,0x44,0x55,0x88, + 0x80,0x80,0xFE,0x10,0x10,0x90,0xFE,0x90,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xECBB [?] [7077]*/ + 0x20,0x10,0x10,0x01,0xFE,0x20,0x20,0x3C,0x24,0x24,0x24,0x24,0x24,0x45,0x55,0x8A, + 0x80,0x80,0xFE,0x00,0x00,0xFC,0x84,0x84,0xFC,0x80,0xA4,0xA8,0xB0,0x22,0x22,0x1E, + /* 0xECBC [?] [7078]*/ + 0x21,0x11,0x11,0x02,0xFC,0x21,0x20,0x3C,0x25,0x24,0x24,0x24,0x24,0x44,0x55,0x8A, + 0x00,0x00,0xFE,0x40,0x20,0xFE,0x40,0x84,0xFE,0x02,0xA8,0xA8,0xA8,0xAA,0x2A,0x26, + /* 0xECBD [?] [7079]*/ + 0x21,0x11,0x11,0x02,0xFC,0x21,0x20,0x3C,0x27,0x24,0x25,0x25,0x25,0x44,0x54,0x88, + 0x00,0x00,0xFE,0x00,0x20,0xFC,0x50,0x88,0xFE,0x08,0xE8,0x28,0xE8,0x08,0x28,0x10, + /* 0xECBE [?] [7080]*/ + 0x10,0x11,0x10,0x14,0x58,0x50,0x51,0x90,0x10,0x10,0x11,0x29,0x26,0x44,0x40,0x81, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xECBF [?] [7081]*/ + 0x10,0x10,0x10,0x13,0x54,0x58,0x51,0x90,0x10,0x13,0x10,0x28,0x24,0x44,0x40,0x80, + 0x40,0x40,0x40,0xFE,0x40,0x40,0xFC,0x40,0x40,0xFE,0x42,0x42,0x4A,0x44,0x40,0x40, + /* 0xECC0 [?] [7082]*/ + 0x10,0x10,0x10,0x11,0x54,0x59,0x51,0x91,0x11,0x11,0x10,0x28,0x24,0x44,0x40,0x80, + 0x20,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x22,0x22,0x1E,0x00, + /* 0xECC1 [?] [7083]*/ + 0x10,0x10,0x10,0x14,0x59,0x52,0x54,0x91,0x11,0x11,0x11,0x29,0x25,0x45,0x40,0x80, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0x06,0xF0,0x10,0x10,0x50,0x20,0x04,0x04,0xFC,0x00, + /* 0xECC2 [?] [7084]*/ + 0x10,0x10,0x13,0x10,0x54,0x58,0x50,0x90,0x11,0x12,0x14,0x28,0x24,0x44,0x40,0x80, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xECC3 [?] [7085]*/ + 0x10,0x10,0x13,0x10,0x55,0x58,0x50,0x90,0x13,0x10,0x10,0x28,0x24,0x44,0x40,0x80, + 0x08,0x3C,0xE0,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xECC4 [?] [7086]*/ + 0x10,0x10,0x10,0x15,0x58,0x50,0x50,0x90,0x11,0x10,0x10,0x28,0x24,0x40,0x43,0x80, + 0x40,0x20,0x00,0xFE,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xECC5 [?] [7087]*/ + 0x10,0x10,0x10,0x15,0x58,0x50,0x50,0x90,0x11,0x10,0x10,0x28,0x24,0x45,0x40,0x80, + 0x20,0x10,0x10,0xFE,0x20,0x20,0x44,0x84,0xF8,0x10,0x20,0x44,0x82,0xFE,0x82,0x00, + /* 0xECC6 [?] [7088]*/ + 0x02,0x04,0x08,0x10,0x3F,0x00,0x1F,0x10,0x10,0x1F,0x01,0x11,0x22,0x04,0x18,0xE0, + 0x00,0x00,0x20,0x10,0xF8,0x08,0xF0,0x10,0x10,0xF0,0x00,0x10,0xA0,0x40,0x30,0x0E, + /* 0xECC7 [?] [7089]*/ + 0x10,0x10,0x11,0x15,0x5B,0x55,0x51,0x91,0x11,0x10,0x13,0x28,0x24,0x44,0x40,0x80, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xECC8 [?] [7090]*/ + 0x11,0x10,0x10,0x14,0x5B,0x50,0x50,0x91,0x10,0x10,0x13,0x28,0x24,0x44,0x40,0x80, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xECC9 [?] [7091]*/ + 0x10,0x13,0x10,0x10,0x55,0x58,0x50,0x93,0x10,0x10,0x11,0x29,0x25,0x45,0x41,0x81, + 0x00,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xECCA [?] [7092]*/ + 0x10,0x10,0x10,0x14,0x59,0x52,0x50,0x90,0x10,0x10,0x11,0x29,0x25,0x45,0x41,0x81, + 0x20,0x20,0x50,0x88,0x44,0x22,0xF8,0x08,0x10,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xECCB [?] [7093]*/ + 0x11,0x10,0x12,0x16,0x5A,0x52,0x52,0x92,0x12,0x13,0x12,0x2A,0x26,0x42,0x42,0x82, + 0x00,0xBE,0x82,0x02,0x22,0x12,0x52,0x42,0xCA,0x56,0x52,0x32,0x02,0x02,0x0A,0x04, + /* 0xECCC [?] [7094]*/ + 0x10,0x10,0x10,0x14,0x59,0x51,0x51,0x91,0x11,0x11,0x10,0x2B,0x24,0x44,0x40,0x80, + 0x20,0x20,0x3E,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xECCD [?] [7095]*/ + 0x01,0x11,0x11,0x22,0x04,0x18,0xE0,0x08,0x0A,0x2A,0x2C,0x48,0x14,0x22,0x42,0x80, + 0x00,0x08,0x08,0x90,0x40,0x30,0x0E,0x10,0x10,0x54,0x54,0x98,0x10,0x28,0x44,0x82, + /* 0xECCE [?] [7096]*/ + 0x11,0x11,0x11,0x17,0x59,0x51,0x51,0x93,0x12,0x12,0x12,0x2A,0x27,0x44,0x40,0x80, + 0x00,0x3C,0x24,0xA4,0x24,0x3C,0x24,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0x44,0x54,0x88, + /* 0xECCF [?] [7097]*/ + 0x10,0x11,0x11,0x15,0x59,0x51,0x51,0x90,0x10,0x13,0x10,0x29,0x24,0x40,0x47,0x80, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x40,0x20,0xFE,0x00,0x04,0x88,0x00,0xFE,0x00, + /* 0xECD0 [?] [7098]*/ + 0x10,0x11,0x11,0x11,0x55,0x59,0x51,0x91,0x10,0x13,0x11,0x29,0x25,0x45,0x41,0x81, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x00,0xFE,0x20,0x22,0x14,0x48,0x84,0x02, + /* 0xECD1 [?] [7099]*/ + 0x10,0x11,0x11,0x11,0x55,0x59,0x51,0x91,0x11,0x11,0x11,0x29,0x27,0x45,0x41,0x81, + 0x20,0xDC,0x14,0x14,0x14,0xD4,0x26,0x00,0xDC,0x14,0x14,0xD4,0x08,0x08,0x14,0x22, + /* 0xECD2 [?] [7100]*/ + 0x08,0x0B,0x12,0x33,0x50,0x97,0x11,0x12,0x14,0x10,0x01,0x11,0x22,0x04,0x18,0xE0, + 0x00,0xF8,0x08,0xF8,0x40,0xFC,0x50,0x48,0x44,0x40,0x00,0x10,0xA0,0x40,0x30,0x0E, + /* 0xECD3 [?] [7101]*/ + 0x10,0x10,0x13,0x12,0x54,0x59,0x50,0x91,0x11,0x11,0x11,0x29,0x25,0x44,0x43,0x80, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xECD4 [?] [7102]*/ + 0x10,0x10,0x11,0x11,0x55,0x59,0x51,0x91,0x11,0x11,0x12,0x2A,0x24,0x44,0x40,0x80, + 0x40,0x20,0xFE,0x02,0x02,0xFE,0x00,0x00,0xFE,0xAA,0xAA,0xFE,0xAA,0xAA,0xA2,0x86, + /* 0xECD5 [?] [7103]*/ + 0x20,0x24,0x22,0x22,0xA8,0xB0,0xAE,0xA2,0x22,0x22,0x22,0x22,0x52,0x4A,0x45,0x88, + 0x00,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0xA2,0x94,0x88,0xA8,0xC4,0x84,0x00,0xFE, + /* 0xECD6 [?] [7104]*/ + 0x10,0x13,0x12,0x16,0x5A,0x52,0x53,0x90,0x13,0x12,0x12,0x2B,0x26,0x42,0x43,0x82, + 0x40,0xBE,0x12,0x92,0x52,0xAA,0x24,0x40,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xECD7 [?] [7105]*/ + 0x10,0x11,0x11,0x11,0x55,0x59,0x50,0x93,0x12,0x13,0x10,0x29,0x24,0x44,0x41,0x86, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0xFC,0x00,0xF8,0x90,0x60,0x98,0x06, + /* 0xECD8 [?] [7106]*/ + 0x10,0x10,0x13,0x14,0x58,0x53,0x52,0x92,0x13,0x12,0x12,0x2A,0x26,0x42,0x42,0x82, + 0x40,0x20,0xFE,0x88,0x50,0xFE,0x52,0x8A,0x06,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xECD9 [?] [7107]*/ + 0x3F,0x21,0x3F,0x20,0x2F,0x20,0x5F,0x44,0x95,0x2C,0x01,0x11,0x22,0x04,0x18,0xE0, + 0x08,0x08,0x7E,0x08,0x48,0x28,0xA8,0x08,0x28,0x90,0x00,0x10,0xA0,0x40,0x30,0x0E, + /* 0xECDA [?] [7108]*/ + 0x10,0x13,0x10,0x12,0x55,0x5A,0x50,0x90,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x81, + 0x00,0xDE,0x42,0x52,0x4A,0x52,0x42,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xECDB [?] [7109]*/ + 0x20,0x21,0x27,0x24,0xAD,0xB4,0xA7,0xA4,0x25,0x24,0x20,0x27,0x50,0x49,0x42,0x8C, + 0x80,0x00,0xFC,0x44,0x54,0x44,0xFC,0xE4,0x54,0x04,0x40,0xFE,0xA0,0x10,0x08,0x06, + /* 0xECDC [?] [7110]*/ + 0x10,0x13,0x11,0x10,0x55,0x58,0x51,0x92,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x81, + 0x3C,0xE0,0x24,0xA8,0xFE,0xA8,0x24,0x02,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xECDD [?] [7111]*/ + 0x10,0x12,0x11,0x14,0x58,0x50,0x53,0x91,0x11,0x11,0x11,0x29,0x25,0x41,0x42,0x84, + 0x44,0x24,0x28,0x7E,0x10,0x28,0x4A,0x1C,0x28,0x4C,0x1A,0x2A,0x48,0x10,0xFE,0x00, + /* 0xECDE [?] [7112]*/ + 0xFE,0x20,0x50,0x9A,0x2C,0x48,0x9C,0x2A,0xC8,0x18,0x01,0x11,0x22,0x04,0x18,0xE0, + 0xFE,0x20,0x50,0x9A,0x2C,0x48,0x9C,0x2A,0xC8,0x18,0x00,0x10,0xA0,0x40,0x30,0x0E, + /* 0xECDF [?] [7113]*/ + 0x10,0x13,0x11,0x14,0x5B,0x52,0x53,0x90,0x13,0x12,0x13,0x2A,0x27,0x42,0x42,0x83, + 0x1E,0xE0,0x22,0x94,0xFE,0x52,0xFE,0x04,0xC4,0x7E,0xC4,0x54,0xCC,0x84,0xD4,0x48, + /* 0xECE0 [?] [7114]*/ + 0x2F,0x48,0x6B,0x48,0x6B,0x4A,0xFF,0x88,0x7E,0x2C,0x4A,0xFF,0x11,0x29,0xC6,0x18, + 0xEC,0x24,0xAC,0x24,0xAC,0xA4,0xFE,0x22,0xFC,0x68,0xA4,0xFE,0x10,0x28,0xC6,0x30, + /* 0xECE1 [?] [7115]*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x24,0x22,0x42,0x80, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0x44,0x44,0x04, + /* 0xECE2 [?] [7116]*/ + 0x02,0x02,0x7F,0x02,0x3F,0x04,0xFF,0x08,0x1F,0x20,0x44,0x82,0x02,0x00,0x24,0x42, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x20,0xFC,0x20,0x20,0x20,0xA0,0x40,0x88,0x44, + /* 0xECE3 [?] [7117]*/ + 0x01,0x79,0x49,0x4A,0x4C,0x79,0x49,0x49,0x49,0x48,0x78,0x00,0x24,0x22,0x42,0x80, + 0x00,0x00,0xFC,0x04,0x04,0xE4,0x24,0x24,0xE4,0x04,0x28,0x10,0x88,0x44,0x44,0x04, + /* 0xECE4 [?] [7118]*/ + 0x01,0x7F,0x01,0x3F,0x00,0x3F,0x20,0x3F,0x08,0xFF,0x00,0x3F,0x20,0x3F,0x24,0x42, + 0x00,0xFC,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x20,0xFE,0x00,0xF8,0x08,0xF8,0x88,0x44, + /* 0xECE5 [?] [7119]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x20,0x2F,0x21,0x21,0x42,0x44,0x88,0x10, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x80,0xA0,0x90,0xFC,0x40,0x40,0x20,0x10,0x08,0x06, + /* 0xECE6 [?] [7120]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x22,0x21,0x24,0x22,0x20,0x5F,0x40,0x80,0x00, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x00,0x20,0x20,0x20,0x20,0x7E,0xA0,0x20,0x20,0x20, + /* 0xECE7 [?] [7121]*/ + 0x02,0x01,0x3F,0x20,0x20,0x3F,0x20,0x20,0x2F,0x28,0x29,0x29,0x49,0x49,0x88,0x08, + 0x00,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x04,0xE4,0x24,0x24,0xE4,0x14,0x08, + /* 0xECE8 [?] [7122]*/ + 0x01,0x00,0x3F,0x20,0x3F,0x20,0x27,0x24,0x27,0x20,0x2F,0x28,0x4F,0x48,0x88,0x07, + 0x00,0x80,0xFC,0x04,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x88,0xF8,0x02,0x02,0xFE, + /* 0xECE9 [?] [7123]*/ + 0x01,0x00,0x3F,0x20,0x3F,0x21,0x21,0x3F,0x21,0x21,0x2F,0x21,0x41,0x5F,0x81,0x01, + 0x00,0x80,0xFC,0x04,0xFC,0x20,0x20,0x3E,0x20,0x20,0x3C,0x20,0x20,0x3E,0x20,0x20, + /* 0xECEA [?] [7124]*/ + 0x20,0x10,0x10,0xF8,0x08,0x10,0x10,0x38,0x54,0x94,0x10,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xECEB [?] [7125]*/ + 0x20,0x10,0x11,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x11,0x10,0x10, + 0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0x02,0x02,0x02,0xFE,0x00, + /* 0xECEC [?] [7126]*/ + 0x20,0x10,0x11,0xF8,0x08,0x10,0x10,0x3B,0x54,0x94,0x10,0x10,0x10,0x10,0x11,0x12, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xECED [?] [7127]*/ + 0x20,0x10,0x10,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x11,0x11,0x17,0x10, + 0x20,0x20,0x20,0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xECEE [?] [7128]*/ + 0x20,0x10,0x10,0xF9,0x08,0x10,0x10,0x3B,0x54,0x94,0x10,0x10,0x10,0x11,0x10,0x10, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00, + /* 0xECEF [?] [7129]*/ + 0x20,0x10,0x10,0xF8,0x0B,0x10,0x10,0x38,0x55,0x95,0x11,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xECF0 [?] [7130]*/ + 0x20,0x10,0x10,0xF8,0x0B,0x10,0x10,0x38,0x55,0x95,0x11,0x11,0x12,0x12,0x14,0x11, + 0x50,0x48,0x48,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xECF1 [?] [7131]*/ + 0x20,0x10,0x10,0xF8,0x09,0x11,0x12,0x38,0x54,0x94,0x10,0x10,0x10,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xECF2 [?] [7132]*/ + 0x20,0x10,0x10,0xF8,0x09,0x11,0x12,0x38,0x54,0x94,0x11,0x11,0x12,0x10,0x10,0x10, + 0x80,0x80,0x80,0xFE,0x02,0x04,0x20,0x20,0xA8,0xA4,0x24,0x22,0x22,0x20,0xA0,0x40, + /* 0xECF3 [?] [7133]*/ + 0x40,0x20,0x23,0xFA,0x12,0x12,0x22,0x33,0x6A,0xAA,0x22,0x22,0x22,0x22,0x23,0x22, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x10,0x10,0x12,0x0A,0x8A,0x26,0x12, + /* 0xECF4 [?] [7134]*/ + 0x20,0x11,0x10,0xF8,0x0B,0x10,0x10,0x39,0x55,0x95,0x11,0x11,0x10,0x10,0x10,0x10, + 0x00,0xFC,0x04,0x04,0xF4,0x04,0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x14,0x08, + /* 0xECF5 [?] [7135]*/ + 0x20,0x10,0x10,0xF8,0x08,0x11,0x11,0x39,0x55,0x95,0x11,0x11,0x10,0x10,0x10,0x11, + 0x20,0x20,0x3E,0x20,0x20,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x50,0x48,0x84,0x04, + /* 0xECF6 [?] [7136]*/ + 0x20,0x10,0x10,0xFA,0x09,0x10,0x18,0x35,0x52,0x94,0x10,0x10,0x11,0x11,0x12,0x14, + 0x90,0x90,0x90,0x92,0x94,0x98,0x90,0x98,0x94,0x92,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xECF7 [?] [7137]*/ + 0x21,0x11,0x13,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x11,0x17,0x10,0x10,0x11,0x12, + 0x08,0x08,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0xFE,0x00,0x90,0x08,0x04, + /* 0xECF8 [?] [7138]*/ + 0x21,0x10,0x10,0xF9,0x09,0x11,0x11,0x39,0x55,0x95,0x10,0x10,0x13,0x10,0x10,0x10, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xECF9 [?] [7139]*/ + 0x41,0x21,0x27,0xF9,0x13,0x11,0x27,0x31,0x69,0xA8,0x27,0x20,0x20,0x21,0x22,0x2C, + 0x00,0x3C,0xD4,0x14,0x94,0x14,0xD4,0x24,0x4C,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xECFA [?] [7140]*/ + 0x21,0x10,0x10,0xF8,0x0B,0x10,0x18,0x35,0x50,0x90,0x13,0x10,0x12,0x12,0x14,0x10, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00,0xA4,0x52,0x52,0x00, + /* 0xECFB [?] [7141]*/ + 0x40,0x27,0x20,0xFB,0x10,0x13,0x22,0x33,0x69,0xAF,0x20,0x23,0x22,0x22,0x23,0x22, + 0x40,0xFC,0x40,0xF8,0x00,0xF8,0x08,0xF8,0x10,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xECFC [?] [7142]*/ + 0x20,0x13,0x10,0xF9,0x09,0x11,0x18,0x37,0x50,0x93,0x10,0x17,0x10,0x11,0x16,0x10, + 0x20,0xFE,0x00,0xDC,0x54,0xDC,0x88,0xFE,0x88,0xFE,0x88,0xFE,0x94,0x88,0xA4,0xC2, + /* 0xECFD [?] [7143]*/ + 0x00,0xFF,0x02,0x02,0x02,0x02,0x02,0x02,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0xFE,0x00,0x40,0x20,0x10,0x08,0x00,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xECFE [?] [7144]*/ + 0x02,0x02,0x02,0x03,0x02,0x02,0x02,0xFF,0x00,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xEDA1 [?] [7145]*/ + 0x00,0x00,0x7E,0x02,0x24,0x14,0x08,0x14,0x22,0x40,0x01,0x08,0x48,0x48,0x87,0x00, + 0x08,0x08,0x08,0xFE,0x08,0x48,0x28,0x08,0x28,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDA2 [?] [7146]*/ + 0x08,0x08,0x7F,0x08,0x3E,0x08,0x7F,0x08,0x08,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x00,0x00,0x7C,0x24,0x24,0x24,0x44,0x54,0x88,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xEDA3 [?] [7147]*/ + 0x01,0x3F,0x01,0x01,0xFF,0x00,0x01,0x3F,0x01,0x01,0xFF,0x02,0x51,0x51,0x90,0x0F, + 0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x04,0x12,0x12,0xF0, + /* 0xEDA4 [?] [7148]*/ + 0x00,0xFF,0x02,0x04,0x3F,0x24,0x24,0x24,0x24,0x20,0x01,0x08,0x48,0x48,0x87,0x00, + 0x00,0xFE,0x00,0x00,0xF8,0x88,0x88,0x88,0xA8,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDA5 [?] [7149]*/ + 0x08,0x0B,0x10,0x30,0x57,0x90,0x10,0x10,0x13,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x38,0xC0,0x40,0x40,0xFC,0x40,0x40,0x40,0xF8,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xEDA6 [?] [7150]*/ + 0x08,0x04,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x20,0x40,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xEDA7 [?] [7151]*/ + 0x40,0x20,0x09,0x12,0x24,0xE0,0x20,0x23,0x2C,0x01,0x08,0x48,0x48,0x48,0x87,0x00, + 0x80,0x80,0xFC,0x04,0x48,0x40,0xA0,0x18,0x06,0x00,0x88,0x84,0x12,0x12,0xF0,0x00, + /* 0xEDA8 [?] [7152]*/ + 0x01,0x7F,0x01,0x3F,0x00,0x7F,0x40,0x8F,0x08,0x10,0x20,0xC1,0x28,0x28,0x48,0x07, + 0x00,0xFC,0x00,0xF8,0x00,0xFE,0x02,0xE4,0x20,0x22,0x22,0x1E,0x88,0xA4,0x24,0xE0, + /* 0xEDA9 [?] [7153]*/ + 0x12,0x21,0x48,0x94,0x21,0x62,0xAE,0x22,0x22,0x22,0x21,0x08,0x48,0x48,0x87,0x00, + 0x00,0x3C,0x00,0x00,0x7E,0x08,0x08,0x08,0x28,0x10,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDAA [?] [7154]*/ + 0x00,0x7F,0x41,0x7F,0x48,0x7F,0x48,0x45,0x53,0x61,0x01,0x08,0x48,0x48,0x87,0x00, + 0x20,0x20,0x3E,0x44,0xA4,0x24,0x28,0x10,0x28,0x46,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDAB [?] [7155]*/ + 0x3F,0x24,0x2F,0x25,0x3F,0x22,0x27,0x2A,0x33,0x20,0x3F,0x02,0x51,0x51,0x90,0x0F, + 0xFC,0x20,0xF8,0x20,0xFC,0x00,0xF0,0x10,0xF0,0x00,0xFC,0x00,0x04,0x12,0x12,0xF0, + /* 0xEDAC [?] [7156]*/ + 0x1C,0x70,0x10,0xFE,0x10,0x7C,0x44,0x44,0x7C,0x44,0x01,0x08,0x48,0x48,0x87,0x00, + 0x10,0x20,0xFC,0x84,0xFC,0x84,0xFC,0x84,0xFC,0x00,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDAD [?] [7157]*/ + 0x08,0x7F,0x00,0x3E,0x23,0x3E,0x00,0x3E,0x04,0x7F,0x08,0x29,0x11,0x48,0x48,0x87, + 0x40,0x40,0x7E,0x88,0x48,0x48,0x50,0x50,0x20,0x50,0x88,0x04,0x00,0x84,0x12,0xF2, + /* 0xEDAE [?] [7158]*/ + 0x27,0x20,0xFA,0x21,0x77,0x6B,0xA5,0x29,0x25,0x22,0x01,0x08,0x48,0x48,0x87,0x00, + 0x88,0x88,0xBE,0x08,0xD8,0x5C,0x2A,0x48,0x08,0x08,0x00,0x84,0x92,0x12,0xF0,0x00, + /* 0xEDAF [?] [7159]*/ + 0x01,0x4F,0x21,0x27,0x80,0x47,0x54,0x14,0xE5,0x26,0x24,0x24,0x01,0x48,0x48,0x87, + 0x10,0xFE,0x10,0xFC,0xA0,0xFC,0xA4,0xA4,0x64,0x54,0x84,0x0C,0x00,0x84,0x12,0xF2, + /* 0xEDB0 [?] [7160]*/ + 0x10,0xFE,0x29,0xFE,0x01,0x7C,0x44,0x7D,0x44,0x7C,0x10,0xFE,0x11,0x48,0x48,0x87, + 0x40,0xF8,0x48,0x30,0xCE,0xF8,0x20,0xFC,0x88,0xA8,0xA8,0x50,0x88,0x84,0x12,0xF2, + /* 0xEDB1 [?] [7161]*/ + 0x01,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xEDB2 [?] [7162]*/ + 0x01,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01, + 0x00,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xEDB3 [?] [7163]*/ + 0x01,0x01,0x7D,0x05,0x09,0x31,0xC5,0x02,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x10, + 0x00,0x08,0x10,0xA0,0x60,0x18,0x06,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10, + /* 0xEDB4 [?] [7164]*/ + 0x22,0x11,0x11,0x00,0x7F,0x40,0x80,0x01,0x01,0x7D,0x05,0x09,0x11,0x21,0xC5,0x02, + 0x08,0x08,0x10,0x20,0xFE,0x02,0x04,0x00,0x04,0x88,0x50,0x20,0x10,0x08,0x06,0x00, + /* 0xEDB5 [?] [7165]*/ + 0x01,0x01,0x7D,0x05,0x09,0x31,0xC5,0x02,0x08,0x0A,0x6A,0x2C,0x2A,0x4A,0xA9,0x10, + 0x00,0x08,0x10,0xA0,0x60,0x18,0x06,0x00,0x10,0x14,0xD4,0x58,0x54,0x94,0x52,0x20, + /* 0xEDB6 [?] [7166]*/ + 0x00,0x01,0xF9,0x21,0x21,0x41,0x79,0xC9,0x49,0x49,0x49,0x49,0x7A,0x42,0x04,0x08, + 0x00,0xF0,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x12,0x12,0x12,0x0E,0x00, + /* 0xEDB7 [?] [7167]*/ + 0x00,0x01,0xFC,0x10,0x10,0x20,0x3C,0x67,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xEDB8 [?] [7168]*/ + 0x00,0x01,0xFC,0x10,0x10,0x20,0x3D,0x64,0x64,0xA4,0x25,0x25,0x3E,0x24,0x20,0x01, + 0x00,0xF8,0x10,0x20,0x40,0x80,0xFE,0x92,0x92,0x92,0x12,0x22,0x22,0x42,0x94,0x08, + /* 0xEDB9 [?] [7169]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x01,0x7F,0x01,0x7F,0x04,0x08,0x3F,0xC8,0x08,0x0F,0x08, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFC,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xEDBA [?] [7170]*/ + 0x00,0x00,0xFC,0x13,0x10,0x20,0x3D,0x65,0x64,0xA4,0x24,0x27,0x3C,0x24,0x20,0x00, + 0x40,0x40,0x40,0xFE,0x80,0xA0,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xEDBB [?] [7171]*/ + 0x00,0x00,0xFC,0x13,0x10,0x21,0x3D,0x65,0x65,0xA5,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x22,0x22,0x1E,0x00, + /* 0xEDBC [?] [7172]*/ + 0x00,0x03,0xF8,0x21,0x21,0x41,0x7A,0xCB,0x48,0x48,0x48,0x49,0x7A,0x44,0x00,0x00, + 0x00,0xFC,0x10,0x10,0x10,0x10,0x10,0xFE,0x30,0x50,0x90,0x10,0x10,0x10,0x50,0x20, + /* 0xEDBD [?] [7173]*/ + 0x00,0x00,0xFC,0x10,0x10,0x20,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3D,0x25,0x22,0x04, + 0x08,0x1C,0xE0,0x80,0x80,0x80,0xFE,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08,0x08, + /* 0xEDBE [?] [7174]*/ + 0x00,0x00,0xFD,0x10,0x10,0x20,0x3D,0x64,0x64,0xA4,0x24,0x24,0x3C,0x25,0x22,0x00, + 0x04,0x1E,0xE0,0x00,0x20,0x10,0xFE,0x04,0x08,0x10,0x20,0x40,0x80,0x40,0x3E,0x00, + /* 0xEDBF [?] [7175]*/ + 0x00,0x03,0xFA,0x22,0x23,0x42,0x7A,0xCA,0x4A,0x4A,0x4A,0x4B,0x7C,0x44,0x08,0x10, + 0x00,0xF8,0x08,0x08,0x28,0xA8,0xA8,0x48,0x48,0xA8,0xA8,0x2A,0x0A,0x0A,0x06,0x02, + /* 0xEDC0 [?] [7176]*/ + 0x00,0x00,0xFC,0x11,0x10,0x20,0x3C,0x65,0x64,0xA4,0x24,0x24,0x3C,0x25,0x20,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00, + /* 0xEDC1 [?] [7177]*/ + 0x01,0x01,0xFB,0x21,0x21,0x40,0x7A,0xCA,0x49,0x49,0x48,0x48,0x78,0x41,0x02,0x0C, + 0x10,0x10,0xFC,0x10,0x10,0x00,0x08,0x08,0x10,0x10,0xA0,0x40,0xA0,0x10,0x08,0x06, + /* 0xEDC2 [?] [7178]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x22,0x02,0x04, + 0x00,0xFE,0x00,0x00,0x00,0xFE,0x20,0x20,0x3C,0x24,0x24,0x24,0x24,0x44,0x54,0x88, + /* 0xEDC3 [?] [7179]*/ + 0x04,0x04,0xFF,0x09,0x11,0x21,0x4F,0x80,0x00,0xFF,0x08,0x1F,0x28,0xC8,0x0F,0x08, + 0x40,0x20,0xFC,0x10,0x60,0x84,0x04,0xFC,0x00,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xEDC4 [?] [7180]*/ + 0x00,0x00,0xFC,0x10,0x11,0x21,0x3E,0x64,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xEDC5 [?] [7181]*/ + 0x00,0x00,0xFC,0x10,0x10,0x21,0x3E,0x64,0x65,0xA4,0x24,0x24,0x3C,0x24,0x23,0x00, + 0x20,0x20,0x50,0x50,0x88,0x04,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xEDC6 [?] [7182]*/ + 0x00,0x00,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x04,0x1E,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x08,0x0A,0x4A,0xA6,0x12, + /* 0xEDC7 [?] [7183]*/ + 0x00,0x00,0xFC,0x10,0x11,0x20,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3C,0x24,0x23,0x00, + 0x40,0x20,0x20,0x00,0xFE,0x00,0x04,0x84,0x84,0x48,0x48,0x48,0x50,0x10,0xFE,0x00, + /* 0xEDC8 [?] [7184]*/ + 0x00,0x00,0xFC,0x11,0x11,0x22,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xEDC9 [?] [7185]*/ + 0x00,0x00,0xF8,0x23,0x20,0x40,0x7B,0x4A,0xCA,0x4B,0x48,0x48,0x79,0x49,0x02,0x04, + 0x90,0x90,0x90,0xFC,0x94,0x94,0xFC,0x90,0x90,0xFE,0x92,0x92,0x1A,0x14,0x10,0x10, + /* 0xEDCA [?] [7186]*/ + 0x00,0x07,0xFA,0x22,0x22,0x42,0x7A,0x4F,0xCA,0x4A,0x4A,0x4A,0x7A,0x4C,0x04,0x08, + 0x02,0xE2,0x42,0x4A,0x4A,0x4A,0x4A,0xEA,0x4A,0x4A,0x4A,0x4A,0x42,0x42,0x4A,0x44, + /* 0xEDCB [?] [7187]*/ + 0x00,0x00,0xFD,0x10,0x10,0x20,0x3C,0x65,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x48,0x48,0xFE,0x48,0x48,0x20,0x10,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0xFC,0x00, + /* 0xEDCC [?] [7188]*/ + 0x00,0x00,0xFC,0x11,0x10,0x21,0x3C,0x64,0x64,0xA7,0x24,0x24,0x3C,0x24,0x21,0x02, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEDCD [?] [7189]*/ + 0x00,0x00,0xF8,0x23,0x20,0x40,0x78,0x4B,0xC8,0x4B,0x48,0x48,0x79,0x49,0x02,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xEDCE [?] [7190]*/ + 0x08,0x08,0x2E,0x28,0x28,0x2E,0xF0,0x00,0x7F,0x04,0x08,0x3F,0xC8,0x08,0x0F,0x08, + 0x80,0x88,0x90,0xE0,0x84,0x84,0x7C,0x00,0xFC,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xEDCF [?] [7191]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x00,0xFE,0x02,0x02,0x7A,0x02,0x02,0x7A,0x4A,0x4A,0x4A,0x7A,0x02,0x02,0x0A,0x04, + /* 0xEDD0 [?] [7192]*/ + 0x00,0x00,0xFC,0x11,0x11,0x21,0x3D,0x65,0x65,0xA5,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x20,0x20,0x40,0xFC,0x04,0x04,0x94,0x54,0x24,0x24,0x54,0x94,0x04,0x04,0xFC,0x04, + /* 0xEDD1 [?] [7193]*/ + 0x00,0x00,0xFC,0x10,0x11,0x20,0x3C,0x64,0x65,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xEDD2 [?] [7194]*/ + 0x00,0x00,0xFB,0x20,0x20,0x43,0x78,0x48,0xC8,0x48,0x4B,0x48,0x78,0x48,0x02,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x02, + /* 0xEDD3 [?] [7195]*/ + 0x00,0x00,0xFB,0x20,0x21,0x40,0x7B,0x48,0xC9,0x49,0x49,0x49,0x79,0x48,0x00,0x03, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xEDD4 [?] [7196]*/ + 0x00,0x00,0xFC,0x10,0x11,0x22,0x3C,0x64,0x64,0xA4,0x24,0x24,0x3C,0x24,0x20,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xEDD5 [?] [7197]*/ + 0x00,0x00,0xFD,0x10,0x11,0x20,0x3C,0x67,0x64,0xA4,0x25,0x25,0x3D,0x25,0x21,0x01, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEDD6 [?] [7198]*/ + 0x00,0x00,0xFB,0x22,0x24,0x40,0x7B,0x48,0xC8,0x49,0x49,0x49,0x7A,0x4A,0x04,0x08, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xFE,0x20,0x20,0x20,0x3C,0x20,0xA0,0x60,0x3E,0x00, + /* 0xEDD7 [?] [7199]*/ + 0x00,0x00,0xF9,0x23,0x20,0x47,0x79,0x4A,0xCC,0x4B,0x48,0x48,0x7B,0x48,0x00,0x07, + 0x80,0x90,0x08,0xFC,0x40,0xFE,0x10,0x48,0x86,0x10,0x20,0xC4,0x08,0x30,0xC0,0x00, + /* 0xEDD8 [?] [7200]*/ + 0x00,0x01,0xFC,0x10,0x10,0x21,0x3C,0x64,0x64,0xA4,0x25,0x24,0x3D,0x25,0x20,0x00, + 0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0xA4,0x94,0xFE,0xA4,0x14,0xFE,0x04,0x18, + /* 0xEDD9 [?] [7201]*/ + 0x00,0x01,0xFD,0x11,0x11,0x21,0x3C,0x65,0x66,0xA5,0x25,0x25,0x3D,0x24,0x20,0x00, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFE,0x22,0x22,0x52,0x02,0xFA,0x02,0x14,0x08, + /* 0xEDDA [?] [7202]*/ + 0x00,0x00,0xF9,0x20,0x20,0x40,0x7B,0x4A,0xCC,0x49,0x49,0x49,0x79,0x49,0x00,0x00, + 0x40,0x20,0xFC,0x00,0x88,0x50,0xFE,0x22,0x24,0xFC,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xEDDB [?] [7203]*/ + 0x00,0x00,0xFB,0x22,0x24,0x41,0x78,0x49,0xC9,0x49,0x49,0x49,0x79,0x48,0x03,0x00, + 0x40,0x20,0xFE,0x02,0x04,0xFC,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x00,0xFE,0x00, + /* 0xEDDC [?] [7204]*/ + 0x00,0x00,0xFB,0x22,0x22,0x43,0x7A,0xCA,0x4B,0x4B,0x4B,0x4D,0x7D,0x45,0x09,0x01, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x54,0x54,0xFC,0x54,0x54,0x44,0x0C, + /* 0xEDDD [?] [7205]*/ + 0x02,0x02,0xF3,0x24,0x2A,0x41,0x72,0xD4,0x58,0x57,0x50,0x51,0x72,0x5C,0x00,0x00, + 0x08,0x08,0xBE,0x88,0xA8,0x3E,0x08,0x48,0x48,0xFC,0xE0,0x50,0x48,0x46,0x40,0x40, + /* 0xEDDE [?] [7206]*/ + 0x00,0x00,0xFB,0x20,0x21,0x42,0x78,0x49,0xC8,0x48,0x48,0x49,0x7A,0x4C,0x00,0x00, + 0x40,0x20,0xFE,0x88,0x24,0x42,0x90,0xF8,0x08,0x44,0xA8,0x90,0x88,0xA4,0xC2,0x80, + /* 0xEDDF [?] [7207]*/ + 0x03,0x01,0xF0,0x23,0x20,0x47,0x74,0xD3,0x54,0x50,0x57,0x50,0x71,0x52,0x0C,0x00, + 0xF0,0x10,0xE0,0x18,0x00,0xBC,0xA4,0x18,0xA4,0x40,0xFC,0xE0,0x50,0x48,0x46,0x40, + /* 0xEDE0 [?] [7208]*/ + 0x08,0x7F,0x08,0x3E,0x00,0x3E,0x2A,0x3E,0x40,0xFF,0x08,0x1F,0x28,0xC8,0x0F,0x08, + 0x00,0x78,0x48,0x48,0x86,0x78,0x48,0x30,0x48,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xEDE1 [?] [7209]*/ + 0x02,0x01,0xF8,0x24,0x22,0x40,0x79,0x4E,0xCA,0x48,0x4B,0x48,0x78,0x49,0x02,0x00, + 0x00,0x7E,0x40,0x7C,0x44,0xFC,0x40,0x7E,0x20,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xEDE2 [?] [7210]*/ + 0x02,0x01,0xF7,0x20,0x27,0x44,0x77,0xD0,0x57,0x50,0x51,0x51,0x77,0x51,0x05,0x02, + 0x08,0x08,0xC8,0x10,0x9E,0x94,0xA4,0x14,0x94,0x94,0x14,0xC8,0x08,0x14,0x24,0x42, + /* 0xEDE3 [?] [7211]*/ + 0x00,0x07,0xF0,0x22,0x21,0x42,0x75,0xD8,0x53,0x52,0x52,0x53,0x72,0x51,0x0F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xEDE4 [?] [7212]*/ + 0x00,0x03,0xFC,0x11,0x11,0x21,0x3D,0x67,0x64,0xA5,0x25,0x25,0x3D,0x25,0x20,0x03, + 0x00,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE, + /* 0xEDE5 [?] [7213]*/ + 0x00,0x00,0xFB,0x20,0x21,0x41,0x7A,0x4D,0xCA,0x49,0x4A,0x49,0x78,0x49,0x02,0x00, + 0x88,0x88,0xFE,0x88,0x10,0xDE,0x52,0x54,0x88,0x74,0x02,0xFC,0x20,0x24,0x22,0x60, + /* 0xEDE6 [?] [7214]*/ + 0x00,0x03,0xF8,0x23,0x22,0x41,0x78,0x4B,0xC8,0x48,0x4B,0x48,0x7B,0x48,0x03,0x00, + 0x88,0xFE,0x88,0xFE,0x02,0xFC,0x00,0xFE,0x40,0xA2,0x54,0xB8,0x54,0x92,0x50,0x20, + /* 0xEDE7 [?] [7215]*/ + 0x00,0x03,0xF0,0x24,0x22,0x40,0x74,0xD2,0x52,0x50,0x51,0x52,0x76,0x52,0x02,0x02, + 0x88,0xFE,0x88,0x12,0xFE,0x10,0xFE,0x92,0xFE,0x92,0xFE,0x92,0x04,0xFE,0x44,0x2C, + /* 0xEDE8 [?] [7216]*/ + 0x01,0x06,0x18,0xEF,0x00,0x1F,0x10,0x1F,0x04,0x04,0xFF,0x09,0x11,0x21,0x4F,0x80, + 0x00,0xC0,0x30,0xEE,0x00,0xF0,0x10,0xF0,0x40,0x20,0xFE,0x10,0x60,0x84,0x04,0xFC, + /* 0xEDE9 [?] [7217]*/ + 0x04,0x24,0x14,0x04,0xFF,0x01,0x11,0x09,0x3F,0x21,0x25,0x25,0x29,0x21,0x21,0x21, + 0x40,0x48,0x50,0x40,0xFE,0x00,0x10,0x20,0xF8,0x08,0x48,0x28,0x28,0x08,0x28,0x10, + /* 0xEDEA [?] [7218]*/ + 0x14,0x55,0x36,0x14,0xFF,0x49,0x2A,0x7F,0x49,0x49,0x5D,0x6B,0x49,0x49,0x49,0x4B, + 0x28,0x24,0x24,0x20,0x7E,0x20,0x20,0x3C,0x34,0x54,0x54,0x54,0x88,0x88,0x14,0x22, + /* 0xEDEB [?] [7219]*/ + 0x14,0x55,0x36,0x14,0xFF,0x49,0x2A,0x7F,0x49,0x49,0x5D,0x6B,0x49,0x49,0x49,0x4B, + 0x14,0x12,0x7E,0x10,0x10,0x7E,0x52,0x52,0x7E,0x52,0x52,0x7E,0x52,0x52,0x52,0x46, + /* 0xEDEC [?] [7220]*/ + 0x00,0x01,0x7C,0x44,0x44,0x7C,0x44,0x47,0x7C,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + 0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xEDED [?] [7221]*/ + 0x00,0x03,0x7C,0x44,0x45,0x7D,0x45,0x45,0x7D,0x45,0x44,0x44,0x7C,0x44,0x00,0x00, + 0x00,0xFE,0x20,0x20,0x20,0x3E,0x22,0x22,0x22,0xFE,0x02,0x02,0x02,0x02,0x14,0x08, + /* 0xEDEE [?] [7222]*/ + 0x00,0x01,0x7D,0x45,0x45,0x7D,0x45,0x45,0x7D,0x45,0x45,0x45,0x7D,0x45,0x01,0x00, + 0x00,0xFE,0x00,0x04,0x44,0x28,0x28,0x10,0x10,0x28,0x28,0x44,0x84,0x00,0xFE,0x00, + /* 0xEDEF [?] [7223]*/ + 0x00,0x00,0x78,0x4B,0x48,0x79,0x49,0x49,0x79,0x49,0x48,0x48,0x78,0x48,0x00,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x22,0x22,0x1E,0x00, + /* 0xEDF0 [?] [7224]*/ + 0x00,0x00,0x78,0x49,0x49,0x7A,0x4A,0x4C,0x78,0x48,0x48,0x48,0x78,0x48,0x01,0x06, + 0x40,0x40,0x40,0x48,0x44,0x42,0x42,0x48,0x48,0x48,0x10,0x10,0x20,0x40,0x80,0x00, + /* 0xEDF1 [?] [7225]*/ + 0x00,0x00,0x78,0x4B,0x4A,0x7C,0x48,0x48,0x78,0x48,0x48,0x49,0x79,0x4A,0x04,0x08, + 0x40,0x40,0x40,0xFC,0x44,0x48,0x40,0x40,0xA0,0xA0,0xA0,0x20,0x22,0x22,0x1E,0x00, + /* 0xEDF2 [?] [7226]*/ + 0x01,0x11,0x1F,0x21,0x5F,0x01,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0x00,0xF8,0x00,0xF0,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xEDF3 [?] [7227]*/ + 0x10,0x1E,0x22,0x62,0x94,0x08,0x30,0xC0,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0xF8,0x88,0xA8,0x92,0x82,0x7E,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xEDF4 [?] [7228]*/ + 0x00,0x00,0x7C,0x44,0x44,0x7C,0x45,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x00,0x00, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xEDF5 [?] [7229]*/ + 0x00,0x00,0x7D,0x44,0x44,0x7C,0x47,0x44,0x7C,0x44,0x45,0x44,0x7C,0x44,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xEDF6 [?] [7230]*/ + 0x00,0x00,0x78,0x4A,0x4A,0x7A,0x4A,0x4A,0x7A,0x4A,0x4A,0x4A,0x7A,0x4F,0x02,0x00, + 0x90,0x90,0x90,0x90,0x92,0xD4,0x98,0x90,0x90,0x90,0x90,0x92,0xD2,0x12,0x0E,0x00, + /* 0xEDF7 [?] [7231]*/ + 0x00,0x00,0x7C,0x44,0x45,0x7C,0x44,0x44,0x7D,0x44,0x44,0x45,0x7C,0x44,0x00,0x01, + 0x20,0x20,0x7C,0x84,0x48,0x30,0x20,0x48,0x90,0x3E,0x42,0xA4,0x18,0x10,0x60,0x80, + /* 0xEDF8 [?] [7232]*/ + 0x00,0x00,0x78,0x49,0x4B,0x78,0x49,0x49,0x79,0x4A,0x48,0x4F,0x78,0x48,0x00,0x00, + 0x40,0x40,0x90,0x08,0xFC,0x24,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xEDF9 [?] [7233]*/ + 0x00,0x00,0x78,0x4B,0x48,0x79,0x48,0x48,0x7B,0x48,0x48,0x48,0x79,0x4A,0x04,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x24,0xA4,0xA8,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20, + /* 0xEDFA [?] [7234]*/ + 0x00,0x00,0x78,0x48,0x49,0x7A,0x4D,0x48,0x78,0x48,0x4A,0x49,0x79,0x48,0x07,0x00, + 0x40,0x40,0xA0,0xA0,0x10,0x08,0xF6,0x00,0x88,0x48,0x48,0x50,0x10,0x20,0xFE,0x00, + /* 0xEDFB [?] [7235]*/ + 0x01,0x00,0x78,0x4B,0x48,0x78,0x4B,0x4A,0x7A,0x4B,0x48,0x48,0x79,0x4A,0x04,0x00, + 0x08,0x88,0x90,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x62,0xA2,0x2A,0x24,0x20,0x20, + /* 0xEDFC [?] [7236]*/ + 0x00,0x00,0x78,0x49,0x4B,0x78,0x48,0x49,0x7A,0x48,0x49,0x4A,0x78,0x48,0x01,0x06, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xEDFD [?] [7237]*/ + 0x00,0x03,0x7A,0x4A,0x4A,0x7A,0x4A,0x4B,0x7A,0x4A,0x4A,0x4A,0x7A,0x4C,0x05,0x08, + 0x00,0xFE,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00,0x10,0x10,0xFE,0x10,0x10,0xFE,0x00, + /* 0xEDFE [?] [7238]*/ + 0x00,0x00,0x7B,0x4A,0x4A,0x7B,0x4A,0x4A,0x7B,0x48,0x48,0x48,0x78,0x49,0x02,0x04, + 0x00,0x40,0x9C,0x04,0x04,0x9C,0x04,0x04,0xFC,0x90,0x90,0x90,0x90,0x12,0x12,0x0E, + /* 0xEEA1 [?] [7239]*/ + 0x00,0x00,0x78,0x49,0x49,0x7B,0x4D,0x49,0x79,0x49,0x49,0x49,0x79,0x49,0x01,0x01, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xEEA2 [?] [7240]*/ + 0x00,0x00,0x7B,0x4A,0x4A,0x7B,0x4A,0x4A,0x7B,0x48,0x49,0x4F,0x78,0x48,0x00,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xEEA3 [?] [7241]*/ + 0x01,0x01,0x01,0x7F,0x40,0x9F,0x09,0x32,0x0C,0x3F,0xD0,0x1F,0x10,0x1F,0x10,0x1F, + 0x00,0xF8,0x00,0xFE,0x02,0xF4,0x20,0x90,0x60,0xF8,0x16,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xEEA4 [?] [7242]*/ + 0x01,0x06,0xF4,0x94,0x97,0xF4,0x94,0x97,0xF0,0x97,0x92,0x91,0xF0,0x90,0x01,0x0E, + 0x40,0x5C,0x44,0x44,0x5C,0x44,0x44,0xFC,0x40,0xFC,0x08,0x10,0xA0,0x40,0xB0,0x0E, + /* 0xEEA5 [?] [7243]*/ + 0x00,0x03,0x78,0x4A,0x49,0x78,0x49,0x4A,0x78,0x48,0x4B,0x48,0x78,0x48,0x01,0x02, + 0x10,0xD4,0x58,0x52,0x8C,0x88,0x04,0xFA,0x20,0x20,0xFE,0x20,0x50,0x88,0x04,0x02, + /* 0xEEA6 [?] [7244]*/ + 0x7E,0x24,0x18,0xFF,0x29,0x4A,0x98,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x20,0x3E,0x48,0xA8,0x10,0x28,0x46,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xEEA7 [?] [7245]*/ + 0x00,0x00,0x79,0x48,0x48,0x7B,0x48,0x49,0x7B,0x48,0x4B,0x4A,0x7A,0x4A,0x07,0x00, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x80,0x04,0xFE,0x02,0xFC,0x94,0x94,0x94,0xFE,0x00, + /* 0xEEA8 [?] [7246]*/ + 0x00,0x03,0x7A,0x48,0x49,0x79,0x49,0x49,0x79,0x48,0x48,0x4B,0x78,0x48,0x01,0x02, + 0x00,0xFE,0x02,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xFE,0x00,0x88,0x04,0x02, + /* 0xEEA9 [?] [7247]*/ + 0x00,0x03,0x78,0x49,0x49,0x79,0x49,0x48,0x79,0x48,0x4B,0x48,0x78,0x49,0x02,0x00, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xEEAA [?] [7248]*/ + 0x00,0x01,0x78,0x4B,0x4A,0x78,0x48,0x48,0x78,0x48,0x48,0x49,0x78,0x48,0x03,0x00, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEEAB [?] [7249]*/ + 0x00,0x07,0xF0,0x91,0x9F,0xF4,0x94,0x97,0xF4,0x97,0x94,0x94,0xF7,0x9C,0x00,0x00, + 0x08,0x88,0x88,0x10,0xDE,0x94,0xA4,0x94,0x94,0x94,0x94,0xC8,0x88,0x94,0xA4,0xC2, + /* 0xEEAC [?] [7250]*/ + 0x00,0x02,0xF1,0x97,0x91,0xF2,0x94,0x92,0xF2,0x93,0x94,0x9A,0xF1,0x92,0x04,0x08, + 0x40,0x48,0x50,0xFC,0x50,0x48,0x44,0x08,0x08,0xBE,0x88,0xA8,0x3E,0x08,0x08,0x08, + /* 0xEEAD [?] [7251]*/ + 0x08,0xFF,0x08,0x7E,0x42,0x7E,0x24,0xFE,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F, + 0x10,0x7E,0x10,0x7C,0x44,0x28,0x18,0xE6,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xEEAE [?] [7252]*/ + 0x00,0x00,0x7D,0x54,0x54,0x54,0x54,0x7C,0x54,0x54,0x54,0x54,0x7C,0x44,0x00,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xEEAF [?] [7253]*/ + 0x00,0x1F,0x11,0x11,0x1F,0x11,0x11,0x1F,0x00,0x00,0xFF,0x08,0x08,0x08,0x10,0x20, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xEEB0 [?] [7254]*/ + 0x00,0x00,0x7C,0x54,0x54,0x55,0x54,0x7C,0x54,0x54,0x54,0x54,0x7C,0x44,0x01,0x02, + 0x20,0x28,0x24,0x24,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEEB1 [?] [7255]*/ + 0x00,0x00,0x7C,0x54,0x54,0x55,0x56,0x7C,0x54,0x54,0x54,0x54,0x7C,0x44,0x01,0x02, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xEEB2 [?] [7256]*/ + 0x00,0x00,0x7D,0x55,0x55,0x55,0x55,0x7D,0x55,0x55,0x55,0x55,0x7D,0x46,0x02,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xEEB3 [?] [7257]*/ + 0x00,0x00,0x7C,0x54,0x55,0x56,0x54,0x7C,0x55,0x54,0x54,0x54,0x7D,0x44,0x00,0x03, + 0x20,0x20,0x50,0x88,0x04,0x12,0x20,0x40,0x88,0x10,0x20,0x44,0x88,0x10,0x60,0x80, + /* 0xEEB4 [?] [7258]*/ + 0x01,0x02,0x0C,0x37,0xC0,0x3F,0x09,0x11,0x25,0x02,0x3F,0x21,0x3F,0x21,0x3F,0x20, + 0x00,0x80,0x60,0xD8,0x06,0xF8,0x20,0x10,0x08,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xEEB5 [?] [7259]*/ + 0x00,0x00,0xFB,0xAA,0xAD,0xA9,0xF9,0xAA,0xAA,0xAB,0xAC,0xF8,0x89,0x01,0x02,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xEEB6 [?] [7260]*/ + 0x00,0x01,0x7C,0x54,0x57,0x54,0x55,0x7D,0x55,0x55,0x55,0x54,0x7D,0x44,0x03,0x00, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xEEB7 [?] [7261]*/ + 0x00,0x3F,0x24,0x24,0x3F,0x00,0x00,0x7F,0x01,0x03,0x05,0x09,0x31,0xC1,0x01,0x01, + 0x00,0xF8,0x48,0x48,0xF8,0x00,0x00,0xFC,0x00,0x00,0x70,0x0C,0x02,0x00,0x00,0x00, + /* 0xEEB8 [?] [7262]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x00,0x00,0x7F,0x01,0x11,0x11,0x11,0x11,0x11,0xFF,0x00, + 0x00,0xFC,0x44,0x44,0xFC,0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE,0x00, + /* 0xEEB9 [?] [7263]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x01,0x01,0xFF,0x01,0x01,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x00,0xFC,0x44,0x44,0xFC,0x00,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xEEBA [?] [7264]*/ + 0x00,0x3F,0x24,0x24,0x3F,0x01,0xFF,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x3F,0x20, + 0x00,0xF8,0x48,0x48,0xF8,0x00,0xFE,0x00,0xF8,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x08, + /* 0xEEBB [?] [7265]*/ + 0x3F,0x24,0x24,0x3F,0x02,0x7F,0x04,0x09,0x3F,0xD1,0x1F,0x11,0x1F,0x01,0x01,0x00, + 0xF8,0x48,0x48,0xF8,0x00,0xFC,0x40,0x20,0xF8,0x16,0xF0,0x10,0xF4,0x04,0x04,0xFC, + /* 0xEEBC [?] [7266]*/ + 0x3F,0x24,0x24,0x3F,0x01,0x01,0x3F,0x01,0xFF,0x04,0x08,0x1F,0x00,0x48,0x44,0x84, + 0xF8,0x48,0x48,0xF8,0x00,0x00,0xF8,0x00,0xFE,0x00,0x20,0xF0,0x10,0x88,0x44,0x44, + /* 0xEEBD [?] [7267]*/ + 0x7F,0x44,0x44,0x7F,0x01,0xFF,0x01,0x3F,0x24,0x22,0x2F,0x21,0x3F,0x21,0x21,0x20, + 0xFC,0x44,0x44,0xFC,0x00,0xFE,0x00,0xF8,0x48,0x88,0xE8,0x08,0xF8,0x08,0x28,0x10, + /* 0xEEBE [?] [7268]*/ + 0x00,0x7F,0x44,0x44,0x7F,0x10,0x10,0x19,0x55,0x53,0x95,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x44,0x44,0xFC,0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEEBF [?] [7269]*/ + 0x00,0x7F,0x44,0x7F,0x22,0x7F,0x22,0x3E,0x08,0x7F,0x49,0x7F,0x08,0xFF,0x08,0x08, + 0x00,0xFC,0x44,0xFC,0x00,0x78,0x08,0x48,0x48,0x7C,0x04,0x04,0xF4,0x04,0x14,0x08, + /* 0xEEC0 [?] [7270]*/ + 0x3F,0x24,0x24,0x3F,0x08,0x04,0x3F,0x29,0x25,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F, + 0xF8,0x48,0x48,0xF8,0x20,0x40,0xF8,0x28,0x48,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0, + /* 0xEEC1 [?] [7271]*/ + 0x01,0x01,0x3F,0x01,0x01,0xFF,0x04,0x08,0x1F,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x00,0xF8,0x00,0x00,0xFE,0x00,0x20,0xF0,0x10,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xEEC2 [?] [7272]*/ + 0x11,0x61,0x4D,0x45,0x75,0x49,0x49,0x75,0x42,0x00,0x3F,0x24,0x24,0x24,0xFF,0x00, + 0x00,0x1C,0x44,0x44,0x9C,0x84,0x44,0x5C,0x04,0x00,0xF8,0x48,0x48,0x48,0xFE,0x00, + /* 0xEEC3 [?] [7273]*/ + 0x44,0x24,0x28,0x00,0xFE,0x00,0x28,0x45,0x82,0x00,0xFE,0xAA,0xAA,0xAA,0xAF,0xF8, + 0x00,0xFE,0xAA,0xAA,0xFE,0x40,0xFE,0x22,0xFA,0xAA,0xAA,0xFA,0x22,0xFA,0x0A,0x04, + /* 0xEEC4 [?] [7274]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xEEC5 [?] [7275]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x84,0x84,0x84,0x7C,0x00, + /* 0xEEC6 [?] [7276]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x11,0x11,0x15,0x19,0x10,0x00, + 0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x40,0x80,0x80,0x00,0x04,0x04,0x04,0xFC,0x00, + /* 0xEEC7 [?] [7277]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x40,0x40,0x40,0x40,0x40,0x60,0x50,0x48,0x44,0x44,0x40,0x40,0x40,0x40,0x40,0x40, + /* 0xEEC8 [?] [7278]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x04,0x04,0x04,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x04,0x04,0x04,0x14,0x08, + /* 0xEEC9 [?] [7279]*/ + 0x10,0x11,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x00, + 0x00,0xFC,0x04,0x08,0x10,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xEECA [?] [7280]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x11,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x13,0x00, + 0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xEECB [?] [7281]*/ + 0x11,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x04,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x04,0x04, + /* 0xEECC [?] [7282]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x10,0x03, + 0x08,0x08,0x10,0x20,0x40,0x88,0x08,0x10,0x20,0x44,0x84,0x08,0x10,0x20,0xC0,0x00, + /* 0xEECD [?] [7283]*/ + 0x10,0x10,0x3C,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x80,0x40,0x5E,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x0A,0x04, + /* 0xEECE [?] [7284]*/ + 0x10,0x13,0x3D,0x21,0x41,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x11,0x06, + 0x00,0xFC,0x04,0x44,0x24,0xA8,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xEECF [?] [7285]*/ + 0x10,0x10,0x3C,0x20,0x43,0xBC,0x10,0x10,0xFC,0x11,0x10,0x10,0x14,0x18,0x10,0x03, + 0x40,0x40,0x40,0x40,0xFE,0x88,0x88,0x88,0x88,0x08,0x90,0x50,0x20,0x50,0x88,0x04, + /* 0xEED0 [?] [7286]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x10,0xFC,0x11,0x12,0x10,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x20,0x20,0x68,0xA4,0x22,0x22,0x20,0x20,0x20,0x20,0x20, + /* 0xEED1 [?] [7287]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7D,0x90,0x10,0xFE,0x10,0x10,0x12,0x14,0x18,0x11,0x02, + 0x20,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x50,0x50,0x50,0x88,0xC8,0x24,0x02, + /* 0xEED2 [?] [7288]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x00, + 0x00,0xFE,0x00,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x00,0x00,0x00,0xFE,0x00, + /* 0xEED3 [?] [7289]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x08,0x1C,0xE0,0x00,0x00,0xFC,0x44,0x44,0x44,0x28,0x28,0x10,0x10,0x28,0x44,0x82, + /* 0xEED4 [?] [7290]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBD,0x12,0x10,0xFC,0x11,0x10,0x10,0x14,0x18,0x10,0x00, + 0x20,0x20,0x50,0x50,0x88,0x44,0x22,0x20,0x00,0xFC,0x04,0x08,0x08,0x10,0x10,0x20, + /* 0xEED5 [?] [7291]*/ + 0x10,0x10,0x3C,0x23,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x40,0x20,0x20,0xFE,0x80,0x80,0x80,0xFC,0x84,0x84,0x84,0x84,0x04,0x04,0x28,0x10, + /* 0xEED6 [?] [7292]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x19,0x11,0x02, + 0x40,0x20,0x00,0xFC,0x00,0x00,0xF0,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xEED7 [?] [7293]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBD,0x10,0x10,0xFC,0x10,0x13,0x10,0x14,0x18,0x10,0x00, + 0x10,0x10,0x90,0x90,0x10,0x10,0x90,0x90,0x10,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10, + /* 0xEED8 [?] [7294]*/ + 0x10,0x10,0x1E,0x20,0x20,0x7C,0x90,0x11,0xFE,0x10,0x10,0x12,0x14,0x18,0x11,0x02, + 0x20,0x20,0x20,0x24,0xA4,0xA4,0xA8,0x20,0x20,0x50,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEED9 [?] [7295]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xEEDA [?] [7296]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x10,0xFD,0x10,0x10,0x10,0x14,0x18,0x13,0x00, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0xFC,0x20,0x28,0x24,0x24,0x20,0xFE,0x00, + /* 0xEEDB [?] [7297]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x13,0x00, + 0x00,0x00,0xFE,0x10,0x10,0x10,0x90,0x90,0x9E,0x90,0x90,0x90,0x90,0x90,0xFE,0x00, + /* 0xEEDC [?] [7298]*/ + 0x10,0x10,0x3C,0x20,0x43,0xBC,0x10,0x10,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xEEDD [?] [7299]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x14,0x18,0x10,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xEEDE [?] [7300]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x00, + 0x00,0xFE,0x00,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x7C,0x44,0x00,0x00,0xFE,0x00, + /* 0xEEDF [?] [7301]*/ + 0x20,0x20,0x38,0x23,0x40,0x78,0xA1,0x21,0xFB,0x25,0x21,0x21,0x29,0x31,0x20,0x00, + 0x40,0x40,0x40,0xFE,0x80,0xA0,0x20,0xFC,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xEEE0 [?] [7302]*/ + 0x10,0x10,0x3C,0x20,0x43,0xBC,0x10,0x10,0xFD,0x11,0x11,0x11,0x16,0x1A,0x14,0x01, + 0x50,0x48,0x48,0x40,0xFE,0x80,0x80,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xEEE1 [?] [7303]*/ + 0x20,0x20,0x38,0x20,0x43,0x7A,0xA2,0x22,0xFA,0x22,0x22,0x22,0x2B,0x32,0x20,0x00, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x24,0x24,0x24,0x28,0x28,0x90,0x12,0x2A,0x46,0x82, + /* 0xEEE2 [?] [7304]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xEEE3 [?] [7305]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x14,0x18,0x13,0x00, + 0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04,0x00,0x00,0xFE,0x00, + /* 0xEEE4 [?] [7306]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xEEE5 [?] [7307]*/ + 0x20,0x20,0x3B,0x22,0x42,0x7A,0xA2,0x23,0xF8,0x20,0x21,0x21,0x2A,0x34,0x20,0x00, + 0x08,0x3C,0xC0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xEEE6 [?] [7308]*/ + 0x10,0x10,0x3C,0x23,0x40,0xBC,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x40,0x20,0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x34,0x28,0x20,0x20, + /* 0xEEE7 [?] [7309]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBC,0x10,0x10,0xFD,0x10,0x10,0x10,0x14,0x19,0x10,0x00, + 0x20,0x10,0x10,0xFE,0x20,0x20,0x44,0x84,0xF8,0x10,0x20,0x44,0x82,0xFE,0x82,0x00, + /* 0xEEE8 [?] [7310]*/ + 0x10,0x10,0x3C,0x21,0x41,0xBE,0x10,0x10,0xFC,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xEEE9 [?] [7311]*/ + 0x10,0x10,0x3C,0x20,0x40,0xBC,0x10,0x11,0xFD,0x11,0x12,0x10,0x14,0x19,0x12,0x00, + 0x40,0x20,0x28,0x08,0x08,0x48,0x54,0x52,0x52,0x60,0x60,0x44,0xC4,0x44,0x3C,0x00, + /* 0xEEEA [?] [7312]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x40,0x44,0x48,0x70,0x40,0x42,0x42,0x3E,0x00, + /* 0xEEEB [?] [7313]*/ + 0x10,0x10,0x3C,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x1A,0x12,0x04, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xEEEC [?] [7314]*/ + 0x10,0x13,0x3D,0x20,0x40,0xBC,0x10,0x13,0xFC,0x11,0x10,0x10,0x17,0x18,0x10,0x00, + 0x00,0xFC,0x04,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xEEED [?] [7315]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBD,0x10,0x10,0xFD,0x12,0x14,0x10,0x14,0x18,0x10,0x00, + 0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0xFE,0x40,0x80,0xFC,0x04,0x04,0x28,0x10, + /* 0xEEEE [?] [7316]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBC,0x13,0x10,0xFC,0x11,0x12,0x10,0x14,0x18,0x10,0x00, + 0x40,0x40,0x44,0xF4,0x48,0x50,0xFE,0x40,0x80,0x84,0x98,0xE0,0x82,0x82,0x7E,0x00, + /* 0xEEEF [?] [7317]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBC,0x10,0x10,0xFC,0x10,0x10,0x10,0x15,0x18,0x10,0x00, + 0x00,0xFE,0x88,0x88,0x88,0xF8,0x88,0x88,0xF8,0x88,0x88,0x9E,0xE8,0x08,0x08,0x08, + /* 0xEEF0 [?] [7318]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBC,0x10,0x11,0xFE,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x20,0x20,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x94,0x88, + /* 0xEEF1 [?] [7319]*/ + 0x20,0x20,0x38,0x20,0x43,0x7A,0xA2,0x22,0xFB,0x22,0x22,0x22,0x2A,0x35,0x24,0x08, + 0x28,0x24,0x24,0x20,0xFE,0x20,0x24,0x24,0xA4,0xA8,0xA8,0x90,0x92,0xAA,0x46,0x82, + /* 0xEEF2 [?] [7320]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBD,0x10,0x10,0xFC,0x13,0x10,0x10,0x14,0x18,0x11,0x02, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xEEF3 [?] [7321]*/ + 0x20,0x20,0x38,0x23,0x40,0x78,0xA0,0x23,0xF8,0x23,0x20,0x20,0x29,0x31,0x22,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xEEF4 [?] [7322]*/ + 0x20,0x27,0x38,0x44,0x44,0x7C,0xA7,0x20,0xF9,0x21,0x22,0x2A,0x34,0x28,0x02,0x01, + 0x00,0xDE,0x92,0x92,0x94,0x94,0xD8,0x94,0x92,0x92,0x92,0x9A,0x94,0x90,0x90,0x10, + /* 0xEEF5 [?] [7323]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBC,0x13,0x10,0xFC,0x10,0x11,0x10,0x14,0x18,0x13,0x00, + 0x20,0x24,0xA4,0xA4,0xA8,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEEF6 [?] [7324]*/ + 0x20,0x21,0x39,0x21,0x41,0x78,0xA0,0x23,0xFA,0x22,0x22,0x22,0x2A,0x32,0x20,0x00, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x2A,0x24,0x20,0x20, + /* 0xEEF7 [?] [7325]*/ + 0x20,0x23,0x3A,0x22,0x42,0x7A,0xA3,0x22,0xFA,0x22,0x22,0x22,0x2B,0x32,0x23,0x02, + 0x00,0xFE,0x02,0x22,0x22,0x22,0xFE,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0xFE,0x02, + /* 0xEEF8 [?] [7326]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBC,0x11,0x10,0xFC,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xEEF9 [?] [7327]*/ + 0x20,0x21,0x39,0x21,0x41,0x7A,0xA0,0x23,0xF8,0x20,0x20,0x21,0x29,0x32,0x20,0x00, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xEEFA [?] [7328]*/ + 0x20,0x20,0x3B,0x20,0x40,0x79,0xA1,0x23,0xF8,0x22,0x22,0x21,0x29,0x32,0x24,0x08, + 0x00,0x06,0xB8,0x88,0x88,0x08,0x3E,0x88,0x88,0x88,0x88,0x3E,0x00,0x80,0x7E,0x00, + /* 0xEEFB [?] [7329]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBD,0x10,0x10,0xFC,0x13,0x10,0x10,0x14,0x19,0x13,0x01, + 0x08,0x3C,0xE0,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x40,0x88,0x04,0xFE,0x02, + /* 0xEEFC [?] [7330]*/ + 0x10,0x10,0x3D,0x21,0x43,0xBD,0x11,0x11,0xFD,0x10,0x13,0x10,0x14,0x18,0x10,0x00, + 0x90,0x94,0x14,0x18,0x10,0x32,0x52,0x0E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xEEFD [?] [7331]*/ + 0x20,0x20,0x38,0x21,0x42,0x7C,0xA3,0x20,0xF8,0x20,0x23,0x20,0x28,0x30,0x27,0x00, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x40,0x40,0x40,0xF8,0x40,0x40,0x40,0xFE,0x00, + /* 0xEEFE [?] [7332]*/ + 0x20,0x20,0x38,0x21,0x42,0x7C,0xA3,0x20,0xF8,0x23,0x22,0x22,0x2A,0x32,0x23,0x02, + 0x40,0x40,0xA0,0x10,0x08,0x06,0xF8,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xEFA1 [?] [7333]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBC,0x11,0x10,0xFF,0x10,0x10,0x10,0x15,0x1A,0x10,0x00, + 0x04,0x88,0x50,0x20,0x50,0x88,0x24,0x20,0xFE,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xEFA2 [?] [7334]*/ + 0x10,0x10,0x3C,0x21,0x40,0xBC,0x10,0x10,0xFC,0x11,0x12,0x10,0x14,0x18,0x11,0x02, + 0x50,0x50,0x50,0x52,0xD4,0x58,0x50,0x58,0xD4,0x52,0x50,0x50,0x92,0x92,0x12,0x0E, + /* 0xEFA3 [?] [7335]*/ + 0x20,0x20,0x39,0x22,0x40,0x7B,0xA0,0x20,0xFB,0x20,0x20,0x23,0x28,0x30,0x20,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0xFE,0x24,0x24,0xFC,0x24,0x20,0xA0,0x40, + /* 0xEFA4 [?] [7336]*/ + 0x10,0x10,0x3C,0x21,0x42,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x10,0x00, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xEFA5 [?] [7337]*/ + 0x10,0x10,0x3C,0x23,0x40,0xBC,0x11,0x13,0xFC,0x10,0x10,0x10,0x15,0x19,0x12,0x04, + 0x40,0x20,0x20,0xFE,0x40,0x88,0x04,0xFE,0x92,0x90,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xEFA6 [?] [7338]*/ + 0x22,0x21,0x39,0x24,0x42,0x7A,0xA0,0x21,0xF9,0x22,0x26,0x22,0x2A,0x33,0x22,0x00, + 0x00,0x7C,0x04,0x08,0x10,0x20,0x7E,0x2A,0x2A,0x2A,0x4A,0x52,0x92,0x22,0x4A,0x84, + /* 0xEFA7 [?] [7339]*/ + 0x20,0x20,0x38,0x23,0x42,0x7C,0xA0,0x23,0xF8,0x20,0x21,0x20,0x28,0x30,0x20,0x03, + 0x40,0x20,0x20,0xFE,0x02,0x44,0x40,0xFE,0x88,0x88,0x08,0xD0,0x20,0x50,0x88,0x04, + /* 0xEFA8 [?] [7340]*/ + 0x21,0x21,0x39,0x21,0x47,0x7A,0xA2,0x22,0xFA,0x24,0x22,0x21,0x2A,0x32,0x24,0x08, + 0x00,0x00,0x00,0x1E,0xD2,0x52,0x52,0x52,0x52,0x92,0x92,0x12,0x92,0x5E,0x52,0x00, + /* 0xEFA9 [?] [7341]*/ + 0x20,0x20,0x3B,0x20,0x40,0x7B,0xA2,0x24,0xF8,0x23,0x20,0x20,0x28,0x31,0x22,0x04, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x44,0x40,0xFC,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xEFAA [?] [7342]*/ + 0x20,0x20,0x38,0x23,0x40,0x79,0xA0,0x20,0xFB,0x20,0x20,0x20,0x29,0x32,0x24,0x00, + 0x20,0x20,0x20,0xFE,0x20,0x24,0xA4,0xA8,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20,0x20, + /* 0xEFAB [?] [7343]*/ + 0x20,0x20,0x38,0x20,0x43,0x78,0xA0,0x20,0xF8,0x20,0x20,0x22,0x2A,0x32,0x24,0x00, + 0x10,0x14,0x12,0x10,0xFE,0x10,0x90,0x50,0x48,0x08,0x88,0xA8,0x9A,0xAA,0x66,0x02, + /* 0xEFAC [?] [7344]*/ + 0x20,0x22,0x3A,0x22,0x42,0x7A,0xA2,0x20,0xF8,0x20,0x21,0x20,0x28,0x30,0x23,0x00, + 0x80,0xFC,0xA4,0xA4,0xA8,0x90,0xA8,0xC6,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xEFAD [?] [7345]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x10,0x10,0xFD,0x10,0x10,0x11,0x14,0x18,0x13,0x00, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEFAE [?] [7346]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFC,0x10,0x11,0x10,0x14,0x18,0x13,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xEFAF [?] [7347]*/ + 0x20,0x21,0x39,0x21,0x41,0x7A,0xA0,0x23,0xF8,0x20,0x21,0x21,0x29,0x31,0x21,0x01, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEFB0 [?] [7348]*/ + 0x20,0x20,0x3B,0x20,0x40,0x7B,0xA0,0x20,0xF8,0x20,0x23,0x20,0x28,0x30,0x22,0x01, + 0x10,0xD8,0x94,0x94,0x90,0xFE,0x90,0x94,0x94,0xD8,0x98,0x90,0xAA,0xCA,0x86,0x02, + /* 0xEFB1 [?] [7349]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x12,0x14,0xFC,0x10,0x11,0x10,0x14,0x18,0x13,0x00, + 0x20,0x20,0x24,0x24,0x24,0x24,0xAA,0x72,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xEFB2 [?] [7350]*/ + 0x10,0x10,0x3D,0x20,0x41,0xBC,0x10,0x10,0xFD,0x10,0x10,0x10,0x14,0x18,0x10,0x00, + 0x04,0x1E,0xE0,0x22,0x12,0x94,0x80,0x08,0xFE,0x08,0x88,0x48,0x48,0x08,0x28,0x10, + /* 0xEFB3 [?] [7351]*/ + 0x20,0x20,0x3B,0x20,0x40,0x79,0xA3,0x20,0xF9,0x21,0x21,0x21,0x2A,0x32,0x24,0x08, + 0x40,0x20,0xFC,0x40,0x90,0x08,0xFC,0x04,0x50,0x50,0x50,0x50,0x50,0x52,0x52,0x0E, + /* 0xEFB4 [?] [7352]*/ + 0x21,0x20,0x3A,0x22,0x42,0x7A,0xA2,0x22,0xFB,0x22,0x22,0x22,0x2B,0x32,0x22,0x02, + 0x00,0xBE,0x82,0x02,0xFA,0x52,0x52,0x52,0xFE,0x52,0x52,0x92,0x12,0x02,0x0A,0x04, + /* 0xEFB5 [?] [7353]*/ + 0x21,0x20,0x3A,0x22,0x42,0x7A,0xA2,0x22,0xFA,0x22,0x22,0x22,0x2A,0x32,0x22,0x02, + 0x00,0xBE,0x82,0x02,0x02,0xFA,0x8A,0x8A,0xFA,0x8A,0x8A,0xFA,0x02,0x02,0x0A,0x04, + /* 0xEFB6 [?] [7354]*/ + 0x10,0x10,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xEFB7 [?] [7355]*/ + 0x10,0x11,0x3C,0x20,0x40,0xBD,0x10,0x13,0xFE,0x11,0x10,0x10,0x14,0x18,0x10,0x03, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x02,0xF8,0x88,0x88,0x50,0x20,0xD8,0x06, + /* 0xEFB8 [?] [7356]*/ + 0x20,0x23,0x3A,0x42,0x43,0x7A,0xA2,0x23,0xFA,0x22,0x22,0x2A,0x34,0x24,0x08,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0xF4,0x94,0x94,0xF4,0x04,0x28,0x10, + /* 0xEFB9 [?] [7357]*/ + 0x20,0x27,0x3D,0x25,0x45,0x7D,0xA6,0x25,0xFD,0x25,0x25,0x25,0x2E,0x34,0x24,0x04, + 0x00,0x7E,0x04,0x04,0x74,0x54,0x54,0x54,0x54,0x54,0x74,0x54,0x04,0x04,0x14,0x08, + /* 0xEFBA [?] [7358]*/ + 0x20,0x20,0x3B,0x20,0x41,0x78,0xA3,0x20,0xF9,0x21,0x21,0x21,0x29,0x31,0x21,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xEFBB [?] [7359]*/ + 0x20,0x20,0x3B,0x20,0x40,0x78,0xA3,0x20,0xF8,0x20,0x21,0x22,0x28,0x30,0x20,0x00, + 0x88,0x88,0xFE,0x88,0xA8,0x20,0xFE,0x40,0x80,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xEFBC [?] [7360]*/ + 0x20,0x20,0x3B,0x20,0x40,0x79,0xA2,0x20,0xF8,0x20,0x23,0x20,0x28,0x30,0x21,0x02, + 0x20,0x20,0xFE,0x50,0xA8,0x24,0xFA,0x20,0xA8,0x88,0xFE,0x88,0x88,0x88,0x08,0x08, + /* 0xEFBD [?] [7361]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x10,0x11,0xFC,0x13,0x10,0x11,0x14,0x18,0x10,0x00, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x08,0xFE,0x08,0x08,0x88,0x08,0x28,0x10, + /* 0xEFBE [?] [7362]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFC,0x13,0x10,0x10,0x15,0x1A,0x10,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xEFBF [?] [7363]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFC,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xEFC0 [?] [7364]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x00,0xFC,0x04,0x24,0x24,0xFC,0x24,0x24,0x74,0x54,0x54,0x74,0x04,0x04,0xFC,0x04, + /* 0xEFC1 [?] [7365]*/ + 0x20,0x20,0x38,0x21,0x42,0x78,0xA1,0x22,0xF8,0x21,0x20,0x20,0x2A,0x32,0x24,0x00, + 0x80,0x80,0xFC,0x54,0x54,0xA4,0x24,0x44,0x94,0x08,0x40,0xA4,0xAA,0x8A,0x78,0x00, + /* 0xEFC2 [?] [7366]*/ + 0x10,0x10,0x3D,0x20,0x41,0xBC,0x10,0x13,0xFC,0x10,0x11,0x11,0x15,0x19,0x11,0x01, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xEFC3 [?] [7367]*/ + 0x10,0x11,0x3C,0x20,0x41,0xBC,0x13,0x10,0xFD,0x12,0x14,0x10,0x14,0x18,0x10,0x00, + 0x20,0x24,0xA8,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x88,0x88,0xA8,0x92,0x82,0x7E, + /* 0xEFC4 [?] [7368]*/ + 0x20,0x22,0x3A,0x24,0x40,0x79,0xA6,0x20,0xF8,0x22,0x22,0x24,0x28,0x31,0x22,0x0C, + 0x40,0x44,0x44,0x48,0xA0,0x10,0x08,0x44,0x40,0x48,0x48,0x50,0xA0,0x10,0x08,0x06, + /* 0xEFC5 [?] [7369]*/ + 0x10,0x10,0x3D,0x22,0x41,0xBC,0x10,0x10,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x92,0x92,0x24,0x48,0x24,0x92,0x92,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xEFC6 [?] [7370]*/ + 0x21,0x21,0x3B,0x21,0x43,0x79,0xA7,0x21,0xF9,0x20,0x27,0x20,0x28,0x31,0x22,0x0C, + 0x00,0x3C,0xD4,0x14,0x94,0x14,0xD4,0x24,0x4C,0x40,0xFE,0x40,0xA0,0x10,0x08,0x06, + /* 0xEFC7 [?] [7371]*/ + 0x11,0x11,0x3D,0x21,0x41,0xBD,0x11,0x10,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x10,0x12,0xD4,0x18,0x52,0x92,0x2E,0x40,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xEFC8 [?] [7372]*/ + 0x20,0x21,0x39,0x21,0x41,0x79,0xA1,0x21,0xF8,0x20,0x20,0x22,0x2A,0x34,0x20,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x00,0x40,0x24,0xA2,0x8A,0x88,0x78,0x00, + /* 0xEFC9 [?] [7373]*/ + 0x20,0x23,0x3A,0x22,0x43,0x78,0xA1,0x20,0xFB,0x20,0x21,0x21,0x28,0x30,0x20,0x00, + 0x00,0xDE,0x52,0x52,0xDE,0x00,0xFC,0x00,0xFE,0x80,0x00,0xFC,0x04,0x04,0x28,0x10, + /* 0xEFCA [?] [7374]*/ + 0x10,0x10,0x3D,0x20,0x40,0xBD,0x10,0x10,0xFD,0x11,0x11,0x11,0x15,0x19,0x11,0x01, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x04, + /* 0xEFCB [?] [7375]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x11,0x11,0xFC,0x11,0x10,0x10,0x14,0x18,0x10,0x03, + 0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x20,0xFC,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xEFCC [?] [7376]*/ + 0x10,0x13,0x3C,0x21,0x40,0xBD,0x10,0x10,0xFD,0x10,0x10,0x11,0x15,0x1A,0x10,0x01, + 0x1E,0xE0,0x44,0x24,0x88,0xFC,0x40,0x40,0xFE,0x80,0xFC,0x44,0x28,0x10,0x68,0x86, + /* 0xEFCD [?] [7377]*/ + 0x20,0x20,0x3B,0x20,0x41,0x79,0xA1,0x21,0xF9,0x20,0x20,0x21,0x2A,0x34,0x20,0x00, + 0x40,0x20,0xFE,0x00,0xFC,0x04,0x04,0x04,0xFC,0x52,0x94,0x88,0x88,0xA4,0xC2,0x80, + /* 0xEFCE [?] [7378]*/ + 0x10,0x11,0x3C,0x20,0x43,0xBC,0x11,0x12,0xFC,0x13,0x10,0x11,0x15,0x18,0x11,0x06, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xEFCF [?] [7379]*/ + 0x10,0x10,0x3C,0x22,0x41,0xBC,0x10,0x10,0xFD,0x12,0x14,0x10,0x14,0x18,0x10,0x00, + 0x90,0x90,0x9E,0xA2,0xD4,0x88,0x94,0xA4,0xFE,0x84,0xA4,0x94,0x94,0x84,0x94,0x88, + /* 0xEFD0 [?] [7380]*/ + 0x20,0x27,0x38,0x23,0x42,0x7B,0xA1,0x22,0xFD,0x21,0x21,0x21,0x29,0x30,0x20,0x03, + 0x90,0xFC,0x94,0xFC,0x90,0xFE,0x12,0x16,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xEFD1 [?] [7381]*/ + 0x20,0x23,0x3A,0x42,0x43,0x7A,0xA2,0x22,0xFA,0x22,0x22,0x2A,0x34,0x24,0x08,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x00,0xFC,0x84,0x84,0xFC,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xEFD2 [?] [7382]*/ + 0x20,0x20,0x3B,0x20,0x40,0x79,0xA1,0x21,0xF9,0x21,0x20,0x23,0x28,0x30,0x21,0x02, + 0x88,0x88,0xFE,0x88,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xEFD3 [?] [7383]*/ + 0x20,0x23,0x38,0x21,0x41,0x79,0xA1,0x20,0xFB,0x22,0x22,0x23,0x2A,0x32,0x22,0x02, + 0x00,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x00,0xFE,0x8A,0x52,0xFE,0x22,0x22,0x2A,0x04, + /* 0xEFD4 [?] [7384]*/ + 0x20,0x20,0x39,0x23,0x45,0x79,0xA1,0x21,0xF9,0x21,0x23,0x20,0x28,0x31,0x22,0x04, + 0xA0,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x9E,0x02,0x0A,0x04, + /* 0xEFD5 [?] [7385]*/ + 0x10,0x10,0x3C,0x21,0x42,0xBC,0x10,0x10,0xFC,0x11,0x10,0x11,0x14,0x1B,0x10,0x00, + 0x20,0x50,0x88,0x74,0x02,0xF8,0x88,0xF8,0x0C,0xF0,0x20,0xFC,0x20,0xFE,0x20,0x60, + /* 0xEFD6 [?] [7386]*/ + 0x20,0x23,0x3A,0x22,0x42,0x7A,0xA3,0x20,0xFB,0x22,0x22,0x23,0x2A,0x32,0x23,0x02, + 0x40,0xBE,0x12,0x92,0x52,0xAA,0x24,0x40,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xEFD7 [?] [7387]*/ + 0x21,0x20,0x38,0x20,0x43,0x78,0xA0,0x21,0xFA,0x21,0x21,0x21,0x29,0x31,0x27,0x00, + 0x04,0x84,0x88,0x00,0xFE,0x00,0x88,0x04,0x02,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xEFD8 [?] [7388]*/ + 0x20,0x20,0x3B,0x22,0x40,0x79,0xA0,0x20,0xFB,0x20,0x20,0x23,0x28,0x30,0x23,0x00, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x40,0xA2,0x34,0x58,0x94,0x34,0x52,0x90,0x50,0x20, + /* 0xEFD9 [?] [7389]*/ + 0x20,0x20,0x3B,0x22,0x44,0x79,0xA1,0x21,0xF9,0x21,0x21,0x27,0x28,0x30,0x21,0x02, + 0x40,0x20,0xFE,0x02,0x14,0xE0,0x00,0x00,0xFC,0x10,0x10,0xFE,0x00,0x90,0x08,0x04, + /* 0xEFDA [?] [7390]*/ + 0x10,0x13,0x3C,0x21,0x41,0xBD,0x11,0x10,0xFD,0x10,0x13,0x10,0x14,0x19,0x12,0x00, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xEFDB [?] [7391]*/ + 0x20,0x21,0x38,0x23,0x42,0x78,0xA0,0x20,0xF8,0x20,0x20,0x21,0x28,0x30,0x23,0x00, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xEFDC [?] [7392]*/ + 0x20,0x21,0x39,0x21,0x41,0x79,0xA0,0x23,0xFA,0x23,0x20,0x21,0x28,0x30,0x21,0x06, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0xFC,0x00,0xF8,0x90,0x60,0x98,0x06, + /* 0xEFDD [?] [7393]*/ + 0x10,0x11,0x3D,0x21,0x41,0xBD,0x10,0x10,0xFD,0x10,0x10,0x13,0x14,0x19,0x12,0x00, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x40,0x88,0xF0,0x20,0x44,0xFE,0x22,0x24,0x22,0x60, + /* 0xEFDE [?] [7394]*/ + 0x20,0x27,0x3C,0x25,0x44,0x77,0xA4,0x25,0xFC,0x25,0x25,0x25,0x2D,0x39,0x29,0x11, + 0x20,0xFE,0x20,0xFC,0x24,0xFE,0x24,0xFC,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x2C, + /* 0xEFDF [?] [7395]*/ + 0x22,0x21,0x39,0x47,0x42,0x7A,0xA3,0x22,0xFA,0x22,0x22,0x2A,0x34,0x25,0x08,0x10, + 0x20,0x20,0x20,0xBE,0x40,0x20,0xBC,0xD0,0x90,0x90,0xFE,0x90,0xA8,0xA8,0x44,0x82, + /* 0xEFE0 [?] [7396]*/ + 0x22,0x21,0x39,0x47,0x42,0x7A,0xA3,0x22,0xFA,0x22,0x22,0x2A,0x34,0x25,0x08,0x10, + 0x10,0x10,0x10,0xBE,0x40,0x00,0xBE,0x8A,0x88,0xA8,0xAE,0xA8,0xA8,0xA8,0x5E,0x80, + /* 0xEFE1 [?] [7397]*/ + 0x20,0x20,0x3B,0x20,0x40,0x7B,0xA2,0x22,0xFA,0x22,0x22,0x22,0x2A,0x32,0x22,0x02, + 0x40,0x20,0xFE,0x88,0x50,0xFE,0x22,0xFA,0x22,0xFA,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xEFE2 [?] [7398]*/ + 0x20,0x23,0x38,0x23,0x42,0x7B,0xA0,0x21,0xF9,0x21,0x21,0x21,0x28,0x33,0x20,0x00, + 0x00,0xFE,0x50,0xFE,0x52,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20, + /* 0xEFE3 [?] [7399]*/ + 0x20,0x2F,0x38,0x4A,0x49,0x7B,0xA8,0x28,0xFA,0x2A,0x2B,0x28,0x38,0x29,0x09,0x12, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xEFE4 [?] [7400]*/ + 0x20,0x24,0x3A,0x20,0x47,0x79,0xA0,0x27,0xF8,0x23,0x20,0x27,0x28,0x31,0x22,0x0C, + 0xA0,0xA4,0xA8,0xA0,0xFC,0x10,0xA0,0xFC,0x40,0xF8,0x40,0xFC,0xA0,0x10,0x08,0x06, + /* 0xEFE5 [?] [7401]*/ + 0x20,0x20,0x39,0x23,0x45,0x79,0xA1,0x21,0xF8,0x23,0x20,0x21,0x29,0x31,0x21,0x01, + 0x80,0xF8,0x10,0xFC,0x24,0xFC,0x24,0xFC,0x00,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC, + /* 0xEFE6 [?] [7402]*/ + 0x21,0x20,0x3B,0x20,0x43,0x7A,0xA3,0x20,0xFB,0x20,0x20,0x20,0x2B,0x30,0x22,0x01, + 0x08,0x88,0xC8,0x10,0xDE,0x64,0xD4,0x14,0xD4,0x54,0x94,0xE8,0x88,0x94,0x94,0x22, + /* 0xEFE7 [?] [7403]*/ + 0x22,0x21,0x3D,0x24,0x45,0x7C,0xA5,0x25,0xFD,0x25,0x25,0x25,0x2C,0x35,0x24,0x04, + 0x00,0x7C,0x04,0x44,0xF4,0x44,0xF4,0x54,0x74,0xD4,0x54,0xF4,0xE4,0x54,0x44,0x4C, + /* 0xEFE8 [?] [7404]*/ + 0x21,0x20,0x3B,0x20,0x42,0x79,0xA0,0x27,0xF8,0x21,0x21,0x21,0x29,0x31,0x21,0x01, + 0x08,0x90,0xFC,0x90,0x94,0x98,0x90,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8, + /* 0xEFE9 [?] [7405]*/ + 0x20,0x20,0x3B,0x22,0x41,0x7A,0xA1,0x21,0xF9,0x20,0x23,0x22,0x2B,0x32,0x20,0x00, + 0x40,0x20,0xFE,0x8A,0x24,0x22,0xFC,0x24,0xFC,0x20,0xFE,0x22,0xFE,0x22,0x20,0x20, + /* 0xEFEA [?] [7406]*/ + 0x20,0x23,0x38,0x20,0x40,0x7B,0xA2,0x22,0xFA,0x23,0x20,0x20,0x28,0x30,0x25,0x02, + 0x00,0xBE,0xA2,0xA2,0xBE,0x88,0x08,0x3E,0x2A,0xAA,0xAA,0xBE,0x88,0x8A,0x7E,0x02, + /* 0xEFEB [?] [7407]*/ + 0x20,0x27,0x38,0x22,0x41,0x7A,0xA5,0x28,0xFB,0x22,0x22,0x23,0x2A,0x31,0x2F,0x00, + 0x20,0xA4,0xA8,0x92,0x14,0x08,0xF4,0x02,0xF8,0x08,0x08,0xF8,0x08,0x10,0xFE,0x00, + /* 0xEFEC [?] [7408]*/ + 0x20,0x23,0x38,0x20,0x41,0x7B,0xA1,0x21,0xF9,0x21,0x21,0x21,0x2B,0x30,0x20,0x03, + 0x88,0xFE,0xA8,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x70,0x8E, + /* 0xEFED [?] [7409]*/ + 0x20,0x23,0x3A,0x22,0x43,0x79,0xA3,0x24,0xFB,0x22,0x22,0x23,0x28,0x37,0x20,0x00, + 0x00,0xF8,0xA8,0xA8,0xF8,0x00,0xFC,0x84,0xE4,0xA4,0xA4,0xE4,0x94,0xF4,0x14,0x08, + /* 0xEFEE [?] [7410]*/ + 0x20,0x20,0x39,0x20,0x40,0x7B,0xA0,0x21,0xF9,0x21,0x21,0x21,0x28,0x32,0x22,0x04, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x94,0x8A,0x7A, + /* 0xEFEF [?] [7411]*/ + 0x20,0x20,0x37,0x44,0x4A,0x73,0xA4,0x2A,0xF5,0x22,0x24,0x23,0x28,0x32,0x24,0x00, + 0x80,0x40,0xFE,0x02,0x24,0xBC,0xA4,0xA8,0x10,0xE8,0x04,0xF8,0x40,0x48,0x44,0xC0, + /* 0xEFF0 [?] [7412]*/ + 0x20,0x20,0x3B,0x22,0x43,0x7A,0xA3,0x22,0xFA,0x22,0x22,0x22,0x2A,0x34,0x25,0x0A, + 0x40,0x20,0xFE,0x50,0xFE,0x52,0xFE,0x00,0x94,0xD8,0x90,0xD2,0x8E,0x00,0x54,0x2A, + /* 0xEFF1 [?] [7413]*/ + 0x10,0x10,0x3D,0x20,0x43,0xBC,0x11,0x11,0xFD,0x11,0x11,0x10,0x15,0x18,0x13,0x00, + 0x08,0x3C,0xE0,0x20,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xEFF2 [?] [7414]*/ + 0x20,0x21,0x3C,0x50,0x90,0x11,0x11,0xFF,0x11,0x11,0x10,0x28,0x24,0x44,0x41,0x80, + 0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0xE4,0x24,0x24,0x24,0x24,0x44,0x84, + /* 0xEFF3 [?] [7415]*/ + 0x20,0x20,0x21,0x7D,0x51,0x91,0x12,0xFC,0x10,0x10,0x11,0x28,0x24,0x44,0x43,0x80, + 0x20,0x20,0x24,0x24,0x24,0x24,0xAA,0x72,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xEFF4 [?] [7416]*/ + 0x20,0x20,0x20,0x7D,0x51,0x93,0x15,0xFD,0x11,0x11,0x11,0x29,0x25,0x45,0x41,0x81, + 0xA0,0x90,0x80,0xFE,0x10,0x10,0xFC,0x10,0x10,0xFC,0x10,0x10,0x10,0xFE,0x00,0x00, + /* 0xEFF5 [?] [7417]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x10, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xEFF6 [?] [7418]*/ + 0x08,0x1C,0xF0,0x11,0x11,0xFD,0x11,0x39,0x34,0x54,0x50,0x91,0x16,0x10,0x10,0x10, + 0x20,0x20,0x2E,0xF0,0x20,0x20,0x20,0xFE,0x22,0x62,0xA2,0x2A,0x24,0x20,0x20,0x20, + /* 0xEFF7 [?] [7419]*/ + 0x08,0x1C,0xF0,0x13,0x10,0xFC,0x10,0x31,0x38,0x54,0x54,0x91,0x11,0x12,0x10,0x10, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x70,0xA8,0xA8,0x24,0x24,0x22,0x20,0x20, + /* 0xEFF8 [?] [7420]*/ + 0x08,0x1C,0xF0,0x10,0x17,0xFC,0x10,0x38,0x35,0x51,0x52,0x94,0x18,0x10,0x10,0x10, + 0x40,0x50,0x48,0x40,0xFC,0x40,0xE0,0xE0,0x50,0x50,0x48,0x44,0x42,0x40,0x40,0x40, + /* 0xEFF9 [?] [7421]*/ + 0x08,0x1C,0xF0,0x10,0x10,0xFC,0x10,0x38,0x34,0x55,0x51,0x91,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x00,0x00,0xFE,0x02,0x02,0x02,0x02,0xFE,0x02, + /* 0xEFFA [?] [7422]*/ + 0x08,0x1C,0xF0,0x13,0x10,0xFC,0x10,0x38,0x35,0x54,0x50,0x91,0x11,0x11,0x11,0x10, + 0x48,0x44,0x40,0xFE,0x50,0x50,0x92,0x92,0x0E,0x20,0x20,0x24,0x24,0x24,0xFC,0x04, + /* 0xEFFB [?] [7423]*/ + 0x08,0x1C,0xF1,0x10,0x11,0xFC,0x10,0x39,0x34,0x50,0x53,0x90,0x10,0x10,0x10,0x10, + 0x04,0x1E,0xE0,0x02,0x22,0x94,0x00,0xFC,0x08,0x10,0xFE,0x10,0x10,0x10,0x50,0x20, + /* 0xEFFC [?] [7424]*/ + 0x08,0x1C,0xF1,0x11,0x11,0xFD,0x11,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xEFFD [?] [7425]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x11,0x31,0x38,0x57,0x54,0x90,0x11,0x12,0x10,0x10, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xEFFE [?] [7426]*/ + 0x08,0x1C,0xF0,0x10,0x11,0xFE,0x11,0x38,0x34,0x54,0x50,0x92,0x12,0x12,0x14,0x10, + 0x20,0x20,0x50,0x88,0x44,0x22,0xF8,0x08,0x50,0x20,0xA4,0x82,0x8A,0x8A,0x78,0x00, + /* 0xF0A1 [?] [7427]*/ + 0x08,0x1C,0xF3,0x10,0x11,0xFD,0x11,0x39,0x35,0x55,0x51,0x91,0x17,0x10,0x11,0x12, + 0x20,0x20,0xFE,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFE,0x88,0x04,0x02, + /* 0xF0A2 [?] [7428]*/ + 0x08,0x1D,0xF1,0x11,0x11,0xFD,0x10,0x31,0x3A,0x54,0x51,0x92,0x10,0x10,0x11,0x16, + 0x00,0xFC,0x24,0xFC,0x24,0xFC,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xF0A3 [?] [7429]*/ + 0x08,0x1C,0xF3,0x10,0x11,0xFC,0x13,0x30,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x20,0x20,0xFE,0x20,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x74,0x54,0x74,0x04,0xFC,0x04, + /* 0xF0A4 [?] [7430]*/ + 0x0C,0x70,0x10,0xFE,0x38,0x54,0x90,0x28,0x55,0x91,0x55,0x39,0x55,0x93,0x51,0x21, + 0x20,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF0A5 [?] [7431]*/ + 0x04,0x78,0x10,0xFE,0x11,0x3A,0x54,0x90,0x7C,0x44,0x44,0x7C,0x45,0x44,0x7C,0x45, + 0x40,0x40,0xFE,0x80,0xFC,0x84,0xFC,0x84,0xFC,0x40,0x7C,0xC4,0x28,0x10,0x68,0x86, + /* 0xF0A6 [?] [7432]*/ + 0x10,0xE7,0x20,0x23,0x22,0xFB,0x21,0x37,0x69,0x67,0xA1,0x2F,0x21,0x23,0x2D,0x21, + 0x40,0xFC,0x00,0xB8,0xA8,0xB8,0x10,0xFC,0x10,0xFC,0x10,0xFE,0x28,0x10,0x48,0x86, + /* 0xF0A7 [?] [7433]*/ + 0x10,0x10,0x20,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x45,0x7D,0x46,0x00, + 0x04,0x0E,0xF0,0x80,0x80,0xFC,0xA4,0xA4,0xA4,0xA8,0xA8,0x90,0x10,0x28,0x44,0x82, + /* 0xF0A8 [?] [7434]*/ + 0x10,0x10,0x20,0x7B,0x48,0x48,0x49,0x4A,0x78,0x48,0x48,0x48,0x48,0x78,0x49,0x06, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xF0A9 [?] [7435]*/ + 0x10,0x11,0x21,0x7D,0x45,0x46,0x44,0x47,0x7C,0x44,0x45,0x45,0x45,0x7D,0x45,0x01, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xF0AA [?] [7436]*/ + 0x08,0x08,0x7E,0x18,0x2C,0x2A,0x48,0x88,0x09,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x88,0x08,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xF0AB [?] [7437]*/ + 0x10,0x13,0x21,0x78,0x4B,0x48,0x49,0x4A,0x79,0x49,0x49,0x49,0x49,0x79,0x49,0x01, + 0x3C,0xE0,0x24,0xA8,0xFE,0xA8,0x24,0x02,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xF0AC [?] [7438]*/ + 0x02,0x07,0x38,0x2A,0x2A,0x2B,0x2A,0x2A,0x2A,0x29,0x29,0x28,0x28,0x4A,0x4D,0x89, + 0x10,0x10,0x50,0x7C,0x90,0x10,0xFE,0x10,0x28,0x24,0x42,0x82,0x40,0x30,0x0E,0x00, + /* 0xF0AD [?] [7439]*/ + 0x10,0x10,0xFE,0x28,0x44,0x82,0x7C,0x00,0xFE,0x20,0x40,0x7C,0x04,0x05,0x29,0x12, + 0x08,0x1C,0xE8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA4,0xA4,0xA4,0xA2,0x28,0x34,0x24, + /* 0xF0AE [?] [7440]*/ + 0x00,0x3F,0x00,0x06,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21,0x21,0x21,0x20, + 0x00,0xF0,0x20,0x40,0x80,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x08,0x08,0x28,0x10, + /* 0xF0AF [?] [7441]*/ + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0x25,0x26,0x45,0x40,0x80,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0B0 [?] [7442]*/ + 0x04,0x04,0x02,0xFF,0x00,0x00,0x02,0x1F,0x14,0x12,0x10,0x1F,0x00,0x7F,0x00,0x00, + 0x20,0x10,0x3E,0xC0,0x80,0x42,0x32,0xEE,0x20,0x60,0x00,0xF8,0x08,0x88,0x28,0x10, + /* 0xF0B1 [?] [7443]*/ + 0x40,0x48,0x50,0x60,0x44,0x44,0x3C,0x10,0x10,0x10,0xFE,0x10,0x11,0x10,0x10,0x10, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0B2 [?] [7444]*/ + 0x08,0x08,0x08,0x7F,0x49,0x08,0x08,0x14,0x14,0x14,0x14,0x25,0x26,0x44,0x80,0x00, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0B3 [?] [7445]*/ + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x7C,0x44,0x44,0x44,0x45,0x7C,0x44,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0B4 [?] [7446]*/ + 0x10,0x10,0x10,0xFF,0x20,0x28,0x48,0x48,0x7E,0x08,0x2C,0x2A,0x49,0x89,0x28,0x10, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0B5 [?] [7447]*/ + 0x10,0x10,0x1E,0x10,0x10,0x7C,0x44,0x44,0x44,0x7C,0x44,0x40,0x41,0x40,0x80,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0B6 [?] [7448]*/ + 0x20,0x20,0x40,0x7E,0x82,0x02,0x7A,0x4A,0x4A,0x4A,0x7A,0x4A,0x03,0x02,0x14,0x08, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0B7 [?] [7449]*/ + 0x01,0x07,0x7C,0x44,0x44,0x44,0x44,0x7F,0x44,0x44,0x44,0x42,0x42,0x52,0x69,0x44, + 0x10,0xA0,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0xFA,0x82,0x8A,0x84, + /* 0xF0B8 [?] [7450]*/ + 0x10,0x24,0x78,0x10,0x7E,0x00,0xFF,0x02,0x04,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x20,0x48,0xF0,0x20,0xFC,0x00,0xFE,0x00,0x00,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xF0B9 [?] [7451]*/ + 0x00,0x7F,0x08,0x08,0x10,0x7F,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x51,0x45,0x42, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0BA [?] [7452]*/ + 0x10,0x10,0xFB,0x10,0x19,0xF0,0x11,0x52,0x24,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x80,0x80,0xF0,0x90,0x90,0x94,0x54,0x0C,0x04,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xF0BB [?] [7453]*/ + 0x04,0x0E,0x38,0x08,0x08,0xFF,0x08,0x08,0x3E,0x22,0x22,0x22,0x23,0x3E,0x22,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0BC [?] [7454]*/ + 0x12,0x12,0x12,0x22,0x2F,0x62,0xA6,0x27,0x2A,0x2A,0x32,0x22,0x22,0x22,0x22,0x22, + 0x08,0x10,0x3E,0x22,0xB2,0x2A,0x22,0x26,0xA0,0xBE,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0BD [?] [7455]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x42,0x1F,0x14,0x12,0x10,0x1F,0x00,0x7F,0x00,0x00, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x04,0xE0,0x20,0x60,0x00,0xF8,0x08,0x88,0x28,0x10, + /* 0xF0BE [?] [7456]*/ + 0x10,0x10,0xFE,0x10,0x10,0xFE,0x82,0x04,0x78,0x08,0x10,0x1E,0xF1,0x10,0x50,0x20, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0BF [?] [7457]*/ + 0x00,0xFF,0x00,0x00,0xF7,0x94,0x94,0x94,0xD6,0xB5,0x94,0x94,0x94,0x94,0x94,0xB5, + 0x08,0x90,0x3E,0x22,0xB2,0xAA,0xA2,0xA6,0xA0,0xBE,0x82,0x82,0xFA,0x82,0x8A,0x84, + /* 0xF0C0 [?] [7458]*/ + 0x08,0x48,0x48,0x7F,0x88,0x08,0x08,0xFF,0x00,0x00,0x7E,0x42,0x42,0x42,0x7E,0x42, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C1 [?] [7459]*/ + 0x28,0x24,0x42,0x92,0x10,0x28,0x44,0x82,0x7C,0x44,0x44,0x44,0x45,0x7C,0x44,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0C2 [?] [7460]*/ + 0x40,0x2F,0x01,0x49,0x49,0x49,0x7F,0x49,0x5D,0x6B,0x49,0x49,0x49,0x41,0x45,0x42, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C3 [?] [7461]*/ + 0x44,0x24,0x28,0xFC,0x14,0x14,0xFC,0x90,0x90,0xFE,0x32,0x32,0x53,0x96,0x10,0x10, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0C4 [?] [7462]*/ + 0x04,0x06,0x75,0x05,0x04,0xFF,0x04,0x14,0x14,0x5C,0x54,0x54,0x55,0x5D,0xE3,0x41, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C5 [?] [7463]*/ + 0x22,0x22,0xFF,0x22,0x22,0x00,0x7F,0x49,0x49,0x49,0x7F,0x49,0x49,0x49,0x7F,0x41, + 0x08,0x10,0xBE,0x22,0x32,0x2A,0x22,0x26,0x20,0x3E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C6 [?] [7464]*/ + 0x08,0x08,0xFF,0x14,0x22,0x49,0x88,0x7F,0x49,0x7F,0x49,0x7F,0x08,0x0A,0x0C,0x08, + 0x08,0x10,0xBE,0x22,0x32,0x2A,0xA2,0x26,0x20,0x3E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C7 [?] [7465]*/ + 0x10,0x20,0x7F,0x49,0x49,0x7F,0x49,0x51,0x7F,0x24,0x44,0xFF,0x04,0x04,0x04,0x04, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x82,0x7A,0x02,0x0A,0x04, + /* 0xF0C8 [?] [7466]*/ + 0x10,0x08,0xFF,0x00,0x7E,0x42,0x7E,0x00,0x7E,0x04,0x08,0x0F,0xF8,0x08,0x28,0x10, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0C9 [?] [7467]*/ + 0x20,0x27,0x24,0xFC,0x24,0x27,0x24,0x74,0x54,0x57,0x54,0x54,0x74,0x08,0x0A,0x11, + 0x08,0x90,0xBE,0xA2,0xB2,0xAA,0xA2,0xA6,0xA0,0xBE,0x82,0x82,0xFA,0x82,0x8A,0x04, + /* 0xF0CA [?] [7468]*/ + 0x00,0x77,0x55,0x55,0x77,0x00,0x7F,0x00,0xFF,0x20,0x3F,0x01,0x01,0x01,0x0A,0x04, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0xC0,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0CB [?] [7469]*/ + 0x21,0x11,0x12,0xFF,0x21,0x21,0x42,0x52,0x94,0xE7,0x21,0x42,0x42,0x94,0xF7,0x10, + 0x08,0x10,0x3E,0xE2,0x32,0x2A,0x22,0xA6,0xA0,0x3E,0x02,0x02,0x7A,0x82,0x8A,0x84, + /* 0xF0CC [?] [7470]*/ + 0x00,0x7F,0x49,0x49,0x7F,0x40,0x5F,0x51,0x51,0x5F,0x51,0x5F,0x51,0x51,0x9F,0x11, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0CD [?] [7471]*/ + 0x00,0x7E,0x24,0x18,0xFF,0x29,0x4A,0x9A,0x04,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x20,0x20,0x7E,0xA4,0x28,0x10,0x28,0xC6,0x00,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xF0CE [?] [7472]*/ + 0x0E,0xF0,0x22,0x92,0x44,0x20,0x3C,0x50,0x10,0xFE,0x10,0x54,0x55,0x5C,0x64,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0CF [?] [7473]*/ + 0x22,0x14,0x00,0x7F,0x14,0x7F,0x15,0xFF,0x15,0x7F,0x14,0x36,0x55,0x94,0x14,0x14, + 0x10,0x20,0x7C,0xC4,0x64,0x54,0x44,0xCC,0x40,0x7E,0x02,0x02,0x7A,0x82,0x0A,0x04, + /* 0xF0D0 [?] [7474]*/ + 0x00,0x77,0x55,0x55,0x55,0x55,0x22,0x55,0x08,0xFF,0x12,0x22,0x34,0x0C,0x32,0xC1, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0D1 [?] [7475]*/ + 0x10,0x08,0x7F,0x40,0x52,0x52,0x7F,0x52,0x52,0x5E,0x40,0x55,0x55,0x55,0x80,0x00, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0D2 [?] [7476]*/ + 0x00,0x77,0x11,0x55,0x33,0x55,0x0C,0x33,0xC4,0x18,0x62,0x0C,0x71,0x06,0x18,0xE0, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0xC0,0x7E,0x02,0x82,0x7A,0x02,0x0A,0x04, + /* 0xF0D3 [?] [7477]*/ + 0x08,0x08,0x7F,0x08,0x55,0x22,0x41,0xBE,0x22,0x3E,0x22,0x3E,0x08,0x2A,0x49,0x18, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0xCC,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0D4 [?] [7478]*/ + 0x28,0x24,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x7E,0x41,0xAA,0xAA,0x00, + 0x20,0x40,0xFC,0x84,0xA4,0x84,0x94,0x88,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF0D5 [?] [7479]*/ + 0x08,0x7F,0x00,0x3E,0x22,0x3E,0x49,0x9A,0x04,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x28,0x24,0xFE,0x20,0x50,0x50,0x52,0x8E,0x00,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xF0D6 [?] [7480]*/ + 0x7E,0x14,0x08,0xFF,0x29,0x4A,0xA8,0x10,0x7F,0x55,0x63,0x5D,0x55,0x5D,0x41,0x43, + 0x10,0x20,0x7C,0x44,0x64,0x54,0x44,0x4C,0x40,0x7E,0x02,0x02,0x7A,0x02,0x0A,0x04, + /* 0xF0D7 [?] [7481]*/ + 0x10,0x21,0x7C,0x44,0x64,0x55,0x44,0x4C,0x40,0x7C,0x04,0x04,0xF5,0x04,0x14,0x09, + 0x44,0xFE,0x54,0x48,0xFE,0x90,0xFE,0x90,0xFE,0x90,0xFE,0x80,0xFE,0x44,0x38,0xC6, + /* 0xF0D8 [?] [7482]*/ + 0x00,0x3E,0x23,0x3E,0x09,0x2E,0x28,0x7E,0x04,0x1F,0x12,0x11,0x1F,0x00,0x7F,0x00, + 0x40,0xFC,0x48,0x30,0xCE,0x78,0x48,0x78,0x00,0xE0,0x20,0x60,0xFC,0x04,0xD4,0x08, + /* 0xF0D9 [?] [7483]*/ + 0x22,0xFF,0x22,0xF7,0x94,0xF7,0x28,0x24,0x7F,0x48,0xFF,0x48,0x7F,0x48,0x7F,0x40, + 0x08,0x90,0x3E,0xA2,0xB2,0xAA,0x22,0x26,0xA0,0x3E,0x02,0x02,0x7A,0x02,0x8A,0x04, + /* 0xF0DA [?] [7484]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x50,0x10,0x30,0x50,0x90,0x10,0x20,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xF0DB [?] [7485]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x30,0x50,0x90,0x10,0x20,0x20,0x41,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80, + /* 0xF0DC [?] [7486]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x30,0x50,0x90,0x10,0x20,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x94,0x88,0x80,0x80,0x80,0x80, + /* 0xF0DD [?] [7487]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x51,0x11,0x31,0x51,0x91,0x12,0x22,0x24,0x48,0x90, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x08,0x08,0x08,0x50,0x20, + /* 0xF0DE [?] [7488]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x50,0x14,0x34,0x54,0x94,0x14,0x24,0x27,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x40,0x40,0x40,0x44,0x44,0x44,0x44,0x44,0x44,0xFC,0x04,0x00, + /* 0xF0DF [?] [7489]*/ + 0x00,0x00,0x1F,0x10,0x93,0x52,0x52,0x12,0x32,0x52,0x92,0x12,0x22,0x24,0x44,0x89, + 0x80,0x40,0xFE,0x00,0xFE,0x00,0x20,0x20,0xFC,0x24,0x24,0x44,0x44,0x84,0xA8,0x10, + /* 0xF0E0 [?] [7490]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x50,0x17,0x30,0x51,0x91,0x11,0x22,0x22,0x44,0x88, + 0x80,0x40,0xFE,0x00,0x90,0x88,0x80,0xFE,0xA0,0x20,0x20,0x20,0x22,0x22,0x22,0x1E, + /* 0xF0E1 [?] [7491]*/ + 0x00,0x00,0x1F,0x10,0x92,0x52,0x5F,0x12,0x32,0x52,0x93,0x12,0x22,0x22,0x43,0x82, + 0x80,0x40,0xFE,0x00,0x08,0x08,0xFE,0x08,0x08,0x08,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xF0E2 [?] [7492]*/ + 0x00,0x00,0x1F,0x10,0x90,0x57,0x50,0x10,0x33,0x52,0x92,0x13,0x22,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFE,0x08,0x08,0xC8,0x48,0x48,0xC8,0x48,0x08,0x28,0x10, + /* 0xF0E3 [?] [7493]*/ + 0x01,0x00,0x3F,0x20,0x20,0xA7,0x64,0x24,0x27,0x64,0xA4,0x27,0x20,0x40,0x5F,0x80, + 0x00,0x80,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFE,0x00, + /* 0xF0E4 [?] [7494]*/ + 0x00,0x00,0x1F,0x12,0x92,0x53,0x55,0x19,0x31,0x51,0x91,0x11,0x21,0x21,0x41,0x81, + 0x80,0x40,0xFE,0x00,0x00,0xFE,0x00,0x00,0xF8,0x00,0x00,0xFC,0x00,0x00,0x00,0x00, + /* 0xF0E5 [?] [7495]*/ + 0x00,0x00,0x1F,0x12,0x92,0x53,0x54,0x1B,0x32,0x52,0x93,0x12,0x22,0x22,0x42,0x81, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x04,0xE4,0x24,0x24,0xE4,0x14,0x08,0x02,0x02,0xFE, + /* 0xF0E6 [?] [7496]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x57,0x10,0x30,0x50,0x93,0x10,0x20,0x20,0x4F,0x80, + 0x80,0x40,0xFE,0x80,0x40,0x00,0xFC,0x40,0x40,0x40,0xF8,0x40,0x40,0x40,0xFE,0x00, + /* 0xF0E7 [?] [7497]*/ + 0x00,0x00,0x1F,0x10,0x90,0x5F,0x50,0x11,0x32,0x57,0x90,0x10,0x21,0x22,0x47,0x82, + 0x80,0x40,0xFE,0x80,0x40,0xFE,0x80,0x08,0x10,0xE0,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xF0E8 [?] [7498]*/ + 0x01,0x00,0x3F,0x24,0x24,0xA4,0x6F,0x24,0x24,0x64,0xA4,0x24,0x28,0x48,0x52,0xA1, + 0x00,0x80,0xFE,0x00,0x00,0x00,0xBC,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0xBC,0xA4,0x00, + /* 0xF0E9 [?] [7499]*/ + 0x00,0x00,0x1F,0x10,0x90,0x53,0x50,0x10,0x34,0x52,0x92,0x10,0x20,0x20,0x47,0x80, + 0x80,0x40,0xFE,0x00,0x00,0xFC,0x90,0x90,0x92,0x92,0x94,0x98,0x90,0x90,0xFE,0x00, + /* 0xF0EA [?] [7500]*/ + 0x00,0x00,0x1F,0x10,0x9F,0x50,0x5F,0x10,0x37,0x54,0x97,0x10,0x20,0x21,0x42,0x8C, + 0x80,0x40,0xFE,0x40,0xFE,0x40,0xFC,0x44,0xFC,0x40,0xFE,0x42,0xAA,0x14,0x08,0x06, + /* 0xF0EB [?] [7501]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x57,0x10,0x30,0x53,0x90,0x10,0x21,0x25,0x45,0x88, + 0x80,0x40,0xFE,0x00,0x40,0x40,0xFC,0x40,0x40,0xFC,0x00,0x40,0x24,0x2A,0x0A,0xF8, + /* 0xF0EC [?] [7502]*/ + 0x00,0x00,0x1F,0x11,0x91,0x57,0x51,0x10,0x37,0x54,0x90,0x17,0x20,0x21,0x42,0x8C, + 0x80,0x40,0xFE,0x08,0x08,0xFE,0x08,0x00,0xFE,0x02,0x40,0xFC,0x84,0x04,0x28,0x10, + /* 0xF0ED [?] [7503]*/ + 0x00,0x00,0x1F,0x10,0x97,0x50,0x53,0x10,0x31,0x5F,0x90,0x13,0x22,0x22,0x43,0x82, + 0x80,0x40,0xFE,0x00,0xFC,0x80,0xF8,0x88,0x08,0xFE,0x00,0xF8,0x08,0x08,0xF8,0x08, + /* 0xF0EE [?] [7504]*/ + 0x00,0x00,0x1F,0x10,0x90,0x52,0x52,0x15,0x38,0x50,0x90,0x17,0x20,0x20,0x40,0x8F, + 0x80,0x40,0xFE,0x40,0x40,0x48,0x48,0x54,0xE2,0x40,0x40,0xFC,0x40,0x40,0x40,0xFE, + /* 0xF0EF [?] [7505]*/ + 0x00,0x00,0x1F,0x10,0x92,0x51,0x54,0x14,0x35,0x54,0x94,0x15,0x26,0x24,0x44,0x84, + 0x80,0x40,0xFE,0x00,0x00,0x7C,0x04,0x44,0xF4,0x44,0xE4,0x54,0x44,0x44,0x54,0x08, + /* 0xF0F0 [?] [7506]*/ + 0x00,0x00,0x1F,0x10,0x92,0x51,0x51,0x14,0x32,0x52,0x91,0x16,0x22,0x22,0x42,0x80, + 0x80,0x40,0xFE,0x10,0x10,0x10,0x54,0x52,0x92,0x10,0x14,0x04,0x08,0x10,0x20,0xC0, + /* 0xF0F1 [?] [7507]*/ + 0x01,0x00,0x3F,0x20,0x2F,0xA1,0x63,0x24,0x2D,0x62,0xA5,0x29,0x22,0x44,0x59,0x80, + 0x00,0x80,0xFE,0x00,0xFC,0x00,0x08,0x88,0x50,0x60,0xE0,0x50,0x50,0x48,0x44,0x80, + /* 0xF0F2 [?] [7508]*/ + 0x00,0x00,0x1F,0x10,0x90,0x50,0x57,0x10,0x30,0x53,0x90,0x10,0x27,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x00,0x90,0x90,0x9E,0x90,0x90,0x9C,0x90,0x90,0x9E,0x90,0x90,0x90, + /* 0xF0F3 [?] [7509]*/ + 0x00,0x00,0x1F,0x10,0x97,0x54,0x54,0x17,0x34,0x55,0x95,0x15,0x25,0x24,0x47,0x84, + 0x80,0x40,0xFE,0x00,0xFC,0x44,0x44,0xFC,0x44,0xF4,0x14,0x14,0xF4,0x04,0xFC,0x04, + /* 0xF0F4 [?] [7510]*/ + 0x00,0x00,0x1F,0x10,0x97,0x50,0x5F,0x11,0x32,0x5C,0x90,0x1F,0x21,0x23,0x40,0x8F, + 0x80,0x40,0xFE,0x38,0xC0,0x40,0xFE,0x50,0x48,0x46,0x80,0xFE,0x08,0x10,0xE0,0x1C, + /* 0xF0F5 [?] [7511]*/ + 0x01,0x00,0x3F,0x20,0x22,0xAC,0x68,0x28,0x2E,0x68,0xA8,0x2F,0x21,0x42,0x4C,0xB0, + 0x00,0x80,0xFE,0x00,0x80,0xB8,0x88,0x88,0xB8,0x88,0x88,0xF8,0x40,0x20,0x18,0x06, + /* 0xF0F6 [?] [7512]*/ + 0x01,0x00,0x3F,0x20,0x24,0xA2,0x6F,0x24,0x24,0x67,0xA4,0x24,0x28,0x48,0x52,0xA1, + 0x00,0x80,0xFE,0x00,0x10,0x10,0xA8,0x28,0x44,0x92,0x88,0x88,0xA0,0x90,0x88,0x08, + /* 0xF0F7 [?] [7513]*/ + 0x00,0x00,0x1F,0x12,0x91,0x57,0x54,0x17,0x34,0x57,0x94,0x10,0x2F,0x20,0x40,0x80, + 0x80,0x40,0xFE,0x08,0x10,0xFC,0x44,0xFC,0x44,0xFC,0x44,0x40,0xFE,0x40,0x40,0x40, + /* 0xF0F8 [?] [7514]*/ + 0x00,0x00,0x1F,0x11,0x91,0x57,0x51,0x17,0x35,0x57,0x91,0x13,0x25,0x29,0x41,0x81, + 0x80,0x40,0xFE,0x00,0x04,0xC4,0x14,0xD4,0x54,0xD4,0x14,0x94,0x54,0x44,0x14,0x08, + /* 0xF0F9 [?] [7515]*/ + 0x01,0x00,0x3F,0x20,0x2F,0xA4,0x62,0x3F,0x21,0x62,0xAC,0x30,0x2F,0x40,0x40,0x9F, + 0x00,0x80,0xFE,0x80,0xF8,0x90,0xA0,0xFE,0x40,0x20,0x98,0x86,0xF8,0x80,0x80,0xFC, + /* 0xF0FA [?] [7516]*/ + 0x01,0x00,0x3F,0x20,0x22,0xA2,0x64,0x2D,0x34,0x64,0xA5,0x24,0x25,0x44,0x44,0x85, + 0x00,0x80,0xFE,0x00,0xF8,0x08,0x08,0xFE,0x80,0xF8,0x20,0x20,0xFE,0x50,0x88,0x06, + /* 0xF0FB [?] [7517]*/ + 0x00,0x00,0x1F,0x11,0x90,0x57,0x50,0x13,0x30,0x57,0x91,0x13,0x24,0x28,0x47,0x80, + 0x80,0x40,0xFE,0x10,0xA0,0xFC,0x40,0xF8,0x80,0xFC,0x00,0xF8,0x40,0x40,0xFE,0x00, + /* 0xF0FC [?] [7518]*/ + 0x00,0x00,0x1F,0x12,0x91,0x5F,0x51,0x12,0x34,0x50,0x9F,0x11,0x23,0x20,0x41,0x86, + 0x80,0x40,0xFE,0x48,0x50,0xFE,0x50,0x48,0x44,0x80,0xFE,0x08,0x90,0x60,0x98,0x04, + /* 0xF0FD [?] [7519]*/ + 0x00,0x00,0x1F,0x10,0x97,0x54,0x54,0x17,0x34,0x54,0x97,0x14,0x24,0x27,0x44,0x84, + 0x80,0x40,0xFE,0x00,0xBC,0x84,0x84,0xBC,0x00,0x7C,0xA4,0x24,0x28,0x90,0x28,0x46, + /* 0xF0FE [?] [7520]*/ + 0x00,0x00,0x1F,0x10,0x97,0x52,0x51,0x10,0x33,0x5C,0x93,0x12,0x23,0x20,0x47,0x80, + 0x80,0x40,0xFE,0x00,0xFC,0x48,0x10,0xE0,0x18,0x46,0xF8,0x48,0xF8,0x44,0xFC,0x04, + /* 0xF1A1 [?] [7521]*/ + 0x00,0x00,0x1F,0x11,0x97,0x51,0x53,0x11,0x37,0x51,0x91,0x10,0x20,0x25,0x45,0x88, + 0x80,0x40,0xFE,0x00,0xBC,0x14,0x94,0x14,0xA4,0x4C,0x00,0x40,0x24,0x22,0x0A,0xF8, + /* 0xF1A2 [?] [7522]*/ + 0x00,0x00,0x1F,0x11,0x97,0x51,0x53,0x12,0x33,0x52,0x93,0x10,0x2F,0x20,0x43,0x8C, + 0x80,0x40,0xFE,0x10,0xFC,0x10,0xF8,0x08,0xF8,0x08,0xF8,0x40,0xFE,0xA0,0x18,0x06, + /* 0xF1A3 [?] [7523]*/ + 0x01,0x00,0x3F,0x24,0x2F,0xA9,0x6D,0x2B,0x3F,0x69,0xA9,0x2D,0x2B,0x49,0x49,0x93, + 0x00,0x80,0xFE,0x00,0x78,0x48,0x48,0x86,0x00,0x78,0x48,0x48,0x28,0x10,0x28,0x46, + /* 0xF1A4 [?] [7524]*/ + 0x00,0x00,0x1F,0x14,0x92,0x54,0x51,0x12,0x37,0x5A,0x93,0x12,0x23,0x22,0x42,0x82, + 0x80,0x40,0xFE,0x44,0x48,0xA4,0x10,0x08,0xFC,0x0A,0xF8,0x08,0xF8,0x08,0x28,0x10, + /* 0xF1A5 [?] [7525]*/ + 0x01,0x00,0x3F,0x22,0x2F,0xA2,0x7F,0x20,0x2F,0x68,0xAF,0x28,0x2F,0x42,0x44,0x88, + 0x00,0x80,0xFE,0x20,0xF8,0x20,0xFC,0x80,0xF8,0x88,0xF8,0x88,0xF8,0x20,0x10,0x08, + /* 0xF1A6 [?] [7526]*/ + 0x00,0x3F,0x20,0x3F,0xA1,0x6F,0x29,0x2F,0x60,0xA7,0x20,0x2F,0x22,0x44,0x49,0x80, + 0x80,0xFE,0x00,0xFE,0x20,0xFC,0x24,0xFC,0x00,0xF8,0x00,0xFC,0x48,0x44,0x42,0x80, + /* 0xF1A7 [?] [7527]*/ + 0x00,0x3F,0x20,0x27,0xA4,0x67,0x24,0x27,0x61,0xA2,0x27,0x20,0x2F,0x44,0x49,0x90, + 0x80,0xFE,0x00,0xFC,0x44,0xFC,0x44,0xFC,0x00,0x08,0xF0,0xC4,0xFE,0x48,0x44,0x82, + /* 0xF1A8 [?] [7528]*/ + 0x00,0x3F,0x20,0x2F,0xA8,0x6A,0x2A,0x2A,0x65,0xA8,0x3F,0x22,0x27,0x40,0x43,0x9C, + 0x80,0xFE,0x00,0xBE,0xA2,0xAA,0xAA,0xAA,0x14,0xA2,0xFE,0x08,0x10,0xE0,0x1C,0x02, + /* 0xF1A9 [?] [7529]*/ + 0x01,0x00,0x3F,0x22,0x23,0xA4,0x6A,0x25,0x22,0x65,0xA8,0x27,0x22,0x44,0x49,0x80, + 0x00,0x80,0xFE,0x20,0xBC,0xA4,0xA8,0x10,0x08,0xF6,0x00,0xFC,0x50,0x48,0x44,0x80, + /* 0xF1AA [?] [7530]*/ + 0x00,0x3F,0x20,0x2F,0xA9,0x6A,0x2C,0x2A,0x69,0xA9,0x2D,0x2A,0x28,0x48,0x48,0x88, + 0x80,0xFE,0x20,0x3C,0x44,0xA8,0x10,0x28,0x46,0x38,0x50,0x7E,0x90,0x7C,0x10,0xFE, + /* 0xF1AB [?] [7531]*/ + 0x00,0x3F,0x20,0x2E,0xAA,0x6B,0x2C,0x2A,0x6A,0xAA,0x2B,0x2E,0x28,0x49,0x49,0x8A, + 0x80,0xFE,0x40,0x78,0x88,0x10,0xFC,0x04,0xFC,0x04,0xFC,0x20,0x14,0x52,0x4A,0x38, + /* 0xF1AC [?] [7532]*/ + 0x00,0x3F,0x20,0x2F,0xA9,0x65,0x29,0x21,0x66,0xB8,0x23,0x2C,0x21,0x4E,0x41,0x8E, + 0x80,0xFE,0x00,0x7C,0x24,0x14,0xA4,0x60,0x18,0x86,0x20,0x40,0x88,0x30,0xC0,0x00, + /* 0xF1AD [?] [7533]*/ + 0x01,0x00,0x3F,0x20,0x2E,0xA4,0x65,0x24,0x25,0x6E,0xA4,0x24,0x24,0x46,0x59,0x82, + 0x00,0x80,0xFE,0x80,0x4E,0x44,0xF4,0x24,0x24,0xAE,0x44,0x44,0xA4,0xA4,0x0E,0x00, + /* 0xF1AE [?] [7534]*/ + 0x00,0x3F,0x22,0x2F,0xA2,0x62,0x2F,0x2A,0x6A,0xAF,0x22,0x27,0x2A,0x52,0x42,0x82, + 0x80,0xFE,0x10,0x9C,0x24,0x48,0xBE,0xA2,0xAA,0xAA,0x2A,0x2A,0xAA,0x94,0x22,0x42, + /* 0xF1AF [?] [7535]*/ + 0x00,0x00,0x1F,0x10,0x97,0x51,0x5F,0x10,0x33,0x52,0x93,0x12,0x23,0x25,0x45,0x88, + 0x80,0x40,0xFE,0x40,0xFC,0x10,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x44,0x2A,0xFA, + /* 0xF1B0 [?] [7536]*/ + 0x01,0x00,0x3F,0x20,0x2F,0xA8,0x6F,0x2A,0x2A,0x6F,0xAA,0x2F,0x28,0x52,0x54,0xA8, + 0x00,0x80,0xFE,0x00,0xDC,0x54,0xD4,0xA2,0x80,0xDC,0x94,0xD4,0x08,0x88,0x54,0x62, + /* 0xF1B1 [?] [7537]*/ + 0x01,0x00,0x3F,0x20,0x27,0xA4,0x64,0x27,0x24,0x64,0xAF,0x2C,0x34,0x47,0x44,0x80, + 0x00,0x80,0xFE,0x10,0x88,0xBE,0x80,0xA2,0x94,0x3E,0x88,0x88,0xBE,0x88,0x88,0x08, + /* 0xF1B2 [?] [7538]*/ + 0x00,0x3F,0x24,0x3F,0xA4,0x6F,0x29,0x2F,0x69,0xAF,0x29,0x2F,0x29,0x7F,0x49,0x90, + 0x80,0xFE,0x00,0xBE,0x08,0x10,0x3E,0x22,0x2A,0x2A,0x2A,0x2A,0x2A,0x94,0x12,0xA2, + /* 0xF1B3 [?] [7539]*/ + 0x00,0x1F,0x14,0x17,0x94,0x57,0x14,0x37,0x51,0x93,0x12,0x17,0x2A,0x23,0x42,0x83, + 0x80,0xFE,0xA4,0xBC,0xA4,0xBC,0xA4,0xBC,0x20,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE, + /* 0xF1B4 [?] [7540]*/ + 0x20,0x13,0x10,0xFC,0x02,0x09,0x89,0x88,0x48,0x49,0x52,0x50,0x1C,0xE0,0x41,0x00, + 0x00,0xDE,0x42,0x42,0x52,0x4A,0x4A,0x42,0xC6,0x4A,0x52,0x42,0x42,0x42,0x4A,0x84, + /* 0xF1B5 [?] [7541]*/ + 0x20,0x10,0x13,0xFC,0x00,0x09,0x89,0x89,0x49,0x48,0x50,0x50,0x1D,0xE2,0x40,0x00, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xF1B6 [?] [7542]*/ + 0x02,0x01,0x7F,0x40,0x88,0x10,0x22,0x04,0x0F,0x10,0x68,0x04,0x02,0x03,0x1C,0xE0, + 0x00,0x00,0xFE,0x02,0x24,0x10,0x08,0x00,0xF0,0x10,0x20,0x40,0x80,0x00,0x00,0x00, + /* 0xF1B7 [?] [7543]*/ + 0x02,0x01,0x7F,0x48,0x90,0x2F,0x00,0x00,0x1F,0x10,0x20,0x3F,0x00,0x00,0x00,0x00, + 0x00,0x00,0xFE,0x22,0x14,0xF8,0x10,0x10,0xF0,0x00,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xF1B8 [?] [7544]*/ + 0x02,0x01,0x7F,0x48,0x91,0x21,0xFF,0x01,0x21,0x21,0x21,0x3F,0x01,0x01,0x01,0x00, + 0x00,0x00,0xFE,0x22,0x14,0x08,0xFE,0x00,0x08,0x08,0x08,0xF8,0x0A,0x02,0x02,0xFE, + /* 0xF1B9 [?] [7545]*/ + 0x02,0x01,0x7F,0x48,0x90,0x01,0x3E,0x02,0x01,0x7F,0x00,0x01,0x0E,0x30,0x48,0x87, + 0x00,0x00,0xFE,0x22,0x14,0xF0,0x00,0x00,0x00,0xF8,0x60,0x80,0x00,0x00,0x00,0xFE, + /* 0xF1BA [?] [7546]*/ + 0x02,0x01,0x7F,0x48,0x90,0x08,0x08,0x12,0x22,0x7C,0x08,0x14,0x22,0x7E,0x21,0x02, + 0x00,0x00,0xFE,0x22,0x14,0x40,0x40,0xF8,0x48,0x48,0x48,0x48,0x88,0x88,0x28,0x10, + /* 0xF1BB [?] [7547]*/ + 0x02,0x01,0x7F,0x48,0x90,0x04,0x44,0x24,0x24,0x0C,0x34,0xC8,0x08,0x10,0x20,0x40, + 0x00,0x00,0xFE,0x22,0x14,0x40,0x48,0x50,0x60,0x40,0x60,0x52,0x4A,0x42,0x3E,0x00, + /* 0xF1BC [?] [7548]*/ + 0x02,0x01,0x7F,0x48,0x91,0x2F,0x01,0x7F,0x04,0x12,0x09,0xFF,0x02,0x04,0x18,0x60, + 0x00,0x00,0xFE,0x22,0x14,0xE8,0x00,0xFC,0x84,0x88,0x00,0xFE,0x60,0x10,0x08,0x04, + /* 0xF1BD [?] [7549]*/ + 0x02,0x01,0x7F,0x48,0x90,0x3F,0x11,0x1F,0x11,0x1F,0x01,0xFF,0x05,0x09,0x31,0xC1, + 0x00,0x00,0xFE,0x22,0x14,0xF8,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x40,0x20,0x18,0x06, + /* 0xF1BE [?] [7550]*/ + 0x02,0x01,0x7F,0x49,0x92,0x0C,0x37,0xC0,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x22,0x26, + 0x00,0x00,0xFE,0x22,0x94,0x60,0xD8,0x06,0x08,0x48,0x48,0x48,0x48,0x08,0x28,0x10, + /* 0xF1BF [?] [7551]*/ + 0x02,0x01,0x7F,0x4A,0x91,0x3F,0x08,0x04,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10, + 0x00,0x00,0xFE,0x22,0x14,0xF8,0x20,0x40,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xF1C0 [?] [7552]*/ + 0x02,0x01,0x7F,0x48,0x91,0x09,0x7F,0x05,0x19,0x61,0x04,0xFF,0x08,0x1E,0x03,0x3C, + 0x00,0x00,0xFE,0x22,0x14,0x20,0xFC,0x40,0x30,0x0C,0x00,0xFE,0x20,0x40,0xC0,0x38, + /* 0xF1C1 [?] [7553]*/ + 0x02,0x01,0x7F,0x48,0x90,0x06,0x38,0x28,0x2C,0x2A,0x2A,0x2A,0x28,0x55,0x5D,0x82, + 0x00,0x00,0xFE,0x22,0x14,0x1C,0xE8,0xA8,0xA8,0xA8,0xA8,0xA8,0xA4,0x54,0x74,0x12, + /* 0xF1C2 [?] [7554]*/ + 0x20,0x10,0x00,0xFC,0x08,0x10,0x10,0x34,0x58,0x94,0x14,0x10,0x10,0x10,0x10,0x10, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xF1C3 [?] [7555]*/ + 0x20,0x13,0x01,0xF9,0x09,0x10,0x10,0x34,0x58,0x94,0x14,0x10,0x10,0x10,0x11,0x16, + 0x00,0xFC,0x04,0x44,0x24,0xA8,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xF1C4 [?] [7556]*/ + 0x20,0x10,0x00,0xFD,0x09,0x11,0x11,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xF1C5 [?] [7557]*/ + 0x20,0x10,0x01,0xFC,0x08,0x10,0x10,0x35,0x58,0x94,0x14,0x10,0x10,0x10,0x11,0x10, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20,0xFC,0x00, + /* 0xF1C6 [?] [7558]*/ + 0x20,0x10,0x00,0xFC,0x08,0x11,0x12,0x34,0x58,0x95,0x14,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x50,0x50,0x88,0x44,0x22,0x20,0x00,0xFC,0x04,0x08,0x08,0x10,0x10,0x20, + /* 0xF1C7 [?] [7559]*/ + 0x20,0x10,0x00,0xF9,0x08,0x10,0x14,0x38,0x55,0x90,0x10,0x10,0x10,0x10,0x11,0x12, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF1C8 [?] [7560]*/ + 0x20,0x10,0x01,0xF8,0x08,0x10,0x15,0x38,0x54,0x90,0x13,0x10,0x10,0x10,0x10,0x10, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF1C9 [?] [7561]*/ + 0x20,0x11,0x00,0xFC,0x08,0x10,0x13,0x34,0x58,0x94,0x15,0x10,0x10,0x10,0x13,0x10, + 0x20,0x24,0xA4,0xA4,0xA8,0x20,0xFC,0x04,0x04,0x04,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xF1CA [?] [7562]*/ + 0x20,0x10,0x00,0xF8,0x09,0x12,0x11,0x34,0x58,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF1CB [?] [7563]*/ + 0x20,0x10,0x00,0xF9,0x0B,0x14,0x10,0x34,0x59,0x96,0x15,0x11,0x11,0x11,0x11,0x11, + 0x80,0x80,0xF8,0x08,0x10,0xA0,0x40,0xA0,0x18,0x06,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xF1CC [?] [7564]*/ + 0x20,0x11,0x01,0xF9,0x09,0x11,0x11,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x44,0x48,0x30,0x20,0x10,0x48,0x86,0x00, + /* 0xF1CD [?] [7565]*/ + 0x20,0x12,0x01,0xF9,0x08,0x10,0x17,0x35,0x59,0x95,0x15,0x11,0x11,0x12,0x14,0x10, + 0x10,0x10,0x10,0x7E,0x20,0x28,0x48,0x7E,0x08,0x08,0xFE,0x08,0x08,0x88,0x7E,0x00, + /* 0xF1CE [?] [7566]*/ + 0x20,0x11,0x01,0xF9,0x09,0x11,0x10,0x34,0x59,0x94,0x14,0x11,0x10,0x10,0x13,0x10, + 0x00,0xFC,0x04,0x04,0x04,0xFC,0x00,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xF1CF [?] [7567]*/ + 0x20,0x10,0x00,0xF8,0x09,0x12,0x11,0x34,0x58,0x94,0x11,0x10,0x10,0x10,0x13,0x10, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x00,0x44,0x24,0x24,0xA8,0x88,0x10,0xFE,0x00, + /* 0xF1D0 [?] [7568]*/ + 0x21,0x10,0x02,0xF2,0x12,0x22,0x22,0x6A,0xB2,0x2A,0x22,0x22,0x22,0x22,0x22,0x22, + 0x00,0xBE,0x82,0x02,0x02,0xFA,0x8A,0x8A,0xFA,0x8A,0x8A,0xFA,0x02,0x02,0x0A,0x04, + /* 0xF1D1 [?] [7569]*/ + 0x20,0x10,0x03,0xF8,0x08,0x11,0x10,0x34,0x5B,0x94,0x14,0x11,0x12,0x14,0x10,0x10, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x40,0xA4,0xA8,0x90,0x88,0xC6,0x80, + /* 0xF1D2 [?] [7570]*/ + 0x20,0x10,0x01,0xF8,0x08,0x13,0x14,0x38,0x54,0x91,0x12,0x10,0x10,0x10,0x10,0x10, + 0x20,0x22,0xFA,0x24,0x28,0xFE,0x20,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xF1D3 [?] [7571]*/ + 0x20,0x11,0x01,0xF9,0x09,0x11,0x15,0x39,0x54,0x91,0x12,0x14,0x11,0x12,0x10,0x11, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x80,0xFC,0x54,0x94,0x24,0x44,0x94,0x08, + /* 0xF1D4 [?] [7572]*/ + 0x20,0x10,0x03,0xFA,0x0A,0x13,0x16,0x3A,0x57,0x90,0x11,0x17,0x10,0x10,0x10,0x10, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xF1D5 [?] [7573]*/ + 0x20,0x13,0x02,0xF2,0x13,0x22,0x22,0x6B,0xB2,0x2A,0x22,0x22,0x22,0x24,0x24,0x28, + 0x00,0xFC,0x04,0x04,0xFC,0x20,0x20,0xFE,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xF1D6 [?] [7574]*/ + 0x20,0x17,0x00,0xF2,0x11,0x22,0x24,0x68,0xB0,0x2F,0x20,0x22,0x21,0x22,0x24,0x28, + 0x00,0xBC,0x84,0x94,0x08,0x94,0xA4,0x40,0x00,0xBC,0xA4,0xA4,0x28,0x90,0xA8,0x46, + /* 0xF1D7 [?] [7575]*/ + 0x20,0x10,0x03,0xF8,0x08,0x10,0x14,0x39,0x56,0x90,0x10,0x11,0x11,0x11,0x11,0x11, + 0x88,0x88,0xFE,0x88,0x20,0x50,0x88,0x04,0xFA,0x00,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF1D8 [?] [7576]*/ + 0x20,0x10,0x03,0xF8,0x08,0x13,0x10,0x35,0x59,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x50,0x52,0xDC,0x50,0xD2,0x4E,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xF1D9 [?] [7577]*/ + 0x21,0x11,0x01,0xF2,0x12,0x26,0x2A,0x6A,0xB2,0x2A,0x22,0x22,0x22,0x23,0x22,0x22, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x10,0x10,0xFE,0x38,0x54,0x54,0x94,0x12,0x10,0x10, + /* 0xF1DA [?] [7578]*/ + 0x20,0x11,0x00,0xF0,0x13,0x20,0x21,0x6A,0xB0,0x2B,0x20,0x21,0x21,0x20,0x21,0x26, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xF1DB [?] [7579]*/ + 0x20,0x10,0x03,0xF2,0x12,0x23,0x22,0x6A,0xB3,0x2B,0x23,0x25,0x25,0x25,0x29,0x21, + 0x80,0x40,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x54,0x54,0xFC,0x54,0x54,0x44,0x0C, + /* 0xF1DC [?] [7580]*/ + 0x20,0x11,0x01,0xF9,0x09,0x11,0x11,0x34,0x58,0x95,0x15,0x11,0x11,0x11,0x17,0x10, + 0x48,0x48,0x4E,0x50,0x68,0x44,0x44,0x40,0x00,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xF1DD [?] [7581]*/ + 0x20,0x10,0x03,0xF2,0x12,0x22,0x22,0x6A,0xB2,0x2A,0x22,0x22,0x22,0x24,0x25,0x2A, + 0x04,0x1E,0xF0,0x1E,0x10,0xFE,0x92,0x98,0xF2,0x8E,0x80,0xB8,0xA8,0xAA,0x4A,0x86, + /* 0xF1DE [?] [7582]*/ + 0x20,0x13,0x00,0xFA,0x09,0x12,0x10,0x34,0x59,0x95,0x15,0x11,0x11,0x11,0x11,0x11, + 0x00,0xDE,0x42,0x52,0x4A,0x52,0x42,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF1DF [?] [7583]*/ + 0x20,0x13,0x00,0xF0,0x10,0x23,0x22,0x6A,0xB2,0x2B,0x20,0x20,0x20,0x20,0x25,0x22, + 0x00,0xBE,0xA2,0xA2,0xBE,0x88,0x08,0x3E,0x2A,0xAA,0xAA,0xBE,0x88,0x8A,0x7E,0x02, + /* 0xF1E0 [?] [7584]*/ + 0x20,0x11,0x00,0xFB,0x0A,0x11,0x14,0x39,0x54,0x93,0x10,0x11,0x11,0x11,0x11,0x11, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFE,0x20,0xFC,0x54,0x54,0x54,0x0C, + /* 0xF1E1 [?] [7585]*/ + 0x22,0x12,0x07,0xF2,0x17,0x2A,0x22,0x6F,0xB2,0x2D,0x28,0x23,0x20,0x27,0x20,0x20, + 0xA8,0x48,0xBE,0xA8,0x5C,0xAA,0x88,0xFE,0x18,0xE4,0x42,0xF8,0x40,0xFC,0x40,0xC0, + /* 0xF1E2 [?] [7586]*/ + 0x00,0x00,0x7F,0x01,0x01,0x01,0x11,0x11,0x11,0x11,0x11,0x11,0x29,0x25,0x43,0x80, + 0x00,0x00,0xFC,0x04,0x08,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xF1E3 [?] [7587]*/ + 0x7F,0x01,0x11,0x11,0x11,0x29,0x47,0x80,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10, + 0xFC,0x04,0x00,0xF8,0x00,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x50,0x20, + /* 0xF1E4 [?] [7588]*/ + 0x00,0xFF,0x91,0x10,0xFE,0x20,0x28,0x48,0x7E,0x08,0x08,0x0E,0xF8,0x49,0x09,0x0A, + 0x10,0x10,0x10,0xFE,0x92,0x94,0x90,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0x28,0x44,0x82, + /* 0xF1E5 [?] [7589]*/ + 0x10,0x10,0x20,0x44,0xFE,0x28,0x44,0xA2,0x3C,0x44,0x44,0xA8,0x10,0x29,0x45,0x82, + 0x10,0x10,0x10,0xFE,0x92,0x94,0x90,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0x28,0x44,0x82, + /* 0xF1E6 [?] [7590]*/ + 0x00,0x7E,0x02,0x24,0x18,0x09,0xFE,0x0A,0x18,0x19,0x28,0x48,0x88,0x08,0x28,0x10, + 0x20,0x20,0x50,0x50,0x88,0x44,0x22,0x20,0x00,0xFC,0x04,0x08,0x08,0x10,0x10,0x20, + /* 0xF1E7 [?] [7591]*/ + 0x01,0x01,0x7F,0x01,0x01,0x3F,0x01,0x01,0xFF,0x03,0x05,0x09,0x31,0xC1,0x01,0x01, + 0x00,0x00,0xFC,0x00,0x00,0xF8,0x00,0x00,0xFE,0x80,0x40,0x20,0x18,0x06,0x00,0x00, + /* 0xF1E8 [?] [7592]*/ + 0x10,0x10,0x10,0xFC,0x10,0x78,0x10,0xFD,0x10,0x38,0x34,0x54,0x90,0x10,0x10,0x10, + 0x00,0xFC,0x04,0x08,0x08,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xF1E9 [?] [7593]*/ + 0x10,0x10,0x10,0xFC,0x10,0x78,0x11,0xFD,0x12,0x38,0x34,0x54,0x90,0x10,0x10,0x13, + 0x20,0x20,0x20,0xA8,0xA4,0xA2,0x22,0x20,0x24,0x24,0x28,0x08,0x10,0x20,0xC0,0x00, + /* 0xF1EA [?] [7594]*/ + 0x10,0x11,0x11,0xFD,0x11,0x79,0x11,0xFD,0x11,0x39,0x35,0x55,0x91,0x11,0x11,0x11, + 0x00,0xF8,0x08,0x08,0x08,0x08,0xF8,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF1EB [?] [7595]*/ + 0x10,0x10,0x10,0xFC,0x11,0x7A,0x11,0xFC,0x10,0x39,0x35,0x55,0x91,0x11,0x11,0x11, + 0x20,0x20,0x50,0x88,0x04,0x02,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF1EC [?] [7596]*/ + 0x10,0x10,0x13,0xFC,0x10,0x7B,0x12,0xFC,0x10,0x3B,0x34,0x54,0x90,0x11,0x12,0x14, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x44,0x40,0xFC,0x44,0x84,0x84,0x04,0x28,0x10, + /* 0xF1ED [?] [7597]*/ + 0x10,0x11,0x10,0xFC,0x10,0x7B,0x12,0xFE,0x12,0x3A,0x36,0x52,0x52,0x92,0x12,0x12, + 0x20,0x24,0xA4,0xA8,0x20,0xFE,0x02,0x02,0xFA,0x8A,0x8A,0x8A,0xFA,0x02,0x0A,0x04, + /* 0xF1EE [?] [7598]*/ + 0x11,0x11,0x11,0xFD,0x11,0x79,0x11,0xFC,0x10,0x3B,0x36,0x52,0x52,0x92,0x12,0x12, + 0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x22,0x2A,0xFA,0x0A,0x02,0x06, + /* 0xF1EF [?] [7599]*/ + 0x10,0x11,0x10,0xFC,0x13,0x78,0x11,0xFE,0x10,0x3B,0x34,0x51,0x51,0x90,0x11,0x16, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xF1F0 [?] [7600]*/ + 0x10,0x10,0x13,0xFC,0x11,0x78,0x13,0xFC,0x11,0x39,0x35,0x51,0x53,0x91,0x11,0x11, + 0x88,0x88,0xFE,0x88,0xFC,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFE,0x04,0x14,0x08, + /* 0xF1F1 [?] [7601]*/ + 0x10,0x11,0x11,0xFD,0x11,0x79,0x11,0xFD,0x11,0x39,0x35,0x51,0x51,0x92,0x12,0x14, + 0x00,0xFE,0x00,0x7E,0x00,0xFE,0x54,0x48,0x64,0x42,0x08,0xFE,0x48,0x28,0x08,0x18, + /* 0xF1F2 [?] [7602]*/ + 0x10,0x10,0x13,0xFE,0x13,0x7A,0x12,0xFF,0x12,0x3B,0x36,0x52,0x52,0x93,0x14,0x18, + 0x40,0x20,0xFE,0x48,0xFE,0x48,0xEC,0x5A,0x48,0xFE,0x20,0x7C,0xC4,0x44,0x7C,0x44, + /* 0xF1F3 [?] [7603]*/ + 0x02,0x3F,0x02,0xFF,0x02,0x0F,0x34,0xC3,0x00,0x7F,0x08,0x1F,0x01,0x1F,0x01,0x7F, + 0x20,0xC0,0x80,0xFE,0x20,0xC0,0x08,0xF8,0x00,0xFC,0x20,0xF0,0x00,0xF0,0x00,0xFC, + /* 0xF1F4 [?] [7604]*/ + 0x00,0xFF,0x22,0x22,0x3E,0x22,0x22,0x3E,0x22,0x22,0x27,0xFA,0x42,0x02,0x02,0x02, + 0x00,0x80,0x7E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0x08,0x08,0x08,0x28,0x10, + /* 0xF1F5 [?] [7605]*/ + 0x00,0xFF,0x24,0x25,0x3D,0x25,0x25,0x3D,0x25,0x25,0x2F,0xF5,0x45,0x05,0x05,0x05, + 0x20,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0xFE,0x04,0x04,0x04,0x14,0x08, + /* 0xF1F6 [?] [7606]*/ + 0x00,0xFF,0x24,0x24,0x3C,0x25,0x26,0x3C,0x25,0x24,0x2E,0xF4,0x44,0x04,0x04,0x04, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xF1F7 [?] [7607]*/ + 0x00,0xFC,0x48,0x4B,0x7A,0x4C,0x48,0x78,0x4B,0x48,0x4C,0x78,0xC8,0x08,0x08,0x08, + 0x40,0x20,0x20,0xFE,0x02,0x04,0x00,0x00,0xFE,0x20,0x20,0x20,0x20,0x20,0xA0,0x40, + /* 0xF1F8 [?] [7608]*/ + 0x00,0xFF,0x24,0x24,0x3C,0x25,0x24,0x3C,0x24,0x24,0x2E,0xF4,0x44,0x04,0x04,0x04, + 0x08,0x1C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF1F9 [?] [7609]*/ + 0x00,0xFC,0x49,0x49,0x79,0x48,0x4B,0x78,0x49,0x49,0x4D,0x79,0xC9,0x08,0x08,0x0B, + 0x20,0x20,0xFC,0x24,0xFC,0x20,0xFE,0x00,0xFC,0x04,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xF1FA [?] [7610]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x10,0x1E,0x22,0x7F,0x88,0x0F,0x08,0xFF,0x00,0x00, + 0x20,0x20,0x7E,0x44,0xA4,0x28,0x10,0x28,0x44,0xFE,0x20,0xE0,0x3E,0xE0,0x20,0x20, + /* 0xF1FB [?] [7611]*/ + 0xFF,0x04,0x3F,0x24,0x3F,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x01,0x01,0x01, + 0xFE,0x40,0xF8,0x48,0xF8,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0x00,0x00, + /* 0xF1FC [?] [7612]*/ + 0x00,0x79,0x10,0x10,0x11,0x11,0x11,0xFD,0x11,0x11,0x11,0x11,0x10,0x10,0x11,0x12, + 0x00,0xFE,0x20,0x40,0xFC,0x04,0x24,0x24,0x24,0x24,0x24,0x44,0x50,0x88,0x04,0x02, + /* 0xF1FD [?] [7613]*/ + 0x08,0x1C,0x60,0x40,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x0B, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF1FE [?] [7614]*/ + 0x10,0x08,0x08,0xFF,0x00,0x00,0x3C,0x24,0x24,0x24,0x24,0x25,0x46,0x44,0x80,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF2A1 [?] [7615]*/ + 0x10,0x10,0x10,0xFE,0x10,0x10,0x7C,0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF2A2 [?] [7616]*/ + 0x10,0x10,0x28,0x24,0x42,0x80,0x7C,0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF2A3 [?] [7617]*/ + 0x20,0x24,0x38,0x22,0x22,0x1E,0x00,0x08,0x0A,0xEC,0x28,0x2C,0x4A,0x4A,0xA8,0x13, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF2A4 [?] [7618]*/ + 0x10,0x08,0x08,0xFF,0x08,0x10,0x22,0x7C,0x09,0x12,0x24,0xC8,0x14,0x22,0xC0,0x03, + 0x00,0xFE,0x20,0x40,0xFC,0x84,0x94,0x94,0x94,0x94,0x94,0xA4,0x30,0x48,0x84,0x02, + /* 0xF2A5 [?] [7619]*/ + 0x08,0x08,0x14,0x22,0x51,0x88,0x7E,0x02,0x04,0x08,0x7E,0x42,0x42,0x7E,0x42,0x00, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xF2A6 [?] [7620]*/ + 0x00,0xEE,0xAA,0xAA,0xEE,0x00,0xFE,0x00,0xFF,0x40,0x7E,0x02,0x02,0x02,0x14,0x08, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xF2A7 [?] [7621]*/ + 0x08,0x49,0x49,0x49,0x7F,0x00,0xFF,0x08,0x10,0x7F,0x55,0x55,0x55,0x55,0x55,0x43, + 0x00,0x7E,0x10,0x20,0x7C,0x44,0xD4,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xF2A8 [?] [7622]*/ + 0x00,0x7F,0x22,0x3E,0x22,0x3E,0x23,0xFE,0x02,0xF7,0x11,0x55,0x22,0x55,0x89,0x10, + 0x00,0x7E,0x10,0x20,0x7C,0x44,0xD4,0x54,0x54,0x54,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xF2A9 [?] [7623]*/ + 0x24,0x24,0xFF,0x24,0x00,0xFF,0x24,0x24,0xFF,0xA5,0xA5,0xDB,0x91,0x81,0x85,0x82, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xF2AA [?] [7624]*/ + 0x00,0x7E,0x22,0x1C,0x22,0x77,0x55,0x22,0x55,0x08,0x7F,0x1C,0x2A,0x49,0x88,0x08, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x54,0x54,0x54,0x54,0x54,0x54,0x28,0x24,0x42,0x82, + /* 0xF2AB [?] [7625]*/ + 0x00,0x7F,0x41,0x7F,0x41,0x7F,0x08,0xFF,0x00,0x7F,0x41,0x7F,0x08,0x49,0x88,0x18, + 0x00,0x7E,0x10,0x20,0x7C,0x44,0x54,0xD4,0x54,0x54,0x54,0x54,0x20,0x28,0xC4,0x82, + /* 0xF2AC [?] [7626]*/ + 0x00,0x7F,0x08,0xFF,0x88,0x6B,0x08,0x6B,0x00,0xFF,0x08,0x7F,0x55,0x55,0x55,0x43, + 0x00,0x7E,0x10,0xA0,0xFC,0x44,0x54,0x54,0x54,0xD4,0x54,0x54,0x20,0x28,0x44,0x82, + /* 0xF2AD [?] [7627]*/ + 0x08,0x2E,0x28,0xFF,0x2A,0x4C,0x32,0xC4,0x3F,0x21,0x3F,0x22,0x3F,0x08,0xFF,0x00, + 0x00,0xFE,0x20,0x7C,0x54,0x54,0x28,0x44,0xF8,0x08,0xF8,0x08,0xF8,0x80,0xFE,0x80, + /* 0xF2AE [?] [7628]*/ + 0x01,0x01,0x01,0x01,0x01,0x3F,0x20,0x21,0x21,0x21,0x21,0x2F,0x21,0x41,0x40,0x80, + 0x00,0x00,0xF8,0x00,0x00,0xFC,0x04,0x08,0x00,0x18,0xE0,0x00,0x04,0x04,0xFC,0x00, + /* 0xF2AF [?] [7629]*/ + 0x01,0x01,0x01,0x3F,0x21,0x21,0x2F,0x20,0x21,0x20,0x2F,0x22,0x21,0x40,0x43,0x8C, + 0x00,0xF8,0x00,0xFE,0x02,0xF0,0x04,0xFC,0x00,0x80,0xF8,0x20,0x40,0x80,0x60,0x1C, + /* 0xF2B0 [?] [7630]*/ + 0x08,0x08,0x08,0x7F,0x49,0x49,0x49,0x49,0x7F,0x48,0x08,0x0A,0x0F,0xF1,0x40,0x00, + 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x44,0x44,0x44,0x3C,0x00, + /* 0xF2B1 [?] [7631]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1C,0xE5,0x41,0x02, + 0x00,0x00,0xF0,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x92,0x92,0x12,0x0E,0x00, + /* 0xF2B2 [?] [7632]*/ + 0x00,0xFF,0x04,0x07,0x08,0x10,0x20,0x41,0x3F,0x21,0x21,0x3F,0x01,0x01,0x7F,0x20, + 0x00,0xFE,0x00,0xF0,0x10,0x10,0xA0,0x40,0xF8,0x08,0x08,0xF8,0x00,0x08,0xFC,0x04, + /* 0xF2B3 [?] [7633]*/ + 0x00,0x00,0xFE,0x25,0x25,0x25,0x25,0x25,0x24,0x24,0x24,0x25,0x24,0x44,0x43,0x80, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0xFC,0x20,0x20,0x28,0xFC,0x04,0x02,0xFE,0x00, + /* 0xF2B4 [?] [7634]*/ + 0x10,0x10,0x10,0x7C,0x55,0x56,0x54,0x54,0x7C,0x50,0x10,0x14,0x1D,0xE5,0x40,0x00, + 0x40,0x40,0x80,0xFE,0x00,0x00,0xFC,0x08,0x10,0x20,0x40,0x80,0x02,0x02,0xFE,0x00, + /* 0xF2B5 [?] [7635]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x20,0x10,0x10,0x00,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xFC,0x00, + /* 0xF2B6 [?] [7636]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x54,0x7D,0x50,0x10,0x14,0x1E,0xE2,0x41,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF2B7 [?] [7637]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x00, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xF2B8 [?] [7638]*/ + 0x10,0x10,0x10,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x20,0x20,0xFE,0x22,0x22,0x22,0x22,0x52,0x4A,0x8A,0x02,0x02,0x02,0x0A,0x04, + /* 0xF2B9 [?] [7639]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x10,0x14,0x1C,0xE5,0x42,0x04, + 0x00,0xFC,0x04,0x04,0x24,0x24,0x24,0x24,0x24,0x54,0x50,0x90,0x90,0x12,0x12,0x0E, + /* 0xF2BA [?] [7640]*/ + 0x10,0x10,0x11,0x7C,0x54,0x54,0x55,0x54,0x7C,0x50,0x13,0x14,0x1E,0xE2,0x40,0x00, + 0x08,0x3C,0xE0,0x20,0x20,0x3C,0xE0,0x20,0x20,0x3E,0xE0,0x20,0x22,0x22,0x22,0x1E, + /* 0xF2BB [?] [7641]*/ + 0x10,0x10,0x10,0x7C,0x54,0x55,0x56,0x54,0x7C,0x50,0x10,0x14,0x1C,0xE5,0x41,0x02, + 0x20,0x20,0x50,0x50,0x88,0x04,0x02,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xF2BC [?] [7642]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x55,0x7C,0x50,0x10,0x14,0x1C,0xE5,0x40,0x00, + 0x08,0x48,0x48,0x48,0x44,0x84,0xA4,0x22,0x20,0x40,0x40,0x48,0x84,0xFE,0x82,0x00, + /* 0xF2BD [?] [7643]*/ + 0x10,0x11,0x10,0x7C,0x54,0x55,0x54,0x54,0x7C,0x50,0x13,0x14,0x1E,0xE2,0x40,0x00, + 0x10,0x10,0x90,0x90,0x10,0x10,0x90,0x90,0x10,0x1E,0xF0,0x10,0x10,0x10,0x10,0x10, + /* 0xF2BE [?] [7644]*/ + 0x10,0x11,0x10,0x7C,0x54,0x55,0x55,0x55,0x7D,0x51,0x10,0x14,0x1C,0xE4,0x41,0x00, + 0x04,0xE4,0x24,0x24,0x24,0xE4,0x04,0x04,0x04,0xE4,0x24,0x24,0x24,0x24,0x44,0x84, + /* 0xF2BF [?] [7645]*/ + 0x01,0x21,0x21,0x3F,0x01,0xFF,0x00,0x01,0x3F,0x21,0x21,0x3F,0x01,0x01,0x7F,0x20, + 0x00,0x08,0x08,0xF8,0x00,0xFE,0x00,0x00,0xF8,0x08,0x08,0xF8,0x00,0x08,0xFC,0x04, + /* 0xF2C0 [?] [7646]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x88,0x88,0x88,0x88,0xFE,0x88,0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xF2C1 [?] [7647]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x54,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF2C2 [?] [7648]*/ + 0x10,0x10,0x13,0x7C,0x54,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1C,0xE4,0x40,0x00, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xF2C3 [?] [7649]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE6,0x42,0x04, + 0x00,0xFE,0x00,0x00,0x00,0xFE,0x20,0x20,0x3C,0x24,0x24,0x24,0x24,0x44,0x54,0x88, + /* 0xF2C4 [?] [7650]*/ + 0x10,0x10,0x10,0x7C,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xF2C5 [?] [7651]*/ + 0x10,0x10,0x10,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x17,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0x24,0xFE,0x04,0x04,0x04,0x14,0x08, + /* 0xF2C6 [?] [7652]*/ + 0x10,0x10,0x10,0x7C,0x55,0x55,0x56,0x54,0x7C,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xF2C7 [?] [7653]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x14,0x1C,0xE4,0x43,0x00, + 0x04,0x0E,0xF0,0x80,0x80,0x80,0x80,0xFE,0x88,0x88,0x88,0x88,0x88,0x88,0xFE,0x00, + /* 0xF2C8 [?] [7654]*/ + 0x10,0x10,0x10,0x7C,0x54,0x55,0x56,0x54,0x7D,0x50,0x10,0x14,0x1E,0xE2,0x40,0x00, + 0x20,0x20,0x50,0x50,0x88,0x24,0x12,0x10,0xFC,0x04,0x08,0x88,0x50,0x20,0x10,0x10, + /* 0xF2C9 [?] [7655]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x54,0x54,0x7F,0x50,0x11,0x14,0x1C,0xE4,0x43,0x00, + 0x00,0xFC,0x84,0x88,0x50,0x20,0x50,0x88,0x26,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xF2CA [?] [7656]*/ + 0x20,0x20,0x20,0xF9,0xA9,0xAA,0xAB,0xA8,0xF9,0xA1,0x22,0x2B,0x38,0xE8,0x40,0x00, + 0x10,0x90,0x90,0x10,0x7E,0x52,0x92,0x92,0x12,0x12,0x52,0xD2,0x62,0x22,0x4A,0x84, + /* 0xF2CB [?] [7657]*/ + 0x00,0x7D,0x11,0x11,0x11,0x1D,0xE2,0x45,0x1F,0x11,0x11,0x1F,0x11,0x01,0x7F,0x20, + 0x00,0xF0,0x10,0x90,0x52,0x12,0x0E,0x00,0xF0,0x10,0x10,0xF0,0x00,0x08,0xFC,0x04, + /* 0xF2CC [?] [7658]*/ + 0x10,0x10,0x10,0x7D,0x54,0x55,0x54,0x54,0x7C,0x53,0x10,0x14,0x1E,0xE2,0x41,0x02, + 0x20,0x20,0x20,0xFC,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF2CD [?] [7659]*/ + 0x20,0x20,0x20,0xFB,0xA8,0xA8,0xA8,0xAB,0xF8,0xA3,0x20,0x28,0x39,0xE9,0x42,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xF2CE [?] [7660]*/ + 0x10,0x11,0x10,0x7C,0x54,0x55,0x55,0x54,0x7C,0x50,0x11,0x14,0x1C,0xE4,0x43,0x00, + 0x00,0xFE,0x20,0x40,0x88,0x04,0xFE,0x22,0x20,0x20,0xFE,0x20,0x20,0x20,0xFE,0x00, + /* 0xF2CF [?] [7661]*/ + 0x20,0x20,0x20,0xFA,0xAA,0xAA,0xAA,0xAA,0xFA,0xA2,0x22,0x28,0x39,0xE9,0x42,0x04, + 0x80,0xBE,0x88,0x88,0xBE,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x2E,0x08,0x08,0x08, + /* 0xF2D0 [?] [7662]*/ + 0x10,0x10,0x10,0x7C,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x50,0x50,0x50,0x50,0xFC,0x54,0x54,0x54,0x54,0xFC,0x54,0x54,0x54,0x54,0xFC,0x04, + /* 0xF2D1 [?] [7663]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xA9,0xA9,0xAB,0xF8,0xA2,0x22,0x29,0x39,0xEA,0x44,0x08, + 0x00,0x06,0xB8,0x88,0x88,0x08,0x3E,0x88,0x88,0x88,0x88,0x3E,0x00,0x80,0x7E,0x00, + /* 0xF2D2 [?] [7664]*/ + 0x10,0x10,0x11,0x7C,0x54,0x57,0x54,0x54,0x7C,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x08,0x3C,0xE0,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF2D3 [?] [7665]*/ + 0x10,0x10,0x13,0x7C,0x54,0x54,0x54,0x54,0x7D,0x50,0x10,0x14,0x1C,0xE5,0x41,0x02, + 0x40,0x20,0xFE,0x88,0x50,0x20,0x50,0x88,0x06,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xF2D4 [?] [7666]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x55,0x56,0x7C,0x50,0x10,0x14,0x1C,0xE4,0x40,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xF2D5 [?] [7667]*/ + 0x11,0x10,0x10,0x7C,0x57,0x54,0x54,0x55,0x7C,0x50,0x13,0x14,0x1E,0xE2,0x40,0x00, + 0x04,0x84,0x88,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF2D6 [?] [7668]*/ + 0x10,0x10,0x10,0x7C,0x55,0x54,0x54,0x54,0x7C,0x51,0x10,0x17,0x1C,0xE4,0x40,0x00, + 0x20,0x20,0x48,0x84,0xFE,0x12,0x90,0x90,0xFE,0x10,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xF2D7 [?] [7669]*/ + 0x3F,0x20,0x2F,0x20,0x3F,0x24,0x24,0x26,0x20,0x2F,0x28,0x48,0x4F,0x80,0x1F,0x08, + 0xFC,0x00,0xF8,0x00,0xFC,0x48,0x30,0x0E,0x80,0xF8,0x88,0x88,0xF8,0x84,0xFE,0x02, + /* 0xF2D8 [?] [7670]*/ + 0x08,0x08,0x7E,0x08,0x0E,0x78,0x08,0x29,0x12,0x01,0x3F,0x21,0x3F,0x01,0x7F,0x00, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0x00,0xF8,0x08,0xF8,0x08,0xFC,0x04, + /* 0xF2D9 [?] [7671]*/ + 0x10,0x11,0x10,0x7C,0x54,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xF2DA [?] [7672]*/ + 0x10,0x11,0x11,0x7D,0x55,0x54,0x54,0x55,0x7C,0x50,0x13,0x14,0x1C,0xE4,0x41,0x02, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x00,0xFC,0x20,0x20,0xFE,0x20,0x50,0x88,0x04,0x02, + /* 0xF2DB [?] [7673]*/ + 0x20,0x21,0x27,0xF9,0xA9,0xA9,0xAF,0xA9,0xFB,0xA3,0x25,0x2D,0x39,0xE9,0x41,0x01, + 0x84,0xC4,0x04,0x14,0x14,0x14,0xD4,0x14,0x14,0x94,0x54,0x04,0x04,0x04,0x14,0x08, + /* 0xF2DC [?] [7674]*/ + 0x10,0x10,0x10,0x7C,0x55,0x56,0x54,0x54,0x7C,0x53,0x10,0x15,0x1D,0xE6,0x40,0x00, + 0x20,0x20,0x50,0x88,0x04,0x02,0xF8,0x20,0x20,0xFE,0x20,0x24,0x22,0x22,0xA0,0x40, + /* 0xF2DD [?] [7675]*/ + 0x10,0x10,0x11,0x7C,0x55,0x54,0x54,0x55,0x7C,0x50,0x13,0x14,0x1E,0xE2,0x40,0x00, + 0x08,0x3C,0xC0,0x04,0x44,0xA8,0x00,0xF8,0x10,0x20,0xFE,0x20,0x20,0x20,0xA0,0x40, + /* 0xF2DE [?] [7676]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x55,0x54,0x7C,0x53,0x10,0x14,0x1C,0xE4,0x41,0x02, + 0x88,0x48,0x50,0xFC,0x20,0x20,0xFC,0x20,0x20,0xFE,0x50,0x50,0x90,0x92,0x12,0x0E, + /* 0xF2DF [?] [7677]*/ + 0x10,0x10,0x13,0x7C,0x55,0x54,0x57,0x54,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xF2E0 [?] [7678]*/ + 0x10,0x10,0x11,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x10,0x15,0x1C,0xE4,0x41,0x02, + 0x88,0x88,0xFC,0x88,0x88,0xF8,0x88,0x88,0xF8,0x88,0x88,0xFE,0x00,0x88,0x04,0x02, + /* 0xF2E1 [?] [7679]*/ + 0x21,0x21,0x21,0xF9,0xAF,0xA9,0xA9,0xAB,0xFB,0xA5,0x25,0x29,0x39,0xE9,0x41,0x01, + 0x00,0x06,0x38,0x20,0xA0,0x20,0x3E,0x24,0xA4,0x64,0x24,0x24,0x24,0x24,0x24,0x44, + /* 0xF2E2 [?] [7680]*/ + 0x20,0x20,0x20,0xFB,0xA8,0xA8,0xAB,0xAA,0xFA,0xA2,0x23,0x28,0x38,0xEB,0x41,0x00, + 0x14,0x12,0x10,0xFE,0x10,0x10,0xD2,0x52,0x52,0x54,0xD4,0x0C,0x6A,0x8A,0x16,0x22, + /* 0xF2E3 [?] [7681]*/ + 0x04,0x04,0x7C,0x04,0x3C,0x04,0x7C,0x04,0x01,0x1F,0x11,0x11,0x1F,0x01,0x7F,0x20, + 0x40,0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x00,0xF0,0x10,0x10,0xF0,0x08,0xFC,0x04, + /* 0xF2E4 [?] [7682]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7C,0x53,0x10,0x14,0x1D,0xE6,0x40,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xF2E5 [?] [7683]*/ + 0x20,0x23,0x22,0xFA,0xAB,0xAA,0xAA,0xAA,0xFA,0xA2,0x22,0x2B,0x3A,0xEA,0x43,0x02, + 0x00,0xFE,0x02,0x02,0xFE,0x22,0x22,0xFA,0x22,0x32,0x2A,0xFE,0x02,0x02,0xFE,0x02, + /* 0xF2E6 [?] [7684]*/ + 0x10,0x10,0x10,0x7C,0x54,0x54,0x54,0x54,0x7C,0x50,0x11,0x14,0x1C,0xE5,0x40,0x00, + 0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x40,0xFE,0x2A,0x4A,0x92,0x22,0x4A,0x84, + /* 0xF2E7 [?] [7685]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x50,0x11,0x17,0x1C,0xE4,0x40,0x00, + 0x40,0x80,0xFC,0x24,0x24,0xFC,0x24,0x44,0xFC,0x90,0x10,0xFE,0x10,0x10,0x10,0x10, + /* 0xF2E8 [?] [7686]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE6,0x42,0x04, + 0x00,0xFC,0x24,0x24,0x74,0x24,0xFC,0x04,0x74,0x54,0x54,0x74,0x04,0x04,0x14,0x08, + /* 0xF2E9 [?] [7687]*/ + 0x10,0x11,0x10,0x7C,0x55,0x54,0x57,0x54,0x7D,0x52,0x14,0x14,0x1C,0xE4,0x40,0x00, + 0x20,0x24,0xA8,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x88,0x88,0xA8,0x92,0x82,0x7E, + /* 0xF2EA [?] [7688]*/ + 0x20,0x20,0x23,0xFA,0xAD,0xA9,0xA9,0xAA,0xFA,0xA3,0x24,0x28,0x39,0xE9,0x42,0x04, + 0x40,0x20,0xFE,0x02,0x04,0x00,0xDE,0x52,0x52,0x52,0x9A,0x94,0x10,0x12,0x12,0x0E, + /* 0xF2EB [?] [7689]*/ + 0x21,0x20,0x23,0xFA,0xAA,0xAB,0xAA,0xAA,0xFB,0xA2,0x22,0x2A,0x3A,0xEB,0x42,0x00, + 0x00,0x9E,0xD2,0x52,0x54,0xD4,0x58,0x54,0xD2,0x12,0x92,0x5A,0xD4,0x50,0x10,0x10, + /* 0xF2EC [?] [7690]*/ + 0x10,0x11,0x10,0x7C,0x54,0x57,0x54,0x54,0x7C,0x51,0x11,0x15,0x1D,0xE5,0x43,0x00, + 0x00,0xFC,0x08,0x10,0x20,0xFE,0x20,0xA0,0x40,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xF2ED [?] [7691]*/ + 0x10,0x10,0x13,0x7C,0x55,0x54,0x57,0x54,0x7D,0x52,0x10,0x14,0x1C,0xE4,0x40,0x00, + 0x20,0x20,0xFE,0x20,0xFC,0x40,0xFE,0x88,0x04,0xFA,0x88,0x88,0xF8,0x88,0x88,0xF8, + /* 0xF2EE [?] [7692]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xAB,0xAA,0xAC,0xF8,0xA3,0x20,0x28,0x38,0xE9,0x42,0x00, + 0x88,0x88,0xFE,0x88,0x00,0xFE,0x02,0x24,0x20,0xFE,0x70,0xA8,0xA8,0x24,0x22,0x20, + /* 0xF2EF [?] [7693]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xAB,0xAA,0xAA,0xFA,0xA2,0x22,0x2A,0x3A,0xEA,0x42,0x02, + 0x20,0x20,0xFE,0x20,0x20,0xFE,0x8A,0x52,0xFA,0x22,0x22,0xFA,0x22,0x22,0x2A,0x04, + /* 0xF2F0 [?] [7694]*/ + 0x10,0x11,0x10,0x7C,0x54,0x54,0x54,0x54,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x00,0xFE,0x00,0xFC,0x84,0x84,0xFC,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xF2F1 [?] [7695]*/ + 0x10,0x10,0x13,0x7C,0x54,0x57,0x55,0x54,0x7C,0x53,0x10,0x14,0x1D,0xE4,0x40,0x03, + 0x20,0x20,0xFE,0x50,0x88,0x26,0xFC,0x20,0x20,0xFE,0x00,0x20,0xFC,0x20,0x20,0xFE, + /* 0xF2F2 [?] [7696]*/ + 0x20,0x27,0x21,0xF9,0xA9,0xAF,0xA9,0xA9,0xFB,0xA3,0x25,0x2D,0x39,0xE9,0x41,0x01, + 0xC4,0x04,0x24,0x14,0x14,0x84,0x24,0x14,0x94,0x46,0x3C,0x04,0x04,0x04,0x04,0x04, + /* 0xF2F3 [?] [7697]*/ + 0x10,0x10,0x10,0x7C,0x55,0x56,0x54,0x54,0x7C,0x50,0x10,0x14,0x1D,0xE4,0x40,0x01, + 0x40,0x40,0xFE,0x80,0xFC,0x84,0xFC,0x84,0xFC,0x40,0x7C,0xC4,0x28,0x10,0x68,0x86, + /* 0xF2F4 [?] [7698]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7C,0x51,0x10,0x14,0x1E,0xE2,0x40,0x03, + 0xA0,0x2C,0x24,0x24,0xAC,0x24,0x24,0xFC,0x20,0xFC,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xF2F5 [?] [7699]*/ + 0x20,0x20,0x21,0xFA,0xAD,0xA8,0xAB,0xAA,0xFA,0xA3,0x22,0x2A,0x3B,0xEA,0x42,0x02, + 0x40,0xA0,0x10,0x08,0xF6,0x00,0xC4,0x54,0x54,0xD4,0x54,0x54,0xD4,0x44,0x54,0xC8, + /* 0xF2F6 [?] [7700]*/ + 0x21,0x20,0x20,0xFB,0xA9,0xA9,0xA9,0xA9,0xF9,0xA1,0x21,0x29,0x3A,0xEA,0x44,0x08, + 0x08,0x88,0x88,0xDE,0x10,0x20,0xDE,0x42,0x44,0x44,0x5E,0x44,0x44,0x44,0xD4,0x08, + /* 0xF2F7 [?] [7701]*/ + 0x20,0x21,0x20,0xF8,0xAB,0xA8,0xA9,0xAA,0xF8,0xA7,0x20,0x29,0x39,0xE8,0x41,0x06, + 0x20,0x24,0xA8,0x20,0xFE,0xA8,0x24,0x02,0x40,0xFE,0x88,0x08,0x90,0x60,0x98,0x04, + /* 0xF2F8 [?] [7702]*/ + 0x10,0x10,0x10,0x7D,0x54,0x54,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x88,0x48,0x50,0xFE,0x50,0x50,0xFC,0x54,0x54,0x8C,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF2F9 [?] [7703]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x12,0x14,0x1C,0xE4,0x40,0x00, + 0x20,0x10,0xFE,0x02,0x02,0xFE,0x00,0x00,0xFE,0xAA,0xAA,0xFE,0xAA,0xAA,0xAA,0x86, + /* 0xF2FA [?] [7704]*/ + 0x00,0x7E,0x24,0x18,0xFF,0x29,0x4A,0x98,0x01,0x1F,0x11,0x11,0x1F,0x01,0x7F,0x20, + 0x20,0x20,0x7E,0xA4,0x28,0x10,0x28,0xC6,0x00,0xF0,0x10,0x10,0xF0,0x08,0xFC,0x04, + /* 0xF2FB [?] [7705]*/ + 0x20,0x20,0x27,0xF8,0xAB,0xA8,0xAF,0xA9,0xFA,0xA5,0x20,0x2B,0x38,0xE9,0x46,0x00, + 0x40,0x40,0xFC,0x40,0xF8,0x80,0xFC,0x10,0x68,0xC6,0x40,0xF8,0xE0,0x58,0x44,0x40, + /* 0xF2FC [?] [7706]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x10,0x1E,0x22,0x46,0x81,0x3F,0x21,0x3F,0x01,0x7F, + 0x20,0x20,0x7E,0x44,0xA4,0x28,0x10,0x28,0x44,0x82,0x00,0xF8,0x08,0xF8,0x04,0xFE, + /* 0xF2FD [?] [7707]*/ + 0x10,0x10,0x11,0x7C,0x54,0x55,0x54,0x54,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x01, + 0x48,0x48,0xFE,0x48,0x00,0xFE,0x48,0x48,0xFE,0x4A,0x4A,0xB6,0x22,0x02,0x0A,0x04, + /* 0xF2FE [?] [7708]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xAB,0xA8,0xA8,0xF9,0xA2,0x20,0x2B,0x38,0xE8,0x41,0x02, + 0x88,0x88,0xFE,0x88,0x24,0xFE,0x50,0x88,0x04,0x8A,0x88,0xFE,0x88,0x88,0x08,0x08, + /* 0xF3A1 [?] [7709]*/ + 0x10,0x10,0x13,0x7C,0x54,0x55,0x55,0x55,0x7D,0x51,0x10,0x17,0x1C,0xE4,0x41,0x02, + 0x88,0x88,0xFE,0x88,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xF3A2 [?] [7710]*/ + 0x10,0x11,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1F,0xE2,0x42,0x04, + 0x00,0xFE,0x10,0x20,0x7C,0x44,0x7C,0x44,0x7C,0x10,0x10,0x54,0x52,0x92,0x50,0x20, + /* 0xF3A3 [?] [7711]*/ + 0x20,0x20,0x21,0xF9,0xA9,0xA9,0xA9,0xA9,0xF9,0xA0,0x20,0x28,0x3A,0xEA,0x44,0x00, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x04,0xFC,0x40,0x20,0xA4,0x8A,0x8A,0x78,0x00, + /* 0xF3A4 [?] [7712]*/ + 0x20,0x20,0x23,0xF8,0xA9,0xA9,0xA9,0xA9,0xF8,0xA3,0x22,0x2A,0x3A,0xEA,0x42,0x02, + 0x40,0x20,0xFE,0x00,0x54,0x24,0x54,0xFC,0x20,0xFE,0x42,0x92,0xFA,0x0A,0x02,0x06, + /* 0xF3A5 [?] [7713]*/ + 0x10,0x10,0x11,0x7D,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE6,0x42,0x04, + 0x20,0x10,0xFE,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xF3A6 [?] [7714]*/ + 0x20,0x20,0x23,0xF9,0xA8,0xAB,0xAA,0xAC,0xF8,0xA3,0x20,0x28,0x38,0xE9,0x41,0x02, + 0x40,0x20,0xFC,0x08,0x90,0xFE,0x02,0x44,0x20,0xFC,0x80,0xF8,0x88,0x08,0x28,0x10, + /* 0xF3A7 [?] [7715]*/ + 0x08,0x7F,0x08,0xFF,0x14,0x56,0xA5,0x4C,0x81,0x1F,0x11,0x11,0x1F,0x01,0x7F,0x20, + 0x20,0x20,0x3E,0x44,0xA8,0x10,0x28,0x46,0x00,0xF0,0x10,0x10,0xF0,0x08,0xFC,0x04, + /* 0xF3A8 [?] [7716]*/ + 0x10,0x10,0x11,0x7C,0x54,0x57,0x54,0x55,0x7D,0x51,0x11,0x15,0x1C,0xE4,0x41,0x02, + 0x88,0x88,0xFC,0x88,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x00,0x88,0x04,0x02, + /* 0xF3A9 [?] [7717]*/ + 0x20,0x20,0x27,0xF8,0xAB,0xAA,0xAB,0xAA,0xFB,0xA0,0x21,0x29,0x39,0xE9,0x41,0x01, + 0x90,0x90,0xFE,0x90,0xFC,0x94,0xFC,0x94,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x08, + /* 0xF3AA [?] [7718]*/ + 0x10,0x13,0x10,0x7D,0x55,0x55,0x55,0x54,0x7D,0x50,0x13,0x14,0x1C,0xE5,0x42,0x00, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xF3AB [?] [7719]*/ + 0x20,0x21,0x20,0xFB,0xAA,0xA8,0xA8,0xA8,0xF8,0xA0,0x20,0x29,0x38,0xE8,0x43,0x00, + 0x20,0x24,0xA8,0xFE,0x02,0xF8,0x88,0x88,0xF8,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xF3AC [?] [7720]*/ + 0x20,0x21,0x20,0xF9,0xA8,0xAB,0xA8,0xA8,0xF9,0xA2,0x20,0x28,0x3A,0xEA,0x44,0x00, + 0x1C,0xE0,0x20,0x24,0xA8,0xFE,0x70,0xA8,0x24,0x22,0x40,0x24,0xA2,0x8A,0x88,0x78, + /* 0xF3AD [?] [7721]*/ + 0x20,0x20,0x21,0xFB,0xAD,0xA9,0xA9,0xA8,0xF8,0xA3,0x20,0x2B,0x38,0xE8,0x43,0x00, + 0x80,0xF8,0x08,0xFE,0x12,0x22,0xFE,0x40,0xA2,0x54,0x98,0x34,0x54,0x92,0x50,0x20, + /* 0xF3AE [?] [7722]*/ + 0x08,0x1F,0x28,0x07,0x18,0xE1,0x0C,0x03,0x10,0x7E,0x52,0x7E,0x10,0x14,0xFE,0x02, + 0x00,0xF0,0x20,0xC0,0x30,0x8E,0x40,0x00,0xA0,0xFC,0xA4,0xFC,0x20,0x24,0xFE,0x02, + /* 0xF3AF [?] [7723]*/ + 0x10,0x11,0x10,0x7C,0x57,0x54,0x55,0x55,0x7D,0x51,0x11,0x14,0x1F,0xE4,0x40,0x00, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xF3B0 [?] [7724]*/ + 0x20,0x20,0x23,0xF8,0xA8,0xAA,0xA9,0xAA,0xF8,0xA0,0x20,0x2B,0x38,0xE8,0x40,0x00, + 0x40,0x20,0xFE,0x20,0x48,0xF2,0x24,0x52,0xF8,0x08,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xF3B1 [?] [7725]*/ + 0x1F,0x02,0x01,0x7F,0x04,0x18,0x62,0x01,0x10,0x7E,0x52,0x7E,0x10,0x14,0xFE,0x02, + 0xF0,0x20,0x40,0xFC,0x84,0x88,0x80,0x00,0x20,0xFC,0xA4,0xFC,0x20,0x24,0xFE,0x02, + /* 0xF3B2 [?] [7726]*/ + 0x20,0x20,0x27,0xF8,0xA8,0xAB,0xA8,0xAB,0xFA,0xA2,0x23,0x2A,0x39,0xE8,0x47,0x02, + 0x82,0x82,0xF4,0x88,0x80,0xE2,0x02,0xE4,0x28,0x20,0xE0,0x22,0x42,0x74,0x88,0x10, + /* 0xF3B3 [?] [7727]*/ + 0x20,0x20,0x23,0xF8,0xA9,0xA9,0xA9,0xA9,0xF9,0xA0,0x23,0x28,0x38,0xEA,0x42,0x04, + 0x20,0x20,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x22,0xFE,0x42,0x24,0xA2,0x8A,0x78, + /* 0xF3B4 [?] [7728]*/ + 0x20,0x23,0x21,0xF8,0xAB,0xA8,0xA9,0xAA,0xF9,0xA1,0x21,0x29,0x39,0xE9,0x41,0x01, + 0x3C,0xE0,0x24,0xA8,0xFE,0xA8,0x24,0x02,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xF3B5 [?] [7729]*/ + 0x10,0x10,0x13,0x7C,0x55,0x54,0x57,0x55,0x7C,0x53,0x10,0x15,0x1D,0xE5,0x41,0x01, + 0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF3B6 [?] [7730]*/ + 0x10,0x13,0x10,0x7C,0x55,0x57,0x55,0x55,0x7D,0x51,0x11,0x15,0x1F,0xE4,0x40,0x03, + 0x88,0xFE,0xA8,0x90,0xFE,0x20,0xFC,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x70,0x8E, + /* 0xF3B7 [?] [7731]*/ + 0x20,0x23,0x20,0xFB,0xAA,0xA9,0xA8,0xAB,0xF8,0xA0,0x23,0x28,0x3B,0xE8,0x43,0x00, + 0x88,0xFE,0x88,0xFE,0x02,0xFC,0x00,0xFE,0x40,0xA2,0x54,0xB8,0x54,0x92,0x50,0x20, + /* 0xF3B8 [?] [7732]*/ + 0x10,0x10,0x11,0x7F,0x55,0x55,0x55,0x55,0x7D,0x51,0x11,0x15,0x1D,0xE5,0x41,0x02, + 0x80,0xF8,0x08,0xFE,0x44,0x92,0xFE,0x00,0x7C,0x00,0x7C,0x00,0x7C,0x44,0x7C,0x44, + /* 0xF3B9 [?] [7733]*/ + 0x20,0x23,0x22,0xFA,0xAB,0xAA,0xAA,0xAA,0xFB,0xA2,0x22,0x2A,0x3A,0xED,0x46,0x08, + 0x20,0xFE,0x88,0x50,0xFE,0x50,0xFC,0x54,0xFE,0x54,0xFC,0x50,0xD8,0x54,0x52,0x50, + /* 0xF3BA [?] [7734]*/ + 0x10,0x11,0x10,0x7C,0x55,0x55,0x55,0x55,0x7C,0x51,0x11,0x15,0x1D,0xE5,0x41,0x02, + 0x48,0xFE,0x48,0x00,0xFE,0x4A,0x4A,0xFE,0x14,0xFE,0x10,0x92,0x4C,0x4A,0x16,0x22, + /* 0xF3BB [?] [7735]*/ + 0x0F,0x10,0x1F,0x00,0xFF,0x0C,0x73,0x0D,0x72,0x0C,0xF3,0x7C,0x54,0x7C,0x12,0xFE, + 0xE0,0x20,0xC0,0x40,0xFE,0x10,0x20,0xC0,0xB0,0x8E,0x20,0xF8,0xA8,0xF8,0x24,0xFC, + /* 0xF3BC [?] [7736]*/ + 0x01,0x7F,0x11,0x1F,0x01,0xFF,0x88,0x1F,0x68,0x0F,0x10,0x7C,0x54,0x7C,0x12,0xFE, + 0x00,0xFC,0x10,0xF0,0x00,0xFE,0x02,0xF0,0x10,0xF0,0x20,0xF8,0xA8,0xF8,0x24,0xFC, + /* 0xF3BD [?] [7737]*/ + 0x23,0x22,0x23,0xFA,0xAB,0xA8,0xA9,0xAB,0xFD,0xA1,0x21,0x28,0x39,0xE8,0x40,0x07, + 0xDE,0x52,0xDE,0x52,0xDE,0xA0,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x88,0x70,0x8E, + /* 0xF3BE [?] [7738]*/ + 0x08,0x08,0x10,0x1F,0x21,0x41,0x01,0x01,0xFF,0x01,0x21,0x21,0x21,0x21,0x3F,0x00, + 0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0xFE,0x00,0x08,0x08,0x08,0x08,0xF8,0x08, + /* 0xF3BF [?] [7739]*/ + 0x3E,0x22,0x2A,0x2A,0x2A,0x14,0x22,0x49,0x1F,0x21,0x01,0xFF,0x01,0x21,0x3F,0x00, + 0xF8,0x88,0xA8,0xA8,0xA8,0x50,0x88,0x04,0xF8,0x00,0x00,0xFE,0x00,0x08,0xF8,0x08, + /* 0xF3C0 [?] [7740]*/ + 0x08,0x7F,0x08,0x3E,0x00,0x3E,0x2A,0x3E,0x40,0x90,0x1F,0x21,0xFF,0x01,0x21,0x3F, + 0x00,0x78,0x48,0x48,0x86,0x78,0x48,0x30,0x48,0x86,0xF0,0x00,0xFE,0x00,0x08,0xF8, + /* 0xF3C1 [?] [7741]*/ + 0x20,0x20,0x3C,0x51,0x91,0x11,0xFF,0x11,0x11,0x55,0x55,0x55,0x5E,0x66,0x04,0x00, + 0x20,0x3E,0x20,0xFE,0x20,0x3C,0xE2,0x1E,0x04,0x78,0x92,0x54,0xFE,0x10,0x50,0x20, + /* 0xF3C2 [?] [7742]*/ + 0x08,0x1C,0x71,0x11,0x11,0xFD,0x11,0x11,0x7D,0x45,0x45,0x45,0x45,0x7D,0x45,0x01, + 0x04,0x1E,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x08,0x0A,0x4A,0x86,0x02, + /* 0xF3C3 [?] [7743]*/ + 0x10,0x10,0x1F,0x28,0x24,0x45,0x80,0x00,0x3F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, + 0x40,0x40,0x7E,0x90,0x88,0x08,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0xFE,0x00, + /* 0xF3C4 [?] [7744]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x01,0x01,0xFF,0x01,0x01,0x01,0x01,0x05,0x02, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, + /* 0xF3C5 [?] [7745]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x08,0x08,0x0C,0x0A,0x12,0x11,0x20,0x43,0x8C, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xE0,0x20,0x40,0x78,0x08,0x10,0x20,0xC0,0x30,0x0E, + /* 0xF3C6 [?] [7746]*/ + 0x10,0x10,0x3F,0x28,0x45,0xBF,0x00,0x10,0x10,0x1F,0x00,0x00,0x7F,0x00,0x00,0x00, + 0x40,0x40,0x7E,0x90,0x08,0xF0,0x10,0x10,0x10,0xFC,0x04,0x04,0xE4,0x04,0x28,0x10, + /* 0xF3C7 [?] [7747]*/ + 0x10,0x10,0x3F,0x48,0x85,0x00,0x7F,0x08,0x08,0x08,0xFF,0x08,0x08,0x10,0x20,0x40, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF3C8 [?] [7748]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x1F,0x10,0x11,0x11,0x11,0x12,0x14,0x08,0x30,0xC0, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF0,0x10,0x10,0x10,0x10,0x90,0x90,0x82,0x82,0x7E, + /* 0xF3C9 [?] [7749]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x00,0x1F,0x12,0x12,0x12,0x12,0x22,0x22,0x42,0x82, + 0x40,0x40,0x7E,0x90,0x08,0x10,0xF8,0x20,0x20,0x20,0x20,0x10,0x10,0x08,0x04,0x02, + /* 0xF3CA [?] [7750]*/ + 0x10,0x10,0x3F,0x28,0x45,0x81,0x1F,0x11,0x21,0x3F,0x03,0x05,0x09,0x31,0xC1,0x01, + 0x40,0x40,0x7E,0x90,0x08,0x70,0x80,0x00,0x00,0xFC,0x04,0x04,0x04,0x28,0x10,0x00, + /* 0xF3CB [?] [7751]*/ + 0x10,0x10,0x3F,0x48,0x95,0x10,0x1F,0x22,0x42,0x84,0x08,0x11,0x22,0x44,0x08,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x48,0x48,0x88,0x88,0x08,0x08,0x08,0x50,0x20, + /* 0xF3CC [?] [7752]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x7E,0x08,0x08,0x08,0x08,0x08,0x0E,0xF0,0x40,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x84,0x88,0x90,0x88,0x84,0x84,0xA8,0x90,0x80, + /* 0xF3CD [?] [7753]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x20,0x20,0x27,0x24,0x24,0x27,0x20,0x20,0x3F, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0xF8,0x00,0x00,0xFE, + /* 0xF3CE [?] [7754]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x1F,0x10,0x10,0x1F,0x10,0x10,0x1F,0x00,0xFF,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0xFE,0x00, + /* 0xF3CF [?] [7755]*/ + 0x10,0x10,0x3F,0x28,0x45,0x91,0x11,0x3F,0x41,0x81,0x01,0x3F,0x01,0x01,0x01,0xFF, + 0x40,0x40,0x7E,0x90,0x08,0x00,0x00,0xFC,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0xFE, + /* 0xF3D0 [?] [7756]*/ + 0x10,0x10,0x3F,0x28,0x45,0x88,0x08,0x1F,0x24,0x44,0x87,0x04,0x04,0x07,0x04,0x04, + 0x40,0x40,0x7E,0x90,0x08,0x00,0x00,0xFC,0x00,0x00,0xF0,0x00,0x00,0xF8,0x00,0x00, + /* 0xF3D1 [?] [7757]*/ + 0x10,0x10,0x3F,0x48,0x95,0x10,0x1F,0x20,0x40,0x9F,0x10,0x10,0x1F,0x00,0x00,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0x08,0x88,0x88,0x88,0x88,0x08,0x50,0x20, + /* 0xF3D2 [?] [7758]*/ + 0x10,0x10,0x1F,0x28,0x24,0x45,0x82,0x01,0x01,0x7F,0x00,0x10,0x08,0x04,0x00,0xFF, + 0x40,0x40,0x7E,0x90,0x88,0x08,0x00,0x00,0x00,0xFC,0x00,0x10,0x20,0x40,0x00,0xFE, + /* 0xF3D3 [?] [7759]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x00,0x7F,0x00,0x1F,0x10,0x10,0x1F,0x10,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0xE8,0x08,0x88,0x88,0x88,0x88,0xA8,0x10, + /* 0xF3D4 [?] [7760]*/ + 0x20,0x3F,0x48,0x85,0x00,0x7F,0x04,0x08,0x10,0x20,0xDF,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0x08,0x50,0x20,0xF8,0x08,0x08,0x08,0xF8,0x08, + /* 0xF3D5 [?] [7761]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x10,0x7E,0x12,0x12,0x12,0x12,0x22,0x22,0x4A,0x84, + 0x40,0x40,0x7E,0x90,0x08,0x00,0x7C,0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xF3D6 [?] [7762]*/ + 0x10,0x10,0x3F,0x48,0x85,0x20,0x10,0x17,0x00,0x70,0x11,0x11,0x12,0x14,0x28,0x47, + 0x40,0x40,0x7E,0x90,0x08,0x80,0x80,0xF8,0x88,0x88,0x08,0x08,0x28,0x10,0x00,0xFE, + /* 0xF3D7 [?] [7763]*/ + 0x10,0x10,0x3F,0x48,0x85,0x08,0x10,0x3F,0x00,0x00,0x1F,0x10,0x10,0x10,0x1F,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x20,0x10,0xF8,0x08,0x00,0xF0,0x10,0x10,0x10,0xF0,0x10, + /* 0xF3D8 [?] [7764]*/ + 0x10,0x10,0x3F,0x28,0x45,0x88,0x08,0x7E,0x08,0x08,0x0E,0x78,0x08,0x08,0x28,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84,0x00, + /* 0xF3D9 [?] [7765]*/ + 0x20,0x3F,0x48,0x85,0x20,0x20,0x3E,0x20,0x20,0x26,0x39,0x01,0xFF,0x01,0x01,0x01, + 0x40,0x7E,0x90,0x08,0x80,0x88,0xB0,0xC4,0x84,0x7C,0x00,0x00,0xFE,0x00,0x00,0x00, + /* 0xF3DA [?] [7766]*/ + 0x10,0x10,0x3F,0x48,0x85,0x11,0x11,0x3F,0x41,0x01,0xFF,0x04,0x08,0x10,0x20,0xC0, + 0x40,0x40,0x7E,0x90,0x08,0x00,0x00,0xF8,0x00,0x00,0xFE,0x40,0x40,0x42,0x42,0x3E, + /* 0xF3DB [?] [7767]*/ + 0x20,0x3F,0x48,0x85,0x00,0x7B,0x08,0x10,0x22,0x7A,0x0A,0x2B,0x10,0x28,0x47,0x80, + 0x40,0x7E,0x90,0x08,0x18,0xE0,0x40,0x40,0x78,0x40,0x40,0xFC,0x00,0x00,0xFE,0x00, + /* 0xF3DC [?] [7768]*/ + 0x10,0x10,0x3F,0x28,0x45,0x82,0x04,0x08,0x30,0xCF,0x01,0x01,0x1F,0x01,0x01,0x7F, + 0x40,0x40,0x7E,0x90,0x08,0x80,0x40,0x20,0x18,0xE6,0x00,0x00,0xF0,0x00,0x00,0xFC, + /* 0xF3DD [?] [7769]*/ + 0x10,0x10,0x3F,0x28,0x45,0x88,0x1F,0x20,0x5F,0x01,0xFF,0x01,0x1F,0x01,0x05,0x02, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xF0,0x20,0xF8,0x08,0xFE,0x08,0xF8,0x08,0x00,0x00, + /* 0xF3DE [?] [7770]*/ + 0x10,0x10,0x3F,0x28,0x45,0x90,0x10,0x7D,0x12,0x10,0x10,0x1C,0xE0,0x41,0x00,0x00, + 0x40,0x40,0x7E,0x90,0x08,0x80,0xFC,0x04,0x04,0x84,0x54,0x24,0x44,0x84,0x28,0x10, + /* 0xF3DF [?] [7771]*/ + 0x10,0x10,0x3F,0x48,0x85,0x00,0x7F,0x01,0x11,0x11,0x11,0x29,0x45,0x85,0x01,0xFF, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x00,0x10,0x10,0x10,0x28,0x44,0x84,0x00,0xFE, + /* 0xF3E0 [?] [7772]*/ + 0x20,0x3F,0x48,0x85,0x7F,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x21,0x1A,0x06,0x19,0x60, + 0x40,0x7E,0x90,0x08,0xFC,0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0x00,0x00,0xC0,0x3E, + /* 0xF3E1 [?] [7773]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x11,0xFD,0x11,0x11,0x1D,0xF1,0x11,0x11,0x51,0x20, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xFC,0x24,0x24,0x24,0xFC,0x00,0x00,0x02,0x02,0xFE, + /* 0xF3E2 [?] [7774]*/ + 0x10,0x10,0x3F,0x48,0x85,0x11,0x09,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10,0x10,0x10, + 0x40,0x40,0x7E,0x90,0x08,0x10,0x20,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x10,0x50,0x20, + /* 0xF3E3 [?] [7775]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x10,0x24,0x24,0x64,0xA5,0x24,0x24,0x20,0x20,0x23, + 0x40,0x40,0x7E,0x90,0x08,0x40,0x40,0x7E,0x88,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xF3E4 [?] [7776]*/ + 0x20,0x3F,0x49,0xBF,0x01,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x10, + 0x40,0x7E,0x90,0xF8,0x00,0xF0,0x00,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0x30, + /* 0xF3E5 [?] [7777]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x01,0x1F,0x01,0x7F,0x00,0x1F,0x10,0x11,0x02,0x0C,0x70, + 0x40,0x7E,0x90,0x08,0xF8,0x00,0xF0,0x00,0xFC,0x00,0xF0,0x10,0x10,0xC0,0x30,0x08, + /* 0xF3E6 [?] [7778]*/ + 0x20,0x3F,0x48,0x85,0x00,0x3F,0x20,0x20,0x2F,0x24,0x22,0x2F,0x21,0x22,0x24,0x3F, + 0x40,0x7E,0x90,0x08,0x00,0xFC,0x80,0x80,0xF8,0x90,0xA0,0xFC,0x40,0x20,0x10,0xFE, + /* 0xF3E7 [?] [7779]*/ + 0x10,0x10,0x3F,0x28,0x45,0x82,0x1F,0x02,0xFF,0x03,0x0F,0x38,0xCF,0x08,0x0F,0x08, + 0x40,0x40,0x7E,0x90,0x08,0x00,0xD0,0x20,0xFE,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10, + /* 0xF3E8 [?] [7780]*/ + 0x20,0x3F,0x48,0x85,0x08,0x7F,0x08,0x02,0xFF,0x04,0x08,0x1F,0x28,0xC8,0x0F,0x08, + 0x40,0x7E,0x90,0x08,0x20,0xFC,0x20,0x00,0xFE,0x00,0x00,0xF0,0x10,0x10,0xF0,0x10, + /* 0xF3E9 [?] [7781]*/ + 0x10,0x10,0x3F,0x48,0x85,0x10,0x10,0xFB,0x10,0x10,0x1C,0xF0,0x10,0x10,0x50,0x20, + 0x40,0x40,0x7E,0x90,0x08,0x88,0x88,0xFE,0x88,0x88,0xF8,0x88,0x88,0x88,0xF8,0x88, + /* 0xF3EA [?] [7782]*/ + 0x20,0x3F,0x48,0x85,0x10,0x11,0x10,0xFC,0x13,0x10,0x1D,0x30,0xD3,0x10,0x50,0x20, + 0x40,0x7E,0x90,0x08,0x00,0xFC,0x88,0x70,0x8E,0x20,0xFC,0x20,0xFE,0x20,0x20,0x20, + /* 0xF3EB [?] [7783]*/ + 0x10,0x10,0x3F,0x48,0x85,0x3F,0x21,0x3F,0x21,0x3F,0x00,0xFF,0x08,0x08,0x10,0x20, + 0x40,0x40,0x7E,0x90,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x20,0x20,0x20,0x20, + /* 0xF3EC [?] [7784]*/ + 0x20,0x3F,0x48,0x85,0x08,0x04,0x3F,0x21,0x3F,0x21,0x3F,0x01,0xFF,0x01,0x01,0x01, + 0x40,0x7E,0x90,0x08,0x20,0x40,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFE,0x00,0x00,0x00, + /* 0xF3ED [?] [7785]*/ + 0x20,0x3F,0x48,0x85,0x01,0x7F,0x40,0x88,0x10,0x20,0x1F,0x01,0x01,0x01,0x7F,0x00, + 0x40,0x7E,0x90,0x08,0x00,0xFE,0x02,0x24,0x10,0x08,0xF0,0x00,0x00,0x00,0xFC,0x00, + /* 0xF3EE [?] [7786]*/ + 0x20,0x20,0x7E,0x51,0x8A,0x01,0x7F,0x40,0x90,0x1E,0x22,0x24,0x54,0x08,0x10,0x60, + 0x40,0x40,0xFE,0x10,0x08,0x00,0xFE,0x02,0x04,0xF8,0x88,0xA8,0x90,0x84,0x84,0x7C, + /* 0xF3EF [?] [7787]*/ + 0x20,0x3F,0x48,0x85,0x01,0x3F,0x01,0xFF,0x01,0x3F,0x01,0x25,0x25,0x29,0x41,0x81, + 0x40,0x7E,0x90,0x08,0x00,0xF8,0x08,0xFE,0x08,0xF8,0x00,0x48,0x28,0x28,0x08,0x08, + /* 0xF3F0 [?] [7788]*/ + 0x10,0x10,0x3F,0x28,0x45,0x80,0x3F,0x20,0x2F,0x20,0x2F,0x28,0x28,0x4F,0x40,0x80, + 0x40,0x40,0x7E,0x90,0x28,0x24,0xFE,0x20,0xA4,0x24,0xA8,0x98,0x92,0xAA,0x46,0x82, + /* 0xF3F1 [?] [7789]*/ + 0x20,0x3F,0x48,0x85,0x1F,0x11,0x1F,0x01,0xFF,0x00,0x1F,0x10,0x11,0x02,0x0C,0x70, + 0x40,0x7E,0x90,0x08,0xF0,0x10,0xF0,0x00,0xFE,0x00,0xF0,0x10,0x10,0xC0,0x30,0x08, + /* 0xF3F2 [?] [7790]*/ + 0x20,0x20,0x7E,0x51,0x8A,0x1F,0x10,0x1F,0x10,0x1F,0x00,0x7F,0x01,0x3F,0x01,0xFF, + 0x40,0x40,0xFE,0x10,0x08,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x00,0xF8,0x00,0xFE, + /* 0xF3F3 [?] [7791]*/ + 0x20,0x3F,0x48,0x85,0x09,0x08,0x10,0x37,0x51,0x91,0x12,0x10,0x17,0x10,0x11,0x12, + 0x40,0x7E,0x90,0x08,0xF0,0x10,0x10,0xFC,0x00,0xF8,0x40,0x40,0xFC,0xA0,0x10,0x0C, + /* 0xF3F4 [?] [7792]*/ + 0x20,0x3F,0x48,0x85,0x7F,0x04,0x3F,0x04,0xFF,0x11,0x1F,0x11,0xFF,0x10,0x10,0x10, + 0x40,0x7E,0x90,0x48,0xFC,0x40,0xF8,0x40,0xFE,0x10,0xF0,0x10,0xFE,0x10,0x50,0x20, + /* 0xF3F5 [?] [7793]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x22,0x22,0x3E,0x22,0x2E,0x22,0x3E,0x22,0x22,0x3F,0x00, + 0x40,0x7E,0x90,0x08,0xFC,0x40,0x40,0x78,0x40,0x70,0x40,0x78,0x40,0x40,0xFC,0x00, + /* 0xF3F6 [?] [7794]*/ + 0x10,0x10,0x3F,0x48,0x85,0x7F,0x04,0x3F,0x24,0x3F,0x01,0x7F,0x05,0x19,0xE1,0x01, + 0x40,0x40,0x7E,0x90,0x08,0xFC,0x40,0xF8,0x48,0xF8,0x00,0xFC,0x40,0x30,0x0E,0x00, + /* 0xF3F7 [?] [7795]*/ + 0x20,0x3E,0x48,0x82,0x3F,0x24,0x23,0x24,0x3F,0x00,0x20,0x3E,0x20,0x20,0x26,0x38, + 0x40,0x7E,0x90,0x00,0xF8,0x48,0x88,0x48,0xF8,0x00,0x84,0x98,0xE0,0x84,0x84,0x7C, + /* 0xF3F8 [?] [7796]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x20,0x20,0x2F,0x28,0x28,0x2B,0x28,0x48,0x51,0x92,0x24, + 0x40,0x7E,0x90,0x7C,0x80,0xF8,0x80,0xFC,0x84,0xF0,0x88,0x78,0x00,0xE0,0x24,0x1C, + /* 0xF3F9 [?] [7797]*/ + 0x20,0x3F,0x48,0x85,0x08,0xFF,0x08,0x7F,0x49,0x49,0x7F,0x1C,0x2A,0x49,0x88,0x08, + 0x40,0x7E,0x90,0x08,0x20,0xA0,0x3E,0x42,0x94,0x10,0x10,0x10,0x28,0x28,0x44,0x82, + /* 0xF3FA [?] [7798]*/ + 0x20,0x3F,0x48,0x85,0x3F,0x24,0x24,0x3F,0x00,0x3F,0x20,0x30,0x28,0x24,0x40,0x83, + 0x40,0x7E,0x90,0x08,0xF8,0x48,0x48,0xF8,0x90,0xFC,0x80,0x48,0x50,0x24,0xD4,0x0C, + /* 0xF3FB [?] [7799]*/ + 0x20,0x3F,0x48,0x85,0x12,0x67,0x44,0x47,0x44,0x57,0x60,0x04,0x04,0x08,0x10,0x60, + 0x40,0x7E,0x90,0x08,0x00,0xDC,0x44,0xC4,0x44,0xDC,0x00,0x40,0x40,0x42,0x42,0x3E, + /* 0xF3FC [?] [7800]*/ + 0x20,0x3F,0x48,0x85,0x00,0x3F,0x22,0x3F,0x22,0x3F,0x28,0x28,0x2F,0x48,0x4B,0x8C, + 0x40,0x7E,0x90,0x08,0x80,0xFE,0x20,0xFC,0x24,0xFC,0x40,0x48,0x70,0x44,0x44,0x3C, + /* 0xF3FD [?] [7801]*/ + 0x20,0x3F,0x48,0x85,0x04,0x55,0x4E,0x44,0x5F,0x44,0x4E,0x55,0x44,0x7F,0x00,0x01, + 0x40,0x7E,0x90,0x08,0x0C,0x70,0x40,0x40,0x7E,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xF3FE [?] [7802]*/ + 0x20,0x3F,0x48,0x85,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x14,0x18,0x3F,0x24,0x24,0xFF, + 0x40,0x7E,0x90,0x08,0xF0,0x10,0xF0,0x10,0xF4,0x88,0x70,0x0E,0xF8,0x48,0x48,0xFE, + /* 0xF4A1 [?] [7803]*/ + 0x20,0x3E,0x48,0xFF,0x04,0x3F,0x24,0x3F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x01,0x01, + 0x40,0x7E,0x90,0xFC,0x40,0xF8,0x48,0xF8,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00,0x00, + /* 0xF4A2 [?] [7804]*/ + 0x20,0x3F,0x48,0x85,0x3E,0x08,0x48,0x7E,0x14,0x24,0x46,0x3F,0x20,0x3F,0x20,0x3F, + 0x40,0x7E,0x90,0x08,0x7C,0x10,0x90,0xFE,0x28,0x4A,0x86,0xF8,0x08,0xF8,0x08,0xF8, + /* 0xF4A3 [?] [7805]*/ + 0x20,0x3F,0x48,0x85,0x00,0x7E,0x04,0x28,0x17,0x20,0xDF,0x10,0x1F,0x08,0x04,0x7F, + 0x40,0x7E,0x90,0x08,0x90,0xA0,0x44,0x28,0xD0,0x08,0xF6,0x10,0xF0,0x20,0x40,0xFC, + /* 0xF4A4 [?] [7806]*/ + 0x20,0x3F,0x48,0x85,0x24,0x24,0xFE,0x24,0x3C,0x24,0x3C,0x24,0xFE,0x29,0x45,0x82, + 0x40,0x7E,0x90,0x08,0x10,0x10,0xFE,0x92,0x90,0xFC,0xA4,0xA4,0xA8,0x10,0x28,0x46, + /* 0xF4A5 [?] [7807]*/ + 0x20,0x3F,0x48,0x85,0x08,0x7F,0x08,0x3E,0x2A,0x2A,0x3E,0x08,0x1C,0x2A,0x48,0x08, + 0x40,0x7E,0x90,0x08,0x20,0x3C,0x44,0x88,0x7C,0x44,0x54,0x54,0x54,0x28,0x44,0x82, + /* 0xF4A6 [?] [7808]*/ + 0x20,0x3F,0x48,0x85,0x20,0x27,0xF4,0x25,0x36,0x20,0xE7,0x24,0x27,0x24,0xA7,0x44, + 0x40,0x7E,0x90,0x08,0x80,0x7C,0xA4,0xA4,0x54,0x88,0xFC,0x44,0xFC,0x44,0xFC,0x04, + /* 0xF4A7 [?] [7809]*/ + 0x01,0x05,0x39,0x21,0x21,0x3D,0x21,0x21,0x21,0x3F,0x21,0x02,0x04,0x08,0x30,0xC0, + 0x00,0x00,0x78,0x08,0x08,0x78,0x08,0x08,0x08,0xF8,0x08,0x80,0x40,0x20,0x18,0x06, + /* 0xF4A8 [?] [7810]*/ + 0x06,0x38,0x20,0x20,0x3E,0x20,0x20,0x3F,0x08,0x08,0xFF,0x08,0x08,0x10,0x20,0x40, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF4A9 [?] [7811]*/ + 0x01,0x01,0x7F,0x01,0x3F,0x02,0xFF,0x04,0x08,0x34,0xD8,0x10,0x1C,0x10,0x1F,0x10, + 0x00,0x00,0xFC,0x00,0xF8,0x00,0xFE,0x40,0x20,0x18,0x76,0x10,0x70,0x10,0xF0,0x10, + /* 0xF4AA [?] [7812]*/ + 0x06,0x38,0x20,0x20,0x3E,0x20,0x20,0x3F,0x10,0x3F,0x40,0x89,0x24,0x24,0x40,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x00,0xFC,0x04,0x24,0x94,0x94,0x28,0x10, + /* 0xF4AB [?] [7813]*/ + 0x02,0x04,0x1F,0x10,0x1F,0x10,0x1F,0x10,0x1F,0x01,0xFF,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x40,0x20,0x18,0x06,0x00, + /* 0xF4AC [?] [7814]*/ + 0x08,0x08,0x10,0x7F,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x57,0xFC,0x01,0x00, + 0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x44,0x44,0x44,0x44,0xC4,0x44,0xFE,0x00, + /* 0xF4AD [?] [7815]*/ + 0x08,0x10,0x3E,0x22,0x32,0x2A,0x2A,0xFE,0x22,0x32,0x2A,0x2A,0x22,0x42,0x4A,0x84, + 0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0xFE,0x00, + /* 0xF4AE [?] [7816]*/ + 0x10,0x20,0x7C,0x44,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x54,0x88, + 0x20,0x20,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00, + /* 0xF4AF [?] [7817]*/ + 0x10,0x20,0x7D,0x45,0x65,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x44,0x44,0x55,0x8A, + 0x40,0x24,0x24,0x04,0x04,0x88,0x88,0x88,0x50,0x50,0x20,0x20,0x50,0x88,0x04,0x02, + /* 0xF4B0 [?] [7818]*/ + 0x10,0x21,0x7D,0x45,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x55,0x88, + 0x10,0x10,0x10,0x12,0x12,0x14,0xD8,0x10,0x10,0x10,0x10,0x12,0x52,0x92,0x0E,0x00, + /* 0xF4B1 [?] [7819]*/ + 0x10,0x20,0x7C,0x44,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x54,0x44,0x44,0x54,0x88, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x20,0x20,0x20,0x20,0x20, + /* 0xF4B2 [?] [7820]*/ + 0x10,0x20,0x7C,0x44,0x64,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x45,0x45,0x56,0x88, + 0x04,0x0E,0xF0,0x80,0x80,0xFC,0xA4,0xA4,0xA4,0xA8,0xA8,0x90,0x10,0x28,0x44,0x82, + /* 0xF4B3 [?] [7821]*/ + 0x10,0x20,0x7C,0x45,0x64,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x44,0x44,0x55,0x8A, + 0x40,0x20,0x20,0xFE,0x40,0x40,0x40,0x7C,0x44,0x44,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xF4B4 [?] [7822]*/ + 0x10,0x20,0x7D,0x44,0x64,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x44,0x44,0x54,0x88, + 0x00,0x00,0xFE,0x08,0x08,0xE8,0x28,0x28,0x28,0x28,0xE8,0x28,0x08,0x08,0x28,0x10, + /* 0xF4B5 [?] [7823]*/ + 0x10,0x20,0x7C,0x44,0x64,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x44,0x45,0x55,0x8A, + 0x20,0x20,0x3C,0x20,0x20,0xFC,0x84,0x84,0x84,0xFC,0x84,0x80,0x80,0x00,0x00,0x00, + /* 0xF4B6 [?] [7824]*/ + 0x10,0x20,0x7C,0x44,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x55,0x89, + 0x20,0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFC,0x24,0x24,0x24,0x24,0xFC,0x04, + /* 0xF4B7 [?] [7825]*/ + 0x10,0x20,0x7C,0x44,0x65,0x55,0x56,0xFC,0x44,0x64,0x54,0x54,0x44,0x44,0x54,0x88, + 0x80,0x80,0x80,0xFE,0x40,0x40,0x40,0x7C,0x40,0x40,0x40,0x7E,0x40,0x40,0x40,0x40, + /* 0xF4B8 [?] [7826]*/ + 0x10,0x23,0x7C,0x44,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x55,0x89, + 0x00,0xFE,0x50,0x50,0xFC,0x54,0x54,0x54,0x54,0x54,0x8C,0x04,0x04,0x04,0xFC,0x04, + /* 0xF4B9 [?] [7827]*/ + 0x10,0x21,0x7C,0x44,0x64,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x55,0x89, + 0x20,0x24,0xA4,0xA8,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x04,0x04,0x14,0x08, + /* 0xF4BA [?] [7828]*/ + 0x10,0x21,0x7D,0x45,0x65,0x55,0x55,0xFD,0x45,0x65,0x55,0x55,0x45,0x45,0x55,0x8A, + 0x00,0xFC,0x04,0x04,0xFC,0x00,0x1C,0x70,0x1C,0x70,0x1E,0xF0,0x10,0x12,0x12,0x0E, + /* 0xF4BB [?] [7829]*/ + 0x10,0x21,0x7C,0x44,0x64,0x57,0x54,0xFC,0x44,0x65,0x55,0x55,0x45,0x45,0x57,0x88, + 0x00,0xFC,0x08,0x10,0x20,0xFE,0x20,0xA0,0x40,0xFC,0x54,0x54,0x54,0x54,0xFE,0x00, + /* 0xF4BC [?] [7830]*/ + 0x10,0x20,0x7D,0x44,0x64,0x54,0x54,0xFC,0x44,0x64,0x54,0x54,0x44,0x44,0x54,0x88, + 0x84,0x48,0xFE,0x20,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xF4BD [?] [7831]*/ + 0x10,0x20,0x7D,0x44,0x65,0x55,0x55,0xFD,0x45,0x64,0x54,0x54,0x44,0x44,0x54,0x88, + 0x50,0x50,0xFE,0x50,0xFC,0x54,0xFC,0x54,0xFC,0x00,0xF8,0x88,0xF8,0x88,0xF8,0x88, + /* 0xF4BE [?] [7832]*/ + 0x10,0x21,0x7C,0x44,0x67,0x54,0x55,0xFD,0x45,0x65,0x55,0x54,0x45,0x44,0x57,0x88, + 0x20,0xFC,0x88,0x50,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xF4BF [?] [7833]*/ + 0x10,0x23,0x78,0x4B,0x6A,0x59,0x48,0xFB,0x48,0x48,0x6B,0x58,0x4B,0x48,0x4B,0x98, + 0x88,0xFE,0x88,0xFE,0x02,0xFC,0x00,0xFE,0x40,0xA2,0x54,0xB8,0x54,0x92,0x50,0x20, + /* 0xF4C0 [?] [7834]*/ + 0x01,0x02,0x04,0x09,0x30,0xCF,0x00,0x02,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x80,0x40,0x20,0x98,0xE6,0x40,0x80,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xF4C1 [?] [7835]*/ + 0x04,0x1F,0x14,0x12,0x10,0x1F,0x00,0x02,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0xE0,0x20,0xA0,0x40,0xFC,0x04,0x14,0x08,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xF4C2 [?] [7836]*/ + 0x08,0x08,0x7F,0x09,0x11,0x11,0x25,0x42,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xF4C3 [?] [7837]*/ + 0x01,0x01,0x7F,0x11,0x09,0x05,0x19,0x62,0x01,0xFF,0x05,0x0C,0x34,0xC5,0x06,0x04, + 0x20,0x10,0xFC,0x10,0xA0,0x40,0x30,0x08,0x00,0xFE,0x00,0x88,0x50,0x30,0x0E,0x00, + /* 0xF4C4 [?] [7838]*/ + 0x10,0x08,0x40,0x24,0x09,0x72,0x10,0x10,0x07,0x01,0xFF,0x04,0x0C,0x34,0xC5,0x06, + 0x20,0x20,0xA8,0xA4,0x22,0x28,0x30,0xC0,0x00,0x00,0xFE,0x88,0x50,0x20,0x18,0x06, + /* 0xF4C5 [?] [7839]*/ + 0x00,0x7C,0x45,0x44,0x7C,0x43,0x7C,0xA5,0x24,0x3E,0x01,0xFF,0x06,0x1C,0xE5,0x06, + 0x40,0x20,0xFC,0x88,0x50,0xFE,0x20,0xFC,0x20,0x20,0x00,0xFE,0x80,0x48,0x30,0x0E, + /* 0xF4C6 [?] [7840]*/ + 0x44,0x24,0x29,0xFD,0x11,0x11,0x7D,0x11,0x11,0xFD,0x11,0x11,0x21,0x21,0x41,0x81, + 0x04,0x1E,0xF0,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x08,0x0A,0x4A,0xA6,0x12, + /* 0xF4C7 [?] [7841]*/ + 0x44,0x25,0x28,0xFC,0x10,0x10,0x7C,0x13,0x10,0xFD,0x10,0x10,0x20,0x20,0x43,0x80, + 0x00,0xFC,0x08,0x10,0x30,0x48,0x84,0x02,0x00,0xFC,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xF4C8 [?] [7842]*/ + 0x44,0x24,0x28,0xFD,0x13,0x10,0x7C,0x11,0x12,0xFC,0x11,0x12,0x20,0x20,0x41,0x86, + 0x40,0x40,0x88,0x04,0xFE,0x02,0x88,0x44,0x42,0xF8,0x88,0x50,0x20,0x50,0x88,0x06, + /* 0xF4C9 [?] [7843]*/ + 0x44,0x25,0x29,0xFD,0x11,0x11,0x7C,0x11,0x12,0xFD,0x11,0x11,0x21,0x20,0x40,0x80, + 0x00,0xFC,0x04,0xFC,0x04,0xFC,0x80,0xFE,0x22,0x22,0x52,0x02,0xFA,0x02,0x14,0x08, + /* 0xF4CA [?] [7844]*/ + 0x44,0x25,0x29,0xFD,0x11,0x10,0x7C,0x13,0x10,0xFD,0x11,0x12,0x22,0x24,0x48,0x80, + 0x20,0x24,0x24,0x24,0xFC,0x80,0x80,0xFE,0x90,0x10,0x52,0x54,0xA8,0x28,0x44,0x82, + /* 0xF4CB [?] [7845]*/ + 0x04,0x7F,0x01,0x3F,0x01,0xFF,0x00,0x3E,0x08,0xFF,0x2A,0x7D,0x90,0x1E,0x02,0x0C, + 0x40,0xFC,0x00,0xF8,0x00,0xFE,0x28,0x24,0x24,0xFE,0x20,0x24,0xA8,0x12,0x2A,0x46, + /* 0xF4CC [?] [7846]*/ + 0x10,0x10,0x94,0x54,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x10,0x10, + 0x20,0x20,0x20,0x20,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0x24,0xFC,0x04,0x00, + /* 0xF4CD [?] [7847]*/ + 0x10,0x10,0x94,0x54,0x58,0x11,0xFE,0x30,0x38,0x54,0x54,0x90,0x10,0x10,0x11,0x12, + 0x40,0x40,0x40,0x80,0xFE,0x08,0x88,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x04,0x02, + /* 0xF4CE [?] [7848]*/ + 0x10,0x10,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x10,0x10, + 0x00,0x00,0xFC,0x24,0x24,0x24,0x24,0x24,0xFC,0x00,0x00,0x00,0x02,0x02,0xFE,0x00, + /* 0xF4CF [?] [7849]*/ + 0x10,0x11,0x95,0x55,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x12,0x12,0x14, + 0x00,0xFE,0x00,0x00,0x00,0xFE,0x20,0x20,0x3C,0x24,0x24,0x24,0x24,0x44,0x54,0x88, + /* 0xF4D0 [?] [7850]*/ + 0x01,0x11,0x11,0x1F,0x41,0x41,0x7F,0x00,0x11,0x09,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x10,0x10,0xF0,0x04,0x04,0xFC,0x00,0x10,0x20,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xF4D1 [?] [7851]*/ + 0x10,0x13,0x94,0x54,0x59,0x11,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x00,0xFE,0x50,0x50,0xFC,0x54,0x54,0x54,0x54,0x54,0x8C,0x04,0x04,0x04,0xFC,0x04, + /* 0xF4D2 [?] [7852]*/ + 0x01,0x41,0x21,0x0A,0x14,0xE0,0x21,0x26,0x11,0x09,0x7F,0x05,0x09,0x31,0xC1,0x01, + 0x00,0x00,0xFC,0x44,0x48,0xA0,0x10,0x08,0x10,0x20,0xFC,0x40,0x20,0x18,0x06,0x00, + /* 0xF4D3 [?] [7853]*/ + 0x08,0x0F,0x28,0x3F,0x61,0x92,0x0C,0x31,0xC0,0x11,0x09,0x7F,0x05,0x09,0x31,0xC1, + 0x00,0x7C,0x04,0x44,0x28,0x10,0x68,0x84,0x00,0x10,0x20,0xFC,0x40,0x20,0x18,0x06, + /* 0xF4D4 [?] [7854]*/ + 0x08,0x49,0x2A,0x08,0xFF,0x2A,0x49,0x88,0x42,0x77,0x92,0x5A,0x2F,0x22,0x42,0x82, + 0x00,0x12,0x12,0x12,0x24,0x24,0x48,0x90,0x48,0x48,0x24,0x24,0x92,0x12,0x12,0x00, + /* 0xF4D5 [?] [7855]*/ + 0x20,0x20,0x23,0xAA,0x70,0x21,0xF8,0x20,0x73,0x68,0xA9,0x21,0x22,0x24,0x20,0x20, + 0x40,0x20,0xFE,0x02,0x00,0xFC,0x00,0x00,0xFE,0x20,0x28,0x24,0x22,0x22,0xA0,0x40, + /* 0xF4D6 [?] [7856]*/ + 0x10,0x10,0x94,0x55,0x58,0x13,0xFC,0x31,0x3A,0x55,0x54,0x90,0x11,0x10,0x10,0x13, + 0x40,0x48,0x84,0xFE,0x20,0xFE,0x88,0x24,0x42,0x88,0x10,0x62,0x84,0x18,0x60,0x80, + /* 0xF4D7 [?] [7857]*/ + 0x10,0x10,0x94,0x55,0x59,0x13,0xFD,0x31,0x39,0x55,0x55,0x91,0x11,0x11,0x11,0x11, + 0x80,0xBC,0x84,0x08,0xFE,0x20,0x20,0x7C,0x90,0x10,0xFE,0x10,0x28,0x28,0x44,0x82, + /* 0xF4D8 [?] [7858]*/ + 0x20,0x20,0x21,0xA9,0x72,0x25,0xF8,0x21,0x76,0x69,0xA9,0x21,0x21,0x21,0x21,0x21, + 0x88,0x88,0xEC,0x2A,0x28,0x48,0x88,0x7E,0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC, + /* 0xF4D9 [?] [7859]*/ + 0x21,0x20,0x20,0xAF,0x71,0x21,0xFA,0x22,0x74,0x6F,0xA9,0x22,0x22,0x24,0x27,0x20, + 0x08,0x88,0x90,0xFE,0x08,0x08,0x10,0x94,0xA4,0x38,0x08,0x10,0x10,0xA4,0xBC,0x84, + /* 0xF4DA [?] [7860]*/ + 0x20,0x23,0x20,0xA9,0x71,0x21,0xFA,0x24,0x71,0x69,0xA9,0x21,0x21,0x21,0x21,0x21, + 0x00,0xFE,0x22,0x20,0x3C,0x20,0xFE,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04,0x14,0x08, + /* 0xF4DB [?] [7861]*/ + 0x20,0x21,0x20,0xA8,0x73,0x20,0xF8,0x21,0x72,0x68,0xAB,0x20,0x20,0x21,0x26,0x20, + 0x00,0xFC,0x48,0x30,0xFE,0x52,0x94,0x10,0x30,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xF4DC [?] [7862]*/ + 0x20,0x20,0x23,0xAA,0x73,0x22,0xFB,0x22,0x73,0x68,0xA8,0x27,0x20,0x21,0x22,0x2C, + 0x40,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0xF8,0x50,0x48,0xFE,0xA0,0x10,0x08,0x06, + /* 0xF4DD [?] [7863]*/ + 0x20,0x23,0x20,0xA8,0x70,0x23,0xFA,0x22,0x72,0x6B,0xA8,0x20,0x20,0x20,0x25,0x22, + 0x00,0xBE,0xA2,0xA2,0xBE,0x88,0x08,0x3E,0x2A,0xAA,0xAA,0xBE,0x88,0x8A,0x7E,0x02, + /* 0xF4DE [?] [7864]*/ + 0x00,0x3F,0x20,0x20,0x3F,0x20,0x20,0x3F,0x22,0x22,0x21,0x20,0x24,0x28,0x30,0x20, + 0x00,0xF0,0x10,0x10,0xF0,0x10,0x10,0xF0,0x00,0x08,0x10,0xA0,0x40,0x20,0x18,0x06, + /* 0xF4DF [?] [7865]*/ + 0x7D,0x44,0x7D,0x45,0x7C,0x48,0x54,0x65,0x1F,0x10,0x1F,0x10,0x1F,0x00,0xFF,0x00, + 0xFC,0x20,0x20,0xFE,0x50,0x52,0x92,0x0E,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00, + /* 0xF4E0 [?] [7866]*/ + 0x00,0x7E,0x22,0x12,0x06,0x1A,0x62,0x02,0x04,0x04,0x7F,0x04,0x04,0x08,0x10,0x20, + 0x00,0xFC,0x44,0x24,0x0C,0x34,0xC4,0x04,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF4E1 [?] [7867]*/ + 0x10,0x11,0x28,0x24,0x43,0x90,0x08,0x00,0xFC,0x04,0x09,0x50,0x20,0x10,0x11,0x00, + 0x00,0xDC,0x44,0x44,0x54,0xCC,0x44,0x44,0x4C,0xD4,0x64,0x44,0x44,0x44,0x54,0x88, + /* 0xF4E2 [?] [7868]*/ + 0x01,0x06,0x18,0xEF,0x00,0x1F,0x10,0x1F,0x00,0x7E,0x22,0x12,0x0A,0x12,0x6A,0x04, + 0x00,0xC0,0x30,0xEE,0x00,0xF0,0x10,0xF0,0x00,0xFC,0x44,0x24,0x14,0x24,0xD4,0x08, + /* 0xF4E3 [?] [7869]*/ + 0x01,0x1F,0x01,0x7F,0x02,0x0F,0x38,0xCF,0x08,0x0F,0x00,0x7E,0x22,0x1A,0x62,0x06, + 0x08,0xD0,0x20,0xFC,0x00,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFC,0x44,0x34,0xC4,0x0C, + /* 0xF4E4 [?] [7870]*/ + 0x04,0x7C,0x04,0x3C,0x04,0x7C,0x04,0x04,0x00,0x7E,0x22,0x12,0x0A,0x12,0x6A,0x04, + 0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x40,0x00,0xFC,0x44,0x24,0x14,0x24,0xD4,0x08, + /* 0xF4E5 [?] [7871]*/ + 0x08,0xFF,0x00,0x3E,0x22,0x3E,0x22,0x3E,0x22,0x26,0x00,0x7E,0x22,0x1A,0x62,0x06, + 0x20,0xFE,0x00,0x08,0x48,0x48,0x48,0x48,0x08,0x18,0x00,0xFC,0x44,0x34,0xC4,0x0C, + /* 0xF4E6 [?] [7872]*/ + 0x10,0x08,0x7E,0x42,0x42,0x7E,0x42,0x40,0x7F,0x55,0x55,0x7F,0xD5,0x55,0x55,0x43, + 0x00,0xEE,0x22,0x22,0xAA,0x66,0x22,0x22,0x26,0x6A,0xB2,0x22,0x22,0x22,0xAA,0x44, + /* 0xF4E7 [?] [7873]*/ + 0x00,0xFE,0x00,0x7C,0x44,0x7C,0x00,0xFE,0x82,0xAA,0x92,0xFE,0x92,0x92,0x92,0x86, + 0x00,0xEE,0x22,0x22,0xAA,0x66,0x22,0x22,0x26,0x6A,0xB2,0x22,0x22,0x22,0xAA,0x44, + /* 0xF4E8 [?] [7874]*/ + 0x00,0x7F,0x48,0x5F,0x64,0x5F,0x44,0x4A,0x51,0x7F,0x00,0x7E,0x22,0x1A,0x62,0x06, + 0x00,0x78,0x48,0x4C,0x80,0x78,0x48,0x48,0x30,0x4C,0x00,0xFC,0x44,0x34,0xC4,0x0C, + /* 0xF4E9 [?] [7875]*/ + 0x02,0x04,0x08,0x10,0x3F,0x01,0x06,0x18,0x7F,0x01,0x09,0x09,0x11,0x21,0x45,0x02, + 0x00,0x00,0x20,0x40,0x80,0x00,0x10,0x08,0xFC,0x04,0x20,0x10,0x08,0x04,0x04,0x00, + /* 0xF4EA [?] [7876]*/ + 0x10,0xFB,0x10,0x19,0xF0,0x11,0x52,0x24,0x1F,0x01,0x06,0x3F,0x01,0x11,0x25,0x42, + 0x80,0xF0,0x90,0x90,0x94,0x54,0x0C,0x24,0xC0,0x80,0x10,0xF8,0x08,0x20,0x10,0x08, + /* 0xF4EB [?] [7877]*/ + 0x08,0x7F,0x08,0x0F,0x08,0x0F,0x08,0xFF,0x14,0x28,0xDF,0x02,0x3F,0x01,0x15,0x22, + 0x20,0xFC,0x20,0xE0,0x20,0xE0,0x20,0xFE,0x50,0x88,0x06,0x10,0xF8,0x08,0x20,0x10, + /* 0xF4EC [?] [7878]*/ + 0x10,0x08,0x3E,0x22,0x23,0x3E,0x20,0x41,0x84,0x08,0x1F,0x02,0x3F,0x01,0x15,0x22, + 0x40,0x40,0x7E,0x88,0x50,0x20,0x58,0x86,0x40,0x80,0x00,0x10,0xF8,0x08,0x20,0x10, + /* 0xF4ED [?] [7879]*/ + 0x00,0x0E,0xF0,0x22,0x92,0x44,0x20,0x3C,0x50,0x10,0xFE,0x10,0x54,0x55,0x5C,0x64, + 0x00,0x0C,0xF0,0x20,0x44,0xF8,0x10,0x24,0xFE,0x12,0x50,0x54,0x92,0x12,0x50,0x20, + /* 0xF4EE [?] [7880]*/ + 0x01,0xFF,0x01,0x1F,0x12,0xFF,0x10,0x1F,0x00,0x3E,0x22,0x2A,0x2A,0xFF,0x2A,0x59, + 0x00,0xFE,0x00,0xF0,0x10,0xFE,0x90,0xF0,0x1C,0xE0,0x24,0xF8,0x24,0xFE,0x54,0xB2, + /* 0xF4EF [?] [7881]*/ + 0x10,0x10,0xFE,0x10,0x7D,0x10,0xFE,0x20,0x3D,0x44,0x48,0xA8,0x10,0x28,0x41,0x82, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF4F0 [?] [7882]*/ + 0x10,0x10,0xFE,0x55,0x56,0xBA,0x10,0x38,0x55,0xA2,0x3C,0x44,0xA9,0x10,0x28,0xC0, + 0x80,0x80,0xFE,0x02,0x22,0xAA,0x72,0x22,0xFE,0x22,0x72,0xAA,0x22,0x22,0x0A,0x04, + /* 0xF4F1 [?] [7883]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFF,0x08,0x28,0x28,0x2E,0x28,0x28,0x58,0x4F,0x80, + 0x04,0x04,0x44,0x44,0x44,0x44,0x44,0x4C,0x54,0x64,0x04,0x04,0x04,0x00,0xFE,0x00, + /* 0xF4F2 [?] [7884]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFF,0x08,0x28,0x28,0x2E,0x29,0x28,0x58,0x4F,0x80, + 0x00,0xF8,0x88,0x88,0xF8,0x88,0x88,0xF8,0x88,0x88,0x88,0xFE,0x00,0x00,0xFE,0x00, + /* 0xF4F3 [?] [7885]*/ + 0x10,0x13,0x10,0x7C,0x10,0x11,0xFD,0x11,0x12,0x50,0x5C,0x50,0x51,0x72,0x50,0x8F, + 0x02,0xF2,0x82,0x8A,0x8A,0xEA,0x2A,0x2A,0xAA,0x4A,0x4A,0x82,0x0A,0x04,0x00,0xFE, + /* 0xF4F4 [?] [7886]*/ + 0x10,0x12,0x11,0x7D,0x10,0x10,0xFC,0x10,0x13,0x51,0x5D,0x51,0x51,0x70,0x50,0x8F, + 0x20,0x20,0x20,0x3E,0x42,0x84,0x90,0x90,0x10,0x10,0x28,0x24,0x42,0x82,0x00,0xFE, + /* 0xF4F5 [?] [7887]*/ + 0x11,0x15,0x17,0x79,0x17,0x13,0xFD,0x19,0x13,0x52,0x5A,0x52,0x50,0x71,0x52,0x8F, + 0x08,0x28,0xBE,0x48,0xBE,0x18,0xAA,0x46,0xF8,0x08,0x48,0x48,0xA0,0x10,0x08,0xFE, + /* 0xF4F6 [?] [7888]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFF,0x14,0x14,0x56,0x55,0x94,0x24,0x24,0x54,0x88, + 0x00,0xFC,0x84,0x84,0x94,0x88,0x80,0xFC,0xA4,0xA4,0xA8,0xA8,0x90,0xA8,0xC4,0x82, + /* 0xF4F7 [?] [7889]*/ + 0x08,0x08,0x08,0x7E,0x08,0x08,0xFF,0x14,0x14,0x56,0x55,0x95,0x24,0x24,0x54,0x88, + 0x20,0x24,0xF4,0x28,0x28,0xFE,0x10,0x20,0x7C,0xC4,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xF4F8 [?] [7890]*/ + 0x00,0xFE,0x01,0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x44,0x28,0x2E,0xF0,0x43,0x00, + 0x00,0x00,0xFC,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFE,0x00, + /* 0xF4F9 [?] [7891]*/ + 0x00,0xFE,0x00,0x01,0x7C,0x44,0x44,0x45,0x7C,0x00,0x44,0x28,0x2E,0xF0,0x41,0x06, + 0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x88,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xF4FA [?] [7892]*/ + 0x00,0xFF,0x14,0x14,0x7F,0x55,0x55,0x55,0x57,0x61,0x41,0x7F,0x41,0x41,0x7F,0x41, + 0x00,0x80,0x7E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x50,0x20, + /* 0xF4FB [?] [7893]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, + /* 0xF4FC [?] [7894]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x08,0x08,0x08,0x08,0xFE,0x08,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x28,0x10, + /* 0xF4FD [?] [7895]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAB,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x20,0x20,0xA0,0xAC,0xB4,0xE4,0xA4,0xA4,0xB4,0xA8,0xA2,0xA2,0x82,0x7E,0x00, + /* 0xF4FE [?] [7896]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x7C,0x44,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xF5A1 [?] [7897]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAB,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x40,0x40,0x40,0x7E,0xA0,0xA0,0x20,0x3C,0x20,0x20,0x20,0x3E,0x20,0x20,0x20,0x20, + /* 0xF5A2 [?] [7898]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x10,0x10,0xFE,0x82,0x84,0x40,0x44,0x48,0x50,0x60,0x42,0x42,0x42,0x3E,0x00, + /* 0xF5A3 [?] [7899]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x10,0x50,0x50,0x7C,0x90,0x10,0x10,0xFE,0x28,0x28,0x28,0x28,0x4A,0x4A,0x86,0x00, + /* 0xF5A4 [?] [7900]*/ + 0x00,0xFE,0x28,0x28,0xFF,0xAA,0xAA,0xAA,0xAE,0xC2,0x83,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x20,0x7E,0x82,0x44,0x28,0x10,0x20,0x40,0xFE,0x42,0x42,0x42,0x42,0x7E,0x42, + /* 0xF5A5 [?] [7901]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x80,0x82,0x8C,0xF0,0x82,0x82,0x7E,0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84, + /* 0xF5A6 [?] [7902]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x83,0xFF,0x82, + 0x00,0xFE,0x28,0xAA,0x6C,0x28,0xFE,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x00, + /* 0xF5A7 [?] [7903]*/ + 0x00,0xFB,0x20,0x20,0xFB,0xAA,0xAA,0xAA,0xDB,0x8A,0x8A,0xFA,0x8A,0x8A,0xFA,0x8A, + 0x00,0xFE,0x00,0x00,0xDE,0x52,0x52,0x52,0x5A,0xD6,0x52,0x52,0x52,0x52,0x52,0xD6, + /* 0xF5A8 [?] [7904]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x00,0x00,0xFE,0x10,0x10,0x7C,0x10,0x10,0xFE,0x00, + /* 0xF5A9 [?] [7905]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x83,0xFE,0x82, + 0x10,0x10,0x28,0x28,0x44,0xBA,0x10,0x10,0xFE,0x10,0x58,0x54,0x92,0x12,0x50,0x20, + /* 0xF5AA [?] [7906]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAF,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x04,0x1E,0xE0,0x22,0x92,0x54,0x40,0x08,0xFE,0x08,0x88,0x48,0x48,0x08,0x28,0x10, + /* 0xF5AB [?] [7907]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x00,0x90,0x92,0xF4,0x98,0x92,0xD2,0x8E, + /* 0xF5AC [?] [7908]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x20,0x10,0xFC,0x00,0x84,0x48,0x00,0xFE,0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xF5AD [?] [7909]*/ + 0x01,0xF9,0x21,0x27,0xF9,0xA9,0xA9,0xAB,0xDA,0x8A,0x8A,0xFA,0x8B,0x88,0xF8,0x88, + 0x00,0x3C,0x24,0xE4,0x24,0x3C,0x24,0xA4,0xA4,0xBC,0xA4,0xA4,0xA4,0x44,0x54,0x88, + /* 0xF5AE [?] [7910]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAB,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x00,0xFE,0x10,0x10,0x5E,0x50,0x50,0xB0,0x9E,0x00, + /* 0xF5AF [?] [7911]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0xFC,0x14,0x50,0x5C,0x50,0x7E,0x80,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x4C, + /* 0xF5B0 [?] [7912]*/ + 0x00,0xF8,0x23,0x20,0xF8,0xA9,0xAA,0xAC,0xD8,0x88,0x89,0xF9,0x89,0x89,0xFB,0x88, + 0x20,0x20,0xFC,0x40,0x80,0xF8,0x88,0x88,0xF8,0x00,0xFC,0x54,0x54,0x54,0xFE,0x00, + /* 0xF5B1 [?] [7913]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x20,0x10,0xFE,0x90,0xBC,0x94,0xFE,0x94,0xBC,0x90,0xBC,0xA4,0xA4,0xA4,0xBC,0x24, + /* 0xF5B2 [?] [7914]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC3,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x00,0xEE,0x22,0xAA,0x66,0xAA,0x10,0x28,0x44,0x92,0x20,0xC8,0x32,0xC4,0x18,0xE0, + /* 0xF5B3 [?] [7915]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x28,0xAA,0x6C,0x28,0xFE,0x44,0x28,0xFE,0x10,0x7C,0x10,0xFE,0x10,0x28,0x44,0x82, + /* 0xF5B4 [?] [7916]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAB,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x83, + 0x28,0x24,0x40,0x7E,0xC8,0x48,0x7E,0x48,0x48,0x7E,0x48,0x48,0x7E,0x40,0xAA,0x2A, + /* 0xF5B5 [?] [7917]*/ + 0x00,0xF8,0x23,0x20,0xF8,0xA9,0xA8,0xA8,0xD9,0x8A,0x89,0xF9,0x89,0x89,0xFB,0x88, + 0x40,0x20,0xFE,0x40,0x84,0xFE,0xA8,0xAA,0x26,0x00,0xFC,0x54,0x54,0x54,0xFE,0x00, + /* 0xF5B6 [?] [7918]*/ + 0x00,0xF8,0x20,0x23,0xFA,0xAA,0xAB,0xAA,0xDA,0x8B,0x8A,0xFB,0x8A,0x8D,0xFC,0x89, + 0x40,0x7C,0x40,0xFE,0x42,0x78,0xC4,0x3C,0x00,0xFE,0x40,0xA4,0x58,0xB4,0x52,0xB0, + /* 0xF5B7 [?] [7919]*/ + 0x00,0xFE,0x28,0x28,0xFE,0xAA,0xAA,0xAA,0xAE,0xC2,0x82,0xFE,0x82,0x82,0xFE,0x82, + 0x28,0xFE,0xAA,0xFE,0xAA,0xFE,0x00,0xFE,0x00,0xFE,0x82,0xFE,0x44,0x28,0xFE,0x00, + /* 0xF5B8 [?] [7920]*/ + 0x00,0xF9,0x20,0x23,0xF8,0xA9,0xA9,0xA9,0xD9,0x88,0x89,0xF8,0x8B,0x88,0xF9,0x8A, + 0x1C,0xE0,0x20,0xFE,0x20,0xFC,0xAC,0x74,0xFC,0x20,0xFC,0x20,0xFE,0x00,0x54,0x2A, + /* 0xF5B9 [?] [7921]*/ + 0x00,0x7F,0x02,0x06,0x09,0x11,0x62,0x04,0x08,0x11,0x62,0x04,0x08,0x30,0xC2,0x01, + 0x00,0xFC,0x00,0x00,0x08,0x90,0xA0,0xC0,0xC0,0xA0,0x90,0x88,0x86,0x80,0x80,0x00, + /* 0xF5BA [?] [7922]*/ + 0x20,0x20,0x3C,0x21,0x20,0xFC,0x84,0x95,0xD4,0xA4,0xD4,0x95,0x86,0xFC,0x85,0x00, + 0x84,0x44,0x48,0xFE,0x20,0xFC,0x20,0xFE,0x40,0x80,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xF5BB [?] [7923]*/ + 0x00,0xFF,0x04,0x07,0x08,0x10,0x60,0x00,0x1F,0x10,0x1F,0x01,0x11,0x11,0x29,0x47, + 0x00,0xFE,0x00,0xF0,0x10,0xA0,0x40,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x00,0x00,0xFE, + /* 0xF5BC [?] [7924]*/ + 0x00,0x7D,0x11,0x11,0x11,0x1D,0xE2,0x44,0x1F,0x10,0x1F,0x01,0x11,0x11,0x29,0x47, + 0x00,0xF0,0x10,0x90,0x52,0x12,0x0E,0x00,0xF0,0x10,0xF0,0x00,0xF8,0x00,0x00,0xFE, + /* 0xF5BD [?] [7925]*/ + 0x08,0x08,0x7E,0x08,0x0E,0x78,0x08,0x29,0x12,0x1F,0x10,0x1F,0x01,0x11,0x31,0xCF, + 0x0C,0xF0,0x80,0x80,0xFE,0x88,0x88,0x08,0x08,0xF0,0x10,0xF0,0x00,0xF8,0x00,0xFE, + /* 0xF5BE [?] [7926]*/ + 0x00,0x3F,0x22,0x23,0x22,0x3F,0x2B,0x52,0x46,0x9F,0x10,0x1F,0x01,0x11,0x31,0xCF, + 0x24,0xFE,0x20,0xA4,0x24,0xA8,0x10,0x9A,0x26,0xF2,0x10,0xF0,0x00,0xF8,0x00,0xFE, + /* 0xF5BF [?] [7927]*/ + 0x49,0x2A,0x7F,0x49,0x5D,0x6B,0x49,0x41,0x1F,0x10,0x1F,0x01,0x11,0x11,0x29,0x47, + 0x20,0x3E,0x48,0x48,0xA8,0x10,0x28,0x46,0xF0,0x10,0xF0,0x00,0xF8,0x00,0x00,0xFE, + /* 0xF5C0 [?] [7928]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7D,0x10,0x11,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x00,0x00, + 0x40,0x40,0x40,0xFC,0x84,0x04,0x04,0x04,0x84,0x44,0x44,0x04,0x04,0x04,0x28,0x10, + /* 0xF5C1 [?] [7929]*/ + 0x00,0x7B,0x48,0x48,0x48,0x78,0x10,0x10,0x51,0x5D,0x51,0x51,0x5A,0xE2,0x04,0x01, + 0x00,0xFC,0x84,0x88,0x88,0x90,0x9C,0x84,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xF5C2 [?] [7930]*/ + 0x00,0x7D,0x44,0x44,0x44,0x7C,0x10,0x13,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x01,0x02, + 0x00,0xFE,0x48,0x48,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x48,0x88,0x88,0x08,0x08, + /* 0xF5C3 [?] [7931]*/ + 0x00,0x7C,0x44,0x44,0x45,0x7C,0x10,0x10,0x5D,0x50,0x50,0x50,0x5C,0xE0,0x01,0x02, + 0x20,0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF5C4 [?] [7932]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7D,0x12,0x10,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x00,0x00, + 0x20,0x20,0x50,0x50,0x88,0x04,0x02,0xF8,0x88,0x88,0xA8,0x90,0x82,0x82,0x7E,0x00, + /* 0xF5C5 [?] [7933]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7C,0x10,0x10,0x10,0x5D,0x52,0x50,0x50,0x5C,0xE0,0x00, + 0x00,0x00,0xFE,0x20,0x20,0x40,0x40,0xFC,0x84,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF5C6 [?] [7934]*/ + 0x00,0x78,0x48,0x49,0x49,0x7B,0x15,0x11,0x51,0x5D,0x51,0x51,0x59,0xE1,0x01,0x01, + 0x88,0x88,0x88,0x08,0x7E,0x08,0x08,0x48,0x28,0x28,0x08,0x08,0x08,0x08,0x28,0x10, + /* 0xF5C7 [?] [7935]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x13,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x00,0xDC,0x54,0x54,0x54,0x54,0x54,0xFE,0x54,0x54,0x54,0x54,0x54,0xD4,0x24,0x4C, + /* 0xF5C8 [?] [7936]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x5C,0x50,0x50,0x50,0x5D,0xE2,0x00,0x00, + 0x08,0x1C,0xE0,0x00,0x20,0x20,0x20,0xFE,0x20,0x20,0xA8,0xA4,0x22,0x22,0xA0,0x40, + /* 0xF5C9 [?] [7937]*/ + 0x00,0x7C,0x44,0x45,0x45,0x7E,0x10,0x10,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x00,0x00, + 0x20,0x10,0x10,0xFE,0x02,0x04,0x80,0x88,0x90,0xA0,0xC0,0x82,0x82,0x82,0x7E,0x00, + /* 0xF5CA [?] [7938]*/ + 0x01,0x79,0x49,0x49,0x4B,0x79,0x11,0x11,0x51,0x5D,0x51,0x51,0x59,0xE2,0x03,0x04, + 0x00,0x00,0x00,0x1C,0xD4,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x5C,0x54,0x80, + /* 0xF5CB [?] [7939]*/ + 0x00,0x7C,0x44,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x10,0x10,0x10,0xFE,0x12,0x14,0x10,0xFC,0x44,0x44,0x28,0x28,0x10,0x28,0x44,0x82, + /* 0xF5CC [?] [7940]*/ + 0x00,0x7C,0x44,0x44,0x44,0x7D,0x13,0x10,0x10,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01, + 0x20,0x20,0x40,0x40,0x88,0x04,0xFE,0x02,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF5CD [?] [7941]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7C,0x13,0x10,0x5C,0x50,0x51,0x50,0x5C,0xE0,0x03,0x00, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xF5CE [?] [7942]*/ + 0x00,0x7C,0x44,0x47,0x44,0x7C,0x10,0x13,0x5C,0x53,0x50,0x50,0x5D,0xE1,0x02,0x04, + 0x80,0x80,0xBC,0xC0,0x50,0x24,0xD4,0x0C,0x00,0xFE,0x90,0x90,0x12,0x12,0x0E,0x00, + /* 0xF5CF [?] [7943]*/ + 0x01,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x11,0x5C,0x53,0x50,0x50,0x5C,0xE0,0x00, + 0x10,0x12,0x14,0xD8,0x10,0x12,0x52,0x8E,0x20,0x20,0xFE,0x20,0x20,0x20,0x20,0x20, + /* 0xF5D0 [?] [7944]*/ + 0x00,0x79,0x49,0x49,0x49,0x7A,0x10,0x13,0x50,0x5C,0x50,0x50,0x59,0xE1,0x02,0x04, + 0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x90,0x90,0x90,0x90,0x12,0x12,0x12,0x0E, + /* 0xF5D1 [?] [7945]*/ + 0x00,0x7A,0x49,0x49,0x48,0x78,0x10,0x17,0x51,0x5D,0x51,0x51,0x59,0xE2,0x04,0x00, + 0x00,0x0C,0x70,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x10,0x10,0x80,0x7E,0x00, + /* 0xF5D2 [?] [7946]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7C,0x10,0x10,0x11,0x5C,0x50,0x50,0x50,0x5D,0xE1,0x02, + 0x40,0x20,0xFE,0x88,0x50,0x20,0x50,0x88,0x06,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xF5D3 [?] [7947]*/ + 0x00,0x7C,0x44,0x45,0x44,0x7C,0x11,0x12,0x10,0x5C,0x50,0x50,0x50,0x5C,0xE0,0x03, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xF5D4 [?] [7948]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01, + 0x40,0x20,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x20,0x22,0x14,0x08,0x44,0x82,0x00, + /* 0xF5D5 [?] [7949]*/ + 0x00,0x7D,0x44,0x44,0x45,0x7D,0x11,0x11,0x5C,0x50,0x50,0x50,0x5E,0xE2,0x04,0x00, + 0x00,0xF8,0x08,0x08,0xF8,0x00,0x04,0x04,0xFC,0x40,0x20,0xA4,0x8A,0x8A,0x78,0x00, + /* 0xF5D6 [?] [7950]*/ + 0x00,0x7C,0x44,0x44,0x45,0x7D,0x11,0x11,0x5D,0x51,0x50,0x53,0x5C,0xE0,0x00,0x00, + 0x20,0x20,0x3E,0x20,0xFC,0x04,0xFC,0x04,0xFC,0x24,0x20,0xFE,0x20,0x20,0x20,0x20, + /* 0xF5D7 [?] [7951]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x10,0x5D,0x50,0x50,0x51,0x5E,0xE0,0x00, + 0x00,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xF5D8 [?] [7952]*/ + 0x01,0x79,0x49,0x4B,0x4A,0x7C,0x10,0x10,0x53,0x5C,0x50,0x51,0x59,0xE2,0x04,0x08, + 0x00,0x00,0x00,0xDE,0x92,0x92,0x92,0x92,0xF2,0x92,0x92,0x52,0x5E,0x20,0x20,0x00, + /* 0xF5D9 [?] [7953]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x1C,0xE0,0x10,0x10,0xFE,0x10,0x10,0x7C,0x44,0x54,0x54,0x54,0x54,0x28,0x44,0x82, + /* 0xF5DA [?] [7954]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x20,0x10,0xFE,0x00,0x20,0x20,0x3C,0x20,0x20,0x7C,0x44,0x44,0x44,0x44,0x7C,0x44, + /* 0xF5DB [?] [7955]*/ + 0x00,0x7C,0x45,0x44,0x45,0x7C,0x10,0x13,0x10,0x5C,0x51,0x51,0x51,0x5D,0xE1,0x01, + 0x40,0x20,0xFC,0x00,0x08,0x90,0x00,0xFE,0x00,0x00,0xFC,0x04,0x04,0x04,0xFC,0x04, + /* 0xF5DC [?] [7956]*/ + 0x04,0xF2,0x92,0x90,0x97,0xF1,0x21,0x21,0xA7,0xB9,0xA1,0xA1,0xBA,0xE2,0x04,0x08, + 0x40,0x5E,0x92,0x12,0xD4,0x14,0x18,0x14,0xF2,0x12,0x12,0x1A,0x94,0x50,0x50,0x10, + /* 0xF5DD [?] [7957]*/ + 0x00,0x78,0x4F,0x49,0x49,0x7A,0x12,0x17,0x51,0x5D,0x55,0x52,0x5A,0xE5,0x08,0x00, + 0x10,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x10,0xFE,0x10,0x10,0x00,0xFE,0x00, + /* 0xF5DE [?] [7958]*/ + 0x00,0x7D,0x45,0x47,0x45,0x7D,0x11,0x11,0x5D,0x50,0x53,0x50,0x5C,0xE1,0x06,0x00, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xF5DF [?] [7959]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7C,0x13,0x10,0x5C,0x51,0x51,0x51,0x5D,0xE1,0x01,0x01, + 0x20,0x24,0x24,0x24,0xFC,0x00,0xFE,0x20,0x40,0xFC,0x54,0x54,0x54,0x54,0x54,0x0C, + /* 0xF5E0 [?] [7960]*/ + 0x00,0x7C,0x45,0x44,0x47,0x7C,0x11,0x11,0x5D,0x51,0x51,0x50,0x5D,0xE0,0x03,0x00, + 0x08,0x3C,0xE0,0x20,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xF5E1 [?] [7961]*/ + 0x00,0x7C,0x47,0x44,0x45,0x7D,0x11,0x11,0x5C,0x53,0x52,0x52,0x5E,0xE2,0x02,0x02, + 0x04,0x1E,0xE0,0x20,0xFC,0x24,0x24,0xFC,0x20,0xFE,0x22,0x2A,0xFA,0x02,0x0A,0x04, + /* 0xF5E2 [?] [7962]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE2,0x02,0x04, + 0x40,0x20,0xFE,0x48,0x48,0xFE,0x48,0x78,0x00,0xFC,0x44,0x48,0x28,0x10,0x28,0xC6, + /* 0xF5E3 [?] [7963]*/ + 0x00,0x7C,0x44,0x45,0x44,0x7C,0x10,0x11,0x5C,0x50,0x50,0x51,0x5E,0xE4,0x01,0x00, + 0x84,0x44,0x48,0xFE,0x20,0xFC,0x20,0xFE,0x40,0x80,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xF5E4 [?] [7964]*/ + 0x00,0x7C,0x45,0x45,0x45,0x7D,0x11,0x11,0x5D,0x51,0x51,0x52,0x5E,0xE2,0x04,0x00, + 0x40,0x20,0xFE,0x02,0x02,0xFE,0x00,0x00,0xFE,0xAA,0xAA,0xFE,0xAA,0xAA,0xA2,0x86, + /* 0xF5E5 [?] [7965]*/ + 0x00,0x7D,0x44,0x44,0x47,0x7C,0x10,0x11,0x5E,0x50,0x53,0x50,0x5C,0xE1,0x06,0x00, + 0x00,0xFC,0x48,0x30,0xFE,0x52,0x94,0x10,0x30,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xF5E6 [?] [7966]*/ + 0x00,0x7D,0x44,0x44,0x44,0x7C,0x10,0x13,0x5C,0x53,0x50,0x51,0x5C,0xE1,0x02,0x04, + 0x00,0xFE,0x84,0xFC,0x84,0xFC,0x86,0xFC,0x04,0xDE,0x52,0x52,0x94,0x48,0x54,0x22, + /* 0xF5E7 [?] [7967]*/ + 0x00,0x7C,0x45,0x44,0x44,0x7D,0x10,0x10,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01,0x01, + 0x48,0x48,0xFE,0x48,0x00,0xFE,0x48,0x48,0xFE,0x4A,0x4A,0xB6,0x22,0x02,0x0A,0x04, + /* 0xF5E8 [?] [7968]*/ + 0x00,0x7B,0x49,0x48,0x48,0x78,0x11,0x10,0x50,0x5D,0x50,0x50,0x5B,0xE0,0x00,0x03, + 0x1E,0xE0,0x22,0x94,0x40,0x88,0xF0,0x20,0xC4,0xFE,0x22,0x20,0xFE,0x50,0x88,0x06, + /* 0xF5E9 [?] [7969]*/ + 0x00,0x7B,0x4A,0x4A,0x4B,0x7A,0x12,0x12,0x52,0x5E,0x52,0x52,0x5A,0xE2,0x05,0x00, + 0x00,0xFE,0x00,0x04,0xF4,0x04,0xEE,0xA4,0xA4,0xEC,0x04,0xA4,0x44,0x74,0x94,0x08, + /* 0xF5EA [?] [7970]*/ + 0x00,0xF7,0x94,0x96,0x95,0xF7,0x24,0x24,0xA6,0xBE,0xA7,0xA4,0xBC,0xE5,0x09,0x12, + 0x00,0xFE,0x00,0x28,0x48,0xEE,0x92,0x84,0xA0,0xA8,0xE8,0x88,0x94,0x14,0x24,0x42, + /* 0xF5EB [?] [7971]*/ + 0x00,0x7A,0x49,0x48,0x4B,0x78,0x10,0x13,0x50,0x5D,0x50,0x53,0x58,0xE0,0x01,0x06, + 0x50,0x52,0x54,0x50,0xFE,0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xF5EC [?] [7972]*/ + 0x00,0x7D,0x45,0x44,0x45,0x7C,0x11,0x12,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01,0x01, + 0x3C,0xE0,0x24,0xA8,0xFE,0xA8,0x24,0x02,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x04, + /* 0xF5ED [?] [7973]*/ + 0x02,0xF1,0x9F,0x90,0x90,0xF7,0x24,0x24,0xA7,0xB9,0xA5,0xA5,0xA9,0xB1,0xC5,0x02, + 0x14,0x12,0xD2,0x10,0x7E,0x90,0x90,0x90,0x90,0x28,0xA8,0x68,0x28,0x4A,0x4A,0x86, + /* 0xF5EE [?] [7974]*/ + 0x00,0x7D,0x45,0x45,0x45,0x7C,0x11,0x12,0x11,0x5D,0x51,0x51,0x50,0x5D,0xE0,0x00, + 0x00,0xFC,0x54,0x54,0xFC,0x80,0xFC,0x44,0xF4,0x54,0x54,0xF4,0x44,0xF4,0x14,0x08, + /* 0xF5EF [?] [7975]*/ + 0x00,0x7D,0x44,0x45,0x44,0x7C,0x11,0x11,0x11,0x5D,0x51,0x51,0x51,0x5D,0xE1,0x01, + 0x48,0xFE,0x48,0x00,0xBE,0x82,0x52,0x7E,0xD2,0x7E,0x52,0x7E,0x52,0x7E,0x42,0x06, + /* 0xF5F0 [?] [7976]*/ + 0x00,0xF7,0x94,0x95,0x95,0xF5,0x25,0x25,0xA4,0xBD,0xA4,0xA7,0xBD,0xEA,0x08,0x13, + 0x20,0xFE,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x24,0xFA,0x20,0xFE, + /* 0xF5F1 [?] [7977]*/ + 0x01,0x7A,0x49,0x48,0x4B,0x7A,0x12,0x12,0x13,0x5E,0x53,0x52,0x53,0x5E,0xE2,0x03, + 0x24,0x48,0x24,0x00,0xFC,0x94,0x64,0x94,0xFC,0x48,0x68,0x48,0x6A,0x4A,0x46,0x62, + /* 0xF5F2 [?] [7978]*/ + 0x01,0xF5,0x97,0x99,0x97,0xF3,0x25,0x29,0xA0,0xBB,0xA2,0xA2,0xBA,0xE0,0x01,0x06, + 0x08,0x28,0xBE,0x48,0xBE,0x18,0xAA,0x46,0x00,0xF8,0x08,0x48,0x48,0xB0,0x08,0x04, + /* 0xF5F3 [?] [7979]*/ + 0x02,0xF2,0x93,0x96,0x9A,0xF2,0x22,0x22,0xA5,0xB8,0xA0,0xA3,0xB9,0xE0,0x03,0x0C, + 0x48,0xE8,0x08,0xEA,0x1C,0xE8,0x08,0xE8,0xB4,0xE2,0x00,0xF8,0x10,0xE0,0x18,0x06, + /* 0xF5F4 [?] [7980]*/ + 0x00,0x07,0x7A,0x11,0x08,0x07,0x78,0x00,0x03,0x0C,0x70,0x01,0x06,0x18,0xE0,0x00, + 0xE0,0x00,0x0C,0x30,0xC0,0x80,0x40,0xA0,0x30,0x50,0x90,0x10,0x10,0x10,0xA0,0x40, + /* 0xF5F5 [?] [7981]*/ + 0x0C,0x31,0xC2,0x14,0x48,0x30,0xC8,0x14,0x25,0xCC,0x14,0x24,0xC4,0x04,0x28,0x10, + 0x00,0xFC,0x44,0x44,0x44,0x44,0x94,0x88,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF5F6 [?] [7982]*/ + 0x0C,0x30,0xC2,0x14,0x48,0x30,0xC8,0x14,0x24,0xCC,0x14,0x24,0xC4,0x04,0x28,0x10, + 0x00,0xFE,0x20,0x20,0x40,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF5F7 [?] [7983]*/ + 0x10,0x20,0xD4,0x09,0x51,0x23,0xD5,0x19,0x29,0xC9,0x19,0x29,0xC9,0x09,0x51,0x21, + 0x90,0x90,0x90,0x10,0xFE,0x10,0x10,0x38,0x38,0x54,0x54,0x92,0x10,0x10,0x10,0x10, + /* 0xF5F8 [?] [7984]*/ + 0x0C,0x30,0xC3,0x14,0x48,0x31,0xC9,0x15,0x25,0xCD,0x14,0x25,0xC4,0x04,0x29,0x12, + 0x88,0x88,0xFE,0x88,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x20,0xFE,0x50,0x88,0x04,0x02, + /* 0xF5F9 [?] [7985]*/ + 0x0C,0x30,0xC3,0x15,0x49,0x31,0xC9,0x15,0x25,0xCC,0x15,0x25,0xC5,0x05,0x29,0x11, + 0x20,0x40,0xFC,0x04,0x54,0x24,0x54,0x04,0xFC,0x00,0x12,0xD4,0x18,0x52,0x92,0x0E, + /* 0xF5FA [?] [7986]*/ + 0x10,0x10,0x3C,0x24,0x48,0xBE,0x2A,0x2A,0x3E,0x2A,0x2A,0x3E,0x2A,0x4A,0x42,0x86, + 0x08,0x88,0x48,0x48,0x08,0x88,0x48,0x48,0x08,0x0E,0xF8,0x08,0x08,0x08,0x08,0x08, + /* 0xF5FB [?] [7987]*/ + 0x20,0x20,0x78,0x49,0x90,0x7C,0x54,0x54,0x7D,0x54,0x54,0x7C,0x54,0x54,0x45,0x8E, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x88,0x04,0x02, + /* 0xF5FC [?] [7988]*/ + 0x10,0x10,0x3C,0x24,0x49,0xBE,0x2A,0x2A,0x3E,0x2A,0x2A,0x3E,0x2B,0x4A,0x42,0x86, + 0x40,0x40,0x7E,0x80,0x7C,0x08,0x10,0x20,0xFE,0x4A,0x4A,0x92,0x12,0x22,0x54,0x88, + /* 0xF5FD [?] [7989]*/ + 0x20,0x20,0x79,0x49,0x91,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x55,0x56,0x46,0x8C, + 0x08,0x1C,0xF0,0x50,0x50,0x50,0x50,0x50,0x50,0x48,0x48,0x68,0x54,0x74,0x52,0x00, + /* 0xF5FE [?] [7990]*/ + 0x08,0x28,0x2E,0x28,0x2E,0xF0,0x08,0x0F,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x11,0x21, + 0x80,0x88,0xF0,0x84,0x84,0x7C,0x00,0xC0,0x80,0xF8,0x08,0xF8,0x08,0xF8,0x08,0x18, + /* 0xF6A1 [?] [7991]*/ + 0x20,0x20,0x79,0x48,0x90,0x7C,0x55,0x54,0x7C,0x54,0x54,0x7C,0x55,0x55,0x46,0x8C, + 0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x90,0x90,0x90,0x90,0x92,0x12,0x12,0x0E,0x00, + /* 0xF6A2 [?] [7992]*/ + 0x20,0x20,0x79,0x48,0x90,0x7D,0x55,0x55,0x7D,0x54,0x54,0x7C,0x55,0x56,0x44,0x8C, + 0x20,0x20,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x20,0x70,0xA8,0x24,0x22,0x20,0x20, + /* 0xF6A3 [?] [7993]*/ + 0x21,0x20,0x78,0x49,0x91,0x7D,0x55,0x55,0x7D,0x55,0x54,0x7C,0x57,0x54,0x44,0x8C, + 0x04,0x88,0x50,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0x20,0xFE,0x20,0x20,0x20, + /* 0xF6A4 [?] [7994]*/ + 0x08,0x28,0x2E,0x28,0x2E,0xF0,0x01,0x7F,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x3F, + 0x80,0x88,0xF0,0x84,0x84,0x7C,0x00,0xFC,0x00,0xF8,0x00,0xF8,0x00,0xF8,0x08,0xF8, + /* 0xF6A5 [?] [7995]*/ + 0x08,0xFF,0x08,0x3E,0x2A,0x3E,0x41,0xFF,0x00,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x3F, + 0x78,0x48,0x86,0x78,0x48,0x30,0x48,0xFC,0x00,0xF8,0x00,0xF8,0x00,0xF8,0x08,0xF8, + /* 0xF6A6 [?] [7996]*/ + 0x10,0x10,0xFE,0x10,0x7C,0x10,0xFE,0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x54,0x49, + 0x00,0xFC,0x84,0x84,0xA4,0xA4,0xA4,0xA4,0xA4,0xA4,0x50,0x50,0x50,0x92,0x92,0x0E, + /* 0xF6A7 [?] [7997]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x00,0xFF,0x04,0x0F,0x00,0x00,0x00, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x00,0xFE,0x00,0xF0,0x10,0xA0,0x40, + /* 0xF6A8 [?] [7998]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x3F,0x20,0x21,0x2F,0x21,0x42,0x44,0x98, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xFC,0x00,0x00,0xF8,0x08,0x08,0x50,0x20, + /* 0xF6A9 [?] [7999]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x02,0x01,0x7F,0x08,0x04,0x03,0x04,0x18,0xE0, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0x00,0xFC,0x20,0x40,0x80,0x40,0x30,0x0E, + /* 0xF6AA [?] [8000]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x7C,0x09,0x10,0x3D,0x44,0x2B,0x10,0x6F, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x08,0x3C,0xE0,0x20,0xFC,0x20,0xFE,0x00,0xFE, + /* 0xF6AB [?] [8001]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x00,0x7F,0x08,0x07,0x18,0xE4,0x04,0x08,0x10, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x80,0xFC,0x20,0xC0,0x30,0x4E,0x40,0x40,0x40, + /* 0xF6AC [?] [8002]*/ + 0x00,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x20,0x17,0x40,0x2B,0x0A,0x72,0x12,0x10, + 0x00,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x40,0xFC,0x40,0xF8,0x48,0x48,0x58,0x40, + /* 0xF6AD [?] [8003]*/ + 0x00,0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x04,0x7C,0x04,0x3C,0x04,0x7C,0x04,0x04, + 0x00,0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x40,0x7C,0x40,0x78,0x40,0x7C,0x40,0x40, + /* 0xF6AE [?] [8004]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x02,0x3F,0x08,0x7F,0x02,0xFF,0x08,0x07,0x78, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x00,0xF8,0x20,0xFC,0x00,0xFE,0x20,0xC0,0x38, + /* 0xF6AF [?] [8005]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x01,0x1D,0x20,0x17,0x82,0x41,0x17,0x20,0xEF,0x20,0x27, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x70,0x3C,0xC0,0x44,0x28,0xFC,0x40,0xFE,0x40,0xFC, + /* 0xF6B0 [?] [8006]*/ + 0x3F,0x01,0x7F,0x49,0x84,0x23,0x12,0x03,0x72,0x13,0x11,0x13,0x14,0x1A,0x13,0x00, + 0xF8,0x00,0xFE,0x22,0x14,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x44,0xA4,0xF4,0x0C, + /* 0xF6B1 [?] [8007]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x00,0x12,0x3F,0x12,0x7F,0x00,0x3F,0x21,0x3F,0x21,0x23, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0x20,0x20,0x3E,0x44,0xA4,0x24,0x28,0x10,0x28,0x46, + /* 0xF6B2 [?] [8008]*/ + 0x3F,0x01,0x7F,0x41,0x9D,0x30,0xCB,0x2D,0x31,0xC9,0x15,0x64,0x0D,0x34,0xC5,0x18, + 0xF8,0x00,0xFE,0x02,0x74,0x00,0xFC,0x24,0xFC,0x24,0xFC,0x20,0xFC,0x20,0xFE,0x00, + /* 0xF6B3 [?] [8009]*/ + 0x08,0x08,0x28,0x2F,0x28,0x28,0xFF,0x00,0x49,0x49,0x55,0x63,0x41,0x47,0x79,0x01, + 0x20,0x20,0x20,0x22,0x22,0x24,0x28,0x30,0x20,0x60,0xA0,0x22,0x22,0x22,0x1E,0x00, + /* 0xF6B4 [?] [8010]*/ + 0x08,0x08,0x28,0x2F,0x28,0x28,0xFF,0x00,0x49,0x49,0x55,0x63,0x41,0x47,0x79,0x01, + 0x00,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44,0xFE,0x00, + /* 0xF6B5 [?] [8011]*/ + 0x10,0x10,0x50,0x5E,0x50,0x51,0xFE,0x00,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x02, + 0x40,0x40,0x7C,0x84,0x84,0xF4,0x94,0x94,0x94,0xF4,0x84,0xA8,0x92,0x82,0x7E,0x00, + /* 0xF6B6 [?] [8012]*/ + 0x08,0x08,0x28,0x2F,0x28,0x28,0xFF,0x00,0x49,0x49,0x55,0x63,0x41,0x47,0x79,0x01, + 0x00,0xFE,0x22,0x22,0x22,0x22,0x4A,0x44,0x80,0x7E,0x42,0x42,0x42,0x42,0x7E,0x42, + /* 0xF6B7 [?] [8013]*/ + 0x10,0x10,0x50,0x5E,0x50,0x50,0xFE,0x00,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x03, + 0x08,0x28,0x28,0x28,0xA8,0xAA,0xBC,0xA8,0xA8,0xA8,0xA8,0xA8,0xAA,0xBA,0xEA,0x86, + /* 0xF6B8 [?] [8014]*/ + 0x10,0x10,0x50,0x5E,0x50,0x50,0xFE,0x00,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x02, + 0x00,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0xA2,0xA4,0x98,0x90,0x88,0xA4,0xC2,0x80, + /* 0xF6B9 [?] [8015]*/ + 0x10,0x11,0x50,0x5E,0x50,0x50,0xFE,0x01,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF2,0x02, + 0x00,0xFC,0x20,0x20,0xFC,0x44,0x44,0xFE,0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84, + /* 0xF6BA [?] [8016]*/ + 0x08,0x08,0x28,0x2F,0x28,0x28,0xFF,0x00,0x49,0x49,0x55,0x63,0x41,0x47,0x79,0x01, + 0x00,0x7C,0x44,0x44,0x44,0x44,0x7C,0x10,0x10,0x50,0x5E,0x50,0x50,0x70,0x9E,0x00, + /* 0xF6BB [?] [8017]*/ + 0x10,0x10,0x50,0x5E,0x50,0x50,0xFE,0x00,0x92,0x92,0xAA,0xC6,0x82,0x8E,0xF3,0x02, + 0x00,0xFE,0x82,0x82,0xFE,0x80,0xFE,0x90,0xA4,0xFE,0x92,0x90,0xFC,0x90,0x10,0xFE, + /* 0xF6BC [?] [8018]*/ + 0x1F,0x10,0x10,0x1F,0x01,0x3F,0x21,0x21,0x3F,0x21,0x21,0x3F,0x21,0x01,0x01,0x00, + 0xF0,0x10,0x10,0xF0,0x00,0xF8,0x08,0x08,0xF8,0x08,0x08,0xF8,0x0A,0x02,0x02,0xFE, + /* 0xF6BD [?] [8019]*/ + 0x1F,0x00,0xFF,0x08,0x30,0xDF,0x10,0x1F,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x01,0x00, + 0xF0,0x00,0xFE,0x44,0x3C,0xF0,0x10,0xF0,0x00,0xF8,0x08,0xF8,0x08,0xFA,0x02,0xFE, + /* 0xF6BE [?] [8020]*/ + 0x00,0x3E,0x22,0x3F,0x11,0x1F,0x11,0xFF,0x01,0x3F,0x21,0x3F,0x21,0x3F,0x01,0x00, + 0x00,0xF8,0x88,0xF8,0x10,0xF0,0x10,0xFE,0x00,0xF8,0x08,0xF8,0x08,0xFA,0x02,0xFE, + /* 0xF6BF [?] [8021]*/ + 0x09,0x08,0x08,0x1F,0x10,0x30,0x5F,0x90,0x10,0x1F,0x10,0x10,0x10,0x1F,0x10,0x10, + 0x00,0x80,0x80,0xFC,0x80,0x80,0xF8,0x80,0x80,0xF8,0x80,0x80,0x80,0xFC,0x00,0x00, + /* 0xF6C0 [?] [8022]*/ + 0x09,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x11,0x01,0xFF,0x01,0x01,0x01,0x01, + 0x00,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00,0x00,0xFE,0x00,0x00,0x00,0x00, + /* 0xF6C1 [?] [8023]*/ + 0x09,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x10,0x3F,0x04,0x04,0x08,0x30,0xC0, + 0x00,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00,0xE0,0x20,0x7C,0x04,0x14,0x08, + /* 0xF6C2 [?] [8024]*/ + 0x00,0x7C,0x44,0x44,0x45,0x7E,0x44,0x44,0x7C,0x44,0x44,0x44,0x4E,0xF0,0x00,0x00, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xF6C3 [?] [8025]*/ + 0x20,0x20,0x3C,0x44,0xC5,0x2A,0x10,0x28,0x44,0x82,0x7C,0x44,0x44,0x44,0x7C,0x44, + 0x50,0x48,0x80,0xFE,0x90,0x90,0xFC,0x90,0x90,0xFC,0x90,0x90,0x90,0xFE,0x80,0x80, + /* 0xF6C4 [?] [8026]*/ + 0x3E,0x22,0x3E,0x22,0x3E,0x22,0x3E,0x08,0x1F,0x30,0x5F,0x90,0x1F,0x10,0x1F,0x10, + 0xF8,0x88,0xF8,0x88,0xF8,0x88,0xF8,0x80,0xFC,0x80,0xF8,0x80,0xF8,0x80,0xFC,0x00, + /* 0xF6C5 [?] [8027]*/ + 0x30,0x2A,0x41,0x7D,0xD0,0x53,0x7D,0x51,0x51,0x7D,0x51,0x51,0x51,0x7D,0x40,0x40, + 0x18,0x14,0x20,0x3E,0x68,0x28,0x3E,0x28,0x28,0x3E,0x28,0x68,0xA8,0x3E,0x20,0x20, + /* 0xF6C6 [?] [8028]*/ + 0x00,0x7D,0x11,0x11,0x11,0x1D,0xE2,0x45,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x00,0xF0,0x10,0x90,0x52,0x12,0x0E,0x00,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6C7 [?] [8029]*/ + 0x02,0x01,0xFF,0x04,0x14,0x24,0x44,0x01,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x00,0x00,0xFE,0x40,0x50,0x48,0x44,0x00,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6C8 [?] [8030]*/ + 0x10,0x09,0x40,0x24,0x0B,0x70,0x10,0x11,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x1C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6C9 [?] [8031]*/ + 0x10,0xFF,0x28,0x7F,0x08,0x0F,0xF8,0x09,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x04,0x78,0x40,0x7E,0x48,0x48,0x88,0x08,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6CA [?] [8032]*/ + 0x00,0x7E,0x24,0x18,0xFF,0x29,0x4A,0x99,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x20,0x20,0x7E,0x84,0x28,0x10,0x28,0x44,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6CB [?] [8033]*/ + 0x08,0x7F,0x08,0x7E,0x08,0xFF,0x20,0x3E,0x43,0x86,0x18,0xEF,0x01,0x3F,0x09,0xFF, + 0x20,0x20,0x3E,0x44,0x84,0x28,0x10,0x28,0x44,0xC2,0x30,0xEE,0x00,0xF8,0x20,0xFE, + /* 0xF6CC [?] [8034]*/ + 0x20,0x17,0x80,0x49,0x13,0xE1,0x22,0x24,0x01,0x06,0x18,0xEF,0x01,0x3F,0x09,0xFF, + 0x40,0xFE,0x90,0x08,0xFC,0x50,0x52,0x4E,0x00,0xC0,0x30,0xEE,0x00,0xF8,0x20,0xFE, + /* 0xF6CD [?] [8035]*/ + 0x3E,0x22,0x3E,0x20,0x7E,0xA2,0x3E,0x23,0x06,0x18,0xEF,0x01,0x3F,0x11,0x09,0xFF, + 0x10,0xFE,0x44,0x28,0xFE,0x10,0xFC,0x10,0xC0,0x30,0xEE,0x00,0xF8,0x10,0x20,0xFE, + /* 0xF6CE [?] [8036]*/ + 0x01,0x06,0x18,0xEF,0x01,0x1F,0x09,0x3F,0x10,0x28,0x7C,0x92,0x7C,0x10,0x54,0xFE, + 0x00,0xC0,0x30,0xEE,0x00,0xF0,0x20,0xF8,0x10,0x28,0x7C,0x92,0x7C,0x10,0x54,0xFE, + /* 0xF6CF [?] [8037]*/ + 0x20,0x20,0x7C,0x44,0x88,0x7D,0x54,0x54,0x7C,0x54,0x54,0x7C,0x00,0x1D,0xE1,0x42, + 0x40,0x50,0x48,0x48,0x40,0xFE,0x50,0x50,0x50,0x50,0x90,0x90,0x92,0x12,0x0E,0x00, + /* 0xF6D0 [?] [8038]*/ + 0x10,0x10,0x1E,0x23,0x24,0x7E,0xAA,0x2A,0x3E,0x2A,0x2A,0x3E,0x00,0x0E,0x71,0x22, + 0x20,0x10,0x10,0xFE,0x40,0x40,0x40,0x7C,0x44,0x44,0x44,0x44,0x84,0x84,0x28,0x10, + /* 0xF6D1 [?] [8039]*/ + 0x20,0x20,0x7C,0x44,0x89,0x7C,0x54,0x54,0x7C,0x54,0x54,0x7D,0x01,0x1E,0xE0,0x40, + 0x50,0x48,0x48,0x40,0xFE,0x40,0x40,0x7C,0xA4,0xA4,0xA8,0x28,0x10,0x28,0x44,0x82, + /* 0xF6D2 [?] [8040]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7D,0x54,0x54,0x7C,0x57,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x00,0x00,0xFC,0x20,0x20,0x24,0xA4,0xA8,0x20,0xFE,0x20,0x20,0x20,0x20,0x20,0x20, + /* 0xF6D3 [?] [8041]*/ + 0x10,0x10,0x1E,0x22,0x24,0x7E,0xAA,0x2A,0x3E,0x2A,0x2A,0x3E,0x00,0x0E,0x70,0x20, + 0x10,0x10,0x10,0x10,0x1E,0x10,0x10,0x10,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF6D4 [?] [8042]*/ + 0x10,0x10,0x1E,0x22,0x24,0x7E,0xAA,0x2A,0x3E,0x2A,0x2A,0x3E,0x00,0x0F,0x71,0x22, + 0x10,0x10,0x1E,0x10,0x10,0xFE,0x82,0x82,0x82,0xFE,0x82,0x80,0x80,0x00,0x00,0x00, + /* 0xF6D5 [?] [8043]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x55,0x54,0x7C,0x54,0x54,0x7C,0x01,0x1C,0xE0,0x40, + 0x08,0x3C,0xE0,0x20,0x20,0x20,0xFE,0x20,0x70,0x68,0xA8,0xA4,0x22,0x20,0x20,0x20, + /* 0xF6D6 [?] [8044]*/ + 0x20,0x20,0x7C,0x44,0x88,0x7D,0x56,0x54,0x7C,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x44,0x44,0x44,0x84,0xBE,0x84,0x84,0xA4,0x94,0x94,0x84,0x84,0x84,0x84,0x94,0x88, + /* 0xF6D7 [?] [8045]*/ + 0x22,0x11,0x00,0x7F,0x44,0x84,0x0F,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF,0x00, + 0x08,0x10,0x20,0xFC,0x04,0x08,0xC0,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE,0x00, + /* 0xF6D8 [?] [8046]*/ + 0x10,0x10,0x1E,0x22,0x24,0x7E,0xAB,0x2A,0x3E,0x2A,0x2A,0x3E,0x00,0x0E,0x70,0x20, + 0x20,0x20,0x20,0x40,0x48,0x84,0xFE,0x82,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF6D9 [?] [8047]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x57,0x54,0x7C,0x54,0x55,0x7C,0x00,0x1C,0xE3,0x40, + 0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00,0x20,0x20,0xFC,0x20,0x20,0x20,0xFE,0x00, + /* 0xF6DA [?] [8048]*/ + 0x20,0x20,0x7C,0x47,0x88,0x7C,0x55,0x54,0x7C,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x04,0x04,0x04,0x04,0xFC,0x04, + /* 0xF6DB [?] [8049]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x54,0x55,0x7E,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x20,0x20,0xFE,0x40,0x40,0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x84,0x84,0x94,0x88, + /* 0xF6DC [?] [8050]*/ + 0x20,0x21,0x7C,0x44,0x88,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x00,0xFE,0x20,0x20,0x40,0xFC,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x54,0x04,0x0C, + /* 0xF6DD [?] [8051]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x54,0x54,0x7D,0x54,0x54,0x7C,0x00,0x1D,0xE1,0x42, + 0x40,0x20,0xFE,0x88,0x50,0x20,0x50,0x88,0x06,0x88,0x88,0x88,0x88,0x08,0x08,0x08, + /* 0xF6DE [?] [8052]*/ + 0x20,0x20,0x7C,0x45,0x88,0x7C,0x55,0x56,0x7C,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x43, + 0x40,0x20,0x20,0xFE,0x00,0x88,0x04,0x02,0x88,0x88,0x50,0x50,0x20,0x50,0x88,0x06, + /* 0xF6DF [?] [8053]*/ + 0x11,0x09,0x7F,0x02,0xFF,0x08,0x34,0xCF,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF, + 0x10,0x20,0xFC,0x00,0xFE,0x20,0x18,0xC6,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xF6E0 [?] [8054]*/ + 0x20,0x21,0x7C,0x44,0x88,0x7C,0x54,0x55,0x7C,0x54,0x55,0x7C,0x00,0x1C,0xE0,0x40, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x08,0x08,0xFE,0x88,0x48,0x48,0x08,0x18, + /* 0xF6E1 [?] [8055]*/ + 0x20,0x21,0x7C,0x44,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x00,0x1C,0xE0,0x43, + 0x00,0xFE,0x20,0x20,0xFC,0x24,0x24,0xFC,0x24,0x24,0xFC,0x20,0xA0,0x40,0xB0,0x0E, + /* 0xF6E2 [?] [8056]*/ + 0x40,0x43,0x78,0x88,0x13,0xFA,0xAA,0xAA,0xFB,0xAA,0xAA,0xFA,0x02,0x1A,0xE2,0x42, + 0x00,0xFE,0x00,0x00,0xDE,0x52,0x52,0x52,0x5A,0xD6,0x52,0x52,0x52,0x52,0x52,0xD6, + /* 0xF6E3 [?] [8057]*/ + 0x40,0x42,0x79,0x89,0x10,0xF8,0xAF,0xA9,0xF9,0xA9,0xA9,0xF9,0x01,0x1A,0xE4,0x40, + 0x10,0x10,0x10,0x7E,0x20,0x28,0x48,0x7E,0x08,0x08,0xFE,0x08,0x08,0x88,0x7E,0x00, + /* 0xF6E4 [?] [8058]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x54,0x7C,0x54,0x54,0x7C,0x00,0x1C,0xE1,0x40, + 0x40,0x7E,0x52,0x52,0x54,0x48,0x54,0x62,0x10,0x10,0xFE,0x10,0x10,0x10,0xFE,0x00, + /* 0xF6E5 [?] [8059]*/ + 0x40,0x40,0x7B,0x8A,0x12,0xFA,0xAA,0xAB,0xFA,0xAA,0xAA,0xFA,0x03,0x1A,0xE0,0x40, + 0x04,0x04,0xC4,0x44,0x7E,0x44,0x44,0xE4,0x54,0x54,0x44,0x44,0xC4,0x44,0x14,0x08, + /* 0xF6E6 [?] [8060]*/ + 0x20,0x20,0x7C,0x44,0x89,0x7C,0x54,0x57,0x7C,0x55,0x54,0x7D,0x01,0x1E,0xE0,0x40, + 0x40,0x40,0xF8,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x20,0x28,0x24,0x24,0xA0,0x40, + /* 0xF6E7 [?] [8061]*/ + 0x20,0x21,0x7C,0x44,0x88,0x7D,0x54,0x54,0x7D,0x54,0x54,0x7C,0x01,0x1E,0xE0,0x40, + 0x0C,0xF0,0x20,0x44,0x88,0xF0,0x20,0x44,0xFE,0x22,0x20,0xA8,0x24,0x22,0xA0,0x40, + /* 0xF6E8 [?] [8062]*/ + 0x20,0x12,0x44,0x20,0x08,0x73,0x28,0x0F,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF, + 0x40,0x48,0x44,0x14,0x60,0x80,0x00,0xC0,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xF6E9 [?] [8063]*/ + 0x20,0x20,0x7D,0x45,0x8A,0x7C,0x54,0x54,0x7D,0x54,0x54,0x7C,0x00,0x1C,0xE1,0x42, + 0x20,0x10,0xFE,0x02,0x04,0xF8,0x00,0x00,0xFE,0x50,0x50,0x50,0x92,0x92,0x0E,0x00, + /* 0xF6EA [?] [8064]*/ + 0x40,0x43,0x7A,0x8A,0x12,0xFB,0xAA,0xAA,0xFA,0xAB,0xAA,0xFA,0x02,0x1A,0xE3,0x40, + 0x00,0xDE,0x52,0x52,0x52,0xD2,0x52,0x52,0x52,0xD2,0x1A,0x94,0x50,0xB0,0x10,0x10, + /* 0xF6EB [?] [8065]*/ + 0x20,0x20,0x7D,0x44,0x88,0x7C,0x55,0x54,0x7C,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x20,0x20,0xFE,0x20,0xFC,0x20,0xFE,0x00,0xFC,0x84,0xFC,0x84,0xFC,0x84,0x94,0x88, + /* 0xF6EC [?] [8066]*/ + 0x20,0x20,0x7C,0x44,0x88,0x7D,0x54,0x54,0x7D,0x54,0x54,0x7D,0x00,0x1C,0xE0,0x41, + 0x20,0x20,0xFC,0x20,0x20,0xFE,0x48,0x84,0x22,0x78,0x88,0x48,0x50,0x20,0x50,0x8C, + /* 0xF6ED [?] [8067]*/ + 0x20,0x23,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x03,0x1C,0xE0,0x40, + 0x00,0xE0,0x5C,0x54,0x54,0xD4,0x54,0x54,0xD4,0x54,0x48,0x68,0xC8,0x54,0x54,0x62, + /* 0xF6EE [?] [8068]*/ + 0x20,0x20,0x7C,0x47,0x88,0x7C,0x54,0x55,0x7C,0x54,0x54,0x7C,0x03,0x1C,0xE0,0x40, + 0x50,0x50,0x50,0xDE,0x50,0x50,0x50,0xDC,0x50,0x50,0x50,0x50,0xDE,0x50,0x50,0x50, + /* 0xF6EF [?] [8069]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7C,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x00,0xFC,0x04,0x04,0xFC,0x04,0x04,0xFC,0x00,0x12,0xD4,0x18,0x10,0x52,0x92,0x0E, + /* 0xF6F0 [?] [8070]*/ + 0x20,0x20,0x7C,0x44,0x88,0x7C,0x54,0x54,0x7D,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0xFC,0x84,0x84,0xFC,0x84,0x84,0xFC,0x00,0xFE,0x02,0x02,0xFE,0x02,0x02,0xFE,0x02, + /* 0xF6F1 [?] [8071]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x00,0xFC,0x04,0x24,0x24,0xFC,0x24,0x24,0x74,0x54,0x54,0x74,0x04,0x04,0xFC,0x04, + /* 0xF6F2 [?] [8072]*/ + 0x20,0x20,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x54,0x54,0x7C,0x00,0x1C,0xE1,0x42, + 0x00,0x40,0x9C,0x04,0x04,0xDC,0x04,0x04,0xFC,0x50,0x50,0x50,0x90,0x92,0x12,0x0E, + /* 0xF6F3 [?] [8073]*/ + 0x40,0x40,0x78,0x88,0x11,0xFA,0xA9,0xA8,0xF8,0xA8,0xA8,0xFA,0x02,0x1A,0xE4,0x40, + 0x20,0x20,0x50,0x88,0x44,0x22,0xF8,0x08,0x50,0x20,0xA4,0x82,0x8A,0x8A,0x78,0x00, + /* 0xF6F4 [?] [8074]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x01,0x1E,0xE2,0x44, + 0x00,0xFC,0x24,0x24,0x74,0x24,0xFC,0x04,0x74,0x54,0x54,0x74,0x04,0x04,0x14,0x08, + /* 0xF6F5 [?] [8075]*/ + 0x20,0x21,0x7C,0x44,0x89,0x7C,0x54,0x55,0x7D,0x55,0x55,0x7C,0x00,0x1C,0xE1,0x40, + 0x00,0xFC,0x04,0x34,0xC4,0x44,0x44,0xF4,0x54,0x54,0xF4,0x44,0x54,0x76,0x96,0x02, + /* 0xF6F6 [?] [8076]*/ + 0x20,0x20,0x7D,0x46,0x89,0x7C,0x54,0x54,0x7D,0x55,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x92,0x92,0x24,0x48,0x24,0x92,0x92,0x00,0xFE,0x22,0x22,0xFE,0x22,0x22,0xFE,0x02, + /* 0xF6F7 [?] [8077]*/ + 0x20,0x21,0x7C,0x44,0x8B,0x7C,0x54,0x55,0x7D,0x55,0x55,0x7D,0x01,0x1C,0xE0,0x43, + 0x20,0xFC,0x20,0x88,0xFE,0x88,0x00,0xFC,0x04,0x24,0x24,0x24,0x24,0x50,0x88,0x04, + /* 0xF6F8 [?] [8078]*/ + 0x40,0x41,0x79,0x8B,0x11,0xF9,0xA9,0xA9,0xF9,0xA8,0xAB,0xF8,0x00,0x19,0xE6,0x40, + 0x48,0x48,0x48,0xFE,0x48,0x48,0x78,0x00,0xFE,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xF6F9 [?] [8079]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7C,0x55,0x54,0x7D,0x54,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x00,0xDC,0x54,0x54,0xDC,0x00,0xFC,0x00,0xFE,0x80,0xFC,0x04,0x04,0x04,0x28,0x10, + /* 0xF6FA [?] [8080]*/ + 0x40,0x40,0x7B,0x89,0x11,0xF9,0xAB,0xA9,0xF9,0xAB,0xAD,0xF9,0x01,0x19,0xE1,0x41, + 0x08,0xC8,0x08,0x08,0x2A,0x2A,0xAC,0x48,0x08,0x88,0x54,0x14,0x14,0x24,0x24,0x42, + /* 0xF6FB [?] [8081]*/ + 0x20,0x20,0x7C,0x44,0x89,0x7E,0x54,0x54,0x7C,0x54,0x54,0x7C,0x01,0x1C,0xE0,0x41, + 0x40,0x40,0xFE,0x80,0xFC,0x84,0xFC,0x84,0xFC,0x40,0x7C,0xC4,0x28,0x10,0x68,0x86, + /* 0xF6FC [?] [8082]*/ + 0x20,0x20,0x7D,0x45,0x89,0x7D,0x55,0x54,0x7F,0x54,0x54,0x7D,0x00,0x1C,0xE3,0x40, + 0x20,0x40,0xFC,0x04,0xFC,0x04,0xFC,0x00,0xFE,0x20,0x20,0xFC,0x20,0x20,0xFE,0x00, + /* 0xF6FD [?] [8083]*/ + 0x20,0x20,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x55,0x56,0x7C,0x00,0x1C,0xE0,0x40, + 0x20,0x10,0xFE,0x02,0x02,0xFE,0x00,0x00,0xFE,0xAA,0xAA,0xFE,0xAA,0xAA,0xAA,0x86, + /* 0xF6FE [?] [8084]*/ + 0x20,0x21,0x7C,0x44,0x88,0x7C,0x54,0x57,0x7C,0x55,0x55,0x7D,0x01,0x1C,0xE3,0x40, + 0x00,0xFC,0xA4,0x88,0x50,0x20,0xD8,0x26,0x20,0xFC,0x24,0x24,0xFC,0x22,0xFE,0x02, + /* 0xF7A1 [?] [8085]*/ + 0x08,0x7E,0x08,0xFE,0x10,0x1E,0x22,0x4F,0x90,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF, + 0x20,0x20,0x7E,0xC4,0x28,0x10,0x28,0xC6,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xF7A2 [?] [8086]*/ + 0x20,0x20,0x7D,0x44,0x8B,0x7C,0x54,0x55,0x7E,0x54,0x55,0x7D,0x01,0x1D,0xE1,0x41, + 0x40,0x44,0xF8,0x50,0xFE,0x40,0xF8,0x82,0x7E,0x00,0xFC,0x04,0xFC,0x04,0xFC,0x04, + /* 0xF7A3 [?] [8087]*/ + 0x20,0x20,0x7C,0x44,0x88,0x7C,0x54,0x54,0x7D,0x54,0x55,0x7C,0x01,0x1C,0xE1,0x40, + 0x00,0xFC,0x84,0xFC,0x84,0xFC,0x00,0x00,0xDC,0x44,0x54,0xCC,0x54,0x44,0x54,0x88, + /* 0xF7A4 [?] [8088]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x54,0x54,0x7C,0x55,0x54,0x7C,0x00,0x1D,0xE0,0x40, + 0x00,0xFC,0x54,0x54,0x54,0xFC,0x20,0xA8,0xA4,0x24,0x20,0xA8,0xA4,0x24,0x20,0x20, + /* 0xF7A5 [?] [8089]*/ + 0x20,0x20,0x7D,0x44,0x89,0x7C,0x54,0x55,0x7C,0x55,0x54,0x7C,0x00,0x1C,0xE0,0x40, + 0x04,0x1E,0xE0,0x02,0x22,0x94,0xFE,0x10,0x10,0xFE,0x10,0x92,0x92,0x92,0xFE,0x02, + /* 0xF7A6 [?] [8090]*/ + 0x41,0x41,0x7B,0x89,0x11,0xF8,0xAB,0xAA,0xFA,0xAB,0xA8,0xFB,0x00,0x18,0xE0,0x40, + 0x48,0x48,0xE8,0x48,0xDE,0x8A,0xEA,0xAA,0xAA,0xEA,0x8A,0xEA,0x92,0x92,0xAA,0xC4, + /* 0xF7A7 [?] [8091]*/ + 0x20,0x23,0x7C,0x45,0x89,0x7D,0x55,0x54,0x7D,0x54,0x57,0x7C,0x00,0x1D,0xE2,0x40, + 0x00,0xFE,0x50,0xFC,0x54,0x54,0xFC,0x00,0xFC,0x00,0xFE,0x20,0xA8,0x24,0xA2,0x40, + /* 0xF7A8 [?] [8092]*/ + 0x20,0x21,0x7C,0x47,0x8A,0x7D,0x54,0x55,0x7C,0x55,0x54,0x7D,0x00,0x1C,0xE1,0x40, + 0x00,0xFC,0x20,0xFE,0x22,0xAC,0x20,0xAC,0x00,0xFC,0x04,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF7A9 [?] [8093]*/ + 0x40,0x41,0x79,0x89,0x11,0xF9,0xA8,0xAB,0xFA,0xAB,0xA8,0xF9,0x00,0x18,0xE1,0x46, + 0x00,0xF8,0x08,0xF8,0x08,0xF8,0x00,0xFC,0x94,0xFC,0x00,0xF8,0x90,0x60,0x98,0x06, + /* 0xF7AA [?] [8094]*/ + 0x20,0x3F,0x40,0xBE,0x2A,0xFF,0x4A,0x7F,0x10,0x3F,0x51,0x1F,0x11,0x1F,0x00,0xFF, + 0x20,0x20,0x7E,0xA8,0x28,0x10,0x28,0xC6,0x40,0xF0,0x10,0xF0,0x10,0xF0,0x00,0xFE, + /* 0xF7AB [?] [8095]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x01,0x1E,0xE2,0x44, + 0x10,0xFE,0x10,0x7C,0x14,0xFE,0x14,0x7C,0x10,0x7C,0x54,0x7C,0x54,0x7C,0x54,0x4C, + /* 0xF7AC [?] [8096]*/ + 0x40,0x43,0x7A,0x8B,0x12,0xFB,0xAA,0xAA,0xFB,0xAB,0xAB,0xFA,0x02,0x1A,0xE4,0x49, + 0x00,0xFE,0x00,0x14,0xA4,0xF6,0x4A,0x42,0x50,0x54,0xF4,0x44,0x4A,0x8A,0x92,0x20, + /* 0xF7AD [?] [8097]*/ + 0x40,0x40,0x7B,0x88,0x11,0xF8,0xAB,0xA9,0xF8,0xAB,0xA8,0xF9,0x01,0x19,0xE1,0x41, + 0x88,0x50,0xFE,0x20,0xFC,0x20,0xFE,0x24,0xA8,0xFE,0x00,0xFC,0x04,0x04,0xFC,0x04, + /* 0xF7AE [?] [8098]*/ + 0x20,0x20,0x7D,0x44,0x89,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7C,0x01,0x1C,0xE0,0x40, + 0x88,0x50,0xFE,0x50,0xFC,0x54,0x9C,0x04,0xFC,0x04,0xFC,0x08,0xFE,0x88,0x48,0x18, + /* 0xF7AF [?] [8099]*/ + 0x20,0x21,0x7D,0x45,0x89,0x7D,0x54,0x55,0x7C,0x55,0x55,0x7D,0x00,0x1C,0xE3,0x40, + 0x50,0xFC,0x54,0xFC,0x54,0xFC,0x00,0xFC,0x00,0xFC,0x04,0xFC,0x88,0x50,0xFE,0x00, + /* 0xF7B0 [?] [8100]*/ + 0x28,0x28,0xFE,0x28,0x38,0x10,0x7C,0x54,0x54,0x7C,0x10,0xFE,0x10,0x10,0x11,0x10, + 0x00,0x00,0xFC,0x84,0x84,0x84,0xFC,0x84,0x84,0x84,0xFC,0x84,0x00,0x00,0xFE,0x00, + /* 0xF7B1 [?] [8101]*/ + 0x28,0x28,0xFE,0x29,0x39,0x11,0x7D,0x55,0x55,0x7F,0x10,0xFE,0x10,0x10,0x11,0x12, + 0x20,0x20,0x20,0xFC,0x24,0x24,0x24,0x24,0x24,0xFE,0x20,0x50,0x50,0x88,0x04,0x02, + /* 0xF7B2 [?] [8102]*/ + 0x28,0x29,0xFC,0x28,0x38,0x10,0x7D,0x54,0x54,0x7C,0x10,0xFC,0x10,0x11,0x12,0x10, + 0x10,0x10,0x90,0x90,0x7E,0x10,0x90,0x90,0x98,0xA8,0xA4,0xC4,0x80,0x40,0x3E,0x00, + /* 0xF7B3 [?] [8103]*/ + 0x28,0x28,0xFE,0x28,0x38,0x11,0x7C,0x54,0x55,0x7E,0x10,0xFE,0x10,0x10,0x10,0x11, + 0x08,0x1C,0xE0,0x20,0x20,0xFE,0x50,0x88,0x04,0x8A,0x88,0x88,0x88,0x88,0x88,0x08, + /* 0xF7B4 [?] [8104]*/ + 0x28,0x28,0xFC,0x29,0x3A,0x11,0x7D,0x55,0x55,0x7D,0x10,0xFC,0x10,0x10,0x11,0x12, + 0x80,0x80,0xF8,0x08,0x10,0xFC,0x24,0x24,0x24,0xFC,0x50,0x50,0x90,0x92,0x12,0x0E, + /* 0xF7B5 [?] [8105]*/ + 0x28,0x28,0xFD,0x28,0x38,0x11,0x7C,0x54,0x54,0x7D,0x12,0xFC,0x10,0x10,0x10,0x10, + 0x48,0x48,0xFE,0x48,0x20,0xFE,0x40,0x40,0xBC,0x84,0x88,0xBE,0x88,0x88,0xA8,0x90, + /* 0xF7B6 [?] [8106]*/ + 0x28,0x28,0xFC,0x29,0x3A,0x11,0x7C,0x55,0x54,0x7D,0x10,0xFD,0x11,0x11,0x10,0x10, + 0x80,0x80,0xFE,0x02,0x42,0xFA,0x02,0xF2,0x02,0xF2,0x02,0xF2,0x12,0xF2,0x14,0x08, + /* 0xF7B7 [?] [8107]*/ + 0x28,0x29,0xFC,0x28,0x3B,0x10,0x7C,0x55,0x56,0x7C,0x13,0xFC,0x10,0x11,0x16,0x10, + 0x00,0xFC,0x48,0x30,0xFE,0x52,0x94,0x10,0x30,0x20,0xFE,0x70,0xA8,0x24,0x22,0x20, + /* 0xF7B8 [?] [8108]*/ + 0x50,0x50,0xFB,0x50,0x71,0x20,0xFB,0xA8,0xA9,0xF9,0x21,0xF9,0x23,0x21,0x21,0x21, + 0x88,0x88,0xFE,0x88,0xFC,0x88,0xFE,0x20,0xFC,0x24,0xFC,0x24,0xFE,0x04,0x14,0x08, + /* 0xF7B9 [?] [8109]*/ + 0x50,0x50,0xFB,0x50,0x70,0x27,0xF8,0xA9,0xAB,0xFD,0x21,0xF9,0x21,0x21,0x21,0x21, + 0x88,0x88,0xFE,0x88,0x88,0xFE,0x80,0xFC,0x24,0xFC,0x24,0xFC,0x24,0x24,0x24,0x0C, + /* 0xF7BA [?] [8110]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x83,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x49, + 0x20,0x20,0x20,0x50,0x50,0x88,0x06,0x48,0x48,0x48,0x48,0x48,0x48,0x88,0x88,0x08, + /* 0xF7BB [?] [8111]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFF,0x82,0x7D,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x4B, + 0x00,0xF8,0x88,0x88,0x88,0x06,0x00,0xFC,0x84,0x84,0x48,0x50,0x20,0x50,0x88,0x06, + /* 0xF7BC [?] [8112]*/ + 0x00,0x7C,0x44,0x74,0x55,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x48, + 0x20,0x20,0x20,0x20,0xFE,0x20,0x20,0x20,0xFC,0x84,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF7BD [?] [8113]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7C,0x45,0x44,0x54,0x48, + 0x20,0x40,0xFC,0x84,0xA4,0x94,0x94,0x8C,0x80,0xFE,0x02,0x02,0xFA,0x02,0x14,0x08, + /* 0xF7BE [?] [8114]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x48, + 0x04,0x1E,0xF0,0x90,0x90,0x90,0x90,0xFE,0x90,0x90,0x90,0x88,0x8A,0xAA,0xD6,0x8A, + /* 0xF7BF [?] [8115]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x45,0x55,0x4A, + 0x08,0x1C,0xE0,0x80,0x80,0xFE,0x80,0x80,0xBC,0xA4,0xA4,0xA4,0xA4,0x3C,0x24,0x00, + /* 0xF7C0 [?] [8116]*/ + 0x00,0x7C,0x44,0x74,0x55,0xFE,0x82,0x7C,0x45,0x7C,0x44,0x7C,0x44,0x44,0x54,0x48, + 0x40,0x40,0x78,0x88,0x50,0x20,0x50,0x88,0x06,0xF8,0x88,0x88,0x88,0x88,0xF8,0x88, + /* 0xF7C1 [?] [8117]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7C,0x44,0x7D,0x44,0x7C,0x44,0x45,0x54,0x48, + 0x00,0xF8,0xA8,0xA8,0xF8,0xA8,0xA8,0xF8,0x20,0xFC,0x20,0x70,0xA8,0x26,0x20,0x20, + /* 0xF7C2 [?] [8118]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7D,0x44,0x44,0x54,0x48, + 0x20,0x40,0xFE,0x92,0x92,0xFE,0x92,0xA2,0xFE,0x48,0x88,0xFE,0x08,0x08,0x08,0x08, + /* 0xF7C3 [?] [8119]*/ + 0x00,0x7D,0x44,0x74,0x55,0xFE,0x82,0x7D,0x44,0x7D,0x44,0x7C,0x44,0x44,0x54,0x49, + 0x20,0x24,0xA8,0x20,0xFE,0x68,0xA4,0x02,0x20,0xFE,0x48,0x88,0xD0,0x30,0x4C,0x82, + /* 0xF7C4 [?] [8120]*/ + 0x00,0x7C,0x45,0x75,0x54,0xFE,0x82,0x7D,0x44,0x7C,0x47,0x7C,0x44,0x44,0x54,0x48, + 0x40,0x20,0xFC,0x04,0x40,0x78,0x88,0x50,0x20,0xD8,0x06,0xF8,0x88,0x88,0xF8,0x88, + /* 0xF7C5 [?] [8121]*/ + 0x00,0x7C,0x45,0x75,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x4B, + 0x20,0x10,0xFE,0x02,0x48,0xFC,0x48,0x00,0xFC,0x84,0xA4,0xA4,0xA4,0x50,0x92,0x0E, + /* 0xF7C6 [?] [8122]*/ + 0x00,0x7C,0x45,0x75,0x54,0xFE,0x82,0x7C,0x44,0x7C,0x44,0x7D,0x44,0x44,0x55,0x4A, + 0x40,0x20,0xFE,0x02,0x18,0xE0,0x80,0xFC,0x90,0x90,0x90,0xFE,0x00,0x88,0x04,0x02, + /* 0xF7C7 [?] [8123]*/ + 0x00,0x7C,0x44,0x74,0x54,0xFE,0x82,0x7D,0x44,0x7C,0x44,0x7C,0x44,0x44,0x54,0x48, + 0x00,0xFE,0xAA,0xAA,0xFE,0x40,0xFE,0x22,0xFA,0xAA,0xAA,0xFA,0x22,0xFA,0x0A,0x04, + /* 0xF7C8 [?] [8124]*/ + 0x08,0x10,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x10,0x1A,0x2C,0x2F,0x48,0x48,0x87, + 0x10,0x10,0x10,0x7C,0x10,0x10,0xFE,0x10,0x38,0x54,0x92,0x90,0x90,0x10,0x02,0xFE, + /* 0xF7C9 [?] [8125]*/ + 0x10,0x20,0x7C,0x55,0x54,0x7C,0x54,0x54,0x7C,0x10,0x2A,0x2D,0x4F,0x48,0x87,0x00, + 0x28,0x24,0x20,0xFE,0x20,0x20,0x7C,0x44,0x54,0x88,0x94,0x24,0x40,0x02,0xFE,0x00, + /* 0xF7CA [?] [8126]*/ + 0x3F,0x20,0x3F,0x21,0x26,0x38,0x21,0x2F,0x28,0x2F,0x28,0x2F,0x41,0x42,0x8C,0x30, + 0xFC,0x90,0xFC,0x40,0x30,0x8C,0x00,0xF8,0x88,0xF8,0x88,0xF8,0x50,0xFA,0x8A,0x7E, + /* 0xF7CB [?] [8127]*/ + 0x10,0x21,0x7C,0x54,0x55,0x7D,0x55,0x55,0x7D,0x11,0x2B,0x2D,0x4F,0x48,0x87,0x00, + 0x00,0xFC,0x50,0x50,0xFC,0x54,0x54,0x54,0xAC,0x04,0x04,0x14,0x08,0x02,0xFE,0x00, + /* 0xF7CC [?] [8128]*/ + 0x08,0x10,0x7F,0x49,0x49,0x7F,0x49,0x49,0x7F,0x10,0x1A,0x2C,0x2F,0x48,0x48,0x87, + 0x10,0x54,0x38,0x10,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0xC4,0xC4,0x4C,0x02,0xFE, + /* 0xF7CD [?] [8129]*/ + 0x10,0x21,0x7D,0x55,0x55,0x7D,0x55,0x55,0x7D,0x11,0x2B,0x2D,0x4F,0x48,0x87,0x00, + 0x00,0xFC,0x04,0x8C,0x54,0xFC,0x44,0x24,0xFC,0x44,0x74,0x04,0x0C,0x02,0xFE,0x00, + /* 0xF7CE [?] [8130]*/ + 0x10,0x20,0x7D,0x54,0x55,0x7D,0x55,0x54,0x7D,0x11,0x2B,0x2D,0x4F,0x48,0x87,0x00, + 0x40,0x20,0xFC,0x50,0x24,0x54,0xFC,0x20,0xFC,0x44,0x54,0x74,0x0C,0x02,0xFE,0x00, + /* 0xF7CF [?] [8131]*/ + 0x10,0x10,0x10,0x24,0x24,0x79,0x0A,0x10,0x24,0x7C,0x04,0x08,0x08,0x10,0x20,0x40, + 0x20,0x20,0x50,0x48,0xA4,0xFA,0x88,0xF8,0x88,0xF8,0xA2,0x94,0x88,0xA4,0xC4,0x80, + /* 0xF7D0 [?] [8132]*/ + 0x00,0x3F,0x21,0x3F,0x24,0x28,0x33,0x2C,0x37,0x24,0x27,0x24,0x27,0x44,0x45,0x86, + 0x00,0xFE,0x08,0xFC,0x10,0x88,0x64,0x98,0xF6,0x10,0xF0,0x10,0xF4,0x68,0x18,0x04, + /* 0xF7D1 [?] [8133]*/ + 0x7F,0x10,0x1E,0x23,0x54,0x09,0x10,0x61,0x06,0x1F,0xE8,0x0F,0x08,0x0F,0x08,0x0C, + 0x20,0x50,0x88,0x46,0x90,0x24,0x48,0x90,0x60,0xF8,0x16,0xF0,0x10,0xF4,0x68,0x1C, + /* 0xF7D2 [?] [8134]*/ + 0x7C,0x44,0xFE,0x20,0x7C,0x04,0x28,0x11,0x06,0x1F,0xE8,0x0F,0x08,0x0F,0x08,0x0C, + 0x1C,0x10,0xFE,0x92,0xF8,0x94,0xBC,0xAA,0x66,0xF8,0x16,0xF0,0x10,0xF4,0x68,0x1C, + /* 0xF7D3 [?] [8135]*/ + 0x01,0xFF,0x10,0x25,0x7B,0x15,0x79,0x11,0xE6,0x1F,0xE8,0x0F,0x08,0x0F,0x08,0x0C, + 0x00,0xFE,0xA0,0xFE,0x20,0xFC,0x20,0xFE,0x60,0xF8,0x16,0xF0,0x10,0xF4,0x68,0x1C, + /* 0xF7D4 [?] [8136]*/ + 0x3F,0x20,0x20,0x3E,0x20,0x20,0x3E,0x20,0x20,0xFF,0x10,0x24,0x42,0xFF,0x41,0x00, + 0x04,0x04,0x08,0x10,0x20,0x44,0x04,0x08,0x10,0x22,0x42,0x04,0x08,0x10,0x20,0xC0, + /* 0xF7D5 [?] [8137]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x00,0x7F,0x04,0x04,0x08,0x30,0xC0, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0x00,0xFC,0x40,0x40,0x42,0x42,0x3E, + /* 0xF7D6 [?] [8138]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x01,0x3E,0x03,0x3E,0x03,0x7E,0x01, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0xF0,0x00,0xF0,0x00,0xFA,0x02,0xFE, + /* 0xF7D7 [?] [8139]*/ + 0x3F,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x01,0x3F,0x21,0x3F,0x21,0xFF,0x20,0x20,0x20, + 0x08,0x30,0xC4,0x18,0x62,0x0C,0x70,0x00,0xF8,0x08,0xF8,0x08,0xFE,0x08,0x28,0x10, + /* 0xF7D8 [?] [8140]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x00,0x7F,0x08,0x10,0x3F,0xD0,0x1F, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0x00,0xF8,0x08,0x30,0xF8,0x08,0xF8, + /* 0xF7D9 [?] [8141]*/ + 0x3F,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x01,0xFF,0x01,0x3F,0x00,0x3F,0x20,0x3F,0x20, + 0x08,0x30,0xC4,0x18,0x62,0x0C,0x70,0x00,0xFE,0x00,0xF8,0x00,0xF8,0x08,0xF8,0x08, + /* 0xF7DA [?] [8142]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x08,0x08,0x2E,0x28,0x28,0x2E,0xF0, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0x80,0x88,0x90,0xE0,0x84,0x84,0x7C, + /* 0xF7DB [?] [8143]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x08,0x10,0x37,0xD0,0x13,0x1C,0x10, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0x40,0x40,0xFC,0xE0,0x58,0x46,0x40, + /* 0xF7DC [?] [8144]*/ + 0x3F,0x20,0xFF,0x22,0x7F,0x11,0x09,0x7F,0x04,0xFF,0x10,0x2F,0xC8,0x08,0x08,0x07, + 0x04,0x18,0x62,0x0C,0x70,0x10,0x20,0xFC,0x00,0xFE,0x10,0xE8,0x26,0xA0,0x48,0xF8, + /* 0xF7DD [?] [8145]*/ + 0x3E,0x20,0x3E,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x00,0x7C,0x10,0xFE,0x38,0x54,0x92, + 0x04,0x18,0x60,0x04,0x18,0x62,0x04,0x18,0x60,0x00,0x10,0x52,0x94,0x28,0x44,0x82, + /* 0xF7DE [?] [8146]*/ + 0x3F,0x20,0xFF,0x22,0x7F,0x02,0x01,0x7F,0x40,0x9F,0x10,0x1F,0x10,0xFF,0x10,0x20, + 0x04,0x18,0x62,0x0C,0x70,0x00,0x00,0xFE,0x22,0xC4,0x00,0xF8,0x80,0xFE,0x20,0x10, + /* 0xF7DF [?] [8147]*/ + 0x3F,0x20,0x3E,0x20,0xFF,0x22,0x7F,0x01,0x3F,0x24,0xFF,0x10,0x1F,0x0C,0x34,0xC6, + 0x08,0x30,0xC4,0x18,0x62,0x0C,0x70,0x00,0xF8,0x48,0xFE,0x10,0xF0,0x88,0x70,0x0E, + /* 0xF7E0 [?] [8148]*/ + 0x3F,0x20,0xFF,0x22,0x7F,0x10,0x21,0x10,0x3F,0x24,0x23,0x24,0x3F,0x29,0x25,0x31, + 0x04,0x18,0x62,0x0C,0x70,0x84,0x08,0x84,0xF8,0x48,0x88,0x48,0xF8,0x4A,0x26,0x82, + /* 0xF7E1 [?] [8149]*/ + 0x01,0x00,0x3F,0x22,0x22,0x2F,0x23,0x26,0x2A,0x21,0x22,0x24,0x49,0x42,0x87,0x00, + 0x00,0x80,0xFE,0x10,0x10,0xBC,0x18,0xB4,0x52,0x00,0x40,0x80,0x10,0x08,0xFC,0x04, + /* 0xF7E2 [?] [8150]*/ + 0x01,0x00,0x3F,0x22,0x2F,0x26,0x2B,0x32,0x20,0x2F,0x20,0x2F,0x20,0x5F,0x40,0x80, + 0x00,0x80,0xFE,0x10,0x7C,0x38,0x54,0x92,0x78,0x80,0xF8,0x80,0xFC,0x82,0x82,0x7E, + /* 0xF7E3 [?] [8151]*/ + 0x01,0x00,0x3F,0x22,0x2F,0x26,0x2B,0x32,0x21,0x27,0x20,0x23,0x2F,0x40,0x45,0x88, + 0x00,0x80,0xFE,0x10,0x7C,0x38,0x54,0x92,0x08,0xF0,0x60,0x84,0xFE,0x42,0x48,0x84, + /* 0xF7E4 [?] [8152]*/ + 0x01,0x00,0x3F,0x22,0x3F,0x22,0x3F,0x28,0x2F,0x28,0x2F,0x20,0x23,0x42,0x44,0x98, + 0x00,0x80,0xFE,0x20,0xFC,0x24,0xFC,0x40,0x78,0x42,0x3E,0x00,0xF0,0x10,0x12,0x0E, + /* 0xF7E5 [?] [8153]*/ + 0x00,0x3F,0x22,0x3F,0x22,0x3F,0x24,0x27,0x24,0x27,0x20,0x23,0x20,0x4F,0x41,0x8E, + 0x80,0xFE,0x20,0xFC,0x24,0xFC,0x20,0xBC,0x22,0x9E,0x08,0xF0,0x40,0xFE,0x50,0x4E, + /* 0xF7E6 [?] [8154]*/ + 0x00,0x3F,0x22,0x3F,0x22,0x3F,0x24,0x27,0x24,0x27,0x20,0x2F,0x20,0x47,0x40,0x9F, + 0x80,0xFE,0x20,0xFC,0x24,0xFC,0x20,0xBC,0x22,0x9E,0x80,0xFE,0x40,0xFC,0x40,0xFE, + /* 0xF7E7 [?] [8155]*/ + 0x00,0x3F,0x22,0x3F,0x22,0x3F,0x24,0x27,0x24,0x27,0x22,0x21,0x2F,0x41,0x42,0x8C, + 0x80,0xFE,0x20,0xFC,0x24,0xFC,0x20,0xBC,0x22,0x9E,0x48,0x50,0xFE,0x50,0x48,0x46, + /* 0xF7E8 [?] [8156]*/ + 0x08,0x7F,0x55,0x54,0x7F,0x55,0x55,0x7F,0x54,0x54,0x5E,0x55,0x54,0x5C,0x56,0x80, + 0x44,0x44,0xFE,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44,0x44,0xFE,0x00,0x28,0x44,0x82, + /* 0xF7E9 [?] [8157]*/ + 0x00,0x3F,0x22,0x3F,0x22,0x3F,0x24,0x27,0x24,0x27,0x23,0x2D,0x20,0x47,0x42,0x8F, + 0x80,0xFE,0x20,0xFC,0x24,0xFC,0x20,0xBC,0x62,0xBE,0x18,0xF6,0x40,0xFC,0x48,0xFE, + /* 0xF7EA [?] [8158]*/ + 0x00,0x3F,0x22,0x3F,0x22,0x3F,0x24,0x27,0x24,0x2F,0x29,0x2F,0x29,0x5F,0x45,0x9B, + 0x80,0xFE,0x20,0xFC,0x24,0xFC,0x20,0xBC,0x22,0x9E,0x08,0x7E,0x48,0x28,0x08,0x18, + /* 0xF7EB [?] [8159]*/ + 0x08,0x7F,0x54,0x54,0x7F,0x55,0x55,0x7F,0x54,0x54,0x5E,0x54,0x55,0x5C,0x56,0x81, + 0x10,0x54,0x38,0xFE,0x10,0x38,0x56,0x90,0x84,0xEE,0xA4,0xB4,0x5E,0x44,0x84,0x04, + /* 0xF7EC [?] [8160]*/ + 0x08,0x10,0x30,0xD7,0x10,0x10,0x00,0x3F,0x29,0x25,0x3F,0x01,0x7F,0x01,0xFF,0x44, + 0x90,0x88,0x7E,0xC0,0x22,0x1A,0x06,0xF8,0x28,0x48,0xF8,0x00,0xFC,0x00,0xFE,0x44, + /* 0xF7ED [?] [8161]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x10,0x10,0x92,0x92,0x92,0x92,0xFE,0x10,0x10,0x92,0x92,0x92,0x92,0x92,0xFE,0x02, + /* 0xF7EE [?] [8162]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x93,0xFF,0x10,0xFE,0x11,0x1F,0xE1,0x02,0xAA,0xA8,0x80, + 0x10,0x50,0x50,0x90,0xFC,0x54,0xD4,0x94,0x94,0x14,0x54,0xD4,0x54,0x24,0x34,0x48, + /* 0xF7EF [?] [8163]*/ + 0x00,0xFE,0x92,0xD7,0xBA,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x20,0x20,0x20,0xFE,0x20,0x20,0xFC,0x00,0x00,0xFC,0x84,0x84,0x84,0x84,0xFC,0x84, + /* 0xF7F0 [?] [8164]*/ + 0x00,0xFE,0x92,0xD6,0xBB,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x20,0x20,0x7C,0x84,0x48,0x30,0x20,0x48,0x90,0x3E,0x42,0xA4,0x18,0x10,0x20,0xC0, + /* 0xF7F1 [?] [8165]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x10,0x10,0x20,0x44,0xFE,0x28,0x44,0xA2,0x3C,0x44,0x44,0xA8,0x10,0x28,0x44,0x82, + /* 0xF7F2 [?] [8166]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x93,0xFE,0x10,0xFE,0x10,0x1E,0xE1,0x02,0xAA,0xA8,0x81, + 0x10,0x10,0xFC,0x10,0x10,0xFE,0x02,0x54,0x30,0x90,0x50,0xFE,0x28,0x44,0x82,0x02, + /* 0xF7F3 [?] [8167]*/ + 0x06,0x38,0x08,0x7E,0x1C,0x2A,0x48,0x3F,0x29,0x25,0x3F,0x01,0x7F,0x01,0xFF,0x44, + 0x40,0x7C,0x94,0x24,0x44,0x94,0x08,0xF8,0x28,0x48,0xF8,0x00,0xFC,0x00,0xFE,0x44, + /* 0xF7F4 [?] [8168]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x20,0x10,0xFE,0x00,0x00,0x7C,0x44,0x44,0x7C,0x10,0x54,0x52,0x92,0x10,0x50,0x20, + /* 0xF7F5 [?] [8169]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x93,0xFE,0x11,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x81, + 0x20,0x28,0x44,0xFE,0x20,0xFE,0x88,0x14,0x22,0x48,0x10,0x22,0xC4,0x18,0x60,0x80, + /* 0xF7F6 [?] [8170]*/ + 0x00,0xFE,0x92,0xD6,0xBA,0x92,0xFE,0x10,0xFE,0x10,0x1E,0xE0,0x02,0xAA,0xA8,0x80, + 0x20,0x10,0xFE,0x00,0x44,0x28,0xFE,0x00,0x7C,0x44,0x44,0x7C,0x44,0x44,0x7C,0x44, + /* 0xF7F7 [?] [8171]*/ + 0x20,0xCE,0x82,0xEE,0x82,0x82,0xFE,0x01,0x92,0x92,0xDA,0x92,0xDA,0x92,0x93,0xD9, + 0x08,0x28,0x28,0x28,0x44,0x44,0x82,0x7C,0x24,0x24,0x24,0x24,0x44,0x44,0x94,0x08, + /* 0xF7F8 [?] [8172]*/ + 0x20,0xCE,0x82,0xEE,0x82,0x82,0xFE,0x00,0x92,0x92,0xDA,0x92,0xDA,0x92,0x93,0xD9, + 0x10,0x10,0x10,0x10,0xFE,0x92,0x92,0x92,0x92,0xFE,0x92,0x92,0x92,0x92,0xFE,0x82, + /* 0xF7F9 [?] [8173]*/ + 0x20,0xCE,0x82,0xEE,0x82,0x82,0xFE,0x00,0x92,0x92,0xDA,0x92,0xDA,0x92,0x93,0xD9, + 0x00,0xFE,0x10,0x10,0x7C,0x24,0x24,0xFE,0x00,0x00,0x7C,0x44,0x44,0x44,0x7C,0x44, + /* 0xF7FA [?] [8174]*/ + 0x20,0xCE,0x82,0xEE,0x82,0x82,0xFE,0x00,0x92,0x92,0xDA,0x92,0xDA,0x92,0x93,0xD9, + 0x00,0x7C,0x44,0x7C,0x44,0x7C,0x10,0xFE,0x82,0x10,0xFE,0x24,0x68,0x10,0x28,0x44, + /* 0xF7FB [?] [8175]*/ + 0x20,0xCE,0x82,0xEE,0x82,0x82,0xFE,0x00,0x92,0x92,0xDA,0x92,0xDA,0x92,0x93,0xD9, + 0x0E,0xF0,0x22,0x92,0x44,0x20,0x44,0xF8,0x10,0x24,0xFE,0x10,0xFE,0x28,0x44,0x82, + /* 0xF7FC [?] [8176]*/ + 0x10,0x3E,0x22,0x3E,0x22,0x3E,0x00,0x7F,0x49,0x7F,0x49,0x7F,0x00,0xFF,0x22,0x42, + 0x20,0x20,0x20,0x20,0xF8,0x28,0x28,0x28,0x28,0x28,0x28,0x2A,0x2A,0xCA,0x46,0x80, + /* 0xF7FD [?] [8177]*/ + 0x10,0x3E,0x22,0x3E,0x22,0x3E,0x00,0x7F,0x49,0x7F,0x49,0x7F,0x00,0xFF,0x22,0x42, + 0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x90,0x10,0x10, + /* 0xF7FE [?] [8178]*/ + 0x10,0x3E,0x22,0x3E,0x22,0x3E,0x00,0x7F,0x49,0x7F,0x49,0x7F,0x00,0xFF,0x22,0x42, + 0x10,0x10,0xFE,0x38,0x54,0x92,0x00,0x7C,0x44,0x7C,0x44,0x7C,0x44,0x80,0xFE,0x00, + }; + + +const uint8_t s_ascii_font8_16[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/ + 0x00,0x00,0x00,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,0x18,0x18,0x00,0x00,/*"!",1*/ + 0x00,0x12,0x36,0x24,0x48,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*""",2*/ + 0x00,0x00,0x00,0x24,0x24,0x24,0xFE,0x48,0x48,0x48,0xFE,0x48,0x48,0x48,0x00,0x00,/*"#",3*/ + 0x00,0x00,0x10,0x38,0x54,0x54,0x50,0x30,0x18,0x14,0x14,0x54,0x54,0x38,0x10,0x10,/*"$",4*/ + 0x00,0x00,0x00,0x44,0xA4,0xA8,0xA8,0xA8,0x54,0x1A,0x2A,0x2A,0x2A,0x44,0x00,0x00,/*"%",5*/ + 0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x50,0x6E,0xA4,0x94,0x88,0x89,0x76,0x00,0x00,/*"&",6*/ + 0x00,0x60,0x60,0x20,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"'",7*/ + 0x00,0x02,0x04,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x08,0x04,0x02,0x00,/*"(",8*/ + 0x00,0x40,0x20,0x10,0x10,0x08,0x08,0x08,0x08,0x08,0x08,0x10,0x10,0x20,0x40,0x00,/*")",9*/ + 0x00,0x00,0x00,0x00,0x10,0x10,0xD6,0x38,0x38,0xD6,0x10,0x10,0x00,0x00,0x00,0x00,/*"*",10*/ + 0x00,0x00,0x00,0x00,0x10,0x10,0x10,0x10,0xFE,0x10,0x10,0x10,0x10,0x00,0x00,0x00,/*"+",11*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x20,0xC0,/*",",12*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"-",13*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x60,0x00,0x00,/*".",14*/ + 0x00,0x00,0x01,0x02,0x02,0x04,0x04,0x08,0x08,0x10,0x10,0x20,0x20,0x40,0x40,0x00,/*"/",15*/ + 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18,0x00,0x00,/*"0",16*/ + 0x00,0x00,0x00,0x10,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"1",17*/ + 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x04,0x04,0x08,0x10,0x20,0x42,0x7E,0x00,0x00,/*"2",18*/ + 0x00,0x00,0x00,0x3C,0x42,0x42,0x04,0x18,0x04,0x02,0x02,0x42,0x44,0x38,0x00,0x00,/*"3",19*/ + 0x00,0x00,0x00,0x04,0x0C,0x14,0x24,0x24,0x44,0x44,0x7E,0x04,0x04,0x1E,0x00,0x00,/*"4",20*/ + 0x00,0x00,0x00,0x7E,0x40,0x40,0x40,0x58,0x64,0x02,0x02,0x42,0x44,0x38,0x00,0x00,/*"5",21*/ + 0x00,0x00,0x00,0x1C,0x24,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x24,0x18,0x00,0x00,/*"6",22*/ + 0x00,0x00,0x00,0x7E,0x44,0x44,0x08,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,/*"7",23*/ + 0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x24,0x18,0x24,0x42,0x42,0x42,0x3C,0x00,0x00,/*"8",24*/ + 0x00,0x00,0x00,0x18,0x24,0x42,0x42,0x42,0x26,0x1A,0x02,0x02,0x24,0x38,0x00,0x00,/*"9",25*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,/*":",26*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x20,/*";",27*/ + 0x00,0x00,0x00,0x02,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x02,0x00,0x00,/*"<",28*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0xFE,0x00,0x00,0x00,0x00,0x00,/*"=",29*/ + 0x00,0x00,0x00,0x40,0x20,0x10,0x08,0x04,0x02,0x04,0x08,0x10,0x20,0x40,0x00,0x00,/*">",30*/ + 0x00,0x00,0x00,0x3C,0x42,0x42,0x62,0x02,0x04,0x08,0x08,0x00,0x18,0x18,0x00,0x00,/*"?",31*/ + 0x00,0x00,0x00,0x38,0x44,0x5A,0xAA,0xAA,0xAA,0xAA,0xB4,0x42,0x44,0x38,0x00,0x00,/*"@",32*/ + 0x00,0x00,0x00,0x10,0x10,0x18,0x28,0x28,0x24,0x3C,0x44,0x42,0x42,0xE7,0x00,0x00,/*"A",33*/ + 0x00,0x00,0x00,0xF8,0x44,0x44,0x44,0x78,0x44,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,/*"B",34*/ + 0x00,0x00,0x00,0x3E,0x42,0x42,0x80,0x80,0x80,0x80,0x80,0x42,0x44,0x38,0x00,0x00,/*"C",35*/ + 0x00,0x00,0x00,0xF8,0x44,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x44,0xF8,0x00,0x00,/*"D",36*/ + 0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x42,0x42,0xFC,0x00,0x00,/*"E",37*/ + 0x00,0x00,0x00,0xFC,0x42,0x48,0x48,0x78,0x48,0x48,0x40,0x40,0x40,0xE0,0x00,0x00,/*"F",38*/ + 0x00,0x00,0x00,0x3C,0x44,0x44,0x80,0x80,0x80,0x8E,0x84,0x44,0x44,0x38,0x00,0x00,/*"G",39*/ + 0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x7E,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"H",40*/ + 0x00,0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"I",41*/ + 0x00,0x00,0x00,0x3E,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x88,0xF0,/*"J",42*/ + 0x00,0x00,0x00,0xEE,0x44,0x48,0x50,0x70,0x50,0x48,0x48,0x44,0x44,0xEE,0x00,0x00,/*"K",43*/ + 0x00,0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x42,0xFE,0x00,0x00,/*"L",44*/ + 0x00,0x00,0x00,0xEE,0x6C,0x6C,0x6C,0x6C,0x54,0x54,0x54,0x54,0x54,0xD6,0x00,0x00,/*"M",45*/ + 0x00,0x00,0x00,0xC7,0x62,0x62,0x52,0x52,0x4A,0x4A,0x4A,0x46,0x46,0xE2,0x00,0x00,/*"N",46*/ + 0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0x82,0x82,0x44,0x38,0x00,0x00,/*"O",47*/ + 0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x42,0x7C,0x40,0x40,0x40,0x40,0xE0,0x00,0x00,/*"P",48*/ + 0x00,0x00,0x00,0x38,0x44,0x82,0x82,0x82,0x82,0x82,0xB2,0xCA,0x4C,0x38,0x06,0x00,/*"Q",49*/ + 0x00,0x00,0x00,0xFC,0x42,0x42,0x42,0x7C,0x48,0x48,0x44,0x44,0x42,0xE3,0x00,0x00,/*"R",50*/ + 0x00,0x00,0x00,0x3E,0x42,0x42,0x40,0x20,0x18,0x04,0x02,0x42,0x42,0x7C,0x00,0x00,/*"S",51*/ + 0x00,0x00,0x00,0xFE,0x92,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,/*"T",52*/ + 0x00,0x00,0x00,0xE7,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,/*"U",53*/ + 0x00,0x00,0x00,0xE7,0x42,0x42,0x44,0x24,0x24,0x28,0x28,0x18,0x10,0x10,0x00,0x00,/*"V",54*/ + 0x00,0x00,0x00,0xD6,0x92,0x92,0x92,0x92,0xAA,0xAA,0x6C,0x44,0x44,0x44,0x00,0x00,/*"W",55*/ + 0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x18,0x18,0x18,0x24,0x24,0x42,0xE7,0x00,0x00,/*"X",56*/ + 0x00,0x00,0x00,0xEE,0x44,0x44,0x28,0x28,0x10,0x10,0x10,0x10,0x10,0x38,0x00,0x00,/*"Y",57*/ + 0x00,0x00,0x00,0x7E,0x84,0x04,0x08,0x08,0x10,0x20,0x20,0x42,0x42,0xFC,0x00,0x00,/*"Z",58*/ + 0x00,0x1E,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x1E,0x00,/*"[",59*/ + 0x00,0x00,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x08,0x04,0x04,0x04,0x02,0x02,/*"\",60*/ + 0x00,0x78,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x78,0x00,/*"]",61*/ + 0x00,0x1C,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"^",62*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,/*"_",63*/ + 0x00,0x60,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"`",64*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x1E,0x22,0x42,0x42,0x3F,0x00,0x00,/*"a",65*/ + 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x58,0x64,0x42,0x42,0x42,0x64,0x58,0x00,0x00,/*"b",66*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C,0x22,0x40,0x40,0x40,0x22,0x1C,0x00,0x00,/*"c",67*/ + 0x00,0x00,0x00,0x06,0x02,0x02,0x02,0x1E,0x22,0x42,0x42,0x42,0x26,0x1B,0x00,0x00,/*"d",68*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x7E,0x40,0x40,0x42,0x3C,0x00,0x00,/*"e",69*/ + 0x00,0x00,0x00,0x0F,0x11,0x10,0x10,0x7E,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"f",70*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x44,0x44,0x38,0x40,0x3C,0x42,0x42,0x3C,/*"g",71*/ + 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x5C,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"h",72*/ + 0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"i",73*/ + 0x00,0x00,0x00,0x0C,0x0C,0x00,0x00,0x1C,0x04,0x04,0x04,0x04,0x04,0x04,0x44,0x78,/*"j",74*/ + 0x00,0x00,0x00,0xC0,0x40,0x40,0x40,0x4E,0x48,0x50,0x68,0x48,0x44,0xEE,0x00,0x00,/*"k",75*/ + 0x00,0x00,0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x7C,0x00,0x00,/*"l",76*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0x49,0x49,0x49,0x49,0x49,0xED,0x00,0x00,/*"m",77*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xDC,0x62,0x42,0x42,0x42,0x42,0xE7,0x00,0x00,/*"n",78*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x42,0x42,0x42,0x42,0x42,0x3C,0x00,0x00,/*"o",79*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD8,0x64,0x42,0x42,0x42,0x44,0x78,0x40,0xE0,/*"p",80*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1E,0x22,0x42,0x42,0x42,0x22,0x1E,0x02,0x07,/*"q",81*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEE,0x32,0x20,0x20,0x20,0x20,0xF8,0x00,0x00,/*"r",82*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0x42,0x40,0x3C,0x02,0x42,0x7C,0x00,0x00,/*"s",83*/ + 0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x7C,0x10,0x10,0x10,0x10,0x10,0x0C,0x00,0x00,/*"t",84*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC6,0x42,0x42,0x42,0x42,0x46,0x3B,0x00,0x00,/*"u",85*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x10,0x10,0x00,0x00,/*"v",86*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD7,0x92,0x92,0xAA,0xAA,0x44,0x44,0x00,0x00,/*"w",87*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6E,0x24,0x18,0x18,0x18,0x24,0x76,0x00,0x00,/*"x",88*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xE7,0x42,0x24,0x24,0x28,0x18,0x10,0x10,0xE0,/*"y",89*/ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0x44,0x08,0x10,0x10,0x22,0x7E,0x00,0x00,/*"z",90*/ + 0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08,/*"|",91*/ + 0x30,0x4C,0x43,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"~",92*/ +}; + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_animation.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_animation.c new file mode 100644 index 0000000..6fb9a95 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_animation.c @@ -0,0 +1,213 @@ +/** + ***************************************************************************************** + * + * @file gui_animation.c + * + * @brief Animation Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_animation.h" +#include +#include + +#if ANIMATION_EN==1 + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static uint8_t all_move_frame = GUI_X_MOVE_FRAME; +static animation_stop_handle_t now_animation_stop_call; +static animation_type_t now_animation_type = MOVE_LEFT; +static uint8_t now_animation_frame = 0; +static bool start_animation_flag = false; + +static T_COLOR (*gui_display_ram)[GUI_DISPLAY_X_MAX]; +static T_COLOR (*gui_display_buffer)[GUI_DISPLAY_X_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ + /** + ***************************************************************************************** + * @brief Move up animation + * + * @param[in] frame move frame. + ***************************************************************************************** + */ +static void gui_animation_move_up(uint8_t frame) +{ + uint8_t y; + for(y=0; y<(GUI_Y_MOVE_FRAME-1); y++) + { + memcpy(&gui_display_ram[y*GUI_Y_MOVE_PIXEL], &gui_display_ram[(y+1)*GUI_Y_MOVE_PIXEL], GUI_DISPLAY_X_MAX*2*GUI_Y_MOVE_PIXEL); + } + memcpy(&gui_display_ram[GUI_DISPLAY_Y_MAX-1-GUI_Y_MOVE_PIXEL], &gui_display_buffer[frame*GUI_Y_MOVE_PIXEL], GUI_DISPLAY_X_MAX*2*GUI_Y_MOVE_PIXEL); +} + + /** + ***************************************************************************************** + * @brief Move down animation + * + * @param[in] frame move frame. + ***************************************************************************************** + */ +static void gui_animation_move_down(uint8_t frame) +{ + uint8_t y; + for(y=GUI_Y_MOVE_FRAME-1; y>0; y--) + { + memcpy(&gui_display_ram[y*GUI_Y_MOVE_PIXEL], &gui_display_ram[(y-1)*GUI_Y_MOVE_PIXEL], GUI_DISPLAY_X_MAX*2*GUI_Y_MOVE_PIXEL); + } + memcpy(&gui_display_ram[0], &gui_display_buffer[(GUI_Y_MOVE_FRAME-1-frame)*GUI_Y_MOVE_PIXEL], GUI_DISPLAY_X_MAX*2*GUI_Y_MOVE_PIXEL); +} + + /** + ***************************************************************************************** + * @brief Move left animation + * + * @param[in] frame move frame. + ***************************************************************************************** + */ +static void gui_animation_move_left(uint8_t frame) +{ + uint16_t x,y; + + for(y=0; y0; x--) + { + memcpy(&gui_display_ram[y][x*GUI_X_MOVE_PIXEL], &gui_display_ram[y][(x-1)*GUI_X_MOVE_PIXEL], GUI_X_MOVE_PIXEL*2); + } + } + + for(y=0; y + + +uint32_t gui_pow(uint32_t m,uint8_t n) +{ + uint32_t result = 1; + while (n--)result *= m; + return result; +} + + +void gui_line_hor(uint16_t x0, uint8_t y0, uint16_t x1, T_COLOR color) +{ + uint8_t temp; + if(x0>x1) + { + temp = x1; + x1 = x0; + x0 = temp; + } + do + { + gui_point(x0, y0, color); + x0++; + } + while(x1>=x0); +} + + +void gui_line_ver(uint16_t x0, uint8_t y0, uint8_t y1, T_COLOR color) +{ + uint8_t temp; + if(y0>y1) + { + temp = y1; + y1 = y0; + y0 = temp; + } + do + { + gui_point(x0, y0, color); + y0++; + } + while(y1>=y0); +} + +void gui_rectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color) +{ gui_line_hor(x0, y0, x1, color); + gui_line_hor(x0, y1, x1, color); + gui_line_ver(x0, y0, y1, color); + gui_line_ver(x1, y0, y1, color); +} + + +void gui_rectangle_fill(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color) +{ + uint16_t i; + if(x0>x1) + { i = x0; + x0 = x1; + x1 = i; + } + if(y0>y1) + { i = y0; + y0 = y1; + y1 = i; + } + + if(y0==y1) + { gui_line_hor(x0, y0, x1, color); + return; + } + if(x0==x1) + { gui_line_ver(x0, y0, y1, color); + return; + } + + while(y0<=y1) + { gui_line_hor(x0, y0, x1, color); + y0++; + } +} + + +void gui_square(uint16_t x0, uint16_t y0, uint16_t with, T_COLOR color) +{ if(with==0) return; + if( (x0+with) > GUI_DISPLAY_X_MAX ) return; + if( (y0+with) > GUI_DISPLAY_Y_MAX ) return; + gui_rectangle(x0, y0, x0+with, y0+with, color); +} + + +void gui_line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color) +{ int16_t dx; + int16_t dy; + int8_t dx_sym; + int8_t dy_sym; + int16_t dx_x2; + int16_t dy_x2; + int16_t di; + + + dx = x1-x0; + dy = y1-y0; + + + if(dx>0) + { dx_sym = 1; + } + else + { if(dx<0) + { dx_sym = -1; + } + else + { + gui_line_ver(x0, y0, y1, color); + return; + } + } + + if(dy>0) + { dy_sym = 1; + } + else + { if(dy<0) + { dy_sym = -1; + } + else + { + gui_line_hor(x0, y0, x1, color); + return; + } + } + + + dx = dx_sym * dx; + dy = dy_sym * dy; + + + dx_x2 = dx*2; + dy_x2 = dy*2; + + /* Bresenham draw line */ + if(dx>=dy) + { di = dy_x2 - dx; + while(x0!=x1) + { gui_point(x0, y0, color); + x0 += dx_sym; + if(di<0) + { di += dy_x2; + } + else + { di += dy_x2 - dx_x2; + y0 += dy_sym; + } + } + gui_point(x0, y0, color); + } + else + { di = dx_x2 - dy; + while(y0!=y1) + { gui_point(x0, y0, color); + y0 += dy_sym; + if(di<0) + { di += dx_x2; + } + else + { di += dx_x2 - dy_x2; + x0 += dx_sym; + } + } + gui_point(x0, y0, color); + } + +} + + +void gui_line_width(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t width, T_COLOR color) +{ int16_t dx; + int16_t dy; + int8_t dx_sym; + int8_t dy_sym; + int16_t dx_x2; + int16_t dy_x2; + int16_t di; + + int16_t wx, wy; + int16_t draw_a, draw_b; + + + if(width==0) return; + if(width>50) width = 50; + + dx = x1-x0; + dy = y1-y0; + + wx = width/2; + wy = width-wx-1; + + + if(dx>0) + { dx_sym = 1; + } + else + { if(dx<0) + { dx_sym = -1; + } + else + { + wx = x0-wx; + if(wx<0) wx = 0; + wy = x0+wy; + + while(1) + { x0 = wx; + gui_line_ver(x0, y0, y1, color); + if(wx>=wy) break; + wx++; + } + return; + } + } + + if(dy>0) + { dy_sym = 1; + } + else + { if(dy<0) + { dy_sym = -1; + } + else + { + wx = y0-wx; + if(wx<0) wx = 0; + wy = y0+wy; + + while(1) + { + y0 = wx; + gui_line_hor(x0, y0, x1, color); + if(wx>=wy) break; + wx++; + } + return; + } + } + + + dx = dx_sym * dx; + dy = dy_sym * dy; + + + dx_x2 = dx*2; + dy_x2 = dy*2; + + + if(dx>=dy) + { di = dy_x2 - dx; + while(x0!=x1) + { + draw_a = y0-wx; + if(draw_a<0) draw_a = 0; + draw_b = y0+wy; + gui_line_ver(x0, draw_a, draw_b, color); + + x0 += dx_sym; + if(di<0) + { di += dy_x2; + } + else + { di += dy_x2 - dx_x2; + y0 += dy_sym; + } + } + draw_a = y0-wx; + if(draw_a<0) draw_a = 0; + draw_b = y0+wy; + gui_line_ver(x0, draw_a, draw_b, color); + } + else + { di = dx_x2 - dy; + while(y0!=y1) + { + draw_a = x0-wx; + if(draw_a<0) draw_a = 0; + draw_b = x0+wy; + gui_line_hor(draw_a, y0, draw_b, color); + + y0 += dy_sym; + if(di<0) + { di += dx_x2; + } + else + { di += dx_x2 - dy_x2; + x0 += dx_sym; + } + } + draw_a = x0-wx; + if(draw_a<0) draw_a = 0; + draw_b = x0+wy; + gui_line_hor(draw_a, y0, draw_b, color); + } +} + + + +void gui_line_s(uint16_t const *points, uint8_t no, T_COLOR color) +{ uint16_t x0, y0; + uint16_t x1, y1; + uint8_t i; + + + if(0==no) return; + if(1==no) + { x0 = *points++; + y0 = *points; + gui_point(x0, y0, color); + } + + + x0 = *points++; + y0 = *points++; + for(i=1; i=0) gui_point(draw_x2, draw_y2, color); + + + draw_x4 = draw_x6 = x0 + r; + draw_y4 = draw_y6 = y0; + if(draw_x4=0) gui_point(draw_x5, draw_y5, color); + if(1==r) return; + + + + di = 3 - 2*r; + + xx = 0; + yy = r; + while(xx=0) ) + { gui_point(draw_x0, draw_y0, color); + } + if( (draw_x1>=0)&&(draw_y1>=0) ) + { gui_point(draw_x1, draw_y1, color); + } + if( (draw_x2<=GUI_DISPLAY_X_MAX)&&(draw_y2<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x2, draw_y2, color); + } + if( (draw_x3>=0)&&(draw_y3<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x3, draw_y3, color); + } + if( (draw_x4<=GUI_DISPLAY_X_MAX)&&(draw_y4>=0) ) + { gui_point(draw_x4, draw_y4, color); + } + if( (draw_x5>=0)&&(draw_y5>=0) ) + { gui_point(draw_x5, draw_y5, color); + } + if( (draw_x6<=GUI_DISPLAY_X_MAX)&&(draw_y6<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x6, draw_y6, color); + } + if( (draw_x7>=0)&&(draw_y7<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x7, draw_y7, color); + } + } +} + + +void gui_circle_fill(uint16_t x0, uint16_t y0, uint16_t r, T_COLOR color) +{ int16_t draw_x0, draw_y0; + int16_t draw_x1, draw_y1; + int16_t draw_x2, draw_y2; + int16_t draw_x3, draw_y3; + int16_t draw_x4, draw_y4; + int16_t draw_x5, draw_y5; + int16_t draw_x6, draw_y6; + int16_t draw_x7, draw_y7; + int16_t fill_x0, fill_y0; + int16_t fill_x1; + int16_t xx, yy; + + int16_t di; + + + if(0==r) return; + + draw_x0 = draw_x1 = x0; + draw_y0 = draw_y1 = y0 + r; + if(draw_y0=0) + { gui_point(draw_x2, draw_y2, color); + } + + draw_x4 = draw_x6 = x0 + r; + draw_y4 = draw_y6 = y0; + if(draw_x4=0) + { gui_point(draw_x5, draw_y5, color); + } + if(1==r) return; + + + + di = 3 - 2*r; + + xx = 0; + yy = r; + while(xx=0) ) + { gui_point(draw_x0, draw_y0, color); + } + if( (draw_x1>=0)&&(draw_y1>=0) ) + { gui_point(draw_x1, draw_y1, color); + } + + + if(draw_x1>=0) + { + fill_x0 = draw_x1; + + fill_y0 = draw_y1; + if(fill_y0>GUI_DISPLAY_Y_MAX) fill_y0 = GUI_DISPLAY_Y_MAX; + if(fill_y0<0) fill_y0 = 0; + + fill_x1 = x0*2 - draw_x1; + if(fill_x1>GUI_DISPLAY_X_MAX) fill_x1 = GUI_DISPLAY_X_MAX; + gui_line_hor(fill_x0, fill_y0, fill_x1, color); + } + + + if( (draw_x2<=GUI_DISPLAY_X_MAX)&&(draw_y2<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x2, draw_y2, color); + } + + if( (draw_x3>=0)&&(draw_y3<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x3, draw_y3, color); + } + + + if(draw_x3>=0) + { + fill_x0 = draw_x3; + + fill_y0 = draw_y3; + if(fill_y0>GUI_DISPLAY_Y_MAX) fill_y0 = GUI_DISPLAY_Y_MAX; + if(fill_y0<0) fill_y0 = 0; + + fill_x1 = x0*2 - draw_x3; + if(fill_x1>GUI_DISPLAY_X_MAX) fill_x1 = GUI_DISPLAY_X_MAX; + gui_line_hor(fill_x0, fill_y0, fill_x1, color); + } + + + if( (draw_x4<=GUI_DISPLAY_X_MAX)&&(draw_y4>=0) ) + { gui_point(draw_x4, draw_y4, color); + } + if( (draw_x5>=0)&&(draw_y5>=0) ) + { gui_point(draw_x5, draw_y5, color); + } + + + if(draw_x5>=0) + { + fill_x0 = draw_x5; + + fill_y0 = draw_y5; + if(fill_y0>GUI_DISPLAY_Y_MAX) fill_y0 = GUI_DISPLAY_Y_MAX; + if(fill_y0<0) fill_y0 = 0; + + fill_x1 = x0*2 - draw_x5; + if(fill_x1>GUI_DISPLAY_X_MAX) fill_x1 = GUI_DISPLAY_X_MAX; + gui_line_hor(fill_x0, fill_y0, fill_x1, color); + } + + + if( (draw_x6<=GUI_DISPLAY_X_MAX)&&(draw_y6<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x6, draw_y6, color); + } + + if( (draw_x7>=0)&&(draw_y7<=GUI_DISPLAY_Y_MAX) ) + { gui_point(draw_x7, draw_y7, color); + } + + + if(draw_x7>=0) + { + fill_x0 = draw_x7; + + fill_y0 = draw_y7; + if(fill_y0>GUI_DISPLAY_Y_MAX) fill_y0 = GUI_DISPLAY_Y_MAX; + if(fill_y0<0) fill_y0 = 0; + + fill_x1 = x0*2 - draw_x7; + if(fill_x1>GUI_DISPLAY_X_MAX) fill_x1 = GUI_DISPLAY_X_MAX; + gui_line_hor(fill_x0, fill_y0, fill_x1, color); + } + + } +} + + + +void gui_ellipse(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1, T_COLOR color) +{ int16_t draw_x0, draw_y0; + int16_t draw_x1, draw_y1; + int16_t draw_x2, draw_y2; + int16_t draw_x3, draw_y3; + int16_t xx, yy; + + int16_t center_x, center_y; + int16_t radius_x, radius_y; + int16_t radius_xx, radius_yy; + int16_t radius_xx2, radius_yy2; + int16_t di; + + + if( (x0==x1) || (y0==y1) ) return; + + + center_x = (x0 + x1) >> 1; + center_y = (y0 + y1) >> 1; + + + if(x0 > x1) + { radius_x = (x0 - x1) >> 1; + } + else + { radius_x = (x1 - x0) >> 1; + } + if(y0 > y1) + { radius_y = (y0 - y1) >> 1; + } + else + { radius_y = (y1 - y0) >> 1; + } + + + radius_xx = radius_x * radius_x; + radius_yy = radius_y * radius_y; + + + radius_xx2 = radius_xx<<1; + radius_yy2 = radius_yy<<1; + + + xx = 0; + yy = radius_y; + + di = radius_yy2 + radius_xx - radius_xx2*radius_y ; + + + draw_x0 = draw_x1 = draw_x2 = draw_x3 = center_x; + draw_y0 = draw_y1 = center_y + radius_y; + draw_y2 = draw_y3 = center_y - radius_y; + + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x2, draw_y2, color); + + while( (radius_yy*xx) < (radius_xx*yy) ) + { if(di<0) + { di+= radius_yy2*(2*xx+3); + } + else + { di += radius_yy2*(2*xx+3) + 4*radius_xx - 4*radius_xx*yy; + + yy--; + draw_y0--; + draw_y1--; + draw_y2++; + draw_y3++; + } + + xx ++; + + draw_x0++; + draw_x1--; + draw_x2++; + draw_x3--; + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x1, draw_y1, color); + gui_point(draw_x2, draw_y2, color); + gui_point(draw_x3, draw_y3, color); + } + + di = radius_xx2*(yy-1)*(yy-1) + radius_yy2*xx*xx + radius_yy + radius_yy2*xx - radius_xx2*radius_yy; + while(yy>=0) + { if(di<0) + { di+= radius_xx2*3 + 4*radius_yy*xx + 4*radius_yy - 2*radius_xx2*yy; + + xx ++; + draw_x0++; + draw_x1--; + draw_x2++; + draw_x3--; + } + else + { di += radius_xx2*3 - 2*radius_xx2*yy; + } + + yy--; + draw_y0--; + draw_y1--; + draw_y2++; + draw_y3++; + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x1, draw_y1, color); + gui_point(draw_x2, draw_y2, color); + gui_point(draw_x3, draw_y3, color); + } +} + + +void gui_ellipse_fill(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1, T_COLOR color) +{ int16_t draw_x0, draw_y0; + int16_t draw_x1, draw_y1; + int16_t draw_x2, draw_y2; + int16_t draw_x3, draw_y3; + int16_t xx, yy; + + int16_t center_x, center_y; + int16_t radius_x, radius_y; + int16_t radius_xx, radius_yy; + int16_t radius_xx2, radius_yy2; + int16_t di; + + + if( (x0==x1) || (y0==y1) ) return; + + + center_x = (x0 + x1) >> 1; + center_y = (y0 + y1) >> 1; + + + if(x0 > x1) + { radius_x = (x0 - x1) >> 1; + } + else + { radius_x = (x1 - x0) >> 1; + } + if(y0 > y1) + { radius_y = (y0 - y1) >> 1; + } + else + { radius_y = (y1 - y0) >> 1; + } + + + radius_xx = radius_x * radius_x; + radius_yy = radius_y * radius_y; + + + radius_xx2 = radius_xx<<1; + radius_yy2 = radius_yy<<1; + + + xx = 0; + yy = radius_y; + + di = radius_yy2 + radius_xx - radius_xx2*radius_y ; + + + draw_x0 = draw_x1 = draw_x2 = draw_x3 = center_x; + draw_y0 = draw_y1 = center_y + radius_y; + draw_y2 = draw_y3 = center_y - radius_y; + + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x2, draw_y2, color); + + while( (radius_yy*xx) < (radius_xx*yy) ) + { if(di<0) + { di+= radius_yy2*(2*xx+3); + } + else + { di += radius_yy2*(2*xx+3) + 4*radius_xx - 4*radius_xx*yy; + + yy--; + draw_y0--; + draw_y1--; + draw_y2++; + draw_y3++; + } + + xx ++; + + draw_x0++; + draw_x1--; + draw_x2++; + draw_x3--; + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x1, draw_y1, color); + gui_point(draw_x2, draw_y2, color); + gui_point(draw_x3, draw_y3, color); + + + if(di>=0) + { gui_line_hor(draw_x0, draw_y0, draw_x1, color); + gui_line_hor(draw_x2, draw_y2, draw_x3, color); + } + } + + di = radius_xx2*(yy-1)*(yy-1) + radius_yy2*xx*xx + radius_yy + radius_yy2*xx - radius_xx2*radius_yy; + while(yy>=0) + { if(di<0) + { di+= radius_xx2*3 + 4*radius_yy*xx + 4*radius_yy - 2*radius_xx2*yy; + + xx ++; + draw_x0++; + draw_x1--; + draw_x2++; + draw_x3--; + } + else + { di += radius_xx2*3 - 2*radius_xx2*yy; + } + + yy--; + draw_y0--; + draw_y1--; + draw_y2++; + draw_y3++; + + gui_point(draw_x0, draw_y0, color); + gui_point(draw_x1, draw_y1, color); + gui_point(draw_x2, draw_y2, color); + gui_point(draw_x3, draw_y3, color); + + + gui_line_hor(draw_x0, draw_y0, draw_x1, color); + gui_line_hor(draw_x2, draw_y2, draw_x3, color); + } +} + + +void gui_arc4(uint16_t x, uint16_t y, uint16_t r, uint8_t angle, T_COLOR color) +{ int16_t draw_x, draw_y; + + int16_t op_x, op_y; + int16_t op_2rr; + + if(r==0) return; + + op_2rr = 2*r*r; + + switch(angle) + { case 1: + draw_x = x+r; + draw_y = y; + + op_x = r; + op_y = 0; + + while(1) + { gui_point(draw_x, draw_y, color); + + + op_y++; + draw_y++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x--; + } + if(op_y>=op_x) break; + } + while(1) + { gui_point(draw_x, draw_y, color); + + op_x--; + draw_x--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y++; + } + if(op_x<=0) + { gui_point(draw_x, draw_y, color); + break; + } + } + + break; + + case 2: + draw_x = x-r; + draw_y = y; + + op_x = r; + op_y = 0; + + while(1) + { gui_point(draw_x, draw_y, color); + + op_y++; + draw_y++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x++; + } + if(op_y>=op_x) break; + } + while(1) + { gui_point(draw_x, draw_y, color); + + op_x--; + draw_x++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y++; + } + if(op_x<=0) + { gui_point(draw_x, draw_y, color); + break; + } + } + + break; + + case 3: + draw_x = x-r; + draw_y = y; + + op_x = r; + op_y = 0; + + while(1) + { gui_point(draw_x, draw_y, color); + + op_y++; + draw_y--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x++; + } + if(op_y>=op_x) break; + } + while(1) + { gui_point(draw_x, draw_y, color); + + op_x--; + draw_x++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y--; + } + if(op_x<=0) + { gui_point(draw_x, draw_y, color); + break; + } + } + + break; + + case 4: + draw_x = x+r; + draw_y = y; + + op_x = r; + op_y = 0; + + while(1) + { gui_point(draw_x, draw_y, color); + + op_y++; + draw_y--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x--; + } + if(op_y>=op_x) break; + } + while(1) + { gui_point(draw_x, draw_y, color); + + op_x--; + draw_x--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y--; + } + if(op_x<=0) + { gui_point(draw_x, draw_y, color); + break; + } + } + break; + + default: + break; + + } + +} + +void gui_arc(uint16_t x, uint16_t y, uint16_t r, uint16_t stangle, uint16_t endangle, T_COLOR color) +{ int16_t draw_x, draw_y; + int16_t op_x, op_y; + int16_t op_2rr; + + int16_t pno_angle; + uint8_t draw_on; + + if(r==0) return; + if(stangle==endangle) return; + if( (stangle>=360) || (endangle>=360) ) return; + + op_2rr = 2*r*r; + pno_angle = 0; + + op_x = r; + op_y = 0; + while(1) + { pno_angle++; + op_y++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + } + if(op_y>=op_x) break; + } + + draw_on = 0; + + if(endangle>stangle) draw_on = 1; + stangle = (360-stangle)*pno_angle/45; + endangle = (360-endangle)*pno_angle/45; + if(stangle==0) stangle=1; + if(endangle==0) endangle=1; + + pno_angle = 0; + + draw_x = x+r; + draw_y = y; + op_x = r; + op_y = 0; + while(1) + { + op_y++; + draw_y--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x--; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + if(op_y>=op_x) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + while(1) + { + op_x--; + draw_x--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y--; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + + if(op_x<=0) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + + draw_y = y-r; + draw_x = x; + op_y = r; + op_x = 0; + while(1) + { + op_x++; + draw_x--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_y +1)>0 ) + { op_y--; + draw_y++; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + + if(op_x>=op_y) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + while(1) + { + op_y--; + draw_y++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_x +1)<=0 ) + { op_x++; + draw_x--; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + if(op_y<=0) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + draw_x = x-r; + draw_y = y; + op_x = r; + op_y = 0; + while(1) + { + op_y++; + draw_y++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_x +1)>0 ) + { op_x--; + draw_x++; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + if(op_y>=op_x) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + while(1) + { + op_x--; + draw_x++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_y +1)<=0 ) + { op_y++; + draw_y++; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + + if(op_x<=0) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + draw_y = y+r; + draw_x = x; + op_y = r; + op_x = 0; + while(1) + { + op_x++; + draw_x++; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr - 2*op_y +1)>0 ) + { op_y--; + draw_y--; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + + if(op_x>=op_y) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + + while(1) + { + op_y--; + draw_y--; + if( (2*op_x*op_x + 2*op_y*op_y - op_2rr + 2*op_x +1)<=0 ) + { op_x++; + draw_x++; + } + if(draw_on==1) gui_point(draw_x, draw_y, color); + pno_angle++; + if( (pno_angle==stangle)||(pno_angle==endangle) ) + { draw_on = 1-draw_on; + if(draw_on==1) gui_point(draw_x, draw_y, color); + } + if(op_y<=0) + { if(draw_on==1) gui_point(draw_x, draw_y, color); + break; + } + } + +} + + + + + + + + + + + + + + + + + + + + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_basic.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_basic.h new file mode 100644 index 0000000..af87afa --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_basic.h @@ -0,0 +1,225 @@ +/** + ***************************************************************************************** + * + * @file gui_basic.h + * + * @brief Gui basic function API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +#ifndef GUI_BASIC_H +#define GUI_BASIC_H + +#include "gui_config.h" + + +uint32_t gui_pow(uint32_t m,uint8_t n); + +/** + ***************************************************************************************** + * @brief Draw a horizontal line. + * + * @param[in] x0: X coordinate at the beginning of the horizontal line. + * @param[in] y0: Y coordinate at the beginning of the horizontal line. + * @param[in] x1: X coordinate at the end of the horizontal line. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_line_hor(uint16_t x0, uint8_t y0, uint16_t x1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a vertical line. + * + * @param[in] x0: X coordinate at the beginning of the vertical line. + * @param[in] y0: Y coordinate at the beginning of the vertical line. + * @param[in] x1: X coordinate at the end of the vertical line. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_line_ver(uint16_t x0, uint8_t y0, uint8_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a rectangle. + * + * @param[in] x0: The x coordinate of the upper-left corner of the rectangle. + * @param[in] y0: The y coordinate of the upper-left corner of the rectangle. + * @param[in] x1: The x coordinate of the bottom right corner of the rectangle. + * @param[in] y1: The y coordinate of the bottom right corner of the rectangle. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_rectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a filled rectangle. + * + * @param[in] x0: The x coordinate of the upper-left corner of the rectangle. + * @param[in] y0: The y coordinate of the upper-left corner of the rectangle. + * @param[in] x1: The x coordinate of the bottom right corner of the rectangle. + * @param[in] y1: The y coordinate of the bottom right corner of the rectangle. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_rectangle_fill(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a square. + * + * @param[in] x0: The x coordinate of the upper-left corner of the rectangle. + * @param[in] y0: The y coordinate of the upper-left corner of the rectangle. + * @param[in] with: With of square. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_square(uint16_t x0, uint16_t y0, uint16_t with, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a line between any two points. + * + * @param[in] x0: The x coordinate of the starting of the line. + * @param[in] y0: The y coordinate of the starting of the line. + * @param[in] x1: The x coordinate of the end of the line. + * @param[in] y1: The y coordinate of the end of the line. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_line(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a line between any two points and can set width. + * + * @param[in] x0: The x coordinate of the starting of the line. + * @param[in] y0: The y coordinate of the starting of the line. + * @param[in] x1: The x coordinate of the end of the line. + * @param[in] y1: The y coordinate of the end of the line. + * @param[in] width: Line width. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_line_width(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint8_t width, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a line of points. + * + * @param[in] points: line points. + * @param[in] no: count of points. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_line_s(uint16_t const *points, uint8_t no, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a circle. + * + * @param[in] x0: The x coordinate of the center of the circle. + * @param[in] y0: The y coordinate of the center of the circle. + * @param[in] r: The radius of the circle + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_circle(uint16_t x0, uint16_t y0, uint16_t r, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a fill circle. + * + * @param[in] x0: The x coordinate of the center of the circle. + * @param[in] y0: The y coordinate of the center of the circle. + * @param[in] r: The radius of the circle + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_circle_fill(uint16_t x0, uint16_t y0, uint16_t r, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a ellipse. + * + * @param[in] x0: The x coordinate of the left of the ellipse. + * @param[in] x1: The x coordinate on the right of the ellipse. + * @param[in] y0: The y coordinate on the up of the ellipse. + * @param[in] y1: The y coordinate on the down of the ellipse. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_ellipse(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a fill ellipse. + * + * @param[in] x0: The x coordinate of the left of the ellipse. + * @param[in] x1: The x coordinate on the right of the ellipse. + * @param[in] y0: The y coordinate on the up of the ellipse. + * @param[in] y1: The y coordinate on the down of the ellipse. + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_ellipse_fill(uint16_t x0, uint16_t x1, uint16_t y0, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a arc. + * @note The angle must be 0,90,-90,-180,180,-270,270 + * + * @param[in] x: The x coordinate of the center of the arc. + * @param[in] y: The y coordinate of the center of the arc. + * @param[in] r: The radius of the arc + * @param[in] angle: The angle of the arc + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_arc4(uint16_t x, uint16_t y, uint16_t r, uint8_t angle, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a any angle arc. + * + * @param[in] x: The x coordinate of the center of the arc. + * @param[in] y: The y coordinate of the center of the arc. + * @param[in] r: The radius of the arc + * @param[in] stangle: Start angle of the arc + * @param[in] endangle: End angle of the arc + * @param[in] color: Display color. + ***************************************************************************************** + */ +void gui_arc(uint16_t x, uint16_t y, uint16_t r, uint16_t stangle, uint16_t endangle, T_COLOR color); + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_color.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_color.c new file mode 100644 index 0000000..3d59954 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_color.c @@ -0,0 +1,99 @@ +/** + **************************************************************************************** + * + * @file gui_color.c + * + * @brief Function of set color + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_color.h" +#include "gui_config.h" + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint8_t const DCB2HEX_TAB[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; +static T_COLOR s_disp_color;/**< Display color. */ +static T_COLOR s_back_color;/**< Back color. */ + + +uint8_t gui_dcb_to_hex(uint8_t dcb) +{ + return DCB2HEX_TAB[dcb]; +} + +void gui_set_color(T_COLOR disp_color, T_COLOR back_color) +{ + s_disp_color = disp_color; + s_back_color = back_color; +} + +T_COLOR gui_get_back_color(void) +{ + return s_back_color; +} + +T_COLOR gui_get_disp_color(void) +{ + return s_disp_color; +} + + +void gui_exchange_color(void) +{ + T_COLOR bakc; + bakc = s_disp_color; + s_disp_color = s_back_color; + s_back_color = bakc; +} + + +void gui_point_color(uint8_t x, uint8_t y, uint8_t font_dat, uint8_t num) +{ + uint8_t j; + uint8_t x_coord = x; + T_COLOR bakc; + for(j=0; j +#include + +/**@brief GUI module enable define. */ +#define FONT8x8_EN 0 +#define FONT5x7_EN 1 +#define FONT_OTHER_EN 1 +#define FONT_GB2312_EN 0 +#define CONVERT_COLOR_EN 0 +#define ANIMATION_EN 1 + +/**@brief DISPLAY param config. */ +#define T_COLOR uint16_t +#define GUI_DISPLAY_X_MAX 128 +#define GUI_DISPLAY_Y_MAX 128 + +/**** display driver config ****/ + +/** + ***************************************************************************************** + * @brief gui display init. + ***************************************************************************************** + */ +void gui_init(void); + +/** + ***************************************************************************************** + * @brief Fill Data to gui display memory. + * + * @param[in] color: Fill color. + ***************************************************************************************** + */ +void gui_fill_mem(T_COLOR color); + +/** + ***************************************************************************************** + * @brief Fill Data to gui display rectangle memory. + * + * @param[in] x0: X0 coordinate. + * @param[in] y0: Y0 coordinate. + * @param[in] x1: X1 coordinate. + * @param[in] y1: Y1 coordinate. + * @param[in] color: Fill color. + ***************************************************************************************** + */ +void gui_rectangle_fill_mem(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Draw a point to display memory. + * + * @param[in] x: X coordinate. + * @param[in] y: Y coordinate. + * @param[in] color: The color of the point. + ***************************************************************************************** + */ +void gui_point(uint16_t x, uint16_t y, T_COLOR color); + +/** + ***************************************************************************************** + * @brief Read a point from display memory. + * + * @param[in] x: X coordinate. + * @param[in] y: Y coordinate. + * + * @return The color of the read point.(Return 0xff:error) + ***************************************************************************************** + */ +T_COLOR gui_read_point(uint16_t x, uint16_t y); + +/** + ***************************************************************************************** + * @brief Set refresh flag to true. + ***************************************************************************************** + */ +void gui_refresh(void); + +/** + ***************************************************************************************** + * @brief Check if the refresh flag is true, if flag is true, refresh the gram memory data to display. + * + * @note This function should be called in main while or in timer handler + ***************************************************************************************** + */ +void gui_refresh_schedule(void); + +/** + ***************************************************************************************** + * @brief Refresh the rectangle gram memory data to display. + * + * @param[in] x0: X0 coordinate. + * @param[in] y0: Y0 coordinate. + * @param[in] x1: X1 coordinate. + * @param[in] y1: Y1 coordinate. + ***************************************************************************************** + */ +void gui_rectangle_refresh(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); + +/** + ***************************************************************************************** + * @brief If refresh gram memory to the display area + * + * @param[in] gram_enable: true -- gram memory false -- buffer memory + ***************************************************************************************** + */ +void gui_set_refresh_mem(bool gram_enable); +/*------------------------*/ + +/**** animation config ****/ +#if ANIMATION_EN==1 + +/**@brief Animation param config. */ +#define GUI_X_MOVE_PIXEL 32 +#define GUI_Y_MOVE_PIXEL 32 +#define GUI_X_MOVE_FRAME (GUI_DISPLAY_X_MAX / GUI_X_MOVE_PIXEL) +#define GUI_Y_MOVE_FRAME (GUI_DISPLAY_Y_MAX / GUI_Y_MOVE_PIXEL) + +/** + ***************************************************************************************** + * @brief start animation timer + ***************************************************************************************** + */ +void gui_animation_timer_start(void); + +/** + ***************************************************************************************** + * @brief stop animation timer + ***************************************************************************************** + */ +void gui_animation_timer_stop(void); + +#endif +/*------------------------*/ + +/**** Font GB2312 config ****/ +#if FONT_GB2312_EN==1 + +/** + ***************************************************************************************** + * @brief Reads gb2312 font data based on offset + * + * @param[in] offset: font offset + * @param[out] read_buf: Read datas + ***************************************************************************************** + */ +void gui_read_gb2312(uint32_t offset, uint8_t* read_buf); + +/** + ***************************************************************************************** + * @brief Reads ascii font data based on offset + * + * @param[in] offset: font offset + * @param[out] read_buf: Read datas + ***************************************************************************************** + */ +void gui_read_ascii(uint32_t offset, uint8_t* read_buf); +#endif + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_gb2312_config.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_gb2312_config.c new file mode 100644 index 0000000..ac4a222 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_gb2312_config.c @@ -0,0 +1,72 @@ +/** + ***************************************************************************************** + * + * @file gui_lcm_config.c + * + * @brief Users should implement the timer-related interface themselves + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_config.h" + +#if FONT_GB2312_EN==1 +#include "hal_flash.h" + +/* + * DEFINES + ***************************************************************************************** + */ +//You can convert bin files in the GUI config folder into hex files that specify flash addresses +#define GB2312_FLASH_START_ADDR (0x0103d000) /**< Flash address of gb2312 font code. */ +#define ASCII_FLASH_ADDR (0x0103d000 + 0x3FE40) /**< Flash address of ascii font code. */ + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void gui_read_gb2312(uint32_t offset, uint8_t* read_buf) +{ + hal_flash_read(GB2312_FLASH_START_ADDR + offset, read_buf, 32); +} + + +void gui_read_ascii(uint32_t offset, uint8_t* read_buf) +{ + hal_flash_read(ASCII_FLASH_ADDR + offset, read_buf, 16); +} + +#endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcd_config.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcd_config.c new file mode 100644 index 0000000..2a8c548 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcd_config.c @@ -0,0 +1,102 @@ +/** + ***************************************************************************************** + * + * @file gui_lcm_config.c + * + * @brief Users should implement the timer-related interface themselves + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "gui_config.h" +#include "st7735.h" +#include "gui_animation.h" + +static bool gui_refresh_flag = false; +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ + +void gui_init(void) +{ + lcd_init(); + gui_animation_init(g_lcd_gram, g_lcd_buffer); +} + +void gui_fill_mem(T_COLOR color) +{ + lcd_fill_mem(color); +} + +void gui_rectangle_fill_mem(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, T_COLOR color) +{ + lcd_rectangle_fill_mem(x0, y0, x1, y1, color); +} + +void gui_point(uint16_t x, uint16_t y, T_COLOR color) +{ + lcd_draw_point(x, y, color); +} + +T_COLOR gui_read_point(uint16_t x, uint16_t y) +{ + return lcd_read_point(x, y); +} + +void gui_refresh(void) +{ + gui_refresh_flag = true; +} + +void gui_rectangle_refresh(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) +{ + lcd_rectangle_refresh(x0, y0, x1, y1); +} + +void gui_set_refresh_mem(bool gram_set) +{ + lcd_set_memory(gram_set); +} + +void gui_refresh_schedule(void) +{ + if(gui_refresh_flag) + { + lcd_refresh(); + gui_refresh_flag = false; + } +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_cfg.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_cfg.c new file mode 100644 index 0000000..81dae52 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_cfg.c @@ -0,0 +1,104 @@ +/** + ***************************************************************************************** + * + * @file gui_lcm_config.c + * + * @brief Users should implement the timer-related interface themselves + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "gui_config.h" +#include "lcm.h" +#include "gui_animation.h" + + +extern lcm_def_t st7735_lcm_opt; +const lcm_def_t *p_lcm_opt = &st7735_lcm_opt; +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ + +void gui_init(void) +{ + p_lcm_opt->lcm_init(); + gui_animation_init(p_lcm_opt->lcm_freambuffer_draw, p_lcm_opt->lcm_freambuffer_map); +} + +void gui_fill(T_COLOR dat) +{ + p_lcm_opt->lcm_fill_color(dat); +} + +void gui_point(uint16_t x, uint16_t y, T_COLOR color) +{ + if (x >= p_lcm_opt->lcm_var.lcm_width) + return; + if (y >= p_lcm_opt->lcm_var.lcm_height) + return; + p_lcm_opt->lcm_draw_point(x, y, color); +} + +T_COLOR gui_read_point(uint16_t x, uint16_t y) +{ + if (x >= p_lcm_opt->lcm_var.lcm_width) + return 0x0; + if (y >= p_lcm_opt->lcm_var.lcm_height) + return 0x0; + return (T_COLOR)p_lcm_opt->lcm_read_point(x, y); +} + +void lcm_set_memory(lcm_memory_type_t type) +{ + //p_lcm_opt->lcm_set_buffer(type); +} + + +void gui_refresh(void) +{ + p_lcm_opt->lcm_refresh(); +} + +void gui_render(uint8_t *p_map) +{ + p_lcm_opt->lcm_render(p_map); +} + + +void lcm_load_16x32(uint8_t x,uint8_t y_page, const uint8_t(*code16_32)[16],uint8_t index) +{ + //fill it +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_config.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_config.c new file mode 100644 index 0000000..fac85a5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_lcm_config.c @@ -0,0 +1,83 @@ +/** + ***************************************************************************************** + * + * @file gui_lcm_config.c + * + * @brief Users should implement the timer-related interface themselves + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "gui_config.h" +#include "uc1701.h" +#include "gui_animation.h" + + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void gui_init(void) +{ + lcm_init(); + gui_animation_init(s_lcm_gram, s_lcm_buffer); +} + + +void gui_fill(T_COLOR dat) +{ + lcm_fill(dat); +} + + +void gui_point(uint16_t x, uint16_t y, T_COLOR color) +{ + lcm_draw_point(x, y, color); +} + + +T_COLOR gui_read_point(uint16_t x, uint16_t y) +{ + return lcm_read_point(x, y); +} + + +void gui_refresh(void) +{ + lcm_set_memory(MEM_GRAM); + lcm_refresh(); +} + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_oled_config.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_oled_config.c new file mode 100644 index 0000000..10953e3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_config/gui_oled_config.c @@ -0,0 +1,82 @@ +/** + ***************************************************************************************** + * + * @file gui_oled_config.c + * + * @brief Users should implement the timer-related interface themselves + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "gui_config.h" +#include "ssd1316.h" +#include "gui_animation.h" + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void gui_init(void) +{ + oled_init(); + gui_animation_init(s_oled_gram, s_oled_buffer); +} + + +void gui_fill(T_COLOR dat) +{ + oled_fill(dat); +} + + +void gui_point(uint16_t x, uint8_t y, T_COLOR color) +{ + oled_draw_point(x, y, color); +} + + +T_COLOR gui_read_point(uint16_t x, uint8_t y) +{ + return oled_read_point(x, y); +} + + +void gui_refresh(void) +{ + oled_set_memory(MEM_GRAM); + oled_refresh(); +} + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.c new file mode 100644 index 0000000..642495d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.c @@ -0,0 +1,179 @@ +/** + **************************************************************************************** + * + * @file gui_convert_color.c + * + * @brief Function of convert color + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_convert_color.h" +#include "gui_config.h" + +#if CONVERT_COLOR_EN==1 + +uint16_t gui_color_to_index_565(uint32_t color_rgb) +{ uint8_t r, g, b; + + b = ( color_rgb>>(0+3) ) & 0x1f; + g = ( color_rgb>>(8+2) ) & 0x3f; + r = ( color_rgb>>(16+3)) & 0x1f; + + return( (r<<11) + (g<<5) + (b<<0) ); +} + +uint32_t gui_index_to_color_565(uint16_t index) +{ uint32_t r, g, b; + + b = (index>>0) & 0x1f; + g = (index>>5) & 0x3f; + r = (index>>11) & 0x1f; + r = r * 255 / 31; + g = g * 255 / 63; + b = b * 255 / 31; + + return( (r<<16) + (g<<8) + (b<<0) ); +} + +uint16_t gui_color_to_index_555(uint32_t color_rgb) +{ uint8_t r, g, b; + + b = ( color_rgb>>(0+3) ) & 0x1f; + g = ( color_rgb>>(8+3) ) & 0x1f; + r = ( color_rgb>>(16+3)) & 0x1f; + + return( (r<<10) + (g<<5) + (b<<0) ); +} + +uint32_t gui_index_to_color_555(uint16_t index) +{ uint32_t r, g, b; + + b = (index>>0) & 0x1f; + g = (index>>5) & 0x1f; + r = (index>>10) & 0x1f; + r = r * 255 / 31; + g = g * 255 / 31; + b = b * 255 / 31; + + return( (r<<16) + (g<<8) + (b<<0) ); +} + +uint16_t gui_color_to_index_444(uint32_t color_rgb) +{ uint8_t r,g,b; + + b = ( color_rgb>>(0+4) ) & 0x0f; + g = ( color_rgb>>(8+4) ) & 0x0f; + r = ( color_rgb>>(16+4)) & 0x0f; + + return ( (r<<8) + (g << 4) + (b<<0) ); +} + +uint32_t gui_index_to_color_444(uint16_t index) +{ uint8_t r,g,b; + + b = (index >> 0) & 0x0f; + g = (index >> 4) & 0x0f; + r = (index >> 8) & 0x0f; + + r = r * 17; + g = g * 17; + b = b * 17; + + return ( (r<<16) + (g<<8) + (b<<0) ); +} + +uint8_t gui_color_to_index_332(uint32_t color_rgb) +{ uint32_t r, g, b; + + b = (color_rgb>>0) & 0xff; + g = (color_rgb>>8) & 0xff; + r = (color_rgb>>16) & 0xff; + r = (r * 7 + 127) / 255; + g = (g * 7 + 127) / 255; + b = (b + 42) / 85; + + return( (r<<5) + (g << 2) + (b<<0) ); +} + +uint32_t gui_index_to_color_332(uint8_t index) +{ uint32_t r, g, b; + + r = (index >> 5) * 255 / 7; + g = ((index >> 3) & 7) * 255 / 7; + b = (index & 3) * 85; + + return( (r<<16) + (g << 8) + (b<<0) ); +} + +uint8_t gui_color_to_index_222(uint32_t color_rgb) +{ uint32_t r, g, b; + + b = (((color_rgb>>0) &255)+0x2a)/0x55; + g = (((color_rgb>>8) &255)+0x2a)/0x55; + r = (((color_rgb>>16)&255)+0x2a)/0x55; + + return( (r<<4) + (g<<2) + (b<<0) ); +} + +uint32_t gui_index_to_color_222(uint8_t index) +{ uint8_t r, g, b; + + b = ((index>>0)&3) * 0x55; + g = ((index>>2)&3) * 0x55; + r = ((index>>4)&3) * 0x55; + + return( (r<<16) + (g<<8) + (b<<0) ); +} + +uint8_t gui_color_to_index_111(uint32_t color_rgb) +{ uint8_t r, g, b; + + b = (color_rgb>>(0+7)) &1; + g = (color_rgb>>(8+7)) &1; + r = (color_rgb>>(16+7)) &1; + + return( (r<<2) + (g<<1) + (b<<0) ); +} + +uint32_t gui_index_to_color_111(uint8_t index) +{ + uint8_t r, g, b; + b = ((index>>0)&1) * 0xff; + g = ((index>>1)&1) * 0xff; + r = ((index>>2)&1) * 0xff; + + return( (r<<16) + (g<<8) + (b<<0) ); +} +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.h new file mode 100644 index 0000000..028ae0c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_convert_color.h @@ -0,0 +1,194 @@ +/** + ***************************************************************************************** + * + * @file gui_convert_color.h + * + * @brief Convert color API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +#ifndef GUI_CONVERT_COLOR_H +#define GUI_CONVERT_COLOR_H + +#include "gui_config.h" + +#if CONVERT_COLOR_EN==1 + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 16-bit index value. + * @note The convert value applies to a 64K color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 16-bit index value(64K color, d15-d11 for R value, d10-d5 for G value, d4-d0 for B value) + ***************************************************************************************** + */ +uint16_t gui_color_to_index_565(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 16-bit index value to a RGB value. + * @note The convert value applies to a 64K color LCD screen. + * + * @param[in] index: 16 bit index value. + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_565(uint16_t index); + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 15-bit index value. + * @note The convert value applies to a 32K color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 15-bit index value. + ***************************************************************************************** + */ +uint16_t gui_color_to_index_555(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 15-bit index value to a RGB value. + * @note The convert value applies to a 32K color LCD screen. + * + * @param[in] index: 15 bit index value. + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_555(uint16_t index); + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 12-bit index value. + * @note The convert value applies to a 4096 color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 12-bit index value.(RRRRGGGGBBBB) + ***************************************************************************************** + */ +uint16_t gui_color_to_index_444(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 12-bit index value to a RGB value. + * @note The convert value applies to a 4096 color LCD screen. + * + * @param[in] index: 12 bit index value.(RRRRGGGGBBBB) + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_444(uint16_t index); + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 8-bit index value. + * @note The convert value applies to a 256 color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 8-bit index value.(RRRGGGBB) + ***************************************************************************************** + */ +uint8_t gui_color_to_index_332(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 8-bit index value to a RGB value. + * @note The convert value applies to a 256 color LCD screen. + * + * @param[in] index: 8 bit index value.(RRRGGGBB) + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_332(uint8_t index); + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 6-bit index value. + * @note The convert value applies to a 256 color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 6-bit index value.(RRGGBB) + ***************************************************************************************** + */ +uint8_t gui_color_to_index_222(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 6-bit index value to a RGB value. + * @note The convert value applies to a 64K color LCD screen. + * + * @param[in] index: 6 bit index value.(RRGGBB) + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_222(uint8_t index); + +/** + ***************************************************************************************** + * @brief Convert the RGB value to a 3-bit index value. + * @note The convert value applies to a 64 color LCD screen. + * + * @param[in] color_rgb: RGB value. + * + * @return 3-bit index value.(RGB) + ***************************************************************************************** + */ +uint8_t gui_color_to_index_111(uint32_t color_rgb); + +/** + ***************************************************************************************** + * @brief Convert the 3-bit index value to a RGB value. + * @note The convert value applies to a 64 color LCD screen. + * + * @param[in] index: 3 bit index value.(RGB) + * + * @return RGB value + ***************************************************************************************** + */ +uint32_t gui_index_to_color_111(uint8_t index); +#endif + +#endif + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font5_7.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font5_7.c new file mode 100644 index 0000000..0759388 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font5_7.c @@ -0,0 +1,1163 @@ +/** + **************************************************************************************** + * + * @file gui_font5_7.c + * + * @brief Function of show 5*7 ascii + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_font5_7.h" +#include "gui_font_macro.h" +#include "gui_color.h" +#include "gui_basic.h" + +#if FONT5x7_EN==1 + +/**@brief 5*7 ascii define. */ +const uint8_t s_ascii_font5_7[][8] = { +/* space */ + { + ________, + ________, + ________, + ________, + ________, + ________, + ________, + ________} + +/* ! */ + ,{ + X_______, + X_______, + X_______, + X_______, + X_______, + ________, + X_______, + ________} + + +/* " */ + ,{ + X_X_____, + X_X_____, + X_X_____, + ________, + ________, + ________, + ________, + ________} + +/* # */ + ,{ + _X_X____, + _X_X____, + XXXXX___, + _X_X____, + XXXXX___, + _X_X____, + _X_X____, + ________} + +/* $ */ + ,{ + __X_____, + _XXXX___, + X_X_____, + _XXX____, + __X_X___, + XXXX____, + __X_____} + +/* % */ + ,{ + XX______, + XX__X___, + ___X____, + __X_____, + _X______, + X__XX___, + ___XX___, + ________} + +/* & */ + ,{ + _XX_____, + X__X____, + X_X_____, + _X______, + X_X_X___, + X__X____, + _XX_X___, + ________} + +/* ' */ + ,{ + XX______, + _X______, + X_______, + ________, + ________, + ________, + ________, + ________} + +/* ( */ + ,{ + __X_____, + _X______, + X_______, + X_______, + X_______, + _X______, + __X_____, + ________} + +/* ) */ + ,{ + X_______, + _X______, + __X_____, + __X_____, + __X_____, + _X______, + X_______, + ________} + +/* * */ + ,{ + ________, + _X_X____, + __X_____, + XXXXX___, + __X_____, + _X_X____, + ________, + ________} + + ,{ + ________, + __X_____, + __X_____, + XXXXX___, + __X_____, + __X_____, + ________, + ________} + + ,{ + ________, + ________, + ________, + ________, + ________, + XX______, + _X______, + X_______} + + ,{ + ________, + ________, + ________, + XXXXX___, + ________, + ________, + ________, + ________} + + ,{ + ________, + ________, + ________, + ________, + ________, + XX______, + XX______, + ________} + + ,{ + ________, + ____X___, + ___X____, + __X_____, + _X______, + X_______, + ________, + ________} + +/* 0 */ + ,{ + _XXX____, + X___X___, + X__XX___, + X_X_X___, + XX__X___, + X___X___, + _XXX____, + ________} + +/* 1 */ + ,{ + __X_____, + _XX_____, + __X_____, + __X_____, + __X_____, + __X_____, + _XXX____, + ________} + +/* 2 */ + ,{ + _XXX____, + X___X___, + ____X___, + __XX____, + _X______, + X_______, + XXXXX___, + ________} + +/* 3 */ + ,{ + _XXX____, + X___X___, + ____X___, + __XX____, + ____X___, + X___X___, + _XXX____, + ________} + +/* 4 */ + ,{ + ___X____, + __XX____, + _X_X____, + X__X____, + XXXXX___, + ___X____, + ___X____, + ________} + +/* 5 */ + ,{ + XXXXX___, + X_______, + XXXX____, + ____X___, + ____X___, + X___X___, + _XXX____, + ________} + +/* 6 */ + ,{ + __XX____, + _X______, + X_______, + XXXX____, + X___X___, + X___X___, + _XXX____, + ________} + +/* 7 */ + ,{ + XXXXX___, + ____X___, + ___X____, + __X_____, + _X______, + _X______, + _X______, + ________} + +/* 8 */ + ,{ + _XXX____, + X___X___, + X___X___, + _XXX____, + X___X___, + X___X___, + _XXX____, + ________} + +/* 9 */ + ,{ + _XXX____, + X___X___, + X___X___, + _XXXX___, + ____X___, + ___X____, + _XX_____, + ________} + +/* ':' 3a */ + ,{ + ________, + XX______, + XX______, + ________, + XX______, + XX______, + ________, + ________} + +/* ';' 3b */ + ,{ + ________, + ________, + XX______, + XX______, + ________, + XX______, + _X______, + X_______} + + +/* '<' 3c */ + ,{ + ___X____, + __X_____, + _X______, + X_______, + _X______, + __X_____, + ___X____, + ________} + +/* '=' 3d */ + ,{ + ________, + ________, + XXXXX___, + ________, + XXXXX___, + ________, + ________, + ________} + +/* '>' */ + ,{ + X_______, + _X______, + __X_____, + ___X____, + __X_____, + _X______, + X_______, + ________} + +/* '?' */ + ,{ + _XXX____, + X___X___, + ____X___, + ___X____, + __X_____, + ________, + __X_____, + ________} + +/* @ */ + ,{ + _XXX____, + X___X___, + ____X___, + _XX_X___, + X_X_X___, + X_X_X___, + _XXX____, + ________} + +/* A */ + ,{ + _XXX____, + X___X___, + X___X___, + XXXXX___, + X___X___, + X___X___, + X___X___, + ________} + +/* B */ + ,{ + XXXX____, + X___X___, + X___X___, + XXXX____, + X___X___, + X___X___, + XXXX____, + ________} + +/* C */ + ,{ + _XXX____, + X___X___, + X_______, + X_______, + X_______, + X___X___, + _XXX____, + ________} + +/* D */ + ,{ + XXX_____, + X__X____, + X___X___, + X___X___, + X___X___, + X__X____, + XXX_____, + ________} + +/* E */ + ,{ + XXXXX___, + X_______, + X_______, + XXXX____, + X_______, + X_______, + XXXXX___, + ________} + +/* F */ + ,{ + XXXXX___, + X_______, + X_______, + XXXX____, + X_______, + X_______, + X_______, + ________} + +/* G */ + ,{ + _XXX____, + X___X___, + X_______, + X_______, + X__XX___, + X___X___, + _XXXX___, + ________} + +/* H */ + ,{ + X___X___, + X___X___, + X___X___, + XXXXX___, + X___X___, + X___X___, + X___X___, + ________} + +/* I */ + ,{ + XXX_____, + _X______, + _X______, + _X______, + _X______, + _X______, + XXX_____, + ________} + +/* J */ + ,{ + __XXX___, + ___X____, + ___X____, + ___X____, + ___X____, + X__X____, + _XX_____, + ________} + +/* K */ + ,{ + X___X___, + X__X____, + X_X_____, + XX______, + X_X_____, + X__X____, + X___X___, + ________} + +/* L */ + ,{ + X_______, + X_______, + X_______, + X_______, + X_______, + X_______, + XXXXX___, + ________} + +/* M */ + ,{ + X___X___, + XX_XX___, + X_X_X___, + X_X_X___, + X___X___, + X___X___, + X___X___, + ________} + +/* N */ + ,{ + X___X___, + X___X___, + XX__X___, + X_X_X___, + X__XX___, + X___X___, + X___X___, + ________} + +/* O */ + ,{ + _XXX____, + X___X___, + X___X___, + X___X___, + X___X___, + X___X___, + _XXX____, + ________} + +/* P */ + ,{ + XXXX____, + X___X___, + X___X___, + XXXX____, + X_______, + X_______, + X_______, + ________} + +/* Q */ + ,{ + _XXX____, + X___X___, + X___X___, + X___X___, + X_X_X___, + X__X____, + _XX_X___, + ________} + +/* R */ + ,{ + XXXX____, + X___X___, + X___X___, + XXXX____, + X_X_____, + X__X____, + X___X___, + ________} + +/* S */ + ,{ + _XXX____, + X___X___, + X_______, + _XXX____, + ____X___, + X___X___, + _XXX____, + ________} + +/* T */ + ,{ + XXXXX___, + __X_____, + __X_____, + __X_____, + __X_____, + __X_____, + __X_____, + ________} + +/* U */ + ,{ + X___X___, + X___X___, + X___X___, + X___X___, + X___X___, + X___X___, + _XXX____, + ________} + +/* V */ + ,{ + X___X___, + X___X___, + X___X___, + X___X___, + X___X___, + _X_X____, + __X_____, + ________} + +/* W */ + ,{ + X___X___, + X___X___, + X___X___, + X_X_X___, + X_X_X___, + X_X_X___, + _X_X____, + ________} + +/* X */ + ,{ + X___X___, + X___X___, + _X_X____, + __X_____, + _X_X____, + X___X___, + X___X___, + ________} + +/* Y */ + ,{ + X___X___, + X___X___, + _X_X____, + __X_____, + __X_____, + __X_____, + __X_____, + ________} + +/* Z */ + ,{ + XXXXX___, + ____X___, + ___X____, + __X_____, + _X______, + X_______, + XXXXX___, + ________} + +/* 5b */ + ,{ + XXX_____, + X_______, + X_______, + X_______, + X_______, + X_______, + XXX_____, + ________} + +/* 5c */ + ,{ + ________, + X_______, + _X______, + __X_____, + ___X____, + ____X___, + ________, + ________} + +/* 5d */ + ,{ + XXX_____, + __X_____, + __X_____, + __X_____, + __X_____, + __X_____, + XXX_____, + ________} + +/* 5e */ + ,{ + __X_____, + _X_X____, + X___X___, + ________, + ________, + ________, + ________, + ________} + +/* 5f */ + ,{ + ________, + ________, + ________, + ________, + ________, + ________, + ________, + XXXXX___} + +/* 60 */ + ,{ + X_______, + _X______, + __X_____, + ________, + ________, + ________, + ________, + ________} + +/* a */ + ,{ + ________, + ________, + _XXX____, + ____X___, + _XXXX___, + X___X___, + _XXXX___, + ________} + +/* b */ + ,{ + X_______, + X_______, + X_XX____, + XX__X___, + X___X___, + X___X___, + XXXX____, + ________} + +/* c */ + ,{ + ________, + ________, + _XX_____, + X__X____, + X_______, + X__X____, + _XX_____, + ________} + +/* d */ + ,{ + ____X___, + ____X___, + _XX_X___, + X__XX___, + X___X___, + X___X___, + _XXXX___, + ________} + +/* e */ + ,{ + ________, + ________, + _XXX____, + X___X___, + XXXXX___, + X_______, + _XXX____, + ________} + +/* f */ + ,{ + __X_____, + _X_X____, + _X______, + XXX_____, + _X______, + _X______, + _X______, + ________} + +/* g */ + ,{ + ________, + ________, + _XXXX___, + X___X___, + X___X___, + _XXXX___, + ____X___, + _XXX____} + +/* h */ + ,{ + X_______, + X_______, + X_XX____, + XX__X___, + X___X___, + X___X___, + X___X___, + ________} + +/* i */ + ,{ + _X______, + ________, + _X______, + _X______, + _X______, + _X______, + _X______, + ________} + +/* j */ + ,{ + __X_____, + ________, + _XX_____, + __X_____, + __X_____, + __X_____, + __X_____, + XX______} + +/* k */ + ,{ + X_______, + X_______, + X__X____, + X_X_____, + XX______, + X_X_____, + X__X____, + ________} + +/* l */ + ,{ + XX______, + _X______, + _X______, + _X______, + _X______, + _X______, + XXX_____, + ________} + +/* m */ + ,{ + ________, + ________, + XX_X____, + X_X_X___, + X_X_X___, + X___X___, + X___X___, + ________} + +/* n */ + ,{ + ________, + ________, + X_XX____, + XX_X____, + X__X____, + X__X____, + X__X____, + ________} + +/* o */ + ,{ + ________, + ________, + _XX_____, + X__X____, + X__X____, + X__X____, + _XX_____, + ________} + +/* p */ + ,{ + ________, + ________, + XXX_____, + X__X____, + X__X____, + XXX_____, + X_______, + X_______} + +/* q */ + ,{ + ________, + ________, + _XXX____, + X__X____, + X__X____, + _XXX____, + ___X____, + ___X____} + +/* r */ + ,{ + ________, + ________, + _X_X____, + _XX_____, + _X______, + _X______, + _X______, + ________} + +/* s */ + ,{ + ________, + ________, + _XXX____, + X_______, + _XX_____, + ___X____, + XXX_____, + ________} + +/* t */ + ,{ + _X______, + _X______, + XXX_____, + _X______, + _X______, + _X______, + _XX_____, + ________} + +/* u */ + ,{ + ________, + ________, + X__X____, + X__X____, + X__X____, + X__X____, + _XXX____, + ________} + +/* v */ + ,{ + ________, + ________, + X___X___, + X___X___, + X___X___, + _X_X____, + __X_____, + ________} + +/* w */ + ,{ + ________, + ________, + X___X___, + X___X___, + X_X_X___, + X_X_X___, + _X_X____, + ________} + +/* X */ + ,{ + ________, + ________, + X___X___, + _X_X____, + __X_____, + _X_X____, + X___X___, + ________} + +/* y */ + ,{ + ________, + ________, + X__X____, + X__X____, + X__X____, + _XXX____, + ___X____, + _XX_____} + +/* z */ + ,{ + ________, + ________, + XXXXX___, + ___X____, + __X_____, + _X______, + XXXXX___, + ________} + +/* 0x7b */ + ,{ + __X_____, + _X______, + _X______, + X_______, + _X______, + _X______, + __X_____, + ________} + +/* 0x7c */ + ,{ + _X______, + _X______, + _X______, + _X______, + _X______, + _X______, + _X______, + ________} + +/* 0x7d */ + ,{ + X_______, + _X______, + _X______, + __X_____, + _X______, + _X______, + X_______, + ________} + +/* 0x7e */ + ,{ + _XX_X___, + X__X____, + ________, + ________, + ________, + ________, + ________, + ________} + +/* 0x7f */ + ,{ + XXXXX___, + XXXXX___, + XXXXX___, + XXXXX___, + XXXXX___, + XXXXX___, + XXXXX___, + ________} + +}; + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +uint8_t gui_put_char5_7(uint16_t x, uint16_t y, uint8_t ch) +{ + uint8_t i; + if( x>(GUI_DISPLAY_X_MAX-8) ) + return(0); + if( y>(GUI_DISPLAY_Y_MAX-8) ) + return(0); + if( (ch<0x20) || (ch>0x7f) ) + ch = 0x20; + + ch -= 0x20; + for(i=0; i<8; i++) + { + gui_point_color(x, y, s_ascii_font5_7[ch][i], 6); + y++; + } + + return(1); +} + + + +void gui_put_string5_7(uint16_t x, uint16_t y, char *p_str) +{ + while(1) + { + if( (*p_str)=='\0' ) break; + if( gui_put_char5_7(x, y, *p_str++)==0 ) break; + x += 6; + } +} + +void gui_put_num5_7(uint16_t x, uint16_t y, uint32_t num, uint8_t len, uint8_t mode) +{ + uint8_t t,temp; + uint8_t enshow = 0; + for(t=0; t */ + ,{ + _XX_____, + __XX____, + ___XX___, + ____XX__, + ___XX___, + __XX____, + _XX_____, + ________} + +/* ? */ + ,{ + _XXXXX__, + XX___XX_, + ____XX__, + ___XX___, + ___XX___, + ________, + ___XX___, + ________} + +/* @ */ + ,{ + _XXXXX__, + XX___XX_, + XX_XXXX_, + XX_XXXX_, + XX_XXXX_, + XX______, + _XXXX___, + ________} + +/* A */ + ,{ + __XXX___, + _XX_XX__, + XX___XX_, + XXXXXXX_, + XX___XX_, + XX___XX_, + XX___XX_, + ________} + +/* B */ + ,{ + XXXXXX__, + _XX__XX_, + _XX__XX_, + _XXXXX__, + _XX__XX_, + _XX__XX_, + XXXXXX__, + ________} + +/* C */ + ,{ + __XXXX__, + _XX__XX_, + XX______, + XX______, + XX______, + _XX__XX_, + __XXXX__, + ________} + +/* D */ + ,{ + XXXXX___, + _XX_XX__, + _XX__XX_, + _XX__XX_, + _XX__XX_, + _XX_XX__, + XXXXX___, + ________} + +/* E */ + ,{ + XXXXXXX_, + _XX___X_, + _XX_X___, + _XXXX___, + _XX_X___, + _XX___X_, + XXXXXXX_, + ________} + +/* F */ + ,{ + XXXXXXX_, + _XX___X_, + _XX_X___, + _XXXX___, + _XX_X___, + _XX_____, + XXXX____, + ________} + +/* G */ + ,{ + __XXXX__, + _XX__XX_, + XX______, + XX______, + XX__XXX_, + _XX__XX_, + __XXX_X_, + ________} + +/* H */ + ,{ + XX___XX_, + XX___XX_, + XX___XX_, + XXXXXXX_, + XX___XX_, + XX___XX_, + XX___XX_, + ________} + +/* I */ + ,{ + __XXXX__, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + __XXXX__, + ________} + +/* J */ + ,{ + ___XXXX_, + ____XX__, + ____XX__, + ____XX__, + XX__XX__, + XX__XX__, + _XXXX___, + ________} + +/* K */ + ,{ + XXX__XX_, + _XX__XX_, + _XX_XX__, + _XXXX___, + _XX_XX__, + _XX__XX_, + XXX__XX_, + ________} + +/* L */ + ,{ + XXXX____, + _XX_____, + _XX_____, + _XX_____, + _XX___X_, + _XX__XX_, + XXXXXXX_, + ________} + +/* M */ + ,{ + XX___XX_, + XXX_XXX_, + XXXXXXX_, + XXXXXXX_, + XX_X_XX_, + XX___XX_, + XX___XX_, + ________} + +/* N */ + ,{ + XX___XX_, + XXX__XX_, + XXXX_XX_, + XX_XXXX_, + XX__XXX_, + XX___XX_, + XX___XX_, + ________} + +/* O */ + ,{ + _XXXXX__, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + _XXXXX__, + ________} + +/* P */ + ,{ + XXXXXX__, + _XX__XX_, + _XX__XX_, + _XXXXX__, + _XX_____, + _XX_____, + XXXX____, + ________} + +/* Q */ + ,{ + _XXXXX__, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + XX__XXX_, + _XXXXX__, + ____XXX_} + +/* R */ + ,{ + XXXXXX__, + _XX__XX_, + _XX__XX_, + _XXXXX__, + _XX_XX__, + _XX__XX_, + XXX__XX_, + ________} + +/* S */ + ,{ + __XXXX__, + _XX__XX_, + __XX____, + ___XX___, + ____XX__, + _XX__XX_, + __XXXX__, + ________} + +/* T */ + ,{ + _XXXXXX_, + _XXXXXX_, + _X_XX_X_, + ___XX___, + ___XX___, + ___XX___, + __XXXX__, + ________} + +/* U */ + ,{ + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + _XXXXX__, + ________} + +/* V */ + ,{ + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + XX___XX_, + _XX_XX__, + __XXX___, + ________} + +/* W */ + ,{ + XX___XX_, + XX___XX_, + XX___XX_, + XX_X_XX_, + XX_X_XX_, + XXXXXXX_, + _XX_XX__, + ________} + +/* X */ + ,{ + XX___XX_, + XX___XX_, + _XX_XX__, + __XXX___, + _XX_XX__, + XX___XX_, + XX___XX_, + ________} + +/* Y */ + ,{ + _XX__XX_, + _XX__XX_, + _XX__XX_, + __XXXX__, + ___XX___, + ___XX___, + __XXXX__, + ________} + +/* Z */ + ,{ + XXXXXXX_, + XX___XX_, + X___XX__, + ___XX___, + __XX__X_, + _XX__XX_, + XXXXXXX_, + ________} + +/* [ */ + ,{ + __XXXX__, + __XX____, + __XX____, + __XX____, + __XX____, + __XX____, + __XXXX__, + ________} + +/* \ */ + ,{ + XX______, + _XX_____, + __XX____, + ___XX___, + ____XX__, + _____XX_, + ______X_, + ________} + +/* ] */ + ,{ + __XXXX__, + ____XX__, + ____XX__, + ____XX__, + ____XX__, + ____XX__, + __XXXX__, + ________} + +/* ^ */ + ,{ + ___X____, + __XXX___, + _XX_XX__, + XX___XX_, + ________, + ________, + ________, + ________} + +/* _ */ + ,{ + ________, + ________, + ________, + ________, + ________, + ________, + ________, + XXXXXXXX} + +/* ` */ + ,{ + __XX____, + ___XX___, + ____XX__, + ________, + ________, + ________, + ________, + ________} + +/* a */ + ,{ + ________, + ________, + _XXXX___, + ____XX__, + _XXXXX__, + XX__XX__, + _XXX_XX_, + ________} + +/* b */ + ,{ + XXX_____, + _XX_____, + _XXXXX__, + _XX__XX_, + _XX__XX_, + _XX__XX_, + XX_XXX__, + ________} + +/* c */ + ,{ + ________, + ________, + _XXXXX__, + XX___XX_, + XX______, + XX___XX_, + _XXXXX__, + ________} + +/* d */ + ,{ + ___XXX__, + ____XX__, + _XXXXX__, + XX__XX__, + XX__XX__, + XX__XX__, + _XXX_XX_, + ________} + +/* e */ + ,{ + ________, + ________, + _XXXXX__, + XX___XX_, + XXXXXXX_, + XX______, + _XXXXX__, + ________} + +/* f */ + ,{ + __XXXX__, + _XX__XX_, + _XX_____, + XXXXX___, + _XX_____, + _XX_____, + XXXX____, + ________} + +/* g */ + ,{ + ________, + ________, + _XXX_XX_, + XX__XX__, + XX__XX__, + _XXXXX__, + ____XX__, + XXXXX___} + +/* h */ + ,{ + XXX_____, + _XX_____, + _XX_XX__, + _XXX_XX_, + _XX__XX_, + _XX__XX_, + XXX__XX_, + ________} + +/* i */ + ,{ + ___XX___, + ________, + __XXX___, + ___XX___, + ___XX___, + ___XX___, + __XXXX__, + ________} + +/* j */ + ,{ + _____XX_, + ________, + _____XX_, + _____XX_, + _____XX_, + _XX__XX_, + _XX__XX_, + __XXXX__} + +/* k */ + ,{ + XXX_____, + _XX_____, + _XX__XX_, + _XX_XX__, + _XXXX___, + _XX_XX__, + XXX__XX_, + ________} + +/* l */ + ,{ + __XXX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + __XXXX__, + ________} + +/* m */ + ,{ + ________, + ________, + XXX_XX__, + XXXXXXX_, + XX_X_XX_, + XX_X_XX_, + XX_X_XX_, + ________} + +/* n */ + ,{ + ________, + ________, + XX_XXX__, + _XX__XX_, + _XX__XX_, + _XX__XX_, + _XX__XX_, + ________} + +/* o */ + ,{ + ________, + ________, + _XXXXX__, + XX___XX_, + XX___XX_, + XX___XX_, + _XXXXX__, + ________} + +/* p */ + ,{ + ________, + ________, + XX_XXX__, + _XX__XX_, + _XX__XX_, + _XXXXX__, + _XX_____, + XXXX____} + +/* q */ + ,{ + ________, + ________, + _XXX_XX_, + XX__XX__, + XX__XX__, + _XXXXX__, + ____XX__, + ___XXXX_} + +/* r */ + ,{ + ________, + ________, + XX_XXX__, + _XXX_XX_, + _XX_____, + _XX_____, + XXXX____, + ________} + +/* s */ + ,{ + ________, + ________, + _XXXXXX_, + XX______, + _XXXXX__, + _____XX_, + XXXXXX__, + ________} + +/* t */ + ,{ + __XX____, + __XX____, + XXXXXX__, + __XX____, + __XX____, + __XX_XX_, + ___XXX__, + ________} + +/* u */ + ,{ + ________, + ________, + XX__XX__, + XX__XX__, + XX__XX__, + XX__XX__, + _XXX_XX_, + ________} + +/* v */ + ,{ + ________, + ________, + XX___XX_, + XX___XX_, + XX___XX_, + _XX_XX__, + __XXX___, + ________} + +/* w */ + ,{ + ________, + ________, + XX___XX_, + XX_X_XX_, + XX_X_XX_, + XXXXXXX_, + _XX_XX__, + ________} + +/* x */ + ,{ + ________, + ________, + XX___XX_, + _XX_XX__, + __XXX___, + _XX_XX__, + XX___XX_, + ________} + +/* y */ + ,{ + ________, + ________, + XX___XX_, + XX___XX_, + XX___XX_, + _XXXXXX_, + _____XX_, + XXXXXX__} + +/* z */ + ,{ + ________, + ________, + _XXXXXX_, + _X__XX__, + ___XX___, + __XX__X_, + _XXXXXX_, + ________} + +/* { */ + ,{ + ____XXX_, + ___XX___, + ___XX___, + _XXX____, + ___XX___, + ___XX___, + ____XXX_, + ________} + +/* | */ + ,{ + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ___XX___, + ________} + +/* } */ + ,{ + _XXX____, + ___XX___, + ___XX___, + ____XXX_, + ___XX___, + ___XX___, + _XXX____, + ________} + +/* ~ */ + ,{ + _XXX_XX_, + XX_XXX__, + ________, + ________, + ________, + ________, + ________, + ________} + +/* 0x7f */ + ,{ + XXXXXX__, + XXXXXX__, + XXXXXX__, + XXXXXX__, + XXXXXX__, + XXXXXX__, + XXXXXX__, + ________} + +}; + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +uint8_t gui_put_char8_8(uint16_t x, uint16_t y, uint8_t ch) +{ + uint8_t i; + + if( x>(GUI_DISPLAY_X_MAX-8) ) return(0); + if( y>(GUI_DISPLAY_Y_MAX-8) ) return(0); + if( (ch<0x20) || (ch>0x7f) ) ch = 0x20; + + ch -= 0x20; + for(i=0; i<8; i++) + { + gui_point_color(x, y, s_ascii_font8_8[ch][i], 8); + y++; + } + + return(1); +} + + +void gui_put_string8_8(uint16_t x, uint16_t y, char *p_str) +{ while(1) + { if( (*p_str)=='\0' ) break; + if( gui_put_char8_8(x, y, *p_str++)==0 ) break; + x += 6; + } +} + +void gui_put_num8_8(uint16_t x, uint16_t y, uint32_t num, uint8_t len, uint8_t mode) +{ + uint8_t t,temp; + uint8_t enshow = 0; + for(t=0; t (GUI_DISPLAY_X_MAX-16) ) + return(0); + if( y_coord > (GUI_DISPLAY_Y_MAX-16) ) + return(0); + offset = (((str1-0xa1)*94) + (str2 - 0xa1)) * 32; + gui_read_gb2312(offset, gb2312_buf); + for(i=0; i<16; i++) + { + gui_point_color(x_coord, y_coord, gb2312_buf[i], 8); + gui_point_color(x_coord+8, y_coord, gb2312_buf[16+i], 8); + y_coord++; + } + + return(1); +} + +/** + ***************************************************************************************** +* @brief Display one 8*16 ascii. +* @note Display value between 0x20 to 0x7f, others show ' '. +* +* @return 0x01--success, 0x00--fail(the coordinate value is out of range) +***************************************************************************************** + */ +static uint8_t gui_put_ascii_char(uint16_t x, uint16_t y, char show_char) +{ + uint8_t i; + uint32_t offset; + uint8_t ascii_buf[16]; + uint16_t x_coord = x; + uint16_t y_coord = y; + + if( x_coord > (GUI_DISPLAY_X_MAX-8) ) + return(0); + if( y_coord > (GUI_DISPLAY_Y_MAX-16) ) + return(0); + offset = (show_char-0x20)*16; + gui_read_ascii(offset, ascii_buf); + for(i=0; i<16; i++) + { + gui_point_color(x_coord, y_coord, ascii_buf[i], 8); + y_coord++; + } + return (1); +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +void gui_put_string(uint16_t x, uint16_t y, char *p_str) +{ + uint16_t i=0; + uint16_t x_coord = x; + uint16_t y_coord = y; + while(p_str[i] > 0x00) + { + if((p_str[i]>=0x20) &&(p_str[i]<=0x7e))//assic + { + if(gui_put_ascii_char(x_coord, y_coord, p_str[i])) + { + x_coord += 8; + if( x_coord > (GUI_DISPLAY_X_MAX-8) ) + { + x_coord = 0; + y_coord += 16; + } + } + + i++; + } + else + { + if(gui_put_one_gb2312(x_coord, y_coord, p_str[i], p_str[i+1])) + { + i+=2; + x_coord += 16; + if( x_coord > (GUI_DISPLAY_X_MAX-16) ) + { + x_coord = 0; + y_coord += 16; + } + } + else + { + i++; + } + } + } +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_gb2312.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_gb2312.h new file mode 100644 index 0000000..7580ecf --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_gb2312.h @@ -0,0 +1,59 @@ +/** + ***************************************************************************************** + * + * @file gui_font_gb2312.h + * + * @brief Show gb2312 string API + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef _GUI_FONT_GB2312_H_ +#define _GUI_FONT_GB2312_H_ + +#include "gui_config.h" + +#if FONT_GB2312_EN==1 + +/** + ***************************************************************************************** + * @brief Display gb2312 string and 8*16 ascii char. + * @note No line feed. + * + * @param[in] x: X coordinate. + * @param[in] y: Y coordinate. + * @param[in] p_str: Display string. + ***************************************************************************************** + */ +void gui_put_string(uint16_t x, uint16_t y, char *p_str); + +#endif + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_macro.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_macro.h new file mode 100644 index 0000000..23d48b1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_macro.h @@ -0,0 +1,261 @@ +#ifndef FONT_MACRO_H +#define FONT_MACRO_H + +#define ________ 0x00 +#define _______X 0x01 +#define ______X_ 0x02 +#define ______XX 0x03 +#define _____X__ 0x04 +#define _____X_X 0x05 +#define _____XX_ 0x06 +#define _____XXX 0x07 +#define ____X___ 0x08 +#define ____X__X 0x09 +#define ____X_X_ 0x0a +#define ____X_XX 0x0b +#define ____XX__ 0x0c +#define ____XX_X 0x0d +#define ____XXX_ 0x0e +#define ____XXXX 0x0f +#define ___X____ 0x10 +#define ___X___X 0x11 +#define ___X__X_ 0x12 +#define ___X__XX 0x13 +#define ___X_X__ 0x14 +#define ___X_X_X 0x15 +#define ___X_XX_ 0x16 +#define ___X_XXX 0x17 +#define ___XX___ 0x18 +#define ___XX__X 0x19 +#define ___XX_X_ 0x1a +#define ___XX_XX 0x1b +#define ___XXX__ 0x1c +#define ___XXX_X 0x1d +#define ___XXXX_ 0x1e +#define ___XXXXX 0x1f +#define __X_____ 0x20 +#define __X____X 0x21 +#define __X___X_ 0x22 +#define __X___XX 0x23 +#define __X__X__ 0x24 +#define __X__X_X 0x25 +#define __X__XX_ 0x26 +#define __X__XXX 0x27 +#define __X_X___ 0x28 +#define __X_X__X 0x29 +#define __X_X_X_ 0x2a +#define __X_X_XX 0x2b +#define __X_XX__ 0x2c +#define __X_XX_X 0x2d +#define __X_XXX_ 0x2e +#define __X_XXXX 0x2f +#define __XX____ 0x30 +#define __XX___X 0x31 +#define __XX__X_ 0x32 +#define __XX__XX 0x33 +#define __XX_X__ 0x34 +#define __XX_X_X 0x35 +#define __XX_XX_ 0x36 +#define __XX_XXX 0x37 +#define __XXX___ 0x38 +#define __XXX__X 0x39 +#define __XXX_X_ 0x3a +#define __XXX_XX 0x3b +#define __XXXX__ 0x3c +#define __XXXX_X 0x3d +#define __XXXXX_ 0x3e +#define __XXXXXX 0x3f +#define _X______ 0x40 +#define _X_____X 0x41 +#define _X____X_ 0x42 +#define _X____XX 0x43 +#define _X___X__ 0x44 +#define _X___X_X 0x45 +#define _X___XX_ 0x46 +#define _X___XXX 0x47 +#define _X__X___ 0x48 +#define _X__X__X 0x49 +#define _X__X_X_ 0x4a +#define _X__X_XX 0x4b +#define _X__XX__ 0x4c +#define _X__XX_X 0x4d +#define _X__XXX_ 0x4e +#define _X__XXXX 0x4f +#define _X_X____ 0x50 +#define _X_X___X 0x51 +#define _X_X__X_ 0x52 +#define _X_X__XX 0x53 +#define _X_X_X__ 0x54 +#define _X_X_X_X 0x55 +#define _X_X_XX_ 0x56 +#define _X_X_XXX 0x57 +#define _X_XX___ 0x58 +#define _X_XX__X 0x59 +#define _X_XX_X_ 0x5a +#define _X_XX_XX 0x5b +#define _X_XXX__ 0x5c +#define _X_XXX_X 0x5d +#define _X_XXXX_ 0x5e +#define _X_XXXXX 0x5f +#define _XX_____ 0x60 +#define _XX____X 0x61 +#define _XX___X_ 0x62 +#define _XX___XX 0x63 +#define _XX__X__ 0x64 +#define _XX__X_X 0x65 +#define _XX__XX_ 0x66 +#define _XX__XXX 0x67 +#define _XX_X___ 0x68 +#define _XX_X__X 0x69 +#define _XX_X_X_ 0x6a +#define _XX_X_XX 0x6b +#define _XX_XX__ 0x6c +#define _XX_XX_X 0x6d +#define _XX_XXX_ 0x6e +#define _XX_XXXX 0x6f +#define _XXX____ 0x70 +#define _XXX___X 0x71 +#define _XXX__X_ 0x72 +#define _XXX__XX 0x73 +#define _XXX_X__ 0x74 +#define _XXX_X_X 0x75 +#define _XXX_XX_ 0x76 +#define _XXX_XXX 0x77 +#define _XXXX___ 0x78 +#define _XXXX__X 0x79 +#define _XXXX_X_ 0x7a +#define _XXXX_XX 0x7b +#define _XXXXX__ 0x7c +#define _XXXXX_X 0x7d +#define _XXXXXX_ 0x7e +#define _XXXXXXX 0x7f +#define X_______ 0x80 +#define X______X 0x81 +#define X_____X_ 0x82 +#define X_____XX 0x83 +#define X____X__ 0x84 +#define X____X_X 0x85 +#define X____XX_ 0x86 +#define X____XXX 0x87 +#define X___X___ 0x88 +#define X___X__X 0x89 +#define X___X_X_ 0x8a +#define X___X_XX 0x8b +#define X___XX__ 0x8c +#define X___XX_X 0x8d +#define X___XXX_ 0x8e +#define X___XXXX 0x8f +#define X__X____ 0x90 +#define X__X___X 0x91 +#define X__X__X_ 0x92 +#define X__X__XX 0x93 +#define X__X_X__ 0x94 +#define X__X_X_X 0x95 +#define X__X_XX_ 0x96 +#define X__X_XXX 0x97 +#define X__XX___ 0x98 +#define X__XX__X 0x99 +#define X__XX_X_ 0x9a +#define X__XX_XX 0x9b +#define X__XXX__ 0x9c +#define X__XXX_X 0x9d +#define X__XXXX_ 0x9e +#define X__XXXXX 0x9f +#define X_X_____ 0xa0 +#define X_X____X 0xa1 +#define X_X___X_ 0xa2 +#define X_X___XX 0xa3 +#define X_X__X__ 0xa4 +#define X_X__X_X 0xa5 +#define X_X__XX_ 0xa6 +#define X_X__XXX 0xa7 +#define X_X_X___ 0xa8 +#define X_X_X__X 0xa9 +#define X_X_X_X_ 0xaa +#define X_X_X_XX 0xab +#define X_X_XX__ 0xac +#define X_X_XX_X 0xad +#define X_X_XXX_ 0xae +#define X_X_XXXX 0xaf +#define X_XX____ 0xb0 +#define X_XX___X 0xb1 +#define X_XX__X_ 0xb2 +#define X_XX__XX 0xb3 +#define X_XX_X__ 0xb4 +#define X_XX_X_X 0xb5 +#define X_XX_XX_ 0xb6 +#define X_XX_XXX 0xb7 +#define X_XXX___ 0xb8 +#define X_XXX__X 0xb9 +#define X_XXX_X_ 0xba +#define X_XXX_XX 0xbb +#define X_XXXX__ 0xbc +#define X_XXXX_X 0xbd +#define X_XXXXX_ 0xbe +#define X_XXXXXX 0xbf +#define XX______ 0xc0 +#define XX_____X 0xc1 +#define XX____X_ 0xc2 +#define XX____XX 0xc3 +#define XX___X__ 0xc4 +#define XX___X_X 0xc5 +#define XX___XX_ 0xc6 +#define XX___XXX 0xc7 +#define XX__X___ 0xc8 +#define XX__X__X 0xc9 +#define XX__X_X_ 0xca +#define XX__X_XX 0xcb +#define XX__XX__ 0xcc +#define XX__XX_X 0xcd +#define XX__XXX_ 0xce +#define XX__XXXX 0xcf +#define XX_X____ 0xd0 +#define XX_X___X 0xd1 +#define XX_X__X_ 0xd2 +#define XX_X__XX 0xd3 +#define XX_X_X__ 0xd4 +#define XX_X_X_X 0xd5 +#define XX_X_XX_ 0xd6 +#define XX_X_XXX 0xd7 +#define XX_XX___ 0xd8 +#define XX_XX__X 0xd9 +#define XX_XX_X_ 0xda +#define XX_XX_XX 0xdb +#define XX_XXX__ 0xdc +#define XX_XXX_X 0xdd +#define XX_XXXX_ 0xde +#define XX_XXXXX 0xdf +#define XXX_____ 0xe0 +#define XXX____X 0xe1 +#define XXX___X_ 0xe2 +#define XXX___XX 0xe3 +#define XXX__X__ 0xe4 +#define XXX__X_X 0xe5 +#define XXX__XX_ 0xe6 +#define XXX__XXX 0xe7 +#define XXX_X___ 0xe8 +#define XXX_X__X 0xe9 +#define XXX_X_X_ 0xea +#define XXX_X_XX 0xeb +#define XXX_XX__ 0xec +#define XXX_XX_X 0xed +#define XXX_XXX_ 0xee +#define XXX_XXXX 0xef +#define XXXX____ 0xf0 +#define XXXX___X 0xf1 +#define XXXX__X_ 0xf2 +#define XXXX__XX 0xf3 +#define XXXX_X__ 0xf4 +#define XXXX_X_X 0xf5 +#define XXXX_XX_ 0xf6 +#define XXXX_XXX 0xf7 +#define XXXXX___ 0xf8 +#define XXXXX__X 0xf9 +#define XXXXX_X_ 0xfa +#define XXXXX_XX 0xfb +#define XXXXXX__ 0xfc +#define XXXXXX_X 0xfd +#define XXXXXXX_ 0xfe +#define XXXXXXXX 0xff + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_other.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_other.c new file mode 100644 index 0000000..51a2d6b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/gui/gui_font_other.c @@ -0,0 +1,138 @@ +/** + ***************************************************************************************** + * + * @file gui_font_other.c + * + * @brief Function of show other modulus font + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "gui_font_other.h" + +#if FONT_OTHER_EN==1 + +#include "gui_color.h" +#include "gui_basic.h" + + +/* + * GLOBAL FUNCTION DEFINITIONS + ******************************************************************************* + */ +uint8_t gui_put_char16_32(uint16_t x, uint16_t y, const uint8_t(*code16_32)[16], uint16_t index) +{ + uint8_t i,j; + + if( x>(GUI_DISPLAY_X_MAX-16) ) return(0); + if( y>(GUI_DISPLAY_Y_MAX-32) ) return(0); + for(i=0; i<16; i++) + { + for(j=0; j<2; j++) + { + gui_point_color(x+j*8, y+i, code16_32[(index*4)+(j*2)][i], 8); + gui_point_color(x+j*8, y+16+i, code16_32[(index*4)+(j*2+1)][i], 8); + } + } + return (1); +} + +void gui_put_string16_32(uint16_t x, uint16_t y, const uint8_t(*code16_32)[16], uint16_t num) +{ + uint16_t i; + + for(i=0; i(GUI_DISPLAY_X_MAX-32) ) return(0); + if( y>(GUI_DISPLAY_Y_MAX-64) ) return(0); + for(i=0; i<16; i++) + { + for(j=0; j<4; j++) + { + gui_point_color(x+j*8, y+i, code32_64[(index*16)+(j*4)][i], 8); + gui_point_color(x+j*8, y+16+i, code32_64[(index*16)+(j*4+1)][i], 8); + gui_point_color(x+j*8, y+32+i, code32_64[(index*16)+(j*4+2)][i], 8); + gui_point_color(x+j*8, y+48+i, code32_64[(index*16)+(j*4+3)][i], 8); + } + } + return (1); +} + +void gui_put_string32_64(uint16_t x, uint16_t y, const uint8_t(*code32_64)[16], uint16_t num) +{ + uint16_t i; + + for(i=0; ip_xqspi, &command, &tmp, 1000); + *p_status_register |= tmp; + + command.inst = 0x35; + tmp = 0; + hal_xqspi_command_receive(p_exflash->p_xqspi, &command, &tmp, 1000); + *p_status_register |= (tmp << 8); + + return status; +} + +SECTION_RAM_CODE static hal_status_t exflash_write_status_register(exflash_handle_t *p_exflash, uint16_t data) +{ + hal_status_t status = HAL_OK; + + uint8_t w_sr_cmd[3]; + w_sr_cmd[0] = 0x01; //Write Status Register + w_sr_cmd[1] = data & 0xFF; + w_sr_cmd[2] = (data >> 8) & 0xFF; + + do { + status = exflash_enable_write(p_exflash); + if (HAL_OK != status) + break; + + status = hal_xqspi_transmit(p_exflash->p_xqspi, w_sr_cmd, sizeof(w_sr_cmd), 1000); + if (HAL_OK != status) + break; + + status = exflash_wait_busy(p_exflash, HAL_EXFLASH_RETRY_DEFAULT_VALUE); + } while(0); + + return status; +} + +SECTION_RAM_CODE hal_status_t enable_quad(exflash_handle_t *p_exflash) +{ + hal_status_t status = HAL_OK; + uint16_t status_reg_value = 0; + + do { + exflash_read_status_register(p_exflash, &status_reg_value); + if (((status_reg_value & (1<> FLASH_QE_BIT_POS) == ENABLE) + break; + + status_reg_value |= (uint16_t)(1<< FLASH_QE_BIT_POS); + + status = exflash_write_status_register(p_exflash, status_reg_value); + if (HAL_OK != status) + break; + + status_reg_value = 0; + exflash_read_status_register(p_exflash, &status_reg_value); + if (((status_reg_value & (1<> FLASH_QE_BIT_POS) == ENABLE) + break; + } while(1); + return status; +} + +SECTION_RAM_CODE hal_status_t platform_exflash_enable_quad(exflash_handle_t *p_exflash) +{ + hal_status_t status = HAL_OK; + + if (ll_xqspi_get_xip_flag(p_exflash->p_xqspi->p_instance)) + { + /* Disable global interrupt, aviod call function in flash */ + GLOBAL_EXCEPTION_DISABLE(); + + /* Configure XQSPI initial paraments */ + p_exflash->p_xqspi->init.work_mode = XQSPI_WORK_MODE_QSPI; + hal_xqspi_init_ext(p_exflash->p_xqspi); + /* Update EXFALSH state */ + p_exflash->state = HAL_EXFLASH_STATE_BUSY; + GLOBAL_EXCEPTION_ENABLE(); + } + else + { + /* EXFLASH in QSPI mode */ + exflash_wakeup(p_exflash); + status = (hal_status_t)exflash_check_id(p_exflash); + if (HAL_OK != status) + { + p_exflash->error_code = HAL_EXFLASH_ERROR_ID; + } else { + /* Update EXFALSH state */ + p_exflash->state = HAL_EXFLASH_STATE_BUSY; + } + } + status = enable_quad(p_exflash); + if (XQSPI_WORK_MODE_XIP == p_exflash->fw_mode) + { + /* Disable global interrupt, aviod call function in flash */ + GLOBAL_EXCEPTION_DISABLE(); + p_exflash->p_xqspi->init.work_mode = XQSPI_WORK_MODE_XIP; + hal_xqspi_init_ext(p_exflash->p_xqspi); + p_exflash->state = HAL_EXFLASH_STATE_READY; + GLOBAL_EXCEPTION_ENABLE(); + } + else + { + exflash_deepsleep(p_exflash); + p_exflash->state = HAL_EXFLASH_STATE_READY; + } + + return status; +} +#endif /* ENABLE_USER_QUAD_FUNC */ + +/* NOTE : Here is a function demo if user want to realize XIP Flash operations + Please refer hal_flash_read_identification_id() + */ static uint32_t s_identification_id; static SECTION_RAM_CODE hal_status_t exflash_read_identification_id(exflash_handle_t *p_exflash) { @@ -23,14 +162,18 @@ static SECTION_RAM_CODE hal_status_t exflash_read_identification_id(exflash_hand command.length = 3; status = hal_xqspi_command_receive_patch(p_exflash->p_xqspi, &command, id, 1000); - if (HAL_OK != status) { + if (HAL_OK != status) + { return status; } - if ((FLASH_MANU_ID_INVALID0 != id[0]) && (FLASH_MANU_ID_INVALID1 != id[0])) { + if ((FLASH_MANU_ID_INVALID0 != id[0]) && (FLASH_MANU_ID_INVALID1 != id[0])) + { s_identification_id = id[2] + (id[1] << 8) + (id[0] << 16); return HAL_OK; - } else { + } + else + { return HAL_ERROR; } } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_exflash_user_operation.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_exflash_user_operation.h old mode 100755 new mode 100644 index 5e6bb10..37222b9 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_exflash_user_operation.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_exflash_user_operation.h @@ -34,10 +34,7 @@ #define SPI_FLASH_CMD_DP 0xB9 #define SPI_FLASH_CMD_RDP 0xAB -extern exflash_handle_t g_exflash_handle; -extern hal_status_t hal_xqspi_command_receive_patch(xqspi_handle_t *p_xqspi, xqspi_command_t *p_cmd, \ - uint8_t *p_data, uint32_t retry); - uint32_t hal_flash_read_identification_id(void); +hal_status_t platform_exflash_enable_quad(exflash_handle_t *p_exflash); #endif /* __HAL_EXFLASH_USER_OPERATION_H_ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.c old mode 100755 new mode 100644 index c56194a..c92d909 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.c @@ -49,46 +49,28 @@ * with the macro *FLASH_ENABLE. ******************************************************************************/ +#include "gr55xx_hal.h" +#include "hal_flash.h" #include #include #include -#include "gr55xx_hal.h" -#include "hal_flash.h" #ifndef EXFLASH_ENABLE #define EXFLASH_ENABLE /** EXFLASH_SIZE_PAGE_BYTES ? - EXFLASH_SIZE_PAGE_BYTES : size; + if (HAL_OK == status) + { + /* It's possible that the data is not written to flash memory. + * So we must read the data from flash memory, and check it. */ + uint8_t rd_buf[EXFLASH_SIZE_PAGE_BYTES]; + uint32_t offset = 0; + uint32_t unrd_bytes = size; + uint32_t rd_bytes = size > EXFLASH_SIZE_PAGE_BYTES ? + EXFLASH_SIZE_PAGE_BYTES : size; - do { - status = hal_exflash_read(&g_exflash_handle, addr + offset, - rd_buf, rd_bytes); - if ((HAL_OK == status) && (memcmp(buf + offset, rd_buf, rd_bytes) == 0)) { - unrd_bytes -= rd_bytes; - if (unrd_bytes == 0) { - return size; + do + { + status = hal_exflash_read(&g_exflash_handle, addr + offset, + rd_buf, rd_bytes); + if ((HAL_OK == status) && (memcmp(buf + offset, rd_buf, rd_bytes) == 0)) + { + unrd_bytes -= rd_bytes; + if (0 == unrd_bytes) + { + return size; + } + else + { + offset += rd_bytes; + rd_bytes = unrd_bytes > EXFLASH_SIZE_PAGE_BYTES ? + EXFLASH_SIZE_PAGE_BYTES : unrd_bytes; + if ((offset >= size) || ((offset + rd_bytes) > size)) + { + break; + } + } } - offset += rd_bytes; - rd_bytes = unrd_bytes > EXFLASH_SIZE_PAGE_BYTES ? - EXFLASH_SIZE_PAGE_BYTES : unrd_bytes; - if ((offset >= size) || ((offset + rd_bytes) > size)) { + else + { break; } - } else { - break; - } - } while (1); + } while(1); + } return 0; } @@ -154,17 +145,18 @@ bool hal_flash_get_security(void) bool hal_flash_erase(const uint32_t addr, const uint32_t size) { - return (HAL_OK == hal_exflash_erase(&g_exflash_handle, 0, addr, size)) ? true : false; + return (HAL_OK == hal_exflash_erase(&g_exflash_handle, 0, addr, size)) ? true : false; } bool hal_flash_erase_chip(void) { - return (HAL_OK == hal_exflash_erase(&g_exflash_handle, 1, 0, 0)) ? true : false; + return (HAL_OK == hal_exflash_erase(&g_exflash_handle, 1, 0, 0)) ? true : false; } void hal_flash_get_info(uint32_t *id, uint32_t *size) { - if (id == NULL || size == NULL) { + if (NULL == id || NULL == size) + { return; } @@ -204,17 +196,18 @@ uint32_t hal_flash_write(const uint32_t addr, const uint8_t *buf, bool hal_flash_erase(const uint32_t addr, const uint32_t size) { - return vflash_erase(addr, size); + return vflash_erase(addr, size); } bool hal_flash_erase_chip(void) { - return false; + return false; } void hal_flash_get_info(uint32_t *id, uint32_t *size) { - if (id == NULL || size == NULL) { + if (NULL == id || NULL == size) + { return; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.h old mode 100755 new mode 100644 index 39a95f9..cfb9bff --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/hal_flash.h @@ -59,15 +59,6 @@ #include #include -#include "gr55xx_hal.h" - -#if defined(GR5515_C) -exflash_handle_t g_exflash_handle; -#else -extern exflash_handle_t g_exflash_handle; -#endif - -extern uint32_t sys_security_enable_status_check(void); /** @addtogroup HAL_FLASH_DRIVER_FUNCTIONS Functions * @{ */ @@ -80,7 +71,7 @@ extern uint32_t sys_security_enable_status_check(void); * @retval false If failure. ******************************************************************************* */ -bool hal_flash_init(void); +bool hal_flash_init( void ); /** ******************************************************************************* @@ -95,9 +86,6 @@ bool hal_flash_init(void); */ uint32_t hal_flash_read(const uint32_t addr, uint8_t *buf, const uint32_t size); - -#if defined(GR5515_D) - /** ******************************************************************************* * @brief [High speed]Read flash Memory. @@ -114,8 +102,6 @@ uint32_t hal_flash_read(const uint32_t addr, uint8_t *buf, const uint32_t size); */ uint32_t hal_flash_read_align_word(const uint32_t addr, uint8_t *buf, const uint32_t size); -#endif - /** ******************************************************************************* * @brief Write flash Memory. @@ -131,7 +117,7 @@ uint32_t hal_flash_write(const uint32_t addr, const uint8_t *buf, const uint32_t /** ******************************************************************************* - * @brief Write flash Memory reliably. + * @brief Write flash Memory reliably. * * @note It's possible that the data was not written into Flash Memory * successfully. This function reads the data from Flash Memory to check @@ -220,7 +206,7 @@ bool hal_flash_erase_chip(void); */ uint32_t hal_flash_sector_size(void); -#if defined(GR5515_D) && defined(ENCRYPT_ENABLE) +#if defined(ENCRYPT_ENABLE) /** **************************************************************************************** diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.c new file mode 100644 index 0000000..e768680 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.c @@ -0,0 +1,67 @@ +#include "custom_config.h" +#include +#include +#include + +#define VFLASH_SECTOR_SIZE 0x1000 +#define VFLASH_SIZE (VFLASH_SECTOR_SIZE * NVDS_NUM_SECTOR) + +extern uint32_t nvds_get_start_addr(void); + +/* ***************************************************************************** + * Local variables + */ +static uint8_t vflash_ram[VFLASH_SIZE]; + +/* ***************************************************************************** + * Local functions + */ +static uint32_t addr_translate(uint32_t addr); + +/* ***************************************************************************** + * Function definitions + */ +bool vflash_init(void) +{ + memset(vflash_ram, 0xFF, VFLASH_SIZE); + + return true; +} + +uint32_t vflash_sector_size(void) +{ + return VFLASH_SECTOR_SIZE; +} + +uint32_t vflash_read(uint32_t addr, uint8_t *buf, uint32_t size) +{ + uint32_t v_addr = addr_translate(addr); + + memcpy(buf, (uint8_t *)v_addr, size); + + return size; +} + +uint32_t vflash_write(uint32_t addr, const uint8_t *buf, uint32_t size) +{ + uint32_t v_addr = addr_translate(addr); + + memcpy((uint8_t *)v_addr, buf, size); + + return size; +} + +bool vflash_erase(uint32_t addr, uint32_t size) +{ + uint32_t v_addr = addr_translate(addr); + + memset((uint8_t *)v_addr, 0xFF, size); + + return true; +} + +uint32_t addr_translate(uint32_t addr) +{ + return ((uint32_t)(addr - nvds_get_start_addr() + vflash_ram)); +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.h new file mode 100644 index 0000000..641e12a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hal_flash/vflash/vflash.h @@ -0,0 +1,18 @@ +#ifndef __VFLASH_H__ +#define __VFLASH_H__ + +#include +#include + +bool vflash_init(void); + +uint32_t vflash_read(uint32_t addr, uint8_t *buf, uint32_t size); + +uint32_t vflash_write(uint32_t addr, const uint8_t *buf, uint32_t size); + +bool vflash_erase(uint32_t addr, uint32_t size); + +uint32_t vflash_sector_size(void); + +#endif // __VFLASH_H__ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/BUILD.gn new file mode 100644 index 0000000..906e48b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hci_uart") { + sources = [ "hci_uart.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.c new file mode 100644 index 0000000..1bb4ab8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.c @@ -0,0 +1,354 @@ +/** + **************************************************************************************** + * @file hci_uart.c + * @author BLE SDK Team + * @brief H4TL UART driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include // standard definition +#include "board_SK.h" +#include "custom_config.h" +#include "gr55xx_hal.h" +#include "gr55xx_sys.h" +#include "app_uart.h" +#include "hci_uart.h" // uart definition +/* + * STRUCT DEFINITIONS + ***************************************************************************************** + */ + +static hci_uart_call_t hci_uart_api = +{ +#if (HCI_UART_GRP_ID == 0) + hci_uart0_init, + hci_uart0_flow_on, + hci_uart0_flow_off, + hci_uart0_finish_transfers, + hci_uart0_read, + hci_uart0_write, +#elif (HCI_UART_GRP_ID == 1) + hci_uart1_init, + hci_uart1_flow_on, + hci_uart1_flow_off, + hci_uart1_finish_transfers, + hci_uart1_read, + hci_uart1_write, +#endif +}; + + /* TX and RX channel class holding data used for asynchronous read and write data + * transactions + */ +/// UART TX RX Channel +typedef struct +{ + /// call back function pointer + void (*callback) (void*, uint8_t); + /// dummy data pointer returned to callback when operation is over. + void *p_dummy; +} uart_txrxchannel_t; + +/// UART environment structure +typedef struct +{ + /// tx channel + uart_txrxchannel_t tx; + /// rx channel + uart_txrxchannel_t rx; + /// error detect + uint8_t errordetect; + /// external wakeup + bool ext_wakeup; +} uart_env_tag_t; + +/* + * GLOBAL VARIABLE DEFINITIONS + **************************************************************************************** + */ +/// uart environment structure +static uart_env_tag_t uart_env; +static app_uart_params_t s_params; +static app_uart_tx_buf_t s_hci_uart_buffer; +static uint8_t s_hci_buffer[256] = {0}; +/* + * PRIVATED FUNCTION DEFINITIONS + **************************************************************************************** + */ +static void hci_uart_callback(app_uart_id_t id, app_uart_evt_t *p_evt) +{ + void *data = NULL; + void (*callback) (void*, uint8_t) = NULL; + + if (APP_UART_EVT_TX_CPLT == p_evt->type) + { + // Retrieve callback pointer + callback = uart_env.tx.callback; + data = uart_env.tx.p_dummy; + + if(callback != NULL) + { + // Clear callback pointer + uart_env.tx.callback = NULL; + uart_env.tx.p_dummy = NULL; + + // Call handler + callback(data, 0); + } + } + else if (APP_UART_EVT_RX_DATA == p_evt->type) + { + // Retrieve callback pointer + callback = uart_env.rx.callback; + data = uart_env.rx.p_dummy; + + if(callback != NULL) + { + // Clear callback pointer + uart_env.rx.callback = NULL; + uart_env.rx.p_dummy = NULL; + + // Call handler + callback(data, 0); + } + } + else if (APP_UART_EVT_ERROR == p_evt->type) + { + uint8_t tmp; + uart_handle_t *p_uart = app_uart_get_handle(id); + + /* dummy read to clear RLS interrupt */ + tmp = ll_uart_receive_data8(p_uart->p_instance); + (void) tmp; + + /* Flush RX_FIFO */ + ll_uart_flush_rx_fifo(p_uart->p_instance); + + /* If Overrun error occurs. */ + if(p_evt->data.error_code & HAL_UART_ERROR_OE) + { + p_evt->type = APP_UART_EVT_RX_DATA; + hci_uart_callback(id, p_evt); + } + } +} + +static void hci_uart0_callback(app_uart_evt_t *p_evt) +{ + hci_uart_callback(APP_UART_ID_0, p_evt); +} + +static void hci_uart1_callback(app_uart_evt_t *p_evt) +{ + hci_uart_callback(APP_UART_ID_1, p_evt); +} + +static void hci_uart_init(app_uart_id_t id, void (*callback)(app_uart_evt_t*)) +{ + s_params.id = id; + + s_params.pin_cfg.tx.type = APP_HCI_UART_TRN_PORT; + s_params.pin_cfg.tx.mux = APP_HCI_UART_TX_PINMUX; + s_params.pin_cfg.tx.pin = APP_HCI_UART_TX_PIN; + s_params.pin_cfg.rx.type = APP_HCI_UART_TRN_PORT; + s_params.pin_cfg.rx.mux = APP_HCI_UART_RX_PINMUX; + s_params.pin_cfg.rx.pin = APP_HCI_UART_RX_PIN; + #if HCI_UART_FLOW_ON == 1 + params.pin_cfg.cts.type = APP_HCI_UART_FLOW_PORT; + params.pin_cfg.cts.mux = APP_HCI_UART_CTS_PINMUX; + params.pin_cfg.cts.pin = APP_HCI_UART_CTS_PIN; + params.pin_cfg.rts.type = APP_HCI_UART_FLOW_PORT; + params.pin_cfg.rts.mux = APP_HCI_UART_RTS_PINMUX; + params.pin_cfg.rts.pin = APP_HCI_UART_RTS_PIN; + #endif //HCI_UART_FLOW_ON + + s_params.init.baud_rate = APP_HCI_UART_BAUDRATE; + s_params.init.data_bits = UART_DATABITS_8; + s_params.init.stop_bits = UART_STOPBITS_1; + s_params.init.parity = UART_PARITY_NONE; + #if HCI_UART_FLOW_ON == 1 + params.init.hw_flow_ctrl = UART_HWCONTROL_RTS_CTS; + #else + s_params.init.hw_flow_ctrl = UART_HWCONTROL_NONE; + #endif //HCI_UART_FLOW_ON + s_params.init.rx_timeout_mode = UART_RECEIVER_TIMEOUT_DISABLE; + app_uart_init(&s_params, callback, &s_hci_uart_buffer); + return; +} + +static void hci_uart_write(app_uart_id_t id, uint8_t *p_buffer, uint32_t size, void (*callback) (void*, uint8_t), void* p_dummy) +{ + if(NULL == uart_env.tx.callback) + { + uart_env.tx.callback = callback; + uart_env.tx.p_dummy = p_dummy; + } + app_uart_transmit_async(id, p_buffer, (uint16_t)size); + return; +} + +static void hci_uart_read(app_uart_id_t id, uint8_t *p_buffer, uint32_t size, void (*callback) (void*, uint8_t), void* p_dummy) +{ + if(NULL == uart_env.rx.callback) + { + uart_env.rx.callback = callback; + uart_env.rx.p_dummy = p_dummy; + } + + app_uart_receive_async(id, p_buffer, (uint16_t)size); + return; +} + +static void hci_uart_flow_on(app_uart_id_t id) +{ + //Define HCI_UART_FLOW_ON to Open UART Flow Control + #if HCI_UART_FLOW_ON == 1 //To define macro this way for auto test script to locate and modify, don't change this line + uart_handle_t *p_uart = app_uart_get_handle(id); + /* Disable flow control default for .bit version < R02_27a_B0228a_k7 because CTS issue */ + ll_uart_set_hw_flow_ctrl(p_uart->p_instance, LL_UART_HWCONTROL_RTS_CTS); + #endif //HCI_UART_FLOW_ON + return; +} + +static bool hci_uart_flow_off(app_uart_id_t id) +{ + bool flow_off = true; + uart_handle_t *p_uart = app_uart_get_handle(id); + hal_uart_state_t state = hal_uart_get_state(p_uart); + + do { + /* Check if sleep is allowed by Host and if no transmission is ongoing */ + if ((state == HAL_UART_STATE_BUSY_TX) || (state == HAL_UART_STATE_BUSY_RX)) + { + flow_off = false; + break; + } + + /* Force RTS to 'flow off' */ + ll_uart_set_hw_flow_ctrl(p_uart->p_instance, LL_UART_HWCONTROL_NONE); + + state = hal_uart_get_state(p_uart); + /* Check if data has been received during wait time */ + if (state == HAL_UART_STATE_BUSY_RX) + { + /* Re-enable UART flow */ + hci_uart_flow_on(id); + + flow_off = false; + } + } while(0); + return flow_off; +} + +static void hci_uart_finish_transfers(app_uart_id_t id) +{ + return; +} + +/* + * EXPORTED FUNCTION DEFINITIONS + **************************************************************************************** + */ +void hci_uart0_init(void) +{ + hci_uart_init(APP_UART_ID_0, hci_uart0_callback); +} + +void hci_uart1_init(void) +{ + hci_uart_init(APP_UART_ID_1, hci_uart1_callback); +} + +void hci_uart0_flow_on(void) +{ + hci_uart_flow_on(APP_UART_ID_0); +} + +void hci_uart1_flow_on(void) +{ + hci_uart_flow_on(APP_UART_ID_1); +} + +bool hci_uart0_flow_off(void) +{ + return hci_uart_flow_off(APP_UART_ID_0); +} + +bool hci_uart1_flow_off(void) +{ + return hci_uart_flow_off(APP_UART_ID_1); +} + +void hci_uart0_finish_transfers(void) +{ + hci_uart_finish_transfers(APP_UART_ID_0); +} + +void hci_uart1_finish_transfers(void) +{ + hci_uart_finish_transfers(APP_UART_ID_1); +} + +void hci_uart0_read(uint8_t *p_buffer, uint32_t size, void (*callback)(void*, uint8_t), void *p_dummy) +{ + hci_uart_read(APP_UART_ID_0, p_buffer, size, callback, p_dummy); +} + +void hci_uart1_read(uint8_t *p_buffer, uint32_t size, void (*callback)(void*, uint8_t), void *p_dummy) +{ + hci_uart_read(APP_UART_ID_1, p_buffer, size, callback, p_dummy); +} + +void hci_uart0_write(uint8_t *p_buffer, uint32_t size, void (*callback)(void*, uint8_t), void *p_dummy) +{ + hci_uart_write(APP_UART_ID_0, p_buffer, size, callback, p_dummy); +} + +void hci_uart1_write(uint8_t *p_buffer, uint32_t size, void (*callback)(void*, uint8_t), void *p_dummy) +{ + hci_uart_write(APP_UART_ID_1, p_buffer, size, callback, p_dummy); +} + +void ble_hci_uart_init(void) +{ + s_hci_uart_buffer.tx_buf = s_hci_buffer; + s_hci_uart_buffer.tx_buf_size = sizeof(s_hci_buffer); + ble_hci_uart_register(0, &hci_uart_api); +} + +void ble_hci_stack_init_handle(void) +{ + +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.h new file mode 100644 index 0000000..f52c07a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/hci_uart/hci_uart.h @@ -0,0 +1,261 @@ +/** + **************************************************************************************** + * @file hci_uart.h + * @author BLE SDK Team + * @brief UART Driver for HCI over UART operation. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup LIBRARIES Libraries + * @{ + */ + +/** + @addtogroup LIBRARIES_HCI_UART HCI HCI UART Driver. + @{ + @brief Definitions and prototypes for HCI UART Driver. + */ + +#ifndef HCI_UART_H_ +#define HCI_UART_H_ + +#include +#include + +#include "gr55xx_hal.h" + +/** @addtogroup HCI_UART_DRIVER_FUNCTIONS Functions + * @{ */ + +/** + **************************************************************************************** + * @brief Initializes the UART0 to default values. + **************************************************************************************** + */ +void hci_uart0_init(void); + +/** + **************************************************************************************** + * @brief Initializes the UART1 to default values. + **************************************************************************************** + */ +void hci_uart1_init(void); + +#ifndef CFG_ROM +/** + **************************************************************************************** + * @brief Enable UART0 flow. + ***************************************************************************************** + */ +void hci_uart0_flow_on(void); + +/** + **************************************************************************************** + * @brief Enable UART1 flow. + ***************************************************************************************** + */ +void hci_uart1_flow_on(void); + +/** + **************************************************************************************** + * @brief Disable UART0 flow. + * + * @retval true if successful. + * @retval false if failure. + ***************************************************************************************** + */ +bool hci_uart0_flow_off(void); + +/** + **************************************************************************************** + * @brief Disable UART1 flow. + * + * @retval true if successful. + * @retval false if failure. + ***************************************************************************************** + */ +bool hci_uart1_flow_off(void); +#endif //CFG_ROM + +/** + **************************************************************************************** + * @brief Finish current UART0 transfers + ***************************************************************************************** + */ +void hci_uart0_finish_transfers(void); + +/** + **************************************************************************************** + * @brief Finish current UART1 transfers + ***************************************************************************************** + */ +void hci_uart1_finish_transfers(void); + +/** + **************************************************************************************** + * @brief Starts a data reception of UART0. + * + * @param[out] bufptr Pointer to the RX buffer + * @param[in] size Size of the expected reception + * @param[in] callback Pointer to the function called back when transfer finished + * @param[in] dummy Dummy data pointer returned to callback when reception is finished + ***************************************************************************************** + */ +void hci_uart0_read(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); + +/** + **************************************************************************************** + * @brief Starts a data reception of UART1. + * + * @param[out] bufptr Pointer to the RX buffer + * @param[in] size Size of the expected reception + * @param[in] callback Pointer to the function called back when transfer finished + * @param[in] dummy Dummy data pointer returned to callback when reception is finished + ***************************************************************************************** + */ +void hci_uart1_read(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); + +/** + **************************************************************************************** + * @brief Starts a data transmission of UART0. + * + * @param[in] bufptr Pointer to the TX buffer + * @param[in] size Size of the transmission + * @param[in] callback Pointer to the function called back when transfer finished + * @param[in] dummy Dummy data pointer returned to callback when transmission is finished + ***************************************************************************************** + */ +void hci_uart0_write(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); + +/** + **************************************************************************************** + * @brief Starts a data transmission of UART1. + * + * @param[in] bufptr Pointer to the TX buffer + * @param[in] size Size of the transmission + * @param[in] callback Pointer to the function called back when transfer finished + * @param[in] dummy Dummy data pointer returned to callback when transmission is finished + ***************************************************************************************** + */ +void hci_uart1_write(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); + +#if defined(CFG_ROM) +/** + **************************************************************************************** + * @brief Poll UART0 on reception and transmission. + * + * This function is used to poll UART0 for reception and transmission. + * It is used when IRQ are not used to detect incoming bytes. + ***************************************************************************************** + */ +void hci_uart0_poll(void); + +/** + **************************************************************************************** + * @brief Poll UART1 on reception and transmission. + * + * This function is used to poll UART1 for reception and transmission. + * It is used when IRQ are not used to detect incoming bytes. + ***************************************************************************************** + */ +void hci_uart1_poll(void); +#endif //CFG_ROM + +/** + **************************************************************************************** + * @brief Handle UART0 interrupt request. + * + * This function is used to handle UART0 interrupt request. + * It must to be called in UART0_IRQHandler(). + ***************************************************************************************** + */ +void hci_uart0_irq_handler(void); + +/** + **************************************************************************************** + * @brief Handle UART1 interrupt request. + * + * This function is used to handle UART1 interrupt request. + * It must to be called in UART1_IRQHandler(). + ***************************************************************************************** + */ +void hci_uart1_irq_handler(void); + +/** + **************************************************************************************** + * @brief HCI UART Tx Transfer completed callback. + * + * It must to be called in hal_uart_tx_cplt_callback(). + ***************************************************************************************** + */ +void hci_uart_tx_cplt_callback(uart_handle_t *huart); + +/** + **************************************************************************************** + * @brief HCI UART Rx Transfer completed callback. + * + * It must to be called in hal_uart_rx_cplt_callback(). + ***************************************************************************************** + */ +void hci_uart_rx_cplt_callback(uart_handle_t *huart); + +/** + **************************************************************************************** + * @brief HCI UART Error callback. + * + * It must to be called in hal_uart_error_callback(). + ***************************************************************************************** + */ +void hci_uart_error_callback(uart_handle_t *huart); + +/** + **************************************************************************************** + * @brief BLE HCI uart init. + * + * If users want to support dtm test, this function should be called. + ***************************************************************************************** + */ +void ble_hci_uart_init(void); + +/** + **************************************************************************************** + * @brief BLE stack init handler function. + * + * BLE Stack init complete, this function should be called. + ***************************************************************************************** + */ +void ble_hci_stack_init_handle(void); + +/** @} */ + +#endif /* HCI_UART_H_ */ + +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/BUILD.gn new file mode 100644 index 0000000..75662c3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("pmu_calibration") { + sources = [ "pmu_calibration.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.c old mode 100755 new mode 100644 index be5f2ad..0426ad9 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.c @@ -41,31 +41,187 @@ */ #include "pmu_calibration.h" #include "platform_sdk.h" +#include "gr55xx_sys.h" +#include "app_timer.h" -#define INTERVAL_MIN 2000 -#define STACKDEPTH 512 /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -#ifdef ENV_USE_FREERTOS -static TimerHandle_t timer_handle = NULL; -static void system_pmu_calibration_task(void *p_arg); -#else -static app_timer_id_t s_pmu_calibration_timer_id = 0; -#endif +static app_timer_id_t s_pmu_calibration_timer_id = {0}; + +extern uint32_t g_debug_temperature; +extern uint32_t g_debug_lpclk; +static uint32_t s_pre_temperature = 0; #if CFG_LPCLK_INTERNAL_EN -#error "INTERNAL LPCLK is not supported by OHOS" +#define LFRC32K_FAST_INTERVAL_ALLOW_PPM (100) +#define LFRC32K_MIDDLE_INTERVAL_ALLOW_PPM (300) +#define LFRC32K_SLOW_INTERVAL_ALLOW_PPM (300) +#define LFRC32K_CHECK_STATUS_CNT (3) +#define LFRC32K_ALLOW_PPM_WITHIN_THE_RANGE_CNT (20) +#define LFRC32K_ALLOW_PPM_WITHIN_MID_THE_RANGE_CNT (LFRC32K_ALLOW_PPM_WITHIN_THE_RANGE_CNT*100) +#define PMU_SMALL_INTERVAL_MS (10*1000) +static uint32_t pmu_interval_init = 30 * 1000; +static uint32_t pmu_interval_prev = 0; +uint32_t lfrc32k_fast_check_interval = 500; +uint32_t lfrc32k_middle_check_interval = 500*10; +const uint32_t lfrc32k_check_interval_table[LFRC32K_CHECK_STATUS_CNT]={500,500*10,30*1000}; //500ms, 5s, 30s +const uint32_t lfrc32k_check_cnt[LFRC32K_CHECK_STATUS_CNT]={20,20*100,0xFFFFFFFF}; //20 times, 2000 times, forever +const uint16_t lfrc32k_allow_ppm[LFRC32K_CHECK_STATUS_CNT]={100,300,300}; // 100ppm , 300ppm, , 300ppm + +uint32_t pmu_interval_get(uint32_t is_init) +{ + uint32_t interval = 0; + + if (g_debug_temperature > 44) + { + interval = PMU_SMALL_INTERVAL_MS; + } + else if (g_debug_temperature >= 40 && g_debug_temperature <= 44 && is_init) + { + interval = PMU_SMALL_INTERVAL_MS; + } + else if (g_debug_temperature < 40) + { + interval = pmu_interval_init; + } + + return interval; +} + + +uint32_t lfrc32k_interval_get(uint32_t use_interval,uint16_t ppm,uint32_t original_interval) +{ + static uint32_t fast_check_index = 0; + uint8_t current_check_status=0xFF; + fast_check_index++; + uint32_t new_use_interval = original_interval; + + for(uint8_t i=0;i lfrc32k_allow_ppm[current_check_status]) + { + new_use_interval = lfrc32k_fast_check_interval; + fast_check_index = 0; + } + else + { + if(fast_check_index < lfrc32k_check_cnt[current_check_status]) + { + new_use_interval = lfrc32k_check_interval_table[current_check_status]; + } + } + } + else + { + if(ppm > lfrc32k_allow_ppm[2]) + { + new_use_interval = lfrc32k_check_interval_table[1]; + fast_check_index = 0; + } + } + return new_use_interval; +} + +uint32_t get_lfrc32k_calibration_interval(uint32_t original_interval) +{ + static uint32_t prev_debug_lpclk=0; + static uint32_t use_interval=0; + if(prev_debug_lpclk == 0) + { + prev_debug_lpclk = g_debug_lpclk; + use_interval = lfrc32k_fast_check_interval; + return use_interval; + } + else + { + uint16_t ppm=0; + if(prev_debug_lpclk >= g_debug_lpclk) + { + ppm = ((prev_debug_lpclk - g_debug_lpclk)*100*10000)/prev_debug_lpclk; + } + else + { + ppm = ((g_debug_lpclk - prev_debug_lpclk)*100*10000)/g_debug_lpclk; + } + + prev_debug_lpclk = g_debug_lpclk; + use_interval = lfrc32k_interval_get(use_interval,ppm,original_interval); + return use_interval; + } +} + +void pmu_timer_handler(void* p_arg) +{ + static uint32_t pmu_calbration_mod=1; + static uint32_t pmu_calbration_index=0; + //is timer interval is 500ms,make sure 30s interval to do pmu calibration + if(pmu_calbration_index%pmu_calbration_mod == 0) + { + pmu_calibration_handler(p_arg); + if (s_pre_temperature != g_debug_temperature) + { + s_pre_temperature = g_debug_temperature; + rng_calibration(); + } + } + pmu_calbration_index++; + lfrc32k_calibration(); + + uint32_t interval_plan; + uint32_t interval_new; + uint32_t interval_diff; + + interval_plan = pmu_interval_get(0); + + if (interval_plan == 0) + { + interval_new = get_lfrc32k_calibration_interval(interval_plan); + return; + } + interval_new = get_lfrc32k_calibration_interval(interval_plan); + pmu_calbration_mod = interval_plan/ interval_new; + + interval_diff = interval_new > pmu_interval_prev ? + interval_new - pmu_interval_prev: pmu_interval_prev - interval_new; + + if (interval_diff > 2000) + { + app_timer_delete(&s_pmu_calibration_timer_id); + app_timer_create(&s_pmu_calibration_timer_id, ATIMER_REPEAT, pmu_timer_handler); + app_timer_start(s_pmu_calibration_timer_id, interval_new, NULL); + } +} #endif /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ + +void pmu_calibration(void* p_arg) +{ + pmu_calibration_handler(p_arg); + if (s_pre_temperature != g_debug_temperature) + { + s_pre_temperature = g_debug_temperature; + rng_calibration(); + } +} + void system_pmu_calibration_init(uint32_t interval) { - if (interval) { + if (interval) + { uint32_t interval_new; #if CFG_LPCLK_INTERNAL_EN pmu_interval_init = interval; @@ -74,28 +230,15 @@ void system_pmu_calibration_init(uint32_t interval) interval_new = interval; #endif -#ifdef ENV_USE_FREERTOS - timer_handle = xTimerCreate(NULL, interval_new, pdTRUE, NULL, -#if CFG_LPCLK_INTERNAL_EN - pmu_timer_handler -#else - pmu_calibration_handler -#endif // CFG_LPCLK_INTERNAL_EN - ); - - xTaskCreate(system_pmu_calibration_task, "pmu_calibration_task", - STACKDEPTH, NULL, configMAX_PRIORITIES - 1, NULL); -#else app_timer_delete(&s_pmu_calibration_timer_id); - app_timer_create(&s_pmu_calibration_timer_id, ATIMER_REPEAT, + app_timer_create(&s_pmu_calibration_timer_id, ATIMER_REPEAT, #if CFG_LPCLK_INTERNAL_EN pmu_timer_handler #else - pmu_calibration_handler -#endif // CFG_LPCLK_INTERNAL_EN - ); + pmu_calibration +#endif //CFG_LPCLK_INTERNAL_EN + ); app_timer_start(s_pmu_calibration_timer_id, interval_new, NULL); -#endif // ENV_USE_FREERTOS #if CFG_LPCLK_INTERNAL_EN pmu_interval_prev = interval_new; @@ -104,35 +247,9 @@ void system_pmu_calibration_init(uint32_t interval) return; } -#ifdef ENV_USE_FREERTOS -void system_pmu_calibration_start(void) -{ - if (timer_handle != NULL) { - if (xTimerIsTimerActive(timer_handle) == pdFALSE) { - xTimerStart(timer_handle, 0); - } - } - - return; -} - -static void system_pmu_calibration_task(void *p_arg) -{ - system_pmu_calibration_start(); - vTaskDelete(NULL); -} -#endif void system_pmu_calibration_stop(void) { -#ifdef ENV_USE_FREERTOS - if (timer_handle != NULL) { - xTimerDelete(timer_handle, 0); - timer_handle = NULL; - } -#else app_timer_delete(&s_pmu_calibration_timer_id); -#endif return; } - diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.h old mode 100755 new mode 100644 index ae8e208..1f94582 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/pmu_calibration/pmu_calibration.h @@ -1,5 +1,5 @@ -#ifndef _PMU_CALIBRATION_H -#define _PMU_CALIBRATION_H +#ifndef _PMU_CALIB_H +#define _PMU_CALIB_H #include #include diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/BUILD.gn new file mode 100644 index 0000000..92eaa3d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ring_buffer") { + sources = [ "ring_buffer.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.c old mode 100755 new mode 100644 index fb2e312..244d0a5 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.c @@ -39,16 +39,18 @@ * INCLUDE FILES ***************************************************************************************** */ -#include -#include "gr55xx_hal.h" -#include "utility.h" #include "ring_buffer.h" +#include "grx_hal.h" +#include "utility.h" +#include + /* * DEFINES ***************************************************************************************** */ -#define RING_BUFFER_LOCK() GLOBAL_EXCEPTION_DISABLE() -#define RING_BUFFER_UNLOCK() GLOBAL_EXCEPTION_ENABLE() +#define RING_BUFFER_LOCK() GLOBAL_EXCEPTION_DISABLE() +#define RING_BUFFER_UNLOCK() GLOBAL_EXCEPTION_ENABLE() +#define RING_BUFFER_SIZE_MIN (1) /* * GLOBAL FUNCTION DEFINITIONS @@ -56,13 +58,18 @@ */ bool ring_buffer_init(ring_buffer_t *p_ring_buff, uint8_t *p_buff, uint32_t buff_size) { - if (p_buff == NULL || p_ring_buff == NULL) { + if ((NULL == p_buff) || (NULL == p_ring_buff) || (buff_size < RING_BUFFER_SIZE_MIN)) + { return false; - } else { - p_ring_buff->buffer_size = buff_size; - p_ring_buff->p_buffer = p_buff; - p_ring_buff->write_index = 0; - p_ring_buff->read_index = 0; + } + else + { + RING_BUFFER_LOCK(); + p_ring_buff->buffer_size = buff_size; + p_ring_buff->p_buffer = p_buff; + p_ring_buff->write_index = 0; + p_ring_buff->read_index = 0; + RING_BUFFER_UNLOCK(); return true; } @@ -70,139 +77,193 @@ bool ring_buffer_init(ring_buffer_t *p_ring_buff, uint8_t *p_buff, uint32_t buff uint32_t ring_buffer_write(ring_buffer_t *p_ring_buff, uint8_t const *p_wr_data, uint32_t length) { - uint32_t surplus_space = 0; - uint32_t over_flow = 0; - uint32_t wr_idx = p_ring_buff->write_index; - uint32_t rd_idx = p_ring_buff->read_index; - uint32_t ret = 0; - uint32_t len = length; + uint32_t surplus_space = 0; + uint32_t over_flow = 0; RING_BUFFER_LOCK(); - if (rd_idx > wr_idx) { - surplus_space = rd_idx - wr_idx - 1; - len = (len > surplus_space ? surplus_space : len); - } else { - surplus_space = p_ring_buff->buffer_size - wr_idx + rd_idx - 1; - len = (len > surplus_space ? surplus_space : len); + uint32_t wr_idx = p_ring_buff->write_index; + uint32_t rd_idx = p_ring_buff->read_index; - if (wr_idx + len >= p_ring_buff->buffer_size) { - over_flow = wr_idx + len - p_ring_buff->buffer_size; + if ((NULL != p_ring_buff) && + (NULL != p_ring_buff->p_buffer) && + (NULL != p_wr_data)) + { + if (rd_idx > wr_idx) + { + surplus_space = rd_idx - wr_idx - 1; + length = (length > surplus_space ? surplus_space : length); } - } + else + { + surplus_space = p_ring_buff->buffer_size - wr_idx + rd_idx - 1; + length = (length > surplus_space ? surplus_space : length); - ret = memcpy_s(p_ring_buff->p_buffer + wr_idx, len - over_flow, p_wr_data, len - over_flow); - if (ret < 0) { - return ret; - } - ret = memcpy_s(p_ring_buff->p_buffer, over_flow, p_wr_data + len - over_flow, over_flow); - if (ret < 0) { - return ret; - } - wr_idx += len; + if (wr_idx + length >= p_ring_buff->buffer_size) + { + over_flow = wr_idx + length - p_ring_buff->buffer_size; + } + } - if (wr_idx >= p_ring_buff->buffer_size) { - wr_idx -= p_ring_buff->buffer_size; - } + memcpy(p_ring_buff->p_buffer + wr_idx, p_wr_data, length - over_flow); + memcpy(p_ring_buff->p_buffer, p_wr_data + length - over_flow, over_flow); + wr_idx += length; - p_ring_buff->write_index = wr_idx; + if (wr_idx >= p_ring_buff->buffer_size) + { + wr_idx -= p_ring_buff->buffer_size; + } + + p_ring_buff->write_index = wr_idx; + } + else + { + length = 0; + } RING_BUFFER_UNLOCK(); - return len; + return length; } uint32_t ring_buffer_read(ring_buffer_t *p_ring_buff, uint8_t *p_rd_data, uint32_t length) { uint32_t items_avail = 0; uint32_t over_flow = 0; - uint32_t wr_idx = p_ring_buff->write_index; - uint32_t rd_idx = p_ring_buff->read_index; - uint32_t len = length; RING_BUFFER_LOCK(); - if (wr_idx >= rd_idx) { - items_avail = wr_idx - rd_idx; - len = (len > items_avail ? items_avail : len); - } else { - items_avail = p_ring_buff->buffer_size - rd_idx + wr_idx; - len = (len > items_avail ? items_avail : len); + uint32_t wr_idx = p_ring_buff->write_index; + uint32_t rd_idx = p_ring_buff->read_index; - if (rd_idx + len >= p_ring_buff->buffer_size) { - over_flow = len + rd_idx - p_ring_buff->buffer_size; + if ((NULL != p_ring_buff) && + (NULL != p_ring_buff->p_buffer) && + (NULL != p_rd_data)) + { + if (wr_idx >= rd_idx) + { + items_avail = wr_idx - rd_idx; + length = (length > items_avail ? items_avail : length); } + else + { + items_avail = p_ring_buff->buffer_size - rd_idx + wr_idx; + length = (length > items_avail ? items_avail : length); + + if (rd_idx + length >= p_ring_buff->buffer_size) + { + over_flow = length + rd_idx - p_ring_buff->buffer_size; + } + } + + memcpy(p_rd_data, p_ring_buff->p_buffer + rd_idx, length - over_flow); + memcpy(p_rd_data + length - over_flow, p_ring_buff->p_buffer, over_flow); + rd_idx += length; + + if (rd_idx >= p_ring_buff->buffer_size && rd_idx > wr_idx) + { + rd_idx -= p_ring_buff->buffer_size; + } + + p_ring_buff->read_index = rd_idx; } - - memcpy_s(p_rd_data, len - over_flow, p_ring_buff->p_buffer + rd_idx, len - over_flow); - memcpy_s(p_rd_data + len - over_flow, over_flow, p_ring_buff->p_buffer, over_flow); - rd_idx += len; - - if (rd_idx >= p_ring_buff->buffer_size && rd_idx > wr_idx) { - rd_idx -= p_ring_buff->buffer_size; + else + { + length = 0; } - p_ring_buff->read_index = rd_idx; - RING_BUFFER_UNLOCK(); - return len; + return length; } uint32_t ring_buffer_pick(ring_buffer_t *p_ring_buff, uint8_t *p_rd_data, uint32_t length) { uint32_t items_avail = 0; uint32_t over_flow = 0; - uint32_t wr_idx = p_ring_buff->write_index; - uint32_t rd_idx = p_ring_buff->read_index; - uint32_t len = length; RING_BUFFER_LOCK(); - if (wr_idx >= rd_idx) { - items_avail = wr_idx - rd_idx; - len = (len > items_avail ? items_avail : len); - } else { - items_avail = p_ring_buff->buffer_size - rd_idx + wr_idx; - len = (len > items_avail ? items_avail : len); + uint32_t wr_idx = p_ring_buff->write_index; + uint32_t rd_idx = p_ring_buff->read_index; - if (rd_idx + len >= p_ring_buff->buffer_size) { - over_flow = len + rd_idx - p_ring_buff->buffer_size; + if ((NULL != p_ring_buff) && + (NULL != p_ring_buff->p_buffer) && + (NULL != p_rd_data)) + { + if (wr_idx >= rd_idx) + { + items_avail = wr_idx - rd_idx; + length = (length > items_avail ? items_avail : length); } - } + else + { + items_avail = p_ring_buff->buffer_size - rd_idx + wr_idx; + length = (length > items_avail ? items_avail : length); - memcpy_s(p_rd_data, len - over_flow, p_ring_buff->p_buffer + rd_idx, len - over_flow); - memcpy_s(p_rd_data + len - over_flow, over_flow, p_ring_buff->p_buffer, over_flow); + if (rd_idx + length >= p_ring_buff->buffer_size) + { + over_flow = length + rd_idx - p_ring_buff->buffer_size; + } + } + + memcpy(p_rd_data, p_ring_buff->p_buffer + rd_idx, length - over_flow); + memcpy(p_rd_data + length - over_flow, p_ring_buff->p_buffer, over_flow); + } + else + { + length = 0; + } RING_BUFFER_UNLOCK(); - return len; + return length; } uint32_t ring_buffer_items_count_get(ring_buffer_t *p_ring_buff) { + uint32_t count = 0; + if (NULL == p_ring_buff) + return 0; + + RING_BUFFER_LOCK(); + uint32_t wr_idx = p_ring_buff->write_index; uint32_t rd_idx = p_ring_buff->read_index; - if (rd_idx <= wr_idx) { - return wr_idx - rd_idx; - } else { - return p_ring_buff->buffer_size - rd_idx + wr_idx; + if (rd_idx <= wr_idx) + { + count = wr_idx - rd_idx; } + else + { + count = p_ring_buff->buffer_size - rd_idx + wr_idx; + } + + RING_BUFFER_UNLOCK(); + + return count; } uint32_t ring_buffer_surplus_space_get(ring_buffer_t *p_ring_buff) { - uint32_t surplus_space; - uint32_t wr_idx = p_ring_buff->write_index; - uint32_t rd_idx = p_ring_buff->read_index; + uint32_t surplus_space = 0; RING_BUFFER_LOCK(); - if (rd_idx > wr_idx) { - surplus_space = rd_idx - wr_idx - 1; - } else { - surplus_space = p_ring_buff->buffer_size - wr_idx + rd_idx - 1; + uint32_t wr_idx = p_ring_buff->write_index; + uint32_t rd_idx = p_ring_buff->read_index; + + if (NULL != p_ring_buff) + { + if (rd_idx > wr_idx) + { + surplus_space = rd_idx - wr_idx - 1; + } + else + { + surplus_space = p_ring_buff->buffer_size - wr_idx + rd_idx - 1; + } } RING_BUFFER_UNLOCK(); @@ -215,9 +276,13 @@ bool ring_buffer_is_reach_left_threshold(ring_buffer_t *p_ring_buff, uint32_t le uint32_t surplus_space; surplus_space = ring_buffer_surplus_space_get(p_ring_buff); - if (letf_threshold >= surplus_space) { + + if (letf_threshold >= surplus_space) + { return true; - } else { + } + else + { return false; } } @@ -226,8 +291,11 @@ void ring_buffer_clean(ring_buffer_t *p_ring_buff) { RING_BUFFER_LOCK(); - p_ring_buff->write_index = 0; - p_ring_buff->read_index = 0; + if (NULL != p_ring_buff) + { + p_ring_buff->write_index = 0; + p_ring_buff->read_index = 0; + } RING_BUFFER_UNLOCK(); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.h old mode 100755 new mode 100644 index 9d87d32..7e5e966 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/ring_buffer/ring_buffer.h @@ -48,7 +48,8 @@ * @defgroup RING_BUFFER_STRUCT Structures * @{ */ -typedef struct { +typedef struct +{ uint32_t buffer_size; /**< Size of ring buffer. */ uint8_t *p_buffer; /**< Pointer to buffer saved data. */ uint32_t write_index; /**< Index of write. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/BUILD.gn new file mode 100644 index 0000000..47dc7b6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("sensorsim") { + sources = [ "sensorsim.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.c new file mode 100644 index 0000000..da49de8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.c @@ -0,0 +1,103 @@ +/** + ***************************************************************************************** + * + * @file sensorsim.c + * + * @brief sensor simulator function Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "sensorsim.h" + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ + +void sensorsim_init(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg) +{ + if (p_cfg->start_at_max) + { + p_state->current_val = p_cfg->max; + p_state->is_increasing = false; + } + else + { + p_state->current_val = p_cfg->min; + p_state->is_increasing = true; + } +} + +int16_t sensorsim_measure(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg) +{ + if (p_state->is_increasing) + { + sensorsim_increment(p_state, p_cfg); + } + else + { + sensorsim_decrement(p_state, p_cfg); + } + + return p_state->current_val; +} + + +void sensorsim_increment(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg) +{ + if (p_cfg->max - p_state->current_val > p_cfg->incr) + { + p_state->current_val += p_cfg->incr; + } + else + { + p_state->current_val = p_cfg->max; + p_state->is_increasing = false; + } +} + +void sensorsim_decrement(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg) +{ + if (p_state->current_val - p_cfg->min > p_cfg->incr) + { + p_state->current_val -= p_cfg->incr; + } + else + { + p_state->current_val = p_cfg->min; + p_state->is_increasing = true; + } +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.h new file mode 100644 index 0000000..92648af --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/sensorsim/sensorsim.h @@ -0,0 +1,118 @@ +/** + ***************************************************************************************** + * + * @file sensorsim.h + * + * @brief Header file - sensor simulator + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef _SENSORSIM_H__ +#define _SENSORSIM_H__ + +#include +#include + +/** + * @defgroup SENSORSIM_STRUCT Structures + * @{ + */ +/**@brief Triangular waveform sensor simulator configuration. */ +typedef struct +{ + int16_t min; /**< Minimum simulated value. */ + int16_t max; /**< Maximum simulated value. */ + int16_t incr; /**< Increment between each measurement. */ + bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */ +} sensorsim_cfg_t; + +/**@brief Triangular waveform sensor simulator state. */ +typedef struct +{ + int16_t current_val; /**< Current sensor value. */ + bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */ +} sensorsim_state_t; +/** @} */ + + +/** + * @defgroup SENSORSIM_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Function for initializing a triangular waveform sensor simulator. + * + * @param[out] p_state: Current state of simulator. + * @param[in] p_cfg: Simulator configuration. + ***************************************************************************************** + */ +void sensorsim_init(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg); + +/** + ***************************************************************************************** + * @brief Function for generating a simulated sensor measurement using a triangular waveform generator. + * + * @param[in,out] p_state: Current state of simulator. + * @param[in] p_cfg: Simulator configuration. + * + * @retval ::Simulator output. + ***************************************************************************************** + */ +int16_t sensorsim_measure(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg); + +/** + ***************************************************************************************** + * @brief Function for incrementing a simulated sensor measurement value. + * + * @param[in,out] p_state: Current state of simulator. + * @param[in] p_cfg: Simulator configuration. + * + * @retval Simulator output. + ***************************************************************************************** + */ +void sensorsim_increment(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg); + +/** + ***************************************************************************************** + * @brief Function for decrementing a simulated sensor measurement value. + * + * @param[in,out] p_state: Current state of simulator. + * @param[in] p_cfg: Simulator configuration. + * + * @retval Simulator output. + ***************************************************************************************** + */ +void sensorsim_decrement(sensorsim_state_t *p_state, const sensorsim_cfg_t *p_cfg); +/** @} */ + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/BUILD.gn new file mode 100644 index 0000000..c81a661 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("user_efuse") { + sources = [ "user_efuse.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.c new file mode 100644 index 0000000..138e319 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.c @@ -0,0 +1,125 @@ +/** + ***************************************************************************************** + * + * @file user_efuse.c + * + * @brief efuse access function Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "user_efuse.h" +#include "string.h" +#include "grx_sys.h" +#include "grx_hal.h" + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint32_t user_efuse_write(uint8_t word_offset, uint32_t * efuse_value, uint8_t size_word) +{ + uint32_t ret = USER_EFUSE_ERROR_NONE; + efuse_handle_t efuse_handle = {0}; + + /* + * Reserved For Furture : Because the macro USER_EFUSE_BASE_OFFSET equal zero now, it will cause compiler warning. + * But in the furture, maybe USER_EFUSE_BASE_OFFSET will be another value. + */ + if( /*(word_offset < USER_EFUSE_BASE_OFFSET) || */(word_offset > (USER_EFUSE_BASE_OFFSET + USER_EFUSE_SIZE)) || (efuse_value == NULL)) + { + return USER_EFUSE_ERROR_INVALID_PARAM; + } + + if((word_offset + size_word * 4) > (USER_EFUSE_BASE_OFFSET + USER_EFUSE_SIZE)) + { + return USER_EFUSE_ERROR_INVALID_PARAM; + } + + do { + efuse_handle.p_instance = EFUSE; + efuse_handle.init.info_mode = DISABLE; + if(hal_efuse_init(&efuse_handle) != HAL_OK) + { + ret = USER_EFUSE_INIT_ERROR; + break; + } + + if(HAL_OK != hal_efuse_write(&efuse_handle, word_offset, efuse_value, size_word)) + { + ret = USER_EFUSE_WRITE_ERROR; + break; + } + } while(0); + hal_efuse_deinit(&efuse_handle); + return ret; +} + +uint32_t user_efuse_read(uint8_t word_offset, uint32_t *data, uint8_t size_word) +{ + uint32_t ret = USER_EFUSE_ERROR_NONE; + efuse_handle_t efuse_handle = {0}; + + /* + * Reserved For Furture : Because the macro USER_EFUSE_BASE_OFFSET equal zero now, it will cause compiler warning. + * But in the furture, maybe USER_EFUSE_BASE_OFFSET will be another value. + */ + if( /*(word_offset < USER_EFUSE_BASE_OFFSET) || */(word_offset > (USER_EFUSE_BASE_OFFSET + USER_EFUSE_SIZE)) || (data == NULL)) + { + return USER_EFUSE_ERROR_INVALID_PARAM; + } + + if((word_offset + size_word * 4) > (USER_EFUSE_BASE_OFFSET + USER_EFUSE_SIZE)) + { + return USER_EFUSE_ERROR_INVALID_PARAM; + } + + do { + efuse_handle.p_instance = EFUSE; + efuse_handle.init.info_mode = DISABLE; + if(hal_efuse_init(&efuse_handle) != HAL_OK) + { + ret = USER_EFUSE_INIT_ERROR; + break; + } + + if(HAL_OK != hal_efuse_read(&efuse_handle, word_offset, data, size_word)) + { + return USER_EFUSE_READ_ERROR; + } + }while(0); + hal_efuse_deinit(&efuse_handle); + return ret; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.h new file mode 100644 index 0000000..0b55272 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/user_efuse/user_efuse.h @@ -0,0 +1,89 @@ +/** + ***************************************************************************************** + * + * @file user_efuse.h + * + * @brief efuse access API. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __USER_EFUSE_H__ +#define __USER_EFUSE_H__ + +#include +#include + +/** + * @defgroup USER_EFUSE_MAROC Defines + * @{ + */ +#define USER_EFUSE_BASE_OFFSET EFUSE_OFFSET_USER_DSVD /**< User eFuse offset */ +#define USER_EFUSE_SIZE (0x0020UL) /**< User eFuse size */ + +#define USER_EFUSE_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define USER_EFUSE_INIT_ERROR ((uint32_t)0x00000001) /**< INIT error */ +#define USER_EFUSE_WRITE_ERROR ((uint32_t)0x00000002) /**< WRITE error */ +#define USER_EFUSE_READ_ERROR ((uint32_t)0x00000004) /**< READ error */ +#define USER_EFUSE_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +/** @} */ + +/** + * @defgroup USER_EFUSE_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief efuse write + * + * @param[in] offset: Offset + * @param[in] efuse_value: Pointer to data + * @param[in] size_word: Write data size + * + * @return the error code of this funciton + ***************************************************************************************** + */ +uint32_t user_efuse_write(uint8_t offset, uint32_t *efuse_value, uint8_t size_word); + +/** + ***************************************************************************************** + * @brief efuse read + * + * @param[in] word_offset: Offset + * @param[in] data: Pointer to data + * @param[in] size_word: Read data size + * + * @return the error code of this funciton + ***************************************************************************************** + */ +uint32_t user_efuse_read(uint8_t word_offset, uint32_t *data, uint8_t size_word); +/** @} */ + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/BUILD.gn new file mode 100644 index 0000000..1c4ef62 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("utility") { + sources = [ "utility.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.c b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.c old mode 100755 new mode 100644 index 07a9139..6c4e958 --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.c @@ -41,176 +41,148 @@ */ #include "utility.h" -/* - * DEFINES - ***************************************************************************************** - */ - -#define ITEM_0 0 -#define ITEM_1 1 -#define ITEM_2 2 -#define ITEM_3 3 -#define ITEM_4 4 -#define ITEM_5 5 -#define ITEM_6 6 -#define ITEM_7 7 - -#define BIT_8 8 -#define BIT_16 16 -#define BIT_24 24 -#define BIT_32 32 -#define BIT_40 40 -#define BIT_48 48 -#define BIT_56 56 - -#define OFFSET_0 0 -#define OFFSET_1 1 -#define OFFSET_2 2 -#define OFFSET_3 3 -#define OFFSET_4 4 - /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** */ -void htole16(uint8_t *p_buf, uint16_t x) +void htole16(void *buf, uint16_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t) x; - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_8); + u8ptr = buf; + u8ptr[0] = (uint8_t) x; + u8ptr[1] = (uint8_t)(x >> 8); } -void htole32(uint8_t *p_buf, uint32_t x) +void htole32(void *buf, uint32_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t) x; - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_2] = (uint8_t)(x >> BIT_16); - u8ptr[ITEM_3] = (uint8_t)(x >> BIT_24); + u8ptr = buf; + u8ptr[0] = (uint8_t) x; + u8ptr[1] = (uint8_t)(x >> 8); + u8ptr[2] = (uint8_t)(x >> 16); + u8ptr[3] = (uint8_t)(x >> 24); } -void htole64(uint8_t *p_buf, uint64_t x) +void htole64(void *buf, uint64_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t) x; - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_2] = (uint8_t)(x >> BIT_16); - u8ptr[ITEM_3] = (uint8_t)(x >> BIT_24); - u8ptr[ITEM_4] = (uint8_t)(x >> BIT_32); - u8ptr[ITEM_5] = (uint8_t)(x >> BIT_40); - u8ptr[ITEM_6] = (uint8_t)(x >> BIT_48); - u8ptr[ITEM_7] = (uint8_t)(x >> BIT_56); + u8ptr = buf; + u8ptr[0] = (uint8_t) x; + u8ptr[1] = (uint8_t)(x >> 8); + u8ptr[2] = (uint8_t)(x >> 16); + u8ptr[3] = (uint8_t)(x >> 24); + u8ptr[4] = (uint8_t)(x >> 32); + u8ptr[5] = (uint8_t)(x >> 40); + u8ptr[6] = (uint8_t)(x >> 48); + u8ptr[7] = (uint8_t)(x >> 56); } -uint16_t le16toh(const uint8_t *p_buf) +uint16_t le16toh(const void *buf) { const uint8_t *u8ptr; uint16_t x; - u8ptr = p_buf; - x = u8ptr[ITEM_0]; - x |= (uint16_t) u8ptr[ITEM_1] << BIT_8; + u8ptr = buf; + x = u8ptr[0]; + x |= (uint16_t) u8ptr[1] << 8; return x; } -uint32_t le32toh(const uint8_t *p_buf) +uint32_t le32toh(const void *buf) { const uint8_t *u8ptr; uint32_t x; - u8ptr = p_buf; - x = u8ptr[ITEM_0]; - x |= (uint32_t) u8ptr[ITEM_1] << BIT_8; - x |= (uint32_t) u8ptr[ITEM_2] << BIT_16; - x |= (uint32_t) u8ptr[ITEM_3] << BIT_24; + u8ptr = buf; + x = u8ptr[0]; + x |= (uint32_t) u8ptr[1] << 8; + x |= (uint32_t) u8ptr[2] << 16; + x |= (uint32_t) u8ptr[3] << 24; return x; } -uint64_t le64toh(const uint8_t *p_buf) +uint64_t le64toh(const void *buf) { const uint8_t *u8ptr; uint64_t x; - u8ptr = p_buf; - x = u8ptr[ITEM_0]; - x |= (uint64_t) u8ptr[ITEM_1] << BIT_8; - x |= (uint64_t) u8ptr[ITEM_2] << BIT_16; - x |= (uint64_t) u8ptr[ITEM_3] << BIT_24; - x |= (uint64_t) u8ptr[ITEM_4] << BIT_32; - x |= (uint64_t) u8ptr[ITEM_5] << BIT_40; - x |= (uint64_t) u8ptr[ITEM_6] << BIT_48; - x |= (uint64_t) u8ptr[ITEM_7] << BIT_56; + u8ptr = buf; + x = u8ptr[0]; + x |= (uint64_t) u8ptr[1] << 8; + x |= (uint64_t) u8ptr[2] << 16; + x |= (uint64_t) u8ptr[3] << 24; + x |= (uint64_t) u8ptr[4] << 32; + x |= (uint64_t) u8ptr[5] << 40; + x |= (uint64_t) u8ptr[6] << 48; + x |= (uint64_t) u8ptr[7] << 56; return x; } -void htobe16(uint8_t *p_buf, uint16_t x) +void htobe16(void *buf, uint16_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_1] = (uint8_t) x; + u8ptr = buf; + u8ptr[0] = (uint8_t)(x >> 8); + u8ptr[1] = (uint8_t) x; } -void htobe32(uint8_t *p_buf, uint32_t x) +void htobe32(void *buf, uint32_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t)(x >> BIT_24); - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_16); - u8ptr[ITEM_2] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_3] = (uint8_t) x; + u8ptr = buf; + u8ptr[0] = (uint8_t)(x >> 24); + u8ptr[1] = (uint8_t)(x >> 16); + u8ptr[2] = (uint8_t)(x >> 8); + u8ptr[3] = (uint8_t) x; } -void htobe64(uint8_t *p_buf, uint64_t x) +void htobe64(void *buf, uint64_t x) { uint8_t *u8ptr; - u8ptr = p_buf; - u8ptr[ITEM_0] = (uint8_t)(x >> BIT_56); - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_48); - u8ptr[ITEM_2] = (uint8_t)(x >> BIT_40); - u8ptr[ITEM_3] = (uint8_t)(x >> BIT_32); - u8ptr[ITEM_4] = (uint8_t)(x >> BIT_24); - u8ptr[ITEM_5] = (uint8_t)(x >> BIT_16); - u8ptr[ITEM_6] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_7] = (uint8_t) x; + u8ptr = buf; + u8ptr[0] = (uint8_t)(x >> 56); + u8ptr[1] = (uint8_t)(x >> 48); + u8ptr[2] = (uint8_t)(x >> 40); + u8ptr[3] = (uint8_t)(x >> 32); + u8ptr[4] = (uint8_t)(x >> 24); + u8ptr[5] = (uint8_t)(x >> 16); + u8ptr[6] = (uint8_t)(x >> 8); + u8ptr[7] = (uint8_t) x; } -uint16_t be16toh(const uint8_t *p_buf) +uint16_t be16toh(const void *buf) { const uint8_t *u8ptr; uint16_t x; - u8ptr = p_buf; - x = (uint16_t) u8ptr[ITEM_0] << BIT_8; - x |= u8ptr[ITEM_1]; + u8ptr = buf; + x = (uint16_t) u8ptr[0] << 8; + x |= u8ptr[1]; return x; } -uint32_t be32toh(const uint8_t *p_buf) +uint32_t be32toh(const void *buf) { const uint8_t *u8ptr; uint32_t x; - u8ptr = p_buf; - x = (uint32_t) u8ptr[ITEM_0] << BIT_24; - x |= (uint32_t) u8ptr[ITEM_1] << BIT_16; - x |= (uint32_t) u8ptr[ITEM_2] << BIT_8; - x |= u8ptr[ITEM_3]; + u8ptr = buf; + x = (uint32_t) u8ptr[0] << 24; + x |= (uint32_t) u8ptr[1] << 16; + x |= (uint32_t) u8ptr[2] << 8; + x |= u8ptr[3]; return x; } -uint64_t be64toh(const uint8_t *p_buf) +uint64_t be64toh(const void *buf) { const uint8_t *u8ptr; uint64_t x; - u8ptr = p_buf; - x = (uint64_t) u8ptr[ITEM_0] << BIT_56; - x |= (uint64_t) u8ptr[ITEM_1] << BIT_48; - x |= (uint64_t) u8ptr[ITEM_2] << BIT_40; - x |= (uint64_t) u8ptr[ITEM_3] << BIT_32; - x |= (uint64_t) u8ptr[ITEM_4] << BIT_24; - x |= (uint64_t) u8ptr[ITEM_5] << BIT_16; - x |= (uint64_t) u8ptr[ITEM_6] << BIT_8; - x |= u8ptr[ITEM_7]; + u8ptr = buf; + x = (uint64_t) u8ptr[0] << 56; + x |= (uint64_t) u8ptr[1] << 48; + x |= (uint64_t) u8ptr[2] << 40; + x |= (uint64_t) u8ptr[3] << 32; + x |= (uint64_t) u8ptr[4] << 24; + x |= (uint64_t) u8ptr[5] << 16; + x |= (uint64_t) u8ptr[6] << 8; + x |= u8ptr[7]; return x; } @@ -219,8 +191,8 @@ uint8_t get_u8_inc(const uint8_t **pp_buf) const uint8_t *u8ptr; uint8_t x; u8ptr = *pp_buf; - x = u8ptr[ITEM_0]; - *pp_buf += OFFSET_1; + x = u8ptr[0]; + *pp_buf += 1; return x; } @@ -229,9 +201,9 @@ uint16_t get_u16_inc(const uint8_t **pp_buf) const uint8_t *u8ptr; uint16_t x; u8ptr = *pp_buf; - x = u8ptr[ITEM_0]; - x |= (uint16_t) u8ptr[ITEM_1] << BIT_8; - *pp_buf += OFFSET_2; + x = u8ptr[0]; + x |= (uint16_t) u8ptr[1] << 8; + *pp_buf += 2; return x; } @@ -240,11 +212,11 @@ uint32_t get_u32_inc(const uint8_t **pp_buf) const uint8_t *u8ptr; uint32_t x; u8ptr = *pp_buf; - x = u8ptr[ITEM_0]; - x |= (uint32_t) u8ptr[ITEM_1] << BIT_8; - x |= (uint32_t) u8ptr[ITEM_2] << BIT_16; - x |= (uint32_t) u8ptr[ITEM_3] << BIT_24; - *pp_buf += OFFSET_4; + x = u8ptr[0]; + x |= (uint32_t) u8ptr[1] << 8; + x |= (uint32_t) u8ptr[2] << 16; + x |= (uint32_t) u8ptr[3] << 24; + *pp_buf += 4; return x; } @@ -252,27 +224,27 @@ void put_u8_inc(uint8_t **pp_buf, uint8_t x) { uint8_t *u8ptr; u8ptr = *pp_buf; - u8ptr[ITEM_0] = x; - *pp_buf += OFFSET_1; + u8ptr[0] = x; + *pp_buf += 1; } void put_u16_inc(uint8_t **pp_buf, uint16_t x) { uint8_t *u8ptr; u8ptr = *pp_buf; - u8ptr[ITEM_0] = (uint8_t) x; - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_8); - *pp_buf += OFFSET_2; + u8ptr[0] = (uint8_t) x; + u8ptr[1] = (uint8_t)(x >> 8); + *pp_buf += 2; } void put_u32_inc(uint8_t **pp_buf, uint32_t x) { uint8_t *u8ptr; u8ptr = *pp_buf; - u8ptr[ITEM_0] = (uint8_t) x; - u8ptr[ITEM_1] = (uint8_t)(x >> BIT_8); - u8ptr[ITEM_2] = (uint8_t)(x >> BIT_16); - u8ptr[ITEM_3] = (uint8_t)(x >> BIT_24); - *pp_buf += OFFSET_4; + u8ptr[0] = (uint8_t) x; + u8ptr[1] = (uint8_t)(x >> 8); + u8ptr[2] = (uint8_t)(x >> 16); + u8ptr[3] = (uint8_t)(x >> 24); + *pp_buf += 4; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.h old mode 100755 new mode 100644 index cd7ad9c..fbad73e --- a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/utility/utility.h @@ -71,54 +71,39 @@ extern "C" { #define B_FAIL ((uint8_t)0xFF) #ifndef BV -static inline uint8_t BV(uint32_t n) -{ - return (uint8_t)(1 << n); -} +#define BV(n) (uint8_t)(1 << (n)) #endif #ifndef BF -static inline uint8_t BF(uint32_t x, uint32_t b, uint32_t s) -{ - return ((uint8_t)((x) & (b)) >> (s)); -} +#define BF(x, b, s) ((uint8_t)((x) & (b)) >> (s)) #endif #ifndef MIN -static inline uint32_t MIN(uint32_t n, uint32_t m) -{ - return (((n) < (m)) ? (n) : (m)); -} +#define MIN(n, m) (((n) < (m)) ? (n) : (m)) #endif #ifndef MAX -static inline uint32_t MAX(uint32_t n, uint32_t m) -{ - return (((n) < (m)) ? (m) : (n)); -} +#define MAX(n, m) (((n) < (m)) ? (m) : (n)) #endif #ifndef ABS -static inline uint32_t ABS(int32_t n) -{ - return (((n) < 0) ? -(n) : (n)); -} +#define ABS(n) (((n) < 0) ? -(n) : (n)) #endif #ifndef ALIGN_NUM #define ALIGN_NUM(align, num) (((num) - 1) + (align) - (((num) - 1) % (align))) #endif -#define BIT_MASK(n) (uint8_t)(((1) << (n)) - 1) +#define BIT_MASK(n) (uint8_t)(((1) << n) - 1) -/* takes a byte out of a uint32:var -uint32, ByteNum - byte tao take out(0-3) */ +/*takes a byte out of a uint32:var -uint32, ByteNum - byte tao take out(0-3)*/ #define BREAK_U32(var, ByteNum) (uint8_t)((uint32_t)(((var) >> ((uint8_t)((ByteNum) * 8))) & 0x00FF)) #define BUILD_U32(Byte0, Byte1, Byte2, Byte3) \ - ((uint32_t)((uint32_t)((Byte0) & 0x00FF) + \ - ((uint32_t)((Byte1) & 0x00FF) << 8) + \ - ((uint32_t)((Byte2) & 0x00FF) << 16) + \ - ((uint32_t)((Byte3) & 0x00FF) << 24))) + ((uint32_t)((uint32_t)((Byte0) & 0x00FF) + \ + ((uint32_t)((Byte1) & 0x00FF) << 8) + \ + ((uint32_t)((Byte2) & 0x00FF) << 16) + \ + ((uint32_t)((Byte3) & 0x00FF) << 24))) #define HI_UINT32_T(a) (((a) >> 24) & 0xFF) #define L3_UINT32_T(a) (((a) >> 16) & 0xFF) @@ -153,16 +138,16 @@ static inline uint32_t ABS(int32_t n) #endif #ifndef GET_BITFIELD -#define GET_BITFIELD(var, MSB, LSB) ((uint8_t)((var) << (7 - (MSB))) >> ((7 - (MSB)) + (LSB))) +#define GET_BITFIELD(var, MSB, LSB) ((uint8_t)((var) << (7 - MSB)) >> ((7 - MSB) + LSB)) #endif #ifndef SET_BITFIELD #define SET_BITFIELD(var, MSB, LSB, value) ((uint8_t)(var) = \ - (uint8_t)(((var) & (~(BIT_MASK(((MSB) - (LSB)))<<(LSB)))) | (((value) & BIT_MASK(((MSB) - (LSB)))) << (LSB)))) + (uint8_t)((var & (~(BIT_MASK((MSB - LSB))< +#include "user_periph_setup.h" +#include "uart_simu_key_init.h" +#include "grx_sys.h" +#include "custom_config.h" +#include "app_assert.h" +#include "app_log.h" +#include "app_error.h" +#include "board_SK.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define UART_TX_BUFFER_SIZE 0x400 +#define UART_RX_BUFFER_SIZE 244 + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +static app_uart_tx_buf_t s_uart_buffer; +static app_uart_params_t s_uart_param; + +static uint8_t s_uart_tx_buffer[UART_TX_BUFFER_SIZE] = {0}; +static uint8_t s_uart_rx_buffer[UART_RX_BUFFER_SIZE] = {0}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_uart_rx_handler(app_uart_evt_t *p_evt) +{ + if (APP_UART_EVT_RX_DATA == p_evt->type) + { + uint8_t key_id = 0xFF; + app_key_click_type_t key_click_type; + uint8_t rx_buf_offset = 0; + + if (!memcmp(s_uart_rx_buffer, VIR_KEY_UP_CMD, strlen(VIR_KEY_UP_CMD))) + { + rx_buf_offset += strlen(VIR_KEY_UP_CMD); + key_id = VIR_KEY_UP_ID; + } + else if (!memcmp(s_uart_rx_buffer, VIR_KEY_DOWN_CMD, strlen(VIR_KEY_DOWN_CMD))) + { + rx_buf_offset += strlen(VIR_KEY_DOWN_CMD); + key_id = VIR_KEY_DOWN_ID; + } + else if (!memcmp(s_uart_rx_buffer, VIR_KEY_LEFT_CMD, strlen(VIR_KEY_LEFT_CMD))) + { + rx_buf_offset += strlen(VIR_KEY_LEFT_CMD); + key_id = VIR_KEY_LEFT_ID; + } + else if (!memcmp(s_uart_rx_buffer, VIR_KEY_RIGHT_CMD, strlen(VIR_KEY_RIGHT_CMD))) + { + rx_buf_offset += strlen(VIR_KEY_RIGHT_CMD); + key_id = VIR_KEY_RIGHT_ID; + } + else if (!memcmp(s_uart_rx_buffer, VIR_KEY_OK_CMD, strlen(VIR_KEY_OK_CMD))) + { + rx_buf_offset += strlen(VIR_KEY_OK_CMD); + key_id = VIR_KEY_OK_ID; + } + + /* Determine the click type. */ + if (!memcmp(&(s_uart_rx_buffer[rx_buf_offset]), VIR_KEY_DOUBLE_PRESS, strlen(VIR_KEY_DOUBLE_PRESS))) + { + if (!memcmp(&(s_uart_rx_buffer[rx_buf_offset]), VIR_KEY_LONG_PRESS, strlen(VIR_KEY_LONG_PRESS))) + { + key_click_type = APP_KEY_LONG_CLICK; + } + else + { + key_click_type = APP_KEY_DOUBLE_CLICK; + } + } + else if (!memcmp(&(s_uart_rx_buffer[rx_buf_offset]), VIR_KEY_CONTINUE_PRESS, strlen(VIR_KEY_CONTINUE_PRESS))) + { + if (!memcmp(&(s_uart_rx_buffer[rx_buf_offset]), VIR_KEY_CONTINUE_RELEASE, strlen(VIR_KEY_CONTINUE_RELEASE))) + { + key_click_type = APP_KEY_CONTINUE_CLICK; + } + else + { + key_click_type = APP_KEY_CONTINUE_RELEASE; + } + } + else + { + key_click_type = APP_KEY_SINGLE_CLICK; + } + + memset(s_uart_rx_buffer,0,UART_RX_BUFFER_SIZE); + app_key_evt_handler(key_id, key_click_type); + } +} + +static void uart_evt_handler(app_uart_evt_t *p_evt) +{ + if (APP_UART_EVT_RX_DATA == p_evt->type) + { + app_uart_rx_handler(p_evt); + app_uart_receive_async(APP_UART_ID, s_uart_rx_buffer, UART_RX_BUFFER_SIZE); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +void uart_simu_key_init(void) +{ + s_uart_buffer.tx_buf = s_uart_tx_buffer; + s_uart_buffer.tx_buf_size = UART_TX_BUFFER_SIZE; + + s_uart_param.id = APP_UART_ID; + s_uart_param.init.baud_rate = APP_UART_BAUDRATE; + s_uart_param.init.data_bits = UART_DATABITS_8; + s_uart_param.init.stop_bits = UART_STOPBITS_1; + s_uart_param.init.parity = UART_PARITY_NONE; + s_uart_param.init.hw_flow_ctrl = UART_HWCONTROL_NONE; + s_uart_param.init.rx_timeout_mode = UART_RECEIVER_TIMEOUT_ENABLE; + s_uart_param.pin_cfg.rx.type = APP_UART_RX_IO_TYPE; + s_uart_param.pin_cfg.rx.pin = APP_UART_RX_PIN; + s_uart_param.pin_cfg.rx.mux = APP_UART_RX_PINMUX; + s_uart_param.pin_cfg.rx.pull = APP_UART_RX_PULL; + s_uart_param.pin_cfg.tx.type = APP_UART_TX_IO_TYPE; + s_uart_param.pin_cfg.tx.pin = APP_UART_TX_PIN; + s_uart_param.pin_cfg.tx.mux = APP_UART_TX_PINMUX; + s_uart_param.pin_cfg.tx.pull = APP_UART_TX_PULL; + s_uart_param.dma_cfg.tx_dma_instance = DMA0; + s_uart_param.dma_cfg.rx_dma_instance = DMA0; + s_uart_param.dma_cfg.tx_dma_channel = DMA_Channel2; + s_uart_param.dma_cfg.rx_dma_channel = DMA_Channel3; + + app_uart_init(&s_uart_param, uart_evt_handler, &s_uart_buffer); + app_uart_receive_async(APP_UART_ID, s_uart_rx_buffer, UART_RX_BUFFER_SIZE); +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/libraries/virt_key/uart_simu_key_init.h b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/virt_key/uart_simu_key_init.h new file mode 100644 index 0000000..3e1675c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/libraries/virt_key/uart_simu_key_init.h @@ -0,0 +1,75 @@ +/** + ***************************************************************************************** + * + * @file user_simu_key_init.h + * + * @brief Header file - User Function + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef _UART_SIMU_KEY_INIT_H_ +#define _UART_SIMU_KEY_INIT_H_ + +/* + * DEFINES + ***************************************************************************************** + */ +#define VIR_KEY_UP_ID 0x00 /**< ID for Virtual UP KEY. */ +#define VIR_KEY_DOWN_ID 0x01 /**< ID for Virtual DOWN KEY. */ +#define VIR_KEY_LEFT_ID 0x02 /**< ID for Virtual LEFT KEY. */ +#define VIR_KEY_RIGHT_ID 0x03 /**< ID for Virtual RIGHT KEY. */ +#define VIR_KEY_OK_ID 0x04 /**< ID for Virtual OK KEY. */ + +#define VIR_KEY_UP_CMD "up" /**< Command for Virtual UP KEY. */ +#define VIR_KEY_DOWN_CMD "down" /**< Command for Virtual DOWN KEY. */ +#define VIR_KEY_LEFT_CMD "left" /**< Command for Virtual LEFT KEY. */ +#define VIR_KEY_RIGHT_CMD "right" /**< Command for Virtual RIGHT KEY. */ +#define VIR_KEY_OK_CMD "ok" /**< Command for Virtual OK KEY. */ +#define VIR_KEY_DOUBLE_PRESS "+" /**< Double press click type. */ +#define VIR_KEY_LONG_PRESS "++" /**< Long press click type. */ +#define VIR_KEY_CONTINUE_PRESS "-" /**< Continue press click type. */ +#define VIR_KEY_CONTINUE_RELEASE "--" /**< Continue release click type. */ + +/* + * GLOBAL FUNCTION DECLARATION + ***************************************************************************************** + */ +/** + ***************************************************************************************** + * @brief Function for ble stack init complete + ***************************************************************************************** + */ +void uart_simu_key_init(void); + +/** @} */ + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/BUILD.gn new file mode 100644 index 0000000..c81e063 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/BUILD.gn @@ -0,0 +1,73 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +module_group("profiles") { + modules = [ + # "wss", + "hts", + "common", + "sample", + "cts_c", + "ths_c", + "gus_c", + + # "cts", + "otas", + "otas_c", + "hrrcps", + "tps", + "ans_c", + + # "mlmr", + "bas", + "ans", + "cscs", + "bas_c", + "lms", + "lns", + "dis_c", + "lls", + "dss", + + # "uds", + "hrs_c", + "tps_c", + "rscs_c", + "gus", + "ias", + "rtus", + "ths", + "dis", + "ias_c", + + # "mlmr_c", + "lls_c", + "ndcs", + "rscs", + + # "ags", + "pass", + "gls", + "ancs_c", + + # "bcs", + "pcs", + "pass_c", + "hrs", + "hids", + "bps", + "ams_c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/BUILD.gn new file mode 100644 index 0000000..663c137 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ags") { + sources = [ "ags.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.c index 85c228d..3902cde 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.c @@ -46,15 +46,12 @@ #include "utility.h" #include "app_log.h" #include "app_error.h" -#define MAX_PACKET_SIZE_OFFSET 3 -#define INDEX_0 0 -#define INDEX_1 1 -#define INDEX_2 2 + /* * DEFINES ***************************************************************************************** */ -/**@brief The UUIDs of AGS characteristics. +/**@brief The UUIDs of AGS characteristics. * The Tx channel transmits data from an Echo device to a gadget. * The Rx channel reansmits data from a gadget to an Echo device. */ @@ -72,7 +69,8 @@ ***************************************************************************************** */ /**@brief Alexa Gadget Service Attributes Indexes. */ -enum { +enum +{ AGS_IDX_SVC, AGS_IDX_TX_CHAR, @@ -90,17 +88,18 @@ enum { ***************************************************************************************** */ /**@brief Alexa Gadget Service environment variable. */ -struct ags_env_t { - ags_init_t ags_init; /**< Alexa Gadget Service initialization variables. */ - uint16_t start_hdl; /**< Alexa Gadget Service start handle. */ - ags_stream_env_t ags_stream_env[3]; /**< The environment variable of gadget stream. */ - uint16_t - rx_ntf_cfg[AGS_CONNECTION_MAX]; /**< The configuration of Rx Notification \ - which is configured by the peer devices. */ +struct ags_env_t +{ + ags_init_t ags_init; /**< Alexa Gadget Service initialization variables. */ + uint16_t start_hdl; /**< Alexa Gadget Service start handle. */ + ags_stream_env_t ags_stream_env[3]; /**< The environment variable of gadget stream. */ + uint16_t rx_ntf_cfg[AGS_CONNECTION_MAX]; /**< The configuration of Rx Notification which is configured by the peer devices. */ + ble_gatts_create_db_t ags_gatts_db; /**< Alexa Gadget Service attributs database. */ }; /**@brief Alexa Gadget stream payload. */ -typedef struct { +typedef struct +{ uint8_t p_data[USER_GADGET_TRANSACTION_BUF_SIZE]; /**< Gadget stream payload. */ uint16_t length; /**< Length of data. */ uint16_t offset; /**< Offset of data. */ @@ -110,126 +109,56 @@ typedef struct { * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t ags_init(void); -static void ags_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void ags_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void ags_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void ags_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - static sdk_err_t ags_echo_rx_val_chunk(uint8_t conn_idx); static sdk_err_t ags_stream_ack_send(uint8_t conn_idx, uint8_t stream_env_id, bool ack_flag); -static void ags_echo_tx_val_decode(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); -static void ags_encode_ack(ags_ack_packet_t *p_ack_packet, uint8_t stream_id, uint8_t trxn_id, bool ack_flag); -static void ags_encode_header(uint8_t *header, uint8_t stream_id, uint8_t trxn_type, uint8_t payload_length, - uint16_t trxn_length); +static void ags_echo_tx_val_decode(uint8_t conn_idx, const uint8_t *buf, uint16_t length); +static void ags_encode_ack(ags_ack_packet_t *ack_packet, uint8_t stream_id, uint8_t trxn_id, bool ack_flag); +static void ags_encode_header(void *header, uint8_t stream_id, uint8_t trxn_type, uint8_t payload_length, uint16_t trxn_length); static void ags_reset_stream(uint8_t stream_env_id, uint16_t total_length); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct ags_env_t s_ags_env; -static uint8_t s_gadget_tx_buffer[244]; -static uint8_t s_trxn_counter; -static uint8_t s_tx_sequ_num; +static struct ags_env_t s_ags_env; +static uint8_t s_gadget_tx_buffer[244]; +static uint8_t s_trxn_counter; +static uint8_t s_tx_sequ_num; static ags_stream_payload_t s_ags_stream_payload; +static const uint8_t s_ags_svc_uuid[] = {AGS_SERVICE_UUID}; /**@brief Full AGS Database Description - Used to add attributes into the database. */ -static const attm_desc_128_t ags_attr_tab[AGS_IDX_NB] = { +static const ble_gatts_attm_desc_128_t ags_attr_tab[AGS_IDX_NB] = +{ // Alexa Gadget Service Declaration - [AGS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [AGS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // AGS Tx Characteristic - Declaration - [AGS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [AGS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // AGS Tx Characteristic - Value - [AGS_IDX_TX_VAL] = { - AGS_TX_UUID, - WRITE_REQ_PERM(UNAUTH) | WRITE_CMD_PERM(UNAUTH), - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - AGS_TX_VAL_LEN_MAX - }, - + [AGS_IDX_TX_VAL] = {AGS_TX_UUID, + BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_UNAUTH), + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + AGS_TX_VAL_LEN_MAX}, + // AGS Tx Characteristic - Declaration - [AGS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [AGS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // AGS Tx Characteristic - Value - [AGS_IDX_RX_VAL] = { - AGS_RX_UUID, - NOTIFY_PERM(UNAUTH), - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - AGS_RX_VAL_LEN_MAX - }, + [AGS_IDX_RX_VAL] = {AGS_RX_UUID, + BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH), + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + AGS_RX_VAL_LEN_MAX}, // AGS Tx Characteristic - Client Characteristic Configuration Descriptor - [AGS_IDX_RX_NTF_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - 0, - 0 - }, -}; - -/**@brief AGS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t ags_task_cbs = { - (prf_init_func_t) ags_init, - NULL, - NULL, -}; - -/**@brief AGS Task Callbacks. */ -static gatts_prf_cbs_t ags_cb_func = { - ags_read_att_cb, - ags_write_att_cb, - NULL, - ags_ntf_ind_cb, - ags_cccd_set_cb -}; - -/**@brief AGS Information. */ -static const prf_server_info_t ags_prf_info = { - .max_connection_nb = AGS_CONNECTION_MAX, - .manager_cbs = &ags_task_cbs, - .gatts_prf_cbs = &ags_cb_func, + [AGS_IDX_RX_NTF_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Alexa Gadget service create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t ags_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t ags_svc_uuid[] = {AGS_SERVICE_UUID}; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = ags_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_ags_env.ags_init.char_mask); - gatts_db.max_nb_attr = AGS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = ags_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_ags_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -238,18 +167,19 @@ static sdk_err_t ags_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void ags_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void ags_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_ags_env.start_hdl, - AGS_IDX_NB, - (uint8_t *)&s_ags_env.ags_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_ags_env.start_hdl, + AGS_IDX_NB, + (uint8_t *)&s_ags_env.ags_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case AGS_IDX_RX_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_ags_env.rx_ntf_cfg[conn_idx]; @@ -272,13 +202,13 @@ static void ags_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void ags_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void ags_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t tab_index = 0; - uint16_t cccd_value = 0; - ags_evt_t event; - gatts_write_cfm_t cfm; + uint16_t handle = p_param->handle; + uint16_t tab_index = 0; + uint16_t cccd_value = 0; + ags_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_ags_env.start_hdl, @@ -288,18 +218,19 @@ static void ags_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par cfm.status = BLE_SUCCESS; event.evt_type = AGS_EVT_INVALID; event.conn_idx = conn_idx; - - switch (tab_index) { + + switch (tab_index) + { case AGS_IDX_TX_VAL: ags_echo_tx_val_decode(conn_idx, p_param->value, p_param->length); event.evt_type = AGS_EVT_ECHO_TX_DATA_RECEIVED; break; - + case AGS_IDX_RX_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - AGS_EVT_ECHO_RX_NOTI_ENABLE :\ - AGS_EVT_ECHO_RX_NOTI_DISABLE); + AGS_EVT_ECHO_RX_NOTI_ENABLE :\ + AGS_EVT_ECHO_RX_NOTI_DISABLE); s_ags_env.rx_ntf_cfg[conn_idx] = cccd_value; break; @@ -310,8 +241,8 @@ static void ags_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && - AGS_EVT_INVALID != event.evt_type && s_ags_env.ags_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && AGS_EVT_INVALID != event.evt_type && s_ags_env.ags_init.evt_handler) + { s_ags_env.ags_init.evt_handler(&event); } } @@ -325,12 +256,13 @@ static void ags_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void ags_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void ags_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; ags_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -342,11 +274,12 @@ static void ags_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = AGS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case AGS_IDX_RX_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - AGS_EVT_ECHO_RX_NOTI_ENABLE :\ - AGS_EVT_ECHO_RX_NOTI_DISABLE); + AGS_EVT_ECHO_RX_NOTI_ENABLE :\ + AGS_EVT_ECHO_RX_NOTI_DISABLE); s_ags_env.rx_ntf_cfg[conn_idx] = cccd_value; break; @@ -354,7 +287,8 @@ static void ags_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (AGS_EVT_INVALID != event.evt_type && s_ags_env.ags_init.evt_handler) { + if (AGS_EVT_INVALID != event.evt_type && s_ags_env.ags_init.evt_handler) + { s_ags_env.ags_init.evt_handler(&event); } } @@ -364,14 +298,16 @@ static void ags_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @brief Handles reception of the complete event. * * @param[in] conn_idx: Connection index. - * @param[in] status: The status of the complete event. + * @param[in] status: The status of the complete event. * @param[in] p_ntf_id: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void ags_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void ags_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_ags_env.ags_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (s_ags_env.ags_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { ags_echo_rx_val_chunk(conn_idx); } } @@ -410,43 +346,55 @@ static void ags_echo_tx_val_decode(uint8_t conn_idx, const uint8_t *p_data, uint uint16_t payload_length; uint16_t payload_offset; - if (p_data == NULL || (length < sizeof(ags_header_base_t))) { + if (NULL == p_data || (length < sizeof(ags_header_base_t))) + { APP_LOG_DEBUG("Unexcepted length: %d", length); return; } ags_header_base_t *p_header_base = (ags_header_base_t *)p_data; - for (uint8_t i = 0; i < ARRAY_SIZE(s_ags_env.ags_stream_env); i++) { - if (s_ags_env.ags_stream_env[i].stream_id == p_header_base->stream_id) { + for (uint8_t i=0; i < ARRAY_SIZE(s_ags_env.ags_stream_env); i++) + { + if (s_ags_env.ags_stream_env[i].stream_id == p_header_base->stream_id) + { stream_env_id = i; } } - if (s_ags_env.ags_stream_env[stream_env_id].is_active) { - if (p_header_base->length_ext) { + if (s_ags_env.ags_stream_env[stream_env_id].is_active) + { + if (p_header_base->length_ext) + { ags_header_subs_ext_t *p_header_subs_ext = (ags_header_subs_ext_t *)p_data; - + payload_length = be16toh(p_header_subs_ext->payload_length); payload_offset = sizeof(ags_header_subs_ext_t); - } else { + } + else + { ags_header_subs_t *p_header_subs = (ags_header_subs_t *)p_data; - + payload_length = p_header_subs->payload_length; payload_offset = sizeof(ags_header_subs_t); } - } else { + } + else + { uint16_t total_length; - if (p_header_base->length_ext) { + if (p_header_base->length_ext) + { ags_header_first_ext_t *p_header_first_ext = (ags_header_first_ext_t *)p_data; - + total_length = be16toh(p_header_first_ext->total_trxn_length); payload_length = be16toh(p_header_first_ext->payload_length); payload_offset = sizeof(ags_header_first_ext_t); - } else { + } + else + { ags_header_first_t *p_header_first = (ags_header_first_t *)p_data; - + total_length = be16toh(p_header_first->total_trxn_length); payload_length = p_header_first->payload_length; payload_offset = sizeof(ags_header_first_t); @@ -455,34 +403,37 @@ static void ags_echo_tx_val_decode(uint8_t conn_idx, const uint8_t *p_data, uint ags_reset_stream(stream_env_id, total_length); } - if (p_header_base->ack_flag) { + if (p_header_base->ack_flag) + { s_ags_env.ags_stream_env[stream_env_id].ack_flag = p_header_base->ack_flag; s_ags_env.ags_stream_env[stream_env_id].trxn_id = p_header_base->trxn_id; } s_ags_env.ags_stream_env[stream_env_id].received_length += payload_length; - if (s_ags_env.ags_stream_env[stream_env_id].received_length == \ - s_ags_env.ags_stream_env[stream_env_id].total_length) { + if (s_ags_env.ags_stream_env[stream_env_id].received_length == s_ags_env.ags_stream_env[stream_env_id].total_length) + { s_ags_env.ags_stream_env[stream_env_id].is_active = 0; - } else if (s_ags_env.ags_stream_env[stream_env_id].received_length > - s_ags_env.ags_stream_env[stream_env_id].total_length) { + } + else if (s_ags_env.ags_stream_env[stream_env_id].received_length > s_ags_env.ags_stream_env[stream_env_id].total_length) + { s_ags_env.ags_stream_env[stream_env_id].is_active = 0; - APP_LOG_DEBUG("Stream Overrun: %d %d.", s_ags_env.ags_stream_env[stream_env_id].received_length, - s_ags_env.ags_stream_env[stream_env_id].total_length); + APP_LOG_DEBUG("Stream Overrun: %d %d.", s_ags_env.ags_stream_env[stream_env_id].received_length, + s_ags_env.ags_stream_env[stream_env_id].total_length); } bool ack_flag = false; - switch (p_header_base->stream_id) { + switch (p_header_base->stream_id) + { case AGS_CONTROL_STREAM_ID: - ack_flag = s_ags_env.ags_init.ags_control_stream_cb(conn_idx, &((uint8_t *)p_data)[payload_offset], \ - payload_length, s_ags_env.ags_stream_env[stream_env_id].is_active); + ack_flag = s_ags_env.ags_init.ags_control_stream_cb(conn_idx, &((uint8_t *)p_data)[payload_offset], payload_length, \ + s_ags_env.ags_stream_env[stream_env_id].is_active); break; case AGS_ALEXA_STREAM_ID: - ack_flag = s_ags_env.ags_init.ags_alexa_stream_cb(conn_idx, &((uint8_t *)p_data)[payload_offset], \ - payload_length, s_ags_env.ags_stream_env[stream_env_id].is_active); + ack_flag = s_ags_env.ags_init.ags_alexa_stream_cb(conn_idx, &((uint8_t *)p_data)[payload_offset], payload_length, \ + s_ags_env.ags_stream_env[stream_env_id].is_active); break; default: @@ -498,7 +449,7 @@ static void ags_echo_tx_val_decode(uint8_t conn_idx, const uint8_t *p_data, uint /** ***************************************************************************************** * @brief Send ACK packet. - * If the Echo device request the ACK packet, the gadget must send the Echo device + * If the Echo device request the ACK packet, the gadget must send the Echo device * an ACK packet in response to the last packet of the transaction. * @param[in] conn_idx: Connection index. * @param[in] stream_env_id: The environment ID of gadget stream which is active. @@ -512,23 +463,24 @@ static sdk_err_t ags_stream_ack_send(uint8_t conn_idx, uint8_t stream_env_id, bo sdk_err_t error_code = SDK_SUCCESS; ags_evt_t ags_evt; - if (!s_ags_env.ags_stream_env[stream_env_id].is_active && (s_ags_env.ags_stream_env[stream_env_id].ack_flag)) { + if (!s_ags_env.ags_stream_env[stream_env_id].is_active && (s_ags_env.ags_stream_env[stream_env_id].ack_flag)) + { ags_ack_packet_t ack_packet; - + ags_encode_ack(&ack_packet, s_ags_env.ags_stream_env[stream_env_id].stream_id, \ s_ags_env.ags_stream_env[stream_env_id].trxn_id, ack_flag); - - gatts_noti_ind_t ags_rx_val_noti; - + + ble_gatts_noti_ind_t ags_rx_val_noti; + ags_rx_val_noti.type = BLE_GATT_NOTIFICATION; ags_rx_val_noti.handle = prf_find_handle_by_idx(AGS_IDX_RX_VAL, s_ags_env.start_hdl, (uint8_t *)&s_ags_env.ags_init.char_mask); ags_rx_val_noti.length = sizeof(ack_packet); ags_rx_val_noti.value = (uint8_t *)&ack_packet; - + error_code = ble_gatts_noti_ind(conn_idx, &ags_rx_val_noti); - + ags_evt.evt_type = AGS_EVT_ECHO_RX_DATA_SENT; ags_evt.conn_idx = conn_idx; ags_evt.p_data = (uint8_t *)&ack_packet; @@ -552,59 +504,65 @@ static sdk_err_t ags_echo_rx_val_chunk(uint8_t conn_idx) sdk_err_t error_code; ags_evt_t ags_evt; - if (s_ags_stream_payload.length) { + if (s_ags_stream_payload.length) + { uint8_t header_size = sizeof(ags_header_subs_t); uint16_t max_packet_size; uint16_t payload_size; uint8_t stream_id; uint8_t trxn_type; - gatts_noti_ind_t ags_rx_val_noti; - + ble_gatts_noti_ind_t ags_rx_val_noti; + ble_gatt_mtu_get(conn_idx, &max_packet_size); - max_packet_size -= MAX_PACKET_SIZE_OFFSET; - - if (max_packet_size < (header_size + s_ags_stream_payload.length)) { + max_packet_size -= 3; + + if (max_packet_size < (header_size + s_ags_stream_payload.length)) + { payload_size = max_packet_size - header_size; s_ags_stream_payload.length -= payload_size; - } else { + } + else + { payload_size = s_ags_stream_payload.length; s_ags_stream_payload.length = 0; } - + // Get stream ID from prededing transmit. stream_id = ((ags_header_base_t *)s_gadget_tx_buffer)->stream_id; - if (s_ags_stream_payload.length) { + if (s_ags_stream_payload.length) + { trxn_type = AGS_TRANSACTION_TYPE_CONT; - } else { + } + else + { trxn_type = AGS_TRANSACTION_TYPE_LAST; } - + ags_encode_header(&s_gadget_tx_buffer[0], stream_id, trxn_type, payload_size, 0); - error_code = memcpy_s(&s_gadget_tx_buffer[header_size], payload_size, - &s_ags_stream_payload.p_data[s_ags_stream_payload.offset], payload_size); + memcpy(&s_gadget_tx_buffer[header_size], &s_ags_stream_payload.p_data[s_ags_stream_payload.offset], payload_size); + s_ags_stream_payload.offset += payload_size; - + ags_rx_val_noti.type = BLE_GATT_NOTIFICATION; ags_rx_val_noti.handle = prf_find_handle_by_idx(AGS_IDX_RX_VAL, s_ags_env.start_hdl, (uint8_t *)&s_ags_env.ags_init.char_mask); ags_rx_val_noti.length = header_size + payload_size; ags_rx_val_noti.value = s_gadget_tx_buffer; - + error_code = ble_gatts_noti_ind(conn_idx, &ags_rx_val_noti); - } else { - error_code = memset_s(&s_ags_stream_payload, sizeof(ags_stream_payload_t), 0, sizeof(ags_stream_payload_t)); - if (error_code < 0) { - return error_code; - } + } + else + { + memset(&s_ags_stream_payload, 0, sizeof(ags_stream_payload_t)); s_ags_stream_payload.length = 0; s_ags_stream_payload.offset = 0; - + ags_evt.evt_type = AGS_EVT_ECHO_RX_DATA_SENT; ags_evt.conn_idx = conn_idx; ags_evt.p_data = s_ags_stream_payload.p_data; s_ags_env.ags_init.evt_handler(&ags_evt); - + error_code = SDK_SUCCESS; } return error_code; @@ -630,7 +588,7 @@ static void ags_encode_ack(ags_ack_packet_t *p_ack_packet, uint8_t stream_id, ui p_ack_packet->header_base.length_ext = AGS_LEN_EXT_NO_EXT; p_ack_packet->reserved_1 = AGS_HEADER_ACK_RES_1; p_ack_packet->payload_length = AGS_HEADER_ACK_PAYLOAD_LEN; - p_ack_packet->reserved_2 = AGS_HEADER_ACK_RES_2; + p_ack_packet->reserved_2 = AGS_HEADER_ACK_RES_2; p_ack_packet->result_code = ack_flag ? AGS_RES_CODE_SUCCESS : AGS_RES_CODE_UNSUPPORTED; } @@ -645,108 +603,130 @@ static void ags_encode_ack(ags_ack_packet_t *p_ack_packet, uint8_t stream_id, ui * @param[in] trxn_length: Total transaction length. ***************************************************************************************** */ -static void ags_encode_header(uint8_t *header, uint8_t stream_id, uint8_t trxn_type, uint8_t payload_length, - uint16_t trxn_length) +static void ags_encode_header(void *p_header, uint8_t stream_id, uint8_t trxn_type, uint8_t payload_length, uint16_t trxn_length) { - ags_header_base_t *p_header_base = header; - + ags_header_base_t *p_header_base = p_header; + p_header_base->stream_id = stream_id; p_header_base->sequ_num = s_tx_sequ_num++; p_header_base->trxn_type = trxn_type; p_header_base->ack_flag = AGS_ACK_NACK; p_header_base->length_ext = AGS_LEN_EXT_NO_EXT; - - if (AGS_TRANSACTION_TYPE_FIRST == trxn_type) { - ags_header_first_t *p_header_first = header; - + + if (AGS_TRANSACTION_TYPE_FIRST == trxn_type) + { + ags_header_first_t *p_header_first = p_header; + s_trxn_counter++; p_header_base->trxn_id = s_trxn_counter; p_header_first->reserved = AGS_HEADER_FIRST_RES; p_header_first->payload_length = payload_length; - + htobe16(&(p_header_first->total_trxn_length), trxn_length); - } else { - ags_header_subs_t *p_header_subs = header; - - p_header_base->trxn_id = s_trxn_counter; + } + else + { + ags_header_subs_t *p_header_subs = p_header; + + p_header_base->trxn_id = s_trxn_counter; p_header_subs->payload_length = payload_length; } } +static void ags_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + ags_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + ags_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + ags_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + ags_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** */ -sdk_err_t ags_stream_send(uint8_t conn_idx, uint8_t stream_id, uint8_t *p_data, uint16_t length) +sdk_err_t ags_stream_send(uint8_t conn_idx, uint8_t stream_id, void *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; uint16_t max_packet_size; uint16_t payload_size; uint16_t header_size; - gatts_noti_ind_t ags_rx_val_noti; - - error_code = memset_s(&s_ags_stream_payload, sizeof(s_ags_stream_payload), - 0, sizeof(s_ags_stream_payload)); - if (error_code < 0) { - return error_code; - } + ble_gatts_noti_ind_t ags_rx_val_noti; + + memset(&s_ags_stream_payload, 0, sizeof(s_ags_stream_payload)); s_tx_sequ_num = 0; s_ags_stream_payload.length = 0; - + ble_gatt_mtu_get(conn_idx, &max_packet_size); - max_packet_size -= MAX_PACKET_SIZE_OFFSET; - - error_code = memcpy_s(s_ags_stream_payload.p_data, length, (uint8_t *)p_data, length); - if (error_code < 0) { - return error_code; - } + max_packet_size -= 3; + memcpy(s_ags_stream_payload.p_data, (uint8_t *)p_data, length); + header_size = sizeof(ags_header_first_t); - - if (max_packet_size < (header_size + length)) { + + if (max_packet_size < (header_size + length)) + { s_ags_stream_payload.length = header_size + length - max_packet_size; - } else { + } + else + { s_ags_stream_payload.length = 0; } - + payload_size = length - s_ags_stream_payload.length; s_ags_stream_payload.offset = payload_size; - + ags_encode_header(&s_gadget_tx_buffer[0], stream_id, AGS_TRANSACTION_TYPE_FIRST, payload_size, length); - error_code = memcpy_s(&s_gadget_tx_buffer[header_size], payload_size, p_data, payload_size); - if (error_code < 0) { - return error_code; - } - + memcpy(&s_gadget_tx_buffer[header_size], p_data, payload_size); + ags_rx_val_noti.type = BLE_GATT_NOTIFICATION; ags_rx_val_noti.handle = prf_find_handle_by_idx(AGS_IDX_RX_VAL, s_ags_env.start_hdl, (uint8_t *)&s_ags_env.ags_init.char_mask); ags_rx_val_noti.length = header_size + payload_size; ags_rx_val_noti.value = s_gadget_tx_buffer; - + error_code = ble_gatts_noti_ind(conn_idx, &ags_rx_val_noti); return error_code; } -sdk_err_t ags_non_stream_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) +sdk_err_t ags_non_stream_send(uint8_t conn_idx, void *p_data, uint16_t length) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t ags_rx_val_noti; - ags_evt_t ags_evt; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t ags_rx_val_noti; + ags_evt_t ags_evt; ags_rx_val_noti.type = BLE_GATT_NOTIFICATION; ags_rx_val_noti.handle = prf_find_handle_by_idx(AGS_IDX_RX_VAL, s_ags_env.start_hdl, (uint8_t *)&s_ags_env.ags_init.char_mask); ags_rx_val_noti.length = length; - ags_rx_val_noti.value = (uint8_t *)p_data; - + ags_rx_val_noti.value = (uint8_t *)p_data; + error_code = ble_gatts_noti_ind(conn_idx, &ags_rx_val_noti); - + ags_evt.evt_type = AGS_EVT_ECHO_RX_DATA_SENT; ags_evt.conn_idx = conn_idx; - ags_evt.p_data = (uint8_t *)p_data; + ags_evt.p_data = (uint8_t *)p_data; ags_evt.length = length; s_ags_env.ags_init.evt_handler(&ags_evt); @@ -755,21 +735,27 @@ sdk_err_t ags_non_stream_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length sdk_err_t ags_service_init(ags_init_t *p_ags_init) { - sdk_err_t ret; - if (p_ags_init == NULL) { + if (NULL == p_ags_init) + { return SDK_ERR_POINTER_NULL; } + + s_ags_env.ags_stream_env[0].stream_id = AGS_CONTROL_STREAM_ID; + s_ags_env.ags_stream_env[0].is_active = false; + s_ags_env.ags_stream_env[1].stream_id = AGS_ALEXA_STREAM_ID; + s_ags_env.ags_stream_env[1].is_active = false; + s_ags_env.ags_stream_env[2].stream_id = AGS_OTA_STREAM_ID; + s_ags_env.ags_stream_env[2].is_active = false; - s_ags_env.ags_stream_env[INDEX_0].stream_id = AGS_CONTROL_STREAM_ID; - s_ags_env.ags_stream_env[INDEX_0].is_active = false; - s_ags_env.ags_stream_env[INDEX_1].stream_id = AGS_ALEXA_STREAM_ID; - s_ags_env.ags_stream_env[INDEX_1].is_active = false; - s_ags_env.ags_stream_env[INDEX_2].stream_id = AGS_OTA_STREAM_ID; - s_ags_env.ags_stream_env[INDEX_2].is_active = false; + memcpy(&s_ags_env.ags_init, p_ags_init, sizeof(ags_init_t)); - ret = memcpy_s(&s_ags_env.ags_init, sizeof(ags_init_t), p_ags_init, sizeof(ags_init_t)); - if (ret < 0) { - return ret; - } - return ble_server_prf_add(&ags_prf_info); + s_ags_env.ags_gatts_db.shdl = &s_ags_env.start_hdl; + s_ags_env.ags_gatts_db.uuid = s_ags_svc_uuid; + s_ags_env.ags_gatts_db.attr_tab_cfg = (uint8_t *)&(s_ags_env.ags_init.char_mask); + s_ags_env.ags_gatts_db.max_nb_attr = AGS_IDX_NB; + s_ags_env.ags_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_ags_env.ags_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_ags_env.ags_gatts_db.attr_tab.attr_tab_128 = ags_attr_tab; + + return ble_gatts_prf_add(&s_ags_env.ags_gatts_db, ags_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.h index feed9ac..4de22d3 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ags/ags.h @@ -46,7 +46,7 @@ * @{ * @brief Definitions and prototypes for the AGS interface. * - * @details The Alexa Gadget (AG) Service is defined by Amazon. It can connect a Alexa gadget with an Echo + * @details The Alexa Gadget (AG) Service is defined by Amazon. It can connect a Alexa gadget with an Echo * device. This module implements the Alexa Gadget Service with TX and RX characteristics. * * After \ref ags_init_t variable is initialized, the application must call \ref ags_service_init() @@ -57,27 +57,26 @@ #ifndef __AGS_H__ #define __AGS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup AGS_MACRO Defines * @{ */ -/**< The UUID of Alexa Gadget Service for setting advertising data. */ -#define AGS_SERVICE_UUID 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, \ - 0x03, 0xFE, 0x00, 0x00 +#define AGS_SERVICE_UUID 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,\ + 0x00, 0x10, 0x00, 0x00, 0x03, 0xFE, 0x00, 0x00 /**< The UUID of Alexa Gadget Service for setting advertising data. */ -#define AGS_HEADER_FIRST_RES 0x00 /**< Reserved value of header in the first packet. */ +#define AGS_HEADER_FIRST_RES 0x00 /**< Reserved value of header in the first packet. */ -#define AGS_HEADER_ACK_RES_1 0x00 /**< The first reserved value of header in the ACK packet. */ -#define AGS_HEADER_ACK_PAYLOAD_LEN 0x02 /**< Length of the ACK packet, in bytes. */ -#define AGS_HEADER_ACK_RES_2 0x01 /**< The second reserved value of header in the ACK packet. */ +#define AGS_HEADER_ACK_RES_1 0x00 /**< The first reserved value of header in the ACK packet. */ +#define AGS_HEADER_ACK_PAYLOAD_LEN 0x02 /**< Length of the ACK packet, in bytes. */ +#define AGS_HEADER_ACK_RES_2 0x01 /**< The second reserved value of header in the ACK packet. */ -#define AGS_TX_VAL_LEN_MAX 244 /**< Maximum length of TX Characteristic value. */ -#define AGS_RX_VAL_LEN_MAX 244 /**< Maximum length of RX Characteristic value. */ +#define AGS_TX_VAL_LEN_MAX 244 /**< Maximum length of TX Characteristic value. */ +#define AGS_RX_VAL_LEN_MAX 244 /**< Maximum length of RX Characteristic value. */ /** * @defgroup AGS_ADV_TYPE Advertising type @@ -91,8 +90,7 @@ #define AGS_RECONNECT_ADV_FLAG 0x00 /**< The reconnecting advertisiment flag. */ /** @} */ -#define AGS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of AGS connections. */ +#define AGS_CONNECTION_MAX 10 /**< Maximum number of AGS connections. */ /** * @defgroup AGS_CHAR_MASK Characteristics Mask @@ -108,62 +106,67 @@ * @defgroup AGS_ENUM Enumerations * @{ */ -/**@brief Alexa Gadget Service Stream ID. +/**@brief Alexa Gadget Service Stream ID. * At any time, there is only one control stream, one Alexa stream, and one OTA stream. * Each packet belongs to one of these streams, which is specified in the stream ID field of the packet's header. * See Gadgets documentation for details: * https://developer.amazon.com/en-US/docs/alexa/alexa-gadgets-toolkit/packet-ble.html#streams */ -typedef enum { +typedef enum +{ AGS_CONTROL_STREAM_ID, /**< Control stream ID, used to communicate. */ AGS_ALEXA_STREAM_ID = 0x06, /**< Alexa stream ID, used to send directives and events. */ AGS_OTA_STREAM_ID = 0x02, /**< OTA stream ID, used to update the gadget's firmware. */ } ags_header_stream_id_t; -/**@brief Alexa Gadget Service transaction type. +/**@brief Alexa Gadget Service transaction type. * It indicate where the packet is within the transaction. The transaction type and * protocol of a single transaction are defined by the first packet of the transaction. */ -typedef enum { - AGS_TRANSACTION_TYPE_FIRST, /**< First packet of a transaction, - or the only packet in a single-packet transaction. */ +typedef enum +{ + AGS_TRANSACTION_TYPE_FIRST, /**< First packet of a transaction, or the only packet in a single-packet transaction. */ AGS_TRANSACTION_TYPE_CONT, /**< Continuation packet of a transaction. */ AGS_TRANSACTION_TYPE_LAST, /**< Last packet of a transaction. */ - AGS_TRANSACTION_TYPE_CTRL, /**< Control packet. Currently, \ - the only type of control packet is the ACK packet. */ + AGS_TRANSACTION_TYPE_CTRL, /**< Control packet. Currently, the only type of control packet is the ACK packet. */ } ags_header_trxn_type_t; /**@brief Alexa Gadget Service ACK Flag. */ -typedef enum { - AGS_ACK_NACK, /**< The gadget doesn't need to send an ACK packet in response to the last packet of the +typedef enum +{ + AGS_ACK_NACK, /**< The gadget doesn't need to send an ACK packet in response to the last packet of the transaction unless another packet in the transaction has this bit set to 1. */ AGS_ACK_ACK, /**< The gadget must send an ACK packet in response to the last packet of the transaction. */ } ags_header_ack_flag_t; /**@brief Alexa Gadget Service Length extender. */ -typedef enum { +typedef enum +{ AGS_LEN_EXT_NO_EXT, /**< The packet's payload is 8 bits. */ AGS_LEN_EXT_EXT, /**< The packet's payload is 16 bits. */ + } ags_header_length_ext_t; /**@brief Alexa Gadget Service result code. */ -typedef enum { +typedef enum +{ AGS_RES_CODE_SUCCESS, /**< The message was valid and acted on (if applicable) successfully. */ AGS_RES_CODE_UNKNOWN, /**< The message was valid but rusulted in a failure or error. */ AGS_RES_CODE_UNSUPPORTED = 0x03, /**< The message was invalid because it contained a command or other field that - was not supported by the receiver. */ + was not supported by the receiver. */ } ags_header_result_code_t; /**@brief Alexa Gadget Service event type.*/ -typedef enum { - AGS_EVT_INVALID, /**< Indicate that invalid event. */ - AGS_EVT_ECHO_RX_DATA_SENT, /**< Indicate that the gadget has been sent the data to an Echo device. */ - AGS_EVT_ECHO_TX_DATA_RECEIVED, /**< Indicate that the gadget has been received the data from an Echo device. */ - AGS_EVT_ECHO_RX_NOTI_ENABLE, /**< Indicate that the Rx notification has been enabled. */ - AGS_EVT_ECHO_RX_NOTI_DISABLE, /**< Indicate that the Rx notification has been disabled. */ +typedef enum +{ + AGS_EVT_INVALID, /**< Indicate that invalid event. */ + AGS_EVT_ECHO_RX_DATA_SENT, /**< Indicate that the gadget has been sent the data to an Echo device. */ + AGS_EVT_ECHO_TX_DATA_RECEIVED, /**< Indicate that the gadget has been received the data from an Echo device. */ + AGS_EVT_ECHO_RX_NOTI_ENABLE, /**< Indicate that the Rx notification has been enabled. */ + AGS_EVT_ECHO_RX_NOTI_DISABLE, /**< Indicate that the Rx notification has been disabled. */ } ags_evt_type_t; /** @} */ @@ -172,60 +175,63 @@ typedef enum { * @{ */ /**@brief Alexa Gadget Service base part of data packet header. */ -typedef struct { - uint8_t trxn_id : 4; /**< The transaction ID. */ - uint8_t stream_id : 4; /**< The stream ID. @ref ags_header_stream_id_t */ - uint8_t length_ext : 1; /**< Length extender. It indicates the length of the payload field. \ - @ref ags_header_length_ext_t */ - uint8_t ack_flag : 1; /**< Acknowledgement(ACK) flag. @ref ags_header_ack_flag_t */ - uint8_t trxn_type : 2; /**< Transaction type. @ref ags_header_trxn_type_t */ - uint8_t sequ_num : 4; /**< Sequence number. Since this is four bits long, it supports - inplace sequencing of up to 16 packet at a given point in time. - Sequence numbers can rool over. */ +typedef struct +{ + uint8_t trxn_id :4; /**< The transaction ID. */ + uint8_t stream_id :4; /**< The stream ID. @ref ags_header_stream_id_t */ + uint8_t length_ext :1; /**< Length extender. It indicates the length of the payload field. @ref ags_header_length_ext_t */ + uint8_t ack_flag :1; /**< Acknowledgement(ACK) flag. @ref ags_header_ack_flag_t */ + uint8_t trxn_type :2; /**< Transaction type. @ref ags_header_trxn_type_t */ + uint8_t sequ_num :4; /**< Sequence number. Since this is four bits long, it supports + inplace sequencing of up to 16 packet at a given point in time. + Sequence numbers can rool over.*/ } ags_header_base_t; /**@brief Alexa Gadget Service header in first packet. */ -typedef struct { - ags_header_base_t header_base; /**< Header base. */ - uint8_t reserved; /**< Reserved. This is only present in the first packet of the transaction. */ - uint8_t - total_trxn_length[2]; /**< Total transaction length. This is only present in the first packet of the transaction. */ - uint8_t payload_length; /**< Payload Length. */ +typedef struct +{ + ags_header_base_t header_base; /**< Header base. */ + uint8_t reserved; /**< Reserved. This is only present in the first packet of the transaction. */ + uint8_t total_trxn_length[2]; /**< Total transaction length. This is only present in the first packet of the transaction. */ + uint8_t payload_length; /**< Payload Length. */ } ags_header_first_t; /**@brief Alexa Gadget Service extended version of header in first packet. */ -typedef struct { - ags_header_base_t header_base; /**< Header base. */ - uint8_t reserved; /**< Reserved. This is only present in the first packet of the transaction. */ - uint8_t - total_trxn_length[2]; /**< Total transaction length. This is only present in the first packet of the transaction. */ +typedef struct +{ + ags_header_base_t header_base; /**< Header base. */ + uint8_t reserved; /**< Reserved. This is only present in the first packet of the transaction. */ + uint8_t total_trxn_length[2]; /**< Total transaction length. This is only present in the first packet of the transaction. */ uint8_t payload_length[2]; /**< Payload Length. */ } ags_header_first_ext_t; /**@brief Alexa Gadget Service header in subsequent packets. */ -typedef struct { +typedef struct +{ ags_header_base_t header_base; /**< Header base. */ uint8_t payload_length; /**< Payload Length. */ } ags_header_subs_t; /**@brief Alexa Gadget Service extended version of header in subsequent packets. */ -typedef struct { +typedef struct +{ ags_header_base_t header_base; /**< Header base. */ uint8_t payload_length[2]; /**< Payload Length. */ } ags_header_subs_ext_t; /**@brief Alexa Gadget Service ACK packet. */ -typedef struct { +typedef struct +{ ags_header_base_t header_base; /**< Header base. */ uint8_t reserved_1; /**< Reserved. */ uint8_t payload_length; /**< Length of the ACK packet. */ uint8_t reserved_2; /**< Reserved. */ - uint8_t - result_code; /**< A result code, which depends on whether this is an ACK or a NACK. @ref ags_header_ack_flag_t */ + uint8_t result_code; /**< A result code, which depends on whether this is an ACK or a NACK. @ref ags_header_ack_flag_t */ } ags_ack_packet_t; /**@brief Alexa Gadget Service gadget stream enviorenment variable. */ -typedef struct { +typedef struct +{ ags_header_stream_id_t stream_id; /**< The stream ID. */ uint8_t is_active; /**< Whether the stream is active. */ uint8_t ack_flag; /**< Whether need to return ACK packet. */ @@ -235,7 +241,8 @@ typedef struct { } ags_stream_env_t; /**@brief Alexa Gadget Service event. */ -typedef struct { +typedef struct +{ ags_evt_type_t evt_type; /**< The AGS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -251,22 +258,20 @@ typedef struct { typedef void (*ags_evt_handler_t)(ags_evt_t *p_evt); /**@brief Alexa Gadget Service stream callback.*/ -typedef bool (*ags_stream_cb_t)(uint8_t conn_idx, const uint8_t *const p_data, uint16_t length, - uint8_t still_receiving); +typedef bool (*ags_stream_cb_t)(uint8_t conn_idx, const uint8_t *const p_data, uint16_t length, uint8_t still_receiving); /** @} */ /** * @defgroup AGS_STRUCT Structures * @{ */ -/**@brief Alexa Gadget Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Alexa Gadget Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ ags_evt_handler_t evt_handler; /**< Alexa Gadget Service event handler. */ ags_stream_cb_t ags_control_stream_cb; /**< Callback for incoming control streams. */ - ags_stream_cb_t ags_alexa_stream_cb; /**< Callback for incoming Alexa streams. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref AGS_CHAR_MASK. */ + ags_stream_cb_t ags_alexa_stream_cb; /**< Callback for incoming Alexa streams. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref AGS_CHAR_MASK. */ } ags_init_t; /** @} */ @@ -297,7 +302,7 @@ sdk_err_t ags_service_init(ags_init_t *p_ags_init); * @return Result of sending data. ***************************************************************************************** */ -sdk_err_t ags_stream_send(uint8_t conn_idx, uint8_t stream_id, uint8_t *p_data, uint16_t length); +sdk_err_t ags_stream_send(uint8_t conn_idx, uint8_t stream_id, void *p_data, uint16_t length); /** ***************************************************************************************** @@ -310,7 +315,7 @@ sdk_err_t ags_stream_send(uint8_t conn_idx, uint8_t stream_id, uint8_t *p_data, * @return Result of sending data. ***************************************************************************************** */ -sdk_err_t ags_non_stream_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); +sdk_err_t ags_non_stream_send(uint8_t conn_idx, void *p_data, uint16_t length); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/BUILD.gn new file mode 100644 index 0000000..f3a5595 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ams_c") { + sources = [ "ams_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.c index 0775e5f..3a0aa17 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.c @@ -40,13 +40,7 @@ **************************************************************************************** */ #include "ams_c.h" -#define ATTR_VALUE_LEN 2 -#define INDEX_0 0 -#define INDEX_1 1 -#define INDEX_2 2 -#define INDEX_3 3 -#define LEN_3 3 -#define OFFSET_2 2 + /* * STRUCT DEFINE ***************************************************************************************** @@ -57,58 +51,26 @@ static const uint8_t ams_cmd_uuid[] = {AMS_CMD_UUID}; static const uint8_t ams_attr_update_uuid[] = {AMS_ATTR_UPDATE_UUID}; static const uint8_t ams_attr_display_uuid[] = {AMS_ATTR_DISPLAY_UUID}; +static ble_uuid_t s_ams_service_uuid = +{ + .uuid_len = BLE_ATT_UUID_128_LEN, + .uuid = (uint8_t *)ams_service_uuid, +}; + /**@brief Apple Media Service Client environment variable. */ -struct ams_c_env_t { +struct ams_c_env_t +{ ams_c_handles_t handles; /**< Handles of AMS characteristics which will be got for peer. */ ams_c_evt_handler_t evt_handler; /**< Handler of AMS Client event handler. */ - uint8_t prf_id; /**< AMS Client profile id. */ uint16_t cmd_enable_flag; /**< The flag bits of the available status for the commands. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void ams_c_att_read_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_read_rsp_t *p_read_rsp); -static void ams_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void ams_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void ams_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct ams_c_env_t s_ams_c_env; /**< Apple Media Service Client environment variable. */ -/**@brief Apple Media Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t ams_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Apple Media Service GATT Client Callbacks. */ -static gattc_prf_cbs_t ams_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - ams_c_att_read_cb, - ams_c_att_write_cb, - ams_c_att_ntf_ind_cb, - ams_c_srvc_browse_cb, - NULL, -}; - -/**@brief Apple Media Service Client Information. */ -static const prf_client_info_t ams_c_prf_info = { - .max_connection_nb = AMS_C_CONNECTION_MAX, - .manager_cbs = &ams_c_mgr_cbs, - .gattc_prf_cbs = &ams_c_gattc_cbs -}; - /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -122,7 +84,8 @@ static const prf_client_info_t ams_c_prf_info = { */ static void ams_c_evt_handler_excute(ams_c_evt_t *p_evt) { - if (s_ams_c_env.evt_handler != NULL && AMS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_ams_c_env.evt_handler && AMS_C_EVT_INVALID != p_evt->evt_type) + { s_ams_c_env.evt_handler(p_evt); } } @@ -139,11 +102,11 @@ static void ams_c_evt_handler_excute(ams_c_evt_t *p_evt) static void ams_c_attr_info_decode(uint8_t *p_data, uint16_t length, ams_c_attr_info_t *p_attr_info) { - p_attr_info->ett_id = (ams_c_ett_id_t)(p_data[INDEX_0]); - p_attr_info->attr_id = p_data[INDEX_1]; - p_attr_info->flag = p_data[INDEX_2]; - p_attr_info->p_data = &(p_data[INDEX_3]); - p_attr_info->length = length - LEN_3; + p_attr_info->ett_id = (ams_c_ett_id_t)(p_data[0]); + p_attr_info->attr_id = p_data[1]; + p_attr_info->flag = p_data[2]; + p_attr_info->p_data = &(p_data[3]); + p_attr_info->length = length - 3; } /** @@ -155,23 +118,24 @@ static void ams_c_attr_info_decode(uint8_t *p_data, uint16_t length, * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void ams_c_att_read_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_read_rsp_t *p_read_rsp) +static void ams_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { ams_c_evt_t ams_c_evt; ams_c_evt.conn_idx = conn_idx; ams_c_evt.evt_type = AMS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_ams_c_env.handles.ams_attr_display_handle) { + if (p_read_rsp->value[0].handle == s_ams_c_env.handles.ams_attr_display_handle) + { ams_c_evt.conn_idx = conn_idx; ams_c_evt.evt_type = AMS_C_EVT_CPLT_ATTR_READ_RSP; - ams_c_evt.param.cplt_attr_data.p_data = p_read_rsp->vals[0].p_value; - ams_c_evt.param.cplt_attr_data.length = p_read_rsp->vals[0].length; + ams_c_evt.param.cplt_attr_data.p_data = p_read_rsp->value[0].p_value; + ams_c_evt.param.cplt_attr_data.length = p_read_rsp->value[0].length; } ams_c_evt_handler_excute(&ams_c_evt); @@ -186,33 +150,42 @@ static void ams_c_att_read_cb(uint8_t conn_idx, uint8_t status, * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void ams_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void ams_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { ams_c_evt_t ams_c_evt; ams_c_evt.conn_idx = conn_idx; ams_c_evt.evt_type = AMS_C_EVT_INVALID; - if (handle == s_ams_c_env.handles.ams_cmd_handle) { + if (handle == s_ams_c_env.handles.ams_cmd_handle) + { ams_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - AMS_C_EVT_CMD_SEND_SUCCESS : - AMS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ams_c_env.handles.ams_cmd_cccd_handle) { + AMS_C_EVT_CMD_SEND_SUCCESS : + AMS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ams_c_env.handles.ams_cmd_cccd_handle) + { ams_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - AMS_C_EVT_CMD_UPDATE_NTF_SET_SUCCESS : - AMS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ams_c_env.handles.ams_attr_update_handle) { + AMS_C_EVT_CMD_UPDATE_NTF_SET_SUCCESS : + AMS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ams_c_env.handles.ams_attr_update_handle) + { ams_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - AMS_C_EVT_ATTR_FOCUS_SET_SUCCESS : - AMS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ams_c_env.handles.ams_attr_update_cccd_handle) { + AMS_C_EVT_ATTR_FOCUS_SET_SUCCESS : + AMS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ams_c_env.handles.ams_attr_update_cccd_handle) + { ams_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - AMS_C_EVT_ATTR_UPDATE_NTF_SET_SUCCESS : - AMS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ams_c_env.handles.ams_attr_display_handle) { + AMS_C_EVT_ATTR_UPDATE_NTF_SET_SUCCESS : + AMS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ams_c_env.handles.ams_attr_display_handle) + { ams_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - AMS_C_EVT_CPLT_ATTR_DISPLAY_SET_SUCCESS : - AMS_C_EVT_WRITE_OP_ERR; + AMS_C_EVT_CPLT_ATTR_DISPLAY_SET_SUCCESS : + AMS_C_EVT_WRITE_OP_ERR; } ams_c_evt_handler_excute(&ams_c_evt); @@ -227,27 +200,31 @@ static void ams_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void ams_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void ams_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { ams_c_evt_t ams_c_evt; ams_c_evt.conn_idx = conn_idx; ams_c_evt.evt_type = AMS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_ams_c_env.handles.ams_cmd_handle) { + if (p_ntf_ind->handle == s_ams_c_env.handles.ams_cmd_handle) + { ams_c_evt.evt_type = AMS_C_EVT_CMD_UPDATE_RECEIVE; - + ams_c_evt.param.cmd_list.p_cmd = (ams_c_cmd_id_t *)(p_ntf_ind->p_value); ams_c_evt.param.cmd_list.length = p_ntf_ind->length; - + s_ams_c_env.cmd_enable_flag = 0; - for (uint16_t i = 0; i < p_ntf_ind->length; i++) { + for (uint16_t i = 0; i < p_ntf_ind->length; i++) + { s_ams_c_env.cmd_enable_flag |= (0x01 << p_ntf_ind->p_value[i]); } - } else if (p_ntf_ind->handle == s_ams_c_env.handles.ams_attr_update_handle) { + } + else if (p_ntf_ind->handle == s_ams_c_env.handles.ams_attr_update_handle) + { ams_c_evt.evt_type = AMS_C_EVT_ATTR_UPDATE_RECEIVE; - ams_c_attr_info_decode(p_ntf_ind->p_value, p_ntf_ind->length, - &ams_c_evt.param.attr_info); + ams_c_attr_info_decode(p_ntf_ind->p_value, p_ntf_ind->length, + &ams_c_evt.param.attr_info); } ams_c_evt_handler_excute(&ams_c_evt); @@ -262,8 +239,8 @@ static void ams_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ ***************************************************************************************** */ -static void ams_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_browse_srvc_t *p_browse_srvc) +static void ams_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, + const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { ams_c_evt_t ams_c_evt; uint16_t handle_disc; @@ -271,161 +248,173 @@ static void ams_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, ams_c_evt.conn_idx = conn_idx; ams_c_evt.evt_type = AMS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - - if (memcmp(p_browse_srvc->uuid, ams_service_uuid, BLE_ATT_UUID_128_LEN) != 0) { - return; - } - s_ams_c_env.handles.ams_srvc_start_handle = p_browse_srvc->start_hdl; - s_ams_c_env.handles.ams_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_SUCCESS == status) + { + if (0 == memcmp(p_browse_srvc->uuid, ams_service_uuid, BLE_ATT_UUID_128_LEN)) + { + s_ams_c_env.handles.ams_srvc_start_handle = p_browse_srvc->start_hdl; + s_ams_c_env.handles.ams_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) { - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) + { + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, ams_cmd_uuid, - BLE_ATT_UUID_128_LEN)) { - s_ams_c_env.handles.ams_cmd_handle = handle_disc; - s_ams_c_env.handles.ams_cmd_cccd_handle = handle_disc + OFFSET_2; - } else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, - ams_attr_update_uuid, BLE_ATT_UUID_128_LEN)) { - s_ams_c_env.handles.ams_attr_update_handle = handle_disc; - s_ams_c_env.handles.ams_attr_update_cccd_handle = handle_disc + OFFSET_2; - } else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, - ams_attr_display_uuid, BLE_ATT_UUID_128_LEN)) { - s_ams_c_env.handles.ams_attr_display_handle = handle_disc; + if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, ams_cmd_uuid, + BLE_ATT_UUID_128_LEN)) + { + s_ams_c_env.handles.ams_cmd_handle = handle_disc; + s_ams_c_env.handles.ams_cmd_cccd_handle = handle_disc + 2; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, + ams_attr_update_uuid, BLE_ATT_UUID_128_LEN)) + { + s_ams_c_env.handles.ams_attr_update_handle = handle_disc; + s_ams_c_env.handles.ams_attr_update_cccd_handle = handle_disc + 2; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, + ams_attr_display_uuid, BLE_ATT_UUID_128_LEN)) + { + s_ams_c_env.handles.ams_attr_display_handle = handle_disc; + } + } + + else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; + } } - } else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; + ams_c_evt.evt_type = AMS_C_EVT_DISCOVERY_CPLT; } } - ams_c_evt.evt_type = AMS_C_EVT_DISCOVERY_CPLT; ams_c_evt_handler_excute(&ams_c_evt); } +static void ams_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + ams_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + ams_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ams_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + ams_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ams_c_client_init(ams_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_ams_c_env, sizeof(s_ams_c_env), 0, sizeof(s_ams_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_ams_c_env, 0, sizeof(s_ams_c_env)); s_ams_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&ams_c_prf_info, &s_ams_c_env.prf_id); + return ble_gattc_prf_add(&s_ams_service_uuid, ams_c_ble_evt_handler); } sdk_err_t ams_c_disc_srvc_start(uint8_t conn_idx) { - ble_uuid_t ble_ams_uuid = { - .uuid_len = BLE_ATT_UUID_128_LEN, - .uuid = (uint8_t *)ams_service_uuid, - }; - return ble_gattc_prf_services_browse(s_ams_c_env.prf_id, conn_idx, &ble_ams_uuid); + return ble_gattc_services_browse(conn_idx, &s_ams_service_uuid); } sdk_err_t ams_c_cmd_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_cmd_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_cmd_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ams_c_env.handles.ams_cmd_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - return ble_gattc_prf_write(s_ams_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ams_c_env.handles.ams_cmd_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ams_c_attr_update_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_update_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_update_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ams_c_env.handles.ams_attr_update_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - return ble_gattc_prf_write(s_ams_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ams_c_env.handles.ams_attr_update_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ams_c_cplt_attr_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_display_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_display_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_ams_c_env.prf_id, conn_idx, + return ble_gattc_read(conn_idx, s_ams_c_env.handles.ams_attr_display_handle, 0); } sdk_err_t ams_c_cmd_send(uint8_t conn_idx, uint8_t cmd_id) { - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_cmd_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_cmd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - gattc_write_attr_value_t write_attr_value; - write_attr_value.handle = s_ams_c_env.handles.ams_cmd_handle; - write_attr_value.offset = 0; - write_attr_value.length = 1; - write_attr_value.p_value = (uint8_t *)& cmd_id; - return ble_gattc_prf_write(s_ams_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ams_c_env.handles.ams_cmd_handle, 0, 1, (uint8_t *)& cmd_id); } sdk_err_t ams_c_attr_focus_set(uint8_t conn_idx, const ams_c_ett_attr_id_t *p_ett_attr_id) { - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_update_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_update_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - gattc_write_attr_value_t write_attr_value; - write_attr_value.handle = s_ams_c_env.handles.ams_attr_update_handle; - write_attr_value.offset = 0; - write_attr_value.length = p_ett_attr_id->attr_count + 1; - write_attr_value.p_value = (uint8_t *)&(p_ett_attr_id->ett_id); - return ble_gattc_prf_write(s_ams_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ams_c_env.handles.ams_attr_update_handle, + 0, p_ett_attr_id->attr_count + 1, (uint8_t *)&(p_ett_attr_id->ett_id)); } sdk_err_t ams_c_attr_display_set(uint8_t conn_idx, const ams_c_attr_info_t *p_attr_info) { - if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_display_handle) { + if (BLE_ATT_INVALID_HDL == s_ams_c_env.handles.ams_attr_display_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - - gattc_write_attr_value_t write_attr_value; - write_attr_value.handle = s_ams_c_env.handles.ams_attr_display_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&(p_attr_info->ett_id); - - return ble_gattc_prf_write(s_ams_c_env.prf_id, conn_idx, &write_attr_value); + + return ble_gattc_write(conn_idx, s_ams_c_env.handles.ams_attr_display_handle, 0, 2, (uint8_t *)&(p_attr_info->ett_id)); } bool ams_c_cmd_enable_check(ams_c_cmd_id_t cmd_id) { - if ((0x01 << cmd_id) & s_ams_c_env.cmd_enable_flag) { + if ((0x01 << cmd_id) & s_ams_c_env.cmd_enable_flag) + { return true; } return false; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.h index 2e97a5f..10b0e23 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ams_c/ams_c.h @@ -1,7 +1,7 @@ /** **************************************************************************************** * - * @file AMS_c.h + * @file ams_c.h * * @brief Apple Media Service Client API. * @@ -47,19 +47,17 @@ * @details The Apple Media Service Client contains the APIs and types, which can be used * by the application to discover Apple Media Service of peer and interact with it. * - * The application must provide an event handler to be registered, - * then call \ref ams_c_client_init() to initialize the client. + * The application must provide an event handler to be registered, then call \ref ams_c_client_init() to initialize the client. * After the application discovers peer Apple Media Service by calling \ref ams_c_disc_srvc_start(), * application can call \ref ams_c_cmd_send() to send romote command to peer and \ref ams_c_attr_focus_set to - * set the attribute focus. + * set the attribute focus. * * Secondly, use \ref ams_c_cmd_notify_set() and \ref ams_c_attr_update_notify_set() to enable the notification * for CMD update and attribute update. * * When the available CMDs or concerned attributes change, the module will receive notification from peer * if notifications of them are enabled. If the notification containing the information of changed attribute - * is truncated, application can call \ref ams_c_attr_display_set to set the attribute - * that needs to be completely + * is truncated, application can call \ref ams_c_attr_display_set to set the attribute that needs to be completely * displayed and \ref ams_c_cplt_attr_read to get the completely information of the attribute. */ @@ -67,7 +65,7 @@ #ifndef __AMS_C_H__ #define __AMS_C_H__ -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" @@ -75,18 +73,17 @@ * @defgroup AMS_C_MACRO Defines * @{ */ -#define AMS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections.*/ -#define AMS_C_ATTR_COUNT_MAX 256 /**< The buffer size of command.*/ -#define AMS_C_TRUNCATED_FLAG (0x01<<0) /**< Bit of truncated.*/ -#define AMS_SRVC_UUID 0xdc, 0xf8, 0x55, 0xad, 0x02, 0xc5, 0xf4, 0x8e, \ - 0x3a, 0x43, 0x36, 0x0f, 0x2b, 0x50, 0xd3, 0x89 /**< UUID of Apple media service.*/ -#define AMS_CMD_UUID 0xc2, 0x51, 0xca, 0xf7, 0x56, 0x0e, 0xdf, 0xb8, \ - 0x8a, 0x4a, 0xb1, 0x57, 0xd8, 0x81, 0x3c, 0x9b /**< UUID of remote command.*/ -#define AMS_ATTR_UPDATE_UUID 0x02, 0xC1, 0x96, 0xBA, 0x92, 0xBB, 0x0C, 0x9A, \ - 0x1F, 0x41, 0x8D, 0x80, 0xCE, 0xAB, 0x7C, 0x2F /**< UUID of attribute update.*/ -#define AMS_ATTR_DISPLAY_UUID 0xd7, 0xd5, 0xbb, 0x70, 0xa8, 0xa3, 0xab, 0xa6, \ - 0xd8, 0x46, 0xab, 0x23, 0x8c, 0xf3, 0xb2, 0xc6 /**< UUID of attribute display.*/ +#define AMS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ +#define AMS_C_ATTR_COUNT_MAX 256 /**< The buffer size of command. */ +#define AMS_C_TRUNCATED_FLAG (0x01<<0) /**< Bit of truncated. */ +#define AMS_SRVC_UUID 0xdc, 0xf8, 0x55, 0xad, 0x02, 0xc5, 0xf4, 0x8e,\ + 0x3a, 0x43, 0x36, 0x0f, 0x2b, 0x50, 0xd3, 0x89 /**< UUID of Apple media service. */ +#define AMS_CMD_UUID 0xc2, 0x51, 0xca, 0xf7, 0x56, 0x0e, 0xdf, 0xb8,\ + 0x8a, 0x4a, 0xb1, 0x57, 0xd8, 0x81, 0x3c, 0x9b /**< UUID of remote command. */ +#define AMS_ATTR_UPDATE_UUID 0x02, 0xC1, 0x96, 0xBA, 0x92, 0xBB, 0x0C, 0x9A,\ + 0x1F, 0x41, 0x8D, 0x80, 0xCE, 0xAB, 0x7C, 0x2F /**< UUID of attribute update. */ +#define AMS_ATTR_DISPLAY_UUID 0xd7, 0xd5, 0xbb, 0x70, 0xa8, 0xa3, 0xab, 0xa6,\ + 0xd8, 0x46, 0xab, 0x23, 0x8c, 0xf3, 0xb2, 0xc6 /**< UUID of attribute display. */ /** @} */ /** @@ -95,7 +92,8 @@ */ /**@brief Apple Media Service Command ID. */ -typedef enum { +typedef enum +{ AMS_CMD_ID_PLAY, /**< Command index of play. */ AMS_CMD_ID_PAUSE, /**< Command index of pause. */ AMS_CMD_ID_TOGGLE_PLAY_PAUSE, /**< Command index of toggle. */ @@ -109,25 +107,28 @@ typedef enum { AMS_CMD_ID_SKIP_BACKWARD, /**< Command index of skip backward. */ AMS_CMD_ID_LIKE_TRACK, /**< Command index of like track. */ AMS_CMD_ID_DISLIKE_TRACK, /**< Command index of dislike track. */ - AMS_CMD_ID_BOOK_MARK_TRACK, /**< ComMand index of book mark. */ + AMS_CMD_ID_BOOK_MARK_TRACK, /**< ComMand index of book mark. */ } ams_c_cmd_id_t; /**@brief Apple Media Service entities index. */ -typedef enum { +typedef enum +{ AMS_ETT_ID_PLAYER, /**< Entity index of player. */ AMS_ETT_ID_QUEUE, /**< Entity index of queue. */ AMS_ETT_ID_TRACK, /**< Entity index of track. */ } ams_c_ett_id_t; /**@brief Apple Media Service player attribute index. */ -enum { +enum +{ AMS_PLAYER_ATTR_ID_NAME, /**< Player attribute index of name. */ AMS_PLAYER_ATTR_ID_PLAYBACK_INFO, /**< Player attribute index of playback information. */ AMS_PLAYER_ATTR_ID_VOLUME, /**< Player attribute index of volume. */ }; /**@brief Apple Media Service queue attribute index. */ -enum { +enum +{ AMS_QUEUE_ATTR_ID_INDEX, /**< Queue attribute index of index. */ AMS_QUEUE_ATTR_ID_COUNT, /**< Queue attribute index of count. */ AMS_QUEUE_ATTR_ID_SHUFFLE_MODE, /**< Queue attribute index of shuffle mode. */ @@ -135,7 +136,8 @@ enum { }; /**@brief Apple Media Service track attribute index. */ -enum { +enum +{ AMS_TRACK_ATTR_ID_ARTIST, /**< Track attribute index of artist. */ AMS_TRACK_ATTR_ID_ALBUM, /**< Track attribute index of album. */ AMS_TRACK_ATTR_ID_TITTLE, /**< Track attribute index of tittle. */ @@ -143,21 +145,20 @@ enum { }; /**@brief Apple Media Service Client Event type. */ -typedef enum { - AMS_C_EVT_INVALID, /**< AMS Client invalid event type. */ - AMS_C_EVT_DISCOVERY_CPLT, /**< AMS Client has found AMS service and its characteristics. */ - AMS_C_EVT_DISCOVERY_FAIL, /**< AMS Client found AMS service failed - because of invalid operation or no found at the peer. */ - AMS_C_EVT_CMD_SEND_SUCCESS, /**< AMS Client has sent command. */ - AMS_C_EVT_CMD_UPDATE_RECEIVE, /**< AMS Client has recieved updated command list. */ - AMS_C_EVT_CMD_UPDATE_NTF_SET_SUCCESS, /**< AMS Client has set command update notification. */ - AMS_C_EVT_ATTR_FOCUS_SET_SUCCESS, /**< AMS Client has set focus attribute */ - AMS_C_EVT_ATTR_UPDATE_RECEIVE, /**< AMS Client has received updated attribution data. */ - AMS_C_EVT_ATTR_UPDATE_NTF_SET_SUCCESS, /**< AMS Client has set focus attribute notification. */ - AMS_C_EVT_CPLT_ATTR_DISPLAY_SET_SUCCESS, /**< AMS Client has set the attribute - which needs to be completely displayed. */ - AMS_C_EVT_CPLT_ATTR_READ_RSP, /**< AMS Client has received a read response. */ - AMS_C_EVT_WRITE_OP_ERR, /**< Write error. */ +typedef enum +{ + AMS_C_EVT_INVALID, /**< AMS Client invalid event type. */ + AMS_C_EVT_DISCOVERY_CPLT, /**< AMS Client has found AMS service and its characteristics. */ + AMS_C_EVT_DISCOVERY_FAIL, /**< AMS Client found AMS service failed because of invalid operation or no found at the peer. */ + AMS_C_EVT_CMD_SEND_SUCCESS, /**< AMS Client has sent command. */ + AMS_C_EVT_CMD_UPDATE_RECEIVE, /**< AMS Client has recieved updated command list. */ + AMS_C_EVT_CMD_UPDATE_NTF_SET_SUCCESS, /**< AMS Client has set command update notification. */ + AMS_C_EVT_ATTR_FOCUS_SET_SUCCESS, /**< AMS Client has set focus attribute */ + AMS_C_EVT_ATTR_UPDATE_RECEIVE, /**< AMS Client has received updated attribution data. */ + AMS_C_EVT_ATTR_UPDATE_NTF_SET_SUCCESS, /**< AMS Client has set focus attribute notification. */ + AMS_C_EVT_CPLT_ATTR_DISPLAY_SET_SUCCESS, /**< AMS Client has set the attribute which needs to be completely displayed. */ + AMS_C_EVT_CPLT_ATTR_READ_RSP, /**< AMS Client has received a read response. */ + AMS_C_EVT_WRITE_OP_ERR, /**< Write error. */ } ams_c_evt_type_t; /** @} */ @@ -167,20 +168,23 @@ typedef enum { */ /**@brief Structure that stores the attribute to be concerned or to display completely. */ -typedef struct { +typedef struct +{ ams_c_ett_id_t ett_id; /**< Entity index. */ uint8_t attr_id[AMS_C_ATTR_COUNT_MAX]; /**< Attribute indexs. */ uint16_t attr_count; /**< Count of attribute. */ } ams_c_ett_attr_id_t; /**@brief Structure that stores new command list. */ -typedef struct { +typedef struct +{ ams_c_cmd_id_t *p_cmd; /**< Command list. */ uint16_t length; /**< Count of Command. */ } ams_c_cmd_list_t; /**@brief Structure that stores attribute information. */ -typedef struct { +typedef struct +{ ams_c_ett_id_t ett_id; /**< Entity index. */ uint8_t attr_id; /**< Attribute index. */ uint8_t flag; /**< Flag about attribute. */ @@ -189,13 +193,15 @@ typedef struct { } ams_c_attr_info_t; /**@brief Complete attribution's value . */ -typedef struct { +typedef struct +{ uint8_t *p_data; /**< complete attribute data. */ uint16_t length; /**< Length of complete attribute data. */ } ams_c_cplt_attr_data_t; /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t ams_srvc_start_handle; /**< AMS Service start handle. */ uint16_t ams_srvc_end_handle; /**< AMS Service end handle. */ uint16_t ams_cmd_handle; /**< AMS Service remote command handle. */ @@ -206,10 +212,12 @@ typedef struct { } ams_c_handles_t; /**@brief Apple Media Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ ams_c_evt_type_t evt_type; /**< The AMS event type. */ - union { + union + { ams_c_cmd_list_t cmd_list; /**< Command list. */ ams_c_attr_info_t attr_info; /**< Attribute information. */ ams_c_cplt_attr_data_t cplt_attr_data; /**< Complete attribute data. */ @@ -292,7 +300,7 @@ sdk_err_t ams_c_cplt_attr_read(uint8_t conn_idx); * @brief Send command to peer device. * * @param[in] conn_idx: Index of connection. - * @param[in] cmd_id: Index of command. + * @param[in] cmd_id: Index of command. * * @return Operation result. ***************************************************************************************** diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/BUILD.gn new file mode 100644 index 0000000..d094c30 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ancs_c") { + sources = [ + "ancs_c.c", + "ancs_protocol.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.c index 285d819..d0d746b 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.c @@ -38,81 +38,51 @@ #include "ancs_c.h" #include "ancs_protocol.h" #include "string.h" -#define ATTR_VALUE_LEN 2 + /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Apple notification center client environment variable. */ -struct ancs_c_env_t { +struct ancs_c_env_t +{ ancs_c_att_handles_t handles; /**< Handles of ANCS characteristics which will be got for peer. */ ancs_c_evt_handler_t evt_handler; /**< Handler of ANCS Client event handler. */ - uint8_t prf_id; /**< ANCS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void ancs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void ancs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void ancs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_browse_srvc_t *p_browse_srvc); - - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static const uint8_t ancs_service_uuid[] = {ANCS_SRVC_UUID}; static const uint8_t ancs_notification_source_uuid[] = {ANCS_NTF_SOURCE_UUID}; -static const uint8_t ancs_control_point_uuid[] = {ANCS_CONTROL_POINT_UUID}; -static const uint8_t ancs_data_source_uuid[] = {ANCS_DATA_SOURCE_UUID}; +static const uint8_t ancs_control_point_uuid[] ={ANCS_CONTROL_POINT_UUID}; +static const uint8_t ancs_data_source_uuid[] ={ANCS_DATA_SOURCE_UUID}; static struct ancs_c_env_t s_ancs_c_env; /**< Apple notification center client environment variable. */ -/**@brief ANCS Client interface required by profile manager. */ -static ble_prf_manager_cbs_t ancs_c_mgr_cbs = { - NULL, - NULL, - NULL +static ble_uuid_t s_ancs_service_uuid = +{ + .uuid_len = BLE_ATT_UUID_128_LEN, + .uuid = (uint8_t *)ancs_service_uuid, }; -/**@brief ANCS GATT Client Callbacks. */ -static gattc_prf_cbs_t ancs_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - ancs_c_att_write_cb, - ancs_c_att_ntf_ind_cb, - ancs_c_srvc_browse_cb, - NULL, -}; + /* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ -/**@brief ANCS Client Information. */ -static const prf_client_info_t ancs_c_prf_info = { - .max_connection_nb = ANCS_C_CONNECTION_MAX, - .manager_cbs = &ancs_c_mgr_cbs, - .gattc_prf_cbs = &ancs_c_gattc_cbs -}; - -/* -* LOCAL FUNCTION DEFINITIONS -***************************************************************************************** -*/ - -/** -***************************************************************************************** -* @brief Excute ANCS client event handler. -* -* @param[in] p_evt: Pointer to ANCS client event structure. -***************************************************************************************** -*/ + /** + ***************************************************************************************** + * @brief Excute ANCS client event handler. + * + * @param[in] p_evt: Pointer to ANCS client event structure. + ***************************************************************************************** + */ static void ancs_c_evt_handler_excute(ancs_c_evt_t *p_evt) { - if (s_ancs_c_env.evt_handler != NULL && BLE_ANCS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_ancs_c_env.evt_handler && BLE_ANCS_C_EVT_INVALID != p_evt->evt_type) + { s_ancs_c_env.evt_handler(p_evt); } } @@ -126,18 +96,21 @@ static void ancs_c_evt_handler_excute(ancs_c_evt_t *p_evt) * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void ancs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void ancs_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { ancs_c_evt_t ancs_c_evt; ancs_c_evt.conn_idx = conn_idx; ancs_c_evt.evt_type = BLE_ANCS_C_EVT_INVALID; - if (handle == s_ancs_c_env.handles.ancs_ntf_source_cccd_handle) { + if (handle == s_ancs_c_env.handles.ancs_ntf_source_cccd_handle) + { ancs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED : BLE_ANCS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ancs_c_env.handles.ancs_data_source_cccd_handle) { + } + else if (handle == s_ancs_c_env.handles.ancs_data_source_cccd_handle) + { ancs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED : BLE_ANCS_C_EVT_WRITE_OP_ERR; @@ -155,17 +128,20 @@ static void ancs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handl * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void ancs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void ancs_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { ancs_c_evt_t ancs_c_evt; ancs_c_evt.conn_idx = conn_idx; ancs_c_evt.evt_type = BLE_ANCS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_ancs_c_env.handles.ancs_ntf_source_handle) { + if (p_ntf_ind->handle == s_ancs_c_env.handles.ancs_ntf_source_handle) + { ancs_c_evt.evt_type = BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE; ancs_decode_notification_source(p_ntf_ind->p_value, p_ntf_ind->length); - } else if (p_ntf_ind->handle == s_ancs_c_env.handles.ancs_data_source_handle) { + } + else if (p_ntf_ind->handle == s_ancs_c_env.handles.ancs_data_source_handle) + { ancs_c_evt.evt_type = BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE; ancs_decode_data_source(p_ntf_ind->p_value, p_ntf_ind->length); } @@ -173,24 +149,107 @@ static void ancs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p ancs_c_evt_handler_excute(&ancs_c_evt); } +/** + ***************************************************************************************** + * @brief Handles reception of the attribute info request message. + * + * @param[in] conn_idx: Connection index. + * @param[in] p_browse_srvc: Pointer to the parameters of the browse services. + ***************************************************************************************** + */ +static void ancs_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, + const ble_gattc_evt_browse_srvc_t *p_browse_srvc) +{ + uint16_t handle_disc; + + ancs_c_evt_t ancs_c_evt; + ancs_c_evt.conn_idx = conn_idx; + ancs_c_evt.evt_type = BLE_ANCS_C_EVT_DISCOVERY_FAILED; + if(p_browse_srvc->uuid_len == BLE_ATT_UUID_128_LEN) + { + if(memcmp(p_browse_srvc->uuid, ancs_service_uuid, BLE_ATT_UUID_128_LEN) == 0)//find ancs service + { + s_ancs_c_env.handles.ancs_service_handle = p_browse_srvc->start_hdl; + + for(uint16_t i=0; i<(p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++)//find characteristic + { + handle_disc = p_browse_srvc->start_hdl + i + 1; + if(p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) + { + if(memcmp(p_browse_srvc->info[i].attr.uuid, ancs_notification_source_uuid, BLE_ATT_UUID_128_LEN) == 0)//find ancs notification source characteristic + { + s_ancs_c_env.handles.ancs_ntf_source_handle = handle_disc; + } + else if(memcmp(p_browse_srvc->info[i].attr.uuid, ancs_control_point_uuid, BLE_ATT_UUID_128_LEN) == 0)//find ancs control point characteristic + { + s_ancs_c_env.handles.ancs_control_point_handle = handle_disc; + } + else if(memcmp(p_browse_srvc->info[i].attr.uuid, ancs_data_source_uuid, BLE_ATT_UUID_128_LEN) == 0)//find ancs data source characteristic + { + s_ancs_c_env.handles.ancs_data_source_handle = handle_disc; + } + } + else if((p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_DESC) && //find cccd + ((*(uint16_t *)(p_browse_srvc->info[i].attr.uuid)) == BLE_ATT_DESC_CLIENT_CHAR_CFG)) + { + if(handle_disc == (s_ancs_c_env.handles.ancs_ntf_source_handle + 1))// find notification source cccd + { + s_ancs_c_env.handles.ancs_ntf_source_cccd_handle = handle_disc; + } + else if(handle_disc == (s_ancs_c_env.handles.ancs_data_source_handle + 1))// find data source cccd + { + s_ancs_c_env.handles.ancs_data_source_cccd_handle = handle_disc; + } + } + else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; + } + } + ancs_c_evt.evt_type = BLE_ANCS_C_EVT_DISCOVERY_CPLT; + } + } + ancs_c_evt_handler_excute(&ancs_c_evt); +} + +static void ancs_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + ancs_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ancs_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + ancs_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ancs_c_client_init(ancs_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_ancs_c_env, sizeof(s_ancs_c_env), 0, sizeof(s_ancs_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_ancs_c_env, 0, sizeof(s_ancs_c_env)); s_ancs_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&ancs_c_prf_info, &s_ancs_c_env.prf_id); + return ble_gattc_prf_add(&s_ancs_service_uuid, ancs_c_ble_evt_handler); } /** @@ -202,109 +261,34 @@ sdk_err_t ancs_c_client_init(ancs_c_evt_handler_t evt_handler) */ sdk_err_t ancs_c_discovery_service(uint8_t conn_idx) { - ble_uuid_t ble_ancs_uuid = { - .uuid_len = BLE_ATT_UUID_128_LEN, - .uuid = (uint8_t*)ancs_service_uuid, - }; - return ble_gattc_prf_services_browse(s_ancs_c_env.prf_id, conn_idx, &ble_ancs_uuid); -} - -/** - ***************************************************************************************** - * @brief Handles reception of the attribute info request message. - * - * @param[in] conn_idx: Connection index. - * @param[in] p_browse_srvc: Pointer to the parameters of the browse services. - ***************************************************************************************** - */ -static void ancs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, - const ble_gattc_browse_srvc_t *p_browse_srvc) -{ - uint16_t handle_disc; - - ancs_c_evt_t ancs_c_evt; - ancs_c_evt.conn_idx = conn_idx; - ancs_c_evt.evt_type = BLE_ANCS_C_EVT_DISCOVERY_FAILED; - if (p_browse_srvc->uuid_len != BLE_ATT_UUID_128_LEN) { - return; - } - if (memcmp(p_browse_srvc->uuid, ancs_service_uuid, BLE_ATT_UUID_128_LEN) != 0) { - return; - } - // find ancs service - s_ancs_c_env.handles.ancs_service_handle = p_browse_srvc->start_hdl; - - for (uint16_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { // find characteristic - handle_disc = p_browse_srvc->start_hdl + i + 1; - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) { - if (memcmp(p_browse_srvc->info[i].attr.uuid, ancs_notification_source_uuid, - BLE_ATT_UUID_128_LEN) == 0) { // find ancs notification source characteristic - s_ancs_c_env.handles.ancs_ntf_source_handle = handle_disc; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, ancs_control_point_uuid, - BLE_ATT_UUID_128_LEN) == 0) { // find ancs control point characteristic - s_ancs_c_env.handles.ancs_control_point_handle = handle_disc; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, ancs_data_source_uuid, - BLE_ATT_UUID_128_LEN) == 0) { // find ancs data source characteristic - s_ancs_c_env.handles.ancs_data_source_handle = handle_disc; - } - } else if ((p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_DESC) && // find cccd - ((*(uint16_t *)(p_browse_srvc->info[i].attr.uuid)) == BLE_ATT_DESC_CLIENT_CHAR_CFG)) { - if (handle_disc == (s_ancs_c_env.handles.ancs_ntf_source_handle + 1)) { - // find notification source cccd - s_ancs_c_env.handles.ancs_ntf_source_cccd_handle = handle_disc; - } else if (handle_disc == (s_ancs_c_env.handles.ancs_data_source_handle + 1)) { - // find data source cccd - s_ancs_c_env.handles.ancs_data_source_cccd_handle = handle_disc; - } - } else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; - } - } - ancs_c_evt.evt_type = BLE_ANCS_C_EVT_DISCOVERY_CPLT; - - ancs_c_evt_handler_excute(&ancs_c_evt); + return ble_gattc_services_browse(conn_idx, &s_ancs_service_uuid); } sdk_err_t ancs_c_write_control_point(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - gattc_write_attr_value_t write_attr_value; - - write_attr_value.handle = s_ancs_c_env.handles.ancs_control_point_handle; - write_attr_value.offset = 0; - write_attr_value.length = length; - write_attr_value.p_value = (uint8_t *)p_data; - - return ble_gattc_prf_write(s_ancs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ancs_c_env.handles.ancs_control_point_handle, 0, length, (uint8_t *)p_data); } sdk_err_t ancs_c_ntf_source_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ancs_c_env.handles.ancs_ntf_source_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ancs_c_env.handles.ancs_ntf_source_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ancs_c_env.handles.ancs_ntf_source_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - return ble_gattc_prf_write(s_ancs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ancs_c_env.handles.ancs_ntf_source_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ancs_c_data_source_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ancs_c_env.handles.ancs_data_source_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ancs_c_env.handles.ancs_data_source_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ancs_c_env.handles.ancs_data_source_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - return ble_gattc_prf_write(s_ancs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ancs_c_env.handles.ancs_data_source_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.h index 4a8bb25..9c699e7 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_c.h @@ -3,7 +3,7 @@ * * @file ancs_c.h * - * @brief ANCS Service API. + * @brief Apple Notification Center Service API. * ***************************************************************************************** * @attention @@ -45,49 +45,48 @@ * @defgroup BLE_SDK_ANCS Apple Notification Center Service (ANCS) * @{ * @brief Definitions and prototypes for the ANCS interface. - - * @details ANCS provides a way for BLE devices to receive IOS mobile phone notifications. - * The service consists of three eigenvalues, including notification source, + + * @details ANCS provides a way for BLE devices to receive IOS mobile phone notifications. + * The service consists of three eigenvalues, including notification source, * data source, control point. - * - * The application needs to call \ref ancs_c_client_init() to initialize, and then - * use \ref ancs_c_discovery_service() to discover ANCS-related services on IOS devices. - * After discovery, ancs_c_on_browse_svc_evt function is called to parse and save + * + * The application needs to call \ref ancs_c_client_init() to initialize, and then + * use \ref ancs_c_discovery_service() to discover ANCS-related services on IOS devices. + * After discovery, ancs_c_on_browse_svc_evt function is called to parse and save * the handle corresponding to each service. These handles are used for data * transmission. - * + * * Secondly, use \ref ancs_c_ntf_source_notify_set() and \ref ancs_c_data_source_notify_set() - * to enable notification source & data source's CCD. The IOS notification is then sent to the + * to enable notification source & data source's CCD. The IOS notification is then sent to the * BLE device side immediately. - * + * * Finally, the application can use \ref ancs_decode_notification_source() and - * \ref ancs_decode_data_source() to parse the ANCS message and \ref ancs_c_write_control_point() + * \ref ancs_decode_data_source() to parse the ANCS message and \ref ancs_c_write_control_point() * to command the control point. For specific commands, please refer to the ANCS protocol specification. * */ -#ifndef ANCS_H -#define ANCS_H +#ifndef _ANCS_H_ +#define _ANCS_H_ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include /** * @defgroup ANCS_C_MACRO Defines * @{ */ -#define ANCS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of ANCS Client connections. */ -#define ANCS_SRVC_UUID 0xd0, 0x00, 0x2d, 0x12, 0x1e, 0x4b, 0x0f, 0xa4, 0x99, 0x4e, 0xce, 0xb5, \ - 0x31, 0xf4, 0x05, 0x79 /**< UUID of Apple notification center service. */ -#define ANCS_NTF_SOURCE_UUID 0xbd, 0x1d, 0xa2, 0x99, 0xe6, 0x25, 0x58, 0x8c, \ - 0xd9, 0x42, 0x01, 0x63, 0x0d, 0x12, 0xbf, 0x9f /**< UUID of notification source. */ -#define ANCS_CONTROL_POINT_UUID 0xd9, 0xd9, 0xaa, 0xfd, 0xbd, 0x9b, 0x21, 0x98, \ - 0xa8, 0x49, 0xe1, 0x45, 0xf3, 0xd8, 0xd1, 0x69 /**< UUID of control point. */ -#define ANCS_DATA_SOURCE_UUID 0xfb, 0x7b, 0x7c, 0xce, 0x6a, 0xb3, 0x44, 0xbe, \ - 0xb5, 0x4b, 0xd6, 0x24, 0xe9, 0xc6, 0xea, 0x22 /**< UUID of data source. */ +#define ANCS_C_CONNECTION_MAX 10 /**< Maximum number of ANCS Client connections. */ +#define ANCS_SRVC_UUID 0xd0, 0x00, 0x2d, 0x12, 0x1e, 0x4b, 0x0f, 0xa4,\ + 0x99,0x4e, 0xce, 0xb5, 0x31, 0xf4, 0x05, 0x79 /**< UUID of Apple notification center service. */ +#define ANCS_NTF_SOURCE_UUID 0xbd, 0x1d, 0xa2, 0x99, 0xe6, 0x25, 0x58, 0x8c,\ + 0xd9, 0x42, 0x01, 0x63, 0x0d, 0x12, 0xbf, 0x9f /**< UUID of notification source. */ +#define ANCS_CONTROL_POINT_UUID 0xd9, 0xd9, 0xaa, 0xfd, 0xbd, 0x9b, 0x21, 0x98,\ + 0xa8, 0x49, 0xe1, 0x45, 0xf3, 0xd8, 0xd1, 0x69 /**< UUID of control point. */ +#define ANCS_DATA_SOURCE_UUID 0xfb, 0x7b, 0x7c, 0xce, 0x6a, 0xb3, 0x44, 0xbe,\ + 0xb5, 0x4b, 0xd6, 0x24, 0xe9, 0xc6, 0xea, 0x22 /**< UUID of data source. */ /** @} */ @@ -96,15 +95,15 @@ * @{ */ /**@brief Event types that are passed from client to application on an event. */ -typedef enum { - BLE_ANCS_C_EVT_INVALID, /**< ANCS Client invalid event type. */ - BLE_ANCS_C_EVT_DISCOVERY_CPLT, /**< ANCS Client has found ANCS service and its characteristics. */ - BLE_ANCS_C_EVT_DISCOVERY_FAILED, /**< ANCS Client found ANCS service failed \ - because of invalid operation or no found at the peer. */ - BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED, /**< ANCS Client has enable notification for notification source. */ - BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED, /**< ANCS Client has enable notification for data source. */ - BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE, /**< ANCS Client has receive notification from notification source. */ - BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE, /**< ANCS Client has receive notification from data source. */ +typedef enum +{ + BLE_ANCS_C_EVT_INVALID, /**< ANCS Client invalid event type. */ + BLE_ANCS_C_EVT_DISCOVERY_CPLT, /**< ANCS Client has found ANCS service and its characteristics. */ + BLE_ANCS_C_EVT_DISCOVERY_FAILED, /**< ANCS Client found ANCS service failed because of invalid operation or no found at the peer. */ + BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED, /**< ANCS Client has enable notification for notification source. */ + BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED, /**< ANCS Client has enable notification for data source. */ + BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE, /**< ANCS Client has receive notification from notification source. */ + BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE, /**< ANCS Client has receive notification from data source. */ BLE_ANCS_C_EVT_WRITE_OP_ERR, } ble_ancs_c_evt_type_t; /** @} */ @@ -114,22 +113,22 @@ typedef enum { * @{ */ /**@brief ancs handle structure. */ -typedef struct { - uint16_t ancs_service_handle; /**< Handle of ancs service as provided by a discovery. */ - uint16_t ancs_ntf_source_handle; /**< Handle of ancs notification source characteristic \ - as provided by a discovery. */ - uint16_t ancs_ntf_source_cccd_handle; /**< Handle of CCCD of ancs control point characteristic \ - as provided by a discovery. */ - uint16_t ancs_control_point_handle; /**< Handle of ancs control point characteristic as provided by a discovery. */ - uint16_t ancs_data_source_handle; /**< Handle of ancs data source characteristic as provided by a discovery. */ - uint16_t ancs_data_source_cccd_handle; /**< Handle of CCCD of ancs data source characteristic \ - as provided by a discovery. */ -} ancs_c_att_handles_t; +typedef struct +{ + uint16_t ancs_service_handle; /**< Handle of ancs service as provided by a discovery. */ + uint16_t ancs_ntf_source_handle; /**< Handle of ancs notification source characteristic as provided by a discovery. */ + uint16_t ancs_ntf_source_cccd_handle; /**< Handle of CCCD of ancs control point characteristic as provided by a discovery. */ + uint16_t ancs_control_point_handle; /**< Handle of ancs control point characteristic as provided by a discovery. */ + uint16_t ancs_data_source_handle; /**< Handle of ancs data source characteristic as provided by a discovery. */ + uint16_t ancs_data_source_cccd_handle; /**< Handle of CCCD of ancs data source characteristic as provided by a discovery. */ +}ancs_c_att_handles_t; /**@brief ANCS Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ ble_ancs_c_evt_type_t evt_type; /**< The ANCS event type. */ + } ancs_c_evt_t; /** @} */ @@ -166,7 +165,7 @@ sdk_err_t ancs_c_discovery_service(uint8_t conn_idx); * @brief enable ancs notification source CCCD. * * @param[in] conn_idx: Connection index. - * @param[in] is_enable: Start or stop the notification. + * @param[in] is_enable: Start or stop the notification. * @return success or not. ***************************************************************************************** */ @@ -177,7 +176,7 @@ sdk_err_t ancs_c_ntf_source_notify_set(uint8_t conn_idx, bool is_enable); * @brief enable ancs data source CCCD. * * @param[in] conn_idx: Connection index. - * @param[in] is_enable: Start or stop the notification. + * @param[in] is_enable: Start or stop the notification. * @return success or not. ***************************************************************************************** */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.c index 2b01ad0..e13d24e 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.c @@ -35,22 +35,12 @@ ***************************************************************************************** */ + +#include "ancs_protocol.h" +#include "ancs_c.h" #include #include #include "app_log.h" -#include "ancs_c.h" -#include "ancs_protocol.h" - -#define LEN_2 2 -#define LEN_4 4 -#define LEN_6 6 -#define LEN_8 8 -#define INDEX_5 5 -#define INDEX_6 6 -#define INDEX_7 7 -#define INDEX_8 8 -#define OFFSET_8 8 - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** @@ -58,7 +48,8 @@ static uint32_t s_uid; /**@brief String literals for the iOS notification Category id types. Used then printing to UART. */ -static char const * lit_catid[] = { +static char const * lit_catid[] = +{ "Other", "Incoming Call", "Missed Call", @@ -74,14 +65,16 @@ static char const * lit_catid[] = { }; /**@brief String literals for the iOS notification event types. Used then printing to UART. */ -static char const * lit_eventid[] = { +static char const * lit_eventid[] = +{ "Added", "Modified", "Removed" }; /**@brief String literals for the iOS notification attribute types. Used when printing to UART. */ -static char const * lit_attrid[] = { +static char const * lit_attrid[] = +{ "App Identifier", "Title", "Subtitle", @@ -108,25 +101,23 @@ static void ancs_notify_attr_print(void) uint16_t UID; uint8_t attr_id; uint16_t attr_size = 0; - uint8_t ret; - ret = memcpy_s(&UID, LEN_4, &s_attr_buf[1], LEN_4); - if (ret < 0) { - return; - } - ret = memcpy_s(&attr_size, LEN_2, &s_attr_buf[INDEX_6], LEN_2); - if (ret < 0) { - return; - } + memcpy(&UID, &s_attr_buf[1], 4); + memcpy(&attr_size, &s_attr_buf[6], 2); - if (commd_id == CTRL_POINT_GET_NTF_ATTRIBUTE) { - attr_id = s_attr_buf[INDEX_5]; + if (commd_id == CTRL_POINT_GET_NTF_ATTRIBUTE) + { + attr_id = s_attr_buf[5]; APP_LOG_INFO("UID=%d, ATTR_ID: %s, ATTR_SIZE=%d", UID, lit_attrid[attr_id], attr_size); - for (uint16_t idx = 0; idx < attr_size; idx++) { - printf("%c", s_attr_buf[INDEX_8 + idx]); + for (uint16_t idx = 0; idx < attr_size; idx++) + { + printf("%c", s_attr_buf[8 + idx]); } printf("\r\n"); - } else if (commd_id == CTRL_POINT_GET_APP_ATTRIBUTE) { - for (uint16_t idx = 0; idx < attr_size; idx++) { + } + else if (commd_id == CTRL_POINT_GET_APP_ATTRIBUTE) + { + for (uint16_t idx = 0; idx < attr_size; idx++) + { printf("%c", s_attr_buf[idx]); } printf("\r\n"); @@ -143,34 +134,37 @@ static void ancs_notify_attr_print(void) */ void ancs_decode_data_source(uint8_t *p_data, uint16_t length) { - uint8_t ret; - // It's the begginning of a attr info. - if (s_buf_index == 0) { - ret = memcpy_s(&s_attr_size, LEN_2, &p_data[INDEX_6], LEN_2); - if (ret < 0) { - return; - } - ret = memcpy_s(&s_attr_size, length, p_data, length); - if (ret < 0) { - return; - } - // It's the end of the attr info, a complete attr info is already stored in the buffer. - if (s_attr_size == length - LEN_8) { + //It's the begginning of a attr info. + if (0 == s_buf_index) + { + memcpy(&s_attr_size, &p_data[6], 2); + memcpy(s_attr_buf, p_data, length); + //It's the end of the attr info, a complete attr info is already stored in the buffer. + if (s_attr_size == length - 8) + { ancs_notify_attr_print(); s_buf_index = 0; - } else { // It's not the end of the attr info. + } + //It's not the end of the attr info. + else + { s_buf_index = length; } - } else { // It isn't the begginning of a attr info. - ret = memcpy_s(&s_attr_buf[s_buf_index], length, p_data, length); - if (ret < 0) { - return; - } - // It's the end of the attr info, print the buffer. - if (s_attr_size == (s_buf_index - INDEX_8) + length) { + } + + //It isn't the begginning of a attr info. + else + { + memcpy(&s_attr_buf[s_buf_index], p_data, length); + //It's the end of the attr info, print the buffer. + if (s_attr_size == (s_buf_index - 8) + length) + { ancs_notify_attr_print(); s_buf_index = 0; - } else { // It's not the end of the attr info. + } + //It's not the end of the attr info. + else + { s_buf_index = s_buf_index + length; } } @@ -181,52 +175,47 @@ void ancs_decode_data_source(uint8_t *p_data, uint16_t length) * @brief Get notification attribute * * @param[in] uid: The uid of notify message - * @param[in] noti_attr: The notification attribute + * @param[in] noti_attr: The notification attribute * ***************************************************************************************** */ void ancs_notify_attr_get(int uid, char noti_attr) { - int len = 0; + int len = 0; uint8_t buf[8]; - uint8_t ret; buf[0] = CTRL_POINT_GET_NTF_ATTRIBUTE; - ret = memcpy_s(&buf[1], LEN_4, &uid, LEN_4); - if (ret < 0) { - return; - } - buf[INDEX_5] = noti_attr; + memcpy(&buf[1], &uid, 4); + buf[5] = noti_attr; if (ANCS_NOTIF_ATTR_ID_TITLE == noti_attr || ANCS_NOTIF_ATTR_ID_SUBTITLE== noti_attr - || ANCS_NOTIF_ATTR_ID_MESSAGE== noti_attr) { + || ANCS_NOTIF_ATTR_ID_MESSAGE== noti_attr) + { len = CFG_ANCS_ATTRIBUTE_MAXLEN; - buf[INDEX_6] = (len & 0xff); - buf[INDEX_7] = (len >> OFFSET_8) & 0xff; - ancs_c_write_control_point(0, buf, LEN_8); - } else { - ancs_c_write_control_point(0, buf, LEN_6); + buf[6] = (len & 0xff); + buf[7] = (len>>8) & 0xff; + ancs_c_write_control_point(0, buf, 8); + } + else + { + ancs_c_write_control_point(0, buf, 6); } } /** ***************************************************************************************** - * @brief ancs perform action + * @brief ancs perform action * * @param[in] uid: The uid of notify message - * @param[in] action: The action status defined by specification + * @param[in] action: The action status defined by specification ***************************************************************************************** */ void ancs_action_perform(int uid, int action) { uint8_t buf[6]; - uint8_t ret; buf[0] = CTRL_POINT_PERFORM_NTF_ACTION; - ret = memcpy_s(&buf[1], LEN_4, &uid, LEN_4); - if (ret < 0) { - return; - } - buf[INDEX_5] = action; - ancs_c_write_control_point(0, buf, LEN_6); -} + memcpy(&buf[1], &uid, 4); + buf[5] = action; + ancs_c_write_control_point(0, buf, 6); +} /** ***************************************************************************************** @@ -243,19 +232,24 @@ static void notification_content_print(ntf_source_pdu_t *p_notif) APP_LOG_INFO("Category Cnt:%u", (unsigned int) p_notif->category_count); APP_LOG_INFO("UID: %u", (unsigned int) p_notif->notification_uid); APP_LOG_INFO("Flags: "); - if (p_notif->event_flags.silent == 1) { + if (p_notif->event_flags.silent == 1) + { APP_LOG_INFO(" Silent"); } - if (p_notif->event_flags.important == 1) { + if (p_notif->event_flags.important == 1) + { APP_LOG_INFO(" Important"); } - if (p_notif->event_flags.pre_existing == 1) { + if (p_notif->event_flags.pre_existing == 1) + { APP_LOG_INFO(" Pre-existing"); } - if (p_notif->event_flags.positive_action == 1) { + if (p_notif->event_flags.positive_action == 1) + { APP_LOG_INFO(" Positive Action"); } - if (p_notif->event_flags.negative_action == 1) { + if (p_notif->event_flags.negative_action == 1) + { APP_LOG_INFO(" Negative Action"); } } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.h index 82c721d..08d65da 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ancs_c/ancs_protocol.h @@ -3,7 +3,7 @@ * * @file ancs_protocol.h * - * @brief ANCS Protocol API. + * @brief Apple Notification Center Service Protocol API. * ******************************************************************************* * @attention @@ -37,8 +37,8 @@ #ifndef _ANCS_PROTOCOL_H_ #define _ANCS_PROTOCOL_H_ +#include "gr_includes.h" #include -#include "gr55xx_sys.h" /** Maximum allowed value for attribute length */ #ifndef CFG_ANCS_ATTRIBUTE_MAXLEN @@ -46,10 +46,10 @@ #endif /** Attribute ID element without maximum length */ -#define ANCS_ATTR(ID) ((uint32_t)0x80000000 | ((uint8_t)(ID))) +#define ANCS_ATTR(ID) ((uint32_t) 0x80000000 | ((uint8_t) ID)) /** Attribute ID element with maximum length */ -#define ANCS_ATTR_MAXLEN(ID, LEN) ((uint32_t)0x80000000 | ((uint8_t)(ID)) | ((uint16_t)(LEN) << 8)) +#define ANCS_ATTR_MAXLEN(ID, LEN) ((uint32_t) 0x80000000 | ((uint8_t) ID) | ((uint16_t) LEN << 8)) /** * @defgroup ANCS_ENUM Enumerations @@ -57,21 +57,21 @@ */ /**@brief IDs for iOS notification attributes. */ -typedef enum { +typedef enum +{ ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER = 0, /**< Identify that the attribute data is of an "App Identifier" type. */ ANCS_NOTIF_ATTR_ID_TITLE, /**< Identify that the attribute data is a "Title". */ ANCS_NOTIF_ATTR_ID_SUBTITLE, /**< Identify that the attribute data is a "Subtitle". */ ANCS_NOTIF_ATTR_ID_MESSAGE, /**< Identify that the attribute data is a "Message". */ ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE, /**< Identify that the attribute data is a "Message Size". */ ANCS_NOTIF_ATTR_ID_DATE, /**< Identify that the attribute data is a "Date". */ - ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL, /**< The notification has a "Positive action" \ - that can be executed associated with it. */ - ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL, /**< The notification has a "Negative action" \ - that can be executed associated with it. */ + ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL, /**< The notification has a "Positive action" that can be executed associated with it. */ + ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL, /**< The notification has a "Negative action" that can be executed associated with it. */ } ancs_notification_attr_t; /**@brief Category IDs for iOS notifications. */ -typedef enum { +typedef enum +{ ANCS_CATEGORY_ID_OTHER, /**< The iOS notification belongs to the "other" category. */ ANCS_CATEGORY_ID_INCOMING_CALL, /**< The iOS notification belongs to the "Incoming Call" category. */ ANCS_CATEGORY_ID_MISSED_CALL, /**< The iOS notification belongs to the "Missed Call" category. */ @@ -80,33 +80,33 @@ typedef enum { ANCS_CATEGORY_ID_SCHEDULE, /**< The iOS notification belongs to the "Schedule" category. */ ANCS_CATEGORY_ID_EMAIL, /**< The iOS notification belongs to the "E-mail" category. */ ANCS_CATEGORY_ID_NEWS, /**< The iOS notification belongs to the "News" category. */ - ANCS_CATEGORY_ID_HEALTH_AND_FITNESS, /**< The iOS notification belongs to the "Health and Fitness" category. */ - ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE, /**< The iOS notification belongs to the "Buisness and Finance" category. */ + ANCS_CATEGORY_ID_HEALTH_AND_FITNESS, /**< The iOS notification belongs to the "Health and Fitness" category. */ + ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE, /**< The iOS notification belongs to the "Buisness and Finance" category. */ ANCS_CATEGORY_ID_LOCATION, /**< The iOS notification belongs to the "Location" category. */ ANCS_CATEGORY_ID_ENTERTAINMENT /**< The iOS notification belongs to the "Entertainment" category. */ } ancs_category_id_t; /**@brief Event IDs for iOS notifications. */ -typedef enum { +typedef enum +{ ANCS_EVENT_ID_NOTIFICATION_ADDED, /**< The iOS notification was added. */ ANCS_EVENT_ID_NOTIFICATION_MODIFIED, /**< The iOS notification was modified. */ ANCS_EVENT_ID_NOTIFICATION_REMOVED /**< The iOS notification was removed. */ } ancs_evt_id_t; /**@brief ID for actions that can be performed for iOS notifications. */ -typedef enum { +typedef enum +{ ACTION_ID_POSITIVE = 0, /**< Positive action. */ ACTION_ID_NEGATIVE /**< Negative action. */ } ancs_c_action_id_t; /**@brief ctrl point command that can be performed for iOS notifications. */ -typedef enum { - CTRL_POINT_GET_NTF_ATTRIBUTE = 0, /**< Request attributes to be sent from \ - the NP to the NC for a given notification. */ - CTRL_POINT_GET_APP_ATTRIBUTE, /**< Request attributes to be sent from the NP to \ - the NC for a given iOS app. */ - CTRL_POINT_PERFORM_NTF_ACTION, /**< Request an action to be performed on \ - a given notification, for example, dismiss an alarm. */ +typedef enum +{ + CTRL_POINT_GET_NTF_ATTRIBUTE = 0, /**< Request attributes to be sent from the NP to the NC for a given notification. */ + CTRL_POINT_GET_APP_ATTRIBUTE, /**< Request attributes to be sent from the NP to the NC for a given iOS app. */ + CTRL_POINT_PERFORM_NTF_ACTION, /**< Request an action to be performed on a given notification, for example, dismiss an alarm. */ } ancs_c_ctrl_point_t; /** @} */ @@ -117,22 +117,21 @@ typedef enum { */ /**@brief notification flags that can be performed for iOS notifications. */ -typedef struct { +typedef struct +{ uint8_t silent : 1; /**< If this flag is set, the notification has a low priority. */ uint8_t important : 1; /**< If this flag is set, the notification has a high priority. */ uint8_t pre_existing : 1; /**< If this flag is set, the notification is pre-existing. */ -uint8_t positive_action : - 1; /**< If this flag is set, the notification has a positive action that can be taken. */ -uint8_t negative_action : - 1; /**< If this flag is set, the notification has a negative action that can be taken. */ + uint8_t positive_action : 1; /**< If this flag is set, the notification has a positive action that can be taken. */ + uint8_t negative_action : 1; /**< If this flag is set, the notification has a negative action that can be taken. */ } ancs_ntf_flags_t; /**@brief iOS notification structure. */ -typedef struct { +typedef struct +{ ancs_evt_id_t event_id; /**< Whether the notification was added, removed, or modified. */ ancs_ntf_flags_t event_flags; /**< Whether the notification was added, removed, or modified. */ - ancs_category_id_t - category_id; /**< Classification of the notification type, for example, email or location. */ + ancs_category_id_t category_id; /**< Classification of the notification type, for example, email or location. */ uint8_t category_count; /**< Current number of active notifications for this category ID. */ uint32_t notification_uid; /**< Notification UID. */ } ntf_source_pdu_t; @@ -148,7 +147,7 @@ typedef struct { * @brief Get notification attribute * * @param[in] uid: The UID of notify message - * @param[in] noti_attr: The notification attribute + * @param[in] noti_attr: The notification attribute * ***************************************************************************************** */ @@ -156,10 +155,10 @@ void ancs_notify_attr_get(int uid, char noti_attr); /** ***************************************************************************************** - * @brief ancs perform action + * @brief ancs perform action * * @param[in] uid: The UID of notify message - * @param[in] action: The action status defined by specification + * @param[in] action: The action status defined by specification * ***************************************************************************************** */ @@ -195,3 +194,5 @@ void ancs_decode_notification_source(uint8_t *p_data, uint16_t length); void ancs_decode_data_source(uint8_t *p_data, uint16_t length); /** @} */ #endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/BUILD.gn new file mode 100644 index 0000000..a6f0d8b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ans") { + sources = [ "ans.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.c index 7d33181..feafbbb 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.c @@ -42,7 +42,7 @@ #include "ans.h" #include "ble_prf_types.h" #include "ble_prf_utils.h" -#include "gr55xx_sys.h" +#include "grx_sys.h" #include "utility.h" /* @@ -50,7 +50,8 @@ **************************************************************************************** */ /**@brief Alert Notification Service Attributes Indexes. */ -enum { +enum +{ // Alert Notification Service ANS_IDX_SVC, @@ -84,171 +85,95 @@ enum { ***************************************************************************************** */ /**@brief Alert Notification Service environment variable. */ -struct ans_env_t { - ans_init_t ans_init; /**< Alert Notification Service initialization variables. */ - uint16_t start_hdl; /**< Alert Notification Service start handle. */ - uint16_t - new_alert_ntf_cfg[ANS_CONNECTION_MAX]; /**< The configuration of New Alert Notification \ - which is configured by the peer devices. */ - uint16_t - unread_alert_sta_ntf_cfg[ANS_CONNECTION_MAX]; /**< The configuration of Unread Alert Status Notification \ - which is configured by the peer devices. */ - uint16_t ntf_new_alert_cfg; /**< New Alert category notification configuration. */ - uint16_t - ntf_unread_alert_cfg; /**< Unread Alert Status category notification configuration. */ +struct ans_env_t +{ + ans_init_t ans_init; /**< Alert Notification Service initialization variables. */ + uint16_t start_hdl; /**< Alert Notification Service start handle. */ + uint16_t new_alert_ntf_cfg[ANS_CONNECTION_MAX]; /**< The configuration of New Alert Notification which is configured by the peer devices. */ + uint16_t unread_alert_sta_ntf_cfg[ANS_CONNECTION_MAX]; /**< The configuration of Unread Alert Status Notification which is configured by the peer devices. */ + uint16_t ntf_new_alert_cfg; /**< New Alert category notification configuration. */ + uint16_t ntf_unread_alert_cfg; /**< Unread Alert Status category notification configuration. */ + ble_gatts_create_db_t ans_gatts_db; /**< Alert Notification Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t ans_init(void); -static void ans_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void ans_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void ans_connected_cb(uint8_t conn_idx); -static bool ans_ctrl_pt_sup_check(ans_ctrl_pt_t *p_ctrl_pt); -static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt); +static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt); +static bool ans_ctrl_pt_sup_check(ans_ctrl_pt_t *p_ctrl_pt); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct ans_env_t s_ans_env; +static uint8_t s_ans_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_ALERT_NTF); static uint16_t s_ans_char_mask = 0x1fff; /**@brief Full ANS Database Description - Used to add attributes into the database. */ -static const attm_desc_t pass_attr_tab[ANS_IDX_NB] = { + +static const ble_gatts_attm_desc_t ans_attr_tab[ANS_IDX_NB] = +{ // Alert Notification Service - [ANS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Status Characteristic - Declaration - [ANS_IDX_SUP_NEW_ALET_CAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_SUP_NEW_ALET_CAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Status Characteristic - Value - [ANS_IDX_SUP_NEW_ALET_CAT_VAL] = { - BLE_ATT_CHAR_SUP_NEW_ALERT_CAT, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - ANS_SUP_NEW_ALERT_CAT_VAL_LEN - }, + [ANS_IDX_SUP_NEW_ALET_CAT_VAL] = {BLE_ATT_CHAR_SUP_NEW_ALERT_CAT, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + ANS_SUP_NEW_ALERT_CAT_VAL_LEN}, // New Alert Characteristic - Declaration - [ANS_IDX_NEWS_ALERT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_NEWS_ALERT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // New Alert Characteristic - Value - [ANS_IDX_NEWS_ALERT_VAL] = { - BLE_ATT_CHAR_NEW_ALERT, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - ANS_NEWS_ALERT_VAL_LEN - }, + [ANS_IDX_NEWS_ALERT_VAL] = {BLE_ATT_CHAR_NEW_ALERT, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + ANS_NEWS_ALERT_VAL_LEN}, // New Alert Characteristic - Client Characteristic Configuration Descriptor - [ANS_IDX_NEWS_ALERT_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [ANS_IDX_NEWS_ALERT_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Supported Unread AlertCategory Characteristic - Declaration - [ANS_IDX_SUP_UNREAD_ALERT_CAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_SUP_UNREAD_ALERT_CAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Supported Unread Alert Category Characteristic - Value - [ANS_IDX_SUP_UNREAD_ALERT_CAT_VAL] = { - BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - ANS_SUP_UNREAD_ALERT_CAT_VAL_LEN - }, + [ANS_IDX_SUP_UNREAD_ALERT_CAT_VAL] = {BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + ANS_SUP_UNREAD_ALERT_CAT_VAL_LEN}, // Unread Alert Status Characteristic - Declaration - [ANS_IDX_UNREAD_ALERT_STA_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_UNREAD_ALERT_STA_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Unread Alert Status Characteristic - Value - [ANS_IDX_UNREAD_ALERT_STA_VAL] = { - BLE_ATT_CHAR_UNREAD_ALERT_STATUS, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - ANS_UNREAD_ALERT_STA_VAL_LEN - }, + [ANS_IDX_UNREAD_ALERT_STA_VAL] = {BLE_ATT_CHAR_UNREAD_ALERT_STATUS, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + ANS_UNREAD_ALERT_STA_VAL_LEN}, // Unread Alert Status Characteristic - Client Characteristic Configuration Descriptor - [ANS_IDX_UNREAD_ALERT_STA_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [ANS_IDX_UNREAD_ALERT_STA_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // Alert Notification Control Point Characteristic - Declaration - [ANS_IDX_ALERT_NTF_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [ANS_IDX_ALERT_NTF_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Notification Control Point Characteristic - Value - [ANS_IDX_ALERT_NTF_CTRL_PT_VAL] = { - BLE_ATT_CHAR_ALERT_NTF_CTNL_PT, + [ANS_IDX_ALERT_NTF_CTRL_PT_VAL] = {BLE_ATT_CHAR_ALERT_NTF_CTNL_PT, #if defined(PTS_AUTO_TEST) - WRITE_REQ_PERM_UNSEC, + BLE_GATTS_WRITE_REQ_PERM_UNSEC, #else - WRITE_CMD_PERM_UNSEC, + BLE_GATTS_WRITE_CMD_PERM_UNSEC, #endif - ATT_VAL_LOC_USER, - ANS_ALERT_NTF_CTRL_PT_VAL_LEN - }, -}; - -/**@brief ANS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t ans_task_cbs = { - (prf_init_func_t) ans_init, - ans_connected_cb, - NULL, -}; - -/**@brief ANS Task Callbacks. */ -static gatts_prf_cbs_t ans_cb_func = { - ans_read_att_cb, - ans_write_att_cb, - NULL, - NULL, - ans_cccd_set_cb -}; - -/**@brief ANS Information. */ -static const prf_server_info_t ans_prf_info = { - .max_connection_nb = ANS_CONNECTION_MAX, - .manager_cbs = &ans_task_cbs, - .gatts_prf_cbs = &ans_cb_func, + BLE_GATTS_ATT_VAL_LOC_USER, + ANS_ALERT_NTF_CTRL_PT_VAL_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Alert Notify Service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t ans_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t pass_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_ALERT_NTF); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = pass_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_ans_char_mask; - gatts_db.max_nb_attr = ANS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = pass_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_ans_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -257,18 +182,19 @@ static sdk_err_t ans_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void ans_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void ans_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, - s_ans_env.start_hdl, - ANS_IDX_NB, - (uint8_t *)&s_ans_char_mask); + s_ans_env.start_hdl, + ANS_IDX_NB, + (uint8_t *)&s_ans_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case ANS_IDX_SUP_NEW_ALET_CAT_VAL: cfm.length = ANS_SUP_NEW_ALERT_CAT_VAL_LEN; cfm.value = (uint8_t *)&s_ans_env.ans_init.sup_new_alert_cat; @@ -306,7 +232,7 @@ static void ans_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void ans_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; @@ -314,7 +240,7 @@ static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p bool is_ctrl_pt_rec = false; ans_ctrl_pt_t ctrl_pt; ans_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_ans_env.start_hdl, @@ -325,7 +251,8 @@ static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p event.evt_type = ANS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case ANS_IDX_NEWS_ALERT_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ @@ -346,9 +273,12 @@ static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p ctrl_pt.cmd_id = (ans_ctrl_pt_id_t)p_param->value[0]; ctrl_pt.cat_id = (ans_alert_cat_id_t)p_param->value[1]; - if (ans_ctrl_pt_sup_check(&ctrl_pt)) { + if (ans_ctrl_pt_sup_check(&ctrl_pt)) + { is_ctrl_pt_rec = true; - } else { + } + else + { cfm.status = ANS_ERROR_CMD_NOT_SUP; } @@ -361,14 +291,16 @@ static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p ble_gatts_write_cfm(conn_idx, &cfm); - if (is_ctrl_pt_rec) { + if (is_ctrl_pt_rec) + { is_ctrl_pt_rec = false; ans_ctrl_pt_handler(conn_idx, &ctrl_pt); } if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && \ - ANS_EVT_INVALID != event.evt_type && \ - s_ans_env.ans_init.evt_handler) { + ANS_EVT_INVALID != event.evt_type && \ + s_ans_env.ans_init.evt_handler) + { s_ans_env.ans_init.evt_handler(&event); } } @@ -382,12 +314,13 @@ static void ans_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void ans_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void ans_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; ans_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -399,7 +332,8 @@ static void ans_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = ANS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case ANS_IDX_NEWS_ALERT_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ ANS_EVT_NEW_ALERT_NTF_ENABLE : \ @@ -419,7 +353,8 @@ static void ans_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val } if (ANS_EVT_INVALID != event.evt_type && \ - s_ans_env.ans_init.evt_handler) { + s_ans_env.ans_init.evt_handler) + { s_ans_env.ans_init.evt_handler(&event); } } @@ -431,7 +366,7 @@ static void ans_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in]: conn_idx: Connection index ***************************************************************************************** */ -static void ans_connected_cb(uint8_t conn_idx) +static void ans_connected_evt_handler(uint8_t conn_idx) { s_ans_env.ntf_new_alert_cfg = 0; s_ans_env.ntf_unread_alert_cfg = 0; @@ -448,30 +383,43 @@ static void ans_connected_cb(uint8_t conn_idx) */ static bool ans_ctrl_pt_sup_check(ans_ctrl_pt_t *p_ctrl_pt) { - if (ANS_CTRL_PT_NTF_UNREAD_CAT_STA_IMME < p_ctrl_pt->cmd_id) { + if (ANS_CTRL_PT_NTF_UNREAD_CAT_STA_IMME < p_ctrl_pt->cmd_id) + { return false; } - if (ANS_CAT_ID_INSTANT_MES < p_ctrl_pt->cat_id && ANS_CAT_ID_ALL != p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_INSTANT_MES < p_ctrl_pt->cat_id && ANS_CAT_ID_ALL != p_ctrl_pt->cat_id) + { return false; } if ((ANS_CTRL_PT_EN_NEW_INC_ALERT_NTF == p_ctrl_pt->cmd_id) && \ (ANS_CTRL_PT_DIS_NEW_INC_ALERT_NTF == p_ctrl_pt->cmd_id) && \ - (ANS_CTRL_PT_NTF_NEW_INC_ALERT_IMME == p_ctrl_pt->cmd_id)) { - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { - if (s_ans_env.ans_init.sup_new_alert_cat == 0) { + (ANS_CTRL_PT_NTF_NEW_INC_ALERT_IMME == p_ctrl_pt->cmd_id)) + { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { + if ( 0 == s_ans_env.ans_init.sup_new_alert_cat) + { return false; } - } else if (!(s_ans_env.ans_init.sup_new_alert_cat & (1 << p_ctrl_pt->cat_id))) { + } + else if (!(s_ans_env.ans_init.sup_new_alert_cat & (1 << p_ctrl_pt->cat_id))) + { return false; } - } else { - if (p_ctrl_pt->cat_id == ANS_CAT_ID_ALL) { - if (s_ans_env.ans_init.sup_new_alert_cat == 0) { + } + else + { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { + if ( 0 == s_ans_env.ans_init.sup_new_alert_cat) + { return false; } - } else if (!(s_ans_env.ans_init.sup_unread_alert_sta & (1 << p_ctrl_pt->cat_id))) { + } + else if (!(s_ans_env.ans_init.sup_unread_alert_sta & ( 1 << p_ctrl_pt->cat_id))) + { return false; } } @@ -493,47 +441,63 @@ static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt) event.evt_type = ANS_EVT_INVALID; event.conn_idx = conn_idx; - switch (p_ctrl_pt->cmd_id) { + switch (p_ctrl_pt->cmd_id) + { case ANS_CTRL_PT_EN_NEW_INC_ALERT_NTF: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { s_ans_env.ntf_new_alert_cfg |= s_ans_env.ans_init.sup_new_alert_cat; - } else { + } + else + { s_ans_env.ntf_new_alert_cfg |= 1 << p_ctrl_pt->cat_id; } break; case ANS_CTRL_PT_EN_UNREAD_CAT_STA_NTF: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { s_ans_env.ntf_unread_alert_cfg |= s_ans_env.ans_init.sup_new_alert_cat; - } else { + } + else + { s_ans_env.ntf_unread_alert_cfg |= 1 << p_ctrl_pt->cat_id; } break; case ANS_CTRL_PT_DIS_NEW_INC_ALERT_NTF: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { s_ans_env.ntf_new_alert_cfg &= ~s_ans_env.ans_init.sup_new_alert_cat; - } else { + } + else + { s_ans_env.ntf_new_alert_cfg &= ~(1 << p_ctrl_pt->cat_id); } break; case ANS_CTRL_PT_DIS_UNREAD_CAT_STA_NTF: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { s_ans_env.ntf_unread_alert_cfg &= ~s_ans_env.ans_init.sup_unread_alert_sta; - } else { + } + else + { s_ans_env.ntf_unread_alert_cfg &= ~(1 << p_ctrl_pt->cat_id); } break; case ANS_CTRL_PT_NTF_NEW_INC_ALERT_IMME: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { event.cat_ids = s_ans_env.ntf_new_alert_cfg; - } else { + } + else + { event.cat_ids = 1 << p_ctrl_pt->cat_id; } @@ -541,9 +505,12 @@ static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt) break; case ANS_CTRL_PT_NTF_UNREAD_CAT_STA_IMME: - if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) { + if (ANS_CAT_ID_ALL == p_ctrl_pt->cat_id) + { event.cat_ids = s_ans_env.ntf_unread_alert_cfg; - } else { + } + else + { event.cat_ids = 1 << p_ctrl_pt->cat_id; } @@ -554,7 +521,8 @@ static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt) break; } - if (ANS_EVT_INVALID != event.evt_type && s_ans_env.ans_init.evt_handler) { + if (ANS_EVT_INVALID != event.evt_type && s_ans_env.ans_init.evt_handler) + { s_ans_env.ans_init.evt_handler(&event); } } @@ -572,56 +540,86 @@ static void ans_ctrl_pt_handler(uint8_t conn_idx, ans_ctrl_pt_t *p_ctrl_pt) static uint16_t ans_new_alert_encode(ans_new_alert_t *p_new_alert, uint8_t *p_buff) { uint16_t length = 0; - uint16_t ret; p_buff[length++] = p_new_alert->cat_id; p_buff[length++] = p_new_alert->alert_num; - if (0 < p_new_alert->length) { - ret = memcpy_s(&p_buff[length], p_new_alert->length, p_new_alert->str_info, p_new_alert->length); - if (ret < 0) { - return ret; - } + if (0 < p_new_alert->length) + { + memcpy(&p_buff[length], p_new_alert->str_info, p_new_alert->length); } return (length + p_new_alert->length); } +static void ans_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GAPC_EVT_CONNECTED: + ans_connected_evt_handler(p_evt->evt.gapc_evt.index); + break; + + case BLE_GATTS_EVT_READ_REQUEST: + ans_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + ans_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + ans_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ans_new_alert_send(uint8_t conn_idx, ans_new_alert_t *p_new_alert) { - uint8_t encoded_new_alert[ANS_NEWS_ALERT_VAL_LEN]; - gatts_noti_ind_t new_alert_ntf; - uint16_t length; + uint8_t encoded_new_alert[ANS_NEWS_ALERT_VAL_LEN]; + ble_gatts_noti_ind_t new_alert_ntf; + uint16_t length; length = ans_new_alert_encode(p_new_alert, encoded_new_alert); - if (ANS_UTF_8_STR_LEN_MAX < p_new_alert->length) { + + if (ANS_UTF_8_STR_LEN_MAX < p_new_alert->length) + { return SDK_ERR_INVALID_PARAM; } - if (ANS_CAT_ID_INSTANT_MES < p_new_alert->cat_id) { + if (ANS_CAT_ID_INSTANT_MES < p_new_alert->cat_id) + { return SDK_ERR_INVALID_PARAM; } - if (!(s_ans_env.ans_init.sup_new_alert_cat & (1 << p_new_alert->cat_id))) { + if (!(s_ans_env.ans_init.sup_new_alert_cat & (1 << p_new_alert->cat_id))) + { return SDK_ERR_INVALID_PARAM; } - if (PRF_CLI_START_NTF != s_ans_env.new_alert_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF != s_ans_env.new_alert_ntf_cfg[conn_idx]) + { return SDK_ERR_NTF_DISABLED; } - if (!(s_ans_env.ntf_new_alert_cfg & (1 << p_new_alert->cat_id))) { + if (!(s_ans_env.ntf_new_alert_cfg & (1 << p_new_alert->cat_id))) + { return SDK_ERR_NTF_DISABLED; } new_alert_ntf.type = BLE_GATT_NOTIFICATION; new_alert_ntf.handle = prf_find_handle_by_idx(ANS_IDX_NEWS_ALERT_VAL, - s_ans_env.start_hdl, - (uint8_t *)&s_ans_char_mask); + s_ans_env.start_hdl, + (uint8_t *)&s_ans_char_mask); new_alert_ntf.length = length; new_alert_ntf.value = encoded_new_alert; @@ -630,32 +628,37 @@ sdk_err_t ans_new_alert_send(uint8_t conn_idx, ans_new_alert_t *p_new_alert) sdk_err_t ans_unread_alert_send(uint8_t conn_idx, ans_unread_alert_t *p_unread_alert) { - uint8_t encoded_unread_alert[ANS_UNREAD_ALERT_STA_VAL_LEN]; - gatts_noti_ind_t unread_alert_ntf; + uint8_t encoded_unread_alert[ANS_UNREAD_ALERT_STA_VAL_LEN]; + ble_gatts_noti_ind_t unread_alert_ntf; encoded_unread_alert[0] = p_unread_alert->cat_id; encoded_unread_alert[1] = p_unread_alert->unread_num; - if (ANS_CAT_ID_INSTANT_MES < p_unread_alert->cat_id) { + + if (ANS_CAT_ID_INSTANT_MES < p_unread_alert->cat_id) + { return SDK_ERR_INVALID_PARAM; } - if (!(s_ans_env.ans_init.sup_unread_alert_sta & (1 << p_unread_alert->cat_id))) { + if (!(s_ans_env.ans_init.sup_unread_alert_sta & (1 << p_unread_alert->cat_id))) + { return SDK_ERR_INVALID_PARAM; } - if (PRF_CLI_START_NTF != s_ans_env.unread_alert_sta_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF != s_ans_env.unread_alert_sta_ntf_cfg[conn_idx]) + { return SDK_ERR_NTF_DISABLED; } - if (!(s_ans_env.ntf_unread_alert_cfg & (1 << p_unread_alert->cat_id))) { + if (!(s_ans_env.ntf_unread_alert_cfg & (1 << p_unread_alert->cat_id))) + { return SDK_ERR_NTF_DISABLED; } unread_alert_ntf.type = BLE_GATT_NOTIFICATION; unread_alert_ntf.handle = prf_find_handle_by_idx(ANS_IDX_UNREAD_ALERT_STA_VAL, - s_ans_env.start_hdl, - (uint8_t *)&s_ans_char_mask); + s_ans_env.start_hdl, + (uint8_t *)&s_ans_char_mask); unread_alert_ntf.length = ANS_UNREAD_ALERT_STA_VAL_LEN; unread_alert_ntf.value = encoded_unread_alert; @@ -664,16 +667,23 @@ sdk_err_t ans_unread_alert_send(uint8_t conn_idx, ans_unread_alert_t *p_unread_a sdk_err_t ans_service_init(ans_init_t *p_ans_init) { - sdk_err_t ret; - if (p_ans_init == NULL) { + if (NULL == p_ans_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_ans_env.ans_init, sizeof(ans_init_t), p_ans_init, sizeof(ans_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_ans_env.ans_init, p_ans_init, sizeof(ans_init_t)); - return ble_server_prf_add(&ans_prf_info); + s_ans_env.start_hdl = PRF_INVALID_HANDLE; + + s_ans_env.ans_gatts_db.shdl = &s_ans_env.start_hdl; + s_ans_env.ans_gatts_db.uuid = s_ans_svc_uuid; + s_ans_env.ans_gatts_db.attr_tab_cfg = (uint8_t *)&s_ans_char_mask; + s_ans_env.ans_gatts_db.max_nb_attr = ANS_IDX_NB; + s_ans_env.ans_gatts_db.srvc_perm = 0; + s_ans_env.ans_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_ans_env.ans_gatts_db.attr_tab.attr_tab_16 = ans_attr_tab; + + return ble_gatts_prf_add(&s_ans_env.ans_gatts_db, ans_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.h index 4b11f1e..924e352 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans/ans.h @@ -46,7 +46,7 @@ * @brief Alert Notification Service module. * * @details The Alert Notification Service exposes alert information in a device. This information - * includes the following:Type of alert occurring in a device, Additional text information + * includes the following: Type of alert occurring in a device, Additional text information * such as caller ID or sender ID, Count of new alerts and Count of unread alert items. * * After \ref ans_init_t variable is intialized, the application must call \ref ans_service_init() @@ -58,24 +58,23 @@ #ifndef __ANS_H__ #define __ANS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup ANS_MACRO Defines * @{ */ -#define ANS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Alert Notification Service connections. */ -#define ANS_ERROR_CMD_NOT_SUP 0xa0 /**< Command not supported. */ -#define ANS_UTF_8_STR_LEN_MAX 18 /**< Maximum length of “UTF-8 string”. */ -#define ANS_SUP_NEW_ALERT_CAT_VAL_LEN 2 /**< Length of Supported New Alert Category value. */ -#define ANS_NEWS_ALERT_VAL_LEN (ANS_UTF_8_STR_LEN_MAX + 2) /**< Length of New Alert value. */ -#define ANS_SUP_UNREAD_ALERT_CAT_VAL_LEN 2 /**< Length of Supported Unread Alert Category value. */ -#define ANS_UNREAD_ALERT_STA_VAL_LEN 2 /**< Length of Unread Alert Status value. */ -#define ANS_ALERT_NTF_CTRL_PT_VAL_LEN 2 /**< Length of Alert Notification Control Point value. */ +#define ANS_CONNECTION_MAX 10 /**< Maximum number of Alert Notification Service connections. */ +#define ANS_ERROR_CMD_NOT_SUP 0xa0 /**< Command not supported. */ +#define ANS_UTF_8_STR_LEN_MAX 18 /**< Maximum length of “UTF-8 string”. */ +#define ANS_SUP_NEW_ALERT_CAT_VAL_LEN 2 /**< Length of Supported New Alert Category value. */ +#define ANS_NEWS_ALERT_VAL_LEN (ANS_UTF_8_STR_LEN_MAX + 2) /**< Length of New Alert value. */ +#define ANS_SUP_UNREAD_ALERT_CAT_VAL_LEN 2 /**< Length of Supported Unread Alert Category value. */ +#define ANS_UNREAD_ALERT_STA_VAL_LEN 2 /**< Length of Unread Alert Status value. */ +#define ANS_ALERT_NTF_CTRL_PT_VAL_LEN 2 /**< Length of Alert Notification Control Point value. */ /** * @defgroup ANS_CAT_ID_BIT_MASK Category ID Bit Masks @@ -101,7 +100,8 @@ * @{ */ /**@brief Alert Notification Service Categories of alerts/messages. */ -typedef enum { +typedef enum +{ ANS_CAT_ID_SMPL_ALERT, /**< Simple Alert: General text alert or non-text alert. */ ANS_CAT_ID_EMAIL, /**< Email: Alert when Email messages arrive. */ ANS_CAT_ID_NEWS, /**< News: News feeds such as RSS, Atom. */ @@ -117,7 +117,8 @@ typedef enum { } ans_alert_cat_id_t; /**@brief Alert Notification Service Control point. */ -typedef enum { +typedef enum +{ ANS_CTRL_PT_EN_NEW_INC_ALERT_NTF, /**< Enable New Incoming Alert Notification. */ ANS_CTRL_PT_EN_UNREAD_CAT_STA_NTF, /**< Enable Unread Category Status Notification. */ ANS_CTRL_PT_DIS_NEW_INC_ALERT_NTF, /**< Disable New Incoming Alert Notification. */ @@ -127,16 +128,15 @@ typedef enum { } ans_ctrl_pt_id_t; /**@brief Alert Notification Service Event type. */ -typedef enum { +typedef enum +{ ANS_EVT_INVALID, /**< Invalid ANS event type. */ ANS_EVT_NEW_ALERT_NTF_ENABLE, /**< NEW Alert notification is enabled. */ ANS_EVT_NEW_ALERT_NTF_DISABLE, /**< NEW Alert notification is disabled. */ ANS_EVT_UNREAD_ALERT_STA_NTF_ENABLE, /**< Unread Alert Status notification is enabled. */ ANS_EVT_UNREAD_ALERT_STA_NTF_DISABLE, /**< Unread Alert Status notification is disabled. */ - ANS_EVT_NEW_ALERT_IMME_NTF_REQ, /**< Request: notify the New Alert characteristic \ - to the client immediately. */ - ANS_EVT_Unread_ALERT_IMME_NTF_REQ, /**< Request: notify the Unread Alert Status characteristic \ - to the client immediately. */ + ANS_EVT_NEW_ALERT_IMME_NTF_REQ, /**< Request: notify the New Alert characteristic to the client immediately. */ + ANS_EVT_Unread_ALERT_IMME_NTF_REQ, /**< Request: notify the Unread Alert Status characteristic to the client immediately. */ } ans_evt_type_t; /** @} */ @@ -145,7 +145,8 @@ typedef enum { * @{ */ /**@brief Alert Notification Service New Alert value. */ -typedef struct { +typedef struct +{ ans_alert_cat_id_t cat_id; /**< Category ID. */ uint8_t alert_num; /**< Number of new alert. */ uint8_t str_info[ANS_UTF_8_STR_LEN_MAX]; /**< Text String Information. */ @@ -153,19 +154,22 @@ typedef struct { } ans_new_alert_t; /**@brief Alert Notification Service Unread Alert Status value. */ -typedef struct { +typedef struct +{ ans_alert_cat_id_t cat_id; /**< Category ID. */ uint8_t unread_num; /**< Number of unread alert. */ } ans_unread_alert_t; /**@brief Alert Notification Service Control Point value. */ -typedef struct { +typedef struct +{ ans_ctrl_pt_id_t cmd_id; /**< Command ID. */ ans_alert_cat_id_t cat_id; /**< Category ID. */ } ans_ctrl_pt_t; /**@brief Alert Notification Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ ans_evt_type_t evt_type; /**< The ANS event type. */ uint16_t cat_ids; /**< Category IDs. */ @@ -184,9 +188,9 @@ typedef void (*ans_evt_handler_t)(ans_evt_t *p_evt); * @defgroup ANS_STRUCT Structures * @{ */ -/**@brief Alert Notification Service init stucture. \ - * This contains all options and data needed for initialization of the service. */ -typedef struct { +/**@brief Alert Notification Service init stucture. This contains all options and data needed for initialization of the service. */ +typedef struct +{ ans_evt_handler_t evt_handler; /**< Phone Alert Status Service event handler. */ uint16_t sup_new_alert_cat; /**< Initial mask of Supported New Alert Category. */ uint16_t sup_unread_alert_sta; /**< Initial mask of Unread Alert Status. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/BUILD.gn new file mode 100644 index 0000000..8dba5b5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ans_c") { + sources = [ "ans_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.c index 683343c..d9140ae 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.c @@ -39,65 +39,31 @@ * INCLUDE FILES **************************************************************************************** */ -#include -#include "utility.h" #include "ans_c.h" +#include "utility.h" +#include -#define INDEX_2 2 -#define LEN_2 2 -#define ATTR_VALUE_LEN 2 -#define UUID_OFFSET_8 8 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Alert Notification Service Client environment variable. */ -struct ans_c_env_t { +struct ans_c_env_t +{ ans_c_handles_t handles; /**< Handles of ANS characteristics which will be got for peer. */ ans_c_evt_handler_t evt_handler; /**< Handler of ANS Client event handler. */ - uint8_t prf_id; /**< ANS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void ans_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void ans_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void ans_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void ans_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct ans_c_env_t s_ans_c_env; /**< Alert Notification Service Client environment variable. */ - -/**@brief Alert Notification Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t ans_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Alert Notification Service GATT Client Callbacks. */ -static gattc_prf_cbs_t ans_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - ans_c_att_read_cb, - ans_c_att_write_cb, - ans_c_att_ntf_ind_cb, - ans_c_srvc_browse_cb, - NULL, -}; - -/**@brief Alert Notification Service Client Information. */ -static const prf_client_info_t ans_c_prf_info = { - .max_connection_nb = ANS_C_CONNECTION_MAX, - .manager_cbs = &ans_c_mgr_cbs, - .gattc_prf_cbs = &ans_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_ALERT_NTF), HI_U16(BLE_ATT_SVC_ALERT_NTF)}; +static ble_uuid_t s_ans_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -113,7 +79,8 @@ static const prf_client_info_t ans_c_prf_info = { */ static void ans_c_evt_handler_excute(ans_c_evt_t *p_evt) { - if (s_ans_c_env.evt_handler != NULL && ANS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_ans_c_env.evt_handler && ANS_C_EVT_INVALID != p_evt->evt_type) + { s_ans_c_env.evt_handler(p_evt); } } @@ -128,24 +95,19 @@ static void ans_c_evt_handler_excute(ans_c_evt_t *p_evt) */ static void ans_c_new_alert_decode(const uint8_t *p_data, uint16_t length, ans_c_new_alert_t *p_new_alert) { - uint8_t ret; - if (length < LEN_2) { + if (2 > length) + { return; } - ret = memset_s(p_new_alert, sizeof(ans_c_new_alert_t), 0, sizeof(ans_c_new_alert_t)); - if (ret < 0) { - return; - } + memset(p_new_alert, 0, sizeof(ans_c_new_alert_t)); p_new_alert->cat_id = (ans_c_alert_cat_id_t)p_data[0]; p_new_alert->alert_num = p_data[1]; - p_new_alert->length = length - LEN_2; + p_new_alert->length = length - 2; - if (length > LEN_2) { - ret = memcpy_s(p_new_alert->str_info, length - LEN_2, &p_data[INDEX_2], length - LEN_2); - if (ret < 0) { - return; - } + if (2 < length) + { + memcpy(p_new_alert->str_info, & p_data[2], length - 2); } } @@ -159,7 +121,8 @@ static void ans_c_new_alert_decode(const uint8_t *p_data, uint16_t length, ans_c */ static void ans_c_unread_decode(const uint8_t *p_data, uint16_t length, ans_c_unread_alert_t *p_unread_alert) { - if (length != 2) { + if (2 != length) + { return; } @@ -176,24 +139,26 @@ static void ans_c_unread_decode(const uint8_t *p_data, uint16_t length, ans_c_un * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void ans_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void ans_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { ans_c_evt_t ans_c_evt; ans_c_evt.conn_idx = conn_idx; ans_c_evt.evt_type = ANS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_ans_c_env.handles.ans_sup_new_alert_cat_handle) { + if (p_read_rsp->value[0].handle == s_ans_c_env.handles.ans_sup_new_alert_cat_handle) + { ans_c_evt.evt_type = ANS_C_EVT_SUP_NEW_ALERT_CAT_RECEIV; - ans_c_evt.value.sup_new_alert_cat_ids = BUILD_U16(p_read_rsp->vals[0].p_value[0], - p_read_rsp->vals[0].p_value[1]); - } else if (p_read_rsp->vals[0].handle == s_ans_c_env.handles.ans_sup_unread_alert_cat_handle) { + ans_c_evt.value.sup_new_alert_cat_ids = BUILD_U16(p_read_rsp->value[0].p_value[0], p_read_rsp->value[0].p_value[1]); + } + else if (p_read_rsp->value[0].handle == s_ans_c_env.handles.ans_sup_unread_alert_cat_handle) + { ans_c_evt.evt_type = ANS_C_EVT_SUP_UNREAD_ALERT_CAT_REC; - ans_c_evt.value.sup_unread_alert_cat_ids = BUILD_U16(p_read_rsp->vals[0].p_value[0], - p_read_rsp->vals[0].p_value[1]); + ans_c_evt.value.sup_unread_alert_cat_ids = BUILD_U16(p_read_rsp->value[0].p_value[0], p_read_rsp->value[0].p_value[1]); } ans_c_evt_handler_excute(&ans_c_evt); @@ -208,22 +173,27 @@ static void ans_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void ans_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void ans_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { ans_c_evt_t ans_c_evt; ans_c_evt.conn_idx = conn_idx; ans_c_evt.evt_type = ANS_C_EVT_INVALID; - if (handle == s_ans_c_env.handles.ans_new_alert_cccd_handle) { + if (handle == s_ans_c_env.handles.ans_new_alert_cccd_handle) + { ans_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - ANS_C_EVT_NEW_ALERT_NTF_SET_SUCCESS : - ANS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ans_c_env.handles.ans_unread_alert_cccd_handle) { + ANS_C_EVT_NEW_ALERT_NTF_SET_SUCCESS : + ANS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ans_c_env.handles.ans_unread_alert_cccd_handle) + { ans_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - ANS_C_EVT_UNREAD_ALERT_STA_NTF_SET_SUCCESS : - ANS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ans_c_env.handles.ans_ctrl_pt_handle) { + ANS_C_EVT_UNREAD_ALERT_STA_NTF_SET_SUCCESS : + ANS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ans_c_env.handles.ans_ctrl_pt_handle) + { ans_c_evt.evt_type = (BLE_SUCCESS == status) ? ANS_C_EVT_CTRL_POINT_SET_SUCCESS : \ ANS_C_EVT_WRITE_OP_ERR; @@ -241,17 +211,20 @@ static void ans_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void ans_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void ans_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { ans_c_evt_t ans_c_evt; ans_c_evt.conn_idx = conn_idx; ans_c_evt.evt_type = ANS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_ans_c_env.handles.ans_new_alert_handle) { + if (p_ntf_ind->handle == s_ans_c_env.handles.ans_new_alert_handle) + { ans_c_evt.evt_type = ANS_C_EVT_NEW_ALERT_RECEIVE; ans_c_new_alert_decode(p_ntf_ind->p_value, p_ntf_ind->length, &ans_c_evt.value.new_alert); - } else if (p_ntf_ind->handle == s_ans_c_env.handles.ans_unread_alert_handle) { + } + else if (p_ntf_ind->handle == s_ans_c_env.handles.ans_unread_alert_handle) + { ans_c_evt.evt_type = ANS_C_EVT_UNREAD_ALERT_RECEIVE; ans_c_unread_decode(p_ntf_ind->p_value, p_ntf_ind->length, &ans_c_evt.value.unread_alert); } @@ -268,7 +241,7 @@ static void ans_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void ans_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void ans_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { ans_c_evt_t ans_c_evt; uint16_t uuid_disc; @@ -277,154 +250,171 @@ static void ans_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat ans_c_evt.conn_idx = conn_idx; ans_c_evt.evt_type = ANS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << UUID_OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (uuid_disc != BLE_ATT_SVC_ALERT_NTF) { - return; - } + if (BLE_ATT_SVC_ALERT_NTF == uuid_disc) + { + s_ans_c_env.handles.ans_srvc_start_handle = p_browse_srvc->start_hdl; + s_ans_c_env.handles.ans_srvc_end_handle = p_browse_srvc->end_hdl; - s_ans_c_env.handles.ans_srvc_start_handle = p_browse_srvc->start_hdl; - s_ans_c_env.handles.ans_srvc_end_handle = p_browse_srvc->end_hdl; + for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) + { + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) { - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | \ - p_browse_srvc->info[i].attr.uuid[1] << UUID_OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; - - if (BLE_ATT_CHAR_SUP_NEW_ALERT_CAT == uuid_disc) { - s_ans_c_env.handles.ans_sup_new_alert_cat_handle = handle_disc; - } else if (BLE_ATT_CHAR_NEW_ALERT == uuid_disc) { - s_ans_c_env.handles.ans_new_alert_handle = handle_disc; - s_ans_c_env.handles.ans_new_alert_cccd_handle = handle_disc + 1; - } else if (BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT == uuid_disc) { - s_ans_c_env.handles.ans_sup_unread_alert_cat_handle = handle_disc; - } else if (BLE_ATT_CHAR_UNREAD_ALERT_STATUS == uuid_disc) { - s_ans_c_env.handles.ans_unread_alert_handle = handle_disc; - s_ans_c_env.handles.ans_unread_alert_cccd_handle = handle_disc + 1; - } else if (BLE_ATT_CHAR_ALERT_NTF_CTNL_PT == uuid_disc) { - s_ans_c_env.handles.ans_ctrl_pt_handle = handle_disc; + if (BLE_ATT_CHAR_SUP_NEW_ALERT_CAT == uuid_disc) + { + s_ans_c_env.handles.ans_sup_new_alert_cat_handle = handle_disc; + } + else if (BLE_ATT_CHAR_NEW_ALERT == uuid_disc) + { + s_ans_c_env.handles.ans_new_alert_handle = handle_disc; + s_ans_c_env.handles.ans_new_alert_cccd_handle = handle_disc + 1; + } + else if (BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT == uuid_disc) + { + s_ans_c_env.handles.ans_sup_unread_alert_cat_handle = handle_disc; + } + else if (BLE_ATT_CHAR_UNREAD_ALERT_STATUS == uuid_disc) + { + s_ans_c_env.handles.ans_unread_alert_handle = handle_disc; + s_ans_c_env.handles.ans_unread_alert_cccd_handle = handle_disc + 1; + } + else if (BLE_ATT_CHAR_ALERT_NTF_CTNL_PT == uuid_disc) + { + s_ans_c_env.handles.ans_ctrl_pt_handle = handle_disc; + } + } + else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; + } } - } else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; + + ans_c_evt.evt_type = ANS_C_EVT_DISCOVERY_COMPLETE; } } - ans_c_evt.evt_type = ANS_C_EVT_DISCOVERY_COMPLETE; - ans_c_evt_handler_excute(&ans_c_evt); } +static void ans_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + ans_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + ans_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ans_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + ans_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ans_client_init(ans_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_ans_c_env, sizeof(s_ans_c_env), 0, sizeof(s_ans_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_ans_c_env, 0, sizeof(s_ans_c_env)); s_ans_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&ans_c_prf_info, &s_ans_c_env.prf_id); + return ble_gattc_prf_add(&s_ans_service_uuid, ans_c_ble_evt_handler); } sdk_err_t ans_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - target_uuid[0] = LO_U16(BLE_ATT_SVC_ALERT_NTF); - target_uuid[1] = HI_U16(BLE_ATT_SVC_ALERT_NTF); - - const ble_uuid_t ans_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_ans_c_env.prf_id, conn_idx, &ans_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_ans_service_uuid); } - sdk_err_t ans_c_new_alert_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_new_alert_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_new_alert_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ans_c_env.handles.ans_new_alert_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_ans_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ans_c_env.handles.ans_new_alert_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ans_c_unread_alert_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_unread_alert_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_unread_alert_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ans_c_env.handles.ans_unread_alert_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_ans_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ans_c_env.handles.ans_unread_alert_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ans_c_sup_new_alert_cat_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_sup_new_alert_cat_handle) { + if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_sup_new_alert_cat_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_ans_c_env.prf_id, conn_idx, s_ans_c_env.handles.ans_sup_new_alert_cat_handle, 0); + return ble_gattc_read(conn_idx, s_ans_c_env.handles.ans_sup_new_alert_cat_handle, 0); } sdk_err_t ans_c_sup_unread_alert_cat_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_sup_unread_alert_cat_handle) { + if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_sup_unread_alert_cat_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_ans_c_env.prf_id, conn_idx, s_ans_c_env.handles.ans_sup_unread_alert_cat_handle, 0); + return ble_gattc_read(conn_idx, s_ans_c_env.handles.ans_sup_unread_alert_cat_handle, 0); } sdk_err_t ans_c_ctrl_point_set(uint8_t conn_idx, ans_c_ctrl_pt_t *p_ctrl_pt) { - gattc_write_no_resp_t write_attr_value; uint8_t ctrl_pt_val[ANS_C_ALERT_NTF_CTRL_PT_VAL_LEN]; ctrl_pt_val[0] = p_ctrl_pt->cmd_id; ctrl_pt_val[1] = p_ctrl_pt->cat_id; - if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_ctrl_pt_handle) { + if (BLE_ATT_INVALID_HDL == s_ans_c_env.handles.ans_ctrl_pt_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_ans_c_env.handles.ans_ctrl_pt_handle; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = ctrl_pt_val; - - return ble_gattc_prf_write_no_resp(s_ans_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_ans_c_env.handles.ans_ctrl_pt_handle, 2, ctrl_pt_val); } + + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.h index 6235ef5..ca64b06 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ans_c/ans_c.h @@ -57,38 +57,37 @@ #ifndef __ANS_C_H__ #define __ANS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup ANS_C_MACRO Defines * @{ */ -#define ANS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */ -#define ANS_C_ERROR_CMD_NOT_SUP 0xa0 /**< Command not supported. */ -#define ANS_C_UTF_8_STR_LEN_MAX 18 /**< Maximum length of “UTF-8 string”. */ -#define ANS_C_ALERT_NTF_CTRL_PT_VAL_LEN 2 /**< Length of Alert Notification Control Point value. */ +#define ANS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ +#define ANS_C_ERROR_CMD_NOT_SUP 0xa0 /**< Command not supported. */ +#define ANS_C_UTF_8_STR_LEN_MAX 18 /**< Maximum length of “UTF-8 string”. */ +#define ANS_C_ALERT_NTF_CTRL_PT_VAL_LEN 2 /**< Length of Alert Notification Control Point value. */ /** * @defgroup ANS_C_CAT_ID_BIT_MASK Category ID Bit Masks * @{ * @brief Category ID Bit Masks. */ -#define ANS_SMPL_ALERT_SUP (0x01 << 0) /**< Bit for Simple Alert Supported. */ -#define ANS_EMAIL_SUP (0x01 << 1) /**< Bit for Email Supported. */ -#define ANS_NEWS_SUP (0x01 << 2) /**< Bit for News Supported. */ -#define ANS_CALL_SUP (0x01 << 3) /**< Bit for Call Supported. */ -#define ANS_MISSED_CALL_SUP (0x01 << 4) /**< Bit for Missed Call Supported. */ -#define ANS_SMS_MMS_SUP (0x01 << 5) /**< Bit for SMS/MMS Supported. */ -#define ANS_VOICE_MAIL_SUP (0x01 << 6) /**< Bit for Voice Mail Supported. */ -#define ANS_SCHEDULE_SUP (0x01 << 7) /**< Bit for Schedule Supported. */ -#define ANS_HG_PRIO_ALERT_SUP (0x01 << 8) /**< Bit for High Prioritized Alert Supported. */ -#define ANS_INSTANT_MES (0x01 << 9) /**< Bit for Instant Message Supported. */ -#define ANS_ALL_CAT_SUP (0x03ff) /**< Bit for All Category Supported. */ +#define ANS_C_SMPL_ALERT_SUP (0x01 << 0) /**< Bit for Simple Alert Supported. */ +#define ANS_C_EMAIL_SUP (0x01 << 1) /**< Bit for Email Supported. */ +#define ANS_C_NEWS_SUP (0x01 << 2) /**< Bit for News Supported. */ +#define ANS_C_CALL_SUP (0x01 << 3) /**< Bit for Call Supported. */ +#define ANS_C_MISSED_CALL_SUP (0x01 << 4) /**< Bit for Missed Call Supported. */ +#define ANS_C_SMS_MMS_SUP (0x01 << 5) /**< Bit for SMS/MMS Supported. */ +#define ANS_C_VOICE_MAIL_SUP (0x01 << 6) /**< Bit for Voice Mail Supported. */ +#define ANS_C_SCHEDULE_SUP (0x01 << 7) /**< Bit for Schedule Supported. */ +#define ANS_C_HG_PRIO_ALERT_SUP (0x01 << 8) /**< Bit for High Prioritized Alert Supported. */ +#define ANS_C_INSTANT_MES (0x01 << 9) /**< Bit for Instant Message Supported. */ +#define ANS_C_ALL_CAT_SUP (0x03ff) /**< Bit for All Category Supported. */ /** @} */ /** @} */ @@ -97,7 +96,8 @@ * @{ */ /**@brief Alert Notification Service Categories of alerts/messages. */ -typedef enum { +typedef enum +{ ANS_C_CAT_ID_SMPL_ALERT, /**< Simple Alert: General text alert or non-text alert. */ ANS_C_CAT_ID_EMAIL, /**< Email: Alert when Email messages arrives. */ ANS_C_CAT_ID_NEWS, /**< News: News feeds such as RSS, Atom. */ @@ -113,7 +113,8 @@ typedef enum { } ans_c_alert_cat_id_t; /**@brief Alert Notification Service Client Control point ID. */ -typedef enum { +typedef enum +{ ANS_C_CTRL_PT_EN_NEW_INC_ALERT_NTF, /**< Enable New Incoming Alert Notification. */ ANS_C_CTRL_PT_EN_UNREAD_CAT_STA_NTF, /**< Enable Unread Category Status Notification. */ ANS_C_CTRL_PT_DIS_NEW_INC_ALERT_NTF, /**< Disable New Incoming Alert Notification. */ @@ -123,21 +124,19 @@ typedef enum { } ans_c_ctrl_pt_id_t; /**@brief Alert Notification Service Client Event type. */ -typedef enum { +typedef enum +{ ANS_C_EVT_INVALID, /**< ANS Client invalid event type. */ ANS_C_EVT_DISCOVERY_COMPLETE, /**< ANS Client has found ANS service and its characteristics. */ - ANS_C_EVT_DISCOVERY_FAIL, /**< ANS Client found ANS service failed \ - because of invalid operation or no found at the peer. */ + ANS_C_EVT_DISCOVERY_FAIL , /**< ANS Client found ANS service failed because of invalid operation or no found at the peer. */ ANS_C_EVT_NEW_ALERT_NTF_SET_SUCCESS, /**< ANS Client has set NEW Alert notification. */ ANS_C_EVT_UNREAD_ALERT_STA_NTF_SET_SUCCESS, /**< ANS Client has set Unread Alert Status notification. */ - ANS_C_EVT_SUP_NEW_ALERT_CAT_RECEIV, /**< ANS Client has received Supported New Alert Category value \ - (Read from peer). */ - ANS_C_EVT_SUP_UNREAD_ALERT_CAT_REC, /**< ANS Client has received Supported Unread Alert Category value \ - (Read from peer). */ - ANS_C_EVT_NEW_ALERT_RECEIVE, /**< ANS Client has received New Alert value (Notification from peer). */ - ANS_C_EVT_UNREAD_ALERT_RECEIVE, /**< ANS Client has received Unread Alert Status value (Notification from peer). */ - ANS_C_EVT_CTRL_POINT_SET_SUCCESS, /**< ANS Client has written Control Point completely. */ - ANS_C_EVT_WRITE_OP_ERR, /**< Error occured when ANS Client wrote to peer. */ + ANS_C_EVT_SUP_NEW_ALERT_CAT_RECEIV, /**< ANS Client has received Supported New Alert Category value (Read from peer). */ + ANS_C_EVT_SUP_UNREAD_ALERT_CAT_REC, /**< ANS Client has received Supported Unread Alert Category value (Read from peer). */ + ANS_C_EVT_NEW_ALERT_RECEIVE, /**< ANS Client has received New Alert value (Notification from peer). */ + ANS_C_EVT_UNREAD_ALERT_RECEIVE, /**< ANS Client has received Unread Alert Status value (Notification from peer). */ + ANS_C_EVT_CTRL_POINT_SET_SUCCESS, /**< ANS Client has written Control Point completely. */ + ANS_C_EVT_WRITE_OP_ERR, /**< Error occured when ANS Client wrote to peer. */ } ans_c_evt_type_t; /** @} */ @@ -146,7 +145,8 @@ typedef enum { * @{ */ /**@brief Alert Notification Service Client decoded New Alert value. */ -typedef struct { +typedef struct +{ ans_c_alert_cat_id_t cat_id; /**< Category ID. */ uint8_t alert_num; /**< Number of new alert. */ uint8_t str_info[ANS_C_UTF_8_STR_LEN_MAX]; /**< Text String Information. */ @@ -154,42 +154,40 @@ typedef struct { } ans_c_new_alert_t; /**@brief Alert Notification Service Client decoded Unread Alert Status value. */ -typedef struct { +typedef struct +{ ans_c_alert_cat_id_t cat_id; /**< Category ID. */ uint8_t unread_num; /**< Number of unread alert. */ } ans_c_unread_alert_t; /**@brief Alert Notification Service Client Control Point value. */ -typedef struct { +typedef struct +{ ans_c_ctrl_pt_id_t cmd_id; /**< Command ID. */ ans_c_alert_cat_id_t cat_id; /**< Category ID. */ } ans_c_ctrl_pt_t; /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t ans_srvc_start_handle; /**< ANS Service start handle. */ uint16_t ans_srvc_end_handle; /**< ANS Service end handle. */ - uint16_t ans_sup_new_alert_cat_handle; /**< ANS Supported New Alert Category characteristic Value handle \ - which has been got from peer. */ - uint16_t ans_new_alert_handle; /**< ANS New Alert characteristic Value handle \ - which has been got from peer. */ - uint16_t ans_new_alert_cccd_handle; /**< ANS CCCD handle of New Alert characteristic \ - which has been got from peer. */ - uint16_t ans_sup_unread_alert_cat_handle; /**< ANS Supported Unread Alert Category characteristic Value handle \ - which has been got from peer. */ - uint16_t ans_unread_alert_handle; /**< ANS Unread Alert characteristic Value handle \ - which has been got from peer. */ - uint16_t ans_unread_alert_cccd_handle; /**< ANS CCCD handle of Unread Alert characteristic \ - which has been got from peer. */ - uint16_t ans_ctrl_pt_handle; /**< ANS Control Point characteristic Value handle \ - which has been got from peer. */ + uint16_t ans_sup_new_alert_cat_handle; /**< ANS Supported New Alert Category characteristic Value handle which has been got from peer. */ + uint16_t ans_new_alert_handle; /**< ANS New Alert characteristic Value handle which has been got from peer. */ + uint16_t ans_new_alert_cccd_handle; /**< ANS CCCD handle of New Alert characteristic which has been got from peer. */ + uint16_t ans_sup_unread_alert_cat_handle; /**< ANS Supported Unread Alert Category characteristic Value handle which has been got from peer. */ + uint16_t ans_unread_alert_handle; /**< ANS Unread Alert characteristic Value handle which has been got from peer. */ + uint16_t ans_unread_alert_cccd_handle; /**< ANS CCCD handle of Unread Alert characteristic which has been got from peer. */ + uint16_t ans_ctrl_pt_handle; /**< ANS Control Point characteristic Value handle which has been got from peer. */ } ans_c_handles_t; /**@brief Alert Notification Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ ans_c_evt_type_t evt_type; /**< The ANS event type. */ - union { + union + { uint16_t sup_new_alert_cat_ids; /**< Alert status received. */ uint16_t sup_unread_alert_cat_ids; /**< Ringer setting received. */ ans_c_new_alert_t new_alert; /**< New Alert value. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/BUILD.gn new file mode 100644 index 0000000..fe6a833 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("bas") { + sources = [ "bas.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.c index f660996..df4f8fd 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.c @@ -49,7 +49,8 @@ ***************************************************************************************** */ /**@brief Battery Service Attributes Indexes. */ -enum bas_attr_idx_t { +enum bas_attr_idx_t +{ BAS_IDX_SVC, BAS_IDX_BATT_LVL_CHAR, @@ -65,125 +66,49 @@ enum bas_attr_idx_t { ***************************************************************************************** */ /**@brief Battery Service environment variable. */ -struct bas_env_t { - bas_init_t bas_init; /**< Battery Service initialization variables. */ - uint16_t start_hdl; /**< Battery Service start handle. */ - uint16_t - ntf_cfg[BAS_CONNECTION_MAX]; /**< The configuration of Battery Level Notification \ - which is configured by the peer devices. */ - prf_char_pres_fmt_t - batt_level_pres_format; /**< Battery Level Characteristic Presentation Format \ - which should not change during connection. */ +struct bas_env_t +{ + bas_init_t bas_init; /**< Battery Service initialization variables. */ + uint16_t start_hdl; /**< Battery Service start handle. */ + uint16_t ntf_cfg[BAS_CONNECTION_MAX]; /**< The configuration of Battery Level Notification which is configured by the peer devices. */ + prf_char_pres_fmt_t batt_level_pres_format; /**< Battery Level Characteristic Presentation Format which should not change during connection. */ + ble_gatts_create_db_t bas_gatts_db; /**< Battery Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t bas_init(void); -static void bas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void bas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void bas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct bas_env_t s_bas_env[BAS_INSTANCE_MAX]; /**< Battery service instance. */ static uint8_t s_bas_ins_cnt = 0; /**< Number of Battery Server task instances. */ +static const uint8_t s_bas_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BATTERY_SERVICE); /**@brief Full BAS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_t bas_attr_tab[BAS_IDX_NB] = { +static const ble_gatts_attm_desc_t bas_attr_tab[BAS_IDX_NB] = +{ // Battery Service Declaration - [BAS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [BAS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Battery Level Characteristic - Declaration - [BAS_IDX_BATT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BAS_IDX_BATT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Battery Level Characteristic - Value - [BAS_IDX_BATT_LVL_VAL] = { - BLE_ATT_CHAR_BATTERY_LEVEL, - READ_PERM_UNSEC | NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - BAS_LVL_MAX_LEN - }, + [BAS_IDX_BATT_LVL_VAL] = {BLE_ATT_CHAR_BATTERY_LEVEL, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + BAS_LVL_MAX_LEN}, // Battery Level Characteristic - Client Characteristic Configuration Descriptor - [BAS_IDX_BATT_LVL_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - 0 - }, + [BAS_IDX_BATT_LVL_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + 0}, // Battery Level Characteristic - Characteristic Presentation Format Descriptor - [BAS_IDX_BATT_LVL_PRES_FMT] = {BLE_ATT_DESC_CHAR_PRES_FORMAT, READ_PERM_UNSEC, ATT_VAL_LOC_USER, 0}, -}; - -/**@brief Battery Service interface required by profile manager. */ -static ble_prf_manager_cbs_t bas_mgr_cbs = { - (prf_init_func_t)bas_init, - NULL, - NULL -}; - -/**@brief Battery GATT Server Callbacks. */ -static gatts_prf_cbs_t bas_gatts_cbs = { - bas_read_att_cb, - bas_write_att_cb, - NULL, - NULL, - bas_cccd_set_cb -}; - -/**@brief Battery Service Information. */ -static const prf_server_info_t bas_prf_info = { - .max_connection_nb = BAS_CONNECTION_MAX, - .manager_cbs = &bas_mgr_cbs, - .gatts_prf_cbs = &bas_gatts_cbs + [BAS_IDX_BATT_LVL_PRES_FMT] = {BLE_ATT_DESC_CHAR_PRES_FORMAT, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Battery service and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t bas_init(void) -{ - const uint8_t bas_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BATTERY_SERVICE); - sdk_err_t error_code = SDK_SUCCESS; - uint16_t start_hdl; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - for (uint8_t i = 0; i < s_bas_ins_cnt; i++) { - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - start_hdl = PRF_INVALID_HANDLE; - gatts_db.shdl = &start_hdl; - gatts_db.uuid = bas_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_bas_env[i].bas_init.char_mask; - gatts_db.max_nb_attr = BAS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = bas_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_bas_env[i].start_hdl = *(gatts_db.shdl); - } else { - return error_code; - } - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -192,28 +117,32 @@ static sdk_err_t bas_init(void) * @param[in] p_param: Point to the parameters of the read request. ***************************************************************************************** */ -static void bas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void bas_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - uint8_t handle = p_param->handle; - uint8_t tab_index; - uint8_t char_pres_value[PRF_CHAR_PRES_FMT_SIZE]; - uint8_t i; - gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index; + uint8_t char_pres_value[PRF_CHAR_PRES_FMT_SIZE]; + uint8_t i; + ble_gatts_read_cfm_t cfm; cfm.handle = handle; cfm.status = BLE_SUCCESS; - for (i = 0; i < s_bas_ins_cnt; i++) { + for (i = 0; i < s_bas_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_bas_env[i].start_hdl, BAS_IDX_NB, &s_bas_env[i].bas_init.char_mask); - if (tab_index > 0) { + + if (tab_index > 0) + { break; } } - switch (tab_index) { + switch (tab_index) + { case BAS_IDX_BATT_LVL_VAL: cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)(&s_bas_env[i].bas_init.batt_lvl); @@ -247,35 +176,39 @@ static void bas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in] p_param Point to the parameters of the write request. ***************************************************************************************** */ -static void bas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void bas_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t cccd_value = 0; - uint8_t tab_index = 0; - uint8_t i = 0; - bas_evt_t bas_evt; - gatts_write_cfm_t cfm; + uint16_t handle = p_param->handle; + uint16_t cccd_value = 0; + uint8_t tab_index = 0; + uint8_t i = 0; + bas_evt_t bas_evt; + ble_gatts_write_cfm_t cfm; cfm.handle = handle; cfm.status = BLE_SUCCESS; - for (i = 0; i < s_bas_ins_cnt; i++) { + for (i = 0; i < s_bas_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_bas_env[i].start_hdl, BAS_IDX_NB, &s_bas_env[i].bas_init.char_mask); - if (tab_index > 0) { + + if (tab_index > 0) + { break; } } - switch (tab_index) { + switch (tab_index) + { case BAS_IDX_BATT_LVL_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); s_bas_env[i].ntf_cfg[conn_idx] = cccd_value; bas_evt.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ - BAS_EVT_NOTIFICATION_ENABLED : \ - BAS_EVT_NOTIFICATION_DISABLED); + BAS_EVT_NOTIFICATION_ENABLED : \ + BAS_EVT_NOTIFICATION_DISABLED); break; default: @@ -284,8 +217,9 @@ static void bas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par } if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && \ - BAS_EVT_INVALID != bas_evt.evt_type && \ - s_bas_env[i].bas_init.evt_handler) { + BAS_EVT_INVALID != bas_evt.evt_type && \ + s_bas_env[i].bas_init.evt_handler) + { bas_evt.conn_idx = conn_idx; s_bas_env[i].bas_init.evt_handler(&bas_evt); } @@ -302,32 +236,37 @@ static void bas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void bas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void bas_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; uint8_t i = 0; bas_evt_t bas_evt; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } - for (i = 0; i < s_bas_ins_cnt; i++) { + for (i = 0; i < s_bas_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_bas_env[i].start_hdl, BAS_IDX_NB, &s_bas_env[i].bas_init.char_mask); - if (tab_index > 0) { + + if (tab_index > 0) + { break; } } - switch (tab_index) { + switch (tab_index) + { case BAS_IDX_BATT_LVL_NTF_CFG: s_bas_env[i].ntf_cfg[conn_idx] = cccd_value; bas_evt.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ - BAS_EVT_NOTIFICATION_ENABLED : \ - BAS_EVT_NOTIFICATION_DISABLED); + BAS_EVT_NOTIFICATION_ENABLED : \ + BAS_EVT_NOTIFICATION_DISABLED); break; default: @@ -335,25 +274,51 @@ static void bas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (BAS_EVT_INVALID != bas_evt.evt_type && s_bas_env[i].bas_init.evt_handler) { + if (BAS_EVT_INVALID != bas_evt.evt_type && s_bas_env[i].bas_init.evt_handler) + { bas_evt.conn_idx = conn_idx; s_bas_env[i].bas_init.evt_handler(&bas_evt); } } +static void bas_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + bas_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + bas_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + bas_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ******************************************************************************* */ sdk_err_t bas_batt_lvl_update(uint8_t conn_idx, uint8_t ins_idx, uint8_t batt_lvl) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_cmd; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t send_cmd; - if (ins_idx <= s_bas_ins_cnt) { + if (ins_idx <= s_bas_ins_cnt) + { s_bas_env[ins_idx].bas_init.batt_lvl = batt_lvl; - if (PRF_CLI_START_NTF == s_bas_env[ins_idx].ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_bas_env[ins_idx].ntf_cfg[conn_idx]) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; send_cmd.handle = prf_find_handle_by_idx(BAS_IDX_BATT_LVL_VAL, @@ -373,24 +338,42 @@ sdk_err_t bas_batt_lvl_update(uint8_t conn_idx, uint8_t ins_idx, uint8_t batt_lv sdk_err_t bas_service_init(bas_init_t *p_bas_init, uint8_t ins_num) { - sdk_err_t ret; - if (p_bas_init == NULL) { + sdk_err_t error_code = SDK_SUCCESS; + + if (NULL == p_bas_init) + { return SDK_ERR_POINTER_NULL; } - if (ins_num > BAS_INSTANCE_MAX) { + if (ins_num > BAS_INSTANCE_MAX) + { return SDK_ERR_INVALID_PARAM; } - for (uint8_t i = 0; i < ins_num; i++) { - ret = memcpy_s(&s_bas_env[i].bas_init, sizeof(bas_init_t), &p_bas_init[i], sizeof(bas_init_t)); - if (ret < 0) { - return ret; + for (uint8_t i = 0; i < ins_num; i++) + { + memcpy(&s_bas_env[i].bas_init, &p_bas_init[i], sizeof(bas_init_t)); + s_bas_env[i].start_hdl = PRF_INVALID_HANDLE; + s_bas_env[i].bas_gatts_db.shdl = &s_bas_env[i].start_hdl; + s_bas_env[i].bas_gatts_db.uuid = s_bas_svc_uuid; + s_bas_env[i].bas_gatts_db.attr_tab_cfg = (uint8_t *)&s_bas_env[i].bas_init.char_mask; + s_bas_env[i].bas_gatts_db.max_nb_attr = BAS_IDX_NB; + s_bas_env[i].bas_gatts_db.srvc_perm = 0; + s_bas_env[i].bas_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_bas_env[i].bas_gatts_db.attr_tab.attr_tab_16 = bas_attr_tab; + error_code = ble_gatts_prf_add(&s_bas_env[i].bas_gatts_db, bas_ble_evt_handler); + if(error_code) + { + return error_code; } } s_bas_ins_cnt = ins_num; - return ble_server_prf_add(&bas_prf_info); + return error_code; } +uint16_t bas_service_start_handle_get(void) +{ + return s_bas_env[0].start_hdl; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.h index b21252f..3b810df 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas/bas.h @@ -69,20 +69,16 @@ #ifndef __BAS_H__ #define __BAS_H__ +#include "gr_includes.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup BAS_MACRO Defines * @{ */ -#define BAS_INSTANCE_MAX 1 /**< Maximum number of Battery Service instances. \ - The value is configurable. */ -#define BAS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of BAS connections. - The value is configurable. */ +#define BAS_INSTANCE_MAX 1 /**< Maximum number of Battery Service instances. The value is configurable. */ +#define BAS_CONNECTION_MAX 10 /**< Maximum number of BAS connections.The value is configurable. */ #define BAS_LVL_MAX_LEN 1 /**< Maximun length of battery level value. */ /** @@ -102,7 +98,8 @@ * @{ */ /**@brief Battery Service event types. */ -typedef enum { +typedef enum +{ BAS_EVT_INVALID, /**< Indicate that it's an invalid event. */ BAS_EVT_NOTIFICATION_ENABLED, /**< Indicate that notification has been enabled. */ BAS_EVT_NOTIFICATION_DISABLED, /**< Indicate that notification has been disabled. */ @@ -114,7 +111,8 @@ typedef enum { * @{ */ /**@brief Battery Service event. */ -typedef struct { +typedef struct +{ bas_evt_type_t evt_type; /**< The BAS event type. */ uint8_t conn_idx; /**< The index of the connection. */ } bas_evt_t; @@ -132,12 +130,11 @@ typedef void (*bas_evt_handler_t)(bas_evt_t *p_evt); * @defgroup BAS_STRUCT Structures * @{ */ -/**@brief Battery Service init structure. - * This contains all options and data needed for initialization of the service. */ -typedef struct { +/**@brief Battery Service init structure. This contains all options and data needed for initialization of the service. */ +typedef struct +{ bas_evt_handler_t evt_handler; /**< Battery Service event handler. */ - uint8_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref BAS_CHAR_MASK */ + uint8_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref BAS_CHAR_MASK */ uint8_t batt_lvl; /**< Initial value of Battery Level characteristic. */ } bas_init_t; /** @} */ @@ -156,7 +153,7 @@ typedef struct { * @return Result of service initialization. ***************************************************************************************** */ -sdk_err_t bas_service_init(bas_init_t bas_init[], uint8_t ins_num); +sdk_err_t bas_service_init(bas_init_t bas_init[],uint8_t ins_num); /** ***************************************************************************************** @@ -170,6 +167,16 @@ sdk_err_t bas_service_init(bas_init_t bas_init[], uint8_t ins_num); ***************************************************************************************** */ sdk_err_t bas_batt_lvl_update(uint8_t conn_idx, uint8_t ins_idx, uint8_t batt_lvl); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the bas service start handle . + * + * @return The bas service start handle. + ***************************************************************************************** + */ +uint16_t bas_service_start_handle_get(void); + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/BUILD.gn new file mode 100644 index 0000000..2f9fe2e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("bas_c") { + sources = [ "bas_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.c index e035df7..53df13b 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.c @@ -39,66 +39,33 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "bas_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "bas_c.h" +#include -#define UUID_OFFSET_8 8 -#define ATTR_VALUE_LEN 2 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Battery Service environment variable. */ -struct bas_c_env_t { +struct bas_c_env_t +{ bas_c_handles_t handles; /**< Handles of BAS characteristics which will be got for peer. */ bas_c_evt_handler_t evt_handler; /**< Handler of BAS Client event */ - uint8_t prf_id; /**< BAS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void bas_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void bas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void bas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void bas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct bas_c_env_t s_bas_c_env; /**< Battery Service Client environment variable. */ - -/**@brief Battery Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t bas_c_mgr_cbs = { - NULL, - NULL, - NULL +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_BATTERY_SERVICE), HI_U16(BLE_ATT_SVC_BATTERY_SERVICE)}; +static ble_uuid_t s_bas_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; - -/**@brief Battery Service GATT Client Callbacks. */ -static gattc_prf_cbs_t bas_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - bas_c_att_read_cb, - bas_c_att_write_cb, - bas_c_att_ntf_ind_cb, - bas_c_srvc_browse_cb, - NULL, -}; - -/**@brief Battery Service Client Information. */ -static const prf_client_info_t bas_c_prf_info = { - .max_connection_nb = BAS_C_CONNECTION_MAX, - .manager_cbs = &bas_c_mgr_cbs, - .gattc_prf_cbs = &bas_c_gattc_cbs -}; - /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -112,7 +79,8 @@ static const prf_client_info_t bas_c_prf_info = { */ void bas_c_evt_handler_excute(bas_c_evt_t *p_evt) { - if (s_bas_c_env.evt_handler != NULL && BAS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_bas_c_env.evt_handler && BAS_C_EVT_INVALID != p_evt->evt_type) + { s_bas_c_env.evt_handler(p_evt); } } @@ -126,20 +94,22 @@ void bas_c_evt_handler_excute(bas_c_evt_t *p_evt) * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void bas_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void bas_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { bas_c_evt_t bas_c_evt; bas_c_evt.conn_idx = conn_idx; bas_c_evt.evt_type = BAS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_bas_c_env.handles.bas_bat_level_handle) { + if (p_read_rsp->value[0].handle == s_bas_c_env.handles.bas_bat_level_handle) + { bas_c_evt.evt_type = BAS_C_EVT_BAT_LEVE_RECEIVE; - bas_c_evt.bat_level = p_read_rsp->vals[0].p_value[0]; + bas_c_evt.bat_level = p_read_rsp->value[0].p_value[0]; bas_c_evt_handler_excute(&bas_c_evt); } } @@ -153,14 +123,15 @@ static void bas_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void bas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void bas_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { bas_c_evt_t bas_c_evt; bas_c_evt.conn_idx = conn_idx; bas_c_evt.evt_type = BAS_C_EVT_INVALID; - if (handle == s_bas_c_env.handles.bas_bat_level_cccd_handle) { + if (handle == s_bas_c_env.handles.bas_bat_level_cccd_handle) + { bas_c_evt.evt_type = (BLE_SUCCESS == status) ?\ BAS_C_EVT_BAT_LEVEL_NTF_SET_SUCCESS :\ BAS_C_EVT_BAT_LEVEL_NTF_SET_ERR; @@ -178,14 +149,15 @@ static void bas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void bas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void bas_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { bas_c_evt_t bas_c_evt; bas_c_evt.conn_idx = conn_idx; bas_c_evt.evt_type = BAS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_bas_c_env.handles.bas_bat_level_handle) { + if (p_ntf_ind->handle == s_bas_c_env.handles.bas_bat_level_handle) + { bas_c_evt.evt_type = BAS_C_EVT_BAT_LEVE_RECEIVE; bas_c_evt.bat_level = p_ntf_ind->p_value[0]; bas_c_evt_handler_excute(&bas_c_evt); @@ -201,7 +173,7 @@ static void bas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void bas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void bas_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { bas_c_evt_t bas_c_evt; uint16_t uuid_disc; @@ -210,102 +182,123 @@ static void bas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat bas_c_evt.conn_idx = conn_idx; bas_c_evt.evt_type = BAS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << UUID_OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_BATTERY_SERVICE == uuid_disc) { - s_bas_c_env.handles.bas_srvc_start_handle = p_browse_srvc->start_hdl; - s_bas_c_env.handles.bas_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_BATTERY_SERVICE == uuid_disc) + { + s_bas_c_env.handles.bas_srvc_start_handle = p_browse_srvc->start_hdl; + s_bas_c_env.handles.bas_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | - p_browse_srvc->info[i].attr.uuid[1] << UUID_OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_BATTERY_LEVEL == uuid_disc) { - s_bas_c_env.handles.bas_bat_level_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_BATTERY_LEVEL == uuid_disc) + { + s_bas_c_env.handles.bas_bat_level_handle = handle_disc; + } } - } else if (BLE_GATTC_BROWSE_ATTR_DESC == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_DESC_CLIENT_CHAR_CFG == uuid_disc) { - s_bas_c_env.handles.bas_bat_level_cccd_handle = handle_disc; - } else if (BLE_ATT_DESC_CHAR_PRES_FORMAT == uuid_disc) { - s_bas_c_env.handles.bas_bat_level_pres_handle = handle_disc; + else if (BLE_GATTC_BROWSE_ATTR_DESC == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_DESC_CLIENT_CHAR_CFG == uuid_disc) + { + s_bas_c_env.handles.bas_bat_level_cccd_handle = handle_disc; + } + else if (BLE_ATT_DESC_CHAR_PRES_FORMAT == uuid_disc) + { + s_bas_c_env.handles.bas_bat_level_pres_handle = handle_disc; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; } - } - bas_c_evt.evt_type = BAS_C_EVT_DISCOVERY_COMPLETE; + bas_c_evt.evt_type = BAS_C_EVT_DISCOVERY_COMPLETE; + } } bas_c_evt_handler_excute(&bas_c_evt); } +static void bas_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + bas_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + bas_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + bas_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + bas_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t bas_client_init(bas_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_bas_c_env, sizeof(s_bas_c_env), 0, sizeof(s_bas_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_bas_c_env, 0, sizeof(s_bas_c_env)); s_bas_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&bas_c_prf_info, &s_bas_c_env.prf_id); + return ble_gattc_prf_add(&s_bas_service_uuid, bas_c_ble_evt_handler); } sdk_err_t bas_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - - target_uuid[0] = LO_U16(BLE_ATT_SVC_BATTERY_SERVICE); - target_uuid[1] = HI_U16(BLE_ATT_SVC_BATTERY_SERVICE); - - const ble_uuid_t bas_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_bas_c_env.prf_id, conn_idx, &bas_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_bas_service_uuid); } sdk_err_t bas_c_bat_level_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_bas_c_env.handles.bas_bat_level_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_bas_c_env.handles.bas_bat_level_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_bas_c_env.handles.bas_bat_level_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_bas_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_bas_c_env.handles.bas_bat_level_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t bas_c_bat_level_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_bas_c_env.handles.bas_bat_level_handle) { + if (BLE_ATT_INVALID_HDL == s_bas_c_env.handles.bas_bat_level_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_bas_c_env.prf_id, conn_idx, s_bas_c_env.handles.bas_bat_level_handle, 0); + return ble_gattc_read(conn_idx, s_bas_c_env.handles.bas_bat_level_handle, 0); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.h index 0d173c6..6d2977e 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bas_c/bas_c.h @@ -57,18 +57,17 @@ #ifndef __BAS_C_H__ #define __BAS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup BAS_C_MACRO Defines * @{ */ -#define BAS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of BAS Client connections. */ +#define BAS_C_CONNECTION_MAX 10 /**< Maximum number of BAS Client connections. */ /** @} */ /** @@ -76,16 +75,14 @@ * @{ */ /**@brief Battery Service Client event type. */ -typedef enum { - BAS_C_EVT_INVALID, /**< BAS Client invalid event. */ - BAS_C_EVT_DISCOVERY_COMPLETE, /**< BAS Client has found BAS service and its characteristics. */ - BAS_C_EVT_DISCOVERY_FAIL, /**< BAS Client found BAS service failed because of invalid operation \ - or no found at the peer. */ - BAS_C_EVT_BAT_LEVEL_NTF_SET_SUCCESS, /**< BAS Client has enabled Notification of Battery Level characteristics. */ - BAS_C_EVT_BAT_LEVEL_NTF_SET_ERR, /**< Error occured when BAS Client set Notification \ - of Battery Level characteristics. */ - BAS_C_EVT_BAT_LEVE_RECEIVE, /**< BAS Client has received Battery Level value \ - (Read or Notification from peer). */ +typedef enum +{ + BAS_C_EVT_INVALID, /**< BAS Client invalid event. */ + BAS_C_EVT_DISCOVERY_COMPLETE, /**< BAS Client has found BAS service and its characteristics. */ + BAS_C_EVT_DISCOVERY_FAIL, /**< BAS Client found BAS service failed because of invalid operation or no found at the peer. */ + BAS_C_EVT_BAT_LEVEL_NTF_SET_SUCCESS, /**< BAS Client has enabled Notification of Battery Level characteristics. */ + BAS_C_EVT_BAT_LEVEL_NTF_SET_ERR, /**< Error occured when BAS Client set Notification of Battery Level characteristics. */ + BAS_C_EVT_BAT_LEVE_RECEIVE, /**< BAS Client has received Battery Level value (Read or Notification from peer). */ } bas_c_evt_type_t; /** @} */ @@ -94,19 +91,18 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t bas_srvc_start_handle; /**< BAS Service start handle. */ uint16_t bas_srvc_end_handle; /**< BAS Service end handle. */ - uint16_t bas_bat_level_handle; /**< BAS Battery Level characteristic Value handle \ - which has been got from peer. */ - uint16_t bas_bat_level_cccd_handle; /**< BAS CCCD handle of Battery Level characteristic \ - which has been got from peer. */ - uint16_t bas_bat_level_pres_handle; /**< BAS Presentation Format Descriptor handle of \ - Battery Level characteristic which has been got from peer. */ + uint16_t bas_bat_level_handle; /**< BAS Battery Level characteristic Value handle which has been got from peer. */ + uint16_t bas_bat_level_cccd_handle; /**< BAS CCCD handle of Battery Level characteristic which has been got from peer. */ + uint16_t bas_bat_level_pres_handle; /**< BAS Presentation Format Descriptor handle of Battery Level characteristic which has been got from peer. */ } bas_c_handles_t; /**@brief Battery Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ bas_c_evt_type_t evt_type; /**< BAS Client event type. */ uint8_t bat_level; /**< Battery level. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/BUILD.gn new file mode 100644 index 0000000..08575ef --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("bcs") { + sources = [ "bcs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.c index ed9d50b..cc77057 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.c @@ -35,7 +35,7 @@ ***************************************************************************************** */ -/* +/* * INCLUDE FILES ***************************************************************************************** */ @@ -45,16 +45,14 @@ #include "ble_prf_utils.h" #include "utility.h" #include "app_log.h" -#define PACKET_ADD_2 2 -#define FIELD_SIZE 2 -#define LOAD_LEN 2 /* * ENUMERATIONS ***************************************************************************************** */ /** Body Composition Service Attributes Indexes. */ -enum { +enum +{ BCS_IDX_SVC, BCS_IDX_BC_FEAT_CHAR, @@ -72,37 +70,33 @@ enum { ***************************************************************************************** */ /**@brief Body Composition Service Measurement packet. */ -typedef struct { +typedef struct +{ uint16_t size; /**< Measurement packet size. */ uint8_t value[BCS_MEAS_VAL_LEN_MAX]; /**< Measurement packet Value. */ } meas_packet_t; /**@brief Body Composition Service Measurement data stream. */ -typedef struct { +typedef struct +{ meas_packet_t meas_packets[BCS_CACHE_MEAS_NUM_MAX * NUM_PACKETS]; /**< BCS Measurement packet Value. */ uint8_t packet_num; /**< BCS Measurement packet number. */ - uint8_t packet_to_be_send_num; /**< Number of BCS Measurement packet to be send. */ + uint8_t packet_to_be_send_num; /**< Number of BCS Measurement packet to be send. */ } bcs_meas_data_stream_t; /**@brief Body Composition Service environment variable. */ -struct bcs_env_t { - bcs_init_t bcs_init; /**< Body Composition Service Init Value. */ - uint16_t start_hdl; /**< Body Composition Service start handle. */ - uint16_t - meas_ind_cfg[BCS_CONNECTION_MAX]; /**< The configuration of BC Measurement Indication - which is configured by the peer devices. */ - uint16_t *p_start_handle; +struct bcs_env_t +{ + bcs_init_t bcs_init; /**< Body Composition Service Init Value. */ + uint16_t start_hdl; /**< Body Composition Service start handle. */ + uint16_t meas_ind_cfg[BCS_CONNECTION_MAX]; /**< The configuration of BC Measurement Indication which is configured by the peer devices. */ + ble_gatts_create_db_t bcs_gatts_db; /**< Body Composition Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATIONS ***************************************************************************************** */ -static sdk_err_t bcs_init(void); -static void bcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void bcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void bcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void bcs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ptf_ind); static uint16_t bcs_indicate_meas_value_chunk(uint8_t conn_idx); static void bcs_meas_value_encoded(const bcs_meas_val_t *p_meas, uint16_t max_payload, uint8_t cache_num); static uint16_t packet_field_add(uint16_t flag, uint16_t value, uint16_t *p_flags, uint8_t **pp_field); @@ -112,104 +106,42 @@ static bool subsequent_packet_switched(uint16_t max_payload, uint8_t field * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct bcs_env_t s_bcs_env; +static struct bcs_env_t s_bcs_env; static bcs_meas_data_stream_t s_meas_packets; +static const uint8_t s_bcs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BODY_COMPOSITION); -/**@brief Full BCS attributes descriptor which is used to add attributes into the ATT database.*/ -static const attm_desc_t bcs_attr_tab[BCS_IDX_NB] = { +/**@brief Full BCS attributes descriptor which is used to add attributes into the ATT database.*/ +static const ble_gatts_attm_desc_t bcs_attr_tab[BCS_IDX_NB] = +{ // Body Composition Service Declaration - [BCS_IDX_SVC] = {BLE_ATT_DECL_SECONDARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [BCS_IDX_SVC] = {BLE_ATT_DECL_SECONDARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // BC Feature Characteristic - Declaration - [BCS_IDX_BC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BCS_IDX_BC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // BC Feature Characteristic - Value - [BCS_IDX_BC_FEAT_VAL] = { - BLE_ATT_CHAR_BODY_COMPOSITION_FEATURE, - READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, - BCS_FEAT_VAL_LEN_MAX - }, + [BCS_IDX_BC_FEAT_VAL] = {BLE_ATT_CHAR_BODY_COMPOSITION_FEATURE, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + BCS_FEAT_VAL_LEN_MAX}, // BC Measurement Characteristic - Declaration - [BCS_IDX_BC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BCS_IDX_BC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // BC Measurement Characteristic - Value - [BCS_IDX_BC_MEAS_VAL] = { - BLE_ATT_CHAR_BODY_COMPOSITION_MEASUREMENT, - INDICATE_PERM(UNAUTH), - ATT_VAL_LOC_USER, - BCS_MEAS_VAL_LEN_MAX - }, + [BCS_IDX_BC_MEAS_VAL] = {BLE_ATT_CHAR_BODY_COMPOSITION_MEASUREMENT, + BLE_GATTS_INDICATE_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + BCS_MEAS_VAL_LEN_MAX}, // BC Measurement Characteristic - Client Characteristic Configuration Descriptor - [BCS_IDX_BC_MEAS_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - 0, - 0 - }, -}; - -/**@brief BCS Callbacks required by profile manager. */ -static ble_prf_manager_cbs_t bcs_mgr_cbs = { - (prf_init_func_t) bcs_init, - NULL, - NULL -}; - -/**@brief BCS Callbacks for GATT server. */ -static gatts_prf_cbs_t bcs_cb_func = { - bcs_read_att_cb, - bcs_write_att_cb, - NULL, - bcs_ntf_ind_cb, - bcs_cccd_set_cb, -}; - -/**@brief Information for registering BC service. */ -static const prf_server_info_t bcs_prf_info = { - .max_connection_nb = BCS_CONNECTION_MAX, - .manager_cbs = &bcs_mgr_cbs, - .gatts_prf_cbs = &bcs_cb_func + [BCS_IDX_BC_MEAS_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Body Composition service create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t bcs_init(void) -{ - *s_bcs_env.p_start_handle = PRF_INVALID_HANDLE; - const uint8_t bcs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BODY_COMPOSITION); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = s_bcs_env.p_start_handle; - gatts_db.uuid = bcs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_bcs_env.bcs_init.char_mask); - gatts_db.max_nb_attr = BCS_IDX_NB; - gatts_db.srvc_perm = SRVC_SECONDARY_SET; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = bcs_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_bcs_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the read request. @@ -220,18 +152,19 @@ static sdk_err_t bcs_init(void) * @return If the request was consumed or not. ***************************************************************************************** */ -static void bcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void bcs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, - s_bcs_env.start_hdl, - BCS_IDX_NB, - (uint8_t *)&(s_bcs_env.bcs_init.char_mask)); + s_bcs_env.start_hdl, + BCS_IDX_NB, + (uint8_t *)&(s_bcs_env.bcs_init.char_mask)); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case BCS_IDX_BC_FEAT_VAL: cfm.length = sizeof(uint32_t); cfm.value = (uint8_t *)&s_bcs_env.bcs_init.feature; @@ -261,13 +194,13 @@ static void bcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @return If the request was consumed or not. ***************************************************************************************** */ -static void bcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void bcs_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t tab_index = 0; - uint16_t cccd_value = 0; - bcs_evt_t event; - gatts_write_cfm_t cfm; + uint16_t handle = p_param->handle; + uint16_t tab_index = 0; + uint16_t cccd_value = 0; + bcs_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_bcs_env.start_hdl, @@ -278,12 +211,13 @@ static void bcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par event.evt_type = BCS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case BCS_IDX_BC_MEAS_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - BCS_EVT_MEAS_INDICATION_ENABLE :\ - BCS_EVT_MEAS_INDICATION_DISABLE); + BCS_EVT_MEAS_INDICATION_ENABLE :\ + BCS_EVT_MEAS_INDICATION_DISABLE); s_bcs_env.meas_ind_cfg[conn_idx] = cccd_value; break; @@ -294,8 +228,8 @@ static void bcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && - BCS_EVT_INVALID != event.evt_type && s_bcs_env.bcs_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && BCS_EVT_INVALID != event.evt_type && s_bcs_env.bcs_init.evt_handler) + { s_bcs_env.bcs_init.evt_handler(&event); } } @@ -309,12 +243,13 @@ static void bcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void bcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void bcs_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; bcs_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -326,11 +261,12 @@ static void bcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = BCS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case BCS_IDX_BC_MEAS_IND_CFG: event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - BCS_EVT_MEAS_INDICATION_ENABLE :\ - BCS_EVT_MEAS_INDICATION_DISABLE); + BCS_EVT_MEAS_INDICATION_ENABLE :\ + BCS_EVT_MEAS_INDICATION_DISABLE); s_bcs_env.meas_ind_cfg[conn_idx] = cccd_value; break; @@ -338,7 +274,8 @@ static void bcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (BCS_EVT_INVALID != event.evt_type && s_bcs_env.bcs_init.evt_handler) { + if (BCS_EVT_INVALID != event.evt_type && s_bcs_env.bcs_init.evt_handler) + { s_bcs_env.bcs_init.evt_handler(&event); } } @@ -352,15 +289,17 @@ static void bcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void bcs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void bcs_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { bcs_evt_t event; event.evt_type = BCS_EVT_INVALID; event.conn_idx = conn_idx; - if (s_bcs_env.bcs_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_INDICATION == p_ntf_ind->type) { + if (s_bcs_env.bcs_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_INDICATION == p_ntf_ind->type) + { bcs_indicate_meas_value_chunk(conn_idx); event.evt_type = BCS_EVT_MEAS_INDICATION_CPLT; } @@ -389,7 +328,7 @@ static uint16_t meas_packet_init(const bcs_meas_val_t *p_meas, meas_packet_t *p_ uint16_t *p_flags = *pp_flags; *p_flags |= (s_bcs_env.bcs_init.bcs_unit == BCS_UNIT_SI) ? - BCS_MEAS_FLAG_UNIT_SI : BCS_MEAS_FLAG_UNIT_IMPERIAL; + BCS_MEAS_FLAG_UNIT_SI : BCS_MEAS_FLAG_UNIT_IMPERIAL; uint16_t *p_field = (uint16_t *)*pp_field; *p_field = p_meas->body_fat_percentage; @@ -440,13 +379,15 @@ static uint16_t packet_field_add(uint16_t flag, uint16_t value, static bool subsequent_packet_switched(uint16_t max_payload, uint8_t field_size, meas_packet_t *p_packets) { - if (p_packets[MEAS_PACKET_SUB].size) { + if (p_packets[MEAS_PACKET_SUB].size) + { return false; } meas_packet_t *p_first_pkt = &p_packets[MEAS_PACKET_FIRST]; - if (p_first_pkt->size + field_size > max_payload) { + if (p_first_pkt->size + field_size > max_payload) + { // The Multiple packet bit is setting for the first packet. uint16_t *p_flags = (uint16_t *)p_first_pkt->value; *p_flags |= BCS_MEAS_FLAG_MUTI_PACKET; @@ -458,7 +399,9 @@ static bool subsequent_packet_switched(uint16_t max_payload, uint8_t field_size, *p_flags |= BCS_MEAS_FLAG_MUTI_PACKET; return true; - } else { + } + else + { return false; } } @@ -474,35 +417,32 @@ static bool subsequent_packet_switched(uint16_t max_payload, uint8_t field_size, */ static uint16_t bcs_indicate_meas_value_chunk(uint8_t conn_idx) { - gatts_noti_ind_t bcs_meas_ind; - sdk_err_t error_code; + ble_gatts_noti_ind_t bcs_meas_ind; + sdk_err_t error_code; - if (s_meas_packets.packet_to_be_send_num == 0) { + if (0 == s_meas_packets.packet_to_be_send_num) + { s_meas_packets.packet_num = 0; s_meas_packets.packet_to_be_send_num = 0; - error_code = memset_s(s_meas_packets.meas_packets, sizeof(s_meas_packets.meas_packets), - 0x00, sizeof(s_meas_packets.meas_packets)); - if (error_code < 0) { - return error_code; - } + memset(s_meas_packets.meas_packets, 0x00, sizeof(s_meas_packets.meas_packets)); return SDK_SUCCESS; } - if (PRF_CLI_START_IND == s_bcs_env.meas_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_bcs_env.meas_ind_cfg[conn_idx]) + { bcs_meas_ind.type = BLE_GATT_INDICATION; bcs_meas_ind.handle = prf_find_handle_by_idx(BCS_IDX_BC_MEAS_VAL, - s_bcs_env.start_hdl, - (uint8_t *)&s_bcs_env.bcs_init.char_mask); - bcs_meas_ind.length = s_meas_packets.meas_packets[s_meas_packets.packet_num - - s_meas_packets.packet_to_be_send_num].size; - bcs_meas_ind.value = s_meas_packets.meas_packets[s_meas_packets.packet_num - - s_meas_packets.packet_to_be_send_num].value; + s_bcs_env.start_hdl, + (uint8_t *)&s_bcs_env.bcs_init.char_mask); + bcs_meas_ind.length = s_meas_packets.meas_packets[s_meas_packets.packet_num - s_meas_packets.packet_to_be_send_num].size; + bcs_meas_ind.value = s_meas_packets.meas_packets[s_meas_packets.packet_num - s_meas_packets.packet_to_be_send_num].value; error_code = ble_gatts_noti_ind(conn_idx, &bcs_meas_ind); } - if (SDK_SUCCESS == error_code) { + if (SDK_SUCCESS == error_code) + { s_meas_packets.packet_to_be_send_num--; } return error_code; @@ -522,7 +462,8 @@ static void bcs_meas_value_encoded(const bcs_meas_val_t *p_meas, uint16_t max_pa { uint8_t packet_num = 0; - for (uint8_t i = 0; i < cache_num; i++) { + for (uint8_t i = 0; i < cache_num; i++) + { meas_packet_t *p_pkt = &s_meas_packets.meas_packets[packet_num]; uint16_t *p_flags; uint8_t *p_field; @@ -533,40 +474,47 @@ static void bcs_meas_value_encoded(const bcs_meas_val_t *p_meas, uint16_t max_pa /** The following are the optional fields. */ // Time Stamp Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_TIME_STAMP) && \ - s_bcs_env.bcs_init.bcs_meas_flags.time_stamp_present) { + s_bcs_env.bcs_init.bcs_meas_flags.time_stamp_present) + { *p_flags |= BCS_MEAS_FLAG_DATE_TIME_PRESENT; p_field += prf_pack_date_time(p_field, &p_meas[i].time_stamp); } // User ID Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_MULTI_USER) && \ - s_bcs_env.bcs_init.bcs_meas_flags.user_id_present) { + s_bcs_env.bcs_init.bcs_meas_flags.user_id_present) + { *p_flags |= BCS_MEAS_FLAG_USER_ID_PRESENT; *p_field++ = p_meas[i].user_id; } - if (BCS_MEAS_UNSUCCESS != p_meas[i].body_fat_percentage) { + if (BCS_MEAS_UNSUCCESS != p_meas[i].body_fat_percentage) + { // Basal Metabolism Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_BASAL_METABOLISM) && \ - s_bcs_env.bcs_init.bcs_meas_flags.basal_metabolism_present) { + s_bcs_env.bcs_init.bcs_meas_flags.basal_metabolism_present) + { packet_field_add(BCS_MEAS_FLAG_BASAL_METABOLISM, p_meas[i].basal_metabolism, p_flags, &p_field); } // Muscle Percentage Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_MUSCLE_PERCENTAGE) && \ - s_bcs_env.bcs_init.bcs_meas_flags.muscle_percentage_present) { + s_bcs_env.bcs_init.bcs_meas_flags.muscle_percentage_present) + { packet_field_add(BCS_MEAS_FLAG_MUSCLE_PERCENTAGE, p_meas[i].muscle_percentage, p_flags, &p_field); } // Muscle Mass Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_MUSCLE_MASS) && \ - s_bcs_env.bcs_init.bcs_meas_flags.muscle_mass_present) { + s_bcs_env.bcs_init.bcs_meas_flags.muscle_mass_present) + { packet_field_add(BCS_MEAS_FLAG_MUSCLE_MASS, p_meas[i].muscle_mass, p_flags, &p_field); } // Fat Free Mass Field. if ((s_bcs_env.bcs_init.feature & BCS_FEAT_FAT_FREE_MASS) && \ - s_bcs_env.bcs_init.bcs_meas_flags.fat_free_mass_present) { + s_bcs_env.bcs_init.bcs_meas_flags.fat_free_mass_present) + { packet_field_add(BCS_MEAS_FLAG_FAT_FREE_MASS, p_meas[i].fat_free_mass, p_flags, &p_field); } @@ -577,94 +525,122 @@ static void bcs_meas_value_encoded(const bcs_meas_val_t *p_meas, uint16_t max_pa * size shall be checked and the subsequent packet shall be used if needed. */ // Soft Lean Mass Field. - if (!(s_bcs_env.bcs_init.feature & BCS_FEAT_SOFT_LEAN_MASS) || \ - !s_bcs_env.bcs_init.bcs_meas_flags.soft_lean_mass_present) { - return; + if ((s_bcs_env.bcs_init.feature & BCS_FEAT_SOFT_LEAN_MASS) && \ + s_bcs_env.bcs_init.bcs_meas_flags.soft_lean_mass_present) + { + if (subsequent_packet_switched(max_payload, 2, &s_meas_packets.meas_packets[packet_num]) == true) + { + p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; + p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + } + + p_pkt->size += packet_field_add(BCS_MEAS_FLAG_SOFT_LEAN_MASS, p_meas[i].soft_lean_mass, p_flags, &p_field); } - if (subsequent_packet_switched(max_payload, FIELD_SIZE, &s_meas_packets.meas_packets[packet_num]) == true) { - p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; - p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); - } - - p_pkt->size += packet_field_add(BCS_MEAS_FLAG_SOFT_LEAN_MASS, - p_meas[i].soft_lean_mass, p_flags, &p_field); // Body Water Mass Field. - if (!(s_bcs_env.bcs_init.feature & BCS_FEAT_BODY_WATER_MASS) || \ - !s_bcs_env.bcs_init.bcs_meas_flags.body_water_mass_present) { - return; + if ((s_bcs_env.bcs_init.feature & BCS_FEAT_BODY_WATER_MASS) && \ + s_bcs_env.bcs_init.bcs_meas_flags.body_water_mass_present) + { + if (subsequent_packet_switched(max_payload, 2, &s_meas_packets.meas_packets[packet_num]) == true) + { + p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; + p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + } + + p_pkt->size += packet_field_add(BCS_MEAS_FLAG_BODY_WATER_MASS, p_meas[i].body_water_mass, p_flags, &p_field); } - if (subsequent_packet_switched(max_payload, FIELD_SIZE, &s_meas_packets.meas_packets[packet_num]) == true) { - p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; - p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); - } - - p_pkt->size += packet_field_add(BCS_MEAS_FLAG_BODY_WATER_MASS, - p_meas[i].body_water_mass, p_flags, &p_field); // Impedance Field. - if (!(s_bcs_env.bcs_init.feature & BCS_FEAT_IMPEDANCE) || \ - !s_bcs_env.bcs_init.bcs_meas_flags.impedance_present) { - return; - } - if (subsequent_packet_switched(max_payload, FIELD_SIZE, &s_meas_packets.meas_packets[packet_num]) == true) { - p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; - p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + if ((s_bcs_env.bcs_init.feature & BCS_FEAT_IMPEDANCE) && \ + s_bcs_env.bcs_init.bcs_meas_flags.impedance_present) + { + if (subsequent_packet_switched(max_payload, 2, &s_meas_packets.meas_packets[packet_num]) == true) { + p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; + p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + } + + p_pkt->size += packet_field_add(BCS_MEAS_FLAG_IMPEDANCE, p_meas[i].impedance, p_flags, &p_field); } - p_pkt->size += packet_field_add(BCS_MEAS_FLAG_IMPEDANCE, p_meas[i].impedance, p_flags, &p_field); // Weight Field. - if (!(s_bcs_env.bcs_init.feature & BCS_FEAT_WEIGHT) || \ - !s_bcs_env.bcs_init.bcs_meas_flags.weight_present) { - return; - } - if (subsequent_packet_switched(max_payload, FIELD_SIZE, - &s_meas_packets.meas_packets[packet_num]) == true) { - p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; - p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + if ((s_bcs_env.bcs_init.feature & BCS_FEAT_WEIGHT) && \ + s_bcs_env.bcs_init.bcs_meas_flags.weight_present) + { + if (subsequent_packet_switched(max_payload, 2, &s_meas_packets.meas_packets[packet_num]) == true) + { + p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; + p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + } + + p_pkt->size += packet_field_add(BCS_MEAS_FLAG_WEIGHT, p_meas[i].weight, p_flags, &p_field); } - p_pkt->size += packet_field_add(BCS_MEAS_FLAG_WEIGHT, p_meas[i].weight, p_flags, &p_field); // Height Field. - if (!(s_bcs_env.bcs_init.feature & BCS_FEAT_HEIGHT) || \ - !s_bcs_env.bcs_init.bcs_meas_flags.height_present) { - return; - } - if (subsequent_packet_switched(max_payload, LOAD_LEN, &s_meas_packets.meas_packets[packet_num]) == true) { - p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; - p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); - } + if ((s_bcs_env.bcs_init.feature & BCS_FEAT_HEIGHT) && \ + s_bcs_env.bcs_init.bcs_meas_flags.height_present) + { + if (subsequent_packet_switched(max_payload, 2, &s_meas_packets.meas_packets[packet_num]) == true) + { + p_pkt = &s_meas_packets.meas_packets[packet_num + 1]; + p_pkt->size = meas_packet_init(&p_meas[i], p_pkt, &p_flags, &p_field); + } - p_pkt->size += packet_field_add(BCS_MEAS_FLAG_HEIGHT, p_meas[i].height, p_flags, &p_field); + p_pkt->size += packet_field_add(BCS_MEAS_FLAG_HEIGHT, p_meas[i].height, p_flags, &p_field); + } } - packet_num += PACKET_ADD_2; + packet_num += 2; } s_meas_packets.packet_num = packet_num; s_meas_packets.packet_to_be_send_num = packet_num; } +static void bcs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + bcs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + bcs_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + bcs_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + bcs_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t bcs_measurement_send(uint8_t conn_idx, bcs_meas_val_t *p_bcs_meas_val, uint8_t cache_num) { - if (p_bcs_meas_val == NULL || BCS_CACHE_MEAS_NUM_MAX < cache_num) { + if (NULL == p_bcs_meas_val || BCS_CACHE_MEAS_NUM_MAX < cache_num) + { return SDK_ERR_INVALID_PARAM; } sdk_err_t error_code = SDK_ERR_IND_DISABLED; - error_code = memset_s(s_meas_packets.meas_packets, sizeof(s_meas_packets.meas_packets), \ - 0x00, sizeof(s_meas_packets.meas_packets)); - if (error_code < 0) { - return error_code; - } + memset(s_meas_packets.meas_packets, 0x00, sizeof(s_meas_packets.meas_packets)); s_meas_packets.packet_num = 0; s_meas_packets.packet_to_be_send_num = 0; - if (PRF_CLI_START_IND == s_bcs_env.meas_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_bcs_env.meas_ind_cfg[conn_idx]) + { bcs_meas_value_encoded(p_bcs_meas_val, BLE_ATT_MTU_DEFAULT - INDI_PAYLOAD_HEADER_LEN, cache_num); error_code = bcs_indicate_meas_value_chunk(conn_idx); } @@ -672,19 +648,29 @@ sdk_err_t bcs_measurement_send(uint8_t conn_idx, bcs_meas_val_t *p_bcs_meas_val, return error_code; } -sdk_err_t bcs_service_init(bcs_init_t *p_bcs_init, uint16_t *p_bcs_start_handle) +sdk_err_t bcs_service_init(bcs_init_t *p_bcs_init) { - sdk_err_t ret; - if (p_bcs_init == NULL) { + if (NULL == p_bcs_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_bcs_env.bcs_init, sizeof(bcs_init_t), p_bcs_init, sizeof(bcs_init_t)); - if (ret < 0) { - return ret; - } - s_bcs_env.p_start_handle = p_bcs_start_handle; + memcpy(&s_bcs_env.bcs_init, p_bcs_init, sizeof(bcs_init_t)); - return ble_server_prf_add(&bcs_prf_info); + s_bcs_env.start_hdl = PRF_INVALID_HANDLE; + s_bcs_env.bcs_gatts_db.shdl = &s_bcs_env.start_hdl; + s_bcs_env.bcs_gatts_db.uuid = s_bcs_svc_uuid; + s_bcs_env.bcs_gatts_db.attr_tab_cfg = (uint8_t *)&(s_bcs_env.bcs_init.char_mask); + s_bcs_env.bcs_gatts_db.max_nb_attr = BCS_IDX_NB; + s_bcs_env.bcs_gatts_db.srvc_perm = BLE_GATTS_SRVC_SECONDARY_SET; + s_bcs_env.bcs_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_bcs_env.bcs_gatts_db.attr_tab.attr_tab_16 = bcs_attr_tab; + + return ble_gatts_prf_add(&s_bcs_env.bcs_gatts_db, bcs_ble_evt_handler); +} + +uint16_t *bcs_start_handle_get(void) +{ + return &s_bcs_env.start_hdl; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.h index ab28f1f..263990c 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bcs/bcs.h @@ -49,32 +49,32 @@ * @details The Body Composition Service (BCS) exposes data related to body composition from a * body composition analyzer (Server) intended for consumer healthcare as well as * sports/fitness applications. This module implements the Body Compositon Service - * with the Body Composition Feature and Body Composition Measurement characteristics. + * with the Body Composition Feature and Body Composition Measurement characteristics. * * After \ref bcs_init_t variable is initialized, the application must call \ref bcs_service_init() - * to optionally add the Body Compisition Service, Body Composition Meaturement characteristics to + * to optionally add the Body Compisition Service, Body Composition Meaturement characteristics to * the BLE stack database according to \ref bcs_init_t.char_mask. */ #ifndef _BCS_H_ #define _BCS_H_ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include + /** * @defgroup BCS_MACRO Defines * @{ */ -#define BCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Body Composition Service connections. */ -#define BCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of BC Measurment value. */ -#define BCS_FEAT_VAL_LEN_MAX 4 /**< Maximum length of BC Feature value. */ +#define BCS_CONNECTION_MAX 10 /**< Maximum number of Body Composition Service connections. */ +#define BCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of BC Measurment value. */ +#define BCS_FEAT_VAL_LEN_MAX 4 /**< Maximum length of BC Feature value. */ -#define INDI_PAYLOAD_HEADER_LEN 3 /**< The length of indication payload header. */ +#define INDI_PAYLOAD_HEADER_LEN 3 /**< The length of indication payload header. */ /** * @defgroup BCS_MEAS_PACKETS_INDEX Measurement packets index @@ -83,24 +83,26 @@ * The least value of MTU is 23 octets. The size of Attribute Value is (23-3) * octets which could be less than the size (30 octets) of all fields of Body * Composition Measurement. If the required data exceeds the current size (MTU - 3) - * octets, the remaining optional fields shall be sent in the subsequent indication. - * So we need no more than 2 packets. + * octets, the remaining optional fields shall be sent in the subsequent indication. + * So we need no more than 2 packets. */ -#define NUM_PACKETS 2 /**< Measurement Packet numbers. */ -#define MEAS_PACKET_FIRST 0 /**< The first Measurement Packet. */ -#define MEAS_PACKET_SUB 1 /**< The second Measurement Packet. */ +#define NUM_PACKETS 2 /**< Measurement Packet numbers. */ +#define MEAS_PACKET_FIRST 0 /**< The first Measurement Packet. */ +#define MEAS_PACKET_SUB 1 /**< The second Measurement Packet. */ /** @} */ -#define BCS_CACHE_MEAS_NUM_MAX 25 /**< Maximum number of cache muasurements value for each user. */ +#define BCS_CACHE_MEAS_NUM_MAX 25 /**< Maximum number of cache muasurements value for each user. */ -#define BCS_MEAS_UNSUCCESS 0xFFFF /**< Measurement unsuccessful. */ +#define BCS_MEAS_UNSUCCESS 0xFFFF /**< Measurement unsuccessful. */ + +#define BCS_MEAS_FLAG_DEFAULT 0x01FF /**< Measurement default flag. */ /** * @defgroup BCS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref bcs_init_t.char_mask. */ -#define BCS_CHAR_FEAT_MANDATORY 0x3F /**< Bit mask for mandatory characteristic in BCS. */ +#define BCS_CHAR_FEAT_MANDATORY 0x3F /**< Bit mask for mandatory characteristic in BCS. */ /** @} */ /** @} */ @@ -114,26 +116,28 @@ * @{ */ /**@brief Body Composition Measurement Flags. */ -enum bcs_meas_flag_bits { - BCS_MEAS_FLAG_UNIT_SI = 0x0000, /**< Flag bit for SI Measurement Units Present. */ - BCS_MEAS_FLAG_UNIT_IMPERIAL = 0x0001, /**< Flag bit for Imperial Measurement Units Present. */ - BCS_MEAS_FLAG_DATE_TIME_PRESENT = 0x0002, /**< Flag bit for Time Stamp Present. */ - BCS_MEAS_FLAG_USER_ID_PRESENT = 0x0004, /**< Flag bit for User ID Present. */ - BCS_MEAS_FLAG_BASAL_METABOLISM = 0x0008, /**< Flag bit for Basal Metabolism Present. */ - BCS_MEAS_FLAG_MUSCLE_PERCENTAGE = 0x0010, /**< Flag bit for Muscle Percentage Present. */ - BCS_MEAS_FLAG_MUSCLE_MASS = 0x0020, /**< Flag bit for Muscle Mass Present. */ - BCS_MEAS_FLAG_FAT_FREE_MASS = 0x0040, /**< Flag bit for Fat Free Mass Present. */ - BCS_MEAS_FLAG_SOFT_LEAN_MASS = 0x0080, /**< Flag bit for Soft Lean Mass Present. */ - BCS_MEAS_FLAG_BODY_WATER_MASS = 0x0100, /**< Flag bit for Body Water Mass Present. */ - BCS_MEAS_FLAG_IMPEDANCE = 0x0200, /**< Flag bit for Impedance Present. */ - BCS_MEAS_FLAG_WEIGHT = 0x0400, /**< Flag bit for Weight Present. */ - BCS_MEAS_FLAG_HEIGHT = 0x0800, /**< Flag bit for Height Present. */ - BCS_MEAS_FLAG_MUTI_PACKET = 0x1000, /**< Flag bit for Multiple Packet Measurement Present. */ +enum bcs_meas_flag_bits +{ + BCS_MEAS_FLAG_UNIT_SI = 0x0000, /**< Flag bit for SI Measurement Units Present. */ + BCS_MEAS_FLAG_UNIT_IMPERIAL = 0x0001, /**< Flag bit for Imperial Measurement Units Present. */ + BCS_MEAS_FLAG_DATE_TIME_PRESENT = 0x0002, /**< Flag bit for Time Stamp Present. */ + BCS_MEAS_FLAG_USER_ID_PRESENT = 0x0004, /**< Flag bit for User ID Present. */ + BCS_MEAS_FLAG_BASAL_METABOLISM = 0x0008, /**< Flag bit for Basal Metabolism Present. */ + BCS_MEAS_FLAG_MUSCLE_PERCENTAGE = 0x0010, /**< Flag bit for Muscle Percentage Present. */ + BCS_MEAS_FLAG_MUSCLE_MASS = 0x0020, /**< Flag bit for Muscle Mass Present. */ + BCS_MEAS_FLAG_FAT_FREE_MASS = 0x0040, /**< Flag bit for Fat Free Mass Present. */ + BCS_MEAS_FLAG_SOFT_LEAN_MASS = 0x0080, /**< Flag bit for Soft Lean Mass Present. */ + BCS_MEAS_FLAG_BODY_WATER_MASS = 0x0100, /**< Flag bit for Body Water Mass Present. */ + BCS_MEAS_FLAG_IMPEDANCE = 0x0200, /**< Flag bit for Impedance Present. */ + BCS_MEAS_FLAG_WEIGHT = 0x0400, /**< Flag bit for Weight Present. */ + BCS_MEAS_FLAG_HEIGHT = 0x0800, /**< Flag bit for Height Present. */ + BCS_MEAS_FLAG_MUTI_PACKET = 0x1000, /**< Flag bit for Multiple Packet Measurement Present. */ }; /** @} */ /**@brief Body Composition Feature characteristic bit values. */ -typedef enum { +typedef enum +{ /* Supported Flags */ BCS_FEAT_TIME_STAMP = 0x00000001, /**< Time Stamp supported */ BCS_FEAT_MULTI_USER = 0x00000002, /**< Multiple Users supported */ @@ -165,7 +169,8 @@ typedef enum { } bcs_feature_t; /**@brief BCS Weight Measurement resolutions. */ -typedef enum { +typedef enum +{ BCS_MASS_RES_500G, /**< Resolution of 0.5kg or 1lb. */ BCS_MASS_RES_200G, /**< Resolution of 0.2kg or 0.5lb. */ BCS_MASS_RES_100G, /**< Resolution of 0.1kg or 0.2lb. */ @@ -176,20 +181,23 @@ typedef enum { } bcs_mass_res_t; /**@brief BCS Height Measurement resolutions. */ -typedef enum { +typedef enum +{ BCS_HEIGHT_RES_10MM, /**< Resolution of 0.01m or 1in. */ BCS_HEIGHT_RES_5MM, /**< Resolution of 0.005m or 0.5in. */ BCS_HEIGHT_RES_1MM, /**< Resolution of 0.001m or 0.1in. */ } bcs_height_res_t; /**@brief BCS unit types. */ -typedef enum { +typedef enum +{ BCS_UNIT_SI, /**< Weight in kilograms and height in meters */ BCS_UNIT_IMPERIAL, /**< Weight in pounds and height in inches */ } bcs_unit_t; -/**@brief Body Composition Service event type. */ -typedef enum { + /**@brief Body Composition Service event type. */ +typedef enum +{ BCS_EVT_INVALID, /**< Indicate that invalid event. */ BCS_EVT_MEAS_INDICATION_ENABLE, /**< Indicate that body composition measurement indication has been enabled. */ BCS_EVT_MEAS_INDICATION_DISABLE, /**< Indicate that body composition measurement indication has been disabled. */ @@ -203,22 +211,24 @@ typedef enum { * @{ */ /**@brief Body composition Measurement flag data. */ -typedef struct { - uint8_t time_stamp_present : 1; /**< Time Stamp flag. */ - uint8_t user_id_present : 1; /**< User ID flag. */ - uint8_t basal_metabolism_present : 1; /**< Basal Metabolism flag. */ - uint8_t muscle_percentage_present : 1; /**< Muscle Percentage flag. */ - uint8_t muscle_mass_present : 1; /**< Muscle Mass flag. */ - uint8_t fat_free_mass_present : 1; /**< Fat Free Mass flag. */ - uint8_t soft_lean_mass_present : 1; /**< Soft Lean Mass flag. */ - uint8_t body_water_mass_present : 1; /**< Body Water Mass flag. */ - uint8_t impedance_present : 1; /**< Impedance flag. */ - uint8_t weight_present : 1; /**< Weight flag. */ - uint8_t height_present : 1; /**< Height flag. */ +typedef struct +{ + uint8_t time_stamp_present :1; /**< Time Stamp flag. */ + uint8_t user_id_present :1; /**< User ID flag. */ + uint8_t basal_metabolism_present :1; /**< Basal Metabolism flag. */ + uint8_t muscle_percentage_present :1; /**< Muscle Percentage flag. */ + uint8_t muscle_mass_present :1; /**< Muscle Mass flag. */ + uint8_t fat_free_mass_present :1; /**< Fat Free Mass flag. */ + uint8_t soft_lean_mass_present :1; /**< Soft Lean Mass flag. */ + uint8_t body_water_mass_present :1; /**< Body Water Mass flag. */ + uint8_t impedance_present :1; /**< Impedance flag. */ + uint8_t weight_present :1; /**< Weight flag. */ + uint8_t height_present :1; /**< Height flag. */ } bcs_meas_flag_t; /**@brief Body composition Measurement data. */ -typedef struct { +typedef struct +{ uint16_t body_fat_percentage; /**< Body Fat Percentage data. */ prf_date_time_t time_stamp; /**< Time Stamp data. */ uint8_t user_id; /**< User Index data. */ @@ -234,7 +244,8 @@ typedef struct { } bcs_meas_val_t; /**@brief Body Composition Service event. */ -typedef struct { +typedef struct +{ bcs_evt_type_t evt_type; /**< The BCS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -255,11 +266,11 @@ typedef void (*bcs_evt_handler_t)(bcs_evt_t *p_evt); * @{ */ /**@brief Body Composition Service Init variable. */ -typedef struct { +typedef struct +{ bcs_evt_handler_t evt_handler; /**< Body Composition Service event handler. */ uint32_t feature; /**< Initial value for features. */ - uint8_t - char_mask; /**< Initial mask of Supported characteristics, and configured with \ref BCS_CHAR_MASK */ + uint8_t char_mask; /**< Initial mask of Supported characteristics, and configured with \ref BCS_CHAR_MASK */ bcs_unit_t bcs_unit; /**< Initial unit system as SI or Imperial. */ bcs_meas_flag_t bcs_meas_flags; /**< Initial measurement flags. */ bcs_mass_res_t bcs_mass_res; /**< Initial resolution of mass value. */ @@ -275,24 +286,35 @@ typedef struct { ***************************************************************************************** * @brief Initialize a Body Composition Service instance and add in the DB. * - * @param[in] p_bcs_init: Pointer to BC Service initialization variable. + * @param[in] p_bcs_init: Pointer to BC Service initialization variable. * * @return Result of service initialization. ***************************************************************************************** */ -sdk_err_t bcs_service_init(bcs_init_t *p_bcs_init, uint16_t *p_bcs_start_handle); +sdk_err_t bcs_service_init(bcs_init_t *p_bcs_init); -/**@brief Send Body Composition Measurement indication. - ***************************************************************************************** +/** + ****************************************************************************************** + * @brief Send Body Composition Measurement indication. * * @param[in] conn_idx: Connection index. * @param[in] p_meas: Pointer to body composition measurement data. * @param[in] cache_num: The number of measurement caches. * - * @return Result of indicate value. - ***************************************************************************************** + * @return SDK_SUCCESS on success, otherwise an error code. + ***************************************************************************************** */ sdk_err_t bcs_measurement_send(uint8_t conn_idx, bcs_meas_val_t *p_meas, uint8_t cache_num); + +/** + ****************************************************************************************** + * @brief Get the pointer to the start handle of Body Composition Service. + * + * + * @return The pointer to the start handle. + ***************************************************************************************** + */ +uint16_t * bcs_start_handle_get(void); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/BUILD.gn new file mode 100644 index 0000000..f56cd8a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("bps") { + sources = [ "bps.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.c index d52669b..4d6a8b5 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.c @@ -43,13 +43,14 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define OFFSET_12 12 + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief Blood Pressure Service Attributes Indexes. */ -enum bps_attr_idx_t { +enum bps_attr_idx_t +{ BPS_IDX_SVC, BPS_IDX_BP_MEAS_CHAR, @@ -67,7 +68,8 @@ enum bps_attr_idx_t { }; /**@brief Blood Pressure Measurement Flags bits. */ -enum bps_meas_flag_t { +enum bps_meas_flag_t +{ BPS_MEAS_BLOOD_PRESSURE_UNITS_FLAG_BIT = (0x01 << 0), /**< Blood Pressure Units Flag bit. */ BPS_MEAS_TIME_STAMP_FLAG_BIT = (0x01 << 1), /**< Time Stamp Flag bit. */ BPS_MEAS_PULSE_RATE_FLAG_BIT = (0x01 << 2), /**< Pulse Rate Flag bit. */ @@ -80,159 +82,93 @@ enum bps_meas_flag_t { ***************************************************************************************** */ /**@brief Blood Pressure Service environment variable. */ -struct bps_env_t { +struct bps_env_t +{ bps_init_t bps_init; /**< Blood Pressure Service initialization variables. */ uint16_t start_hdl; /**< Start handle of Blood Pressure Service. */ - uint16_t - ntf_ind_cfg[BPS_CONNECTION_MAX]; /**< Notification and indication configuration for each connections. */ + uint16_t ntf_ind_cfg[BPS_CONNECTION_MAX]; /**< Notification and indication configuration for each connections. */ + ble_gatts_create_db_t bps_serv_db; /**< Blood Pressure Service DataBase. */ }; -/* -* LOCAL FUNCTION DECLARATION -***************************************************************************************** -*/ -static sdk_err_t bps_init(void); -static void bps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void bps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void bps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); + /* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ + /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct bps_env_t s_bps_env; +static const uint8_t s_bps_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BLOOD_PRESSURE); /**@brief Full BPS Database Description which is used to add attributes into theATT database. */ -static const attm_desc_t bps_attr_tab[BPS_IDX_NB] = { +static const ble_gatts_attm_desc_t bps_attr_tab[BPS_IDX_NB] = +{ // Blood Pressure Service Declaration - [BPS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [BPS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Blood Pressure Measurement Characteristic Declaration - [BPS_IDX_BP_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BPS_IDX_BP_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Blood Pressure Measurement Characteristic Value - [BPS_IDX_BP_MEAS_VAL] = { - BLE_ATT_CHAR_BLOOD_PRESSURE_MEAS, + [BPS_IDX_BP_MEAS_VAL] = {BLE_ATT_CHAR_BLOOD_PRESSURE_MEAS, #ifdef PTS_AUTO_TEST - INDICATE_PERM_UNSEC, + BLE_GATTS_INDICATE_PERM_UNSEC, #else - INDICATE_PERM(NOAUTH), + BLE_GATTS_INDICATE_PERM(BLE_GATTS_NOAUTH), #endif - ATT_VAL_LOC_USER, - BPS_BP_MEAS_MAX_LEN - }, + BLE_GATTS_ATT_VAL_LOC_USER, + BPS_BP_MEAS_MAX_LEN}, // Blood Pressure Measurement Characteristic - Client Characteristic Configuration Descriptor - [BPS_IDX_BP_MEAS_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, + [BPS_IDX_BP_MEAS_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, #ifdef PTS_AUTO_TEST - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, #else - READ_PERM(NOAUTH) | WRITE_REQ_PERM(NOAUTH), + BLE_GATTS_READ_PERM(BLE_GATTS_NOAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_NOAUTH), #endif - 0, - 0 - }, + 0, + 0}, // Intermediate Cuff Pressure Characteristic Declaration - [BPS_IDX_INTM_CUFF_PRESS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BPS_IDX_INTM_CUFF_PRESS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Intermediate Cuff Pressure Characteristic Value - [BPS_IDX_INTM_CUFF_PRESS_VAL] = { - BLE_ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE, + [BPS_IDX_INTM_CUFF_PRESS_VAL] = {BLE_ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE, #ifdef PTS_AUTO_TEST - NOTIFY_PERM_UNSEC, + BLE_GATTS_NOTIFY_PERM_UNSEC, #else - NOTIFY_PERM(NOAUTH), + BLE_GATTS_NOTIFY_PERM(BLE_GATTS_NOAUTH), #endif - ATT_VAL_LOC_USER, - BPS_BP_MEAS_MAX_LEN - }, + BLE_GATTS_ATT_VAL_LOC_USER, + BPS_BP_MEAS_MAX_LEN}, // Intermediate Cuff Pressure Characteristic - Client Characteristic Configuration Descriptor - [BPS_IDX_INTM_CUFF_PRESS_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, + [BPS_IDX_INTM_CUFF_PRESS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, #ifdef PTS_AUTO_TEST - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, #else - READ_PERM(NOAUTH) | WRITE_REQ_PERM(NOAUTH), + BLE_GATTS_READ_PERM(BLE_GATTS_NOAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_NOAUTH), #endif - 0, - 0 - }, + 0, + 0}, // Blood Pressure Feature Characteristic Declaration - [BPS_IDX_BP_FEATURE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [BPS_IDX_BP_FEATURE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Blood Pressure Feature Characteristic Value - [BPS_IDX_BP_FEATURE_VAL] = { - BLE_ATT_CHAR_BLOOD_PRESSURE_FEATURE, + [BPS_IDX_BP_FEATURE_VAL] = {BLE_ATT_CHAR_BLOOD_PRESSURE_FEATURE, #ifdef PTS_AUTO_TEST - READ_PERM_UNSEC, + BLE_GATTS_READ_PERM_UNSEC, #else - READ_PERM(NOAUTH), + BLE_GATTS_READ_PERM(BLE_GATTS_NOAUTH), #endif - ATT_VAL_LOC_USER, - sizeof(uint16_t) - }, + BLE_GATTS_ATT_VAL_LOC_USER, + sizeof(uint16_t)}, }; -/**@brief BPS interface required by profile manager. */ -static ble_prf_manager_cbs_t bps_mgr_cbs = { - (prf_init_func_t)bps_init, - NULL, - NULL -}; -/**@brief BPS GATT Server Callbacks. */ -static gatts_prf_cbs_t bps_gatts_cbs = { - bps_read_att_cb, - bps_write_att_cb, - NULL, - NULL, - bps_cccd_set_cb, -}; - -/**@brief BPS Information. */ -static const prf_server_info_t bps_prf_info = { - .max_connection_nb = BPS_CONNECTION_MAX, - .manager_cbs = &bps_mgr_cbs, - .gatts_prf_cbs = &bps_gatts_cbs -}; - -/* -* LOCAL FUNCTION DEFINITIONS -***************************************************************************************** -*/ -/** - ***************************************************************************************** - * @brief Initialize Blood Pressure service and create DB in ATT. - * - * @retval ::Error code to know if profile initialization succeed or not. + /* + * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -static sdk_err_t bps_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t bps_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_BLOOD_PRESSURE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = bps_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t*)&(s_bps_env.bps_init.char_mask); - gatts_db.max_nb_attr = BPS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = bps_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_bps_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} /** ***************************************************************************************** @@ -242,18 +178,19 @@ static sdk_err_t bps_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void bps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void bps_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_bps_env.start_hdl, - BPS_IDX_NB, - (uint8_t *)&s_bps_env.bps_init.char_mask); + BPS_IDX_NB, + (uint8_t *)&s_bps_env.bps_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case BPS_IDX_BP_MEAS_IND_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_bps_env.ntf_ind_cfg[conn_idx]; @@ -265,7 +202,8 @@ static void bps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param break; case BPS_IDX_BP_FEATURE_VAL: - if (s_bps_env.bps_init.evt_handler) { + if (s_bps_env.bps_init.evt_handler) + { s_bps_env.bps_init.evt_handler(conn_idx, BPS_EVT_READ_BL_PRESSURE_FEATURE); } cfm.length = sizeof(uint16_t); @@ -289,13 +227,13 @@ static void bps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void bps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void bps_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; bps_evt_type_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_bps_env.start_hdl, @@ -304,21 +242,21 @@ static void bps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case BPS_IDX_BP_MEAS_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event = ((PRF_CLI_START_IND == cccd_value) ?\ - BPS_EVT_BP_MEAS_INDICATION_ENABLED :\ - BPS_EVT_BP_MEAS_INDICATION_DISABLED); + BPS_EVT_BP_MEAS_INDICATION_ENABLED :\ + BPS_EVT_BP_MEAS_INDICATION_DISABLED); s_bps_env.ntf_ind_cfg[conn_idx] = cccd_value; break; case BPS_IDX_INTM_CUFF_PRESS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event = ((PRF_CLI_START_NTF == cccd_value) ?\ - BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED :\ - BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED); - \ + BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED :\ + BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED);\ s_bps_env.ntf_ind_cfg[conn_idx] = cccd_value; break; @@ -327,7 +265,8 @@ static void bps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa break; } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && BPS_EVT_INVALID != event && s_bps_env.bps_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && BPS_EVT_INVALID != event && s_bps_env.bps_init.evt_handler) + { s_bps_env.bps_init.evt_handler(conn_idx, event); } ble_gatts_write_cfm(conn_idx, &cfm); @@ -342,12 +281,13 @@ static void bps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void bps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void bps_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; bps_evt_type_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -356,19 +296,19 @@ static void bps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val BPS_IDX_NB, (uint8_t *)&s_bps_env.bps_init.char_mask); - switch (tab_index) { + switch (tab_index) + { case BPS_IDX_BP_MEAS_IND_CFG: event = ((PRF_CLI_START_IND == cccd_value) ?\ - BPS_EVT_BP_MEAS_INDICATION_ENABLED :\ - BPS_EVT_BP_MEAS_INDICATION_DISABLED); + BPS_EVT_BP_MEAS_INDICATION_ENABLED :\ + BPS_EVT_BP_MEAS_INDICATION_DISABLED); s_bps_env.ntf_ind_cfg[conn_idx] = cccd_value; break; case BPS_IDX_INTM_CUFF_PRESS_NTF_CFG: event = ((PRF_CLI_START_NTF == cccd_value) ?\ - BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED :\ - BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED); - \ + BPS_EVT_INTM_CUFF_PRESS_NTF_ENABLED :\ + BPS_EVT_INTM_CUFF_PRESS_NTF_DISABLED);\ s_bps_env.ntf_ind_cfg[conn_idx] = cccd_value; break; @@ -377,7 +317,8 @@ static void bps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (BPS_EVT_INVALID != event && s_bps_env.bps_init.evt_handler) { + if (BPS_EVT_INVALID != event && s_bps_env.bps_init.evt_handler) + { s_bps_env.bps_init.evt_handler(conn_idx, event); } } @@ -399,30 +340,32 @@ static uint16_t bps_measurement_encode(bps_meas_t *p_meas, uint8_t *p_encoded_bu uint16_t encoded_sfloat = 0; // Set measurement units flag - if (p_meas->bl_unit_in_kpa) { + if (p_meas->bl_unit_in_kpa) + { flags |= BPS_MEAS_BLOOD_PRESSURE_UNITS_FLAG_BIT; } // Blood Pressure Measurement - Systolic - encoded_sfloat = ((p_meas->systolic.exponent << OFFSET_12) & 0xF000) | + encoded_sfloat = ((p_meas->systolic.exponent << 12) & 0xF000) | ((p_meas->systolic.mantissa << 0) & 0x0FFF); p_encoded_buffer[length++] = LO_U16(encoded_sfloat); p_encoded_buffer[length++] = HI_U16(encoded_sfloat); // Blood Pressure Measurement - Diastolic - encoded_sfloat = ((p_meas->diastolic.exponent << OFFSET_12) & 0xF000) | + encoded_sfloat = ((p_meas->diastolic.exponent << 12) & 0xF000) | ((p_meas->diastolic.mantissa << 0) & 0x0FFF); p_encoded_buffer[length++] = LO_U16(encoded_sfloat); p_encoded_buffer[length++] = HI_U16(encoded_sfloat); // Blood Pressure Measurement - Mean Arterial Pressure - encoded_sfloat = ((p_meas->mean_arterial_pr.exponent << OFFSET_12) & 0xF000) | + encoded_sfloat = ((p_meas->mean_arterial_pr.exponent << 12) & 0xF000) | ((p_meas->mean_arterial_pr.mantissa << 0) & 0x0FFF); p_encoded_buffer[length++] = LO_U16(encoded_sfloat); p_encoded_buffer[length++] = HI_U16(encoded_sfloat); // Time Stamp field - if (p_meas->time_stamp_present) { + if (p_meas->time_stamp_present) + { flags |= BPS_MEAS_TIME_STAMP_FLAG_BIT; p_encoded_buffer[length++] = LO_U16(p_meas->time_stamp.year); p_encoded_buffer[length++] = HI_U16(p_meas->time_stamp.year); @@ -434,22 +377,25 @@ static uint16_t bps_measurement_encode(bps_meas_t *p_meas, uint8_t *p_encoded_bu } // Pulse Rate - if (p_meas->pulse_rate_present) { + if (p_meas->pulse_rate_present) + { flags |= BPS_MEAS_PULSE_RATE_FLAG_BIT; - encoded_sfloat = ((p_meas->pulse_rate.exponent << OFFSET_12) & 0xF000) | + encoded_sfloat = ((p_meas->pulse_rate.exponent << 12) & 0xF000) | ((p_meas->pulse_rate.mantissa << 0) & 0x0FFF); p_encoded_buffer[length++] = LO_U16(encoded_sfloat); p_encoded_buffer[length++] = HI_U16(encoded_sfloat); } // User ID - if (p_meas->user_id_present) { + if (p_meas->user_id_present) + { flags |= BPS_MEAS_USER_ID_FLAG_BIT; p_encoded_buffer[length++] = p_meas->user_id; } // Measurement Status - if (p_meas->meas_status_present) { + if (p_meas->meas_status_present) + { flags |= BPS_MEAS_MEASUREMENT_STATUS_FLAG_BIT; p_encoded_buffer[length++] = LO_U16(p_meas->meas_status); p_encoded_buffer[length++] = HI_U16(p_meas->meas_status); @@ -469,11 +415,12 @@ sdk_err_t bps_measurement_send(uint8_t conidx, bps_meas_t *p_meas) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; uint8_t encoded_bps_meas[BPS_BP_MEAS_MAX_LEN] = {0}; - gatts_noti_ind_t bps_ind; + ble_gatts_noti_ind_t bps_ind; uint16_t length = bps_measurement_encode(p_meas, encoded_bps_meas); - if (PRF_CLI_START_IND == (s_bps_env.ntf_ind_cfg[conidx] & PRF_CLI_START_IND)) { + if (PRF_CLI_START_IND == (s_bps_env.ntf_ind_cfg[conidx] & PRF_CLI_START_IND)) + { bps_ind.type = BLE_GATT_INDICATION; bps_ind.handle = prf_find_handle_by_idx(BPS_IDX_BP_MEAS_VAL, s_bps_env.start_hdl, @@ -487,17 +434,49 @@ sdk_err_t bps_measurement_send(uint8_t conidx, bps_meas_t *p_meas) return error_code; } +static void bps_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + bps_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + bps_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + bps_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + sdk_err_t bps_service_init(bps_init_t *p_bps_init) { - sdk_err_t ret; - if (p_bps_init == NULL) { + if (NULL == p_bps_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_bps_env.bps_init, sizeof(bps_init_t), p_bps_init, sizeof(bps_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_bps_env.bps_init, p_bps_init, sizeof(bps_init_t)); - return ble_server_prf_add(&bps_prf_info); + memset(&s_bps_env.bps_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_bps_env.start_hdl = PRF_INVALID_HANDLE; + s_bps_env.bps_serv_db.shdl = &s_bps_env.start_hdl; + s_bps_env.bps_serv_db.uuid = s_bps_svc_uuid; + s_bps_env.bps_serv_db.attr_tab_cfg = (uint8_t*)&(s_bps_env.bps_init.char_mask); + s_bps_env.bps_serv_db.max_nb_attr = BPS_IDX_NB; + s_bps_env.bps_serv_db.srvc_perm = 0; + s_bps_env.bps_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_bps_env.bps_serv_db.attr_tab.attr_tab_16 = bps_attr_tab; + + return ble_gatts_prf_add(&s_bps_env.bps_serv_db, bps_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.h index 6a5a7a8..33a7107 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/bps/bps.h @@ -70,18 +70,17 @@ #ifndef __BPS_H__ #define __BPS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_utils.h" #include "custom_config.h" +#include +#include /** * @defgroup BPS_MACRO Defines * @{ */ -#define BPS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of BPS connections. */ +#define BPS_CONNECTION_MAX 10 /**< Maximum number of BPS connections. */ #define BPS_BP_MEAS_MAX_LEN 20 /**< Maximum notification length. */ /** @@ -100,7 +99,8 @@ * @{ */ /**@brief Blood Pressure Service event type. */ -typedef enum { +typedef enum +{ BPS_EVT_INVALID, /**< Invalid event. */ BPS_EVT_BP_MEAS_INDICATION_ENABLED, /**< The measurement indication has been enabled. */ BPS_EVT_BP_MEAS_INDICATION_DISABLED, /**< The measurement indication has been disabled. */ @@ -110,7 +110,8 @@ typedef enum { } bps_evt_type_t; /**@brief Blood Pressure Feature bits. */ -enum bp_feature_bit { +enum bp_feature_bit +{ BP_FEATURE_BODY_MOVEMENT_BIT = (0x01 << 0), /**< Body Movement Detection Support bit. */ BP_FEATURE_CUFF_FIT_BIT = (0x01 << 1), /**< Cuff Fit Detection Support bit. */ BP_FEATURE_IRREGULAR_PULSE_BIT = (0x01 << 2), /**< Irregular Pulse Detection Support bit. */ @@ -133,33 +134,34 @@ typedef void (*bps_evt_handler_t)(uint8_t conn_idx, bps_evt_type_t event); * @{ */ /**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, defined as a 16-bit value with 12-bit mantissa and 4-bit exponent. */ -typedef struct { - int8_t exponent; /**< Base 10 exponent, only 4 bits */ - int16_t mantissa; /**< Mantissa, only 12 bits */ -} ieee_float16_t; +typedef struct +{ + int8_t exponent; /**< Base 10 exponent, only 4 bits */ + int16_t mantissa; /**< Mantissa, only 12 bits */ +} bps_ieee_float16_t; /**@brief Blood Pressure measurement structure. */ -typedef struct { - uint8_t bl_unit_in_kpa; /**< Blood Pressure Units Flag, 0=mmHg, 1=kPa */ - uint8_t time_stamp_present; /**< Time Stamp Flag, 0=not present, 1=present. */ - uint8_t pulse_rate_present; /**< Pulse Rate Flag, 0=not present, 1=present. */ - uint8_t user_id_present; /**< User ID Flag, 0=not present, 1=present. */ - uint8_t meas_status_present; /**< Measurement Status Flag, 0=not present, 1=present. */ - ieee_float16_t systolic; /**< Blood Pressure Measurement Compound Value - Systolic. */ - ieee_float16_t diastolic; /**< Blood Pressure Measurement Compound Value - Diastolic . */ - ieee_float16_t mean_arterial_pr; /**< Blood Pressure Measurement Compound Value - Mean Arterial Pressure. */ - prf_date_time_t time_stamp; /**< Time Stamp. */ - ieee_float16_t pulse_rate; /**< Pulse Rate. */ - uint8_t user_id; /**< User ID. */ - uint16_t meas_status; /**< Measurement Status. */ +typedef struct +{ + uint8_t bl_unit_in_kpa; /**< Blood Pressure Units Flag, 0=mmHg, 1=kPa */ + uint8_t time_stamp_present; /**< Time Stamp Flag, 0=not present, 1=present. */ + uint8_t pulse_rate_present; /**< Pulse Rate Flag, 0=not present, 1=present. */ + uint8_t user_id_present; /**< User ID Flag, 0=not present, 1=present. */ + uint8_t meas_status_present; /**< Measurement Status Flag, 0=not present, 1=present. */ + bps_ieee_float16_t systolic; /**< Blood Pressure Measurement Compound Value - Systolic. */ + bps_ieee_float16_t diastolic; /**< Blood Pressure Measurement Compound Value - Diastolic . */ + bps_ieee_float16_t mean_arterial_pr; /**< Blood Pressure Measurement Compound Value - Mean Arterial Pressure. */ + prf_date_time_t time_stamp; /**< Time Stamp. */ + bps_ieee_float16_t pulse_rate; /**< Pulse Rate. */ + uint8_t user_id; /**< User ID. */ + uint16_t meas_status; /**< Measurement Status. */ } bps_meas_t; -/**@brief Blood Pressure Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Blood Pressure Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ bps_evt_handler_t evt_handler; /**< Blood Pressure Service event handler. */ - uint16_t - char_mask; /**< Mask of Supported characteristics, and configured with \ref BPS_CHAR_MASK */ + uint16_t char_mask; /**< Mask of Supported characteristics, and configured with \ref BPS_CHAR_MASK */ uint16_t bp_feature; /**< Value of Blood Pressure Feature characteristic. */ } bps_init_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/BUILD.gn new file mode 100644 index 0000000..62c57d1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/BUILD.gn @@ -0,0 +1,25 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("common") { + sources = [ + "ble_prf_utils.c", + "ble_srv_disc_utils.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_types.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_types.h index a95c7b6..e7e2568 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_types.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_types.h @@ -50,8 +50,8 @@ #ifndef __BLE_PRF_TYPES_H__ #define __BLE_PRF_TYPES_H__ +#include "gr_includes.h" #include -#include "gr55xx_sys.h" /** @defgroup BLE_MACRO Defines * @{ @@ -66,7 +66,8 @@ * @{ */ /**@brief The values for setting client configuration characteristics. */ -typedef enum { +typedef enum +{ PRF_CLI_STOP_NTFIND = 0x0000, /**< Stop notification/indication. */ PRF_CLI_START_NTF, /**< Start notification. */ PRF_CLI_START_IND, /**< Start indication. */ @@ -86,7 +87,8 @@ typedef void (*prf_error_handler_t)(sdk_err_t err_code); */ /**@brief Characteristic Presentation Format Descriptor structure. * The packed size is \ref PRF_CHAR_PRES_FMT_SIZE. */ -typedef struct { +typedef struct +{ uint16_t unit; /**< Unit (The Unit is a UUID). */ uint16_t description; /**< Description. */ uint8_t format; /**< Format. */ @@ -95,7 +97,8 @@ typedef struct { } prf_char_pres_fmt_t; /**@brief The date and time structure. The packed size is 7 bytes. */ -typedef struct { +typedef struct +{ uint16_t year; /**< year time element. */ uint8_t month; /**< month time element. */ uint8_t day; /**< day time element. */ @@ -105,7 +108,8 @@ typedef struct { } prf_date_time_t; /**@brief Slave preferred connection parameters. */ -typedef struct { +typedef struct +{ uint16_t con_intv_min; /**< Connection interval minimum. */ uint16_t con_intv_max; /**< Connection interval maximum. */ uint16_t slave_latency; /**< Slave latency. */ @@ -113,7 +117,8 @@ typedef struct { } gap_slv_pref_t; /**@brief Attribute information. */ -typedef struct { +typedef struct +{ uint16_t handle; /**< Attribute Handle. */ uint16_t offset; /**< Offset of the attribute value . */ uint16_t length; /**< Attribute length. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.c index f977e7a..69a5a3d 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.c @@ -39,18 +39,11 @@ * INCLUDE FILES ******************************************************************************* */ +#include "ble_prf_utils.h" +#include "utility.h" #include #include -#include "utility.h" -#include "ble_prf_utils.h" -#define OFFSET_2 2 -#define OFFSET_3 3 -#define OFFSET_4 4 -#define OFFSET_5 5 -#define OFFSET_6 6 -#define VALUE_7 7 -#define VALUE_8 8 /* * GLOBAL FUNCTION DEFINITIONS ******************************************************************************* @@ -60,48 +53,49 @@ void prf_pack_char_pres_fmt(uint8_t *p_packed_val, { *p_packed_val = p_char_pres_fmt->format; *(p_packed_val + 1) = p_char_pres_fmt->exponent; - - htole16(p_packed_val + OFFSET_2, p_char_pres_fmt->unit); - - *(p_packed_val + OFFSET_4) = p_char_pres_fmt->name_space; - - htole16(p_packed_val + OFFSET_5, p_char_pres_fmt->description); + + htole16(p_packed_val + 2, p_char_pres_fmt->unit); + + *(p_packed_val + 4) = p_char_pres_fmt->name_space; + + htole16(p_packed_val + 5, p_char_pres_fmt->description); } void prf_unpack_char_pres_fmt(const uint8_t *p_packed_val, prf_char_pres_fmt_t *p_char_pres_fmt) { + p_char_pres_fmt->format = *p_packed_val; p_char_pres_fmt->exponent = *(p_packed_val + 1); - p_char_pres_fmt->unit = le16toh(p_packed_val + OFFSET_2); - p_char_pres_fmt->name_space = *(p_packed_val + OFFSET_4); - p_char_pres_fmt->description = le16toh(p_packed_val + OFFSET_5); + p_char_pres_fmt->unit = le16toh(p_packed_val + 2); + p_char_pres_fmt->name_space = *(p_packed_val + 4); + p_char_pres_fmt->description = le16toh(p_packed_val + 5); } uint8_t prf_pack_date_time(uint8_t *p_packed_val, const prf_date_time_t *p_date_time) { htole16(p_packed_val, p_date_time->year); - *(p_packed_val + OFFSET_2) = p_date_time->month; - *(p_packed_val + OFFSET_3) = p_date_time->day; - *(p_packed_val + OFFSET_4) = p_date_time->hour; - *(p_packed_val + OFFSET_5) = p_date_time->min; - *(p_packed_val + OFFSET_6) = p_date_time->sec; + *(p_packed_val + 2) = p_date_time->month; + *(p_packed_val + 3) = p_date_time->day; + *(p_packed_val + 4) = p_date_time->hour; + *(p_packed_val + 5) = p_date_time->min; + *(p_packed_val + 6) = p_date_time->sec; - return VALUE_7; + return 7; } uint8_t prf_unpack_date_time(const uint8_t *p_packed_val, prf_date_time_t *p_date_time) { p_date_time->year = le16toh(&(p_packed_val[0])); - p_date_time->month = p_packed_val[OFFSET_2]; - p_date_time->day = p_packed_val[OFFSET_3]; - p_date_time->hour = p_packed_val[OFFSET_4]; - p_date_time->min = p_packed_val[OFFSET_5]; - p_date_time->sec = p_packed_val[OFFSET_6]; + p_date_time->month = p_packed_val[2]; + p_date_time->day = p_packed_val[3]; + p_date_time->hour = p_packed_val[4]; + p_date_time->min = p_packed_val[5]; + p_date_time->sec = p_packed_val[6]; - return VALUE_7; + return 7; } uint8_t prf_find_idx_by_handle(uint16_t handle, uint16_t start_hdl, @@ -113,8 +107,8 @@ uint8_t prf_find_idx_by_handle(uint16_t handle, uint16_t start_hdl, uint8_t bit = 0; for (uint8_t i = 1; i < char_nb; i++) { - byte = i / VALUE_8; - bit = i % VALUE_8; + byte = i / 8; + bit = i % 8; if ((p_char_mask[byte] >> bit) & 0x01) { // check if value handle correspond to requested handle if (cur_hdl == handle) { @@ -138,18 +132,17 @@ uint16_t prf_find_handle_by_idx(uint8_t idx, uint16_t start_hdl, if (!idx) { found_hdl = start_hdl; - return found_hdl; - } + } else { + for(uint8_t i = 1; i <= idx; i++) { + byte = i / 8; + bit = i % 8; - for (uint8_t i = 1; i <= idx; i++) { - byte = i / VALUE_8; - bit = i % VALUE_8; + if ((p_char_mask[byte] >> bit) & 0x01) { + cur_hdl++; - if ((p_char_mask[byte] >> bit) & 0x01) { - cur_hdl++; - - if (i == idx) { - found_hdl = cur_hdl; + if (i == idx) { + found_hdl = cur_hdl; + } } } } @@ -160,8 +153,9 @@ uint16_t prf_find_handle_by_idx(uint8_t idx, uint16_t start_hdl, bool prf_is_cccd_value_valid(uint16_t cccd_value) { if (PRF_CLI_STOP_NTFIND == cccd_value || \ - PRF_CLI_START_NTF == cccd_value || \ - PRF_CLI_START_IND == cccd_value) { + PRF_CLI_START_NTF == cccd_value || \ + PRF_CLI_START_IND == cccd_value) + { return true; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.h index 148e1db..9d2146c 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_prf_utils.h @@ -51,8 +51,8 @@ #ifndef __BLE_PRF_UTILS_H__ #define __BLE_PRF_UTILS_H__ -#include #include "ble_prf_types.h" +#include /** * @defgroup BLE_PRF_UTILS_FUNCTION Functions diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.c index 0680c58..d04e478 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.c @@ -53,7 +53,8 @@ static ble_srv_disc_state_t srv_disc_procedure[BLE_SRV_DISC_PROC_NB]; */ void ble_srv_disc_proc_state_set(uint8_t srv_disc_proc_id, ble_srv_disc_state_t srv_disc_state) { - if (BLE_SRV_DISC_PROC_MAX <= srv_disc_proc_id) { + if (BLE_SRV_DISC_PROC_MAX <= srv_disc_proc_id) + { return; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.h index 6896f44..aa751f6 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/common/ble_srv_disc_utils.h @@ -57,7 +57,7 @@ * @defgroup DIS_C_MACRO Defines * @{ */ -#define BLE_SRV_DISC_PROC_MAX 6 /**< Maximum number of services discovery procedure in one application. */ +#define BLE_SRV_DISC_PROC_MAX 6 /**< Maximum number of services discovery procedure in one application. */ /** @} */ /** @@ -65,14 +65,16 @@ * @{ */ /**@brief BLE Service Discovery Procedure State. */ -typedef enum { +typedef enum +{ BLE_SRV_DISC_NO_IMPLEMENT, /**< Service discovery procedure has not been implemented. */ BLE_SRV_DISC_UNDERWAY, /**< Service discovery procedure is underway. */ BLE_SRV_DISC_COMPLETELY, /**< Service discovery procedure has been completed. */ } ble_srv_disc_state_t; /**@brief BLE Service Discovery Procedure ID. */ -typedef enum { +typedef enum +{ BLE_SRV_DISC_PROC_ID_0, /**< Service discovery procedure ID_0. */ BLE_SRV_DISC_PROC_ID_1, /**< Service discovery procedure ID_1. */ BLE_SRV_DISC_PROC_ID_2, /**< Service discovery procedure ID_2. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/BUILD.gn new file mode 100644 index 0000000..7859293 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("cscs") { + sources = [ "cscs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.c index 09dd376..46aed0e 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.c @@ -49,7 +49,8 @@ ***************************************************************************************** */ /**@brief Cycling Speed and Cadence Service Attributes Indexes. */ -enum { +enum +{ CSCS_IDX_SVC, CSCS_IDX_CSC_MEAS_CHAR, @@ -74,32 +75,23 @@ enum { ***************************************************************************************** */ /**@brief Cycling Speed and Cadence Service environment variable. */ -struct cscs_env_t { - cscs_init_t - cscs_init; /**< Cycling Speed and Cadence Service initialization variables. */ - uint16_t start_hdl; /**< Cycling Speed and Cadence Service start handle. */ - bool - ctrl_pt_op_in_progress; /**< A previously triggered SC Control Point operation is still in progress. */ - bool - ctrl_pt_op_rsp_cplt; /**< A previously triggered SC Control Point operation response cplt. */ - uint16_t - meas_ntf_cfg[CSCS_CONNECTION_MAX]; /**< The configuration of CSC Measurement Notification \ - which is configured by the peer devices. */ - uint16_t - ctrl_point_ind_cfg[CSCS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification \ - which is configured by the peer devices. */ +struct cscs_env_t +{ + cscs_init_t cscs_init; /**< Cycling Speed and Cadence Service initialization variables. */ + uint16_t start_hdl; /**< Cycling Speed and Cadence Service start handle. */ + bool ctrl_pt_op_in_progress; /**< A previously triggered SC Control Point operation is still in progress. */ + bool ctrl_pt_op_rsp_cplt; /**< A previously triggered SC Control Point operation response cplt. */ + uint16_t meas_ntf_cfg[CSCS_CONNECTION_MAX]; /**< The configuration of CSC Measurement Notification which is configured by the peer devices. */ + uint16_t ctrl_point_ind_cfg[CSCS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification which is configured by the peer devices. */ + ble_gatts_create_db_t cscs_serv_db; /**< Cycling Speed and Cadence Service DataBase. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t cscs_init(void); -static void cscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void cscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void cscs_disconnect_cb(uint8_t conn_idx, uint8_t reason); -static void cscs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); + + static void cscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); /* @@ -107,88 +99,55 @@ static void cscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data ***************************************************************************************** */ static struct cscs_env_t s_cscs_env; +static const uint8_t s_cscs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_CYCLING_SPEED_CADENCE); /**@brief Full CSCS Database Description - Used to add attributes into the database. */ -static const attm_desc_t cscs_attr_tab[CSCS_IDX_NB] = { +static const ble_gatts_attm_desc_t cscs_attr_tab[CSCS_IDX_NB] = +{ // Cycling Speed and Cadence Service Declaration - [CSCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [CSCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // CSC Measurement Characteristic - Declaration - [CSCS_IDX_CSC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CSCS_IDX_CSC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // CSC Measurement Characteristic - Value - [CSCS_IDX_CSC_MEAS_VAL] = { - BLE_ATT_CHAR_CSC_MEAS, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - CSCS_MEAS_VAL_LEN_MAX - }, + [CSCS_IDX_CSC_MEAS_VAL] = {BLE_ATT_CHAR_CSC_MEAS, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + CSCS_MEAS_VAL_LEN_MAX}, // CSC Measurement Characteristic - Client Characteristic Configuration Descriptor - [CSCS_IDX_CSC_MEAS_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [CSCS_IDX_CSC_MEAS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // CS Feature Characteristic - Declaration - [CSCS_IDX_CSC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CSCS_IDX_CSC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // CSC Feature Characteristic - Value - [CSCS_IDX_CSC_FEAT_VAL] = { - BLE_ATT_CHAR_CSC_FEAT, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - CSCS_FEAT_VAL_LEN_MAX - }, + [CSCS_IDX_CSC_FEAT_VAL] = {BLE_ATT_CHAR_CSC_FEAT, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + CSCS_FEAT_VAL_LEN_MAX}, // Sensor Location Characteristic - Declaration - [CSCS_IDX_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CSCS_IDX_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Sensor Location Characteristic - Value - [CSCS_IDX_SENSOR_LOC_VAL] = { - BLE_ATT_CHAR_SENSOR_LOC, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - CSCS_SENSOR_LOC_VAL_LEN_MAX - }, + [CSCS_IDX_SENSOR_LOC_VAL] = {BLE_ATT_CHAR_SENSOR_LOC, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + CSCS_SENSOR_LOC_VAL_LEN_MAX}, // SC Control Point Characteristic - Declaration - [CSCS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CSCS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // SC Control Point Characteristic - Value - [CSCS_IDX_CTRL_POINT_VAL] = { - BLE_ATT_CHAR_SC_CNTL_PT, - WRITE_REQ_PERM_UNSEC | INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - CSCS_CTRL_PT_VAL_LEN_MAX - }, + [CSCS_IDX_CTRL_POINT_VAL] = {BLE_ATT_CHAR_SC_CNTL_PT, + BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_INDICATE_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + CSCS_CTRL_PT_VAL_LEN_MAX}, // SC Control Point Characteristic - Client Characteristic Configuration Descriptor - [CSCS_IDX_CTRL_POINT_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief CSCS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t cscs_task_cbs = { - (prf_init_func_t) cscs_init, - NULL, - cscs_disconnect_cb -}; - -/**@brief CSCS Task Callbacks. */ -static gatts_prf_cbs_t cscs_cb_func = { - cscs_read_att_cb, - cscs_write_att_cb, - NULL, - cscs_ntf_ind_cb, - cscs_cccd_set_cb -}; - -/**@brief CSCS Information. */ -static const prf_server_info_t cscs_prf_info = { - .max_connection_nb = CSCS_CONNECTION_MAX, - .manager_cbs = &cscs_task_cbs, - .gatts_prf_cbs = &cscs_cb_func, + [CSCS_IDX_CTRL_POINT_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, }; /* @@ -202,34 +161,7 @@ static const prf_server_info_t cscs_prf_info = { * @return Error code to know if profile initialization succeed or not. ***************************************************************************************** */ -static sdk_err_t cscs_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t rscs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_CYCLING_SPEED_CADENCE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = rscs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_cscs_env.cscs_init.char_mask); - gatts_db.max_nb_attr = CSCS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = cscs_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_cscs_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} /** ***************************************************************************************** @@ -239,18 +171,19 @@ static sdk_err_t cscs_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void cscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void cscs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, + uint8_t tab_index = prf_find_idx_by_handle(handle, s_cscs_env.start_hdl, CSCS_IDX_NB, - (uint8_t *)&s_cscs_env.cscs_init.char_mask); + (uint8_t *)&s_cscs_env.cscs_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case CSCS_IDX_CSC_MEAS_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_cscs_env.meas_ntf_cfg[conn_idx]; @@ -265,7 +198,7 @@ static void cscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_pa cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)&s_cscs_env.cscs_init.sensor_location; break; - + case CSCS_IDX_CTRL_POINT_IND_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_cscs_env.ctrl_point_ind_cfg[conn_idx]; @@ -288,14 +221,14 @@ static void cscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_pa * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void cscs_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; bool ctrl_pt_evt = false; cscs_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_cscs_env.start_hdl, @@ -305,23 +238,29 @@ static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ cfm.status = BLE_SUCCESS; event.evt_type = CSCS_EVT_INVALID; event.conn_idx = conn_idx; - - switch (tab_index) { + + switch (tab_index) + { case CSCS_IDX_CSC_MEAS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE :\ - CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE); + CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE :\ + CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE); s_cscs_env.meas_ntf_cfg[conn_idx] = cccd_value; break; case CSCS_IDX_CTRL_POINT_VAL: - if (PRF_CLI_START_IND != s_cscs_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND != s_cscs_env.ctrl_point_ind_cfg[conn_idx]) + { cfm.status = CSCS_ERROR_CCCD_INVALID; break; - } else if (s_cscs_env.ctrl_pt_op_in_progress) { + } + else if (s_cscs_env.ctrl_pt_op_in_progress) + { cfm.status = CSCS_ERROR_PROC_IN_PROGRESS; - } else if (PRF_CLI_START_IND == s_cscs_env.ctrl_point_ind_cfg[conn_idx]) { + } + else if (PRF_CLI_START_IND == s_cscs_env.ctrl_point_ind_cfg[conn_idx]) + { s_cscs_env.ctrl_pt_op_in_progress = true; ctrl_pt_evt = true; } @@ -330,8 +269,8 @@ static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ case CSCS_IDX_CTRL_POINT_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - CSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ - CSCS_EVT_CTRL_POINT_INDICATION_DISABLE); + CSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ + CSCS_EVT_CTRL_POINT_INDICATION_DISABLE); s_cscs_env.ctrl_point_ind_cfg[conn_idx] = cccd_value; break; @@ -342,10 +281,12 @@ static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ ble_gatts_write_cfm(conn_idx, &cfm); - if (ctrl_pt_evt) { + if (ctrl_pt_evt) + { cscs_sc_ctrl_pt_handler(conn_idx, p_param->value, p_param->length); - } else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && CSCS_EVT_INVALID != event.evt_type - && s_cscs_env.cscs_init.evt_handler) { + } + else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && CSCS_EVT_INVALID != event.evt_type && s_cscs_env.cscs_init.evt_handler) + { s_cscs_env.cscs_init.evt_handler(&event); } } @@ -359,12 +300,13 @@ static void cscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void cscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void cscs_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; cscs_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -375,19 +317,20 @@ static void cscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va event.evt_type = CSCS_EVT_INVALID; event.conn_idx = conn_idx; - - switch (tab_index) { + + switch (tab_index) + { case CSCS_IDX_CSC_MEAS_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE :\ - CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE); + CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE :\ + CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE); s_cscs_env.meas_ntf_cfg[conn_idx] = cccd_value; break; case CSCS_IDX_CTRL_POINT_IND_CFG: event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - CSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ - CSCS_EVT_CTRL_POINT_INDICATION_DISABLE); + CSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ + CSCS_EVT_CTRL_POINT_INDICATION_DISABLE); s_cscs_env.ctrl_point_ind_cfg[conn_idx] = cccd_value; break; @@ -395,7 +338,9 @@ static void cscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va break; } - if (CSCS_EVT_INVALID != event.evt_type && s_cscs_env.cscs_init.evt_handler) { + + if (CSCS_EVT_INVALID != event.evt_type && s_cscs_env.cscs_init.evt_handler) + { s_cscs_env.cscs_init.evt_handler(&event); } } @@ -408,17 +353,21 @@ static void cscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va * @param[in] p_param: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void cscs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void cscs_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { cscs_evt_t event; event.evt_type = CSCS_EVT_INVALID; event.conn_idx = conn_idx; - if (s_cscs_env.cscs_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (s_cscs_env.cscs_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = CSCS_EVT_CSC_MEAS_SEND_CPLT; - } else if (BLE_GATT_INDICATION == p_ntf_ind->type) { + } + else if (BLE_GATT_INDICATION == p_ntf_ind->type) + { event.evt_type = CSCS_EVT_CTRL_POINT_RSP_CPLT; s_cscs_env.ctrl_pt_op_in_progress = false; } @@ -434,7 +383,7 @@ static void cscs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_nt * @param[in] reason: Reason of disconnection. ***************************************************************************************** */ -static void cscs_disconnect_cb(uint8_t conn_idx, uint8_t reason) +static void cscs_disconnect_evt_handler(uint8_t conn_idx, uint8_t reason) { s_cscs_env.ctrl_pt_op_in_progress = false; } @@ -453,19 +402,22 @@ static void cscs_op_set_cumulative_handler(uint8_t conn_idx, const uint8_t *p_da cscs_evt_t event; uint8_t rsp[CSCS_CTRL_PT_RSP_LEN_MIN]; - rsp[INDEX_0] = CSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = CSCS_CTRL_PT_OP_SET_CUMUL_VAL; - ATrsp[INDEX_2] = CSCS_CTRL_PT_RSP_FAILED; + rsp[0] = CSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = CSCS_CTRL_PT_OP_SET_CUMUL_VAL; + rsp[2] = CSCS_CTRL_PT_RSP_FAILED; if ((sizeof(uint32_t) == length) && \ (s_cscs_env.cscs_init.feature & CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT) && \ - (s_cscs_env.cscs_init.evt_handler)) { + (s_cscs_env.cscs_init.evt_handler)) + { event.conn_idx = conn_idx; event.evt_type = CSCS_EVT_CUMUL_VAL_SET; event.p_data = p_data; event.length = length; s_cscs_env.cscs_init.evt_handler(&event); - } else { + } + else + { cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -484,20 +436,25 @@ static void cscs_op_sensor_loc_update_handler(uint8_t conn_idx, const uint8_t *p cscs_evt_t event; uint8_t rsp[CSCS_CTRL_PT_RSP_LEN_MIN]; - rsp[INDEX_0] = CSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = CSCS_CTRL_PT_OP_UPD_LOC; + rsp[0] = CSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = CSCS_CTRL_PT_OP_UPD_LOC; - if (CSCS_SENSOR_LOC_SUP_NB <= p_data[0] || (sizeof(uint8_t) != length)) { - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_INVALID_PARAM; + if (CSCS_SENSOR_LOC_SUP_NB <= p_data[0] || (sizeof(uint8_t) != length)) + { + rsp[2] = CSCS_CTRL_PT_RSP_INVALID_PARAM; cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); - } else if ((s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) && s_cscs_env.cscs_init.evt_handler) { + } + else if ((s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) && s_cscs_env.cscs_init.evt_handler) + { event.conn_idx = conn_idx; event.evt_type = CSCS_EVT_SEBSOR_LOC_UPD; event.p_data = p_data; event.length = length; s_cscs_env.cscs_init.evt_handler(&event); - } else { - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_FAILED; + } + else + { + rsp[2] = CSCS_CTRL_PT_RSP_FAILED; cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -515,24 +472,29 @@ static void cscs_op_sup_sensor_loc_req_handler(uint8_t conn_idx) uint8_t rsp[CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB]; uint8_t rsp_idx = CSCS_CTRL_PT_RSP_LEN_MIN; - rsp[INDEX_0] = CSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = CSCS_CTRL_PT_OP_REQ_SUP_LOC; - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_SUCCESS; + rsp[0] = CSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = CSCS_CTRL_PT_OP_REQ_SUP_LOC; + rsp[2] = CSCS_CTRL_PT_RSP_SUCCESS; - if (s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) + { event.conn_idx = conn_idx; event.evt_type = CSCS_EVT_SUP_SEBSOR_LOC_REQ; - if (s_cscs_env.cscs_init.evt_handler) { - s_cscs_env.cscs_init.evt_handler(&event); + if (s_cscs_env.cscs_init.evt_handler) + { + s_cscs_env.cscs_init.evt_handler(&event); } - for (uint8_t i = 0; i < CSCS_SENSOR_LOC_SUP_NB; i++) { + for (uint8_t i = 0; i < CSCS_SENSOR_LOC_SUP_NB; i++) + { rsp[rsp_idx++] = i; } cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB); - } else { - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_FAILED; + } + else + { + rsp[2] = CSCS_CTRL_PT_RSP_FAILED; cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -550,15 +512,16 @@ static void cscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uin { uint8_t rsp[CSCS_CTRL_PT_RSP_LEN_MIN]; - switch (p_data[0]) { + switch(p_data[0]) + { case CSCS_CTRL_PT_OP_SET_CUMUL_VAL: cscs_op_set_cumulative_handler(conn_idx, &p_data[1], length - 1); break; case CSCS_CTRL_PT_OP_START_CALIB: - rsp[INDEX_0] = CSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = p_data[0]; - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_NOT_SUP; + rsp[0] = CSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = p_data[0]; + rsp[2] = CSCS_CTRL_PT_RSP_NOT_SUP; cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); break; @@ -571,9 +534,9 @@ static void cscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uin break; default: - rsp[INDEX_0] = CSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = p_data[0]; - rsp[INDEX_2] = CSCS_CTRL_PT_RSP_NOT_SUP; + rsp[0] = CSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = p_data[0]; + rsp[2] = CSCS_CTRL_PT_RSP_NOT_SUP; cscs_ctrl_pt_rsp_send(conn_idx, rsp, CSCS_CTRL_PT_RSP_LEN_MIN); break; } @@ -595,8 +558,10 @@ static uint16_t csc_meas_value_encoded(cscs_meas_val_t *p_meas, uint8_t *p_encod uint16_t length = 1; // Cumulative Wheel Revolutions and Last Wheel Event Time Fields - if (s_cscs_env.cscs_init.feature & CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT) { - if (p_meas->wheel_rev_data_present) { + if (s_cscs_env.cscs_init.feature & CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT) + { + if (p_meas->wheel_rev_data_present) + { p_encoded_buffer[length++] = LO_UINT32_T(p_meas->cumulative_wheel_revs); p_encoded_buffer[length++] = L2_UINT32_T(p_meas->cumulative_wheel_revs); p_encoded_buffer[length++] = L3_UINT32_T(p_meas->cumulative_wheel_revs); @@ -610,8 +575,10 @@ static uint16_t csc_meas_value_encoded(cscs_meas_val_t *p_meas, uint8_t *p_encod } // Cumulative Crank Revolutions and Last Crank Event Time Fields - if (s_cscs_env.cscs_init.feature & CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT) { - if (p_meas->crank_rev_data_present) { + if (s_cscs_env.cscs_init.feature & CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT) + { + if (p_meas->crank_rev_data_present) + { p_encoded_buffer[length++] = LO_U16(p_meas->cumulative_crank_revs); p_encoded_buffer[length++] = HI_U16(p_meas->cumulative_crank_revs); p_encoded_buffer[length++] = LO_U16(p_meas->last_crank_event_time); @@ -636,11 +603,12 @@ sdk_err_t cscs_measurement_send(uint8_t conn_idx, cscs_meas_val_t *p_meas) sdk_err_t error_code = SDK_ERR_NTF_DISABLED; uint8_t encoded_csc_meas[CSCS_MEAS_VAL_LEN_MAX]; uint16_t length; - gatts_noti_ind_t csc_ntf; + ble_gatts_noti_ind_t csc_ntf; length = csc_meas_value_encoded(p_meas, encoded_csc_meas); - if (PRF_CLI_START_NTF == s_cscs_env.meas_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_cscs_env.meas_ntf_cfg[conn_idx]) + { csc_ntf.type = BLE_GATT_NOTIFICATION; csc_ntf.handle = prf_find_handle_by_idx(CSCS_IDX_CSC_MEAS_VAL, s_cscs_env.start_hdl, @@ -656,9 +624,10 @@ sdk_err_t cscs_measurement_send(uint8_t conn_idx, cscs_meas_val_t *p_meas) sdk_err_t cscs_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t ctrl_pt_rsp; + ble_gatts_noti_ind_t ctrl_pt_rsp; - if (PRF_CLI_START_IND == s_cscs_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_cscs_env.ctrl_point_ind_cfg[conn_idx]) + { ctrl_pt_rsp.type = BLE_GATT_INDICATION; ctrl_pt_rsp.handle = prf_find_handle_by_idx(CSCS_IDX_CTRL_POINT_VAL, s_cscs_env.start_hdl, @@ -675,32 +644,72 @@ sdk_err_t cscs_sensor_loc_update(cscs_sensor_loc_t sensor_loc) { sdk_err_t error_code = BLE_SUCCESS; - if (s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (s_cscs_env.cscs_init.feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) + { s_cscs_env.cscs_init.sensor_location = sensor_loc; - } else { + } + else + { error_code = SDK_ERR_DISALLOWED; } return error_code; } +static void cscs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + cscs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + cscs_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + cscs_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index,p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + cscs_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + case BLE_GAPC_EVT_DISCONNECTED: + cscs_disconnect_evt_handler(p_evt->evt.gapc_evt.index,p_evt->evt.gapc_evt.params.disconnected.reason); + break; + default: + break; + } +} sdk_err_t cscs_service_init(cscs_init_t *p_cscs_init) { - sdk_err_t ret; - if (p_cscs_init == NULL) { + if (NULL == p_cscs_init) + { return SDK_ERR_POINTER_NULL; } - if (p_cscs_init->feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (p_cscs_init->feature & CSCS_FEAT_MULTIPLE_SENSORS_BIT) + { p_cscs_init->char_mask |= CSCS_CHAR_SENSOR_LOC_SUP; - } else { + } + else + { p_cscs_init->char_mask &= ~CSCS_CHAR_SENSOR_LOC_SUP; } - ret = memcpy_s(&s_cscs_env.cscs_init, sizeof(cscs_init_t), p_cscs_init, sizeof(cscs_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_cscs_env.cscs_init, p_cscs_init, sizeof(cscs_init_t)); - return ble_server_prf_add(&cscs_prf_info); + memset(&s_cscs_env.cscs_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_cscs_env.start_hdl = PRF_INVALID_HANDLE; + s_cscs_env.cscs_serv_db.shdl = &s_cscs_env.start_hdl; + s_cscs_env.cscs_serv_db.uuid = s_cscs_svc_uuid; + s_cscs_env.cscs_serv_db.attr_tab_cfg = (uint8_t *)&(s_cscs_env.cscs_init.char_mask); + s_cscs_env.cscs_serv_db.max_nb_attr = CSCS_IDX_NB; + s_cscs_env.cscs_serv_db.srvc_perm = 0; + s_cscs_env.cscs_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_cscs_env.cscs_serv_db.attr_tab.attr_tab_16 = cscs_attr_tab; + return ble_gatts_prf_add(&s_cscs_env.cscs_serv_db, cscs_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.h index 23384c6..42e590c 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cscs/cscs.h @@ -51,45 +51,41 @@ * and Cadence Service with CSC Measurement, CSC Feature, Sensor Location and SC Control Point characteristics. * * After \ref cscs_init_t variable is initialized, the application must call \ref cscs_service_init() - * to add the Cycling Speed and Cadence Service and CSC Measurement, CSC Feature, Sensor Location and + * to add the Cycling Speed and Cadence Service and CSC Measurement, CSC Feature, Sensor Location and * SC Control Point characteristics to the BLE Stack database according to \ref cscs_init_t.char_mask. */ #ifndef __CSCS_H__ #define __CSCS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup CSCS_MACRO Defines * @{ */ -#define CSCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of CSCS connections. */ -#define CSCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of CSC Measurment value. */ -#define CSCS_FEAT_VAL_LEN_MAX 2 /**< Maximum length of CSC Feature value. */ -#define CSCS_SENSOR_LOC_VAL_LEN_MAX 1 /**< Maximum length of Sensor Location value. */ -#define CSCS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of SC Control Point response value. */ -/**< Maximum length of SC Control Point value. */ -#define CSCS_CTRL_PT_VAL_LEN_MAX (CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB) +#define CSCS_CONNECTION_MAX 10 /**< Maximum number of CSCS connections. */ +#define CSCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of CSC Measurment value. */ +#define CSCS_FEAT_VAL_LEN_MAX 2 /**< Maximum length of CSC Feature value. */ +#define CSCS_SENSOR_LOC_VAL_LEN_MAX 1 /**< Maximum length of Sensor Location value. */ +#define CSCS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of SC Control Point response value. */ +#define CSCS_CTRL_PT_VAL_LEN_MAX (CSCS_CTRL_PT_RSP_LEN_MIN + CSCS_SENSOR_LOC_SUP_NB) /**< Maximum length of SC Control Point value. */ -#define CSCS_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point operation \ - is still in progress. */ -#define CSCS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor \ - is not configured. */ +#define CSCS_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point operation is still in progress. */ +#define CSCS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor is not configured. */ /** * @defgroup CSCS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref cscs_init_t.char_mask. */ -#define CSCS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in CSCS. */ -#define CSCS_CHAR_SENSOR_LOC_SUP 0x00c0 /**< Bit mask for Sensor Location characteristic that is optional. */ -#define CSCS_CHAR_SC_CTRL_POINT 0x0700 /**< Bit mask for SC Control Point characteristic that is optional. */ -#define CSCS_CHAR_FULL 0x07ff /**< Bit mask of the full characteristic. */ +#define CSCS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in CSCS. */ +#define CSCS_CHAR_SENSOR_LOC_SUP 0x00c0 /**< Bit mask for Sensor Location characteristic that is optional. */ +#define CSCS_CHAR_SC_CTRL_POINT 0x0700 /**< Bit mask for SC Control Point characteristic that is optional. */ +#define CSCS_CHAR_FULL 0x07ff /**< Bit mask of the full characteristic. */ /** @} */ /** @@ -97,8 +93,8 @@ * @{ * @brief Cycling Speed and Cadence Measurement Flags. */ -#define CSCS_MEAS_FLAG_WHEEL_REVOLUTION_BIT (0x01 << 0) /**< Flag bit for Wheel Revolution Data Present. */ -#define CSCS_MEAS_FLAG_CRANK_REVOLUTION_BIT (0x01 << 1) /**< Flag bit for Crank Revolution Data Present. */ +#define CSCS_MEAS_FLAG_WHEEL_REVOLUTION_BIT (0x01 << 0) /**< Flag bit for Wheel Revolution Data Present. */ +#define CSCS_MEAS_FLAG_CRANK_REVOLUTION_BIT (0x01 << 1) /**< Flag bit for Crank Revolution Data Present. */ /** @} */ /** @@ -106,10 +102,10 @@ * @{ * @brief Cycling Speed and Cadence Service feature bits. */ -#define CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT (0x01 << 0) /**< Bit for Wheel Revolution Data Supported. */ -#define CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT (0x01 << 1) /**< Bit for Crank Revolution Data Supported. */ -#define CSCS_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 2) /**< Bit for Multiple Sensor Locations Supported. */ -#define CSCS_FEAR_FULL_BIT (0x07) /**< Bit for all CSC features Supported. */ +#define CSCS_FEAT_WHEEL_REVOLUTION_SUP_BIT (0x01 << 0) /**< Bit for Wheel Revolution Data Supported. */ +#define CSCS_FEAT_CRANK_REVOLUTION_SUP_BIT (0x01 << 1) /**< Bit for Crank Revolution Data Supported. */ +#define CSCS_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 2) /**< Bit for Multiple Sensor Locations Supported. */ +#define CSCS_FEAR_FULL_BIT (0x07) /**< Bit for all CSC features Supported. */ /** @} */ /** @} */ @@ -118,7 +114,8 @@ * @{ */ /**@brief Cycling Speed and Cadence Service Sensor Location. */ -typedef enum { +typedef enum +{ CSCS_SENSOR_LOC_OTHER, /**< Sensor location: other. */ CSCS_SENSOR_LOC_SHOE_TOP, /**< Sensor location: top of shoe. */ CSCS_SENSOR_LOC_SHOE_IN, /**< Sensor location: inside of shoe. */ @@ -131,7 +128,8 @@ typedef enum { } cscs_sensor_loc_t; /**@brief Cycling Speed and Cadence Service Control Point Operation Code.*/ -typedef enum { +typedef enum +{ CSCS_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */ CSCS_CTRL_PT_OP_SET_CUMUL_VAL, /**< Set Cumulative value Operation Code.*/ CSCS_CTRL_PT_OP_START_CALIB, /**< Start Sensor Calibration Operation Code.*/ @@ -141,7 +139,8 @@ typedef enum { } cscs_ctrl_pt_op_code_t; /**@brief Cycling Speed and Cadence Service Control Point Response value.*/ -typedef enum { +typedef enum +{ CSCS_CTRL_PT_RSP_RESERVED, /**< Reserved value. */ CSCS_CTRL_PT_RSP_SUCCESS, /**< Operation Success. */ CSCS_CTRL_PT_RSP_NOT_SUP, /**< Operation Code Not Supported. */ @@ -150,18 +149,19 @@ typedef enum { } cscs_ctrl_pt_rsp_t; /**@brief Cycling Speed and Cadence Service event type.*/ -typedef enum { - CSCS_EVT_INVALID, /**< Indicate that invalid event. */ - CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE, /**< Indicate that CSC Measurement notification has been enabled. */ - CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE, /**< Indicate that CSC Measurement notification has been disabled. */ - CSCS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that SC Control Point indication has been enabled. */ - CSCS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that SC Control Point indication has been disabled. */ - CSCS_EVT_CSC_MEAS_SEND_CPLT, /**< Indicate that CSC Measurement has been notified. */ - CSCS_EVT_CUMUL_VAL_SET, /**< Indicate that Wheel Revolution Data needs to be set. */ - CSCS_EVT_SEBSOR_CALIBRATION, /**< Indicate that Sensor calibration procedure should be initiated. */ - CSCS_EVT_SEBSOR_LOC_UPD, /**< Indicate that Sensor Location needs to be reset. */ - CSCS_EVT_SUP_SEBSOR_LOC_REQ, /**< Indicate that request supported sensor location list. */ - CSCS_EVT_CTRL_POINT_RSP_CPLT /**< Indicate that SC Control Point response has been indicated. */ +typedef enum +{ + CSCS_EVT_INVALID, /**< Indicate that invalid event. */ + CSCS_EVT_CSC_MEAS_NOTIFICATION_ENABLE, /**< Indicate that CSC Measurement notification has been enabled. */ + CSCS_EVT_CSC_MEAS_NOTIFICATION_DISABLE, /**< Indicate that CSC Measurement notification has been disabled. */ + CSCS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that SC Control Point indication has been enabled. */ + CSCS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that SC Control Point indication has been disabled. */ + CSCS_EVT_CSC_MEAS_SEND_CPLT, /**< Indicate that CSC Measurement has been notified. */ + CSCS_EVT_CUMUL_VAL_SET, /**< Indicate that Wheel Revolution Data needs to be set. */ + CSCS_EVT_SEBSOR_CALIBRATION, /**< Indicate that Sensor calibration procedure should be initiated. */ + CSCS_EVT_SEBSOR_LOC_UPD, /**< Indicate that Sensor Location needs to be reset. */ + CSCS_EVT_SUP_SEBSOR_LOC_REQ, /**< Indicate that request supported sensor location list. */ + CSCS_EVT_CTRL_POINT_RSP_CPLT /**< Indicate that SC Control Point response has been indicated. */ } cscs_evt_type_t; /** @} */ @@ -170,7 +170,8 @@ typedef enum { * @{ */ /**@brief Cycling Speed and Cadence Service event. */ -typedef struct { +typedef struct +{ cscs_evt_type_t evt_type; /**< The CSCS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -191,7 +192,8 @@ typedef void (*cscs_evt_handler_t)(cscs_evt_t *p_evt); * @{ */ /**@brief Cycling Speed and Cadence Measurement Character value structure. */ -typedef struct { +typedef struct +{ bool wheel_rev_data_present; /**< If Wheel Revolution Data is present. */ bool crank_rev_data_present; /**< If Crank Revolution Data is present. */ uint32_t cumulative_wheel_revs; /**< Cumulative Wheel Revolutions. */ @@ -200,13 +202,11 @@ typedef struct { uint16_t last_crank_event_time; /**< Last Crank Event Time. */ } cscs_meas_val_t; -/**@brief Cycling Speed and Cadence Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Cycling Speed and Cadence Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ cscs_evt_handler_t evt_handler; /**< Cycling Speed and Cadence Service event handler. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, \ - and configured with \ref CSCS_CHAR_MASK. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref CSCS_CHAR_MASK. */ cscs_sensor_loc_t sensor_location; /**< Initial sensor location. */ uint16_t feature; /**< Initial value for features. */ } cscs_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/BUILD.gn new file mode 100644 index 0000000..7194892 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("cts") { + sources = [ "cts.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.c index 9ec5883..e0366d1 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.c @@ -43,22 +43,51 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define INDEX_2 2 -#define INDEX_3 3 -#define INDEX_7 7 -#define INDEX_8 8 -#define INDEX_9 9 -#define VALUE_7 7 -#define VALUE_12 12 -#define VALUE_31 31 -#define VALUE_23 23 -#define VALUE_59 59 +#include "app_log.h" +#include "user_app.h" + /* * ENUMERATIONS **************************************************************************************** */ + /**@brief The time zone adjustment sent by the receiving host. */ +enum +{ + CTS_HOST_DATA_ZONE, /**< Accept zone receipts from the host. */ + CTS_HOST_DATA_OFFST, /**< Accept offst receipts from the host. */ + + CTS_HOST_NB /**< The maximum number of data from the host. */ +}; + + /**@brief Accept receipts from serial ports. */ +enum +{ + CTS_SERIAL_DATA_SOURCE, /**< Source of information. */ + CTS_SERIAL_DATA_ACCURACY, /**< Drift accuracy. */ + CTS_SERIAL_DAY_SINCE, /**< Days since update.*/ + CTS_SERIAL_HOURS_SINCE, /**< hours since update. */ + + CTS_SERIAL_NB /**< The maximum number of data from the serial port. */ +}; + + /**@brief Accept receipts from peers. */ +enum +{ + CTS_PEER_DATA_YEAR, /**< Receive data from the peer year. */ + CTS_PEER_DATA_MONTH, /**< Receive data from the peer month. */ + CTS_PEER_DATA_DAY, /**< Receive data from the peer day. */ + CTS_PEER_DATA_HOUR, /**< Receive data from the peer hour */ + CTS_PEER_DATA_MIN, /**< Receive data from the peer minute */ + CTS_PEER_DATA_SEC, /**< Receive data from the peer second */ + CTS_PEER_DATA_WEEK, /**< Receive data from the peer week */ + CTS_PEER_DATA_FRACTION, /**< Receive data from the peer fracyion */ + CTS_PEER_DATA_REASON, /**< Receive data from the peer Reason for adjustment */ + + CTS_PEER_NB /**< The maximum number of data from peer devices */ +}; /**@brief Current Time Service Attributes Indexes. */ -enum { +enum +{ // Current Time Service CTS_IDX_SVC, @@ -83,136 +112,69 @@ enum { ***************************************************************************************** */ /**@brief Current Time Service environment variable. */ -struct cts_env_t { - cts_init_t cts_init; /**< Current Time Service initialization variables. */ - uint16_t start_hdl; /**< Current Time Service start handle. */ - uint16_t - cur_time_ntf_cfg[CTS_CONNECTION_MAX]; /**< The configuration of Current Time Notification - which is configured by the peer devices. */ +struct cts_env_t +{ + cts_init_t cts_init; /**< Current Time Service initialization variables. */ + uint16_t start_hdl; /**< Current Time Service start handle. */ + uint16_t cur_time_ntf_cfg[CTS_CONNECTION_MAX]; /**< The configuration of Current Time Notification which is configured by the peer devices. */ + ble_gatts_create_db_t cts_gatts_db; /**< Current Time Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t cts_init(void); -static void cts_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void cts_write_att_cb(uint8_t conidx, const gatts_write_req_cb_t *p_param); -static void cts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void cts_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); -static void cts_cur_time_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); -static void cts_loc_time_info_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); -static void cts_ref_time_info_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); -static void cts_cur_time_write_handler(gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt); -static void cts_loc_time_info_write_handler(gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt); +static void cts_cur_time_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); +static void cts_loc_time_info_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); +static void cts_ref_time_info_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct cts_env_t s_cts_env; +static struct cts_env_t s_cts_record_time; +static cts_adj_info_t s_cts_ref_info; +static cts_updata_ref_time_info_t s_cts_updata; +static uint8_t s_cts_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_CURRENT_TIME); /**@brief Full CTS Database Description - Used to add attributes into the database. */ -static const attm_desc_t cts_attr_tab[CTS_IDX_NB] = { +static const ble_gatts_attm_desc_t cts_attr_tab[CTS_IDX_NB] = +{ // CTS Service Declaration - [CTS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [CTS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Current Time Characteristic Declaration - [CTS_IDX_CUR_TIME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CTS_IDX_CUR_TIME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Current Time Characteristic Declaration value - [CTS_IDX_CUR_TIME_VAL] = { - BLE_ATT_CHAR_CT_TIME, - READ_PERM_UNSEC | NOTIFY_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - CTS_CUR_TIME_VAL_LEN - }, + [CTS_IDX_CUR_TIME_VAL] = {BLE_ATT_CHAR_CT_TIME, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_NOTIFY_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + TOTAL_CTS_CUR_TIME_VAL_LEN}, // Current Time Characteristic Declaration - Client Characteristic Configuration Descriptor - [CTS_IDX_CUR_TIMR_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [CTS_IDX_CUR_TIMR_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Local Time Information Characteristic Declaration - [CTS_IDX_LOC_TIME_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CTS_IDX_LOC_TIME_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Local Time Information Characteristic Value - [CTS_IDX_LOC_TIME_INFO_VAL] = { - BLE_ATT_CHAR_LOCAL_TIME_INFO, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - CTS_LOC_TIME_INFO_VAL_LEN - }, + [CTS_IDX_LOC_TIME_INFO_VAL] = {BLE_ATT_CHAR_LOCAL_TIME_INFO, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + TOTAL_CTS_LOC_TIME_INFO_VAL_LEN}, // Reference Time Information Characteristic Declaration - [CTS_IDX_REF_TIME_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [CTS_IDX_REF_TIME_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Reference Time Information Characteristic Value - [CTS_IDX_REF_TIME_INFO_VAL] = { - BLE_ATT_CHAR_REFERENCE_TIME_INFO, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - CTS_REF_TIME_INFO_VAL_LEN - }, -}; - -/**@brief CTS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t cts_tack_cbs = { - (prf_init_func_t) cts_init, - NULL, - NULL -}; - -/**@brief CTS Task Callbacks. */ -static gatts_prf_cbs_t cts_cb_func = { - cts_read_att_cb, - cts_write_att_cb, - NULL, - cts_gatts_ntf_ind_cb, - cts_cccd_set_cb -}; - -/**@brief CTS Information. */ -static const prf_server_info_t cts_prf_info = { - .max_connection_nb = CTS_CONNECTION_MAX, - .manager_cbs = &cts_tack_cbs, - .gatts_prf_cbs = &cts_cb_func + [CTS_IDX_REF_TIME_INFO_VAL] = {BLE_ATT_CHAR_REFERENCE_TIME_INFO, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + CTS_REF_TIME_INFO_VAL_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Current Time service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t cts_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t cts_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_CURRENT_TIME); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = cts_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_cts_env.cts_init.char_mask); - gatts_db.max_nb_attr = CTS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = cts_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_cts_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -221,21 +183,24 @@ static sdk_err_t cts_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void cts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void cts_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_cts_env.start_hdl, - CTS_IDX_NB, - (uint8_t *)&s_cts_env.cts_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_cts_env.start_hdl, + CTS_IDX_NB, + (uint8_t *)&s_cts_env.cts_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { - case CTS_IDX_CUR_TIME_VAL: { + switch (tab_index) + { + case CTS_IDX_CUR_TIME_VAL: + { uint8_t encoded_buffer[CTS_CUR_TIME_VAL_LEN]; cts_cur_time_read_handler(&cfm, encoded_buffer); + APP_LOG_INFO("Read current time success."); break; } @@ -244,15 +209,19 @@ static void cts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par cfm.value = (uint8_t *)&s_cts_env.cur_time_ntf_cfg[conn_idx]; break; - case CTS_IDX_LOC_TIME_INFO_VAL: { + case CTS_IDX_LOC_TIME_INFO_VAL: + { uint8_t encoded_buffer[CTS_LOC_TIME_INFO_VAL_LEN]; cts_loc_time_info_read_handler(&cfm, encoded_buffer); + APP_LOG_INFO("Read local time success."); break; } - case CTS_IDX_REF_TIME_INFO_VAL: { + case CTS_IDX_REF_TIME_INFO_VAL: + { uint8_t encoded_buffer[CTS_REF_TIME_INFO_VAL_LEN]; cts_ref_time_info_read_handler(&cfm, encoded_buffer); + APP_LOG_INFO("Read refence time success."); break; } @@ -273,14 +242,13 @@ static void cts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void cts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void cts_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t tab_index = 0; - uint16_t cccd_value = 0; - cts_evt_t event; - gatts_write_cfm_t cfm; - uint8_t ret; + uint16_t handle = p_param->handle; + uint16_t tab_index = 0; + uint16_t cccd_value = 0; + cts_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_cts_env.start_hdl, @@ -291,17 +259,14 @@ static void cts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p event.evt_type = CTS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case CTS_IDX_CUR_TIME_VAL: event.evt_type = CTS_EVT_CUR_TIME_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - cts_cur_time_write_handler(&cfm, &event); - ret = memcpy_s(&event.cur_time, sizeof(cts_cur_time_t), - &s_cts_env.cts_init.cur_time, sizeof(cts_cur_time_t)); - if (ret < 0) { - return; - } + event.length = current_time_universal_decode(&cfm, &event); + memcpy(&event.cur_time, &s_cts_env.cts_init.cur_time, sizeof(cts_cur_time_t)); break; case CTS_IDX_CUR_TIMR_NTF_CFG: @@ -316,12 +281,8 @@ static void cts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p event.evt_type = CTS_EVT_LOC_TIME_INFO_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - cts_loc_time_info_write_handler(&cfm, &event); - ret = memcpy_s(&event.loc_time_info, sizeof(cts_loc_time_info_t), - &s_cts_env.cts_init.loc_time_info, sizeof(cts_loc_time_info_t)); - if (ret < 0) { - return; - } + event.length = local_time_universal_decode(&cfm, &event); + memcpy(&event.loc_time_info, &s_cts_env.cts_init.loc_time_info, sizeof(cts_loc_time_info_t)); break; default: @@ -331,8 +292,8 @@ static void cts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && - CTS_EVT_INVALID != event.evt_type && s_cts_env.cts_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && CTS_EVT_INVALID != event.evt_type && s_cts_env.cts_init.evt_handler) + { s_cts_env.cts_init.evt_handler(&event); } } @@ -346,12 +307,13 @@ static void cts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void cts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void cts_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; cts_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -363,7 +325,8 @@ static void cts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = CTS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case CTS_IDX_CUR_TIMR_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED : \ @@ -375,7 +338,8 @@ static void cts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (CTS_EVT_INVALID != event.evt_type && s_cts_env.cts_init.evt_handler) { + if (CTS_EVT_INVALID != event.evt_type && s_cts_env.cts_init.evt_handler) + { s_cts_env.cts_init.evt_handler(&event); } } @@ -388,10 +352,11 @@ static void cts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_param: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void cts_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void cts_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { - s_cts_env.cts_init.cur_time.adjust_reason = CTS_AR_NO_CHANGE; + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { + s_cts_env.cts_init.cur_time.adjust_reason = s_cts_env.cts_init.cur_time.adjust_reason; } } @@ -407,26 +372,9 @@ static void cts_cur_time_encode(const cts_cur_time_t *p_cur_time, uint8_t *p_enc { prf_pack_date_time(p_encoded_data, &p_cur_time->day_date_time.date_time); - p_encoded_data[INDEX_7] = p_cur_time->day_date_time.day_of_week; - p_encoded_data[INDEX_8] = p_cur_time->day_date_time.fractions_256; - p_encoded_data[INDEX_9] = p_cur_time->adjust_reason; -} - -/** - ***************************************************************************************** - * @brief Decode for a Current Time. - * - * @param[in] p_data: Pointer to data to be decoded. - * @param[out] p_cur_time: Pointer to Current Time. - ***************************************************************************************** - */ -static void cts_cur_time_decode(const uint8_t *p_data, cts_cur_time_t *p_cur_time) -{ - prf_unpack_date_time(p_data, &p_cur_time->day_date_time.date_time); - - p_cur_time->day_date_time.day_of_week = p_data[INDEX_7]; - p_cur_time->day_date_time.fractions_256 = p_data[INDEX_8]; - p_cur_time->adjust_reason = p_data[INDEX_9]; + p_encoded_data[7] = p_cur_time->day_date_time.day_of_week; + p_encoded_data[8] = p_cur_time->day_date_time.fractions_256; + p_encoded_data[9] = p_cur_time->adjust_reason; } /** @@ -437,10 +385,8 @@ static void cts_cur_time_decode(const uint8_t *p_data, cts_cur_time_t *p_cur_tim * @param[out] p_encode_buffer: Pointer to encoded data will be written. ***************************************************************************************** */ -static void cts_cur_time_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) +static void cts_cur_time_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) { - s_cts_env.cts_init.cur_time.adjust_reason = CTS_AR_NO_CHANGE; - cts_cur_time_encode(&s_cts_env.cts_init.cur_time, p_encode_buffer); p_cfm->length = CTS_CUR_TIME_VAL_LEN; @@ -455,7 +401,7 @@ static void cts_cur_time_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode * @param[out] p_encode_buffer: Pointer to encoded data will be written. ***************************************************************************************** */ -static void cts_loc_time_info_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) +static void cts_loc_time_info_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) { p_encode_buffer[0] = s_cts_env.cts_init.loc_time_info.time_zone; p_encode_buffer[1] = s_cts_env.cts_init.loc_time_info.dst_offset; @@ -472,110 +418,42 @@ static void cts_loc_time_info_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_e * @param[out] p_encode_buffer: Pointer to encoded data will be written. ***************************************************************************************** */ -static void cts_ref_time_info_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) +static void cts_ref_time_info_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) { p_encode_buffer[0] = s_cts_env.cts_init.ref_time_info.source; p_encode_buffer[1] = s_cts_env.cts_init.ref_time_info.accuracy; - p_encode_buffer[INDEX_2] = s_cts_env.cts_init.ref_time_info.days_since_update; - p_encode_buffer[INDEX_3] = s_cts_env.cts_init.ref_time_info.hours_since_update; + p_encode_buffer[2] = s_cts_env.cts_init.ref_time_info.days_since_update; + p_encode_buffer[3] = s_cts_env.cts_init.ref_time_info.hours_since_update; p_cfm->value = p_encode_buffer; p_cfm->length = CTS_REF_TIME_INFO_VAL_LEN; } -/** - ***************************************************************************************** - * @brief Handle Current Time write event. - * - * @param[out] p_cfm: Pointer to GATT write attribute result description. - * @param[in] p_evt: Pointer to CTS event. - ***************************************************************************************** - */ -static void cts_cur_time_write_handler(gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) +static void cts_ble_evt_handler(const ble_evt_t *p_evt) { - cts_cur_time_t cur_time_set = {0}; - - cts_cur_time_decode(p_evt->p_data, &cur_time_set); - - if ((CTS_TIME_YEAR_VALID_VAL_MIN <= cur_time_set.day_date_time.date_time.year) && \ - (CTS_TIME_YEAR_VALID_VAL_MIN >= cur_time_set.day_date_time.date_time.year)) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.year = cur_time_set.day_date_time.date_time.year; - } else { - if (cur_time_set.day_date_time.date_time.year == 0) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.year = cur_time_set.day_date_time.date_time.year; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } + if (NULL == p_evt) + { + return; } - if (cur_time_set.day_date_time.date_time.month <= VALUE_12) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.month = cur_time_set.day_date_time.date_time.month; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + cts_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + cts_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + cts_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + cts_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; } - - if (cur_time_set.day_date_time.date_time.day <= VALUE_31) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.day = cur_time_set.day_date_time.date_time.day; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (cur_time_set.day_date_time.date_time.hour <= VALUE_23) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.hour = cur_time_set.day_date_time.date_time.hour; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (cur_time_set.day_date_time.date_time.min <= VALUE_23) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.min = cur_time_set.day_date_time.date_time.min; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (cur_time_set.day_date_time.date_time.sec <= VALUE_23) { - s_cts_env.cts_init.cur_time.day_date_time.date_time.sec = cur_time_set.day_date_time.date_time.sec; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (cur_time_set.day_date_time.day_of_week <= VALUE_7) { - s_cts_env.cts_init.cur_time.day_date_time.day_of_week = cur_time_set.day_date_time.day_of_week; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (cur_time_set.adjust_reason <= 0x0f) { - s_cts_env.cts_init.cur_time.adjust_reason = cur_time_set.adjust_reason; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } -} - -/** - ***************************************************************************************** - * @brief Handle Local Time Information write event. - * - * @param[out] p_cfm: Pointer to GATT write attribute result description. - * @param[in] p_evt: Pointer to CTS event. - ***************************************************************************************** - */ -static void cts_loc_time_info_write_handler(gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) -{ - cts_dst_offset_t dst_offset = (cts_dst_offset_t)p_evt->p_data[1]; - - if (CTS_TIME_ZONE_OFFSET_MIN <= (int8_t)p_evt->p_data[0] && CTS_TIME_ZONE_OFFSET_MAX >= (int8_t)p_evt->p_data[0]) { - s_cts_env.cts_init.loc_time_info.time_zone = p_evt->p_data[0]; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - if (CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME >= dst_offset) { - s_cts_env.cts_init.loc_time_info.dst_offset = dst_offset; - } else { - p_cfm->status = CTS_ERROR_FIELDS_IGNORED; - } - - s_cts_env.cts_init.loc_time_info.dst_offset = (cts_dst_offset_t)p_evt->p_data[1]; } /* @@ -584,13 +462,14 @@ static void cts_loc_time_info_write_handler(gatts_write_cfm_t *p_cfm, cts_evt_t */ sdk_err_t cts_cur_time_send(uint8_t conn_idx, cts_cur_time_t *p_cur_time) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - uint8_t encoded_cur_time[CTS_CUR_TIME_VAL_LEN]; - gatts_noti_ind_t ct_ntf; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + uint8_t encoded_cur_time[CTS_CUR_TIME_VAL_LEN]; + ble_gatts_noti_ind_t ct_ntf; cts_cur_time_encode(p_cur_time, encoded_cur_time); - if (PRF_CLI_START_NTF == s_cts_env.cur_time_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_cts_env.cur_time_ntf_cfg[conn_idx]) + { ct_ntf.type = BLE_GATT_NOTIFICATION; ct_ntf.handle = prf_find_handle_by_idx(CTS_IDX_CUR_TIME_VAL, s_cts_env.start_hdl, @@ -603,50 +482,63 @@ sdk_err_t cts_cur_time_send(uint8_t conn_idx, cts_cur_time_t *p_cur_time) return error_code; } -void cts_exact_time_get(cts_exact_time_256_t *p_cts_exact_time) +void cts_exact_time_get(cts_init_t *p_cts_exact_time) { - uint8_t ret; - ret = memcpy_s(p_cts_exact_time, sizeof(cts_exact_time_256_t), - &s_cts_env.cts_init.cur_time.day_date_time, sizeof(cts_exact_time_256_t)); - if (ret < 0) { - return; - } + memcpy(p_cts_exact_time, &s_cts_env.cts_init, sizeof(cts_init_t)); } -void cts_exact_time_update(cts_exact_time_256_t *p_cts_exact_time) +void cts_exact_time_update(cts_init_t *p_cts_exact_time) { - uint8_t ret; - ret = memcpy_s(&s_cts_env.cts_init.cur_time.day_date_time, sizeof(cts_exact_time_256_t), - p_cts_exact_time, sizeof(cts_exact_time_256_t)); - if (ret < 0) { - return; + p_cts_exact_time->cur_time.adjust_reason = s_cts_env.cts_init.cur_time.adjust_reason ; + memcpy(&s_cts_env.cts_init, p_cts_exact_time, sizeof(cts_init_t)); + memcpy(&s_cts_env.cts_init.ref_time_info,&s_cts_ref_info.ref_time_info, sizeof(cts_ref_time_info_t)); + + s_cts_updata.current_time_min = s_cts_env.cts_init.cur_time.day_date_time.date_time.min; + s_cts_updata.current_time_sec = s_cts_env.cts_init.cur_time.day_date_time.date_time.sec; + + if( s_cts_updata.current_time_min > s_cts_updata.expected_time_1min_adapt || + (s_cts_updata.current_time_min == s_cts_updata.expected_time_1min_adapt && s_cts_updata.current_time_sec > s_cts_updata.before_updata_sec) + ) + { + s_cts_updata.updata_time_flag =1; + s_cts_ref_info.ref_time_info.source = s_cts_updata.stage_update_source; + if(s_cts_updata.stage_update_source == 1) + { + s_cts_env.cts_init.cur_time.adjust_reason =2; + } + else if(s_cts_updata.stage_update_source == 4) + { + s_cts_env.cts_init.cur_time.adjust_reason =1; + } } + + else + { + s_cts_updata.updata_time_flag =0; + } + + cts_cur_time_send(0, &s_cts_env.cts_init.cur_time); } void cts_cur_time_adjust(cts_adj_info_t *p_adj_info) { - uint8_t ret; - if (CTS_AR_MAUAL_TIME_UPDATE & p_adj_info->adjust_reason) { - ret = memcpy_s(&s_cts_env.cts_init.cur_time.day_date_time, - &p_adj_info->day_date_time, sizeof(cts_exact_time_256_t)); - if (ret < 0) { - return; - } + if (CTS_AR_MAUAL_TIME_UPDATE & p_adj_info->adjust_reason) + { + memcpy(&s_cts_env.cts_init.cur_time.day_date_time, &p_adj_info->day_date_time, sizeof(cts_exact_time_256_t)); } - if (CTS_AR_EXT_REF_TIME_UPDATE & p_adj_info->adjust_reason) { - ret = memcpy_s(&s_cts_env.cts_init.ref_time_info, - &p_adj_info->ref_time_info, sizeof(cts_ref_time_info_t)); - if (ret < 0) { - return; - } + if (CTS_AR_EXT_REF_TIME_UPDATE & p_adj_info->adjust_reason) + { + memcpy(&s_cts_env.cts_init.ref_time_info, &p_adj_info->ref_time_info, sizeof(cts_ref_time_info_t)); } - if (CTS_AR_TIME_ZONE_CHANGE & p_adj_info->adjust_reason) { + if (CTS_AR_TIME_ZONE_CHANGE & p_adj_info->adjust_reason) + { s_cts_env.cts_init.loc_time_info.time_zone = p_adj_info->loc_time_info.time_zone; } - if (CTS_AR_DST_CHANGE & p_adj_info->adjust_reason) { + if (CTS_AR_DST_CHANGE & p_adj_info->adjust_reason) + { s_cts_env.cts_init.loc_time_info.dst_offset = p_adj_info->loc_time_info.dst_offset; } @@ -657,18 +549,292 @@ void cts_cur_time_adjust(cts_adj_info_t *p_adj_info) sdk_err_t cts_service_init(cts_init_t *p_cts_init) { - uint8_t ret; - if (p_cts_init == NULL) { + if (NULL == p_cts_init) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_cts_env, sizeof(s_cts_env), 0, sizeof(s_cts_env)); - if (ret < 0) { - return; - } - ret = memcpy_s(&s_cts_env.cts_init, sizeof(cts_init_t), p_cts_init, sizeof(cts_init_t)); - if (ret < 0) { - return; - } - return ble_server_prf_add(&cts_prf_info); + memset(&s_cts_env, 0, sizeof(s_cts_env)); + memcpy(&s_cts_env.cts_init, p_cts_init, sizeof(cts_init_t)); + + memset(&s_cts_env.cts_gatts_db, 0, sizeof(ble_gatts_create_db_t)); + + s_cts_env.start_hdl = PRF_INVALID_HANDLE; + s_cts_env.cts_gatts_db.shdl = &s_cts_env.start_hdl; + s_cts_env.cts_gatts_db.uuid = s_cts_svc_uuid; + s_cts_env.cts_gatts_db.attr_tab_cfg = (uint8_t *)&(s_cts_env.cts_init.char_mask); + s_cts_env.cts_gatts_db.max_nb_attr = CTS_IDX_NB; + s_cts_env.cts_gatts_db.srvc_perm = 0; + s_cts_env.cts_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_cts_env.cts_gatts_db.attr_tab.attr_tab_16 = cts_attr_tab; + + return ble_gatts_prf_add(&s_cts_env.cts_gatts_db, cts_ble_evt_handler); +} + +void cts_c_data_parse(uint8_t *p_data, uint16_t length) +{ + if (0 == memcmp(p_data, "RW:", 3)) + { + reference_time_encode(&p_data[3], length-3); + return; + } + + else if(0 == memcmp(p_data, "CW:", 3)) + { + current_time_encode(&p_data[3], length-3); + return; + } + + else if (0 == memcmp(p_data, "LW:", 3)) + { + local_time_encode(&p_data[3], length-3); + return; + } +} + +void reference_time_encode(uint8_t *p_data, uint16_t length) +{ + uint16_t data_length =0; + uint8_t time_param_check_idx = 0; + uint16_t time_param_check[CTS_SERIAL_NB] = {0}; + + while (data_length < length) + { + if (p_data[data_length] <= '9' && p_data[data_length] >= '0') + { + time_param_check[time_param_check_idx] = time_param_check[time_param_check_idx] * 10 + (p_data[data_length] - '0'); + } + else if ('-' == p_data[data_length]) + { + time_param_check_idx++; + } + + data_length++; + } + + if( 7>time_param_check[CTS_SERIAL_DATA_SOURCE] && + 255>time_param_check[CTS_SERIAL_DAY_SINCE] && + 24>time_param_check[CTS_SERIAL_HOURS_SINCE] && + 256>time_param_check[CTS_SERIAL_DATA_ACCURACY] + ) + { + s_cts_updata.stage_update_source = (cts_ref_time_source_t)time_param_check[CTS_SERIAL_DATA_SOURCE]; + s_cts_ref_info.ref_time_info.days_since_update = time_param_check[CTS_SERIAL_DAY_SINCE]; + s_cts_ref_info.ref_time_info.hours_since_update = time_param_check[CTS_SERIAL_HOURS_SINCE]; + s_cts_ref_info.ref_time_info.accuracy = time_param_check[CTS_SERIAL_DATA_ACCURACY]; + APP_LOG_INFO("SOURCE=%d ACCURACY=%d DAY_SINCE=%d HOURS_SINCE=%d",s_cts_ref_info.ref_time_info.source, + s_cts_ref_info.ref_time_info.accuracy , + s_cts_ref_info.ref_time_info.days_since_update, + s_cts_ref_info.ref_time_info.hours_since_update); + } + else + { + APP_LOG_INFO("Invalid set parameter."); + } + + if(s_cts_updata.stage_update_source != s_cts_env.cts_init.ref_time_info.source) + { + memcpy(&s_cts_record_time.cts_init.cur_time.day_date_time,&s_cts_env.cts_init.cur_time.day_date_time, sizeof(cts_cur_time_t)); + s_cts_updata.before_updata_sec = s_cts_record_time.cts_init.cur_time.day_date_time.date_time.sec; + s_cts_updata.expected_time_1min_adapt = s_cts_record_time.cts_init.cur_time.day_date_time.date_time.min + 1; + + if(s_cts_updata.expected_time_1min_adapt > 59) + { + s_cts_updata.expected_time_1min_adapt = 0 ; + } + } +} + +void local_time_encode(uint8_t *p_data, uint8_t length) +{ + ble_gatts_write_cfm_t *p_cfm; + cts_evt_t p_evt; + + p_evt.length = length; + p_evt.p_data = p_data; + p_evt.length = local_time_universal_decode(p_cfm,&p_evt); + + if(p_evt.length) + { + APP_LOG_DEBUG("UART Change Local Time value\n"); + p_evt.evt_type = CTS_EVT_LOC_TIME_INFO_SET_BY_PEER; + memcpy(&p_evt.loc_time_info,&s_cts_env.cts_init.loc_time_info, sizeof(cts_loc_time_info_t)); + s_cts_env.cts_init.evt_handler(&p_evt); + } +} + +void current_time_encode(uint8_t *p_data, uint16_t length) +{ + ble_gatts_write_cfm_t *p_cfm; + cts_evt_t p_evt; + + p_evt.length = length; + p_evt.p_data = p_data; + + if(s_cts_updata.updata_time_flag) + { + p_evt.length = current_time_universal_decode(p_cfm,&p_evt); + if(p_evt.length) + { + p_evt.evt_type = CTS_EVT_CUR_TIME_SET_BY_PEER; + p_evt.length = length; + memcpy(&p_evt.cur_time, &s_cts_env.cts_init.cur_time, sizeof(cts_cur_time_t)); + s_cts_env.cts_init.evt_handler(&p_evt); + } + + s_cts_updata.expected_time_1min_adapt = 0; + s_cts_updata.before_updata_sec = 0; + s_cts_record_time.cts_init.cur_time.day_date_time.date_time.min =0; + s_cts_record_time.cts_init.cur_time.day_date_time.date_time.sec =0; + } + + else + { + APP_LOG_INFO("It is not updated for more than 1 minute\n."); + APP_LOG_INFO("Updatable time minutes: %d seconds:= %d.",s_cts_updata.expected_time_1min_adapt,s_cts_updata.before_updata_sec); + } +} + +uint8_t current_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) +{ + uint16_t data_length =0; + uint8_t time_param_check_idx = 0; + uint16_t time_param_check[CTS_PEER_NB] = {0}; + + while (data_length < p_evt->length) + { + if (p_evt->p_data[data_length] <= '9' && p_evt->p_data[data_length] >= '0') + { + time_param_check[time_param_check_idx] = time_param_check[time_param_check_idx] * 10 + (p_evt->p_data[data_length] - '0'); + } + else if ('-' == p_evt->p_data[data_length]) + { + time_param_check_idx++; + } + + data_length++; + } + + if( CTS_TIME_YEAR_VALID_VAL_MIN=time_param_check[CTS_PEER_DATA_YEAR] && + 9>time_param_check[CTS_PEER_DATA_REASON] && + 32>time_param_check[CTS_PEER_DATA_DAY] && + 25>time_param_check[CTS_PEER_DATA_HOUR] && + 60>time_param_check[CTS_PEER_DATA_MIN] && + 60>time_param_check[CTS_PEER_DATA_SEC] && + 8>time_param_check[CTS_PEER_DATA_WEEK] && + 256>time_param_check[CTS_PEER_DATA_FRACTION] && + 13>time_param_check[CTS_PEER_DATA_MONTH] + ) + { + s_cts_env.cts_init.cur_time.adjust_reason = time_param_check[CTS_PEER_DATA_REASON]; + s_cts_env.cts_init.cur_time.day_date_time.day_of_week = time_param_check[CTS_PEER_DATA_WEEK]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.year = time_param_check[CTS_PEER_DATA_YEAR]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.month = time_param_check[CTS_PEER_DATA_MONTH]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.day = time_param_check[CTS_PEER_DATA_DAY]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.hour = time_param_check[CTS_PEER_DATA_HOUR]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.min = time_param_check[CTS_PEER_DATA_MIN]; + s_cts_env.cts_init.cur_time.day_date_time.date_time.sec = time_param_check[CTS_PEER_DATA_SEC]; + s_cts_env.cts_init.cur_time.day_date_time.fractions_256 = time_param_check[CTS_PEER_DATA_FRACTION]; + } + else + { + APP_LOG_INFO("Invalid set parameter."); + p_cfm->status = CTS_ERROR_FIELDS_IGNORED; + p_evt->length = 0; + } + return p_evt->length; +} + +uint8_t local_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) +{ + uint16_t data_length =0; + uint8_t time_param_check_idx = 0; + int16_t time_param_check[CTS_HOST_NB] = {0}; + uint8_t flag=0; //Determine if the start bit is - + uint8_t zone_set_same=1; //Determines whether the time zone entered is the same + + while (data_length < p_evt->length) + { + if (p_evt->p_data[data_length] <= '9' && p_evt->p_data[data_length] >= '0') + { + time_param_check[time_param_check_idx] = time_param_check[time_param_check_idx] * 10 + (p_evt->p_data[data_length] - '0'); + } + else if ('-' == p_evt->p_data[data_length] ) + { + if (!data_length) + { + flag=1; + } + else + { + time_param_check_idx++; + if(flag) + time_param_check[CTS_HOST_DATA_ZONE] = -time_param_check[CTS_HOST_DATA_ZONE]; + } + } + + data_length++; + } + + if(s_cts_env.cts_init.loc_time_info.time_zone != time_param_check[CTS_HOST_DATA_ZONE]) + { + s_cts_env.cts_init.cur_time.adjust_reason =4; + } + + if(s_cts_env.cts_init.loc_time_info.time_zone == (int16_t)time_param_check[CTS_HOST_DATA_ZONE] && + s_cts_env.cts_init.loc_time_info.dst_offset == (cts_dst_offset_t)time_param_check[CTS_HOST_DATA_OFFST] + ) + { + zone_set_same = 0; + APP_LOG_INFO("Enter the same time zone."); + } + + if(time_param_check[CTS_HOST_DATA_ZONE]== -128 ) + { + s_cts_env.cts_init.loc_time_info.time_zone = time_param_check[CTS_HOST_DATA_ZONE]; + } + + else if( CTS_TIME_ZONE_OFFSET_MIN <= (int16_t)time_param_check[CTS_HOST_DATA_ZONE] && + CTS_TIME_ZONE_OFFSET_MAX >= (int16_t)time_param_check[CTS_HOST_DATA_ZONE] && + zone_set_same + ) + { + s_cts_env.cts_init.loc_time_info.time_zone = time_param_check[CTS_HOST_DATA_ZONE]; + } + + else + { + APP_LOG_INFO("Invalid set parameter."); + p_cfm->status = CTS_ERROR_FIELDS_IGNORED; + p_evt->length = 0 ; + } + + if(s_cts_env.cts_init.loc_time_info.dst_offset != (cts_dst_offset_t)time_param_check[CTS_HOST_DATA_OFFST]) + { + s_cts_env.cts_init.cur_time.adjust_reason =8; + } + + if( time_param_check[CTS_HOST_DATA_OFFST] == 255 ) + { + s_cts_env.cts_init.loc_time_info.dst_offset = (cts_dst_offset_t)time_param_check[CTS_HOST_DATA_OFFST]; + } + + else if( CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME >= (cts_dst_offset_t)time_param_check[CTS_HOST_DATA_OFFST] && + time_param_check[CTS_HOST_DATA_OFFST]%2 ==0 && + time_param_check[CTS_HOST_DATA_OFFST] != 6 && + zone_set_same + ) + { + s_cts_env.cts_init.loc_time_info.dst_offset = (cts_dst_offset_t)time_param_check[CTS_HOST_DATA_OFFST]; + } + + else + { + APP_LOG_INFO("Invalid set parameter\r\n."); + p_cfm->status = CTS_ERROR_FIELDS_IGNORED; + p_evt->length = 0 ; + } + + return p_evt->length; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.h index dccc5cb..ecb2c3a 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts/cts.h @@ -57,28 +57,29 @@ #ifndef __CTS_H__ #define __CTS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup CTS_MACRO Defines * @{ */ -#define CTS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of CTS connections. */ -#define CTS_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */ -#define CTS_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */ -#define CTS_REF_TIME_INFO_VAL_LEN 4 /**< Length of reference time information value. */ -#define CTS_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */ -#define CTS_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */ -#define CTS_TIME_ZONE_OFFSET_MIN (-48) /**< Minimum Value of Offset from UTC. */ -#define CTS_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */ -#define CTS_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */ -#define CTS_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */ -#define CTS_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */ +#define CTS_CONNECTION_MAX 10 /**< Maximum number of CTS connections. */ +#define CTS_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */ +#define TOTAL_CTS_CUR_TIME_VAL_LEN 27 /**< TOTAL length of current time value. */ +#define CTS_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */ +#define TOTAL_CTS_LOC_TIME_INFO_VAL_LEN 6 /**< TOTAL length local time information value. */ +#define CTS_REF_TIME_INFO_VAL_LEN 4 /**< Length of reference time information value. */ +#define CTS_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */ +#define CTS_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */ +#define CTS_TIME_ZONE_OFFSET_MIN -48 /**< Minimum Value of Offset from UTC. */ +#define CTS_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */ +#define CTS_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */ +#define CTS_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */ +#define CTS_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */ /** * @defgroup CTS_CHAR_MASK Characteristics Mask @@ -86,10 +87,8 @@ * @brief Bit masks for the initialization of \ref cts_init_t.char_mask. */ #define CTS_CHAR_MANDATORY 0x0f /**< Bit mask for mandatory characteristic in CTS. */ -#define CTS_CHAR_LOC_TIME_INFO_SUP 0x30 /**< Bit mask for Local Time Information characteristic \ - that is optional. */ -#define CTS_CHAR_REF_TIME_INFO_SUP 0xc0 /**< Bit mask for Reference Time Information characteristic \ - that is optional. */ +#define CTS_CHAR_LOC_TIME_INFO_SUP 0x30 /**< Bit mask for Local Time Information characteristic that is optional. */ +#define CTS_CHAR_REF_TIME_INFO_SUP 0xc0 /**< Bit mask for Reference Time Information characteristic that is optional. */ #define CTS_CHAR_FULL 0xff /**< Bit mask of the full characteristic. */ /** @} */ @@ -103,16 +102,17 @@ #define CTS_AR_EXT_REF_TIME_UPDATE (0x01 << 1) /**< External reference time update. */ #define CTS_AR_TIME_ZONE_CHANGE (0x01 << 2) /**< Change of time zone. */ #define CTS_AR_DST_CHANGE (0x01 << 3) /**< Change of DST (daylight savings time). */ -/** @} */ -/** @} */ +/** @} */ +/** @} */ /** * @defgroup CTS_ENUM Enumerations * @{ */ /**@brief Current Time Day of week. */ -typedef enum { +typedef enum +{ CTS_WEEK_UNKNOWN_DAY, /**< Day of week is not known. */ CTS_WEEK_MONDAY, /**< Monday. */ CTS_WEEK_TUSEDAY, /**< Tuesday. */ @@ -124,15 +124,18 @@ typedef enum { } cts_week_day_t; /**@brief Local time information:Daylight Saving Time Offset. */ -typedef enum { +typedef enum +{ CTS_DST_OFFSET_STANDAR_TIME = 0x00, /**< Standard Time. */ CTS_DST_OFFSET_HALF_HOUR = 0x02, /**< Half An Hour Daylight Time (+0.5h). */ CTS_DST_OFFSET_DAYLIGHT_TIME = 0x04, /**< Daylight Time (+1h). */ CTS_DST_OFFSET_DOUB_DAYLIGHT_TIME = 0x08, /**< Double Daylight Time (+2h). */ + CTS_DST_OFFSET_DOUB_UNKNOWED_TIME = 0xff, /**< Unknown time. */ } cts_dst_offset_t; /**@brief Reference time information:Time Source. */ -typedef enum { +typedef enum +{ CTS_REF_TIME_SRC_UNKNOWN, /**< Unknown. */ CTS_REF_TIME_SRC_NET_TIME_PROTOCOL, /**< Network Time Protocol. */ CTS_REF_TIME_SRC_GPS, /**< GPS. */ @@ -143,7 +146,8 @@ typedef enum { } cts_ref_time_source_t; /**@brief Current Time Service event type. */ -typedef enum { +typedef enum +{ CTS_EVT_INVALID = 0x00, /**< Invalid event. */ CTS_EVT_CUR_TIME_NOTIFICATION_ENABLED, /**< Current Time Notification is enabled. */ CTS_EVT_CUR_TIME_NOTIFICATION_DISABLED, /**< Current Time Notification is disabled. */ @@ -157,34 +161,50 @@ typedef enum { * @{ */ /**@brief CTS Exact Time 256. */ -typedef struct { +typedef struct +{ prf_date_time_t date_time; /**< Date Time. */ uint8_t day_of_week; /**< Day of Week. */ uint8_t fractions_256; /**< 1/256th of a second. */ } cts_exact_time_256_t; /**@brief CTS Current Time value. */ -typedef struct { +typedef struct +{ cts_exact_time_256_t day_date_time; /**< Exact Time 256. */ uint8_t adjust_reason; /**< Adjust Reason. */ } cts_cur_time_t; /**@brief CTS Local Time Information. */ -typedef struct { - int8_t time_zone; /**< Time Zone, Offset from UTC in number of 15-minute increments. */ +typedef struct +{ + int16_t time_zone; /**< Time Zone, Offset from UTC in number of 15-minute increments. */ cts_dst_offset_t dst_offset; /**< Daylight Saving Time Offset. */ } cts_loc_time_info_t; /**@brief CTS Reference Time Information. */ -typedef struct { +typedef struct +{ cts_ref_time_source_t source; /**< Time Source. */ uint8_t accuracy; /**< Accuracy of time information. */ uint8_t days_since_update; /**< Days Since Update. */ uint8_t hours_since_update; /**< Hours Since Update. */ } cts_ref_time_info_t; +/**@brief CTS Reference Time Updata Information. */ +typedef struct +{ + uint8_t before_updata_sec ; /**< The second before the update. */ + uint8_t current_time_min; /**< Minutes of the current time. */ + uint8_t current_time_sec; /**< The second of the current time. */ + uint8_t expected_time_1min_adapt; /**< Minutes of the expected update time. */ + cts_ref_time_source_t stage_update_source; /**< Minutes of the expected update time. */ + uint8_t updata_time_flag; /**< 1 minute time flag bit. */ +} cts_updata_ref_time_info_t; + /**@brief CTS Adjust information. */ -typedef struct { +typedef struct +{ uint8_t adjust_reason; /**< Adjust Reason. */ cts_exact_time_256_t day_date_time; /**< Exact Time 256. */ cts_loc_time_info_t loc_time_info; /**< Local Time information. */ @@ -192,7 +212,8 @@ typedef struct { } cts_adj_info_t; /**@brief Current Time Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ cts_evt_type_t evt_type; /**< The CTS event type. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -214,12 +235,11 @@ typedef void (*cts_evt_handler_t)(cts_evt_t *p_evt); * @defgroup CTS_STRUCT Structures * @{ */ -/**@brief Current Time Service init structure. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Current Time Service init structure. This contains all option and data needed for initialization of the service. */ +typedef struct +{ cts_evt_handler_t evt_handler; /**< Current Time Service event handler. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref CTS_CHAR_MASK. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref CTS_CHAR_MASK. */ cts_cur_time_t cur_time; /**< Current Time. */ cts_loc_time_info_t loc_time_info; /**< Local Time information. */ cts_ref_time_info_t ref_time_info; /**< Reference Time information. */ @@ -245,19 +265,19 @@ sdk_err_t cts_service_init(cts_init_t *p_cts_init); ***************************************************************************************** * @brief Get exact time for user. * - * @param[out] p_cts_exact_time: Pointer to exact time. + * @param[out] p_exact_time: Pointer to exact time. ***************************************************************************************** */ -void cts_exact_time_get(cts_exact_time_256_t *p_cts_exact_time); +void cts_exact_time_get(cts_init_t *p_exact_time); /** ***************************************************************************************** * @brief Update exact time. * - * @param[in] p_exact_time: Pointer to exact time. + * @param[in] p_cts_exact_time: Pointer to exact time. ***************************************************************************************** */ -void cts_exact_time_update(cts_exact_time_256_t *p_cts_exact_time); +void cts_exact_time_update(cts_init_t *p_cts_exact_time) ; /** ***************************************************************************************** @@ -281,6 +301,70 @@ void cts_cur_time_adjust(cts_adj_info_t *p_adj_info); sdk_err_t cts_cur_time_send(uint8_t conn_idx, cts_cur_time_t *p_cur_time); /** @} */ +/** + ***************************************************************************************** + * @brief Data accepts data and processing functions. + * + * @param[in] p_data: Serial port data. + * @param[in] length: Data length. + ***************************************************************************************** + */ +void cts_c_data_parse(uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Serial port data is converted into reference time. + * + * @param[in] p_data: Serial port data. + * @param[in] length: Data length. + ***************************************************************************************** + */ +void reference_time_encode(uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Serial port data is converted into local time. + * + * @param[in] p_data: Serial port data. + * @param[in] length: Data length. + ***************************************************************************************** + */ +void local_time_encode(uint8_t *p_data, uint8_t length); + +/** + ***************************************************************************************** + * @brief Serial port data is converted into current time. + * + * @param[in] p_data: Serial port data. + * @param[in] length: Data length. + ***************************************************************************************** + */ +void current_time_encode(uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Handle Local Time Information conversion. + * + * @param[in] p_cfm: Pointer to GATT write attribute result description. + * @param[in] p_evt: Pointer to CTS event. + * + * @return Result of data lenth. + ***************************************************************************************** + */ +uint8_t local_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt) ; + +/** + ***************************************************************************************** + * @brief Decode for a Current Time. + * + * @param[in] p_cfm: Pointer to GATT write attribute result description. + * @param[in] p_evt: Pointer to CTS event. + * + * @return Result of data lenth. + ***************************************************************************************** + */ +uint8_t current_time_universal_decode(ble_gatts_write_cfm_t *p_cfm, cts_evt_t *p_evt); + #endif /** @} */ /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/BUILD.gn new file mode 100644 index 0000000..0c895c8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("cts_c") { + sources = [ "cts_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.c index 134024d..e3a6b77 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.c @@ -39,72 +39,33 @@ * INCLUDE FILES **************************************************************************************** */ -#include +#include "cts_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "cts_c.h" -#define OFFSET_1 1 -#define OFFSET_2 2 -#define OFFSET_3 3 -#define OFFSET_7 7 -#define OFFSET_8 8 -#define OFFSET_9 9 -#define OFFSET_12 12 -#define OFFSET_31 31 -#define OFFSET_23 23 -#define OFFSET_59 59 -#define ATTR_VALUE_LEN 2 +#include +#include "app_log.h" + /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Current Time Service Client environment variable. */ -struct cts_c_env_t { +struct cts_c_env_t +{ cts_c_handles_t handles; /**< Handles of CTS characteristics which will be got for peer. */ cts_c_evt_handler_t evt_handler; /**< Handler of CTS Client event */ uint8_t prf_id; /**< CTS Client profile id. */ }; - -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void cts_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void cts_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void cts_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void cts_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct cts_c_env_t s_cts_c_env; /**< Current Time Service Client environment variable. */ - -/**@brief Current Time Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t cts_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Current Time Service GATT Client Callbacks. */ -static gattc_prf_cbs_t cts_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - cts_c_att_read_cb, - cts_c_att_write_cb, - cts_c_att_ntf_ind_cb, - cts_c_srvc_browse_cb, - NULL, -}; - -/**@brief Current Time Service Client Information. */ -static const prf_client_info_t cts_c_prf_info = { - .max_connection_nb = CTS_C_CONNECTION_MAX, - .manager_cbs = &cts_c_mgr_cbs, - .gattc_prf_cbs = &cts_c_gattc_cbs +static struct cts_c_env_t s_cts_c_env; /**< Current Time Service Client environment variable. */ +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_CURRENT_TIME), HI_U16(BLE_ATT_SVC_CURRENT_TIME)}; +static ble_uuid_t s_cts_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -120,7 +81,8 @@ static const prf_client_info_t cts_c_prf_info = { */ static void cts_c_evt_handler_excute(cts_c_evt_t *p_evt) { - if (s_cts_c_env.evt_handler != NULL && CTS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_cts_c_env.evt_handler && CTS_C_EVT_INVALID != p_evt->evt_type) + { s_cts_c_env.evt_handler(p_evt); } } @@ -137,9 +99,9 @@ static void cts_c_cur_time_encode(const cts_c_cur_time_t *p_cur_time, uint8_t *p { prf_pack_date_time(p_encoded_data, &p_cur_time->day_date_time.date_time); - p_encoded_data[OFFSET_7] = p_cur_time->day_date_time.day_of_week; - p_encoded_data[OFFSET_8] = p_cur_time->day_date_time.fractions_256; - p_encoded_data[OFFSET_9] = p_cur_time->adjust_reason; + p_encoded_data[7] = p_cur_time->day_date_time.day_of_week; + p_encoded_data[8] = p_cur_time->day_date_time.fractions_256; + p_encoded_data[9] = p_cur_time->adjust_reason; } /** @@ -154,9 +116,9 @@ static void cts_c_cur_time_decode(const uint8_t *p_data, cts_c_cur_time_t *p_cur { prf_unpack_date_time(p_data, &p_cur_time->day_date_time.date_time); - p_cur_time->day_date_time.day_of_week = p_data[OFFSET_7]; - p_cur_time->day_date_time.fractions_256 = p_data[OFFSET_8]; - p_cur_time->adjust_reason = p_data[OFFSET_9]; + p_cur_time->day_date_time.day_of_week = p_data[7]; + p_cur_time->day_date_time.fractions_256 = p_data[8]; + p_cur_time->adjust_reason = p_data[9]; } /** @@ -170,9 +132,9 @@ static void cts_c_cur_time_decode(const uint8_t *p_data, cts_c_cur_time_t *p_cur static void cts_c_ref_time_info_decode(const uint8_t *p_data, cts_c_ref_time_info_t *p_ref_time_info) { p_ref_time_info->source = (cts_c_ref_time_source_t)p_data[0]; - p_ref_time_info->accuracy = p_data[OFFSET_1]; - p_ref_time_info->days_since_update = p_data[OFFSET_2]; - p_ref_time_info->hours_since_update = p_data[OFFSET_3]; + p_ref_time_info->accuracy = p_data[1]; + p_ref_time_info->days_since_update = p_data[2]; + p_ref_time_info->hours_since_update = p_data[3]; } /** @@ -185,36 +147,44 @@ static void cts_c_ref_time_info_decode(const uint8_t *p_data, cts_c_ref_time_inf static bool cts_c_cur_time_valid_check(cts_c_cur_time_t *p_cur_time) { if ((p_cur_time->day_date_time.date_time.year > CTS_C_TIME_YEAR_VALID_VAL_MAX) || \ - ((p_cur_time->day_date_time.date_time.year < CTS_C_TIME_YEAR_VALID_VAL_MIN) && \ - (CTS_C_TIME_Y_M_D_UNKNOWN != p_cur_time->day_date_time.date_time.year))) { + ((p_cur_time->day_date_time.date_time.year < CTS_C_TIME_YEAR_VALID_VAL_MIN) && \ + (CTS_C_TIME_Y_M_D_UNKNOWN != p_cur_time->day_date_time.date_time.year))) + { return false; } - if (p_cur_time->day_date_time.date_time.month > OFFSET_12) { + if (p_cur_time->day_date_time.date_time.month > 12) + { return false; } - if (p_cur_time->day_date_time.date_time.day > OFFSET_31) { + if (p_cur_time->day_date_time.date_time.day > 31) + { return false; } - if (p_cur_time->day_date_time.date_time.hour > OFFSET_23) { + if (p_cur_time->day_date_time.date_time.hour > 23) + { return false; } - if (p_cur_time->day_date_time.date_time.min > OFFSET_59) { + if (p_cur_time->day_date_time.date_time.min > 59) + { return false; } - if (p_cur_time->day_date_time.date_time.sec > OFFSET_59) { + if (p_cur_time->day_date_time.date_time.sec > 59) + { return false; } - if (p_cur_time->day_date_time.day_of_week > CTS_C_WEEK_SUNDAY) { + if (p_cur_time->day_date_time.day_of_week > CTS_C_WEEK_SUNDAY) + { return false; } - if (p_cur_time->adjust_reason > 0x0f) { + if (p_cur_time->adjust_reason > 0x0f) + { return false; } return true; @@ -230,14 +200,16 @@ static bool cts_c_cur_time_valid_check(cts_c_cur_time_t *p_cur_time) static bool cts_c_loc_time_info_valid_check(cts_c_loc_time_info_t *p_loc_time_info) { if ((p_loc_time_info->time_zone < CTS_C_TIME_ZONE_OFFSET_MIN) || \ - (p_loc_time_info->time_zone > CTS_C_TIME_ZONE_OFFSET_MAX)) { + (p_loc_time_info->time_zone > CTS_C_TIME_ZONE_OFFSET_MAX)) + { return false; } if ((CTS_C_DST_OFFSET_STANDAR_TIME != p_loc_time_info->dst_offset) && \ (CTS_C_DST_OFFSET_HALF_HOUR != p_loc_time_info->dst_offset) && \ (CTS_C_DST_OFFSET_DAYLIGHT_TIME != p_loc_time_info->dst_offset) && \ - (CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME != p_loc_time_info->dst_offset)) { + (CTS_C_DST_OFFSET_DOUB_DAYLIGHT_TIME != p_loc_time_info->dst_offset)) + { return false; } @@ -253,7 +225,8 @@ static bool cts_c_loc_time_info_valid_check(cts_c_loc_time_info_t *p_loc_time_in */ static bool cts_c_ref_time_info_valid_check(cts_c_ref_time_info_t *p_ref_time_info) { - if (p_ref_time_info->source > CTS_C_REF_TIME_SRC_CELLUAR_NET) { + if (p_ref_time_info->source > CTS_C_REF_TIME_SRC_CELLUAR_NET) + { return false; } @@ -269,40 +242,55 @@ static bool cts_c_ref_time_info_valid_check(cts_c_ref_time_info_t *p_ref_time_in * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void cts_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void cts_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { cts_c_evt_t cts_c_evt; cts_c_evt.conn_idx = conn_idx; cts_c_evt.evt_type = CTS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_cts_c_env.handles.cts_cur_time_handle) { - cts_c_cur_time_decode(p_read_rsp->vals[0].p_value, &cts_c_evt.value.cur_time); + if (p_read_rsp->value[0].handle == s_cts_c_env.handles.cts_cur_time_handle) + { + cts_c_cur_time_decode(p_read_rsp->value[0].p_value, &cts_c_evt.value.cur_time); - if (cts_c_cur_time_valid_check(&cts_c_evt.value.cur_time)) { + if (cts_c_cur_time_valid_check(&cts_c_evt.value.cur_time)) + { cts_c_evt.evt_type = CTS_C_EVT_VALID_CUR_TIME_REC; - } else { + } + else + { cts_c_evt.evt_type = CTS_C_EVT_INVALID_CUR_TIME_REC; } - } else if (p_read_rsp->vals[0].handle == s_cts_c_env.handles.cts_loc_time_info_handle) { - cts_c_evt.value.loc_time_info.time_zone = p_read_rsp->vals[0].p_value[0]; - cts_c_evt.value.loc_time_info.dst_offset = (cts_c_dst_offset_t)p_read_rsp->vals[0].p_value[1]; + } + else if (p_read_rsp->value[0].handle == s_cts_c_env.handles.cts_loc_time_info_handle) + { + cts_c_evt.value.loc_time_info.time_zone = p_read_rsp->value[0].p_value[0]; + cts_c_evt.value.loc_time_info.dst_offset = (cts_c_dst_offset_t)p_read_rsp->value[0].p_value[1]; - if (cts_c_loc_time_info_valid_check(&cts_c_evt.value.loc_time_info)) { + if (cts_c_loc_time_info_valid_check(&cts_c_evt.value.loc_time_info)) + { cts_c_evt.evt_type = CTS_C_EVT_VALID_LOC_TIME_INFO_REC; - } else { + } + else + { cts_c_evt.evt_type = CTS_C_EVT_INVALID_LOC_TIME_INFO_REC; } - } else if (p_read_rsp->vals[0].handle == s_cts_c_env.handles.cts_ref_time_info_handle) { - cts_c_ref_time_info_decode(p_read_rsp->vals[0].p_value, &cts_c_evt.value.ref_time_info); + } + else if (p_read_rsp->value[0].handle == s_cts_c_env.handles.cts_ref_time_info_handle) + { + cts_c_ref_time_info_decode(p_read_rsp->value[0].p_value, &cts_c_evt.value.ref_time_info); - if (cts_c_ref_time_info_valid_check(&cts_c_evt.value.ref_time_info)) { + if (cts_c_ref_time_info_valid_check(&cts_c_evt.value.ref_time_info)) + { cts_c_evt.evt_type = CTS_C_EVT_VALID_REF_TIME_INFO_REC; - } else { + } + else + { cts_c_evt.evt_type = CTS_C_EVT_INVALID_REF_TIME_INFO_REC; } } @@ -319,25 +307,30 @@ static void cts_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void cts_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void cts_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { cts_c_evt_t cts_c_evt; cts_c_evt.conn_idx = conn_idx; cts_c_evt.evt_type = CTS_C_EVT_INVALID; - if (handle == s_cts_c_env.handles.cts_cur_time_cccd_handle) { + if (handle == s_cts_c_env.handles.cts_cur_time_cccd_handle) + { cts_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS : - CTS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_cts_c_env.handles.cts_cur_time_handle) { + CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS : + CTS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_cts_c_env.handles.cts_cur_time_handle) + { cts_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - CTS_C_EVT_CUR_TIME_SET_SUCCESS : - CTS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_cts_c_env.handles.cts_loc_time_info_handle) { + CTS_C_EVT_CUR_TIME_SET_SUCCESS : + CTS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_cts_c_env.handles.cts_loc_time_info_handle) + { cts_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS : - CTS_C_EVT_WRITE_OP_ERR; + CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS : + CTS_C_EVT_WRITE_OP_ERR; } cts_c_evt_handler_excute(&cts_c_evt); @@ -352,19 +345,23 @@ static void cts_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void cts_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void cts_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { cts_c_evt_t cts_c_evt; cts_c_evt.conn_idx = conn_idx; cts_c_evt.evt_type = CTS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_cts_c_env.handles.cts_cur_time_handle) { + if (p_ntf_ind->handle == s_cts_c_env.handles.cts_cur_time_handle) + { cts_c_cur_time_decode(p_ntf_ind->p_value, &cts_c_evt.value.cur_time); - if (cts_c_cur_time_valid_check(&cts_c_evt.value.cur_time)) { + if (cts_c_cur_time_valid_check(&cts_c_evt.value.cur_time)) + { cts_c_evt.evt_type = CTS_C_EVT_VALID_CUR_TIME_REC; - } else { + } + else + { cts_c_evt.evt_type = CTS_C_EVT_INVALID_CUR_TIME_REC; } } @@ -381,7 +378,7 @@ static void cts_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void cts_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void cts_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { cts_c_evt_t cts_c_evt; uint16_t uuid_disc; @@ -390,43 +387,79 @@ static void cts_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat cts_c_evt.conn_idx = conn_idx; cts_c_evt.evt_type = CTS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_CURRENT_TIME == uuid_disc) { - s_cts_c_env.handles.cts_srvc_start_handle = p_browse_srvc->start_hdl; - s_cts_c_env.handles.cts_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_CURRENT_TIME == uuid_disc) + { + s_cts_c_env.handles.cts_srvc_start_handle = p_browse_srvc->start_hdl; + s_cts_c_env.handles.cts_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_CT_TIME == uuid_disc) { - s_cts_c_env.handles.cts_cur_time_handle = handle_disc; - s_cts_c_env.handles.cts_cur_time_cccd_handle = handle_disc + 1; - } else if (BLE_ATT_CHAR_LOCAL_TIME_INFO == uuid_disc) { - s_cts_c_env.handles.cts_loc_time_info_handle = handle_disc; - } else if (BLE_ATT_CHAR_REFERENCE_TIME_INFO == uuid_disc) { - s_cts_c_env.handles.cts_ref_time_info_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_CT_TIME == uuid_disc) + { + s_cts_c_env.handles.cts_cur_time_handle = handle_disc; + s_cts_c_env.handles.cts_cur_time_cccd_handle = handle_disc + 1; + } + else if (BLE_ATT_CHAR_LOCAL_TIME_INFO == uuid_disc) + { + s_cts_c_env.handles.cts_loc_time_info_handle = handle_disc; + } + else if (BLE_ATT_CHAR_REFERENCE_TIME_INFO == uuid_disc) + { + s_cts_c_env.handles.cts_ref_time_info_handle = handle_disc; + } + } + else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; } - } else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; } + + cts_c_evt.evt_type = CTS_C_EVT_DISCOVERY_COMPLETE; } - - cts_c_evt.evt_type = CTS_C_EVT_DISCOVERY_COMPLETE; } - cts_c_evt_handler_excute(&cts_c_evt); } +static void cts_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + cts_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + cts_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + cts_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + cts_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} /* * GLOBAL FUNCTION DEFINITIONS @@ -434,18 +467,15 @@ static void cts_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat */ sdk_err_t cts_client_init(cts_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_cts_c_env, sizeof(s_cts_c_env), 0, sizeof(s_cts_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_cts_c_env, 0, sizeof(s_cts_c_env)); s_cts_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&cts_c_prf_info, &s_cts_c_env.prf_id); + return ble_gattc_prf_add(&s_cts_service_uuid, cts_c_ble_evt_handler); } sdk_err_t cts_c_disc_srvc_start(uint8_t conn_idx) @@ -455,93 +485,113 @@ sdk_err_t cts_c_disc_srvc_start(uint8_t conn_idx) target_uuid[0] = LO_U16(BLE_ATT_SVC_CURRENT_TIME); target_uuid[1] = HI_U16(BLE_ATT_SVC_CURRENT_TIME); - const ble_uuid_t cts_service_uuid = { + const ble_uuid_t cts_service_uuid = + { .uuid_len = 2, .uuid = target_uuid, }; - return ble_gattc_prf_services_browse(s_cts_c_env.prf_id, conn_idx, &cts_service_uuid); + return ble_gattc_services_browse(conn_idx, &cts_service_uuid); } sdk_err_t cts_c_cur_time_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_cts_c_env.handles.cts_cur_time_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_cts_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_cts_c_env.handles.cts_cur_time_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t cts_c_cur_time_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_cts_c_env.prf_id, conn_idx, s_cts_c_env.handles.cts_cur_time_handle, 0); + return ble_gattc_read(conn_idx, s_cts_c_env.handles.cts_cur_time_handle, 0); } sdk_err_t cts_c_loc_time_info_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_loc_time_info_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_loc_time_info_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_cts_c_env.prf_id, conn_idx, s_cts_c_env.handles.cts_loc_time_info_handle, 0); + return ble_gattc_read(conn_idx, s_cts_c_env.handles.cts_loc_time_info_handle, 0); } sdk_err_t cts_c_ref_time_info_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_ref_time_info_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_ref_time_info_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_cts_c_env.prf_id, conn_idx, s_cts_c_env.handles.cts_ref_time_info_handle, 0); + return ble_gattc_read(conn_idx, s_cts_c_env.handles.cts_ref_time_info_handle, 0); } sdk_err_t cts_c_cur_time_set(uint8_t conn_idx, cts_c_cur_time_t *p_cur_time) { - gattc_write_attr_value_t write_attr_value; uint8_t encoded_buffer[CTS_C_CUR_TIME_VAL_LEN]; - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_cur_time_handle) + { return SDK_ERR_INVALID_HANDLE; } cts_c_cur_time_encode(p_cur_time, encoded_buffer); - write_attr_value.handle = s_cts_c_env.handles.cts_cur_time_handle; - write_attr_value.offset = 0; - write_attr_value.length = CTS_C_CUR_TIME_VAL_LEN; - write_attr_value.p_value = encoded_buffer; - - return ble_gattc_prf_write(s_cts_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_cts_c_env.handles.cts_cur_time_handle, 0, CTS_C_CUR_TIME_VAL_LEN, (uint8_t *)&encoded_buffer); } sdk_err_t cts_c_loc_time_info_set(uint8_t conn_idx, cts_c_loc_time_info_t *p_loc_time_info) { - gattc_write_attr_value_t write_attr_value; uint8_t encoded_buffer[CTS_C_LOC_TIME_INFO_VAL_LEN]; - if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_loc_time_info_handle) { + if (BLE_ATT_INVALID_HDL == s_cts_c_env.handles.cts_loc_time_info_handle) + { return SDK_ERR_INVALID_HANDLE; } encoded_buffer[0] = p_loc_time_info->time_zone; encoded_buffer[1] = p_loc_time_info->dst_offset; - write_attr_value.handle = s_cts_c_env.handles.cts_loc_time_info_handle; - write_attr_value.offset = 0; - write_attr_value.length = CTS_C_LOC_TIME_INFO_VAL_LEN; - write_attr_value.p_value = encoded_buffer; - - return ble_gattc_prf_write(s_cts_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_cts_c_env.handles.cts_loc_time_info_handle, 0, CTS_C_LOC_TIME_INFO_VAL_LEN, encoded_buffer); } + +void cts_c_data_parse(uint8_t *p_data, uint16_t length) +{ + if(0 == memcmp(p_data, "CR", 2)) + { + APP_LOG_DEBUG("Read Current Time value."); + cts_c_cur_time_read(0); + } + else if(0 == memcmp(p_data, "LR", 2)) + { + APP_LOG_DEBUG("Read Local Time Information value."); + cts_c_loc_time_info_read(0); + } + else if(0 == memcmp(p_data, "RR", 2)) + { + APP_LOG_DEBUG("Read Reference Time Information value."); + cts_c_ref_time_info_read(0); + } + else if(0 == memcmp(p_data, "EN", 2)) + { + APP_LOG_INFO("Enabled Current Time Notification."); + cts_c_cur_time_notify_set(0, true); + + } + else if(0 == memcmp(p_data, "DN", 2)) + { + APP_LOG_INFO("Disabled Current Time Notification."); + cts_c_cur_time_notify_set(0, false); + } +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.h index 7b1586c..2fc6946 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/cts_c/cts_c.h @@ -59,29 +59,27 @@ #ifndef __CTS_C_H__ #define __CTS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup CTS_C_MACRO Defines * @{ */ -#define CTS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */ - -#define CTS_C_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */ -#define CTS_C_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */ -#define CTS_C_TIME_Y_M_D_UNKNOWN 0 /**< Year or Month or Day is not known. */ -#define CTS_C_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */ -#define CTS_C_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */ -#define CTS_C_TIME_ZONE_OFFSET_MIN (-48) /**< Minimum Value of Offset from UTC. */ -#define CTS_C_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */ -#define CTS_C_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */ -#define CTS_C_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */ -#define CTS_C_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */ +#define CTS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ +#define CTS_C_CUR_TIME_VAL_LEN 10 /**< Length of current time value. */ +#define CTS_C_LOC_TIME_INFO_VAL_LEN 2 /**< Length of local time information value. */ +#define CTS_C_TIME_Y_M_D_UNKNOWN 0 /**< Year or Month or Day is not known. */ +#define CTS_C_TIME_YEAR_VALID_VAL_MIN 1582 /**< Minimum value of valid year. */ +#define CTS_C_TIME_YEAR_VALID_VAL_MAX 9999 /**< Maximum value of valid year. */ +#define CTS_C_TIME_ZONE_OFFSET_MIN -48 /**< Minimum Value of Offset from UTC. */ +#define CTS_C_TIME_ZONE_OFFSET_MAX 56 /**< Maximum Value of Offset from UTC. */ +#define CTS_C_TIME_ACCURACY_OUT_RANGE 254 /**< Accuracy out of range. */ +#define CTS_C_TIME_ACCURACT_UNKNOWN 255 /**< Accuracy Unknown. */ +#define CTS_C_ERROR_FIELDS_IGNORED 0x80 /**< The server ignored one or more fields. */ /** * @defgroup CTS_C_ADJ_REASON Current Time Adjust Reason @@ -101,7 +99,8 @@ * @{ */ /**@brief Current Time Day of week. */ -typedef enum { +typedef enum +{ CTS_C_WEEK_UNKNOWN_DAY, /**< Day of week is not known. */ CTS_C_WEEK_MONDAY, /**< Monday. */ CTS_C_WEEK_TUSEDAY, /**< Tuesday. */ @@ -113,7 +112,8 @@ typedef enum { } cts_c_week_day_t; /**@brief Local time information:Daylight Saving Time Offset. */ -typedef enum { +typedef enum +{ CTS_C_DST_OFFSET_STANDAR_TIME = 0x00, /**< Standard Time. */ CTS_C_DST_OFFSET_HALF_HOUR = 0x02, /**< Half An Hour Daylight Time (+0.5h). */ CTS_C_DST_OFFSET_DAYLIGHT_TIME = 0x04, /**< Daylight Time (+1h). */ @@ -121,7 +121,8 @@ typedef enum { } cts_c_dst_offset_t; /**@brief Reference time information:Time Source. */ -typedef enum { +typedef enum +{ CTS_C_REF_TIME_SRC_UNKNOWN, /**< Unknown. */ CTS_C_REF_TIME_SRC_NET_TIME_PROTOCOL, /**< Network Time Protocol. */ CTS_C_REF_TIME_SRC_GPS, /**< GPS. */ @@ -132,24 +133,18 @@ typedef enum { } cts_c_ref_time_source_t; /**@brief Current Time Service Client event type. */ -typedef enum { +typedef enum +{ CTS_C_EVT_INVALID, /**< CTS Client invalid event. */ CTS_C_EVT_DISCOVERY_COMPLETE, /**< CTS Client has found CTS service and its characteristics. */ - CTS_C_EVT_DISCOVERY_FAIL, /**< CTS Client found CTS service failed because of invalid operation or \ - no found at the peer. */ + CTS_C_EVT_DISCOVERY_FAIL, /**< CTS Client found CTS service failed because of invalid operation or no found at the peer. */ CTS_C_EVT_CUR_TIME_NTF_SET_SUCCESS, /**< CTS Client has set Notification of Current Time characteristic. */ - CTS_C_EVT_VALID_CUR_TIME_REC, /**< CTS Client has received valid Current Time value \ - (Read or Notification from peer). */ - CTS_C_EVT_INVALID_CUR_TIME_REC, /**< CTS Client has received invalid Current Time value \ - (Read or Notification from peer). */ - CTS_C_EVT_VALID_LOC_TIME_INFO_REC, /**< CTS Client has received valid Local Time Information value \ - (Read from peer). */ - CTS_C_EVT_INVALID_LOC_TIME_INFO_REC, /**< CTS Client has received invalid Local Time Information value \ - (Read from peer). */ - CTS_C_EVT_VALID_REF_TIME_INFO_REC, /**< CTS Client has received valid Reference Time Information Value \ - (Read from peer). */ - CTS_C_EVT_INVALID_REF_TIME_INFO_REC, /**< CTS Client has received invalid Reference Time Information Value \ - (Read from peer). */ + CTS_C_EVT_VALID_CUR_TIME_REC, /**< CTS Client has received valid Current Time value (Read or Notification from peer). */ + CTS_C_EVT_INVALID_CUR_TIME_REC, /**< CTS Client has received invalid Current Time value (Read or Notification from peer). */ + CTS_C_EVT_VALID_LOC_TIME_INFO_REC, /**< CTS Client has received valid Local Time Information value (Read from peer). */ + CTS_C_EVT_INVALID_LOC_TIME_INFO_REC, /**< CTS Client has received invalid Local Time Information value (Read from peer). */ + CTS_C_EVT_VALID_REF_TIME_INFO_REC, /**< CTS Client has received valid Reference Time Information Value (Read from peer). */ + CTS_C_EVT_INVALID_REF_TIME_INFO_REC, /**< CTS Client has received invalid Reference Time Information Value (Read from peer). */ CTS_C_EVT_CUR_TIME_SET_SUCCESS, /**< CTS Client has writen Current Time completely. */ CTS_C_EVT_LOC_TIME_INFO_SET_SUCCESS, /**< CTS Client has writen Local Time Information completely. */ CTS_C_EVT_WRITE_OP_ERR, /**< Error occured when CTS Client writen to peer. */ @@ -161,40 +156,41 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t cts_srvc_start_handle; /**< CTS Service start handle. */ uint16_t cts_srvc_end_handle; /**< CTS Service end handle. */ - uint16_t cts_cur_time_handle; /**< CTS Current Time characteristic Value handle \ - which has been got from peer. */ - uint16_t cts_cur_time_cccd_handle; /**< CTS CCCD handle of Current Time characteristic \ - which has been got from peer. */ - uint16_t cts_loc_time_info_handle; /**< CTS Local Time Information characteristic Value handle \ - which has been got from peer. */ - uint16_t cts_ref_time_info_handle; /**< CTS Reference Time Information characteristic Value handle \ - which has been got from peer. */ + uint16_t cts_cur_time_handle; /**< CTS Current Time characteristic Value handle which has been got from peer. */ + uint16_t cts_cur_time_cccd_handle; /**< CTS CCCD handle of Current Time characteristic which has been got from peer. */ + uint16_t cts_loc_time_info_handle; /**< CTS Local Time Information characteristic Value handle which has been got from peer. */ + uint16_t cts_ref_time_info_handle; /**< CTS Reference Time Information characteristic Value handle which has been got from peer. */ } cts_c_handles_t; /**@brief Exact Time 256. */ -typedef struct { +typedef struct +{ prf_date_time_t date_time; /**< Date Time. */ uint8_t day_of_week; /**< Day of Week. */ uint8_t fractions_256; /**< 1/256th of a second. */ } cts_c_exact_time_256_t; /**@brief Current Time value. */ -typedef struct { +typedef struct +{ cts_c_exact_time_256_t day_date_time; /**< Exact Time 256. */ uint8_t adjust_reason; /**< Adjust Reason. */ } cts_c_cur_time_t; /**@brief Local Time Information. */ -typedef struct { +typedef struct +{ int8_t time_zone; /**< Time Zone, Offset from UTC in number of 15 minutes increments. */ cts_c_dst_offset_t dst_offset; /**< Daylight Saving Time Offset. */ } cts_c_loc_time_info_t; /**@brief Reference Time Information. */ -typedef struct { +typedef struct +{ cts_c_ref_time_source_t source; /**< Time Source. */ uint8_t accuracy; /**< Accuracy of time information. */ uint8_t days_since_update; /**< Days Since Update. */ @@ -202,10 +198,12 @@ typedef struct { } cts_c_ref_time_info_t; /**@brief Current Time Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ cts_c_evt_type_t evt_type; /**< The CTS client event type. */ - union { + union + { cts_c_cur_time_t cur_time; /**< Curren time received. */ cts_c_loc_time_info_t loc_time_info; /**< Local time information received. */ cts_c_ref_time_info_t ref_time_info; /**< Referen time information received. */ @@ -315,6 +313,16 @@ sdk_err_t cts_c_cur_time_set(uint8_t conn_idx, cts_c_cur_time_t *p_cur_time); ***************************************************************************************** */ sdk_err_t cts_c_loc_time_info_set(uint8_t conn_idx, cts_c_loc_time_info_t *p_loc_time_info); + +/** + ***************************************************************************************** + * @brief Data accepts data and processing functions. + * + * @param[in] p_data: Serial port data. + * @param[in] length: Data length. + ***************************************************************************************** + */ +void cts_c_data_parse(uint8_t *p_data, uint16_t length); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/BUILD.gn new file mode 100644 index 0000000..d0ae73c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("dis") { + sources = [ "dis.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.c index b9049d4..bbd758e 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.c @@ -43,19 +43,14 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define INDEX_0 0 -#define INDEX_1 1 -#define INDEX_2 2 -#define INDEX_3 3 -#define INDEX_4 4 -#define INDEX_5 5 -#define INDEX_6 6 + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief Device Information Service Attributes database index list. */ -enum dis_attr_idx_t { +enum dis_attr_idx_t +{ DIS_IDX_SVC, DIS_IDX_SYSTEM_ID_CHAR, @@ -93,137 +88,76 @@ enum dis_attr_idx_t { ***************************************************************************************** */ /**@brief Device Information Service environment variable. */ -struct dis_env_t { - dis_init_t dis_init; /**< Device Information Service initialization variables. */ - uint16_t start_hdl; /**< Device Information Service start handle. */ +struct dis_env_t +{ + dis_init_t dis_init; /**< Device Information Service initialization variables. */ + uint16_t start_hdl; /**< Device Information Service start handle. */ + ble_gatts_create_db_t dis_gatts_db; /**< Device Information Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t dis_init(void); -static void dis_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct dis_env_t s_dis_env; +static const uint8_t s_dis_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_DEVICE_INFO); /**@brief Full DIS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_t dis_attr_tab[DIS_IDX_NB] = { +static const ble_gatts_attm_desc_t dis_attr_tab[DIS_IDX_NB] = +{ // Device Information Service Declaration - [DIS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // System ID Characteristic Declaration - [DIS_IDX_SYSTEM_ID_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_SYSTEM_ID_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // System ID Characteristic Value - [DIS_IDX_SYSTEM_ID_VAL] = {BLE_ATT_CHAR_SYS_ID, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_SYS_ID_LEN}, + [DIS_IDX_SYSTEM_ID_VAL] = {BLE_ATT_CHAR_SYS_ID, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_SYS_ID_LEN}, // Model Number String Characteristic Declaration - [DIS_IDX_MODEL_NB_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_MODEL_NB_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Model Number String Characteristic Value - [DIS_IDX_MODEL_NB_STR_VAL] = {BLE_ATT_CHAR_MODEL_NB, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_MODEL_NB_STR_VAL] = {BLE_ATT_CHAR_MODEL_NB, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // Serial Number String Characteristic Declaration - [DIS_IDX_SERIAL_NB_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_SERIAL_NB_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Serial Number String Characteristic Value - [DIS_IDX_SERIAL_NB_STR_VAL] = {BLE_ATT_CHAR_SERIAL_NB, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_SERIAL_NB_STR_VAL] = {BLE_ATT_CHAR_SERIAL_NB, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // Firmware Revision String Characteristic Declaration - [DIS_IDX_FIRM_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_FIRM_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Firmware Revision String Characteristic Value - [DIS_IDX_FIRM_REV_STR_VAL] = {BLE_ATT_CHAR_FW_REV, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_FIRM_REV_STR_VAL] = {BLE_ATT_CHAR_FW_REV, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // Hardware Revision String Characteristic Declaration - [DIS_IDX_HARD_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_HARD_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Hardware Revision String Characteristic Value - [DIS_IDX_HARD_REV_STR_VAL] = {BLE_ATT_CHAR_HW_REV, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_HARD_REV_STR_VAL] = {BLE_ATT_CHAR_HW_REV, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // Software Revision String Characteristic Declaration - [DIS_IDX_SW_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_SW_REV_STR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Software Revision String Characteristic Value - [DIS_IDX_SW_REV_STR_VAL] = {BLE_ATT_CHAR_SW_REV, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_SW_REV_STR_VAL] = {BLE_ATT_CHAR_SW_REV, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // Manufacturer Name Characteristic Declaration - [DIS_IDX_MANUFACTURER_NAME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_MANUFACTURER_NAME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Manufacturer Name Characteristic Value - [DIS_IDX_MANUFACTURER_NAME_VAL] = {BLE_ATT_CHAR_MANUF_NAME, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, + [DIS_IDX_MANUFACTURER_NAME_VAL] = {BLE_ATT_CHAR_MANUF_NAME, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_VAL_MAX_LEN}, // IEEE 11073-20601 Regulatory Certification Data List Characteristic Declaration - [DIS_IDX_IEEE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_IEEE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // IEEE 11073-20601 Regulatory Certification Data List Characteristic Value - [DIS_IDX_IEEE_VAL] = {BLE_ATT_CHAR_IEEE_CERTIF, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_SYS_ID_LEN}, + [DIS_IDX_IEEE_VAL] = {BLE_ATT_CHAR_IEEE_CERTIF, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_SYS_ID_LEN}, // PnP ID Characteristic Declaration - [DIS_IDX_PNP_ID_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [DIS_IDX_PNP_ID_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // PnP ID Characteristic Value - [DIS_IDX_PNP_ID_VAL] = {BLE_ATT_CHAR_PNP_ID, READ_PERM_UNSEC, ATT_VAL_LOC_USER, DIS_PNP_ID_LEN}, -}; - -/**@brief Device Information Service interface required by profile manager. */ -static ble_prf_manager_cbs_t dis_mgr_cbs = { - (prf_init_func_t)dis_init, - NULL, - NULL -}; - -/**@brief Device Information GATT Server Callbacks. */ -static gatts_prf_cbs_t dis_gatts_cbs = { - dis_read_att_cb, - NULL, - NULL, - NULL -}; - -/**@brief Device Information Service Information. */ -static const prf_server_info_t dis_prf_info = { - .max_connection_nb = DIS_CONNECTION_MAX, - .manager_cbs = &dis_mgr_cbs, - .gatts_prf_cbs = &dis_gatts_cbs + [DIS_IDX_PNP_ID_VAL] = {BLE_ATT_CHAR_PNP_ID, BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, DIS_PNP_ID_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize device information service and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t dis_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t dis_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_DEVICE_INFO); - sdk_err_t error_code = SDK_SUCCESS; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = dis_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_dis_env.dis_init.char_mask; - gatts_db.max_nb_attr = DIS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = dis_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_dis_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -232,20 +166,21 @@ static sdk_err_t dis_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void dis_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void dis_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint16_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_dis_env.start_hdl, - DIS_IDX_NB, - (uint8_t *)&s_dis_env.dis_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint16_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_dis_env.start_hdl, + DIS_IDX_NB, + (uint8_t *)&s_dis_env.dis_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; uint8_t buf[DIS_PNP_ID_LEN]; - switch (tab_index) { + switch (tab_index) + { case DIS_IDX_SYSTEM_ID_VAL: cfm.length = DIS_SYS_ID_LEN; cfm.value = (uint8_t *)s_dis_env.dis_init.p_sys_id; @@ -286,17 +221,18 @@ static void dis_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param cfm.value = (uint8_t *)s_dis_env.dis_init.reg_cert_data_list.p_list; break; - case DIS_IDX_PNP_ID_VAL: { - buf[INDEX_0] = s_dis_env.dis_init.p_pnp_id->vendor_id_source; - buf[INDEX_1] = LO_U16(s_dis_env.dis_init.p_pnp_id->vendor_id); - buf[INDEX_2] = HI_U16(s_dis_env.dis_init.p_pnp_id->vendor_id); - buf[INDEX_3] = LO_U16(s_dis_env.dis_init.p_pnp_id->product_id); - buf[INDEX_4] = HI_U16(s_dis_env.dis_init.p_pnp_id->product_id); - buf[INDEX_5] = LO_U16(s_dis_env.dis_init.p_pnp_id->product_version); - buf[INDEX_6] = HI_U16(s_dis_env.dis_init.p_pnp_id->product_version); - cfm.length = DIS_PNP_ID_LEN; - cfm.value = buf; - } + case DIS_IDX_PNP_ID_VAL: + { + buf[0] = s_dis_env.dis_init.p_pnp_id->vendor_id_source; + buf[1] = LO_U16(s_dis_env.dis_init.p_pnp_id->vendor_id); + buf[2] = HI_U16(s_dis_env.dis_init.p_pnp_id->vendor_id); + buf[3] = LO_U16(s_dis_env.dis_init.p_pnp_id->product_id); + buf[4] = HI_U16(s_dis_env.dis_init.p_pnp_id->product_id); + buf[5] = LO_U16(s_dis_env.dis_init.p_pnp_id->product_version); + buf[6] = HI_U16(s_dis_env.dis_init.p_pnp_id->product_version); + cfm.length = DIS_PNP_ID_LEN; + cfm.value = buf; + } break; default: @@ -308,21 +244,47 @@ static void dis_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param ble_gatts_read_cfm(conn_idx, &cfm); } +static void dis_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + dis_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + } +} + + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t dis_service_init(dis_init_t *p_dis_init) { - sdk_err_t ret; - if (p_dis_init == NULL) { + if (NULL == p_dis_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_dis_env.dis_init, sizeof(dis_init_t), p_dis_init, sizeof(dis_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_dis_env.dis_init, p_dis_init, sizeof(dis_init_t)); - return ble_server_prf_add(&dis_prf_info); + s_dis_env.start_hdl = PRF_INVALID_HANDLE; + s_dis_env.dis_gatts_db.shdl = &s_dis_env.start_hdl; + s_dis_env.dis_gatts_db.uuid = s_dis_svc_uuid; + s_dis_env.dis_gatts_db.attr_tab_cfg = (uint8_t *)&s_dis_env.dis_init.char_mask; + s_dis_env.dis_gatts_db.max_nb_attr = DIS_IDX_NB; + s_dis_env.dis_gatts_db.srvc_perm = 0; + s_dis_env.dis_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_dis_env.dis_gatts_db.attr_tab.attr_tab_16 = dis_attr_tab; + + return ble_gatts_prf_add(&s_dis_env.dis_gatts_db, dis_ble_evt_handler); } +uint16_t dis_service_start_handle_get(void) +{ + return s_dis_env.start_hdl; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.h index 72540a6..8cc2aad 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis/dis.h @@ -62,21 +62,19 @@ #ifndef __DIS_H__ #define __DIS_H__ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup DIS_MACRO Defines * @{ */ -#define DIS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of DIS connections. \ - The value is configurable. */ -#define DIS_SYS_ID_LEN 8 /**< System ID length. */ -#define DIS_PNP_ID_LEN 7 /**< PnP ID length. */ -#define DIS_VAL_MAX_LEN 128 /**< Maximal length for Characteristic values - 128 bytes. */ -#define DIS_IEEE_CERTIF_MIN_LEN 6 /**< IEEE Certification length (min 6 bytes). */ +#define DIS_CONNECTION_MAX 10 /**< Maximum number of DIS connections.The value is configurable. */ +#define DIS_SYS_ID_LEN 8 /**< System ID length. */ +#define DIS_PNP_ID_LEN 7 /**< PnP ID length. */ +#define DIS_VAL_MAX_LEN 128 /**< Maximal length for Characteristic values - 128 bytes. */ +#define DIS_IEEE_CERTIF_MIN_LEN 6 /**< IEEE Certification length (min 6 bytes). */ /** * @defgroup DIS_CHAR_MASK Characteristics Mask @@ -90,8 +88,7 @@ #define DIS_CHAR_HARDWARE_REV_SUP 0x00000600 /**< Bit mask of the Hardware Revision. */ #define DIS_CHAR_SOFTWARE_REV_SUP 0x00001800 /**< Bit mask of the Software Revision. */ #define DIS_CHAR_MANUFACTURER_NAME_SUP 0x00006000 /**< Bit mask of the Manufacturer Name. */ -#define DIS_CHAR_11073_CERT_DATA_SUP 0x00018000 /**< Bit mask of the IEEE 11073-20601 \ - Regulatory Certification Data List. */ +#define DIS_CHAR_11073_CERT_DATA_SUP 0x00018000 /**< Bit mask of the IEEE 11073-20601 Regulatory Certification Data List. */ #define DIS_CHAR_PNP_ID_SUP 0x00060000 /**< Bit mask of the PnP ID. */ #define DIS_CHAR_FULL 0x0007ffff /**< Bit mask of the full characteristic. */ /** @} */ @@ -112,27 +109,31 @@ * @{ */ /**@brief UTF-8 string data type. */ -typedef struct { +typedef struct +{ uint8_t length; /**< String length. */ char *p_str; /**< String data. */ } dis_string_t; /**@brief System ID parameters. The first field is the LSOs and the second * field contains the MSOs. */ -typedef struct { +typedef struct +{ uint8_t manufacturer_id[5]; /**< Manufacturer-defined ID. */ uint8_t org_unique_id[3]; /**< Organizationally unique ID (OUI) which is issued by IEEE. */ } dis_sys_id_t; /**@brief IEEE 11073-20601 Regulatory Certification Data List Structure. */ -typedef struct { +typedef struct +{ char *p_list; /**< Pointer to the list which contains the encoded opaque * structure based on IEEE 11073-20601 specification. */ uint8_t list_len; /**< Length of the list. */ } dis_reg_cert_data_list_t; /**@brief PnP ID parameters */ -typedef struct { +typedef struct +{ uint8_t vendor_id_source; /**< Vendor ID Source. */ uint16_t vendor_id; /**< Vendor ID. */ uint16_t product_id; /**< Product ID. */ @@ -141,9 +142,9 @@ typedef struct { /**@brief Device Information Service init structure. This contains all options * and data needed for initialization of the service. */ -typedef struct { - uint32_t - char_mask; /**< Initial mask of Supported characteristics, and configured with \ref DIS_CHAR_MASK. */ +typedef struct +{ + uint32_t char_mask; /**< Initial mask of Supported characteristics, and configured with \ref DIS_CHAR_MASK. */ dis_string_t manufact_name_str; /**< Initial manufacturer Name String. */ dis_string_t model_num_str; /**< Initial model Number String. */ dis_string_t serial_num_str; /**< Initial serial Number String. */ @@ -170,6 +171,16 @@ typedef struct { ***************************************************************************************** */ sdk_err_t dis_service_init(dis_init_t *p_dis_init); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the dis service start handle . + * + * @return The dis service start handle. + ***************************************************************************************** + */ +uint16_t dis_service_start_handle_get(void); + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/BUILD.gn new file mode 100644 index 0000000..02f6a66 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("dis_c") { + sources = [ "dis_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.c index 3f0ebd5..a9b78e3 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.c @@ -39,68 +39,32 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "dis_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "dis_c.h" +#include -#define INDEX_1 1 -#define INDEX_2 2 -#define INDEX_3 3 -#define INDEX_4 4 -#define INDEX_5 5 -#define INDEX_6 6 -#define INDEX_7 7 -#define OFFSET_8 8 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Device Information Service environment variable. */ -struct dis_c_env_t { +struct dis_c_env_t +{ dis_c_handles_t handles; /**< Handles of DIS characteristics which will be got for peer. */ dis_c_evt_handler_t evt_handler; /**< Handler of DIS Client event */ - uint8_t prf_id; /**< DIS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void dis_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void dis_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct dis_c_env_t s_dis_c_env; /**< Device Information Service Client environment variable. */ - -/**@brief Device Information Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t dis_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Device Information Service GATT Client Callbacks. */ -static gattc_prf_cbs_t dis_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - dis_c_att_read_cb, - NULL, - NULL, - dis_c_srvc_browse_cb, - NULL, -}; - -/**@brief Device Information Service Client Information. */ -static const prf_client_info_t dis_c_prf_info = { - .max_connection_nb = DIS_C_CONNECTION_MAX, - .manager_cbs = &dis_c_mgr_cbs, - .gattc_prf_cbs = &dis_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_DEVICE_INFO), HI_U16(BLE_ATT_SVC_DEVICE_INFO)}; +static ble_uuid_t s_dis_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -118,8 +82,10 @@ static const prf_client_info_t dis_c_prf_info = { */ static dis_c_char_type_t dis_c_char_read_type_get(uint16_t handle) { - for (uint8_t i = 0; i < DIS_C_CHARACTER_NB; i++) { - if (handle == s_dis_c_env.handles.dis_char_handle[i]) { + for (uint8_t i = 0; i < DIS_C_CHARACTER_NB; i++) + { + if (handle == s_dis_c_env.handles.dis_char_handle[i]) + { return (dis_c_char_type_t)i; } } @@ -144,24 +110,31 @@ static void dis_c_char_read_rsp_encode(dis_c_char_type_t char_read_type, { p_read_rsp_buffer->char_type = char_read_type; - if (DIS_C_SYS_ID == char_read_type) { - p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[INDEX_0] = p_data[INDEX_0]; - p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[INDEX_1] = p_data[INDEX_1]; - p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[INDEX_2] = p_data[INDEX_2]; - p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[INDEX_3] = p_data[INDEX_3]; - p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[INDEX_4] = p_data[INDEX_4]; - p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[INDEX_0] = p_data[INDEX_5]; - p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[INDEX_1] = p_data[INDEX_6]; - p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[INDEX_2] = p_data[INDEX_7]; - } else if (DIS_C_CERT_LIST == char_read_type) { + if (DIS_C_SYS_ID == char_read_type) + { + p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[0] = p_data[0]; + p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[1] = p_data[1]; + p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[2] = p_data[2]; + p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[3] = p_data[3]; + p_read_rsp_buffer->encode_rst.sys_id.manufacturer_id[4] = p_data[4]; + p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[0] = p_data[5]; + p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[1] = p_data[6]; + p_read_rsp_buffer->encode_rst.sys_id.org_unique_id[2] = p_data[7]; + } + else if (DIS_C_CERT_LIST == char_read_type) + { p_read_rsp_buffer->encode_rst.cert_list.p_list = p_data; p_read_rsp_buffer->encode_rst.cert_list.list_length = length; - } else if (DIS_C_PNP_ID == char_read_type) { - p_read_rsp_buffer->encode_rst.pnp_id.vendor_id_source = p_data[INDEX_0] | (p_data[INDEX_1] << OFFSET_8); - p_read_rsp_buffer->encode_rst.pnp_id.vendor_id = p_data[INDEX_2] | (p_data[INDEX_3] << OFFSET_8); - p_read_rsp_buffer->encode_rst.pnp_id.product_id = p_data[INDEX_4] | (p_data[INDEX_5] << OFFSET_8); - p_read_rsp_buffer->encode_rst.pnp_id.product_version = p_data[INDEX_6] | (p_data[INDEX_7] << OFFSET_8); - } else { + } + else if (DIS_C_PNP_ID == char_read_type) + { + p_read_rsp_buffer->encode_rst.pnp_id.vendor_id_source = p_data[0] | p_data[1] << 8; + p_read_rsp_buffer->encode_rst.pnp_id.vendor_id = p_data[2] | p_data[3] << 8; + p_read_rsp_buffer->encode_rst.pnp_id.product_id = p_data[4] | p_data[5] << 8; + p_read_rsp_buffer->encode_rst.pnp_id.product_version = p_data[6] | p_data[7] << 8; + } + else + { p_read_rsp_buffer->encode_rst.string_data.p_data = p_data; p_read_rsp_buffer->encode_rst.string_data.length = length; } @@ -176,7 +149,8 @@ static void dis_c_char_read_rsp_encode(dis_c_char_type_t char_read_type, */ void dis_c_evt_handler_excute(dis_c_evt_t *p_evt) { - if (s_dis_c_env.evt_handler != NULL && DIS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_dis_c_env.evt_handler && DIS_C_EVT_INVALID != p_evt->evt_type) + { s_dis_c_env.evt_handler(p_evt); } } @@ -190,7 +164,7 @@ void dis_c_evt_handler_excute(dis_c_evt_t *p_evt) * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void dis_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void dis_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { dis_c_evt_t dis_c_evt; dis_c_char_type_t char_read_type = DIS_C_CHARACTER_NB; @@ -198,15 +172,16 @@ static void dis_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ dis_c_evt.conn_idx = conn_idx; dis_c_evt.evt_type = DIS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if ((p_read_rsp->vals[0].handle >= s_dis_c_env.handles.dis_srvc_start_handle) && \ - (p_read_rsp->vals[0].handle <= s_dis_c_env.handles.dis_srvc_end_handle)) { - char_read_type = dis_c_char_read_type_get(p_read_rsp->vals[0].handle); - dis_c_char_read_rsp_encode(char_read_type, p_read_rsp->vals[0].p_value, p_read_rsp->vals[0].length, - &dis_c_evt.read_rsp); + if ((p_read_rsp->value[0].handle >= s_dis_c_env.handles.dis_srvc_start_handle) && \ + (p_read_rsp->value[0].handle <= s_dis_c_env.handles.dis_srvc_end_handle)) + { + char_read_type = dis_c_char_read_type_get(p_read_rsp->value[0].handle); + dis_c_char_read_rsp_encode(char_read_type, p_read_rsp->value[0].p_value, p_read_rsp->value[0].length, &dis_c_evt.read_rsp); dis_c_evt.evt_type = DIS_C_EVT_DEV_INFORMATION_READ_RSP; dis_c_evt_handler_excute(&dis_c_evt); } @@ -221,7 +196,7 @@ static void dis_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void dis_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void dis_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { dis_c_evt_t dis_c_evt; uint16_t uuid_disc; @@ -230,42 +205,66 @@ static void dis_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat dis_c_evt.conn_idx = conn_idx; dis_c_evt.evt_type = DIS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (BLE_SUCCESS == status) { - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_DEVICE_INFO == uuid_disc) { + if (BLE_ATT_SVC_DEVICE_INFO == uuid_disc) + { s_dis_c_env.handles.dis_srvc_start_handle = p_browse_srvc->start_hdl; s_dis_c_env.handles.dis_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << OFFSET_8; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_SYS_ID == uuid_disc) { + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_SYS_ID == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_SYS_ID] = handle_disc; - } else if (BLE_ATT_CHAR_MODEL_NB == uuid_disc) { + } + else if (BLE_ATT_CHAR_MODEL_NB == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_MODEL_NUM] = handle_disc; - } else if (BLE_ATT_CHAR_SERIAL_NB == uuid_disc) { + } + else if (BLE_ATT_CHAR_SERIAL_NB == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_SERIAL_NUM] = handle_disc; - } else if (BLE_ATT_CHAR_FW_REV == uuid_disc) { + } + else if (BLE_ATT_CHAR_FW_REV == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_FW_REV] = handle_disc; - } else if (BLE_ATT_CHAR_HW_REV == uuid_disc) { + } + else if (BLE_ATT_CHAR_HW_REV == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_HW_REV] = handle_disc; - } else if (BLE_ATT_CHAR_SW_REV == uuid_disc) { + } + else if (BLE_ATT_CHAR_SW_REV == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_SW_REV] = handle_disc; - } else if (BLE_ATT_CHAR_MANUF_NAME == uuid_disc) { + } + else if (BLE_ATT_CHAR_MANUF_NAME == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_MANUF_NAME] = handle_disc; - } else if (BLE_ATT_CHAR_IEEE_CERTIF == uuid_disc) { + } + else if (BLE_ATT_CHAR_IEEE_CERTIF == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_CERT_LIST] = handle_disc; - } else if (BLE_ATT_CHAR_PNP_ID == uuid_disc) { + } + else if (BLE_ATT_CHAR_PNP_ID == uuid_disc) + { s_dis_c_env.handles.dis_char_handle[DIS_C_PNP_ID] = handle_disc; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { break; } } @@ -277,39 +276,46 @@ static void dis_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat dis_c_evt_handler_excute(&dis_c_evt); } +static void dis_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + dis_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + dis_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t dis_client_init(dis_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_dis_c_env, sizeof(s_dis_c_env), 0, sizeof(s_dis_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_dis_c_env, 0, sizeof(s_dis_c_env)); s_dis_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&dis_c_prf_info, &s_dis_c_env.prf_id); + return ble_gattc_prf_add(&s_dis_service_uuid, dis_c_ble_evt_handler); } sdk_err_t dis_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - target_uuid[0] = LO_U16(BLE_ATT_SVC_DEVICE_INFO); - target_uuid[1] = HI_U16(BLE_ATT_SVC_DEVICE_INFO); - - const ble_uuid_t dis_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_dis_c_env.prf_id, conn_idx, &dis_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_dis_service_uuid); } sdk_err_t dis_c_char_value_read(uint8_t conn_idx, dis_c_char_type_t char_read_type) @@ -318,10 +324,11 @@ sdk_err_t dis_c_char_value_read(uint8_t conn_idx, dis_c_char_type_t char_read_ty target_handle = s_dis_c_env.handles.dis_char_handle[char_read_type]; - if (BLE_ATT_INVALID_HDL == target_handle) { + if (BLE_ATT_INVALID_HDL == target_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_dis_c_env.prf_id, conn_idx, target_handle, 0); + return ble_gattc_read(conn_idx, target_handle, 0); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.h index 17015ec..2171760 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dis_c/dis_c.h @@ -56,19 +56,18 @@ #ifndef __DIS_C_H__ #define __DIS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup DIS_C_MACRO Defines * @{ */ -#define DIS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of DIS Client connections. */ -#define DIS_C_STRING_LEN_MAX 128 /**< Maximal length for Characteristic values - 128 bytes. */ +#define DIS_C_CONNECTION_MAX 10 /**< Maximum number of DIS Client connections. */ +#define DIS_C_STRING_LEN_MAX 128 /**< Maximal length for Characteristic values - 128 bytes. */ /** * @defgroup DIS_IEEE_11073_BODY IEEE 11073-20601 Authoritative Body Type @@ -87,16 +86,17 @@ * @{ */ /**@brief Device Information Service Client event type. */ -typedef enum { - DIS_C_EVT_INVALID, /**< DIS Client invalid event. */ - DIS_C_EVT_DISCOVERY_COMPLETE, /**< DIS Client has found Device Information Service and its characteristics. */ - DIS_C_EVT_DISCOVERY_FAIL, /**< DIS Client found DIS service failed because of invalid operation or \ - no found at the peer. */ +typedef enum +{ + DIS_C_EVT_INVALID, /**< DIS Client invalid event. */ + DIS_C_EVT_DISCOVERY_COMPLETE, /**< DIS Client has found Device Information Service and its characteristics. */ + DIS_C_EVT_DISCOVERY_FAIL, /**< DIS Client found DIS service failed because of invalid operation or no found at the peer. */ DIS_C_EVT_DEV_INFORMATION_READ_RSP, /**< DIS Client has received device information value read response. */ } dis_c_evt_type_t; /**@brief Device Information Service Client characteristic type. */ -typedef enum { +typedef enum +{ DIS_C_SYS_ID, /**< System ID characteristic. */ DIS_C_MODEL_NUM, /**< Model Number String characteristic. */ DIS_C_SERIAL_NUM, /**< Serial Number String characteristic. */ @@ -115,33 +115,37 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t dis_srvc_start_handle; /**< DIS Serivce start handle. */ uint16_t dis_srvc_end_handle; /**< DIS Service end handle. */ uint16_t dis_char_handle[DIS_C_CHARACTER_NB]; /**< DIS characteristic handle. */ } dis_c_handles_t; /**@brief Response data for string-based DIS characteristics. */ -typedef struct { +typedef struct +{ uint8_t *p_data; /**< Pointer to response data. */ uint16_t length; /**< Response data length. */ } dis_c_string_t; /**@brief Response data for System ID parameters. */ -typedef struct { +typedef struct +{ uint8_t manufacturer_id[5]; /**< Manufacturer-defined ID. */ uint8_t org_unique_id[3]; /**< Organizationally unique ID (OUI) which is issued by IEEE. */ } dis_c_sys_id_t; /**@brief Response data for IEEE 11073-20601 Regulatory Certification Data List Structure. */ -typedef struct { - uint8_t *p_list; /**< Pointer to the list which contains the encoded opaque structure \ - based on IEEE 11073-20601 specification. */ +typedef struct +{ + uint8_t *p_list; /**< Pointer to the list which contains the encoded opaque structure based on IEEE 11073-20601 specification. */ uint16_t list_length; /**< Length of the list. */ } dis_c_reg_cert_data_list_t; /**@brief Response data for PnP ID parameters */ -typedef struct { +typedef struct +{ uint8_t vendor_id_source; /**< Vendor ID Source. */ uint16_t vendor_id; /**< Vendor ID. */ uint16_t product_id; /**< Product ID. */ @@ -149,21 +153,21 @@ typedef struct { } dis_c_pnp_id_t; /**@brief Device Information Service Client Read Response encode structure. */ -typedef struct { +typedef struct +{ dis_c_char_type_t char_type; /**< Characteristic type. */ - union { + union + { dis_c_sys_id_t sys_id; /**< System ID characteristic response data. */ - dis_c_string_t - string_data; /**< Model Number, Serial Number, Hardware Revision, Firmware Revision, Software Revision, \ - Manufacturer Name String characteristic response data. */ - dis_c_reg_cert_data_list_t - cert_list; /**< IEEE 11073-20601 Regulatory Certification Data List characteristic response data. */ + dis_c_string_t string_data; /**< Model Number, Serial Number, Hardware Revision, Firmware Revision, Software Revision, Manufacturer Name String characteristic response data. */ + dis_c_reg_cert_data_list_t cert_list; /**< IEEE 11073-20601 Regulatory Certification Data List characteristic response data. */ dis_c_pnp_id_t pnp_id; /**< PnP ID characteristic response data. */ } encode_rst; /**< Result of encoding. */ } ble_dis_c_read_rsp_t; /**@brief Device Information Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ dis_c_evt_type_t evt_type; /**< DIS Client event type. */ ble_dis_c_read_rsp_t read_rsp; /**< DIS Client characteristic Read Response encode. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/BUILD.gn new file mode 100644 index 0000000..9e19951 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("dss") { + sources = [ "dss.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.c index 6e4ad2d..b7f8db7 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.c @@ -1,7 +1,7 @@ /** ***************************************************************************************** * - * @file dss.c + * @file dss.h * * @brief Device Synchronize Service Implementation. * @@ -10,13 +10,13 @@ #####Copyright (c) 2019 GOODIX All rights reserved. - Redistribution and use in source and binary forms, with or without + Redsstribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + * Redsstributions of source code must retain the above copyright + notice, this list of conditions and the following dssclaimer. + * Redsstributions in binary form must reproduce the above copyright + notice, this list of conditions and the following dssclaimer in the + documentation and/or other materials provided with the dsstribution. * Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. @@ -24,7 +24,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + ARE DSSCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS @@ -51,18 +51,11 @@ ***************************************************************************************** */ /**@brief The UUIDs of DSS service and characteristics. */ -#define DSS_SERVICE_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x01, 0x0A, 0xED, 0xA6} -#define DSS_ROLE_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x02, 0x0A, 0xED, 0xA6} -#define DSS_EVT_CNT_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x03, 0x0A, 0xED, 0xA6} -#define DSS_EVT_PERIOD_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x04, 0x0A, 0xED, 0xA6} -#define DSS_STATUS_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x05, 0x0A, 0xED, 0xA6} -#define DSS_CTRL_PT_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, - 0x06, 0x0A, 0xED, 0xA6} +#define DSS_ROLE_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x0A, 0xED, 0xA6} +#define DSS_EVT_CNT_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x0A, 0xED, 0xA6} +#define DSS_EVT_PERIOD_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x0A, 0xED, 0xA6} +#define DSS_STATUS_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x05, 0x0A, 0xED, 0xA6} +#define DSS_CTRL_PT_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x06, 0x0A, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -74,7 +67,8 @@ ***************************************************************************************** */ /**@brief Device Synchronize Service Attributes database index list. */ -enum dss_attr_idx_t { +enum dss_attr_idx_t +{ DSS_IDX_SVC, DSS_IDX_ROLE_CHAR, @@ -102,35 +96,31 @@ enum dss_attr_idx_t { ***************************************************************************************** */ /**@brief Device Synchronize Service environment variable. */ -struct dss_env_t { - dss_evt_handler_t evt_handler; - uint16_t start_hdl; - uint16_t char_mask; - dss_role_t dss_role; - dss_staus_t sync_status; - uint16_t event_period; - uint32_t sync_cnt; - uint8_t sync_cfg_conn_idx; - bool is_busy_send; - bool is_auto_calib_drift; - bool is_auto_enter_lp; - bool is_in_lp; - uint32_t auto_calib_timing; - uint8_t sync_device_num; - uint16_t evt_cnt_ntf[DSS_CONNECTION_MAX]; - uint16_t ctrl_pt_ind[DSS_CONNECTION_MAX]; +struct dss_env_t +{ + dss_evt_handler_t evt_handler; + uint16_t start_hdl; + uint16_t char_mask; + dss_role_t dss_role; + dss_staus_t sync_status; + uint16_t event_period; + uint32_t sync_cnt; + uint8_t sync_cfg_conn_idx; + bool is_busy_send; + bool is_auto_calib_drift; + bool is_auto_enter_lp; + bool is_in_lp; + uint32_t auto_calib_timing; + uint8_t sync_device_num; + uint16_t evt_cnt_ntf[DSS_CONNECTION_MAX]; + uint16_t ctrl_pt_ind[DSS_CONNECTION_MAX]; + ble_gatts_create_db_t dss_gatts_db; /**< Device Synchronize Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t dss_init(void); -static void dss_disconnect_cb(uint8_t conn_idx, uint8_t reason); -static void dss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void dss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void dss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void dss_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); static void dss_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); static sdk_err_t dss_ctrl_pt_rsp_send(uint8_t conn_idx, dss_op_id_t op_id, dss_rsp_id_t rsp_id); /* @@ -138,129 +128,63 @@ static sdk_err_t dss_ctrl_pt_rsp_send(uint8_t conn_idx, dss_op_id_t op_id, dss_r ***************************************************************************************** */ static struct dss_env_t s_dss_env; +static const uint8_t s_dss_svc_uuid[] = {DSS_SERVICE_UUID}; /**@brief Full DSS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_128_t dss_attr_tab[DSS_IDX_NB] = { - [DSS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, +static const ble_gatts_attm_desc_128_t dss_attr_tab[DSS_IDX_NB] = +{ + [DSS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_ROLE_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_ROLE_VAL] = { - DSS_ROLE_UUID, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - DSS_ROLE_VALUE_LEN - }, + [DSS_IDX_ROLE_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + [DSS_IDX_ROLE_VAL] = {DSS_ROLE_UUID, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + DSS_ROLE_VALUE_LEN}, - [DSS_IDX_SYNC_CNT_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_SYNC_CNT_VAL] = { - DSS_EVT_CNT_UUID, - READ_PERM_UNSEC | NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - DSS_EVT_CNT_VALUE_LEN - }, - [DSS_IDX_SYNC_CNT_CFG] = {ATT_128_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [DSS_IDX_SYNC_CNT_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + [DSS_IDX_SYNC_CNT_VAL] = {DSS_EVT_CNT_UUID, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + DSS_EVT_CNT_VALUE_LEN}, + [DSS_IDX_SYNC_CNT_CFG] = {ATT_128_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, - [DSS_IDX_SYNC_PERIOD_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_SYNC_PERIOD_VAL] = { - DSS_EVT_PERIOD_UUID, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - DSS_EVT_PERIOD_VALUE_LEN - }, + [DSS_IDX_SYNC_PERIOD_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + [DSS_IDX_SYNC_PERIOD_VAL] = {DSS_EVT_PERIOD_UUID, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + DSS_EVT_PERIOD_VALUE_LEN}, - [DSS_IDX_SYNC_STATUS_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_SYNC_STATUS_VAL] = { - DSS_STATUS_UUID, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - DSS_STATUS_VALUE_LEN - }, + [DSS_IDX_SYNC_STATUS_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + [DSS_IDX_SYNC_STATUS_VAL] = {DSS_STATUS_UUID, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + DSS_STATUS_VALUE_LEN}, - [DSS_IDX_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - [DSS_IDX_CTRL_PT_VAL] = { - DSS_CTRL_PT_UUID, - WRITE_REQ_PERM_UNSEC | INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - DSS_CTRL_PT_VALUE_LEN - }, - [DSS_IDX_CTRL_PT_CFG] = {ATT_128_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, -}; - -/**@brief Device Synchronize Service interface required by profile manager. */ -static ble_prf_manager_cbs_t dss_mgr_cbs = { - (prf_init_func_t)dss_init, - NULL, - dss_disconnect_cb -}; - -/**@brief Device Synchronize GATT Server Callbacks. */ -static gatts_prf_cbs_t dss_gatts_cbs = { - dss_read_att_cb, - dss_write_att_cb, - NULL, - dss_ntf_ind_cb, - dss_cccd_set_cb -}; - -/**@brief Device Synchronize Service Information. */ -static const prf_server_info_t dss_prf_info = { - .max_connection_nb = DSS_CONNECTION_MAX, - .manager_cbs = &dss_mgr_cbs, - .gatts_prf_cbs = &dss_gatts_cbs + [DSS_IDX_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + [DSS_IDX_CTRL_PT_VAL] = {DSS_CTRL_PT_UUID, + BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_INDICATE_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + DSS_CTRL_PT_VALUE_LEN}, + [DSS_IDX_CTRL_PT_CFG] = {ATT_128_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Device Synchronize Service and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t dss_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t dss_svc_uuid[] = DSS_SERVICE_UUID; - sdk_err_t error_code = SDK_SUCCESS; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = dss_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_dss_env.char_mask; - gatts_db.max_nb_attr = DSS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = dss_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_dss_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Device Synchronize Service disconnect callback. ***************************************************************************************** */ -static void dss_disconnect_cb(uint8_t conn_idx, uint8_t reason) +static void dss_disconnect_evt_handler(uint8_t conn_idx, uint8_t reason) { s_dss_env.evt_cnt_ntf[conn_idx] = 0x0000; s_dss_env.ctrl_pt_ind[conn_idx] = 0x0000; - if (conn_idx == s_dss_env.sync_cfg_conn_idx) { - s_dss_env.sync_cfg_conn_idx = GAP_INVALID_CONN_INDEX; + if (conn_idx == s_dss_env.sync_cfg_conn_idx) + { + s_dss_env.sync_cfg_conn_idx = BLE_GAP_INVALID_CONN_INDEX; } } @@ -272,9 +196,9 @@ static void dss_disconnect_cb(uint8_t conn_idx, uint8_t reason) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void dss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void dss_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint16_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_dss_env.start_hdl, @@ -283,7 +207,8 @@ static void dss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case DSS_IDX_ROLE_VAL: cfm.length = DSS_ROLE_VALUE_LEN; cfm.value = (uint8_t *)&s_dss_env.dss_role; @@ -332,11 +257,11 @@ static void dss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in] p_param: Point to the parameters of the write request. ***************************************************************************************** */ -static void dss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void dss_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; bool ctrl_pt_evt = false; s_dss_env.sync_cfg_conn_idx = conn_idx; @@ -346,8 +271,9 @@ static void dss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par (uint8_t *)&s_dss_env.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - - switch (tab_index) { + + switch (tab_index) + { case DSS_IDX_SYNC_CNT_CFG: s_dss_env.evt_cnt_ntf[conn_idx] = le16toh(&p_param->value[0]); break; @@ -367,7 +293,8 @@ static void dss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par ble_gatts_write_cfm(conn_idx, &cfm); - if (ctrl_pt_evt) { + if (ctrl_pt_evt) + { dss_ctrl_pt_handler(conn_idx, p_param->value, p_param->length); } } @@ -381,11 +308,12 @@ static void dss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void dss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void dss_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -394,7 +322,8 @@ static void dss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val DSS_IDX_NB, (uint8_t *)&s_dss_env.char_mask); - switch (tab_index) { + switch (tab_index) + { case DSS_IDX_SYNC_CNT_CFG: s_dss_env.evt_cnt_ntf[conn_idx] = cccd_value; break; @@ -417,11 +346,14 @@ static void dss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void dss_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void dss_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { s_dss_env.is_busy_send = false; - } else if (status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + } + else if (status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { s_dss_env.is_busy_send = true; } } @@ -441,11 +373,16 @@ static void dss_op_role_set_handler(uint8_t conn_idx, const uint8_t *p_data, uin dss_rsp_id_t rsp_id = DSS_RSP_ID_SUCCESS; dss_evt_t evt; - if (length != 2 || (p_data[1] != DSS_ROLE_SYNC_SOURCE && p_data[1] != DSS_ROLE_SYNC_DEVICE)) { + if (length != 2 || (p_data[1] != DSS_ROLE_SYNC_SOURCE && p_data[1] != DSS_ROLE_SYNC_DEVICE)) + { rsp_id = DSS_RSP_ID_PARAM_ERR; - } else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) { + } + else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) + { rsp_id = DSS_RSP_ID_STATUS_ERR; - } else { + } + else + { s_dss_env.dss_role = (dss_role_t)p_data[1]; evt.evt_type = s_dss_env.dss_role == DSS_ROLE_SYNC_SOURCE ? DSS_EVT_SOURCE_ROLE_SET : DSS_EVT_DEVICE_ROLE_SET; @@ -470,19 +407,29 @@ static void dss_op_sync_src_create_handler(uint8_t conn_idx, const uint8_t *p_da uint16_t event_period = le16toh(&p_data[1]); dss_evt_t evt; - if (length != 3 || (le16toh(&p_data[1]) < 32) || (le16toh(&p_data[1]) > 3200)) { + if (length != 3 || (320 > le16toh(&p_data[1])) || (3200 < le16toh(&p_data[1]))) + { rsp_id = DSS_RSP_ID_PARAM_ERR; - } else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) { + } + else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) + { rsp_id = DSS_RSP_ID_STATUS_ERR; - } else if (s_dss_env.dss_role != DSS_ROLE_SYNC_SOURCE) { + } + else if (s_dss_env.dss_role != DSS_ROLE_SYNC_SOURCE) + { rsp_id = DSS_RSP_ID_ROLE_ERR; - } else { - if (ble_sync_source_create(event_period)) { - rsp_id = DSS_RSP_ID_CREATE_SRC_FAIL; - } else { + } + else + { + if (ble_sync_source_create(event_period)) + { + rsp_id = DSS_RSP_ID_CREATE_SRC_FAIL; + } + else + { s_dss_env.sync_status = DSS_STATUS_CFG_READY; s_dss_env.event_period = event_period; - + evt.evt_type = DSS_EVT_SYNC_SRC_CREATE; s_dss_env.evt_handler(&evt); } @@ -506,31 +453,45 @@ static void dss_op_sync_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_ dss_rsp_id_t rsp_id = DSS_RSP_ID_SUCCESS; dss_evt_t evt; - if ((op_id != DSS_OP_ID_SYNC) || length != 7 || p_data[6] == 0) { + if ((op_id != DSS_OP_ID_SYNC) || length != 7 || 0 == p_data[6]) + { rsp_id = DSS_RSP_ID_PARAM_ERR; - } else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) { + } + else if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) + { rsp_id = DSS_RSP_ID_STATUS_ERR; - } else if (!s_dss_env.event_period && s_dss_env.dss_role == DSS_ROLE_SYNC_SOURCE) { + } + else if (!s_dss_env.event_period && s_dss_env.dss_role == DSS_ROLE_SYNC_SOURCE) + { rsp_id = DSS_RSP_ID_DISALLOWED; - } else if (s_dss_env.dss_role == DSS_ROLE_SYNC_INVALID) { + } + else if (s_dss_env.dss_role == DSS_ROLE_SYNC_INVALID) + { rsp_id = DSS_RSP_ID_ROLE_ERR; - } else if (!s_dss_env.evt_handler) { + } + else if (!s_dss_env.evt_handler) + { rsp_id = DSS_RSP_ID_NO_HANDLER; - } else { + } + else + { s_dss_env.is_auto_calib_drift = (p_data[1] & 0x01) ? true : false; s_dss_env.is_auto_enter_lp = (p_data[1] & 0x02) ? true : false; s_dss_env.auto_calib_timing = BUILD_U32(p_data[2], p_data[3], p_data[4], p_data[5]); s_dss_env.sync_device_num = p_data[6]; - - if (s_dss_env.is_auto_calib_drift && !s_dss_env.auto_calib_timing) { + + if (s_dss_env.is_auto_calib_drift && !s_dss_env.auto_calib_timing) + { s_dss_env.is_auto_calib_drift = false; - s_dss_env.is_auto_enter_lp = false; + s_dss_env.is_auto_enter_lp = false; rsp_id = DSS_RSP_ID_PARAM_ERR; - } else { + } + else + { s_dss_env.is_in_lp = false; s_dss_env.sync_status = s_dss_env.dss_role == DSS_ROLE_SYNC_SOURCE ? DSS_STATUS_IN_SCAN : DSS_STATUS_IN_ADV; - + evt.conn_idx = conn_idx; evt.evt_type = DSS_EVT_SYNC_SELF_OR_PEER; evt.is_enter_lp_mode = s_dss_env.is_auto_enter_lp; @@ -539,7 +500,8 @@ static void dss_op_sync_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_ } } - if (rsp_id) { + if (rsp_id) + { dss_ctrl_pt_rsp_send(conn_idx, op_id, rsp_id); } } @@ -557,17 +519,23 @@ static void dss_op_cancel_sync_handler(uint8_t conn_idx) dss_evt_t evt; if (((s_dss_env.sync_status != DSS_STATUS_IN_SCAN) && (DSS_ROLE_SYNC_SOURCE == s_dss_env.dss_role)) || - ((s_dss_env.sync_status != DSS_STATUS_IN_ADV) && (DSS_ROLE_SYNC_DEVICE == s_dss_env.dss_role))) { + ((s_dss_env.sync_status != DSS_STATUS_IN_ADV) && (DSS_ROLE_SYNC_DEVICE == s_dss_env.dss_role))) + { rsp_id = DSS_RSP_ID_STATUS_ERR; - } else if (s_dss_env.evt_handler == NULL) { + } + else if (NULL == s_dss_env.evt_handler) + { rsp_id = DSS_RSP_ID_NO_HANDLER; - } else { + } + else + { evt.conn_idx = conn_idx; evt.evt_type = DSS_EVT_SYNC_CANCEL; s_dss_env.evt_handler(&evt); } - if (rsp_id) { + if (rsp_id) + { dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_CANCEL_SYNC, rsp_id); } } @@ -584,11 +552,17 @@ static void dss_op_lp_enter_handler(uint8_t conn_idx) dss_rsp_id_t rsp_id = DSS_RSP_ID_SUCCESS; dss_evt_t evt; - if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) { + if (s_dss_env.sync_status != DSS_STATUS_CFG_READY) + { rsp_id = DSS_RSP_ID_STATUS_ERR; - } else if (s_dss_env.evt_handler == NULL) { + } + else if (NULL == s_dss_env.evt_handler) + { rsp_id = DSS_RSP_ID_NO_HANDLER; - } else { + } + else + { +// s_dss_env.is_in_lp = true; s_dss_env.is_auto_enter_lp = true; s_dss_env.sync_status = DSS_STATUS_CFG_READY; @@ -600,7 +574,8 @@ static void dss_op_lp_enter_handler(uint8_t conn_idx) s_dss_env.evt_handler(&evt); } - if (rsp_id) { + if (rsp_id) + { dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_LP_ENTER, rsp_id); } } @@ -617,11 +592,16 @@ static void dss_op_sync_destroy_handler(uint8_t conn_idx) dss_rsp_id_t rsp_id = DSS_RSP_ID_SUCCESS; dss_evt_t evt; - if (s_dss_env.dss_role == DSS_ROLE_SYNC_INVALID) { + if (s_dss_env.dss_role == DSS_ROLE_SYNC_INVALID) + { rsp_id = DSS_RSP_ID_ROLE_ERR; - } else if (ble_sync_source_destroy()) { + } + else if (ble_sync_source_destroy()) + { rsp_id = DSS_RSP_ID_DESTROY_SRC_FAIL; - } else { + } + else + { s_dss_env.sync_status = DSS_STATUS_CFG_READY; s_dss_env.is_in_lp = false; s_dss_env.is_auto_enter_lp = false; @@ -629,13 +609,14 @@ static void dss_op_sync_destroy_handler(uint8_t conn_idx) s_dss_env.event_period = 0; s_dss_env.sync_cnt = 0; s_dss_env.sync_device_num = 0; - + evt.conn_idx = conn_idx; evt.evt_type = DSS_EVT_SYNC_DESTROY; s_dss_env.evt_handler(&evt); } - - if (rsp_id) { + + if (rsp_id) + { dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_SYNC_DESTROY, rsp_id); } } @@ -653,16 +634,16 @@ static sdk_err_t dss_ctrl_pt_rsp_send(uint8_t conn_idx, dss_op_id_t op_id, dss_r { sdk_err_t error_code = SDK_ERR_IND_DISABLED; uint8_t rsp[DSS_CTRL_PT_RSP_VAL_LEN] = {0}; - gatts_noti_ind_t rsp_ind; + ble_gatts_noti_ind_t rsp_ind; rsp[0] = DSS_OP_ID_RSP; rsp[1] = op_id; rsp[2] = rsp_id; - if (s_dss_env.ctrl_pt_ind[conn_idx] == PRF_CLI_START_IND) { + if (s_dss_env.ctrl_pt_ind[conn_idx] == PRF_CLI_START_IND) + { rsp_ind.type = BLE_GATT_INDICATION; - rsp_ind.handle = prf_find_handle_by_idx(DSS_IDX_CTRL_PT_VAL, s_dss_env.start_hdl, - (uint8_t *)&s_dss_env.char_mask); + rsp_ind.handle = prf_find_handle_by_idx(DSS_IDX_CTRL_PT_VAL, s_dss_env.start_hdl, (uint8_t *)&s_dss_env.char_mask); rsp_ind.length = DSS_CTRL_PT_RSP_VAL_LEN; rsp_ind.value = rsp; @@ -683,7 +664,8 @@ static sdk_err_t dss_ctrl_pt_rsp_send(uint8_t conn_idx, dss_op_id_t op_id, dss_r */ static void dss_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length) { - switch (p_data[0]) { + switch(p_data[0]) + { case DSS_OP_ID_ROLE_SET: dss_op_role_set_handler(conn_idx, p_data, length); break; @@ -703,7 +685,7 @@ static void dss_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_ case DSS_OP_ID_SYNC_DESTROY: dss_op_sync_destroy_handler(conn_idx); break; - + case DSS_OP_ID_CANCEL_SYNC: dss_op_cancel_sync_handler(conn_idx); break; @@ -717,46 +699,52 @@ static void dss_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_ static void dss_sync_evt_cb(uint32_t sync_cnt, uint16_t event_period) { - gatts_noti_ind_t send_ntf; + ble_gatts_noti_ind_t send_ntf; sdk_err_t error_code = SDK_ERR_NTF_DISABLED; dss_evt_t evt; - if (s_dss_env.evt_handler == NULL) { + if (NULL == s_dss_env.evt_handler) + { return; } evt.evt_type = DSS_EVT_INVALID; - evt.conn_idx = GAP_INVALID_CONN_INDEX; + evt.conn_idx = BLE_GAP_INVALID_CONN_INDEX; evt.evt_type = DSS_EVT_SYNC_OCCUR; evt.sync_cnt = sync_cnt; s_dss_env.evt_handler(&evt); - if (!s_dss_env.is_in_lp && s_dss_env.is_auto_enter_lp && s_dss_env.evt_handler) { + if (!s_dss_env.is_in_lp && s_dss_env.is_auto_enter_lp && s_dss_env.evt_handler) + { evt.evt_type = DSS_EVT_LP_ENTER; evt.is_enter_lp_mode = true; s_dss_env.evt_handler(&evt); } - if (s_dss_env.is_auto_calib_drift && !(sync_cnt % s_dss_env.auto_calib_timing)) { - evt.sync_dev_num = s_dss_env.sync_device_num; + if (s_dss_env.is_auto_calib_drift && !(sync_cnt % s_dss_env.auto_calib_timing)) + { + evt.sync_dev_num = s_dss_env.sync_device_num; evt.evt_type = DSS_EVT_SYNC_SELF_OR_PEER; evt.is_enter_lp_mode = s_dss_env.is_auto_enter_lp; s_dss_env.sync_status = s_dss_env.dss_role == DSS_ROLE_SYNC_DEVICE ? DSS_STATUS_IN_ADV : DSS_STATUS_IN_SCAN; s_dss_env.evt_handler(&evt); s_dss_env.is_in_lp = false; - } else { + } + else + { s_dss_env.sync_cnt = sync_cnt; s_dss_env.event_period = event_period; - if (!s_dss_env.is_busy_send) { - if (s_dss_env.evt_cnt_ntf[s_dss_env.sync_cfg_conn_idx] == PRF_CLI_START_NTF) { + if (!s_dss_env.is_busy_send) + { + if (s_dss_env.evt_cnt_ntf[s_dss_env.sync_cfg_conn_idx] == PRF_CLI_START_NTF) + { send_ntf.type = BLE_GATT_NOTIFICATION; - send_ntf.handle = prf_find_handle_by_idx(DSS_IDX_SYNC_CNT_VAL, s_dss_env.start_hdl, - (uint8_t *)&s_dss_env.char_mask); + send_ntf.handle = prf_find_handle_by_idx(DSS_IDX_SYNC_CNT_VAL, s_dss_env.start_hdl, (uint8_t *)&s_dss_env.char_mask); send_ntf.length = DSS_EVT_CNT_VALUE_LEN; send_ntf.value = (uint8_t *)&s_dss_env.sync_cnt; @@ -767,13 +755,45 @@ static void dss_sync_evt_cb(uint32_t sync_cnt, uint16_t event_period) } } +static void dss_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + dss_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + dss_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + dss_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + dss_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + dss_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t dss_service_init(dss_evt_handler_t evt_handler) { - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } @@ -792,20 +812,39 @@ sdk_err_t dss_service_init(dss_evt_handler_t evt_handler) s_dss_env.sync_device_num = 0; s_dss_env.sync_cnt = 0; - return ble_server_prf_add(&dss_prf_info); + s_dss_env.start_hdl = PRF_INVALID_HANDLE; + + s_dss_env.dss_gatts_db.shdl = &s_dss_env.start_hdl; + s_dss_env.dss_gatts_db.uuid = s_dss_svc_uuid; + s_dss_env.dss_gatts_db.attr_tab_cfg = (uint8_t *)&(s_dss_env.char_mask); + s_dss_env.dss_gatts_db.max_nb_attr = DSS_IDX_NB; + s_dss_env.dss_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_dss_env.dss_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_dss_env.dss_gatts_db.attr_tab.attr_tab_128 = dss_attr_tab; + + return ble_gatts_prf_add(&s_dss_env.dss_gatts_db, dss_ble_evt_handler); } sdk_err_t dss_sync_op_result_send(uint8_t conn_idx, dss_evt_type_t evt_type, dss_rsp_id_t rsp_id) { - if (evt_type == DSS_EVT_SYNC_SELF_OR_PEER) { + if (evt_type == DSS_EVT_SYNC_SELF_OR_PEER) + { return dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_SYNC, rsp_id); - } else if (evt_type == DSS_EVT_SYNC_CANCEL) { + } + else if (evt_type == DSS_EVT_SYNC_CANCEL) + { return dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_CANCEL_SYNC, rsp_id); - } else if (evt_type == DSS_EVT_LP_ENTER) { + } + else if (evt_type == DSS_EVT_LP_ENTER) + { return dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_LP_ENTER, rsp_id); - } else if (evt_type == DSS_EVT_SYNC_DESTROY) { + } + else if (evt_type == DSS_EVT_SYNC_DESTROY) + { return dss_ctrl_pt_rsp_send(conn_idx, DSS_OP_ID_SYNC_DESTROY, rsp_id); - } else { + } + else + { return SDK_ERR_INVALID_PARAM; } } @@ -832,7 +871,8 @@ void dss_sync_src_distribute(uint8_t conn_idx) dss_op_id_t op_id; dss_rsp_id_t rsp_id = DSS_RSP_ID_SUCCESS; - if (DSS_ROLE_SYNC_SOURCE == s_dss_env.dss_role && ble_sync_source_distribute(conn_idx)) { + if (DSS_ROLE_SYNC_SOURCE == s_dss_env.dss_role && ble_sync_source_distribute(conn_idx)) + { rsp_id = DSS_RSP_ID_DISTR_SRC_FAIL; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.h index fa67042..0c36cdf 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/dss/dss.h @@ -59,26 +59,28 @@ #ifndef __DSS_H__ #define __DSS_H__ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup DSS_MACRO Defines * @{ */ -#define DSS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of DSS connections. */ -#define DSS_ROLE_VALUE_LEN 1 /**< Length of Role characteristic value. */ -#define DSS_EVT_CNT_VALUE_LEN 4 /**< Length of Event Count characteristic value. */ -#define DSS_EVT_PERIOD_VALUE_LEN 2 /**< Length of Event Period characteristic value. */ -#define DSS_STATUS_VALUE_LEN 1 /**< Length of Status characteristic value. */ -#define DSS_CTRL_PT_VALUE_LEN 7 /**< Length of Control Point characteristic value. */ -#define DSS_CTRL_PT_RSP_VAL_LEN 3 /**< Length of Control Point Response characteristic value. */ +#define DSS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x0A, 0xED, 0xA6 /**< DSS service UUID. */ -#define DSS_SYNC_DEV_MAX_NUM 5 /**< Maximun num of Source Sync Device. */ -#define DSS_CFG_ADV_IDX 0 /**< DSS Config Advertising Index. */ -#define DSS_SYNC_ADV_IDX 1 /**< DSS Sync Advertising Index. */ +#define DSS_CONNECTION_MAX 10 /**< Maximum number of DSS connections. */ +#define DSS_ROLE_VALUE_LEN 1 /**< Length of Role characteristic value. */ +#define DSS_EVT_CNT_VALUE_LEN 4 /**< Length of Event Count characteristic value. */ +#define DSS_EVT_PERIOD_VALUE_LEN 2 /**< Length of Event Period characteristic value. */ +#define DSS_STATUS_VALUE_LEN 1 /**< Length of Status characteristic value. */ +#define DSS_CTRL_PT_VALUE_LEN 7 /**< Length of Control Point characteristic value. */ +#define DSS_CTRL_PT_RSP_VAL_LEN 3 /**< Length of Control Point Response characteristic value. */ + +#define DSS_SYNC_DEV_MAX_NUM 5 /**< Maximun num of Source Sync Device. */ +#define DSS_CFG_ADV_IDX 0 /**< DSS Config Advertising Index. */ +#define DSS_SYNC_ADV_IDX 1 /**< DSS Sync Advertising Index. */ /** @} */ /** @@ -86,14 +88,16 @@ * @{ */ /**@brief Device Synchronize Service roles. */ -typedef enum { +typedef enum +{ DSS_ROLE_SYNC_INVALID, /**< Device synchronize invalid role. */ DSS_ROLE_SYNC_SOURCE, /**< Device synchronize source role (Create synchronize source and distribute). */ DSS_ROLE_SYNC_DEVICE, /**< Device synchronize deivce role. */ } dss_role_t; /**@brief Device Synchronize Service status. */ -typedef enum { +typedef enum +{ DSS_STATUS_CFG_READY, /**< Device is ready for config, */ DSS_STATUS_IN_ADV, /**< Device is in advertising. */ DSS_STATUS_IN_SCAN, /**< Device is in scanning. */ @@ -101,7 +105,8 @@ typedef enum { } dss_staus_t; /**@brief Device Synchronize Service control point OP IDs. */ -typedef enum { +typedef enum +{ DSS_OP_ID_INVALID, /**< Invalid op id. */ DSS_OP_ID_ROLE_SET, /**< Set role op id.*/ DSS_OP_ID_SYNC_SRC_CREATE, /**< Create synchronize source op id. */ @@ -113,7 +118,8 @@ typedef enum { } dss_op_id_t; /**@brief Device Synchronize Service control point response IDs. */ -typedef enum { +typedef enum +{ DSS_RSP_ID_SUCCESS, /**< Success. */ DSS_RSP_ID_UNSUPPORT, /**< Unsupport op. */ DSS_RSP_ID_DISALLOWED, /**< Disallowed op. */ @@ -135,7 +141,8 @@ typedef enum { /**@brief Device Synchronize Service event types. */ -typedef enum { +typedef enum +{ DSS_EVT_INVALID, /**< Invalid event. */ DSS_EVT_SOURCE_ROLE_SET, /**< Source Role set event. */ DSS_EVT_DEVICE_ROLE_SET, /**< Device Role set event. */ @@ -153,7 +160,8 @@ typedef enum { * @{ */ /**@brief Device Synchronize Service Synchronize event. */ -typedef struct { +typedef struct +{ dss_evt_type_t evt_type; /**< Event type. */ uint8_t conn_idx; /**< Connect index. */ uint32_t sync_cnt; /**< Synchronize count. */ @@ -224,7 +232,7 @@ void dss_set_status(uint8_t conn_idx, dss_staus_t status); * * @param[in] conn_idx: Connection index. * @param[in] is_auto_enter_lp: Auto enter low power mode flag. - * @param[in] is_auto_calib_drift: Auto calibration drift flag. + * @param[in] is_auto_calib_drift: Auto calibration drift flag. ***************************************************************************************** */ void dss_set_sync_params(uint8_t conn_idx, bool is_auto_enter_lp, bool is_auto_calib_drift); @@ -234,7 +242,7 @@ void dss_set_sync_params(uint8_t conn_idx, bool is_auto_enter_lp, bool is_auto_c * @brief Set Device whether in low power mode. * * @param[in] conn_idx: Connection index. - * @param[in] is_in_lp_mode: Is Device in low power mode. + * @param[in] is_in_lp_mode: Is Device in low power mode. ***************************************************************************************** */ void dss_set_lp_mode(uint8_t conn_idx, bool is_in_lp_mode); diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/BUILD.gn new file mode 100644 index 0000000..8ae5b5c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/BUILD.gn @@ -0,0 +1,26 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("gls") { + sources = [ + "gls.c", + "gls_db.c", + "gls_racp.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.c index 8a58b43..560e05f 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.c @@ -47,15 +47,13 @@ #include "utility.h" #include "app_log.h" -#define XPONENT_OFFSET 12 -#define ENCODE_OFFSET 8 -#define LOCATION_OFFSET 4 /* * ENUMERATIONS **************************************************************************************** */ /**@brief Glucose Service Attributes Indexes. */ -enum { +enum +{ // Glucose Service GLS_IDX_SVC, @@ -86,40 +84,28 @@ enum { ***************************************************************************************** */ /**@brief Glucose Service environment variable. */ -struct gls_env_t { - gls_init_t gls_init; /**< Glucose Service initialization variables. */ - uint16_t start_hdl; /**< Glucose Service start handle. */ - uint16_t next_seq_num; /**< Sequence number of the next database record. */ - uint8_t proc_record_idx; /**< Current record index. */ - uint16_t proc_record_seq_num; /**< Sequence number of current request. */ - uint16_t proc_records_reported; /**< Number of reported records. */ - bool is_record_continue_send; /**< State for continue send record. */ - bool - racp_in_progress; /**< A previously triggered Control Point operation is still in progress. */ - uint8_t - ntf_mask; /**< Mask for measurement notify or measurement context notify. */ - gls_racp_req_t racp_req; /**< Buffer saved current RACP request decode result. */ - uint16_t - meas_ntf_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Glucose Measurement Notification - which is configured by the peer devices. */ - uint16_t - meas_ctx_ntf_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Glucose Measurement - Context Notification which is configured by the peer devices. */ - uint16_t - racp_ind_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Record Access Control Point Indication - which is configured by the peer devices. */ +struct gls_env_t +{ + gls_init_t gls_init; /**< Glucose Service initialization variables. */ + uint16_t start_hdl; /**< Glucose Service start handle. */ + uint16_t next_seq_num; /**< Sequence number of the next database record. */ + uint8_t proc_record_idx; /**< Current record index. */ + uint16_t proc_record_seq_num; /**< Sequence number of current request. */ + uint16_t proc_records_reported; /**< Number of reported records. */ + bool is_record_continue_send; /**< State for continue send record. */ + bool racp_in_progress; /**< A previously triggered Control Point operation is still in progress. */ + uint8_t ntf_mask; /**< Mask for measurement notify or measurement context notify. */ + gls_racp_req_t racp_req; /**< Buffer saved current RACP request decode result. */ + uint16_t meas_ntf_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Glucose Measurement Notification which is configured by the peer devices. */ + uint16_t meas_ctx_ntf_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Glucose Measurement Context Notification which is configured by the peer devices. */ + uint16_t racp_ind_cfg[GLS_CONNECTION_MAX]; /**< The configuration of Record Access Control Point Indication which is configured by the peer devices. */ + ble_gatts_create_db_t gls_gatts_db; /**< Glucose Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION **************************************************************************************** */ -static sdk_err_t gls_init(void); -static void gls_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void gls_write_att_cb(uint8_t conidx, const gatts_write_req_cb_t *p_param); -static void gls_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void gls_disconnect_cb(uint8_t conn_idx, uint8_t reason); -static void gls_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); static void gls_receive_racp_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); static bool gls_are_meas_racp_cccd_configured(uint8_t conn_idx); static sdk_err_t gls_meas_val_send(uint8_t conn_idx, gls_rec_t *p_rec); @@ -129,137 +115,63 @@ static sdk_err_t gls_meas_val_send(uint8_t conn_idx, gls_rec_t *p_rec); **************************************************************************************** */ static struct gls_env_t s_gls_env; +static const uint8_t s_gls_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_GLUCOSE); /**@brief Full GLS Database Description - Used to add attributes into the database. */ -static const attm_desc_t gls_attr_tab[GLS_IDX_NB] = { +static const ble_gatts_attm_desc_t gls_attr_tab[GLS_IDX_NB] = +{ // Glucose Service Declaration - [GLS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [GLS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Glucose Measurement Characteristic Declaration - [GLS_IDX_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GLS_IDX_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Glucose Measurement Characteristic Value - [GLS_IDX_MEAS_VAL] = { - BLE_ATT_CHAR_GLUCOSE_MEAS, NOTIFY_PERM(AUTH), - ATT_VAL_LOC_USER, GLS_MEAS_VAL_LEN_MAX - }, + [GLS_IDX_MEAS_VAL] = {BLE_ATT_CHAR_GLUCOSE_MEAS, BLE_GATTS_NOTIFY_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, GLS_MEAS_VAL_LEN_MAX}, // Glucose Measurement Characteristic - Client Characteristic Configuration Descriptor - [GLS_IDX_MEAS_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM(AUTH) | WRITE_REQ_PERM(AUTH), - 0, 0 - }, + [GLS_IDX_MEAS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_AUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_AUTH), + 0, 0}, // Glucose Measurement Context Characteristic Declaration - [GLS_IDX_MEAS_CTX_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GLS_IDX_MEAS_CTX_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Glucose Measurement Context Characteristic Value - [GLS_IDX_MEAS_CTX_VAL] = { - BLE_ATT_CHAR_GLUCOSE_MEAS_CTX, NOTIFY_PERM(AUTH), - ATT_VAL_LOC_USER, GLS_MEAS_CTX_LEN_MAX - }, + [GLS_IDX_MEAS_CTX_VAL] = {BLE_ATT_CHAR_GLUCOSE_MEAS_CTX, BLE_GATTS_NOTIFY_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, GLS_MEAS_CTX_LEN_MAX}, // Glucose Measurement Context Characteristic - Client Characteristic Configuration Descriptor - [GLS_IDX_MEAS_CTX_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM(AUTH) | WRITE_REQ_PERM(AUTH), - 0, 0 - }, + [GLS_IDX_MEAS_CTX_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_AUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_AUTH), + 0, 0}, // Glucose Features Characteristic Declaration - [GLS_IDX_FEATURE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GLS_IDX_FEATURE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Glucose Features Characteristic Value #if defined(PTS_AUTO_TEST) - [GLS_IDX_FEATURE_VAL] = { - BLE_ATT_CHAR_GLUCOSE_FEATURE, READ_PERM_UNSEC, - ATT_VAL_LOC_USER, sizeof(uint16_t) - }, + [GLS_IDX_FEATURE_VAL] = {BLE_ATT_CHAR_GLUCOSE_FEATURE, BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(uint16_t)}, #else - [GLS_IDX_FEATURE_VAL] = { - BLE_ATT_CHAR_GLUCOSE_FEATURE, READ_PERM(AUTH), - ATT_VAL_LOC_USER, sizeof(uint16_t) - }, + [GLS_IDX_FEATURE_VAL] = {BLE_ATT_CHAR_GLUCOSE_FEATURE, BLE_GATTS_READ_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(uint16_t)}, #endif // Record Access Control Point characteristic Declaration - [GLS_IDX_REC_ACCESS_CTRL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GLS_IDX_REC_ACCESS_CTRL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Record Access Control Point characteristic Value - [GLS_IDX_REC_ACCESS_CTRL_VAL] = { - BLE_ATT_CHAR_REC_ACCESS_CTRL_PT, - INDICATE_PERM_UNSEC | WRITE_REQ_PERM(AUTH), - ATT_VAL_LOC_USER, - GLS_REC_ACCESS_CTRL_LEN_MAX - }, + [GLS_IDX_REC_ACCESS_CTRL_VAL] = {BLE_ATT_CHAR_REC_ACCESS_CTRL_PT, + BLE_GATTS_INDICATE_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + GLS_REC_ACCESS_CTRL_LEN_MAX}, // Record Access Control Point characteristic - Client Characteristic Configuration Descriptor - [GLS_IDX_REC_ACCESS_CTRL_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM(AUTH) | WRITE_REQ_PERM(AUTH), - 0, 0 - }, + [GLS_IDX_REC_ACCESS_CTRL_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_AUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_AUTH), + 0, 0}, }; -/**@brief GLS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t gls_tack_cbs = { - (prf_init_func_t) gls_init, - NULL, - gls_disconnect_cb -}; - -/**@brief GLS Task Callbacks. */ -static gatts_prf_cbs_t gls_cb_func = { - gls_read_att_cb, - gls_write_att_cb, - NULL, - gls_gatts_ntf_ind_cb, - gls_cccd_set_cb -}; - -/**@brief GLS Information. */ -static const prf_server_info_t gls_prf_info = { - .max_connection_nb = GLS_CONNECTION_MAX, - .manager_cbs = &gls_tack_cbs, - .gatts_prf_cbs = &gls_cb_func -}; - /* * LOCAL FUNCTION DEFINITIONS **************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Glucose Service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t gls_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t gls_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_GLUCOSE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - sdk_err_t error_code; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = gls_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_gls_env.gls_init.char_mask); - gatts_db.max_nb_attr = GLS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = gls_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_gls_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -268,9 +180,9 @@ static sdk_err_t gls_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void gls_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void gls_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_gls_env.start_hdl, @@ -279,7 +191,8 @@ static void gls_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case GLS_IDX_MEAS_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_gls_env.meas_ntf_cfg[conn_idx]; @@ -317,64 +230,78 @@ static void gls_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void gls_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void gls_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; bool racp_evt = false; gls_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; - tab_index = prf_find_idx_by_handle(handle, s_gls_env.start_hdl, - GLS_IDX_NB, (uint8_t *)&s_gls_env.gls_init.char_mask); + tab_index = prf_find_idx_by_handle(handle, + s_gls_env.start_hdl, + GLS_IDX_NB, + (uint8_t *)&s_gls_env.gls_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; event.evt_type = GLS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case GLS_IDX_MEAS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ - GLS_EVT_MEAS_NOTIFICATION_ENABLED : GLS_EVT_MEAS_NOTIFICATION_DISABLED); + GLS_EVT_MEAS_NOTIFICATION_ENABLED : \ + GLS_EVT_MEAS_NOTIFICATION_DISABLED); s_gls_env.meas_ntf_cfg[conn_idx] = cccd_value; break; case GLS_IDX_MEAS_CTX_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ - GLS_EVT_CTX_NOTIFICATION_ENABLED : GLS_EVT_CTX_NOTIFICATION_DISABLED); + GLS_EVT_CTX_NOTIFICATION_ENABLED : \ + GLS_EVT_CTX_NOTIFICATION_DISABLED); s_gls_env.meas_ctx_ntf_cfg[conn_idx] = cccd_value; break; case GLS_IDX_REC_ACCESS_CTRL_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ? \ - GLS_EVT_CTRL_INDICATION_ENABLED : GLS_EVT_CTRL_INDICATION_DISABLED); + GLS_EVT_CTRL_INDICATION_ENABLED : \ + GLS_EVT_CTRL_INDICATION_DISABLED); s_gls_env.racp_ind_cfg[conn_idx] = cccd_value; break; case GLS_IDX_REC_ACCESS_CTRL_VAL: - if (!gls_are_meas_racp_cccd_configured(conn_idx)) { + if (!gls_are_meas_racp_cccd_configured(conn_idx)) + { cfm.status = GLS_ERROR_CCCD_INVALID; - } else if (s_gls_env.racp_in_progress && GLS_RACP_OP_ABORT_OP != p_param->value[0]) { + } + else if (s_gls_env.racp_in_progress && GLS_RACP_OP_ABORT_OP != p_param->value[0]) + { cfm.status = GLS_ERROR_PROC_IN_PROCESS; - } else { + } + else + { racp_evt = true; } break; + default: cfm.status = BLE_ATT_ERR_INVALID_HANDLE; break; } ble_gatts_write_cfm(conn_idx, &cfm); - if (racp_evt) { + + if (racp_evt) + { gls_receive_racp_handler(conn_idx, p_param->value, p_param->length); } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && - GLS_EVT_INVALID != event.evt_type && s_gls_env.gls_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && GLS_EVT_INVALID != event.evt_type && s_gls_env.gls_init.evt_handler) + { s_gls_env.gls_init.evt_handler(&event); } } @@ -388,12 +315,13 @@ static void gls_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void gls_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void gls_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; gls_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -405,7 +333,8 @@ static void gls_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = GLS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case GLS_IDX_MEAS_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ GLS_EVT_MEAS_NOTIFICATION_ENABLED : \ @@ -431,7 +360,8 @@ static void gls_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (GLS_EVT_INVALID != event.evt_type && s_gls_env.gls_init.evt_handler) { + if (GLS_EVT_INVALID != event.evt_type && s_gls_env.gls_init.evt_handler) + { s_gls_env.gls_init.evt_handler(&event); } } @@ -444,7 +374,7 @@ static void gls_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] reason: Reason of disconnection. ***************************************************************************************** */ -static void gls_disconnect_cb(uint8_t conn_idx, uint8_t reason) +static void gls_disconnect_evt_handler(uint8_t conn_idx, uint8_t reason) { s_gls_env.racp_in_progress = false; } @@ -461,9 +391,12 @@ static void gls_disconnect_cb(uint8_t conn_idx, uint8_t reason) static bool gls_are_meas_racp_cccd_configured(uint8_t conn_idx) { if ((PRF_CLI_STOP_NTFIND == s_gls_env.meas_ntf_cfg[conn_idx]) || \ - (PRF_CLI_STOP_NTFIND == s_gls_env.racp_ind_cfg[conn_idx])) { + (PRF_CLI_STOP_NTFIND == s_gls_env.racp_ind_cfg[conn_idx])) + { return false; - } else { + } + else + { return true; } } @@ -481,13 +414,20 @@ static bool gls_next_sequence_num_set(void) gls_rec_t gls_res; records_num = gls_db_records_num_get(); - if (records_num > 0) { - if (gls_db_record_get(records_num - 1, &gls_res)) { + + if (0 < records_num) + { + if (gls_db_record_get(records_num - 1, &gls_res)) + { s_gls_env.next_seq_num = gls_res.meas_val.sequence_number + 1; - } else { + } + else + { return false; } - } else { + } + else + { s_gls_env.next_seq_num = 0; } @@ -506,19 +446,18 @@ static void gls_report_records_completed(uint8_t conn_idx) gls_racp_rsp_t racp_rsp; uint8_t encoded_racp_rsp[GLS_REC_ACCESS_CTRL_LEN_MAX]; uint16_t encode_length; - uint8_t ret; - ret = memset_s(&racp_rsp, sizeof(gls_racp_rsp_t), 0, sizeof(gls_racp_rsp_t)); - if (ret < 0) { - return; - } + memset(&racp_rsp, 0, sizeof(gls_racp_rsp_t)); racp_rsp.op_code = GLS_RACP_OP_RSP_CODE; racp_rsp.operand.rsp.op_code_req = GLS_RACP_OP_REP_STRD_RECS; - if (s_gls_env.proc_records_reported) { + if (s_gls_env.proc_records_reported) + { racp_rsp.operand.rsp.status = GLS_RACP_RSP_SUCCESS; - } else { + } + else + { racp_rsp.operand.rsp.status = GLS_RACP_RSP_NO_RECS_FOUND; } @@ -540,11 +479,15 @@ static void gls_all_records_report(uint8_t conn_idx, gls_racp_req_t *p_racp_req) gls_rec_t gls_res; records_num = gls_db_records_num_get(); - if (s_gls_env.proc_record_idx >= records_num) { + + if (s_gls_env.proc_record_idx >= records_num) + { s_gls_env.is_record_continue_send = false; s_gls_env.racp_in_progress = false; gls_report_records_completed(conn_idx); - } else if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) { + } + else if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) + { s_gls_env.is_record_continue_send = true; gls_meas_val_send(conn_idx, &gls_res); } @@ -565,16 +508,21 @@ static void gls_less_or_equal_records_report(uint8_t conn_idx, gls_racp_req_t *p records_num = gls_db_records_num_get(); - while (s_gls_env.proc_record_idx < records_num) { - if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) { - if (s_gls_env.proc_record_seq_num >= gls_res.meas_val.sequence_number) { + while (s_gls_env.proc_record_idx < records_num) + { + if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) + { + if (s_gls_env.proc_record_seq_num >= gls_res.meas_val.sequence_number) + { s_gls_env.is_record_continue_send = true; gls_meas_val_send(conn_idx, &gls_res); return; } s_gls_env.proc_record_idx++; - } else { + } + else + { break; } }; @@ -599,16 +547,21 @@ static void gls_greater_or_equal_records_report(uint8_t conn_idx, gls_racp_req_t records_num = gls_db_records_num_get(); - while (s_gls_env.proc_record_idx < records_num) { - if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) { - if (s_gls_env.proc_record_seq_num <= gls_res.meas_val.sequence_number) { + while (s_gls_env.proc_record_idx < records_num) + { + if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) + { + if (s_gls_env.proc_record_seq_num <= gls_res.meas_val.sequence_number) + { s_gls_env.is_record_continue_send = true; gls_meas_val_send(conn_idx, &gls_res); return; } s_gls_env.proc_record_idx++; - } else { + } + else + { break; } }; @@ -633,29 +586,36 @@ static void gls_within_range_of_records_report(uint8_t conn_idx, gls_racp_req_t records_num = gls_db_records_num_get(); - while (s_gls_env.proc_record_idx < records_num) { - if (!gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) { + while (s_gls_env.proc_record_idx < records_num) + { + if (gls_db_record_get(s_gls_env.proc_record_idx, &gls_res)) + { + if (GLS_RACP_FILTER_SEQ_NUMBER == p_racp_req->filter.racp_filter_type) + { + if ((gls_res.meas_val.sequence_number >= s_gls_env.racp_req.filter.val.seq_num.min) && \ + (gls_res.meas_val.sequence_number <= s_gls_env.racp_req.filter.val.seq_num.max)) + { + s_gls_env.is_record_continue_send = true; + gls_meas_val_send(conn_idx, &gls_res); + return; + } + } + else if (GLS_RACP_FILTER_USER_FACING_TIME == p_racp_req->filter.racp_filter_type) + { + if ( !(-1 == gls_racp_user_time_compare(&gls_res.meas_val.base_time, &s_gls_env.racp_req.filter.val.time.min)) && \ + !(-1 == gls_racp_user_time_compare(&s_gls_env.racp_req.filter.val.time.max, &gls_res.meas_val.base_time))) + { + s_gls_env.is_record_continue_send = true; + gls_meas_val_send(conn_idx, &gls_res); + break; + } + } + s_gls_env.proc_record_idx++; + } + else + { break; } - - if (GLS_RACP_FILTER_SEQ_NUMBER == p_racp_req->filter.racp_filter_type) { - if ((gls_res.meas_val.sequence_number >= s_gls_env.racp_req.filter.val.seq_num.min) && \ - (gls_res.meas_val.sequence_number <= s_gls_env.racp_req.filter.val.seq_num.max)) { - s_gls_env.is_record_continue_send = true; - gls_meas_val_send(conn_idx, &gls_res); - return; - } - } else if (GLS_RACP_FILTER_USER_FACING_TIME == p_racp_req->filter.racp_filter_type) { - if (!(-1 == gls_racp_user_time_compare(&gls_res.meas_val.base_time, \ - &s_gls_env.racp_req.filter.val.time.min)) && \ - !(-1 == gls_racp_user_time_compare(&s_gls_env.racp_req.filter.val.time.max, \ - &gls_res.meas_val.base_time))) { - s_gls_env.is_record_continue_send = true; - gls_meas_val_send(conn_idx, &gls_res); - break; - } - } - s_gls_env.proc_record_idx++; }; s_gls_env.is_record_continue_send = false; @@ -679,21 +639,28 @@ static void gls_first_or_last_records_report(uint8_t conn_idx, gls_racp_req_t *p records_num = gls_db_records_num_get(); - if (0 < s_gls_env.proc_records_reported) { + if (0 < s_gls_env.proc_records_reported || records_num == 0) + { s_gls_env.is_record_continue_send = false; s_gls_env.racp_in_progress = false; gls_report_records_completed(conn_idx); - } else { + } + else + { s_gls_env.is_record_continue_send = true; is_get_rec = false; - if (GLS_RACP_OPERATOR_FIRST_REC == p_racp_req->filter.racp_operator) { + if (GLS_RACP_OPERATOR_FIRST_REC == p_racp_req->filter.racp_operator) + { is_get_rec = gls_db_record_get(0, &gls_res); - } else if (GLS_RACP_OPERATOR_LAST_REC == p_racp_req->filter.racp_operator) { + } + else if (GLS_RACP_OPERATOR_LAST_REC == p_racp_req->filter.racp_operator) + { is_get_rec = gls_db_record_get(records_num - 1, &gls_res); } - if (is_get_rec) { + if (is_get_rec) + { gls_meas_val_send(conn_idx, &gls_res); } } @@ -709,7 +676,8 @@ static void gls_first_or_last_records_report(uint8_t conn_idx, gls_racp_req_t *p */ static void gls_report_records_req_handler(uint8_t conn_idx, gls_racp_req_t *p_racp_req) { - switch (p_racp_req->filter.racp_operator) { + switch (p_racp_req->filter.racp_operator) + { case GLS_RACP_OPERATOR_ALL_RECS: gls_all_records_report(conn_idx, p_racp_req); break; @@ -775,14 +743,11 @@ static void gls_abort_operation_handler(uint8_t conn_idx) gls_racp_rsp_t racp_rsp; uint8_t encoded_racp_rsp[GLS_REC_ACCESS_CTRL_LEN_MAX]; uint16_t encode_length; - uint8_t ret; - ret = memset_s(&racp_rsp, sizeof(gls_racp_rsp_t), 0, sizeof(gls_racp_rsp_t)); - if (ret <0) { - return; - } + memset(&racp_rsp, 0, sizeof(gls_racp_rsp_t)); - if (s_gls_env.racp_in_progress) { + if (s_gls_env.racp_in_progress) + { s_gls_env.racp_in_progress = false; } @@ -810,40 +775,46 @@ static void gls_receive_racp_handler(uint8_t conn_idx, const uint8_t *p_data, ui gls_racp_operand_t status; uint8_t encoded_racp_rsp[GLS_REC_ACCESS_CTRL_LEN_MAX]; uint16_t encode_length; - uint8_t ret; - ret = memset_S(&s_gls_env.racp_req, sizeof(gls_racp_req_t), 0, sizeof(gls_racp_req_t)); - if (ret < 0) { - return; - } - ret = memset_S(&racp_rsp, sizeof(gls_racp_rsp_t), 0, sizeof(gls_racp_rsp_t)); - if (ret < 0) { - return; - } + memset(&s_gls_env.racp_req, 0, sizeof(gls_racp_req_t)); + memset(&racp_rsp, 0, sizeof(gls_racp_rsp_t)); - if (GLS_REC_ACCESS_CTRL_LEN_MIN <= length) { + if (GLS_REC_ACCESS_CTRL_LEN_MIN <= length) + { status = gls_racp_req_decode(p_data, length, &s_gls_env.racp_req); + if ((GLS_RACP_RSP_VALID_DECODE == status) && \ - (GLS_RACP_OP_REP_STRD_RECS <= s_gls_env.racp_req.op_code) && \ - (GLS_RACP_OP_REP_NB_OF_STRD_RECS >= s_gls_env.racp_req.op_code)) { - if (GLS_RACP_OP_REP_STRD_RECS == s_gls_env.racp_req.op_code) { + (GLS_RACP_OP_REP_STRD_RECS <= s_gls_env.racp_req.op_code) && \ + (GLS_RACP_OP_REP_NB_OF_STRD_RECS >= s_gls_env.racp_req.op_code)) + { + if (GLS_RACP_OP_REP_STRD_RECS == s_gls_env.racp_req.op_code) + { s_gls_env.racp_in_progress = true; s_gls_env.proc_records_reported = 0; s_gls_env.proc_record_idx = 0; gls_report_records_req_handler(conn_idx, &s_gls_env.racp_req); - } else if (GLS_RACP_OP_REP_NB_OF_STRD_RECS == s_gls_env.racp_req.op_code) { + } + else if (GLS_RACP_OP_REP_NB_OF_STRD_RECS == s_gls_env.racp_req.op_code) + { s_gls_env.racp_in_progress = true; gls_report_records_num_req_handler(conn_idx, &s_gls_env.racp_req); - } else if (GLS_RACP_OP_ABORT_OP == s_gls_env.racp_req.op_code) { + } + else if (GLS_RACP_OP_ABORT_OP == s_gls_env.racp_req.op_code) + { gls_abort_operation_handler(conn_idx); } - } else { - if (GLS_RACP_RSP_VALID_DECODE != status) { + } + + else + { + if (GLS_RACP_RSP_VALID_DECODE != status) + { racp_rsp.operand.rsp.status = status; } if ((GLS_RACP_OP_REP_STRD_RECS > s_gls_env.racp_req.op_code) || \ - (GLS_RACP_OP_REP_NB_OF_STRD_RECS < s_gls_env.racp_req.op_code)) { + (GLS_RACP_OP_REP_NB_OF_STRD_RECS < s_gls_env.racp_req.op_code)) + { racp_rsp.operand.rsp.status = GLS_RACP_RSP_OP_CODE_NOT_SUP; } @@ -853,6 +824,7 @@ static void gls_receive_racp_handler(uint8_t conn_idx, const uint8_t *p_data, ui gls_racp_rsp_send(conn_idx, encoded_racp_rsp, encode_length); } } + } /** @@ -876,29 +848,32 @@ static uint8_t gls_meas_value_encode(const gls_meas_val_t *p_meas, uint8_t *p_en p_encoded_buffer[length++] = LO_U16(p_meas->base_time.year); p_encoded_buffer[length++] = HI_U16(p_meas->base_time.year); - p_encoded_buffer[length++] = LO_U16(p_meas->base_time.month); - p_encoded_buffer[length++] = HI_U16(p_meas->base_time.day); - p_encoded_buffer[length++] = LO_U16(p_meas->base_time.hour); - p_encoded_buffer[length++] = HI_U16(p_meas->base_time.min); - p_encoded_buffer[length++] = LO_U16(p_meas->base_time.sec); + p_encoded_buffer[length++] = p_meas->base_time.month; + p_encoded_buffer[length++] = p_meas->base_time.day; + p_encoded_buffer[length++] = p_meas->base_time.hour; + p_encoded_buffer[length++] = p_meas->base_time.min; + p_encoded_buffer[length++] = p_meas->base_time.sec; - if (p_meas->flags & GLS_MEAS_FLAG_TIME_OFFSET) { + if (p_meas->flags & GLS_MEAS_FLAG_TIME_OFFSET) + { p_encoded_buffer[length++] = LO_U16(p_meas->time_offset); p_encoded_buffer[length++] = HI_U16(p_meas->time_offset); } - if (p_meas->flags & GLS_MEAS_FLAG_CONC_TYPE_LOC) { + if (p_meas->flags & GLS_MEAS_FLAG_CONC_TYPE_LOC) + { uint16_t encoded_concentration; - encoded_concentration = ((p_meas->glucose_concentration.exponent << XPONENT_OFFSET) & 0xF000) | + encoded_concentration = ((p_meas->glucose_concentration.exponent << 12) & 0xF000) | ((p_meas->glucose_concentration.mantissa << 0) & 0x0FFF); p_encoded_buffer[length++] = (uint8_t)(encoded_concentration); - p_encoded_buffer[length++] = (uint8_t)(encoded_concentration >> ENCODE_OFFSET); - p_encoded_buffer[length++] = (p_meas->sample_location << LOCATION_OFFSET) | (p_meas->type & 0x0F); + p_encoded_buffer[length++] = (uint8_t)(encoded_concentration >> 8); + p_encoded_buffer[length++] = (p_meas->sample_location << 4) | (p_meas->type & 0x0F); } - if (p_meas->flags & GLS_MEAS_FLAG_SENSOR_STATUS) { + if (p_meas->flags & GLS_MEAS_FLAG_SENSOR_STATUS) + { p_encoded_buffer[length++] = LO_U16(p_meas->sensor_status_annunciation); p_encoded_buffer[length++] = HI_U16(p_meas->sensor_status_annunciation); } @@ -921,17 +896,14 @@ static sdk_err_t gls_meas_val_send(uint8_t conn_idx, gls_rec_t *p_rec) sdk_err_t error_code = BLE_SUCCESS; uint8_t encoded_glc_meas[GLS_MEAS_VAL_LEN_MAX]; uint16_t length; - gatts_noti_ind_t gls_ntf; - sdk_err_t ret; + ble_gatts_noti_ind_t gls_ntf; length = gls_meas_value_encode(&p_rec->meas_val, encoded_glc_meas); - ret = memset_s(&gls_ntf, sizeof(gatts_noti_ind_t), 0, sizeof(gatts_noti_ind_t)); - if (ret < 0) { - return ret; - } + memset(&gls_ntf, 0, sizeof (ble_gatts_noti_ind_t)); - if (PRF_CLI_START_NTF == s_gls_env.meas_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_gls_env.meas_ntf_cfg[conn_idx]) + { gls_ntf.type = BLE_GATT_NOTIFICATION; gls_ntf.handle = prf_find_handle_by_idx(GLS_IDX_MEAS_VAL, s_gls_env.start_hdl, @@ -939,7 +911,9 @@ static sdk_err_t gls_meas_val_send(uint8_t conn_idx, gls_rec_t *p_rec) gls_ntf.length = length; gls_ntf.value = encoded_glc_meas; error_code = ble_gatts_noti_ind(conn_idx, &gls_ntf); - if (BLE_SUCCESS == error_code) { + + if (BLE_SUCCESS == error_code) + { s_gls_env.ntf_mask = GLS_NTF_OF_MEAS; } } @@ -955,26 +929,63 @@ static sdk_err_t gls_meas_val_send(uint8_t conn_idx, gls_rec_t *p_rec) * @param[in] p_param: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void gls_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void gls_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (SDK_SUCCESS != status) { + if (SDK_SUCCESS == status) + { + if (BLE_GATT_INDICATION == p_ntf_ind->type) + { + s_gls_env.racp_in_progress = false; + } + else if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { + if (s_gls_env.ntf_mask & GLS_NTF_OF_MEAS) + { + s_gls_env.ntf_mask = GLS_NTF_OF_NULL; + + if (s_gls_env.is_record_continue_send) + { + s_gls_env.proc_record_idx++; + s_gls_env.proc_records_reported++; + gls_report_records_req_handler(conn_idx, &s_gls_env.racp_req); + } + else + { + s_gls_env.racp_in_progress = false; + } + } + } + } +} + +static void gls_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { return; } - if (BLE_GATT_INDICATION == p_ntf_ind->type) { - s_gls_env.racp_in_progress = false; - } else if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { - if (s_gls_env.ntf_mask & GLS_NTF_OF_MEAS) { - s_gls_env.ntf_mask = GLS_NTF_OF_NULL; + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + gls_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; - if (s_gls_env.is_record_continue_send) { - s_gls_env.proc_record_idx++; - s_gls_env.proc_records_reported++; - gls_report_records_req_handler(conn_idx, &s_gls_env.racp_req); - } else { - s_gls_env.racp_in_progress = false; - } - } + case BLE_GATTS_EVT_WRITE_REQUEST: + gls_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + gls_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + gls_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + gls_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; } } @@ -991,13 +1002,14 @@ bool gls_new_meas_record(gls_rec_t *p_rec) sdk_err_t gls_racp_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t racp_rsp; + ble_gatts_noti_ind_t racp_rsp; - if (PRF_CLI_START_IND == s_gls_env.racp_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_gls_env.racp_ind_cfg[conn_idx]) + { racp_rsp.type = BLE_GATT_INDICATION; racp_rsp.handle = prf_find_handle_by_idx(GLS_IDX_REC_ACCESS_CTRL_VAL, - s_gls_env.start_hdl, - (uint8_t *)&s_gls_env.gls_init.char_mask); + s_gls_env.start_hdl, + (uint8_t *)&s_gls_env.gls_init.char_mask); racp_rsp.length = length; racp_rsp.value = p_data; error_code = ble_gatts_noti_ind(conn_idx, &racp_rsp); @@ -1008,21 +1020,25 @@ sdk_err_t gls_racp_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length sdk_err_t gls_service_init(gls_init_t *p_gls_init) { - sdk_err_t ret; - if (p_gls_init == NULL) { + if (NULL == p_gls_init) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_gls_env, sizeof(s_gls_env), 0, sizeof(s_gls_env)); - if (ret < 0) { - return ret; - } - ret = memcpy_s(&s_gls_env.gls_init, sizeof(gls_init_t), p_gls_init, sizeof(gls_init_t)); - if (ret < 0) { - return ret; - } + memset(&s_gls_env, 0, sizeof(s_gls_env)); + memcpy(&s_gls_env.gls_init, p_gls_init, sizeof(gls_init_t)); gls_next_sequence_num_set(); gls_db_init(); - return ble_server_prf_add(&gls_prf_info); + s_gls_env.start_hdl = PRF_INVALID_HANDLE; + + s_gls_env.gls_gatts_db.shdl = &s_gls_env.start_hdl; + s_gls_env.gls_gatts_db.uuid = s_gls_svc_uuid; + s_gls_env.gls_gatts_db.attr_tab_cfg = (uint8_t *)&(s_gls_env.gls_init.char_mask); + s_gls_env.gls_gatts_db.max_nb_attr = GLS_IDX_NB; + s_gls_env.gls_gatts_db.srvc_perm = 0; + s_gls_env.gls_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_gls_env.gls_gatts_db.attr_tab.attr_tab_16 = gls_attr_tab; + + return ble_gatts_prf_add(&s_gls_env.gls_gatts_db, gls_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.h index 6145dca..baba015 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls.h @@ -64,41 +64,38 @@ * INCLUDE FILES **************************************************************************************** */ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup GLS_MACRO Defines * @{ */ -#define GLS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Glucose Profile connections. */ -#define GLS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of GLS measurement value. */ -#define GLS_MEAS_CTX_LEN_MAX 20 /**< Maximum length of GLS measurement context value. */ -#define GLS_REC_ACCESS_CTRL_LEN_MIN 2 /**< Minimum length of Record Access Control Point packet. */ -#define GLS_REC_ACCESS_CTRL_LEN_MAX 21 /**< Maximum length of Record Access Control Point packet. */ +#define GLS_CONNECTION_MAX 10 /**< Maximum number of Glucose Profile connections. */ +#define GLS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of GLS measurement value. */ +#define GLS_MEAS_CTX_LEN_MAX 20 /**< Maximum length of GLS measurement context value. */ +#define GLS_REC_ACCESS_CTRL_LEN_MIN 2 /**< Minimum length of Record Access Control Point packet. */ +#define GLS_REC_ACCESS_CTRL_LEN_MAX 21 /**< Maximum length of Record Access Control Point packet. */ #define GLS_NTF_OF_NULL 0x00 /**< Mask for no notify. */ #define GLS_NTF_OF_MEAS 0x01 /**< Mask for measurement notify. */ #define GLS_NTF_OF_MEAS_CTX 0x10 /**< Mask for measurement context notify. */ -#define GLS_ERROR_PROC_IN_PROCESS 0x80 /**< Error code: A previously triggered SC Control Point operation \ - is still in progress. */ -#define GLS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor \ - is not configured. */ +#define GLS_ERROR_PROC_IN_PROCESS 0x80 /**< Error code: A previously triggered SC Control Point operation is still in progress. */ +#define GLS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor is not configured. */ /** * @defgroup GLS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref gls_init_t.char_mask. */ -#define GLS_CHAR_MANDATORY 0x0f8f /**< Bit mask for mandatory characteristic in GLS. */ -#define GLS_CHAR_MEAS_CTX_SUP 0x0070 /**< Bit mask for Glucose Measurement Context characteristic that is optional. */ -#define GLS_CHAR_FULL 0x0fff /**< Bit mask of the full characteristic. */ +#define GLS_CHAR_MANDATORY 0x0f8f /**< Bit mask for mandatory characteristic in GLS. */ +#define GLS_CHAR_MEAS_CTX_SUP 0x0070 /**< Bit mask for Glucose Measurement Context characteristic that is optional. */ +#define GLS_CHAR_FULL 0x0fff /**< Bit mask of the full characteristic. */ /** @} */ /** @@ -157,21 +154,16 @@ */ #define GLS_MEAS_STATUS_BATT_LOW (0x01 << 0) /**< Device battery low at time of measurement */ #define GLS_MEAS_STATUS_SENSOR_FAULT (0x01 << 1) /**< Sensor malfunction or faulting at time of measurement */ -#define GLS_MEAS_STATUS_SAMPLE_SIZE (0x01 << 2) /**< Sample size for blood or control solution insufficient \ - at time of measurement */ +#define GLS_MEAS_STATUS_SAMPLE_SIZE (0x01 << 2) /**< Sample size for blood or control solution insufficient at time of measurement */ #define GLS_MEAS_STATUS_STRIP_INSERT (0x01 << 3) /**< Strip insertion error */ #define GLS_MEAS_STATUS_STRIP_TYPE (0x01 << 4) /**< Strip type incorrect for device */ #define GLS_MEAS_STATUS_RESULT_HIGH (0x01 << 5) /**< Sensor result higher than the device can process */ #define GLS_MEAS_STATUS_RESULT_LOW (0x01 << 6) /**< Sensor result lower than the device can process */ -#define GLS_MEAS_STATUS_TEMP_HIGH (0x01 << 7) /**< Sensor temperature too high for valid test/result \ - at time of measurement */ -#define GLS_MEAS_STATUS_TEMP_LOW (0x01 << 8) /**< Sensor temperature too low for valid test/result \ - at time of measurement */ -#define GLS_MEAS_STATUS_STRIP_PULL (0x01 << 9) /**< Sensor read interrupted because strip was pulled too soon \ - at time of measurement */ +#define GLS_MEAS_STATUS_TEMP_HIGH (0x01 << 7) /**< Sensor temperature too high for valid test/result at time of measurement */ +#define GLS_MEAS_STATUS_TEMP_LOW (0x01 << 8) /**< Sensor temperature too low for valid test/result at time of measurement */ +#define GLS_MEAS_STATUS_STRIP_PULL (0x01 << 9) /**< Sensor read interrupted because strip was pulled too soon at time of measurement */ #define GLS_MEAS_STATUS_GENERAL_FAULT (0x01 << 10) /**< General device fault has occurred in the sensor */ -#define GLS_MEAS_STATUS_TIME_FAULT (0x01 << 11) /**< Time fault has occurred in the sensor and \ - time may be inaccurate */ +#define GLS_MEAS_STATUS_TIME_FAULT (0x01 << 11) /**< Time fault has occurred in the sensor and time may be inaccurate */ /** @} */ /** @} */ @@ -180,7 +172,8 @@ * @{ */ /**@brief Glucose measurement type */ -typedef enum { +typedef enum +{ GLS_MEAS_TYPE_CAP_BLOOD = 0x01, /**< Capillary whole blood */ GLS_MEAS_TYPE_CAP_PLASMA, /**< Capillary plasma */ GLS_MEAS_TYPE_VEN_BLOOD, /**< Venous whole blood */ @@ -194,7 +187,8 @@ typedef enum { } gls_meas_type_t; /**@brief Glucose measurement location */ -typedef enum { +typedef enum +{ GLS_MEAS_LOC_FINGER = 0x01, /**< Finger */ GLS_MEAS_LOC_AST, /**< Alternate Site Test (AST) */ GLS_MEAS_LOC_EAR, /**< Earlobe */ @@ -203,7 +197,8 @@ typedef enum { } gls_meas_loc_t; /**@brief Glucose measurement context carbohydrate ID */ -typedef enum { +typedef enum +{ GLS_MEAS_CTX_CARB_BREAKFAST = 0x01, /**< Breakfast */ GLS_MEAS_CTX_CARB_LUNCH, /**< Lunch */ GLS_MEAS_CTX_CARB_DINNER, /**< Dinner */ @@ -214,7 +209,8 @@ typedef enum { } gls_meas_ctx_carb_id_t; /**@brief Glucose measurement context meal */ -typedef enum { +typedef enum +{ GLS_MEAS_CTX_MEAL_PREPRANDIAL = 0x01, /**< Preprandial (before meal) */ GLS_MEAS_CTX_MEAL_POSTPRANDIAL, /**< Postprandial (after meal) */ GLS_MEAS_CTX_MEAL_FASTING, /**< Fasting */ @@ -223,7 +219,8 @@ typedef enum { } gls_meas_ctx_meal_t; /**@brief Glucose measurement context tester */ -typedef enum { +typedef enum +{ GLS_MEAS_CTX_TESTER_SELF = 0x01, /**< Self */ GLS_MEAS_CTX_TESTER_PRO, /**< Health care professional */ GLS_MEAS_CTX_TESTER_LAB, /**< Lab test */ @@ -231,7 +228,8 @@ typedef enum { } gls_meas_ctx_tester_t; /**@brief Glucose measurement context health */ -typedef enum { +typedef enum +{ GLS_MEAS_CTX_HEALTH_MINOR = 0x01, /**< Minor health issues */ GLS_MEAS_CTX_HEALTH_MAJOR, /**< Major health issues */ GLS_MEAS_CTX_HEALTH_MENSES, /**< During menses */ @@ -241,7 +239,8 @@ typedef enum { } gls_meas_ctx_health_t; /**@brief Glucose measurement context medication ID */ -typedef enum { +typedef enum +{ GLS_MEAS_CTX_MED_RAPID = 0x01, /**< Rapid acting insulin */ GLS_MEAS_CTX_MED_SHORT, /**< Short acting insulin */ GLS_MEAS_CTX_MED_INTERMED, /**< Intermediate acting insulin */ @@ -250,7 +249,8 @@ typedef enum { } gls_meas_ctx_medic_id_t; /**@brief Glucose Service event type. */ -typedef enum { +typedef enum +{ GLS_EVT_INVALID = 0x00, /**< Invalid event. */ GLS_EVT_MEAS_NOTIFICATION_ENABLED, /**< Glucose Measurement notification enabled event. */ GLS_EVT_MEAS_NOTIFICATION_DISABLED, /**< Glucose Measurement notification disabled event. */ @@ -267,13 +267,15 @@ typedef enum { * @{ */ /**@brief SFLOAT format (IEEE-11073 16-bit FLOAT, defined as a 16-bit value with 12-bit mantissa and 4-bit exponent). */ -typedef struct { +typedef struct +{ int8_t exponent; /**< Base 10 exponent, only 4 bits. */ int16_t mantissa; /**< Mantissa, only 12 bits. */ -} ieee_float16_t; +} gls_ieee_float16_t; /**@brief Glucose Service event. */ -typedef struct { +typedef struct +{ gls_evt_type_t evt_type; /**< The GLS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -294,43 +296,46 @@ typedef void (*gls_evt_handler_t)(gls_evt_t *p_evt); * @{ */ /**@brief Glucose Measurement structure. This contains glucose measurement value. */ -typedef struct { - uint8_t flags; /**< Flags. */ - uint16_t sequence_number; /**< Sequence number. */ - prf_date_time_t base_time; /**< Time stamp. */ - int16_t time_offset; /**< Time offset. */ - ieee_float16_t glucose_concentration; /**< Glucose concentration. */ - uint8_t type; /**< Type. */ - uint8_t sample_location; /**< Sample location. */ - uint16_t sensor_status_annunciation; /**< Sensor status annunciation. */ +typedef struct +{ + uint8_t flags; /**< Flags. */ + uint16_t sequence_number; /**< Sequence number. */ + prf_date_time_t base_time; /**< Time stamp. */ + int16_t time_offset; /**< Time offset. */ + gls_ieee_float16_t glucose_concentration; /**< Glucose concentration. */ + uint8_t type; /**< Type. */ + uint8_t sample_location; /**< Sample location. */ + uint16_t sensor_status_annunciation; /**< Sensor status annunciation. */ } gls_meas_val_t; /**@brief Glucose measurement context structure */ -typedef struct { - uint8_t flags; /**< Flags. */ - uint8_t extended_flags; /**< Extended Flags. */ - uint8_t carbohydrate_id; /**< Carbohydrate ID. */ - ieee_float16_t carbohydrate; /**< Carbohydrate. */ - uint8_t meal; /**< Meal. */ - uint8_t tester_and_health; /**< Tester and health. */ - uint16_t exercise_duration; /**< Exercise Duration. */ - uint8_t exercise_intensity; /**< Exercise Intensity. */ - uint8_t medication_id; /**< Medication ID. */ - ieee_float16_t medication; /**< Medication. */ - uint16_t hba1c; /**< HbA1c. */ +typedef struct +{ + uint8_t flags; /**< Flags. */ + uint8_t extended_flags; /**< Extended Flags. */ + uint8_t carbohydrate_id; /**< Carbohydrate ID. */ + gls_ieee_float16_t carbohydrate; /**< Carbohydrate. */ + uint8_t meal; /**< Meal. */ + uint8_t tester_and_health; /**< Tester and health. */ + uint16_t exercise_duration; /**< Exercise Duration. */ + uint8_t exercise_intensity; /**< Exercise Intensity. */ + uint8_t medication_id; /**< Medication ID. */ + gls_ieee_float16_t medication; /**< Medication. */ + uint16_t hba1c; /**< HbA1c. */ } gls_meas_ctx_t; /**@brief Glucose measurement record */ -typedef struct { +typedef struct +{ gls_meas_val_t meas_val; /**< Glucose measurement value. */ gls_meas_ctx_t meas_ctx; /**< Glucose measurement context. */ } gls_rec_t; /**@brief Glucose Service init stucture. This contains all option and data needed for initialization of the service. */ -typedef struct { +typedef struct +{ gls_evt_handler_t evt_handler; /**< Glucose Service event handler. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref GLS_CHAR_MASK. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref GLS_CHAR_MASK. */ uint16_t feature; /**< Initial value for features. */ } gls_init_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.c index 9d07277..f6a1a61 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.c @@ -46,17 +46,18 @@ ***************************************************************************************** */ /**@brief Glucose Service record structure. */ -struct gls_db_single_rec_t { +struct gls_db_single_rec_t +{ bool is_recorded; gls_rec_t record; }; /**@brief Glucose Service Database environment variable. */ -struct gls_db_env_t { - struct gls_db_single_rec_t database[GLS_DB_RECORDS_MAX]; /**< Glucose Service measurement values \ - records database. */ +struct gls_db_env_t +{ + struct gls_db_single_rec_t database[GLS_DB_RECORDS_MAX]; /**< Glucose Service measurement values records database. */ uint8_t rec_index[GLS_DB_RECORDS_MAX]; /**< Glucose Service measurement values record indexs. */ - uint16_t num_records; /**< Number of measurement values records in database. */ + uint16_t num_records; /**< Number of measurement values records in database. */ }; /* @@ -83,19 +84,29 @@ uint16_t gls_db_le_or_eq_record_num_get(gls_racp_filter_t *p_filter) gls_rec_t gls_res; uint16_t num_get = 0; - for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) { - if (!gls_db_record_get(i, &gls_res)) { - return num_get; + for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) + { + if (gls_db_record_get(i, &gls_res)) + { + if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) + { + if (p_filter->val.seq_num.max >= gls_res.meas_val.sequence_number) + { + num_get++; + } + } + else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) + { + if (-1 != gls_racp_user_time_compare(&p_filter->val.time.max, + &gls_res.meas_val.base_time)) + { + num_get++; + } + } } - if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) { - if (p_filter->val.seq_num.max >= gls_res.meas_val.sequence_number) { - num_get++; - } - } else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) { - if (-1 != gls_racp_user_time_compare(&p_filter->val.time.max, - &gls_res.meas_val.base_time)) { - num_get++; - } + else + { + break; } } @@ -116,21 +127,33 @@ uint16_t gls_db_gt_or_eq_record_num_get(gls_racp_filter_t *p_filter) gls_rec_t gls_res; uint16_t num_get = 0; - for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) { - if (gls_db_record_get(i, &gls_res)) { - return num_get; + for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) + { + if (gls_db_record_get(i, &gls_res)) + { + if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) + { + if (p_filter->val.seq_num.min <= gls_res.meas_val.sequence_number) + { + num_get++; + } + } + else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) + { + if (-1 != gls_racp_user_time_compare(&gls_res.meas_val.base_time, + &p_filter->val.time.min)) + { + num_get++; + } + } } - if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) { - if (p_filter->val.seq_num.min <= gls_res.meas_val.sequence_number) { - num_get++; - } - } else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) { - if (-1 != gls_racp_user_time_compare(&gls_res.meas_val.base_time, - &p_filter->val.time.min)) { - num_get++; - } + else + { + break; } } + + return num_get; } /** @@ -147,20 +170,31 @@ uint16_t gls_db_within_range_record_num_get(gls_racp_filter_t *p_filter) gls_rec_t gls_res; uint16_t num_get = 0; - for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) { - if (gls_db_record_get(i, &gls_res)) { - return num_get; + + for (uint8_t i = 0; i < s_gls_db_env.num_records; i++) + { + if (gls_db_record_get(i, &gls_res)) + { + if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) + { + if ((gls_res.meas_val.sequence_number >= p_filter->val.seq_num.min) && \ + (gls_res.meas_val.sequence_number <= p_filter->val.seq_num.max)) + { + num_get++; + } + } + else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) + { + if ((-1 != gls_racp_user_time_compare(&gls_res.meas_val.base_time, &p_filter->val.time.min)) && \ + (-1 != gls_racp_user_time_compare(&p_filter->val.time.max, &gls_res.meas_val.base_time))) + { + num_get++; + } + } } - if (GLS_RACP_FILTER_SEQ_NUMBER == p_filter->racp_filter_type) { - if ((gls_res.meas_val.sequence_number >= p_filter->val.seq_num.min) && \ - (gls_res.meas_val.sequence_number <= p_filter->val.seq_num.max)) { - num_get++; - } - } else if (GLS_RACP_FILTER_USER_FACING_TIME == p_filter->racp_filter_type) { - if ((-1 != gls_racp_user_time_compare(&gls_res.meas_val.base_time, &p_filter->val.time.min)) && \ - (-1 != gls_racp_user_time_compare(&p_filter->val.time.max, &gls_res.meas_val.base_time))) { - num_get++; - } + else + { + break; } } @@ -173,7 +207,8 @@ uint16_t gls_db_within_range_record_num_get(gls_racp_filter_t *p_filter) */ void gls_db_init(void) { - for (uint8_t i = 0; i < GLS_DB_RECORDS_MAX; i++) { + for (uint8_t i = 0; i < GLS_DB_RECORDS_MAX; i++) + { s_gls_db_env.database[i].is_recorded = false; s_gls_db_env.rec_index[i] = 0xFF; } @@ -185,12 +220,15 @@ bool gls_db_record_add(gls_rec_t *p_rec) { uint8_t i = 0; - if (GLS_DB_RECORDS_MAX <= s_gls_db_env.num_records) { + if (GLS_DB_RECORDS_MAX <= s_gls_db_env.num_records) + { return false; } - for (i = 0; i < GLS_DB_RECORDS_MAX; i++) { - if (!s_gls_db_env.database[i].is_recorded) { + for (i = 0; i < GLS_DB_RECORDS_MAX; i++) + { + if (!s_gls_db_env.database[i].is_recorded) + { s_gls_db_env.database[i].is_recorded = true; s_gls_db_env.database[i].record = *p_rec; s_gls_db_env.rec_index[s_gls_db_env.num_records] = i; @@ -204,7 +242,8 @@ bool gls_db_record_add(gls_rec_t *p_rec) bool gls_db_record_delete(uint8_t rec_idx) { - if (rec_idx >= s_gls_db_env.num_records) { + if (rec_idx >= s_gls_db_env.num_records) + { return false; } @@ -212,7 +251,8 @@ bool gls_db_record_delete(uint8_t rec_idx) s_gls_db_env.num_records--; - for (uint8_t i = rec_idx; i < s_gls_db_env.num_records; i++) { + for (uint8_t i = rec_idx; i < s_gls_db_env.num_records; i++) + { s_gls_db_env.rec_index[i] = s_gls_db_env.rec_index[i + 1]; } @@ -228,7 +268,8 @@ uint16_t gls_db_filter_records_num_get(gls_racp_filter_t *p_filter) { uint16_t num_get = 0; - switch (p_filter->racp_operator) { + switch (p_filter->racp_operator) + { case GLS_RACP_OPERATOR_ALL_RECS: num_get = s_gls_db_env.num_records; break; @@ -247,7 +288,8 @@ uint16_t gls_db_filter_records_num_get(gls_racp_filter_t *p_filter) case GLS_RACP_OPERATOR_FIRST_REC: case GLS_RACP_OPERATOR_LAST_REC: - if (s_gls_db_env.num_records != 0) { + if (0 != s_gls_db_env.num_records) + { num_get = 1; } break; @@ -261,7 +303,8 @@ uint16_t gls_db_filter_records_num_get(gls_racp_filter_t *p_filter) bool gls_db_record_get(uint8_t rec_idx, gls_rec_t *p_rec) { - if (rec_idx >= s_gls_db_env.num_records) { + if (rec_idx >= s_gls_db_env.num_records) + { return false; } @@ -272,7 +315,8 @@ bool gls_db_record_get(uint8_t rec_idx, gls_rec_t *p_rec) void gls_db_record_clear(void) { - for (uint8_t i = 0; i < GLS_DB_RECORDS_MAX; i++) { + for (uint8_t i = 0; i < GLS_DB_RECORDS_MAX; i++) + { s_gls_db_env.database[i].is_recorded = false; s_gls_db_env.rec_index[i] = 0xFF; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.h index 1e2bc78..5288ad0 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_db.h @@ -54,10 +54,10 @@ #ifndef __GLS_DB_H__ #define __GLS_DB_H__ -#include -#include #include "gls.h" #include "gls_racp.h" +#include +#include /** * @defgroup GLS_DB_MAROC Defines diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.c index 9e04d14..a16f05f 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.c @@ -42,47 +42,64 @@ #include "gls_racp.h" #include "ble_prf_utils.h" #include "utility.h" -#define SCALE_2 2 -#define ADD_2 2 + /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** */ int8_t gls_racp_user_time_compare(prf_date_time_t *p_compared_date_time, prf_date_time_t *p_base_date_time) { - if (p_compared_date_time->year < p_base_date_time->year) { + if (p_compared_date_time->year < p_base_date_time->year) + { return -1; - } else if (p_compared_date_time->year > p_base_date_time->year) { + } + else if (p_compared_date_time->year > p_base_date_time->year) + { return 1; } - if (p_compared_date_time->month < p_base_date_time->month) { + if (p_compared_date_time->month < p_base_date_time->month) + { return -1; - } else if (p_compared_date_time->month > p_base_date_time->month) { + } + else if (p_compared_date_time->month > p_base_date_time->month) + { return 1; } - if (p_compared_date_time->day < p_base_date_time->day) { + if (p_compared_date_time->day < p_base_date_time->day) + { return -1; - } else if (p_compared_date_time->day > p_base_date_time->day) { + } + else if (p_compared_date_time->day > p_base_date_time->day) + { return 1; } - if (p_compared_date_time->hour < p_base_date_time->hour) { + if (p_compared_date_time->hour < p_base_date_time->hour) + { return -1; - } else if (p_compared_date_time->hour > p_base_date_time->hour) { + } + else if (p_compared_date_time->hour > p_base_date_time->hour) + { return 1; } - if (p_compared_date_time->min < p_base_date_time->min) { + if (p_compared_date_time->min < p_base_date_time->min) + { return -1; - } else if (p_compared_date_time->min > p_base_date_time->min) { + } + else if (p_compared_date_time->min > p_base_date_time->min) + { return 1; } - if (p_compared_date_time->sec < p_base_date_time->sec) { + if (p_compared_date_time->sec < p_base_date_time->sec) + { return -1; - } else if (p_compared_date_time->sec > p_base_date_time->sec) { + } + else if (p_compared_date_time->sec > p_base_date_time->sec) + { return 1; } @@ -96,78 +113,132 @@ gls_racp_operand_t gls_racp_req_decode(const uint8_t *p_data, uint16_t length, g p_racp_req->op_code = (gls_racp_op_code_t)p_data[index++]; p_racp_req->filter.racp_operator = (gls_racp_operator_t)p_data[index++]; - if ((GLS_RACP_OP_ABORT_OP != p_racp_req->op_code) && \ - (GLS_RACP_OPERATOR_ALL_RECS > p_racp_req->filter.racp_operator)) { - return GLS_RACP_RSP_INVALID_OPERATOR; + if (GLS_RACP_OP_REP_STRD_RECS == p_racp_req->op_code || + GLS_RACP_OP_DEL_STRD_RECS == p_racp_req->op_code || + GLS_RACP_OP_REP_NB_OF_STRD_RECS == p_racp_req->op_code) + { + if(GLS_RACP_OPERATOR_ALL_RECS > p_racp_req->filter.racp_operator) + { + return GLS_RACP_RSP_INVALID_OPERATOR; + } + } + else + { + if(GLS_RACP_OPERATOR_ALL_RECS <= p_racp_req->filter.racp_operator) + { + return GLS_RACP_RSP_INVALID_OPERATOR; + } } - if (GLS_RACP_OPERATOR_LAST_REC < p_racp_req->filter.racp_operator) { + if (GLS_RACP_OPERATOR_LAST_REC < p_racp_req->filter.racp_operator) + { return GLS_RACP_RSP_OPERATOR_NOT_SUP; } if ((GLS_RACP_OPERATOR_LE_OR_EQ <= p_racp_req->filter.racp_operator) && \ - ((GLS_RACP_OPERATOR_WITHIN_RANGE_OF) >= p_racp_req->filter.racp_operator)) { - if (length <= index) { + ((GLS_RACP_OPERATOR_WITHIN_RANGE_OF) >= p_racp_req->filter.racp_operator)) + { + if (length <= index) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { p_racp_req->filter.racp_filter_type = (gls_racp_filter_type_t)p_data[index++]; - if (GLS_RACP_FILTER_SEQ_NUMBER == p_racp_req->filter.racp_filter_type) { - if (GLS_RACP_OPERATOR_LE_OR_EQ == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_SEQ_NUM_LEN != (length - index)) { + if (GLS_RACP_FILTER_SEQ_NUMBER == p_racp_req->filter.racp_filter_type) + { + if (GLS_RACP_OPERATOR_LE_OR_EQ == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_SEQ_NUM_LEN != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { p_racp_req->filter.val.seq_num.max = BUILD_U16(p_data[index], p_data[index + 1]); } - } else if (GLS_RACP_OPERATOR_GT_OR_EQ == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_SEQ_NUM_LEN != (length - index)) { + } + else if (GLS_RACP_OPERATOR_GT_OR_EQ == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_SEQ_NUM_LEN != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { p_racp_req->filter.val.seq_num.min = BUILD_U16(p_data[index], p_data[index + 1]); } - } else if (GLS_RACP_OPERATOR_WITHIN_RANGE_OF == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_SEQ_NUM_LEN * SCALE_2 != (length - index)) { + } + else if (GLS_RACP_OPERATOR_WITHIN_RANGE_OF == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_SEQ_NUM_LEN * 2 != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { p_racp_req->filter.val.seq_num.min = BUILD_U16(p_data[index], p_data[index + 1]); - p_racp_req->filter.val.seq_num.max = BUILD_U16(p_data[index + ADD_2], p_data[index + 3]); + p_racp_req->filter.val.seq_num.max = BUILD_U16(p_data[index + 2], p_data[index + 3]); - if (p_racp_req->filter.val.seq_num.min > p_racp_req->filter.val.seq_num.max) { + if (p_racp_req->filter.val.seq_num.min > p_racp_req->filter.val.seq_num.max) + { return GLS_RACP_RSP_INVALID_OPERAND; } } } - } else if (GLS_RACP_FILTER_USER_FACING_TIME == p_racp_req->filter.racp_filter_type) { - if (GLS_RACP_OPERATOR_LE_OR_EQ == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_USER_TIME_LEN != (length - index)) { + + } + else if (GLS_RACP_FILTER_USER_FACING_TIME == p_racp_req->filter.racp_filter_type) + { + if (GLS_RACP_OPERATOR_LE_OR_EQ == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_USER_TIME_LEN != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { prf_unpack_date_time(&p_data[index], &p_racp_req->filter.val.time.max); } - } else if (GLS_RACP_OPERATOR_GT_OR_EQ == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_USER_TIME_LEN != (length - index)) { + } + else if (GLS_RACP_OPERATOR_GT_OR_EQ == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_USER_TIME_LEN != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { prf_unpack_date_time(&p_data[index], &p_racp_req->filter.val.time.min); } - } else if (GLS_RACP_OPERATOR_WITHIN_RANGE_OF == p_racp_req->filter.racp_operator) { - if (GLS_RACP_FILTER_USER_TIME_LEN * SCALE_2 != (length - index)) { + } + else if (GLS_RACP_OPERATOR_WITHIN_RANGE_OF == p_racp_req->filter.racp_operator) + { + if (GLS_RACP_FILTER_USER_TIME_LEN * 2 != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; - } else { + } + else + { index += prf_unpack_date_time(&p_data[index], &p_racp_req->filter.val.time.min); prf_unpack_date_time(&p_data[index], &p_racp_req->filter.val.time.max); - if (gls_racp_user_time_compare(&p_racp_req->filter.val.time.max, - &p_racp_req->filter.val.time.min) != -1) { + if (-1 != gls_racp_user_time_compare(&p_racp_req->filter.val.time.max, &p_racp_req->filter.val.time.min)) + { return GLS_RACP_RSP_INVALID_OPERAND; } } } - } else { + } + else + { return GLS_RACP_RSP_OPERAND_NOT_SUP; } } - } else if (length - index) != 0) { + } + else if (0 != (length - index)) + { return GLS_RACP_RSP_INVALID_OPERAND; } @@ -181,10 +252,13 @@ uint16_t gls_racp_rsp_encode(gls_racp_rsp_t *p_racp_rsp, uint8_t *p_encoded_buff p_encoded_buffer[length++] = p_racp_rsp->op_code; p_encoded_buffer[length++] = GLS_RACP_OPERATOR_NULL; - if (GLS_RACP_OP_REP_NB_OF_STRD_RECS == p_racp_rsp->op_code) { + if (GLS_RACP_OP_REP_NB_OF_STRD_RECS == p_racp_rsp->op_code) + { p_encoded_buffer[length++] = LO_U16(p_racp_rsp->operand.num_of_record); p_encoded_buffer[length++] = HI_U16(p_racp_rsp->operand.num_of_record); - } else { + } + else + { p_encoded_buffer[length++] = p_racp_rsp->operand.rsp.op_code_req; p_encoded_buffer[length++] = p_racp_rsp->operand.rsp.status; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.h index 8e7ea4b..ca54ee3 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gls/gls_racp.h @@ -57,10 +57,10 @@ * INCLUDE FILES **************************************************************************************** */ +#include "ble_prf_types.h" +#include "gr_includes.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" /** * @defgroup GLS_RACP_MACRO Defines @@ -75,19 +75,20 @@ * @{ */ /**@brief Glucose Recoerd Access Control Point Operation Codes. */ -typedef enum { +typedef enum +{ GLS_RACP_OP_RESERVED, /**< Reserved for future use. */ GLS_RACP_OP_REP_STRD_RECS, /**< Report stored records (Operator: Value from Operator Table). */ GLS_RACP_OP_DEL_STRD_RECS, /**< Delete stored records (Operator: Value from Operator Table). */ GLS_RACP_OP_ABORT_OP, /**< Abort operation (Operator: Null 'value of 0x00 from Operator Table'). */ GLS_RACP_OP_REP_NB_OF_STRD_RECS, /**< Report number of stored records (Operator: Value from Operator Table). */ - GLS_RACP_OP_NB_OF_STRD_RECS_RSP, /**< Number of stored records response \ - (Operator: Null 'value of 0x00 from Operator Table'). */ + GLS_RACP_OP_NB_OF_STRD_RECS_RSP, /**< Number of stored records response (Operator: Null 'value of 0x00 from Operator Table'). */ GLS_RACP_OP_RSP_CODE, /**< Response Code (Operator: Null 'value of 0x00 from Operator Table'). */ } gls_racp_op_code_t; /**@brief Glucose Recoerd Access Control Point Operator. */ -typedef enum { +typedef enum +{ GLS_RACP_OPERATOR_NULL, /**< NULL. */ GLS_RACP_OPERATOR_ALL_RECS, /**< All records. */ GLS_RACP_OPERATOR_LE_OR_EQ, /**< Less than or equal to. */ @@ -98,17 +99,15 @@ typedef enum { } gls_racp_operator_t; /**@brief Glucose Recoerd Access Control Point Response codes. */ -typedef enum { +typedef enum +{ GLS_RACP_RSP_RESERVED, /**< Reserved for future use. */ GLS_RACP_RSP_SUCCESS, /**< Normal response for successful operation. */ GLS_RACP_RSP_OP_CODE_NOT_SUP, /**< Normal response if unsupported Op Code is received. */ - GLS_RACP_RSP_INVALID_OPERATOR, /**< Normal response if Operator received does not meet \ - the requirements of the service (e.g. Null was expected). */ + GLS_RACP_RSP_INVALID_OPERATOR, /**< Normal response if Operator received does not meet the requirements of the service (e.g. Null was expected). */ GLS_RACP_RSP_OPERATOR_NOT_SUP, /**< Normal response if unsupported Operator is received. */ - GLS_RACP_RSP_INVALID_OPERAND, /**< Normal response if Operand received does not meet \ - the requirements of the service. */ - GLS_RACP_RSP_NO_RECS_FOUND, /**< Normal response if request to report stored records or request to \ - delete stored records resulted in no records meeting criteria. */ + GLS_RACP_RSP_INVALID_OPERAND, /**< Normal response if Operand received does not meet the requirements of the service. */ + GLS_RACP_RSP_NO_RECS_FOUND, /**< Normal response if request to report stored records or request to delete stored records resulted in no records meeting criteria. */ GLS_RACP_RSP_ABORT_UNSUCCESSFUL, /**< Normal response if request for Abort cannot be completed. */ GLS_RACP_RSP_PROCEDURE_NOT_COMPLETED, /**< Normal response if unable to complete a procedure for any reason. */ GLS_RACP_RSP_OPERAND_NOT_SUP, /**< Normal response if unsupported Operand is received. */ @@ -116,7 +115,8 @@ typedef enum { } gls_racp_operand_t; /**@brief Glucose Recoerd Access Control Point filter types. */ -typedef enum { +typedef enum +{ GLS_RACP_FILTER_RESERVED, /**< Reserved for future use. */ GLS_RACP_FILTER_SEQ_NUMBER, /**< Filter data using Sequence Number criteria. */ GLS_RACP_FILTER_USER_FACING_TIME, /**< Filter data using User Facing Time criteria. */ @@ -128,36 +128,42 @@ typedef enum { * @{ */ /**@brief Glucose Recoerd Access Control Point filter value. */ -typedef struct { +typedef struct +{ gls_racp_operator_t racp_operator; /**< Glucose Recoerd Access Control Point Operator. */ gls_racp_filter_type_t racp_filter_type; /**< Glucose Recoerd Access Control Point filter types. */ - union { - struct { + union + { + struct + { uint16_t min; /**< Min sequence number. */ uint16_t max; /**< Max sequence number. */ - } seq_num; /**< Sequence number filtering \ - (racp_filter_type = GLS_RACP_FILTER_SEQ_NUMBER). */ - struct { + } seq_num; /**< Sequence number filtering (racp_filter_type = GLS_RACP_FILTER_SEQ_NUMBER). */ + struct + { prf_date_time_t min; /**< Min base time. */ prf_date_time_t max; /**< Max base time. */ - } time; /**< User facing time filtering \ - (filter_type = GLS_RACP_FILTER_USER_FACING_TIME). */ + } time; /**< User facing time filtering (filter_type = GLS_RACP_FILTER_USER_FACING_TIME). */ } val; /**< Filter union. */ } gls_racp_filter_t; /**@brief Glucose Recoerd Access Control Point request value. */ -typedef struct { +typedef struct +{ gls_racp_op_code_t op_code; /**< Glucose Recoerd Access Control Point Operation Code. */ gls_racp_filter_t filter; /**< Glucose Recoerd Access Control Point Operation Code. */ } gls_racp_req_t; /**@brief Glucose Recoerd Access Control Point response value. */ -typedef struct { +typedef struct +{ gls_racp_op_code_t op_code; /**< Glucose Recoerd Access Control Point Operation Code. */ gls_racp_operator_t racp_operator; /**< Glucose Recoerd Access Control Point Operator. */ - union { + union + { uint16_t num_of_record; /**< Number of record (if op_code = GLS_RACP_OP_REP_NB_OF_STRD_RECS). */ - struct { + struct + { gls_racp_op_code_t op_code_req; /**< Request Op Code. */ gls_racp_operand_t status; /**< Command Status (if op_code = GLS_RACP_OP_RSP_CODE). */ } rsp; /**< Response. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/BUILD.gn new file mode 100644 index 0000000..53fc9d7 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("gus") { + sources = [ "gus.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.c index 18f977b..f2c7c97 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.c @@ -49,12 +49,9 @@ ***************************************************************************************** */ /**@brief The UUIDs of GUS characteristics. */ -#define GUS_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, \ - 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} -#define GUS_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, \ - 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} -#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, \ - 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} +#define GUS_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} +#define GUS_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} +#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -66,9 +63,10 @@ ***************************************************************************************** */ /**@brief Goodix UART Service Attributes Indexes. */ -enum gus_attr_idx_t { +enum gus_attr_idx_t +{ GUS_IDX_SVC, - + GUS_IDX_TX_CHAR, GUS_IDX_TX_VAL, GUS_IDX_TX_CFG, @@ -88,143 +86,68 @@ enum gus_attr_idx_t { ***************************************************************************************** */ /**@brief Goodix UART Service environment variable. */ -struct gus_env_t { - gus_init_t gus_init; /**< Goodix UART Service initialization variables. */ - uint16_t start_hdl; /**< Start handle of services */ - uint16_t tx_ntf_cfg[GUS_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of the peers. */ - uint16_t - flow_ctrl_ntf_cfg[GUS_CONNECTION_MAX]; /**< Flow Control Characteristic Notification configuration of the peers. */ +struct gus_env_t +{ + gus_init_t gus_init; /**< Goodix UART Service initialization variables. */ + uint16_t start_hdl; /**< Start handle of services */ + uint16_t tx_ntf_cfg[GUS_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of the peers. */ + uint16_t flow_ctrl_ntf_cfg[GUS_CONNECTION_MAX]; /**< Flow Control Characteristic Notification configuration of the peers. */ + ble_gatts_create_db_t gus_gatts_db; /**< Goodix UART Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t gus_init(void); -static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void gus_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct gus_env_t s_gus_env; static const uint16_t s_char_mask = 0xFFFF; +static const uint8_t s_gus_svc_uuid[] = {GUS_SERVICE_UUID}; /**@brief Full GUS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_128_t gus_att_db[GUS_IDX_NB] = { +static const ble_gatts_attm_desc_128_t gus_attr_tab[GUS_IDX_NB] = +{ // GUS service - [GUS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [GUS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // GUS TX Characteristic Declaration - [GUS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GUS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // GUS TX Characteristic Value - [GUS_IDX_TX_VAL] = { - GUS_SERVER_TX_UUID, - NOTIFY_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, + [GUS_IDX_TX_VAL] = {GUS_SERVER_TX_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + GUS_MAX_DATA_LEN}, // GUS TX Characteristic - Client Characteristic Configuration Descriptor - [GUS_IDX_TX_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [GUS_IDX_TX_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // GUS RX Characteristic Declaration - [GUS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GUS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // GUS RX Characteristic Value - [GUS_IDX_RX_VAL] = { - GUS_SERVER_RX_UUID, - WRITE_REQ_PERM_UNSEC | WRITE_CMD_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, + [GUS_IDX_RX_VAL] = {GUS_SERVER_RX_UUID, + BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_WRITE_CMD_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + GUS_MAX_DATA_LEN}, // GUS FLOW_CTRL Characteristic Declaration - [GUS_IDX_FLOW_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [GUS_IDX_FLOW_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // GUS FLOW_CTRL Characteristic Value - [GUS_IDX_FLOW_CTRL_VAL] = { - GUS_FLOW_CTRL_UUID, - NOTIFY_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, + [GUS_IDX_FLOW_CTRL_VAL] = {GUS_FLOW_CTRL_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + GUS_MAX_DATA_LEN}, // GUS FLOW_CTRL Characteristic - Client Characteristic Configuration Descriptor - [GUS_IDX_FLOW_CTRL_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief GUS Service interface required by profile manager. */ -static ble_prf_manager_cbs_t gus_mgr_cbs = { - (prf_init_func_t)gus_init, - NULL, - NULL, -}; - -/**@brief GUS GATT Server Callbacks. */ -static gatts_prf_cbs_t gus_gatts_cbs = { - gus_read_att_cb, - gus_write_att_cb, - NULL, - gus_ntf_ind_cb, - gus_cccd_set_cb -}; - -/**@brief GUS Server Information. */ -static const prf_server_info_t gus_prf_info = { - .max_connection_nb = GUS_CONNECTION_MAX, - .manager_cbs = &gus_mgr_cbs, - .gatts_prf_cbs = &gus_gatts_cbs + [GUS_IDX_FLOW_CTRL_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize GUS and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t gus_init(void) -{ - const uint8_t gus_svc_uuid[] = {GUS_SERVICE_UUID}; - uint16_t start_hdl = PRF_INVALID_HANDLE; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = gus_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; - gatts_db.max_nb_attr = GUS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = gus_att_db; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_gus_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -233,9 +156,9 @@ static sdk_err_t gus_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void gus_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint16_t handle = p_param->handle; uint8_t tab_index = 0; @@ -243,7 +166,8 @@ static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case GUS_IDX_TX_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_gus_env.tx_ntf_cfg[conn_idx]; @@ -273,21 +197,22 @@ static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in] p_param: Point to the parameters of the write request. ***************************************************************************************** */ -static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void gus_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint16_t flow_ctrl_state; uint16_t cccd_value; gus_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; - tab_index = prf_find_idx_by_handle(handle, s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); + tab_index = prf_find_idx_by_handle(handle,s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); event.conn_idx = conn_idx; cfm.handle = handle; cfm.status = BLE_SUCCESS; - - switch (tab_index) { + + switch (tab_index) + { case GUS_IDX_RX_VAL: event.evt_type = GUS_EVT_RX_DATA_RECEIVED; event.p_data = (uint8_t *)p_param->value; @@ -309,9 +234,12 @@ static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p case GUS_IDX_FLOW_CTRL_VAL: flow_ctrl_state = p_param->value[0]; - if (FLOW_OFF == flow_ctrl_state) { + if (GUS_FLOW_CTRL_STATE_OFF == flow_ctrl_state) + { event.evt_type = GUS_EVT_TX_FLOW_OFF; - } else if (FLOW_ON == flow_ctrl_state) { + } + else if (GUS_FLOW_CTRL_STATE_ON == flow_ctrl_state) + { event.evt_type = GUS_EVT_TX_FLOW_ON; } break; @@ -321,8 +249,8 @@ static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p break; } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && GUS_EVT_INVALID != event.evt_type && - s_gus_env.gus_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && GUS_EVT_INVALID != event.evt_type && s_gus_env.gus_init.evt_handler) + { s_gus_env.gus_init.evt_handler(&event); } @@ -338,20 +266,22 @@ static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void gus_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; gus_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } - tab_index = prf_find_idx_by_handle(handle, s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); + tab_index = prf_find_idx_by_handle(handle,s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); event.conn_idx = conn_idx; event.evt_type = GUS_EVT_INVALID; - switch (tab_index) { + switch (tab_index) + { case GUS_IDX_TX_CFG: event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? GUS_EVT_TX_PORT_OPENED : GUS_EVT_TX_PORT_CLOSED; s_gus_env.tx_ntf_cfg[conn_idx] = cccd_value; @@ -366,7 +296,8 @@ static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (GUS_EVT_INVALID != event.evt_type && s_gus_env.gus_init.evt_handler) { + if (GUS_EVT_INVALID != event.evt_type && s_gus_env.gus_init.evt_handler) + { s_gus_env.gus_init.evt_handler(&event); } } @@ -380,29 +311,59 @@ static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void gus_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void gus_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_gus_env.gus_init.evt_handler != NULL) { + if (NULL != s_gus_env.gus_init.evt_handler) + { gus_evt_t event; event.conn_idx = conn_idx; - if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = GUS_EVT_TX_DATA_SENT; s_gus_env.gus_init.evt_handler(&event); } } } +static void gus_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + gus_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + gus_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + gus_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + gus_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_cmd; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t send_cmd; - if (PRF_CLI_START_NTF == s_gus_env.tx_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_gus_env.tx_ntf_cfg[conn_idx]) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; send_cmd.handle = prf_find_handle_by_idx(GUS_IDX_TX_VAL, s_gus_env.start_hdl, (uint8_t *)&s_char_mask); @@ -418,12 +379,13 @@ sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) return error_code; } -sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) +sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, gus_flow_ctrl_state_t flow_ctrl) { - sdk_err_t error_code = BLE_SUCCESS; - gatts_noti_ind_t send_cmd; + sdk_err_t error_code = BLE_SUCCESS; + ble_gatts_noti_ind_t send_cmd; - if (PRF_CLI_START_NTF == s_gus_env.flow_ctrl_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_gus_env.flow_ctrl_ntf_cfg[conn_idx]) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; send_cmd.handle = prf_find_handle_by_idx(GUS_IDX_FLOW_CTRL_VAL, s_gus_env.start_hdl, (uint8_t *)&s_char_mask); @@ -441,15 +403,28 @@ sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) sdk_err_t gus_service_init(gus_init_t *p_gus_init) { - sdk_err_t ret; - if (p_gus_init == NULL) { + if (NULL == p_gus_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_gus_env.gus_init, sizeof(gus_init_t), p_gus_init, sizeof(gus_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_gus_env.gus_init, p_gus_init, sizeof(gus_init_t)); - return ble_server_prf_add(&gus_prf_info); + memset(&s_gus_env.gus_gatts_db, 0, sizeof(ble_gatts_create_db_t)); + + s_gus_env.start_hdl = PRF_INVALID_HANDLE; + s_gus_env.gus_gatts_db.shdl = &s_gus_env.start_hdl; + s_gus_env.gus_gatts_db.uuid = s_gus_svc_uuid; + s_gus_env.gus_gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_gus_env.gus_gatts_db.max_nb_attr = GUS_IDX_NB; + s_gus_env.gus_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_gus_env.gus_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_gus_env.gus_gatts_db.attr_tab.attr_tab_128 = gus_attr_tab; + + return ble_gatts_prf_add(&s_gus_env.gus_gatts_db, gus_ble_evt_handler); +} + +uint16_t gus_service_start_handle_get(void) +{ + return s_gus_env.start_hdl; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.h index 87021ef..781b220 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus/gus.h @@ -61,21 +61,18 @@ #ifndef __GUS_H__ #define __GUS_H__ -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" /** * @defgroup GUS_MACRO Defines * @{ */ -#define GUS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Goodix UART Service connections. */ -#define FLOW_ON 0x01 /**< Indicate that GUS can receive data from peer. */ -#define FLOW_OFF 0x00 /**< Indicate that GUS can not receive data from peer. */ -#define GUS_MAX_DATA_LEN 247 /**< Maximum length of application data packet which is transmitted via GUS. */ -#define GUS_FLOW_CTRL_LEN 1 /**< Maximum length of ble flow control data packet which is transmitted via GUS. */ -#define GUS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x01, \ - 0x02, 0xED, 0xA6 /**< The UUID of Goodix UART Service for setting advertising data. */ +#define GUS_CONNECTION_MAX 10 /**< Maximum number of Goodix UART Service connections. */ +#define GUS_MAX_DATA_LEN 247 /**< Maximum length of application data packet which is transmitted via GUS. */ +#define GUS_FLOW_CTRL_LEN 1 /**< Maximum length of ble flow control data packet which is transmitted via GUS. */ +#define GUS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6 /**< The UUID of Goodix UART Service for setting advertising data. */ /** @} */ /** @@ -83,18 +80,27 @@ * @{ */ /**@brief Goodix UART Service event types. */ -typedef enum { - GUS_EVT_INVALID, /**< Invalid GUS event. */ - GUS_EVT_RX_DATA_RECEIVED, /**< The data from the peer has been received. */ - GUS_EVT_TX_DATA_SENT, /**< The data from the application has been sent, - and the service is ready to accept new data from the application. */ - GUS_EVT_TX_PORT_OPENED, /**< Tx port has been opened. */ - GUS_EVT_TX_PORT_CLOSED, /**< Tx port has been closed. */ - GUS_EVT_FLOW_CTRL_ENABLE, /**< GUS flow control been enabled. */ - GUS_EVT_FLOW_CTRL_DISABLE, /**< GUS flow control been disabled. */ - GUS_EVT_TX_FLOW_OFF, /**< Tx flow off control request. */ - GUS_EVT_TX_FLOW_ON, /**< Tx flow on control request. */ +typedef enum +{ + GUS_EVT_INVALID, /**< Invalid GUS event. */ + GUS_EVT_RX_DATA_RECEIVED, /**< The data from the peer has been received. */ + GUS_EVT_TX_DATA_SENT, /**< The data from the application has been sent, and the service is ready to accept new data from the application. */ + GUS_EVT_TX_PORT_OPENED, /**< Tx port has been opened. */ + GUS_EVT_TX_PORT_CLOSED, /**< Tx port has been closed. */ + GUS_EVT_FLOW_CTRL_ENABLE, /**< GUS flow control been enabled. */ + GUS_EVT_FLOW_CTRL_DISABLE, /**< GUS flow control been disabled. */ + GUS_EVT_TX_FLOW_OFF, /**< Tx flow off control request. */ + GUS_EVT_TX_FLOW_ON, /**< Tx flow on control request. */ } gus_evt_type_t; + +/**@brief Flow control state for GUS service. */ +enum gus_flow_ctrl_state +{ + GUS_FLOW_CTRL_STATE_OFF = 0, /**< Indicate that GUS can not receive data from peer. */ + GUS_FLOW_CTRL_STATE_ON /**< Indicate that GUS can receive data from peer. */ +}; +/**@brief Underlying type used for the GUS flow control state. */ +typedef uint8_t gus_flow_ctrl_state_t; /** @} */ /** @@ -102,7 +108,8 @@ typedef enum { * @{ */ /**@brief Goodix UART Service event. */ -typedef struct { +typedef struct +{ gus_evt_type_t evt_type; /**< The GUS event. */ uint8_t conn_idx; /**< The index of the connection for the data transmission. */ uint8_t *p_data; /**< Pointer to the buffer within received data. */ @@ -111,7 +118,7 @@ typedef struct { /** @} */ /** - * @defgroup GUS_TYPEDEF Typedefs + * @addtogroup GUS_TYPEDEF Typedefs * @{ */ /**@brief Goodix UART Service event handler type. */ @@ -122,12 +129,10 @@ typedef void (*gus_evt_handler_t)(gus_evt_t *p_evt); * @addtogroup GUS_STRUCT Structures * @{ */ -/**@brief Goodix UART Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { - gus_evt_handler_t - evt_handler; /**< Goodix UART Service event handler which must be provided by - the application to send and receive the data. */ +/**@brief Goodix UART Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ + gus_evt_handler_t evt_handler; /**< Goodix UART Service event handler which must be provided by the application to send and receive the data. */ } gus_init_t; /** @} */ @@ -163,13 +168,19 @@ sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); ***************************************************************************************** * @brief Send GUS Rx flow control state to peer device * - * @param[in] conn_idx: Index of the connection. - * @param[in] flow_ctrl: GUS Rx flow control state - * * @return Result of sending GUS Rx flow control state. ***************************************************************************************** */ -sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl); +sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, gus_flow_ctrl_state_t flow_ctrl); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the gus service start handle . + * + * @return The gus service start handle. + ***************************************************************************************** + */ +uint16_t gus_service_start_handle_get(void); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/BUILD.gn new file mode 100644 index 0000000..667fdab --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("gus_c") { + sources = [ "gus_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.c index fbecc5a..61a7cd9 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.c @@ -39,28 +39,18 @@ ***************************************************************************************** */ #include "gus_c.h" -#define ATTR_VALUE_LEN 2 -#define UUID_LEN_16 16 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Goodix UART Service Client environment variable. */ -struct gus_c_env_t { +struct gus_c_env_t +{ gus_c_handles_t handles; /**< Handles of GUS characteristics which will be got for peer. */ gus_c_evt_handler_t evt_handler; /**< Handler of GUS client event */ - uint8_t prf_id; /**< GUS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void gus_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void gus_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** @@ -71,31 +61,10 @@ static uint8_t s_gus_rx_char_uuid[16] = GUS_RX_CHAR_UUID; static uint8_t s_gus_tx_char_uuid[16] = GUS_TX_CHAR_UUID; static uint8_t s_gus_flow_ctrl_char_uuid[16] = GUS_FLOW_CTRL_UUID; -/**@brief GUS Client interface required by profile manager. */ -static ble_prf_manager_cbs_t gus_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief GUS GATT Client Callbacks. */ -static gattc_prf_cbs_t gus_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - gus_c_att_write_cb, - gus_c_att_ntf_ind_cb, - gus_c_srvc_browse_cb, - NULL, -}; - -/**@brief GUS Client Information. */ -static const prf_client_info_t gus_c_prf_info = { - .max_connection_nb = GUS_C_CONNECTION_MAX, - .manager_cbs = &gus_c_mgr_cbs, - .gattc_prf_cbs = &gus_c_gattc_cbs +static ble_uuid_t s_gus_service_uuid = +{ + .uuid_len = 16, + .uuid = s_gus_uuid, }; /* @@ -111,7 +80,8 @@ static const prf_client_info_t gus_c_prf_info = { */ static void gus_c_evt_handler_excute(gus_c_evt_t *p_evt) { - if (s_gus_c_env.evt_handler != NULL && GUS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_gus_c_env.evt_handler && GUS_C_EVT_INVALID != p_evt->evt_type) + { s_gus_c_env.evt_handler(p_evt); } } @@ -125,29 +95,36 @@ static void gus_c_evt_handler_excute(gus_c_evt_t *p_evt) * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void gus_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void gus_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { gus_c_evt_t gus_c_evt; gus_c_evt.conn_idx = conn_idx; gus_c_evt.evt_type = GUS_C_EVT_INVALID; - if (handle == s_gus_c_env.handles.gus_tx_cccd_handle) { + if (handle == s_gus_c_env.handles.gus_tx_cccd_handle) + { gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_TX_NTF_SET_SUCCESS : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) { + GUS_C_EVT_TX_NTF_SET_SUCCESS : \ + GUS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) + { gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_rx_handle) { + GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS : \ + GUS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_gus_c_env.handles.gus_rx_handle) + { gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_TX_CPLT : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_flow_ctrl_handle) { + GUS_C_EVT_TX_CPLT : \ + GUS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_gus_c_env.handles.gus_flow_ctrl_handle) + { gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_RX_FLOW_UPDATE_CPLT : \ - GUS_C_EVT_WRITE_OP_ERR; + GUS_C_EVT_RX_FLOW_UPDATE_CPLT : \ + GUS_C_EVT_WRITE_OP_ERR; } gus_c_evt_handler_excute(&gus_c_evt); @@ -162,20 +139,26 @@ static void gus_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void gus_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { gus_c_evt_t gus_c_evt; gus_c_evt.conn_idx = conn_idx; gus_c_evt.evt_type = GUS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_gus_c_env.handles.gus_flow_ctrl_handle) { - if (FLOW_ON == p_ntf_ind->p_value[0]) { + if (p_ntf_ind->handle == s_gus_c_env.handles.gus_flow_ctrl_handle) + { + if (GUS_C_FLOW_CTRL_STATE_ON == p_ntf_ind->p_value[0]) + { gus_c_evt.evt_type = GUS_C_EVT_TX_FLOW_ON; - } else if (FLOW_OFF == p_ntf_ind->p_value[0]) { + } + else if (GUS_C_FLOW_CTRL_STATE_OFF == p_ntf_ind->p_value[0]) + { gus_c_evt.evt_type = GUS_C_EVT_TX_FLOW_OFF; } - } else if (p_ntf_ind->handle == s_gus_c_env.handles.gus_tx_handle) { + } + else if (p_ntf_ind->handle == s_gus_c_env.handles.gus_tx_handle) + { gus_c_evt.evt_type = GUS_C_EVT_PEER_DATA_RECEIVE; gus_c_evt.p_data = p_ntf_ind->p_value; gus_c_evt.length = p_ntf_ind->length; @@ -193,7 +176,7 @@ static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void gus_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void gus_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { gus_c_evt_t gus_c_evt; uint16_t handle_disc; @@ -201,140 +184,145 @@ static void gus_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat gus_c_evt.conn_idx = conn_idx; gus_c_evt.evt_type = GUS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } + if (BLE_SUCCESS == status) + { + if (16 == p_browse_srvc->uuid_len && 0 == memcmp(p_browse_srvc->uuid, s_gus_uuid, 16)) + { + s_gus_c_env.handles.gus_srvc_start_handle = p_browse_srvc->start_hdl; + s_gus_c_env.handles.gus_srvc_end_handle = p_browse_srvc->end_hdl; - if (p_browse_srvc->uuid_len == UUID_LEN_16 && memcmp(p_browse_srvc->uuid, s_gus_uuid, UUID_LEN_16) == 0) { - s_gus_c_env.handles.gus_srvc_start_handle = p_browse_srvc->start_hdl; - s_gus_c_env.handles.gus_srvc_end_handle = p_browse_srvc->end_hdl; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + handle_disc = p_browse_srvc->start_hdl + i + 1; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - handle_disc = p_browse_srvc->start_hdl + i + 1; - - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_rx_char_uuid, UUID_LEN_16) == 0) { - s_gus_c_env.handles.gus_rx_handle = handle_disc; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_tx_char_uuid, UUID_LEN_16) == 0) { - s_gus_c_env.handles.gus_tx_handle = handle_disc; - s_gus_c_env.handles.gus_tx_cccd_handle = handle_disc + 1; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_flow_ctrl_char_uuid, UUID_LEN_16) == 0) { - s_gus_c_env.handles.gus_flow_ctrl_handle = handle_disc; - s_gus_c_env.handles.gus_flow_ctrl_cccd_handle = handle_disc + 1; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_rx_char_uuid, 16)) + { + s_gus_c_env.handles.gus_rx_handle = handle_disc; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_tx_char_uuid, 16)) + { + s_gus_c_env.handles.gus_tx_handle = handle_disc; + s_gus_c_env.handles.gus_tx_cccd_handle = handle_disc + 1; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_flow_ctrl_char_uuid, 16)) + { + s_gus_c_env.handles.gus_flow_ctrl_handle = handle_disc; + s_gus_c_env.handles.gus_flow_ctrl_cccd_handle = handle_disc + 1; + } + } + + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; } } - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; - } + gus_c_evt.evt_type = GUS_C_EVT_DISCOVERY_COMPLETE; } - - gus_c_evt.evt_type = GUS_C_EVT_DISCOVERY_COMPLETE; } gus_c_evt_handler_excute(&gus_c_evt); } +static void gus_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + gus_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + gus_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + gus_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t gus_client_init(gus_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_gus_c_env, sizeof(s_gus_c_env), 0, sizeof(s_gus_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_gus_c_env, 0, sizeof(s_gus_c_env)); s_gus_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&gus_c_prf_info, &s_gus_c_env.prf_id); + return ble_gattc_prf_add(&s_gus_service_uuid, gus_c_ble_evt_handler); } sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx) { - const ble_uuid_t gus_uuid = { - .uuid_len = 16, - .uuid = s_gus_uuid, - }; - - return ble_gattc_prf_services_browse(s_gus_c_env.prf_id, conn_idx, &gus_uuid); + return ble_gattc_services_browse(conn_idx, &s_gus_service_uuid); } sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_tx_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_tx_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_tx_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_gus_c_env.handles.gus_tx_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_flow_ctrl_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_gus_c_env.handles.gus_flow_ctrl_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_rx_handle) { + if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_rx_handle) + { return SDK_ERR_INVALID_HANDLE; } - if (p_data == NULL) { + if (NULL == p_data) + { return SDK_ERR_POINTER_NULL; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_gus_c_env.handles.gus_rx_handle; - write_attr_value.length = length; - write_attr_value.p_value = p_data; - - return ble_gattc_prf_write_no_resp(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_gus_c_env.handles.gus_rx_handle, length, p_data); } -sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) +sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, gus_c_flow_ctrl_state_t flow_ctrl) { - gattc_write_attr_value_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_handle) { + if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_flow_ctrl_handle; - write_attr_value.offset = 0; - write_attr_value.length = 1; - write_attr_value.p_value = &flow_ctrl; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_gus_c_env.handles.gus_flow_ctrl_handle, 0, 1, &flow_ctrl); } + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.h index 7e1c893..8614bea 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/gus_c/gus_c.h @@ -46,12 +46,12 @@ * @{ * @brief Goodix UART Service Client module. * - * @details The Goodix Uart Service Client contains the APIs and types, which can be used by the - * application to perform scanning, connection and discover Goodix Uart Service at + * @details The Goodix Uart Service Client contains the APIs and types, which can be used by the + * application to perform scanning, connection and discover Goodix Uart Service at * peer and interact with it. * * The application must provide an event handler, then call \ref gus_client_init(). After the - * module can send and receive BLE data, application can call \ref gus_c_tx_data_send() to + * module can send and receive BLE data, application can call \ref gus_c_tx_data_send() to * send data to peer, and receive data from peer \ref GUS_C_EVT_PEER_DATA_RECEIVE, * meanwhile update its received BLE data state \ref gus_c_rx_flow_ctrl_set() to peer. */ @@ -59,33 +59,30 @@ #ifndef __GUS_C_H__ #define __GUS_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup GUS_C_MACRO Defines * @{ */ -#define GUS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of GUS Client connections. */ -#define FLOW_ON 0x01 /**< Indicate that GUS Client can receive data from peer. */ -#define FLOW_OFF 0x00 /**< Indicate that GUS Client can not receive data from peer. */ +#define GUS_C_CONNECTION_MAX 10 /**< Maximum number of GUS Client connections. */ /** * @defgroup GUS_UUID Service and Characteristics UUID * @{ */ -#define GUS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define GUS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6} /**< UUID of GUS Service. */ -#define GUS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define GUS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} /**< UUID of GUS Tx characterisitc. */ -#define GUS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define GUS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} /**< UUID of GUS Rx characterisitc. */ -#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, \ - 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**< UUID of GUS Flow Control characterisitc. */ +#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**< UUID of GUS Flow Control characterisitc. */ /** @} */ /** @} */ @@ -94,11 +91,11 @@ * @{ */ /**@brief Goodix UART Service Client event type. */ -typedef enum { +typedef enum +{ GUS_C_EVT_INVALID, /**< Invalid GUS Client event. */ GUS_C_EVT_DISCOVERY_COMPLETE, /**< GUS Client has found service and its characteristics at peer. */ - GUS_C_EVT_DISCOVERY_FAIL, /**< GUS Client found THS service failed because of invalid operation \ - or no found at peer. */ + GUS_C_EVT_DISCOVERY_FAIL, /**< GUS Client found THS service failed because of invalid operation or no found at peer. */ GUS_C_EVT_TX_NTF_SET_SUCCESS, /**< GUS Client has set peer Tx notify. */ GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS, /**< GUS Client has set peer ble flow control notify. */ GUS_C_EVT_PEER_DATA_RECEIVE, /**< GUS Client has received something from peer. */ @@ -108,6 +105,15 @@ typedef enum { GUS_C_EVT_RX_FLOW_UPDATE_CPLT, /**< GUS CLient has updated flow control to peer completely. */ GUS_C_EVT_WRITE_OP_ERR, /**< Error occured when GUS Client wrote to peer. */ } gus_c_evt_type_t; + +/**@brief Flow control state for GUS Client service. */ +enum gus_c_flow_ctrl_state +{ + GUS_C_FLOW_CTRL_STATE_OFF = 0, /**< Indicate that GUS Client can not receive data from peer. */ + GUS_C_FLOW_CTRL_STATE_ON /**< Indicate that GUS Client can receive data from peer. */ +}; +/**@brief Underlying type used for the GUS Client flow control state. */ +typedef uint8_t gus_c_flow_ctrl_state_t; /** @} */ /** @@ -115,19 +121,20 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t gus_srvc_start_handle; /**< GUS Service start handle. */ uint16_t gus_srvc_end_handle; /**< GUS Service end handle. */ uint16_t gus_tx_handle; /**< Handle of GUS Tx characteristic as provided by a discovery. */ uint16_t gus_tx_cccd_handle; /**< Handle of CCCD of GUS Tx characteristic as provided by a discovery. */ uint16_t gus_rx_handle; /**< Handle of GUS Rx characteristic as provided by a discovery. */ uint16_t gus_flow_ctrl_handle; /**< Handle of GUS Flow Control characteristic as provided by a discovery. */ - uint16_t gus_flow_ctrl_cccd_handle; /**< Handle of CCCD of GUS Flow Control characteristic \ - as provided by a discovery. */ + uint16_t gus_flow_ctrl_cccd_handle; /**< Handle of CCCD of GUS Flow Control characteristic as provided by a discovery. */ } gus_c_handles_t; /**@brief Goodix UART Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< Connection index. */ gus_c_evt_type_t evt_type; /**< GUS Client event type. */ uint16_t length; /**< Length of event data. */ @@ -216,7 +223,7 @@ sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) * @return Result of sending gus_c Rx flow control state. ***************************************************************************************** */ -sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl); +sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, gus_c_flow_ctrl_state_t flow_ctrl); /** @} */ #endif /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/BUILD.gn new file mode 100644 index 0000000..a446d70 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hids") { + sources = [ "hids.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.c index 3fb5d2d..ded7a80 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.c @@ -43,28 +43,17 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define INDEX_0 0 -#define INDEX_1 1 -#define INDEX_2 2 -#define INDEX_3 3 -#define INDEX_4 4 + /* * DEFINES ******************************************************************************* */ #define IN_REPORT_MAX_COUNT 3 /**< Maximum support input report count. */ -/**< Maximum size of a Boot Keyboard Input Report (as per Appendix B in Device Class Definition - * for Human Interface Devices (HID), Version 1.11). */ -#define HIDS_BOOT_KB_IN_REPORT_MAX_SIZE 8 -/**< Maximum size of a Boot Keyboard Output Report (as per Appendix B in Device Class Definition - * for Human Interface Devices (HID), Version 1.11). */ -#define HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE 1 -/**< Minimum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition - * for Human Interface Devices (HID), Version 1.11). */ -#define HIDS_BOOT_MOUSE_IN_REPORT_MIN_SIZE 3 -/**< Maximum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition - * for Human Interface Devices (HID), Version 1.11). */ -#define HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE 8 + +#define HIDS_BOOT_KB_IN_REPORT_MAX_SIZE 8 /**< Maximum size of a Boot Keyboard Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE 1 /**< Maximum size of a Boot Keyboard Output Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define HIDS_BOOT_MOUSE_IN_REPORT_MIN_SIZE 3 /**< Minimum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ +#define HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE 8 /**< Maximum size of a Boot Mouse Input Report (as per Appendix B in Device Class Definition for Human Interface Devices (HID), Version 1.11). */ // Protocol Mode values @@ -74,79 +63,77 @@ // HID Control Point values #define HIDS_CONTROL_POINT_SUSPEND 0x00 /**< Suspend command. */ #define HIDS_CONTROL_POINT_EXIT_SUSPEND 0x01 /**< Exit Suspend command. */ -/**< Default value for the Protocol Mode characteristic. */ -#define DEFAULT_PROTOCOL_MODE PROTOCOL_MODE_REPORT -/**< Initial value for the HID Control Point characteristic. */ -#define INITIAL_VALUE_HID_CONTROL_POINT HIDS_CONTROL_POINT_SUSPEND -#define REPORT_CNT_0 0 -#define REPORT_CNT_1 1 -#define REPORT_CNT_2 2 + +#define DEFAULT_PROTOCOL_MODE PROTOCOL_MODE_REPORT /**< Default value for the Protocol Mode characteristic. */ +#define INITIAL_VALUE_HID_CONTROL_POINT HIDS_CONTROL_POINT_SUSPEND /**< Initial value for the HID Control Point characteristic. */ + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief HIDS Attributes database index list. */ -enum hids_attr_idx_tag { +enum hids_attr_idx_tag +{ // Service - HIDS_IDX_SVC, + HIDS_IDX_SVC, // Protocol Mode characteristic - HIDS_IDX_PROTOCOL_MODE_CHAR, - HIDS_IDX_PROTOCOL_MODE_VAL, + HIDS_IDX_PROTOCOL_MODE_CHAR, + HIDS_IDX_PROTOCOL_MODE_VAL, + + //Input Report1 characteristics + HIDS_IDX_INPUT1_REPORT_CHAR, + HIDS_IDX_INPUT1_REPORT_VAL, + HIDS_IDX_INPUT1_REPORT_CCCD, + HIDS_IDX_INPUT1_REPORT_REF, + + //Input Report2 characteristics + HIDS_IDX_INPUT2_REPORT_CHAR, + HIDS_IDX_INPUT2_REPORT_VAL, + HIDS_IDX_INPUT2_REPORT_CCCD, + HIDS_IDX_INPUT2_REPORT_REF, + + //Input Report3 characteristics + HIDS_IDX_INPUT3_REPORT_CHAR, + HIDS_IDX_INPUT3_REPORT_VAL, + HIDS_IDX_INPUT3_REPORT_CCCD, + HIDS_IDX_INPUT3_REPORT_REF, + + //Output Report characteristics + HIDS_IDX_OUTPUT_REPORT_CHAR, + HIDS_IDX_OUTPUT_REPORT_VAL, + HIDS_IDX_OUTPUT_REPORT_REF, - // Input Report1 characteristics - HIDS_IDX_INPUT1_REPORT_CHAR, - HIDS_IDX_INPUT1_REPORT_VAL, - HIDS_IDX_INPUT1_REPORT_CCCD, - HIDS_IDX_INPUT1_REPORT_REF, + //Feature Report characteristic + HIDS_IDX_FEATURE_REPORT_CHAR, + HIDS_IDX_FEATURE_REPORT_VAL, + HIDS_IDX_FEATURE_REPORT_REF, - // Input Report2 characteristics - HIDS_IDX_INPUT2_REPORT_CHAR, - HIDS_IDX_INPUT2_REPORT_VAL, - HIDS_IDX_INPUT2_REPORT_CCCD, - HIDS_IDX_INPUT2_REPORT_REF, - - // Input Report3 characteristics - HIDS_IDX_INPUT3_REPORT_CHAR, - HIDS_IDX_INPUT3_REPORT_VAL, - HIDS_IDX_INPUT3_REPORT_CCCD, - HIDS_IDX_INPUT3_REPORT_REF, - - // Output Report characteristics - HIDS_IDX_OUTPUT_REPORT_CHAR, - HIDS_IDX_OUTPUT_REPORT_VAL, - HIDS_IDX_OUTPUT_REPORT_REF, - - // Feature Report characteristic - HIDS_IDX_FEATURE_REPORT_CHAR, - HIDS_IDX_FEATURE_REPORT_VAL, - HIDS_IDX_FEATURE_REPORT_REF, - - // Report Map characteristic - HIDS_IDX_REPORT_MAP_CHAR, - HIDS_IDX_REPORT_MAP_VAL, - - // Boot Keyboard Input Report characteristic - HIDS_IDX_BOOT_KB_IN_RPT_CHAR, - HIDS_IDX_BOOT_KB_IN_RPT_VAL, - HIDS_IDX_BOOT_KB_IN_RPT_CCCD, - - // Boot Keyboard Output Report characteristic + //Report Map characteristic + HIDS_IDX_REPORT_MAP_CHAR, + HIDS_IDX_REPORT_MAP_VAL, + + //Boot Keyboard Input Report characteristic + HIDS_IDX_BOOT_KB_IN_RPT_CHAR, + HIDS_IDX_BOOT_KB_IN_RPT_VAL, + HIDS_IDX_BOOT_KB_IN_RPT_CCCD, + + //Boot Keyboard Output Report characteristic HIDS_IDX_BOOT_KB_OUT_RPT_CHAR, HIDS_IDX_BOOT_KB_OUT_RPT_VAL, - + // Boot Mouse Input Report characteristic. - HIDS_IDX_BOOT_MS_IN_RPT_CHAR, - HIDS_IDX_BOOT_MS_IN_RPT_VAL, - HIDS_IDX_BOOT_MS_IN_RPT_CCCD, + HIDS_IDX_BOOT_MS_IN_RPT_CHAR, + HIDS_IDX_BOOT_MS_IN_RPT_VAL, + HIDS_IDX_BOOT_MS_IN_RPT_CCCD, + + //HID Information characteristic + HIDS_IDX_HID_INFO_CHAR, + HIDS_IDX_HID_INFO_VAL, - // HID Information characteristic - HIDS_IDX_HID_INFO_CHAR, - HIDS_IDX_HID_INFO_VAL, - - // HID Control Point characteristic - HIDS_IDX_CTRL_POINT_CHAR, - HIDS_IDX_CTRL_POINT_VAL, + //HID Control Point characteristic + HIDS_IDX_CTRL_POINT_CHAR, + HIDS_IDX_CTRL_POINT_VAL, HIDS_IDX_NB, }; @@ -155,258 +142,147 @@ enum hids_attr_idx_tag { * STRUCT DEFINE ******************************************************************************* */ -/**@brief Heart Rate Service environment variable. */ -struct hids_env_t { - hids_init_t hids_init; /**< HID Service Init Value. */ - uint16_t start_hdl; /**< HID Service start handle. */ - uint8_t - char_mask[5]; /**< Mask of Supported characteristics*/ - uint16_t - input_cccd[IN_REPORT_MAX_COUNT][HIDS_CONNECTION_MAX]; /**< Input report characteristics cccd value*/ - uint16_t - kb_input_cccd[HIDS_CONNECTION_MAX]; /**< Boot keyboard input report characteristics cccd value*/ - uint16_t - mouse_input_cccd[HIDS_CONNECTION_MAX]; /**< Boot mouse input report characteristics cccd value*/ +/**@brief Hid Service environment variable. */ +struct hids_env_t +{ + hids_init_t hids_init; /**< HID Service Init Value. */ + uint16_t start_hdl; /**< HID Service start handle. */ + uint8_t char_mask[5]; /**< Mask of Supported characteristics*/ + uint16_t input_cccd[IN_REPORT_MAX_COUNT][HIDS_CONNECTION_MAX]; /**< Input report characteristics cccd value*/ + uint16_t kb_input_cccd[HIDS_CONNECTION_MAX]; /**< Boot keyboard input report characteristics cccd value*/ + uint16_t mouse_input_cccd[HIDS_CONNECTION_MAX]; /**< Boot mouse input report characteristics cccd value*/ uint8_t protocol_mode; /**< Protocol mode. */ uint8_t ctrl_pt; /**< HID Control Point. */ - uint8_t - input_report_val[IN_REPORT_MAX_COUNT][HIDS_REPORT_MAX_SIZE]; /**< Input report characteristics value*/ - uint8_t - output_report_val[HIDS_REPORT_MAX_SIZE]; /**< Output report characteristic value*/ - uint8_t - feature_report_val[HIDS_REPORT_MAX_SIZE]; /**< Feature report characteristic value*/ - uint8_t - kb_input_report_val[HIDS_BOOT_KB_IN_REPORT_MAX_SIZE]; /**< Boot keyboard input report characteristics value*/ - uint8_t - kb_output_report_val[HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE]; /**< Boot keyboard output report characteristics value*/ - uint8_t - mouse_input_report_val[HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE]; /**< Boot mouse input report characteristics value*/ + uint8_t input_report_val[IN_REPORT_MAX_COUNT][HIDS_REPORT_MAX_SIZE]; /**< Input report characteristics value*/ + uint8_t output_report_val[HIDS_REPORT_MAX_SIZE]; /**< Output report characteristic value*/ + uint8_t feature_report_val[HIDS_REPORT_MAX_SIZE]; /**< Feature report characteristic value*/ + uint8_t kb_input_report_val[HIDS_BOOT_KB_IN_REPORT_MAX_SIZE]; /**< Boot keyboard input report characteristics value*/ + uint8_t kb_output_report_val[HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE]; /**< Boot keyboard output report characteristics value*/ + uint8_t mouse_input_report_val[HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE]; /**< Boot mouse input report characteristics value*/ + ble_gatts_create_db_t hids_gatts_db; /**< Hid Service attributs database. */ }; - -/* - * LOCAL FUNCTION DECLARATIONS - ***************************************************************************************** - */ -static sdk_err_t hids_init(void); -static void hids_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void hids_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void hids_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); - /* * LOCAL VARIABLE DEFINITIONS ******************************************************************************* */ static struct hids_env_t s_hids_env; - +static const uint8_t s_hids_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HID); /**@brief Full HID Service Database Description - Used to add attributes into the database. */ -static const attm_desc_t hids_attr_tab[HIDS_IDX_NB] = { - // HID Service Declaration - [HIDS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, +static const ble_gatts_attm_desc_t hids_attr_tab[HIDS_IDX_NB] = +{ + //HID Service Declaration + [HIDS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + + //Protocol Mode Characteristic - Declaration + [HIDS_IDX_PROTOCOL_MODE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Protocol Mode Characteristic - Value + [HIDS_IDX_PROTOCOL_MODE_VAL] = {BLE_ATT_CHAR_PROTOCOL_MODE, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(uint8_t)}, + + //Input Report1 Characteristic - Declaration + [HIDS_IDX_INPUT1_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Input Report1 Characteristic - Value + [HIDS_IDX_INPUT1_REPORT_VAL] = {BLE_ATT_CHAR_REPORT, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE}, + //Input Report1 Characteristic - Descriptor: CCCD + [HIDS_IDX_INPUT1_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), 0, 0}, + //Input Report1 Characteristic - Descriptor: Report Reference + [HIDS_IDX_INPUT1_REPORT_REF] = {BLE_ATT_DESC_REPORT_REF, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_report_ref_t)}, + + //Input Report2 Characteristic - Declaration + [HIDS_IDX_INPUT2_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Input Report2 Characteristic - Value + [HIDS_IDX_INPUT2_REPORT_VAL] = {BLE_ATT_CHAR_REPORT, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE}, + //Input Report2 Characteristic - Descriptor: CCCD + [HIDS_IDX_INPUT2_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), 0, 0}, + //Input Report2 Characteristic - Descriptor: Report Reference + [HIDS_IDX_INPUT2_REPORT_REF] = {BLE_ATT_DESC_REPORT_REF, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_report_ref_t)}, + + //Input Report3 Characteristic - Declaration + [HIDS_IDX_INPUT3_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Input Report3 Characteristic - Value + [HIDS_IDX_INPUT3_REPORT_VAL] = {BLE_ATT_CHAR_REPORT, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE}, + //Input Report3 Characteristic - Descriptor: CCCD + [HIDS_IDX_INPUT3_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), 0, 0}, + //Input Report3 Characteristic - Descriptor: Report Reference + [HIDS_IDX_INPUT3_REPORT_REF] = {BLE_ATT_DESC_REPORT_REF, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_report_ref_t)}, - // Protocol Mode Characteristic - Declaration - [HIDS_IDX_PROTOCOL_MODE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Protocol Mode Characteristic - Value - [HIDS_IDX_PROTOCOL_MODE_VAL] = { - BLE_ATT_CHAR_PROTOCOL_MODE, READ_PERM(UNAUTH) | WRITE_CMD_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(uint8_t) - }, + //Output Report Characteristic - Declaration + [HIDS_IDX_OUTPUT_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Output Report Characteristic - Value + [HIDS_IDX_OUTPUT_REPORT_VAL] = {BLE_ATT_CHAR_REPORT, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE}, + //Output Report Characteristic - Descriptor: Report Reference + [HIDS_IDX_OUTPUT_REPORT_REF] = {BLE_ATT_DESC_REPORT_REF, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_report_ref_t)}, - // Input Report1 Characteristic - Declaration - [HIDS_IDX_INPUT1_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Input Report1 Characteristic - Value - [HIDS_IDX_INPUT1_REPORT_VAL] = { - BLE_ATT_CHAR_REPORT, READ_PERM(UNAUTH) | NOTIFY_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE - }, - // Input Report1 Characteristic - Descriptor: CCCD - [HIDS_IDX_INPUT1_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), 0, 0}, - // Input Report1 Characteristic - Descriptor: Report Reference - [HIDS_IDX_INPUT1_REPORT_REF] = { - BLE_ATT_DESC_REPORT_REF, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_report_ref_t) - }, + //Feature Report Characteristic - Declaration + [HIDS_IDX_FEATURE_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Feature Report Characteristic - Value + [HIDS_IDX_FEATURE_REPORT_VAL] = {BLE_ATT_CHAR_REPORT, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE}, + //Feature Report Characteristic - Descriptor: Report Reference + [HIDS_IDX_FEATURE_REPORT_REF] = {BLE_ATT_DESC_REPORT_REF, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_report_ref_t)}, - // Input Report2 Characteristic - Declaration - [HIDS_IDX_INPUT2_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Input Report2 Characteristic - Value - [HIDS_IDX_INPUT2_REPORT_VAL] = { - BLE_ATT_CHAR_REPORT, READ_PERM(UNAUTH) | NOTIFY_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE - }, - // Input Report2 Characteristic - Descriptor: CCCD - [HIDS_IDX_INPUT2_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), 0, 0}, - // Input Report2 Characteristic - Descriptor: Report Reference - [HIDS_IDX_INPUT2_REPORT_REF] = { - BLE_ATT_DESC_REPORT_REF, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_report_ref_t) - }, + + //Report Map Characteristic - Declaration + [HIDS_IDX_REPORT_MAP_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Report Map Characteristic - Value + [HIDS_IDX_REPORT_MAP_VAL] = {BLE_ATT_CHAR_REPORT_MAP, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_REPORT_MAP_MAX_SIZE}, + + //Boot Keyboard Input Report Characteristic - Declaration + [HIDS_IDX_BOOT_KB_IN_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Boot Keyboard Input Report Characteristic - Value + [HIDS_IDX_BOOT_KB_IN_RPT_VAL] = {BLE_ATT_CHAR_BOOT_KB_IN_REPORT, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_BOOT_KB_IN_REPORT_MAX_SIZE}, + //Boot Keyboard Input Report Characteristic - Descriptor: CCCD + [HIDS_IDX_BOOT_KB_IN_RPT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), 0, 0}, - // Input Report3 Characteristic - Declaration - [HIDS_IDX_INPUT3_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Input Report3 Characteristic - Value - [HIDS_IDX_INPUT3_REPORT_VAL] = { - BLE_ATT_CHAR_REPORT, READ_PERM(UNAUTH) | NOTIFY_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE - }, - // Input Report3 Characteristic - Descriptor: CCCD - [HIDS_IDX_INPUT3_REPORT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), 0, 0}, - // Input Report3 Characteristic - Descriptor: Report Reference - [HIDS_IDX_INPUT3_REPORT_REF] = { - BLE_ATT_DESC_REPORT_REF, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_report_ref_t) - }, + //Boot Keyboard Output Report Characteristic - Declaration + [HIDS_IDX_BOOT_KB_OUT_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Boot Keyboard Output Report Characteristic - Value + [HIDS_IDX_BOOT_KB_OUT_RPT_VAL] = {BLE_ATT_CHAR_BOOT_KB_OUT_REPORT, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE}, - // Output Report Characteristic - Declaration - [HIDS_IDX_OUTPUT_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Output Report Characteristic - Value - [HIDS_IDX_OUTPUT_REPORT_VAL] = { - BLE_ATT_CHAR_REPORT, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH) | WRITE_CMD_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE - }, - // Output Report Characteristic - Descriptor: Report Reference - [HIDS_IDX_OUTPUT_REPORT_REF] = { - BLE_ATT_DESC_REPORT_REF, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_report_ref_t) - }, + + //Boot Mouse Input Report Characteristic - Declaration + [HIDS_IDX_BOOT_MS_IN_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //Boot Mouse Input Report Characteristic - Value + [HIDS_IDX_BOOT_MS_IN_RPT_VAL] = {BLE_ATT_CHAR_BOOT_MOUSE_IN_REPORT, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE}, + //Boot Mouse Input Report Characteristic - Descriptor: CCCD + [HIDS_IDX_BOOT_MS_IN_RPT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), 0, 0}, + + //HID Information Characteristic - Declaration + [HIDS_IDX_HID_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + //HID Information Characteristic - Value + [HIDS_IDX_HID_INFO_VAL] = {BLE_ATT_CHAR_HID_INFO, BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(hids_hid_info_t)}, - // Feature Report Characteristic - Declaration - [HIDS_IDX_FEATURE_REPORT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Feature Report Characteristic - Value - [HIDS_IDX_FEATURE_REPORT_VAL] = { - BLE_ATT_CHAR_REPORT, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAX_SIZE - }, - // Feature Report Characteristic - Descriptor: Report Reference - [HIDS_IDX_FEATURE_REPORT_REF] = { - BLE_ATT_DESC_REPORT_REF, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_report_ref_t) - }, - - // Report Map Characteristic - Declaration - [HIDS_IDX_REPORT_MAP_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Report Map Characteristic - Value - [HIDS_IDX_REPORT_MAP_VAL] = { - BLE_ATT_CHAR_REPORT_MAP, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_REPORT_MAP_MAX_SIZE - }, - - // Boot Keyboard Input Report Characteristic - Declaration - [HIDS_IDX_BOOT_KB_IN_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Boot Keyboard Input Report Characteristic - Value - [HIDS_IDX_BOOT_KB_IN_RPT_VAL] = { - BLE_ATT_CHAR_BOOT_KB_IN_REPORT, - READ_PERM(UNAUTH) | NOTIFY_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_BOOT_KB_IN_REPORT_MAX_SIZE - }, - // Boot Keyboard Input Report Characteristic - Descriptor: CCCD - [HIDS_IDX_BOOT_KB_IN_RPT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), 0, 0}, - - // Boot Keyboard Output Report Characteristic - Declaration - [HIDS_IDX_BOOT_KB_OUT_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Boot Keyboard Output Report Characteristic - Value - [HIDS_IDX_BOOT_KB_OUT_RPT_VAL] = { - BLE_ATT_CHAR_BOOT_KB_OUT_REPORT, - READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH) | WRITE_CMD_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE - }, - - // Boot Mouse Input Report Characteristic - Declaration - [HIDS_IDX_BOOT_MS_IN_RPT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // Boot Mouse Input Report Characteristic - Value - [HIDS_IDX_BOOT_MS_IN_RPT_VAL] = { - BLE_ATT_CHAR_BOOT_MOUSE_IN_REPORT, - READ_PERM(UNAUTH) | NOTIFY_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), - ATT_VAL_LOC_USER, HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE - }, - // Boot Mouse Input Report Characteristic - Descriptor: CCCD - [HIDS_IDX_BOOT_MS_IN_RPT_CCCD] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM(UNAUTH) | WRITE_REQ_PERM(UNAUTH), 0, 0}, - - // HID Information Characteristic - Declaration - [HIDS_IDX_HID_INFO_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // HID Information Characteristic - Value - [HIDS_IDX_HID_INFO_VAL] = { - BLE_ATT_CHAR_HID_INFO, READ_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(hids_hid_info_t) - }, - - // HID Control Point Characteristic - Declaration - [HIDS_IDX_CTRL_POINT_CHAR] = { - BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, - 0, 0 - }, - // HID Control Point Characteristic - Value - [HIDS_IDX_CTRL_POINT_VAL] = { - BLE_ATT_CHAR_HID_CTNL_PT, WRITE_CMD_PERM(UNAUTH), - ATT_VAL_LOC_USER, sizeof(uint8_t) - }, -}; - -/**@brief HIDS interface required by profile manager. */ -static ble_prf_manager_cbs_t hids_mgr_cbs = { - (prf_init_func_t)hids_init, - NULL, - NULL -}; - -/**@brief HIDS GATT server Callbacks. */ -static gatts_prf_cbs_t hids_gatts_cbs = { - hids_read_att_cb, - hids_write_att_cb, - NULL, - NULL, - hids_cccd_set_cb -}; - -/**@brief HIDS Information. */ -static const prf_server_info_t hids_prf_info = { - .max_connection_nb = HIDS_CONNECTION_MAX, - .manager_cbs = &hids_mgr_cbs, - .gatts_prf_cbs = &hids_gatts_cbs + //HID Control Point Characteristic - Declaration + [HIDS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, + 0, 0}, + //HID Control Point Characteristic - Value + [HIDS_IDX_CTRL_POINT_VAL] = {BLE_ATT_CHAR_HID_CTNL_PT, BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, sizeof(uint8_t)}, }; /* * LOCAL FUNCTION DEFINITIONS ******************************************************************************* */ - -/** - ***************************************************************************************** - * @brief Initialize HID service and create db in att. - * - * @return BLE_ATT_ERR_NO_ERROR on success, otherwise error code. - ***************************************************************************************** - */ -static sdk_err_t hids_init(void) -{ - const uint8_t hids_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HID); - gatts_create_db_t gatts_db; - uint16_t start_hdl = PRF_INVALID_HANDLE; /* The start hanlde is an in/out - * parameter of ble_gatts_srvc_db_create(). - * It must be set with PRF_INVALID_HANDLE - * to be allocated automatically by BLE Stack. */ - sdk_err_t ret; - ret = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = (uint8_t*)hids_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t*)&s_hids_env.char_mask; - gatts_db.max_nb_attr = HIDS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = hids_attr_tab; - - sdk_err_t status = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == status) { - s_hids_env.start_hdl = *gatts_db.shdl; - } - return status; -} - /** ***************************************************************************************** * @brief Handles reception of the read request. @@ -415,129 +291,130 @@ static sdk_err_t hids_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void hids_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void hids_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_hids_env.start_hdl, - HIDS_IDX_NB, - (uint8_t *)&s_hids_env.char_mask); - gatts_read_cfm_t cfm; + HIDS_IDX_NB, + (uint8_t *)&s_hids_env.char_mask); + ble_gatts_read_cfm_t cfm; cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch(tab_index) + { case HIDS_IDX_PROTOCOL_MODE_VAL: cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)(&s_hids_env.protocol_mode); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_INPUT1_REPORT_VAL: - cfm.length = s_hids_env.hids_init.input_report_array[INDEX_0].value_len; - cfm.value = (uint8_t *)(&s_hids_env.input_report_val[INDEX_0]); + cfm.length = s_hids_env.hids_init.input_report_array[0].value_len; + cfm.value = (uint8_t *)(&s_hids_env.input_report_val[0]); break; - + case HIDS_IDX_INPUT1_REPORT_CCCD: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)(&s_hids_env.input_cccd[INDEX_0][conn_idx]); + cfm.value = (uint8_t *)(&s_hids_env.input_cccd[0][conn_idx]); break; - + case HIDS_IDX_INPUT1_REPORT_REF: cfm.length = sizeof(hids_report_ref_t); - cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[INDEX_0].ref); + cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[0].ref); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_INPUT2_REPORT_VAL: - cfm.length = s_hids_env.hids_init.input_report_array[INDEX_1].value_len; - cfm.value = (uint8_t *)(&s_hids_env.input_report_val[INDEX_1]); + cfm.length = s_hids_env.hids_init.input_report_array[1].value_len; + cfm.value = (uint8_t *)(&s_hids_env.input_report_val[1]); break; - + case HIDS_IDX_INPUT2_REPORT_CCCD: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)(&s_hids_env.input_cccd[INDEX_1][conn_idx]); + cfm.value = (uint8_t *)(&s_hids_env.input_cccd[1][conn_idx]); break; - + case HIDS_IDX_INPUT2_REPORT_REF: cfm.length = sizeof(hids_report_ref_t); - cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[INDEX_1].ref); + cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[1].ref); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_INPUT3_REPORT_VAL: - cfm.length = s_hids_env.hids_init.input_report_array[INDEX_2].value_len; - cfm.value = (uint8_t *)(&s_hids_env.input_report_val[INDEX_2]); + cfm.length = s_hids_env.hids_init.input_report_array[2].value_len; + cfm.value = (uint8_t *)(&s_hids_env.input_report_val[2]); break; - + case HIDS_IDX_INPUT3_REPORT_CCCD: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)(&s_hids_env.input_cccd[INDEX_2][conn_idx]); + cfm.value = (uint8_t *)(&s_hids_env.input_cccd[2][conn_idx]); break; - + case HIDS_IDX_INPUT3_REPORT_REF: cfm.length = sizeof(hids_report_ref_t); - cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[INDEX_2].ref); + cfm.value = (uint8_t *)(&s_hids_env.hids_init.input_report_array[2].ref); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_OUTPUT_REPORT_VAL: cfm.length = s_hids_env.hids_init.output_report.value_len; cfm.value = (uint8_t *)(&s_hids_env.output_report_val); break; - + case HIDS_IDX_OUTPUT_REPORT_REF: cfm.length = sizeof(hids_report_ref_t); cfm.value = (uint8_t *)(&s_hids_env.hids_init.output_report.ref); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_FEATURE_REPORT_VAL: cfm.length = s_hids_env.hids_init.feature_report.value_len; cfm.value = (uint8_t *)(&s_hids_env.feature_report_val); break; - - case HIDS_IDX_FEATURE_REPORT_REF: + + case HIDS_IDX_FEATURE_REPORT_REF: cfm.length = sizeof(hids_report_ref_t); cfm.value = (uint8_t *)(&s_hids_env.hids_init.feature_report.ref); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_REPORT_MAP_VAL: cfm.length = s_hids_env.hids_init.report_map.len; cfm.value = (uint8_t *)(s_hids_env.hids_init.report_map.p_map); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_BOOT_KB_IN_RPT_VAL: cfm.length = HIDS_BOOT_KB_IN_REPORT_MAX_SIZE; cfm.value = (uint8_t *)(&s_hids_env.kb_input_report_val); break; - + case HIDS_IDX_BOOT_KB_IN_RPT_CCCD: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)(&s_hids_env.kb_input_cccd[conn_idx]); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_BOOT_KB_OUT_RPT_VAL: cfm.length = HIDS_IDX_BOOT_KB_IN_RPT_VAL; cfm.value = (uint8_t *)(&s_hids_env.kb_output_report_val); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_BOOT_MS_IN_RPT_VAL: cfm.length = HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE; cfm.value = (uint8_t *)(&s_hids_env.mouse_input_report_val); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_BOOT_MS_IN_RPT_CCCD: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_hids_env.mouse_input_cccd[conn_idx]; break; - /*----------------------------------------------------------------------------------*/ - +/*----------------------------------------------------------------------------------*/ + case HIDS_IDX_HID_INFO_VAL: cfm.length = sizeof(hids_hid_info_t); cfm.value = (uint8_t *)(&s_hids_env.hids_init.hid_info); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ case HIDS_IDX_CTRL_POINT_VAL: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)(&s_hids_env.ctrl_pt); break; - /*----------------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------------*/ default: cfm.length = 0; cfm.status = BLE_ATT_ERR_INVALID_HANDLE; @@ -557,8 +434,8 @@ static void hids_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para static void hids_cccd_check(hids_evt_t *p_evt, uint16_t cccd_value) { p_evt->evt_type = ((cccd_value == PRF_CLI_START_NTF) ? - HIDS_EVT_IN_REP_NOTIFY_ENABLED : - HIDS_EVT_IN_REP_NOTIFY_DISABLED); + HIDS_EVT_IN_REP_NOTIFY_ENABLED : + HIDS_EVT_IN_REP_NOTIFY_DISABLED); } /** @@ -573,31 +450,32 @@ static void hids_cccd_check(hids_evt_t *p_evt, uint16_t cccd_value) */ static void hids_on_cccd_write(uint8_t tab_index, uint8_t conn_idx, hids_evt_t *p_evt, uint16_t cccd_value) { - switch (tab_index) { + switch (tab_index) + { case HIDS_IDX_INPUT1_REPORT_CCCD: - s_hids_env.input_cccd[INDEX_0][conn_idx] = cccd_value; + s_hids_env.input_cccd[0][conn_idx] = cccd_value; p_evt->report_type = HIDS_REPORT_TYPE_IN1; hids_cccd_check(p_evt, cccd_value); break; - + case HIDS_IDX_INPUT2_REPORT_CCCD: - s_hids_env.input_cccd[INDEX_1][conn_idx] = cccd_value; + s_hids_env.input_cccd[1][conn_idx] = cccd_value; p_evt->report_type = HIDS_REPORT_TYPE_IN2; hids_cccd_check(p_evt, cccd_value); break; - + case HIDS_IDX_INPUT3_REPORT_CCCD: - s_hids_env.input_cccd[INDEX_2][conn_idx] = cccd_value; + s_hids_env.input_cccd[2][conn_idx] = cccd_value; p_evt->report_type = HIDS_REPORT_TYPE_IN3; hids_cccd_check(p_evt, cccd_value); break; - + case HIDS_IDX_BOOT_KB_IN_RPT_CCCD: s_hids_env.kb_input_cccd[conn_idx] = cccd_value; p_evt->report_type = HIDS_REPORT_TYPE_KB_IN; hids_cccd_check(p_evt, cccd_value); break; - + case HIDS_IDX_BOOT_MS_IN_RPT_CCCD: s_hids_env.mouse_input_cccd[conn_idx] = cccd_value; p_evt->report_type = HIDS_REPORT_TYPE_MOUSE_IN; @@ -617,10 +495,12 @@ static void hids_on_cccd_write(uint8_t tab_index, uint8_t conn_idx, hids_evt_t * * @param[in] p_param Pointer to the parameters of the write request. ***************************************************************************************** */ -static void hids_on_protocol_mode_write(hids_evt_t *p_evt, const gatts_write_req_cb_t *p_param) +static void hids_on_protocol_mode_write(hids_evt_t *p_evt, const ble_gatts_evt_write_t *p_param) { - if (p_param->length == 1) { - switch (p_param->value[INDEX_0]) { + if (p_param->length == 1) + { + switch (p_param->value[0]) + { case PROTOCOL_MODE_BOOT: p_evt->evt_type = HIDS_EVT_BOOT_MODE_ENTERED; break; @@ -632,7 +512,7 @@ static void hids_on_protocol_mode_write(hids_evt_t *p_evt, const gatts_write_req default: break; } - s_hids_env.protocol_mode = p_param->value[INDEX_0]; + s_hids_env.protocol_mode = p_param->value[0]; } } @@ -644,10 +524,12 @@ static void hids_on_protocol_mode_write(hids_evt_t *p_evt, const gatts_write_req * @param[in] p_param Pointer to the parameters of the write request. ***************************************************************************************** */ -static void hids_on_control_point_write(hids_evt_t *p_evt, const gatts_write_req_cb_t *p_param) +static void hids_on_control_point_write(hids_evt_t *p_evt, const ble_gatts_evt_write_t *p_param) { - if (p_param->length == 1) { - switch (p_param->value[INDEX_0]) { + if (p_param->length == 1) + { + switch (p_param->value[0]) + { case HIDS_CONTROL_POINT_SUSPEND: p_evt->evt_type = HIDS_EVT_HOST_SUSP; break; @@ -659,11 +541,10 @@ static void hids_on_control_point_write(hids_evt_t *p_evt, const gatts_write_req default: break; } - s_hids_env.ctrl_pt = p_param->value[INDEX_0]; + s_hids_env.ctrl_pt = p_param->value[0]; } } - /** ***************************************************************************************** * @brief Handles reception of the write request. @@ -672,146 +553,122 @@ static void hids_on_control_point_write(hids_evt_t *p_evt, const gatts_write_req * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void hids_write_att_cb(uint8_t conn_idx, - const gatts_write_req_cb_t *p_param) +static void hids_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_hids_env.start_hdl, - HIDS_IDX_NB, - (uint8_t *)&s_hids_env.char_mask); + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_hids_env.start_hdl, + HIDS_IDX_NB, + (uint8_t *)&s_hids_env.char_mask); uint16_t cccd_value; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; hids_evt_t evt; - uint8_t ret; - + evt.evt_type = HIDS_EVT_INVALID; evt.offset = p_param->offset; evt.len = p_param->length; evt.data = p_param->value; cfm.handle = handle; cfm.status = BLE_SUCCESS; - - switch (tab_index) { + + switch(tab_index) + { case HIDS_IDX_PROTOCOL_MODE_VAL: hids_on_protocol_mode_write(&evt, p_param); break; - + case HIDS_IDX_INPUT1_REPORT_CCCD: case HIDS_IDX_INPUT2_REPORT_CCCD: case HIDS_IDX_INPUT3_REPORT_CCCD: case HIDS_IDX_BOOT_KB_IN_RPT_CCCD: case HIDS_IDX_BOOT_MS_IN_RPT_CCCD: - cccd_value = le16toh(&p_param->value[INDEX_0]); + cccd_value = le16toh(&p_param->value[0]); hids_on_cccd_write(tab_index, conn_idx, &evt, cccd_value); break; - + case HIDS_IDX_INPUT1_REPORT_VAL: - if ((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[INDEX_0].value_len) { - ret = memcp_s(&s_hids_env.input_report_val[INDEX_0][p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[0].value_len) + { + memcpy(&s_hids_env.input_report_val[0][p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_IN1; } break; - + case HIDS_IDX_INPUT2_REPORT_VAL: - if ((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[INDEX_1].value_len) { - ret = memcpy_s(&s_hids_env.input_report_val[INDEX_1][p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[1].value_len) + { + memcpy(&s_hids_env.input_report_val[1][p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_IN2; } break; - + case HIDS_IDX_INPUT3_REPORT_VAL: - if ((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[INDEX_2].value_len) { - ret = memcpy_s(&s_hids_env.input_report_val[INDEX_2][p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= s_hids_env.hids_init.input_report_array[2].value_len) + { + memcpy(&s_hids_env.input_report_val[2][p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_IN3; } break; - + case HIDS_IDX_OUTPUT_REPORT_VAL: - if ((p_param->offset + p_param->length) <= s_hids_env.hids_init.output_report.value_len) { - ret = memcpy_s(&s_hids_env.output_report_val[p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= s_hids_env.hids_init.output_report.value_len) + { + memcpy(&s_hids_env.output_report_val[p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_OUT; } break; - - case HIDS_IDX_FEATURE_REPORT_VAL: - if ((p_param->offset + p_param->length) <= s_hids_env.hids_init.feature_report.value_len) { - ret = memcpy_s(&s_hids_env.feature_report_val[p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + + case HIDS_IDX_FEATURE_REPORT_VAL: + if((p_param->offset + p_param->length) <= s_hids_env.hids_init.feature_report.value_len) + { + memcpy(&s_hids_env.feature_report_val[p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_FEATURE; } break; - - case HIDS_IDX_BOOT_KB_IN_RPT_VAL: - if ((p_param->offset + p_param->length) <= HIDS_BOOT_KB_IN_REPORT_MAX_SIZE) { - ret = memcpy_s(&s_hids_env.kb_input_report_val[p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + + case HIDS_IDX_BOOT_KB_IN_RPT_VAL: + if((p_param->offset + p_param->length) <= HIDS_BOOT_KB_IN_REPORT_MAX_SIZE) + { + memcpy(&s_hids_env.kb_input_report_val[p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_KB_IN; } - break; + break; case HIDS_IDX_BOOT_KB_OUT_RPT_VAL: - if ((p_param->offset + p_param->length) <= HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE) { - ret = memcpy_s(&s_hids_env.kb_output_report_val[p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= HIDS_BOOT_KB_OUT_REPORT_MAX_SIZE) + { + memcpy(&s_hids_env.kb_output_report_val[p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_KB_OUT; } break; case HIDS_IDX_BOOT_MS_IN_RPT_VAL: - if ((p_param->offset + p_param->length) <= HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE) { - ret = memcpy_s(&s_hids_env.mouse_input_report_val[p_param->offset], p_param->length, - p_param->value, p_param->length); - if (ret < 0) { - return ret; - } + if((p_param->offset + p_param->length) <= HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE) + { + memcpy(&s_hids_env.mouse_input_report_val[p_param->offset], p_param->value, p_param->length); evt.evt_type = HIDS_EVT_REP_CHAR_WRITE; evt.report_type = HIDS_REPORT_TYPE_MOUSE_IN; } break; - + case HIDS_IDX_CTRL_POINT_VAL: hids_on_control_point_write(&evt, p_param); break; - + default: cfm.status = BLE_ATT_ERR_INVALID_HANDLE; break; } - + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && \ - HIDS_EVT_INVALID != evt.evt_type && \ - s_hids_env.hids_init.evt_handler) { + HIDS_EVT_INVALID != evt.evt_type && \ + s_hids_env.hids_init.evt_handler) + { evt.conn_idx = conn_idx; s_hids_env.hids_init.evt_handler(&evt); } @@ -819,7 +676,6 @@ static void hids_write_att_cb(uint8_t conn_idx, ble_gatts_write_cfm(conn_idx, &cfm); } - /** ***************************************************************************************** * @brief Handles reception of the cccd recover request. @@ -829,21 +685,23 @@ static void hids_write_att_cb(uint8_t conn_idx, * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void hids_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void hids_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { hids_evt_t evt; evt.evt_type = HIDS_EVT_INVALID; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_hids_env.start_hdl, - HIDS_IDX_NB, - (uint8_t *)&s_hids_env.char_mask); - hids_on_cccd_write(tab_index, conn_idx, &evt, cccd_value); + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_hids_env.start_hdl, + HIDS_IDX_NB, + (uint8_t *)&s_hids_env.char_mask); + hids_on_cccd_write(tab_index, conn_idx, &evt, cccd_value); if (HIDS_EVT_INVALID != evt.evt_type && \ - s_hids_env.hids_init.evt_handler) { + s_hids_env.hids_init.evt_handler) + { evt.conn_idx = conn_idx; s_hids_env.hids_init.evt_handler(&evt); } @@ -858,44 +716,50 @@ static void hids_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va */ static void hids_char_mask_init(hids_init_t *p_hids_init) { - s_hids_env.char_mask[INDEX_0] = 0x01; - s_hids_env.char_mask[INDEX_1] = 0x00; - s_hids_env.char_mask[INDEX_2] = 0x60; - s_hids_env.char_mask[INDEX_3] = 0x80; - s_hids_env.char_mask[INDEX_4] = 0x07; - if (p_hids_init->is_kb || p_hids_init->is_mouse) { - s_hids_env.char_mask[INDEX_0] |= 0x06; - if (p_hids_init->is_kb) { - s_hids_env.char_mask[INDEX_2] |= 0x80; - s_hids_env.char_mask[INDEX_3] |= 0x0f; + s_hids_env.char_mask[0] = 0x01; + s_hids_env.char_mask[1] = 0x00; + s_hids_env.char_mask[2] = 0x60; + s_hids_env.char_mask[3] = 0x80; + s_hids_env.char_mask[4] = 0x07; + if(p_hids_init->is_kb || p_hids_init->is_mouse) + { + s_hids_env.char_mask[0] |= 0x06; + if(p_hids_init->is_kb) + { + s_hids_env.char_mask[2] |= 0x80; + s_hids_env.char_mask[3] |= 0x0f; } - if (p_hids_init->is_mouse) { - s_hids_env.char_mask[INDEX_3] |= 0x70; + if(p_hids_init->is_mouse) + { + s_hids_env.char_mask[3] |= 0x70; } } - switch (p_hids_init->input_report_count) { - case REPORT_CNT_0: // do noting + switch(p_hids_init->input_report_count) + { + case 0://do noting break; - case REPORT_CNT_1: - s_hids_env.char_mask[INDEX_0] |= 0x78; + case 1: + s_hids_env.char_mask[0] |= 0x78; break; - case REPORT_CNT_2: - s_hids_env.char_mask[INDEX_0] |= 0xf8; - s_hids_env.char_mask[INDEX_1] |= 0x07; + case 2: + s_hids_env.char_mask[0] |= 0xf8; + s_hids_env.char_mask[1] |= 0x07; break; - default: // max count is 3 - s_hids_env.char_mask[INDEX_0] |= 0xf8; - s_hids_env.char_mask[INDEX_1] |= 0x7f; + default:// max count is 3 + s_hids_env.char_mask[0] |= 0xf8; + s_hids_env.char_mask[1] |= 0x7f; break; } - - if (p_hids_init->out_report_sup) { - s_hids_env.char_mask[INDEX_1] |= 0x80; - s_hids_env.char_mask[INDEX_2] |= 0x03; + + if(p_hids_init->out_report_sup) + { + s_hids_env.char_mask[1] |= 0x80; + s_hids_env.char_mask[2] |= 0x03; } - - if (p_hids_init->feature_report_sup) { - s_hids_env.char_mask[INDEX_2] |= 0x1c; + + if(p_hids_init->feature_report_sup) + { + s_hids_env.char_mask[2] |= 0x1c; } } @@ -914,56 +778,92 @@ static void hids_char_mask_init(hids_init_t *p_hids_init) static sdk_err_t hids_in_rep_notify(uint8_t conn_idx, uint8_t char_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code; - gatts_noti_ind_t hids_noti; + ble_gatts_noti_ind_t hids_noti; hids_noti.type = BLE_GATT_NOTIFICATION; hids_noti.handle = prf_find_handle_by_idx(char_idx, - s_hids_env.start_hdl, - (uint8_t *)&s_hids_env.char_mask); + s_hids_env.start_hdl, + (uint8_t *)&s_hids_env.char_mask); hids_noti.length = length; hids_noti.value = p_data; error_code = ble_gatts_noti_ind(conn_idx, &hids_noti); + return error_code; } +static void hids_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + hids_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + hids_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + +// case BLE_GATTS_EVT_NTF_IND: +// hids_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); +// break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + hids_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + +// case BLE_GAPC_EVT_DISCONNECTED: +// hids_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); +// break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ******************************************************************************* */ sdk_err_t hids_service_init(hids_init_t *p_hids_init) { - sdk_err_t ret; - if (p_hids_init == NULL) { + if (NULL == p_hids_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_hids_env.hids_init, sizeof(hids_init_t), p_hids_init, sizeof(hids_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_hids_env.hids_init, p_hids_init, sizeof(hids_init_t)); hids_char_mask_init(p_hids_init); s_hids_env.protocol_mode = DEFAULT_PROTOCOL_MODE; s_hids_env.ctrl_pt = INITIAL_VALUE_HID_CONTROL_POINT; - return ble_server_prf_add(&hids_prf_info); + + s_hids_env.start_hdl = PRF_INVALID_HANDLE; + + s_hids_env.hids_gatts_db.shdl = &s_hids_env.start_hdl; + s_hids_env.hids_gatts_db.uuid = s_hids_svc_uuid; + s_hids_env.hids_gatts_db.attr_tab_cfg = (uint8_t *)&(s_hids_env.char_mask); + s_hids_env.hids_gatts_db.max_nb_attr = HIDS_IDX_NB; + s_hids_env.hids_gatts_db.srvc_perm = 0; + s_hids_env.hids_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_hids_env.hids_gatts_db.attr_tab.attr_tab_16 = hids_attr_tab; + + return ble_gatts_prf_add(&s_hids_env.hids_gatts_db, hids_ble_evt_handler); } -sdk_err_t hids_input_rep_send(uint8_t conn_idx, uint8_t rep_idx, uint8_t *p_data, uint16_t uint16_t length) +sdk_err_t hids_input_rep_send(uint8_t conn_idx, uint8_t rep_idx, uint8_t *p_data, uint16_t length) { - uint16_t len = length; - sdk_err_t ret; - static const uint8_t char_idx[] = {HIDS_IDX_INPUT1_REPORT_VAL, - HIDS_IDX_INPUT2_REPORT_VAL, HIDS_IDX_INPUT3_REPORT_VAL}; + static const uint8_t char_idx[] = {HIDS_IDX_INPUT1_REPORT_VAL, HIDS_IDX_INPUT2_REPORT_VAL, HIDS_IDX_INPUT3_REPORT_VAL}; sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - if (rep_idx >= IN_REPORT_MAX_COUNT || p_data == NULL || len == 0) { + if(rep_idx >= IN_REPORT_MAX_COUNT || p_data == NULL || length == 0) + { return SDK_ERR_INVALID_PARAM; } - len = ((length > HIDS_REPORT_MAX_SIZE) ? HIDS_REPORT_MAX_SIZE : len); - ret = memcpy_s(&s_hids_env.input_report_val[rep_idx], len, p_data, len); - if (ret < 0) { - return ret; - } - if (s_hids_env.input_cccd[rep_idx][conn_idx] == PRF_CLI_START_NTF) { - error_code = hids_in_rep_notify(conn_idx, char_idx[rep_idx], p_data, len); + length = ((length > HIDS_REPORT_MAX_SIZE) ? HIDS_REPORT_MAX_SIZE : length); + memcpy(&s_hids_env.input_report_val[rep_idx], p_data, length); + if(s_hids_env.input_cccd[rep_idx][conn_idx] == PRF_CLI_START_NTF) + { + error_code = hids_in_rep_notify(conn_idx, char_idx[rep_idx], p_data, length); } return error_code; } @@ -971,17 +871,15 @@ sdk_err_t hids_input_rep_send(uint8_t conn_idx, uint8_t rep_idx, uint8_t *p_data sdk_err_t hids_boot_kb_in_rep_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - uint16_t len = length; - if (p_data == NULL || len == 0) { + if(p_data == NULL || length == 0) + { return SDK_ERR_INVALID_PARAM; } - len = ((len > HIDS_BOOT_KB_IN_REPORT_MAX_SIZE) ? HIDS_BOOT_KB_IN_REPORT_MAX_SIZE : len); - error_code = memcpy_s(&s_hids_env.kb_input_report_val, len, p_data, len); - if (error_code < 0) { - return error_code; - } - if (s_hids_env.kb_input_cccd[conn_idx] == PRF_CLI_START_NTF) { - error_code = hids_in_rep_notify(conn_idx, HIDS_IDX_BOOT_KB_IN_RPT_VAL, p_data, len); + length = ((length > HIDS_BOOT_KB_IN_REPORT_MAX_SIZE) ? HIDS_BOOT_KB_IN_REPORT_MAX_SIZE : length); + memcpy(&s_hids_env.kb_input_report_val, p_data, length); + if(s_hids_env.kb_input_cccd[conn_idx] == PRF_CLI_START_NTF) + { + error_code = hids_in_rep_notify(conn_idx, HIDS_IDX_BOOT_KB_IN_RPT_VAL, p_data, length); } return error_code; } @@ -989,17 +887,23 @@ sdk_err_t hids_boot_kb_in_rep_send(uint8_t conn_idx, uint8_t *p_data, uint16_t l sdk_err_t hids_boot_mouse_in_rep_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - uint16_t len = length; - if (p_data == NULL || length < HIDS_BOOT_MOUSE_IN_REPORT_MIN_SIZE) { + if(p_data == NULL || length < HIDS_BOOT_MOUSE_IN_REPORT_MIN_SIZE) + { return SDK_ERR_INVALID_PARAM; } - len = ((len > HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE) ? HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE : len); - error_code = memcpy_s(&s_hids_env.mouse_input_report_val, len, p_data, len); - if (error_code < 0) { - return error_code; - } - if (s_hids_env.mouse_input_cccd[conn_idx] == PRF_CLI_START_NTF) { - error_code = hids_in_rep_notify(conn_idx, HIDS_IDX_BOOT_MS_IN_RPT_VAL, p_data, len); + length = ((length > HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE) ? HIDS_BOOT_MOUSE_IN_REPORT_MAX_SIZE : length); + memcpy(&s_hids_env.mouse_input_report_val, p_data, length); + if(s_hids_env.mouse_input_cccd[conn_idx] == PRF_CLI_START_NTF) + { + error_code = hids_in_rep_notify(conn_idx, HIDS_IDX_BOOT_MS_IN_RPT_VAL, p_data, length); } return error_code; } + +uint16_t hids_service_start_handle_get(void) +{ + return s_hids_env.start_hdl; +} + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.h index a9f04cf..adcb5fa 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hids/hids.h @@ -66,21 +66,20 @@ #ifndef __HIDS_H__ #define __HIDS_H__ -#include #include "ble_prf_utils.h" -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup HIDS_MACRO Defines * @{ */ -#define HIDS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Heart Rate Service connections. */ +#define HIDS_CONNECTION_MAX 10 /**< Maximum number of Heart Rate Service connections. */ -#define HIDS_REPORT_MAX_SIZE 20 /**< Maximum length of report. */ -#define HIDS_REPORT_MAP_MAX_SIZE 512 /**< Limitation of length, as per Section 2.6.1 in HIDS Spec, version 1.0 */ +#define HIDS_REPORT_MAX_SIZE 20 /**< Maximum length of report. */ +#define HIDS_REPORT_MAP_MAX_SIZE 512 /**< Limitation of length, as per Section 2.6.1 in HIDS Spec, version 1.0 */ /** * @defgroup HIDS_REPORT_TYPE Report Type values @@ -97,8 +96,8 @@ * @{ * @brief HIDS Information Flags define. */ -#define HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01 /**< Bit mask of Remote Wake flag in HIDS information. */ -#define HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02 /**< Bit mask of Normally Connectable flag in HIDS information. */ +#define HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01 /**< Bit mask of Remote Wake flag in HIDS information. */ +#define HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02 /**< Bit mask of Normally Connectable flag in HIDS information. */ /** @} */ /** @} */ @@ -109,7 +108,8 @@ */ /**@brief HID Service event type. */ -typedef enum { +typedef enum +{ HIDS_EVT_INVALID, /**< Invalid event. */ HIDS_EVT_IN_REP_NOTIFY_ENABLED, /**< Input report notification enabled event. */ HIDS_EVT_IN_REP_NOTIFY_DISABLED, /**< Input report notification disabled event. */ @@ -122,7 +122,8 @@ typedef enum { /**@brief HID Service write report type. */ -typedef enum { +typedef enum +{ HIDS_REPORT_TYPE_RESERVED, /**< The reserved report type. */ HIDS_REPORT_TYPE_IN1, /**< The input report1 type. */ HIDS_REPORT_TYPE_IN2, /**< The input report2 type. */ @@ -142,27 +143,23 @@ typedef enum { */ /**@brief HID Service event. */ -typedef struct { +typedef struct +{ hids_evt_type_t evt_type; /**< Type of event. */ uint8_t conn_idx; /**< Connect index. */ hids_report_type_t report_type; /**< Type of report, see @ref hids_report_type_t. */ uint16_t offset; /**< Offset for the write operation. */ uint16_t len; /**< Length of the incoming data. */ uint8_t const * data; /**< Incoming data, variable length */ -} hids_evt_t; +}hids_evt_t; /**@brief HID Information characteristic value. */ -typedef struct { - uint16_t - bcd_hid; /**< 16-bit unsigned integer representing version number of base USB HID Specification \ - implemented by HID Device */ - uint8_t - b_country_code; /**< Identifies which country the hardware is localized for. \ - Most hardware is not localized and thus this value would be zero (0). */ - uint8_t - flags; /**< See http://developer.bluetooth.org/gatt/characteristics/Pages/ \ - CharacteristicViewer.aspx?u=org.bluetooth.characteristic.hid_information.xml */ -} hids_hid_info_t; +typedef struct +{ + uint16_t bcd_hid; /**< 16-bit unsigned integer representing version number of base USB HID Specification implemented by HID Device */ + uint8_t b_country_code; /**< Identifies which country the hardware is localized for. Most hardware is not localized and thus this value would be zero (0). */ + uint8_t flags; /**< See http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.hid_information.xml */ +}hids_hid_info_t; /**@brief Value of a Report Reference descriptor. @@ -170,22 +167,24 @@ typedef struct { * @details This is mapping information that maps the parent characteristic to the Report ID(s) and * Report Type(s) defined within a Report Map characteristic. */ -typedef struct { - uint8_t report_id; /**< Non-zero value if there is more than one instance of the same Report Type */ - uint8_t report_type; /**< Type of Report characteristic (see @ref HIDS_REPORT_TYPE) */ +typedef struct +{ + uint8_t report_id; /**< Non-zero value if there is more than one instance of the same Report Type */ + uint8_t report_type; /**< Type of Report characteristic (see @ref HIDS_REPORT_TYPE) */ } hids_report_ref_t; /**@brief HID Service Report characteristic define. */ -typedef struct { +typedef struct +{ uint16_t value_len; /**< Length of characteristic value. */ - hids_report_ref_t - ref; /**< Value of a Report Reference descriptor, see @ref hids_report_ref_t. */ + hids_report_ref_t ref; /**< Value of a Report Reference descriptor, see @ref hids_report_ref_t. */ } hids_report_int_t; /**@brief HID Service Report Map characteristic value. */ -typedef struct { +typedef struct +{ uint8_t *p_map; /**< Pointer to the report map. */ uint16_t len; /**< The length of report map. */ } hids_report_map_t; @@ -199,19 +198,18 @@ typedef void (*hids_evt_handler_t)(hids_evt_t *p_evt); /**@brief HID Service initialization variable. */ -typedef struct { - hids_evt_handler_t evt_handler; /**< Handle events in HID Service. */ - bool is_kb; /**< TRUE if device is operating as a keyboard, FALSE if it is not. */ - bool is_mouse; /**< TRUE if device is operating as a mouse, FALSE if it is not. */ - hids_hid_info_t hid_info; /**< Value of HID information characteristic. */ - hids_report_map_t report_map; /**< HID Service Report Map characteristic value. */ - uint8_t input_report_count; /**< Number of Input Report characteristics. */ - hids_report_int_t input_report_array[3]; /**< HID input Report Reference value. */ - bool - out_report_sup; /**< TRUE if output Report characteristic suport, FALSE if it is nonsupport. */ +typedef struct +{ + hids_evt_handler_t evt_handler; /**< Handle events in HID Service. */ + bool is_kb; /**< TRUE if device is operating as a keyboard, FALSE if it is not. */ + bool is_mouse; /**< TRUE if device is operating as a mouse, FALSE if it is not. */ + hids_hid_info_t hid_info; /**< Value of HID information characteristic. */ + hids_report_map_t report_map; /**< HID Service Report Map characteristic value. */ + uint8_t input_report_count; /**< Number of Input Report characteristics. */ + hids_report_int_t input_report_array[3]; /**< HID input Report Reference value. */ + bool out_report_sup; /**< TRUE if output Report characteristic suport, FALSE if it is nonsupport. */ hids_report_int_t output_report; /**< HID output Report Reference value. */ - bool - feature_report_sup; /**< TRUE if feature Report characteristic suport, FALSE if it is nonsupport. */ + bool feature_report_sup; /**< TRUE if feature Report characteristic suport, FALSE if it is nonsupport. */ hids_report_int_t feature_report; /**< HID feature Report Reference value. */ } hids_init_t; /** @} */ @@ -271,6 +269,16 @@ sdk_err_t hids_boot_kb_in_rep_send(uint8_t conn_idx, uint8_t *p_data, uint16_t l ***************************************************************************************** */ sdk_err_t hids_boot_mouse_in_rep_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the hids service start handle . + * + * @return The hids service start handle. + ***************************************************************************************** + */ +uint16_t hids_service_start_handle_get(void); + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/BUILD.gn new file mode 100644 index 0000000..ceeae7e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hrrcps") { + sources = [ "hrrcps.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.c index 1686d90..d2766b5 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.c @@ -3,7 +3,7 @@ * * @file hrrcps.c * - * @brief HRS RSCS Relay Control Point Service Implementation. + * @brief HRS hrrcps Relay Control Point Service Implementation. * **************************************************************************************** * @attention @@ -48,9 +48,9 @@ * DEFINES ***************************************************************************************** */ -#define HRRCPS_CTRL_PT_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ - 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x06, 0xED, 0xA6} -#define HRRCPS_CTRL_PT_RSP_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define HRRCPS_CTRL_PT_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A,0x46, 0x44, 0xD3, 0x02, 0x06, 0xED, 0xA6} +#define HRRCPS_CTRL_PT_RSP_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x06, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ @@ -62,9 +62,10 @@ * ENUMERATIONS **************************************************************************************** */ -/**@brief HRS RSCS Relay Control Point Service Attributes Indexes. */ -enum { - // HRS RSCS Relay Control Point Service +/**@brief HRS hrrcps Relay Control Point Service Attributes Indexes. */ +enum +{ + // HRS hrrcps Relay Control Point Service HRRCPS_IDX_SVC, // HRR Control Point @@ -83,25 +84,19 @@ enum { * STRUCTURES ***************************************************************************************** */ -/**@brief HRS RSCS Relay Control Point Service environment variable. */ -struct hrrcps_env_t { - hrrcps_evt_handler_t - evt_handler; /**< HRS RSCS Relay Control Point Service event handler. */ - uint16_t - start_hdl; /**< HRS RSCS Relay Control Point Service start handle. */ - uint16_t - ctrl_pt_rsp_ind_cfg[HRRCPS_CONNECTION_MAX]; /**< The configuration of Control Point Response \ - which is configured by the peer devices. */ +/**@brief HRS hrrcps Relay Control Point Service environment variable. */ +struct hrrcps_env_t +{ + hrrcps_evt_handler_t evt_handler; /**< HRS hrrcps Relay Control Point Service event handler. */ + uint16_t start_hdl; /**< HRS hrrcps Relay Control Point Service start handle. */ + uint16_t ctrl_pt_rsp_ind_cfg[HRRCPS_CONNECTION_MAX]; /**< The configuration of Control Point Response which is configured by the peer devices. */ + ble_gatts_create_db_t hrrcps_gatts_db; /**< HRS hrrcps Relay Control Point Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t hrrcps_init(void); -static void hrrcps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void hrrcps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void hrrcps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t ctrl_pt_id); /* @@ -110,97 +105,37 @@ static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t */ static struct hrrcps_env_t s_hrrcps_env; static uint16_t s_hrrcps_char_mask = 0x7f; +static const uint8_t s_hrrcps_svc_uuid[] = {HRRCPS_SERVICE_UUID}; /**@brief Full HRRCPS Database Description - Used to add attributes into the database. */ -static const attm_desc_128_t hrrcps_attr_tab[HRRCPS_IDX_NB] = { - // HRS RSCS Relay Control Point Service - [HRRCPS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, +static const ble_gatts_attm_desc_128_t hrrcps_attr_tab[HRRCPS_IDX_NB] = +{ + // HRS hrrcps Relay Control Point Service + [HRRCPS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // HRR Control Point Characteristic - Declaration - [HRRCPS_IDX_HRR_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HRRCPS_IDX_HRR_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // HRR Control Point Characteristic - Value - [HRRCPS_IDX_HRR_CTRL_PT_VAL] = { - HRRCPS_CTRL_PT_CHARACTERISTIC_UUID, - WRITE_REQ_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - HRRCPS_CTRL_PT_VAL_LEN - }, + [HRRCPS_IDX_HRR_CTRL_PT_VAL] = {HRRCPS_CTRL_PT_CHARACTERISTIC_UUID, + BLE_GATTS_WRITE_REQ_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + HRRCPS_CTRL_PT_VAL_LEN}, // HRR Control Point Response Characteristic - Declaration - [HRRCPS_IDX_HRR_CTRL_PT_RSP_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HRRCPS_IDX_HRR_CTRL_PT_RSP_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // HRR Control Point Response Characteristic - Value - [HRRCPS_IDX_HRR_CTRL_PT_RSP_VAL] = { - HRRCPS_CTRL_PT_RSP_CHARACTERISTIC_UUID, - INDICATE_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - HRRCPS_CTRL_PT_RSP_VAL_LEN - }, + [HRRCPS_IDX_HRR_CTRL_PT_RSP_VAL] = {HRRCPS_CTRL_PT_RSP_CHARACTERISTIC_UUID, + BLE_GATTS_INDICATE_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + HRRCPS_CTRL_PT_RSP_VAL_LEN}, // HRR Control Point Responset Characteristic - Client Characteristic Configuration Descriptor - [HRRCPS_IDX_HRR_CTRL_PT_RSP_CFG] = {ATT_128_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, -}; - -/**@brief HRRCPS Service interface required by profile manager. */ -static ble_prf_manager_cbs_t hrrcps_mgr_cbs = { - (prf_init_func_t)hrrcps_init, - NULL, - NULL -}; - -/**@brief HRRCPS GATT Server Callbacks. */ -static gatts_prf_cbs_t hrrcps_gatts_cbs = { - hrrcps_read_att_cb, - hrrcps_write_att_cb, - NULL, - NULL, - hrrcps_cccd_set_cb -}; - -/**@brief HRRCPS Service Information. */ -static const prf_server_info_t hrrcps_prf_info = { - .max_connection_nb = HRRCPS_CONNECTION_MAX, - .manager_cbs = &hrrcps_mgr_cbs, - .gatts_prf_cbs = &hrrcps_gatts_cbs + [HRRCPS_IDX_HRR_CTRL_PT_RSP_CFG] = {ATT_128_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize HRS RSCS Relay Control Point service and create database in ATT. - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t hrrcps_init(void) -{ - const uint8_t hrrcps_svc_uuid[] = {HRRCPS_SERVICE_UUID}; - uint16_t start_hdl = PRF_INVALID_HANDLE; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = hrrcps_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_hrrcps_char_mask; - gatts_db.max_nb_attr = HRRCPS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = hrrcps_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_hrrcps_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -209,9 +144,9 @@ static sdk_err_t hrrcps_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void hrrcps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void hrrcps_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = 0; @@ -219,7 +154,8 @@ static void hrrcps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_ cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case HRRCPS_IDX_HRR_CTRL_PT_RSP_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_hrrcps_env.ctrl_pt_rsp_ind_cfg[conn_idx]; @@ -242,25 +178,29 @@ static void hrrcps_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_ * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void hrrcps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void hrrcps_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint16_t cccd_value = 0; bool is_ctrl_pt_valid = false; hrrcps_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_hrrcps_env.start_hdl, HRRCPS_IDX_NB, (uint8_t *)&s_hrrcps_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case HRRCPS_IDX_HRR_CTRL_PT_VAL: if ((HRRCPS_CTRL_PT_SCAN_HRS > p_param->value[0]) || \ - (HRRCPS_CTRL_PT_RSCS_DISCONN < p_param->value[0])) { + (HRRCPS_CTRL_PT_RSCS_DISCONN < p_param->value[0])) + { cfm.status = 0x80; - } else { + } + else + { is_ctrl_pt_valid = true; } break; @@ -278,10 +218,12 @@ static void hrrcps_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t * break; } - if (is_ctrl_pt_valid) { + if (is_ctrl_pt_valid) + { hrrcps_ctrl_pt_handler(conn_idx, (hrrcps_ctrl_pt_id_t)p_param->value[0]); - } else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && HRRCPS_EVT_INVALID != event.evt_type - && s_hrrcps_env.evt_handler) { + } + else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && HRRCPS_EVT_INVALID != event.evt_type && s_hrrcps_env.evt_handler) + { event.conn_idx = conn_idx; s_hrrcps_env.evt_handler(&event); } @@ -305,7 +247,8 @@ static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t ctrl_pt event.conn_idx = conn_idx; - switch (ctrl_pt_id) { + switch (ctrl_pt_id) + { case HRRCPS_CTRL_PT_SCAN_HRS: event.evt_type = HRRCPS_EVT_SCAN_HRS; break; @@ -317,23 +260,23 @@ static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t ctrl_pt case HRRCPS_CTRL_PT_HRS_SEN_LOC_READ: event.evt_type = HRRCPS_EVT_HRS_SENSOR_LOC_READ; break; - + case HRRCPS_CTRL_PT_RSCS_SEN_LOC_READ: event.evt_type = HRRCPS_EVT_RSCS_SENSOR_LOC_READ; break; - + case HRRCPS_CTRL_PT_HRS_NTF_ENABLE: event.evt_type = HRRCPS_EVT_ENABLE_HRS_NTF; break; - + case HRRCPS_CTRL_PT_RSCS_NTF_ENABLE: event.evt_type = HRRCPS_EVT_ENABLE_RSCS_NTF; break; - + case HRRCPS_CTRL_PT_HRS_NTF_DISABLE: event.evt_type = HRRCPS_EVT_DISABLE_HRS_NTF; break; - + case HRRCPS_CTRL_PT_RSCS_NTF_DISABLE: event.evt_type = HRRCPS_EVT_DISABLE_RSCS_NTF; break; @@ -350,7 +293,8 @@ static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t ctrl_pt break; } - if (HRRCPS_EVT_INVALID != event.evt_type && s_hrrcps_env.evt_handler) { + if (HRRCPS_EVT_INVALID != event.evt_type && s_hrrcps_env.evt_handler) + { s_hrrcps_env.evt_handler(&event); } } @@ -364,18 +308,20 @@ static void hrrcps_ctrl_pt_handler(uint8_t conn_idx, hrrcps_ctrl_pt_id_t ctrl_pt * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void hrrcps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void hrrcps_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; hrrcps_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } tab_index = prf_find_idx_by_handle(handle, s_hrrcps_env.start_hdl, HRRCPS_IDX_NB, (uint8_t *)&s_hrrcps_char_mask); - switch (tab_index) { + switch (tab_index) + { case HRRCPS_IDX_HRR_CTRL_PT_RSP_CFG: event.evt_type = ((PRF_CLI_START_IND == cccd_value) ? \ HRRCPS_EVT_CTRL_PT_IND_ENABLE : \ @@ -388,7 +334,8 @@ static void hrrcps_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_ break; } - if (HRRCPS_EVT_INVALID != event.evt_type && s_hrrcps_env.evt_handler) { + if (HRRCPS_EVT_INVALID != event.evt_type && s_hrrcps_env.evt_handler) + { event.conn_idx = conn_idx; s_hrrcps_env.evt_handler(&event); } @@ -412,13 +359,37 @@ static uint16_t hrrcps_ctrl_pt_rsp_encode(hrrcps_rsp_val_t *p_rsp_val, uint8_t * p_encoded_buff[length++] = p_rsp_val->cmd_id; p_encoded_buff[length++] = p_rsp_val->rsp_id; - if (p_rsp_val->is_inc_prama) { + if (p_rsp_val->is_inc_prama) + { p_encoded_buff[length++] = p_rsp_val->rsp_param; } return length; } +static void hrrcps_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + hrrcps_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + hrrcps_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + hrrcps_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -426,12 +397,13 @@ static uint16_t hrrcps_ctrl_pt_rsp_encode(hrrcps_rsp_val_t *p_rsp_val, uint8_t * sdk_err_t hrrcps_ctrl_pt_rsp_send(uint8_t conn_idx, hrrcps_rsp_val_t *p_rsp_val) { uint8_t encoded_ctrl_pt_rsp[HRRCPS_CTRL_PT_RSP_VAL_LEN]; - gatts_noti_ind_t ctrl_pt_rsp_ind; + ble_gatts_noti_ind_t ctrl_pt_rsp_ind; uint16_t encoded_length; encoded_length =hrrcps_ctrl_pt_rsp_encode(p_rsp_val, encoded_ctrl_pt_rsp); - if (PRF_CLI_START_IND == s_hrrcps_env.ctrl_pt_rsp_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_hrrcps_env.ctrl_pt_rsp_ind_cfg[conn_idx]) + { ctrl_pt_rsp_ind.type = BLE_GATT_INDICATION; ctrl_pt_rsp_ind.handle = prf_find_handle_by_idx(HRRCPS_IDX_HRR_CTRL_PT_RSP_VAL, s_hrrcps_env.start_hdl, @@ -448,5 +420,16 @@ sdk_err_t hrrcps_ctrl_pt_rsp_send(uint8_t conn_idx, hrrcps_rsp_val_t *p_rsp_val) sdk_err_t hrrcps_service_init(hrrcps_evt_handler_t evt_handler) { s_hrrcps_env.evt_handler = evt_handler; - return ble_server_prf_add(&hrrcps_prf_info); + + s_hrrcps_env.start_hdl = PRF_INVALID_HANDLE; + + s_hrrcps_env.hrrcps_gatts_db.shdl = &s_hrrcps_env.start_hdl; + s_hrrcps_env.hrrcps_gatts_db.uuid = s_hrrcps_svc_uuid; + s_hrrcps_env.hrrcps_gatts_db.attr_tab_cfg = (uint8_t *)&s_hrrcps_char_mask; + s_hrrcps_env.hrrcps_gatts_db.max_nb_attr = HRRCPS_IDX_NB; + s_hrrcps_env.hrrcps_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_hrrcps_env.hrrcps_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_hrrcps_env.hrrcps_gatts_db.attr_tab.attr_tab_128 = hrrcps_attr_tab; + + return ble_gatts_prf_add(&s_hrrcps_env.hrrcps_gatts_db, hrrcps_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.h index 0903cfa..bff3912 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrrcps/hrrcps.h @@ -57,24 +57,21 @@ #ifndef __HRRCPS_H__ #define __HRRCPS_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup HRRCPS_MACRO Defines * @{ */ -#define HRRCPS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of \ - HRS RSCS Relay Control Point Service connections. */ -#define HRRCPS_CTRL_PT_VAL_LEN 2 /**< Length of the value of Control Point characteristic. */ -#define HRRCPS_CTRL_PT_RSP_VAL_LEN 4 /**< Length of the value of Control Point Response characteristic. */ -#define HRRCPS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x01, 0x06, 0xED, 0xA6 /**< The UUID of HRS RSCS Relay Control Point Service \ - for setting advertising data. */ +#define HRRCPS_CONNECTION_MAX 10 /**< Maximum number of HRS RSCS Relay Control Point Service connections. */ +#define HRRCPS_CTRL_PT_VAL_LEN 2 /**< Length of the value of Control Point characteristic. */ +#define HRRCPS_CTRL_PT_RSP_VAL_LEN 4 /**< Length of the value of Control Point Response characteristic. */ +#define HRRCPS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x06, 0xED, 0xA6 /**< The UUID of HRS RSCS Relay Control Point Service for setting advertising data. */ /** @} */ /** @@ -82,7 +79,8 @@ * @{ */ /**@brief HRS RSCS Relay Control Point Service Control Point IDs. */ -typedef enum { +typedef enum +{ HRRCPS_CTRL_PT_SCAN_HRS = 0x01, /**< Scan HRS device. */ HRRCPS_CTRL_PT_SCAN_RSCS, /**< Scan RSCS device. */ HRRCPS_CTRL_PT_HRS_SEN_LOC_READ, /**< Read HRS sensor location. */ @@ -99,13 +97,15 @@ typedef enum { } hrrcps_ctrl_pt_id_t; /**@brief HRS RSCS Relay Control Point Service Response IDs of Control Point. */ -typedef enum { +typedef enum +{ HRRCPS_RSP_ID_OK = 0x01, /**< Success. */ HRRCPS_RSP_ID_ERROR, /**< Fail. */ } hrrcps_rsp_id_t; /**@brief HRS RSCS Relay Control Point Service event type. */ -typedef enum { +typedef enum +{ HRRCPS_EVT_INVALID, /**< Invalid HRRCPS event type. */ HRRCPS_EVT_CTRL_PT_IND_ENABLE, /**< HRR Control Point indicaiton is enabled. */ HRRCPS_EVT_CTRL_PT_IND_DISABLE, /**< HRR Control Point indicaiton is disabled. */ @@ -127,7 +127,8 @@ typedef enum { * @{ */ /**@brief HRS RSCS Relay Control Point Response value. */ -typedef struct { +typedef struct +{ hrrcps_ctrl_pt_id_t cmd_id; /**< Control Point ID. */ hrrcps_rsp_id_t rsp_id; /**< Response ID. */ bool is_inc_prama; /**< Parameter is included or not. */ @@ -135,7 +136,8 @@ typedef struct { } hrrcps_rsp_val_t; /**@brief HRS RSCS Relay Control Point Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ hrrcps_evt_type_t evt_type; /**< The HRRCPS event type. */ } hrrcps_evt_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/BUILD.gn new file mode 100644 index 0000000..f25c0ce --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hrs") { + sources = [ "hrs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.c index 70c829b..e521e95 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.c @@ -35,17 +35,15 @@ ***************************************************************************************** */ -/* -* INCLUDE FILES -******************************************************************************* -*/ + /* + * INCLUDE FILES + ******************************************************************************* + */ #include "hrs.h" #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define DIV_2 2 - /* * DEFINES ******************************************************************************* @@ -58,20 +56,27 @@ ******************************************************************************* */ /**@brief Heart Rate Service Attributes Indexes. */ -enum hrs_attr_idx_t { +enum hrs_attr_idx_t +{ HRS_IDX_SVC, + HRS_IDX_HR_MEAS_CHAR, HRS_IDX_HR_MEAS_VAL, HRS_IDX_HR_MEAS_NTF_CFG, + HRS_IDX_BODY_SENSOR_LOC_CHAR, HRS_IDX_BODY_SENSOR_LOC_VAL, + HRS_IDX_HR_CTNL_PT_CHAR, HRS_IDX_HR_CTNL_PT_VAL, + HRS_IDX_NB, }; /**@brief Heart Rate Service Measurement flag bit. */ -enum hrs_flag_bit_t { +enum hrs_flag_bit_t +{ + HRS_BIT_RATE_FORMAT = 0x01, /**< Heart Rate Value Format bit. */ HRS_BIT_SENSOR_CONTACT_DETECTED = 0x02, /**< Sensor Contact Detected bit. */ HRS_BIT_SENSOR_CONTACT_SUPPORTED = 0x04, /**< Sensor Contact Supported bit. */ @@ -84,128 +89,65 @@ enum hrs_flag_bit_t { ******************************************************************************* */ /**@brief Heart Rate Measurement characteristic value structure. */ -struct hr_meas_char_val_t { - bool is_sensor_contact_detected; /**< True if sensor contact has been detected. */ - uint8_t hr_meas_value[HRS_MEAS_MAX_LEN]; /**< The buffer for encoded value of Heart Rate \ - Measurement characteristic. */ - uint16_t energy_expended; /**< The accumulated energy expended in kilo Joules since the last time it was reset. */ +struct hr_meas_char_val_t +{ + bool is_sensor_contact_detected; /**< True if sensor contact has been detected. */ + uint8_t hr_meas_value[HRS_MEAS_MAX_LEN]; /**< The buffer for encoded value of Heart Rate Measurement characteristic. */ + uint16_t energy_expended; /**< The accumulated energy expended in kilo Joules since the last time it was reset. */ uint16_t rr_interval[HRS_MAX_BUFFERED_RR_INTERVALS]; /**< The buffer for RR Interval measurements. */ uint8_t rr_interval_count; /**< The number of RR Interval measurements in the buffer. */ }; /**@brief Heart Rate Service environment variable. */ -struct hrs_env_t { - hrs_init_t hrs_init; /**< Heart Rate Service Init Value. */ - struct hr_meas_char_val_t hr_meas; /**< The value of Heart Rate Measurement characteristic. */ +struct hrs_env_t +{ + hrs_init_t hrs_init; /**< Heart Rate Service Init Value. */ + struct hr_meas_char_val_t hr_meas; /**< The value of Heart Rate Measurement characteristic. */ uint16_t start_hdl; /**< Heart Rate Service start handle. */ - uint16_t - ntf_cfg[HRS_CONNECTION_MAX];/**< The configuration of Heart Rate Measurement Notification \ - which is configured by the peer devices. */ + uint16_t ntf_cfg[HRS_CONNECTION_MAX];/**< The configuration of Heart Rate Measurement Notification which is configured by the peer devices. */ + ble_gatts_create_db_t hrs_serv_db; /**< Heart Rate Service DataBase. */ }; -/* -* LOCAL FUNCTION DECLARATION -******************************************************************************* -*/ -static sdk_err_t hrs_init(void); -static void hrs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void hrs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void hrs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); + /* + * LOCAL FUNCTION DECLARATION + ******************************************************************************* + */ /* * LOCAL VARIABLE DEFINITIONS ******************************************************************************* */ static struct hrs_env_t s_hrs_env; +static const uint8_t s_hrs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HEART_RATE); /**@brief Full HRS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_t hrs_attr_tab[HRS_IDX_NB] = { +static const ble_gatts_attm_desc_t hrs_attr_tab[HRS_IDX_NB] = +{ // Heart Rate Service Declaration - [HRS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [HRS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // HR Measurement Characteristic - Declaration - [HRS_IDX_HR_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HRS_IDX_HR_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // HR Measurement Characteristic - Value - [HRS_IDX_HR_MEAS_VAL] = {BLE_ATT_CHAR_HEART_RATE_MEAS, NOTIFY_PERM_UNSEC, ATT_VAL_LOC_USER, HRS_MEAS_MAX_LEN}, + [HRS_IDX_HR_MEAS_VAL] = {BLE_ATT_CHAR_HEART_RATE_MEAS, BLE_GATTS_NOTIFY_PERM_UNSEC,BLE_GATTS_ATT_VAL_LOC_USER, HRS_MEAS_MAX_LEN}, // HR Measurement Characteristic - Client Characteristic Configuration Descriptor - [HRS_IDX_HR_MEAS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [HRS_IDX_HR_MEAS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Body Sensor Location Characteristic - Declaration - [HRS_IDX_BODY_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HRS_IDX_BODY_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Body Sensor Location Characteristic - Value - [HRS_IDX_BODY_SENSOR_LOC_VAL] = {BLE_ATT_CHAR_BODY_SENSOR_LOCATION, READ_PERM_UNSEC, - ATT_VAL_LOC_USER, sizeof(uint8_t)}, + [HRS_IDX_BODY_SENSOR_LOC_VAL] = {BLE_ATT_CHAR_BODY_SENSOR_LOCATION,BLE_GATTS_READ_PERM_UNSEC, BLE_GATTS_ATT_VAL_LOC_USER, sizeof(uint8_t)}, // Heart Rate Control Point Characteristic - Declaration - [HRS_IDX_HR_CTNL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HRS_IDX_HR_CTNL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Heart Rate Control Point Characteristic - Value - [HRS_IDX_HR_CTNL_PT_VAL] = {BLE_ATT_CHAR_HEART_RATE_CNTL_POINT, WRITE_REQ_PERM_UNSEC, 0, sizeof(uint8_t)}, -}; - -/**@brief HRS interface required by profile manager. */ -static ble_prf_manager_cbs_t hrs_mgr_cbs = { - (prf_init_func_t)hrs_init, - NULL, - NULL -}; - -/**@brief HRS GATT server Callbacks. */ -static gatts_prf_cbs_t hrs_gatts_cbs = { - hrs_read_att_cb, - hrs_write_att_cb, - NULL, - NULL, - hrs_cccd_set_cb -}; - -/**@brief HRS Information. */ -static const prf_server_info_t hrs_prf_info = { - .max_connection_nb = HRS_CONNECTION_MAX, - .manager_cbs = &hrs_mgr_cbs, - .gatts_prf_cbs = &hrs_gatts_cbs + [HRS_IDX_HR_CTNL_PT_VAL] = {BLE_ATT_CHAR_HEART_RATE_CNTL_POINT,BLE_GATTS_WRITE_REQ_PERM_UNSEC,0, sizeof(uint8_t)}, }; /* * LOCAL FUNCTION DEFINITIONS ******************************************************************************* */ -/** - ***************************************************************************************** - * @brief Initialize heart rate service, and create DB in ATT. - * - * @return status code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t hrs_init(void) -{ - const uint8_t hrs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HEART_RATE); - gatts_create_db_t gatts_db; - sdk_err_t ret; - uint16_t start_hdl = PRF_INVALID_HANDLE; /* The start hanlde is an in/out - * parameter of ble_gatts_srvc_db_create() - * It must be set with PRF_INVALID_HANDLE - * to be allocated automatically by BLE Stack. */ - - ret = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = hrs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_hrs_env.hrs_init.char_mask; - gatts_db.max_nb_attr = HRS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = hrs_attr_tab; - - sdk_err_t status = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == status) { - s_hrs_env.start_hdl = *gatts_db.shdl; - } - - return status; -} /** ***************************************************************************************** @@ -215,20 +157,21 @@ static sdk_err_t hrs_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void hrs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void hrs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_hrs_env.start_hdl, - HRS_IDX_NB, - (uint8_t *)&s_hrs_env.hrs_init.char_mask); + HRS_IDX_NB, + (uint8_t *)&s_hrs_env.hrs_init.char_mask); - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; hrs_evt_t evt; cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case HRS_IDX_HR_MEAS_VAL: cfm.length = HRS_MEAS_MAX_LEN; cfm.value = s_hrs_env.hr_meas.hr_meas_value; @@ -240,7 +183,8 @@ static void hrs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param break; case HRS_IDX_BODY_SENSOR_LOC_VAL: - if (s_hrs_env.hrs_init.evt_handler) { + if (s_hrs_env.hrs_init.evt_handler) + { evt.conn_idx = conn_idx; evt.evt_type = HRS_EVT_READ_BODY_SEN_LOCATION; s_hrs_env.hrs_init.evt_handler(&evt); @@ -266,29 +210,31 @@ static void hrs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void hrs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void hrs_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_hrs_env.start_hdl, - HRS_IDX_NB, - (uint8_t *)&s_hrs_env.hrs_init.char_mask); + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_hrs_env.start_hdl, + HRS_IDX_NB, + (uint8_t *)&s_hrs_env.hrs_init.char_mask); uint16_t cccd_value; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; hrs_evt_t evt; - + cfm.handle = handle; - switch (tab_index) { + switch (tab_index) + { case HRS_IDX_HR_MEAS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); s_hrs_env.ntf_cfg[conn_idx] = cccd_value; - if (s_hrs_env.hrs_init.evt_handler) { + if (s_hrs_env.hrs_init.evt_handler) + { evt.conn_idx = conn_idx; evt.evt_type = ((cccd_value == PRF_CLI_START_NTF) ? - HRS_EVT_NOTIFICATION_ENABLED : - HRS_EVT_NOTIFICATION_DISABLED); + HRS_EVT_NOTIFICATION_ENABLED : + HRS_EVT_NOTIFICATION_DISABLED); s_hrs_env.hrs_init.evt_handler(&evt); } @@ -296,15 +242,19 @@ static void hrs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par break; case HRS_IDX_HR_CTNL_PT_VAL: - if (p_param->value[0] == HRS_CTRL_POINT_ENERGY_EXP) { - if (s_hrs_env.hrs_init.evt_handler) { + if (p_param->value[0] == HRS_CTRL_POINT_ENERGY_EXP) + { + if (s_hrs_env.hrs_init.evt_handler) + { evt.conn_idx = conn_idx; evt.evt_type = HRS_EVT_RESET_ENERGY_EXPENDED; s_hrs_env.hrs_init.evt_handler(&evt); } cfm.status = BLE_SUCCESS; - } else { + } + else + { cfm.status = 0x80; } break; @@ -326,28 +276,31 @@ static void hrs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void hrs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void hrs_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { hrs_evt_t evt; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_hrs_env.start_hdl, - HRS_IDX_NB, - (uint8_t *)&s_hrs_env.hrs_init.char_mask); + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_hrs_env.start_hdl, + HRS_IDX_NB, + (uint8_t *)&s_hrs_env.hrs_init.char_mask); - switch (tab_index) { + switch (tab_index) + { case HRS_IDX_HR_MEAS_NTF_CFG: s_hrs_env.ntf_cfg[conn_idx] = cccd_value; - if (s_hrs_env.hrs_init.evt_handler) { + if (s_hrs_env.hrs_init.evt_handler) + { evt.conn_idx = conn_idx; evt.evt_type = ((cccd_value == PRF_CLI_START_NTF) ? - HRS_EVT_NOTIFICATION_ENABLED : - HRS_EVT_NOTIFICATION_DISABLED); + HRS_EVT_NOTIFICATION_ENABLED : + HRS_EVT_NOTIFICATION_DISABLED); s_hrs_env.hrs_init.evt_handler(&evt); } break; @@ -375,40 +328,50 @@ static uint8_t hrs_hrm_encode(uint16_t heart_rate, uint8_t *p_encoded_buffer, bo uint8_t temp = 0; uint8_t flags = 0; struct hr_meas_char_val_t *p_meas_char; - + // Set sensor contact related flags - if (s_hrs_env.hrs_init.is_sensor_contact_supported) { + if (s_hrs_env.hrs_init.is_sensor_contact_supported) + { flags |= HRS_BIT_SENSOR_CONTACT_SUPPORTED; } - if (s_hrs_env.hr_meas.is_sensor_contact_detected) { + if (s_hrs_env.hr_meas.is_sensor_contact_detected) + { flags |= HRS_BIT_SENSOR_CONTACT_DETECTED; } p_meas_char = &s_hrs_env.hr_meas; // Encode heart rate measurement - if (heart_rate > 0xff) { + if (heart_rate > 0xff) + { flags |= HRS_BIT_RATE_FORMAT; p_encoded_buffer[len++] = LO_U16(heart_rate); p_encoded_buffer[len++] = HI_U16(heart_rate); - } else { + } + else + { flags &= ~HRS_BIT_RATE_FORMAT; p_encoded_buffer[len++] = (uint8_t)heart_rate; } // Encode heart rate energy - if ((s_hrs_env.hrs_init.char_mask & HRS_CHAR_ENGY_EXP_SUP) && is_energy_updated) { + if ((s_hrs_env.hrs_init.char_mask & HRS_CHAR_ENGY_EXP_SUP) && is_energy_updated) + { flags |= HRS_BIT_ENERGY_EXPENDED_STATUS; p_encoded_buffer[len++] = LO_U16(p_meas_char->energy_expended); p_encoded_buffer[len++] = HI_U16(p_meas_char->energy_expended); } // Encode rr_interval values - if (p_meas_char->rr_interval_count == 0) { + if (p_meas_char->rr_interval_count == 0) + { flags &= ~(HRS_BIT_INTERVAL); - } else { + } + else + { flags |= HRS_BIT_INTERVAL; - temp = ((HRS_MEAS_MAX_LEN - len) / DIV_2); - for (uint8_t i = 0; i < temp; i++) { + temp = ((HRS_MEAS_MAX_LEN - len) / 2); + for (uint8_t i = 0; i < temp; i++) + { p_encoded_buffer[len++] = LO_U16(p_meas_char->rr_interval[i]); p_encoded_buffer[len++] = HI_U16(p_meas_char->rr_interval[i]); } @@ -430,13 +393,15 @@ void hrs_rr_interval_add(uint16_t rr_interval) p_meas_char->rr_interval_count = 0; - for (uint8_t i = HRS_MAX_BUFFERED_RR_INTERVALS - 1; i > 0; i--) { + for (uint8_t i = HRS_MAX_BUFFERED_RR_INTERVALS - 1; i > 0; i--) + { p_meas_char->rr_interval[i] = p_meas_char->rr_interval[i - 1]; } p_meas_char->rr_interval[0] = rr_interval; p_meas_char->rr_interval_count++; - if (p_meas_char->rr_interval_count > HRS_MAX_BUFFERED_RR_INTERVALS) { + if (p_meas_char->rr_interval_count > HRS_MAX_BUFFERED_RR_INTERVALS) + { p_meas_char->rr_interval_count = HRS_MAX_BUFFERED_RR_INTERVALS; } } @@ -469,10 +434,11 @@ sdk_err_t hrs_heart_rate_measurement_send(uint8_t conn_idx, uint16_t heart_rate, { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; struct hr_meas_char_val_t *p_meas_char = &s_hrs_env.hr_meas; - uint8_t len = hrs_hrm_encode(heart_rate, p_meas_char->hr_meas_value, is_energy_updated); + uint8_t len = hrs_hrm_encode(heart_rate, p_meas_char->hr_meas_value,is_energy_updated); - if (s_hrs_env.ntf_cfg[conn_idx] == PRF_CLI_START_NTF) { - gatts_noti_ind_t hr_noti; + if (s_hrs_env.ntf_cfg[conn_idx] == PRF_CLI_START_NTF) + { + ble_gatts_noti_ind_t hr_noti; hr_noti.type = BLE_GATT_NOTIFICATION; hr_noti.handle = prf_find_handle_by_idx(HRS_IDX_HR_MEAS_VAL, @@ -487,18 +453,56 @@ sdk_err_t hrs_heart_rate_measurement_send(uint8_t conn_idx, uint16_t heart_rate, return error_code; } +static void hrs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + hrs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + hrs_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + hrs_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + default: + break; + } +} + sdk_err_t hrs_service_init(hrs_init_t *p_hrs_init) { - sdk_err_t ret; - if (p_hrs_init == NULL) { + if (NULL == p_hrs_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_hrs_env.hrs_init, sizeof(hrs_init_t), p_hrs_init, sizeof(hrs_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_hrs_env.hrs_init, p_hrs_init, sizeof(hrs_init_t)); - return ble_server_prf_add(&hrs_prf_info); + memset(&s_hrs_env.hrs_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_hrs_env.start_hdl = PRF_INVALID_HANDLE; + s_hrs_env.hrs_serv_db.shdl = &s_hrs_env.start_hdl; + s_hrs_env.hrs_serv_db.uuid = s_hrs_svc_uuid; + s_hrs_env.hrs_serv_db.attr_tab_cfg = (uint8_t *)&s_hrs_env.hrs_init.char_mask; + s_hrs_env.hrs_serv_db.max_nb_attr = HRS_IDX_NB; + s_hrs_env.hrs_serv_db.srvc_perm = 0; + s_hrs_env.hrs_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_hrs_env.hrs_serv_db.attr_tab.attr_tab_16 = hrs_attr_tab; + + return ble_gatts_prf_add(&s_hrs_env.hrs_serv_db, hrs_ble_evt_handler); } +uint16_t hrs_service_start_handle_get(void) +{ + return s_hrs_env.start_hdl; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.h index e600bca..b8ec04a 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs/hrs.h @@ -55,9 +55,8 @@ * However the value of Heart Rate Measurement characteristic is stored in user space. * * If a device supports Body Sensor Location, \ref hrs_init_t.char_mask should be - * set with the mask \ref HRS_CHAR_BODY_SENSOR_LOC_SUP to expose the Body Sensor Location characteristic. - * If Energy Expended Field is included in the Heart Rate Measurement characteristic, \ref hrs_init_t. - * char_mask must be set with \ref HRS_CHAR_ENGY_EXP_SUP. + * set with the mask \ref HRS_CHAR_BODY_SENSOR_LOC_SUP to expose the Body Sensor Location characteristic. If Energy Expended Field is included + * in the Heart Rate Measurement characteristic, \ref hrs_init_t.char_mask must be set with \ref HRS_CHAR_ENGY_EXP_SUP. * * If an event handler is provided by the application, the Heart Rate Service will pass * Heart Rate Service events to the application. @@ -69,20 +68,19 @@ #ifndef __HRS_H__ #define __HRS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup HRS_MACRO Defines * @{ */ -#define HRS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Heart Rate Service connections. */ -#define HRS_MEAS_MAX_LEN 20 /**< Maximum length of heart rate measurement characteristic. */ -#define HRS_MAX_BUFFERED_RR_INTERVALS 9 /**< Size of RR Interval buffer inside service. */ +#define HRS_CONNECTION_MAX 10 /**< Maximum number of Heart Rate Service connections. */ +#define HRS_MEAS_MAX_LEN 20 /**< Maximum length of heart rate measurement characteristic. */ +#define HRS_MAX_BUFFERED_RR_INTERVALS 9 /**< Size of RR Interval buffer inside service. */ /** * @defgroup HRS_CHAR_MASK Characteristics Mask @@ -101,7 +99,8 @@ * @{ */ /**@brief Values for sensor location. */ -typedef enum { +typedef enum +{ HRS_SENS_LOC_OTHER, /**< The sensor location is other. */ HRS_SENS_LOC_CHEST, /**< The sensor location is the chest. */ HRS_SENS_LOC_WRIST, /**< The sensor location is the wrist. */ @@ -112,7 +111,8 @@ typedef enum { } hrs_sensor_loc_t; /**@brief Heart Rate Service event types. */ -typedef enum { +typedef enum +{ HRS_EVT_NOTIFICATION_ENABLED, /**< Heart Rate value notification has been enabled. */ HRS_EVT_NOTIFICATION_DISABLED, /**< Heart Rate value notification has been disabled. */ HRS_EVT_RESET_ENERGY_EXPENDED, /**< The peer device requests to reset Energy Expended. */ @@ -125,7 +125,8 @@ typedef enum { * @{ */ /**@brief Heart Rate Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< Index of connection. */ hrs_evt_type_t evt_type; /**< Heart Rate Service event type. */ } hrs_evt_t; @@ -144,12 +145,12 @@ typedef void (*hrs_evt_handler_t)(hrs_evt_t *p_evt); * @{ */ /**@brief Heart Rate Service Init variable. */ -typedef struct { - hrs_evt_handler_t evt_handler; /**< Heart Rate Service event handler. */ - bool is_sensor_contact_supported; /**< Determine if sensor contact detection is to be supported. */ - uint8_t char_mask; /**< Mask of Supported characteristics, and configured with \ref HRS_CHAR_MASK */ - hrs_sensor_loc_t - sensor_loc; /**< The value of Body Sensor Location characteristic is static while in a connection. */ +typedef struct +{ + hrs_evt_handler_t evt_handler; /**< Heart Rate Service event handler. */ + bool is_sensor_contact_supported; /**< Determine if sensor contact detection is to be supported. */ + uint8_t char_mask; /**< Mask of Supported characteristics, and configured with \ref HRS_CHAR_MASK */ + hrs_sensor_loc_t sensor_loc; /**< The value of Body Sensor Location characteristic is static while in a connection. */ } hrs_init_t; /** @} */ @@ -234,6 +235,16 @@ void hrs_rr_interval_add(uint16_t rr_interval); ***************************************************************************************** */ sdk_err_t hrs_service_init(hrs_init_t *p_hrs_init); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the hrs service start handle . + * + * @return The hrs service start handle. + ***************************************************************************************** + */ +uint16_t hrs_service_start_handle_get(void); + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/BUILD.gn new file mode 100644 index 0000000..4e4657a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hrs_c") { + sources = [ "hrs_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.c index 3d0b9a0..59eaf68 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.c @@ -39,63 +39,32 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "hrs_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "hrs_c.h" -#define OFFSET_8 8 -#define ATTR_VALUE_LEN 2 +#include + /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Heart Rate Service environment variable. */ -struct hrs_c_env_t { +struct hrs_c_env_t +{ hrs_c_handles_t handles; /**< Handles of HRS characteristics which will be got for peer. */ hrs_c_evt_handler_t evt_handler; /**< Handler of HRS Client event */ - uint8_t prf_id; /**< HRS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void hrs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void hrs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void hrs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void hrs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct hrs_c_env_t s_hrs_c_env; /**< Heart Rate Service Client environment variable. */ - -/**@brief Heart Rate Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t hrs_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Heart Rate Service GATT Client Callbacks. */ -static gattc_prf_cbs_t hrs_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - hrs_c_att_read_cb, - hrs_c_att_write_cb, - hrs_c_att_ntf_ind_cb, - hrs_c_srvc_browse_cb, - NULL, -}; - -/**@brief Heart Rate Service Client Information. */ -static const prf_client_info_t hrs_c_prf_info = { - .max_connection_nb = HRS_C_CONNECTION_MAX, - .manager_cbs = &hrs_c_mgr_cbs, - .gattc_prf_cbs = &hrs_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_HEART_RATE), HI_U16(BLE_ATT_SVC_HEART_RATE)}; +static ble_uuid_t s_hrs_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -111,7 +80,8 @@ static const prf_client_info_t hrs_c_prf_info = { */ static void hrs_c_evt_handler_excute(hrs_c_evt_t *p_evt) { - if (s_hrs_c_env.evt_handler != NULL && HRS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_hrs_c_env.evt_handler && HRS_C_EVT_INVALID != p_evt->evt_type) + { s_hrs_c_env.evt_handler(p_evt); } } @@ -129,39 +99,45 @@ static void hrs_c_meas_value_encode(uint8_t *p_data, uint16_t length, hrs_c_hr_m { uint8_t flags = 0; uint8_t index = 0; - uint8_t ret; flags = p_data[index++]; - ret = memset_s(p_hr_meas_buff, sizeof(hrs_c_hr_meas_t), 0, sizeof(hrs_c_hr_meas_t)); - if (ret < 0) { - return ret; - } + memset(p_hr_meas_buff, 0, sizeof(hrs_c_hr_meas_t)); - if (flags & HRS_C_BIT_RATE_FORMAT) { - p_hr_meas_buff->hr_value = p_data[index] | (p_data[index + 1] << OFFSET_8); + if (flags & HRS_C_BIT_RATE_FORMAT) + { + p_hr_meas_buff->hr_value = p_data[index] | (p_data[index + 1] << 8); index += sizeof(uint16_t); - } else { + } + else + { p_hr_meas_buff->hr_value = p_data[index++]; } - if (flags & HRS_C_BIT_SENSOR_CONTACT_SUPPORTED) { - if (flags & HRS_C_BIT_SENSOR_CONTACT_DETECTED) { + if (flags & HRS_C_BIT_SENSOR_CONTACT_SUPPORTED) + { + if (flags & HRS_C_BIT_SENSOR_CONTACT_DETECTED) + { p_hr_meas_buff->is_sensor_contact_detected = true; - } else { + } + else + { p_hr_meas_buff->is_sensor_contact_detected = false; } } - if (flags & HRS_C_BIT_ENERGY_EXPENDED_STATUS) { - p_hr_meas_buff->energy_expended = p_data[index] | (p_data[index + 1] << OFFSET_8); + if (flags & HRS_C_BIT_ENERGY_EXPENDED_STATUS) + { + p_hr_meas_buff->energy_expended = p_data[index] | (p_data[index + 1] << 8); index += sizeof(uint16_t); } - if (flags & HRS_C_BIT_INTERVAL) { - for (uint8_t i = 0; index < length; i++) { + if (flags & HRS_C_BIT_INTERVAL) + { + for (uint8_t i = 0; index < length; i++) + { p_hr_meas_buff->rr_intervals_num++; - p_hr_meas_buff->rr_intervals[i] = (p_data[index] | (p_data[index + 1] << OFFSET_8)) * 1000 / 1024.0; + p_hr_meas_buff->rr_intervals[i] = (p_data[index] | (p_data[index + 1] << 8)) * 1000 / 1024.0; index += sizeof(uint16_t); } } @@ -169,27 +145,29 @@ static void hrs_c_meas_value_encode(uint8_t *p_data, uint16_t length, hrs_c_hr_m /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void hrs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void hrs_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { hrs_c_evt_t hrs_c_evt; hrs_c_evt.conn_idx = conn_idx; hrs_c_evt.evt_type = HRS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_hrs_c_env.handles.hrs_sensor_loc_handle) { + if (p_read_rsp->value[0].handle == s_hrs_c_env.handles.hrs_sensor_loc_handle) + { hrs_c_evt.evt_type = HRS_C_EVT_SENSOR_LOC_READ_RSP; - hrs_c_evt.value.sensor_loc = (hrs_c_sensor_loc_t)p_read_rsp->vals[0].p_value[0]; + hrs_c_evt.value.sensor_loc = (hrs_c_sensor_loc_t)p_read_rsp->value[0].p_value[0]; } hrs_c_evt_handler_excute(&hrs_c_evt); @@ -197,28 +175,31 @@ static void hrs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void hrs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void hrs_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { hrs_c_evt_t hrs_c_evt; hrs_c_evt.conn_idx = conn_idx; hrs_c_evt.evt_type = HRS_C_EVT_INVALID; - if (handle == s_hrs_c_env.handles.hrs_hr_meas_cccd_handle) { + if (handle == s_hrs_c_env.handles.hrs_hr_meas_cccd_handle) + { hrs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - HRS_C_EVT_HR_MEAS_NTF_SET_SUCCESS : - HRS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_hrs_c_env.handles.hrs_ctrl_point_handle) { + HRS_C_EVT_HR_MEAS_NTF_SET_SUCCESS : + HRS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_hrs_c_env.handles.hrs_ctrl_point_handle) + { hrs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - HRS_C_EVT_CTRL_POINT_SET : - HRS_C_EVT_WRITE_OP_ERR; + HRS_C_EVT_CTRL_POINT_SET : + HRS_C_EVT_WRITE_OP_ERR; } hrs_c_evt_handler_excute(&hrs_c_evt); @@ -226,21 +207,22 @@ static void hrs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle /** ***************************************************************************************** - * @brief This callback function will be called when receiving notification or indication. + * @brief This event handler function will be called when receiving notification or indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void hrs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void hrs_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { hrs_c_evt_t hrs_c_evt; hrs_c_evt.conn_idx = conn_idx; hrs_c_evt.evt_type = HRS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_hrs_c_env.handles.hrs_hr_meas_handle) { + if (p_ntf_ind->handle == s_hrs_c_env.handles.hrs_hr_meas_handle) + { hrs_c_evt.evt_type = HRS_C_EVT_HR_MEAS_VAL_RECEIVE; hrs_c_meas_value_encode(p_ntf_ind->p_value, p_ntf_ind->length, &hrs_c_evt.value.hr_meas_buff); } @@ -250,14 +232,14 @@ static void hrs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ /** ***************************************************************************************** - * @brief This callback function will be called when receiving browse service indication. + * @brief This event handler function will be called when receiving browse service indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void hrs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void hrs_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { hrs_c_evt_t hrs_c_evt; uint16_t uuid_disc; @@ -266,46 +248,86 @@ static void hrs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat hrs_c_evt.conn_idx = conn_idx; hrs_c_evt.evt_type = HRS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_HEART_RATE == uuid_disc) { - s_hrs_c_env.handles.hrs_srvc_start_handle = p_browse_srvc->start_hdl; - s_hrs_c_env.handles.hrs_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_HEART_RATE == uuid_disc) + { + s_hrs_c_env.handles.hrs_srvc_start_handle = p_browse_srvc->start_hdl; + s_hrs_c_env.handles.hrs_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_HEART_RATE_MEAS == uuid_disc) { - s_hrs_c_env.handles.hrs_hr_meas_handle = handle_disc; - } else if (BLE_ATT_CHAR_BODY_SENSOR_LOCATION == uuid_disc) { - s_hrs_c_env.handles.hrs_sensor_loc_handle = handle_disc; - } else if (BLE_ATT_CHAR_HEART_RATE_CNTL_POINT == uuid_disc) { - s_hrs_c_env.handles.hrs_ctrl_point_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_HEART_RATE_MEAS == uuid_disc) + { + s_hrs_c_env.handles.hrs_hr_meas_handle = handle_disc; + } + else if (BLE_ATT_CHAR_BODY_SENSOR_LOCATION == uuid_disc) + { + s_hrs_c_env.handles.hrs_sensor_loc_handle = handle_disc; + } + else if (BLE_ATT_CHAR_HEART_RATE_CNTL_POINT == uuid_disc) + { + s_hrs_c_env.handles.hrs_ctrl_point_handle = handle_disc; + } } - } else if (BLE_GATTC_BROWSE_ATTR_DESC == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_DESC_CLIENT_CHAR_CFG == uuid_disc) { - s_hrs_c_env.handles.hrs_hr_meas_cccd_handle = handle_disc; + else if (BLE_GATTC_BROWSE_ATTR_DESC == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_DESC_CLIENT_CHAR_CFG == uuid_disc) + { + s_hrs_c_env.handles.hrs_hr_meas_cccd_handle = handle_disc; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; } - } - hrs_c_evt.evt_type = HRS_C_EVT_DISCOVERY_COMPLETE; + hrs_c_evt.evt_type = HRS_C_EVT_DISCOVERY_COMPLETE; + } } hrs_c_evt_handler_excute(&hrs_c_evt); } +static void hrs_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + hrs_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + hrs_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + hrs_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + hrs_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} /* * GLOBAL FUNCTION DEFINITIONS @@ -313,74 +335,52 @@ static void hrs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat */ sdk_err_t hrs_client_init(hrs_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_hrs_c_env, sizeof(s_hrs_c_env), 0, sizeof(s_hrs_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_hrs_c_env, 0, sizeof(s_hrs_c_env)); s_hrs_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&hrs_c_prf_info, &s_hrs_c_env.prf_id); + return ble_gattc_prf_add(&s_hrs_service_uuid, hrs_c_ble_evt_handler); } sdk_err_t hrs_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - - target_uuid[0] = LO_U16(BLE_ATT_SVC_HEART_RATE); - target_uuid[1] = HI_U16(BLE_ATT_SVC_HEART_RATE); - - const ble_uuid_t hrs_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_hrs_c_env.prf_id, conn_idx, &hrs_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_hrs_service_uuid); } sdk_err_t hrs_c_heart_rate_meas_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_hr_meas_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_hr_meas_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_hrs_c_env.handles.hrs_hr_meas_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_hrs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_hrs_c_env.handles.hrs_hr_meas_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t hrs_c_sensor_loc_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_sensor_loc_handle) { + if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_sensor_loc_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_hrs_c_env.prf_id, conn_idx, s_hrs_c_env.handles.hrs_sensor_loc_handle, 0); + return ble_gattc_read(conn_idx, s_hrs_c_env.handles.hrs_sensor_loc_handle, 0); } sdk_err_t hrs_c_ctrl_point_set(uint8_t conn_idx, uint16_t ctrl_value) { - gattc_write_attr_value_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_ctrl_point_handle) { + if (BLE_ATT_INVALID_HDL == s_hrs_c_env.handles.hrs_ctrl_point_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_hrs_c_env.handles.hrs_ctrl_point_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ctrl_value; - - return ble_gattc_prf_write(s_hrs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_hrs_c_env.handles.hrs_ctrl_point_handle, 0, 2, (uint8_t *)&ctrl_value); } + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.h index 74bdaf3..6c4434c 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hrs_c/hrs_c.h @@ -58,21 +58,19 @@ #ifndef __HRS_C_H__ #define __HRS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" - +#include +#include /** * @defgroup HRS_C_MACRO Defines * @{ */ -#define HRS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */ -#define HRS_C_RR_INTERVALS_NUM_MAX 9 /**< Maximum number of RR intervals in HRS notifications. */ -#define HRS_C_CTRL_POINT_ENERGY_EXP 0x01 /**< Value for control point characteristic. */ +#define HRS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ +#define HRS_C_RR_INTERVALS_NUM_MAX 9 /**< Maximum number of RR intervals in HRS notifications. */ +#define HRS_C_CTRL_POINT_ENERGY_EXP 0x01 /**< Value for control point characteristic. */ /** @} */ /** @@ -80,20 +78,22 @@ * @{ */ /**@brief Heart Rate Service Client event type. */ -typedef enum { +typedef enum +{ HRS_C_EVT_INVALID, /**< HRS Client invalid event. */ HRS_C_EVT_DISCOVERY_COMPLETE, /**< HRS Client has found HRS service and its characteristics. */ - HRS_C_EVT_DISCOVERY_FAIL, /**< HRS Client found HRS service failed because of invalid operation or \ - no found at the peer. */ - HRS_C_EVT_HR_MEAS_NTF_SET_SUCCESS, /**< HRS Client has set Notification of Heart Rate Measure characteristic. */ - HRS_C_EVT_HR_MEAS_VAL_RECEIVE, /**< HRS Client has received Heart Rate Measure value notification from peer. */ - HRS_C_EVT_SENSOR_LOC_READ_RSP, /**< HRS Client has received Sensor Location Value read response. */ - HRS_C_EVT_CTRL_POINT_SET, /**< HRS Client has set Control Point completely. */ - HRS_C_EVT_WRITE_OP_ERR, /**< Error occured when HRS Client writen to peer. */ + HRS_C_EVT_DISCOVERY_FAIL, /**< HRS Client found HRS service failed because of invalid operation or no found at the peer. */ + HRS_C_EVT_HR_MEAS_NTF_SET_SUCCESS, /**< HRS Client has set Notification of Heart Rate Measure characteristic. */ + HRS_C_EVT_HR_MEAS_VAL_RECEIVE, /**< HRS Client has received Heart Rate Measure value notification from peer. */ + HRS_C_EVT_SENSOR_LOC_READ_RSP, /**< HRS Client has received Sensor Location Value read response. */ + HRS_C_EVT_CTRL_POINT_SET, /**< HRS Client has set Control Point completely. */ + HRS_C_EVT_WRITE_OP_ERR, /**< Error occured when HRS Client writen to peer. */ } hrs_c_evt_type_t; /**@brief Heart Rate Service Measurement flag bit. */ -typedef enum { +typedef enum +{ + HRS_C_BIT_RATE_FORMAT = 0x01, /**< Heart Rate Value Format bit. */ HRS_C_BIT_SENSOR_CONTACT_DETECTED = 0x02, /**< Sensor Contact Detected bit. */ HRS_C_BIT_SENSOR_CONTACT_SUPPORTED = 0x04, /**< Sensor Contact Supported bit. */ @@ -102,7 +102,8 @@ typedef enum { } hrs_c_flag_bit_t; /**@brief Values for sensor location. */ -typedef enum { +typedef enum +{ HRS_C_SENS_LOC_OTHER, /**< The sensor location is other. */ HRS_C_SENS_LOC_CHEST, /**< The sensor location is the chest. */ HRS_C_SENS_LOC_WRIST, /**< The sensor location is the wrist. */ @@ -118,34 +119,33 @@ typedef enum { * @{ */ /**@brief Heart Rate Measurement characteristic value structure. */ -typedef struct { +typedef struct +{ bool is_sensor_contact_detected; /**< True if sensor contact has been detected. */ uint16_t hr_value; /**< Heart Rate Value. */ uint8_t rr_intervals_num; /**< Number of RR intervals. */ float rr_intervals[HRS_C_RR_INTERVALS_NUM_MAX]; /**< RR intervals. */ - uint16_t energy_expended; /**< The accumulated energy expended in kilo Joules \ - since the last time it was reset. */ + uint16_t energy_expended; /**< The accumulated energy expended in kilo Joules since the last time it was reset. */ } hrs_c_hr_meas_t; /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t hrs_srvc_start_handle; /**< HRS Service start handle. */ uint16_t hrs_srvc_end_handle; /**< HRS Service end handle. */ - uint16_t hrs_hr_meas_handle; /**< HRS Heart Rate Measurement characteristic Value handle \ - which has been got from peer. */ - uint16_t hrs_hr_meas_cccd_handle; /**< HRS CCCD handle of Heart Rate Measurement characteristic \ - which has been got from peer. */ - uint16_t hrs_sensor_loc_handle; /**< HRS Sensor Location characteristic Value handle \ - which has been got from peer. */ - uint16_t hrs_ctrl_point_handle; /**< HRS Control Point characteristic Value handle \ - which has been got from peer. */ + uint16_t hrs_hr_meas_handle; /**< HRS Heart Rate Measurement characteristic Value handle which has been got from peer. */ + uint16_t hrs_hr_meas_cccd_handle; /**< HRS CCCD handle of Heart Rate Measurement characteristic which has been got from peer. */ + uint16_t hrs_sensor_loc_handle; /**< HRS Sensor Location characteristic Value handle which has been got from peer. */ + uint16_t hrs_ctrl_point_handle; /**< HRS Control Point characteristic Value handle which has been got from peer. */ } hrs_c_handles_t; /**@brief Heart Rate Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ hrs_c_evt_type_t evt_type; /**< HRS Client event type. */ - union { + union + { hrs_c_hr_meas_t hr_meas_buff; /**< Buffer of heart rate measurement value. */ hrs_c_sensor_loc_t sensor_loc; /**< Sensor location. */ } value; /**< Decoded result of value received. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/BUILD.gn new file mode 100644 index 0000000..672cf67 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("hts") { + sources = [ "hts.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.c index 3aa3f5c..e90b790 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.c @@ -42,18 +42,14 @@ #include "hts.h" #include "ble_prf_types.h" #include "utility.h" -#define EXPONEBT_2 (-2) -#define MANTISSA_32 32 -#define MANTISSA_32_SCALE 100 -#define OFFSET_24 24 -#define SCALE_9 9 -#define DESCALE_5 5 + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief Health Thermometer Service Attributes Indexes. */ -enum { +enum +{ HTS_IDX_SVC, HTS_IDX_TEM_MEAS_CHAR, @@ -80,133 +76,88 @@ enum { ***************************************************************************************** */ /**@brief Health Thermometer Service environment variable. */ -struct hts_env_t { - hts_init_t hts_init; /**< Health Thermometer Service initialization variables. */ - uint16_t start_hdl; /**< Health Thermometer Service start handle. */ - uint16_t - meas_ind_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Temperature Measurement Indication \ - which is configured by the peer devices. */ - uint16_t - intm_tem_ntf_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Intermediate Temperature Notification \ - which is configured by the peer devices. */ - uint16_t - meas_interval_ind_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Measurement Interval Indication \ - which is configured by the peer devices. */ +struct hts_env_t +{ + hts_init_t hts_init; /**< Health Thermometer Service initialization variables. */ + uint16_t start_hdl; /**< Health Thermometer Service start handle. */ + uint16_t meas_ind_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Temperature Measurement Indication which is configured by the peer devices. */ + uint16_t intm_tem_ntf_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Intermediate Temperature Notification which is configured by the peer devices. */ + uint16_t meas_interval_ind_cfg[HTS_CONNECTION_MAX]; /**< The configuration of Measurement Interval Indication which is configured by the peer devices. */ + ble_gatts_create_db_t hts_serv_db; /**< Health Thermometer Service DataBase. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t hts_init(void); -static void hts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void hts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void hts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); + /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct hts_env_t s_hts_env; +static const uint8_t s_hts_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HEALTH_THERMOM); /**@brief Full HTS Database Description - Used to add attributes into the database. */ -static const attm_desc_t hts_attr_tab[HTS_IDX_NB] = { +static const ble_gatts_attm_desc_t hts_attr_tab[HTS_IDX_NB] = +{ // Health Thermometer Service Declaration - [HTS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [HTS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Temperature Measurement Characteristic - Declaration - [HTS_IDX_TEM_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HTS_IDX_TEM_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Temperature Measurement Characteristic - Value - [HTS_IDX_TEM_MEAS_VAL] = { - BLE_ATT_CHAR_TEMPERATURE_MEAS, - INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - HTS_TEM_MEAS_MAX_LEN - }, + [HTS_IDX_TEM_MEAS_VAL] = {BLE_ATT_CHAR_TEMPERATURE_MEAS, + BLE_GATTS_INDICATE_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + HTS_TEM_MEAS_MAX_LEN}, // Temperature Measurement Characteristic - Client Characteristic Configuration Descriptor - [HTS_IDX_TEM_MEAS_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [HTS_IDX_TEM_MEAS_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // Temperature Type Characteristic - Declaration - [HTS_IDX_TEM_TYPE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HTS_IDX_TEM_TYPE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Temperature Measurement Characteristic - Value - [HTS_IDX_TEM_TYPE_VAL] = { - BLE_ATT_CHAR_TEMPERATURE_TYPE, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - HTS_TEM_TYPE_MAX_LEN - }, + [HTS_IDX_TEM_TYPE_VAL] = {BLE_ATT_CHAR_TEMPERATURE_TYPE, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + HTS_TEM_TYPE_MAX_LEN}, // Intermediate Temperature Characteristic - Declaration - [HTS_IDX_INTM_TEM_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HTS_IDX_INTM_TEM_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Intermediate Temperature Characteristic - Value - [HTS_IDX_INTM_TEM_VAL] = { - BLE_ATT_CHAR_INTERMED_TEMPERATURE, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - HTS_INTM_TEM_MAX_LEN - }, + [HTS_IDX_INTM_TEM_VAL] = {BLE_ATT_CHAR_INTERMED_TEMPERATURE, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + HTS_INTM_TEM_MAX_LEN}, // Intermediate Temperature Characteristic - Client Characteristic Configuration Descriptor - [HTS_IDX_INTM_TEM_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [HTS_IDX_INTM_TEM_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // Measurement Interval Characteristic - Declaration - [HTS_IDX_MEAS_INTERVAL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [HTS_IDX_MEAS_INTERVAL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Measurement Interval Characteristic - Value - [HTS_IDX_MEAS_INTERVAL_VAL] = { - BLE_ATT_CHAR_MEAS_INTERVAL, - READ_PERM_UNSEC | WRITE_REQ_PERM(AUTH) | INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - HTS_MEAS_INTERVAL_MAX_LEN - }, + [HTS_IDX_MEAS_INTERVAL_VAL] = {BLE_ATT_CHAR_MEAS_INTERVAL, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_AUTH) | BLE_GATTS_INDICATE_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + HTS_MEAS_INTERVAL_MAX_LEN}, // Measurement Interval Characteristic - Client Characteristic Configuration Descriptor - [HTS_IDX_MEAS_INTERVAL_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [HTS_IDX_MEAS_INTERVAL_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // Measurement Interval Characteristic - Valid Range Descriptor - [HTS_IDX_MEAS_INTERVAL_VRD_CFG] = { - BLE_ATT_DESC_VALID_RANGE, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - 0 - }, + [HTS_IDX_MEAS_INTERVAL_VRD_CFG] = {BLE_ATT_DESC_VALID_RANGE, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + 0}, }; -/**@brief HTS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t hts_task_cbs = { - (prf_init_func_t) hts_init, - NULL, - NULL - -}; - -/**@brief HTS Task Callbacks. */ -static gatts_prf_cbs_t hts_cb_func = { - hts_read_att_cb, - hts_write_att_cb, - NULL, - NULL, - hts_cccd_set_cb -}; - -/**@brief HTS Information. */ -static const prf_server_info_t hts_prf_info = { - .max_connection_nb = HTS_CONNECTION_MAX, - .manager_cbs = &hts_task_cbs, - .gatts_prf_cbs = &hts_cb_func, -}; - /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -218,34 +169,6 @@ static const prf_server_info_t hts_prf_info = { * @return Error code to know if profile initialization succeed or not. ***************************************************************************************** */ -static sdk_err_t hts_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t hts_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_HEALTH_THERMOM); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = hts_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_hts_env.hts_init.char_mask); - gatts_db.max_nb_attr = HTS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = hts_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_hts_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} /** ***************************************************************************************** @@ -255,30 +178,32 @@ static sdk_err_t hts_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void hts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void hts_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint16_t meas_interval[2]; - uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_hts_env.start_hdl, - HTS_IDX_NB, - (uint8_t *)&s_hts_env.hts_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint16_t meas_interval[2]; + uint8_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_hts_env.start_hdl, + HTS_IDX_NB, + (uint8_t *)&s_hts_env.hts_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case HTS_IDX_TEM_MEAS_IND_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_hts_env.meas_ind_cfg[conn_idx]; break; case HTS_IDX_TEM_TYPE_VAL: - if (s_hts_env.hts_init.evt_handler) { + if (s_hts_env.hts_init.evt_handler) + { hts_evt_t event; hts_read_characteristic_t characteristic = HTS_READ_CHAR_TEMP_TYPE; - + event.evt_type = HTS_EVT_READ_CHARACTERISTIC; event.p_data = (uint8_t *)&characteristic; event.length = sizeof(characteristic); @@ -287,17 +212,18 @@ static void hts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)&s_hts_env.hts_init.temp_type; break; - + case HTS_IDX_INTM_TEM_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_hts_env.intm_tem_ntf_cfg[conn_idx]; break; case HTS_IDX_MEAS_INTERVAL_VAL: - if (s_hts_env.hts_init.evt_handler) { + if (s_hts_env.hts_init.evt_handler) + { hts_evt_t event; hts_read_characteristic_t characteristic = HTS_READ_CHAR_MEAS_INTL; - + event.evt_type = HTS_EVT_READ_CHARACTERISTIC; event.p_data = (uint8_t *)&characteristic; event.length = sizeof(characteristic); @@ -336,13 +262,13 @@ static void hts_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void hts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void hts_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; - uint16_t tab_index = 0; + uint16_t tab_index = 0;; uint16_t cccd_value = 0; hts_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_hts_env.start_hdl, @@ -351,43 +277,47 @@ static void hts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case HTS_IDX_TEM_MEAS_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - HTS_EVT_TEM_MEAS_INDICATION_ENABLE :\ - HTS_EVT_TEM_MEAS_INDICATION_DISABLE); + HTS_EVT_TEM_MEAS_INDICATION_ENABLE :\ + HTS_EVT_TEM_MEAS_INDICATION_DISABLE); event.p_data = (uint8_t *)&s_hts_env.hts_init.meas_interval; event.length = sizeof(uint16_t); s_hts_env.meas_ind_cfg[conn_idx] = cccd_value; break; - + case HTS_IDX_INTM_TEM_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE :\ - HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE); + HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE :\ + HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE); s_hts_env.intm_tem_ntf_cfg[conn_idx] = cccd_value; break; - + case HTS_IDX_MEAS_INTERVAL_VAL: if (((le16toh(p_param->value) >= s_hts_env.hts_init.min_meas_interval_sup) && \ (le16toh(p_param->value) <= s_hts_env.hts_init.max_meas_interval_sup)) || \ - (le16toh(p_param->value) == 0)) { - event.evt_type = HTS_EVT_MEAS_INTERVAL_UPDATE; - event.p_data = p_param->value; - event.length = sizeof(uint16_t); - s_hts_env.hts_init.meas_interval = le16toh(p_param->value); - } else { - cfm.status = 0x80; // Out of Range + (0 == le16toh(p_param->value))) + { + event.evt_type = HTS_EVT_MEAS_INTERVAL_UPDATE; + event.p_data = p_param->value; + event.length = sizeof(uint16_t); + s_hts_env.hts_init.meas_interval = le16toh(p_param->value); + } + else + { + cfm.status = 0x80; // Out of Range } break; - + case HTS_IDX_MEAS_INTERVAL_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE :\ - HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE); + HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE :\ + HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE); s_hts_env.meas_interval_ind_cfg[conn_idx] = cccd_value; break; @@ -396,8 +326,8 @@ static void hts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p break; } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && HTS_EVT_INVALID != event.evt_type && - s_hts_env.hts_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && HTS_EVT_INVALID != event.evt_type && s_hts_env.hts_init.evt_handler) + { s_hts_env.hts_init.evt_handler(&event); } @@ -413,12 +343,13 @@ static void hts_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void hts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void hts_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { - uint16_t tab_index = 0; + uint16_t tab_index = 0;; hts_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -427,25 +358,26 @@ static void hts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val HTS_IDX_NB, (uint8_t *)&s_hts_env.hts_init.char_mask); - switch (tab_index) { + switch (tab_index) + { case HTS_IDX_TEM_MEAS_IND_CFG: event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - HTS_EVT_TEM_MEAS_INDICATION_ENABLE :\ - HTS_EVT_TEM_MEAS_INDICATION_DISABLE); + HTS_EVT_TEM_MEAS_INDICATION_ENABLE :\ + HTS_EVT_TEM_MEAS_INDICATION_DISABLE); s_hts_env.meas_ind_cfg[conn_idx] = cccd_value; break; - + case HTS_IDX_INTM_TEM_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE :\ - HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE); + HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE :\ + HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE); s_hts_env.intm_tem_ntf_cfg[conn_idx] = cccd_value; break; - + case HTS_IDX_MEAS_INTERVAL_IND_CFG: event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE :\ - HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE); + HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE :\ + HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE); s_hts_env.meas_interval_ind_cfg[conn_idx] = cccd_value; break; @@ -454,7 +386,8 @@ static void hts_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (HTS_EVT_INVALID != event.evt_type && s_hts_env.hts_init.evt_handler) { + if (HTS_EVT_INVALID != event.evt_type && s_hts_env.hts_init.evt_handler) + { s_hts_env.hts_init.evt_handler(&event); } } @@ -475,24 +408,27 @@ static uint16_t hts_htm_encoded(hts_meas_val_t *p_meas, uint8_t *p_encoded_buffe uint16_t length = 1; uint32_t encoded_sfloat = 0; - if (HTS_TEMPERATURE_CELCIUS == s_hts_env.hts_init.temperature_units) { - p_meas->temp_convert_value.exponent = EXPONEBT_2; + if (HTS_TEMPERATURE_CELCIUS == s_hts_env.hts_init.temperature_units) + { + p_meas->temp_convert_value.exponent = -2; p_meas->temp_convert_value.mantissa = p_meas->temp_original_value; - } else { - p_meas->temp_convert_value.exponent = EXPONEBT_2; - p_meas->temp_convert_value.mantissa = (MANTISSA_32 * MANTISSA_32_SCALE) + - ((p_meas->temp_original_value * SCALE_9) / DESCALE_5); + } + else + { + p_meas->temp_convert_value.exponent = -2; + p_meas->temp_convert_value.mantissa = (32 * 100) + ((p_meas->temp_original_value * 9) / 5); flags |= HTS_MEAS_FLAG_TEM_UINTS_BIT; } - encoded_sfloat = ((p_meas->temp_convert_value.exponent << OFFSET_24) & 0xFF000000) | + encoded_sfloat = ((p_meas->temp_convert_value.exponent << 24) & 0xFF000000) | ((p_meas->temp_convert_value.mantissa << 0) & 0x00FFFFFF); p_encoded_buffer[length++] = LO_UINT32_T(encoded_sfloat); p_encoded_buffer[length++] = L2_UINT32_T(encoded_sfloat); p_encoded_buffer[length++] = L3_UINT32_T(encoded_sfloat); p_encoded_buffer[length++] = HI_UINT32_T(encoded_sfloat); - if (s_hts_env.hts_init.time_stamp_present) { + if (s_hts_env.hts_init.time_stamp_present) + { flags |= HTS_MEAS_FLAG_TIME_STAMP_BIT; p_encoded_buffer[length++] = LO_U16(p_meas->time_stamp.year); p_encoded_buffer[length++] = HI_U16(p_meas->time_stamp.year); @@ -503,7 +439,8 @@ static uint16_t hts_htm_encoded(hts_meas_val_t *p_meas, uint8_t *p_encoded_buffe p_encoded_buffer[length++] = p_meas->time_stamp.sec; } - if ((s_hts_env.hts_init.char_mask & HTS_CHAR_TEM_TYPE_SUP) == 0) { + if (0 == (s_hts_env.hts_init.char_mask & HTS_CHAR_TEM_TYPE_SUP)) + { flags |= HTS_MEAS_FLAG_TEM_TYPE_BIT; p_encoded_buffer[length++] = p_meas->temp_type; } @@ -521,11 +458,13 @@ sdk_err_t hts_measurement_send(uint8_t conn_idx, hts_meas_val_t *p_meas) sdk_err_t error_code = SDK_ERR_NTF_DISABLED; uint8_t encoded_hts_meas[HTS_TEM_MEAS_MAX_LEN]; uint16_t length; - gatts_noti_ind_t hts_ind; + ble_gatts_noti_ind_t hts_ind; length = hts_htm_encoded(p_meas, encoded_hts_meas); - if (HTS_TEMPERATURE_STABLE == p_meas->temp_meas_type) { - if (PRF_CLI_START_IND == (s_hts_env.meas_ind_cfg[conn_idx] & PRF_CLI_START_IND)) { + if( HTS_TEMPERATURE_STABLE == p_meas->temp_meas_type) + { + if (PRF_CLI_START_IND == (s_hts_env.meas_ind_cfg[conn_idx] & PRF_CLI_START_IND)) + { hts_ind.type = BLE_GATT_INDICATION; hts_ind.handle = prf_find_handle_by_idx(HTS_IDX_TEM_MEAS_VAL, s_hts_env.start_hdl, @@ -534,8 +473,11 @@ sdk_err_t hts_measurement_send(uint8_t conn_idx, hts_meas_val_t *p_meas) hts_ind.value = encoded_hts_meas; error_code = ble_gatts_noti_ind(conn_idx, &hts_ind); } - } else { - if (PRF_CLI_START_NTF == (s_hts_env.intm_tem_ntf_cfg[conn_idx] & PRF_CLI_START_NTF)) { + } + else + { + if (PRF_CLI_START_NTF == (s_hts_env.intm_tem_ntf_cfg[conn_idx] & PRF_CLI_START_NTF)) + { hts_ind.type = BLE_GATT_NOTIFICATION; hts_ind.handle = prf_find_handle_by_idx(HTS_IDX_INTM_TEM_VAL, s_hts_env.start_hdl, @@ -551,9 +493,10 @@ sdk_err_t hts_measurement_send(uint8_t conn_idx, hts_meas_val_t *p_meas) sdk_err_t hts_measurement_interval_send(uint8_t conn_idx) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t hts_ind; - - if (PRF_CLI_START_IND == (s_hts_env.meas_interval_ind_cfg[conn_idx] & PRF_CLI_START_IND)) { + ble_gatts_noti_ind_t hts_ind; + + if (PRF_CLI_START_IND == (s_hts_env.meas_interval_ind_cfg[conn_idx] & PRF_CLI_START_IND)) + { hts_ind.type = BLE_GATT_INDICATION; hts_ind.handle = prf_find_handle_by_idx(HTS_IDX_MEAS_INTERVAL_VAL, s_hts_env.start_hdl, @@ -565,18 +508,52 @@ sdk_err_t hts_measurement_interval_send(uint8_t conn_idx) return error_code; } +static void hts_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + hts_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + hts_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + hts_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + default: + break; + } +} + sdk_err_t hts_service_init(hts_init_t *p_hts_init) { - sdk_err_t ret; - if (p_hts_init == NULL) { + if (NULL == p_hts_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_hts_env.hts_init, sizeof(hts_init_t), p_hts_init, sizeof(hts_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_hts_env.hts_init, p_hts_init, sizeof(hts_init_t)); - return ble_server_prf_add(&hts_prf_info); + memset(&s_hts_env.hts_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_hts_env.start_hdl = PRF_INVALID_HANDLE; + s_hts_env.hts_serv_db.shdl = &s_hts_env.start_hdl; + s_hts_env.hts_serv_db.uuid = s_hts_svc_uuid; + s_hts_env.hts_serv_db.attr_tab_cfg = (uint8_t *)&(s_hts_env.hts_init.char_mask); + s_hts_env.hts_serv_db.max_nb_attr = HTS_IDX_NB; + s_hts_env.hts_serv_db.srvc_perm = 0; + s_hts_env.hts_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_hts_env.hts_serv_db.attr_tab.attr_tab_16 = hts_attr_tab; + + return ble_gatts_prf_add(&s_hts_env.hts_serv_db, hts_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.h index 49fe4fe..5d06bb5 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/hts/hts.h @@ -49,47 +49,46 @@ * @details The Health Thermometer Service exposes temperature and other data related to a * thermometer used for healthcare applications. This module implements the Health * Thermometer Service with the Temperature Meaturement, Temperature Type, Intermediate - * Temperature, and Measurement Interval characteristics. + * Temperature, and Measurement Interval characteristics. * * After \ref hts_init_t variable is initialized, the application must call \ref hts_service_init() * to optionally add the Health Thermometer Service, Temperature Meaturement, Temperature Type, * Intermediate Temperature, and Measurement Interval characteristics to the BLE stack database - * according to \ref hts_init_t.char_mask. However the value of Temperature Type is stored within + * according to \ref hts_init_t.char_mask. However the value of Temperature Type is stored within * \ref hts_init_t.temp_type which locates in user space. */ - + #ifndef _HTS_H_ #define _HTS_H_ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup HTS_MACRO Defines * @{ */ -#define HTS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Health Thermometer Service connections. */ -#define HTS_TEM_MEAS_MAX_LEN 20 /**< Maximum length of temperature measurement encode. */ -#define HTS_TEM_TYPE_MAX_LEN 1 /**< Maximum length of temperature type value. */ -#define HTS_INTM_TEM_MAX_LEN 20 /**< Maximun length of intermediate temperature encode. */ -#define HTS_MEAS_INTERVAL_MAX_LEN 2 /**< Maximum length of measurement interval value. */ -#define HTS_MEAS_INTV_DFLT_MIN 2 /**< Minimun interval of temperature measurement (in unit of 1s). */ -#define HTS_MEAS_INTV_DFLT_MAX 10 /**< Maximum interval of temperature measurement (in unit of 1s). */ +#define HTS_CONNECTION_MAX 10 /**< Maximum number of Health Thermometer Service connections. */ +#define HTS_TEM_MEAS_MAX_LEN 20 /**< Maximum length of temperature measurement encode. */ +#define HTS_TEM_TYPE_MAX_LEN 1 /**< Maximum length of temperature type value. */ +#define HTS_INTM_TEM_MAX_LEN 20 /**< Maximun length of intermediate temperature encode. */ +#define HTS_MEAS_INTERVAL_MAX_LEN 2 /**< Maximum length of measurement interval value. */ +#define HTS_MEAS_INTV_DFLT_MIN 2 /**< Minimun interval of temperature measurement (in unit of 1s). */ +#define HTS_MEAS_INTV_DFLT_MAX 10 /**< Maximum interval of temperature measurement (in unit of 1s). */ /** * @defgroup HTS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref hts_init_t.char_mask. */ -#define HTS_CHAR_MANDATORY 0x000f /**< Bit mask for mandatory characteristic in HTS. */ -#define HTS_CHAR_TEM_TYPE_SUP 0x003f /**< Bit mask for temperature type characteristic that is optional. */ -#define HTS_CHAR_INTM_TEM_SUP 0x01c0 /**< Bit mask for intermediate temperature characteristic that is optional. */ -#define HTS_CHAR_MEAS_INTERVAL_SUP 0x1e00 /**< Bit mask for mearsurement interval characteristic that is optional. */ -#define HTS_CHAR_FULL 0x1fff /**< Bit mask of the full characteristic. */ +#define HTS_CHAR_MANDATORY 0x000f /**< Bit mask for mandatory characteristic in HTS. */ +#define HTS_CHAR_TEM_TYPE_SUP 0x003f /**< Bit mask for temperature type characteristic that is optional. */ +#define HTS_CHAR_INTM_TEM_SUP 0x01c0 /**< Bit mask for intermediate temperature characteristic that is optional. */ +#define HTS_CHAR_MEAS_INTERVAL_SUP 0x1e00 /**< Bit mask for mearsurement interval characteristic that is optional. */ +#define HTS_CHAR_FULL 0x1fff /**< Bit mask of the full characteristic. */ /** @} */ /** @} */ @@ -98,39 +97,44 @@ * @{ */ /**@brief Health Thermometer Service event type.*/ -typedef enum { - HTS_EVT_INVALID, /**< Indicate that invalid event. */ - HTS_EVT_TEM_MEAS_INDICATION_ENABLE, /**< Indicate that temperature measurement indication has been enabled. */ - HTS_EVT_TEM_MEAS_INDICATION_DISABLE, /**< Indicate that temperature measurement indication has been disabled. */ - HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE, /**< Indicate that intermediate temperature notification has been enabled. */ - HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE, /**< Indicate that intermediate temperature notification has been disbled. */ - HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE, /**< Indicate that measurement interval indication has been enabled. */ - HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE, /**< Indicate that measurement interval indication has been disabled. */ - HTS_EVT_MEAS_INTERVAL_UPDATE, /**< Indicate that measurement interval has been updated. */ - HTS_EVT_READ_CHARACTERISTIC, /**< The peer reads the characteristic. */ +typedef enum +{ + HTS_EVT_INVALID, /**< Indicate that invalid event. */ + HTS_EVT_TEM_MEAS_INDICATION_ENABLE, /**< Indicate that temperature measurement indication has been enabled. */ + HTS_EVT_TEM_MEAS_INDICATION_DISABLE, /**< Indicate that temperature measurement indication has been disabled. */ + HTS_EVT_INTM_TEM_NOTIFICATION_ENABLE, /**< Indicate that intermediate temperature notification has been enabled. */ + HTS_EVT_INTM_TEM_NOTIFICATION_DISABLE, /**< Indicate that intermediate temperature notification has been disbled. */ + HTS_EVT_MEAS_INTREVAL_INDICATION_ENABLE, /**< Indicate that measurement interval indication has been enabled. */ + HTS_EVT_MEAS_INTERVAL_INDICATION_DISABLE, /**< Indicate that measurement interval indication has been disabled. */ + HTS_EVT_MEAS_INTERVAL_UPDATE, /**< Indicate that measurement interval has been updated. */ + HTS_EVT_READ_CHARACTERISTIC, /**< The peer reads the characteristic. */ } hts_evt_type_t; /**@brief Health Thermometer temperature unit, */ -typedef enum { - HTS_TEMPERATURE_CELCIUS, /**< Indicate that temperature measurement Value Unit is celcius. */ - HTS_TEMPERATURE_FAHRENHEIT, /**< Indicate that temperature measurement Value Unit is fahrenheit. */ +typedef enum +{ + HTS_TEMPERATURE_CELCIUS, /**< Indicate that temperature measurement Value Unit is celcius. */ + HTS_TEMPERATURE_FAHRENHEIT, /**< Indicate that temperature measurement Value Unit is fahrenheit. */ } hts_temp_unit_t; /**@brief Health Thermometer temperature measurement type. */ -typedef enum { - HTS_TEMPERATURE_STABLE, /**< Stable type of temperature. */ - HTS_TEMPERATURE_INTERMEDIATE, /**< Intermediary type of temperature. */ +typedef enum +{ + HTS_TEMPERATURE_STABLE, /**< Stable type of temperature. */ + HTS_TEMPERATURE_INTERMEDIATE, /**< Intermediary type of temperature. */ } hts_temp_meas_type_t; /**@brief Health Thermometer Measurement flag bits. */ -typedef enum { +typedef enum +{ HTS_MEAS_FLAG_TEM_UINTS_BIT = (0x01<<0), /**< Bit for temperature uints. */ HTS_MEAS_FLAG_TIME_STAMP_BIT = (0x01<<1), /**< Bit for time stamp. */ HTS_MEAS_FLAG_TEM_TYPE_BIT = (0x01<<2), /**< Bit for temperature type. */ } hts_flag_bit_t; /**@brief Temperature Type measurement locations. */ -typedef enum { +typedef enum +{ HTS_TEMP_TYPE_ARMPIT = 0x01, /**< Temperature measurement location: armpit. */ HTS_TEMP_TYPE_BODY, /**< Temperature measurement location: body. */ HTS_TEMP_TYPE_EAR, /**< Temperature measurement location: ear. */ @@ -143,7 +147,8 @@ typedef enum { } hts_temp_meas_loc_t; /**@brief The parameters for \ref HTS_EVT_READ_CHARACTERISTIC. */ -typedef enum { +typedef enum +{ HTS_READ_CHAR_TEMP_TYPE, /**< The peer reads the Temperature Type characteristic. */ HTS_READ_CHAR_MEAS_INTL, /**< The peer reads the Measurement Interval characteristic. */ } hts_read_characteristic_t; @@ -154,7 +159,8 @@ typedef enum { * @{ */ /**@brief Health Thermometer Service event. */ -typedef struct { +typedef struct +{ hts_evt_type_t evt_type; /**< The HTS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to the event data. */ @@ -178,13 +184,15 @@ typedef prf_date_time_t hts_date_time_t; * @{ */ /**@brief SFLOAT format (IEEE-11073 32-bit FLOAT, defined as a 32-bit vlue with 24-bit mantissa and 8-bit exponent. */ -typedef struct { - int8_t exponent; /**< Base 10 exponent, only 8 bits */ - int32_t mantissa; /**< Mantissa, only 24 bits */ +typedef struct +{ + int8_t exponent; /**< Base 10 exponent, only 8 bits */ + int32_t mantissa; /**< Mantissa, only 24 bits */ } ieee_float32_t; /**@brief Health Theromometer Measurement Character value structure. */ -typedef struct { +typedef struct +{ hts_temp_meas_type_t temp_meas_type; /**< Stable or intermediary type of temperature. */ uint16_t temp_original_value; /**< Temperature measurement original value. */ ieee_float32_t temp_convert_value; /**< Temperature measurement convert value. */ @@ -192,16 +200,15 @@ typedef struct { hts_temp_meas_loc_t temp_type; /**< Temperature Type measurement location. */ } hts_meas_val_t; -/**@brief Health Thermometer Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Health Thermometer Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ hts_evt_handler_t evt_handler; /**< Health Thermometer Service event handler. */ - uint16_t - char_mask; /**< Initial mask of Supported characteristics, and configured with \ref HTS_CHAR_MASK */ - hts_temp_unit_t temperature_units; /**< Initial if Temperature is in Fahrenheit unit, Celcius otherwise. */ - bool time_stamp_present; /**< Initial if Time Stamp is present. */ - hts_temp_meas_loc_t temp_type; /**< Initial temperature type measurement location. */ - uint16_t meas_interval; /**< Initial temperature measurement interval. */ + uint16_t char_mask; /**< Initial mask of Supported characteristics, and configured with \ref HTS_CHAR_MASK */ + hts_temp_unit_t temperature_units; /**< Initial if Temperature is in Fahrenheit unit, Celcius otherwise. */ + bool time_stamp_present; /**< Initial if Time Stamp is present. */ + hts_temp_meas_loc_t temp_type; /**< Initial temperature type measurement location. */ + uint16_t meas_interval; /**< Initial temperature measurement interval. */ uint16_t min_meas_interval_sup; /**< Initial minimum temperature measurement interval support. */ uint16_t max_meas_interval_sup; /**< Initial maximum temperature measurement interval support. */ } hts_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/BUILD.gn new file mode 100644 index 0000000..7793368 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ias") { + sources = [ "ias.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.c index 8a11b90..b5d4c68 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.c @@ -35,7 +35,7 @@ ***************************************************************************************** */ -/* +/* * INCLUDE FILES ***************************************************************************************** */ @@ -55,7 +55,8 @@ ***************************************************************************************** */ /**@brief IAS Attributes database index list. */ -enum ias_attr_idx_t { +enum ias_attr_idx_t +{ IAS_IDX_SVC, IAS_IDX_ALERT_LVL_CHAR, @@ -65,9 +66,11 @@ enum ias_attr_idx_t { }; /**@brief Immediate Alert Service environment variable. */ -struct ias_env_t { - ias_init_t ias_init; /**< Immediate Alert Service initialization variables. */ - uint16_t start_hdl; /**< Immediate Alert Service start handle. */ +struct ias_env_t +{ + ias_init_t ias_init; /**< Immediate Alert Service initialization variables. */ + uint16_t start_hdl; /**< Immediate Alert Service start handle. */ + ble_gatts_create_db_t ias_serv_db; /**< Immediate Alert Service DataBase. */ }; /* * LOCAL VARIABLE DEFINITIONS @@ -79,46 +82,23 @@ static uint8_t s_char_mask = 0x07; /**< Features added into ATT database. * bit1 - Alert Level Characteristic Declaration * bit2 - Alert Level Characteristic Value */ +static const uint8_t s_ias_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_IMMEDIATE_ALERT); -/**@brief IAS Database Description - Used to add attributes into the database. */ -static const attm_desc_t ias_attr_tab[IAS_IDX_NB] = { +/**@brief IAS Database Description - Used to add attributes into the database. */ +static const ble_gatts_attm_desc_t ias_attr_tab[IAS_IDX_NB] = +{ // Immediate Alert Service Declaration - [IAS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [IAS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Level Characteristic Declaration - [IAS_IDX_ALERT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [IAS_IDX_ALERT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Level Characteristic Value - [IAS_IDX_ALERT_LVL_VAL] = {BLE_ATT_CHAR_ALERT_LEVEL, WRITE_CMD_PERM_UNSEC, 0, sizeof(uint8_t)}, + [IAS_IDX_ALERT_LVL_VAL] = {BLE_ATT_CHAR_ALERT_LEVEL, BLE_GATTS_WRITE_CMD_PERM_UNSEC, 0, sizeof(uint8_t)}, }; /* * LOCAL FUNCTION DECLARATIONS ***************************************************************************************** */ -static sdk_err_t ias_init(void); -static void ias_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); - -/**@brief IAS interface required by profile manager. */ -static ble_prf_manager_cbs_t ias_mgr_cbs = { - (prf_init_func_t)ias_init, - NULL, - NULL -}; - -/**@brief IAS GATT server Callbacks. */ -static gatts_prf_cbs_t ias_gatts_cbs = { - NULL, - ias_write_att_cb, - NULL, - NULL -}; - -/**@brief IAS Information. */ -static const prf_server_info_t ias_prf_info = { - /* There shall be only one connection with a device. */ - .max_connection_nb = 1, - .manager_cbs = &ias_mgr_cbs, - .gatts_prf_cbs = &ias_gatts_cbs -}; /* * LOCAL FUNCTION DEFINITIONS @@ -131,41 +111,6 @@ static const prf_server_info_t ias_prf_info = { * @return Error code to know if service initialization succeed or not. ***************************************************************************************** */ -static sdk_err_t ias_init(void) -{ - const uint8_t ias_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_IMMEDIATE_ALERT); - gatts_create_db_t gatts_db; - sdk_err_t ret; - uint16_t start_hdl = PRF_INVALID_HANDLE; /* The start hanlde is an in/out - * parameter of ble_gatts_srvc_db_create(). - * It must be set with PRF_INVALID_HANDLE - * to be allocated automatically by BLE Stack. */ - - ret = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = (uint8_t *)ias_svc_uuid; - gatts_db.attr_tab_cfg = &s_char_mask; - gatts_db.max_nb_attr = IAS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = ias_attr_tab; - - sdk_err_t error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_ias_env.start_hdl = *gatts_db.shdl; - - uint16_t handle = prf_find_handle_by_idx(IAS_IDX_ALERT_LVL_VAL, s_ias_env.start_hdl, &s_char_mask); - uint8_t initial_alert_level = INITIAL_ALERT_LEVEL; - - ble_gatts_value_set(handle, sizeof(uint8_t), 0, &initial_alert_level); - } - - return error_code; -} /** ***************************************************************************************** @@ -175,33 +120,40 @@ static sdk_err_t ias_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void ias_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void ias_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = prf_find_handle_by_idx(IAS_IDX_ALERT_LVL_VAL, s_ias_env.start_hdl, &s_char_mask); - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; cfm.handle = p_param->handle; - if (handle != p_param->handle) { + if (handle != p_param->handle) + { cfm.status = BLE_ATT_ERR_INVALID_HANDLE; - } else { - if (p_param->length != sizeof(uint8_t)) { + } + else + { + if (p_param->length != sizeof(uint8_t)) + { cfm.status = SDK_ERR_INVALID_ATT_VAL_LEN; - } else { - // Send write response + } + else + { + //Send write response uint8_t value = p_param->value[0]; cfm.status = (uint8_t)ble_gatts_value_set(cfm.handle, sizeof(uint8_t), 0, &value); - if (cfm.status != BLE_SUCCESS) { - return; - } - /* Alert level updated by the peer, notify app the event. */ - if (s_ias_env.ias_init.evt_handler) { - ias_evt_t evt; + if (BLE_SUCCESS == cfm.status) + { + /* Alert level updated by the peer, notify app the event. */ + if (s_ias_env.ias_init.evt_handler) + { + ias_evt_t evt; - evt.evt_type = IAS_EVT_ALERT_LEVEL_UPDATED; - evt.alert_level = value; - s_ias_env.ias_init.evt_handler(&evt); + evt.evt_type = IAS_EVT_ALERT_LEVEL_UPDATED; + evt.alert_level = value; + s_ias_env.ias_init.evt_handler(&evt); + } } } } @@ -221,13 +173,47 @@ sdk_err_t ias_alert_level_get(uint8_t *p_alert_level) return ble_gatts_value_get(handle, &length, p_alert_level); } +static void ias_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + ias_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + break; + default: + break; + } +} sdk_err_t ias_service_init(ias_init_t *p_ias_init) { - if (p_ias_init == NULL) { + if (NULL == p_ias_init) + { return SDK_ERR_POINTER_NULL; } s_ias_env.ias_init.evt_handler = p_ias_init->evt_handler; - return ble_server_prf_add(&ias_prf_info); + memset(&s_ias_env.ias_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_ias_env.start_hdl = PRF_INVALID_HANDLE; + s_ias_env.ias_serv_db.shdl = &s_ias_env.start_hdl; + s_ias_env.ias_serv_db.uuid = s_ias_svc_uuid; + s_ias_env.ias_serv_db.attr_tab_cfg = &s_char_mask; + s_ias_env.ias_serv_db.max_nb_attr = IAS_IDX_NB; + s_ias_env.ias_serv_db.srvc_perm = 0; + s_ias_env.ias_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_ias_env.ias_serv_db.attr_tab.attr_tab_16 = ias_attr_tab; + + return ble_gatts_prf_add(&s_ias_env.ias_serv_db, ias_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.h index 1e59cf2..ebea1e0 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias/ias.h @@ -47,9 +47,9 @@ * @brief Definitions and prototypes for the IAS interface. * * @details The Immediate Alert Service exposes a control point to allow a peer device to cause - * the device to immediately alert. + * the device to immediately alert. * - * The application must provide an event handler to set \ref ias_init_t.evt_handler. + * The application must provide an event handler to set \ref ias_init_t.evt_handler. * After \ref ias_init_t variable is initialized, the application must call \ref ias_service_init() * to add the Immediate Alert Service and Alert Level characteristic to the BLE Stack database, * the service will notify the application when the value of Alert Level characteristic is changed @@ -63,26 +63,28 @@ #ifndef __IAS_H__ #define __IAS_H__ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup IAS_ENUM Enumerations * @{ */ /**@brief Immediate Alert Service Alert levels. */ -enum { +enum +{ IAS_ALERT_NONE, /**< No alert. */ IAS_ALERT_MILD, /**< Mild alert. */ IAS_ALERT_HIGH, /**< High alert. */ }; /**@brief Immediate Alert Service event type. */ -typedef enum { +typedef enum +{ IAS_EVT_INVALID, /**< Invalid IAS event. */ IAS_EVT_ALERT_LEVEL_UPDATED, /**< Alert Level Updated event. */ -} ias_evt_type_t; +}ias_evt_type_t; /** @} */ /** @@ -90,10 +92,11 @@ typedef enum { * @{ */ /**@brief Immediate Alert Service event. */ -typedef struct { +typedef struct +{ ias_evt_type_t evt_type; /**< Type of event. */ uint8_t alert_level; /**< New value of Alert level. */ -} ias_evt_t; +}ias_evt_t; /** @} */ /** @@ -108,9 +111,9 @@ typedef void (*ias_evt_handler_t)(ias_evt_t *p_evt); * @addtogroup IAS_STRUCT Structures * @{ */ -/**@brief Immediate Alert Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Immediate Alert Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ ias_evt_handler_t evt_handler; /**< Immediate Alert Service event handler. */ } ias_init_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/BUILD.gn new file mode 100644 index 0000000..404dba4 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ias_c") { + sources = [ "ias_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.c index 3e564a8..f467726 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.c @@ -39,64 +39,34 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "ias_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "ias_c.h" - -#define OFFSET_8 8 +#include /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Immediate Alert Service environment variable. */ -struct ias_c_env_t { +struct ias_c_env_t +{ ias_c_handles_t handles; /**< Handles of IAS characteristics which will be got for peer. */ ias_c_evt_handler_t evt_handler; /**< Handler of IAS Client event */ uint8_t prf_id; /**< IAS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void ias_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void ias_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct ias_c_env_t s_ias_c_env; /**< Immediate Alert Service Client environment variable. */ - -/**@brief Immediate Alert Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t ias_c_mgr_cbs = { - NULL, - NULL, - NULL +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_IMMEDIATE_ALERT), HI_U16(BLE_ATT_SVC_IMMEDIATE_ALERT)}; +static ble_uuid_t s_ias_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; - -/**@brief Immediate Alert Service GATT Client Callbacks. */ -static gattc_prf_cbs_t ias_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - ias_c_att_write_cb, - NULL, - ias_c_srvc_browse_cb, - NULL, -}; - -/**@brief Immediate Alert Service Client Information. */ -static const prf_client_info_t ias_c_prf_info = { - .max_connection_nb = IAS_C_CONNECTION_MAX, - .manager_cbs = &ias_c_mgr_cbs, - .gattc_prf_cbs = &ias_c_gattc_cbs -}; - /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -110,19 +80,21 @@ static const prf_client_info_t ias_c_prf_info = { * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void ias_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void ias_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { ias_c_evt_t ias_c_evt; ias_c_evt.conn_idx = conn_idx; ias_c_evt.evt_type = IAS_C_EVT_INVALID; - if (handle == s_ias_c_env.handles.ias_alert_level_handle) { + if (handle == s_ias_c_env.handles.ias_alert_level_handle) + { ias_c_evt.evt_type = (BLE_SUCCESS == status) ?\ IAS_C_EVT_ALERT_LEVEL_SET_SUCCESS :\ IAS_C_EVT_ALERT_LEVEL_SET_ERR; - if (s_ias_c_env.evt_handler) { + if (s_ias_c_env.evt_handler) + { s_ias_c_env.evt_handler(&ias_c_evt); } } @@ -137,7 +109,7 @@ static void ias_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void ias_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void ias_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { ias_c_evt_t ias_c_evt; uint16_t uuid_disc; @@ -146,88 +118,97 @@ static void ias_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat ias_c_evt.conn_idx = conn_idx; ias_c_evt.evt_type = IAS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_IMMEDIATE_ALERT == uuid_disc) { - s_ias_c_env.handles.ias_srvc_start_handle = p_browse_srvc->start_hdl; - s_ias_c_env.handles.ias_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_IMMEDIATE_ALERT == uuid_disc) + { + s_ias_c_env.handles.ias_srvc_start_handle = p_browse_srvc->start_hdl; + s_ias_c_env.handles.ias_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_ALERT_LEVEL == uuid_disc) { - s_ias_c_env.handles.ias_alert_level_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_ALERT_LEVEL == uuid_disc) + { + s_ias_c_env.handles.ias_alert_level_handle = handle_disc; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; } - } - ias_c_evt.evt_type = IAS_C_EVT_DISCOVERY_COMPLETE; + ias_c_evt.evt_type = IAS_C_EVT_DISCOVERY_COMPLETE; + } } - if (s_ias_c_env.evt_handler) { + if (s_ias_c_env.evt_handler) + { s_ias_c_env.evt_handler(&ias_c_evt); } } +static void ias_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_WRITE_REQUEST: + ias_c_att_write_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_SRVC_BROWSE: + ias_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ias_client_init(ias_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_ias_c_env, sizeof(s_ias_c_env), 0, sizeof(s_ias_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_ias_c_env, 0, sizeof(s_ias_c_env)); s_ias_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&ias_c_prf_info, &s_ias_c_env.prf_id); + return ble_gattc_prf_add(&s_ias_service_uuid, ias_c_ble_evt_handler); } sdk_err_t ias_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - - target_uuid[0] = LO_U16(BLE_ATT_SVC_IMMEDIATE_ALERT); - target_uuid[1] = HI_U16(BLE_ATT_SVC_IMMEDIATE_ALERT); - - const ble_uuid_t ias_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_ias_c_env.prf_id, conn_idx, &ias_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_ias_service_uuid); } sdk_err_t ias_c_alert_level_set(uint8_t conn_idx, ias_c_alert_level_t alert_level) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_ias_c_env.handles.ias_alert_level_handle) { + if (BLE_ATT_INVALID_HDL == s_ias_c_env.handles.ias_alert_level_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_ias_c_env.handles.ias_alert_level_handle; - write_attr_value.length = sizeof(uint8_t); - write_attr_value.p_value = (uint8_t *)&alert_level; - - return ble_gattc_prf_write_no_resp(s_ias_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_ias_c_env.handles.ias_alert_level_handle, \ + sizeof(uint8_t), (uint8_t *)&alert_level); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.h index 767951d..f6912c8 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ias_c/ias_c.h @@ -56,18 +56,17 @@ #ifndef __IAS_C_H__ #define __IAS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup IAS_C_MACRO Defines * @{ */ -#define IAS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of IAS Client connections. */ +#define IAS_C_CONNECTION_MAX 10 /**< Maximum number of IAS Client connections. */ /** @} */ /** @@ -75,18 +74,19 @@ * @{ */ /**@brief Immediate Alert Service Alert levels. */ -typedef enum { +typedef enum +{ IAS_C_ALERT_NONE, /**< No alert. */ IAS_C_ALERT_MILD, /**< Mild alert. */ IAS_C_ALERT_HIGH, /**< High alert. */ } ias_c_alert_level_t; /**@brief Immediate Alert Service Client event type. */ -typedef enum { +typedef enum +{ IAS_C_EVT_INVALID, /**< IAS Client invalid event. */ IAS_C_EVT_DISCOVERY_COMPLETE, /**< IAS Client has found BAS service and its characteristics. */ - IAS_C_EVT_DISCOVERY_FAIL, /**< IAS Client found BAS service failed because of invalid operation \ - or no found at the peer. */ + IAS_C_EVT_DISCOVERY_FAIL, /**< IAS Client found BAS service failed because of invalid operation or no found at the peer. */ IAS_C_EVT_ALERT_LEVEL_SET_SUCCESS, /**< IAS Client has set Alert Level characteristic. */ IAS_C_EVT_ALERT_LEVEL_SET_ERR, /**< Error occured when IAS Client set Alert Level characteristic. */ } ias_c_evt_type_t; @@ -97,14 +97,16 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { - uint16_t ias_srvc_start_handle; /**< IAS Service start handle. */ - uint16_t ias_srvc_end_handle; /**< IAS Service end handle. */ - uint16_t ias_alert_level_handle; /**< IAS Alert Level characteristic Value handle which has been got from peer. */ +typedef struct +{ + uint16_t ias_srvc_start_handle; /**< IAS Service start handle. */ + uint16_t ias_srvc_end_handle; /**< IAS Service end handle. */ + uint16_t ias_alert_level_handle; /**< IAS Alert Level characteristic Value handle which has been got from peer. */ } ias_c_handles_t; /**@brief Immediate Alert Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ ias_c_evt_type_t evt_type; /**< IAS Client event type. */ } ias_c_evt_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/BUILD.gn new file mode 100644 index 0000000..5d1515d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("lls") { + sources = [ "lls.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.c index ebb95dd..98a10bf 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.c @@ -1,7 +1,7 @@ /** ***************************************************************************************** * - * @file bas.c + * @file lls.c * * @brief Link Loss Server Implementation. * @@ -49,7 +49,8 @@ ***************************************************************************************** */ /**@brief LLS Attributes database index list. */ -enum lls_attr_idx_t { +enum lls_attr_idx_t +{ LLS_IDX_SVC, LLS_IDX_ALERT_LVL_CHAR, @@ -63,9 +64,11 @@ enum lls_attr_idx_t { ***************************************************************************************** */ /**@brief Link Loss Service environment variable. */ -struct lls_env_t { - lls_init_t lls_init; /**< Link Loss Service initialization variables. */ - uint16_t start_hdl; /**< Link Loss Service start handle. */ +struct lls_env_t +{ + lls_init_t lls_init; /**< Link Loss Service initialization variables. */ + uint16_t start_hdl; /**< Link Loss Service start handle. */ + ble_gatts_create_db_t lls_serv_db; /**< Link Loss Service DataBase. */ }; /* @@ -79,92 +82,27 @@ static uint8_t s_char_mask = 0x07; /**< Features added into ATT datab * bit1 - Alert Level Characteristic Declaration * bit2 - Alert Level Characteristic Value */ +static const uint8_t s_lls_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_LINK_LOSS); /**@brief Full LLS Database Description - Used to add attributes into the * database. */ -static const attm_desc_t lls_attr_tab[LLS_IDX_NB] = { +static const ble_gatts_attm_desc_t lls_attr_tab[LLS_IDX_NB] = +{ // Link Loss Service Declaration - [LLS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [LLS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Level Characteristic Declaration - [LLS_IDX_ALERT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [LLS_IDX_ALERT_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Level Characteristic Value - [LLS_IDX_ALERT_LVL_VAL] = {BLE_ATT_CHAR_ALERT_LEVEL, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, sizeof(uint8_t)}, + [LLS_IDX_ALERT_LVL_VAL] = {BLE_ATT_CHAR_ALERT_LEVEL, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, sizeof(uint8_t)}, }; /* * LOCAL FUNCTION DECLARATIONS ******************************************************************************* */ -static sdk_err_t lls_init(void); static void lls_on_connect(uint8_t conn_idx); static void lls_on_disconnect(uint8_t conn_idx, uint8_t reason); -static void lls_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); - -/**@brief LLS interface required by profile manager. */ -static ble_prf_manager_cbs_t lls_mgr_cbs = { - (prf_init_func_t)lls_init, - lls_on_connect, - lls_on_disconnect -}; - -/**@brief LLS GATT server callbacks. */ -static gatts_prf_cbs_t lls_gatts_cbs = { - NULL, - lls_write_att_cb, - NULL, - NULL -}; - -/**@brief LLS Information. */ -static const prf_server_info_t lls_prf_info = { - /* There shall be only one connection on a device. */ - .max_connection_nb = 1, - .manager_cbs = &lls_mgr_cbs, - .gatts_prf_cbs = &lls_gatts_cbs -}; - -/** - ***************************************************************************************** - * @brief Initialize Link Loss service and create database in BLE Stack. - * - * @return BLE_ATT_ERR_NO_ERROR on success, otherwise error code. - ***************************************************************************************** - */ -static sdk_err_t lls_init(void) -{ - const uint8_t lls_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_LINK_LOSS); - gatts_create_db_t gatts_db; - sdk_err_t ret; - uint16_t start_hdl = PRF_INVALID_HANDLE; /* The start hanlde is an in/out - * parameter of ble_gatts_srvc_db_create(). - * It must be set with PRF_INVALID_HANDLE - * to be allocated automatically by BLE Stack. */ - - ret = memset_S(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = (uint8_t *)lls_svc_uuid; - gatts_db.attr_tab_cfg = &s_char_mask; - gatts_db.max_nb_attr = LLS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = lls_attr_tab; - - sdk_err_t error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_lls_env.start_hdl = *gatts_db.shdl; - - uint16_t handle = prf_find_handle_by_idx(LLS_IDX_ALERT_LVL_VAL, s_lls_env.start_hdl, &s_char_mask); - ble_gatts_value_set(handle, sizeof(uint8_t), 0, (unsigned char *)(&s_lls_env.lls_init.initial_alert_level)); - } - - return error_code; -} /** ***************************************************************************************** @@ -178,11 +116,14 @@ static void lls_on_connect(uint8_t conn_idx) lls_evt_t evt; sdk_err_t ret; - if (s_lls_env.lls_init.evt_handler) { + if (s_lls_env.lls_init.evt_handler) + { evt.evt_type = LLS_EVT_LINK_LOSS_ALERT; ret = lls_alert_level_get((unsigned char *)(&evt.alert_level)); - if (SDK_SUCCESS == ret && s_lls_env.lls_init.evt_handler) { + + if (SDK_SUCCESS == ret && s_lls_env.lls_init.evt_handler) + { /* Inform Application the link is (re)connected */ s_lls_env.lls_init.evt_handler(&evt); } @@ -200,7 +141,8 @@ static void lls_on_connect(uint8_t conn_idx) static void lls_on_disconnect(uint8_t conn_idx, uint8_t reason) { /* The reason is HCI Connection Timeout */ - if (BLE_LL_ERR_CON_TIMEOUT == reason || BLE_LL_ERR_INSTANT_PASSED == reason) { + if (BLE_LL_ERR_CON_TIMEOUT == reason || BLE_LL_ERR_INSTANT_PASSED == reason) + { /* Link loss detected, inform application */ lls_evt_t evt; sdk_err_t ret; @@ -208,8 +150,11 @@ static void lls_on_disconnect(uint8_t conn_idx, uint8_t reason) evt.evt_type = LLS_EVT_LINK_LOSS_ALERT; ret = lls_alert_level_get((unsigned char *)(&evt.alert_level)); - if (SDK_SUCCESS == ret) { - if (s_lls_env.lls_init.evt_handler) { + + if (SDK_SUCCESS == ret) + { + if (s_lls_env.lls_init.evt_handler) + { s_lls_env.lls_init.evt_handler(&evt); } } @@ -226,20 +171,26 @@ static void lls_on_disconnect(uint8_t conn_idx, uint8_t reason) * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void lls_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void lls_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = prf_find_handle_by_idx(LLS_IDX_ALERT_LVL_VAL, s_lls_env.start_hdl, &s_char_mask); - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; cfm.handle = p_param->handle; - if (handle != p_param->handle) { + if (handle != p_param->handle) + { cfm.status = BLE_ATT_ERR_INVALID_HANDLE; - } else { - if (p_param->length != sizeof(uint8_t)) { + } + else + { + if (p_param->length != sizeof(uint8_t)) + { cfm.status = SDK_ERR_INVALID_ATT_VAL_LEN; - } else { - // Send write response + } + else + { + //Send write response uint8_t value = p_param->value[0]; cfm.status = (uint8_t)ble_gatts_value_set(cfm.handle, sizeof(uint8_t), 0, &value); @@ -249,22 +200,70 @@ static void lls_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p ble_gatts_write_cfm(conn_idx, &cfm); } +static void lls_ble_evt_handler(const ble_evt_t *p_evt) +{ + if(NULL == p_evt) + { + return ; + } + + uint16_t handle; + + switch(p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + break; + case BLE_GATTS_EVT_WRITE_REQUEST: + lls_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + case BLE_GATTS_EVT_NTF_IND: + break; + case BLE_GATTS_EVT_CCCD_RECOVERY: + break; + case BLE_GAPC_EVT_CONNECTED: + lls_on_connect(p_evt->evt.gapc_evt.index); + break; + case BLE_GAPC_EVT_DISCONNECTED: + lls_on_disconnect(p_evt->evt.gapc_evt.index,p_evt->evt.gapc_evt.params.disconnected.reason); + break; + case BLE_GATT_COMMON_EVT_PRF_REGISTER: + handle = prf_find_handle_by_idx(LLS_IDX_ALERT_LVL_VAL, s_lls_env.start_hdl, &s_char_mask); + ble_gatts_value_set(handle, sizeof(uint8_t), 0, (uint8_t *)&s_lls_env.lls_init.initial_alert_level); + break; + default: + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t lls_service_init(lls_init_t *p_lls_init) { - if (p_lls_init == NULL) { + if (NULL == p_lls_init) + { return SDK_ERR_POINTER_NULL; } - s_lls_env.lls_init.evt_handler = p_lls_init->evt_handler; + s_lls_env.lls_init.evt_handler = p_lls_init->evt_handler; + s_lls_env.lls_init.initial_alert_level = p_lls_init->initial_alert_level; - return ble_server_prf_add(&lls_prf_info); + memset(&s_lls_env.lls_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_lls_env.start_hdl = PRF_INVALID_HANDLE; + s_lls_env.lls_serv_db.shdl = &s_lls_env.start_hdl; + s_lls_env.lls_serv_db.uuid = s_lls_svc_uuid; + s_lls_env.lls_serv_db.attr_tab_cfg = &s_char_mask; + s_lls_env.lls_serv_db.max_nb_attr = LLS_IDX_NB; + s_lls_env.lls_serv_db.srvc_perm = 0; + s_lls_env.lls_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_lls_env.lls_serv_db.attr_tab.attr_tab_16 = lls_attr_tab; + + return ble_gatts_prf_add(&s_lls_env.lls_serv_db, lls_ble_evt_handler); } -sdk_err_t lls_alert_level_get(uint8_t *p_alert_level) +sdk_err_t lls_alert_level_get(uint8_t *p_alert_level) { uint16_t handle = prf_find_handle_by_idx(LLS_IDX_ALERT_LVL_VAL, s_lls_env.start_hdl, (uint8_t *)&s_char_mask); uint16_t length = sizeof(uint8_t); diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.h index 7126400..50bfc90 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls/lls.h @@ -49,7 +49,7 @@ * @details The Link Loss Service uses the Alert Level characteristic to cause an alert in the * device when the link is lost. * - * The application must provide an event handler to set \ref lls_init_t.evt_handler. + * The application must provide an event handler to set \ref lls_init_t.evt_handler. * After \ref lls_init_t variable is initialized, the application must call \ref lls_service_init() * to add Alert Level Characteristic to the BLE Stack database, the service will notify the application * with the event handler when the link has been lost, and which Alert Level has been set. @@ -62,23 +62,25 @@ #ifndef __LLS_H__ #define __LLS_H__ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup LLS_ENUM Enumerations * @{ */ /** Link Loss Service alert levels. */ -typedef enum { +typedef enum +{ LLS_ALERT_LEVEL_NO_ALERT, /**< No alert. */ LLS_ALERT_LEVEL_MILD_ALERT, /**< Mild alert. */ LLS_ALERT_LEVEL_HIGH_ALERT, /**< High alert. */ } lls_alert_levels_t; /**@brief Link Loss Service event type. */ -typedef enum { +typedef enum +{ LLS_EVT_INVALID, /**< Invalid LLS event. */ LLS_EVT_LINK_LOSS_ALERT /**< Link loss alert event. */ } lls_evt_type_t; @@ -89,7 +91,8 @@ typedef enum { * @{ */ /**@brief Link Loss Service event. */ -typedef struct { +typedef struct +{ lls_evt_type_t evt_type; /**< Type of event. */ lls_alert_levels_t alert_level; /**< Alert level. */ } lls_evt_t; @@ -107,9 +110,9 @@ typedef void (*lls_evt_handler_t)(lls_evt_t *p_evt); * @addtogroup LLS_STRUCT Structures * @{ */ -/**@brief Link Loss Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Link Loss Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ lls_evt_handler_t evt_handler; /**< Link Loss Service event handler. */ lls_alert_levels_t initial_alert_level; /**< Initial value of the alert level. */ } lls_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/BUILD.gn new file mode 100644 index 0000000..1ee5d83 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("lls_c") { + sources = [ "lls_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.c index ce99689..55be44c 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.c @@ -39,62 +39,33 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "lls_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "lls_c.h" +#include -#define OFFSET_8 8 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Link Loss Service environment variable. */ -struct lls_c_env_t { +struct lls_c_env_t +{ lls_c_handles_t handles; /**< Handles of LLS characteristics which will be got for peer. */ lls_c_evt_handler_t evt_handler; /**< Handler of LLS Client event */ uint8_t prf_id; /**< LLS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void lls_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void lls_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void lls_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct lls_c_env_t s_lls_c_env; /**< Link Loss Service Client environment variable. */ - -/**@brief Link Loss Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t lls_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Link Loss Service GATT Client Callbacks. */ -static gattc_prf_cbs_t lls_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - lls_c_att_read_cb, - lls_c_att_write_cb, - NULL, - lls_c_srvc_browse_cb, - NULL, -}; - -/**@brief Link Loss Service Client Information. */ -static const prf_client_info_t lls_c_prf_info = { - .max_connection_nb = LLS_C_CONNECTION_MAX, - .manager_cbs = &lls_c_mgr_cbs, - .gattc_prf_cbs = &lls_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_LINK_LOSS), HI_U16(BLE_ATT_SVC_LINK_LOSS)}; +static ble_uuid_t s_lls_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -110,55 +81,59 @@ static const prf_client_info_t lls_c_prf_info = { */ void lls_c_evt_handler_excute(lls_c_evt_t *p_evt) { - if (s_lls_c_env.evt_handler != NULL && LLS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_lls_c_env.evt_handler && LLS_C_EVT_INVALID != p_evt->evt_type) + { s_lls_c_env.evt_handler(p_evt); } } /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void lls_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void lls_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { lls_c_evt_t lls_c_evt; lls_c_evt.conn_idx = conn_idx; lls_c_evt.evt_type = LLS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_lls_c_env.handles.lls_alert_level_handle) { + if (p_read_rsp->value[0].handle == s_lls_c_env.handles.lls_alert_level_handle) + { lls_c_evt.evt_type = LLS_C_EVT_ALERT_LEVEL_RECEIVE; - lls_c_evt.alert_level = (lls_c_alert_level_t)p_read_rsp->vals[0].p_value[0]; + lls_c_evt.alert_level = (lls_c_alert_level_t)p_read_rsp->value[0].p_value[0]; lls_c_evt_handler_excute(&lls_c_evt); } } /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void lls_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void lls_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { lls_c_evt_t lls_c_evt; lls_c_evt.conn_idx = conn_idx; lls_c_evt.evt_type = LLS_C_EVT_INVALID; - if (handle == s_lls_c_env.handles.lls_alert_level_handle) { + if (handle == s_lls_c_env.handles.lls_alert_level_handle) + { lls_c_evt.evt_type = (BLE_SUCCESS == status) ?\ LLS_C_EVT_ALERT_LEVEL_SET_SUCCESS :\ LLS_C_EVT_ALERT_LEVEL_SET_ERR; @@ -169,14 +144,14 @@ static void lls_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle /** ***************************************************************************************** - * @brief This callback function will be called when receiving browse service indication. + * @brief This event handler function will be called when receiving browse service indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void lls_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void lls_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { lls_c_evt_t lls_c_evt; uint16_t uuid_disc; @@ -185,94 +160,105 @@ static void lls_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat lls_c_evt.conn_idx = conn_idx; lls_c_evt.evt_type = LLS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_LINK_LOSS == uuid_disc) { - s_lls_c_env.handles.lls_srvc_start_handle = p_browse_srvc->start_hdl; - s_lls_c_env.handles.lls_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_LINK_LOSS == uuid_disc) + { + s_lls_c_env.handles.lls_srvc_start_handle = p_browse_srvc->start_hdl; + s_lls_c_env.handles.lls_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_ALERT_LEVEL == uuid_disc) { - s_lls_c_env.handles.lls_alert_level_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_ALERT_LEVEL == uuid_disc) + { + s_lls_c_env.handles.lls_alert_level_handle = handle_disc; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; } - } - lls_c_evt.evt_type = LLS_C_EVT_DISCOVERY_COMPLETE; + lls_c_evt.evt_type = LLS_C_EVT_DISCOVERY_COMPLETE; + } } lls_c_evt_handler_excute(&lls_c_evt); } +static void lls_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_WRITE_RSP: + lls_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_READ_RSP: + lls_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_SRVC_BROWSE: + lls_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + } +} /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t lls_client_init(lls_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_lls_c_env, sizeof(s_lls_c_env), 0, sizeof(s_lls_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_lls_c_env, 0, sizeof(s_lls_c_env)); s_lls_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&lls_c_prf_info, &s_lls_c_env.prf_id); + return ble_gattc_prf_add(&s_lls_service_uuid, lls_c_ble_evt_handler); } sdk_err_t lls_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - - target_uuid[0] = LO_U16(BLE_ATT_SVC_LINK_LOSS); - target_uuid[1] = HI_U16(BLE_ATT_SVC_LINK_LOSS); - - const ble_uuid_t lls_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_lls_c_env.prf_id, conn_idx, &lls_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_lls_service_uuid); } sdk_err_t lls_c_alert_level_set(uint8_t conn_idx, lls_c_alert_level_t alert_level) { - gattc_write_attr_value_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_lls_c_env.handles.lls_alert_level_handle) { + if (BLE_ATT_INVALID_HDL == s_lls_c_env.handles.lls_alert_level_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_lls_c_env.handles.lls_alert_level_handle; - write_attr_value.offset = 0; - write_attr_value.length = sizeof(uint8_t); - write_attr_value.p_value = (uint8_t *)&alert_level; - - return ble_gattc_prf_write(s_lls_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_lls_c_env.handles.lls_alert_level_handle, 0, sizeof(uint8_t), (uint8_t *)&alert_level); } sdk_err_t lls_c_alert_level_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_lls_c_env.handles.lls_alert_level_handle) { + if (BLE_ATT_INVALID_HDL == s_lls_c_env.handles.lls_alert_level_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_lls_c_env.prf_id, conn_idx, s_lls_c_env.handles.lls_alert_level_handle, 0); + return ble_gattc_read(conn_idx, s_lls_c_env.handles.lls_alert_level_handle, 0); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.h index eaa789b..5e9c1ca 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lls_c/lls_c.h @@ -56,18 +56,17 @@ #ifndef __LLS_C_H__ #define __LLS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup LLS_C_MACRO Defines * @{ */ -#define LLS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of LLS Client connections. */ +#define LLS_C_CONNECTION_MAX 10 /**< Maximum number of LLS Client connections. */ /** @} */ /** @@ -75,21 +74,22 @@ * @{ */ /**@brief Link Loss Service Client alert levels. */ -typedef enum { +typedef enum +{ LLS_C_ALERT_LEVEL_NO_ALERT, /**< No alert. */ LLS_C_ALERT_LEVEL_MILD_ALERT, /**< Mild alert. */ LLS_C_ALERT_LEVEL_HIGH_ALERT, /**< High alert. */ } lls_c_alert_level_t; /**@brief Link Loss Service Client event type. */ -typedef enum { - LLS_C_EVT_INVALID, /**< LLS Client invalid event. */ - LLS_C_EVT_DISCOVERY_COMPLETE, /**< LLS Client has found LLS service and its characteristics. */ - LLS_C_EVT_DISCOVERY_FAIL, /**< LLS Client found LLS service failed \ - because of invalid operation or no found at the peer. */ - LLS_C_EVT_ALERT_LEVEL_SET_SUCCESS, /**< LLS Client has set Alert Level characteristics. */ - LLS_C_EVT_ALERT_LEVEL_SET_ERR, /**< Error occured when LLS Client set Alert Level characteristics. */ - LLS_C_EVT_ALERT_LEVEL_RECEIVE, /**< LLS Client has received Alert Level value. */ +typedef enum +{ + LLS_C_EVT_INVALID, /**< LLS Client invalid event. */ + LLS_C_EVT_DISCOVERY_COMPLETE, /**< LLS Client has found LLS service and its characteristics. */ + LLS_C_EVT_DISCOVERY_FAIL, /**< LLS Client found LLS service failed because of invalid operation or no found at the peer. */ + LLS_C_EVT_ALERT_LEVEL_SET_SUCCESS, /**< LLS Client has set Alert Level characteristics. */ + LLS_C_EVT_ALERT_LEVEL_SET_ERR, /**< Error occured when LLS Client set Alert Level characteristics. */ + LLS_C_EVT_ALERT_LEVEL_RECEIVE, /**< LLS Client has received Alert Level value. */ } lls_c_evt_type_t; /** @} */ @@ -98,15 +98,16 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t lls_srvc_start_handle; /**< LLS Service start handle. */ uint16_t lls_srvc_end_handle; /**< LLS Service end handle. */ - uint16_t lls_alert_level_handle; /**< LLS Alert Level characteristic Value handle \ - which has been got from peer. */ + uint16_t lls_alert_level_handle; /**< LLS Alert Level characteristic Value handle which has been got from peer. */ } lls_c_handles_t; /**@brief Link Loss Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ lls_c_evt_type_t evt_type; /**< LLS Client event type. */ lls_c_alert_level_t alert_level; /**< Alert level. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/BUILD.gn new file mode 100644 index 0000000..fcff582 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("lms") { + sources = [ "lms.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.c new file mode 100644 index 0000000..db9dbf0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.c @@ -0,0 +1,440 @@ +/** + **************************************************************************************** + * + * @file lms.c + * + * @brief Log Management Service Implementation. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + /* + * INCLUDE FILES + **************************************************************************************** + */ +#include "lms.h" +#include "ble_prf_types.h" +#include "ble_prf_utils.h" +#include "utility.h" + +/* + * DEFINES + **************************************************************************************** + */ +/**@brief Proprietary UUIDs. */ +#define LMS_SERVICE_CMD_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x0B, 0xED, 0xA6} +#define LMS_SERVICE_DATA_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x0B, 0xED, 0xA6} + +/**@brief Macros for conversion of 128bit to 16bit UUID. */ +#define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) +#define ATT_128_CHARACTERISTIC BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_CHARACTERISTIC) +#define ATT_128_CLIENT_CHAR_CFG BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DESC_CLIENT_CHAR_CFG) + +/* + * ENUMERATIONS + **************************************************************************************** + */ +/**@brief LMS Service Attributes Indexes. */ +enum lms_attr_idx_tag +{ + LMS_IDX_SVC, + + LMS_IDX_CMD_CHAR, + LMS_IDX_CMD_VAL, + LMS_IDX_CMD_CFG, + LMS_IDX_DATA_CHAR, + LMS_IDX_DATA_VAL, + LMS_IDX_DATA_CFG, + + LMS_IDX_NB, +}; + +/* + * STRUCT DEFINE + **************************************************************************************** + */ +struct lms_env_t +{ + lms_init_t lms_init; + uint16_t cmd_ntf_cfg[LMS_CONNECTION_MAX]; + uint16_t data_ntf_cfg[LMS_CONNECTION_MAX]; + uint16_t start_hdl; + ble_gatts_create_db_t lms_att_db; +}; + +/* + * LOCAL VARIABLE DEFINITIONS + **************************************************************************************** + */ +static struct lms_env_t s_lms_env; +static uint16_t s_char_mask = 0xff; +static const uint8_t s_ths_svc_uuid[] = {LMS_SERVICE_UUID}; + +/**@brief Full LMS Database Description - Used to add attributes into the database. */ +static const ble_gatts_attm_desc_128_t lms_att_db[LMS_IDX_NB] = { + // LMS service + [LMS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + + // LMS TX Characteristic Declaration + [LMS_IDX_CMD_CHAR] = {ATT_128_CHARACTERISTIC,BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + // LMS TX Characteristic Value + [LMS_IDX_CMD_VAL] = {LMS_SERVICE_CMD_UUID, + BLE_GATTS_WRITE_CMD_PERM_UNSEC | BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + LMS_MAX_DATA_LEN}, + + // LMS TX Characteristic - Client Characteristic Configuration Descriptor + [LMS_IDX_CMD_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC| BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, + + // LMS RX Characteristic Declaration + [LMS_IDX_DATA_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0 }, + + // LMS RX Characteristic Value + [LMS_IDX_DATA_VAL] = {LMS_SERVICE_DATA_UUID, + BLE_GATTS_WRITE_CMD_PERM_UNSEC | BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + LMS_MAX_DATA_LEN}, + [LMS_IDX_DATA_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC| BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, +}; + +/* + * LOCAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +/** + ***************************************************************************************** + * @brief Handles reception of the attribute info request message. + * + * @param[in] conn_idx: Connection index + * @param[in] p_param: The parameters of the read request. + ***************************************************************************************** + */ +static void lms_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) +{ + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; + + tab_index = prf_find_idx_by_handle(handle, s_lms_env.start_hdl, LMS_IDX_NB, (uint8_t*)&s_char_mask); + + cfm.handle = handle; + cfm.status = BLE_SUCCESS; + + switch(tab_index) + { + case LMS_IDX_CMD_CFG: + cfm.length = sizeof(uint16_t); + cfm.value = (uint8_t *)(&s_lms_env.cmd_ntf_cfg[conn_idx]); + break; + case LMS_IDX_DATA_CFG: + cfm.length = sizeof(uint16_t); + cfm.value = (uint8_t *)(&s_lms_env.data_ntf_cfg[conn_idx]); + break; + + default: + cfm.length = 0; + cfm.status = BLE_ATT_ERR_INVALID_HANDLE; + break; + } + + ble_gatts_read_cfm(conn_idx,&cfm); +} + +/** + ***************************************************************************************** + * @brief Handles reception of the write request. + * + * @param[in] conn_idx: of connection index + * @param[in] p_param: Pointer to the parameters of the write request. + ***************************************************************************************** + */ +static void lms_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) +{ + ble_gatts_write_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; + uint16_t cccd_value = 0; + lms_evt_t event; + + tab_index = prf_find_idx_by_handle(handle, s_lms_env.start_hdl, LMS_IDX_NB, (uint8_t*)&s_char_mask); + + cfm.handle = handle; + cfm.status = BLE_SUCCESS; + + switch(tab_index) + { + + case LMS_IDX_CMD_VAL: + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = LMS_EVT_CMD_RECEIVE_DATA; + event.p_data = (uint8_t*)p_param->value; + event.length = p_param->length; + + s_lms_env.lms_init.evt_handler(&event); + } + + break; + + case LMS_IDX_CMD_CFG: + cccd_value = le16toh(&p_param->value[0]); + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ + LMS_EVT_CMD_NOTIFICATION_ENABLED : + LMS_EVT_CMD_NOTIFICATION_DISABLED; + s_lms_env.lms_init.evt_handler(&event); + } + s_lms_env.cmd_ntf_cfg[conn_idx] = cccd_value; + break; + + case LMS_IDX_DATA_VAL: + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = LMS_EVT_DATA_RECEIVE_DATA; + event.p_data = (uint8_t*)p_param->value; + event.length = p_param->length; + + s_lms_env.lms_init.evt_handler(&event); + } + break; + + case LMS_IDX_DATA_CFG: + cccd_value = le16toh(&p_param->value[0]); + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ + LMS_EVT_DATA_NOTIFICATION_ENABLED : + LMS_EVT_DATA_NOTIFICATION_DISABLED; + s_lms_env.lms_init.evt_handler(&event); + } + s_lms_env.data_ntf_cfg[conn_idx] = cccd_value; + + break; + + + + default: + cfm.status = BLE_ATT_ERR_INVALID_HANDLE; + break; + } + + ble_gatts_write_cfm(conn_idx,&cfm); +} + +/** + ***************************************************************************************** + * @brief Handles reception of the cccd recover request. + * + * @param[in]: conn_idx: Connection index + * @param[in]: handle: The handle of cccd attribute. + * @param[in]: cccd_value: The value of cccd attribute. + ***************************************************************************************** + */ +static void lms_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +{ + uint8_t tab_index = 0; + lms_evt_t event; + + if (!prf_is_cccd_value_valid(cccd_value)) + { + return; + } + + tab_index = prf_find_idx_by_handle(handle, s_lms_env.start_hdl, LMS_IDX_NB, (uint8_t*)&s_char_mask); + + switch(tab_index) + { + case LMS_IDX_CMD_CFG: + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ + LMS_EVT_CMD_NOTIFICATION_ENABLED : + LMS_EVT_CMD_NOTIFICATION_DISABLED; + s_lms_env.lms_init.evt_handler(&event); + } + s_lms_env.cmd_ntf_cfg[conn_idx] = cccd_value; + break; + + case LMS_IDX_DATA_CFG: + if(s_lms_env.lms_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ + LMS_EVT_DATA_NOTIFICATION_ENABLED : + LMS_EVT_DATA_NOTIFICATION_DISABLED; + s_lms_env.lms_init.evt_handler(&event); + } + s_lms_env.data_ntf_cfg[conn_idx] = cccd_value; + break; + + default: + break; + } +} + +/** + ***************************************************************************************** + * @brief Handles reception of the complete event. + * + * @param[in] conn_idx: Connection index + * @param[in] p_param: Pointer to the parameters of the complete event. + * + * @return If the event was consumed or not. + ***************************************************************************************** + */ +static void lms_ntf_cplt_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) +{ + if(s_lms_env.lms_init.evt_handler != NULL) + { + lms_evt_t event; + uint8_t tab_index = 0; + uint8_t handle = p_ntf_ind->handle; + + event.conn_idx = conn_idx; + tab_index = prf_find_idx_by_handle(handle, s_lms_env.start_hdl, LMS_IDX_NB, (uint8_t*)&s_char_mask); + if(status == BLE_SUCCESS) + { + if(p_ntf_ind->type == BLE_GATT_NOTIFICATION && LMS_IDX_CMD_VAL == tab_index) + { + event.evt_type = LMS_EVT_CMD_NOTIFY_COMPLETE; + s_lms_env.lms_init.evt_handler(&event); + } + else if (p_ntf_ind->type == BLE_GATT_NOTIFICATION && LMS_IDX_DATA_VAL == tab_index) + { + event.evt_type = LMS_EVT_DATA_NOTIFY_COMPLETE; + s_lms_env.lms_init.evt_handler(&event); + } + } + } + } + +static void lms_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + lms_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + lms_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + lms_ntf_cplt_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + lms_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +sdk_err_t lms_notify_cmd(uint8_t conn_idx,uint8_t* p_data,uint16_t len) +{ + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t send_cmd; + + if(s_lms_env.cmd_ntf_cfg[conn_idx] == PRF_CLI_START_NTF) + { + // Fill in the parameter structure + send_cmd.type = BLE_GATT_NOTIFICATION; + send_cmd.handle = prf_find_handle_by_idx(LMS_IDX_CMD_VAL, s_lms_env.start_hdl, (uint8_t*)&s_char_mask); + // pack measured value in database + send_cmd.length = len; + send_cmd.value = p_data; + // send notification to peer device + error_code = ble_gatts_noti_ind(conn_idx,&send_cmd); + } + return error_code; +} +sdk_err_t lms_notify_data(uint8_t conn_idx,uint8_t* p_data,uint16_t len) +{ + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t send_cmd; + + if(s_lms_env.data_ntf_cfg[conn_idx] == PRF_CLI_START_NTF) + { + // Fill in the parameter structure + send_cmd.type = BLE_GATT_NOTIFICATION; + send_cmd.handle = prf_find_handle_by_idx(LMS_IDX_DATA_VAL, s_lms_env.start_hdl, (uint8_t*)&s_char_mask); + // pack measured value in database + send_cmd.length = len; + send_cmd.value = p_data; + + error_code = ble_gatts_noti_ind(conn_idx,&send_cmd); + } + return error_code; +} + + +sdk_err_t lms_service_init(lms_init_t *p_lms_init) +{ + if (NULL == p_lms_init) + { + return SDK_ERR_POINTER_NULL; + } + + s_lms_env.lms_init.evt_handler = p_lms_init->evt_handler; + + memset(&s_lms_env.lms_att_db, 0, sizeof(ble_gatts_create_db_t)); + + s_lms_env.start_hdl = PRF_INVALID_HANDLE; + s_lms_env.lms_att_db.shdl = &s_lms_env.start_hdl; + s_lms_env.lms_att_db.uuid = s_ths_svc_uuid; + s_lms_env.lms_att_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_lms_env.lms_att_db.max_nb_attr = LMS_IDX_NB; + s_lms_env.lms_att_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_lms_env.lms_att_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_lms_env.lms_att_db.attr_tab.attr_tab_128 = lms_att_db; + + return ble_gatts_prf_add(&s_lms_env.lms_att_db, lms_ble_evt_handler); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.h new file mode 100644 index 0000000..b79a525 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lms/lms.h @@ -0,0 +1,179 @@ +/** + **************************************************************************************** + * + * @file lms.h + * + * @brief Log Management Service API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/** + * @addtogroup BLE_SRV BLE Services + * @{ + * @brief Definitions and prototypes for the BLE Service interface. + */ + +/** + * @defgroup BLE_SDK_LMS LMS Service (LMS) + * @{ + * @brief Definitions and prototypes for the LMS interface. + * + * @details The Log Management Service is a customized service with Command and Data + * characteristics. This module implements the log storage and sending function. + * After @ref lms_init_t variable is initialized, the developer shall call + * @ref lms_service_init() to add the LMS Service and RX, TX, Control characteristic + * to the BLE stack database. + * + * This module also provides \ref lms_notify_data() function to the application + * to send data to peer. + */ + +#ifndef _LMS_H_ +#define _LMS_H_ + +/* + * INCLUDE FILES + **************************************************************************************** + */ +#include "gr_includes.h" + +/** + * @defgroup LMS_MACRO Defines + * @{ + */ +#define LMS_CONNECTION_MAX 10 /**< Maximum number of LMS Service connections. */ +#define LMS_MAX_DATA_LEN 244 /**< Maximum length of LMS characteristic. */ +#define LMS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x0B, 0xED, 0xA6 /**< The UUID of LMS Service for setting advertising data. */ + +#define LMS_PATTERN_VALUE 0x474f4f44 /**< The Fast OTA pattern value. */ +/** @} */ + +/** + * @defgroup LMS_ENUM Enumerations + * @{ + */ +/**@brief LMS Service event type. */ +typedef enum +{ + LMS_EVT_INVALID, + LMS_EVT_CMD_NOTIFICATION_ENABLED, + LMS_EVT_CMD_NOTIFICATION_DISABLED, + LMS_EVT_CMD_RECEIVE_DATA, + LMS_EVT_CMD_NOTIFY_COMPLETE, + LMS_EVT_DATA_NOTIFICATION_ENABLED, + LMS_EVT_DATA_NOTIFICATION_DISABLED, + LMS_EVT_DATA_RECEIVE_DATA, + LMS_EVT_DATA_NOTIFY_COMPLETE +} lms_evt_type_t; +/** @} */ + +/** + * @defgroup LMS_STRUCT Structures + * @{ + */ +/**@brief LMS Service event. */ +typedef struct +{ + lms_evt_type_t evt_type; /**< The LMS event. */ + uint8_t conn_idx; /**< Index of connection. */ + uint8_t *p_data; /**< Pointer to data. */ + uint16_t length; /**< Length of data. */ +} lms_evt_t; +/** @} */ + +/** + * @defgroup LMS_TYPEDEF Typedefs + * @{ + */ +/**@brief LMS Service event handler type. */ +typedef void (*lms_evt_handler_t)(lms_evt_t *p_evt); + +/** @} */ + +/** + * @defgroup LMS_STRUCT Structures + * @{ + */ +/**@brief LMS Service initialization variable. */ +typedef struct +{ + lms_evt_handler_t evt_handler; /**< Handler to handle lms event. */ +} lms_init_t; +/** @} */ + + +/** + * @defgroup LMS_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Add an LMS Service instance in the DB + * + * @param[in] p_lms_init :Pointer to LMS Service environment variable + * + * @return Result of service initialization. + ***************************************************************************************** + */ +sdk_err_t lms_service_init(lms_init_t *p_lms_init); + + +/** + ***************************************************************************************** + * @brief Send data to peer device + * + * @param[in] conn_idx: Connection index + * @param[in] p_data: The Pointer of send value + * @param[in] length: The Lenth of send value + * + * @return Result of notify and indicate value + ***************************************************************************************** + */ +sdk_err_t lms_notify_cmd(uint8_t conn_idx, uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Send data to peer device + * + * @param[in] conn_idx: Connection index + * @param[in] p_data: The Pointer of send value + * @param[in] length: The Lenth of send value + * + * @return Result of notify and indicate value + ***************************************************************************************** + */ +sdk_err_t lms_notify_data(uint8_t conn_idx, uint8_t *p_data,uint16_t length); +/** @} */ + +#endif +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/BUILD.gn new file mode 100644 index 0000000..d406d5d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("lns") { + sources = [ "lns.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.c index c0d0129..d8cd395 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.c @@ -39,20 +39,20 @@ * INCLUDE FILES **************************************************************************************** */ -#include +#include "lns.h" #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#include "lns.h" +#include /* * DEFINES ***************************************************************************************** */ #define LNS_DEFAULT_GATT_PAYLOAD 20 -#define LNS_LOG_INFO_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define LNS_LOG_INFO_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x08, 0xED, 0xA6} -#define LNS_LOG_CTRL_PT_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ +#define LNS_LOG_CTRL_PT_CHARACTERISTIC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x08, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ @@ -65,7 +65,8 @@ **************************************************************************************** */ /**@brief Log Notification Service Attributes Indexes. */ -enum { +enum +{ // Log Notification Service LNS_IDX_SVC, @@ -87,27 +88,20 @@ enum { ***************************************************************************************** */ /**@brief Log Notification Service environment variable. */ -struct lns_env_t { - lns_evt_handler_t evt_handler; /**< Log Notification Service event handler. */ - uint16_t start_hdl; /**< Log Notification Service start handle. */ - uint16_t payload_len; /**< Length of gatt payload. */ - uint16_t - log_info_ntf_cfg[LNS_CONNECTION_MAX]; /**< The configuration of Log Information Notification \ - which is configured by the peer devices. */ - uint16_t - log_ctrl_pt_ind_cfg[LNS_CONNECTION_MAX]; /**< The configuration of Log Control Point indication \ - which is configured by the peer devices. */ +struct lns_env_t +{ + lns_evt_handler_t evt_handler; /**< Log Notification Service event handler. */ + uint16_t start_hdl; /**< Log Notification Service start handle. */ + uint16_t payload_len; /**< Length of gatt payload. */ + uint16_t log_info_ntf_cfg[LNS_CONNECTION_MAX]; /**< The configuration of Log Information Notification which is configured by the peer devices. */ + uint16_t log_ctrl_pt_ind_cfg[LNS_CONNECTION_MAX]; /**< The configuration of Log Control Point indication which is configured by the peer devices. */ + ble_gatts_create_db_t lns_gatts_db; /**< Log Notification Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t lns_init(void); -static void lns_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void lns_gatts_cplt_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); -static void lns_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); static sdk_err_t lns_log_info_chunk(uint8_t conn_idx); static void lns_evt_handler(lns_evt_t *p_evt); @@ -117,101 +111,40 @@ static void lns_evt_handler(lns_evt_t *p_evt); */ static struct lns_env_t s_lns_env; static lns_log_data_t s_log_data_ntf; -static uint16_t s_lns_char_mask = 0x007f; +static uint16_t s_lns_char_mask = 0x007f; +static const uint8_t s_lns_svc_uuid[] = {LNS_SERVICE_UUID}; /**@brief Full LNS Database Description - Used to add attributes into the database. */ -static const attm_desc_128_t lns_attr_tab[LNS_IDX_NB] = { +static const ble_gatts_attm_desc_128_t lns_attr_tab[LNS_IDX_NB] = +{ // Log Notification Service Declaration - [LNS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [LNS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Log Information Characteristic - Declaration - [LNS_IDX_LOG_INFO_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [LNS_IDX_LOG_INFO_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Log Information Characteristic - Value - [LNS_IDX_LOG_INFO_VAL] = { - LNS_LOG_INFO_CHARACTERISTIC_UUID, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - LNS_LOG_INFO_VAL_LEN - }, + [LNS_IDX_LOG_INFO_VAL] = {LNS_LOG_INFO_CHARACTERISTIC_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + LNS_LOG_INFO_VAL_LEN}, // Log Information Characteristic - Client Characteristic Configuration Descriptor - [LNS_IDX_LOG_INFO_NTF_CFG] = {ATT_128_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [LNS_IDX_LOG_INFO_NTF_CFG] = {ATT_128_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Log Control Point Characteristic - Declaration - [LNS_IDX_LOG_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [LNS_IDX_LOG_CTRL_PT_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Log Control Point Characteristic - Value - [LNS_IDX_LOG_CTRL_PT_VAL] = { - LNS_LOG_CTRL_PT_CHARACTERISTIC_UUID, - INDICATE_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128), - LNS_LOG_CTRL_PT_VAL_LEN - }, + [LNS_IDX_LOG_CTRL_PT_VAL] = {LNS_LOG_CTRL_PT_CHARACTERISTIC_UUID, + BLE_GATTS_INDICATE_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128), + LNS_LOG_CTRL_PT_VAL_LEN}, // Log Control Point Characteristic - Client Characteristic Configuration Descriptor - [LNS_IDX_LOG_CTRL_PT_IND_CFG] = {ATT_128_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, -}; - -/**@brief LNS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t lns_task_cbs = { - (prf_init_func_t) lns_init, - NULL, - NULL, -}; - -/**@brief LNS Task Callbacks. */ -static gatts_prf_cbs_t lns_cb_func = { - lns_read_att_cb, - lns_write_att_cb, - NULL, - lns_gatts_cplt_cb, - lns_cccd_set_cb -}; - -/**@brief LNS Information. */ -static const prf_server_info_t lns_prf_info = { - .max_connection_nb = LNS_CONNECTION_MAX, - .manager_cbs = &lns_task_cbs, - .gatts_prf_cbs = &lns_cb_func, + [LNS_IDX_LOG_CTRL_PT_IND_CFG] = {ATT_128_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Log Notification Service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t lns_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t lns_svc_uuid[] = {LNS_SERVICE_UUID}; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = lns_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_lns_char_mask; - gatts_db.max_nb_attr = LNS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = lns_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_lns_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -220,18 +153,19 @@ static sdk_err_t lns_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void lns_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void lns_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, - s_lns_env.start_hdl, - LNS_IDX_NB, - (uint8_t *)&s_lns_char_mask); + s_lns_env.start_hdl, + LNS_IDX_NB, + (uint8_t *)&s_lns_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case LNS_IDX_LOG_INFO_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_lns_env.log_info_ntf_cfg[conn_idx]; @@ -259,13 +193,13 @@ static void lns_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void lns_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; lns_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_lns_env.start_hdl, @@ -276,7 +210,8 @@ static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par event.evt_type = LNS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case LNS_IDX_LOG_INFO_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ @@ -293,8 +228,10 @@ static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par s_lns_env.log_ctrl_pt_ind_cfg[conn_idx] = cccd_value; break; - case LNS_IDX_LOG_CTRL_PT_VAL: { - switch (p_param->value[0]) { + case LNS_IDX_LOG_CTRL_PT_VAL: + { + switch (p_param->value[0]) + { case LNS_CTRL_PT_TRACE_STATUS_GET: event.evt_type = LNS_EVT_TRACE_STATUS_GET; break; @@ -311,7 +248,7 @@ static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par break; } } - break; + break; default: cfm.status = BLE_ATT_ERR_INVALID_HANDLE; @@ -320,7 +257,8 @@ static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && LNS_EVT_INVALID != event.evt_type) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && LNS_EVT_INVALID != event.evt_type) + { lns_evt_handler(&event); } } @@ -334,12 +272,13 @@ static void lns_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void lns_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void lns_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; lns_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -351,7 +290,8 @@ static void lns_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = LNS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case LNS_IDX_LOG_INFO_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ LNS_EVT_LOG_INFO_NTF_ENABLE : \ @@ -370,7 +310,8 @@ static void lns_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (LNS_EVT_INVALID != event.evt_type && s_lns_env.evt_handler) { + if (LNS_EVT_INVALID != event.evt_type && s_lns_env.evt_handler) + { s_lns_env.evt_handler(&event); } } @@ -383,7 +324,7 @@ static void lns_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_param: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void lns_gatts_cplt_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void lns_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { uint8_t tab_index; @@ -391,10 +332,15 @@ static void lns_gatts_cplt_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ s_lns_env.start_hdl, LNS_IDX_NB, (uint8_t *)&s_lns_char_mask); - if (LNS_IDX_LOG_INFO_VAL == tab_index) { - if (BLE_SUCCESS == status) { + + if (LNS_IDX_LOG_INFO_VAL == tab_index) + { + if (BLE_SUCCESS == status) + { lns_log_info_chunk(conn_idx); - } else { + } + else + { s_log_data_ntf.length = 0; s_log_data_ntf.offset = 0; @@ -414,7 +360,8 @@ static void lns_evt_handler(lns_evt_t *p_evt) { uint8_t trace_log_num = 0; - switch (p_evt->evt_type) { + switch (p_evt->evt_type) + { case LNS_EVT_TRACE_STATUS_GET: trace_log_num = fault_db_records_num_get(); lns_log_status_send(p_evt->conn_idx, trace_log_num); @@ -427,11 +374,10 @@ static void lns_evt_handler(lns_evt_t *p_evt) case LNS_EVT_TRACE_INFO_CLEAR: fault_db_record_clear(); break; - default : - break; } - if (LNS_EVT_INVALID != p_evt->evt_type && s_lns_env.evt_handler) { + if (LNS_EVT_INVALID != p_evt->evt_type && s_lns_env.evt_handler) + { s_lns_env.evt_handler(p_evt); } } @@ -449,12 +395,13 @@ static sdk_err_t lns_log_info_chunk(uint8_t conn_idx) { uint16_t chunk_len = 0; sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t data_ntf; + ble_gatts_noti_ind_t data_ntf; chunk_len = s_log_data_ntf.length - s_log_data_ntf.offset; chunk_len = chunk_len > s_lns_env.payload_len ? s_lns_env.payload_len : chunk_len; - if (chunk_len == 0) { + if (0 == chunk_len) + { s_log_data_ntf.length = 0; s_log_data_ntf.offset = 0; @@ -463,7 +410,8 @@ static sdk_err_t lns_log_info_chunk(uint8_t conn_idx) return SDK_SUCCESS; } - if (PRF_CLI_START_NTF == s_lns_env.log_info_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_lns_env.log_info_ntf_cfg[conn_idx]) + { data_ntf.type = BLE_GATT_NOTIFICATION; data_ntf.handle = prf_find_handle_by_idx(LNS_IDX_LOG_INFO_VAL, s_lns_env.start_hdl, @@ -474,13 +422,41 @@ static sdk_err_t lns_log_info_chunk(uint8_t conn_idx) error_code = ble_gatts_noti_ind(conn_idx, &data_ntf); } - if (SDK_SUCCESS == error_code) { + if (SDK_SUCCESS == error_code) + { s_log_data_ntf.offset += chunk_len; } return error_code; } +static void lns_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + lns_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + lns_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + lns_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + lns_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -489,8 +465,17 @@ sdk_err_t lns_service_init(lns_evt_handler_t evt_handler) { s_lns_env.evt_handler = evt_handler; s_lns_env.payload_len = LNS_DEFAULT_GATT_PAYLOAD; + s_lns_env.start_hdl = PRF_INVALID_HANDLE; - return ble_server_prf_add(&lns_prf_info); + s_lns_env.lns_gatts_db.shdl = &s_lns_env.start_hdl; + s_lns_env.lns_gatts_db.uuid = s_lns_svc_uuid; + s_lns_env.lns_gatts_db.attr_tab_cfg = (uint8_t *)&s_lns_char_mask; + s_lns_env.lns_gatts_db.max_nb_attr = LNS_IDX_NB; + s_lns_env.lns_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_lns_env.lns_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_lns_env.lns_gatts_db.attr_tab.attr_tab_128 = lns_attr_tab; + + return ble_gatts_prf_add(&s_lns_env.lns_gatts_db, lns_ble_evt_handler); } sdk_err_t lns_log_info_send(uint8_t conn_idx) @@ -499,9 +484,12 @@ sdk_err_t lns_log_info_send(uint8_t conn_idx) s_log_data_ntf.length = fault_db_records_total_len_get(); s_log_data_ntf.p_data = sys_malloc(s_log_data_ntf.length); - if (s_log_data_ntf.p_data) { + if (s_log_data_ntf.p_data) + { fault_db_records_dump(s_log_data_ntf.p_data, &s_log_data_ntf.length); - } else { + } + else + { return SDK_ERR_NO_RESOURCES; } @@ -511,13 +499,14 @@ sdk_err_t lns_log_info_send(uint8_t conn_idx) sdk_err_t lns_log_status_send(uint8_t conn_idx, const uint8_t log_num) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t status_ind; + ble_gatts_noti_ind_t status_ind; - if (PRF_CLI_START_IND == s_lns_env.log_ctrl_pt_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_lns_env.log_ctrl_pt_ind_cfg[conn_idx]) + { status_ind.type = BLE_GATT_INDICATION; status_ind.handle = prf_find_handle_by_idx(LNS_IDX_LOG_CTRL_PT_VAL, - s_lns_env.start_hdl, - (uint8_t *)&s_lns_char_mask); + s_lns_env.start_hdl, + (uint8_t *)&s_lns_char_mask); status_ind.length = LNS_LOG_CTRL_PT_VAL_LEN; status_ind.value = (uint8_t *)&log_num; @@ -529,9 +518,12 @@ sdk_err_t lns_log_status_send(uint8_t conn_idx, const uint8_t log_num) sdk_err_t lns_pay_load_update(uint8_t conn_idx, const uint16_t payload_len) { - if (s_lns_env.payload_len > LNS_LOG_INFO_VAL_LEN) { + if (s_lns_env.payload_len > LNS_LOG_INFO_VAL_LEN) + { s_lns_env.payload_len = LNS_LOG_INFO_VAL_LEN; - } else { + } + else + { s_lns_env.payload_len = payload_len; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.h index 2c845e8..bc24cc5 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/lns/lns.h @@ -45,35 +45,30 @@ * @{ * @brief Log Notification Service module. * - * @details The Log Notification Service shall expose the Log Info characteristic and - * the Log Control Point characteristic. + * @details The Log Notification Service shall expose the Log Info characteristic and the Log Control Point characteristic. * - * After \ref lns_init_t variable is intialized, the application - * must call \ref lns_service_init() to add Log Notification Service and - * Log Info and Log Control Point characteristics to the BLE Stack database. + * The application must call \ref lns_service_init() to add Log Notification Service and Log Info + * and Log Control Point characteristics to the BLE Stack database. */ #ifndef __LNS_H__ #define __LNS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "fault_trace.h" +#include +#include /** * @defgroup LNS_MACRO Defines * @{ */ -#define LNS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Log Notification \ - Service connections. */ -#define LNS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x01, 0x08, 0xED, 0xA6 /**< The UUID of Log Notification Service for \ - setting advertising data. */ -#define LNS_LOG_INFO_VAL_LEN 244 /**< Length of Log Information value. */ -#define LNS_LOG_CTRL_PT_VAL_LEN 1 /**< Length of Log Control Point value. */ +#define LNS_CONNECTION_MAX 10 /**< Maximum number of Log Notification Service connections. */ +#define LNS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x08, 0xED, 0xA6 /**< The UUID of Log Notification Service for setting advertising data. */ +#define LNS_LOG_INFO_VAL_LEN 244 /**< Length of Log Information value. */ +#define LNS_LOG_CTRL_PT_VAL_LEN 1 /**< Length of Log Control Point value. */ /** @} */ /** @@ -81,14 +76,16 @@ * @{ */ /**@brief Log Notification Service Control Point. */ -typedef enum { +typedef enum +{ LNS_CTRL_PT_TRACE_STATUS_GET = 0x01, /**< Get trace info status. */ LNS_CTRL_PT_TRACE_INFO_DUMP, /**< Dump saved trace info. */ LNS_CTRL_PT_TRACE_INFO_CLEAR, /**< Clear trace information. */ } lns_ctrl_pt_t; /**@brief Log Notification Service event type. */ -typedef enum { +typedef enum +{ LNS_EVT_INVALID, /**< Invalid lns event type. */ LNS_EVT_LOG_INFO_NTF_ENABLE, /**< Trace Information notification is enabled. */ LNS_EVT_LOG_INFO_NTF_DISABLE, /**< Trace Information notification is disabled. */ @@ -105,13 +102,15 @@ typedef enum { * @{ */ /**@brief Log Notification Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ lns_evt_type_t evt_type; /**< The lns event type. */ } lns_evt_t; /**@brief Log Information data. */ -typedef struct { +typedef struct +{ uint8_t *p_data; /**< Pointer to data. */ uint32_t length; /**< Length of data. */ uint32_t offset; /**< Offset of data. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/BUILD.gn new file mode 100644 index 0000000..3c2e5fe --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("mlmr") { + sources = [ "mlmr.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.c index 43cea0e..cb1c98d 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.c @@ -3,7 +3,7 @@ * * @file mlmr.c * - * @brief Goodix UART Service Implementation. + * @brief MLMR Service Implementation. * ***************************************************************************************** * @attention @@ -45,19 +45,15 @@ #include "utility.h" #include "user_app.h" #include "app_log.h" -#define MTU_DEF_OFFSET 3 -#define DATA_COPY_LEN 2 + /* * DEFINES ***************************************************************************************** */ -/**@brief The UUIDs of GUS characteristics. */ -#define GUS_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, - 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} -#define GUS_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, - 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} -#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, - 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} +/**@brief The UUIDs of MLMR characteristics. */ +#define MLMR_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} +#define MLMR_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} +#define MLMR_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -68,172 +64,97 @@ * ENUMERATIONS ***************************************************************************************** */ -/**@brief Goodix UART Service Attributes Indexes. */ -enum gus_attr_idx_t { - GUS_IDX_SVC, +/**@brief Multi Link Multi Role Service Attributes Indexes. */ +enum mlmr_attr_idx_t +{ + MLMR_IDX_SVC, + + MLMR_IDX_TX_CHAR, + MLMR_IDX_TX_VAL, + MLMR_IDX_TX_CFG, - GUS_IDX_TX_CHAR, - GUS_IDX_TX_VAL, - GUS_IDX_TX_CFG, + MLMR_IDX_RX_CHAR, + MLMR_IDX_RX_VAL, - GUS_IDX_RX_CHAR, - GUS_IDX_RX_VAL, + MLMR_IDX_FLOW_CTRL_CHAR, + MLMR_IDX_FLOW_CTRL_VAL, + MLMR_IDX_FLOW_CTRL_CFG, - GUS_IDX_FLOW_CTRL_CHAR, - GUS_IDX_FLOW_CTRL_VAL, - GUS_IDX_FLOW_CTRL_CFG, - - GUS_IDX_NB, + MLMR_IDX_NB, }; /* * STRUCTURES ***************************************************************************************** */ -/**@brief Goodix UART Service environment variable. */ -struct gus_env_t { - gus_init_t gus_init; /**< Goodix UART Service initialization variables. */ +/**@brief Multi Link Multi Role Service environment variable. */ +struct mlmr_env_t +{ + mlmr_init_t mlmr_init; /**< Multi Link Multi Role Service initialization variables. */ uint16_t start_hdl; /**< Start handle of services */ - uint16_t tx_ntf_cfg[GUS_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of - the peers. */ - uint16_t - flow_ctrl_ntf_cfg[GUS_CONNECTION_MAX]; /**< Flow Control Characteristic Notification configuration of the peers. */ + uint16_t tx_ntf_cfg[MLMR_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of the peers. */ + uint16_t flow_ctrl_ntf_cfg[MLMR_CONNECTION_MAX]; /**< Flow Control Characteristic Notification configuration of the peers. */ + ble_gatts_create_db_t mlmr_gatts_db; /**< Running Speed and Cadence Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t gus_init(void); -static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void gus_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct gus_env_t s_gus_env; +static struct mlmr_env_t s_mlmr_env; static const uint16_t s_char_mask = 0x003F; +static uint8_t s_mlmr_svc_uuid[] = {MLMR_SERVICE_UUID}; static uint16_t received_data_len[CFG_BOND_DEVS]; static uint16_t send_data_len[CFG_BOND_DEVS]; static uint8_t adv_header = 0xA0; static uint8_t rx_buffer[CFG_BOND_DEVS][516]; -/**@brief Full GUS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_128_t gus_att_db[GUS_IDX_NB] = { - // GUS service - [GUS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, +/**@brief Full MLMR Database Description which is used to add attributes into the ATT database. */ +static const ble_gatts_attm_desc_128_t mlmr_attr_tab[MLMR_IDX_NB] = +{ + // MLMR service + [MLMR_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, - // GUS TX Characteristic Declaration - [GUS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // GUS TX Characteristic Value - [GUS_IDX_TX_VAL] = { - GUS_SERVER_TX_UUID, - NOTIFY_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, - // GUS TX Characteristic - Client Characteristic Configuration Descriptor - [GUS_IDX_TX_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + // MLMR TX Characteristic Declaration + [MLMR_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + // MLMR TX Characteristic Value + [MLMR_IDX_TX_VAL] = {MLMR_SERVER_TX_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + MLMR_MAX_DATA_LEN}, + // MLMR TX Characteristic - Client Characteristic Configuration Descriptor + [MLMR_IDX_TX_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, - // GUS RX Characteristic Declaration - [GUS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // GUS RX Characteristic Value - [GUS_IDX_RX_VAL] = { - GUS_SERVER_RX_UUID, - WRITE_REQ_PERM_UNSEC | WRITE_CMD_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, + // MLMR RX Characteristic Declaration + [MLMR_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + // MLMR RX Characteristic Value + [MLMR_IDX_RX_VAL] = {MLMR_SERVER_RX_UUID, + BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_WRITE_CMD_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + MLMR_MAX_DATA_LEN}, - // GUS FLOW_CTRL Characteristic Declaration - [GUS_IDX_FLOW_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, - // GUS FLOW_CTRL Characteristic Value - [GUS_IDX_FLOW_CTRL_VAL] = { - GUS_FLOW_CTRL_UUID, - NOTIFY_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - GUS_MAX_DATA_LEN - }, - // GUS FLOW_CTRL Characteristic - Client Characteristic Configuration Descriptor - [GUS_IDX_FLOW_CTRL_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief GUS Service interface required by profile manager. */ -static ble_prf_manager_cbs_t gus_mgr_cbs = { - (prf_init_func_t)gus_init, - NULL, - NULL, -}; - -/**@brief GUS GATT Server Callbacks. */ -static gatts_prf_cbs_t gus_gatts_cbs = { - gus_read_att_cb, - gus_write_att_cb, - NULL, - gus_ntf_ind_cb, - gus_cccd_set_cb -}; - -/**@brief GUS Server Information. */ -static const prf_server_info_t gus_prf_info = { - .max_connection_nb = GUS_CONNECTION_MAX, - .manager_cbs = &gus_mgr_cbs, - .gatts_prf_cbs = &gus_gatts_cbs + // MLMR FLOW_CTRL Characteristic Declaration + [MLMR_IDX_FLOW_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, + // MLMR FLOW_CTRL Characteristic Value + [MLMR_IDX_FLOW_CTRL_VAL] = {MLMR_FLOW_CTRL_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + MLMR_MAX_DATA_LEN}, + // MLMR FLOW_CTRL Characteristic - Client Characteristic Configuration Descriptor + [MLMR_IDX_FLOW_CTRL_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize GUS and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t gus_init(void) -{ - const uint8_t gus_svc_uuid[] = {GUS_SERVICE_UUID}; - uint16_t start_hdl = PRF_INVALID_HANDLE; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = gus_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; - gatts_db.max_nb_attr = GUS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = gus_att_db; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_gus_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -242,26 +163,27 @@ static sdk_err_t gus_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void mlmr_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint16_t handle = p_param->handle; uint8_t tab_index = 0; - tab_index = prf_find_idx_by_handle(handle, s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); + tab_index = prf_find_idx_by_handle(handle, s_mlmr_env.start_hdl, MLMR_IDX_NB, (uint8_t *)&s_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { - case GUS_IDX_TX_CFG: + switch (tab_index) + { + case MLMR_IDX_TX_CFG: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)&s_gus_env.tx_ntf_cfg[conn_idx]; + cfm.value = (uint8_t *)&s_mlmr_env.tx_ntf_cfg[conn_idx]; cfm.status = BLE_SUCCESS; break; - case GUS_IDX_FLOW_CTRL_CFG: + case MLMR_IDX_FLOW_CTRL_CFG: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)&s_gus_env.flow_ctrl_ntf_cfg[conn_idx]; + cfm.value = (uint8_t *)&s_mlmr_env.flow_ctrl_ntf_cfg[conn_idx]; cfm.status = BLE_SUCCESS; break; @@ -274,18 +196,15 @@ static void gus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param ble_gatts_read_cfm(conn_idx, &cfm); } -void gus_combin_received_packet(uint8_t conn_idx, uint16_t length, uint8_t *p_received_data, uint8_t *p_combin_data) +void mlmr_combin_received_packet(uint8_t conn_idx, uint16_t length, uint8_t *p_received_data, uint8_t *p_combin_data) { uint8_t *buffer = p_combin_data; - uint8_t ret; - if (send_data_len[conn_idx] > received_data_len[conn_idx]) { + if(send_data_len[conn_idx] > received_data_len[conn_idx]) + { buffer += received_data_len[conn_idx]; - ret = memcpy_s(buffer, length, p_received_data, length); - if (ret < 0) { - return; - } - received_data_len[conn_idx] += length; + memcpy(buffer, p_received_data, length); + received_data_len[conn_idx] += length; } } @@ -297,68 +216,74 @@ void gus_combin_received_packet(uint8_t conn_idx, uint16_t length, uint8_t *p_re * @param[in] p_param: Point to the parameters of the write request. ***************************************************************************************** */ -static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void mlmr_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint16_t cccd_value; - gus_evt_t event; - gatts_write_cfm_t cfm; - uint8_t ret; + mlmr_evt_t event; + ble_gatts_write_cfm_t cfm; - tab_index = prf_find_idx_by_handle(handle, s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); + tab_index = prf_find_idx_by_handle(handle,s_mlmr_env.start_hdl, MLMR_IDX_NB, (uint8_t *)&s_char_mask); event.conn_idx = conn_idx; cfm.handle = handle; cfm.status = BLE_SUCCESS; - - switch (tab_index) { - case GUS_IDX_RX_VAL: - event.evt_type = GUS_EVT_RX_DATA_RECEIVED; - if (((uint8_t *)p_param->value)[0] == adv_header) { + + switch (tab_index) + { + case MLMR_IDX_RX_VAL: + event.evt_type = MLMR_EVT_RX_DATA_RECEIVED; + if(((uint8_t *)p_param->value)[0] == adv_header) + { uint16_t data_len; - ret = memcpy(&data_len, DATA_COPY_LEN, &(((uint8_t *)p_param->value)[1]), DATA_COPY_LEN); - if (ret < 0) { - return; - } + memcpy(&data_len, &(((uint8_t *)p_param->value)[1]), 2); + received_data_len[conn_idx] = 0; + memset(rx_buffer[conn_idx], 0, 516); - if (data_len <= (MAX_MTU_DEFUALT - MTU_DEF_OFFSET)) { + if(data_len <= (MAX_MTU_DEFUALT - 3)) + { event.p_data = (uint8_t *)p_param->value; event.length = p_param->length; - s_gus_env.gus_init.evt_handler(&event); - } else { + s_mlmr_env.mlmr_init.evt_handler(&event); + } + else + { send_data_len[conn_idx] = data_len; - gus_combin_received_packet(conn_idx, p_param->length, - (uint8_t *)p_param->value, rx_buffer[conn_idx]); - if (received_data_len[conn_idx] == send_data_len[conn_idx]) { + mlmr_combin_received_packet(conn_idx, p_param->length, (uint8_t *)p_param->value, rx_buffer[conn_idx]); + if(received_data_len[conn_idx] == send_data_len[conn_idx]) + { event.p_data = rx_buffer[conn_idx]; event.length = send_data_len[conn_idx]; - s_gus_env.gus_init.evt_handler(&event); + s_mlmr_env.mlmr_init.evt_handler(&event); received_data_len[conn_idx] = 0; } } - } else { - gus_combin_received_packet(conn_idx, p_param->length, (uint8_t *)p_param->value, rx_buffer[conn_idx]); - - if (received_data_len[conn_idx] == send_data_len[conn_idx]) { + } + else + { + mlmr_combin_received_packet(conn_idx, p_param->length, (uint8_t *)p_param->value, rx_buffer[conn_idx]); + + if(received_data_len[conn_idx] == send_data_len[conn_idx]) + { event.p_data = rx_buffer[conn_idx]; event.length = send_data_len[conn_idx]; - s_gus_env.gus_init.evt_handler(&event); + s_mlmr_env.mlmr_init.evt_handler(&event); received_data_len[conn_idx] = 0; } } break; - case GUS_IDX_TX_CFG: + case MLMR_IDX_TX_CFG: cccd_value = le16toh(&p_param->value[0]); - event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? GUS_EVT_TX_PORT_OPENED : GUS_EVT_TX_PORT_CLOSED; - s_gus_env.tx_ntf_cfg[conn_idx] = cccd_value; - s_gus_env.gus_init.evt_handler(&event); + event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? MLMR_EVT_TX_PORT_OPENED : MLMR_EVT_TX_PORT_CLOSED; + s_mlmr_env.tx_ntf_cfg[conn_idx] = cccd_value; + s_mlmr_env.mlmr_init.evt_handler(&event); break; default: cfm.status = BLE_ATT_ERR_INVALID_HANDLE; - s_gus_env.gus_init.evt_handler(&event); + s_mlmr_env.mlmr_init.evt_handler(&event); break; } @@ -374,36 +299,39 @@ static void gus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void mlmr_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; - gus_evt_t event; + mlmr_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } - tab_index = prf_find_idx_by_handle(handle, s_gus_env.start_hdl, GUS_IDX_NB, (uint8_t *)&s_char_mask); + tab_index = prf_find_idx_by_handle(handle,s_mlmr_env.start_hdl, MLMR_IDX_NB, (uint8_t *)&s_char_mask); event.conn_idx = conn_idx; - event.evt_type = GUS_EVT_INVALID; + event.evt_type = MLMR_EVT_INVALID; - switch (tab_index) { - case GUS_IDX_TX_CFG: - event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? GUS_EVT_TX_PORT_OPENED : GUS_EVT_TX_PORT_CLOSED; - s_gus_env.tx_ntf_cfg[conn_idx] = cccd_value; + switch (tab_index) + { + case MLMR_IDX_TX_CFG: + event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? MLMR_EVT_TX_PORT_OPENED : MLMR_EVT_TX_PORT_CLOSED; + s_mlmr_env.tx_ntf_cfg[conn_idx] = cccd_value; break; - case GUS_IDX_FLOW_CTRL_CFG: - event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? GUS_EVT_FLOW_CTRL_ENABLE : GUS_EVT_FLOW_CTRL_DISABLE; - s_gus_env.flow_ctrl_ntf_cfg[conn_idx] = cccd_value; + case MLMR_IDX_FLOW_CTRL_CFG: + event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? MLMR_EVT_FLOW_CTRL_ENABLE : MLMR_EVT_FLOW_CTRL_DISABLE; + s_mlmr_env.flow_ctrl_ntf_cfg[conn_idx] = cccd_value; break; default: break; } - if (GUS_EVT_INVALID != event.evt_type && s_gus_env.gus_init.evt_handler) { - s_gus_env.gus_init.evt_handler(&event); + if (MLMR_EVT_INVALID != event.evt_type && s_mlmr_env.mlmr_init.evt_handler) + { + s_mlmr_env.mlmr_init.evt_handler(&event); } } @@ -416,48 +344,83 @@ static void gus_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void gus_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void mlmr_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_gus_env.gus_init.evt_handler != NULL) { - gus_evt_t event; + if (NULL != s_mlmr_env.mlmr_init.evt_handler) + { + mlmr_evt_t event; event.conn_idx = conn_idx; - if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) { - event.evt_type = GUS_EVT_TX_DATA_SENT; - s_gus_env.gus_init.evt_handler(&event); + if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { + event.evt_type = MLMR_EVT_TX_DATA_SENT; + s_mlmr_env.mlmr_init.evt_handler(&event); } } } +static void mlmr_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + mlmr_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + mlmr_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + mlmr_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + mlmr_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ -sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) +sdk_err_t mlmr_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_cmd; + ble_gatts_noti_ind_t send_cmd; uint8_t *buffer = p_data; - if (PRF_CLI_START_NTF == s_gus_env.tx_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_mlmr_env.tx_ntf_cfg[conn_idx]) + { send_cmd.type = BLE_GATT_NOTIFICATION; - send_cmd.handle = prf_find_handle_by_idx(GUS_IDX_TX_VAL, s_gus_env.start_hdl, (uint8_t *)&s_char_mask); + send_cmd.handle = prf_find_handle_by_idx(MLMR_IDX_TX_VAL, s_mlmr_env.start_hdl, (uint8_t *)&s_char_mask); - if (length > (MAX_MTU_DEFUALT - MTU_DEF_OFFSET)) { - while length > MAX_MTU_DEFUALT - MTU_DEF_OFFSET) { + if(length > (MAX_MTU_DEFUALT - 3)) + { + while(length > MAX_MTU_DEFUALT - 3) + { send_cmd.value = buffer; - send_cmd.length = MAX_MTU_DEFUALT - MTU_DEF_OFFSET; + send_cmd.length = MAX_MTU_DEFUALT - 3; error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); - buffer += (MAX_MTU_DEFUALT - MTU_DEF_OFFSET); - length -= (MAX_MTU_DEFUALT - MTU_DEF_OFFSET); + buffer += (MAX_MTU_DEFUALT - 3); + length -= (MAX_MTU_DEFUALT - 3); } - - if (length != 0 && length < (MAX_MTU_DEFUALT - MTU_DEF_OFFSET)) { + + if(length != 0 && length < (MAX_MTU_DEFUALT - 3)) + { send_cmd.length = length; send_cmd.value = buffer; error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); } - } else { + } + else + { send_cmd.value = buffer; send_cmd.length = length; error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); @@ -467,15 +430,16 @@ sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) return error_code; } -sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) +sdk_err_t mlmr_rx_flow_ctrl_set(uint8_t conn_idx, mlmr_flow_ctrl_state_t flow_ctrl) { sdk_err_t error_code = BLE_SUCCESS; - gatts_noti_ind_t send_cmd; + ble_gatts_noti_ind_t send_cmd; - if (PRF_CLI_START_NTF == s_gus_env.flow_ctrl_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_mlmr_env.flow_ctrl_ntf_cfg[conn_idx]) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; - send_cmd.handle = prf_find_handle_by_idx(GUS_IDX_FLOW_CTRL_VAL, s_gus_env.start_hdl, (uint8_t *)&s_char_mask); + send_cmd.handle = prf_find_handle_by_idx(MLMR_IDX_FLOW_CTRL_VAL, s_mlmr_env.start_hdl, (uint8_t *)&s_char_mask); // Pack measured value in database send_cmd.length = 1; @@ -488,16 +452,24 @@ sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) return error_code; } -sdk_err_t gus_service_init(gus_init_t *p_gus_init) +sdk_err_t mlmr_service_init(mlmr_init_t *p_mlmr_init) { - sdk_err_t ret; - if (p_gus_init == NULL) { + if (NULL == p_mlmr_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_gus_env.gus_init, sizeof(gus_init_t), p_gus_init, sizeof(gus_init_t)); - if (ret < 0) { - return ret; - } - return ble_server_prf_add(&gus_prf_info); + memcpy(&s_mlmr_env.mlmr_init, p_mlmr_init, sizeof(mlmr_init_t)); + + s_mlmr_env.start_hdl = PRF_INVALID_HANDLE; + + s_mlmr_env.mlmr_gatts_db.shdl = &s_mlmr_env.start_hdl; + s_mlmr_env.mlmr_gatts_db.uuid = s_mlmr_svc_uuid; + s_mlmr_env.mlmr_gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_mlmr_env.mlmr_gatts_db.max_nb_attr = MLMR_IDX_NB; + s_mlmr_env.mlmr_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_mlmr_env.mlmr_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_mlmr_env.mlmr_gatts_db.attr_tab.attr_tab_128 = mlmr_attr_tab; + + return ble_gatts_prf_add(&s_mlmr_env.mlmr_gatts_db, mlmr_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.h index b878d8b..73fbca2 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr/mlmr.h @@ -3,7 +3,7 @@ * * @file mlmr.h * - * @brief Goodix UART Service API + * @brief Multi Link Multi Role Service API * ***************************************************************************************** * @attention @@ -42,109 +42,114 @@ */ /** - * @defgroup BLE_SDK_GUS Goodix UART Service (GUS) + * @defgroup BLE_SDK_MLMR Multi Link Multi Role Service (MLMR) * @{ - * @brief Definitions and prototypes for the GUS interface. + * @brief Definitions and prototypes for the MLMR interface. * - * @details The Goodix UART Service is a customized GATT-based service with Tx, Rx and Flow Control + * @details The Multi Link Multi Role Service is a customized GATT-based service with Tx, Rx and Flow Control * characteristics. The application uses the service to send and receive data to and * from the peer. The application data is sent to the peer as Handle Value Notification, * and the data received from the peer is transmitted with GATT Write Command. * - * After \ref gus_init_t variable is initialized , the application must call \ref gus_service_init() + * After \ref mlmr_init_t variable is initialized , the application must call \ref mlmr_service_init() * to add the Goodix Uart Service and Rx, Tx, Flow Control characteristics to the BLE Stack - * database. The application can send the data to the peer with \ref gus_tx_data_send() after - * \ref GUS_EVT_TX_PORT_OPENED received. The application should copy the received data to its own buffer - * when handling \ref GUS_EVT_RX_DATA_RECEIVED. + * database. The application can send the data to the peer with \ref mlmr_tx_data_send() after + * \ref MLMR_EVT_TX_PORT_OPENED received. The application should copy the received data to its own buffer + * when handling \ref MLMR_EVT_RX_DATA_RECEIVED. */ -#ifndef GUS_H -#define GUS_H +#ifndef __MLMR_H__ +#define __MLMR_H__ -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" /** - * @defgroup GUS_MACRO Defines + * @defgroup MLMR_MACRO Defines * @{ */ -#define GUS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Goodix UART Service connections. */ -#define FLOW_ON 0x01 /**< Indicate that GUS can receive data from peer. */ -#define FLOW_OFF 0x00 /**< Indicate that GUS can not receive data from peer. */ -#define GUS_MAX_DATA_LEN 247 /**< Maximum length of application data packet which is transmitted via GUS. */ -#define GUS_FLOW_CTRL_LEN 1 /**< Maximum length of ble flow control data packet which is transmitted via GUS. */ -#define GUS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, \ - 0xED, 0xA6 /**< The UUID of Goodix UART Service for setting advertising data. */ +#define MLMR_CONNECTION_MAX 10 /**< Maximum number of Multi Link Multi Role Service connections. */ +#define MLMR_MAX_DATA_LEN 247 /**< Maximum length of application data packet which is transmitted via MLMR. */ +#define MLMR_FLOW_CTRL_LEN 1 /**< Maximum length of ble flow control data packet which is transmitted via MLMR. */ +#define MLMR_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6 /**< The UUID of Multi Link Multi Role Service for setting advertising data. */ /** @} */ /** - * @defgroup GUS_ENUM Enumerations + * @defgroup MLMR_ENUM Enumerations * @{ */ -/**@brief Goodix UART Service event types. */ -typedef enum { - GUS_EVT_INVALID, /**< Invalid GUS event. */ - GUS_EVT_RX_DATA_RECEIVED, /**< The data from the peer has been received. */ - GUS_EVT_TX_DATA_SENT, /**< The data from the application has been sent, \ - and the service is ready to accept new data from the application. */ - GUS_EVT_TX_PORT_OPENED, /**< Tx port has been opened. */ - GUS_EVT_TX_PORT_CLOSED, /**< Tx port has been closed. */ - GUS_EVT_FLOW_CTRL_ENABLE, /**< GUS flow control been enabled. */ - GUS_EVT_FLOW_CTRL_DISABLE, /**< GUS flow control been disabled. */ - GUS_EVT_TX_FLOW_OFF, /**< Tx flow off control request. */ - GUS_EVT_TX_FLOW_ON, /**< Tx flow on control request. */ -} gus_evt_type_t; +/**@brief Multi Link Multi Role Service event types. */ +typedef enum +{ + MLMR_EVT_INVALID, /**< Invalid MLMR event. */ + MLMR_EVT_RX_DATA_RECEIVED, /**< The data from the peer has been received. */ + MLMR_EVT_TX_DATA_SENT, /**< The data from the application has been sent, and the service is ready to accept new data from the application. */ + MLMR_EVT_TX_PORT_OPENED, /**< Tx port has been opened. */ + MLMR_EVT_TX_PORT_CLOSED, /**< Tx port has been closed. */ + MLMR_EVT_FLOW_CTRL_ENABLE, /**< MLMR flow control been enabled. */ + MLMR_EVT_FLOW_CTRL_DISABLE, /**< MLMR flow control been disabled. */ + MLMR_EVT_TX_FLOW_OFF, /**< Tx flow off control request. */ + MLMR_EVT_TX_FLOW_ON, /**< Tx flow on control request. */ +} mlmr_evt_type_t; + +/**@brief Flow control state for MLMR service. */ +enum mlmr_flow_ctrl_state +{ + MLMR_FLOW_CTRL_STATE_OFF = 0, /**< Indicate that MLMR can not receive data from peer. */ + MLMR_FLOW_CTRL_STATE_ON /**< Indicate that MLMR can receive data from peer. */ +}; +/**@brief Underlying type used for the MLMR flow control state. */ +typedef uint8_t mlmr_flow_ctrl_state_t; /** @} */ /** - * @defgroup GUS_STRUCT Structures + * @defgroup MLMR_STRUCT Structures * @{ */ -/**@brief Goodix UART Service event. */ -typedef struct { - gus_evt_type_t evt_type; /**< The GUS event. */ +/**@brief Multi Link Multi Role Service event. */ +typedef struct +{ + mlmr_evt_type_t evt_type; /**< The MLMR event. */ uint8_t conn_idx; /**< The index of the connection for the data transmission. */ uint8_t *p_data; /**< Pointer to the buffer within received data. */ uint16_t length; /**< Length of received data. */ -} gus_evt_t; +} mlmr_evt_t; /** @} */ /** - * @defgroup GUS_TYPEDEF Typedefs + * @defgroup MLMR_TYPEDEF Typedefs * @{ */ -/**@brief Goodix UART Service event handler type. */ -typedef void (*gus_evt_handler_t)(gus_evt_t *p_evt); +/**@brief Multi Link Multi Role Service event handler type. */ +typedef void (*mlmr_evt_handler_t)(mlmr_evt_t *p_evt); /** @} */ /** - * @addtogroup GUS_STRUCT Structures + * @addtogroup MLMR_STRUCT Structures * @{ */ -/** @brief Goodix UART Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { - gus_evt_handler_t - evt_handler; /**< Goodix UART Service event handler which must be provided - by the application to send and receive the data. */ -} gus_init_t; +/**@brief Multi Link Multi Role Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ + mlmr_evt_handler_t evt_handler; /**< Multi Link Multi Role Service event handler which must be provided by the application to send and receive the data. */ +} mlmr_init_t; /** @} */ /** - * @defgroup GUS_FUNCTION Functions + * @defgroup MLMR_FUNCTION Functions * @{ */ /** ***************************************************************************************** - * @brief Initialize a Goodix UART Service instance and add in the database. + * @brief Initialize a Multi Link Multi Role Service instance and add in the database. * - * @param[in] p_gus_init: Pointer to Goodix UART Service initialization variables. + * @param[in] p_mlmr_init: Pointer to Multi Link Multi Role Service initialization variables. * * @return Result of service initialization. ***************************************************************************************** */ -sdk_err_t gus_service_init(gus_init_t *p_gus_init); +sdk_err_t mlmr_service_init(mlmr_init_t *p_mlmr_init); /** ***************************************************************************************** @@ -157,19 +162,19 @@ sdk_err_t gus_service_init(gus_init_t *p_gus_init); * @return Result of sending data. ***************************************************************************************** */ -sdk_err_t gus_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); +sdk_err_t mlmr_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); /** ***************************************************************************************** - * @brief Send GUS Rx flow control state to peer device + * @brief Send MLMR Rx flow control state to peer device * * @param[in] conn_idx: Index of the connection. - * @param[in] flow_ctrl: GUS Rx flow control state + * @param[in] flow_ctrl: MLMR Rx flow control state * - * @return Result of sending GUS Rx flow control state. + * @return Result of sending MLMR Rx flow control state. ***************************************************************************************** */ -sdk_err_t gus_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl); +sdk_err_t mlmr_rx_flow_ctrl_set(uint8_t conn_idx, mlmr_flow_ctrl_state_t flow_ctrl); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/BUILD.gn new file mode 100644 index 0000000..6a6f09b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("mlmr_c") { + sources = [ "mlmr_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.c index e0be6e8..511d4d9 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.c @@ -3,7 +3,7 @@ * * @file mlmr_c.c * - * @brief Goodix UART Client Implementation. + * @brief Multi Link Multi Role Client Implementation. * ***************************************************************************************** * @attention @@ -41,71 +41,35 @@ #include "mlmr_c.h" #include "user_app.h" #include "app_log.h" -#define DATA_COPY_LEN 2 -#define MAX_MTU_OFFSET 3 -#define UUID_LEN 16 -#define ATTR_LEN_DEF 2 - /* * STRUCT DEFINE ***************************************************************************************** */ -/**@brief Goodix UART Service Client environment variable. */ -struct gus_c_env_t { - gus_c_handles_t handles; /**< Handles of GUS characteristics which will be got for peer. */ - gus_c_evt_handler_t evt_handler; /**< Handler of GUS client event */ - uint8_t prf_id; /**< GUS Client profile id. */ +/**@brief Multi Link Multi Role Service Client environment variable. */ +struct mlmr_c_env_t +{ + mlmr_c_handles_t handles; /**< Handles of MLMR_C characteristics which will be got for peer. */ + mlmr_c_evt_handler_t evt_handler; /**< Handler of MLMR client event */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void gus_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void gus_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct gus_c_env_t s_gus_c_env; /**< GUS Client environment variable. */ -static uint8_t s_gus_uuid[16] = GUS_SVC_UUID; -static uint8_t s_gus_rx_char_uuid[16] = GUS_RX_CHAR_UUID; -static uint8_t s_gus_tx_char_uuid[16] = GUS_TX_CHAR_UUID; -static uint8_t s_gus_flow_ctrl_char_uuid[16] = GUS_FLOW_CTRL_UUID; +static struct mlmr_c_env_t s_mlmr_c_env; /**< MLMR Client environment variable. */ +static uint8_t s_mlmr_c_uuid[16] = MLMR_C_SVC_UUID; +static uint8_t s_mlmr_c_rx_char_uuid[16] = MLMR_C_RX_CHAR_UUID; +static uint8_t s_mlmr_c_tx_char_uuid[16] = MLMR_C_TX_CHAR_UUID; +static uint8_t s_mlmr_c_flow_ctrl_char_uuid[16] = MLMR_C_FLOW_CTRL_UUID; -static uint16_t received_data_len[CFG_BOND_DEVS]; -static uint16_t send_data_len[CFG_BOND_DEVS]; -static uint8_t adv_header = 0xA0; -static uint8_t rx_buffer[CFG_BOND_DEVS][516]; - - -/**@brief GUS Client interface required by profile manager. */ -static ble_prf_manager_cbs_t gus_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief GUS GATT Client Callbacks. */ -static gattc_prf_cbs_t gus_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - gus_c_att_write_cb, - gus_c_att_ntf_ind_cb, - gus_c_srvc_browse_cb, - NULL, -}; - -/**@brief GUS Client Information. */ -static const prf_client_info_t gus_c_prf_info = { - .max_connection_nb = GUS_C_CONNECTION_MAX, - .manager_cbs = &gus_c_mgr_cbs, - .gattc_prf_cbs = &gus_c_gattc_cbs +static uint16_t received_data_len[CFG_BOND_DEVS]; +static uint16_t send_data_len[CFG_BOND_DEVS]; +static uint8_t adv_header = 0xA0; +static uint8_t rx_buffer[CFG_BOND_DEVS][516]; +static ble_uuid_t s_mlmr_c_service_uuid = +{ + .uuid_len = 16, + .uuid = s_mlmr_c_uuid, }; /* @@ -114,15 +78,16 @@ static const prf_client_info_t gus_c_prf_info = { */ /** ***************************************************************************************** - * @brief Excute GUS Service Client event handler. + * @brief Excute MLMR Service Client event handler. * - * @param[in] p_evt: Pointer to GUS Service Client event structure. + * @param[in] p_evt: Pointer to MLMR Service Client event structure. ***************************************************************************************** */ -static void gus_c_evt_handler_excute(gus_c_evt_t *p_evt) +static void mlmr_c_evt_handler_excute(mlmr_c_evt_t *p_evt) { - if (s_gus_c_env.evt_handler != NULL && GUS_C_EVT_INVALID != p_evt->evt_type) { - s_gus_c_env.evt_handler(p_evt); + if (NULL != s_mlmr_c_env.evt_handler && MLMR_C_EVT_INVALID != p_evt->evt_type) + { + s_mlmr_c_env.evt_handler(p_evt); } } @@ -135,45 +100,49 @@ static void gus_c_evt_handler_excute(gus_c_evt_t *p_evt) * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void gus_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void mlmr_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { - gus_c_evt_t gus_c_evt; + mlmr_c_evt_t mlmr_c_evt; - gus_c_evt.conn_idx = conn_idx; - gus_c_evt.evt_type = GUS_C_EVT_INVALID; + mlmr_c_evt.conn_idx = conn_idx; + mlmr_c_evt.evt_type = MLMR_C_EVT_INVALID; - if (handle == s_gus_c_env.handles.gus_tx_cccd_handle) { - gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_TX_NTF_SET_SUCCESS : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) { - gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_rx_handle) { - gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_TX_CPLT : \ - GUS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_gus_c_env.handles.gus_flow_ctrl_handle) { - gus_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - GUS_C_EVT_RX_FLOW_UPDATE_CPLT : \ - GUS_C_EVT_WRITE_OP_ERR; + if (handle == s_mlmr_c_env.handles.mlmr_c_tx_cccd_handle) + { + mlmr_c_evt.evt_type = (BLE_SUCCESS == status) ? \ + MLMR_C_EVT_TX_NTF_SET_SUCCESS : \ + MLMR_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_mlmr_c_env.handles.mlmr_c_flow_ctrl_cccd_handle) + { + mlmr_c_evt.evt_type = (BLE_SUCCESS == status) ? \ + MLMR_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS : \ + MLMR_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_mlmr_c_env.handles.mlmr_c_rx_handle) + { + mlmr_c_evt.evt_type = (BLE_SUCCESS == status) ? \ + MLMR_C_EVT_TX_CPLT : \ + MLMR_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_mlmr_c_env.handles.mlmr_c_flow_ctrl_handle) + { + mlmr_c_evt.evt_type = (BLE_SUCCESS == status) ? \ + MLMR_C_EVT_RX_FLOW_UPDATE_CPLT : \ + MLMR_C_EVT_WRITE_OP_ERR; } - gus_c_evt_handler_excute(&gus_c_evt); + mlmr_c_evt_handler_excute(&mlmr_c_evt); } void combin_received_packet(uint8_t conn_idx, uint16_t length, uint8_t *p_received_data, uint8_t *p_combin_data) { uint8_t *buffer = p_combin_data; - uint8_t ret; - if (send_data_len[conn_idx] > received_data_len[conn_idx]) { + if(send_data_len[conn_idx] > received_data_len[conn_idx]) + { buffer += received_data_len[conn_idx]; - ret = memcpy_s(buffer, length, p_received_data, length); - if (ret < 0) { - return; - } + memcpy(buffer, p_received_data,length); received_data_len[conn_idx] += length; } } @@ -187,50 +156,62 @@ void combin_received_packet(uint8_t conn_idx, uint16_t length, uint8_t *p_receiv * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void mlmr_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { - gus_c_evt_t gus_c_evt; - uint8_t ret; - uint16_t data_length; + mlmr_c_evt_t mlmr_c_evt; - gus_c_evt.conn_idx = conn_idx; - gus_c_evt.evt_type = GUS_C_EVT_INVALID; + mlmr_c_evt.conn_idx = conn_idx; + mlmr_c_evt.evt_type = MLMR_C_EVT_INVALID; - if (p_ntf_ind->handle == s_gus_c_env.handles.gus_flow_ctrl_handle) { - if (FLOW_ON == p_ntf_ind->p_value[0]) { - gus_c_evt.evt_type = GUS_C_EVT_TX_FLOW_ON; - } else if (FLOW_OFF == p_ntf_ind->p_value[0]) { - gus_c_evt.evt_type = GUS_C_EVT_TX_FLOW_OFF; + if (p_ntf_ind->handle == s_mlmr_c_env.handles.mlmr_c_flow_ctrl_handle) + { + if (MLMR_C_FLOW_CTRL_STATE_ON == p_ntf_ind->p_value[0]) + { + mlmr_c_evt.evt_type = MLMR_C_EVT_TX_FLOW_ON; } - } else if (p_ntf_ind->handle == s_gus_c_env.handles.gus_tx_handle) { - gus_c_evt.evt_type = GUS_C_EVT_PEER_DATA_RECEIVE; - if (p_ntf_ind->p_value[0] == adv_header) { - ret = memcpy_s(&data_length, DATA_COPY_LEN, - sizeof(&(((uint8_t *)p_ntf_ind->p_value)[1]), DATA_COPY_LEN); - if (ret <0) { - return; + else if (MLMR_C_FLOW_CTRL_STATE_OFF == p_ntf_ind->p_value[0]) + { + mlmr_c_evt.evt_type = MLMR_C_EVT_TX_FLOW_OFF; + } + } + else if (p_ntf_ind->handle == s_mlmr_c_env.handles.mlmr_c_tx_handle) + { + mlmr_c_evt.evt_type = MLMR_C_EVT_PEER_DATA_RECEIVE; + if(p_ntf_ind->p_value[0] == adv_header) + { + uint16_t data_length; + memcpy(&data_length, &(((uint8_t *)p_ntf_ind->p_value)[1]), 2); + received_data_len[conn_idx] = 0; + memset(rx_buffer[conn_idx], 0, 516); + + if(data_length <= (MAX_MTU_DEFUALT - 3)) + { + mlmr_c_evt.evt_type = MLMR_C_EVT_PEER_DATA_RECEIVE; + mlmr_c_evt.p_data = p_ntf_ind->p_value; + mlmr_c_evt.length = p_ntf_ind->length; + mlmr_c_evt_handler_excute(&mlmr_c_evt); } - if (data_length <= (MAX_MTU_DEFUALT - MAX_MTU_OFFSET)) { - gus_c_evt.evt_type = GUS_C_EVT_PEER_DATA_RECEIVE; - gus_c_evt.p_data = p_ntf_ind->p_value; - gus_c_evt.length = p_ntf_ind->length; - gus_c_evt_handler_excute(&gus_c_evt); - } else { + else + { send_data_len[conn_idx] = data_length; combin_received_packet(conn_idx, p_ntf_ind->length, p_ntf_ind->p_value, rx_buffer[conn_idx]); - if (received_data_len[conn_idx] == send_data_len[conn_idx]) { - gus_c_evt.p_data = rx_buffer[conn_idx]; - gus_c_evt.length = send_data_len[conn_idx]; - gus_c_evt_handler_excute(&gus_c_evt); + if(received_data_len[conn_idx] == send_data_len[conn_idx]) + { + mlmr_c_evt.p_data = rx_buffer[conn_idx]; + mlmr_c_evt.length = send_data_len[conn_idx]; + mlmr_c_evt_handler_excute(&mlmr_c_evt); received_data_len[conn_idx] = 0; } } - } else { + } + else + { combin_received_packet(conn_idx, p_ntf_ind->length, p_ntf_ind->p_value, rx_buffer[conn_idx]); - if (received_data_len[conn_idx] == send_data_len[conn_idx]) { - gus_c_evt.p_data = rx_buffer[conn_idx]; - gus_c_evt.length = send_data_len[conn_idx]; - gus_c_evt_handler_excute(&gus_c_evt); + if(received_data_len[conn_idx] == send_data_len[conn_idx]) + { + mlmr_c_evt.p_data = rx_buffer[conn_idx]; + mlmr_c_evt.length = send_data_len[conn_idx]; + mlmr_c_evt_handler_excute(&mlmr_c_evt); received_data_len[conn_idx] = 0; } } @@ -246,167 +227,173 @@ static void gus_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void gus_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void mlmr_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { - gus_c_evt_t gus_c_evt; + mlmr_c_evt_t mlmr_c_evt; uint16_t handle_disc; - gus_c_evt.conn_idx = conn_idx; - gus_c_evt.evt_type = GUS_C_EVT_DISCOVERY_FAIL; + mlmr_c_evt.conn_idx = conn_idx; + mlmr_c_evt.evt_type = MLMR_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (BLE_SUCCESS == status) { - if (p_browse_srvc->uuid_len == UUID_LEN && - memcmp(p_browse_srvc->uuid, s_gus_uuid, UUID_LEN) == 0) { - s_gus_c_env.handles.gus_srvc_start_handle = p_browse_srvc->start_hdl; - s_gus_c_env.handles.gus_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_SUCCESS == status) + { + if (16 == p_browse_srvc->uuid_len && 0 == memcmp(p_browse_srvc->uuid, s_mlmr_c_uuid, 16)) + { + s_mlmr_c_env.handles.mlmr_c_srvc_start_handle = p_browse_srvc->start_hdl; + s_mlmr_c_env.handles.mlmr_c_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_rx_char_uuid, UUID_LEN) == 0) { - s_gus_c_env.handles.gus_rx_handle = handle_disc; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_tx_char_uuid, UUID_LEN) == 0) { - s_gus_c_env.handles.gus_tx_handle = handle_disc; - s_gus_c_env.handles.gus_tx_cccd_handle = handle_disc + 1; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_gus_flow_ctrl_char_uuid, UUID_LEN) == 0) { - s_gus_c_env.handles.gus_flow_ctrl_handle = handle_disc; - s_gus_c_env.handles.gus_flow_ctrl_cccd_handle = handle_disc + 1; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_mlmr_c_rx_char_uuid, 16)) + { + s_mlmr_c_env.handles.mlmr_c_rx_handle = handle_disc; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_mlmr_c_tx_char_uuid, 16)) + { + s_mlmr_c_env.handles.mlmr_c_tx_handle = handle_disc; + s_mlmr_c_env.handles.mlmr_c_tx_cccd_handle = handle_disc + 1; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_mlmr_c_flow_ctrl_char_uuid, 16)) + { + s_mlmr_c_env.handles.mlmr_c_flow_ctrl_handle = handle_disc; + s_mlmr_c_env.handles.mlmr_c_flow_ctrl_cccd_handle = handle_disc + 1; } } - - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { + + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { break; } } - gus_c_evt.evt_type = GUS_C_EVT_DISCOVERY_COMPLETE; + mlmr_c_evt.evt_type = MLMR_C_EVT_DISCOVERY_COMPLETE; } } - gus_c_evt_handler_excute(&gus_c_evt); + mlmr_c_evt_handler_excute(&mlmr_c_evt); +} + +static void mlmr_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + mlmr_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + mlmr_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + mlmr_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } } /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ -sdk_err_t gus_client_init(gus_c_evt_handler_t evt_handler) +sdk_err_t mlmr_client_init(mlmr_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_gus_c_env, sizeof(s_gus_c_env), 0, sizeof(s_gus_c_env)); - if (ret < 0) { - return ret; - } - s_gus_c_env.evt_handler = evt_handler; + memset(&s_mlmr_c_env, 0, sizeof(s_mlmr_c_env)); + s_mlmr_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&gus_c_prf_info, &s_gus_c_env.prf_id); + return ble_gattc_prf_add(&s_mlmr_c_service_uuid, mlmr_c_ble_evt_handler); } -sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx) +sdk_err_t mlmr_c_disc_srvc_start(uint8_t conn_idx) { - const ble_uuid_t gus_uuid = { - .uuid_len = 16, - .uuid = s_gus_uuid, - }; - - return ble_gattc_prf_services_browse(s_gus_c_env.prf_id, conn_idx, &gus_uuid); + return ble_gattc_services_browse(conn_idx, &s_mlmr_c_service_uuid); } -sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable) +sdk_err_t mlmr_c_tx_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_tx_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_mlmr_c_env.handles.mlmr_c_tx_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_tx_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_LEN_DEF; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_mlmr_c_env.handles.mlmr_c_tx_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } -sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable) +sdk_err_t mlmr_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_mlmr_c_env.handles.mlmr_c_flow_ctrl_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_flow_ctrl_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_LEN_DEF; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_mlmr_c_env.handles.mlmr_c_flow_ctrl_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } -sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) +sdk_err_t mlmr_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code; uint8_t *buffer = p_data; - gattc_write_no_resp_t write_attr_value; - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_rx_handle) { + if (BLE_ATT_INVALID_HDL == s_mlmr_c_env.handles.mlmr_c_rx_handle) + { return SDK_ERR_INVALID_HANDLE; } - if (p_data == NULL) { + if (NULL == p_data) + { return SDK_ERR_POINTER_NULL; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_gus_c_env.handles.gus_rx_handle; - - if (length > (MAX_MTU_DEFUALT - MAX_MTU_OFFSET)) { - while (length > MAX_MTU_DEFUALT - MAX_MTU_OFFSET) { - write_attr_value.p_value = buffer; - write_attr_value.length = MAX_MTU_DEFUALT - MAX_MTU_OFFSET; - error_code = ble_gattc_prf_write_no_resp(s_gus_c_env.prf_id, conn_idx, &write_attr_value); - buffer += (MAX_MTU_DEFUALT - MAX_MTU_OFFSET); - length -= (MAX_MTU_DEFUALT - MAX_MTU_OFFSET); + if(length > (MAX_MTU_DEFUALT - 3)) + { + while(length > MAX_MTU_DEFUALT - 3) + { + error_code = ble_gattc_write_no_resp(conn_idx, false, s_mlmr_c_env.handles.mlmr_c_rx_handle, MAX_MTU_DEFUALT - 3, buffer); + buffer += (MAX_MTU_DEFUALT - 3); + length -= (MAX_MTU_DEFUALT - 3); } - - if (length != 0 && length < (MAX_MTU_DEFUALT - MAX_MTU_OFFSET)) { - write_attr_value.length = length; - write_attr_value.p_value = buffer; - error_code = ble_gattc_prf_write_no_resp(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + + if(length != 0 && length < (MAX_MTU_DEFUALT - 3)) + { + error_code = ble_gattc_write_no_resp(conn_idx, false, s_mlmr_c_env.handles.mlmr_c_rx_handle, length, buffer); } - } else { - write_attr_value.p_value = buffer; - write_attr_value.length = length; - error_code = ble_gattc_prf_write_no_resp(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + } + else + { + error_code = ble_gattc_write_no_resp(conn_idx, false, s_mlmr_c_env.handles.mlmr_c_rx_handle, length, buffer); } return error_code; } -sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl) +sdk_err_t mlmr_c_rx_flow_ctrl_set(uint8_t conn_idx, mlmr_c_flow_ctrl_state_t flow_ctrl) { - gattc_write_attr_value_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_gus_c_env.handles.gus_flow_ctrl_handle) { + if (BLE_ATT_INVALID_HDL == s_mlmr_c_env.handles.mlmr_c_flow_ctrl_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_gus_c_env.handles.gus_flow_ctrl_handle; - write_attr_value.offset = 0; - write_attr_value.length = 1; - write_attr_value.p_value = &flow_ctrl; - - return ble_gattc_prf_write(s_gus_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_mlmr_c_env.handles.mlmr_c_flow_ctrl_handle, 0, 1, &flow_ctrl); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.h index 12e1c0c..7096dd8 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/mlmr_c/mlmr_c.h @@ -3,7 +3,7 @@ * * @file mlmr_c.h * - * @brief Header file - Goodix UART Service Client + * @brief Header file - Multi Link Multi Role Service Client * ***************************************************************************************** * @attention @@ -42,136 +42,143 @@ */ /** - * @defgroup BLE_SDK_GUS_C Goodix UART Service Client (GUS_C) + * @defgroup BLE_SDK_MLMR_C Multi Link Multi Role Service Client (MLMR_C) * @{ - * @brief Goodix UART Service Client module. + * @brief Multi Link Multi Role Service Client module. * - * @details The Goodix Uart Service Client contains the APIs and types, which can be used by the - * application to perform scanning, connection and discover Goodix Uart Service at + * @details The Multi Link Multi Role Service Client contains the APIs and types, which can be used by the + * application to perform scanning, connection and discover Multi Link Multi Role Service at * peer and interact with it. * - * The application must provide an event handler, then call \ref gus_client_init(). After the - * module can send and receive BLE data, application can call \ref gus_c_tx_data_send() to - * send data to peer, and receive data from peer \ref GUS_C_EVT_PEER_DATA_RECEIVE, - * meanwhile update its received BLE data state \ref gus_c_rx_flow_ctrl_set() to peer. + * The application must provide an event handler, then call \ref mlmr_client_init(). After the + * module can send and receive BLE data, application can call \ref mlmr_c_tx_data_send() to + * send data to peer, and receive data from peer \ref MLMR_C_EVT_PEER_DATA_RECEIVE, + * meanwhile update its received BLE data state \ref mlmr_c_rx_flow_ctrl_set() to peer. */ -#ifndef GUS_C_H -#define GUS_C_H +#ifndef __MLMR_C_H__ +#define __MLMR_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** - * @defgroup GUS_C_MACRO Defines + * @defgroup MLMR_C_MACRO Defines * @{ */ -#define GUS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of GUS Client connections. */ -#define FLOW_ON 0x01 /**< Indicate that GUS Client can receive data from peer. */ -#define FLOW_OFF 0x00 /**< Indicate that GUS Client can not receive data from peer. */ +#define MLMR_C_CONNECTION_MAX 10 /**< Maximum number of MLMR Client connections. */ /** - * @defgroup GUS_UUID Service and Characteristics UUID + * @defgroup MLMR_C_UUID Service and Characteristics UUID * @{ */ -#define GUS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, \ - 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6} /**< UUID of GUS Service. */ -#define GUS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, \ - 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} /**< UUID of GUS Tx characterisitc. */ -#define GUS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, \ - 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} /**< UUID of GUS Rx characterisitc. */ -#define GUS_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, \ - 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**< UUID of GUS Flow Control characterisitc. */ +#define MLMR_C_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x02, 0xED, 0xA6} /**< UUID of MLMR_C Service. */ +#define MLMR_C_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x02, 0xED, 0xA6} /**< UUID of MLMR_C Tx characterisitc. */ +#define MLMR_C_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x02, 0xED, 0xA6} /**< UUID of MLMR_C Rx characterisitc. */ +#define MLMR_C_FLOW_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x02, 0xED, 0xA6} /**< UUID of MLMR_C Flow Control characterisitc. */ /** @} */ /** @} */ /** - * @defgroup GUS_C_ENUM Enumerations + * @defgroup MLMR_C_ENUM Enumerations * @{ */ -/**@brief Goodix UART Service Client event type. */ -typedef enum { - GUS_C_EVT_INVALID, /**< Invalid GUS Client event. */ - GUS_C_EVT_DISCOVERY_COMPLETE, /**< GUS Client has found service and its characteristics at peer. */ - GUS_C_EVT_DISCOVERY_FAIL, /**< GUS Client found THS service failed because of invalid operation \ - or no found at peer. */ - GUS_C_EVT_TX_NTF_SET_SUCCESS, /**< GUS Client has set peer Tx notify. */ - GUS_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS, /**< GUS Client has set peer ble flow control notify. */ - GUS_C_EVT_PEER_DATA_RECEIVE, /**< GUS Client has received something from peer. */ - GUS_C_EVT_TX_CPLT, /**< GUS Client has sent something to peer successfully. */ - GUS_C_EVT_TX_FLOW_OFF, /**< GUS Client has received Tx flow off control request from peer. */ - GUS_C_EVT_TX_FLOW_ON, /**< GUS Client has received Tx flow on control request from peer. */ - GUS_C_EVT_RX_FLOW_UPDATE_CPLT, /**< GUS CLient has updated flow control to peer completely. */ - GUS_C_EVT_WRITE_OP_ERR, /**< Error occured when GUS Client wrote to peer. */ -} gus_c_evt_type_t; +/**@brief Multi Link Multi Role Service Client event type. */ +typedef enum +{ + MLMR_C_EVT_INVALID, /**< Invalid MLMR Client event. */ + MLMR_C_EVT_DISCOVERY_COMPLETE, /**< MLMR Client has found service and its characteristics at peer. */ + MLMR_C_EVT_DISCOVERY_FAIL, /**< MLMR Client found the service failed because of invalid operation or no found at peer. */ + MLMR_C_EVT_TX_NTF_SET_SUCCESS, /**< MLMR Client has set peer Tx notify. */ + MLMR_C_EVT_FLOW_CTRL_NTF_SET_SUCCESS, /**< MLMR Client has set peer ble flow control notify. */ + MLMR_C_EVT_PEER_DATA_RECEIVE, /**< MLMR Client has received something from peer. */ + MLMR_C_EVT_TX_CPLT, /**< MLMR Client has sent something to peer successfully. */ + MLMR_C_EVT_TX_FLOW_OFF, /**< MLMR Client has received Tx flow off control request from peer. */ + MLMR_C_EVT_TX_FLOW_ON, /**< MLMR Client has received Tx flow on control request from peer. */ + MLMR_C_EVT_RX_FLOW_UPDATE_CPLT, /**< MLMR CLient has updated flow control to peer completely. */ + MLMR_C_EVT_WRITE_OP_ERR, /**< Error occured when MLMR Client wrote to peer. */ +} mlmr_c_evt_type_t; + +/**@brief Flow control state for MLMR Client service. */ +enum mlmr_c_flow_ctrl_state +{ + MLMR_C_FLOW_CTRL_STATE_OFF = 0, /**< Indicate that MLMR Client can not receive data from peer. */ + MLMR_C_FLOW_CTRL_STATE_ON /**< Indicate that MLMR Client can receive data from peer. */ +}; +/**@brief Underlying type used for the MLMR Client flow control state. */ +typedef uint8_t mlmr_c_flow_ctrl_state_t; /** @} */ /** - * @defgroup GUS_C_STRUCT Structures + * @defgroup MLMR_C_STRUCT Structures * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { - uint16_t gus_srvc_start_handle; /**< GUS Service start handle. */ - uint16_t gus_srvc_end_handle; /**< GUS Service end handle. */ - uint16_t gus_tx_handle; /**< Handle of GUS Tx characteristic as provided by a discovery. */ - uint16_t gus_tx_cccd_handle; /**< Handle of CCCD of GUS Tx characteristic as provided by a discovery. */ - uint16_t gus_rx_handle; /**< Handle of GUS Rx characteristic as provided by a discovery. */ - uint16_t gus_flow_ctrl_handle; /**< Handle of GUS Flow Control characteristic as provided by a discovery. */ - uint16_t gus_flow_ctrl_cccd_handle; /**< Handle of CCCD of GUS Flow Control characteristic \ - as provided by a discovery. */ -} gus_c_handles_t; +typedef struct +{ + uint16_t mlmr_c_srvc_start_handle; /**< MLMR_C Service start handle. */ + uint16_t mlmr_c_srvc_end_handle; /**< MLMR_C Service end handle. */ + uint16_t mlmr_c_tx_handle; /**< Handle of MLMR_C Tx characteristic as provided by a discovery. */ + uint16_t mlmr_c_tx_cccd_handle; /**< Handle of CCCD of MLMR_C Tx characteristic as provided by a discovery. */ + uint16_t mlmr_c_rx_handle; /**< Handle of MLMR_C Rx characteristic as provided by a discovery. */ + uint16_t mlmr_c_flow_ctrl_handle; /**< Handle of MLMR_C Flow Control characteristic as provided by a discovery. */ + uint16_t mlmr_c_flow_ctrl_cccd_handle; /**< Handle of CCCD of MLMR_C Flow Control characteristic as provided by a discovery. */ +} mlmr_c_handles_t; -/**@brief Goodix UART Service Client event. */ -typedef struct { - uint8_t conn_idx; /**< Connection index. */ - gus_c_evt_type_t evt_type; /**< GUS Client event type. */ - uint16_t length; /**< Length of event data. */ - uint8_t *p_data; /**< Pointer to event data. */ -} gus_c_evt_t; +/**@brief Multi Link Multi Role Service Client event. */ +typedef struct +{ + uint8_t conn_idx; /**< Connection index. */ + mlmr_c_evt_type_t evt_type; /**< MLMR Client event type. */ + uint16_t length; /**< Length of event data. */ + uint8_t *p_data; /**< Pointer to event data. */ +} mlmr_c_evt_t; /** @} */ /** - * @defgroup GUS_C_TYPEDEF Typedefs + * @defgroup MLMR_C_TYPEDEF Typedefs * @{ */ -/**@brief Goodix UART Service Client event handler type. */ -typedef void (* gus_c_evt_handler_t)(gus_c_evt_t *p_evt); +/**@brief Multi Link Multi Role Service Client event handler type. */ +typedef void (* mlmr_c_evt_handler_t)(mlmr_c_evt_t *p_evt); /** @} */ /** - * @defgroup GUS_C_FUNCTION Functions + * @defgroup MLMR_C_FUNCTION Functions * @{ */ /** ***************************************************************************************** - * @brief Register GUS Client event handler. + * @brief Register MLMR Client event handler. * - * @param[in] evt_handler: Goodix UART Service Client event handler. + * @param[in] evt_handler: Multi Link Multi Role Service Client event handler. * * @return Result of initialization. ***************************************************************************************** */ -sdk_err_t gus_client_init(gus_c_evt_handler_t evt_handler); +sdk_err_t mlmr_client_init(mlmr_c_evt_handler_t evt_handler); /** ***************************************************************************************** - * @brief Discovery GUS on peer. + * @brief Discovery MLMR_C on peer. * * @param[in] conn_idx: Index of connection. * * @return Operation result. ***************************************************************************************** */ -sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx); +sdk_err_t mlmr_c_disc_srvc_start(uint8_t conn_idx); /** ***************************************************************************************** - * @brief Enable or disable peer GUS Tx characteristic notify. + * @brief Enable or disable peer MLMR_C Tx characteristic notify. * * @param[in] conn_idx: Connection index. * @param[in] is_enable: Enable or disable ths Tx notify. @@ -179,11 +186,11 @@ sdk_err_t gus_c_disc_srvc_start(uint8_t conn_idx); * @return Operation result. ***************************************************************************************** */ -sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable); +sdk_err_t mlmr_c_tx_notify_set(uint8_t conn_idx, bool is_enable); /** ***************************************************************************************** - * @brief Enable or disable peer device GUS flow control notify. + * @brief Enable or disable peer device MLMR_C flow control notify. * * @param[in] conn_idx: Connection index. * @param[in] is_enable: Enable or disable ths Tx notify. @@ -191,7 +198,7 @@ sdk_err_t gus_c_tx_notify_set(uint8_t conn_idx, bool is_enable); * @return Operation result. ***************************************************************************************** */ -sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable); +sdk_err_t mlmr_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable); /** ***************************************************************************************** @@ -204,19 +211,19 @@ sdk_err_t gus_c_flow_ctrl_notify_set(uint8_t conn_idx, bool is_enable); * @return Operation result. ***************************************************************************************** */ -sdk_err_t gus_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); +sdk_err_t mlmr_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length); /** ***************************************************************************************** - * @brief Send GUS Client Rx flow control state to peer device + * @brief Send MLMR Client Rx flow control state to peer device * * @param[in] conn_idx: Connection index. - * @param[in] flow_ctrl: GUS client Rx flow control state. + * @param[in] flow_ctrl: MLMR client Rx flow control state. * - * @return Result of sending gus_c Rx flow control state. + * @return Result of sending mlmr_c Rx flow control state. ***************************************************************************************** */ -sdk_err_t gus_c_rx_flow_ctrl_set(uint8_t conn_idx, uint8_t flow_ctrl); +sdk_err_t mlmr_c_rx_flow_ctrl_set(uint8_t conn_idx, mlmr_c_flow_ctrl_state_t flow_ctrl); /** @} */ #endif /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/BUILD.gn new file mode 100644 index 0000000..a0d5223 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ndcs") { + sources = [ "ndcs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.c index 183786e..a5c83d5 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.c @@ -44,13 +44,13 @@ #include "ble_prf_utils.h" #include "utility.h" -#define INDEX_7 7 /* * ENUMERATIONS **************************************************************************************** */ /**@brief Next DST Change Service Attributes Indexes. */ -enum { +enum +{ // Next DST Change Service NDCS_IDX_SVC, @@ -66,103 +66,45 @@ enum { ***************************************************************************************** */ /**@brief Next DST Change Service environment variable. */ -struct ndcs_env_t { - uint16_t char_mask; /**< Mask of supported characteristics. */ - uint16_t start_hdl; /**< Next DST Change Service start handle. */ - ndcs_time_dst_t time_with_dst; /**< Time with DST value. */ +struct ndcs_env_t +{ + uint16_t char_mask; /**< Mask of supported characteristics. */ + uint16_t start_hdl; /**< Next DST Change Service start handle. */ + ndcs_time_dst_t time_with_dst; /**< Time with DST value. */ + ble_gatts_create_db_t ndcs_gatts_db; /**< Next DST Change Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t ndcs_init(void); -static void ndcs_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void ndcs_time_with_dst_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); +static void ndcs_time_with_dst_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct ndcs_env_t s_ndcs_env; +static const uint8_t s_ndcs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_NEXT_DST_CHANGE); /**@brief Full NDCS Database Description - Used to add attributes into the database. */ -static const attm_desc_t ndcs_attr_tab[NDCS_IDX_NB] = { +static const ble_gatts_attm_desc_t ndcs_attr_tab[NDCS_IDX_NB] = +{ // NDCS Service Declaration - [NDCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [NDCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Time with DST Characteristic Declaration - [NDCS_IDX_TIME_DST_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [NDCS_IDX_TIME_DST_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Time with DST Characteristic Declaration value - [NDCS_IDX_TIME_DST_VAL] = { - BLE_ATT_CHAR_TIME_WITH_DST, - READ_PERM(AUTH), - ATT_VAL_LOC_USER, - NDCS_TIME_WITH_DST_VAL_LEN - }, -}; - -/**@brief NDCS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t ndcs_tack_cbs = { - (prf_init_func_t) ndcs_init, - NULL, - NULL -}; - -/**@brief NDCS Task Callbacks. */ -static gatts_prf_cbs_t ndcs_cb_func = { - ndcs_read_att_cb, - NULL, - NULL, - NULL -}; - -/**@brief NDCS Information. */ -static const prf_server_info_t ndcs_prf_info = { - .max_connection_nb = NDCS_CONNECTION_MAX, - .manager_cbs = &ndcs_tack_cbs, - .gatts_prf_cbs = &ndcs_cb_func + [NDCS_IDX_TIME_DST_VAL] = {BLE_ATT_CHAR_TIME_WITH_DST, + BLE_GATTS_READ_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + NDCS_TIME_WITH_DST_VAL_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Next DST Change service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t ndcs_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t ndcs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_NEXT_DST_CHANGE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = ndcs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_ndcs_env.char_mask); - gatts_db.max_nb_attr = NDCS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = ndcs_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_ndcs_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -171,9 +113,9 @@ static sdk_err_t ndcs_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void ndcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void ndcs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_ndcs_env.start_hdl, @@ -182,8 +124,10 @@ static void ndcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { - case NDCS_IDX_TIME_DST_VAL: { + switch (tab_index) + { + case NDCS_IDX_TIME_DST_VAL: + { uint8_t encoded_buffer[NDCS_TIME_WITH_DST_VAL_LEN]; ndcs_time_with_dst_read_handler(&cfm, encoded_buffer); break; @@ -206,29 +150,38 @@ static void ndcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para * @param[out] p_encode_buffer: Pointer to encoded data will be written. ***************************************************************************************** */ -static void ndcs_time_with_dst_read_handler(gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) +static void ndcs_time_with_dst_read_handler(ble_gatts_read_cfm_t *p_cfm, uint8_t *p_encode_buffer) { prf_pack_date_time(p_encode_buffer, &s_ndcs_env.time_with_dst.date_time); - p_encode_buffer[INDEX_7] = s_ndcs_env.time_with_dst.dst_offset; + p_encode_buffer[7] = s_ndcs_env.time_with_dst.dst_offset; p_cfm->length = NDCS_TIME_WITH_DST_VAL_LEN; p_cfm->value = p_encode_buffer; } +static void ndcs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + ndcs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ void ndcs_day_time_update(prf_date_time_t *p_day_time) { - uint8_t ret; - - ret = memcpy_s(&s_ndcs_env.time_with_dst.date_time, sizeof(prf_date_time_t), - p_day_time, sizeof(prf_date_time_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_ndcs_env.time_with_dst.date_time, p_day_time, sizeof(prf_date_time_t)); } void ndcs_dst_offset_update(ndcs_dst_offset_t dst_offset) @@ -240,5 +193,15 @@ sdk_err_t ndcs_service_init(uint8_t char_mask) { s_ndcs_env.char_mask = char_mask; - return ble_server_prf_add(&ndcs_prf_info); + s_ndcs_env.start_hdl = PRF_INVALID_HANDLE; + + s_ndcs_env.ndcs_gatts_db.shdl = &s_ndcs_env.start_hdl; + s_ndcs_env.ndcs_gatts_db.uuid = s_ndcs_svc_uuid; + s_ndcs_env.ndcs_gatts_db.attr_tab_cfg = (uint8_t *)&(s_ndcs_env.char_mask); + s_ndcs_env.ndcs_gatts_db.max_nb_attr = NDCS_IDX_NB; + s_ndcs_env.ndcs_gatts_db.srvc_perm = 0; + s_ndcs_env.ndcs_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_ndcs_env.ndcs_gatts_db.attr_tab.attr_tab_16 = ndcs_attr_tab; + + return ble_gatts_prf_add(&s_ndcs_env.ndcs_gatts_db, ndcs_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.h index cc15099..be68521 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ndcs/ndcs.h @@ -49,27 +49,26 @@ * @details The Next DST Change Service exposes the Time with DST characteristic. This module * implements the Next DST Change Service with Time with DST characteristics. * - * The application must call \ref ndcs_service_init() to add Next DST Change Service + * The application must call \ref ndcs_service_init() to add Next DST Change Service * and Time with DST characteristic to the BLE Stack database. */ #ifndef __NDCS_H__ #define __NDCS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup NDCS_MACRO Defines * @{ */ -#define NDCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of NDCS connections. */ -#define NDCS_TIME_WITH_DST_VAL_LEN 8 /**< Length of Time with DST value. */ -#define NDCS_CHAR_FULL 0x07 /**< Bit mask for mandatory characteristic in NDCS. */ +#define NDCS_CONNECTION_MAX 10 /**< Maximum number of NDCS connections. */ +#define NDCS_TIME_WITH_DST_VAL_LEN 8 /**< Length of Time with DST value. */ +#define NDCS_CHAR_FULL 0x07 /**< Bit mask for mandatory characteristic in NDCS. */ /** @} */ /** @@ -77,7 +76,8 @@ * @{ */ /**@brief Daylight Saving Time Offset. */ -typedef enum { +typedef enum +{ NDCS_DST_OFFSET_STANDAR_TIME, /**< Standard Time. */ NDCS_DST_OFFSET_HALF_HOUR, /**< Half An Hour Daylight Time (+0.5h). */ NDCS_DST_OFFSET_DAYLIGHT_TIME, /**< Daylight Time (+1h). */ @@ -90,7 +90,8 @@ typedef enum { * @{ */ /**@brief Time with DST. */ -typedef struct { +typedef struct +{ prf_date_time_t date_time; /**< Date Time. */ ndcs_dst_offset_t dst_offset; /**< Daylight Saving Time Offset. */ } ndcs_time_dst_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/BUILD.gn new file mode 100644 index 0000000..23ecada --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("otas") { + sources = [ "otas.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.c index 71c06a0..1c14cf7 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.c @@ -35,28 +35,28 @@ ***************************************************************************************** */ -/* -* INCLUDE FILES -**************************************************************************************** -*/ + /* + * INCLUDE FILES + **************************************************************************************** + */ #include "otas.h" #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" +#include "dfu_port.h" +#include "hal_flash.h" +#include "app_log.h" + /* * DEFINES **************************************************************************************** */ /**@brief Proprietary UUIDs. */ -#define OTA_SERVICE_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, - 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x04, 0xED, 0xA6} -#define OTA_SERVICE_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, - 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x04, 0xED, 0xA6} -#define OTA_SERVICE_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, - 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x04, 0xED, 0xA6} -#define OTA_SERVICE_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, - 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x04, 0xED, 0xA6} +#define OTA_SERVICE_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x04, 0xED, 0xA6} +#define OTA_SERVICE_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x04, 0xED, 0xA6} +#define OTA_SERVICE_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x04, 0xED, 0xA6} +#define OTA_SERVICE_CTRL_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x04, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -68,7 +68,8 @@ **************************************************************************************** */ /**@brief OTA Service Attributes Indexes. */ -enum otas_attr_idx_tag { +enum otas_attr_idx_tag +{ OTAS_IDX_SVC, OTAS_IDX_TX_CHAR, @@ -78,6 +79,7 @@ enum otas_attr_idx_tag { OTAS_IDX_RX_VAL, OTAS_IDX_CTRL_CHAR, OTAS_IDX_CTRL_VAL, + OTAS_IDX_CTRL_CFG, OTAS_IDX_NB, }; @@ -86,138 +88,69 @@ enum otas_attr_idx_tag { * STRUCT DEFINE **************************************************************************************** */ -struct otas_env_t { - otas_init_t otas_init; - uint16_t ntf_cfg[OTAS_CONNECTION_MAX]; - uint16_t start_hdl; +struct otas_env_t +{ + otas_init_t otas_init; + uint16_t tx_ntf_cfg[OTAS_CONNECTION_MAX]; + uint16_t ctrl_pt_ind_cfg[OTAS_CONNECTION_MAX]; + uint16_t start_hdl; + ble_gatts_create_db_t otas_att_db; }; - -/* -* LOCAL FUNCTION DECLARATION -**************************************************************************************** -*/ -static sdk_err_t otas_init(void); -static void otas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void otas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void otas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void otas_gatts_cmpl_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - +struct otas_env_t s_otas_env; /* * LOCAL VARIABLE DEFINITIONS **************************************************************************************** */ -static struct otas_env_t s_otas_env; -static uint16_t s_char_mask = 0xff; +static uint16_t s_char_mask = 0x1ff; +static const uint8_t s_otas_svc_uuid[] = {BLE_UUID_OTA_SERVICE}; + /**@brief Full OTAS Database Description - Used to add attributes into the database. */ -static const attm_desc_128_t otas_att_db[OTAS_IDX_NB] = { +static const ble_gatts_attm_desc_128_t otas_att_db[OTAS_IDX_NB] = { // OTA service - [OTAS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [OTAS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // OTA TX Characteristic Declaration - [OTAS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [OTAS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC,BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // OTA TX Characteristic Value - [OTAS_IDX_TX_VAL] = { - OTA_SERVICE_TX_UUID, - NOTIFY_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - OTAS_MAX_DATA_LEN - }, - + [OTAS_IDX_TX_VAL] = {OTA_SERVICE_TX_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + OTAS_MAX_DATA_LEN}, // OTA TX Characteristic - Client Characteristic Configuration Descriptor - [OTAS_IDX_TX_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC| WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [OTAS_IDX_TX_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC| BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // OTA RX Characteristic Declaration - [OTAS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0 }, + [OTAS_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // OTA RX Characteristic Value - [OTAS_IDX_RX_VAL] = { - OTA_SERVICE_RX_UUID, - WRITE_CMD_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - OTAS_MAX_DATA_LEN - }, + [OTAS_IDX_RX_VAL] = {OTA_SERVICE_RX_UUID, + BLE_GATTS_WRITE_CMD_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + OTAS_MAX_DATA_LEN}, // OTA CTRL Characteristic Declaration - [OTAS_IDX_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [OTAS_IDX_CTRL_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, - // OTA CTRL Characteristic Value - [OTAS_IDX_CTRL_VAL] = { - OTA_SERVICE_CTRL_UUID, - WRITE_CMD_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - sizeof(uint32_t) - }, -}; - -/**@brief OTA Server Task interface required by profile manager. */ -static ble_prf_manager_cbs_t otas_tack_cbs = { - (prf_init_func_t) otas_init, - NULL, - NULL, -}; - -/**@brief OTA Server Task Callbacks. */ -static gatts_prf_cbs_t otas_cb_func = { - otas_read_att_cb, - otas_write_att_cb, - NULL, - otas_gatts_cmpl_cb, - otas_cccd_set_cb -}; - -/**@brief OTA Server Information. */ -static const prf_server_info_t otas_prf_info = { - .max_connection_nb = OTAS_CONNECTION_MAX, - .manager_cbs = &otas_tack_cbs, - .gatts_prf_cbs =&otas_cb_func + // OTA CTRL Characteristic Value BLE_GATTS_WRITE_CMD_PERM_UNSEC + [OTAS_IDX_CTRL_VAL] = {OTA_SERVICE_CTRL_UUID, + BLE_GATTS_WRITE_CMD_PERM_UNSEC | BLE_GATTS_INDICATE_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + sizeof(uint32_t)}, + // OTA CTRL Characteristic - Client Characteristic Configuration Descriptor + [OTAS_IDX_CTRL_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS **************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize OTA service create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t otas_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t otas_svc_uuid[] = OTA_SERVICE_UUID; - sdk_err_t error_code = SDK_SUCCESS; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = otas_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t*)&s_char_mask; - gatts_db.max_nb_attr = OTAS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = otas_att_db; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_otas_env.start_hdl = *(gatts_db.shdl); - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -226,21 +159,27 @@ static sdk_err_t otas_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void otas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void otas_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = 0; + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; tab_index = prf_find_idx_by_handle(handle, s_otas_env.start_hdl, OTAS_IDX_NB, (uint8_t*)&s_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch(tab_index) + { case OTAS_IDX_TX_CFG: cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)(&s_otas_env.ntf_cfg[conn_idx]); + cfm.value = (uint8_t *)(&s_otas_env.tx_ntf_cfg[conn_idx]); + break; + + case OTAS_IDX_CTRL_CFG: + cfm.length = sizeof(uint16_t); + cfm.value = (uint8_t *)(&s_otas_env.ctrl_pt_ind_cfg[conn_idx]); break; default: @@ -249,7 +188,33 @@ static void otas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para break; } - ble_gatts_read_cfm(conn_idx, &cfm); + ble_gatts_read_cfm(conn_idx,&cfm); +} + +/** + ***************************************************************************************** + * @brief Handles control point cmd. + * + * @param[in] p_data: Pointer to the cmd data. + * @param[in] length: Length of the cmd data. + ***************************************************************************************** + */ +static void otas_control_point_handler(uint8_t conn_idx, uint8_t *p_data, uint16_t length) +{ + otas_evt_t event; + + event.conn_idx = conn_idx; + event.evt_type = OTAS_EVT_INVALID; + + if (le32toh(p_data) == OTAS_CTRL_PT_OP_DFU_ENTER) + { + event.evt_type = OTAS_EVT_DFU_TASK_ENTER; + } + + if(s_otas_env.otas_init.evt_handler != NULL && event.evt_type != OTAS_EVT_INVALID) + { + s_otas_env.otas_init.evt_handler(&event); + } } /** @@ -260,22 +225,24 @@ static void otas_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void otas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void otas_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - gatts_write_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = 0; - uint16_t cccd_value = 0; - otas_evt_t event; + ble_gatts_write_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; + uint16_t cccd_value = 0; + otas_evt_t event; tab_index = prf_find_idx_by_handle(handle, s_otas_env.start_hdl, OTAS_IDX_NB, (uint8_t*)&s_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch(tab_index) + { case OTAS_IDX_RX_VAL: - if (s_otas_env.otas_init.evt_handler != NULL) { + if(s_otas_env.otas_init.evt_handler != NULL) + { event.conn_idx = conn_idx; event.evt_type = OTAS_EVT_RX_RECEIVE_DATA; event.p_data = (uint8_t*)p_param->value; @@ -283,29 +250,37 @@ static void otas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa s_otas_env.otas_init.evt_handler(&event); } - break; case OTAS_IDX_TX_CFG: cccd_value = le16toh(&p_param->value[0]); - if (s_otas_env.otas_init.evt_handler != NULL) { + if(s_otas_env.otas_init.evt_handler != NULL) + { event.conn_idx = conn_idx; event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ - OTAS_EVT_TX_NOTIFICATION_ENABLED : - OTAS_EVT_TX_NOTIFICATION_DISABLED; + OTAS_EVT_TX_NOTIFICATION_ENABLED : + OTAS_EVT_TX_NOTIFICATION_DISABLED; s_otas_env.otas_init.evt_handler(&event); } - s_otas_env.ntf_cfg[conn_idx] = cccd_value; + s_otas_env.tx_ntf_cfg[conn_idx] = cccd_value; + break; + + case OTAS_IDX_CTRL_CFG: + cccd_value = le16toh(&p_param->value[0]); + if(s_otas_env.otas_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_IND) ?\ + OTAS_EVT_CTRL_PT_INDICATION_ENABLED : + OTAS_EVT_CTRL_PT_INDICATION_DISABLED; + + s_otas_env.otas_init.evt_handler(&event); + } + s_otas_env.ctrl_pt_ind_cfg[conn_idx] = cccd_value; break; case OTAS_IDX_CTRL_VAL: - if (le32toh(&p_param->value[0]) == OTAS_CTRL_ENTER_DFU) { - if (s_otas_env.otas_init.evt_handler != NULL) { - event.conn_idx = conn_idx; - event.evt_type = OTAS_EVT_DFU_MODE_ENTER; - s_otas_env.otas_init.evt_handler(&event); - } - } + otas_control_point_handler(conn_idx, p_param->value, p_param->length); break; default: @@ -313,7 +288,7 @@ static void otas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa break; } - ble_gatts_write_cfm(conn_idx, &cfm); + ble_gatts_write_cfm(conn_idx,&cfm); } /** @@ -325,29 +300,43 @@ static void otas_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void otas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void otas_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; otas_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } tab_index = prf_find_idx_by_handle(handle, s_otas_env.start_hdl, OTAS_IDX_NB, (uint8_t*)&s_char_mask); - switch (tab_index) { + switch(tab_index) + { case OTAS_IDX_TX_CFG: - if (s_otas_env.otas_init.evt_handler != NULL) { + if(s_otas_env.otas_init.evt_handler != NULL) + { event.conn_idx = conn_idx; event.evt_type = (cccd_value == PRF_CLI_START_NTF) ?\ - OTAS_EVT_TX_NOTIFICATION_ENABLED : - OTAS_EVT_TX_NOTIFICATION_DISABLED; + OTAS_EVT_TX_NOTIFICATION_ENABLED : + OTAS_EVT_TX_NOTIFICATION_DISABLED; s_otas_env.otas_init.evt_handler(&event); } - s_otas_env.ntf_cfg[conn_idx] = cccd_value; + s_otas_env.tx_ntf_cfg[conn_idx] = cccd_value; break; + case OTAS_IDX_CTRL_CFG: + if(s_otas_env.otas_init.evt_handler != NULL) + { + event.conn_idx = conn_idx; + event.evt_type = (cccd_value == PRF_CLI_START_IND) ?\ + OTAS_EVT_CTRL_PT_INDICATION_ENABLED : + OTAS_EVT_CTRL_PT_INDICATION_DISABLED; + s_otas_env.otas_init.evt_handler(&event); + } + s_otas_env.ctrl_pt_ind_cfg[conn_idx] = cccd_value; + default: break; } @@ -363,14 +352,17 @@ static void otas_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va * @return If the event was consumed or not. ***************************************************************************************** */ -static void otas_gatts_cmpl_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void otas_ntf_cplt_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_otas_env.otas_init.evt_handler != NULL) { + if(s_otas_env.otas_init.evt_handler != NULL) + { otas_evt_t event; event.conn_idx = conn_idx; - if (status == BLE_SUCCESS) { - if (p_ntf_ind->type == BLE_GATT_NOTIFICATION) { + if(status == BLE_SUCCESS) + { + if(p_ntf_ind->type == BLE_GATT_NOTIFICATION) + { event.evt_type = OTAS_EVT_NOTIFY_COMPLETE; s_otas_env.otas_init.evt_handler(&event); } @@ -378,16 +370,44 @@ static void otas_gatts_cmpl_cb(uint8_t conn_idx, uint8_t status, const ble_gatts } } +static void otas_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + otas_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + otas_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + otas_ntf_cplt_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + otas_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** */ -sdk_err_t otas_notify_tx_data(uint8_t conn_idx, uint8_t* p_data, uint16_t len) +sdk_err_t otas_notify_tx_data(uint8_t conn_idx,uint8_t* p_data,uint16_t len) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_cmd; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + ble_gatts_noti_ind_t send_cmd; - if (s_otas_env.ntf_cfg[conn_idx] == PRF_CLI_START_NTF) { + if(s_otas_env.tx_ntf_cfg[conn_idx] == PRF_CLI_START_NTF) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; send_cmd.handle = prf_find_handle_by_idx(OTAS_IDX_TX_VAL, s_otas_env.start_hdl, (uint8_t*)&s_char_mask); @@ -395,7 +415,7 @@ sdk_err_t otas_notify_tx_data(uint8_t conn_idx, uint8_t* p_data, uint16_t len) send_cmd.length = len; send_cmd.value = p_data; // send notification to peer device - error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); + error_code = ble_gatts_noti_ind(conn_idx,&send_cmd); } return error_code; } @@ -403,11 +423,30 @@ sdk_err_t otas_notify_tx_data(uint8_t conn_idx, uint8_t* p_data, uint16_t len) sdk_err_t otas_service_init(otas_init_t *p_otas_init) { - if (p_otas_init == NULL) { + if (NULL == p_otas_init) + { return SDK_ERR_POINTER_NULL; } s_otas_env.otas_init.evt_handler = p_otas_init->evt_handler; - return ble_server_prf_add(&otas_prf_info); + memset(&s_otas_env.otas_att_db, 0, sizeof(ble_gatts_create_db_t)); + + s_otas_env.start_hdl = PRF_INVALID_HANDLE; + s_otas_env.otas_att_db.shdl = &s_otas_env.start_hdl; + s_otas_env.otas_att_db.uuid = s_otas_svc_uuid; + s_otas_env.otas_att_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_otas_env.otas_att_db.max_nb_attr = OTAS_IDX_NB; + s_otas_env.otas_att_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_otas_env.otas_att_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_otas_env.otas_att_db.attr_tab.attr_tab_128 = otas_att_db; + + return ble_gatts_prf_add(&s_otas_env.otas_att_db, otas_ble_evt_handler); } + +uint16_t otas_service_start_handle_get(void) +{ + return s_otas_env.start_hdl; +} + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.h index 5c0dbea..6fc6335 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas/otas.h @@ -3,7 +3,7 @@ * * @file otas.h * - * @brief OTA Service API + * @brief Over The Air Service API * **************************************************************************************** * @attention @@ -46,8 +46,8 @@ * @{ * @brief Definitions and prototypes for the OTAS interface. * - * @details The OTA Service exposes the state of a battery within a device. - * This module implements the Battery Service with the Battery Level + * @details The OTA Service is a customized service with Tx, Rx and Flow Control + * characteristics. This module implements the Battery Service with the Battery Level * characteristic. After @ref otas_init_t variable is initialized, the * developer shall call @ref otas_service_init() to add the OTA * Service and RX, TX, Control characteristic to the BLE stack database. @@ -63,33 +63,53 @@ * INCLUDE FILES **************************************************************************************** */ -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include "flash_scatter_config.h" /** * @defgroup OTAS_MACRO Defines * @{ */ -#define OTAS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of OTA Service connections. */ -#define OTAS_MAX_DATA_LEN 244 /**< Maximum length of OTAS characteristic. */ -#define BLE_UUID_OTA_SERVICE 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x01, 0x04, 0xED, 0xA6 /**< The UUID of OTA Service for setting advertising data. */ -#define OTAS_CTRL_ENTER_DFU 0x474f4f44 /**< OTAS enter DFU control. */ +#define OTAS_CONNECTION_MAX 10 /**< Maximum number of OTA Service connections. */ +#define OTAS_MAX_DATA_LEN 244 /**< Maximum length of OTAS characteristic. */ +#define OTAS_VERSION 0x02 /**< The OTA VERSION. */ +#define BLE_UUID_OTA_SERVICE 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x04, 0xED, 0xA6 /**< The UUID of OTA Service for setting advertising data. */ /** @} */ /** * @defgroup OTA_ENUM Enumerations * @{ */ +/**@brief OTA Service dfu mode.*/ +typedef enum +{ + OTAS_DFU_MODE_RESERVED, /**< Reserved for future use. */ + OTAS_DFU_MODE_COPY_UPGRADE, /**< OTAS Copy DFU mode (Double bank, Background). */ + OTAS_DFU_MODE_NON_COPY_UPGRADE, /**< OTAS Non-Copy DFU mode (Single bank, Non-background). */ +} otas_dfu_mode_t; + +/**@brief OTA Service Control Point Operation Code.*/ +typedef enum +{ + OTAS_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */ + OTAS_CTRL_PT_OP_DFU_ENTER = 0x474f4f44, /**< OTAS task enter Operation Code.*/ + OTAS_CTRL_PT_OP_RSP_CODE = 0x10, /**< Response code. */ +} otas_ctrl_pt_op_code_t; + /**@brief OTA Service event type. */ -typedef enum { - OTAS_EVT_INVALID, - OTAS_EVT_TX_NOTIFICATION_ENABLED, - OTAS_EVT_TX_NOTIFICATION_DISABLED, - OTAS_EVT_RX_RECEIVE_DATA, - OTAS_EVT_NOTIFY_COMPLETE, - OTAS_EVT_DFU_MODE_ENTER, +typedef enum +{ + OTAS_EVT_INVALID, /**< Invalid event for ota service. */ + OTAS_EVT_TX_NOTIFICATION_ENABLED, /**< tx notification enable event for ota service. */ + OTAS_EVT_TX_NOTIFICATION_DISABLED, /**< tx notification disable event for ota service. */ + OTAS_EVT_CTRL_PT_INDICATION_ENABLED, /**< control point indication enable event for ota service. */ + OTAS_EVT_CTRL_PT_INDICATION_DISABLED, /**< control point indication disable event for ota service. */ + OTAS_EVT_RX_RECEIVE_DATA, /**< rx receive data event for ota service. */ + OTAS_EVT_NOTIFY_COMPLETE, /**< notify complete event for ota service. */ + OTAS_EVT_DFU_TASK_ENTER, /**< set dfu task enter event for ota service. */ + OTAS_EVT_DFU_MODE_SET, /**< set dfu mode for ota service. */ } otas_evt_type_t; /** @} */ @@ -98,11 +118,13 @@ typedef enum { * @{ */ /**@brief OTA Service event. */ -typedef struct { - otas_evt_type_t evt_type; /**< The OTAS event. */ - uint8_t conn_idx; /**< Index of connection. */ - uint8_t *p_data; /**< Pointer to data. */ - uint16_t length; /**< Length of data. */ +typedef struct +{ + otas_evt_type_t evt_type; /**< The OTAS event. */ + uint8_t conn_idx; /**< Index of connection. */ + uint8_t *p_data; /**< Pointer to data. */ + uint16_t length; /**< Length of data. */ + otas_dfu_mode_t dfu_mode; /**< OTA Service dfu mode. */ } otas_evt_t; /** @} */ @@ -112,9 +134,6 @@ typedef struct { */ /**@brief OTA Service event handler type. */ typedef void (*otas_evt_handler_t)(otas_evt_t *p_evt); - -/**@brief OTA Service function type. */ -typedef void (*function)(void); /** @} */ /** @@ -122,8 +141,9 @@ typedef void (*function)(void); * @{ */ /**@brief OTA Service initialization variable. */ -typedef struct { - otas_evt_handler_t evt_handler; /**< Handler to handle otas event. */ +typedef struct +{ + otas_evt_handler_t evt_handler; /**< Handler to handle otas event. */ } otas_init_t; /** @} */ @@ -143,7 +163,6 @@ typedef struct { */ sdk_err_t otas_service_init(otas_init_t *p_otas_init); - /** ***************************************************************************************** * @brief Send data to peer device @@ -155,9 +174,19 @@ sdk_err_t otas_service_init(otas_init_t *p_otas_init); * @return Result of notify and indicate value ***************************************************************************************** */ -sdk_err_t otas_notify_tx_data(uint8_t conn_idx, uint8_t *p_data, uint16_t length); +sdk_err_t otas_notify_tx_data(uint8_t conn_idx, uint8_t *p_data,uint16_t length); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the ots service start handle . + * + * @return The ots service start handle. + ***************************************************************************************** + */ +uint16_t otas_service_start_handle_get(void); /** @} */ #endif + /** @} */ /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/BUILD.gn new file mode 100644 index 0000000..5013965 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("otas_c") { + sources = [ "otas_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.c index 194d8eb..45e3a44 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.c @@ -42,63 +42,37 @@ #include "otas_c.h" #include -#define ATTR_VALUE_LEN 2 -#define UUID_LEN_16 16 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief OTA Service Client environment variable. */ -struct otas_c_env_t { - otas_c_handles_t handles; /**< Handles of OTA characteristics which will be got for peer. */ - otas_c_evt_handler_t evt_handler; /**< Handler of OTA client event */ - uint8_t prf_id; /**< OTA Client profile id. */ +struct otas_c_env_t +{ + otas_c_handles_t handles; /**< Handles of OTA characteristics which will be got for peer. */ + otas_c_evt_handler_t evt_handler; /**< Handler of OTA client event */ + uint8_t prf_id; /**< OTA Client profile id. */ + ble_gatts_create_db_t otas_c_gatts_db; /**< OTA Client attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static void otas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void otas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void otas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct otas_c_env_t s_otas_c_env; -static uint8_t s_otas_uuid[16] = OTAS_SVC_UUID; -static uint8_t s_otas_tx_char_uuid[16] = OTAS_TX_CHAR_UUID; -static uint8_t s_otas_rx_char_uuid[16] = OTAS_RX_CHAR_UUID; -static uint8_t s_otas_ctrl_char_uuid[16] = OTAS_CTRL_CHAR_UUID; - - -/**@brief OTA Client interface required by profile manager. */ -static ble_prf_manager_cbs_t otas_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief OTA GATT Client Callbacks. */ -static gattc_prf_cbs_t otas_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - otas_c_att_write_cb, - otas_c_att_ntf_ind_cb, - otas_c_srvc_browse_cb, - NULL, -}; - -/**@brief OTA Client Information. */ -static const prf_client_info_t otas_c_prf_info = { - .max_connection_nb = OTAS_C_CONNECTION_MAX, - .manager_cbs = &otas_c_mgr_cbs, - .gattc_prf_cbs = &otas_c_gattc_cbs +static uint8_t s_otas_uuid[16] = OTAS_SVC_UUID; +static uint8_t s_otas_tx_char_uuid[16] = OTAS_TX_CHAR_UUID; +static uint8_t s_otas_rx_char_uuid[16] = OTAS_RX_CHAR_UUID; +static uint8_t s_otas_ctrl_char_uuid[16] = OTAS_CTRL_CHAR_UUID; +static ble_uuid_t s_otas_c_service_uuid = +{ + .uuid_len = 16, + .uuid = s_otas_uuid, }; /* @@ -114,7 +88,8 @@ static const prf_client_info_t otas_c_prf_info = { */ static void otas_c_evt_handler_execute(otas_c_evt_t *p_evt) { - if (s_otas_c_env.evt_handler != NULL && OTAS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_otas_c_env.evt_handler && OTAS_C_EVT_INVALID != p_evt->evt_type) + { s_otas_c_env.evt_handler(p_evt); } } @@ -128,22 +103,27 @@ static void otas_c_evt_handler_execute(otas_c_evt_t *p_evt) * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void otas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void otas_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { otas_c_evt_t otas_c_evt; otas_c_evt.conn_idx = conn_idx; otas_c_evt.evt_type = OTAS_C_EVT_INVALID; - if (handle == s_otas_c_env.handles.otas_tx_cccd_handle) { + if (handle == s_otas_c_env.handles.otas_tx_cccd_handle) + { otas_c_evt.evt_type = (BLE_SUCCESS == status) ? \ OTAS_C_EVT_TX_NTF_SET_SUCCESS : \ OTAS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_otas_c_env.handles.otas_ctrl_handle) { + } + else if (handle == s_otas_c_env.handles.otas_ctrl_handle) + { otas_c_evt.evt_type = (BLE_SUCCESS == status) ? \ OTAS_C_EVT_CTRL_SUCCESS : \ OTAS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_otas_c_env.handles.otas_rx_handle) { + } + else if (handle == s_otas_c_env.handles.otas_rx_handle) + { otas_c_evt.evt_type = (BLE_SUCCESS == status) ? \ OTAS_C_EVT_TX_CPLT : \ OTAS_C_EVT_WRITE_OP_ERR; @@ -161,7 +141,7 @@ static void otas_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handl * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void otas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void otas_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { otas_c_evt_t otas_c_evt; @@ -170,7 +150,8 @@ static void otas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p otas_c_evt.p_data = p_ntf_ind->p_value; otas_c_evt.length = p_ntf_ind->length; - if (p_ntf_ind->handle == s_otas_c_env.handles.otas_tx_handle) { + if (p_ntf_ind->handle == s_otas_c_env.handles.otas_tx_handle) + { otas_c_evt.evt_type = OTAS_C_EVT_PEER_DATA_RECEIVE; } @@ -186,7 +167,7 @@ static void otas_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void otas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void otas_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { otas_c_evt_t otas_c_evt; uint16_t handle_disc; @@ -194,120 +175,134 @@ static void otas_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_ga otas_c_evt.conn_idx = conn_idx; otas_c_evt.evt_type = OTAS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } + if (BLE_SUCCESS == status) + { + if (16 == p_browse_srvc->uuid_len && 0 == memcmp(p_browse_srvc->uuid, s_otas_uuid, 16)) + { + s_otas_c_env.handles.otas_srvc_start_handle = p_browse_srvc->start_hdl; + s_otas_c_env.handles.otas_srvc_end_handle = p_browse_srvc->end_hdl; - if (p_browse_srvc->uuid_len == UUID_LEN_16 && memcmp(p_browse_srvc->uuid, s_otas_uuid, UUID_LEN_16) == 0) { - s_otas_c_env.handles.otas_srvc_start_handle = p_browse_srvc->start_hdl; - s_otas_c_env.handles.otas_srvc_end_handle = p_browse_srvc->end_hdl; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + handle_disc = p_browse_srvc->start_hdl + i + 1; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - handle_disc = p_browse_srvc->start_hdl + i + 1; + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) + { + if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_rx_char_uuid, 16)) + { + s_otas_c_env.handles.otas_rx_handle = handle_disc; + } + else if (0 == (memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_tx_char_uuid, 16))) + { + s_otas_c_env.handles.otas_tx_handle = handle_disc; + s_otas_c_env.handles.otas_tx_cccd_handle = handle_disc + 1; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_ctrl_char_uuid, 16)) + { + s_otas_c_env.handles.otas_ctrl_handle = handle_disc; + } + } - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) { - if (memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_rx_char_uuid, UUID_LEN_16) == 0) { - s_otas_c_env.handles.otas_rx_handle = handle_disc; - } else if ((memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_tx_char_uuid, UUID_LEN_16) == 0)) { - s_otas_c_env.handles.otas_tx_handle = handle_disc; - s_otas_c_env.handles.otas_tx_cccd_handle = handle_disc + 1; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_otas_ctrl_char_uuid, UUID_LEN_16) == 0) { - s_otas_c_env.handles.otas_ctrl_handle = handle_disc; + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; } } - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; - } + otas_c_evt.evt_type = OTAS_C_EVT_DISCOVERY_COMPLETE; } - - otas_c_evt.evt_type = OTAS_C_EVT_DISCOVERY_COMPLETE; } otas_c_evt_handler_execute(&otas_c_evt); } +static void otas_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + otas_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + break; + + case BLE_GATTC_EVT_WRITE_RSP: + otas_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + otas_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t otas_client_init(otas_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_otas_c_env, sizeof(s_otas_c_env), 0, sizeof(s_otas_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_otas_c_env, 0, sizeof(s_otas_c_env)); s_otas_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&otas_c_prf_info, &s_otas_c_env.prf_id); + return ble_gattc_prf_add(&s_otas_c_service_uuid, otas_c_ble_evt_handler); } - sdk_err_t otas_c_disc_srvc_start(uint8_t conn_idx) { - const ble_uuid_t ths_uuid = { + const ble_uuid_t otas_uuid = + { .uuid_len = 16, .uuid = s_otas_uuid, }; - return ble_gattc_prf_services_browse(s_otas_c_env.prf_id, conn_idx, &ths_uuid); + return ble_gattc_services_browse(conn_idx, &otas_uuid); } - sdk_err_t otas_c_tx_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_tx_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_tx_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_otas_c_env.handles.otas_tx_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_otas_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_otas_c_env.handles.otas_tx_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t otas_c_ctrl_data_send(uint8_t conn_idx, uint32_t data) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_ctrl_handle) { + if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_ctrl_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_otas_c_env.handles.otas_ctrl_handle; - write_attr_value.length = sizeof(uint32_t); - write_attr_value.p_value = (uint8_t*)&data; - - return ble_gattc_prf_write_no_resp(s_otas_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_otas_c_env.handles.otas_ctrl_handle, sizeof(uint32_t), (uint8_t*)&data); } sdk_err_t otas_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_rx_handle) { + if (BLE_ATT_INVALID_HDL == s_otas_c_env.handles.otas_rx_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_otas_c_env.handles.otas_rx_handle; - write_attr_value.length = length; - write_attr_value.p_value = p_data; - - return ble_gattc_prf_write_no_resp(s_otas_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_otas_c_env.handles.otas_rx_handle, length, p_data); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.h index af2107a..b5664e0 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/otas_c/otas_c.h @@ -3,7 +3,7 @@ * * @file otas_c.h * - * @brief OTAS Client API + * @brief Over The Air Service Client API * ***************************************************************************************** * @attention @@ -55,32 +55,31 @@ #ifndef __OTAS_C_H__ #define __OTAS_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup OTAS_C_MACRO Defines * @{ */ -#define OTAS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of OTAS Client connections. */ +#define OTAS_C_CONNECTION_MAX 10 /**< Maximum number of OTAS Client connections. */ /** * @defgroup OTAS_UUID OTAS UUIDs * @{ * @brief OTAS service and characteristcs UUID. */ -#define OTAS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x01, 0x04, 0xED, 0xA6} /**< UUID of OTA Service. */ -#define OTAS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x02, 0x04, 0xED, 0xA6} /**< UUID of OTA TX Characteristic. */ -#define OTAS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x03, 0x04, 0xED, 0xA6} /**< UUID of OTA RX Characteristic. */ -#define OTAS_CTRL_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, \ - 0x04, 0x04, 0xED, 0xA6} /**< UUID of OTA Control Characteristic. */ +#define OTAS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x04, 0xED, 0xA6} /**< UUID of OTA Service. */ +#define OTAS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ + 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x04, 0xED, 0xA6} /**< UUID of OTA TX Characteristic. */ +#define OTAS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ + 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x04, 0xED, 0xA6} /**< UUID of OTA RX Characteristic. */ +#define OTAS_CTRL_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ + 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x04, 0xED, 0xA6} /**< UUID of OTA Control Characteristic. */ /** @} */ /** @} */ @@ -89,16 +88,16 @@ * @{ */ /**@brief OTA Service Client event type. */ -typedef enum { - OTAS_C_EVT_INVALID, /**< OTA Client invalid event. */ - OTAS_C_EVT_DISCOVERY_COMPLETE, /**< OTA Client has found THS service and its characteristics. */ - OTAS_C_EVT_DISCOVERY_FAIL, /**< OTA Client found THS service failed because of invalid operation \ - or no found at the peer. */ - OTAS_C_EVT_TX_NTF_SET_SUCCESS, /**< OTA Client has set peer Tx notify. */ - OTAS_C_EVT_CTRL_SUCCESS, /**< OTA Client has set control info. */ - OTAS_C_EVT_PEER_DATA_RECEIVE, /**< OTA Client has received data from peer. */ - OTAS_C_EVT_TX_CPLT, /**< OTA Client has sent something to a peer successfully. */ - OTAS_C_EVT_WRITE_OP_ERR, /**< Error occured when OTA Client writen to peer. */ +typedef enum +{ + OTAS_C_EVT_INVALID, /**< OTA Client invalid event. */ + OTAS_C_EVT_DISCOVERY_COMPLETE, /**< OTA Client has found THS service and its characteristics. */ + OTAS_C_EVT_DISCOVERY_FAIL, /**< OTA Client found THS service failed because of invalid operation or no found at the peer. */ + OTAS_C_EVT_TX_NTF_SET_SUCCESS, /**< OTA Client has set peer Tx notify. */ + OTAS_C_EVT_CTRL_SUCCESS, /**< OTA Client has set control info. */ + OTAS_C_EVT_PEER_DATA_RECEIVE, /**< OTA Client has received data from peer. */ + OTAS_C_EVT_TX_CPLT, /**< OTA Client has sent something to a peer successfully. */ + OTAS_C_EVT_WRITE_OP_ERR, /**< Error occured when OTA Client writen to peer. */ } otas_c_evt_type_t; /** @} */ @@ -107,17 +106,19 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { - uint16_t otas_srvc_start_handle; /**< OTA Service start handle. */ - uint16_t otas_srvc_end_handle; /**< OTA Service end handle. */ - uint16_t otas_tx_handle; /**< OTA tx characteristic handle which has been got from peer. */ - uint16_t otas_tx_cccd_handle; /**< OTA tx characteristic CCCD handle which has been got from peer. */ - uint16_t otas_rx_handle; /**< OTA rx characteristic handle which has been got from peer. */ - uint16_t otas_ctrl_handle; /**< OTA control characteristic handle which has been got from peer. */ +typedef struct +{ + uint16_t otas_srvc_start_handle; /**< OTA Service start handle. */ + uint16_t otas_srvc_end_handle; /**< OTA Service end handle. */ + uint16_t otas_tx_handle; /**< OTA tx characteristic handle which has been got from peer. */ + uint16_t otas_tx_cccd_handle; /**< OTA tx characteristic CCCD handle which has been got from peer. */ + uint16_t otas_rx_handle; /**< OTA rx characteristic handle which has been got from peer. */ + uint16_t otas_ctrl_handle; /**< OTA control characteristic handle which has been got from peer. */ } otas_c_handles_t; /**@brief OTA Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ otas_c_evt_type_t evt_type; /**< OTA client event type. */ uint8_t *p_data; /**< Pointer to event data. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/BUILD.gn new file mode 100644 index 0000000..1f0e315 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("pass") { + sources = [ "pass.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.c index 8eca9ff..7728a90 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.c @@ -49,7 +49,8 @@ **************************************************************************************** */ /**@brief Phone Alert Status Service Attributes Indexes. */ -enum { +enum +{ // Phone Alert Status Service PASS_IDX_SVC, @@ -75,136 +76,61 @@ enum { ***************************************************************************************** */ /**@brief Phone Alert Status Service environment variable. */ -struct pass_env_t { - pass_init_t pass_init; /**< Phone Alert Status Service initialization variables. */ - uint16_t start_hdl; /**< Phone Alert Status Service start handle. */ - uint16_t - alert_status_ntf_cfg[PASS_CONNECTION_MAX]; /**< The configuration of Alert Status Notification - which is configured by the peer devices. */ - uint16_t - ringer_setting_ntf_cfg[PASS_CONNECTION_MAX]; /**< The configuration of Ringer Setting Notification - which is configured by the peer devices. */ +struct pass_env_t +{ + pass_init_t pass_init; /**< Phone Alert Status Service initialization variables. */ + uint16_t start_hdl; /**< Phone Alert Status Service start handle. */ + uint16_t alert_status_ntf_cfg[PASS_CONNECTION_MAX]; /**< The configuration of Alert Status Notification which is configured by the peer devices. */ + uint16_t ringer_setting_ntf_cfg[PASS_CONNECTION_MAX]; /**< The configuration of Ringer Setting Notification which is configured by the peer devices. */ + ble_gatts_create_db_t pass_gatts_db; /**< Running Speed and Cadence Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t pass_init(void); -static void pass_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void pass_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); - - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct pass_env_t s_pass_env; +static const uint8_t s_pass_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_PHONE_ALERT_STATUS); /**@brief Full PASS Database Description - Used to add attributes into the database. */ -static const attm_desc_t pass_attr_tab[PASS_IDX_NB] = { +static const ble_gatts_attm_desc_t pass_attr_tab[PASS_IDX_NB] = +{ // Phone Alert Status Service Declaration - [PASS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [PASS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Status Characteristic - Declaration - [PASS_IDX_ALERT_STATUS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [PASS_IDX_ALERT_STATUS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Alert Status Characteristic - Value - [PASS_IDX_ALERT_STATUS_VAL] = { - BLE_ATT_CHAR_ALERT_STATUS, - NOTIFY_PERM_UNSEC | READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - PASS_ALERT_STATUS_VAL_LEN - }, + [PASS_IDX_ALERT_STATUS_VAL] = {BLE_ATT_CHAR_ALERT_STATUS, + BLE_GATTS_NOTIFY_PERM_UNSEC | BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + PASS_ALERT_STATUS_VAL_LEN}, // Alert Status Characteristic - Client Characteristic Configuration Descriptor - [PASS_IDX_ALERT_STATUS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [PASS_IDX_ALERT_STATUS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Ringer Setting Characteristic - Declaration - [PASS_IDX_RINGER_SET_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [PASS_IDX_RINGER_SET_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Ringer Setting Characteristic - Value - [PASS_IDX_RINGER_SET_VAL] = { - BLE_ATT_CHAR_RINGER_SETTING, - NOTIFY_PERM_UNSEC | READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - PASS_RINGER_SET_VAL_LEN - }, + [PASS_IDX_RINGER_SET_VAL] = {BLE_ATT_CHAR_RINGER_SETTING, + BLE_GATTS_NOTIFY_PERM_UNSEC | BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + PASS_RINGER_SET_VAL_LEN}, // Ringer Setting Characteristic - Client Characteristic Configuration Descriptor - [PASS_IDX_RINGER_SET_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, 0, 0}, + [PASS_IDX_RINGER_SET_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, 0, 0}, // Ringer Setting Characteristic - Declaration - [PASS_IDX_RINGER_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [PASS_IDX_RINGER_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Ringer Setting Characteristic - Value - [PASS_IDX_RINGER_CTRL_PT_VAL] = { - BLE_ATT_CHAR_RINGER_CNTL_POINT, - WRITE_CMD_PERM_UNSEC, - ATT_VAL_LOC_USER, - PASS_RINGER_CTRL_PT_VAL_LEN - }, -}; - -/**@brief PASS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t pass_task_cbs = { - (prf_init_func_t) pass_init, - NULL, - NULL, -}; - -/**@brief PASS Task Callbacks. */ -static gatts_prf_cbs_t pass_cb_func = { - pass_read_att_cb, - pass_write_att_cb, - NULL, - NULL, - pass_cccd_set_cb -}; - -/**@brief PASS Information. */ -static const prf_server_info_t pass_prf_info = { - .max_connection_nb = PASS_CONNECTION_MAX, - .manager_cbs = &pass_task_cbs, - .gatts_prf_cbs = &pass_cb_func, + [PASS_IDX_RINGER_CTRL_PT_VAL] = {BLE_ATT_CHAR_RINGER_CNTL_POINT, + BLE_GATTS_WRITE_CMD_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + PASS_RINGER_CTRL_PT_VAL_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Phone Alert Status Service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t pass_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t pass_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_PHONE_ALERT_STATUS); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = pass_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *) & (s_pass_env.pass_init.char_mask); - gatts_db.max_nb_attr = PASS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = pass_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_pass_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -213,18 +139,19 @@ static sdk_err_t pass_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void pass_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void pass_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, - s_pass_env.start_hdl, - PASS_IDX_NB, - (uint8_t *)&s_pass_env.pass_init.char_mask); + s_pass_env.start_hdl, + PASS_IDX_NB, + (uint8_t *)&s_pass_env.pass_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case PASS_IDX_ALERT_STATUS_VAL: cfm.length = PASS_ALERT_STATUS_VAL_LEN; cfm.value = &s_pass_env.pass_init.alert_status; @@ -262,13 +189,13 @@ static void pass_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_pa * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void pass_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; pass_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_pass_env.start_hdl, @@ -279,7 +206,8 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ event.evt_type = PASS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case PASS_IDX_ALERT_STATUS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ @@ -296,11 +224,14 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ s_pass_env.ringer_setting_ntf_cfg[conn_idx] = cccd_value; break; - case PASS_IDX_RINGER_CTRL_PT_VAL: { - switch (p_param->value[0]) { + case PASS_IDX_RINGER_CTRL_PT_VAL: + { + switch (p_param->value[0]) + { case PASS_CTRL_PT_SILENT_MODE: if ((PASS_RINGER_SET_NORMAL == s_pass_env.pass_init.ringer_setting) && \ - (PASS_RINGER_ACTIVE & s_pass_env.pass_init.alert_status)) { + (PASS_RINGER_ACTIVE & s_pass_env.pass_init.alert_status)) + { event.evt_type = PASS_EVT_SILENT_MODE_SET; } break; @@ -311,7 +242,8 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ case PASS_CTRL_PT_CANCEL_SLIENT_MODE: if ((PASS_RINGER_SET_SILENT == s_pass_env.pass_init.ringer_setting) && \ - (PASS_RINGER_ACTIVE & s_pass_env.pass_init.alert_status)) { + (PASS_RINGER_ACTIVE & s_pass_env.pass_init.alert_status)) + { event.evt_type = PASS_EVT_SILENT_MODE_CANCEL; } break; @@ -320,7 +252,7 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ break; } } - break; + break; default: cfm.status = BLE_ATT_ERR_INVALID_HANDLE; @@ -329,8 +261,8 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && PASS_EVT_INVALID != event.evt_type - && s_pass_env.pass_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && PASS_EVT_INVALID != event.evt_type && s_pass_env.pass_init.evt_handler) + { s_pass_env.pass_init.evt_handler(&event); } } @@ -344,12 +276,13 @@ static void pass_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_ * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void pass_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void pass_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; pass_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -361,7 +294,8 @@ static void pass_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va event.evt_type = PASS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case PASS_IDX_ALERT_STATUS_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ PASS_EVT_ALERT_STATUS_NTF_ENABLE : \ @@ -380,7 +314,8 @@ static void pass_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va break; } - if (PASS_EVT_INVALID != event.evt_type && s_pass_env.pass_init.evt_handler) { + if (PASS_EVT_INVALID != event.evt_type && s_pass_env.pass_init.evt_handler) + { s_pass_env.pass_init.evt_handler(&event); } } @@ -395,13 +330,14 @@ static void pass_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va static sdk_err_t pass_alert_status_send(uint8_t conn_idx) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t alert_status_ntf; + ble_gatts_noti_ind_t alert_status_ntf; - if (PRF_CLI_START_NTF == s_pass_env.alert_status_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_pass_env.alert_status_ntf_cfg[conn_idx]) + { alert_status_ntf.type = BLE_GATT_NOTIFICATION; alert_status_ntf.handle = prf_find_handle_by_idx(PASS_IDX_ALERT_STATUS_VAL, - s_pass_env.start_hdl, - (uint8_t *)&s_pass_env.pass_init.char_mask); + s_pass_env.start_hdl, + (uint8_t *)&s_pass_env.pass_init.char_mask); alert_status_ntf.length = PASS_ALERT_STATUS_VAL_LEN; alert_status_ntf.value = &s_pass_env.pass_init.alert_status; error_code = ble_gatts_noti_ind(conn_idx, &alert_status_ntf); @@ -420,13 +356,14 @@ static sdk_err_t pass_alert_status_send(uint8_t conn_idx) sdk_err_t pass_ringer_set_send(uint8_t conn_idx) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t ringer_set_ntf; + ble_gatts_noti_ind_t ringer_set_ntf; - if (PRF_CLI_START_NTF == s_pass_env.ringer_setting_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_pass_env.ringer_setting_ntf_cfg[conn_idx]) + { ringer_set_ntf.type = BLE_GATT_NOTIFICATION; ringer_set_ntf.handle = prf_find_handle_by_idx(PASS_IDX_RINGER_SET_VAL, - s_pass_env.start_hdl, - (uint8_t *)&s_pass_env.pass_init.char_mask); + s_pass_env.start_hdl, + (uint8_t *)&s_pass_env.pass_init.char_mask); ringer_set_ntf.length = PASS_ALERT_STATUS_VAL_LEN; ringer_set_ntf.value = &s_pass_env.pass_init.ringer_setting; error_code = ble_gatts_noti_ind(conn_idx, &ringer_set_ntf); @@ -435,6 +372,29 @@ sdk_err_t pass_ringer_set_send(uint8_t conn_idx) return error_code; } +static void pass_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + pass_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + pass_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + pass_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -446,7 +406,8 @@ uint8_t pass_ringer_setting_get(void) void pass_alert_status_set(uint8_t conn_idx, uint8_t new_status) { - if (new_status != s_pass_env.pass_init.alert_status) { + if (new_status != s_pass_env.pass_init.alert_status) + { s_pass_env.pass_init.alert_status = new_status; pass_alert_status_send(conn_idx); } @@ -454,7 +415,8 @@ void pass_alert_status_set(uint8_t conn_idx, uint8_t new_status) void pass_ringer_setting_set(uint8_t conn_idx, uint8_t new_setting) { - if (new_setting != s_pass_env.pass_init.ringer_setting) { + if (new_setting != s_pass_env.pass_init.ringer_setting) + { s_pass_env.pass_init.ringer_setting = new_setting; pass_ringer_set_send(conn_idx); } @@ -462,16 +424,23 @@ void pass_ringer_setting_set(uint8_t conn_idx, uint8_t new_setting) sdk_err_t pass_service_init(pass_init_t *p_pass_init) { - sdk_err_t ret; - if (p_pass_init == NULL) { + if (NULL == p_pass_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_pass_env.pass_init, sizeof(pass_init_t), p_pass_init, sizeof(pass_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_pass_env.pass_init, p_pass_init, sizeof(pass_init_t)); - return ble_server_prf_add(&pass_prf_info); + s_pass_env.start_hdl = PRF_INVALID_HANDLE; + + s_pass_env.pass_gatts_db.shdl = &s_pass_env.start_hdl; + s_pass_env.pass_gatts_db.uuid = s_pass_svc_uuid; + s_pass_env.pass_gatts_db.attr_tab_cfg = (uint8_t *)&(s_pass_env.pass_init.char_mask); + s_pass_env.pass_gatts_db.max_nb_attr = PASS_IDX_NB; + s_pass_env.pass_gatts_db.srvc_perm = 0; + s_pass_env.pass_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_pass_env.pass_gatts_db.attr_tab.attr_tab_16 = pass_attr_tab; + + return ble_gatts_prf_add(&s_pass_env.pass_gatts_db, pass_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.h index b6ce0fa..2693e83 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass/pass.h @@ -56,17 +56,16 @@ #ifndef __PASS_H__ #define __PASS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup PASS_MACRO Defines * @{ */ -#define PASS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Phone Alert Status Service connections. */ +#define PASS_CONNECTION_MAX 10 /**< Maximum number of Phone Alert Status Service connections. */ #define PASS_ALERT_STATUS_VAL_LEN 1 /**< Length of Alert Status value. */ #define PASS_RINGER_SET_VAL_LEN 1 /**< Length of Ringer Setting value. */ #define PASS_RINGER_CTRL_PT_VAL_LEN 1 /**< Length of Ringer Control Point value. */ @@ -76,9 +75,9 @@ * @{ * @brief Bit masks for the initialization of \ref pass_init_t.char_mask. */ -#define PASS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in PASS. */ -#define PASS_CHAR_RING_CTRL_PT_SUP 0x0180 /**< Bit mask for Ringer Control Point characteristic in PASS. */ -#define PASS_CHAR_FULL 0x01ff /**< Bit mask of the full characteristic. */ +#define PASS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in PASS. */ +#define PASS_CHAR_RING_CTRL_PT_SUP 0x0180 /**< Bit mask for Ringer Control Point characteristic in PASS. */ +#define PASS_CHAR_FULL 0x01ff /**< Bit mask of the full characteristic. */ /** @} */ /** @@ -108,14 +107,16 @@ * @{ */ /**@brief Phone Alert Status Service Ringer Control Point. */ -typedef enum { +typedef enum +{ PASS_CTRL_PT_SILENT_MODE = 0x01, /**< Silent Mode. */ PASS_CTRL_PT_MUTE_ONCE, /**< Mute Once. */ PASS_CTRL_PT_CANCEL_SLIENT_MODE, /**< Cancel Silent Mode. */ } pass_ringer_ctrl_pt_t; /**@brief Phone Alert Status Service event type. */ -typedef enum { +typedef enum +{ PASS_EVT_INVALID, /**< Invalid PASS event type. */ PASS_EVT_ALERT_STATUS_NTF_ENABLE, /**< Alert Status notification is enabled. */ PASS_EVT_ALERT_STATUS_NTF_DISABLE, /**< Alert Status notification is disabled. */ @@ -132,7 +133,8 @@ typedef enum { * @{ */ /**@brief Phone Alert Status Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ pass_evt_type_t evt_type; /**< The CTS event type. */ } pass_evt_t; @@ -150,12 +152,11 @@ typedef void (*pass_evt_handler_t)(pass_evt_t *p_evt); * @defgroup PASS_STRUCT Structures * @{ */ -/**@brief Phone Alert Status Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Phone Alert Status Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ pass_evt_handler_t evt_handler; /**< Phone Alert Status Service event handler. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref PASS_CHAR_MASK. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref PASS_CHAR_MASK. */ uint8_t alert_status; /**< Initial alert status. */ uint8_t ringer_setting; /**< Initial ringer setting. */ } pass_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/BUILD.gn new file mode 100644 index 0000000..d13bd51 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("pass_c") { + sources = [ "pass_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.c index 995ab06..3d883b6 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.c @@ -39,65 +39,34 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "pass_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "pass_c.h" -#define ATTR_VALUE_LEN 2 -#define UUID_OFFSET_8 8 +#include + /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Phone Alert Status Service Client environment variable. */ -struct pass_c_env_t { +struct pass_c_env_t +{ pass_c_handles_t handles; /**< Handles of PASS characteristics which will be got for peer. */ pass_c_evt_handler_t evt_handler; /**< Handler of PASS Client event */ - uint8_t prf_id; /**< PASS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void pass_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void pass_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void pass_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void pass_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct pass_c_env_t s_pass_c_env; /**< Phone Alert Status Service Client environment variable. */ - -/**@brief Phone Alert Status Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t pass_c_mgr_cbs = { - NULL, - NULL, - NULL +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_PHONE_ALERT_STATUS), HI_U16(BLE_ATT_SVC_PHONE_ALERT_STATUS)}; +static ble_uuid_t s_pass_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; - -/**@brief Phone Alert Status Service GATT Client Callbacks. */ -static gattc_prf_cbs_t pass_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - pass_c_att_read_cb, - pass_c_att_write_cb, - pass_c_att_ntf_ind_cb, - pass_c_srvc_browse_cb, - NULL, -}; - -/**@brief Phone Alert Status Service Client Information. */ -static const prf_client_info_t pass_c_prf_info = { - .max_connection_nb = PASS_C_CONNECTION_MAX, - .manager_cbs = &pass_c_mgr_cbs, - .gattc_prf_cbs = &pass_c_gattc_cbs -}; - + /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -111,7 +80,8 @@ static const prf_client_info_t pass_c_prf_info = { */ static void pass_c_evt_handler_excute(pass_c_evt_t *p_evt) { - if (s_pass_c_env.evt_handler != NULL && PASS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_pass_c_env.evt_handler && PASS_C_EVT_INVALID != p_evt->evt_type) + { s_pass_c_env.evt_handler(p_evt); } } @@ -125,23 +95,27 @@ static void pass_c_evt_handler_excute(pass_c_evt_t *p_evt) * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void pass_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void pass_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { pass_c_evt_t pass_c_evt; pass_c_evt.conn_idx = conn_idx; pass_c_evt.evt_type = PASS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_pass_c_env.handles.pass_alert_status_handle) { + if (p_read_rsp->value[0].handle == s_pass_c_env.handles.pass_alert_status_handle) + { pass_c_evt.evt_type = PASS_C_EVT_ALERT_STATUS_RECEIVE; - pass_c_evt.value.alert_status = p_read_rsp->vals[0].p_value[0]; - } else if (p_read_rsp->vals[0].handle == s_pass_c_env.handles.pass_ringer_set_handle) { + pass_c_evt.value.alert_status = p_read_rsp->value[0].p_value[0]; + } + else if (p_read_rsp->value[0].handle == s_pass_c_env.handles.pass_ringer_set_handle) + { pass_c_evt.evt_type = PASS_C_EVT_RINGER_SET_RECEIVE; - pass_c_evt.value.ringer_set = p_read_rsp->vals[0].p_value[0]; + pass_c_evt.value.ringer_set = p_read_rsp->value[0].p_value[0]; } pass_c_evt_handler_excute(&pass_c_evt); @@ -156,28 +130,33 @@ static void pass_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void pass_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void pass_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { pass_c_evt_t pass_c_evt; pass_c_evt.conn_idx = conn_idx; pass_c_evt.evt_type = PASS_C_EVT_INVALID; - if (handle == s_pass_c_env.handles.pass_alert_status_cccd_handle) { + if (handle == s_pass_c_env.handles.pass_alert_status_cccd_handle) + { pass_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS : - PASS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_pass_c_env.handles.pass_ringer_set_cccd_handle) { + PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS : + PASS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_pass_c_env.handles.pass_ringer_set_cccd_handle) + { pass_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS : - PASS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_pass_c_env.handles.pass_ringer_ctrl_pt_handle) { + PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS : + PASS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_pass_c_env.handles.pass_ringer_ctrl_pt_handle) + { pass_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - PASS_C_EVT_CTRL_POINT_SET_SUCCESS : - PASS_C_EVT_WRITE_OP_ERR; + PASS_C_EVT_CTRL_POINT_SET_SUCCESS : + PASS_C_EVT_WRITE_OP_ERR; } - pass_c_evt_handler_excute(&pass_c_evt); + pass_c_evt_handler_excute(&pass_c_evt);; } /** @@ -189,17 +168,20 @@ static void pass_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handl * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void pass_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void pass_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { pass_c_evt_t pass_c_evt; pass_c_evt.conn_idx = conn_idx; pass_c_evt.evt_type = PASS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_pass_c_env.handles.pass_alert_status_handle) { + if (p_ntf_ind->handle == s_pass_c_env.handles.pass_alert_status_handle) + { pass_c_evt.evt_type = PASS_C_EVT_ALERT_STATUS_RECEIVE; pass_c_evt.value.alert_status = p_ntf_ind->p_value[0]; - } else if (p_ntf_ind->handle == s_pass_c_env.handles.pass_ringer_set_handle) { + } + else if (p_ntf_ind->handle == s_pass_c_env.handles.pass_ringer_set_handle) + { pass_c_evt.evt_type = PASS_C_EVT_RINGER_SET_RECEIVE; pass_c_evt.value.ringer_set = p_ntf_ind->p_value[0]; } @@ -216,7 +198,7 @@ static void pass_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void pass_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void pass_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { pass_c_evt_t pass_c_evt; uint16_t uuid_disc; @@ -224,143 +206,156 @@ static void pass_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_ga pass_c_evt.conn_idx = conn_idx; pass_c_evt.evt_type = PASS_C_EVT_DISCOVERY_FAIL; - - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << UUID_OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_PHONE_ALERT_STATUS == uuid_disc) { - s_pass_c_env.handles.pass_srvc_start_handle = p_browse_srvc->start_hdl; - s_pass_c_env.handles.pass_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_PHONE_ALERT_STATUS == uuid_disc) + { + s_pass_c_env.handles.pass_srvc_start_handle = p_browse_srvc->start_hdl; + s_pass_c_env.handles.pass_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) { - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | \ - p_browse_srvc->info[i].attr.uuid[1] << UUID_OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < p_browse_srvc->end_hdl - p_browse_srvc->start_hdl; i++) + { + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_ATT_CHAR_ALERT_STATUS == uuid_disc) { - s_pass_c_env.handles.pass_alert_status_handle = handle_disc; - s_pass_c_env.handles.pass_alert_status_cccd_handle = handle_disc + 1; - } else if (BLE_ATT_CHAR_RINGER_CNTL_POINT == uuid_disc) { - s_pass_c_env.handles.pass_ringer_ctrl_pt_handle = handle_disc; - } else if (BLE_ATT_CHAR_RINGER_SETTING == uuid_disc) { - s_pass_c_env.handles.pass_ringer_set_handle = handle_disc; - s_pass_c_env.handles.pass_ringer_set_cccd_handle = handle_disc + 1; + if (BLE_ATT_CHAR_ALERT_STATUS == uuid_disc) + { + s_pass_c_env.handles.pass_alert_status_handle = handle_disc; + s_pass_c_env.handles.pass_alert_status_cccd_handle = handle_disc + 1; + } + else if (BLE_ATT_CHAR_RINGER_CNTL_POINT == uuid_disc) + { + s_pass_c_env.handles.pass_ringer_ctrl_pt_handle = handle_disc; + } + else if (BLE_ATT_CHAR_RINGER_SETTING == uuid_disc) + { + s_pass_c_env.handles.pass_ringer_set_handle = handle_disc; + s_pass_c_env.handles.pass_ringer_set_cccd_handle = handle_disc + 1; + } + } + else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; } - } else if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; } - } - pass_c_evt.evt_type = PASS_C_EVT_DISCOVERY_COMPLETE; + pass_c_evt.evt_type = PASS_C_EVT_DISCOVERY_COMPLETE; + } } pass_c_evt_handler_excute(&pass_c_evt); } +static void pass_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + pass_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + pass_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + pass_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + pass_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t pass_client_init(pass_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_pass_c_env, sizeof(s_pass_c_env), 0, sizeof(s_pass_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_pass_c_env, 0, sizeof(s_pass_c_env)); s_pass_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&pass_c_prf_info, &s_pass_c_env.prf_id); + return ble_gattc_prf_add(&s_pass_service_uuid, pass_c_ble_evt_handler); } sdk_err_t pass_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - target_uuid[0] = LO_U16(BLE_ATT_SVC_PHONE_ALERT_STATUS); - target_uuid[1] = HI_U16(BLE_ATT_SVC_PHONE_ALERT_STATUS); - const ble_uuid_t pass_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - return ble_gattc_prf_services_browse(s_pass_c_env.prf_id, conn_idx, &pass_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_pass_service_uuid); } sdk_err_t pass_c_alert_status_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_alert_status_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_alert_status_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_pass_c_env.handles.pass_alert_status_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_pass_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_pass_c_env.handles.pass_alert_status_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t pass_c_ringer_set_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_set_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_set_cccd_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_pass_c_env.handles.pass_ringer_set_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_pass_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_pass_c_env.handles.pass_ringer_set_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t pass_c_ctrl_point_set(uint8_t conn_idx, uint8_t ctrl_value) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_ctrl_pt_handle) { + if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_ctrl_pt_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_pass_c_env.handles.pass_ringer_ctrl_pt_handle; - write_attr_value.length = PASS_C_RINGER_CTRL_PT_VAL_LEN; - write_attr_value.p_value = &ctrl_value; - - return ble_gattc_prf_write_no_resp(s_pass_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_pass_c_env.handles.pass_ringer_ctrl_pt_handle, PASS_C_RINGER_CTRL_PT_VAL_LEN, &ctrl_value); } sdk_err_t pass_c_alert_status_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_alert_status_handle) { + if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_alert_status_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_pass_c_env.prf_id, conn_idx, s_pass_c_env.handles.pass_alert_status_handle, 0); + return ble_gattc_read(conn_idx, s_pass_c_env.handles.pass_alert_status_handle, 0); } sdk_err_t pass_c_ringer_set_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_set_handle) { + if (BLE_ATT_INVALID_HDL == s_pass_c_env.handles.pass_ringer_set_handle) + { return BLE_ATT_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_pass_c_env.prf_id, conn_idx, s_pass_c_env.handles.pass_ringer_set_handle, 0); + return ble_gattc_read(conn_idx, s_pass_c_env.handles.pass_ringer_set_handle, 0); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.h index 5b53096..3b1e083 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pass_c/pass_c.h @@ -3,7 +3,7 @@ * * @file pass_c.h * - * @brief API + * @brief Phone Alert Status Service Client API. * ***************************************************************************************** * @attention @@ -59,11 +59,11 @@ #ifndef __PASS_C_H__ #define __PASS_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup PASS_C_MACRO Defines @@ -74,8 +74,7 @@ * @{ * @brief PASS Alert Status bits. */ -#define PASS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */ +#define PASS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ #define PASS_C_NO_STATE_ACTIVE (0x00) /**< Bit for no state active. */ #define PASS_C_RINGER_ACTIVE (0x01 << 0) /**< Bit for ringer State active. */ #define PASS_C_VIBRATE_ACTIVE (0x01 << 1) /**< Bit for vibrate State active. */ @@ -100,26 +99,25 @@ * @{ */ /**@brief Phone Alert Status Service Client Ringer Control Point. */ -typedef enum { +typedef enum +{ PASS_C_CTRL_PT_SILENT_MODE = 0x01, /**< Silent Mode. */ PASS_C_CTRL_PT_MUTE_ONCE, /**< Mute Once. */ PASS_C_CTRL_PT_CANCEL_SLIENT_MODE, /**< Cancel Silent Mode. */ } pass_c_ringer_ctrl_pt_t; /**@brief Phone Alert Status Service Client event type. */ -typedef enum { - PASS_C_EVT_INVALID, /**< PASS Client invalid event. */ +typedef enum +{ + PASS_C_EVT_INVALID, /*<* PASS Client invalid event. */ PASS_C_EVT_DISCOVERY_COMPLETE, /**< PASS Client has found PASS service and its characteristics. */ - PASS_C_EVT_DISCOVERY_FAIL, /**< PASS Client found PASS service failed because of \ - invalid operation or no found at the peer. */ - PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS, /**< PASS Client has set Notification of Alert Status characteristic. */ - PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS, /**< PASS Client has set Notification of Ringer Setting characteristic. */ - PASS_C_EVT_ALERT_STATUS_RECEIVE, /**< PASS Client has received Alert Status value \ - (Read or Notification from peer). */ - PASS_C_EVT_RINGER_SET_RECEIVE, /**< PASS Client has received Ringer Setting Value \ - (Read or Notification from peer). */ - PASS_C_EVT_CTRL_POINT_SET_SUCCESS, /**< PASS Client has writen Control Point completely. */ - PASS_C_EVT_WRITE_OP_ERR, /**< Error occured when PASS Client writen to peer. */ + PASS_C_EVT_DISCOVERY_FAIL, /**< PASS Client found PASS service failed because of invalid operation or no found at the peer. */ + PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS, /**< PASS Client has set Notification of Alert Status characteristic. */ + PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS, /**< PASS Client has set Notification of Ringer Setting characteristic. */ + PASS_C_EVT_ALERT_STATUS_RECEIVE, /**< PASS Client has received Alert Status value (Read or Notification from peer). */ + PASS_C_EVT_RINGER_SET_RECEIVE, /**< PASS Client has received Ringer Setting Value (Read or Notification from peer). */ + PASS_C_EVT_CTRL_POINT_SET_SUCCESS, /**< PASS Client has writen Control Point completely. */ + PASS_C_EVT_WRITE_OP_ERR, /**< Error occured when PASS Client writen to peer. */ } pass_c_evt_type_t; /** @} */ @@ -129,26 +127,24 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t pass_srvc_start_handle; /**< PASS Service start handle. */ uint16_t pass_srvc_end_handle; /**< PASS Service end handle. */ - uint16_t pass_alert_status_handle; /**< PASS Alert Status characteristic Value handle \ - which has been got from peer. */ - uint16_t pass_alert_status_cccd_handle; /**< PASS CCCD handle of Alert Status characteristic \ - which has been got from peer. */ - uint16_t pass_ringer_set_handle; /**< PASS Ringer Setting characteristic Value handle \ - which has been got from peer. */ - uint16_t pass_ringer_set_cccd_handle; /**< PASS CCCD handle of Ringer Setting characteristic \ - which has been got from peer. */ - uint16_t pass_ringer_ctrl_pt_handle; /**< PASS Ringer Control Point characteristic Value handle \ - which has been got from peer. */ + uint16_t pass_alert_status_handle; /**< PASS Alert Status characteristic Value handle which has been got from peer. */ + uint16_t pass_alert_status_cccd_handle; /**< PASS CCCD handle of Alert Status characteristic which has been got from peer. */ + uint16_t pass_ringer_set_handle; /**< PASS Ringer Setting characteristic Value handle which has been got from peer. */ + uint16_t pass_ringer_set_cccd_handle; /**< PASS CCCD handle of Ringer Setting characteristic which has been got from peer. */ + uint16_t pass_ringer_ctrl_pt_handle; /**< PASS Ringer Control Point characteristic Value handle which has been got from peer. */ } pass_c_handles_t; /**@brief Phone Alert Status Client Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ pass_c_evt_type_t evt_type; /**< The PASS event type. */ - union { + union + { uint8_t alert_status; /**< Alert status received. */ uint8_t ringer_set; /**< Ringer setting received. */ } value; /**< Value received. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/BUILD.gn new file mode 100644 index 0000000..002bfe6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("pcs") { + sources = [ "pcs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.c index 8893300..daef8fa 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.c @@ -49,10 +49,8 @@ ***************************************************************************************** */ /**@brief The UUIDs of PCS characteristics. */ -#define PCS_CHARACTERISTIC_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ - 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x05, 0xED, 0xA6} -#define PCS_CHARACTERISTIC_SETTING_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ - 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x05, 0xED, 0xA6} +#define PCS_CHARACTERISTIC_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x05, 0xED, 0xA6} +#define PCS_CHARACTERISTIC_SETTING_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x05, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -64,7 +62,8 @@ ***************************************************************************************** */ /**@brief PCS Service Attributes Indexes. */ -enum pcs_attr_idx_t { +enum pcs_attr_idx_t +{ PCS_IDX_SVC, PCS_IDX_TX_CHAR, @@ -83,134 +82,60 @@ enum pcs_attr_idx_t { ***************************************************************************************** */ /**@brief PCS Service environment variable. */ -struct pcs_env_t { - pcs_init_t pcs_init; /**< PCS Service initialization variables. */ - uint16_t start_hdl; /**< Start handle of services */ - uint16_t tx_ntf_cfg[PCS_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of the peers. */ - uint16_t setting_ind_cfg[PCS_CONNECTION_MAX]; /**< Setting Characteristic Indication configuration - of the peers. */ +struct pcs_env_t +{ + pcs_init_t pcs_init; /**< PCS Service initialization variables. */ + uint16_t start_hdl; /**< Start handle of services */ + uint16_t tx_ntf_cfg[PCS_CONNECTION_MAX]; /**< TX Characteristic Notification configuration of the peers. */ + uint16_t setting_ind_cfg[PCS_CONNECTION_MAX]; /**< Setting Characteristic Indication configuration of the peers. */ + ble_gatts_create_db_t pcs_gatts_db; /**< Running Speed and Cadence Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t pcs_init(void); -static void pcs_disconnected(uint8_t conn_idx, uint8_t disconn_reason); -static void pcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void pcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void pcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void pcs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct pcs_env_t s_pcs_env; static const uint16_t s_char_mask = 0xFFFF; +static const uint8_t s_pcs_svc_uuid[] = {PCS_SERVICE_UUID}; /**@brief Full PCS Database Description which is used to add attributes into the ATT database. */ -static const attm_desc_128_t pcs_att_db[PCS_IDX_NB] = { +static const ble_gatts_attm_desc_128_t pcs_attr_tab[PCS_IDX_NB] = +{ // PCS service - [PCS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [PCS_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // PCS TX Characteristic Declaration - [PCS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [PCS_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // PCS TX Characteristic Value - [PCS_IDX_TX_VAL] = { - PCS_CHARACTERISTIC_TX_UUID, - NOTIFY_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - PCS_MAX_DATA_LEN - }, + [PCS_IDX_TX_VAL] = {PCS_CHARACTERISTIC_TX_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + PCS_MAX_DATA_LEN}, // PCS TX Characteristic - Client Characteristic Configuration Descriptor - [PCS_IDX_TX_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, - + [PCS_IDX_TX_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, + // PCS settings - [PCS_IDX_SETTING_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [PCS_IDX_SETTING_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // PCS settings Value - [PCS_IDX_SETTING_VAL] = { - PCS_CHARACTERISTIC_SETTING_UUID, - (WRITE_CMD_PERM_UNSEC | INDICATE_PERM_UNSEC), - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - PCS_MAX_DATA_LEN - }, + [PCS_IDX_SETTING_VAL] = {PCS_CHARACTERISTIC_SETTING_UUID, + (BLE_GATTS_WRITE_CMD_PERM_UNSEC | BLE_GATTS_INDICATE_PERM_UNSEC), + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + PCS_MAX_DATA_LEN}, // ths settings cfg - [PCS_IDX_SETTING_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - (READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC | WRITE_CMD_PERM_UNSEC), - 0, - 0 - }, -}; - -/**@brief PCS Service interface required by profile manager. */ -static ble_prf_manager_cbs_t pcs_mgr_cbs = { - (prf_init_func_t)pcs_init, - NULL, - pcs_disconnected, -}; - -/**@brief PCS GATT Server Callbacks. */ -static gatts_prf_cbs_t pcs_gatts_cbs = { - pcs_read_att_cb, - pcs_write_att_cb, - NULL, - pcs_ntf_ind_cb, - pcs_cccd_set_cb -}; - -/**@brief PCS Server Information. */ -static const prf_server_info_t pcs_prf_info = { - .max_connection_nb = PCS_CONNECTION_MAX, - .manager_cbs = &pcs_mgr_cbs, - .gatts_prf_cbs = &pcs_gatts_cbs + [PCS_IDX_SETTING_CFG] = {ATT_128_CLIENT_CHAR_CFG, + (BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_WRITE_CMD_PERM_UNSEC), + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize PCS and create DB in ATT. - * - * @return Error code to know if service initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t pcs_init(void) -{ - const uint8_t pcs_svc_uuid[] = {PCS_SERVICE_UUID}; - uint16_t start_hdl = PRF_INVALID_HANDLE; - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = pcs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; - gatts_db.max_nb_attr = PCS_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = pcs_att_db; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_pcs_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -219,9 +144,9 @@ static sdk_err_t pcs_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void pcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void pcs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint16_t handle = p_param->handle; uint8_t tab_index = 0; @@ -229,7 +154,8 @@ static void pcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case PCS_IDX_TX_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_pcs_env.tx_ntf_cfg[conn_idx]; @@ -241,7 +167,7 @@ static void pcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par cfm.value = (uint8_t *)&s_pcs_env.setting_ind_cfg[conn_idx]; cfm.status = BLE_SUCCESS; break; - + default: cfm.length = 0; cfm.status = BLE_ATT_ERR_INVALID_HANDLE; @@ -259,20 +185,22 @@ static void pcs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par * @param[in] p_param: Point to the parameters of the write request. ***************************************************************************************** */ -static void pcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void pcs_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint16_t cccd_value; pcs_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_pcs_env.start_hdl, PCS_IDX_NB, (uint8_t *)&s_char_mask); event.conn_idx = conn_idx; cfm.handle = handle; cfm.status = BLE_SUCCESS; + + switch (tab_index) + { - switch (tab_index) { case PCS_IDX_TX_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? PCS_EVT_TX_ENABLE : PCS_EVT_TX_DISABLE; @@ -294,8 +222,8 @@ static void pcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p break; } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && PCS_EVT_INVALID != event.evt_type && - s_pcs_env.pcs_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && PCS_EVT_INVALID != event.evt_type && s_pcs_env.pcs_init.evt_handler) + { event.conn_idx = conn_idx; event.p_data = (uint8_t *)p_param->value; event.length = p_param->length; @@ -315,12 +243,13 @@ static void pcs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void pcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void pcs_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; pcs_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -328,7 +257,8 @@ static void pcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.conn_idx = conn_idx; event.evt_type = PCS_EVT_INVALID; - switch (tab_index) { + switch (tab_index) + { case PCS_IDX_SETTING_CFG: event.evt_type = (PRF_CLI_START_IND == cccd_value) ? PCS_EVT_SETTING_ENABLE : PCS_EVT_SETTING_DISABLE; s_pcs_env.setting_ind_cfg[conn_idx] = cccd_value; @@ -338,7 +268,8 @@ static void pcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (PCS_EVT_INVALID != event.evt_type && s_pcs_env.pcs_init.evt_handler) { + if (PCS_EVT_INVALID != event.evt_type && s_pcs_env.pcs_init.evt_handler) + { s_pcs_env.pcs_init.evt_handler(&event); } } @@ -350,16 +281,18 @@ static void pcs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] conn_idx: Index of the connection. ***************************************************************************************** */ -static void pcs_disconnected(uint8_t conn_idx, uint8_t disconn_reason) +static void pcs_disconnect_evt_handler(uint8_t conn_idx, uint8_t disconn_reason) { - pcs_evt_t event = { + pcs_evt_t event = + { .conn_idx = conn_idx, .evt_type = PCS_EVT_DISCONNECTED, .p_data = &disconn_reason, .length = sizeof(uint8_t) }; - if (s_pcs_env.pcs_init.evt_handler) { + if (s_pcs_env.pcs_init.evt_handler) + { s_pcs_env.pcs_init.evt_handler(&event); } } @@ -373,19 +306,52 @@ static void pcs_disconnected(uint8_t conn_idx, uint8_t disconn_reason) * @param[in] p_ntf_ind: Pointer to the structure of the complete event. ***************************************************************************************** */ -static void pcs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void pcs_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_pcs_env.pcs_init.evt_handler != NULL) { + if (NULL != s_pcs_env.pcs_init.evt_handler) + { pcs_evt_t event; event.conn_idx = conn_idx; - if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (BLE_SUCCESS == status && BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = PCS_EVT_TX_DATA_SENT; s_pcs_env.pcs_init.evt_handler(&event); } } } +static void pcs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + pcs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + pcs_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + pcs_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + pcs_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + pcs_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -393,9 +359,10 @@ static void pcs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf sdk_err_t pcs_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_rsp; + ble_gatts_noti_ind_t send_rsp; - if (PRF_CLI_START_NTF == s_pcs_env.tx_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_pcs_env.tx_ntf_cfg[conn_idx]) + { // Fill in the parameter structure send_rsp.type = BLE_GATT_NOTIFICATION; send_rsp.handle = prf_find_handle_by_idx(PCS_IDX_TX_VAL, s_pcs_env.start_hdl, (uint8_t *)&s_char_mask); @@ -414,9 +381,10 @@ sdk_err_t pcs_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) sdk_err_t pcs_setting_reply(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t send_cmd; + ble_gatts_noti_ind_t send_cmd; - if (PRF_CLI_START_IND == s_pcs_env.setting_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_pcs_env.setting_ind_cfg[conn_idx]) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_INDICATION; send_cmd.handle = prf_find_handle_by_idx(PCS_IDX_SETTING_VAL, s_pcs_env.start_hdl, (uint8_t *)&s_char_mask); @@ -434,15 +402,22 @@ sdk_err_t pcs_setting_reply(uint8_t conn_idx, uint8_t *p_data, uint16_t length) sdk_err_t pcs_service_init(pcs_init_t *p_pcs_init) { - sdk_err_t ret; - if (p_pcs_init == NULL) { + if (NULL == p_pcs_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_pcs_env.pcs_init, sizeof(pcs_init_t), p_pcs_init, sizeof(pcs_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_pcs_env.pcs_init, p_pcs_init, sizeof(pcs_init_t)); - return ble_server_prf_add(&pcs_prf_info); + s_pcs_env.start_hdl = PRF_INVALID_HANDLE; + + s_pcs_env.pcs_gatts_db.shdl = &s_pcs_env.start_hdl; + s_pcs_env.pcs_gatts_db.uuid = s_pcs_svc_uuid; + s_pcs_env.pcs_gatts_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_pcs_env.pcs_gatts_db.max_nb_attr = PCS_IDX_NB; + s_pcs_env.pcs_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_pcs_env.pcs_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_pcs_env.pcs_gatts_db.attr_tab.attr_tab_128 = pcs_attr_tab; + + return ble_gatts_prf_add(&s_pcs_env.pcs_gatts_db, pcs_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.h index 5757c6e..d90c014 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/pcs/pcs.h @@ -58,18 +58,17 @@ #ifndef __PCS_H__ #define __PCS_H__ -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" /** * @defgroup PCS_MACRO Defines * @{ */ -#define PCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Power Consumption Service connections. */ -#define PCS_MAX_DATA_LEN 244 /**< Maximum length of application data packet which is transmitted via PCS. */ -#define PCS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x05, \ - 0xED, 0xA6 /**< The UUID of Power Consumption Service for setting advertising data. */ +#define PCS_CONNECTION_MAX 10 /**< Maximum number of Power Consumption Service connections. */ +#define PCS_MAX_DATA_LEN 244 /**< Maximum length of application data packet which is transmitted via PCS. */ +#define PCS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x05, 0xED, 0xA6 /**< The UUID of Power Consumption Service for setting advertising data. */ #define PCS_SET_PARAM_SUCCESS 0x00 /**< PCS parameters set successfully. */ #define PCS_SET_PARAM_FAIL 0x81 /**< PCS parameters set unsuccessfully. */ @@ -86,7 +85,8 @@ * @{ */ /**@brief PCS Service event types. */ -typedef enum { +typedef enum +{ PCS_EVT_INVALID, /**< Invalid PCS event. */ PCS_EVT_TX_ENABLE, /**< TX notify has been enabled. */ PCS_EVT_TX_DISABLE, /**< TX notify has been disabled. */ @@ -98,7 +98,8 @@ typedef enum { } pcs_evt_type_t; /**@brief PCS Service settings types. */ -typedef enum { +typedef enum +{ PCS_SETTING_TYPE_ADV_INTERVAL, /**< BLE Advertising Interval parameter. */ PCS_SETTING_TYPE_CONN_PARAM, /**< BLE Connection parameter. */ PCS_SETTING_TYPE_PHY, /**< Radio Phy mode, 1M, 2M, Encoded. */ @@ -112,7 +113,8 @@ typedef enum { * @{ */ /**@brief PCS Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ pcs_evt_type_t evt_type; /**< The PCS event type. */ uint8_t *p_data; /**< Pointer to data. */ @@ -132,9 +134,9 @@ typedef void (*pcs_evt_handler_t)(pcs_evt_t *p_evt); * @addtogroup PCS_STRUCT Structures * @{ */ -/**@brief PCS Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief PCS Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ pcs_evt_handler_t evt_handler; /**< PCS Service event handler. */ } pcs_init_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/BUILD.gn new file mode 100644 index 0000000..06ea183 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("rscs") { + sources = [ "rscs.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.c index 70992d3..c137129 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.c @@ -43,13 +43,14 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define INDEX_2 + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief Running Speed and Cadence Service Attributes Indexes. */ -enum { +enum +{ RSCS_IDX_SVC, RSCS_IDX_RSC_MEAS_CHAR, @@ -74,32 +75,22 @@ enum { ***************************************************************************************** */ /**@brief Running Speed and Cadence Service environment variable. */ -struct rscs_env_t { - rscs_init_t - rscs_init; /**< Running Speed and Cadence Service initialization variables. */ - uint16_t start_hdl; /**< Running Speed and Cadence Service start handle. */ - bool - ctrl_pt_op_in_progress; /**< A previously triggered SC Control Point operation is still in progress. */ - bool - ctrl_pt_op_rsp_cplt; /**< A previously triggered SC Control Point operation response cplt. */ - uint16_t - meas_ntf_cfg[RSCS_CONNECTION_MAX]; /**< The configuration of RCS Measurement Notification - which is configured by the peer devices. */ - uint16_t - ctrl_point_ind_cfg[RSCS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification - which is configured by the peer devices. */ +struct rscs_env_t +{ + rscs_init_t rscs_init; /**< Running Speed and Cadence Service initialization variables. */ + uint16_t start_hdl; /**< Running Speed and Cadence Service start handle. */ + bool ctrl_pt_op_in_progress; /**< A previously triggered SC Control Point operation is still in progress. */ + bool ctrl_pt_op_rsp_cplt; /**< A previously triggered SC Control Point operation response cplt. */ + uint16_t meas_ntf_cfg[RSCS_CONNECTION_MAX]; /**< The configuration of RCS Measurement Notification which is configured by the peer devices. */ + uint16_t ctrl_point_ind_cfg[RSCS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification which is configured by the peer devices. */ + ble_gatts_create_db_t rscs_gatts_db; /**< Running Speed and Cadence Service attributs database. */ }; -/* + + /* * LOCAL FUNCTION DECLARATION - ***************************************************************************************** + **************************************************************************************** */ -static sdk_err_t rscs_init(void); -static void rscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void rscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void rscs_disconnect_cb(uint8_t conn_idx, uint8_t reason); -static void rscs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); static void rscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); /* @@ -107,130 +98,61 @@ static void rscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_da ***************************************************************************************** */ static struct rscs_env_t s_rscs_env; +static const uint8_t s_rscs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_RUNNING_SPEED_CADENCE); /**@brief Full RSCS Database Description - Used to add attributes into the database. */ -static const attm_desc_t rscs_attr_tab[RSCS_IDX_NB] = { +static const ble_gatts_attm_desc_t rscs_attr_tab[RSCS_IDX_NB] = +{ // Running Speed and Cadence Service Declaration - [RSCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [RSCS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // RSC Measurement Characteristic - Declaration - [RSCS_IDX_RSC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RSCS_IDX_RSC_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // RSC Measurement Characteristic - Value - [RSCS_IDX_RSC_MEAS_VAL] = { - BLE_ATT_CHAR_RSC_MEAS, - NOTIFY_PERM_UNSEC, - ATT_VAL_LOC_USER, - RSCS_MEAS_VAL_LEN_MAX - }, + [RSCS_IDX_RSC_MEAS_VAL] = {BLE_ATT_CHAR_RSC_MEAS, + BLE_GATTS_NOTIFY_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + RSCS_MEAS_VAL_LEN_MAX}, // RSC Measurement Characteristic - Client Characteristic Configuration Descriptor - [RSCS_IDX_RSC_MEAS_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [RSCS_IDX_RSC_MEAS_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // RSC Feature Characteristic - Declaration - [RSCS_IDX_RSC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RSCS_IDX_RSC_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // RSC Feature Characteristic - Value - [RSCS_IDX_RSC_FEAT_VAL] = { - BLE_ATT_CHAR_RSC_FEAT, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - RSCS_FEAT_VAL_LEN_MAX - }, + [RSCS_IDX_RSC_FEAT_VAL] = {BLE_ATT_CHAR_RSC_FEAT, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + RSCS_FEAT_VAL_LEN_MAX}, // Sensor Location Characteristic - Declaration - [RSCS_IDX_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RSCS_IDX_SENSOR_LOC_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Sensor Location Characteristic - Value - [RSCS_IDX_SENSOR_LOC_VAL] = { - BLE_ATT_CHAR_SENSOR_LOC, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - RSCS_SENSOR_LOC_VAL_LEN_MAX - }, + [RSCS_IDX_SENSOR_LOC_VAL] = {BLE_ATT_CHAR_SENSOR_LOC, + BLE_GATTS_READ_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + RSCS_SENSOR_LOC_VAL_LEN_MAX}, // SC Control Point Characteristic - Declaration - [RSCS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RSCS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // SC Control Point Characteristic - Value - [RSCS_IDX_CTRL_POINT_VAL] = { - BLE_ATT_CHAR_SC_CNTL_PT, - WRITE_REQ_PERM_UNSEC | INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - RSCS_CTRL_PT_VAL_LEN_MAX - }, + [RSCS_IDX_CTRL_POINT_VAL] = {BLE_ATT_CHAR_SC_CNTL_PT, + BLE_GATTS_WRITE_REQ_PERM_UNSEC | BLE_GATTS_INDICATE_PERM_UNSEC, + BLE_GATTS_ATT_VAL_LOC_USER, + RSCS_CTRL_PT_VAL_LEN_MAX}, // SC Control Point Characteristic - Client Characteristic Configuration Descriptor - [RSCS_IDX_CTRL_POINT_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief RSCS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t rscs_task_cbs = { - (prf_init_func_t) rscs_init, - NULL, - rscs_disconnect_cb, -}; - -/**@brief RSCS Task Callbacks. */ -static gatts_prf_cbs_t rscs_cb_func = { - rscs_read_att_cb, - rscs_write_att_cb, - NULL, - rscs_ntf_ind_cb, - rscs_cccd_set_cb -}; - -/**@brief RSCS Information. */ -static const prf_server_info_t rscs_prf_info = { - .max_connection_nb = RSCS_CONNECTION_MAX, - .manager_cbs = &rscs_task_cbs, - .gatts_prf_cbs = &rscs_cb_func, + [RSCS_IDX_CTRL_POINT_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Running Speed and Cadence service create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t rscs_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t rscs_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_RUNNING_SPEED_CADENCE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = rscs_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_rscs_env.rscs_init.char_mask); - gatts_db.max_nb_attr = RSCS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = rscs_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_rscs_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -239,18 +161,19 @@ static sdk_err_t rscs_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void rscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void rscs_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_rscs_env.start_hdl, - RSCS_IDX_NB, - (uint8_t *)&s_rscs_env.rscs_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_rscs_env.start_hdl, + RSCS_IDX_NB, + (uint8_t *)&s_rscs_env.rscs_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case RSCS_IDX_RSC_MEAS_NTF_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_rscs_env.meas_ntf_cfg[conn_idx]; @@ -265,7 +188,7 @@ static void rscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)&s_rscs_env.rscs_init.sensor_location; break; - + case RSCS_IDX_CTRL_POINT_IND_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_rscs_env.ctrl_point_ind_cfg[conn_idx]; @@ -288,14 +211,14 @@ static void rscs_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void rscs_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t tab_index = 0; - uint16_t cccd_value = 0; - bool ctrl_pt_evt = false; - rscs_evt_t event; - gatts_write_cfm_t cfm; + uint16_t handle = p_param->handle; + uint16_t tab_index = 0; + uint16_t cccd_value = 0; + bool ctrl_pt_evt = false; + rscs_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_rscs_env.start_hdl, @@ -305,23 +228,29 @@ static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa cfm.status = BLE_SUCCESS; event.evt_type = RSCS_EVT_INVALID; event.conn_idx = conn_idx; - - switch (tab_index) { + + switch (tab_index) + { case RSCS_IDX_RSC_MEAS_NTF_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE :\ - RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE); + RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE :\ + RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE); s_rscs_env.meas_ntf_cfg[conn_idx] = cccd_value; break; case RSCS_IDX_CTRL_POINT_VAL: - if (PRF_CLI_START_IND != s_rscs_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND != s_rscs_env.ctrl_point_ind_cfg[conn_idx]) + { cfm.status = RSCS_ERROR_CCCD_INVALID; break; - } else if (s_rscs_env.ctrl_pt_op_in_progress) { + } + else if (s_rscs_env.ctrl_pt_op_in_progress) + { cfm.status = RSCS_ERROR_PROC_IN_PROGRESS; - } else if (PRF_CLI_START_IND == s_rscs_env.ctrl_point_ind_cfg[conn_idx]) { + } + else if (PRF_CLI_START_IND == s_rscs_env.ctrl_point_ind_cfg[conn_idx]) + { s_rscs_env.ctrl_pt_op_in_progress = true; ctrl_pt_evt = true; } @@ -330,8 +259,8 @@ static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa case RSCS_IDX_CTRL_POINT_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - RSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ - RSCS_EVT_CTRL_POINT_INDICATION_DISABLE); + RSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ + RSCS_EVT_CTRL_POINT_INDICATION_DISABLE); s_rscs_env.ctrl_point_ind_cfg[conn_idx] = cccd_value; break; @@ -342,14 +271,17 @@ static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa ble_gatts_write_cfm(conn_idx, &cfm); - if (ctrl_pt_evt) { + if (ctrl_pt_evt) + { rscs_sc_ctrl_pt_handler(conn_idx, p_param->value, p_param->length); - } else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && RSCS_EVT_INVALID != event.evt_type - && s_rscs_env.rscs_init.evt_handler) { + } + else if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && RSCS_EVT_INVALID != event.evt_type && s_rscs_env.rscs_init.evt_handler) + { s_rscs_env.rscs_init.evt_handler(&event); } } + /** ***************************************************************************************** * @brief Handles reception of the cccd recover request. @@ -359,43 +291,46 @@ static void rscs_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void rscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void rscs_cccd_set_evt_handler(uint8_t conn_idx, const ble_gatts_evt_cccd_rec_t *p_cccd_rec) { uint16_t tab_index = 0; rscs_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(p_cccd_rec->cccd_val)) + { return; } - tab_index = prf_find_idx_by_handle(handle, + tab_index = prf_find_idx_by_handle(p_cccd_rec->handle, s_rscs_env.start_hdl, RSCS_IDX_NB, (uint8_t *)&s_rscs_env.rscs_init.char_mask); event.evt_type = RSCS_EVT_INVALID; event.conn_idx = conn_idx; - - switch (tab_index) { + + switch (tab_index) + { case RSCS_IDX_RSC_MEAS_NTF_CFG: - event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ?\ - RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE :\ - RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE); - s_rscs_env.meas_ntf_cfg[conn_idx] = cccd_value; + event.evt_type = ((PRF_CLI_START_NTF == p_cccd_rec->cccd_val) ?\ + RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE :\ + RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE); + s_rscs_env.meas_ntf_cfg[conn_idx] = p_cccd_rec->cccd_val; break; case RSCS_IDX_CTRL_POINT_IND_CFG: - event.evt_type = ((PRF_CLI_START_IND == cccd_value) ?\ - RSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ - RSCS_EVT_CTRL_POINT_INDICATION_DISABLE); - s_rscs_env.ctrl_point_ind_cfg[conn_idx] = cccd_value; + event.evt_type = ((PRF_CLI_START_IND == p_cccd_rec->cccd_val) ?\ + RSCS_EVT_CTRL_POINT_INDICATION_ENABLE :\ + RSCS_EVT_CTRL_POINT_INDICATION_DISABLE); + s_rscs_env.ctrl_point_ind_cfg[conn_idx] = p_cccd_rec->cccd_val; break; default: break; } - if (RSCS_EVT_INVALID != event.evt_type && s_rscs_env.rscs_init.evt_handler) { + if (RSCS_EVT_INVALID != event.evt_type && s_rscs_env.rscs_init.evt_handler) + { s_rscs_env.rscs_init.evt_handler(&event); } } @@ -409,17 +344,21 @@ static void rscs_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_va * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void rscs_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void rscs_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { rscs_evt_t event; event.evt_type = RSCS_EVT_INVALID; event.conn_idx = conn_idx; - if (s_rscs_env.rscs_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (s_rscs_env.rscs_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = RSCS_EVT_RSC_MEAS_SEND_CPLT; - } else if (BLE_GATT_INDICATION == p_ntf_ind->type) { + } + else if (BLE_GATT_INDICATION == p_ntf_ind->type) + { event.evt_type = RSCS_EVT_CTRL_POINT_RSP_CPLT; s_rscs_env.ctrl_pt_op_in_progress = false; } @@ -441,19 +380,22 @@ static void rscs_op_set_cumulative_handler(uint8_t conn_idx, const uint8_t *p_da rscs_evt_t event; uint8_t rsp[RSCS_CTRL_PT_RSP_LEN_MIN]; - rsp[INDEX_0] = RSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = RSCS_CTRL_PT_OP_SET_CUMUL_VAL; - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_FAILED; + rsp[0] = RSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = RSCS_CTRL_PT_OP_SET_CUMUL_VAL; + rsp[2] = RSCS_CTRL_PT_RSP_FAILED; if ((sizeof(uint32_t) == length) && \ (s_rscs_env.rscs_init.feature & RSCS_FEAT_TOTAL_DISTANCE_BIT) && \ - (s_rscs_env.rscs_init.evt_handler)) { + (s_rscs_env.rscs_init.evt_handler)) + { event.conn_idx = conn_idx; event.evt_type = RSCS_EVT_CUMUL_VAL_SET; event.p_data = p_data; event.length = length; s_rscs_env.rscs_init.evt_handler(&event); - } else { + } + else + { rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -470,15 +412,18 @@ static void rscs_op_start_calibration_handler(uint8_t conn_idx) rscs_evt_t event; uint8_t rsp[RSCS_CTRL_PT_RSP_LEN_MIN]; - rsp[INDEX_0] = RSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = RSCS_CTRL_PT_OP_START_CALIB; - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_FAILED; + rsp[0] = RSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = RSCS_CTRL_PT_OP_START_CALIB; + rsp[2] = RSCS_CTRL_PT_RSP_FAILED; - if ((s_rscs_env.rscs_init.feature & RSCS_FEAT_CALIBRATION_PROCEDURE_BIT) && s_rscs_env.rscs_init.evt_handler) { + if ((s_rscs_env.rscs_init.feature & RSCS_FEAT_CALIBRATION_PROCEDURE_BIT) && s_rscs_env.rscs_init.evt_handler) + { event.conn_idx = conn_idx; event.evt_type = RSCS_EVT_SEBSOR_CALIBRATION; s_rscs_env.rscs_init.evt_handler(&event); - } else { + } + else + { rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -497,20 +442,25 @@ static void rscs_op_sensor_loc_update_handler(uint8_t conn_idx, const uint8_t *p rscs_evt_t event; uint8_t rsp[RSCS_CTRL_PT_RSP_LEN_MIN]; - rsp[INDEX_0] = RSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = RSCS_CTRL_PT_OP_UPD_LOC; + rsp[0] = RSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = RSCS_CTRL_PT_OP_UPD_LOC; - if (RSCS_SENSOR_LOC_SUP_NB <= p_data[0] || sizeof(uint8_t) != length) { - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_INVALID_PARAM; + if (RSCS_SENSOR_LOC_SUP_NB <= p_data[0] || sizeof(uint8_t) != length) + { + rsp[2] = RSCS_CTRL_PT_RSP_INVALID_PARAM; rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); - } else if ((s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) && s_rscs_env.rscs_init.evt_handler) { + } + else if ((s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) && s_rscs_env.rscs_init.evt_handler) + { event.conn_idx = conn_idx; event.evt_type = RSCS_EVT_SEBSOR_LOC_UPD; event.p_data = p_data; event.length = length; s_rscs_env.rscs_init.evt_handler(&event); - } else { - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_FAILED; + } + else + { + rsp[2] = RSCS_CTRL_PT_RSP_FAILED; rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -528,24 +478,29 @@ static void rscs_op_sup_sensor_loc_req_handler(uint8_t conn_idx) uint8_t rsp[RSCS_CTRL_PT_RSP_LEN_MIN + RSCS_SENSOR_LOC_SUP_NB]; uint8_t rsp_idx = RSCS_CTRL_PT_RSP_LEN_MIN; - rsp[INDEX_0] = RSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = RSCS_CTRL_PT_OP_REQ_SUP_LOC; - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_SUCCESS; + rsp[0] = RSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = RSCS_CTRL_PT_OP_REQ_SUP_LOC; + rsp[2] = RSCS_CTRL_PT_RSP_SUCCESS; - if (s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) + { event.conn_idx = conn_idx; event.evt_type = RSCS_EVT_SUP_SEBSOR_LOC_REQ; - if (s_rscs_env.rscs_init.evt_handler) { - s_rscs_env.rscs_init.evt_handler(&event); + if (s_rscs_env.rscs_init.evt_handler) + { + s_rscs_env.rscs_init.evt_handler(&event); } - for (uint8_t i = 0; i < RSCS_SENSOR_LOC_SUP_NB; i++) { + for (uint8_t i = 0; i < RSCS_SENSOR_LOC_SUP_NB; i++) + { rsp[rsp_idx++] = i; } rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN + RSCS_SENSOR_LOC_SUP_NB); - } else { - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_FAILED; + } + else + { + rsp[2] = RSCS_CTRL_PT_RSP_FAILED; rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); } } @@ -558,7 +513,7 @@ static void rscs_op_sup_sensor_loc_req_handler(uint8_t conn_idx) * @param[in] reason: Reason of disconnection. ***************************************************************************************** */ -static void rscs_disconnect_cb(uint8_t conn_idx, uint8_t reason) +static void rscs_disconnect_evt_handler(uint8_t conn_idx, uint8_t reason) { s_rscs_env.ctrl_pt_op_in_progress = false; } @@ -576,7 +531,8 @@ static void rscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uin { uint8_t rsp[RSCS_CTRL_PT_RSP_LEN_MIN]; - switch (p_data[0]) { + switch(p_data[0]) + { case RSCS_CTRL_PT_OP_SET_CUMUL_VAL: rscs_op_set_cumulative_handler(conn_idx, &p_data[1], length - 1); break; @@ -594,9 +550,9 @@ static void rscs_sc_ctrl_pt_handler(uint8_t conn_idx, const uint8_t *p_data, uin break; default: - rsp[INDEX_0] = RSCS_CTRL_PT_OP_RSP_CODE; - rsp[INDEX_1] = p_data[0]; - rsp[INDEX_2] = RSCS_CTRL_PT_RSP_NOT_SUP; + rsp[0] = RSCS_CTRL_PT_OP_RSP_CODE; + rsp[1] = p_data[0]; + rsp[2] = RSCS_CTRL_PT_RSP_NOT_SUP; rscs_ctrl_pt_rsp_send(conn_idx, rsp, RSCS_CTRL_PT_RSP_LEN_MIN); break; } @@ -625,8 +581,10 @@ static uint16_t rsc_meas_value_encoded(rscs_meas_val_t *p_meas, uint8_t *p_encod p_encoded_buffer[length++] = p_meas->inst_cadence; // Instantaneous stride length field - if (s_rscs_env.rscs_init.feature & RSCS_FEAT_INSTANT_STRIDE_LEN_BIT) { - if (p_meas->inst_stride_length_present) { + if (s_rscs_env.rscs_init.feature & RSCS_FEAT_INSTANT_STRIDE_LEN_BIT) + { + if (p_meas->inst_stride_length_present) + { p_encoded_buffer[length++] = LO_U16(p_meas->inst_stride_length); p_encoded_buffer[length++] = HI_U16(p_meas->inst_stride_length); // Flags field @@ -635,8 +593,10 @@ static uint16_t rsc_meas_value_encoded(rscs_meas_val_t *p_meas, uint8_t *p_encod } // Total distance field - if (s_rscs_env.rscs_init.feature & RSCS_FEAT_TOTAL_DISTANCE_BIT) { - if (p_meas->total_distance_present) { + if (s_rscs_env.rscs_init.feature & RSCS_FEAT_TOTAL_DISTANCE_BIT) + { + if (p_meas->total_distance_present) + { p_encoded_buffer[length++] = LO_UINT32_T(p_meas->total_distance); p_encoded_buffer[length++] = L2_UINT32_T(p_meas->total_distance); p_encoded_buffer[length++] = L3_UINT32_T(p_meas->total_distance); @@ -647,8 +607,10 @@ static uint16_t rsc_meas_value_encoded(rscs_meas_val_t *p_meas, uint8_t *p_encod } // Flags field - if (s_rscs_env.rscs_init.feature & RSCS_FEAT_RUNNING_OR_WALKING_STATUS_BIT) { - if (p_meas->is_run_or_walk) { + if (s_rscs_env.rscs_init.feature & RSCS_FEAT_RUNNING_OR_WALKING_STATUS_BIT) + { + if (p_meas->is_run_or_walk) + { flags |= RSCS_MEAS_FLAG_RUNNING_OR_WALKING_BIT; } } @@ -658,20 +620,52 @@ static uint16_t rsc_meas_value_encoded(rscs_meas_val_t *p_meas, uint8_t *p_encod return length; } +static void rscs_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + rscs_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + rscs_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + rscs_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + rscs_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.cccd_recovery); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + rscs_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** */ sdk_err_t rscs_measurement_send(uint8_t conn_idx, rscs_meas_val_t *p_meas) { - sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - uint8_t encoded_rsc_meas[RSCS_MEAS_VAL_LEN_MAX]; - uint16_t length; - gatts_noti_ind_t rsc_ntf; + sdk_err_t error_code = SDK_ERR_NTF_DISABLED; + uint8_t encoded_rsc_meas[RSCS_MEAS_VAL_LEN_MAX]; + uint16_t length; + ble_gatts_noti_ind_t rsc_ntf; length = rsc_meas_value_encoded(p_meas, encoded_rsc_meas); - if (PRF_CLI_START_NTF == s_rscs_env.meas_ntf_cfg[conn_idx]) { + if (PRF_CLI_START_NTF == s_rscs_env.meas_ntf_cfg[conn_idx]) + { rsc_ntf.type = BLE_GATT_NOTIFICATION; rsc_ntf.handle = prf_find_handle_by_idx(RSCS_IDX_RSC_MEAS_VAL, s_rscs_env.start_hdl, @@ -686,10 +680,11 @@ sdk_err_t rscs_measurement_send(uint8_t conn_idx, rscs_meas_val_t *p_meas) sdk_err_t rscs_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t ctrl_pt_rsp; + sdk_err_t error_code = SDK_ERR_IND_DISABLED; + ble_gatts_noti_ind_t ctrl_pt_rsp; - if (PRF_CLI_START_IND == s_rscs_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_rscs_env.ctrl_point_ind_cfg[conn_idx]) + { ctrl_pt_rsp.type = BLE_GATT_INDICATION; ctrl_pt_rsp.handle = prf_find_handle_by_idx(RSCS_IDX_CTRL_POINT_VAL, s_rscs_env.start_hdl, @@ -706,9 +701,12 @@ sdk_err_t rscs_sensor_loc_update(rscs_sensor_loc_t sensor_loc) { sdk_err_t error_code = BLE_SUCCESS; - if (s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (s_rscs_env.rscs_init.feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) + { s_rscs_env.rscs_init.sensor_location = sensor_loc; - } else { + } + else + { error_code = SDK_ERR_DISALLOWED; } @@ -717,22 +715,32 @@ sdk_err_t rscs_sensor_loc_update(rscs_sensor_loc_t sensor_loc) sdk_err_t rscs_service_init(rscs_init_t *p_rscs_init) { - sdk_err_t ret; - if (p_rscs_init == NULL) { + if (NULL == p_rscs_init) + { return SDK_ERR_POINTER_NULL; } - if (p_rscs_init->feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) { + if (p_rscs_init->feature & RSCS_FEAT_MULTIPLE_SENSORS_BIT) + { p_rscs_init->char_mask |= RSCS_CHAR_SENSOR_LOC_SUP; - } else { + } + else + { p_rscs_init->char_mask &= ~RSCS_CHAR_SENSOR_LOC_SUP; } - ret = memcpy_s(&s_rscs_env.rscs_init, sizeof(rscs_init_t), p_rscs_init, sizeof(rscs_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_rscs_env.rscs_init, p_rscs_init, sizeof(rscs_init_t)); - return ble_server_prf_add(&rscs_prf_info); + s_rscs_env.start_hdl = PRF_INVALID_HANDLE; + + s_rscs_env.rscs_gatts_db.shdl = &s_rscs_env.start_hdl; + s_rscs_env.rscs_gatts_db.uuid = s_rscs_svc_uuid; + s_rscs_env.rscs_gatts_db.attr_tab_cfg = (uint8_t *)&(s_rscs_env.rscs_init.char_mask); + s_rscs_env.rscs_gatts_db.max_nb_attr = RSCS_IDX_NB; + s_rscs_env.rscs_gatts_db.srvc_perm = 0; + s_rscs_env.rscs_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_rscs_env.rscs_gatts_db.attr_tab.attr_tab_16 = rscs_attr_tab; + + return ble_gatts_prf_add(&s_rscs_env.rscs_gatts_db, rscs_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.h index 496b4f6..51c932a 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs/rscs.h @@ -47,52 +47,46 @@ * @brief Definitions and prototypes for the RSCS interface. * * @details The Running Speed and Cadence (RSC) Service exposes speed, cadence and other data related to - * fitness applications such as the stride length and the total distance the user has traveled + * fitness applications such as the stride length and the total distance the user has traveled * while using the Running Speed and Cadence sensor (Server). This module implements the Running * Speed and Cadence Service with RSC Measurement, RSC Feature, Sensor Location and SC Control * Point characteristics. * * After \ref rscs_init_t variable is initialized, the application must call \ref rscs_service_init() - * to add the Running Speed and Cadence Service and RSC Measurement, RSC Feature, Sensor Location and + * to add the Running Speed and Cadence Service and RSC Measurement, RSC Feature, Sensor Location and * SC Control Point characteristics to the BLE Stack database according to \ref rscs_init_t.char_mask. */ #ifndef __RSCS_H__ #define __RSCS_H__ +#include "gr_includes.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup RSCS_MACRO Defines * @{ */ -#define RSCS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Running Speed and \ - Cadence Service connections. */ -#define RSCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of RSC measurement value. */ -#define RSCS_FEAT_VAL_LEN_MAX 2 /**< Maximum length of RSC Feature value. */ -#define RSCS_SENSOR_LOC_VAL_LEN_MAX 1 /**< Maximum length of RSC Sensor Location value. */ -#define RSCS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of SC Control Point responce value. */ -/**< Maximum length of SC Control Point value. */ -#define RSCS_CTRL_PT_VAL_LEN_MAX (RSCS_CTRL_PT_RSP_LEN_MIN + RSCS_SENSOR_LOC_SUP_NB) +#define RSCS_CONNECTION_MAX 10 /**< Maximum number of Running Speed and Cadence Service connections. */ +#define RSCS_MEAS_VAL_LEN_MAX 20 /**< Maximum length of RSC measurement value. */ +#define RSCS_FEAT_VAL_LEN_MAX 2 /**< Maximum length of RSC Feature value. */ +#define RSCS_SENSOR_LOC_VAL_LEN_MAX 1 /**< Maximum length of RSC Sensor Location value. */ +#define RSCS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of SC Control Point responce value. */ +#define RSCS_CTRL_PT_VAL_LEN_MAX (RSCS_CTRL_PT_RSP_LEN_MIN + RSCS_SENSOR_LOC_SUP_NB) /**< Maximum length of SC Control Point value. */ -#define RSCS_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point operation \ - is still in progress. */ -#define RSCS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor \ - is not configured. */ +#define RSCS_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point operation is still in progress. */ +#define RSCS_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor is not configured. */ /** * @defgroup RSCS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref rscs_init_t.char_mask. */ -#define RSCS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in RSCS.*/ -#define RSCS_CHAR_SENSOR_LOC_SUP 0x00c0 /**< Bit mask for Sensor Location characteristic that is optional.*/ -#define RSCS_CHAR_SC_CTRL_POINT 0x0700 /**< Bit mask for SC Control Point characteristic that is optional.*/ -#define RSCS_CHAR_FULL 0x07ff /**< Bit mask of the full characteristic.*/ +#define RSCS_CHAR_MANDATORY 0x003f /**< Bit mask for mandatory characteristic in RSCS. */ +#define RSCS_CHAR_SENSOR_LOC_SUP 0x00c0 /**< Bit mask for Sensor Location characteristic that is optional. */ +#define RSCS_CHAR_SC_CTRL_POINT 0x0700 /**< Bit mask for SC Control Point characteristic that is optional. */ +#define RSCS_CHAR_FULL 0x07ff /**< Bit mask of the full characteristic. */ /** @} */ /** @@ -100,9 +94,9 @@ * @{ * @brief Running Speed and Cadence Measurement Flags. */ -#define RSCS_MEAS_FLAG_INST_STRIDE_LEN_BIT (0x01 << 0) /**< Flag bit for Instantaneous Stride Length Measurement.*/ -#define RSCS_MEAS_FLAG_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Flag bit for Total Distance Measurement.*/ -#define RSCS_MEAS_FLAG_RUNNING_OR_WALKING_BIT (0x01 << 2) /**< Flag bit for Running or Walking.*/ +#define RSCS_MEAS_FLAG_INST_STRIDE_LEN_BIT (0x01 << 0) /**< Flag bit for Instantaneous Stride Length Measurement. */ +#define RSCS_MEAS_FLAG_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Flag bit for Total Distance Measurement. */ +#define RSCS_MEAS_FLAG_RUNNING_OR_WALKING_BIT (0x01 << 2) /**< Flag bit for Running or Walking. */ /** @} */ /** @@ -110,13 +104,12 @@ * @{ * @brief Running Speed and Cadence Service feature bits. */ -/**< Bit for Instantaneous Stride Length Measurement Supported.*/ -#define RSCS_FEAT_INSTANT_STRIDE_LEN_BIT (0x01 << 0) -#define RSCS_FEAT_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Bit for Total Distance Measurement Supported. */ -#define RSCS_FEAT_RUNNING_OR_WALKING_STATUS_BIT (0x01 << 2) /**< Bit for Running or Walking Status Supported. */ -#define RSCS_FEAT_CALIBRATION_PROCEDURE_BIT (0x01 << 3) /**< Bit for Calibration Procedure Supported. */ -#define RSCS_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 4) /**< Bit for Multiple Sensor Locations Supported. */ -#define RSCS_FEAR_FULL_BIT (0x1f) /**< Bit for all RSC features Supported. */ +#define RSCS_FEAT_INSTANT_STRIDE_LEN_BIT (0x01 << 0) /**< Bit for Instantaneous Stride Length Measurement Supported. */ +#define RSCS_FEAT_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Bit for Total Distance Measurement Supported. */ +#define RSCS_FEAT_RUNNING_OR_WALKING_STATUS_BIT (0x01 << 2) /**< Bit for Running or Walking Status Supported. */ +#define RSCS_FEAT_CALIBRATION_PROCEDURE_BIT (0x01 << 3) /**< Bit for Calibration Procedure Supported. */ +#define RSCS_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 4) /**< Bit for Multiple Sensor Locations Supported. */ +#define RSCS_FEAR_FULL_BIT (0x1f) /**< Bit for all RSC features Supported. */ /** @} */ /** @} */ @@ -125,7 +118,8 @@ * @{ */ /**@brief Running Speed and Cadence Service Sensor Location. */ -typedef enum { +typedef enum +{ RSCS_SENSOR_LOC_OTHER, /**< Sensor location: other. */ RSCS_SENSOR_LOC_SHOE_TOP, /**< Sensor location: top of shoe. */ RSCS_SENSOR_LOC_SHOE_IN, /**< Sensor location: inside of shoe. */ @@ -138,7 +132,8 @@ typedef enum { } rscs_sensor_loc_t; /**@brief Running Speed and Cadence Service Control Point Operation Code.*/ -typedef enum { +typedef enum +{ RSCS_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */ RSCS_CTRL_PT_OP_SET_CUMUL_VAL, /**< Set Cumulative value Operation Code.*/ RSCS_CTRL_PT_OP_START_CALIB, /**< Start Sensor Calibration Operation Code.*/ @@ -148,7 +143,8 @@ typedef enum { } rscs_ctrl_pt_op_code_t; /**@brief Running Speed and Cadence Service Control Point Response value.*/ -typedef enum { +typedef enum +{ RSCS_CTRL_PT_RSP_RESERVED, /**< Reserved value. */ RSCS_CTRL_PT_RSP_SUCCESS, /**< Operation Succeeded. */ RSCS_CTRL_PT_RSP_NOT_SUP, /**< Operation Code Not Supported. */ @@ -157,18 +153,19 @@ typedef enum { } rscs_ctrl_pt_rsp_t; /**@brief Running Speed and Cadence Service event type.*/ -typedef enum { - RSCS_EVT_INVALID, /**< Indicate that invalid event. */ - RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE, /**< Indicate that RSC Measurement notification has been enabled. */ - RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE, /**< Indicate that RSC Measurement notification has been disabled. */ - RSCS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that SC Control Point indication has been enabled. */ - RSCS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that SC Control Point indication has been disabled. */ - RSCS_EVT_RSC_MEAS_SEND_CPLT, /**< Indicate that RSC Measurement has been notified. */ - RSCS_EVT_CUMUL_VAL_SET, /**< Indicate that Total Distance value needs to be set. */ - RSCS_EVT_SEBSOR_CALIBRATION, /**< Indicate that Sensor calibration procedure should be initiated. */ - RSCS_EVT_SEBSOR_LOC_UPD, /**< Indicate that Sensor Location needs to be reset. */ - RSCS_EVT_SUP_SEBSOR_LOC_REQ, /**< Indicate that request supported sensor location list. */ - RSCS_EVT_CTRL_POINT_RSP_CPLT /**< Indicate that SC Control Point response has been indicated. */ +typedef enum +{ + RSCS_EVT_INVALID, /**< Indicate that invalid event. */ + RSCS_EVT_RSC_MEAS_NOTIFICATION_ENABLE, /**< Indicate that RSC Measurement notification has been enabled. */ + RSCS_EVT_RSC_MEAS_NOTIFICATION_DISABLE, /**< Indicate that RSC Measurement notification has been disabled. */ + RSCS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that SC Control Point indication has been enabled. */ + RSCS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that SC Control Point indication has been disabled. */ + RSCS_EVT_RSC_MEAS_SEND_CPLT, /**< Indicate that RSC Measurement has been notified. */ + RSCS_EVT_CUMUL_VAL_SET, /**< Indicate that Total Distance value needs to be set. */ + RSCS_EVT_SEBSOR_CALIBRATION, /**< Indicate that Sensor calibration procedure should be initiated. */ + RSCS_EVT_SEBSOR_LOC_UPD, /**< Indicate that Sensor Location needs to be reset. */ + RSCS_EVT_SUP_SEBSOR_LOC_REQ, /**< Indicate that request supported sensor location list. */ + RSCS_EVT_CTRL_POINT_RSP_CPLT /**< Indicate that SC Control Point response has been indicated. */ } rscs_evt_type_t; /** @} */ @@ -177,7 +174,8 @@ typedef enum { * @{ */ /**@brief Running Speed and Cadence Service event. */ -typedef struct { +typedef struct +{ rscs_evt_type_t evt_type; /**< The RSCS event type. */ uint8_t conn_idx; /**< The index of the connection. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -185,7 +183,8 @@ typedef struct { } rscs_evt_t; /**@brief Running Speed and Cadence Measurement Character value structure. */ -typedef struct { +typedef struct +{ bool inst_stride_length_present; /**< If Instantaneous Stride Length is present. */ bool total_distance_present; /**< If Total Distance is present. */ bool is_run_or_walk; /**< True: Running, False: Walking. */ @@ -208,12 +207,11 @@ typedef void (*rscs_evt_handler_t)(rscs_evt_t *p_evt); * @defgroup RSCS_STRUCT Structures * @{ */ -/**@brief Running Speed and Cadence Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Running Speed and Cadence Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ rscs_evt_handler_t evt_handler; /**< Running Speed and Cadence Service event handler. */ - uint16_t - char_mask; /**< Initial mask of supported characteristics, and configured with \ref RSCS_CHAR_MASK. */ + uint16_t char_mask; /**< Initial mask of supported characteristics, and configured with \ref RSCS_CHAR_MASK. */ rscs_sensor_loc_t sensor_location; /**< Initial sensor location. */ uint16_t feature; /**< Initial value for features. */ } rscs_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/BUILD.gn new file mode 100644 index 0000000..f50eeb0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("rscs_c") { + sources = [ "rscs_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.c index eeac0da..25824fd 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.c @@ -39,67 +39,32 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "rscs_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "rscs_c.h" +#include -#define UUID_OFFSET_8 8 -#define INDIX_OFFSET_1 1 -#define INDIX_OFFSET_2 2 -#define INDIX_OFFSET_3 3 -#define ATTR_VALUE_LEN 2 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Running Speed and Cadence Service Client environment variable. */ -struct rscs_c_env_t { +struct rscs_c_env_t +{ rscs_c_handles_t handles; /**< Handles of RSCS characteristics which will be got for peer. */ rscs_c_evt_handler_t evt_handler; /**< Handler of RSCS Client event */ - uint8_t prf_id; /**< RSCS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void rscs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void rscs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void rscs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void rscs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct rscs_c_env_t s_rscs_c_env; /**< Running Speed and Cadence Service Client environment variable. */ - -/**@brief Running Speed and Cadence Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t rscs_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Running Speed and Cadence Service GATT Client Callbacks. */ -static gattc_prf_cbs_t rscs_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - rscs_c_att_read_cb, - rscs_c_att_write_cb, - rscs_c_att_ntf_ind_cb, - rscs_c_srvc_browse_cb, - NULL, -}; - -/**@brief Running Speed and Cadence Service Client Information. */ -static const prf_client_info_t rscs_c_prf_info = { - .max_connection_nb = RSCS_C_CONNECTION_MAX, - .manager_cbs = &rscs_c_mgr_cbs, - .gattc_prf_cbs = &rscs_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_RUNNING_SPEED_CADENCE), HI_U16(BLE_ATT_SVC_RUNNING_SPEED_CADENCE)}; +static ble_uuid_t s_rscs_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -115,7 +80,8 @@ static const prf_client_info_t rscs_c_prf_info = { */ static void rscs_c_evt_handler_excute(rscs_c_evt_t *p_evt) { - if (s_rscs_c_env.evt_handler != NULL && RSCS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_rscs_c_env.evt_handler && RSCS_C_EVT_INVALID != p_evt->evt_type) + { s_rscs_c_env.evt_handler(p_evt); } } @@ -133,12 +99,8 @@ static void rscs_c_meas_value_encode(uint8_t *p_data, uint16_t length, rscs_c_me { uint8_t flags = 0; uint8_t index = 0; - uint8_t ret = 0; flags = p_data[index++]; - ret = memset_s(p_rsc_meas_buff, sizeof(rscs_c_meas_val_t), 0, sizeof(rscs_c_meas_val_t)); - if (ret < 0) { - return; - } + memset(p_rsc_meas_buff, 0, sizeof(rscs_c_meas_val_t)); // Instantaneous speed field p_rsc_meas_buff->inst_speed = BUILD_U16(p_data[index], p_data[index + 1]); index += sizeof(uint16_t); @@ -146,26 +108,31 @@ static void rscs_c_meas_value_encode(uint8_t *p_data, uint16_t length, rscs_c_me p_rsc_meas_buff->inst_cadence = p_data[index++]; // Instantaneous stride length field - if (flags & RSCS_C_MEAS_FLAG_INST_STRIDE_LEN_BIT) { + if (flags & RSCS_C_MEAS_FLAG_INST_STRIDE_LEN_BIT) + { p_rsc_meas_buff->inst_stride_length_present = true; p_rsc_meas_buff->inst_stride_length = BUILD_U16(p_data[index], p_data[index + 1]); index += sizeof(uint16_t); } // Total distance field - if (flags & RSCS_C_MEAS_FLAG_TOTAL_DISTANCE_BIT) { + if (flags & RSCS_C_MEAS_FLAG_TOTAL_DISTANCE_BIT) + { p_rsc_meas_buff->total_distance_present = true; p_rsc_meas_buff->total_distance = BUILD_U32(p_data[index], - p_data[index + INDIX_OFFSET_1], - p_data[index + INDIX_OFFSET_2], - p_data[index + INDIX_OFFSET_3]); + p_data[index + 1], + p_data[index + 2], + p_data[index + 3]); index += sizeof(uint32_t); } // Running or Walking field - if (flags & RSCS_C_MEAS_FLAG_RUNNING_OR_WALKING_BIT) { + if (flags & RSCS_C_MEAS_FLAG_RUNNING_OR_WALKING_BIT) + { p_rsc_meas_buff->is_run_or_walk = true; - } else { + } + else + { p_rsc_meas_buff->is_run_or_walk = false; } } @@ -179,23 +146,27 @@ static void rscs_c_meas_value_encode(uint8_t *p_data, uint16_t length, rscs_c_me * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void rscs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void rscs_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { rscs_c_evt_t rscs_c_evt; rscs_c_evt.conn_idx = conn_idx; rscs_c_evt.evt_type = RSCS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_rscs_c_env.handles.rscs_rsc_feature_handle) { + if (p_read_rsp->value[0].handle == s_rscs_c_env.handles.rscs_rsc_feature_handle) + { rscs_c_evt.evt_type = RSCS_C_EVT_RSC_FEATURE_RECEIVE; - rscs_c_evt.value.rsc_feature = BUILD_U16(p_read_rsp->vals[0].p_value[0], p_read_rsp->vals[0].p_value[1]); - } else if (p_read_rsp->vals[0].handle == s_rscs_c_env.handles.rscs_sensor_loc_handle) { + rscs_c_evt.value.rsc_feature = BUILD_U16(p_read_rsp->value[0].p_value[0], p_read_rsp->value[0].p_value[1]); + } + else if (p_read_rsp->value[0].handle == s_rscs_c_env.handles.rscs_sensor_loc_handle) + { rscs_c_evt.evt_type = RSCS_C_EVT_SENSOR_LOC_RECEIVE; - rscs_c_evt.value.rsc_sensor_loc = (rscs_c_sensor_loc_t)p_read_rsp->vals[0].p_value[0]; + rscs_c_evt.value.rsc_sensor_loc = (rscs_c_sensor_loc_t)p_read_rsp->value[0].p_value[0]; } rscs_c_evt_handler_excute(&rscs_c_evt); @@ -210,25 +181,30 @@ static void rscs_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void rscs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void rscs_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { rscs_c_evt_t rscs_c_evt; rscs_c_evt.conn_idx = conn_idx; rscs_c_evt.evt_type = RSCS_C_EVT_INVALID; - if (handle == s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle) { + if (handle == s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle) + { rscs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - RSCS_C_EVT_RSC_MEAS_NTF_SET_SUCCESS : - RSCS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle) { + RSCS_C_EVT_RSC_MEAS_NTF_SET_SUCCESS : + RSCS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle) + { rscs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - RSCS_C_EVT_CTRL_PT_IND_SET_SUCCESS : - RSCS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_rscs_c_env.handles.rscs_ctrl_pt_handle) { + RSCS_C_EVT_CTRL_PT_IND_SET_SUCCESS : + RSCS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_rscs_c_env.handles.rscs_ctrl_pt_handle) + { rscs_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - RSCS_C_EVT_CTRL_PT_SET_SUCCESS : - RSCS_C_EVT_WRITE_OP_ERR; + RSCS_C_EVT_CTRL_PT_SET_SUCCESS : + RSCS_C_EVT_WRITE_OP_ERR; } rscs_c_evt_handler_excute(&rscs_c_evt); @@ -243,23 +219,22 @@ static void rscs_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handl * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void rscs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void rscs_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { rscs_c_evt_t rscs_c_evt; - uint8_t ret; rscs_c_evt.conn_idx = conn_idx; rscs_c_evt.evt_type = RSCS_C_EVT_INVALID; - if (p_ntf_ind->handle == s_rscs_c_env.handles.rscs_rsc_meas_handle) { + if (p_ntf_ind->handle == s_rscs_c_env.handles.rscs_rsc_meas_handle) + { rscs_c_evt.evt_type = RSCS_C_EVT_RSC_MEAS_VAL_RECEIVE; rscs_c_meas_value_encode(p_ntf_ind->p_value, p_ntf_ind->length, &rscs_c_evt.value.rsc_meas_buff); - } else if (p_ntf_ind->handle == s_rscs_c_env.handles.rscs_ctrl_pt_handle) { + } + else if (p_ntf_ind->handle == s_rscs_c_env.handles.rscs_ctrl_pt_handle) + { rscs_c_evt.evt_type = RSCS_C_EVT_CTRL_PT_RSP_RECEIVE; - ret = memcpy_s(rscs_c_evt.value.ctrl_pt_rsp, p_ntf_ind->p_value, p_ntf_ind->length); - if (ret < 0) { - return; - } + memcpy(rscs_c_evt.value.ctrl_pt_rsp, p_ntf_ind->p_value, p_ntf_ind->length); } rscs_c_evt_handler_excute(&rscs_c_evt); @@ -274,7 +249,7 @@ static void rscs_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void rscs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void rscs_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { rscs_c_evt_t rscs_c_evt; uint16_t uuid_disc; @@ -283,143 +258,158 @@ static void rscs_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_ga rscs_c_evt.conn_idx = conn_idx; rscs_c_evt.evt_type = RSCS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << UUID_OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_RUNNING_SPEED_CADENCE == uuid_disc) { - s_rscs_c_env.handles.rscs_srvc_start_handle = p_browse_srvc->start_hdl; - s_rscs_c_env.handles.rscs_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_RUNNING_SPEED_CADENCE == uuid_disc) + { + s_rscs_c_env.handles.rscs_srvc_start_handle = p_browse_srvc->start_hdl; + s_rscs_c_env.handles.rscs_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << UUID_OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_RSC_MEAS == uuid_disc) { - s_rscs_c_env.handles.rscs_rsc_meas_handle = handle_disc; - s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle = handle_disc + 1; - } else if (BLE_ATT_CHAR_RSC_FEAT == uuid_disc) { - s_rscs_c_env.handles.rscs_rsc_feature_handle = handle_disc; - } else if (BLE_ATT_CHAR_SENSOR_LOC == uuid_disc) { - s_rscs_c_env.handles.rscs_sensor_loc_handle = handle_disc; - } else if (BLE_ATT_CHAR_SC_CNTL_PT == uuid_disc) { - s_rscs_c_env.handles.rscs_ctrl_pt_handle = handle_disc; - s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle = handle_disc + 1; - } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_RSC_MEAS == uuid_disc) + { + s_rscs_c_env.handles.rscs_rsc_meas_handle = handle_disc; + s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle = handle_disc + 1; + } + else if (BLE_ATT_CHAR_RSC_FEAT == uuid_disc) + { + s_rscs_c_env.handles.rscs_rsc_feature_handle = handle_disc; + } + else if (BLE_ATT_CHAR_SENSOR_LOC == uuid_disc) + { + s_rscs_c_env.handles.rscs_sensor_loc_handle = handle_disc; + } + else if (BLE_ATT_CHAR_SC_CNTL_PT == uuid_disc) + { + s_rscs_c_env.handles.rscs_ctrl_pt_handle = handle_disc; + s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle = handle_disc + 1; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; + } } - } - rscs_c_evt.evt_type = RSCS_C_EVT_DISCOVERY_COMPLETE; + rscs_c_evt.evt_type = RSCS_C_EVT_DISCOVERY_COMPLETE; + } } rscs_c_evt_handler_excute(&rscs_c_evt); } +static void rscs_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + rscs_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_READ_RSP: + rscs_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + rscs_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + rscs_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t rscs_client_init(rscs_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_rscs_c_env, sizeof(s_rscs_c_env), 0, sizeof(s_rscs_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_rscs_c_env, 0, sizeof(s_rscs_c_env)) ; s_rscs_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&rscs_c_prf_info, &s_rscs_c_env.prf_id); + return ble_gattc_prf_add(&s_rscs_service_uuid, rscs_c_ble_evt_handler); } sdk_err_t rscs_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - target_uuid[0] = LO_U16(BLE_ATT_SVC_RUNNING_SPEED_CADENCE); - target_uuid[1] = HI_U16(BLE_ATT_SVC_RUNNING_SPEED_CADENCE); - const ble_uuid_t rscs_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_rscs_c_env.prf_id, conn_idx, &rscs_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_rscs_service_uuid); } sdk_err_t rscs_c_rsc_meas_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_rscs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_rscs_c_env.handles.rscs_rsc_meas_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t rscs_c_rsc_feature_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_rsc_feature_handle) { + if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_rsc_feature_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_rscs_c_env.prf_id, conn_idx, s_rscs_c_env.handles.rscs_rsc_feature_handle, 0); + return ble_gattc_read(conn_idx, s_rscs_c_env.handles.rscs_rsc_feature_handle, 0); } sdk_err_t rscs_c_sensor_loc_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_sensor_loc_handle) { + if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_sensor_loc_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_rscs_c_env.prf_id, conn_idx, s_rscs_c_env.handles.rscs_sensor_loc_handle, 0); + return ble_gattc_read(conn_idx, s_rscs_c_env.handles.rscs_sensor_loc_handle, 0); } sdk_err_t rscs_c_ctrl_pt_indicate_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ind_value = is_enable ? PRF_CLI_START_IND : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ind_value; - - return ble_gattc_prf_write(s_rscs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_rscs_c_env.handles.rscs_ctrl_pt_cccd_handle, 0, 2, (uint8_t *)&ind_value); } sdk_err_t rscs_c_ctrl_pt_set(uint8_t conn_idx, uint16_t ctrl_value) { - gattc_write_attr_value_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_ctrl_pt_handle) { + if (BLE_ATT_INVALID_HDL == s_rscs_c_env.handles.rscs_ctrl_pt_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_rscs_c_env.handles.rscs_ctrl_pt_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ctrl_value; - - return ble_gattc_prf_write(s_rscs_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_rscs_c_env.handles.rscs_ctrl_pt_handle, 0, 2, (uint8_t *)&ctrl_value); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.h index 0a1435e..0433fcf 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rscs_c/rscs_c.h @@ -52,41 +52,36 @@ * After Running Speed and Cadence Service Client discoveries peer Running Speed and Cadence Service, * application can call \ref rscs_c_rsc_meas_notify_set(), then will receive Running Speed and Cadence * data from peer, and can call \ref rscs_c_sensor_loc_read() and \ref rscs_c_rsc_feature_read() to get - * sensor location information and the supported features of the Server, - * also can call \ref rscs_c_ctrl_pt_set() + * sensor location information and the supported features of the Server, also can call \ref rscs_c_ctrl_pt_set() * to send control point to peer. */ #ifndef __RSCS_C_H__ #define __RSCS_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup RSCS_C_MACRO Defines * @{ */ -#define RSCS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of HRS Client connections. */ -/**< Maximum length of SC Control Point response value. */ -#define RSCS_C_PT_RSP_LEN_MAX (3 + RSCS_C_SENSOR_LOC_SUP_NB) -#define RSCS_C_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point \ - operation is still in progress. */ -#define RSCS_C_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration \ - descriptor is not configured. */ +#define RSCS_C_CONNECTION_MAX 10 /**< Maximum number of HRS Client connections. */ +#define RSCS_C_PT_RSP_LEN_MAX (3 + RSCS_C_SENSOR_LOC_SUP_NB) /**< Maximum length of SC Control Point response value. */ +#define RSCS_C_ERROR_PROC_IN_PROGRESS 0x80 /**< Error code: A previously triggered SC Control Point operation is still in progress. */ +#define RSCS_C_ERROR_CCCD_INVALID 0x81 /**< Error code: The Client Characteristic Configuration descriptor is not configured. */ /** * @defgroup RSCS_C_MEAS_FLAG_BIT Measurement Flag Bits * @{ * @brief Running Speed and Cadence Measurement Flags. */ -#define RSCS_C_MEAS_FLAG_INST_STRIDE_LEN_BIT (0x01 << 0) /**< Flag bit for Instantaneous Stride Length Measurement.*/ -#define RSCS_C_MEAS_FLAG_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Flag bit for Total Distance Measurement. */ -#define RSCS_C_MEAS_FLAG_RUNNING_OR_WALKING_BIT (0x01 << 2) /**< Flag bit for Running or Walking. */ +#define RSCS_C_MEAS_FLAG_INST_STRIDE_LEN_BIT (0x01 << 0) /**< Flag bit for Instantaneous Stride Length Measurement. */ +#define RSCS_C_MEAS_FLAG_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Flag bit for Total Distance Measurement. */ +#define RSCS_C_MEAS_FLAG_RUNNING_OR_WALKING_BIT (0x01 << 2) /**< Flag bit for Running or Walking. */ /** @} */ /** @@ -94,12 +89,11 @@ * @{ * @brief Running Speed and Cadence Service feature bits. */ -#define RSCS_C_FEAT_INSTANT_STRIDE_LEN_BIT (0x01 << 0) /**< Bit for Instantaneous Stride Length \ - Measurement Supported. */ -#define RSCS_C_FEAT_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Bit for Total Distance Measurement Supported.*/ -#define RSCS_C_FEAT_RUNNING_OR_WALKING_STATUS_BIT (0x01 << 2) /**< Bit for Running or Walking Status Supported.*/ -#define RSCS_C_FEAT_CALIBRATION_PROCEDURE_BIT (0x01 << 3) /**< Bit for Calibration Procedure Supported.*/ -#define RSCS_C_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 4) /**< Bit for Multiple Sensor Locations Supported.*/ +#define RSCS_C_FEAT_INSTANT_STRIDE_LEN_BIT (0x01 << 0) /**< Bit for Instantaneous Stride Length Measurement Supported. */ +#define RSCS_C_FEAT_TOTAL_DISTANCE_BIT (0x01 << 1) /**< Bit for Total Distance Measurement Supported. */ +#define RSCS_C_FEAT_RUNNING_OR_WALKING_STATUS_BIT (0x01 << 2) /**< Bit for Running or Walking Status Supported. */ +#define RSCS_C_FEAT_CALIBRATION_PROCEDURE_BIT (0x01 << 3) /**< Bit for Calibration Procedure Supported. */ +#define RSCS_C_FEAT_MULTIPLE_SENSORS_BIT (0x01 << 4) /**< Bit for Multiple Sensor Locations Supported. */ /** @} */ /** @} */ @@ -108,23 +102,24 @@ * @{ */ /**@brief Running Speed and Cadence Service Client event type. */ -typedef enum { - RSCS_C_EVT_INVALID, /**< RSCS Client invalid event. */ +typedef enum +{ + RSCS_C_EVT_INVALID, /*<* RSCS Client invalid event. */ RSCS_C_EVT_DISCOVERY_COMPLETE, /**< RSCS Client has found RSCS service and its characteristics. */ - RSCS_C_EVT_DISCOVERY_FAIL, /**< RSCS Client found RSCS service failed because of invalid operation \ - or no found at the peer. */ + RSCS_C_EVT_DISCOVERY_FAIL, /**< RSCS Client found RSCS service failed because of invalid operation or no found at the peer. */ RSCS_C_EVT_RSC_MEAS_NTF_SET_SUCCESS, /**< RSCS Client has set Notification of RSC Measure characteristic. */ RSCS_C_EVT_CTRL_PT_IND_SET_SUCCESS, /**< RSCS Client has set Indication of Control Point characteristic. */ - RSCS_C_EVT_RSC_MEAS_VAL_RECEIVE, /**< RSCS Client has received RSC Measurement value notification from peer.*/ + RSCS_C_EVT_RSC_MEAS_VAL_RECEIVE, /**< RSCS Client has received RSC Measurement value notification from peer. */ RSCS_C_EVT_RSC_FEATURE_RECEIVE, /**< RSCS Client has received RSC Feature Value read response. */ RSCS_C_EVT_SENSOR_LOC_RECEIVE, /**< RSCS Client has received Sensor Location Value read response. */ RSCS_C_EVT_CTRL_PT_SET_SUCCESS, /**< RSCS Client has writen Control Point completely. */ - RSCS_C_EVT_CTRL_PT_RSP_RECEIVE, /**< RSCS Client has received Indication of Control Point characteristic.*/ + RSCS_C_EVT_CTRL_PT_RSP_RECEIVE, /**< RSCS Client has received Indication of Control Point characteristic. */ RSCS_C_EVT_WRITE_OP_ERR, /**< Error occured when RSCS Client writen to peer. */ } rscs_c_evt_type_t; /**@brief Running Speed and Cadence Service Sensor Location. */ -typedef enum { +typedef enum +{ RSCS_C_SENSOR_LOC_OTHER, /**< Sensor location: other. */ RSCS_C_SENSOR_LOC_SHOE_TOP, /**< Sensor location: top of shoe. */ RSCS_C_SENSOR_LOC_SHOE_IN, /**< Sensor location: inside of shoe. */ @@ -137,7 +132,8 @@ typedef enum { } rscs_c_sensor_loc_t; /**@brief Running Speed and Cadence Service Control Point Operation Code.*/ -typedef enum { +typedef enum +{ RSCS_C_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */ RSCS_C_CTRL_PT_OP_SET_CUMUL_VAL, /**< Set Cumulative value Operation Code.*/ RSCS_C_CTRL_PT_OP_START_CALIB, /**< Start Sensor Calibration Operation Code.*/ @@ -147,7 +143,8 @@ typedef enum { } rscs_c_ctrl_pt_op_code_t; /**@brief Running Speed and Cadence Service Control Point Response value.*/ -typedef enum { +typedef enum +{ RSCS_C_CTRL_PT_RSP_RESERVED, /**< Reserved value. */ RSCS_C_CTRL_PT_RSP_SUCCESS, /**< Operation Succeeded. */ RSCS_C_CTRL_PT_RSP_NOT_SUP, /**< Operation Code Not Supported. */ @@ -161,7 +158,8 @@ typedef enum { * @{ */ /**@brief Running Speed and Cadence Measurement Character value structure. */ -typedef struct { +typedef struct +{ bool inst_stride_length_present; /**< If Instantaneous Stride Length is present. */ bool total_distance_present; /**< If Total Distance is present. */ bool is_run_or_walk; /**< True: Running, False: Walking. */ @@ -172,34 +170,32 @@ typedef struct { } rscs_c_meas_val_t; /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t rscs_srvc_start_handle; /**< RSCS Service start handle. */ uint16_t rscs_srvc_end_handle; /**< RSCS Service end handle. */ - uint16_t rscs_rsc_meas_handle; /**< RSCS RSC Measurement characteristic Value handle \ - which has been got from peer. */ - uint16_t rscs_rsc_meas_cccd_handle; /**< RSCS CCCD handle of RSC Measurement characteristic \ - which has been got from peer. */ - uint16_t rscs_sensor_loc_handle; /**< RSCS Sensor Location characteristic Value handle \ - which has been got from peer. */ - uint16_t rscs_rsc_feature_handle; /**< RSCS RSC Feature characteristic Value handle \ - which has been got from peer. */ - uint16_t rscs_ctrl_pt_handle; /**< RSCS Control Point characteristic Value handle \ - which has been got from peer. */ - uint16_t rscs_ctrl_pt_cccd_handle; /**< RSCS CCCD handle of Control Point characteristic \ - which has been got from peer. */ + uint16_t rscs_rsc_meas_handle; /**< RSCS RSC Measurement characteristic Value handle which has been got from peer. */ + uint16_t rscs_rsc_meas_cccd_handle; /**< RSCS CCCD handle of RSC Measurement characteristic which has been got from peer. */ + uint16_t rscs_sensor_loc_handle; /**< RSCS Sensor Location characteristic Value handle which has been got from peer. */ + uint16_t rscs_rsc_feature_handle; /**< RSCS RSC Feature characteristic Value handle which has been got from peer. */ + uint16_t rscs_ctrl_pt_handle; /**< RSCS Control Point characteristic Value handle which has been got from peer. */ + uint16_t rscs_ctrl_pt_cccd_handle; /**< RSCS CCCD handle of Control Point characteristic which has been got from peer. */ } rscs_c_handles_t; /**@brief Running Speed and Cadence Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ rscs_c_evt_type_t evt_type; /**< RSCS Client event type. */ uint16_t handle; /**< Handle of characteristic. */ - union { + union + { rscs_c_meas_val_t rsc_meas_buff; /**< Buffer of RSC measurement value. */ uint16_t rsc_feature; /**< RSC feature received. */ rscs_c_sensor_loc_t rsc_sensor_loc; /**< RSC sensor location received. */ uint8_t ctrl_pt_rsp[RSCS_C_PT_RSP_LEN_MAX]; /**< SC Control Point Response. */ } value; /**< Decoded result of value received. */ + } rscs_c_evt_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/BUILD.gn new file mode 100644 index 0000000..6dfab52 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("rtus") { + sources = [ "rtus.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.c index ee8201e..d30e6ba 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.c @@ -49,7 +49,8 @@ **************************************************************************************** */ /**@brief Reference Time Update Service Attributes Indexes. */ -enum { +enum +{ // Reference Time Update Service RTUS_IDX_SVC, @@ -69,113 +70,48 @@ enum { ***************************************************************************************** */ /**@brief Reference Time Update Service environment variable. */ -struct rtus_env_t { +struct rtus_env_t +{ rtus_init_t rtus_init; /**< Reference Time Update Service initialization variables. */ uint16_t start_hdl; /**< Reference Time Update Service start handle. */ rtus_update_state_t update_state; /**< State of time update. */ + ble_gatts_create_db_t rtus_gatts_db; /**< Reference Time Update Service attributs database. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static sdk_err_t rtus_init(void); -static void rtus_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void rtus_write_att_cb(uint8_t conidx, const gatts_write_req_cb_t *p_param); /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct rtus_env_t s_rtus_env; +static const uint8_t s_rtus_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_REF_TIME_UPDATE); /**@brief Full RTUS Database Description - Used to add attributes into the database. */ -static const attm_desc_t rtus_attr_tab[RTUS_IDX_NB] = { +static const ble_gatts_attm_desc_t rtus_attr_tab[RTUS_IDX_NB] = +{ // RTUS Service Declaration - [RTUS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [RTUS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Time Update Control Point Characteristic Declaration - [RTUS_IDX_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RTUS_IDX_CTRL_PT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Time Update Control Point Characteristic Declaration value - [RTUS_IDX_CTRL_PT_VAL] = { - BLE_ATT_CHAR_TIME_UPDATE_CNTL_POINT, - WRITE_CMD_PERM(AUTH), - ATT_VAL_LOC_USER, - RTUS_CTRL_PT_VAL_LEN - }, + [RTUS_IDX_CTRL_PT_VAL] = {BLE_ATT_CHAR_TIME_UPDATE_CNTL_POINT, + BLE_GATTS_WRITE_CMD_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + RTUS_CTRL_PT_VAL_LEN}, // Time Update State Characteristic Declaration - [RTUS_IDX_UPDATE_STATE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [RTUS_IDX_UPDATE_STATE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Time Update State Characteristic Declaration value - [RTUS_IDX_UPDATE_STATE_VAL] = { - BLE_ATT_CHAR_TIME_UPDATE_STATE, - READ_PERM(AUTH), - ATT_VAL_LOC_USER, - RTUS_UPDATE_STATE_VAL_LEN - }, -}; - -/**@brief RTUS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t rtus_tack_cbs = { - (prf_init_func_t) rtus_init, - NULL, - NULL -}; - -/**@brief RTUS Task Callbacks. */ -static gatts_prf_cbs_t rtus_cb_func = { - rtus_read_att_cb, - rtus_write_att_cb, - NULL, - NULL -}; - -/**@brief RTUS Information. */ -static const prf_server_info_t rtus_prf_info = { - .max_connection_nb = RTUS_CONNECTION_MAX, - .manager_cbs = &rtus_tack_cbs, - .gatts_prf_cbs = &rtus_cb_func + [RTUS_IDX_UPDATE_STATE_VAL] = {BLE_ATT_CHAR_TIME_UPDATE_STATE, + BLE_GATTS_READ_PERM(BLE_GATTS_AUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + RTUS_UPDATE_STATE_VAL_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Reference Time Update service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t rtus_init(void) -{ - // The start hanlde must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t rtus_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_REF_TIME_UPDATE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = rtus_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_rtus_env.rtus_init.char_mask); - gatts_db.max_nb_attr = RTUS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = rtus_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_rtus_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -184,9 +120,9 @@ static sdk_err_t rtus_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void rtus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void rtus_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, s_rtus_env.start_hdl, @@ -195,7 +131,8 @@ static void rtus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case RTUS_IDX_UPDATE_STATE_VAL: cfm.length = RTUS_UPDATE_STATE_VAL_LEN; cfm.value = (uint8_t *)&s_rtus_env.update_state; @@ -217,13 +154,13 @@ static void rtus_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_para * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void rtus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void rtus_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; rtus_ctrl_pt_t ctrl_pt; rtus_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_rtus_env.start_hdl, @@ -234,15 +171,21 @@ static void rtus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa event.evt_type = RTUS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case RTUS_IDX_CTRL_PT_VAL: ctrl_pt = (rtus_ctrl_pt_t)p_param->value[0]; - if (RTUS_CTRL_PT_GET_UPDATE == ctrl_pt) { + if (RTUS_CTRL_PT_GET_UPDATE == ctrl_pt) + { event.evt_type = RTUS_EVT_GET_UPDATE; - } else if (RTUS_CTRL_PT_CANCEL_UPDATE == ctrl_pt) { + } + else if (RTUS_CTRL_PT_CANCEL_UPDATE == ctrl_pt) + { event.evt_type = RTUS_EVT_CANCEL_UPDATE; - } else { + } + else + { break; } @@ -253,12 +196,31 @@ static void rtus_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_pa ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && RTUS_EVT_INVALID != event.evt_type - && s_rtus_env.rtus_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && RTUS_EVT_INVALID != event.evt_type && s_rtus_env.rtus_init.evt_handler) + { s_rtus_env.rtus_init.evt_handler(&event); } } +static void rtus_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + rtus_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + rtus_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -275,16 +237,23 @@ void rtus_update_result_set(rtus_update_result_t update_result) sdk_err_t rtus_service_init(rtus_init_t *p_rtus_init) { - sdk_err_t ret; - if (p_rtus_init == NULL) { + if (NULL == p_rtus_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_rtus_env.rtus_init, sizeof(rtus_init_t), p_rtus_init, sizeof(rtus_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_rtus_env.rtus_init, p_rtus_init, sizeof(rtus_init_t)); - return ble_server_prf_add(&rtus_prf_info); + s_rtus_env.start_hdl = PRF_INVALID_HANDLE; + + s_rtus_env.rtus_gatts_db.shdl = &s_rtus_env.start_hdl; + s_rtus_env.rtus_gatts_db.uuid = s_rtus_svc_uuid; + s_rtus_env.rtus_gatts_db.attr_tab_cfg = (uint8_t *)&(s_rtus_env.rtus_init.char_mask); + s_rtus_env.rtus_gatts_db.max_nb_attr = RTUS_IDX_NB; + s_rtus_env.rtus_gatts_db.srvc_perm = 0; + s_rtus_env.rtus_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_rtus_env.rtus_gatts_db.attr_tab.attr_tab_16 = rtus_attr_tab; + + return ble_gatts_prf_add(&s_rtus_env.rtus_gatts_db, rtus_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.h index b9b402a..5d92074 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/rtus/rtus.h @@ -57,20 +57,19 @@ #ifndef __RTUS_H__ #define __RTUS_H__ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup RTUS_MACRO Defines * @{ */ -#define RTUS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of RTUS connections. */ -#define RTUS_CTRL_PT_VAL_LEN 1 /**< Length of Time Update Control Point value. */ -#define RTUS_UPDATE_STATE_VAL_LEN 2 /**< Length of Time Update State value. */ -#define RTUS_CHAR_FULL 0x1f /**< Bit mask for mandatory characteristic in RTUS. */ +#define RTUS_CONNECTION_MAX 10 /**< Maximum number of RTUS connections. */ +#define RTUS_CTRL_PT_VAL_LEN 1 /**< Length of Time Update Control Point value. */ +#define RTUS_UPDATE_STATE_VAL_LEN 2 /**< Length of Time Update State value. */ +#define RTUS_CHAR_FULL 0x1f /**< Bit mask for mandatory characteristic in RTUS. */ /** @} */ /** @@ -78,19 +77,22 @@ * @{ */ /**@brief RTUS Time Update Control Point. */ -typedef enum { +typedef enum +{ RTUS_CTRL_PT_GET_UPDATE = 0x01, /**< Get reference update. */ RTUS_CTRL_PT_CANCEL_UPDATE, /**< Cancel reference update. */ } rtus_ctrl_pt_t; /**@brief RTUS Current State. */ -typedef enum { +typedef enum +{ RTUS_CUR_STATE_IDLE, /**< Idle update state. */ RTUS_CUR_STATE_PENDING, /**< Update pending state. */ } rtus_cur_state_t; /**@brief RTUS Time Update Result. */ -typedef enum { +typedef enum +{ RTUS_UPDATE_RESULT_SCCESSFUL, /**< Time update successful. */ RTUS_UPDATE_RESULT_CANCELED, /**< Time update canceled. */ RTUS_UPDATE_RESULT_NO_CONN_TO_REF, /**< No Connection To Reference. */ @@ -100,7 +102,8 @@ typedef enum { } rtus_update_result_t; /**@brief RTUS Event type. */ -typedef enum { +typedef enum +{ RTUS_EVT_INVALID, /**< Invalid event. */ RTUS_EVT_GET_UPDATE, /**< Get reference update. */ RTUS_EVT_CANCEL_UPDATE, /**< Cancel reference update. */ @@ -112,13 +115,15 @@ typedef enum { * @{ */ /**@brief RTUS Time Update State. */ -typedef struct { +typedef struct +{ rtus_cur_state_t cur_state; /**< RTUS Current State. */ rtus_update_result_t update_result; /**< Time Update Result. */ } rtus_update_state_t; /**@brief RTUS Event data. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ rtus_evt_type_t evt_type; /**< RTUS event type. */ } rtus_evt_t; @@ -136,9 +141,9 @@ typedef void (*rtus_evt_handler_t)(rtus_evt_t *p_evt); * @defgroup RTUS_STRUCT Structures * @{ */ -/**@brief Reference Time Update Service init structure. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief Reference Time Update Service init structure. This contains all option and data needed for initialization of the service. */ +typedef struct +{ rtus_evt_handler_t evt_handler; /**< Reference Time Update Service event handler. */ uint16_t char_mask; /**< Initial mask of supported characteristics. */ } rtus_init_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/BUILD.gn new file mode 100644 index 0000000..0ddf7d5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("sample") { + sources = [ "sample_service.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.c index a70b440..10f5b82 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.c @@ -1,9 +1,9 @@ /** ***************************************************************************************** * - * @file sample_profile.c + * @file sample_service.c * - * @brief sample_profile Server Implementation. + * @brief sample profile Server Implementation. * ***************************************************************************************** * @attention @@ -48,10 +48,8 @@ ***************************************************************************************** */ /**@brief The UUIDs of GUS characteristics. */ -#define SAMPLE_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, - 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x01, 0xED, 0xA6} -#define SAMPLE_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, - 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x01, 0xED, 0xA6} +#define SAMPLE_SERVER_TX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x01, 0xED, 0xA6} +#define SAMPLE_SERVER_RX_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x01, 0xED, 0xA6} /**@brief Macros for conversion of 128bit to 16bit UUID. */ #define ATT_128_PRIMARY_SERVICE BLE_ATT_16_TO_128_ARRAY(BLE_ATT_DECL_PRIMARY_SERVICE) @@ -63,7 +61,8 @@ ***************************************************************************************** */ /**@brief Sample Service Attributes Indexes. */ -enum samples_attr_idx_t { +enum samples_attr_idx_t +{ SAMPLES_IDX_SVC, SAMPLES_IDX_TX_CHAR, @@ -80,23 +79,14 @@ enum samples_attr_idx_t { ***************************************************************************************** */ /**@brief Samples Service environment variable. */ -typedef struct { - samples_init_t samples_init; /**< Sample Service initialization variables. */ - uint16_t start_hdl; /**< Service start handle. */ - uint16_t - tx_ntf_cfg[SAMPLES_CONNECTION_MAX]; /**< TX Character Notification configuration of peer devices. */ +typedef struct +{ + samples_init_t samples_init; /**< Sample Service initialization variables. */ + uint16_t start_hdl; /**< Service start handle. */ + uint16_t tx_ntf_cfg[SAMPLES_CONNECTION_MAX]; /**< TX Character Notification configuration of peer devices. */ + ble_gatts_create_db_t sample_gatts_db; /**< Running Speed and Cadence Service attributs database. */ } samples_env_t; -/* -* LOCAL FUNCTION DECLARATION -***************************************************************************************** -*/ -static sdk_err_t samples_init(void); -static void samples_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param); -static void samples_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param); -static void samples_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void samples_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** @@ -106,106 +96,40 @@ static uint8_t s_samples_ins_cnt = 0; /**< Number of static uint8_t s_now_ins_cnt = 0; static samples_evt_type_t s_now_notify_cmp_type = SAMPLES_EVT_TX_NOTIFY_COMPLETE; static const uint16_t s_samples_features = 0xFFFF; +static const uint8_t s_samples_svc_uuid[] = {SAMPLES_SERVICE_UUID}; /**@brief Full SAMPLES Database Description - Used to add attributes into the database. */ -static const attm_desc_128_t samples_att_db[SAMPLES_IDX_NB] = { +static const ble_gatts_attm_desc_128_t samples_attr_tab[SAMPLES_IDX_NB] = +{ // SAMPLE service - [SAMPLES_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [SAMPLES_IDX_SVC] = {ATT_128_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // SAMPLE TX Characteristic Declaration - [SAMPLES_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [SAMPLES_IDX_TX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // SAMPLE TX Characteristic Value - [SAMPLES_IDX_TX_VAL] = { - SAMPLE_SERVER_TX_UUID, - NOTIFY_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - SAMPLES_MAX_DATA_LEN - }, + [SAMPLES_IDX_TX_VAL] = {SAMPLE_SERVER_TX_UUID, + BLE_GATTS_NOTIFY_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + SAMPLES_MAX_DATA_LEN }, // SAMPLE TX Characteristic - Client Characteristic Configuration Descriptor - [SAMPLES_IDX_TX_CFG] = { - ATT_128_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [SAMPLES_IDX_TX_CFG] = {ATT_128_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM_UNSEC | BLE_GATTS_WRITE_REQ_PERM_UNSEC, + 0, + 0}, // SAMPLE RX Characteristic Declaration - [SAMPLES_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0 }, + [SAMPLES_IDX_RX_CHAR] = {ATT_128_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0 }, // SAMPLE RX Characteristic Value - [SAMPLES_IDX_RX_VAL] = { - SAMPLE_SERVER_RX_UUID, - WRITE_CMD_PERM_UNSEC, - (ATT_VAL_LOC_USER | ATT_UUID_TYPE_SET(UUID_TYPE_128)), - SAMPLES_MAX_DATA_LEN - }, -}; - -/**@brief SAMPLE Server Task interface required by profile manager. */ -static ble_prf_manager_cbs_t samples_tack_cbs = { - (prf_init_func_t) samples_init, - NULL, - NULL -}; - -/**@brief SAMPLE Server Task Callbacks. */ -static gatts_prf_cbs_t samples_cb_func = { - samples_read_att_cb, - samples_write_att_cb, - NULL, - samples_ntf_ind_cb, - samples_cccd_set_cb -}; - -/**@brief SAMPLE Server Information. */ -static const prf_server_info_t samples_prf_info = { - .max_connection_nb = SAMPLES_CONNECTION_MAX, - .manager_cbs = &samples_tack_cbs, - .gatts_prf_cbs = &samples_cb_func + [SAMPLES_IDX_RX_VAL] = {SAMPLE_SERVER_RX_UUID, + BLE_GATTS_WRITE_CMD_PERM_UNSEC, + (BLE_GATTS_ATT_VAL_LOC_USER | BLE_GATTS_ATT_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128)), + SAMPLES_MAX_DATA_LEN}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Sample Service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t samples_init(void) -{ - const uint8_t samples_svc_uuid[] = {SAMPLES_SERVICE_UUID}; - sdk_err_t error_code = SDK_SUCCESS; - uint16_t start_hdl = 0; - gatts_create_db_t gatts_db; - sdk_err_t ret; - - ret = memset(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; - } - for (uint8_t i = 0; i < s_samples_ins_cnt; i++) { - gatts_db.shdl = &start_hdl; - gatts_db.uuid = samples_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&s_samples_features; - gatts_db.max_nb_attr = SAMPLES_IDX_NB; - gatts_db.srvc_perm = SRVC_UUID_TYPE_SET(UUID_TYPE_128); - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_128; - gatts_db.attr_tab.attr_tab_128 = samples_att_db; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (error_code == SDK_SUCCESS) { - s_samples_env[i].start_hdl = *(gatts_db.shdl); - } else { - return error_code; - } - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -214,19 +138,22 @@ static sdk_err_t samples_init(void) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void samples_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void samples_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint8_t i = 0; - gatts_read_cfm_t cfm; - - for (i = 0; i < s_samples_ins_cnt; i++) { + ble_gatts_read_cfm_t cfm; + + for (i = 0; i < s_samples_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_samples_env[i].start_hdl, - SAMPLES_IDX_NB, + SAMPLES_IDX_NB, (uint8_t *)&s_samples_features); - if (tab_index > 0) { + + if (tab_index > 0) + { break; } } @@ -234,12 +161,13 @@ static void samples_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_p cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case SAMPLES_IDX_TX_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_samples_env[i].tx_ntf_cfg[conn_idx]; break; - + default: break; } @@ -255,40 +183,43 @@ static void samples_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_p * @param[in] p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void samples_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void samples_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint8_t handle = p_param->handle; uint8_t tab_index = 0; uint8_t i = 0; uint16_t cccd_value = 0; samples_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; cfm.handle = handle; cfm.status = BLE_SUCCESS; - for (i = 0; i < s_samples_ins_cnt; i++) { + for (i = 0; i < s_samples_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_samples_env[i].start_hdl, SAMPLES_IDX_NB, (uint8_t *)&s_samples_features); - if (tab_index > 0) { + if (tab_index > 0) + { break; } } - switch (tab_index) { + switch (tab_index) + { case SAMPLES_IDX_RX_VAL: - event.conn_idx = conn_idx; - event.evt_type = SAMPLES_EVT_RX_RECEIVE_DATA; + event.conn_idx = conn_idx; + event.evt_type = SAMPLES_EVT_RX_RECEIVE_DATA; break; case SAMPLES_IDX_TX_CFG: cccd_value = le16toh(&p_param->value[0]); event.conn_idx = conn_idx; event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? \ - SAMPLES_EVT_TX_NOTIFICATION_ENABLED :\ - SAMPLES_EVT_TX_NOTIFICATION_DISABLED; + SAMPLES_EVT_TX_NOTIFICATION_ENABLED :\ + SAMPLES_EVT_TX_NOTIFICATION_DISABLED; s_samples_env[i].tx_ntf_cfg[conn_idx] = cccd_value; break; @@ -298,7 +229,8 @@ static void samples_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p } if ((BLE_ATT_ERR_INVALID_HANDLE != cfm.status) &&\ (SAMPLES_EVT_INVALID != event.evt_type) &&\ - (s_samples_env[i].samples_init.evt_handler)) { + (s_samples_env[i].samples_init.evt_handler)) + { s_samples_env[i].samples_init.evt_handler(&event); } @@ -314,35 +246,39 @@ static void samples_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void samples_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void samples_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; uint8_t i = 0; samples_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } event.evt_type = SAMPLES_EVT_INVALID; event.conn_idx = conn_idx; - for (i = 0; i < s_samples_ins_cnt; i++) { + for (i = 0; i < s_samples_ins_cnt; i++) + { tab_index = prf_find_idx_by_handle(handle, s_samples_env[i].start_hdl, SAMPLES_IDX_NB, (uint8_t *)&s_samples_features); - if (tab_index > 0) { + if (tab_index > 0) + { break; } } - switch (tab_index) { + switch (tab_index) + { case SAMPLES_IDX_TX_CFG: event.conn_idx = conn_idx; event.evt_type = (PRF_CLI_START_NTF == cccd_value) ? \ - SAMPLES_EVT_TX_NOTIFICATION_ENABLED :\ - SAMPLES_EVT_TX_NOTIFICATION_DISABLED; + SAMPLES_EVT_TX_NOTIFICATION_ENABLED :\ + SAMPLES_EVT_TX_NOTIFICATION_DISABLED; s_samples_env[i].tx_ntf_cfg[conn_idx] = cccd_value; break; @@ -350,7 +286,8 @@ static void samples_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd break; } if ((SAMPLES_EVT_INVALID != event.evt_type) &&\ - (s_samples_env[i].samples_init.evt_handler)) { + (s_samples_env[i].samples_init.evt_handler)) + { s_samples_env[i].samples_init.evt_handler(&event); } } @@ -365,14 +302,17 @@ static void samples_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd * @return If the event was consumed or not. ***************************************************************************************** */ -static void samples_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void samples_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_samples_env[s_now_ins_cnt].samples_init.evt_handler != NULL) { + if (s_samples_env[s_now_ins_cnt].samples_init.evt_handler != NULL) + { samples_evt_t event; event.conn_idx = conn_idx; - if (status == BLE_SUCCESS) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (status == BLE_SUCCESS) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = s_now_notify_cmp_type; s_samples_env[s_now_ins_cnt].samples_init.evt_handler(&event); } @@ -380,6 +320,33 @@ static void samples_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts } } +static void samples_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + samples_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + samples_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + samples_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + samples_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS **************************************************************************************** @@ -387,15 +354,17 @@ static void samples_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts sdk_err_t samples_notify_tx_data(uint8_t conn_idx, uint8_t ins_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - gatts_noti_ind_t send_cmd; + ble_gatts_noti_ind_t send_cmd; - if (PRF_CLI_START_NTF == s_samples_env[ins_idx].tx_ntf_cfg[conn_idx]) { - if (ins_idx <= s_samples_ins_cnt) { + if (PRF_CLI_START_NTF == s_samples_env[ins_idx].tx_ntf_cfg[conn_idx]) + { + if (ins_idx <= s_samples_ins_cnt) + { // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; send_cmd.handle = prf_find_handle_by_idx(SAMPLES_IDX_TX_VAL, - s_samples_env[ins_idx].start_hdl, - (uint8_t *)&s_samples_features); + s_samples_env[ins_idx].start_hdl, + (uint8_t *)&s_samples_features); // pack measured value in database send_cmd.length = length; send_cmd.value = p_data; @@ -412,20 +381,34 @@ sdk_err_t samples_notify_tx_data(uint8_t conn_idx, uint8_t ins_idx, uint8_t *p_d sdk_err_t samples_service_init(samples_init_t samples_init[], uint8_t ins_num) { - sdk_err_t ret; + sdk_err_t error_code = SDK_SUCCESS; - if (ins_num > SAMPLES_INSTANCE_MAX) { + if (ins_num > SAMPLES_INSTANCE_MAX) + { return SDK_ERR_INVALID_PARAM; } - for (uint8_t i = 0; i < ins_num; i++) { - ret = memcpy_s(&s_samples_env[i].samples_init, sizeof(samples_init_t), - &samples_init[i], sizeof(samples_init_t)); - if (ret < 0) { - return ret; - } + for (uint8_t i = 0; i < ins_num; i++) + { + memcpy(&s_samples_env[i].samples_init, &samples_init[i], sizeof(samples_init_t)); } s_samples_ins_cnt = ins_num; - return ble_server_prf_add(&samples_prf_info); + + for (uint8_t i = 0; i < ins_num; i++) + { + s_samples_env[i].start_hdl = PRF_INVALID_HANDLE; + + s_samples_env[i].sample_gatts_db.shdl = &s_samples_env[i].start_hdl; + s_samples_env[i].sample_gatts_db.uuid = s_samples_svc_uuid; + s_samples_env[i].sample_gatts_db.attr_tab_cfg = (uint8_t *)&s_samples_features; + s_samples_env[i].sample_gatts_db.max_nb_attr = SAMPLES_IDX_NB; + s_samples_env[i].sample_gatts_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_samples_env[i].sample_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_samples_env[i].sample_gatts_db.attr_tab.attr_tab_128 = samples_attr_tab; + + error_code |= ble_gatts_prf_add(&s_samples_env[i].sample_gatts_db, samples_ble_evt_handler); + } + + return error_code; } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.h index 6f5344c..fc0dc07 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/sample/sample_service.h @@ -3,7 +3,7 @@ * * @file sample_service.h * - * @brief Header file - sample_profile Server Role + * @brief Sample Service API. * ***************************************************************************************** * @attention @@ -46,32 +46,30 @@ * @{ * @brief Definitions and prototypes for the GUS interface. * - * @details The Sample Service demonstrates how to add vendor service to BLE Stack database, which includes + * @details The Sample Service demonstrates how to add vendor service to BLE Stack database, which includes * Tx and Rx base charateristic, developer can changes and adds other characteristics. - * + * * After \ref samples_init_t variable is initialized, the application must call \ref samples_service_init() * to add example characteristics to the BLE Stack database, and it provides \ref samples_notify_tx_data(). */ -#ifndef SAMPLE_PROFILE_H -#define SAMPLE_PROFILE_H +#ifndef _SAMPLE_PROFILE_H_ +#define _SAMPLE_PROFILE_H_ +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup SAMPLES_MACRO Defines * @{ */ -#define SAMPLES_INSTANCE_MAX 0x01 /**< Maximum number of Sample Service instances. The value is configurable.*/ -#define SAMPLES_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Sample Service connections. */ -#define SAMPLES_MAX_DATA_LEN 244 /**< Maximum length of sample charateristic value. */ -#define SAMPLES_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ - 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x01, 0xED, 0xA6 /**< The UUID of Sample Service for \ - setting advertising data. */ +#define SAMPLES_INSTANCE_MAX 0x01 /**< Maximum number of Sample Service instances. The value is configurable. */ +#define SAMPLES_CONNECTION_MAX 10 /**< Maximum number of Sample Service connections. */ +#define SAMPLES_MAX_DATA_LEN 244 /**< Maximum length of sample charateristic value. */ +#define SAMPLES_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x01, 0xED, 0xA6 /**< The UUID of Sample Service for setting advertising data. */ /** @} */ /** @@ -79,7 +77,8 @@ * @{ */ /**@brief Sample Service event type. */ -typedef enum { +typedef enum +{ SAMPLES_EVT_INVALID, SAMPLES_EVT_TX_NOTIFICATION_ENABLED, SAMPLES_EVT_TX_NOTIFICATION_DISABLED, @@ -93,7 +92,8 @@ typedef enum { * @{ */ /**@brief Sample Service event. */ -typedef struct { +typedef struct +{ samples_evt_type_t evt_type; /**< The sample service event. */ uint8_t conn_idx; /**< The connection index. */ uint8_t *p_data; /**< Pointer to event data. */ @@ -114,7 +114,8 @@ typedef void (*samples_evt_handler_t)(samples_evt_t *p_evt); * @{ */ /**@brief Sample Service init stucture. This contains all option and data needed for initialization of the service. */ -typedef struct { +typedef struct +{ samples_evt_handler_t evt_handler; /**handle; - uint8_t tab_index = 0; + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; tab_index = prf_find_idx_by_handle(handle, s_ths_env.start_hdl, THS_IDX_NB, (uint8_t *)&s_char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { + switch (tab_index) + { case THS_IDX_TX_CFG: cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_ths_env.data_ntf_cfg[conn_idx]; @@ -289,12 +210,12 @@ static void ths_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_par * @return If the request was consumed or not. ***************************************************************************************** */ -static void ths_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void ths_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint8_t handle = p_param->handle; - uint8_t tab_index = 0; - ths_evt_t event; - gatts_write_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = 0; + ths_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_ths_env.start_hdl, THS_IDX_NB, (uint8_t *)&s_char_mask); cfm.handle = handle; @@ -303,7 +224,8 @@ static void ths_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p event.conn_idx = conn_idx; event.evt_type = THS_EVT_INVALID; - switch (tab_index) { + switch (tab_index) + { case THS_IDX_TX_CFG: s_ths_env.data_ntf_cfg[conn_idx] = le16toh(&p_param->value[0]); break; @@ -318,7 +240,8 @@ static void ths_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p case THS_IDX_SETTINGS_VAL: event.evt_type = THS_EVT_SETTINGS_CHANGED; - if (THS_SETTINGS_TYPE_TRANS_MODE == p_param->value[0]) { + if (THS_SETTINGS_TYPE_TRANS_MODE == p_param->value[0]) + { s_ths_env.ths_init.transport_mode = (ths_transport_mode_t)p_param->value[1]; } break; @@ -332,8 +255,8 @@ static void ths_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p break; } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && THS_EVT_INVALID != event.evt_type && - s_ths_env.ths_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && THS_EVT_INVALID != event.evt_type && s_ths_env.ths_init.evt_handler) + { event.length = p_param->length; event.p_data = (uint8_t *)p_param->value; s_ths_env.ths_init.evt_handler(&event); @@ -351,17 +274,19 @@ static void ths_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void ths_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void ths_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint8_t tab_index = 0; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } tab_index = prf_find_idx_by_handle(handle, s_ths_env.start_hdl, THS_IDX_NB, (uint8_t *)&s_char_mask); - switch (tab_index) { + switch (tab_index) + { case THS_IDX_TX_CFG: s_ths_env.data_ntf_cfg[conn_idx] = cccd_value; break; @@ -377,16 +302,18 @@ static void ths_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val /** ***************************************************************************************** - * @brief Handles reception of the complete event. + * @brief Handles reception of the notification complete event. * * @param[in] conn_idx: Connection index. * @param[in] p_param: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void ths_gatts_cmpl_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void ths_ntf_cplt_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_ths_env.ths_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type && THS_IDX_TX_VAL == s_noti_cfg_idx) { + if (s_ths_env.ths_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type && THS_IDX_TX_VAL == s_noti_cfg_idx) + { ths_evt_t event; event.conn_idx = conn_idx; event.evt_type = THS_EVT_DATA_SENT; @@ -395,6 +322,33 @@ static void ths_gatts_cmpl_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ } } +static void ths_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + ths_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + ths_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + ths_ntf_cplt_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + ths_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -403,18 +357,19 @@ sdk_err_t ths_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - if (PRF_CLI_START_NTF == s_ths_env.data_ntf_cfg[conn_idx]) { - gatts_noti_ind_t send_cmd; + if (PRF_CLI_START_NTF == s_ths_env.data_ntf_cfg[conn_idx]) + { + ble_gatts_noti_ind_t send_cmd; - // Fill in the parameter structure - send_cmd.type = BLE_GATT_NOTIFICATION; - send_cmd.handle = prf_find_handle_by_idx(THS_IDX_TX_VAL, s_ths_env.start_hdl, (uint8_t *)&s_char_mask); - // Pack measured value in database - send_cmd.length = length; - send_cmd.value = p_data; - // Send notification to peer device - error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); - s_noti_cfg_idx = THS_IDX_TX_VAL; + // Fill in the parameter structure + send_cmd.type = BLE_GATT_NOTIFICATION; + send_cmd.handle = prf_find_handle_by_idx(THS_IDX_TX_VAL, s_ths_env.start_hdl, (uint8_t *)&s_char_mask); + // Pack measured value in database + send_cmd.length = length; + send_cmd.value = p_data; + // Send notification to peer device + error_code = ble_gatts_noti_ind(conn_idx, &send_cmd); + s_noti_cfg_idx = THS_IDX_TX_VAL; } return error_code; @@ -424,8 +379,9 @@ sdk_err_t ths_settings_notify(uint8_t conn_idx, uint8_t *p_settings, uint16_t le { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; - if (PRF_CLI_START_NTF == s_ths_env.settings_ntf_cfg[conn_idx]) { - gatts_noti_ind_t send_cmd; + if (PRF_CLI_START_NTF == s_ths_env.settings_ntf_cfg[conn_idx]) + { + ble_gatts_noti_ind_t send_cmd; // Fill in the parameter structure send_cmd.type = BLE_GATT_NOTIFICATION; @@ -450,16 +406,24 @@ ths_transport_mode_t ths_transport_mode_get(void) sdk_err_t ths_service_init(ths_init_t *p_ths_init) { - sdk_err_t ret; - if (p_ths_init == NULL) { + if (NULL == p_ths_init) + { return SDK_ERR_POINTER_NULL; } - ret = memcpy_s(&s_ths_env.ths_init, sizeof(ths_init_t), p_ths_init, sizeof(ths_init_t)); - if (ret < 0) { - return ret; - } + memcpy(&s_ths_env.ths_init, p_ths_init, sizeof(ths_init_t)); - return ble_server_prf_add(&ths_prf_info); + memset(&s_ths_env.ths_att_db, 0, sizeof(ble_gatts_create_db_t)); + + s_ths_env.start_hdl = PRF_INVALID_HANDLE; + s_ths_env.ths_att_db.shdl = &s_ths_env.start_hdl; + s_ths_env.ths_att_db.uuid = s_ths_svc_uuid; + s_ths_env.ths_att_db.attr_tab_cfg = (uint8_t *)&s_char_mask; + s_ths_env.ths_att_db.max_nb_attr = THS_IDX_NB; + s_ths_env.ths_att_db.srvc_perm = BLE_GATTS_SRVC_UUID_TYPE_SET(BLE_GATTS_UUID_TYPE_128); + s_ths_env.ths_att_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_128; + s_ths_env.ths_att_db.attr_tab.attr_tab_128 = ths_attr_tab; + + return ble_gatts_prf_add(&s_ths_env.ths_att_db, ths_ble_evt_handler); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths/ths.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths/ths.h index e267fe6..3f202aa 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths/ths.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths/ths.h @@ -47,12 +47,12 @@ * @brief Definitions and prototypes for the THS interface. * * @details The Throughput Service is a customized GATT-based service with Settings, Toggle, - * Tx and Rx characteristics. The developer uses the service to test throughput. + * Tx and Rx characteristics. The developer uses the service to test throughput. * The data is sent to the peer as Handle Value Notification, and the data received * from the peer is transmitted with GATT Write Command. * * The peer writes Toggle characteristic to command the application starting/stopping - * throughput. The application calls \ref ths_data_send() to send data to the peer. + * throughput. The application calls \ref ths_data_send() to send data to the peer. * The application handles \ref THS_EVT_DATA_RECEIVED in \ref ths_init_t.evt_handler() * to get the data received from the peer. The application uses ths_settings_notify() to * request the change of the parameters related with throughput, including CI, MTU, PDU and PHY. @@ -61,20 +61,18 @@ #ifndef _THS_H_ #define _THS_H_ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup THS_MACRO Defines * @{ */ -#define THS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Throughput Service connections.*/ -#define THS_MAX_DATA_LEN 512 /**< Maximum length of the value of Rx or Tx characteristic. */ -#define THS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, \ - 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x03, 0xED, 0xA6 /**< The UUID of Throughput Service \ - for setting advertising data. */ +#define THS_CONNECTION_MAX 10 /**< Maximum number of Throughput Service connections. */ +#define THS_MAX_DATA_LEN 512 /**< Maximum length of the value of Rx or Tx characteristic. */ +#define THS_SERVICE_UUID 0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x03, 0xED, 0xA6 /**< The UUID of Throughput Service for setting advertising data. */ /** @} */ /** @@ -82,38 +80,40 @@ * @{ */ /**@brief Throughput data transport mode. */ -typedef enum { +typedef enum +{ THS_SLAVE_NOTIFY_MODE, /**< Only allow device notify. */ THS_MASTER_WRITE_MODE, /**< Only allow peer writes. */ THS_DOUBLE_MODE, /**< Allow device notify and peer writes at the same time. */ } ths_transport_mode_t; /**@brief Throughput Service event type. */ -typedef enum { +typedef enum +{ THS_EVT_INVALID, /**< Invalid THS event type. */ - THS_EVT_DATA_RECEIVED, /**< The data from the peer has been received. \ - The application gets the data in \ref ths_evt_t.p_data. */ - THS_EVT_DATA_SENT, /**< The data from the application has been sent, \ - and the service is ready to accept new data from the application. */ + THS_EVT_DATA_RECEIVED, /**< The data from the peer has been received. The application gets the data in \ref ths_evt_t.p_data. */ + THS_EVT_DATA_SENT, /**< The data from the application has been sent, and the service is ready to accept new data from the application. */ THS_EVT_SETTINGS_CHANGED, /**< The settings parameters, like MTU, PHY, have been changed by the peer. */ THS_EVT_TOGGLE_SET, /**< The toggle state has been set by the peer. */ } ths_evt_type_t; /**@brief Throughput toggle state of sending the data. */ -enum ths_toggle_state_t { +enum ths_toggle_state_t +{ THS_TOGGLE_STATE_OFF, /**< Sending data is disabled. */ THS_TOGGLE_STATE_ON, /**< Sending data is enabled. */ }; /**@brief Throughput service settings types. */ -typedef enum { +typedef enum +{ THS_SETTINGS_TYPE_CI, /**< BLE Connection Interval parameter. */ THS_SETTINGS_TYPE_MTU, /**< MTU Size. */ THS_SETTINGS_TYPE_PDU, /**< PDU Size. */ THS_SETTINGS_TYPE_PHY, /**< Radio Phy mode, 1M, 2M, Encoded. */ THS_SETTINGS_TYPE_TRANS_MODE, /**< Data transmission mode. */ THS_SETTINGS_TYPE_TX_POWER, /**< Connect Tx power. */ -} ths_settings_type_t; +}ths_settings_type_t; /** @} */ /** @@ -121,7 +121,8 @@ typedef enum { * @{ */ /**@brief Throughput Service event. */ -typedef struct { +typedef struct +{ ths_evt_type_t evt_type; /**< The THS event type. */ ths_settings_type_t setting_type; /**< The THS parameter set type. */ uint8_t conn_idx; /**< The index of the connection for the data transmission. */ @@ -142,12 +143,10 @@ typedef void (*ths_evt_handler_t)(ths_evt_t *p_evt); * @addtogroup THS_STRUCT Structures * @{ */ -/**@brief Throughput Service init stucture. - * This contains all option and data needed for initialization of the service. */ -typedef struct { - ths_evt_handler_t - evt_handler; /**< Throughput Service event handler which must be provided \ - by the application to send and receive the data and the settings change. */ +/**@brief Throughput Service init stucture. This contains all option and data needed for initialization of the service. */ +typedef struct +{ + ths_evt_handler_t evt_handler; /**< Throughput Service event handler which must be provided by the application to send and receive the data and the settings change. */ ths_transport_mode_t transport_mode; /**< The transport mode of a device. */ } ths_init_t; /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/BUILD.gn new file mode 100644 index 0000000..47aaa96 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("ths_c") { + sources = [ "ths_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.c index 8c7e026..68481f3 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.c @@ -41,66 +41,35 @@ */ #include "ths_c.h" #include -#define ATTR_VALUE_LEN 2 -#define UUID_LEN 16 /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Throughput Service Client environment variable. */ -struct ths_c_env_t { +struct ths_c_env_t +{ ths_c_handles_t handles; /**< Handles of THS characteristics which will be got for peer. */ ths_c_evt_handler_t evt_handler; /**< Handler of THS client event */ uint8_t prf_id; /**< THS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void ths_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle); -static void ths_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); -static void ths_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ -static struct ths_c_env_t - s_ths_c_env; /**< THS Client environment variable. */ +static struct ths_c_env_t s_ths_c_env; /**< THS Client environment variable. */ static uint8_t s_ths_uuid[16] = THS_SVC_UUID; static uint8_t s_ths_tx_char_uuid[16] = THS_TX_CHAR_UUID; static uint8_t s_ths_rx_char_uuid[16] = THS_RX_CHAR_UUID; static uint8_t s_ths_setting_char_uuid[16] = THS_SETTING_CHAR_UUID; static uint8_t s_toggle_char_uuid[16] = THS_TOGGLE_CHAR_UUID; -/**@brief THS Client interface required by profile manager. */ -static ble_prf_manager_cbs_t ths_c_mgr_cbs = { - NULL, - NULL, - NULL -}; -/**@brief THS GATT Client Callbacks. */ -static gattc_prf_cbs_t ths_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - NULL, - ths_c_att_write_cb, - ths_c_att_ntf_ind_cb, - ths_c_srvc_browse_cb, - NULL, +static ble_uuid_t s_ths_service_uuid = +{ + .uuid_len = 16, + .uuid = s_ths_uuid, }; - -/**@brief THS Client Information. */ -static const prf_client_info_t ths_c_prf_info = { - .max_connection_nb = THS_C_CONNECTION_MAX, - .manager_cbs = &ths_c_mgr_cbs, - .gattc_prf_cbs = &ths_c_gattc_cbs -}; - /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -114,47 +83,57 @@ static const prf_client_info_t ths_c_prf_info = { */ static void ths_c_evt_handler_excute(ths_c_evt_t *p_evt) { - if (s_ths_c_env.evt_handler != NULL && THS_C_EVT_INVALID != p_evt->evt_type) { + if (NULL != s_ths_c_env.evt_handler && THS_C_EVT_INVALID != p_evt->evt_type) + { s_ths_c_env.evt_handler(p_evt); } } /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] handle: The handle of attribute. ***************************************************************************************** */ -static void ths_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle) +static void ths_c_att_write_evt_handler(uint8_t conn_idx, uint8_t status, uint16_t handle) { ths_c_evt_t ths_c_evt; ths_c_evt.conn_idx = conn_idx; ths_c_evt.evt_type = THS_C_EVT_INVALID; - if (handle == s_ths_c_env.handles.ths_tx_cccd_handle) { + if (handle == s_ths_c_env.handles.ths_tx_cccd_handle) + { ths_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - THS_C_EVT_TX_NTF_SET_SUCCESS : \ - THS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ths_c_env.handles.ths_setting_cccd_handle) { + THS_C_EVT_TX_NTF_SET_SUCCESS : \ + THS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ths_c_env.handles.ths_setting_cccd_handle) + { ths_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - THS_C_EVT_SETTING_NTF_SET_SUCCESS : \ - THS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ths_c_env.handles.ths_toggle_handle) { + THS_C_EVT_SETTING_NTF_SET_SUCCESS : \ + THS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ths_c_env.handles.ths_toggle_handle) + { ths_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - THS_C_EVT_TOGGLE_SET_SUCCESS : \ - THS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ths_c_env.handles.ths_setting_handle) { + THS_C_EVT_TOGGLE_SET_SUCCESS : \ + THS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ths_c_env.handles.ths_setting_handle) + { ths_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - THS_C_EVT_PARAM_SET_SUCCESS : \ - THS_C_EVT_WRITE_OP_ERR; - } else if (handle == s_ths_c_env.handles.ths_rx_handle) { + THS_C_EVT_PARAM_SET_SUCCESS : \ + THS_C_EVT_WRITE_OP_ERR; + } + else if (handle == s_ths_c_env.handles.ths_rx_handle) + { ths_c_evt.evt_type = (BLE_SUCCESS == status) ? \ - THS_C_EVT_TX_SUCCESS : \ - THS_C_EVT_WRITE_OP_ERR; + THS_C_EVT_TX_SUCCESS : \ + THS_C_EVT_WRITE_OP_ERR; } ths_c_evt_handler_excute(&ths_c_evt); @@ -162,14 +141,14 @@ static void ths_c_att_write_cb(uint8_t conn_idx, uint8_t status, uint16_t handle /** ***************************************************************************************** - * @brief This callback function will be called when receiving notification or indication. + * @brief This event handler function will be called when receiving notification or indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_ntf_ind: The information of notification or indication. ***************************************************************************************** */ -static void ths_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind) +static void ths_c_att_ntf_ind_evt_handler(uint8_t conn_idx, const ble_gattc_evt_ntf_ind_t *p_ntf_ind) { ths_c_evt_t ths_c_evt; @@ -178,9 +157,12 @@ static void ths_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ ths_c_evt.p_data = p_ntf_ind->p_value; ths_c_evt.length = p_ntf_ind->length; - if (p_ntf_ind->handle == s_ths_c_env.handles.ths_setting_handle) { + if (p_ntf_ind->handle == s_ths_c_env.handles.ths_setting_handle) + { ths_c_evt.evt_type = THS_C_EVT_SETTING_RSP_RECEIVE; - } else if (p_ntf_ind->handle == s_ths_c_env.handles.ths_tx_handle) { + } + else if (p_ntf_ind->handle == s_ths_c_env.handles.ths_tx_handle) + { ths_c_evt.evt_type = THS_C_EVT_THRP_DATA_RECEIVE; } @@ -189,14 +171,14 @@ static void ths_c_att_ntf_ind_cb(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ /** ***************************************************************************************** - * @brief This callback function will be called when receiving browse service indication. + * @brief This event handler function will be called when receiving browse service indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void ths_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void ths_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { ths_c_evt_t ths_c_evt; uint16_t handle_disc; @@ -204,153 +186,154 @@ static void ths_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat ths_c_evt.conn_idx = conn_idx; ths_c_evt.evt_type = THS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - if (p_browse_srvc->uuid_len == UUID_LEN && memcmp(p_browse_srvc->uuid, s_ths_uuid, UUID_LEN) == 0) { - s_ths_c_env.handles.ths_srvc_start_handle = p_browse_srvc->start_hdl; - s_ths_c_env.handles.ths_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_SUCCESS == status) + { + if (16 == p_browse_srvc->uuid_len && 0 == memcmp(p_browse_srvc->uuid, s_ths_uuid, 16)) + { + s_ths_c_env.handles.ths_srvc_start_handle = p_browse_srvc->start_hdl; + s_ths_c_env.handles.ths_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) { - if (memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_rx_char_uuid, UUID_LEN) == 0) { - s_ths_c_env.handles.ths_rx_handle = handle_disc; - } else if ((memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_tx_char_uuid, UUID_LEN) == 0)) { - s_ths_c_env.handles.ths_tx_handle = handle_disc; - s_ths_c_env.handles.ths_tx_cccd_handle = handle_disc + 1; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_setting_char_uuid, UUID_LEN) == 0) { - s_ths_c_env.handles.ths_setting_handle = handle_disc; - s_ths_c_env.handles.ths_setting_cccd_handle = handle_disc + 1; - } else if (memcmp(p_browse_srvc->info[i].attr.uuid, s_toggle_char_uuid, UUID_LEN) == 0) { - s_ths_c_env.handles.ths_toggle_handle = handle_disc; + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_ATTR_VAL) + { + if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_rx_char_uuid, 16)) + { + s_ths_c_env.handles.ths_rx_handle = handle_disc; + } + else if (0 == (memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_tx_char_uuid, 16))) + { + s_ths_c_env.handles.ths_tx_handle = handle_disc; + s_ths_c_env.handles.ths_tx_cccd_handle = handle_disc + 1; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_ths_setting_char_uuid, 16)) + { + s_ths_c_env.handles.ths_setting_handle = handle_disc; + s_ths_c_env.handles.ths_setting_cccd_handle = handle_disc + 1; + } + else if (0 == memcmp(p_browse_srvc->info[i].attr.uuid, s_toggle_char_uuid, 16)) + { + s_ths_c_env.handles.ths_toggle_handle = handle_disc; + } + } + + if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) + { + break; } } - if (p_browse_srvc->info[i].attr_type == BLE_GATTC_BROWSE_NONE) { - break; - } + ths_c_evt.evt_type = THS_C_EVT_DISCOVERY_COMPLETE; } - - ths_c_evt.evt_type = THS_C_EVT_DISCOVERY_COMPLETE; } ths_c_evt_handler_excute(&ths_c_evt); } +static void ths_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTC_EVT_SRVC_BROWSE: + ths_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + + case BLE_GATTC_EVT_WRITE_RSP: + ths_c_att_write_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, p_evt->evt.gattc_evt.params.write_rsp.handle); + break; + + case BLE_GATTC_EVT_NTF_IND: + ths_c_att_ntf_ind_evt_handler(p_evt->evt.gattc_evt.index, &p_evt->evt.gattc_evt.params.ntf_ind); + break; + } +} /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t ths_client_init(ths_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_ths_c_env, sizeof(s_ths_c_env), 0, sizeof(s_ths_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_ths_c_env, 0, sizeof(s_ths_c_env)); s_ths_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&ths_c_prf_info, &s_ths_c_env.prf_id); + return ble_gattc_prf_add(&s_ths_service_uuid, ths_c_ble_evt_handler); } sdk_err_t ths_c_disc_srvc_start(uint8_t conn_idx) { - const ble_uuid_t ths_uuid = { - .uuid_len = 16, - .uuid = s_ths_uuid, - }; - - return ble_gattc_prf_services_browse(s_ths_c_env.prf_id, conn_idx, &ths_uuid); + return ble_gattc_services_browse(conn_idx, &s_ths_service_uuid); } sdk_err_t ths_c_tx_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_tx_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_tx_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ths_c_env.handles.ths_tx_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_ths_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx,s_ths_c_env.handles.ths_tx_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ths_c_setting_notify_set(uint8_t conn_idx, bool is_enable) { - gattc_write_attr_value_t write_attr_value; uint16_t ntf_value = is_enable ? PRF_CLI_START_NTF : PRF_CLI_STOP_NTFIND; - if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_setting_cccd_handle) { + if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_setting_cccd_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.handle = s_ths_c_env.handles.ths_setting_cccd_handle; - write_attr_value.offset = 0; - write_attr_value.length = ATTR_VALUE_LEN; - write_attr_value.p_value = (uint8_t *)&ntf_value; - - return ble_gattc_prf_write(s_ths_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write(conn_idx, s_ths_c_env.handles.ths_setting_cccd_handle, 0, 2, (uint8_t *)&ntf_value); } sdk_err_t ths_c_comm_param_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_setting_handle) { + if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_setting_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_ths_c_env.handles.ths_setting_handle; - write_attr_value.length = length; - write_attr_value.p_value = p_data; - - return ble_gattc_prf_write_no_resp(s_ths_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_ths_c_env.handles.ths_setting_handle, length, p_data); } sdk_err_t ths_c_toggle_set(uint8_t conn_idx, bool is_enable) { - gattc_write_no_resp_t write_attr_value; - - if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_toggle_handle) { + if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_toggle_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_ths_c_env.handles.ths_toggle_handle; - write_attr_value.length = 1; - write_attr_value.p_value = (uint8_t *)&is_enable; - - return ble_gattc_prf_write_no_resp(s_ths_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_ths_c_env.handles.ths_toggle_handle, 1, (uint8_t *)&is_enable); } sdk_err_t ths_c_tx_data_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { - gattc_write_no_resp_t write_attr_value; - if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_rx_handle) { + if (BLE_ATT_INVALID_HDL == s_ths_c_env.handles.ths_rx_handle) + { return SDK_ERR_INVALID_HANDLE; } - write_attr_value.signed_write = false; - write_attr_value.handle = s_ths_c_env.handles.ths_rx_handle; - write_attr_value.length = length; - write_attr_value.p_value = p_data; - - return ble_gattc_prf_write_no_resp(s_ths_c_env.prf_id, conn_idx, &write_attr_value); + return ble_gattc_write_no_resp(conn_idx, false, s_ths_c_env.handles.ths_rx_handle, length, p_data); } + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.h index 2ec0fd9..3521312 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/ths_c/ths_c.h @@ -39,7 +39,6 @@ * @addtogroup BLE_SRV BLE Services * @{ */ - /** * @defgroup BLE_SDK_THS_C Throughput Service Client (THS_C) * @{ @@ -50,7 +49,7 @@ * interact with it. * * The application must provide to register, then call \ref ths_client_init(). After the module can - * send setting parameters and throughput data to peer, it will notify application. + * send setting parameters and throughput data to peer, it will notify application. * It includes only Throughput Service notify data, only Throughput Service Client write data * and both send data test mode \ref ths_c_transport_mode_t. */ @@ -58,11 +57,11 @@ #ifndef __THS_C_H__ #define __THS_C_H__ +#include "ble_prf_types.h" +#include "gr_includes.h" +#include "custom_config.h" #include #include -#include "ble_prf_types.h" -#include "gr55xx_sys.h" -#include "custom_config.h" /** * @defgroup THS_C_MACRO Defines @@ -73,18 +72,17 @@ * @{ * @brief THS service and characteristcs UUID. */ -#define THS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of THS Client connections. */ -#define THS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, \ - 0xD3, 0x01, 0x03, 0xED, 0xA6} /**< UUID of THS Service. */ -#define THS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, \ - 0xD3, 0x02, 0x03, 0xED, 0xA6} /**< UUID of THS Tx Characteristic. */ -#define THS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, \ - 0xD3, 0x03, 0x03, 0xED, 0xA6} /**< UUID of THS Rx Characteristic. */ -#define THS_SETTING_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, \ - 0xD3, 0x04, 0x03, 0xED, 0xA6} /**< UUID of THS Setting Characteristic. */ -#define THS_TOGGLE_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80, 0x0A, 0x46, 0x44, \ - 0xD3, 0x05, 0x03, 0xED, 0xA6} /**< UUID of THS Toggle Characteristic. */ +#define THS_C_CONNECTION_MAX 10 /**< Maximum number of THS Client connections. */ +#define THS_SVC_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x01, 0x03, 0xED, 0xA6} /**< UUID of THS Service. */ +#define THS_TX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x02, 0x03, 0xED, 0xA6} /**< UUID of THS Tx Characteristic. */ +#define THS_RX_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x03, 0x03, 0xED, 0xA6} /**< UUID of THS Rx Characteristic. */ +#define THS_SETTING_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x04, 0x03, 0xED, 0xA6} /**< UUID of THS Setting Characteristic. */ +#define THS_TOGGLE_CHAR_UUID {0x1B, 0xD7, 0x90, 0xEC, 0xE8, 0xB9, 0x75, 0x80,\ + 0x0A, 0x46, 0x44, 0xD3, 0x05, 0x03, 0xED, 0xA6} /**< UUID of THS Toggle Characteristic. */ /** @} */ /** @} */ @@ -93,15 +91,16 @@ * @{ */ /**@brief Throughput Service Client data transport mode. */ -typedef enum { +typedef enum +{ THS_C_SLAVE_NOTIFY_MODE, /** The device recieves data from the peer via notify. */ THS_C_MASTER_WRITE_MODE, /** The device writes data to the peer. */ - THS_C_DOUBLE_MODE, /** The device recieve data from the peer via notify and \ - write data to the peer at the same time. */ + THS_C_DOUBLE_MODE, /** The device recieve data from the peer via notify and write data to the peer at the same time. */ } ths_c_transport_mode_t; /**@brief Throughput service settings types. */ -typedef enum { +typedef enum +{ THS_C_SETTINGS_TYPE_CI, /**< BLE Connection Interval parameter. */ THS_C_SETTINGS_TYPE_MTU, /**< MTU Size. */ THS_C_SETTINGS_TYPE_PDU, /**< PDU Size. */ @@ -111,11 +110,11 @@ typedef enum { } ths_c_settings_type_t; /**@brief Throughput Service Client event type. */ -typedef enum { +typedef enum +{ THS_C_EVT_INVALID, /**< THS Client invalid event. */ THS_C_EVT_DISCOVERY_COMPLETE, /**< THS Client has found THS service and its characteristics. */ - THS_C_EVT_DISCOVERY_FAIL, /**< THS Client found THS service failed because of invalid operation \ - or no found at the peer. */ + THS_C_EVT_DISCOVERY_FAIL, /**< THS Client found THS service failed because of invalid operation or no found at the peer. */ THS_C_EVT_TX_NTF_SET_SUCCESS, /**< THS Client has set peer Tx notify. */ THS_C_EVT_SETTING_NTF_SET_SUCCESS, /**< THS Client has set peer Settings notify. */ THS_C_EVT_TOGGLE_SET_SUCCESS, /**< THS Client has set toggle no. */ @@ -132,7 +131,8 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t ths_srvc_start_handle; /**< THS Service start handle. */ uint16_t ths_srvc_end_handle; /**< THS Service end handle. */ uint16_t ths_tx_handle; /**< THS Tx characteristic handle which has been got from peer. */ @@ -144,7 +144,8 @@ typedef struct { } ths_c_handles_t; /**@brief Throughput Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ ths_c_evt_type_t evt_type; /**< THS client event type. */ uint8_t *p_data; /**< Pointer to event data. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/BUILD.gn new file mode 100644 index 0000000..06022f1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("tps") { + sources = [ "tps.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.c index 8107f5a..eef235f 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.c @@ -43,14 +43,14 @@ #include "ble_prf_types.h" #include "ble_prf_utils.h" #include "utility.h" -#define OFFSET_100 100 -#define OFFSET_20 20 + /* * ENUMERATIONS ***************************************************************************************** */ /**@brief Tx Power Service attributes index. */ -enum tps_attr_idx_tag { +enum tps_attr_idx_tag +{ TPS_IDX_SVC, TPS_IDX_TX_POWER_LVL_CHAR, @@ -64,9 +64,11 @@ enum tps_attr_idx_tag { ***************************************************************************************** */ /**@brief Tx Power Service environment variable. */ -struct tps_env_t { - tps_init_t tps_init; /**< Tx Power Service initialization variables. */ - uint16_t start_hdl; /**< Tx Power Service start handle. */ +struct tps_env_t +{ + tps_init_t tps_init; /**< Tx Power Service initialization variables. */ + uint16_t start_hdl; /**< Tx Power Service start handle. */ + ble_gatts_create_db_t tps_serv_db; /**< Tx Power Service DataBase. */ }; /* @@ -79,89 +81,56 @@ static uint8_t s_char_mask = 0x07; /**< Features added into ATT database. * bit1 - Tx Power Level Characteristic Declaration * bit2 - Tx Power Level Characteristic Value */ +static const uint8_t s_tps_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_TX_POWER); /**@brief TPS Database Description - Used to add attributes into the database. */ -static const attm_desc_t tps_attr_tab[TPS_IDX_NB] = { +static const ble_gatts_attm_desc_t tps_attr_tab[TPS_IDX_NB] = +{ // Tx Power Service Declaration - [TPS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [TPS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Tx Power Level Characteristic Declaration - [TPS_IDX_TX_POWER_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [TPS_IDX_TX_POWER_LVL_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Tx Power Level Characteristic Value - [TPS_IDX_TX_POWER_LVL_VAL] = {BLE_ATT_CHAR_TX_POWER_LEVEL, READ_PERM_UNSEC, 0, sizeof(int8_t)}, + [TPS_IDX_TX_POWER_LVL_VAL] = {BLE_ATT_CHAR_TX_POWER_LEVEL, BLE_GATTS_READ_PERM_UNSEC, 0, sizeof(int8_t)}, }; /* * LOCAL FUNCTION DECLARATIONS ***************************************************************************************** */ -static sdk_err_t tps_init(void); - -/**@brief TPS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t tps_mgr_cbs = { - (prf_init_func_t)tps_init, - NULL, - NULL -}; - -/**@brief TPS GATT server Callbacks. */ -static gatts_prf_cbs_t tps_gatts_cbs = { - NULL, - NULL, - NULL, - NULL -}; - -/**@brief TPS Information. */ -static const prf_server_info_t tps_prf_info = { - /* There shall be only one connection on a device */ - .max_connection_nb = 1, - .manager_cbs = &tps_mgr_cbs, - .gatts_prf_cbs = &tps_gatts_cbs -}; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize TP service and create db in BLE Stack. - * - * @return BLE_ATT_ERR_NO_ERROR on success, otherwise error code. - ***************************************************************************************** - */ -static sdk_err_t tps_init(void) +static void tps_ble_evt_handler(const ble_evt_t *p_evt) { - const uint8_t tps_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_TX_POWER); - gatts_create_db_t gatts_db; - sdk_err_t ret; - uint16_t start_hdl = PRF_INVALID_HANDLE; /* The start hanlde is an in/out - * parameter of ble_gatts_srvc_db_create(). - * It must be set with PRF_INVALID_HANDLE - * to be allocated automatically by BLE Stack. */ - - ret = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (ret < 0) { - return ret; + if (NULL == p_evt) + { + return; } - gatts_db.shdl = &start_hdl; - gatts_db.uuid = (uint8_t *)tps_svc_uuid; - gatts_db.attr_tab_cfg = &s_char_mask; - gatts_db.max_nb_attr = TPS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = tps_attr_tab; + uint16_t handle; - sdk_err_t error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_tps_env.start_hdl = *gatts_db.shdl; + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + break; - uint16_t handle = prf_find_handle_by_idx(TPS_IDX_TX_POWER_LVL_VAL, s_tps_env.start_hdl, &s_char_mask); - ble_gatts_value_set(handle, sizeof(uint8_t), 0, (uint8_t *)&s_tps_env.tps_init.initial_tx_power_level); + case BLE_GATTS_EVT_WRITE_REQUEST: + break; + + case BLE_GATTS_EVT_NTF_IND: + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + break; + + case BLE_GATT_COMMON_EVT_PRF_REGISTER: + handle = prf_find_handle_by_idx(TPS_IDX_TX_POWER_LVL_VAL, s_tps_env.start_hdl, &s_char_mask); + ble_gatts_value_set(handle, sizeof(uint8_t), 0, (uint8_t *)&s_tps_env.tps_init.initial_tx_power_level); + break; } - - return error_code; } /* @@ -170,23 +139,42 @@ static sdk_err_t tps_init(void) */ sdk_err_t tps_service_init(tps_init_t *p_tps_init) { - if (p_tps_init == NULL) { + if (NULL == p_tps_init) + { return SDK_ERR_POINTER_NULL; } s_tps_env.tps_init.initial_tx_power_level = p_tps_init->initial_tx_power_level; - return ble_server_prf_add(&tps_prf_info); + memset(&s_tps_env.tps_serv_db, 0, sizeof(ble_gatts_create_db_t)); + + s_tps_env.start_hdl = PRF_INVALID_HANDLE; + s_tps_env.tps_serv_db.shdl = &s_tps_env.start_hdl; + s_tps_env.tps_serv_db.uuid = s_tps_svc_uuid; + s_tps_env.tps_serv_db.attr_tab_cfg = &s_char_mask; + s_tps_env.tps_serv_db.max_nb_attr = TPS_IDX_NB; + s_tps_env.tps_serv_db.srvc_perm = 0; + s_tps_env.tps_serv_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_tps_env.tps_serv_db.attr_tab.attr_tab_16 = tps_attr_tab; + + return ble_gatts_prf_add(&s_tps_env.tps_serv_db, tps_ble_evt_handler); } -sdk_err_t tps_tx_power_level_set(int8_t tx_power_level) +sdk_err_t tps_tx_power_level_set(int8_t tx_power_level) { - if (tx_power_level < -OFFSET_100 || tx_power_level > OFFSET_20) { + if (tx_power_level < -100 || tx_power_level > 20) + { return SDK_ERR_INVALID_PARAM; - } else { + } + else + { uint16_t handle = prf_find_handle_by_idx(TPS_IDX_TX_POWER_LVL_VAL, s_tps_env.start_hdl, &s_char_mask); return ble_gatts_value_set(handle, sizeof(int8_t), 0, (uint8_t *)&tx_power_level); } } +uint16_t tps_service_start_handle_get(void) +{ + return s_tps_env.start_hdl; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.h index 517f232..29d2c4e 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps/tps.h @@ -60,16 +60,17 @@ #ifndef __TPS_H__ #define __TPS_H__ -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" +#include /** * @defgroup TPS_STRUCT Structures * @{ */ /**@brief Tx Power Servic init stucture. This contains all option and data needed for initialization of the service. */ -typedef struct { +typedef struct +{ int8_t initial_tx_power_level; /**< Initial value of Tx Power Level characteristic (in dBm) */ } tps_init_t; /** @} */ @@ -99,6 +100,16 @@ sdk_err_t tps_service_init(tps_init_t *p_tps_init); ***************************************************************************************** */ sdk_err_t tps_tx_power_level_set(int8_t tx_power_level); + +/** + ***************************************************************************************** + * @brief Provide the interface for other modules to obtain the tps service start handle . + * + * @return The tps service start handle. + ***************************************************************************************** + */ +uint16_t tps_service_start_handle_get(void); + /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/BUILD.gn new file mode 100644 index 0000000..82a07af --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("tps_c") { + sources = [ "tps_c.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.c index cd16cae..24863eb 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.c @@ -39,60 +39,33 @@ * INCLUDE FILES ***************************************************************************************** */ -#include +#include "tps_c.h" #include "ble_prf_utils.h" #include "utility.h" -#include "tps_c.h" -#define UUID_OFFSET_8 8 +#include + /* * STRUCT DEFINE ***************************************************************************************** */ /**@brief Tx Power Service environment variable. */ -struct tps_c_env_t { +struct tps_c_env_t +{ tps_c_handles_t handles; /**< Handles of TPS characteristics which will be got for peer. */ tps_c_evt_handler_t evt_handler; /**< Handler of TPS Client event */ uint8_t prf_id; /**< TPS Client profile id. */ }; -/* - * LOCAL FUNCTION DECLARATION - ***************************************************************************************** - */ -static void tps_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); -static void tps_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); - /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct tps_c_env_t s_tps_c_env; /**< Tx Power Service Client environment variable. */ - -/**@brief Tx Power Service Client interface required by profile manager. */ -static ble_prf_manager_cbs_t tps_c_mgr_cbs = { - NULL, - NULL, - NULL -}; - -/**@brief Tx Power Service GATT Client Callbacks. */ -static gattc_prf_cbs_t tps_c_gattc_cbs = { - NULL, - NULL, - NULL, - NULL, - tps_c_att_read_cb, - NULL, - NULL, - tps_c_srvc_browse_cb, - NULL, -}; - -/**@brief Tx Power Service Client Information. */ -static const prf_client_info_t bas_c_prf_info = { - .max_connection_nb = TPS_C_CONNECTION_MAX, - .manager_cbs = &tps_c_mgr_cbs, - .gattc_prf_cbs = &tps_c_gattc_cbs +static uint8_t s_target_uuid[2] = {LO_U16(BLE_ATT_SVC_TX_POWER), HI_U16(BLE_ATT_SVC_TX_POWER)}; +static ble_uuid_t s_tps_service_uuid = +{ + .uuid_len = 2, + .uuid = s_target_uuid, }; /* @@ -102,29 +75,32 @@ static const prf_client_info_t bas_c_prf_info = { /** ***************************************************************************************** - * @brief This callback function will be called when receiving read response. + * @brief This event handler function will be called when receiving read response. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_read_rsp: The information of read response. ***************************************************************************************** */ -static void tps_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp) +static void tps_c_att_read_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_read_t *p_read_rsp) { tps_c_evt_t tps_c_evt; tps_c_evt.conn_idx = conn_idx; tps_c_evt.evt_type = TPS_C_EVT_INVALID; - if (BLE_SUCCESS != status) { + if (BLE_SUCCESS != status) + { return; } - if (p_read_rsp->vals[0].handle == s_tps_c_env.handles.tps_tx_power_level_handle) { + if (p_read_rsp->value[0].handle == s_tps_c_env.handles.tps_tx_power_level_handle) + { tps_c_evt.evt_type = TPS_C_EVT_TX_POWER_LEVEL_RECEIVE; - tps_c_evt.tx_power_level = p_read_rsp->vals[0].p_value[0]; + tps_c_evt.tx_power_level = p_read_rsp->value[0].p_value[0]; - if (s_tps_c_env.evt_handler) { + if (s_tps_c_env.evt_handler) + { s_tps_c_env.evt_handler(&tps_c_evt); } } @@ -132,14 +108,14 @@ static void tps_c_att_read_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_ /** ***************************************************************************************** - * @brief This callback function will be called when receiving browse service indication. + * @brief This event handler function will be called when receiving browse service indication. * * @param[in] conn_idx: The connection index. * @param[in] status: The status of GATTC operation. * @param[in] p_browse_srvc: The information of service browse. ***************************************************************************************** */ -static void tps_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc) +static void tps_c_srvc_browse_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gattc_evt_browse_srvc_t *p_browse_srvc) { tps_c_evt_t tps_c_evt; uint16_t uuid_disc; @@ -148,81 +124,95 @@ static void tps_c_srvc_browse_cb(uint8_t conn_idx, uint8_t status, const ble_gat tps_c_evt.conn_idx = conn_idx; tps_c_evt.evt_type = TPS_C_EVT_DISCOVERY_FAIL; - if (BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) { + if(BLE_GATT_ERR_BROWSE_NO_ANY_MORE == status) + { return; } - if (status != BLE_SUCCESS) { - return; - } - uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << UUID_OFFSET_8; + if (BLE_SUCCESS == status) + { + uuid_disc = p_browse_srvc->uuid[0] | p_browse_srvc->uuid[1] << 8; - if (BLE_ATT_SVC_TX_POWER == uuid_disc) { - s_tps_c_env.handles.tps_srvc_start_handle = p_browse_srvc->start_hdl; - s_tps_c_env.handles.tps_srvc_end_handle = p_browse_srvc->end_hdl; + if (BLE_ATT_SVC_TX_POWER == uuid_disc) + { + s_tps_c_env.handles.tps_srvc_start_handle = p_browse_srvc->start_hdl; + s_tps_c_env.handles.tps_srvc_end_handle = p_browse_srvc->end_hdl; - for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) { - uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << UUID_OFFSET_8; - handle_disc = p_browse_srvc->start_hdl + i + 1; + for (uint32_t i = 0; i < (p_browse_srvc->end_hdl - p_browse_srvc->start_hdl); i++) + { + uuid_disc = p_browse_srvc->info[i].attr.uuid[0] | p_browse_srvc->info[i].attr.uuid[1] << 8; + handle_disc = p_browse_srvc->start_hdl + i + 1; - if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) { - if (BLE_ATT_CHAR_TX_POWER_LEVEL == uuid_disc) { - s_tps_c_env.handles.tps_tx_power_level_handle = handle_disc; + if (BLE_GATTC_BROWSE_ATTR_VAL == p_browse_srvc->info[i].attr_type) + { + if (BLE_ATT_CHAR_TX_POWER_LEVEL == uuid_disc) + { + s_tps_c_env.handles.tps_tx_power_level_handle = handle_disc; + } + } + else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) + { + break; } - } else if (BLE_GATTC_BROWSE_NONE == p_browse_srvc->info[i].attr_type) { - break; } - } - tps_c_evt.evt_type = TPS_C_EVT_DISCOVERY_COMPLETE; + tps_c_evt.evt_type = TPS_C_EVT_DISCOVERY_COMPLETE; + } } - if (s_tps_c_env.evt_handler) { + if (s_tps_c_env.evt_handler) + { s_tps_c_env.evt_handler(&tps_c_evt); } } +static void tps_c_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + tps_c_att_read_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.read_rsp); + break; + + case BLE_GATTC_EVT_SRVC_BROWSE: + tps_c_srvc_browse_evt_handler(p_evt->evt.gattc_evt.index, p_evt->evt_status, &p_evt->evt.gattc_evt.params.srvc_browse); + break; + } +} /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t tps_client_init(tps_c_evt_handler_t evt_handler) { - sdk_err_t ret; - if (evt_handler == NULL) { + if (NULL == evt_handler) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_tps_c_env, sizeof(s_tps_c_env), 0, sizeof(s_tps_c_env)); - if (ret < 0) { - return ret; - } + memset(&s_tps_c_env, 0, sizeof(s_tps_c_env)); s_tps_c_env.evt_handler = evt_handler; - return ble_client_prf_add(&bas_c_prf_info, &s_tps_c_env.prf_id); + return ble_gattc_prf_add(&s_tps_service_uuid, tps_c_ble_evt_handler); } sdk_err_t tps_c_disc_srvc_start(uint8_t conn_idx) { - uint8_t target_uuid[2]; - - target_uuid[0] = LO_U16(BLE_ATT_SVC_TX_POWER); - target_uuid[1] = HI_U16(BLE_ATT_SVC_TX_POWER); - - const ble_uuid_t tps_service_uuid = { - .uuid_len = 2, - .uuid = target_uuid, - }; - - return ble_gattc_prf_services_browse(s_tps_c_env.prf_id, conn_idx, &tps_service_uuid); + return ble_gattc_services_browse(conn_idx, &s_tps_service_uuid); } sdk_err_t tps_c_tx_power_level_read(uint8_t conn_idx) { - if (BLE_ATT_INVALID_HDL == s_tps_c_env.handles.tps_tx_power_level_handle) { + if (BLE_ATT_INVALID_HDL == s_tps_c_env.handles.tps_tx_power_level_handle) + { return SDK_ERR_INVALID_HANDLE; } - return ble_gattc_prf_read(s_tps_c_env.prf_id, conn_idx, s_tps_c_env.handles.tps_tx_power_level_handle, 0); + return ble_gattc_read(conn_idx, s_tps_c_env.handles.tps_tx_power_level_handle, 0); } diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.h index 02e4063..8399332 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/tps_c/tps_c.h @@ -56,18 +56,17 @@ #ifndef __TPS_C_H__ #define __TPS_C_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "ble_prf_types.h" #include "custom_config.h" +#include +#include /** * @defgroup TPS_C_MACRO Defines * @{ */ -#define TPS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of TPS Client connections. */ +#define TPS_C_CONNECTION_MAX 10 /**< Maximum number of TPS Client connections. */ /** @} */ /** @@ -75,11 +74,11 @@ * @{ */ /**@brief Tx Power Service Client event type. */ -typedef enum { +typedef enum +{ TPS_C_EVT_INVALID, /**< TPS Client invalid event. */ TPS_C_EVT_DISCOVERY_COMPLETE, /**< TPS Client has found TPS service and its characteristics. */ - TPS_C_EVT_DISCOVERY_FAIL, /**< TPS Client found TPS service failed because of invalid operation or \ - no found at the peer. */ + TPS_C_EVT_DISCOVERY_FAIL, /**< TPS Client found TPS service failed because of invalid operation or no found at the peer. */ TPS_C_EVT_TX_POWER_LEVEL_RECEIVE, /**< TPS Client has received Tx Power Level value. */ } tps_c_evt_type_t; /** @} */ @@ -89,15 +88,16 @@ typedef enum { * @{ */ /**@brief Handles on the connected peer device needed to interact with it. */ -typedef struct { +typedef struct +{ uint16_t tps_srvc_start_handle; /**< TPS Service start handle. */ uint16_t tps_srvc_end_handle; /**< TPS Service end handle. */ - uint16_t tps_tx_power_level_handle; /**< TPS Tx Power Level characteristic Value handle \ - which has been got from peer. */ + uint16_t tps_tx_power_level_handle; /**< TPS Tx Power Level characteristic Value handle which has been got from peer. */ } tps_c_handles_t; /**@brief Tx Power Service Client event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The connection index. */ tps_c_evt_type_t evt_type; /**< TPS Client event type. */ int8_t tx_power_level; /**< Tx Power level. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/BUILD.gn new file mode 100644 index 0000000..112bc10 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("uds") { + sources = [ "uds.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.c index ac4e701..ff530a6 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.c @@ -46,30 +46,13 @@ #include "utility.h" #include "app_log.h" -#define HEIGHT_165 165 -#define HEIGHT_1650 1650 -#define YEAR_2000_2000 2000 -#define MONTH_01 01 -#define DAY_01 01 -#define INDEX_2 2 -#define INDEX_3 3 -#define INDEX_5 5 -#define AGE_18 18 -#define YEAR_LOW 1582 -#define YEAR_HIGHT 9999 -#define ROLL_NUM 63 -#define MONTH_12 12 -#define DAY_31 31 -#define HEIGHT_40 40 -#define HEIGHT_250 250 -#define USER_DATA_OFFSET 2 -#define NAME_LEN_OFFSET 3 /* * ENUMERATIONS **************************************************************************************** */ /**@brief User Data Service Attributes Indexes. */ -enum { +enum +{ // User Data Service UDS_IDX_SVC, @@ -120,237 +103,145 @@ enum { ***************************************************************************************** */ /**@brief User Data Service environment variable. */ -struct uds_env_t { - uds_init_t - uds_init; /**< User Data Service initialization variables. */ +struct uds_env_t +{ + uds_init_t uds_init; /**< User Data Service initialization variables. */ uint16_t start_hdl; /**< User Data Service start handle. */ - bool - ucp_in_progress; /**< A previously triggered Control Point operationis - still in progress. */ - uint8_t - segm_head_roll_num; /**< Rolling Segment Number of Segmentation Header. */ + bool ucp_in_progress; /**< A previously triggered Control Point operation is still in progress. */ + uint8_t segm_head_roll_num; /**< Rolling Segment Number of Segmentation Header. */ uint8_t consent_try_num; /**< The number of consent tries. */ - uint16_t - db_change_incr_ntf_cfg[UDS_CONNECTION_MAX]; /**< The configuration of Current Time Notification - which is configured by the peer devices. */ - uint16_t - ctrl_point_ind_cfg[UDS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification - which is configured by the peer devices. */ - uint16_t - regist_user_ind_cfg[UDS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification - which is configured by the peer devices. */ + uint16_t db_change_incr_ntf_cfg[UDS_CONNECTION_MAX]; /**< The configuration of Current Time Notification which is configured by the peer devices. */ + uint16_t ctrl_point_ind_cfg[UDS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification which is configured by the peer devices. */ + uint16_t regist_user_ind_cfg[UDS_CONNECTION_MAX]; /**< The configuration of SC Control Point Notification which is configured by the peer devices. */ + ble_gatts_create_db_t uds_gatts_db; /**< User Data Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t uds_init(void); -static void uds_disconnect_cb(uint8_t conn_idx, uint8_t reason); - -static void uds_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void uds_write_att_cb(uint8_t conidx, const gatts_write_req_cb_t *p_param); -static void uds_gatts_prep_write_cb(uint8_t conn_idx, const gatts_prep_write_req_cb_t *p_prep_req); -static void uds_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void uds_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); -static void uds_age_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); -static void uds_date_of_birth_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); -static void uds_first_name_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); -static void uds_height_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); -static void uds_gender_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); -static void uds_db_change_incr_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm); +static sdk_err_t uds_age_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); +static sdk_err_t uds_date_of_birth_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); +static sdk_err_t uds_first_name_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); +static sdk_err_t uds_height_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); +static sdk_err_t uds_gender_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); +static sdk_err_t uds_db_change_incr_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt); static void uds_receive_ucp_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length); static void uds_regist_user_value_encode(uint8_t conn_idx); static sdk_err_t uds_indicate_user_char_val_chunk(uint8_t conn_idx); + /* * LOCAL VARIABLE DEFINITIONS ***************************************************************************************** */ static struct uds_env_t s_uds_env; static uds_regi_user_data_stream_t s_regi_user_char_val_stream; +static uint8_t local_buf[UDS_REGI_USER_VAL_LEN_MAX * 5 * 3]; +static uint16_t local_segm_length[10]; +static const uint8_t s_uds_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_USER_DATA); +extern wss_db_user_buf_t s_wss_db_user_buf; +extern wss_rec_cmd_queue_t s_wss_db_rec_cmd_queue; /**@brief Full UDS Database Description - Used to add attributes into the database. */ -static const attm_desc_t uds_attr_tab[UDS_IDX_NB] = { +static const ble_gatts_attm_desc_t uds_attr_tab[UDS_IDX_NB] = +{ // User Data Service Declaration - [UDS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Database Change Increment Characteristic - Declaration - [UDS_IDX_DB_CHANGE_INCR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_DB_CHANGE_INCR_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Database Change Increment Characteristic - Value - [UDS_IDX_DB_CHANGE_INCR_VAL] = { - BLE_ATT_CHAR_DATABASE_CHANGE_INCREMENT, - READ_PERM_UNSEC | NOTIFY_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_DB_CHANGE_INCR_VAL_LEN_MAX - }, + [UDS_IDX_DB_CHANGE_INCR_VAL] = {BLE_ATT_CHAR_DATABASE_CHANGE_INCREMENT, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_NOTIFY_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_DB_CHANGE_INCR_VAL_LEN_MAX}, // Database Change Increment Characteristic - Client Characteristic Configuration Descriptor - [UDS_IDX_DB_CHANGE_INCR_NTF_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, + [UDS_IDX_DB_CHANGE_INCR_NTF_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, // User Index Characteristic - Declaration - [UDS_IDX_USER_INDEX_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_USER_INDEX_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // User Index Characteristic - Value - [UDS_IDX_USER_INDEX_VAL] = { - BLE_ATT_CHAR_USER_INDEX, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_USER_INDEX_VAL_LEN_MAX - }, + [UDS_IDX_USER_INDEX_VAL] = {BLE_ATT_CHAR_USER_INDEX, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_USER_INDEX_VAL_LEN_MAX}, // User Control Point Characteristic - Declaration - [UDS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_CTRL_POINT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // User Control Point Characteristic - Value - [UDS_IDX_CTRL_POINT_VAL] = { - BLE_ATT_CHAR_USER_CONTROL_POINT, - WRITE_REQ_PERM_UNSEC | INDICATE_PERM(UNAUTH), - ATT_VAL_LOC_USER, - UDS_CTRL_PT_VAL_LEN_MAX - }, + [UDS_IDX_CTRL_POINT_VAL] = {BLE_ATT_CHAR_USER_CONTROL_POINT, + BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_INDICATE_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_CTRL_PT_VAL_LEN_MAX}, // User Control Point Characteristic - Client Characteristic Configuration Descriptor - [UDS_IDX_CTRL_POINT_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, - + [UDS_IDX_CTRL_POINT_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, + // Age Characteristic - Declaration - [UDS_IDX_AGE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_AGE_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Age Characteristic - Value - [UDS_IDX_AGE_VAL] = { - BLE_ATT_CHAR_AGE, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_AGE_VAL_LEN_MAX - }, + [UDS_IDX_AGE_VAL] = {BLE_ATT_CHAR_AGE, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_AGE_VAL_LEN_MAX}, // Date of Birth Characteristic - Declaration - [UDS_IDX_DATE_OF_BIRTH_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_DATE_OF_BIRTH_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Date of Birth Characteristic - Value - [UDS_IDX_DATE_OF_BIRTH_VAL] = { - BLE_ATT_CHAR_DATE_OF_BIRTH, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_DATE_OF_BIRTH_VAL_LEN_MAX - }, - + [UDS_IDX_DATE_OF_BIRTH_VAL] = {BLE_ATT_CHAR_DATE_OF_BIRTH, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_DATE_OF_BIRTH_VAL_LEN_MAX}, + // First Name Characteristic - Declaration - [UDS_IDX_FIRST_NAME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_FIRST_NAME_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // First Name Characteristic - Value - [UDS_IDX_FIRST_NAME_VAL] = { - BLE_ATT_CHAR_FIRST_NAME, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_FIRST_NAME_VAL_LEN_MAX - }, + [UDS_IDX_FIRST_NAME_VAL] = {BLE_ATT_CHAR_FIRST_NAME, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_FIRST_NAME_VAL_LEN_MAX}, // Height Characteristic - Declaration - [UDS_IDX_HEIGHT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_HEIGHT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Height Characteristic - Value - [UDS_IDX_HEIGHT_VAL] = { - BLE_ATT_CHAR_HEIGHT, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_HEIGHT_VAL_LEN_MAX - }, - + [UDS_IDX_HEIGHT_VAL] = {BLE_ATT_CHAR_HEIGHT, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_HEIGHT_VAL_LEN_MAX}, + // Gender Characteristic - Declaration - [UDS_IDX_GENDER_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_GENDER_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Gender Characteristic - Value - [UDS_IDX_GENDER_VAL] = { - BLE_ATT_CHAR_GENDER, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_GENDER_VAL_LEN_MAX - }, - + [UDS_IDX_GENDER_VAL] = {BLE_ATT_CHAR_GENDER, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_GENDER_VAL_LEN_MAX}, + // Registered User Characteristic Declaration - [UDS_IDX_REGIST_USER_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [UDS_IDX_REGIST_USER_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Registered User Characteristic Declaration value - [UDS_IDX_REGIST_USER_VAL] = { - BLE_ATT_CHAR_REGISTERED_USER, - INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - UDS_REGI_USER_VAL_LEN_MAX - }, + [UDS_IDX_REGIST_USER_VAL] = {BLE_ATT_CHAR_REGISTERED_USER, + BLE_GATTS_INDICATE_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + UDS_REGI_USER_VAL_LEN_MAX}, // Registered User Characteristic Declaration - Client Characteristic Configuration Descriptor - [UDS_IDX_REGIST_USER_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief UDS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t uds_task_cbs = { - (prf_init_func_t) uds_init, - NULL, - uds_disconnect_cb -}; - -/**@brief UDS Task Callbacks. */ -static gatts_prf_cbs_t uds_cb_func = { - uds_read_att_cb, - uds_write_att_cb, - uds_gatts_prep_write_cb, - uds_gatts_ntf_ind_cb, - uds_cccd_set_cb -}; - -/**@brief UDS Information. */ -static const prf_server_info_t uds_prf_info = { - .max_connection_nb = UDS_CONNECTION_MAX, - .manager_cbs = &uds_task_cbs, - .gatts_prf_cbs = &uds_cb_func + [UDS_IDX_REGIST_USER_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize User Data service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t uds_init(void) -{ - // The start handle must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t uds_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_USER_DATA); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = uds_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_uds_env.uds_init.char_mask); - gatts_db.max_nb_attr = UDS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = uds_attr_tab; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_uds_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the disconnection event. @@ -359,7 +250,7 @@ static sdk_err_t uds_init(void) * @param[in] reason: Reason of disconnection. ***************************************************************************************** */ -static void uds_disconnect_cb(uint8_t conn_idx, uint8_t reason) +static void uds_disconnect_evt_handler(uint8_t conn_idx, uint8_t reason) { s_uds_env.ucp_in_progress = false; } @@ -372,96 +263,114 @@ static void uds_disconnect_cb(uint8_t conn_idx, uint8_t reason) * @param[in] p_param: Pointer to the parameters of the read request. ***************************************************************************************** */ -static void uds_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void uds_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; + ble_gatts_read_cfm_t cfm; uint8_t handle = p_param->handle; uint8_t tab_index = prf_find_idx_by_handle(handle, - s_uds_env.start_hdl, - UDS_IDX_NB, - (uint8_t *)&s_uds_env.uds_init.char_mask); + s_uds_env.start_hdl, + UDS_IDX_NB, + (uint8_t *)&s_uds_env.uds_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - wss_rec_t loc_rec; + uint32_t db_change_incr_val; - switch (tab_index) { - case UDS_IDX_AGE_VAL: { - if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) { + switch (tab_index) + { + case UDS_IDX_AGE_VAL: + { + if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) + { cfm.status = BLE_ATT_ERR_READ_NOT_PERMITTED; cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)UDS_ERROR_UD_ACCESS_NOT_PERMIT; - } else { - wss_db_record_get(s_uds_env.uds_init.user_index, &loc_rec); + } + else + { cfm.length = sizeof(uint8_t); - cfm.value = (uint8_t *)&loc_rec.age; + cfm.value = (uint8_t *)&s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].age; } break; } - case UDS_IDX_DATE_OF_BIRTH_VAL: { - if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) { + case UDS_IDX_DATE_OF_BIRTH_VAL: + { + if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) + { cfm.status = BLE_ATT_ERR_READ_NOT_PERMITTED; cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)UDS_ERROR_UD_ACCESS_NOT_PERMIT; - } else { - wss_db_record_get(s_uds_env.uds_init.user_index, &loc_rec); + } + else + { cfm.length = sizeof(birth_date_t); - cfm.value = (uint8_t *)&loc_rec.date_of_birth; + cfm.value = (uint8_t *)&s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].date_of_birth; } break; } - case UDS_IDX_FIRST_NAME_VAL: { - if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) { + case UDS_IDX_FIRST_NAME_VAL: + { + if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) + { cfm.status = BLE_ATT_ERR_READ_NOT_PERMITTED; cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)UDS_ERROR_UD_ACCESS_NOT_PERMIT; - } else { - wss_db_record_get(s_uds_env.uds_init.user_index, &loc_rec); - cfm.length = loc_rec.name_length; - cfm.value = (uint8_t *)loc_rec.first_name; + } + else + { + cfm.length = s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].name_length; + cfm.value = (uint8_t *)&s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].first_name; } break; } - case UDS_IDX_HEIGHT_VAL: { - if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) { + case UDS_IDX_HEIGHT_VAL: + { + if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) + { cfm.status = BLE_ATT_ERR_READ_NOT_PERMITTED; cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)UDS_ERROR_UD_ACCESS_NOT_PERMIT; - } else { - wss_db_record_get(s_uds_env.uds_init.user_index, &loc_rec); + } + else + { cfm.length = sizeof(uint16_t); - cfm.value = (uint8_t *)&loc_rec.height; + cfm.value = (uint8_t *)&s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].height; } break; } - case UDS_IDX_GENDER_VAL: { - if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) { + case UDS_IDX_GENDER_VAL: + { + if (s_uds_env.uds_init.user_index == UDS_UNKNOWN_USER) + { cfm.status = BLE_ATT_ERR_READ_NOT_PERMITTED; cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)UDS_ERROR_UD_ACCESS_NOT_PERMIT; - } else { - wss_db_record_get(s_uds_env.uds_init.user_index, &loc_rec); + } + else + { cfm.length = sizeof(uint8_t); - cfm.value = (uint8_t *)&loc_rec.gender; + cfm.value = (uint8_t *)&s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].gender; } break; } - case UDS_IDX_DB_CHANGE_INCR_VAL: { - uint8_t user_index = s_uds_env.uds_init.user_index; - if (UDS_UNKNOWN_USER == user_index) { - uint32_t db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; + case UDS_IDX_DB_CHANGE_INCR_VAL: + { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { + db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; + + cfm.length = sizeof(uint32_t); + cfm.value = (uint8_t *)&db_change_incr_val; + } + else + { cfm.length = sizeof(uint32_t); - cfm.value = (uint8_t *)&db_change_incr_val; - } else { - if (wss_db_record_get(user_index, &loc_rec)) { - cfm.length = sizeof(uint32_t); - cfm.value = (uint8_t *)&loc_rec.db_change_incr_val; - } + cfm.value = (uint8_t *)&(s_wss_db_user_buf.user_data[s_uds_env.uds_init.user_index].db_change_incr_val); } break; } @@ -471,19 +380,22 @@ static void uds_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param cfm.value = (uint8_t *)&s_uds_env.db_change_incr_ntf_cfg[conn_idx]; break; - case UDS_IDX_USER_INDEX_VAL: { + case UDS_IDX_USER_INDEX_VAL: + { cfm.length = sizeof(uint8_t); cfm.value = (uint8_t *)&s_uds_env.uds_init.user_index; break; } - case UDS_IDX_REGIST_USER_IND_CFG: { + case UDS_IDX_REGIST_USER_IND_CFG: + { cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_uds_env.regist_user_ind_cfg[conn_idx]; break; } - case UDS_IDX_CTRL_POINT_IND_CFG: { + case UDS_IDX_CTRL_POINT_IND_CFG: + { cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_uds_env.ctrl_point_ind_cfg[conn_idx]; break; @@ -506,14 +418,14 @@ static void uds_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: Pointer to the parameters of the write request. ***************************************************************************************** */ -static void uds_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void uds_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { uint16_t handle = p_param->handle; uint16_t tab_index = 0; uint16_t cccd_value = 0; bool ucp_evt = false; uds_evt_t event; - gatts_write_cfm_t cfm; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_uds_env.start_hdl, @@ -524,66 +436,73 @@ static void uds_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par event.evt_type = UDS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case UDS_IDX_AGE_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } - - event.evt_type = UDS_EVT_AGE_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_age_write_handler(p_param->value, p_param->length, &cfm); + + uds_age_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_DATE_OF_BIRTH_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } - event.evt_type = UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_date_of_birth_write_handler(p_param->value, p_param->length, &cfm); + + uds_date_of_birth_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_FIRST_NAME_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } event.evt_type = UDS_EVT_FIRST_NAME_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_first_name_write_handler(p_param->value, p_param->length, &cfm); + + uds_first_name_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_HEIGHT_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } - event.evt_type = UDS_EVT_HEIGHT_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_height_write_handler(p_param->value, p_param->length, &cfm); + + uds_height_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_GENDER_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } - event.evt_type = UDS_EVT_GENDER_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_gender_write_handler(p_param->value, p_param->length, &cfm); + + uds_gender_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_DB_CHANGE_INCR_VAL: - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { cfm.status = UDS_ERROR_UD_ACCESS_NOT_PERMIT; } - event.evt_type = UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER; event.p_data = p_param->value; event.length = p_param->length; - uds_db_change_incr_write_handler(p_param->value, p_param->length, &cfm); + + uds_db_change_incr_write_handler(p_param->value, p_param->length, &cfm, &event); break; case UDS_IDX_DB_CHANGE_INCR_NTF_CFG: @@ -603,14 +522,27 @@ static void uds_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par break; case UDS_IDX_CTRL_POINT_VAL: - if (PRF_CLI_START_IND != s_uds_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND != s_uds_env.ctrl_point_ind_cfg[conn_idx]) + { cfm.status = UDS_ERROR_CCCD_INVALID; break; - } else if (s_uds_env.ucp_in_progress) { + } + else if (s_uds_env.ucp_in_progress) + { cfm.status = UDS_ERROR_PROC_IN_PROGRESS; - } else if (PRF_CLI_START_IND == s_uds_env.ctrl_point_ind_cfg[conn_idx]) { - ucp_evt = true; - s_uds_env.ucp_in_progress = true; + } + else if (PRF_CLI_START_IND == s_uds_env.ctrl_point_ind_cfg[conn_idx]) + { + if (UDS_CTRL_PT_OP_LIST_ALL_USERS == p_param->value[0] && \ + (PRF_CLI_START_IND != s_uds_env.regist_user_ind_cfg[conn_idx])) + { + cfm.status = UDS_ERROR_CCCD_INVALID; + } + else + { + ucp_evt = true; + s_uds_env.ucp_in_progress = true; + } } break; @@ -629,13 +561,15 @@ static void uds_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par ble_gatts_write_cfm(conn_idx, &cfm); - if (ucp_evt) { + if (ucp_evt) + { uds_receive_ucp_handler(conn_idx, p_param->value, p_param->length); } - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && UDS_EVT_INVALID != event.evt_type && - s_uds_env.uds_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && UDS_EVT_INVALID != event.evt_type && s_uds_env.uds_init.evt_handler) + { s_uds_env.uds_init.evt_handler(&event); } + } /** @@ -646,14 +580,15 @@ static void uds_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_par * @param[in]: p_prep_req: Pointer to the handle of cccd attribute. ***************************************************************************************** */ -static void uds_gatts_prep_write_cb(uint8_t conn_idx, const gatts_prep_write_req_cb_t *p_prep_req) +static void uds_gatts_prep_write_evt_handler(uint8_t conn_idx, const ble_gatts_evt_prep_write_t *p_prep_req) { - gatts_prep_write_cfm_t cfm; + ble_gatts_prep_write_cfm_t cfm; cfm.handle = p_prep_req->handle; cfm.length = UDS_REGI_USER_VAL_LEN_MAX; cfm.status = BLE_SUCCESS; + APP_LOG_DEBUG("Prepare write."); ble_gatts_prepare_write_cfm(conn_idx, &cfm); } @@ -666,12 +601,13 @@ static void uds_gatts_prep_write_cb(uint8_t conn_idx, const gatts_prep_write_req * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void uds_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void uds_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; uds_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -683,7 +619,8 @@ static void uds_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = UDS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case UDS_IDX_DB_CHANGE_INCR_NTF_CFG: event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE : \ @@ -709,7 +646,8 @@ static void uds_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val break; } - if (UDS_EVT_INVALID != event.evt_type && s_uds_env.uds_init.evt_handler) { + if (UDS_EVT_INVALID != event.evt_type && s_uds_env.uds_init.evt_handler) + { s_uds_env.uds_init.evt_handler(&event); } } @@ -723,7 +661,7 @@ static void uds_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void uds_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void uds_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { uds_evt_t event; @@ -731,22 +669,29 @@ static void uds_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gat event.conn_idx = conn_idx; uint8_t tab_index; - tab_index = prf_find_idx_by_handle(p_ntf_ind->handle, + tab_index = prf_find_idx_by_handle(p_ntf_ind->handle, s_uds_env.start_hdl, UDS_IDX_NB, (uint8_t *)&s_uds_env.uds_init.char_mask); - if (BLE_GAP_ERR_TIMEOUT == status) { + if (BLE_GAP_ERR_TIMEOUT == status) + { ble_gap_disconnect(conn_idx); } - if (s_uds_env.uds_init.evt_handler && SDK_SUCCESS == status) { - if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) { + if (s_uds_env.uds_init.evt_handler && SDK_SUCCESS == status) + { + if (BLE_GATT_NOTIFICATION == p_ntf_ind->type) + { event.evt_type = UDS_EVT_DB_CHANGE_INCR_SEND_CPLT; s_uds_env.uds_init.evt_handler(&event); - } else if (BLE_GATT_INDICATION == p_ntf_ind->type && (UDS_IDX_REGIST_USER_VAL == tab_index)) { + } + else if (BLE_GATT_INDICATION == p_ntf_ind->type && (UDS_IDX_REGIST_USER_VAL == tab_index)) + { uds_indicate_user_char_val_chunk(conn_idx); - } else if (BLE_GATT_INDICATION == p_ntf_ind->type && (UDS_IDX_CTRL_POINT_VAL == tab_index)) { + } + else if (BLE_GATT_INDICATION == p_ntf_ind->type && (UDS_IDX_CTRL_POINT_VAL == tab_index)) + { event.evt_type = UDS_EVT_CTRL_POINT_RSP_CPLT; s_uds_env.ucp_in_progress = false; s_uds_env.uds_init.evt_handler(&event); @@ -754,15 +699,6 @@ static void uds_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gat } } -/** - ***************************************************************************************** - * @brief Change the endian of Registered User Name. - * - * @param[in] user_index: index. - * @param[in] p_param: Pointer to the parameters of the complete event. - ***************************************************************************************** - */ - /** ***************************************************************************************** * @brief Handle Age Characteristic write event. @@ -772,16 +708,31 @@ static void uds_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gat * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_age_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_age_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - if (length != 1 || p_data[0] > 100) { - p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - uint8_t age = p_data[0]; - uint8_t user_index = s_uds_env.uds_init.user_index; + sdk_err_t error_code; - wss_db_record_age_set(user_index, age); + if (length != 1 || p_data[0] > 120) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; } + else + { + p_evt->evt_type = UDS_EVT_AGE_SET_BY_PEER; + + uint8_t age = p_data[0]; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].age = age; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } + + return error_code; } /** @@ -793,24 +744,97 @@ static void uds_age_write_handler(const uint8_t *p_data, uint16_t length, gatts_ * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_date_of_birth_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_date_of_birth_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - if (length != 4) { + sdk_err_t error_code; + + if (length != 4) + { p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - birth_date_t date_of_birth; + error_code = BLE_GATT_ERR_WRITE; + } + else + { + birth_date_t date_of_birth; date_of_birth.year = BUILD_U16(p_data[0], p_data[1]); - date_of_birth.month = p_data[INDEX_2]; - date_of_birth.day = p_data[INDEX_3]; - - if (date_of_birth.month > MONTH_12 || (date_of_birth.day > DAY_31) ||\ - ((date_of_birth.year < YEAR_LOW || date_of_birth.year > YEAR_HIGHT) && (date_of_birth.year != 0))) { + date_of_birth.month = p_data[2]; + date_of_birth.day = p_data[3]; + + if (date_of_birth.month > 12 || (date_of_birth.day > 31) ||\ + ((date_of_birth.year < 1582 || date_of_birth.year > 9999) && (date_of_birth.year != 0))) + { p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - uint8_t user_index = s_uds_env.uds_init.user_index; - wss_db_record_date_of_birth_set(user_index, &date_of_birth); + error_code = BLE_GATT_ERR_WRITE; + } + else + { + if ((((date_of_birth.month == 1) || (date_of_birth.month == 3) || (date_of_birth.month == 5) || + (date_of_birth.month == 7) || (date_of_birth.month == 8) || (date_of_birth.month == 10) || (date_of_birth.month == 12)) + && (date_of_birth.day > 31)) || + (((date_of_birth.month == 4) || (date_of_birth.month == 6) || (date_of_birth.month == 9) || (date_of_birth.month == 11)) + && (date_of_birth.day > 30))) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; + } + else if (date_of_birth.month == 2) + { + if (((date_of_birth.year % 4 == 0) && (date_of_birth.year % 100 != 0)) || (date_of_birth.year % 400 ==0)) // leap year + { + if (date_of_birth.day > 29) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; + } + else + { + p_evt->evt_type = UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].date_of_birth = date_of_birth; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } + } + else // average year + { + if (date_of_birth.day > 28) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; + } + else + { + p_evt->evt_type = UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].date_of_birth = date_of_birth; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } + } + } + else + { + p_evt->evt_type = UDS_EVT_DATE_OF_BIRTH_SET_BY_PEER; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].date_of_birth = date_of_birth; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } } } + return error_code; } /** @@ -822,10 +846,19 @@ static void uds_date_of_birth_write_handler(const uint8_t *p_data, uint16_t leng * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_first_name_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_first_name_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - uint8_t user_index = s_uds_env.uds_init.user_index; - wss_db_record_first_name_set(user_index, p_data, length); + sdk_err_t error_code; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].name_length = length; + memcpy(&s_wss_db_user_buf.user_data[cur_user_id].first_name, p_data, length); + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + return error_code; } /** @@ -837,19 +870,37 @@ static void uds_first_name_write_handler(const uint8_t *p_data, uint16_t length, * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_height_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_height_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - if (length != INDEX_2) { + sdk_err_t error_code; + + if (length != 2) + { p_cfm->status = BLE_GATT_ERR_WRITE; - } else { + error_code = BLE_GATT_ERR_WRITE; + } + else + { uint16_t height = BUILD_U16(p_data[0], p_data[1]); - if (height < HEIGHT_40 || height > HEIGHT_250) { + if (height < 40 || 250 < height) + { p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - uint8_t user_index = s_uds_env.uds_init.user_index; - wss_db_record_height_set(user_index, height); + error_code = BLE_GATT_ERR_WRITE; + } + else + { + p_evt->evt_type = UDS_EVT_HEIGHT_SET_BY_PEER; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].height = height; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; } } + return error_code; } /** @@ -861,16 +912,30 @@ static void uds_height_write_handler(const uint8_t *p_data, uint16_t length, gat * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_gender_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_gender_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - if (length != 1 || (p_data[0] > INDEX_2)) { - p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - uint8_t gender = p_data[0]; - uint8_t user_index = s_uds_env.uds_init.user_index; + sdk_err_t error_code; - wss_db_record_gender_set(user_index, gender); + if (length != 1 || (p_data[0] > 2)) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; } + else + { + p_evt->evt_type = UDS_EVT_GENDER_SET_BY_PEER; + uint8_t gender = p_data[0]; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].gender = gender; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } + + return error_code; } /** @@ -882,16 +947,30 @@ static void uds_gender_write_handler(const uint8_t *p_data, uint16_t length, gat * @param[in] p_cfm: Pointer of the write confirmation. ***************************************************************************************** */ -static void uds_db_change_incr_write_handler(const uint8_t *p_data, uint16_t length, gatts_write_cfm_t *p_cfm) +static sdk_err_t uds_db_change_incr_write_handler(const uint8_t *p_data, uint16_t length, ble_gatts_write_cfm_t *p_cfm, uds_evt_t *p_evt) { - if (length != UDS_DB_CHANGE_INCR_VAL_LEN_MAX) { - p_cfm->status = BLE_GATT_ERR_WRITE; - } else { - uint8_t user_index = s_uds_env.uds_init.user_index; + sdk_err_t error_code; - uint32_t db_change_incr_val = BUILD_U32(p_data[0], p_data[1], p_data[INDEX_2], p_data[INDEX_3]); - bool status = wss_db_record_db_change_incr_val_set(user_index, db_change_incr_val); + if (length != UDS_DB_CHANGE_INCR_VAL_LEN_MAX) + { + p_cfm->status = BLE_GATT_ERR_WRITE; + error_code = BLE_GATT_ERR_WRITE; } + else + { + p_evt->evt_type = UDS_EVT_DB_CHANGE_INCR_SET_BY_PEER; + uint32_t db_change_incr_val = BUILD_U32(p_data[0], p_data[1], p_data[2], p_data[3]); + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].db_change_incr_val = db_change_incr_val; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_WRITE_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + error_code = BLE_SUCCESS; + } + + return error_code; } /** @@ -910,53 +989,50 @@ static void uds_op_regist_new_user_handler(uint8_t conn_idx, const uint8_t *p_da rsp[0] = UDS_CTRL_PT_OP_RSP_CODE; rsp[1] = UDS_CTRL_PT_OP_REGIST_NEW_USER; - rsp[INDEX_2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + rsp[2] = UDS_CTRL_PT_RSP_SUCCESS; uint16_t consent_code = BUILD_U16(p_data[0], p_data[1]); - if ((sizeof(uint16_t) != length) || (UDS_CONSENT_CODE_VAL_MAX < consent_code)) { + + if ((sizeof(uint16_t) != length) || (UDS_CONSENT_CODE_VAL_MAX < consent_code)) + { + rsp[2] = UDS_CTRL_PT_RSP_INVALID_PARAM; uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); - } else { - uds_chars_val_t uds_chars_val; - uint8_t user_nums; - uint8_t db_change_incr_val; - uint8_t new_user_index; + } + else + { + uint8_t new_user_id; + new_user_id = wss_db_user_id_get(); - user_nums = (uint8_t)wss_db_records_num_get(); - if (WSS_DB_RECORDS_MAX <= user_nums) { - wss_db_record_delete(1); - new_user_index = 0x01; - } else { - new_user_index = user_nums; + if (UDS_UNKNOWN_USER == new_user_id) + { + new_user_id = 0x01; } - uint8_t first_name[] = "tom"; - db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; - uds_chars_val.age = AGE_18; - uds_chars_val.height = HEIGHT_165; // The unit is cm. - uds_chars_val.gender = 0x00; - uds_chars_val.date_of_birth.year = YEAR_2000; - uds_chars_val.date_of_birth.month = MONTH_01; - uds_chars_val.date_of_birth.day = DAY_01; - uds_chars_val.p_first_name = &first_name[0]; - uds_chars_val.name_length = sizeof(first_name); - rsp[INDEX_3] = new_user_index; + uint8_t first_name[] = {'d', 'e', 'f', 'a', 'u', 'l', 't'}; - if (wss_db_record_add(new_user_index, consent_code, db_change_incr_val, &uds_chars_val) - && s_uds_env.uds_init.evt_handler) { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_SUCCESS; + s_wss_db_user_buf.user_id = new_user_id; + s_wss_db_user_buf.user_data[new_user_id].consent_code = consent_code; + s_wss_db_user_buf.user_data[new_user_id].db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; + s_wss_db_user_buf.user_data[new_user_id].age = 18; + s_wss_db_user_buf.user_data[new_user_id].height = 165; // The unit is cm. + s_wss_db_user_buf.user_data[new_user_id].gender = 0x00; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.year = 2000; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.month = 01; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.day = 01; + s_wss_db_user_buf.user_data[new_user_id].name_length = sizeof(first_name); + memcpy(s_wss_db_user_buf.user_data[new_user_id].first_name, &first_name[0], sizeof(first_name)); + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_ADD_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); - event.conn_idx = conn_idx; - event.evt_type = UDS_EVT_REGIST_NEW_USER; - event.p_data = &new_user_index; - event.length = length; - s_uds_env.uds_init.evt_handler(&event); - s_uds_env.uds_init.user_index = new_user_index; + event.conn_idx = conn_idx; + event.evt_type = UDS_EVT_REGIST_NEW_USER; + event.p_data = &new_user_id; + event.length = length; + s_uds_env.uds_init.evt_handler(&event); + s_uds_env.uds_init.user_index = new_user_id; - uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN + 1); - } else { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_FAILED; - uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); - } + rsp[3] = new_user_id; + uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN + 1); } } @@ -972,46 +1048,64 @@ static void uds_op_regist_new_user_handler(uint8_t conn_idx, const uint8_t *p_da static void uds_op_consent_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length) { uds_evt_t event; + uint8_t cur_user_id = p_data[0]; uint8_t rsp[UDS_CTRL_PT_RSP_LEN_MIN]; rsp[0] = UDS_CTRL_PT_OP_RSP_CODE; rsp[1] = UDS_CTRL_PT_OP_CONSENT; - rsp[INDEX_2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + rsp[2] = UDS_CTRL_PT_RSP_SUCCESS; - uint16_t consent_code = BUILD_U16(p_data[1], p_data[INDEX_2]); + uint16_t consent_code = BUILD_U16(p_data[1], p_data[2]); - if (UDS_CONSENT_TRY_NUM_MAX <= s_uds_env.consent_try_num) { + if (UDS_CONSENT_TRY_NUM_MAX <= s_uds_env.consent_try_num) + { #if defined(PTS_AUTO_TEST) - wss_db_record_clear(); -#endif - rsp[INDEX_2] = UDS_CTRL_PT_RSP_FAILED; - } else if (((sizeof(uint16_t)+sizeof(uint8_t)) == length) && \ - (UDS_UNKNOWN_USER > p_data[0]) && \ - (UDS_CONSENT_CODE_VAL_MAX >= consent_code)) { - uint8_t user_index = p_data[0]; - wss_rec_t loc_rec; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; - bool status = wss_db_record_get(user_index, &loc_rec); - if (consent_code != loc_rec.consent_code || (!status)) { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_USER_NOT_AUTH; + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].consent_code = 0xFFFF; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_CLEAR_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); +#endif + rsp[2] = UDS_CTRL_PT_RSP_FAILED; + } + else if (((sizeof(uint16_t)+sizeof(uint8_t)) != length) || \ + (UDS_UNKNOWN_USER < cur_user_id) || \ + (UDS_UNKNOWN_USER > cur_user_id && (cur_user_id >= WSS_DB_RECORDS_MAX)) || \ + (UDS_CONSENT_CODE_VAL_MAX <= consent_code)) + { + rsp[2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + } + else + { + if (consent_code != s_wss_db_user_buf.user_data[cur_user_id].consent_code) + { + rsp[2] = UDS_CTRL_PT_RSP_USER_NOT_AUTH; s_uds_env.consent_try_num++; #if defined(PTS_AUTO_TEST) - wss_db_record_delete(s_uds_env.uds_init.user_index); -#endif - } else { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_SUCCESS; - event.conn_idx = conn_idx; - event.evt_type = UDS_EVT_USER_GRANT_ACCESS; - event.p_data = p_data; - event.length = length; + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].consent_code = 0xFFFF; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_CLEAR_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); +#endif + } + else + { + event.conn_idx = conn_idx; + event.evt_type = UDS_EVT_USER_GRANT_ACCESS; + event.p_data = p_data; + event.length = length; + event.uds_chars_val.height = s_wss_db_user_buf.user_data[cur_user_id].height; s_uds_env.uds_init.evt_handler(&event); - s_uds_env.uds_init.user_index = user_index; + + s_uds_env.uds_init.user_index = cur_user_id; s_uds_env.consent_try_num = 0; - s_uds_env.uds_init.evt_handler(&event); } } + uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); } @@ -1031,24 +1125,33 @@ static void uds_op_del_user_data_handler(uint8_t conn_idx, const uint8_t *p_data rsp[0] = UDS_CTRL_PT_OP_RSP_CODE; rsp[1] = UDS_CTRL_PT_OP_DEL_USER_DATA; - rsp[INDEX_2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + rsp[2] = UDS_CTRL_PT_RSP_SUCCESS; - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_USER_NOT_AUTH; - } else { - if (wss_db_record_delete(s_uds_env.uds_init.user_index)) { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_SUCCESS; - - event.conn_idx = conn_idx; - event.evt_type = UDS_EVT_DEL_USER_DATA; - event.p_data = p_data; - event.length = length; - s_uds_env.uds_init.evt_handler(&event); - s_uds_env.uds_init.user_index = UDS_UNKNOWN_USER; - } else { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_FAILED; - } + if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) + { + rsp[2] = UDS_CTRL_PT_RSP_USER_NOT_AUTH; } + else if (length > 0) + { + rsp[2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + } + else + { + uint8_t cur_user_id = s_uds_env.uds_init.user_index; + + s_wss_db_user_buf.user_id = cur_user_id; + s_wss_db_user_buf.user_data[cur_user_id].consent_code = 0xFFFF; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_DEL_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + event.conn_idx = conn_idx; + event.evt_type = UDS_EVT_DEL_USER_DATA; + event.p_data = p_data; + event.length = length; + s_uds_env.uds_init.evt_handler(&event); + s_uds_env.uds_init.user_index = UDS_UNKNOWN_USER; + } + uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); } @@ -1068,22 +1171,37 @@ static void uds_op_list_all_users_handler(uint8_t conn_idx, const uint8_t *p_dat rsp[0] = UDS_CTRL_PT_OP_RSP_CODE; rsp[1] = UDS_CTRL_PT_OP_LIST_ALL_USERS; - rsp[INDEX_2] = UDS_CTRL_PT_RSP_SUCCESS; + rsp[2] = UDS_CTRL_PT_RSP_SUCCESS; uint16_t user_num = wss_db_records_num_get(); - if (UDS_UNKNOWN_USER > user_num && 0 < user_num) { + + if (length > 0) + { + rsp[2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); + } + else if (UDS_UNKNOWN_USER > user_num) + { event.conn_idx = conn_idx; event.evt_type = UDS_EVT_CTRL_POINT_SET_BY_PEER; event.p_data = p_data; event.length = length; s_uds_env.uds_init.evt_handler(&event); - s_uds_env.regist_user_ind_cfg[conn_idx] = UDS_EVT_CTRL_POINT_INDICATION_ENABLE; - - uds_regist_user_value_encode(0); // start indicate the value of the registered user char. - uds_indicate_user_char_val_chunk(conn_idx); - } else if (user_num == 0) { - rsp[INDEX_3] = user_num; + if (PRF_CLI_START_IND == s_uds_env.regist_user_ind_cfg[conn_idx]) + { + uds_regist_user_value_encode(0); + uds_indicate_user_char_val_chunk(conn_idx); + } + else + { + rsp[3] = user_num; + uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN + 1); + } + } + else if (0 == user_num) + { + rsp[3] = user_num; uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN + 1); } } @@ -1100,40 +1218,63 @@ static void uds_op_list_all_users_handler(uint8_t conn_idx, const uint8_t *p_dat static void uds_op_del_users_handler(uint8_t conn_idx, const uint8_t *p_data, uint16_t length) { uds_evt_t event; + uint8_t cur_user_id = p_data[0]; uint8_t rsp[UDS_CTRL_PT_RSP_LEN_MIN+1]; rsp[0] = UDS_CTRL_PT_OP_RSP_CODE; rsp[1] = UDS_CTRL_PT_OP_DEL_USERS; - rsp[INDEX_2] = UDS_CTRL_PT_RSP_INVALID_PARAM; + rsp[2] = UDS_CTRL_PT_RSP_SUCCESS; + rsp[3] = cur_user_id; - if (sizeof(uint8_t) != length || UDS_UNKNOWN_USER < p_data[0] || (s_uds_env.uds_init.user_index < p_data[0] - && p_data[0] < UDS_UNKNOWN_USER)) { - s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present = false; - s_uds_env.uds_init.uds_regi_user_data_flag.user_name_truncated = false; + if (sizeof(uint8_t) != length || UDS_UNKNOWN_USER < cur_user_id || \ + (WSS_DB_RECORDS_MAX <= cur_user_id && cur_user_id < UDS_UNKNOWN_USER)) + { + rsp[2] = UDS_CTRL_PT_RSP_INVALID_PARAM; uds_ctrl_pt_rsp_send(conn_idx, rsp, UDS_CTRL_PT_RSP_LEN_MIN); - } else { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_SUCCESS; - - uint8_t user_index = p_data[0]; - if (UDS_UNKNOWN_USER == user_index) { - wss_db_record_clear(); - rsp[INDEX_3] = UDS_UNKNOWN_USER; - s_uds_env.uds_init.user_index = UDS_UNKNOWN_USER; - } else { - if (!wss_db_record_delete(user_index)) { - rsp[INDEX_2] = UDS_CTRL_PT_RSP_FAILED; - } else { - rsp[INDEX_3] = user_index; + } + else + { + if (UDS_UNKNOWN_USER == cur_user_id) + { + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_CLEAR_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + { + s_uds_env.uds_init.user_index = UDS_UNKNOWN_USER; + + for (uint8_t i=0; i= chunk_len && segm_num_per_user == 0) { - uint8_t segm_header = 0; - - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { - s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present = false; - } - - uint8_t regi_user_data_flags = 0; - uint8_t regi_user_index; - - segm_header |= (s_uds_env.segm_head_roll_num << USER_DATA_OFFSET); - segm_header |= UDS_ONLY_REGI_USER_SEGM; // the only packet. - - if (s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present) { - regi_user_data_flags |= UDS_REGI_USER_NAME_PRESENT; - } - - if (s_uds_env.uds_init.uds_regi_user_data_flag.user_name_truncated) { - regi_user_data_flags |= UDS_USER_NAME_TRUNCATED; - } - - regi_user_index = i; - - local_buf[length++] = segm_header; - local_buf[length++] = regi_user_data_flags; - local_buf[length++] = regi_user_index; - - ret = memcpy_s(&local_buf[length], loc_rec.name_length, - loc_rec.first_name, loc_rec.name_length); - if (ret < 0) { - return; - } - length += loc_rec.name_length; - - local_segm_length[segm_total_num++] = loc_rec.name_length + NAME_LEN_OFFSET; - s_regi_user_char_val_stream.length += (loc_rec.name_length + NAME_LEN_OFFSET); - name_offset_per_user += loc_rec.name_length; - } else if (UDS_REGI_USER_DATA_LEN_MAX >= chunk_len && segm_num_per_user != 0) { - uint8_t segm_header = 0; - segm_header |= (s_uds_env.segm_head_roll_num << USER_DATA_OFFSET); - segm_header |= UDS_LAST_REGI_USER_SEGM; // the last packet. - local_buf[length++] = segm_header; - - ret = memcpy_s(&local_buf[length], chunk_len, loc_rec.first_name + name_offset_per_user, chunk_len); - if (ret < 0) { - return; - } - length += chunk_len; - - local_segm_length[segm_total_num++] = chunk_len + 1; - s_regi_user_char_val_stream.length += (chunk_len + 1); - name_offset_per_user += chunk_len; - } else if (UDS_REGI_USER_DATA_LEN_MAX < chunk_len) { - if (segm_num_per_user == 0) { + do + { + chunk_len = user_data.name_length - name_offset_per_user; + + if (UDS_REGI_USER_DATA_LEN_MAX - 2 >= chunk_len && 0 == segm_num_per_user) + { uint8_t segm_header = 0; - if (UDS_UNKNOWN_USER == s_uds_env.uds_init.user_index) { - s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present = false; - } + uint8_t regi_user_data_flags = 0; uint8_t regi_user_index; - segm_header |= (s_uds_env.segm_head_roll_num << USER_DATA_OFFSET); - segm_header |= UDS_FIRST_REGI_USER_SEGM; // the first packet. - if (s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present) { + segm_header |= (s_uds_env.segm_head_roll_num << 2); + segm_header |= UDS_ONLY_REGI_USER_SEGM; // the only packet. + + if (s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present) + { regi_user_data_flags |= UDS_REGI_USER_NAME_PRESENT; } - if (s_uds_env.uds_init.uds_regi_user_data_flag.user_name_truncated) { + if (s_uds_env.uds_init.uds_regi_user_data_flag.user_name_truncated) + { regi_user_data_flags |= UDS_USER_NAME_TRUNCATED; } @@ -1353,42 +1443,90 @@ static void uds_regist_user_value_encode(uint8_t conn_idx) local_buf[length++] = regi_user_data_flags; local_buf[length++] = regi_user_index; - ret = memcpy_s(&local_buf[length], UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET, - loc_rec.first_name, UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET); - if (ret < 0) { - return; - } - length += UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET; + memcpy(&local_buf[length], user_data.first_name, user_data.name_length); + length += user_data.name_length; - local_segm_length[segm_total_num++] = UDS_REGI_USER_VAL_LEN_MAX; - s_regi_user_char_val_stream.length += UDS_REGI_USER_VAL_LEN_MAX; - name_offset_per_user += UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET; - } else { + local_segm_length[segm_total_num++] = user_data.name_length + 3; + s_regi_user_char_val_stream.length += (user_data.name_length + 3); + name_offset_per_user += user_data.name_length; + + } + else if (UDS_REGI_USER_DATA_LEN_MAX >= chunk_len && 0 != segm_num_per_user) + { uint8_t segm_header = 0; - segm_header |= (s_uds_env.segm_head_roll_num << USER_DATA_OFFSET); - segm_header |= UDS_MIDDLE_REGI_USER_SEGM; // the middle packet. + segm_header |= (s_uds_env.segm_head_roll_num << 2); + segm_header |= UDS_LAST_REGI_USER_SEGM; // the last packet. local_buf[length++] = segm_header; - ret = memcpy_s(&local_buf[length], UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET, - loc_rec.first_name + name_offset_per_user, - UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET); - if (ret < 0) { - return; - } - length += UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET; - local_segm_length[segm_total_num++] = UDS_REGI_USER_VAL_LEN_MAX; - s_regi_user_char_val_stream.length += UDS_REGI_USER_VAL_LEN_MAX; - name_offset_per_user += UDS_REGI_USER_DATA_LEN_MAX - USER_DATA_OFFSET; + memcpy(&local_buf[length], user_data.first_name + name_offset_per_user, chunk_len); + length += chunk_len; + + local_segm_length[segm_total_num++] = chunk_len + 1; + s_regi_user_char_val_stream.length += (chunk_len + 1); + name_offset_per_user += chunk_len; + } + else if (UDS_REGI_USER_DATA_LEN_MAX < chunk_len) + { + if (0 == segm_num_per_user) + { + uint8_t segm_header = 0; + uint8_t regi_user_data_flags = 0; + uint8_t regi_user_index; + + segm_header |= (s_uds_env.segm_head_roll_num << 2); + segm_header |= UDS_FIRST_REGI_USER_SEGM; // the first packet. + + if (s_uds_env.uds_init.uds_regi_user_data_flag.regi_user_name_present) + { + regi_user_data_flags |= UDS_REGI_USER_NAME_PRESENT; + } + + if (s_uds_env.uds_init.uds_regi_user_data_flag.user_name_truncated) + { + regi_user_data_flags |= UDS_USER_NAME_TRUNCATED; + } + + regi_user_index = i; + + local_buf[length++] = segm_header; + local_buf[length++] = regi_user_data_flags; + local_buf[length++] = regi_user_index; + + memcpy(&local_buf[length], user_data.first_name, UDS_REGI_USER_DATA_LEN_MAX - 2); + length += UDS_REGI_USER_DATA_LEN_MAX - 2; + + local_segm_length[segm_total_num++] = UDS_REGI_USER_VAL_LEN_MAX; + s_regi_user_char_val_stream.length += UDS_REGI_USER_VAL_LEN_MAX; + name_offset_per_user += UDS_REGI_USER_DATA_LEN_MAX - 2; + } + else + { + uint8_t segm_header = 0; + segm_header |= (s_uds_env.segm_head_roll_num << 2); + segm_header |= UDS_MIDDLE_REGI_USER_SEGM; // the middle packet. + + local_buf[length++] = segm_header; + memcpy(&local_buf[length], user_data.first_name + name_offset_per_user, UDS_REGI_USER_DATA_LEN_MAX - 2); + length += UDS_REGI_USER_DATA_LEN_MAX - 2; + + local_segm_length[segm_total_num++] = UDS_REGI_USER_VAL_LEN_MAX; + s_regi_user_char_val_stream.length += UDS_REGI_USER_VAL_LEN_MAX; + name_offset_per_user += UDS_REGI_USER_DATA_LEN_MAX - 2; + } + } + segm_num_per_user++; + if (63 == s_uds_env.segm_head_roll_num) + { + s_uds_env.segm_head_roll_num = 0; + } + else + { + s_uds_env.segm_head_roll_num++; } } - segm_num_per_user++; - if (s_uds_env.segm_head_roll_num == ROLL_NUM) { - s_uds_env.segm_head_roll_num = 0; - } else { - s_uds_env.segm_head_roll_num++; - } - } while (name_offset_per_user != loc_rec.name_length); + while (name_offset_per_user != user_data.name_length); + } } s_regi_user_char_val_stream.segm_offset = segm_total_num; @@ -1398,6 +1536,41 @@ static void uds_regist_user_value_encode(uint8_t conn_idx) s_regi_user_char_val_stream.offset = 0; } +static void uds_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + uds_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + uds_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_PREP_WRITE_REQUEST: + uds_gatts_prep_write_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.prep_wr_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + uds_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + uds_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + + case BLE_GAPC_EVT_DISCONNECTED: + uds_disconnect_evt_handler(p_evt->evt.gapc_evt.index, p_evt->evt.gapc_evt.params.disconnected.reason); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** @@ -1412,31 +1585,24 @@ uint8_t uds_get_cur_user_index(uint8_t conn_idx) return s_uds_env.uds_init.user_index; } -sdk_err_t uds_regi_user_val_send(uint8_t conn_idx) -{ - uds_regist_user_value_encode(0); - return uds_indicate_user_char_val_chunk(conn_idx); -} - sdk_err_t uds_db_change_incr_val_send(uint8_t conn_idx, uint8_t user_index) { sdk_err_t error_code = SDK_ERR_NTF_DISABLED; uint16_t length; - gatts_noti_ind_t uds_ntf; - wss_rec_t loc_rec; + ble_gatts_noti_ind_t uds_ntf; - if (UDS_UNKNOWN_USER != user_index) { - if (wss_db_record_get(user_index, &loc_rec)) { - length = sizeof(loc_rec.db_change_incr_val); - if (PRF_CLI_START_NTF == s_uds_env.db_change_incr_ntf_cfg[conn_idx]) { - uds_ntf.type = BLE_GATT_NOTIFICATION; - uds_ntf.handle = prf_find_handle_by_idx(UDS_IDX_DB_CHANGE_INCR_VAL, - s_uds_env.start_hdl, - (uint8_t *)&s_uds_env.uds_init.char_mask); - uds_ntf.length = length; - uds_ntf.value = (uint8_t *)&loc_rec.db_change_incr_val; - error_code = ble_gatts_noti_ind(conn_idx, &uds_ntf); - } + if (UDS_UNKNOWN_USER != user_index) + { + length = sizeof(s_wss_db_user_buf.user_data[user_index].db_change_incr_val); + if (PRF_CLI_START_NTF == s_uds_env.db_change_incr_ntf_cfg[conn_idx]) + { + uds_ntf.type = BLE_GATT_NOTIFICATION; + uds_ntf.handle = prf_find_handle_by_idx(UDS_IDX_DB_CHANGE_INCR_VAL, + s_uds_env.start_hdl, + (uint8_t *)&s_uds_env.uds_init.char_mask); + uds_ntf.length = length; + uds_ntf.value = (uint8_t *)&(s_wss_db_user_buf.user_data[user_index].db_change_incr_val); + error_code = ble_gatts_noti_ind(conn_idx, &uds_ntf); } } return error_code; @@ -1445,13 +1611,14 @@ sdk_err_t uds_db_change_incr_val_send(uint8_t conn_idx, uint8_t user_index) sdk_err_t uds_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t length) { sdk_err_t error_code = SDK_ERR_IND_DISABLED; - gatts_noti_ind_t ctrl_pt_rsp; + ble_gatts_noti_ind_t ctrl_pt_rsp; - if (PRF_CLI_START_IND == s_uds_env.ctrl_point_ind_cfg[conn_idx]) { + if (PRF_CLI_START_IND == s_uds_env.ctrl_point_ind_cfg[conn_idx]) + { ctrl_pt_rsp.type = BLE_GATT_INDICATION; ctrl_pt_rsp.handle = prf_find_handle_by_idx(UDS_IDX_CTRL_POINT_VAL, - s_uds_env.start_hdl, - (uint8_t *)&s_uds_env.uds_init.char_mask); + s_uds_env.start_hdl, + (uint8_t *)&s_uds_env.uds_init.char_mask); ctrl_pt_rsp.length = length; ctrl_pt_rsp.value = p_data; error_code = ble_gatts_noti_ind(conn_idx, &ctrl_pt_rsp); @@ -1462,51 +1629,63 @@ sdk_err_t uds_ctrl_pt_rsp_send(uint8_t conn_idx, uint8_t *p_data, uint16_t lengt sdk_err_t uds_service_init(uds_init_t *p_uds_init) { - sdk_err_t ret; - if (p_uds_init == NULL) { + if (NULL == p_uds_init) + { return SDK_ERR_POINTER_NULL; } - ret = memset_s(&s_uds_env, sizeof(s_uds_env), 0, sizeof(s_uds_env)); - if (ret < 0) { - return ret; - } - ret = memcpy_s(&s_uds_env.uds_init, sizeof(uds_init_t), p_uds_init, sizeof(uds_init_t)); - if (ret < 0) { - return ret; - } + memset(&s_uds_env, 0, sizeof(s_uds_env)); + memcpy(&s_uds_env.uds_init, p_uds_init, sizeof(uds_init_t)); - return ble_server_prf_add(&uds_prf_info); + s_uds_env.start_hdl = PRF_INVALID_HANDLE; + + s_uds_env.uds_gatts_db.shdl = &s_uds_env.start_hdl; + s_uds_env.uds_gatts_db.uuid = s_uds_svc_uuid; + s_uds_env.uds_gatts_db.attr_tab_cfg = (uint8_t *)&(s_uds_env.uds_init.char_mask); + s_uds_env.uds_gatts_db.max_nb_attr = UDS_IDX_NB; + s_uds_env.uds_gatts_db.srvc_perm = 0; + s_uds_env.uds_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_uds_env.uds_gatts_db.attr_tab.attr_tab_16 = uds_attr_tab; + + return ble_gatts_prf_add(&s_uds_env.uds_gatts_db, uds_ble_evt_handler); } #if defined(PTS_AUTO_TEST) void uds_regist_new_user(uint8_t conn_idx) { - uint16_t consent_code = 0x0001; + uint8_t new_user_id; + new_user_id = wss_db_user_id_get(); - uds_chars_val_t uds_chars_val; - uint8_t user_index; - uint8_t db_change_incr_val; + if (UDS_UNKNOWN_USER == new_user_id) + { + new_user_id = 0x01; + } - user_index = (uint8_t)wss_db_records_num_get(); - s_uds_env.uds_init.user_index = user_index; - uint8_t first_name[] = "tom"; - db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; - uds_chars_val.age = AGE_18; - uds_chars_val.height = HEIGHT_1650; - uds_chars_val.gender = 0x00; - uds_chars_val.date_of_birth.year = YEAR_2000; - uds_chars_val.date_of_birth.month = MONTH_01; - uds_chars_val.date_of_birth.day = DAY_01; - uds_chars_val.p_first_name = &first_name[0]; - uds_chars_val.name_length = sizeof(first_name); + uint8_t first_name[] = {'d', 'e', 'f', 'a', 'u', 'l', 't'}; - wss_db_record_add(user_index, consent_code, db_change_incr_val, &uds_chars_val); + s_wss_db_user_buf.user_id = new_user_id; + s_wss_db_user_buf.user_data[new_user_id].consent_code = 0x0001; + s_wss_db_user_buf.user_data[new_user_id].db_change_incr_val = UDS_DB_CHANGE_INCR_DEFAULT_VAL; + s_wss_db_user_buf.user_data[new_user_id].age = 18; + s_wss_db_user_buf.user_data[new_user_id].height = 165; // The unit is cm. + s_wss_db_user_buf.user_data[new_user_id].gender = 0x00; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.year = 2000; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.month = 01; + s_wss_db_user_buf.user_data[new_user_id].date_of_birth.day = 01; + s_wss_db_user_buf.user_data[new_user_id].name_length = sizeof(first_name); + memcpy(s_wss_db_user_buf.user_data[new_user_id].first_name, &first_name[0], sizeof(first_name)); + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_ADD_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); + + s_uds_env.uds_init.user_index = new_user_id; } void uds_del_users(uint8_t conn_idx) { - uint8_t user_index = 0x00; - wss_db_record_delete(user_index); + s_wss_db_user_buf.user_id = 0x00; + wss_db_rec_cmd_type_t ucp_cmd = UCP_CMD_TYPE_DEL_REC; + wss_db_ucp_cmd_queue_elem_push(&s_wss_db_rec_cmd_queue, ucp_cmd); } #endif + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.h index 6f9d7d1..7511bde 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/uds/uds.h @@ -52,68 +52,66 @@ * * After \ref uds_init_t variable is intialized, the application must call \ref uds_service_init() * to add User Data Service and UDS Characteristic, Database Change Increment, User Index, User - * Control Point and Registered User characteristics to the BLE Stack database according to + * Control Point and Registered User characteristics to the BLE Stack database according to * \ref uds_init_t.char_mask. */ #ifndef __UDS_H__ #define __UDS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup UDS_MACRO Defines * @{ */ -#define UDS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of UDS connections. */ +#define UDS_CONNECTION_MAX 10 /**< Maximum number of UDS connections. */ +#define UDS_AGE_VAL_LEN_MAX 2 /**< Maximum length of Age Characteristic value. */ +#define UDS_DATE_OF_BIRTH_VAL_LEN_MAX 4 /**< Maximum length of Date of Birth Characteristic value. */ +#define UDS_FIRST_NAME_VAL_LEN_MAX 50 /**< Maximum length of First Name Characteristic value. */ +#define UDS_HEIGHT_VAL_LEN_MAX 2 /**< Maximum length of Height Characteristic value. */ +#define UDS_GENDER_VAL_LEN_MAX 2 /**< Maximum length of Gender Characteristic value. */ +#define UDS_DB_CHANGE_INCR_VAL_LEN_MAX 4 /**< Maximum length of Database Change Increment value. */ +#define UDS_USER_INDEX_VAL_LEN_MAX 1 /**< Maximum length of User Index value. */ +#define UDS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of User Control Point response value. */ +#define UDS_CTRL_PT_RSP_LEN_MAX 20 /**< Maximum length of User Control Point response value. */ +#define UDS_CTRL_PT_VAL_LEN_MAX 19 /**< Maximum length of User Control Point value. */ +#define UDS_REGI_USER_DATA_LEN_MAX 19 /**< Maximum length of Registered User Data value. */ +#define UDS_REGI_USER_VAL_LEN_MAX 20 /**< Maximum length of Registered User Characteristic value. */ -#define UDS_AGE_VAL_LEN_MAX 2 /**< Maximum length of Age Characteristic value. */ -#define UDS_DATE_OF_BIRTH_VAL_LEN_MAX 4 /**< Maximum length of Date of Birth Characteristic value. */ -#define UDS_FIRST_NAME_VAL_LEN_MAX 50 /**< Maximum length of First Name Characteristic value. */ -#define UDS_HEIGHT_VAL_LEN_MAX 2 /**< Maximum length of Height Characteristic value. */ -#define UDS_GENDER_VAL_LEN_MAX 2 /**< Maximum length of Gender Characteristic value. */ -#define UDS_DB_CHANGE_INCR_VAL_LEN_MAX 4 /**< Maximum length of Database Change Increment value. */ -#define UDS_USER_INDEX_VAL_LEN_MAX 1 /**< Maximum length of User Index value. */ -#define UDS_CTRL_PT_RSP_LEN_MIN 3 /**< Mimimum length of User Control Point response value. */ -#define UDS_CTRL_PT_RSP_LEN_MAX 20 /**< Maximum length of User Control Point response value. */ -#define UDS_CTRL_PT_VAL_LEN_MAX 19 /**< Maximum length of User Control Point value. */ -#define UDS_REGI_USER_DATA_LEN_MAX 19 /**< Maximum length of Registered User Data value. */ -#define UDS_REGI_USER_VAL_LEN_MAX 20 /**< Maximum length of Registered User Characteristic value. */ +#define UDS_ERROR_UD_ACCESS_NOT_PERMIT 0x80 /**< Error code: The user data access is not permitted. */ +#define UDS_ERROR_PROC_IN_PROGRESS 0xFE /**< Error code: A previously triggered User Control Point operation is still in progress. */ +#define UDS_ERROR_CCCD_INVALID 0xFD /**< Error code: The Client Characteristic Configuration descriptor is not configured. */ -#define UDS_ERROR_UD_ACCESS_NOT_PERMIT 0x80 /**< Error code: The user data access is not permitted. */ -#define UDS_ERROR_PROC_IN_PROGRESS 0xFE /**< Error code: A previously triggered User Control Point operation \ - is still in progress. */ -#define UDS_ERROR_CCCD_INVALID 0xFD /**< Error code: The Client Characteristic Configuration descriptor \ - is not configured. */ +#define UDS_DB_CHANGE_INCR_DEFAULT_VAL 0x00 /**< Database Change Increment default value. */ +#define UDS_UNKNOWN_USER 0xFF /**< Unknown User. */ +#define UDS_CONSENT_CODE_VAL_MAX 0x270F /**< Maximum value of Consent Code. */ +#define UDS_CONSENT_TRY_NUM_MAX 0x04 /**< Maximum number of consent tries. */ -#define UDS_DB_CHANGE_INCR_DEFAULT_VAL 0x00 /**< Database Change Increment default value. */ -#define UDS_UNKNOWN_USER 0xFF /**< Unknown User. */ -#define UDS_CONSENT_CODE_VAL_MAX 0x270F /**< Maximum value of Consent Code. */ -#define UDS_CONSENT_TRY_NUM_MAX 0x04 /**< Maximum number of consent tries. */ +#define UDS_MIDDLE_REGI_USER_SEGM 0x00 /**< The middle segment of Registered User Characterristic value. */ +#define UDS_FIRST_REGI_USER_SEGM 0x01 /**< The first segment of Registered User Characterristic value. */ +#define UDS_LAST_REGI_USER_SEGM 0x02 /**< The last segment of Registered User Characterristic value. */ +#define UDS_ONLY_REGI_USER_SEGM 0x03 /**< The only segment of Registered User Characterristic value. */ -#define UDS_MIDDLE_REGI_USER_SEGM 0x00 /**< The middle segment of Registered User Characterristic value. */ -#define UDS_FIRST_REGI_USER_SEGM 0x01 /**< The first segment of Registered User Characterristic value. */ -#define UDS_LAST_REGI_USER_SEGM 0x02 /**< The last segment of Registered User Characterristic value. */ -#define UDS_ONLY_REGI_USER_SEGM 0x03 /**< The only segment of Registered User Characterristic value. */ +#define UDS_MEAS_FLAG_DEFAULT 0x3E /**< The default flag of UDS MEAS */ /** * @defgroup UDS_CHAR_MASK Characteristics Mask * @{ * @brief Bit masks for the initialization of \ref uds_init_t.char_mask. */ -#define UDS_CHAR_MANDATORY 0x000001FF /**< Bit mask for mandatory characteristic in UDS.*/ -#define UDS_CHAR_AGE_SUP 0x00000600 /**< Bit mask for Age characteristic that is optional.*/ -#define UDS_CHAR_DATE_OF_BIRTH_SUP 0x00001800 /**< Bit mask for date of birth characteristic that is optional.*/ -#define UDS_CHAR_FIRST_NAME_SUP 0x00006000 /**< Bit mask for first name characteristic that is optional. */ -#define UDS_CHAR_HEIGHT_SUP 0x00018000 /**< Bit mask for height characteristic that is optional.*/ -#define UDS_CHAR_GENDER_SUP 0x00060000 /**< Bit mask for gender characteristic that is optional.*/ -#define UDS_CHAR_REGIST_USER_SUP 0x00380000 /**< Bit mask for Registered User characteristic that is optional.*/ -#define UDS_CHAR_FULL 0x003FFFFF /**< Bit mask of the full characteristic.*/ +#define UDS_CHAR_MANDATORY 0x000001FF /**< Bit mask for mandatory characteristic in UDS. */ +#define UDS_CHAR_AGE_SUP 0x00000600 /**< Bit mask for Age characteristic that is optional. */ +#define UDS_CHAR_DATE_OF_BIRTH_SUP 0x00001800 /**< Bit mask for date of birth characteristic that is optional. */ +#define UDS_CHAR_FIRST_NAME_SUP 0x00006000 /**< Bit mask for first name characteristic that is optional. */ +#define UDS_CHAR_HEIGHT_SUP 0x00018000 /**< Bit mask for height characteristic that is optional. */ +#define UDS_CHAR_GENDER_SUP 0x00060000 /**< Bit mask for gender characteristic that is optional. */ +#define UDS_CHAR_REGIST_USER_SUP 0x00380000 /**< Bit mask for Registered User characteristic that is optional. */ +#define UDS_CHAR_FULL 0x003FFFFF /**< Bit mask of the full characteristic. */ /** @} */ /** @} */ @@ -122,7 +120,8 @@ * @{ */ /**@brief User Data Service Control Point Operation Code.*/ -typedef enum { +typedef enum +{ UDS_CTRL_PT_OP_RESERVED, /**< Reserved for future use. */ UDS_CTRL_PT_OP_REGIST_NEW_USER, /**< Register New User Operation Code.*/ UDS_CTRL_PT_OP_CONSENT, /**< Consent Operation Code.*/ @@ -133,7 +132,8 @@ typedef enum { } uds_ctrl_pt_op_code_t; /**@brief User Data Service Control Point Response value.*/ -typedef enum { +typedef enum +{ UDS_CTRL_PT_RSP_RESERVED, /**< Reserved value. */ UDS_CTRL_PT_RSP_SUCCESS, /**< Operation Success. */ UDS_CTRL_PT_RSP_NOT_SUP, /**< Operation Code Not Supported. */ @@ -143,12 +143,13 @@ typedef enum { } uds_ctrl_pt_rsp_t; /**@brief User Data Service event type. */ -typedef enum { +typedef enum +{ UDS_EVT_INVALID = 0x00, /**< Invalid event. */ UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_ENABLE, /**< Database Change Increment Notification is enabled. */ UDS_EVT_DB_CHANGE_INCR_NOTIFICATION_DISABLE, /**< Database Change Increment Notification is disabled. */ - UDS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that User Control Point indication has been enabled.*/ - UDS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that User Control Point indication has been disabled.*/ + UDS_EVT_CTRL_POINT_INDICATION_ENABLE, /**< Indicate that User Control Point indication has been enabled. */ + UDS_EVT_CTRL_POINT_INDICATION_DISABLE, /**< Indicate that User Control Point indication has been disabled. */ UDS_EVT_REGIST_USER_INDICATION_ENABLE, /**< Indicate that Registered User indication has been enabled. */ UDS_EVT_REGIST_USER_INDICATION_DISABLE, /**< Indicate that Registered User indication has been disabled. */ UDS_EVT_DB_CHANGE_INCR_SEND_CPLT, /**< Indicate that Database Change Increment has been notified. */ @@ -164,11 +165,12 @@ typedef enum { UDS_EVT_USER_GRANT_ACCESS, /**< Indicate that User is waiting to be granted access. */ UDS_EVT_REGIST_NEW_USER, /**< Indicate that User is waiting to be granted access. */ UDS_EVT_DEL_USER_DATA, - UDS_EVT_DEL_USERS, + UDS_EVT_DEL_USERS, } uds_evt_type_t; /**@brief UDS Characteristics Flags. */ -enum uds_chars_flag_bits { +enum uds_chars_flag_bits +{ UDS_CHARS_WEIGHT_PRESENT = 0x01, /**< Flag bit for Weight Present. */ UDS_CHARS_AGE_PRESENT = 0x02, /**< Flag bit for Age Present. */ UDS_CHARS_BIRTH_DATE_PRESENT = 0x04, /**< Flag bit for Date of Birth Present. */ @@ -178,7 +180,8 @@ enum uds_chars_flag_bits { }; /**@brief Registered User Data Flags. */ -enum uds_regi_user_data_flag_bits { +enum uds_regi_user_data_flag_bits +{ UDS_REGI_USER_NAME_PRESENT = 0x01, /**< Flag bit for Registered User Name Present. */ UDS_USER_NAME_TRUNCATED = 0x02, /**< Flag bit for User Name is truncated. */ }; @@ -189,42 +192,47 @@ enum uds_regi_user_data_flag_bits { * @{ */ /**@brief UDS Characteristic - birthdate's structure. */ -typedef struct { +typedef struct +{ uint16_t year; /**< year time element of birth date. */ uint8_t month; /**< month time element of birth date. */ uint8_t day; /**< day time element of birth date. */ } birth_date_t; /**@brief UDS Characteristics Flags structure. */ -typedef struct { - uint8_t weight_present : 1; /**< Weight Present. */ - uint8_t age_present : 1; /**< Age Present. */ - uint8_t birth_date_present : 1; /**< Date of Birth Present. */ - uint8_t first_name_present : 1; /**< First Name Present. */ - uint8_t height_present : 1; /**< Height Present. */ - uint8_t gender_present : 1; /**< Gender Present. */ +typedef struct +{ + uint8_t weight_present :1; /**< Weight Present. */ + uint8_t age_present :1; /**< Age Present. */ + uint8_t birth_date_present :1; /**< Date of Birth Present. */ + uint8_t first_name_present :1; /**< First Name Present. */ + uint8_t height_present :1; /**< Height Present. */ + uint8_t gender_present :1; /**< Gender Present. */ } uds_chars_flag_t; /**@brief UDS Characteristics value structure. */ -typedef struct { +typedef struct +{ uint16_t weight; /**< User's weight. */ - uint8_t age; /**< User's age. */ - birth_date_t date_of_birth; /**< User's birth date. */ - uint16_t height; /**< User's height. */ - uint8_t gender; /**< User's gender. */ + uint8_t age; /**< User's age. */ + birth_date_t date_of_birth; /**< User's birth date. */ + uint16_t height; /**< User's height. */ + uint8_t gender; /**< User's gender. */ uint8_t *p_first_name; /**< User's first name. */ uint16_t name_length; /**< Length of User's first name. */ } uds_chars_val_t; /**@brief Registered User Data Flags structure. */ -typedef struct { - uint8_t regi_user_name_present : 1; /**< Registered User Name Present. */ - uint8_t user_name_truncated : 1; /**< User Name is truncated. */ - uint8_t reserved : 6; /**< Reserved for Future Use. */ +typedef struct +{ + uint8_t regi_user_name_present :1; /**< Registered User Name Present. */ + uint8_t user_name_truncated :1; /**< User Name is truncated. */ + uint8_t reserved :6; /**< Reserved for Future Use. */ } uds_regi_user_data_flag_t; /**@brief User Data Service event. */ -typedef struct { +typedef struct +{ uint8_t conn_idx; /**< The index of the connection. */ uds_evt_type_t evt_type; /**< The UDS event type. */ const uint8_t *p_data; /**< Pointer to event data. */ @@ -248,7 +256,8 @@ typedef void (*uds_evt_handler_t)(uds_evt_t *p_evt); * @{ */ /**@brief UDS Registered User Data stream. */ -typedef struct { +typedef struct +{ uint8_t *p_data; /**< Pointer to Registered User Data stream. */ uint16_t length; /**< Length of Registered User Data stream. */ uint16_t offset; /**< Offset of Registered User Data stream. */ @@ -257,13 +266,11 @@ typedef struct { uint16_t segm_offset; /**< Offset of Registered User Data segmentations' number. */ } uds_regi_user_data_stream_t; -/**@brief User Data Service init structure. - * This contains all option and data needed for initialization of the service. */ -typedef struct { +/**@brief User Data Service init structure. This contains all option and data needed for initialization of the service. */ +typedef struct +{ uds_evt_handler_t evt_handler; /**< User Data Service event handler. */ - uint32_t - char_mask; /**< Initialize the mask of supported characteristics, \ - and configured with \ref UDS_CHAR_MASK. */ + uint32_t char_mask; /**< Initialize the mask of supported characteristics, and configured with \ref UDS_CHAR_MASK. */ uint8_t user_index; /**< Initialize the user index. */ uint8_t db_change_incr_val; /**< Initialize the Database Change Increment value. */ uds_regi_user_data_flag_t uds_regi_user_data_flag; /**< Initialize the Registered User Data Flags structure. */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/BUILD.gn new file mode 100644 index 0000000..dedd3c6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("wss") { + sources = [ "wss.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.c b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.c index ac687ab..27fbbe6 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.c +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.c @@ -46,30 +46,22 @@ #include "utility.h" #include "app_log.h" -#define WEIGHTS_SCALE 0.005 -#define HEIGHT_SCALE 0.01 -#define LB_KG 0.01 -#define LB_KG_SCALE 0.4535924 -#define TURN_TO_M 0.1 -#define TURN_TO_M_SCALE 0.0254 -#define PACKET_LEN_OFFSET 4 -#define CACHE_NUM_LOW 25 -#define SCALE_10 10 /* * ENUMERATIONS **************************************************************************************** */ /**@brief Weight Scale Service Attributes Indexes. */ -enum { +enum +{ // Weight Scale Service WSS_IDX_SVC, - + WSS_IDX_INCL_SVC, - + // WSS Scale Feature Characteristics WSS_IDX_WS_FEAT_CHAR, WSS_IDX_WS_FEAT_VAL, - + // Weight Measurement Characteristic WSS_IDX_WEIGHT_MEAS_CHAR, WSS_IDX_WEIGHT_MEAS_VAL, @@ -83,34 +75,31 @@ enum { ***************************************************************************************** */ /**@brief Weight Scale measurement data stream. */ -typedef struct { +typedef struct +{ uint8_t *p_data; /**< Pointer to data. */ uint16_t length; /**< Length of data. */ uint16_t offset; /**< Offset of data. */ } wss_meas_data_stream_t; /**@brief Weight Scale Service environment variable. */ -struct wss_env_t { +struct wss_env_t +{ wss_init_t wss_init; /**< Weight Scale Service initialization variables. */ uint16_t start_hdl; /**< Weight Scale Service start handle. */ uint8_t cur_user_index; /**< Current User Index. */ - uint16_t - meas_ind_cfg[WSS_CONNECTION_MAX]; /**< The configuration of Weight Scale Indication - which is configured by the peer devices. */ + uint16_t meas_ind_cfg[WSS_CONNECTION_MAX]; /**< The configuration of Weight Scale Indication which is configured by the peer devices. */ uint16_t *p_incl_srvc_start_handle; + ble_gatts_create_db_t wss_gatts_db; /**< Weight Scale Service attributs database. */ }; /* * LOCAL FUNCTION DECLARATION ***************************************************************************************** */ -static sdk_err_t wss_init(void); -static void wss_read_att_cb(uint8_t conidx, const gatts_read_req_cb_t *p_param); -static void wss_write_att_cb(uint8_t conidx, const gatts_write_req_cb_t *p_param); -static void wss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value); -static void wss_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); -static uint16_t wss_meas_value_encoded(wss_meas_val_t *p_wss_meas_val, uint8_t cache_num); +static uint16_t wss_meas_value_encoded(wss_meas_val_t *p_wss_meas_val, uint8_t index); static uint16_t wss_indicate_meas_value_chunk(uint8_t conn_idx); +static uint8_t local_buff[WSS_MEAS_VAL_LEN_MAX * WSS_CACHE_MEAS_NUM_MAX]; /* * LOCAL VARIABLE DEFINITIONS @@ -119,108 +108,43 @@ static uint16_t wss_indicate_meas_value_chunk(uint8_t conn_idx); static struct wss_env_t s_wss_env; static wss_meas_data_stream_t s_wss_meas_val; static uint16_t s_packet_length; +static const uint8_t s_wss_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_WEIGHT_SCALE); /**@brief Full WSS Database Description - Used to add attributes into the database. */ -static const attm_desc_t wss_attr_tab[WSS_IDX_NB] = { +static const ble_gatts_attm_desc_t wss_attr_tab[WSS_IDX_NB] = +{ // WSS Service Declaration - [WSS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, READ_PERM_UNSEC, 0, 0}, + [WSS_IDX_SVC] = {BLE_ATT_DECL_PRIMARY_SERVICE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, - // Include Service Declaration - [WSS_IDX_INCL_SVC] = {BLE_ATT_DECL_INCLUDE, READ_PERM_UNSEC, 0, 0}, + //Include Service Declaration + [WSS_IDX_INCL_SVC] = {BLE_ATT_DECL_INCLUDE, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Weight Scale Feature Characteristic - Declaration - [WSS_IDX_WS_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [WSS_IDX_WS_FEAT_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Weight Scale Feature Characteristic - Value - [WSS_IDX_WS_FEAT_VAL] = { - BLE_ATT_CHAR_WEIGHT_SCALE_FEATURE, - READ_PERM_UNSEC, - ATT_VAL_LOC_USER, - WSS_FEAT_VAL_LEN_MAX - }, + [WSS_IDX_WS_FEAT_VAL] = {BLE_ATT_CHAR_WEIGHT_SCALE_FEATURE, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + WSS_FEAT_VAL_LEN_MAX}, // Weight Measurement Characteristic - Declaration - [WSS_IDX_WEIGHT_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, READ_PERM_UNSEC, 0, 0}, + [WSS_IDX_WEIGHT_MEAS_CHAR] = {BLE_ATT_DECL_CHARACTERISTIC, BLE_GATTS_READ_PERM_UNSEC, 0, 0}, // Weight Measurement Characteristic Declaration - value - [WSS_IDX_WEIGHT_MEAS_VAL] = { - BLE_ATT_CHAR_WEIGHT_MEASUREMENT, - INDICATE_PERM_UNSEC, - ATT_VAL_LOC_USER, - WSS_MEAS_VAL_LEN_MAX - }, + [WSS_IDX_WEIGHT_MEAS_VAL] = {BLE_ATT_CHAR_WEIGHT_MEASUREMENT, + BLE_GATTS_INDICATE_PERM(BLE_GATTS_UNAUTH), + BLE_GATTS_ATT_VAL_LOC_USER, + WSS_MEAS_VAL_LEN_MAX}, // Weight Measurement Declaration - Client Characteristic Configuration Descriptor - [WSS_IDX_WEIGHT_MEAS_IND_CFG] = { - BLE_ATT_DESC_CLIENT_CHAR_CFG, - READ_PERM_UNSEC | WRITE_REQ_PERM_UNSEC, - 0, - 0 - }, -}; - -/**@brief WSS Task interface required by profile manager. */ -static ble_prf_manager_cbs_t wss_task_cbs = { - (prf_init_func_t) wss_init, - NULL, - NULL -}; - -/**@brief WSS Task Callbacks. */ -static gatts_prf_cbs_t wss_cb_func = { - wss_read_att_cb, - wss_write_att_cb, - NULL, - wss_gatts_ntf_ind_cb, - wss_cccd_set_cb -}; - -/**@brief WSS Information. */ -static const prf_server_info_t wss_prf_info = { - .max_connection_nb = WSS_CONNECTION_MAX, - .manager_cbs = &wss_task_cbs, - .gatts_prf_cbs = &wss_cb_func + [WSS_IDX_WEIGHT_MEAS_IND_CFG] = {BLE_ATT_DESC_CLIENT_CHAR_CFG, + BLE_GATTS_READ_PERM(BLE_GATTS_UNAUTH) | BLE_GATTS_WRITE_REQ_PERM(BLE_GATTS_UNAUTH), + 0, + 0}, }; /* * LOCAL FUNCTION DEFINITIONS ***************************************************************************************** */ -/** - ***************************************************************************************** - * @brief Initialize Weight Scale service and create db in att - * - * @return Error code to know if profile initialization succeed or not. - ***************************************************************************************** - */ -static sdk_err_t wss_init(void) -{ - // The start handle must be set with PRF_INVALID_HANDLE to be allocated automatically by BLE Stack. - uint16_t start_hdl = PRF_INVALID_HANDLE; - const uint8_t wss_svc_uuid[] = BLE_ATT_16_TO_16_ARRAY(BLE_ATT_SVC_WEIGHT_SCALE); - sdk_err_t error_code; - gatts_create_db_t gatts_db; - - error_code = memset_s(&gatts_db, sizeof(gatts_db), 0, sizeof(gatts_db)); - if (error_code < 0) { - return error_code; - } - - gatts_db.shdl = &start_hdl; - gatts_db.uuid = wss_svc_uuid; - gatts_db.attr_tab_cfg = (uint8_t *)&(s_wss_env.wss_init.char_mask); - gatts_db.max_nb_attr = WSS_IDX_NB; - gatts_db.srvc_perm = 0; - gatts_db.attr_tab_type = SERVICE_TABLE_TYPE_16; - gatts_db.attr_tab.attr_tab_16 = wss_attr_tab; - gatts_db.inc_srvc_num = 1; - gatts_db.inc_srvc_handle[0] = s_wss_env.p_incl_srvc_start_handle; - - error_code = ble_gatts_srvc_db_create(&gatts_db); - if (SDK_SUCCESS == error_code) { - s_wss_env.start_hdl = *gatts_db.shdl; - } - - return error_code; -} - /** ***************************************************************************************** * @brief Handles reception of the attribute info request message. @@ -229,31 +153,35 @@ static sdk_err_t wss_init(void) * @param[in] p_param: The parameters of the read request. ***************************************************************************************** */ -static void wss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param) +static void wss_read_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_read_t *p_param) { - gatts_read_cfm_t cfm; - uint8_t handle = p_param->handle; - uint8_t tab_index = prf_find_idx_by_handle(handle, - s_wss_env.start_hdl, - WSS_IDX_NB, - (uint8_t *)&s_wss_env.wss_init.char_mask); + ble_gatts_read_cfm_t cfm; + uint8_t handle = p_param->handle; + uint8_t tab_index = prf_find_idx_by_handle(handle, + s_wss_env.start_hdl, + WSS_IDX_NB, + (uint8_t *)&s_wss_env.wss_init.char_mask); cfm.handle = handle; cfm.status = BLE_SUCCESS; - switch (tab_index) { - case WSS_IDX_WS_FEAT_VAL: { + switch (tab_index) + { + case WSS_IDX_WS_FEAT_VAL: + { cfm.length = sizeof(uint32_t); cfm.value = (uint8_t *)&s_wss_env.wss_init.feature; break; } - case WSS_IDX_WEIGHT_MEAS_IND_CFG: { + case WSS_IDX_WEIGHT_MEAS_IND_CFG: + { cfm.length = sizeof(uint16_t); cfm.value = (uint8_t *)&s_wss_env.meas_ind_cfg[conn_idx]; break; } - default: { + default: + { cfm.length = 0; cfm.status = BLE_ATT_ERR_INVALID_HANDLE; break; @@ -271,13 +199,13 @@ static void wss_read_att_cb(uint8_t conn_idx, const gatts_read_req_cb_t *p_param * @param[in]: p_param: The parameters of the write request. ***************************************************************************************** */ -static void wss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_param) +static void wss_write_att_evt_handler(uint8_t conn_idx, const ble_gatts_evt_write_t *p_param) { - uint16_t handle = p_param->handle; - uint16_t tab_index = 0; - uint16_t cccd_value = 0; - wss_evt_t event; - gatts_write_cfm_t cfm; + uint16_t handle = p_param->handle; + uint16_t tab_index = 0; + uint16_t cccd_value = 0; + wss_evt_t event; + ble_gatts_write_cfm_t cfm; tab_index = prf_find_idx_by_handle(handle, s_wss_env.start_hdl, @@ -288,7 +216,8 @@ static void wss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p event.evt_type = WSS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case WSS_IDX_WEIGHT_MEAS_IND_CFG: cccd_value = le16toh(&p_param->value[0]); event.evt_type = ((PRF_CLI_START_IND == cccd_value) ? \ @@ -304,8 +233,8 @@ static void wss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p ble_gatts_write_cfm(conn_idx, &cfm); - if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && WSS_EVT_INVALID != event.evt_type && - s_wss_env.wss_init.evt_handler) { + if (BLE_ATT_ERR_INVALID_HANDLE != cfm.status && WSS_EVT_INVALID != event.evt_type && s_wss_env.wss_init.evt_handler) + { s_wss_env.wss_init.evt_handler(&event); } } @@ -319,12 +248,13 @@ static void wss_write_att_cb(uint8_t conn_idx, const gatts_write_req_cb_t *p_p * @param[in]: cccd_value: The value of cccd attribute. ***************************************************************************************** */ -static void wss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) +static void wss_cccd_set_evt_handler(uint8_t conn_idx, uint16_t handle, uint16_t cccd_value) { uint16_t tab_index = 0; wss_evt_t event; - if (!prf_is_cccd_value_valid(cccd_value)) { + if (!prf_is_cccd_value_valid(cccd_value)) + { return; } @@ -336,19 +266,21 @@ static void wss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val event.evt_type = WSS_EVT_INVALID; event.conn_idx = conn_idx; - switch (tab_index) { + switch (tab_index) + { case WSS_IDX_WEIGHT_MEAS_IND_CFG: - event.evt_type = ((PRF_CLI_START_NTF == cccd_value) ? \ + event.evt_type = ((PRF_CLI_START_IND == cccd_value) ? \ WSS_EVT_MEAS_INDICATION_ENABLE : \ WSS_EVT_MEAS_INDICATION_DISABLE); s_wss_env.meas_ind_cfg[conn_idx] = cccd_value; break; - + default: break; } - if (WSS_EVT_INVALID != event.evt_type && s_wss_env.wss_init.evt_handler) { + if (WSS_EVT_INVALID != event.evt_type && s_wss_env.wss_init.evt_handler) + { s_wss_env.wss_init.evt_handler(&event); } } @@ -362,10 +294,12 @@ static void wss_cccd_set_cb(uint8_t conn_idx, uint16_t handle, uint16_t cccd_val * @param[in] p_ntf_ind: Pointer to the parameters of the complete event. ***************************************************************************************** */ -static void wss_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind) +static void wss_ntf_ind_evt_handler(uint8_t conn_idx, uint8_t status, const ble_gatts_evt_ntf_ind_t *p_ntf_ind) { - if (s_wss_env.wss_init.evt_handler && SDK_SUCCESS == status && s_wss_env.meas_ind_cfg[conn_idx]) { - if (BLE_GATT_INDICATION == p_ntf_ind->type) { + if (s_wss_env.wss_init.evt_handler && SDK_SUCCESS == status && s_wss_env.meas_ind_cfg[conn_idx]) + { + if (BLE_GATT_INDICATION == p_ntf_ind->type) + { wss_indicate_meas_value_chunk(conn_idx); } } @@ -382,18 +316,19 @@ static void wss_gatts_ntf_ind_cb(uint8_t conn_idx, uint8_t status, const ble_gat */ static uint16_t wss_indicate_meas_value_chunk(uint8_t conn_idx) { - uint16_t chunk_len; - gatts_noti_ind_t wss_meas_ind; - sdk_err_t error_code; - + uint16_t chunk_len; + ble_gatts_noti_ind_t wss_meas_ind; + sdk_err_t error_code; + chunk_len = s_wss_meas_val.length - s_wss_meas_val.offset; chunk_len = chunk_len > s_packet_length ? s_packet_length : chunk_len; - - if (chunk_len == 0) { + + if (0 == chunk_len) + { s_wss_meas_val.p_data = NULL; s_wss_meas_val.length = 0; s_wss_meas_val.offset = 0; - + return SDK_SUCCESS; } @@ -405,7 +340,8 @@ static uint16_t wss_indicate_meas_value_chunk(uint8_t conn_idx) wss_meas_ind.value = (uint8_t *)s_wss_meas_val.p_data + s_wss_meas_val.offset; error_code = ble_gatts_noti_ind(conn_idx, &wss_meas_ind); - if (SDK_SUCCESS == error_code) { + if (SDK_SUCCESS == error_code) + { s_wss_meas_val.offset += chunk_len; } @@ -424,28 +360,33 @@ static uint16_t wss_indicate_meas_value_chunk(uint8_t conn_idx) */ static uint16_t wss_meas_value_encoded(wss_meas_val_t *p_wss_meas_val, uint8_t cache_num) { - uint8_t local_buff[WSS_MEAS_VAL_LEN_MAX * WSS_CACHE_MEAS_NUM_MAX] = {0}; uint8_t flags = 0; uint16_t length = 0; double height_in_m; double weight_in_kg; - + + memset(local_buff, 0, sizeof(local_buff)); s_wss_meas_val.length = 0; - - for (uint8_t i = 0; i < cache_num; i++) { + + for (uint8_t i = 0; i < cache_num; i++) + { length++; - if (WSS_MEAS_UNSUCCESS != p_wss_meas_val->weight) { + if (WSS_MEAS_UNSUCCESS != p_wss_meas_val->weight) + { // Weight Field local_buff[length++] = LO_U16(p_wss_meas_val[i].weight); local_buff[length++] = HI_U16(p_wss_meas_val[i].weight); - } else { + } + else + { // Weight Field local_buff[length++] = LO_U16(WSS_MEAS_UNSUCCESS); local_buff[length++] = HI_U16(WSS_MEAS_UNSUCCESS); } - + // Time Stamp Field - if ((s_wss_env.wss_init.feature & WSS_FEAT_TIME_STAMP) && (s_wss_env.wss_init.time_stamp_present)) { + if (s_wss_env.wss_init.feature & WSS_FEAT_TIME_STAMP && (s_wss_env.wss_init.time_stamp_present)) + { local_buff[length++] = LO_U16(p_wss_meas_val[i].time_stamp.year); local_buff[length++] = HI_U16(p_wss_meas_val[i].time_stamp.year); local_buff[length++] = p_wss_meas_val[i].time_stamp.month; @@ -457,79 +398,123 @@ static uint16_t wss_meas_value_encoded(wss_meas_val_t *p_wss_meas_val, uint8_t c } // User ID Field - if ((s_wss_env.wss_init.feature & WSS_FEAT_MULTI_USER) && (s_wss_env.wss_init.multi_user_present)) { + if (s_wss_env.wss_init.feature & WSS_FEAT_MULTI_USER && (s_wss_env.wss_init.multi_user_present)) + { local_buff[length++] = p_wss_meas_val[i].user_id; flags |= WSS_MEAS_FLAG_USER_ID_PRESENT; } - if (WSS_MEAS_UNSUCCESS != p_wss_meas_val->weight) { + if (WSS_MEAS_UNSUCCESS != p_wss_meas_val->weight) + { // BMI and Height Fields - if ((WSS_FEAT_BMI & s_wss_env.wss_init.feature) && (s_wss_env.wss_init.bmi_present)) { + if (WSS_FEAT_BMI & s_wss_env.wss_init.feature && (s_wss_env.wss_init.bmi_present)) + { uint16_t bmi; - + s_packet_length = WSS_MEAS_VAL_LEN_MAX; - - if (WSS_UNIT_SI == s_wss_env.wss_init.wss_unit) { + + if (WSS_UNIT_SI == s_wss_env.wss_init.wss_unit) + { if ((WSS_FEAT_MASS_RES_5G & s_wss_env.wss_init.feature) && \ (WSS_FEAT_HEIGHT_RES_1MM & s_wss_env.wss_init.feature) && \ (WSS_HEIGHT_RES_1MM == s_wss_env.wss_init.wss_height_res) && \ - (WSS_MASS_RES_5G == s_wss_env.wss_init.wss_mass_res)) { - weight_in_kg = p_wss_meas_val[i].weight * WEIGHTS_SCALE; - height_in_m = p_wss_meas_val->height * HEIGHT_SCALE; - bmi = (weight_in_kg/(height_in_m * height_in_m)) * SCALE_10; + (WSS_MASS_RES_5G == s_wss_env.wss_init.wss_mass_res)) + { + weight_in_kg = p_wss_meas_val[i].weight * 0.005; + height_in_m = p_wss_meas_val->height * 0.01; + bmi = (weight_in_kg/(height_in_m * height_in_m)) * 10; } - } else { + } + else + { if ((WSS_FEAT_MASS_RES_5G & s_wss_env.wss_init.feature) && \ (WSS_FEAT_HEIGHT_RES_1MM & s_wss_env.wss_init.feature) && \ (WSS_HEIGHT_RES_1MM == s_wss_env.wss_init.wss_height_res) && \ - (WSS_MASS_RES_5G == s_wss_env.wss_init.wss_mass_res)) { - weight_in_kg = p_wss_meas_val[i].weight * LB_KG * LB_KG_SCALE; // turn lb to kg. - height_in_m = p_wss_meas_val->height * TURN_TO_M * TURN_TO_M_SCALE; // turn in to m. - bmi = (weight_in_kg/(height_in_m * height_in_m)) * SCALE_10; - } + (WSS_MASS_RES_5G == s_wss_env.wss_init.wss_mass_res)) + { + weight_in_kg = p_wss_meas_val[i].weight * 0.01 * 0.4535924; // turn lb to kg. + height_in_m = p_wss_meas_val->height * 0.1 * 0.0254; // turn in to m. + bmi = (weight_in_kg/(height_in_m * height_in_m)) * 10; + } } local_buff[length++] = LO_U16(bmi); local_buff[length++] = HI_U16(bmi); - local_buff[length++] = LO_U16(p_wss_meas_val->height * SCALE_10); - local_buff[length++] = HI_U16(p_wss_meas_val->height * SCALE_10); + local_buff[length++] = LO_U16(p_wss_meas_val->height * 10); + local_buff[length++] = HI_U16(p_wss_meas_val->height * 10); flags |= WSS_MEAS_FLAG_BMI_HEIGHT_PRESENT; - } else if ((WSS_FEAT_BMI & s_wss_env.wss_init.feature) && (!s_wss_env.wss_init.bmi_present)) { - s_packet_length = WSS_MEAS_VAL_LEN_MAX - PACKET_LEN_OFFSET; } - } else { - s_packet_length = WSS_MEAS_VAL_LEN_MAX - PACKET_LEN_OFFSET; + else if (WSS_FEAT_BMI & s_wss_env.wss_init.feature && (!s_wss_env.wss_init.bmi_present)) + { + s_packet_length = WSS_MEAS_VAL_LEN_MAX - 4; + } } - - if (WSS_UNIT_SI == s_wss_env.wss_init.wss_unit) { + else + { + s_packet_length = WSS_MEAS_VAL_LEN_MAX - 4; + } + + if (WSS_UNIT_SI == s_wss_env.wss_init.wss_unit) + { flags |= WSS_MEAS_FLAG_UNIT_SI; - } else { + } + else + { flags |= WSS_MEAS_FLAG_UNIT_IMPERIAL; } - + local_buff[s_wss_meas_val.length] = flags; s_wss_meas_val.length = length; } - + s_wss_meas_val.offset = 0; s_wss_meas_val.p_data = &local_buff[0]; - + return length; } +static void wss_ble_evt_handler(const ble_evt_t *p_evt) +{ + if (NULL == p_evt) + { + return; + } + + switch (p_evt->evt_id) + { + case BLE_GATTS_EVT_READ_REQUEST: + wss_read_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.read_req); + break; + + case BLE_GATTS_EVT_WRITE_REQUEST: + wss_write_att_evt_handler(p_evt->evt.gatts_evt.index, &p_evt->evt.gatts_evt.params.write_req); + break; + + case BLE_GATTS_EVT_NTF_IND: + wss_ntf_ind_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt_status, &p_evt->evt.gatts_evt.params.ntf_ind_sended); + break; + + case BLE_GATTS_EVT_CCCD_RECOVERY: + wss_cccd_set_evt_handler(p_evt->evt.gatts_evt.index, p_evt->evt.gatts_evt.params.cccd_recovery.handle, p_evt->evt.gatts_evt.params.cccd_recovery.cccd_val); + break; + } +} + /* * GLOBAL FUNCTION DEFINITIONS ***************************************************************************************** */ sdk_err_t wss_measurement_send(uint8_t conn_idx, wss_meas_val_t *p_wss_meas_val, uint8_t cache_num) { - if (p_wss_meas_val == NULL || cache_num > CACHE_NUM_LOW) { + if (NULL == p_wss_meas_val || 25 < cache_num) + { return SDK_ERR_INVALID_PARAM; } - + sdk_err_t error_code = SDK_ERR_IND_DISABLED; - - if (PRF_CLI_START_IND == s_wss_env.meas_ind_cfg[conn_idx]) { + + if (PRF_CLI_START_IND == s_wss_env.meas_ind_cfg[conn_idx]) + { wss_meas_value_encoded(p_wss_meas_val, cache_num); error_code = wss_indicate_meas_value_chunk(conn_idx); } @@ -539,20 +524,27 @@ sdk_err_t wss_measurement_send(uint8_t conn_idx, wss_meas_val_t *p_wss_meas_val, sdk_err_t wss_service_init(wss_init_t *p_wss_init, uint16_t *p_incl_srvc_start_handle) { - sdk_err_t ret; - if (p_wss_init == NULL) { + if (NULL == p_wss_init) + { return SDK_ERR_POINTER_NULL; } - ret = memset_S(&s_wss_env, sizeof(s_wss_env), 0, sizeof(s_wss_env)); - if (ret < 0) { - return ret; - } - ret = memcpy_s(&s_wss_env.wss_init, sizeof(wss_init_t), p_wss_init, sizeof(wss_init_t)); - if (ret < 0) { - return ret; - } + memset(&s_wss_env, 0, sizeof(s_wss_env)); + memcpy(&s_wss_env.wss_init, p_wss_init, sizeof(wss_init_t)); s_wss_env.p_incl_srvc_start_handle = p_incl_srvc_start_handle; + + s_wss_env.start_hdl = PRF_INVALID_HANDLE; + s_wss_env.wss_gatts_db.shdl = &s_wss_env.start_hdl; + s_wss_env.wss_gatts_db.uuid = s_wss_svc_uuid; + s_wss_env.wss_gatts_db.attr_tab_cfg = (uint8_t *)&(s_wss_env.wss_init.char_mask); + s_wss_env.wss_gatts_db.max_nb_attr = WSS_IDX_NB; + s_wss_env.wss_gatts_db.srvc_perm = 0; + s_wss_env.wss_gatts_db.attr_tab_type = BLE_GATTS_SERVICE_TABLE_TYPE_16; + s_wss_env.wss_gatts_db.attr_tab.attr_tab_16 = wss_attr_tab; + s_wss_env.wss_gatts_db.inc_srvc_num = 1; + s_wss_env.wss_gatts_db.inc_srvc_handle[0] = p_incl_srvc_start_handle; - return ble_server_prf_add(&wss_prf_info); + return ble_gatts_prf_add(&s_wss_env.wss_gatts_db, wss_ble_evt_handler); } + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.h b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.h index 8fe50e0..5ca6e09 100644 --- a/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/profiles/wss/wss.h @@ -50,29 +50,28 @@ * (Server) intended for consumer healthcare as well as sports/fitness applications. * * After \ref wss_init_t variable is intialized, the application must call \ref wss_service_init() - * to add Weight Scale Feature and Weight Measurement characteristics to the BLE Stack database + * to add Weight Scale Feature and Weight Measurement characteristics to the BLE Stack database * according to \ref wss_init_t.char_mask. */ #ifndef __WSS_H__ #define __WSS_H__ -#include -#include -#include "gr55xx_sys.h" +#include "gr_includes.h" #include "custom_config.h" #include "ble_prf_utils.h" +#include +#include /** * @defgroup WSS_MACRO Defines * @{ */ -#define WSS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ? \ - 10 : CFG_MAX_CONNECTIONS) /**< Maximum number of Weight Scale Service connections. */ -#define WSS_MEAS_VAL_LEN_MAX 15 /**< Maximum length of Weight Measurment value. */ -#define WSS_CACHE_MEAS_NUM_MAX 25 /**< Maximum number of cache muasurements value for each user. */ -#define WSS_FEAT_VAL_LEN_MAX 1 /**< Maximum length of WS Feature value. */ -#define WSS_MEAS_UNSUCCESS 0xFFFF /**< Measurement Unsuccessful. */ +#define WSS_CONNECTION_MAX 10 /**< Maximum number of Weight Scale Service connections. */ +#define WSS_MEAS_VAL_LEN_MAX 15 /**< Maximum length of Weight Measurment value. */ +#define WSS_CACHE_MEAS_NUM_MAX 25 /**< Maximum number of cache muasurements value for each user. */ +#define WSS_FEAT_VAL_LEN_MAX 1 /**< Maximum length of WS Feature value. */ +#define WSS_MEAS_UNSUCCESS 0xFFFF /**< Measurement Unsuccessful. */ /** * @defgroup WSS_CHAR_MASK Characteristics Mask * @{ @@ -86,22 +85,19 @@ * @defgroup WSS_ENUM Enumerations * @{ */ -/** - * @defgroup WSS_MEAS_FLAG_BIT Measurement Flag Bits - * @{ - * @brief Weight Scale Measurement Flags. - */ -enum wss_meas_flag_bits { +/**@brief Weight Scale Measurement Flags.*/ +enum wss_meas_flag_bits +{ WSS_MEAS_FLAG_UNIT_SI = 0x00, /**< Flag bit for SI Measurement Units Present. */ WSS_MEAS_FLAG_UNIT_IMPERIAL = 0x01, /**< Flag bit for Imperial Measurement Units Present. */ WSS_MEAS_FLAG_DATE_TIME_PRESENT = 0x02, /**< Flag bit for Time Stamp Present. */ WSS_MEAS_FLAG_USER_ID_PRESENT = 0x04, /**< Flag bit for User ID Present. */ WSS_MEAS_FLAG_BMI_HEIGHT_PRESENT = 0x08, /**< Flag bit for BMI and Height Present. */ }; -/** @} */ /**@brief Weight Scale Feature characteristic bit values.*/ -typedef enum { +typedef enum +{ /* Supported Flags */ WSS_FEAT_TIME_STAMP = 0x00000001, /**< Time Stamp supported. */ WSS_FEAT_MULTI_USER = 0x00000002, /**< Multiple Users supported. */ @@ -115,17 +111,18 @@ typedef enum { WSS_FEAT_MASS_RES_20G = 0x00000028, /**< Resolution of 0.02kg or 0.05lb. */ WSS_FEAT_MASS_RES_10G = 0x00000030, /**< Resolution of 0.01kg or 0.02lb. */ WSS_FEAT_MASS_RES_5G = 0x00000038, /**< Resolution of 0.005kg or 0.01lb. */ - + /* Height Measurement Resolution */ WSS_FEAT_HEIGHT_RES_10MM = 0x00000080, /**< Resolution of 0.01m or 1in. */ WSS_FEAT_HEIGHT_RES_5MM = 0x00000100, /**< Resolution of 0.005m or 0.5in. */ WSS_FEAT_HEIGHT_RES_1MM = 0x00000180, /**< Resolution of 0.001m or 0.1in. */ - + WSS_FEAT_FULL_BIT = 0x000001BF, } wss_feature_t; /**@brief WSS Weight Measurement resolutions. */ -typedef enum { +typedef enum +{ WSS_MASS_RES_500G, /**< Resolution of 0.5kg or 1lb. */ WSS_MASS_RES_200G, /**< Resolution of 0.2kg or 0.5lb. */ WSS_MASS_RES_100G, /**< Resolution of 0.1kg or 0.2lb. */ @@ -136,34 +133,38 @@ typedef enum { } wss_mass_res_t; /**@brief WSS Height Measurement resolutions. */ -typedef enum { +typedef enum +{ WSS_HEIGHT_RES_10MM, /**< Resolution of 0.01m or 1in. */ WSS_HEIGHT_RES_5MM, /**< Resolution of 0.005m or 0.5in. */ WSS_HEIGHT_RES_1MM, /**< Resolution of 0.001m or 0.1in. */ } wss_height_res_t; /**@brief WSS unit types. */ -typedef enum { +typedef enum +{ WSS_UNIT_SI, /**< Weight in kilograms and height in meters */ WSS_UNIT_IMPERIAL, /**< Weight in pounds and height in inches */ } wss_unit_t; -/**@brief Weight Scale Service event type. */ -typedef enum { + /**@brief Weight Scale Service event type. */ +typedef enum +{ WSS_EVT_INVALID, /**< Indicate that invalid event. */ WSS_EVT_MEAS_INDICATION_ENABLE, /**< Indicate that body composition measurement indication has been enabled. */ WSS_EVT_MEAS_INDICATION_DISABLE, /**< Indicate that body composition measurement indication has been disabled. */ WSS_EVT_MEAS_INDICATION_CPLT, /**< Indicate that BC Measurement has been indicated. */ WSS_EVT_MEAS_READ_CHARACTERISTIC, /**< The peer reads the characteristic. */ -} wss_evt_type_t; +} wss_evt_type_t; /** @} */ -/** +/** * @defgroup WSS_STRUCT Structures * @{ - */ + */ /**@brief Weight Scale Measurement data. */ -typedef struct { +typedef struct +{ uint16_t weight; /**< Weight. */ prf_date_time_t time_stamp; /**< Time stamp. */ uint8_t user_id; /**< User index. */ @@ -172,10 +173,11 @@ typedef struct { } wss_meas_val_t; /**@brief Weight Scale Service event. */ -typedef struct { +typedef struct +{ wss_evt_type_t evt_type; /**< The WSS event type. */ - uint8_t conn_idx; /**< The index of the connection. */ - const uint8_t *p_data; /**< Pointer to event data. */ + uint8_t conn_idx; /**< The index of the connection. */ + const uint8_t *p_data; /**< Pointer to event data. */ uint16_t length; /**< Length of event data. */ } wss_evt_t; /** @} */ @@ -193,11 +195,11 @@ typedef void (*wss_evt_handler_t)(wss_evt_t *p_evt); * @{ */ /**@brief Weight Scale Service Init variable. */ -typedef struct { +typedef struct +{ wss_evt_handler_t evt_handler; /**< Weight Scale Service event handler. */ uint32_t feature; /**< Initial value for features. */ - uint8_t - char_mask; /**< Initial mask of Supported characteristics, and configured with \ref WSS_CHAR_MASK */ + uint8_t char_mask; /**< Initial mask of Supported characteristics, and configured with \ref WSS_CHAR_MASK */ wss_unit_t wss_unit; /**< Initial the unit system as SI or Imperial. */ wss_mass_res_t wss_mass_res; /**< Initial resolution of mass value. */ wss_height_res_t wss_height_res; /**< Initial resolution of height value. */ @@ -215,8 +217,8 @@ typedef struct { ***************************************************************************************** * @brief Initialize a Weight Scale Service instance and add in the DB. * - * @param[in] p_wss_init: Pointer to WSS Service initialization variable. - * + * @param[in] p_wss_init: Pointer to WSS Service initialization variable. + * @param[in] p_bcs_start_handle: Pointer to the included service(BCS) start handle. * @return Result of service initialization. ***************************************************************************************** */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/BUILD.gn new file mode 100644 index 0000000..c6ea37e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/BUILD.gn @@ -0,0 +1,21 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("sdk") { +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble.h old mode 100755 new mode 100644 index 9775f7c..a105e0c --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble.h @@ -35,10 +35,10 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -*/ + /** + * @addtogroup BLE + * @{ + */ /** @addtogroup BLE_COMMEN BLE Common @@ -59,23 +59,28 @@ #include "ble_l2cap.h" #include "ble_prf.h" #include "ble_sec.h" +#include "ble_event.h" + +#include /** @addtogroup BLE_COMMEN_ENUM Enumerations * @{ */ /** - * @brief RF TX mode. + * @brief RF TX mode. */ -typedef enum { +typedef enum +{ BLE_RF_TX_MODE_INVALID = 0, BLE_RF_TX_MODE_LP_MODE = 1, BLE_RF_TX_MODE_ULP_MODE = 2, } ble_rf_tx_mode_t; /** - * @brief The resistance value (ohm) of the RF match circuit. + * @brief The resistance value (ohm) of the RF match circuit. */ -typedef enum { +typedef enum +{ BLE_RF_MATCH_CIRCUIT_25OHM = 25, BLE_RF_MATCH_CIRCUIT_100OHM = 100, } ble_rf_match_circuit_t; @@ -85,20 +90,11 @@ typedef enum { /** @addtogroup BLE_COMMEN_STRUCTURES Structures * @{ */ -/** @brief The app callbacks for GAP, GATT, SM and L2CAP. */ -typedef struct { - app_ble_init_cmp_cb_t - app_ble_init_cmp_callback; /**< Callback function for BLE initialization completed */ - gap_cb_fun_t *app_gap_callbacks; /**< Callback function for GAP */ - const gatt_common_cb_fun_t *app_gatt_common_callback; /**< Callback function for GATT common */ - const gattc_cb_fun_t *app_gattc_callback; /**< Callback function for GATT Client */ - sec_cb_fun_t *app_sec_callback; /**< Callback function for SM*/ -} app_callback_t; - -/** @brief The table contains the pointers to four arrays which are used +/**@brief The table contains the pointers to four arrays which are used * as heap memory by BLE stack in ROM. The size of four arrays depends on * the number of connections and the number of attributes of profiles. */ -typedef struct { +typedef struct +{ uint32_t *env_ret; /**< Pointer to the array for environment heap */ uint32_t *db_ret; /**< Pointer to the array for ATT DB heap */ uint32_t *msg_ret; /**< Pointer to the array for message heap */ @@ -113,18 +109,19 @@ typedef struct { uint32_t bm_size; /**< The size of the array for bond manager heap */ uint8_t *conn_buf; /**< Pointer to the array for connection heap */ uint32_t conn_size; /**< The size of the array for connection heap */ -} stack_heaps_table_t; + uint8_t *scan_dup_filt_list_buf; /**< Pointer to the array for adv duplicate filter */ + uint32_t scan_dup_filt_list_size; /**< The size of the array for adv duplicate filter */ +}stack_heaps_table_t; -/** @brief The function pointers for HCI UART. */ -typedef struct { - void (*init)(void); /**< Initialize UART. */ - void (*flow_on)(void); /**< Flow control on. */ - bool (*flow_off)(void); /**< Flow control off. */ - void (*finish_transfers)(void); /**< Finish the current transferring. */ - /**< Read data. */ - void (*read)(uint8_t *bufptr, uint32_t size, uint8_t (*callback) (uint8_t*, uint8_t), uint8_t* dummy); - /**< Write data. */ - void (*write)(uint8_t *bufptr, uint32_t size, uint8_t (*callback) (uint8_t*, uint8_t), uint8_t* dummy); +/**@brief The function pointers for HCI UART. */ +typedef struct +{ + void (*init)(void); /**< Initialize UART. */ + void (*flow_on)(void); /**< Flow control on. */ + bool (*flow_off)(void); /**< Flow control off. */ + void (*finish_transfers)(void); /**< Finish the current transferring. */ + void (*read)(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); /**< Read data. */ + void (*write)(uint8_t *bufptr, uint32_t size, void (*callback) (void*, uint8_t), void* dummy); /**< Write data. */ } hci_uart_call_t; /** @} */ @@ -132,7 +129,7 @@ typedef struct { * @{ */ -/** @brief The BLE sync event callback. */ +/**@brief The BLE sync event callback. */ typedef void (*ble_sync_evt_cb_t)(uint32_t sync_cnt, uint16_t sync_period); /** @} */ @@ -140,13 +137,22 @@ typedef void (*ble_sync_evt_cb_t)(uint32_t sync_cnt, uint16_t sync_period); * @{ */ /** ***************************************************************************************** - * @brief Initialize BEL Stack. + * @brief Initialize BLE Stack. * - * @param[in] p_app_callback: Pointer to the structure of app callbacks. + * @param[in] evt_handler: Pointer to ble events handler. * @param[in] p_heaps_table: Pointer to the BLE stack heaps table. ***************************************************************************************** */ -void ble_stack_init(app_callback_t *p_app_callback, stack_heaps_table_t *p_heaps_table); +uint16_t ble_stack_init(ble_evt_handler_t evt_handler, stack_heaps_table_t *p_heaps_table); + +/** + ***************************************************************************************** + * @brief Initialize only BLE Stack Controller. + * + * @param[in] p_heaps_table: Pointer to the BLE stack heaps table. + ***************************************************************************************** + */ +void ble_stack_controller_init(stack_heaps_table_t *p_heaps_table); /** ***************************************************************************************** @@ -173,42 +179,38 @@ void ble_idle_time_notify_cb_register(void (*callback)(uint32_t hs)); /** ***************************************************************************************** - * @brief Register BLE event - start notification callback function. + * @brief Register BLE activity start notification callback function. * - * @param[in] callback: function pointer of BLE event - start notification. - * @note param[in] of callback: e_role - the role of event, - * @ref gap_role_t for possible roles. + * @param[in] callback: function pointer of BLE activity start notification function. + * @note param[in] of callback: e_role - the role of activity, gap_activity_role_t for possible roles. * param[in] of callback: index - The index parameter is interpreted by role. - * If the role is @ref GAP_EVENT_ROLE_ADV, it's the index of Advertising. - * If the role is @ref GAP_EVENT_ROLE_CON, it's the index of Connection. + * If role is GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. + * If role is GAP_ACTIVITY_ROLE_CON, it's the index of Connection. * For all other roles, it should be ignored. - * A callback will be called by BLE ISR when the BLE event starts every time. + * Callback will be called by BLE ISR when the BLE activity starts every time. * It should be realized as simlpe as you can. * Notice: You must define the start callback in the RAM space to avoid hardfault. * It's not suitable for ISO activities. ***************************************************************************************** */ -void ble_start_notify_cb_register(void (*callback)(gap_event_role_t e_role, - uint8_t index)); +void ble_activity_start_notify_cb_register(void (*callback)(ble_gap_actv_role_t e_role, uint8_t index)); /** ***************************************************************************************** - * @brief Register BLE event end notification callback function. + * @brief Register BLE activity end notification callback function. * - * @param[in] callback: function pointer of BLE event - end notification function. - * @note param[in] of callback: e_role - the role of event, - * @ref gap_role_t for possible roles. + * @param[in] callback: function pointer of BLE activity end notification function. + * @note param[in] of callback: e_role - the role of activity,gap_activity_role_t for possible roles. * param[in] of callback: index - The index parameter is interpreted by role. - * If the role is @ref GAP_EVENT_ROLE_ADV, it's the index of Advertising. - * If the role is @ref GAP_EVENT_ROLE_CON, it's the index of Connection. + * If role is GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. + * If role is GAP_ACTIVITY_ROLE_CON, it's the index of Connection. * For all other roles, it should be ignored. - * A callback will be called by BLE ISR when the BLE event ends every time. + * Callback will be called by BLE ISR when the BLE activity ends every time. * It should be realized as simlpe as you can. You'd better to define it in the RAM space * It's not suitable for ISO activities. ***************************************************************************************** */ -void ble_end_notify_cb_register(void (*callback)(gap_event_role_t e_role, - uint8_t index)); +void ble_activity_end_notify_cb_register(void (*callback)(ble_gap_actv_role_t e_role, uint8_t index)); /** ***************************************************************************************** @@ -264,10 +266,10 @@ uint16_t ble_sync_source_destroy(void); * BLE_RF_TX_MODE_LP_MODE: LP mode. * BLE_RF_TX_MODE_ULP_MODE: ULP mode. * Others: invalid mode. - * + * * @note This function should be called before BLE stack init. * - * @return SDK_SUCCESS: Successfully set Tx mode. + * @return SDK_SUCCESS: Successfully set Tx mode. * SDK_ERR_DISALLOWED: Failed to set Tx mode. ***************************************************************************************** */ @@ -283,7 +285,7 @@ uint8_t ble_rf_tx_mode_set(ble_rf_tx_mode_t e_rf_tx_mode); ***************************************************************************************** */ ble_rf_tx_mode_t ble_rf_tx_mode_get(void); - + /** ***************************************************************************************** * @brief Set the resistance value of the RF match circuit (unit: ohm). diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_att.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_att.h old mode 100755 new mode 100644 index ce9e56b..ccc8c0e --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_att.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_att.h @@ -35,12 +35,12 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -*/ + /** + * @addtogroup BLE + * @{ + */ -/** + /** * @addtogroup BLE_ATT Attribute Protocol (ATT) * @{ * @brief Definitions and prototypes for ATT. @@ -52,12 +52,11 @@ /** @addtogroup BLE_ATT_DEFINES Defines * @{ */ -#define BLE_ATT_UUID_16(uuid) (uuid) /**< Convert CPU’s integer definition to - LSB-first 16-bit UUID. */ -#define BLE_ATT_MTU_DEFAULT (23) /**< Default ATT MTU size in bytes. */ -#define BLE_ATT_INVALID_HDL (0x0000) /**< Invalid attribute handle. */ -#define BLE_ATT_HANDLE_START (0x0001) /**< Attribute handle start. */ -#define BLE_ATT_HANDLE_END (0xFFFF) /**< Attribute handle end. */ +#define BLE_ATT_UUID_16(uuid) (uuid) /**< Convert CPU’s integer definition to LSB-first 16-bit UUID. */ +#define BLE_ATT_MTU_DEFAULT (23) /**< Default ATT MTU size in bytes. */ +#define BLE_ATT_INVALID_HDL (0x0000) /**< Invalid attribute handle. */ +#define BLE_ATT_HANDLE_START (0x0001) /**< Attribute handle start. */ +#define BLE_ATT_HANDLE_END (0xFFFF) /**< Attribute handle end. */ /** @defgroup BLE_ATT_UUID_LEN Attribute UUID Length(bytes) * @{ */ @@ -80,23 +79,20 @@ /** @defgroup BLE_ATT_CHAR_EXTENDED_PROPERTIES Characteristic Extended Properties * @{ */ -#define BLE_ATT_EXT_RELIABLE_WRITE 0x0001 /**< Characteristic Extended Property: Reliable Write. */ -#define BLE_ATT_EXT_WRITABLE_AUX 0x0002 /**< Characteristic Extended Property: Writable Auxiliaries. */ -#define BLE_ATT_EXT_RFU 0xFFFC /**< Characteristic Extended Property: - Reserved for Future Use. */ +#define BLE_ATT_EXT_RELIABLE_WRITE 0x0001 /**< Characteristic Extended Property: Reliable Write. */ +#define BLE_ATT_EXT_WRITABLE_AUX 0x0002 /**< Characteristic Extended Property: Writable Auxiliaries. */ +#define BLE_ATT_EXT_RFU 0xFFFC /**< Characteristic Extended Property: Reserved for Future Use. */ /** @} */ -/** @brief Characteristic Base UUID. */ +/**@brief Characteristic Base UUID. */ #define BLE_ATT_BT_UUID_128 {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} - /** @brief Change a 16-bit UUID array to a 128-bit one (append 0). * @param uuid: 16-bit UUID * @retval None */ #define BLE_ATT_16_TO_128_ARRAY(uuid) {(uuid) & 0xFF, ((uuid) >> 8) & 0xFF, 0x00, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } - + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } /** @brief Change a 16-bit UUID array to a 16-bit one (append 0). * @param uuid: 16-bit UUID * @retval None @@ -108,854 +104,442 @@ /** @addtogroup BLE_ATT_ENUMERATIONS Enumerations * @{ */ -/** @brief Attribute Specification Definitions: Common 16-bit (Universal Unique Identifier). */ -typedef enum { - BLE_ATT_INVALID_UUID = BLE_ATT_UUID_16(0x0000), - /**< Invalid UUID. */ +/**@brief Attribute Specification Definitions: Common 16-bit (Universal Unique Identifier). */ +typedef enum +{ + BLE_ATT_INVALID_UUID = BLE_ATT_UUID_16(0x0000), /**< Invalid UUID. */ /*----------------- SERVICES ---------------------*/ - BLE_ATT_SVC_GENERIC_ACCESS = BLE_ATT_UUID_16(0x1800), - /**< Generic Access Profile. */ - BLE_ATT_SVC_GENERIC_ATTRIBUTE = BLE_ATT_UUID_16(0x1801), - /**< Attribute Profile. */ - BLE_ATT_SVC_IMMEDIATE_ALERT = BLE_ATT_UUID_16(0x1802), - /**< Immediate Alert Service. */ - BLE_ATT_SVC_LINK_LOSS = BLE_ATT_UUID_16(0x1803), - /**< Link Loss Service. */ - BLE_ATT_SVC_TX_POWER = BLE_ATT_UUID_16(0x1804), - /**< TX Power Service. */ - BLE_ATT_SVC_CURRENT_TIME = BLE_ATT_UUID_16(0x1805), - /**< Current Time Service. */ - BLE_ATT_SVC_REF_TIME_UPDATE = BLE_ATT_UUID_16(0x1806), - /**< Reference Time Update Service. */ - BLE_ATT_SVC_NEXT_DST_CHANGE = BLE_ATT_UUID_16(0x1807), - /**< Next DST Change Service. */ - BLE_ATT_SVC_GLUCOSE = BLE_ATT_UUID_16(0x1808), - /**< Glucose Service. */ - BLE_ATT_SVC_HEALTH_THERMOM = BLE_ATT_UUID_16(0x1809), - /**< Health Thermometer Service. */ - BLE_ATT_SVC_DEVICE_INFO = BLE_ATT_UUID_16(0x180A), - /**< Device Information Service. */ - BLE_ATT_SVC_HEART_RATE = BLE_ATT_UUID_16(0x180D), - /**< Heart Rate Service. */ - BLE_ATT_SVC_PHONE_ALERT_STATUS = BLE_ATT_UUID_16(0x180E), - /**< Phone Alert Status Service. */ - BLE_ATT_SVC_BATTERY_SERVICE = BLE_ATT_UUID_16(0x180F), - /**< Battery Service. */ - BLE_ATT_SVC_BLOOD_PRESSURE = BLE_ATT_UUID_16(0x1810), - /**< Blood Pressure Service. */ - BLE_ATT_SVC_ALERT_NTF = BLE_ATT_UUID_16(0x1811), - /**< Alert Notification Service. */ - BLE_ATT_SVC_HID = BLE_ATT_UUID_16(0x1812), - /**< HID Service. */ - BLE_ATT_SVC_SCAN_PARAMETERS = BLE_ATT_UUID_16(0x1813), - /**< Scan Parameters Service. */ - BLE_ATT_SVC_RUNNING_SPEED_CADENCE = BLE_ATT_UUID_16(0x1814), - /**< Running Speed and Cadence Service. */ - BLE_ATT_SVC_CYCLING_SPEED_CADENCE = BLE_ATT_UUID_16(0x1816), - /**< Cycling Speed and Cadence Service. */ - BLE_ATT_SVC_CYCLING_POWER = BLE_ATT_UUID_16(0x1818), - /**< Cycling Power Service. */ - BLE_ATT_SVC_LOCATION_AND_NAVIGATION = BLE_ATT_UUID_16(0x1819), - /**< Location and Navigation Service. */ - BLE_ATT_SVC_ENVIRONMENTAL_SENSING = BLE_ATT_UUID_16(0x181A), - /**< Environmental Sensing Service. */ - BLE_ATT_SVC_BODY_COMPOSITION = BLE_ATT_UUID_16(0x181B), - /**< Body Composition Service. */ - BLE_ATT_SVC_USER_DATA = BLE_ATT_UUID_16(0x181C), - /**< User Data Service. */ - BLE_ATT_SVC_WEIGHT_SCALE = BLE_ATT_UUID_16(0x181D), - /**< Weight Scale Service. */ - BLE_ATT_SVC_BOND_MANAGEMENT = BLE_ATT_UUID_16(0x181E), - /**< Bond Management Service. */ - BLE_ATT_SVC_CONTINUOUS_GLUCOSE_MONITORING = BLE_ATT_UUID_16(0x181F), - /**< Continuous Glucose Monitoring Service. */ - BLE_ATT_SVC_IP_SUPPORT = BLE_ATT_UUID_16(0x1820), - /**< Internet Protocol Support Service. */ - BLE_ATT_SVC_INDOOR_POSITIONING = BLE_ATT_UUID_16(0x1821), - /**< Indoor Positioning Service. */ - BLE_ATT_SVC_PULSE_OXIMETER = BLE_ATT_UUID_16(0x1822), - /**< Pulse Oximeter Service. */ - BLE_ATT_SVC_HTTP_PROXY = BLE_ATT_UUID_16(0x1823), - /**< HTTP Proxy Service. */ - BLE_ATT_SVC_TRANSPORT_DISCOVERY = BLE_ATT_UUID_16(0x1824), - /**< Transport Discovery Service. */ - BLE_ATT_SVC_OBJECT_TRANSFER = BLE_ATT_UUID_16(0x1825), - /**< Object Transfer Service. */ + BLE_ATT_SVC_GENERIC_ACCESS = BLE_ATT_UUID_16(0x1800), /**< Generic Access Profile. */ + BLE_ATT_SVC_GENERIC_ATTRIBUTE = BLE_ATT_UUID_16(0x1801), /**< Attribute Profile. */ + BLE_ATT_SVC_IMMEDIATE_ALERT = BLE_ATT_UUID_16(0x1802), /**< Immediate Alert Service. */ + BLE_ATT_SVC_LINK_LOSS = BLE_ATT_UUID_16(0x1803), /**< Link Loss Service. */ + BLE_ATT_SVC_TX_POWER = BLE_ATT_UUID_16(0x1804), /**< TX Power Service. */ + BLE_ATT_SVC_CURRENT_TIME = BLE_ATT_UUID_16(0x1805), /**< Current Time Service. */ + BLE_ATT_SVC_REF_TIME_UPDATE = BLE_ATT_UUID_16(0x1806), /**< Reference Time Update Service. */ + BLE_ATT_SVC_NEXT_DST_CHANGE = BLE_ATT_UUID_16(0x1807), /**< Next DST Change Service. */ + BLE_ATT_SVC_GLUCOSE = BLE_ATT_UUID_16(0x1808), /**< Glucose Service. */ + BLE_ATT_SVC_HEALTH_THERMOM = BLE_ATT_UUID_16(0x1809), /**< Health Thermometer Service. */ + BLE_ATT_SVC_DEVICE_INFO = BLE_ATT_UUID_16(0x180A), /**< Device Information Service. */ + BLE_ATT_SVC_HEART_RATE = BLE_ATT_UUID_16(0x180D), /**< Heart Rate Service. */ + BLE_ATT_SVC_PHONE_ALERT_STATUS = BLE_ATT_UUID_16(0x180E), /**< Phone Alert Status Service. */ + BLE_ATT_SVC_BATTERY_SERVICE = BLE_ATT_UUID_16(0x180F), /**< Battery Service. */ + BLE_ATT_SVC_BLOOD_PRESSURE = BLE_ATT_UUID_16(0x1810), /**< Blood Pressure Service. */ + BLE_ATT_SVC_ALERT_NTF = BLE_ATT_UUID_16(0x1811), /**< Alert Notification Service. */ + BLE_ATT_SVC_HID = BLE_ATT_UUID_16(0x1812), /**< HID Service. */ + BLE_ATT_SVC_SCAN_PARAMETERS = BLE_ATT_UUID_16(0x1813), /**< Scan Parameters Service. */ + BLE_ATT_SVC_RUNNING_SPEED_CADENCE = BLE_ATT_UUID_16(0x1814), /**< Running Speed and Cadence Service. */ + BLE_ATT_SVC_CYCLING_SPEED_CADENCE = BLE_ATT_UUID_16(0x1816), /**< Cycling Speed and Cadence Service. */ + BLE_ATT_SVC_CYCLING_POWER = BLE_ATT_UUID_16(0x1818), /**< Cycling Power Service. */ + BLE_ATT_SVC_LOCATION_AND_NAVIGATION = BLE_ATT_UUID_16(0x1819), /**< Location and Navigation Service. */ + BLE_ATT_SVC_ENVIRONMENTAL_SENSING = BLE_ATT_UUID_16(0x181A), /**< Environmental Sensing Service. */ + BLE_ATT_SVC_BODY_COMPOSITION = BLE_ATT_UUID_16(0x181B), /**< Body Composition Service. */ + BLE_ATT_SVC_USER_DATA = BLE_ATT_UUID_16(0x181C), /**< User Data Service. */ + BLE_ATT_SVC_WEIGHT_SCALE = BLE_ATT_UUID_16(0x181D), /**< Weight Scale Service. */ + BLE_ATT_SVC_BOND_MANAGEMENT = BLE_ATT_UUID_16(0x181E), /**< Bond Management Service. */ + BLE_ATT_SVC_CONTINUOUS_GLUCOSE_MONITORING = BLE_ATT_UUID_16(0x181F), /**< Continuous Glucose Monitoring Service. */ + BLE_ATT_SVC_IP_SUPPORT = BLE_ATT_UUID_16(0x1820), /**< Internet Protocol Support Service. */ + BLE_ATT_SVC_INDOOR_POSITIONING = BLE_ATT_UUID_16(0x1821), /**< Indoor Positioning Service. */ + BLE_ATT_SVC_PULSE_OXIMETER = BLE_ATT_UUID_16(0x1822), /**< Pulse Oximeter Service. */ + BLE_ATT_SVC_HTTP_PROXY = BLE_ATT_UUID_16(0x1823), /**< HTTP Proxy Service. */ + BLE_ATT_SVC_TRANSPORT_DISCOVERY = BLE_ATT_UUID_16(0x1824), /**< Transport Discovery Service. */ + BLE_ATT_SVC_OBJECT_TRANSFER = BLE_ATT_UUID_16(0x1825), /**< Object Transfer Service. */ /*------------------- UNITS ---------------------*/ - BLE_ATT_UNIT_UNITLESS = BLE_ATT_UUID_16(0x2700), - /**< No defined unit. */ - BLE_ATT_UNIT_METRE = BLE_ATT_UUID_16(0x2701), - /**< Length unit: meter. */ - BLE_ATT_UNIT_KG = BLE_ATT_UUID_16(0x2702), - /**< Mass unit: kilogram. */ - BLE_ATT_UNIT_SECOND = BLE_ATT_UUID_16(0x2703), - /**< Time unit: second. */ - BLE_ATT_UNIT_AMPERE = BLE_ATT_UUID_16(0x2704), - /**< Electric current unit: ampere. */ - BLE_ATT_UNIT_KELVIN = BLE_ATT_UUID_16(0x2705), - /**< Thermodynamic Temperature unit: kelvin. */ - BLE_ATT_UNIT_MOLE = BLE_ATT_UUID_16(0x2706), - /**< Amount of substance unit: mole. */ - BLE_ATT_UNIT_CANDELA = BLE_ATT_UUID_16(0x2707), - /**< Luminous intensity unit: candela. */ - BLE_ATT_UNIT_SQ_METRE = BLE_ATT_UUID_16(0x2710), - /**< Area unit: square meter. */ - BLE_ATT_UNIT_CUBIC_METRE = BLE_ATT_UUID_16(0x2710), - /**< Column unit: cubic meter. */ - BLE_ATT_UNIT_METRE_PER_SECOND = BLE_ATT_UUID_16(0x2711), - /**< Velocity unit: meter per second. */ - BLE_ATT_UNIT_METRES_PER_SEC_SQ = BLE_ATT_UUID_16(0x2712), - /**< Acceleration unit: meter per second squared. */ - BLE_ATT_UNIT_RECIPROCAL_METRE = BLE_ATT_UUID_16(0x2713), - /**< Wavenumber unit: reciprocal meter. */ - BLE_ATT_UNIT_DENS_KG_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2714), - /**< Density unit: kilogram per cubic meter. */ - BLE_ATT_UNIT_KG_PER_SQ_METRE = BLE_ATT_UUID_16(0x2715), - /**< Surface density unit: (kg/m^2)kilogram per square meter. */ - BLE_ATT_UNIT_CUBIC_METRE_PER_KG = BLE_ATT_UUID_16(0x2716), - /**< Specific volume unit: cubic meter per kilogram. */ - BLE_ATT_UNIT_AMPERE_PER_SQ_METRE = BLE_ATT_UUID_16(0x2717), - /**< Current density unit: ampere per square meter. */ - BLE_ATT_UNIT_AMPERE_PER_METRE = BLE_ATT_UUID_16(0x2718), - /**< Magnetic field strength unit: ampere per meter. */ - BLE_ATT_UNIT_MOLE_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2719), - /**< Amount concentration unit: mole per cubic meter. */ - BLE_ATT_UNIT_MASS_KG_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x271A), - /**< Mass Concentration unit: kilogram per cubic meter. */ - BLE_ATT_UNIT_CANDELA_PER_SQ_METRE = BLE_ATT_UUID_16(0x271B), - /**< Luminance unit: candela per square meter. */ - BLE_ATT_UNIT_REFRACTIVE_INDEX = BLE_ATT_UUID_16(0x271C), - /**< Refractive index unit. */ - BLE_ATT_UNIT_RELATIVE_PERMEABILITY = BLE_ATT_UUID_16(0x271D), - /**< Relative permeability unit. */ - BLE_ATT_UNIT_RADIAN = BLE_ATT_UUID_16(0x2720), - /**< Plane angle unit: radian. */ - BLE_ATT_UNIT_STERADIAN = BLE_ATT_UUID_16(0x2721), - /**< Solid angle unit: steradian. */ - BLE_ATT_UNIT_HERTZ = BLE_ATT_UUID_16(0x2722), - /**< Frequency unit: hertz. */ - BLE_ATT_UNIT_NEWTON = BLE_ATT_UUID_16(0x2723), - /**< Force unit: newton. */ - BLE_ATT_UNIT_PASCAL = BLE_ATT_UUID_16(0x2724), - /**< Pressure unit: pascal. */ - BLE_ATT_UNIT_JOULE = BLE_ATT_UUID_16(0x2725), - /**< Energy unit: joule. */ - BLE_ATT_UNIT_WATT = BLE_ATT_UUID_16(0x2726), - /**< Power unit: watt. */ - BLE_ATT_UNIT_COULOMB = BLE_ATT_UUID_16(0x2727), - /**< Electric Charge unit: coulomb. */ - BLE_ATT_UNIT_VOLT = BLE_ATT_UUID_16(0x2728), - /**< Electric potential difference unit: Volt. */ - BLE_ATT_UNIT_FARAD = BLE_ATT_UUID_16(0x2729), - /**< Capacitance unit: Farad. */ - BLE_ATT_UNIT_OHM = BLE_ATT_UUID_16(0x272A), - /**< Electric resistance unit: ohm. */ - BLE_ATT_UNIT_SIEMENS = BLE_ATT_UUID_16(0x272B), - /**< Electric conductance unit: siemens. */ - BLE_ATT_UNIT_WEBER = BLE_ATT_UUID_16(0x272C), - /**< Magnetic flux unit: weber. */ - BLE_ATT_UNIT_TESLA = BLE_ATT_UUID_16(0x272D), - /**< Magnetic flux density unit: Tesla. */ - BLE_ATT_UNIT_HENRY = BLE_ATT_UUID_16(0x272E), - /**< Inductance unit: henry. */ - BLE_ATT_UNIT_CELSIUS = BLE_ATT_UUID_16(0x272F), - /**< Temperature unit: degree Celsius. */ - BLE_ATT_UNIT_LUMEN = BLE_ATT_UUID_16(0x2730), - /**< Luminous flux unit: lumen. */ - BLE_ATT_UNIT_LUX = BLE_ATT_UUID_16(0x2731), - /**< Illuminance unit: lux. */ - BLE_ATT_UNIT_BECQUEREL = BLE_ATT_UUID_16(0x2732), - /**< Enable referred to a radionuclide unit: becquerel. */ - BLE_ATT_UNIT_GRAY = BLE_ATT_UUID_16(0x2733), - /**< Absorbed dose unit: gray. */ - BLE_ATT_UNIT_SIEVERT = BLE_ATT_UUID_16(0x2734), - /**< Dose equivalent unit: sievert. */ - BLE_ATT_UNIT_KATAL = BLE_ATT_UUID_16(0x2735), - /**< Catalytic enable unit: katal. */ - BLE_ATT_UNIT_PASCAL_SECOND = BLE_ATT_UUID_16(0x2740), - /**< Synamic viscosity unit: pascal second. */ - BLE_ATT_UNIT_NEWTON_METRE = BLE_ATT_UUID_16(0x2741), - /**< Moment of force unit: (N.m)newton meter. */ - BLE_ATT_UNIT_NEWTON_PER_METRE = BLE_ATT_UUID_16(0x2742), - /**< Surface tension unit: newton per meter. */ - BLE_ATT_UNIT_RADIAN_PER_SECOND = BLE_ATT_UUID_16(0x2743), - /**< Angular velocity unit: radian per second. */ - BLE_ATT_UNIT_RADIAN_PER_SECOND_SQ = BLE_ATT_UUID_16(0x2744), - /**< Angular acceleration unit: radian per second squared. */ - BLE_ATT_UNIT_WATT_PER_SQ_METRE = BLE_ATT_UUID_16(0x2745), - /**< Heat flux density unit: watt per square meter. */ - BLE_ATT_UNIT_JOULE_PER_KELVIN = BLE_ATT_UUID_16(0x2746), - /**< Heat capacity unit: joule per Kelvin. */ - BLE_ATT_UNIT_JOULE_PER_KG_KELVIN = BLE_ATT_UUID_16(0x2747), - /**< Specific heat capacity unit: joule per kilogram kelvin. */ - BLE_ATT_UNIT_JOULE_PER_KG = BLE_ATT_UUID_16(0x2748), - /**< Specific Energy unit: joule per kilogram. */ - BLE_ATT_UNIT_WATT_PER_METRE_KELVIN = BLE_ATT_UUID_16(0x2749), - /**< Thermal conductivity unit: watt per meter Kelvin. */ - BLE_ATT_UNIT_JOULE_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x274A), - /**< Energy Density unit: joule per cubic meter. */ - BLE_ATT_UNIT_VOLT_PER_METRE = BLE_ATT_UUID_16(0x274B), - /**< Electric field strength unit: volt per meter. */ - BLE_ATT_UNIT_COULOMB_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x274C), - /**< Electric charge density unit: coulomb per cubic meter. */ - BLE_ATT_UNIT_SURF_COULOMB_PER_SQ_METRE = BLE_ATT_UUID_16(0x274D), - /**< Surface charge density unit: coulomb/(square meter). */ - BLE_ATT_UNIT_FLUX_COULOMB_PER_SQ_METRE = BLE_ATT_UUID_16(0x274E), - /**< Electric flux density unit: coulomb per square meter. */ - BLE_ATT_UNIT_FARAD_PER_METRE = BLE_ATT_UUID_16(0x274F), - /**< Permittivity unit: farad per meter. */ - BLE_ATT_UNIT_HENRY_PER_METRE = BLE_ATT_UUID_16(0x2750), - /**< Permeability unit: henry per meter. */ - BLE_ATT_UNIT_JOULE_PER_MOLE = BLE_ATT_UUID_16(0x2751), - /**< Molar energy unit: joule per mole. */ - BLE_ATT_UNIT_JOULE_PER_MOLE_KELVIN = BLE_ATT_UUID_16(0x2752), - /**< Molar entropy unit: joule per mole kelvin. */ - BLE_ATT_UNIT_COULOMB_PER_KG = BLE_ATT_UUID_16(0x2753), - /**< Exposure unit: coulomb per kilogram. */ - BLE_ATT_UNIT_GRAY_PER_SECOND = BLE_ATT_UUID_16(0x2754), - /**< Absorbed dose rate unit: gray per second. */ - BLE_ATT_UNIT_WATT_PER_STERADIAN = BLE_ATT_UUID_16(0x2755), - /**< Radiant intensity unit: watt per steradian. */ - BLE_ATT_UNIT_WATT_PER_SQ_METRE_STERADIAN = BLE_ATT_UUID_16(0x2756), - /**< Radiance unit: watt per square meter steradian. */ - BLE_ATT_UNIT_KATAL_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2757), - /**< Catalytic active - concentration unit: katal per cubic meter. */ - BLE_ATT_UNIT_MINUTE = BLE_ATT_UUID_16(0x2760), - /**< Time unit: minute. */ - BLE_ATT_UNIT_HOUR = BLE_ATT_UUID_16(0x2761), - /**< Time unit: hour. */ - BLE_ATT_UNIT_DAY = BLE_ATT_UUID_16(0x2762), - /**< Time unit: day. */ - BLE_ATT_UNIT_ANGLE_DEGREE = BLE_ATT_UUID_16(0x2763), - /**< Plane angle unit: degree. */ - BLE_ATT_UNIT_ANGLE_MINUTE = BLE_ATT_UUID_16(0x2764), - /**< Plane angle unit: minute. */ - BLE_ATT_UNIT_ANGLE_SECOND = BLE_ATT_UUID_16(0x2765), - /**< Plane angle unit: second. */ - BLE_ATT_UNIT_HECTARE = BLE_ATT_UUID_16(0x2766), - /**< Area unit: hectare. */ - BLE_ATT_UNIT_LITRE = BLE_ATT_UUID_16(0x2767), - /**< Volume unit: litre. */ - BLE_ATT_UNIT_TONNE = BLE_ATT_UUID_16(0x2768), - /**< Mass unit: tonne. */ - BLE_ATT_UNIT_BAR = BLE_ATT_UUID_16(0x2780), - /**< Pressure unit: bar. */ - BLE_ATT_UNIT_MM_MERCURY = BLE_ATT_UUID_16(0x2781), - /**< Pressure unit: millimetre of mercury. */ - BLE_ATT_UNIT_ANGSTROM = BLE_ATT_UUID_16(0x2782), - /**< Length unit: angstrom. */ - BLE_ATT_UNIT_NAUTICAL_MILE = BLE_ATT_UUID_16(0x2783), - /**< Length unit: nautical mile. */ - BLE_ATT_UNIT_BARN = BLE_ATT_UUID_16(0x2784), - /**< Area unit: barn. */ - BLE_ATT_UNIT_KNOT = BLE_ATT_UUID_16(0x2785), - /**< Velocity unit: knot. */ - BLE_ATT_UNIT_NEPER = BLE_ATT_UUID_16(0x2786), - /**< Logarithmic radio quantity unit: neper. */ - BLE_ATT_UNIT_BEL = BLE_ATT_UUID_16(0x2787), - /**< Logarithmic radio quantity unit: bel. */ - BLE_ATT_UNIT_YARD = BLE_ATT_UUID_16(0x27A0), - /**< Length unit: yard. */ - BLE_ATT_UNIT_PARSEC = BLE_ATT_UUID_16(0x27A1), - /**< Length unit: parsec. */ - BLE_ATT_UNIT_INCH = BLE_ATT_UUID_16(0x27A2), - /**< Length unit: inch. */ - BLE_ATT_UNIT_FOOT = BLE_ATT_UUID_16(0x27A3), - /**< Length unit: foot. */ - BLE_ATT_UNIT_MILE = BLE_ATT_UUID_16(0x27A4), - /**< Length unit: mile. */ - BLE_ATT_UNIT_POUND_FORCE_PER_SQ_INCH = BLE_ATT_UUID_16(0x27A5), - /**< Pressure unit: pound-force per square inch. */ - BLE_ATT_UNIT_KM_PER_HOUR = BLE_ATT_UUID_16(0x27A6), - /**< Velocity unit: kilometre per hour. */ - BLE_ATT_UNIT_MILE_PER_HOUR = BLE_ATT_UUID_16(0x27A7), - /**< Velocity unit: mile per hour. */ - BLE_ATT_UNIT_REVOLUTION_PER_MINUTE = BLE_ATT_UUID_16(0x27A8), - /**< Angular velocity unit: revolution per minute. */ - BLE_ATT_UNIT_GRAM_CALORIE = BLE_ATT_UUID_16(0x27A9), - /**< Energy unit: gram calorie. */ - BLE_ATT_UNIT_KG_CALORIE = BLE_ATT_UUID_16(0x27AA), - /**< Energy unit: kilogram calorie. */ - BLE_ATT_UNIT_KILOWATT_HOUR = BLE_ATT_UUID_16(0x27AB), - /**< Energy unit: kilowatt hour. */ - BLE_ATT_UNIT_FAHRENHEIT = BLE_ATT_UUID_16(0x27AC), - /**< Thermodynamic temperature unit: degree Fahrenheit. */ - BLE_ATT_UNIT_PERCENTAGE = BLE_ATT_UUID_16(0x27AD), - /**< Unit: Percentage. */ - BLE_ATT_UNIT_PER_MILLE = BLE_ATT_UUID_16(0x27AE), - /**< Unit: per mille. */ - BLE_ATT_UNIT_BEATS_PER_MINUTE = BLE_ATT_UUID_16(0x27AF), - /**< Period unit: beats per minute. */ - BLE_ATT_UNIT_AMPERE_HOURS = BLE_ATT_UUID_16(0x27B0), - /**< Electric charge unit: ampere hours. */ - BLE_ATT_UNIT_MILLIGRAM_PER_DECILITRE = BLE_ATT_UUID_16(0x27B1), - /**< Mass density unit: milligram per decilitre. */ - BLE_ATT_UNIT_MILLIMOLE_PER_LITRE = BLE_ATT_UUID_16(0x27B2), - /**< Mass density unit: millimole per litre. */ - BLE_ATT_UNIT_YEAR = BLE_ATT_UUID_16(0x27B3), - /**< Time unit: year. */ - BLE_ATT_UNIT_MONTH = BLE_ATT_UUID_16(0x27B4), - /**< Time unit: month. */ + BLE_ATT_UNIT_UNITLESS = BLE_ATT_UUID_16(0x2700), /**< No defined unit. */ + BLE_ATT_UNIT_METRE = BLE_ATT_UUID_16(0x2701), /**< Length unit: meter. */ + BLE_ATT_UNIT_KG = BLE_ATT_UUID_16(0x2702), /**< Mass unit: kilogram. */ + BLE_ATT_UNIT_SECOND = BLE_ATT_UUID_16(0x2703), /**< Time unit: second. */ + BLE_ATT_UNIT_AMPERE = BLE_ATT_UUID_16(0x2704), /**< Electric current unit: ampere. */ + BLE_ATT_UNIT_KELVIN = BLE_ATT_UUID_16(0x2705), /**< Thermodynamic Temperature unit: kelvin. */ + BLE_ATT_UNIT_MOLE = BLE_ATT_UUID_16(0x2706), /**< Amount of substance unit: mole. */ + BLE_ATT_UNIT_CANDELA = BLE_ATT_UUID_16(0x2707), /**< Luminous intensity unit: candela. */ + BLE_ATT_UNIT_SQ_METRE = BLE_ATT_UUID_16(0x2710), /**< Area unit: square meter. */ + BLE_ATT_UNIT_CUBIC_METRE = BLE_ATT_UUID_16(0x2710), /**< Column unit: cubic meter. */ + BLE_ATT_UNIT_METRE_PER_SECOND = BLE_ATT_UUID_16(0x2711), /**< Velocity unit: meter per second. */ + BLE_ATT_UNIT_METRES_PER_SEC_SQ = BLE_ATT_UUID_16(0x2712), /**< Acceleration unit: meter per second squared. */ + BLE_ATT_UNIT_RECIPROCAL_METRE = BLE_ATT_UUID_16(0x2713), /**< Wavenumber unit: reciprocal meter. */ + BLE_ATT_UNIT_DENS_KG_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2714), /**< Density unit: kilogram per cubic meter. */ + BLE_ATT_UNIT_KG_PER_SQ_METRE = BLE_ATT_UUID_16(0x2715), /**< Surface density unit: kilogram per square meter. */ + BLE_ATT_UNIT_CUBIC_METRE_PER_KG = BLE_ATT_UUID_16(0x2716), /**< Specific volume unit: cubic meter per kilogram. */ + BLE_ATT_UNIT_AMPERE_PER_SQ_METRE = BLE_ATT_UUID_16(0x2717), /**< Current density unit: ampere per square meter. */ + BLE_ATT_UNIT_AMPERE_PER_METRE = BLE_ATT_UUID_16(0x2718), /**< Magnetic field strength unit: ampere per meter. */ + BLE_ATT_UNIT_MOLE_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2719), /**< Amount concentration unit: mole per cubic meter. */ + BLE_ATT_UNIT_MASS_KG_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x271A), /**< Mass Concentration unit: kilogram per cubic meter. */ + BLE_ATT_UNIT_CANDELA_PER_SQ_METRE = BLE_ATT_UUID_16(0x271B), /**< Luminance unit: candela per square meter. */ + BLE_ATT_UNIT_REFRACTIVE_INDEX = BLE_ATT_UUID_16(0x271C), /**< Refractive index unit. */ + BLE_ATT_UNIT_RELATIVE_PERMEABILITY = BLE_ATT_UUID_16(0x271D), /**< Relative permeability unit. */ + BLE_ATT_UNIT_RADIAN = BLE_ATT_UUID_16(0x2720), /**< Plane angle unit: radian. */ + BLE_ATT_UNIT_STERADIAN = BLE_ATT_UUID_16(0x2721), /**< Solid angle unit: steradian. */ + BLE_ATT_UNIT_HERTZ = BLE_ATT_UUID_16(0x2722), /**< Frequency unit: hertz. */ + BLE_ATT_UNIT_NEWTON = BLE_ATT_UUID_16(0x2723), /**< Force unit: newton. */ + BLE_ATT_UNIT_PASCAL = BLE_ATT_UUID_16(0x2724), /**< Pressure unit: pascal. */ + BLE_ATT_UNIT_JOULE = BLE_ATT_UUID_16(0x2725), /**< Energy unit: joule. */ + BLE_ATT_UNIT_WATT = BLE_ATT_UUID_16(0x2726), /**< Power unit: watt. */ + BLE_ATT_UNIT_COULOMB = BLE_ATT_UUID_16(0x2727), /**< Electric Charge unit: coulomb. */ + BLE_ATT_UNIT_VOLT = BLE_ATT_UUID_16(0x2728), /**< Electric potential difference unit: Volt. */ + BLE_ATT_UNIT_FARAD = BLE_ATT_UUID_16(0x2729), /**< Capacitance unit: Farad. */ + BLE_ATT_UNIT_OHM = BLE_ATT_UUID_16(0x272A), /**< Electric resistance unit: ohm. */ + BLE_ATT_UNIT_SIEMENS = BLE_ATT_UUID_16(0x272B), /**< Electric conductance unit: siemens. */ + BLE_ATT_UNIT_WEBER = BLE_ATT_UUID_16(0x272C), /**< Magnetic flux unit: weber. */ + BLE_ATT_UNIT_TESLA = BLE_ATT_UUID_16(0x272D), /**< Magnetic flux density unit: Tesla. */ + BLE_ATT_UNIT_HENRY = BLE_ATT_UUID_16(0x272E), /**< Inductance unit: henry. */ + BLE_ATT_UNIT_CELSIUS = BLE_ATT_UUID_16(0x272F), /**< Temperature unit: degree Celsius. */ + BLE_ATT_UNIT_LUMEN = BLE_ATT_UUID_16(0x2730), /**< Luminous flux unit: lumen. */ + BLE_ATT_UNIT_LUX = BLE_ATT_UUID_16(0x2731), /**< Illuminance unit: lux. */ + BLE_ATT_UNIT_BECQUEREL = BLE_ATT_UUID_16(0x2732), /**< Activity referred to a radionuclide unit: becquerel. */ + BLE_ATT_UNIT_GRAY = BLE_ATT_UUID_16(0x2733), /**< Absorbed dose unit: gray. */ + BLE_ATT_UNIT_SIEVERT = BLE_ATT_UUID_16(0x2734), /**< Dose equivalent unit: sievert. */ + BLE_ATT_UNIT_KATAL = BLE_ATT_UUID_16(0x2735), /**< Catalytic activity unit: katal. */ + BLE_ATT_UNIT_PASCAL_SECOND = BLE_ATT_UUID_16(0x2740), /**< Synamic viscosity unit: pascal second. */ + BLE_ATT_UNIT_NEWTON_METRE = BLE_ATT_UUID_16(0x2741), /**< Moment of force unit: newton meter. */ + BLE_ATT_UNIT_NEWTON_PER_METRE = BLE_ATT_UUID_16(0x2742), /**< Surface tension unit: newton per meter. */ + BLE_ATT_UNIT_RADIAN_PER_SECOND = BLE_ATT_UUID_16(0x2743), /**< Angular velocity unit: radian per second. */ + BLE_ATT_UNIT_RADIAN_PER_SECOND_SQ = BLE_ATT_UUID_16(0x2744), /**< Angular acceleration unit: radian per second squared. */ + BLE_ATT_UNIT_WATT_PER_SQ_METRE = BLE_ATT_UUID_16(0x2745), /**< Heat flux density unit: watt per square meter. */ + BLE_ATT_UNIT_JOULE_PER_KELVIN = BLE_ATT_UUID_16(0x2746), /**< Heat capacity unit: joule per Kelvin. */ + BLE_ATT_UNIT_JOULE_PER_KG_KELVIN = BLE_ATT_UUID_16(0x2747), /**< Specific heat capacity unit: joule per kilogram kelvin. */ + BLE_ATT_UNIT_JOULE_PER_KG = BLE_ATT_UUID_16(0x2748), /**< Specific Energy unit: joule per kilogram. */ + BLE_ATT_UNIT_WATT_PER_METRE_KELVIN = BLE_ATT_UUID_16(0x2749), /**< Thermal conductivity unit: watt per meter Kelvin. */ + BLE_ATT_UNIT_JOULE_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x274A), /**< Energy Density unit: joule per cubic meter. */ + BLE_ATT_UNIT_VOLT_PER_METRE = BLE_ATT_UUID_16(0x274B), /**< Electric field strength unit: volt per meter. */ + BLE_ATT_UNIT_COULOMB_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x274C), /**< Electric charge density unit: coulomb per cubic meter. */ + BLE_ATT_UNIT_SURF_COULOMB_PER_SQ_METRE = BLE_ATT_UUID_16(0x274D), /**< Surface charge density unit: coulomb per square meter. */ + BLE_ATT_UNIT_FLUX_COULOMB_PER_SQ_METRE = BLE_ATT_UUID_16(0x274E), /**< Electric flux density unit: coulomb per square meter. */ + BLE_ATT_UNIT_FARAD_PER_METRE = BLE_ATT_UUID_16(0x274F), /**< Permittivity unit: farad per meter. */ + BLE_ATT_UNIT_HENRY_PER_METRE = BLE_ATT_UUID_16(0x2750), /**< Permeability unit: henry per meter. */ + BLE_ATT_UNIT_JOULE_PER_MOLE = BLE_ATT_UUID_16(0x2751), /**< Molar energy unit: joule per mole. */ + BLE_ATT_UNIT_JOULE_PER_MOLE_KELVIN = BLE_ATT_UUID_16(0x2752), /**< Molar entropy unit: joule per mole kelvin. */ + BLE_ATT_UNIT_COULOMB_PER_KG = BLE_ATT_UUID_16(0x2753), /**< Exposure unit: coulomb per kilogram. */ + BLE_ATT_UNIT_GRAY_PER_SECOND = BLE_ATT_UUID_16(0x2754), /**< Absorbed dose rate unit: gray per second. */ + BLE_ATT_UNIT_WATT_PER_STERADIAN = BLE_ATT_UUID_16(0x2755), /**< Radiant intensity unit: watt per steradian. */ + BLE_ATT_UNIT_WATT_PER_SQ_METRE_STERADIAN = BLE_ATT_UUID_16(0x2756), /**< Radiance unit: watt per square meter steradian. */ + BLE_ATT_UNIT_KATAL_PER_CUBIC_METRE = BLE_ATT_UUID_16(0x2757), /**< Catalytic activity concentration unit: katal per cubic meter. */ + BLE_ATT_UNIT_MINUTE = BLE_ATT_UUID_16(0x2760), /**< Time unit: minute. */ + BLE_ATT_UNIT_HOUR = BLE_ATT_UUID_16(0x2761), /**< Time unit: hour. */ + BLE_ATT_UNIT_DAY = BLE_ATT_UUID_16(0x2762), /**< Time unit: day. */ + BLE_ATT_UNIT_ANGLE_DEGREE = BLE_ATT_UUID_16(0x2763), /**< Plane angle unit: degree. */ + BLE_ATT_UNIT_ANGLE_MINUTE = BLE_ATT_UUID_16(0x2764), /**< Plane angle unit: minute. */ + BLE_ATT_UNIT_ANGLE_SECOND = BLE_ATT_UUID_16(0x2765), /**< Plane angle unit: second. */ + BLE_ATT_UNIT_HECTARE = BLE_ATT_UUID_16(0x2766), /**< Area unit: hectare. */ + BLE_ATT_UNIT_LITRE = BLE_ATT_UUID_16(0x2767), /**< Volume unit: litre. */ + BLE_ATT_UNIT_TONNE = BLE_ATT_UUID_16(0x2768), /**< Mass unit: tonne. */ + BLE_ATT_UNIT_BAR = BLE_ATT_UUID_16(0x2780), /**< Pressure unit: bar. */ + BLE_ATT_UNIT_MM_MERCURY = BLE_ATT_UUID_16(0x2781), /**< Pressure unit: millimetre of mercury. */ + BLE_ATT_UNIT_ANGSTROM = BLE_ATT_UUID_16(0x2782), /**< Length unit: angstrom. */ + BLE_ATT_UNIT_NAUTICAL_MILE = BLE_ATT_UUID_16(0x2783), /**< Length unit: nautical mile. */ + BLE_ATT_UNIT_BARN = BLE_ATT_UUID_16(0x2784), /**< Area unit: barn. */ + BLE_ATT_UNIT_KNOT = BLE_ATT_UUID_16(0x2785), /**< Velocity unit: knot. */ + BLE_ATT_UNIT_NEPER = BLE_ATT_UUID_16(0x2786), /**< Logarithmic radio quantity unit: neper. */ + BLE_ATT_UNIT_BEL = BLE_ATT_UUID_16(0x2787), /**< Logarithmic radio quantity unit: bel. */ + BLE_ATT_UNIT_YARD = BLE_ATT_UUID_16(0x27A0), /**< Length unit: yard. */ + BLE_ATT_UNIT_PARSEC = BLE_ATT_UUID_16(0x27A1), /**< Length unit: parsec. */ + BLE_ATT_UNIT_INCH = BLE_ATT_UUID_16(0x27A2), /**< Length unit: inch. */ + BLE_ATT_UNIT_FOOT = BLE_ATT_UUID_16(0x27A3), /**< Length unit: foot. */ + BLE_ATT_UNIT_MILE = BLE_ATT_UUID_16(0x27A4), /**< Length unit: mile. */ + BLE_ATT_UNIT_POUND_FORCE_PER_SQ_INCH = BLE_ATT_UUID_16(0x27A5), /**< Pressure unit: pound-force per square inch. */ + BLE_ATT_UNIT_KM_PER_HOUR = BLE_ATT_UUID_16(0x27A6), /**< Velocity unit: kilometre per hour. */ + BLE_ATT_UNIT_MILE_PER_HOUR = BLE_ATT_UUID_16(0x27A7), /**< Velocity unit: mile per hour. */ + BLE_ATT_UNIT_REVOLUTION_PER_MINUTE = BLE_ATT_UUID_16(0x27A8), /**< Angular velocity unit: revolution per minute. */ + BLE_ATT_UNIT_GRAM_CALORIE = BLE_ATT_UUID_16(0x27A9), /**< Energy unit: gram calorie. */ + BLE_ATT_UNIT_KG_CALORIE = BLE_ATT_UUID_16(0x27AA), /**< Energy unit: kilogram calorie. */ + BLE_ATT_UNIT_KILOWATT_HOUR = BLE_ATT_UUID_16(0x27AB), /**< Energy unit: kilowatt hour. */ + BLE_ATT_UNIT_FAHRENHEIT = BLE_ATT_UUID_16(0x27AC), /**< Thermodynamic temperature unit: degree Fahrenheit. */ + BLE_ATT_UNIT_PERCENTAGE = BLE_ATT_UUID_16(0x27AD), /**< Unit: Percentage. */ + BLE_ATT_UNIT_PER_MILLE = BLE_ATT_UUID_16(0x27AE), /**< Unit: per mille. */ + BLE_ATT_UNIT_BEATS_PER_MINUTE = BLE_ATT_UUID_16(0x27AF), /**< Period unit: beats per minute. */ + BLE_ATT_UNIT_AMPERE_HOURS = BLE_ATT_UUID_16(0x27B0), /**< Electric charge unit: ampere hours. */ + BLE_ATT_UNIT_MILLIGRAM_PER_DECILITRE = BLE_ATT_UUID_16(0x27B1), /**< Mass density unit: milligram per decilitre. */ + BLE_ATT_UNIT_MILLIMOLE_PER_LITRE = BLE_ATT_UUID_16(0x27B2), /**< Mass density unit: millimole per litre. */ + BLE_ATT_UNIT_YEAR = BLE_ATT_UUID_16(0x27B3), /**< Time unit: year. */ + BLE_ATT_UNIT_MONTH = BLE_ATT_UUID_16(0x27B4), /**< Time unit: month. */ /*---------------- DECLARATIONS -----------------*/ - BLE_ATT_DECL_PRIMARY_SERVICE = BLE_ATT_UUID_16(0x2800), - /**< Primary service Declaration. */ - BLE_ATT_DECL_SECONDARY_SERVICE = BLE_ATT_UUID_16(0x2801), - /**< Secondary service Declaration. */ - BLE_ATT_DECL_INCLUDE = BLE_ATT_UUID_16(0x2802), - /**< Include Declaration. */ - BLE_ATT_DECL_CHARACTERISTIC = BLE_ATT_UUID_16(0x2803), - /**< Characteristic Declaration. */ + BLE_ATT_DECL_PRIMARY_SERVICE = BLE_ATT_UUID_16(0x2800), /**< Primary service Declaration. */ + BLE_ATT_DECL_SECONDARY_SERVICE = BLE_ATT_UUID_16(0x2801), /**< Secondary service Declaration. */ + BLE_ATT_DECL_INCLUDE = BLE_ATT_UUID_16(0x2802), /**< Include Declaration. */ + BLE_ATT_DECL_CHARACTERISTIC = BLE_ATT_UUID_16(0x2803), /**< Characteristic Declaration. */ - /*----------------- DESCRIPTORS -----------------*/ - BLE_ATT_DESC_CHAR_EXT_PROPERTIES = BLE_ATT_UUID_16(0x2900), - /**< Characteristic extended properties. */ - BLE_ATT_DESC_CHAR_USER_DESCRIPTION = BLE_ATT_UUID_16(0x2901), - /**< Characteristic user description. */ - BLE_ATT_DESC_CLIENT_CHAR_CFG = BLE_ATT_UUID_16(0x2902), - /**< Client characteristic configuration. */ - BLE_ATT_DESC_SERVER_CHAR_CFG = BLE_ATT_UUID_16(0x2903), - /**< Server characteristic configuration. */ - BLE_ATT_DESC_CHAR_PRES_FORMAT = BLE_ATT_UUID_16(0x2904), - /**< Characteristic Presentation Format. */ - BLE_ATT_DESC_CHAR_AGGREGATE_FORMAT = BLE_ATT_UUID_16(0x2905), - /**< Characteristic Aggregate Format. */ - BLE_ATT_DESC_VALID_RANGE = BLE_ATT_UUID_16(0x2906), - /**< Valid Range. */ - BLE_ATT_DESC_EXT_REPORT_REF = BLE_ATT_UUID_16(0x2907), - /**< External Report Reference. */ - BLE_ATT_DESC_REPORT_REF = BLE_ATT_UUID_16(0x2908), - /**< Report Reference. */ - BLE_ATT_DESC_ES_CONFIGURATION = BLE_ATT_UUID_16(0x290B), - /**< Environmental Sensing Configuration. */ - BLE_ATT_DESC_ES_MEASUREMENT = BLE_ATT_UUID_16(0x290C), - /**< Environmental Sensing Measurement. */ - BLE_ATT_DESC_ES_TRIGGER_SETTING = BLE_ATT_UUID_16(0x290D), - /**< Environmental Sensing Trigger Setting. */ + /*----------------- DESCRIPTORS -----------------*/ + BLE_ATT_DESC_CHAR_EXT_PROPERTIES = BLE_ATT_UUID_16(0x2900), /**< Characteristic extended properties. */ + BLE_ATT_DESC_CHAR_USER_DESCRIPTION = BLE_ATT_UUID_16(0x2901), /**< Characteristic user description. */ + BLE_ATT_DESC_CLIENT_CHAR_CFG = BLE_ATT_UUID_16(0x2902), /**< Client characteristic configuration. */ + BLE_ATT_DESC_SERVER_CHAR_CFG = BLE_ATT_UUID_16(0x2903), /**< Server characteristic configuration. */ + BLE_ATT_DESC_CHAR_PRES_FORMAT = BLE_ATT_UUID_16(0x2904), /**< Characteristic Presentation Format. */ + BLE_ATT_DESC_CHAR_AGGREGATE_FORMAT = BLE_ATT_UUID_16(0x2905), /**< Characteristic Aggregate Format. */ + BLE_ATT_DESC_VALID_RANGE = BLE_ATT_UUID_16(0x2906), /**< Valid Range. */ + BLE_ATT_DESC_EXT_REPORT_REF = BLE_ATT_UUID_16(0x2907), /**< External Report Reference. */ + BLE_ATT_DESC_REPORT_REF = BLE_ATT_UUID_16(0x2908), /**< Report Reference. */ + BLE_ATT_DESC_ES_CONFIGURATION = BLE_ATT_UUID_16(0x290B), /**< Environmental Sensing Configuration. */ + BLE_ATT_DESC_ES_MEASUREMENT = BLE_ATT_UUID_16(0x290C), /**< Environmental Sensing Measurement. */ + BLE_ATT_DESC_ES_TRIGGER_SETTING = BLE_ATT_UUID_16(0x290D), /**< Environmental Sensing Trigger Setting. */ /*--------------- CHARACTERISTICS ---------------*/ - BLE_ATT_CHAR_DEVICE_NAME = BLE_ATT_UUID_16(0x2A00), - /**< Device name. */ - BLE_ATT_CHAR_APPEARANCE = BLE_ATT_UUID_16(0x2A01), - /**< Appearance. */ - BLE_ATT_CHAR_PRIVACY_FLAG = BLE_ATT_UUID_16(0x2A02), - /**< Privacy flag. */ - BLE_ATT_CHAR_RECONNECTION_ADDR = BLE_ATT_UUID_16(0x2A03), - /**< Reconnection address. */ - BLE_ATT_CHAR_PERIPH_PREF_CON_PARAM = BLE_ATT_UUID_16(0x2A04), - /**< Peripheral preferred connection parameters. */ - BLE_ATT_CHAR_SERVICE_CHANGED = BLE_ATT_UUID_16(0x2A05), - /**< Service handles changed. */ - BLE_ATT_CHAR_ALERT_LEVEL = BLE_ATT_UUID_16(0x2A06), - /**< Alert Level characteristic. */ - BLE_ATT_CHAR_TX_POWER_LEVEL = BLE_ATT_UUID_16(0x2A07), - /**< Tx Power Level. */ - BLE_ATT_CHAR_DATE_TIME = BLE_ATT_UUID_16(0x2A08), - /**< Date Time. */ - BLE_ATT_CHAR_DAY_WEEK = BLE_ATT_UUID_16(0x2A09), - /**< Day of Week. */ - BLE_ATT_CHAR_DAY_DATE_TIME = BLE_ATT_UUID_16(0x2A0A), - /**< Day Date Time. */ - BLE_ATT_CHAR_EXACT_TIME_256 = BLE_ATT_UUID_16(0x2A0C), - /**< Exact time 256. */ - BLE_ATT_CHAR_DST_OFFSET = BLE_ATT_UUID_16(0x2A0D), - /**< DST Offset. */ - BLE_ATT_CHAR_TIME_ZONE = BLE_ATT_UUID_16(0x2A0E), - /**< Time zone. */ - BLE_ATT_CHAR_LOCAL_TIME_INFO = BLE_ATT_UUID_16(0x2A0F), - /**< Local time Information. */ - BLE_ATT_CHAR_TIME_WITH_DST = BLE_ATT_UUID_16(0x2A11), - /**< Time with DST. */ - BLE_ATT_CHAR_TIME_ACCURACY = BLE_ATT_UUID_16(0x2A12), - /**< Time Accuracy. */ - BLE_ATT_CHAR_TIME_SOURCE = BLE_ATT_UUID_16(0x2A13), - /**< Time Source. */ - BLE_ATT_CHAR_REFERENCE_TIME_INFO = BLE_ATT_UUID_16(0x2A14), - /**< Reference Time Information. */ - BLE_ATT_CHAR_TIME_UPDATE_CNTL_POINT = BLE_ATT_UUID_16(0x2A16), - /**< Time Update Control Point. */ - BLE_ATT_CHAR_TIME_UPDATE_STATE = BLE_ATT_UUID_16(0x2A17), - /**< Time Update State. */ - BLE_ATT_CHAR_GLUCOSE_MEAS = BLE_ATT_UUID_16(0x2A18), - /**< Glucose Measurement. */ - BLE_ATT_CHAR_BATTERY_LEVEL = BLE_ATT_UUID_16(0x2A19), - /**< Battery Level. */ - BLE_ATT_CHAR_TEMPERATURE_MEAS = BLE_ATT_UUID_16(0x2A1C), - /**< Temperature Measurement. */ - BLE_ATT_CHAR_TEMPERATURE_TYPE = BLE_ATT_UUID_16(0x2A1D), - /**< Temperature Type. */ - BLE_ATT_CHAR_INTERMED_TEMPERATURE = BLE_ATT_UUID_16(0x2A1E), - /**< Intermediate Temperature. */ - BLE_ATT_CHAR_MEAS_INTERVAL = BLE_ATT_UUID_16(0x2A21), - /**< Measurement Interval. */ - BLE_ATT_CHAR_BOOT_KB_IN_REPORT = BLE_ATT_UUID_16(0x2A22), - /**< Boot Keyboard Input Report. */ - BLE_ATT_CHAR_SYS_ID = BLE_ATT_UUID_16(0x2A23), - /**< System ID. */ - BLE_ATT_CHAR_MODEL_NB = BLE_ATT_UUID_16(0x2A24), - /**< Model Number String. */ - BLE_ATT_CHAR_SERIAL_NB = BLE_ATT_UUID_16(0x2A25), - /**< Serial Number String. */ - BLE_ATT_CHAR_FW_REV = BLE_ATT_UUID_16(0x2A26), - /**< Firmware Revision String. */ - BLE_ATT_CHAR_HW_REV = BLE_ATT_UUID_16(0x2A27), - /**< Hardware revision String. */ - BLE_ATT_CHAR_SW_REV = BLE_ATT_UUID_16(0x2A28), - /**< Software Revision String. */ - BLE_ATT_CHAR_MANUF_NAME = BLE_ATT_UUID_16(0x2A29), - /**< Manufacturer Name String. */ - BLE_ATT_CHAR_IEEE_CERTIF = BLE_ATT_UUID_16(0x2A2A), - /**< IEEE Regulatory Certification Data List. */ - BLE_ATT_CHAR_CT_TIME = BLE_ATT_UUID_16(0x2A2B), - /**< CT Time. */ - BLE_ATT_CHAR_MAGN_DECLINE = BLE_ATT_UUID_16(0x2A2C), - /**< Magnetic Declination. */ - BLE_ATT_CHAR_SCAN_REFRESH = BLE_ATT_UUID_16(0x2A31), - /**< Scan Refresh. */ - BLE_ATT_CHAR_BOOT_KB_OUT_REPORT = BLE_ATT_UUID_16(0x2A32), - /**< Boot Keyboard Output Report. */ - BLE_ATT_CHAR_BOOT_MOUSE_IN_REPORT = BLE_ATT_UUID_16(0x2A33), - /**< Boot Mouse Input Report. */ - BLE_ATT_CHAR_GLUCOSE_MEAS_CTX = BLE_ATT_UUID_16(0x2A34), - /**< Glucose Measurement Context. */ - BLE_ATT_CHAR_BLOOD_PRESSURE_MEAS = BLE_ATT_UUID_16(0x2A35), - /**< Blood Pressure Measurement. */ - BLE_ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE = BLE_ATT_UUID_16(0x2A36), - /**< Intermediate Cuff Pressure. */ - BLE_ATT_CHAR_HEART_RATE_MEAS = BLE_ATT_UUID_16(0x2A37), - /**< Heart Rate Measurement. */ - BLE_ATT_CHAR_BODY_SENSOR_LOCATION = BLE_ATT_UUID_16(0x2A38), - /**< Body Sensor Location. */ - BLE_ATT_CHAR_HEART_RATE_CNTL_POINT = BLE_ATT_UUID_16(0x2A39), - /**< Heart Rate Control Point. */ - BLE_ATT_CHAR_ALERT_STATUS = BLE_ATT_UUID_16(0x2A3F), - /**< Alert Status. */ - BLE_ATT_CHAR_RINGER_CNTL_POINT = BLE_ATT_UUID_16(0x2A40), - /**< Ringer Control Point. */ - BLE_ATT_CHAR_RINGER_SETTING = BLE_ATT_UUID_16(0x2A41), - /**< Ringer Setting. */ - BLE_ATT_CHAR_ALERT_CAT_ID_BIT_MASK = BLE_ATT_UUID_16(0x2A42), - /**< Alert Category ID Bit Mask. */ - BLE_ATT_CHAR_ALERT_CAT_ID = BLE_ATT_UUID_16(0x2A43), - /**< Alert Category ID. */ - BLE_ATT_CHAR_ALERT_NTF_CTNL_PT = BLE_ATT_UUID_16(0x2A44), - /**< Alert Notification Control Point. */ - BLE_ATT_CHAR_UNREAD_ALERT_STATUS = BLE_ATT_UUID_16(0x2A45), - /**< Unread Alert Status. */ - BLE_ATT_CHAR_NEW_ALERT = BLE_ATT_UUID_16(0x2A46), - /**< New Alert. */ - BLE_ATT_CHAR_SUP_NEW_ALERT_CAT = BLE_ATT_UUID_16(0x2A47), - /**< Supported New Alert Category. */ - BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT = BLE_ATT_UUID_16(0x2A48), - /**< Supported Unread Alert Category. */ - BLE_ATT_CHAR_BLOOD_PRESSURE_FEATURE = BLE_ATT_UUID_16(0x2A49), - /**< Blood Pressure Feature. */ - BLE_ATT_CHAR_HID_INFO = BLE_ATT_UUID_16(0x2A4A), - /**< HID Information. */ - BLE_ATT_CHAR_REPORT_MAP = BLE_ATT_UUID_16(0x2A4B), - /**< Report Map. */ - BLE_ATT_CHAR_HID_CTNL_PT = BLE_ATT_UUID_16(0x2A4C), - /**< HID Control Point. */ - BLE_ATT_CHAR_REPORT = BLE_ATT_UUID_16(0x2A4D), - /**< Report. */ - BLE_ATT_CHAR_PROTOCOL_MODE = BLE_ATT_UUID_16(0x2A4E), - /**< Protocol Mode. */ - BLE_ATT_CHAR_SCAN_INTV_WD = BLE_ATT_UUID_16(0x2A4F), - /**< Scan Interval Window. */ - BLE_ATT_CHAR_PNP_ID = BLE_ATT_UUID_16(0x2A50), - /**< PnP ID. */ - BLE_ATT_CHAR_GLUCOSE_FEATURE = BLE_ATT_UUID_16(0x2A51), - /**< Glucose Feature. */ - BLE_ATT_CHAR_REC_ACCESS_CTRL_PT = BLE_ATT_UUID_16(0x2A52), - /**< Record access control point. */ - BLE_ATT_CHAR_RSC_MEAS = BLE_ATT_UUID_16(0x2A53), - /**< RSC Measurement. */ - BLE_ATT_CHAR_RSC_FEAT = BLE_ATT_UUID_16(0x2A54), - /**< RSC Feature. */ - BLE_ATT_CHAR_SC_CNTL_PT = BLE_ATT_UUID_16(0x2A55), - /**< SC Control Point. */ - BLE_ATT_CHAR_CSC_MEAS = BLE_ATT_UUID_16(0x2A5B), - /**< CSC Measurement. */ - BLE_ATT_CHAR_CSC_FEAT = BLE_ATT_UUID_16(0x2A5C), - /**< CSC Feature. */ - BLE_ATT_CHAR_SENSOR_LOC = BLE_ATT_UUID_16(0x2A5D), - /**< Sensor Location. */ - BLE_ATT_CHAR_PLX_SPOT_CHECK_MEASUREMENT_LOC = BLE_ATT_UUID_16(0x2A5E), - /**< PLX Spot-Check Measurement. */ - BLE_ATT_CHAR_PLX_CONTINUOUS_MEASUREMENT_LOC = BLE_ATT_UUID_16(0x2A5F), - /**< PLX Continuous Measurement. */ - BLE_ATT_CHAR_PLX_FEATURES_LOC = BLE_ATT_UUID_16(0x2A60), - /**< PLX Features. */ - BLE_ATT_CHAR_CP_MEAS = BLE_ATT_UUID_16(0x2A63), - /**< CP Measurement. */ - BLE_ATT_CHAR_CP_VECTOR = BLE_ATT_UUID_16(0x2A64), - /**< CP Vector. */ - BLE_ATT_CHAR_CP_FEAT = BLE_ATT_UUID_16(0x2A65), - /**< CP Feature. */ - BLE_ATT_CHAR_CP_CNTL_PT = BLE_ATT_UUID_16(0x2A66), - /**< CP Control Point. */ - BLE_ATT_CHAR_LOC_SPEED = BLE_ATT_UUID_16(0x2A67), - /**< Location and Speed. */ - BLE_ATT_CHAR_NAVIGATION = BLE_ATT_UUID_16(0x2A68), - /**< Navigation. */ - BLE_ATT_CHAR_POS_QUALITY = BLE_ATT_UUID_16(0x2A69), - /**< Position Quality. */ - BLE_ATT_CHAR_LN_FEAT = BLE_ATT_UUID_16(0x2A6A), - /**< LN Feature. */ - BLE_ATT_CHAR_LN_CNTL_PT = BLE_ATT_UUID_16(0x2A6B), - /**< LN Control Point. */ - BLE_ATT_CHAR_ELEVATION = BLE_ATT_UUID_16(0x2A6C), - /**< Elevation. */ - BLE_ATT_CHAR_PRESSURE = BLE_ATT_UUID_16(0x2A6D), - /**< Pressure. */ - BLE_ATT_CHAR_TEMPERATURE = BLE_ATT_UUID_16(0x2A6E), - /**< Temperature. */ - BLE_ATT_CHAR_HUMIDITY = BLE_ATT_UUID_16(0x2A6F), - /**< Humidity. */ - BLE_ATT_CHAR_TRUE_WIND_SPEED = BLE_ATT_UUID_16(0x2A70), - /**< True Wind Speed. */ - BLE_ATT_CHAR_TRUE_WIND_DIR = BLE_ATT_UUID_16(0x2A71), - /**< True Wind Direction. */ - BLE_ATT_CHAR_APRNT_WIND_SPEED = BLE_ATT_UUID_16(0x2A72), - /**< Apparent Wind Speed. */ - BLE_ATT_CHAR_APRNT_WIND_DIRECTION = BLE_ATT_UUID_16(0x2A73), - /**< Apparent Wind Direction. */ - BLE_ATT_CHAR_GUST_FACTOR = BLE_ATT_UUID_16(0x2A74), - /**< Gust Factor. */ - BLE_ATT_CHAR_POLLEN_CONC = BLE_ATT_UUID_16(0x2A75), - /**< Pollen Concentration. */ - BLE_ATT_CHAR_UV_INDEX = BLE_ATT_UUID_16(0x2A76), - /**< UV Index. */ - BLE_ATT_CHAR_IRRADIANCE = BLE_ATT_UUID_16(0x2A77), - /**< Irradiance. */ - BLE_ATT_CHAR_RAINFALL = BLE_ATT_UUID_16(0x2A78), - /**< Rainfall. */ - BLE_ATT_CHAR_WIND_CHILL = BLE_ATT_UUID_16(0x2A79), - /**< Wind Chill. */ - BLE_ATT_CHAR_HEAT_INDEX = BLE_ATT_UUID_16(0x2A7A), - /**< Heat Index. */ - BLE_ATT_CHAR_DEW_POINT = BLE_ATT_UUID_16(0x2A7B), - /**< Dew Point. */ - BLE_ATT_CHAR_DESCRIPTOR_VALUE_CHANGED = BLE_ATT_UUID_16(0x2A7D), - /**< Descriptor Value Changed. */ - BLE_ATT_CHAR_AEROBIC_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A7E), - /**< Aerobic Heart Rate Lower Limit. */ - BLE_ATT_CHAR_AEROBIC_THRESHOLD = BLE_ATT_UUID_16(0x2A7F), - /**< Aerobic Threshold. */ - BLE_ATT_CHAR_AGE = BLE_ATT_UUID_16(0x2A80), - /**< Age. */ - BLE_ATT_CHAR_ANAEROBIC_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A81), - /**< Anaerobic Heart Rate Lower Limit. */ - BLE_ATT_CHAR_ANAEROBIC_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A82), - /**< Anaerobic Heart Rate Upper Limit. */ - BLE_ATT_CHAR_ANAEROBIC_THRESHHOLD = BLE_ATT_UUID_16(0x2A83), - /**< Anaerobic Threshhold. */ - BLE_ATT_CHAR_AEROBIC_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A84), - /**< Aerobic Heart Rate Upper Limit. */ - BLE_ATT_CHAR_DATE_OF_BIRTH = BLE_ATT_UUID_16(0x2A85), - /**< Date of Birth. */ - BLE_ATT_CHAR_DATE_OF_THRESHOLD_ASSESSMENT = BLE_ATT_UUID_16(0x2A86), - /**< Date of Threshold Assessment. */ - BLE_ATT_CHAR_EMAIL_ADDRESS = BLE_ATT_UUID_16(0x2A87), - /**< Email Address. */ - BLE_ATT_CHAR_FAT_BURN_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A88), - /**< Fat Burn Heart Rate Lower Limit. */ - BLE_ATT_CHAR_FAT_BURN_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A89), - /**< Fat Burn Heart Rate Upper Limit. */ - BLE_ATT_CHAR_FIRST_NAME = BLE_ATT_UUID_16(0x2A8A), - /**< First Name. */ - BLE_ATT_CHAR_FIVE_ZONE_HEART_RATE_LIMITS = BLE_ATT_UUID_16(0x2A8B), - /**< Five Zone Heart Rate Limits. */ - BLE_ATT_CHAR_GENDER = BLE_ATT_UUID_16(0x2A8C), - /**< Gender. */ - BLE_ATT_CHAR_MAX_HEART_RATE = BLE_ATT_UUID_16(0x2A8D), - /**< Max Heart Rate. */ - BLE_ATT_CHAR_HEIGHT = BLE_ATT_UUID_16(0x2A8E), - /**< Height. */ - BLE_ATT_CHAR_HIP_CIRCUMFERENCE = BLE_ATT_UUID_16(0x2A8F), - /**< Hip Circumference. */ - BLE_ATT_CHAR_LAST_NAME = BLE_ATT_UUID_16(0x2A90), - /**< Last Name. */ - BLE_ATT_CHAR_MAXIMUM_RECOMMENDED_HEART_RATE = BLE_ATT_UUID_16(0x2A91), - /**< Maximum Recommended Heart Rate. */ - BLE_ATT_CHAR_RESTING_HEART_RATE = BLE_ATT_UUID_16(0x2A92), - /**< Resting Heart Rate. */ - BLE_ATT_CHAR_SPORT_TYPE_FOR_AEROBIC_AND_ANAEROBIC_THRESHOLDS = BLE_ATT_UUID_16(0x2A93), - /**< Sport Type For Aerobic And Anaerobic Thresholds. */ - BLE_ATT_CHAR_THREE_ZONE_HEART_RATE_LIMITS = BLE_ATT_UUID_16(0x2A94), - /**< Three Zone Heart Rate Limits. */ - BLE_ATT_CHAR_TWO_ZONE_HEART_RATE_LIMIT = BLE_ATT_UUID_16(0x2A95), - /**< Two Zone Heart Rate Limits. */ - BLE_ATT_CHAR_VO2_MAX = BLE_ATT_UUID_16(0x2A96), - /**< Vo2 Max. */ - BLE_ATT_CHAR_WAIST_CIRCUMFERENCE = BLE_ATT_UUID_16(0x2A97), - /**< Waist Circumference. */ - BLE_ATT_CHAR_WEIGHT = BLE_ATT_UUID_16(0x2A98), - /**< Weight. */ - BLE_ATT_CHAR_DATABASE_CHANGE_INCREMENT = BLE_ATT_UUID_16(0x2A99), - /**< Database Change Increment. */ - BLE_ATT_CHAR_USER_INDEX = BLE_ATT_UUID_16(0x2A9A), - /**< User Index. */ - BLE_ATT_CHAR_BODY_COMPOSITION_FEATURE = BLE_ATT_UUID_16(0x2A9B), - /**< Body Composition Feature. */ - BLE_ATT_CHAR_BODY_COMPOSITION_MEASUREMENT = BLE_ATT_UUID_16(0x2A9C), - /**< Body Composition Measurement. */ - BLE_ATT_CHAR_WEIGHT_MEASUREMENT = BLE_ATT_UUID_16(0x2A9D), - /**< Weight Measurement. */ - BLE_ATT_CHAR_WEIGHT_SCALE_FEATURE = BLE_ATT_UUID_16(0x2A9E), - /**< Weight Scale Feature. */ - BLE_ATT_CHAR_USER_CONTROL_POINT = BLE_ATT_UUID_16(0x2A9F), - /**< User Control Point. */ - BLE_ATT_CHAR_MAGN_FLUX_2D = BLE_ATT_UUID_16(0x2AA0), - /**< Flux Density - 2D. */ - BLE_ATT_CHAR_MAGN_FLUX_3D = BLE_ATT_UUID_16(0x2AA1), - /**< Magnetic Flux Density - 3D. */ - BLE_ATT_CHAR_LANGUAGE = BLE_ATT_UUID_16(0x2AA2), - /**< Language string. */ - BLE_ATT_CHAR_BAR_PRES_TREND = BLE_ATT_UUID_16(0x2AA3), - /**< Barometric Pressure Trend. */ - BLE_ATT_CHAR_CTL_ADDR_RESOL_SUPP = BLE_ATT_UUID_16(0x2AA6), - /**< Central Address Resolution Support. */ - BLE_ATT_CHAR_OTS_FEATURES = BLE_ATT_UUID_16(0x2ABD), - /**< OTS Service Feature. */ - BLE_ATT_CHAR_OTS_OBJECT_NAME = BLE_ATT_UUID_16(0x2ABE), - /**< Object Name. */ - BLE_ATT_CHAR_OTS_OBJECT_TYPE = BLE_ATT_UUID_16(0x2ABF), - /**< Object Type. */ - BLE_ATT_CHAR_OTS_OBJECT_SIZE = BLE_ATT_UUID_16(0x2AC0), - /**< Object Size. */ - BLE_ATT_CHAR_OTS_OBJECT_FIRST_CREATED = BLE_ATT_UUID_16(0x2AC1), - /**< Object First Created. */ - BLE_ATT_CHAR_OTS_OBJECT_LAST_MODIFIED = BLE_ATT_UUID_16(0x2AC2), - /**< Object Last Modified. */ - BLE_ATT_CHAR_OTS_OBJECT_ID = BLE_ATT_UUID_16(0x2AC3), - /**< Object ID. */ - BLE_ATT_CHAR_OTS_OBJECT_PROPERTIES = BLE_ATT_UUID_16(0x2AC4), - /**< Object Properties. */ - BLE_ATT_CHAR_OTS_OACP = BLE_ATT_UUID_16(0x2AC5), - /**< Object Action Control Point. */ - BLE_ATT_CHAR_OTS_OLCP = BLE_ATT_UUID_16(0x2AC6), - /**< Object List Control Point. */ - BLE_ATT_CHAR_OTS_LF = BLE_ATT_UUID_16(0x2AC7), - /**< Object List Filter. */ - BLE_ATT_CHAR_OTS_OBJECT_CHANGED = BLE_ATT_UUID_16(0x2AC8), - /**< Object Changed. */ - BLE_ATT_CHAR_RSLV_PRIV_ADDR_ONLY = BLE_ATT_UUID_16(0x2AC9), - /**< Resolvable Private Address only. */ - - BLE_ATT_CHAR_UNSPECIFIED = BLE_ATT_UUID_16(0X2ACA), - /**< Unspecified. */ - BLE_ATT_CHAR_DIRE_LISTING = BLE_ATT_UUID_16(0X2ACB), - /**< Directory Listing. */ - BLE_ATT_CHAR_FIT_MACH_FEAT = BLE_ATT_UUID_16(0X2ACC), - /**< Fitness Machine Feature. */ - BLE_ATT_CHAR_TREADMILL_DATA = BLE_ATT_UUID_16(0X2ACD), - /**< Treadmill Data. */ - BLE_ATT_CHAR_CROSS_TRAINER_DATA = BLE_ATT_UUID_16(0X2ACE), - /**< Cross Trainer Data. */ - BLE_ATT_CHAR_STEP_CLIMBER_DATA = BLE_ATT_UUID_16(0X2ACF), - /**< Step Climber Data. */ - BLE_ATT_CHAR_STSIR_CLIMBER_DATA = BLE_ATT_UUID_16(0X2AD0), - /**< Stair Climber Data. */ - BLE_ATT_CHAR_ROWER_DATA = BLE_ATT_UUID_16(0X2AD1), - /**< Rower Data. */ - BLE_ATT_CHAR_INDOOR_BIKE_DATA = BLE_ATT_UUID_16(0X2AD2), - /**< Indoor Bike Data. */ - BLE_ATT_CHAR_TRAIN_STATUS = BLE_ATT_UUID_16(0X2AD3), - /**< Training Status. */ - BLE_ATT_CHAR_SUP_SPEED_RANGE = BLE_ATT_UUID_16(0X2AD4), - /**< Supported Speed Range. */ - BLE_ATT_CHAR_SUP_INCL_RANGE = BLE_ATT_UUID_16(0X2AD5), - /**< Supported Inclination Range. */ - BLE_ATT_CHAR_SUP_RESIST_LEVEL_RANGE = BLE_ATT_UUID_16(0X2AD6), - /**< Supported Resistance Level Range. */ - BLE_ATT_CHAR_SUP_HEART_RATE_RANGE = BLE_ATT_UUID_16(0X2AD7), - /**< Supported Heart Rate Range. */ - BLE_ATT_CHAR_SUP_POWER_RANGE = BLE_ATT_UUID_16(0X2AD8), - /**< Supported Power Range. */ - BLE_ATT_CHAR_FIT_MACH_CNTL_PT = BLE_ATT_UUID_16(0X2AD9), - /**< Fitness Machine Control Point. */ - BLE_ATT_CHAR_FIT_MACH_STATUS = BLE_ATT_UUID_16(0X2ADA), - /**< Fitness Machine Status. */ - BLE_ATT_CHAR_MESH_PROV_DATA_IN = BLE_ATT_UUID_16(0X2ADB), - /**< Mesh Provisioning Data In. */ - BLE_ATT_CHAR_MESH_PROV_DATA_OUT = BLE_ATT_UUID_16(0X2ADC), - /**< Mesh Provisioning Data Out. */ - BLE_ATT_CHAR_MESH_PROX_DATA_IN = BLE_ATT_UUID_16(0X2ADD), - /**< Mesh Proxy Data In. */ - BLE_ATT_CHAR_MESH_PROX_DATA_OUT = BLE_ATT_UUID_16(0X2ADE), - /**< Mesh Proxy Data Out. */ - BLE_ATT_CHAR_AVG_CURRENT = BLE_ATT_UUID_16(0X2AE0), - /**< Average Current. */ - BLE_ATT_CHAR_AVG_VOLTAGE = BLE_ATT_UUID_16(0X2AE1), - /**< Average Voltage. */ - BLE_ATT_CHAR_BOOLEAN = BLE_ATT_UUID_16(0X2AE2), - /**< Boolean. */ - BLE_ATT_CHAR_CHROM_DIST_FROM_PLANCKIAN = BLE_ATT_UUID_16(0X2AE3), - /**< Chromatic Distance From Planckian. */ - BLE_ATT_CHAR_CHROM_COORD = BLE_ATT_UUID_16(0X2AE4), - /**< Chromaticity Coordinates. */ - BLE_ATT_CHAR_CHORM_IN_CCT_AND_DUV_VAL = BLE_ATT_UUID_16(0X2AE5), - /**< Chromaticity in CCT And Duv Values. */ - BLE_ATT_CHAR_CHROM_TOLERANCE = BLE_ATT_UUID_16(0X2AE6), - /**< Chromaticity Tolerance. */ - BLE_ATT_CHAR_CIE_COLOR_REND_IDX = BLE_ATT_UUID_16(0X2AE7), - /**< CIE 13.3-1995 Color Rendering Index. */ - BLE_ATT_CHAR_COEFFICIENT = BLE_ATT_UUID_16(0X2AE8), - /**< Coefficient. */ - BLE_ATT_CHAR_CORRELA_COLOR_TEMP = BLE_ATT_UUID_16(0X2AE9), - /**< Correlated Color Temperature. */ - BLE_ATT_CHAR_COUNT_SIXTEEN = BLE_ATT_UUID_16(0X2AEA), - /**< Count 16. */ - BLE_ATT_CHAR_COUNT_TWENTY_FOUR = BLE_ATT_UUID_16(0X2AEB), - /**< Count 24. */ - BLE_ATT_CHAR_COUNTRY_CODE = BLE_ATT_UUID_16(0X2AEC), - /**< Country Code. */ - BLE_ATT_CHAR_DATE_UTC = BLE_ATT_UUID_16(0X2AED), - /**< Date UTC. */ - BLE_ATT_CHAR_ELEC_CURRENT = BLE_ATT_UUID_16(0X2AEE), - /**< Electric Current. */ - BLE_ATT_CHAR_ELEC_CURRENT_RANGE = BLE_ATT_UUID_16(0X2AEF), - /**< Electric Current Range. */ - BLE_ATT_CHAR_ELEC_CURRENT_SPEC = BLE_ATT_UUID_16(0X2AF0), - /**< Electric Current Specification. */ - BLE_ATT_CHAR_ELEC_CURRENT_STATIS = BLE_ATT_UUID_16(0X2AF1), - /**< Electric Current Statistics. */ - BLE_ATT_CHAR_ENERGY = BLE_ATT_UUID_16(0X2AF2), - /**< Energy. */ - BLE_ATT_CHAR_ENERGY_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2AF3), - /**< Energy In A Period Of Day. */ - BLE_ATT_CHAR_EVENT_STATIC = BLE_ATT_UUID_16(0X2AF4), - /**< Event Statistics. */ - BLE_ATT_CHAR_FIXED_STR_SIXTEEN = BLE_ATT_UUID_16(0X2AF5), - /**< Fixed String 16. */ - BLE_ATT_CHAR_FIXED_STR_TWENTY_FOUR = BLE_ATT_UUID_16(0X2AF6), - /**< Fixed String 24. */ - BLE_ATT_CHAR_FIXED_STR_THIRTY_SIX = BLE_ATT_UUID_16(0X2AF7), - /**< Fixed String 36. */ - BLE_ATT_CHAR_FIXED_STR_EIGHT = BLE_ATT_UUID_16(0X2AF8), - /**< Fixed String 8. */ - BLE_ATT_CHAR_GENERIC_LEVEL = BLE_ATT_UUID_16(0X2AF9), - /**< Generic Level. */ - BLE_ATT_CHAR_GLOB_TRADE_ITEM_NUM = BLE_ATT_UUID_16(0X2AFA), - /**< Global Trade Item Number. */ - BLE_ATT_CHAR_ILLUMINANCE = BLE_ATT_UUID_16(0X2AFB), - /**< Illuminance. */ - BLE_ATT_CHAR_LUMI_EFFICACY = BLE_ATT_UUID_16(0X2AFC), - /**< Luminous Efficacy. */ - BLE_ATT_CHAR_LUMI_ENERGY = BLE_ATT_UUID_16(0X2AFD), - /**< Luminous Energy. */ - BLE_ATT_CHAR_LUMI_EXPOSURE = BLE_ATT_UUID_16(0X2AFE), - /**< Luminous Exposure. */ - BLE_ATT_CHAR_LUMI_FLUX = BLE_ATT_UUID_16(0X2AFE), - /**< Luminous Flux. */ - BLE_ATT_CHAR_LUMI_FLUX_RANGE = BLE_ATT_UUID_16(0X2B00), - /**< Luminous Flux Range. */ - BLE_ATT_CHAR_LUMI_INTENS = BLE_ATT_UUID_16(0X2B01), - /**< Luminous Intensity. */ - BLE_ATT_CHAR_MASS_FLOW = BLE_ATT_UUID_16(0X2B02), - /**< Mass Flow. */ - BLE_ATT_CHAR_PERCEIVED_LIGHT = BLE_ATT_UUID_16(0X2B03), - /**< Perceived Lightness. */ - BLE_ATT_CHAR_PERC_EIGHT = BLE_ATT_UUID_16(0X2B04), - /**< Percentage 8. */ - BLE_ATT_CHAR_POWER = BLE_ATT_UUID_16(0X2B05), - /**< Power. */ - BLE_ATT_CHAR_POWER_SPEC = BLE_ATT_UUID_16(0X2B06), - /**< Power Specification. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_CUR_RANGE = BLE_ATT_UUID_16(0X2B07), - /**< Relative Runtime In A Current Range. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_GEN_LEVEL_RANGE = BLE_ATT_UUID_16(0X2B08), - /**< Relative Runtime In A Generic Level Range. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_VOLT_RANGE = BLE_ATT_UUID_16(0X2B09), - /**< Relative Value In A Voltage Range. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_ILLUM_RANGE = BLE_ATT_UUID_16(0X2B0A), - /**< Relative Value In An Illuminance Range. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2B0B), - /**< Relative Value In A Period Of Day. */ - BLE_ATT_CHAR_RELAT_RUNTIME_IN_TEMP_RANGE = BLE_ATT_UUID_16(0X2B0C), - /**< Relative Value In A Temperature Range. */ - BLE_ATT_CHAR_TEMP_EIGHT = BLE_ATT_UUID_16(0X2B0D), - /**< Temperature 8. */ - BLE_ATT_CHAR_TEMP_EIGHT_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2B0E), - /**< Temperature 8 In A Period Of Day. */ - BLE_ATT_CHAR_TEMP_EIGHT_STATIS = BLE_ATT_UUID_16(0X2B0F), - /**< Temperature 8 Statistics. */ - BLE_ATT_CHAR_TEMP_RANGE = BLE_ATT_UUID_16(0X2B10), - /**< Temperature Range. */ - BLE_ATT_CHAR_TEMP_STATIS = BLE_ATT_UUID_16(0X2B11), - /**< Temperature Statistics. */ - BLE_ATT_CHAR_TIME_DECI_EIGHT = BLE_ATT_UUID_16(0X2B12), - /**< Time Decihour 8. */ - BLE_ATT_CHAR_TIME_EXPON_EIGHT = BLE_ATT_UUID_16(0X2B13), - /**< Time Exponential 8. */ - BLE_ATT_CHAR_TIME_HOUR_TWENTY_FOUR = BLE_ATT_UUID_16(0X2B14), - /**< Time Hour 24. */ - BLE_ATT_CHAR_TIME_MS_TWENTY_FOUR = BLE_ATT_UUID_16(0X2B15), - /**< Time Millisecond 24. */ - BLE_ATT_CHAR_TIME_SEC_SIXTEEN = BLE_ATT_UUID_16(0X2B16), - /**< Time Second 16. */ - BLE_ATT_CHAR_TIME_SEC_EIGHT = BLE_ATT_UUID_16(0X2B17), - /**< Time Second 8. */ - BLE_ATT_CHAR_VOLTAGE = BLE_ATT_UUID_16(0X2B18), - /**< Voltage. */ - BLE_ATT_CHAR_VOLTAGE_SPEC = BLE_ATT_UUID_16(0X2B19), - /**< Voltage Specification. */ - BLE_ATT_CHAR_VOLTAGE_STATIS = BLE_ATT_UUID_16(0X2B1A), - /**< Voltage Statistics. */ - BLE_ATT_CHAR_VOLUME_FLOW = BLE_ATT_UUID_16(0X2B1B), - /**< Volume Flow. */ - BLE_ATT_CHAR_CHROM_COORDINATE = BLE_ATT_UUID_16(0X2B1C), - /**< Chromaticity Coordinate. */ - - BLE_ATT_CHAR_RC_FEAT = BLE_ATT_UUID_16(0x2B1D), - /**< RC Feature. */ - BLE_ATT_CHAR_RC_SETTINGS = BLE_ATT_UUID_16(0x2B1E), - /**< RC Settings. */ - BLE_ATT_CHAR_RECONNEC_CONFIG_CNTL_PT = BLE_ATT_UUID_16(0x2B1F), - /**< Reconnection Configuration Control Point. */ - BLE_ATT_CHAR_IDD_STATUS_CHANGED = BLE_ATT_UUID_16(0x2B20), - /**< IDD Status Changed. */ - BLE_ATT_CHAR_IDD_STATUS = BLE_ATT_UUID_16(0x2B21), - /**< IDD Status. */ - BLE_ATT_CHAR_IDD_ANNU_STATUS = BLE_ATT_UUID_16(0x2B22), - /**< IDD Annunciation Status. */ - BLE_ATT_CHAR_IDD_FEAT = BLE_ATT_UUID_16(0x2B23), - /**< IDD Features. */ - BLE_ATT_CHAR_IDD_STATUS_READER_CNTL_PT = BLE_ATT_UUID_16(0x2B24), - /**< IDD Status Reader Control Point. */ - BLE_ATT_CHAR_IDD_COMMAND_CNTL_PT = BLE_ATT_UUID_16(0x2B25), - /**< IDD Command Control Point. */ - BLE_ATT_CHAR_IDD_COMMAND_DATA = BLE_ATT_UUID_16(0x2B26), - /**< IDD Command Data. */ - BLE_ATT_CHAR_IDD_RECORD_ACCESS_CNTL_PT = BLE_ATT_UUID_16(0x2B27), - /**< IDD Record Access Control Point. */ - BLE_ATT_CHAR_IDD_HISTORY_DATA = BLE_ATT_UUID_16(0x2B28), - /**< IDD History Data. */ - BLE_ATT_CHAR_CLI_SUP_FEAT = BLE_ATT_UUID_16(0x2B29), - /**< Client Supported Features. */ - BLE_ATT_CHAR_DB_HASH = BLE_ATT_UUID_16(0x2B2A), - /**< Database Hash. */ - BLE_ATT_CHAR_BSS_CNTL_PT = BLE_ATT_UUID_16(0x2B2B), - /**< BSS Control Point. */ - BLE_ATT_CHAR_BSS_RESPONSE = BLE_ATT_UUID_16(0x2B2C), - /**< BSS Response. */ - BLE_ATT_CHAR_EMERGENCY_ID = BLE_ATT_UUID_16(0x2B2D), - /**< Emergency ID. */ - BLE_ATT_CHAR_EMERGENCY_TEXT = BLE_ATT_UUID_16(0x2B2E), - /**< Emergency Text. */ - - BLE_ATT_CHAR_REGISTERED_USER = BLE_ATT_UUID_16(0x2B37), - /**< Registered User Characterisitc. */ - BLE_ATT_CHAR_SRV_SUP_FEAT = BLE_ATT_UUID_16(0x2B3A), - /**< Server Supported Features. */ -} att_uuid_t; + BLE_ATT_CHAR_DEVICE_NAME = BLE_ATT_UUID_16(0x2A00), /**< Device name. */ + BLE_ATT_CHAR_APPEARANCE = BLE_ATT_UUID_16(0x2A01), /**< Appearance. */ + BLE_ATT_CHAR_PRIVACY_FLAG = BLE_ATT_UUID_16(0x2A02), /**< Privacy flag. */ + BLE_ATT_CHAR_RECONNECTION_ADDR = BLE_ATT_UUID_16(0x2A03), /**< Reconnection address. */ + BLE_ATT_CHAR_PERIPH_PREF_CON_PARAM = BLE_ATT_UUID_16(0x2A04), /**< Peripheral preferred connection parameters. */ + BLE_ATT_CHAR_SERVICE_CHANGED = BLE_ATT_UUID_16(0x2A05), /**< Service handles changed. */ + BLE_ATT_CHAR_ALERT_LEVEL = BLE_ATT_UUID_16(0x2A06), /**< Alert Level characteristic. */ + BLE_ATT_CHAR_TX_POWER_LEVEL = BLE_ATT_UUID_16(0x2A07), /**< Tx Power Level. */ + BLE_ATT_CHAR_DATE_TIME = BLE_ATT_UUID_16(0x2A08), /**< Date Time. */ + BLE_ATT_CHAR_DAY_WEEK = BLE_ATT_UUID_16(0x2A09), /**< Day of Week. */ + BLE_ATT_CHAR_DAY_DATE_TIME = BLE_ATT_UUID_16(0x2A0A), /**< Day Date Time. */ + BLE_ATT_CHAR_EXACT_TIME_256 = BLE_ATT_UUID_16(0x2A0C), /**< Exact time 256. */ + BLE_ATT_CHAR_DST_OFFSET = BLE_ATT_UUID_16(0x2A0D), /**< DST Offset. */ + BLE_ATT_CHAR_TIME_ZONE = BLE_ATT_UUID_16(0x2A0E), /**< Time zone. */ + BLE_ATT_CHAR_LOCAL_TIME_INFO = BLE_ATT_UUID_16(0x2A0F), /**< Local time Information. */ + BLE_ATT_CHAR_TIME_WITH_DST = BLE_ATT_UUID_16(0x2A11), /**< Time with DST. */ + BLE_ATT_CHAR_TIME_ACCURACY = BLE_ATT_UUID_16(0x2A12), /**< Time Accuracy. */ + BLE_ATT_CHAR_TIME_SOURCE = BLE_ATT_UUID_16(0x2A13), /**< Time Source. */ + BLE_ATT_CHAR_REFERENCE_TIME_INFO = BLE_ATT_UUID_16(0x2A14), /**< Reference Time Information. */ + BLE_ATT_CHAR_TIME_UPDATE_CNTL_POINT = BLE_ATT_UUID_16(0x2A16), /**< Time Update Control Point. */ + BLE_ATT_CHAR_TIME_UPDATE_STATE = BLE_ATT_UUID_16(0x2A17), /**< Time Update State. */ + BLE_ATT_CHAR_GLUCOSE_MEAS = BLE_ATT_UUID_16(0x2A18), /**< Glucose Measurement. */ + BLE_ATT_CHAR_BATTERY_LEVEL = BLE_ATT_UUID_16(0x2A19), /**< Battery Level. */ + BLE_ATT_CHAR_TEMPERATURE_MEAS = BLE_ATT_UUID_16(0x2A1C), /**< Temperature Measurement. */ + BLE_ATT_CHAR_TEMPERATURE_TYPE = BLE_ATT_UUID_16(0x2A1D), /**< Temperature Type. */ + BLE_ATT_CHAR_INTERMED_TEMPERATURE = BLE_ATT_UUID_16(0x2A1E), /**< Intermediate Temperature. */ + BLE_ATT_CHAR_MEAS_INTERVAL = BLE_ATT_UUID_16(0x2A21), /**< Measurement Interval. */ + BLE_ATT_CHAR_BOOT_KB_IN_REPORT = BLE_ATT_UUID_16(0x2A22), /**< Boot Keyboard Input Report. */ + BLE_ATT_CHAR_SYS_ID = BLE_ATT_UUID_16(0x2A23), /**< System ID. */ + BLE_ATT_CHAR_MODEL_NB = BLE_ATT_UUID_16(0x2A24), /**< Model Number String. */ + BLE_ATT_CHAR_SERIAL_NB = BLE_ATT_UUID_16(0x2A25), /**< Serial Number String. */ + BLE_ATT_CHAR_FW_REV = BLE_ATT_UUID_16(0x2A26), /**< Firmware Revision String. */ + BLE_ATT_CHAR_HW_REV = BLE_ATT_UUID_16(0x2A27), /**< Hardware revision String. */ + BLE_ATT_CHAR_SW_REV = BLE_ATT_UUID_16(0x2A28), /**< Software Revision String. */ + BLE_ATT_CHAR_MANUF_NAME = BLE_ATT_UUID_16(0x2A29), /**< Manufacturer Name String. */ + BLE_ATT_CHAR_IEEE_CERTIF = BLE_ATT_UUID_16(0x2A2A), /**< IEEE Regulatory Certification Data List. */ + BLE_ATT_CHAR_CT_TIME = BLE_ATT_UUID_16(0x2A2B), /**< CT Time. */ + BLE_ATT_CHAR_MAGN_DECLINE = BLE_ATT_UUID_16(0x2A2C), /**< Magnetic Declination. */ + BLE_ATT_CHAR_SCAN_REFRESH = BLE_ATT_UUID_16(0x2A31), /**< Scan Refresh. */ + BLE_ATT_CHAR_BOOT_KB_OUT_REPORT = BLE_ATT_UUID_16(0x2A32), /**< Boot Keyboard Output Report. */ + BLE_ATT_CHAR_BOOT_MOUSE_IN_REPORT = BLE_ATT_UUID_16(0x2A33), /**< Boot Mouse Input Report. */ + BLE_ATT_CHAR_GLUCOSE_MEAS_CTX = BLE_ATT_UUID_16(0x2A34), /**< Glucose Measurement Context. */ + BLE_ATT_CHAR_BLOOD_PRESSURE_MEAS = BLE_ATT_UUID_16(0x2A35), /**< Blood Pressure Measurement. */ + BLE_ATT_CHAR_INTERMEDIATE_CUFF_PRESSURE = BLE_ATT_UUID_16(0x2A36), /**< Intermediate Cuff Pressure. */ + BLE_ATT_CHAR_HEART_RATE_MEAS = BLE_ATT_UUID_16(0x2A37), /**< Heart Rate Measurement. */ + BLE_ATT_CHAR_BODY_SENSOR_LOCATION = BLE_ATT_UUID_16(0x2A38), /**< Body Sensor Location. */ + BLE_ATT_CHAR_HEART_RATE_CNTL_POINT = BLE_ATT_UUID_16(0x2A39), /**< Heart Rate Control Point. */ + BLE_ATT_CHAR_ALERT_STATUS = BLE_ATT_UUID_16(0x2A3F), /**< Alert Status. */ + BLE_ATT_CHAR_RINGER_CNTL_POINT = BLE_ATT_UUID_16(0x2A40), /**< Ringer Control Point. */ + BLE_ATT_CHAR_RINGER_SETTING = BLE_ATT_UUID_16(0x2A41), /**< Ringer Setting. */ + BLE_ATT_CHAR_ALERT_CAT_ID_BIT_MASK = BLE_ATT_UUID_16(0x2A42), /**< Alert Category ID Bit Mask. */ + BLE_ATT_CHAR_ALERT_CAT_ID = BLE_ATT_UUID_16(0x2A43), /**< Alert Category ID. */ + BLE_ATT_CHAR_ALERT_NTF_CTNL_PT = BLE_ATT_UUID_16(0x2A44), /**< Alert Notification Control Point. */ + BLE_ATT_CHAR_UNREAD_ALERT_STATUS = BLE_ATT_UUID_16(0x2A45), /**< Unread Alert Status. */ + BLE_ATT_CHAR_NEW_ALERT = BLE_ATT_UUID_16(0x2A46), /**< New Alert. */ + BLE_ATT_CHAR_SUP_NEW_ALERT_CAT = BLE_ATT_UUID_16(0x2A47), /**< Supported New Alert Category. */ + BLE_ATT_CHAR_SUP_UNREAD_ALERT_CAT = BLE_ATT_UUID_16(0x2A48), /**< Supported Unread Alert Category. */ + BLE_ATT_CHAR_BLOOD_PRESSURE_FEATURE = BLE_ATT_UUID_16(0x2A49), /**< Blood Pressure Feature. */ + BLE_ATT_CHAR_HID_INFO = BLE_ATT_UUID_16(0x2A4A), /**< HID Information. */ + BLE_ATT_CHAR_REPORT_MAP = BLE_ATT_UUID_16(0x2A4B), /**< Report Map. */ + BLE_ATT_CHAR_HID_CTNL_PT = BLE_ATT_UUID_16(0x2A4C), /**< HID Control Point. */ + BLE_ATT_CHAR_REPORT = BLE_ATT_UUID_16(0x2A4D), /**< Report. */ + BLE_ATT_CHAR_PROTOCOL_MODE = BLE_ATT_UUID_16(0x2A4E), /**< Protocol Mode. */ + BLE_ATT_CHAR_SCAN_INTV_WD = BLE_ATT_UUID_16(0x2A4F), /**< Scan Interval Window. */ + BLE_ATT_CHAR_PNP_ID = BLE_ATT_UUID_16(0x2A50), /**< PnP ID. */ + BLE_ATT_CHAR_GLUCOSE_FEATURE = BLE_ATT_UUID_16(0x2A51), /**< Glucose Feature. */ + BLE_ATT_CHAR_REC_ACCESS_CTRL_PT = BLE_ATT_UUID_16(0x2A52), /**< Record access control point. */ + BLE_ATT_CHAR_RSC_MEAS = BLE_ATT_UUID_16(0x2A53), /**< RSC Measurement. */ + BLE_ATT_CHAR_RSC_FEAT = BLE_ATT_UUID_16(0x2A54), /**< RSC Feature. */ + BLE_ATT_CHAR_SC_CNTL_PT = BLE_ATT_UUID_16(0x2A55), /**< SC Control Point. */ + BLE_ATT_CHAR_CSC_MEAS = BLE_ATT_UUID_16(0x2A5B), /**< CSC Measurement. */ + BLE_ATT_CHAR_CSC_FEAT = BLE_ATT_UUID_16(0x2A5C), /**< CSC Feature. */ + BLE_ATT_CHAR_SENSOR_LOC = BLE_ATT_UUID_16(0x2A5D), /**< Sensor Location. */ + BLE_ATT_CHAR_PLX_SPOT_CHECK_MEASUREMENT_LOC = BLE_ATT_UUID_16(0x2A5E), /**< PLX Spot-Check Measurement. */ + BLE_ATT_CHAR_PLX_CONTINUOUS_MEASUREMENT_LOC = BLE_ATT_UUID_16(0x2A5F), /**< PLX Continuous Measurement. */ + BLE_ATT_CHAR_PLX_FEATURES_LOC = BLE_ATT_UUID_16(0x2A60), /**< PLX Features. */ + BLE_ATT_CHAR_CP_MEAS = BLE_ATT_UUID_16(0x2A63), /**< CP Measurement. */ + BLE_ATT_CHAR_CP_VECTOR = BLE_ATT_UUID_16(0x2A64), /**< CP Vector. */ + BLE_ATT_CHAR_CP_FEAT = BLE_ATT_UUID_16(0x2A65), /**< CP Feature. */ + BLE_ATT_CHAR_CP_CNTL_PT = BLE_ATT_UUID_16(0x2A66), /**< CP Control Point. */ + BLE_ATT_CHAR_LOC_SPEED = BLE_ATT_UUID_16(0x2A67), /**< Location and Speed. */ + BLE_ATT_CHAR_NAVIGATION = BLE_ATT_UUID_16(0x2A68), /**< Navigation. */ + BLE_ATT_CHAR_POS_QUALITY = BLE_ATT_UUID_16(0x2A69), /**< Position Quality. */ + BLE_ATT_CHAR_LN_FEAT = BLE_ATT_UUID_16(0x2A6A), /**< LN Feature. */ + BLE_ATT_CHAR_LN_CNTL_PT = BLE_ATT_UUID_16(0x2A6B), /**< LN Control Point. */ + BLE_ATT_CHAR_ELEVATION = BLE_ATT_UUID_16(0x2A6C), /**< Elevation. */ + BLE_ATT_CHAR_PRESSURE = BLE_ATT_UUID_16(0x2A6D), /**< Pressure. */ + BLE_ATT_CHAR_TEMPERATURE = BLE_ATT_UUID_16(0x2A6E), /**< Temperature. */ + BLE_ATT_CHAR_HUMIDITY = BLE_ATT_UUID_16(0x2A6F), /**< Humidity. */ + BLE_ATT_CHAR_TRUE_WIND_SPEED = BLE_ATT_UUID_16(0x2A70), /**< True Wind Speed. */ + BLE_ATT_CHAR_TRUE_WIND_DIR = BLE_ATT_UUID_16(0x2A71), /**< True Wind Direction. */ + BLE_ATT_CHAR_APRNT_WIND_SPEED = BLE_ATT_UUID_16(0x2A72), /**< Apparent Wind Speed. */ + BLE_ATT_CHAR_APRNT_WIND_DIRECTION = BLE_ATT_UUID_16(0x2A73), /**< Apparent Wind Direction. */ + BLE_ATT_CHAR_GUST_FACTOR = BLE_ATT_UUID_16(0x2A74), /**< Gust Factor. */ + BLE_ATT_CHAR_POLLEN_CONC = BLE_ATT_UUID_16(0x2A75), /**< Pollen Concentration. */ + BLE_ATT_CHAR_UV_INDEX = BLE_ATT_UUID_16(0x2A76), /**< UV Index. */ + BLE_ATT_CHAR_IRRADIANCE = BLE_ATT_UUID_16(0x2A77), /**< Irradiance. */ + BLE_ATT_CHAR_RAINFALL = BLE_ATT_UUID_16(0x2A78), /**< Rainfall. */ + BLE_ATT_CHAR_WIND_CHILL = BLE_ATT_UUID_16(0x2A79), /**< Wind Chill. */ + BLE_ATT_CHAR_HEAT_INDEX = BLE_ATT_UUID_16(0x2A7A), /**< Heat Index. */ + BLE_ATT_CHAR_DEW_POINT = BLE_ATT_UUID_16(0x2A7B), /**< Dew Point. */ + BLE_ATT_CHAR_DESCRIPTOR_VALUE_CHANGED = BLE_ATT_UUID_16(0x2A7D), /**< Descriptor Value Changed. */ + BLE_ATT_CHAR_AEROBIC_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A7E), /**< Aerobic Heart Rate Lower Limit. */ + BLE_ATT_CHAR_AEROBIC_THRESHOLD = BLE_ATT_UUID_16(0x2A7F), /**< Aerobic Threshold. */ + BLE_ATT_CHAR_AGE = BLE_ATT_UUID_16(0x2A80), /**< Age. */ + BLE_ATT_CHAR_ANAEROBIC_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A81), /**< Anaerobic Heart Rate Lower Limit. */ + BLE_ATT_CHAR_ANAEROBIC_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A82), /**< Anaerobic Heart Rate Upper Limit. */ + BLE_ATT_CHAR_ANAEROBIC_THRESHHOLD = BLE_ATT_UUID_16(0x2A83), /**< Anaerobic Threshhold. */ + BLE_ATT_CHAR_AEROBIC_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A84), /**< Aerobic Heart Rate Upper Limit. */ + BLE_ATT_CHAR_DATE_OF_BIRTH = BLE_ATT_UUID_16(0x2A85), /**< Date of Birth. */ + BLE_ATT_CHAR_DATE_OF_THRESHOLD_ASSESSMENT = BLE_ATT_UUID_16(0x2A86), /**< Date of Threshold Assessment. */ + BLE_ATT_CHAR_EMAIL_ADDRESS = BLE_ATT_UUID_16(0x2A87), /**< Email Address. */ + BLE_ATT_CHAR_FAT_BURN_HEART_RATE_LOWER_LIMIT = BLE_ATT_UUID_16(0x2A88), /**< Fat Burn Heart Rate Lower Limit. */ + BLE_ATT_CHAR_FAT_BURN_HEART_RATE_UPPER_LIMIT = BLE_ATT_UUID_16(0x2A89), /**< Fat Burn Heart Rate Upper Limit. */ + BLE_ATT_CHAR_FIRST_NAME = BLE_ATT_UUID_16(0x2A8A), /**< First Name. */ + BLE_ATT_CHAR_FIVE_ZONE_HEART_RATE_LIMITS = BLE_ATT_UUID_16(0x2A8B), /**< Five Zone Heart Rate Limits. */ + BLE_ATT_CHAR_GENDER = BLE_ATT_UUID_16(0x2A8C), /**< Gender. */ + BLE_ATT_CHAR_MAX_HEART_RATE = BLE_ATT_UUID_16(0x2A8D), /**< Max Heart Rate. */ + BLE_ATT_CHAR_HEIGHT = BLE_ATT_UUID_16(0x2A8E), /**< Height. */ + BLE_ATT_CHAR_HIP_CIRCUMFERENCE = BLE_ATT_UUID_16(0x2A8F), /**< Hip Circumference. */ + BLE_ATT_CHAR_LAST_NAME = BLE_ATT_UUID_16(0x2A90), /**< Last Name. */ + BLE_ATT_CHAR_MAXIMUM_RECOMMENDED_HEART_RATE = BLE_ATT_UUID_16(0x2A91), /**< Maximum Recommended Heart Rate. */ + BLE_ATT_CHAR_RESTING_HEART_RATE = BLE_ATT_UUID_16(0x2A92), /**< Resting Heart Rate. */ + BLE_ATT_CHAR_SPORT_TYPE_FOR_AEROBIC_AND_ANAEROBIC_THRESHOLDS = BLE_ATT_UUID_16(0x2A93), /**< Sport Type For Aerobic And Anaerobic Thresholds. */ + BLE_ATT_CHAR_THREE_ZONE_HEART_RATE_LIMITS = BLE_ATT_UUID_16(0x2A94), /**< Three Zone Heart Rate Limits. */ + BLE_ATT_CHAR_TWO_ZONE_HEART_RATE_LIMIT = BLE_ATT_UUID_16(0x2A95), /**< Two Zone Heart Rate Limits. */ + BLE_ATT_CHAR_VO2_MAX = BLE_ATT_UUID_16(0x2A96), /**< Vo2 Max. */ + BLE_ATT_CHAR_WAIST_CIRCUMFERENCE = BLE_ATT_UUID_16(0x2A97), /**< Waist Circumference. */ + BLE_ATT_CHAR_WEIGHT = BLE_ATT_UUID_16(0x2A98), /**< Weight. */ + BLE_ATT_CHAR_DATABASE_CHANGE_INCREMENT = BLE_ATT_UUID_16(0x2A99), /**< Database Change Increment. */ + BLE_ATT_CHAR_USER_INDEX = BLE_ATT_UUID_16(0x2A9A), /**< User Index. */ + BLE_ATT_CHAR_BODY_COMPOSITION_FEATURE = BLE_ATT_UUID_16(0x2A9B), /**< Body Composition Feature. */ + BLE_ATT_CHAR_BODY_COMPOSITION_MEASUREMENT = BLE_ATT_UUID_16(0x2A9C), /**< Body Composition Measurement. */ + BLE_ATT_CHAR_WEIGHT_MEASUREMENT = BLE_ATT_UUID_16(0x2A9D), /**< Weight Measurement. */ + BLE_ATT_CHAR_WEIGHT_SCALE_FEATURE = BLE_ATT_UUID_16(0x2A9E), /**< Weight Scale Feature. */ + BLE_ATT_CHAR_USER_CONTROL_POINT = BLE_ATT_UUID_16(0x2A9F), /**< User Control Point. */ + BLE_ATT_CHAR_MAGN_FLUX_2D = BLE_ATT_UUID_16(0x2AA0), /**< Flux Density - 2D. */ + BLE_ATT_CHAR_MAGN_FLUX_3D = BLE_ATT_UUID_16(0x2AA1), /**< Magnetic Flux Density - 3D. */ + BLE_ATT_CHAR_LANGUAGE = BLE_ATT_UUID_16(0x2AA2), /**< Language string. */ + BLE_ATT_CHAR_BAR_PRES_TREND = BLE_ATT_UUID_16(0x2AA3), /**< Barometric Pressure Trend. */ + BLE_ATT_CHAR_CTL_ADDR_RESOL_SUPP = BLE_ATT_UUID_16(0x2AA6), /**< Central Address Resolution Support. */ + BLE_ATT_CHAR_OTS_FEATURES = BLE_ATT_UUID_16(0x2ABD), /**< OTS Service Feature. */ + BLE_ATT_CHAR_OTS_OBJECT_NAME = BLE_ATT_UUID_16(0x2ABE), /**< Object Name. */ + BLE_ATT_CHAR_OTS_OBJECT_TYPE = BLE_ATT_UUID_16(0x2ABF), /**< Object Type. */ + BLE_ATT_CHAR_OTS_OBJECT_SIZE = BLE_ATT_UUID_16(0x2AC0), /**< Object Size. */ + BLE_ATT_CHAR_OTS_OBJECT_FIRST_CREATED = BLE_ATT_UUID_16(0x2AC1), /**< Object First Created. */ + BLE_ATT_CHAR_OTS_OBJECT_LAST_MODIFIED = BLE_ATT_UUID_16(0x2AC2), /**< Object Last Modified. */ + BLE_ATT_CHAR_OTS_OBJECT_ID = BLE_ATT_UUID_16(0x2AC3), /**< Object ID. */ + BLE_ATT_CHAR_OTS_OBJECT_PROPERTIES = BLE_ATT_UUID_16(0x2AC4), /**< Object Properties. */ + BLE_ATT_CHAR_OTS_OACP = BLE_ATT_UUID_16(0x2AC5), /**< Object Action Control Point. */ + BLE_ATT_CHAR_OTS_OLCP = BLE_ATT_UUID_16(0x2AC6), /**< Object List Control Point. */ + BLE_ATT_CHAR_OTS_LF = BLE_ATT_UUID_16(0x2AC7), /**< Object List Filter. */ + BLE_ATT_CHAR_OTS_OBJECT_CHANGED = BLE_ATT_UUID_16(0x2AC8), /**< Object Changed. */ + BLE_ATT_CHAR_RSLV_PRIV_ADDR_ONLY = BLE_ATT_UUID_16(0x2AC9), /**< Resolvable Private Address only. */ + + BLE_ATT_CHAR_UNSPECIFIED = BLE_ATT_UUID_16(0X2ACA), /**< Unspecified. */ + BLE_ATT_CHAR_DIRE_LISTING = BLE_ATT_UUID_16(0X2ACB), /**< Directory Listing. */ + BLE_ATT_CHAR_FIT_MACH_FEAT = BLE_ATT_UUID_16(0X2ACC), /**< Fitness Machine Feature. */ + BLE_ATT_CHAR_TREADMILL_DATA = BLE_ATT_UUID_16(0X2ACD), /**< Treadmill Data. */ + BLE_ATT_CHAR_CROSS_TRAINER_DATA = BLE_ATT_UUID_16(0X2ACE), /**< Cross Trainer Data. */ + BLE_ATT_CHAR_STEP_CLIMBER_DATA = BLE_ATT_UUID_16(0X2ACF), /**< Step Climber Data. */ + BLE_ATT_CHAR_STSIR_CLIMBER_DATA = BLE_ATT_UUID_16(0X2AD0), /**< Stair Climber Data. */ + BLE_ATT_CHAR_ROWER_DATA = BLE_ATT_UUID_16(0X2AD1), /**< Rower Data. */ + BLE_ATT_CHAR_INDOOR_BIKE_DATA = BLE_ATT_UUID_16(0X2AD2), /**< Indoor Bike Data. */ + BLE_ATT_CHAR_TRAIN_STATUS = BLE_ATT_UUID_16(0X2AD3), /**< Training Status. */ + BLE_ATT_CHAR_SUP_SPEED_RANGE = BLE_ATT_UUID_16(0X2AD4), /**< Supported Speed Range. */ + BLE_ATT_CHAR_SUP_INCL_RANGE = BLE_ATT_UUID_16(0X2AD5), /**< Supported Inclination Range. */ + BLE_ATT_CHAR_SUP_RESIST_LEVEL_RANGE = BLE_ATT_UUID_16(0X2AD6), /**< Supported Resistance Level Range. */ + BLE_ATT_CHAR_SUP_HEART_RATE_RANGE = BLE_ATT_UUID_16(0X2AD7), /**< Supported Heart Rate Range. */ + BLE_ATT_CHAR_SUP_POWER_RANGE = BLE_ATT_UUID_16(0X2AD8), /**< Supported Power Range. */ + BLE_ATT_CHAR_FIT_MACH_CNTL_PT = BLE_ATT_UUID_16(0X2AD9), /**< Fitness Machine Control Point. */ + BLE_ATT_CHAR_FIT_MACH_STATUS = BLE_ATT_UUID_16(0X2ADA), /**< Fitness Machine Status. */ + BLE_ATT_CHAR_MESH_PROV_DATA_IN = BLE_ATT_UUID_16(0X2ADB), /**< Mesh Provisioning Data In. */ + BLE_ATT_CHAR_MESH_PROV_DATA_OUT = BLE_ATT_UUID_16(0X2ADC), /**< Mesh Provisioning Data Out. */ + BLE_ATT_CHAR_MESH_PROX_DATA_IN = BLE_ATT_UUID_16(0X2ADD), /**< Mesh Proxy Data In. */ + BLE_ATT_CHAR_MESH_PROX_DATA_OUT = BLE_ATT_UUID_16(0X2ADE), /**< Mesh Proxy Data Out. */ + BLE_ATT_CHAR_AVG_CURRENT = BLE_ATT_UUID_16(0X2AE0), /**< Average Current. */ + BLE_ATT_CHAR_AVG_VOLTAGE = BLE_ATT_UUID_16(0X2AE1), /**< Average Voltage. */ + BLE_ATT_CHAR_BOOLEAN = BLE_ATT_UUID_16(0X2AE2), /**< Boolean. */ + BLE_ATT_CHAR_CHROM_DIST_FROM_PLANCKIAN = BLE_ATT_UUID_16(0X2AE3), /**< Chromatic Distance From Planckian. */ + BLE_ATT_CHAR_CHROM_COORD = BLE_ATT_UUID_16(0X2AE4), /**< Chromaticity Coordinates. */ + BLE_ATT_CHAR_CHORM_IN_CCT_AND_DUV_VAL = BLE_ATT_UUID_16(0X2AE5), /**< Chromaticity in CCT And Duv Values. */ + BLE_ATT_CHAR_CHROM_TOLERANCE = BLE_ATT_UUID_16(0X2AE6), /**< Chromaticity Tolerance. */ + BLE_ATT_CHAR_CIE_COLOR_REND_IDX = BLE_ATT_UUID_16(0X2AE7), /**< CIE 13.3-1995 Color Rendering Index. */ + BLE_ATT_CHAR_COEFFICIENT = BLE_ATT_UUID_16(0X2AE8), /**< Coefficient. */ + BLE_ATT_CHAR_CORRELA_COLOR_TEMP = BLE_ATT_UUID_16(0X2AE9), /**< Correlated Color Temperature. */ + BLE_ATT_CHAR_COUNT_SIXTEEN = BLE_ATT_UUID_16(0X2AEA), /**< Count 16. */ + BLE_ATT_CHAR_COUNT_TWENTY_FOUR = BLE_ATT_UUID_16(0X2AEB), /**< Count 24. */ + BLE_ATT_CHAR_COUNTRY_CODE = BLE_ATT_UUID_16(0X2AEC), /**< Country Code. */ + BLE_ATT_CHAR_DATE_UTC = BLE_ATT_UUID_16(0X2AED), /**< Date UTC. */ + BLE_ATT_CHAR_ELEC_CURRENT = BLE_ATT_UUID_16(0X2AEE), /**< Electric Current. */ + BLE_ATT_CHAR_ELEC_CURRENT_RANGE = BLE_ATT_UUID_16(0X2AEF), /**< Electric Current Range. */ + BLE_ATT_CHAR_ELEC_CURRENT_SPEC = BLE_ATT_UUID_16(0X2AF0), /**< Electric Current Specification. */ + BLE_ATT_CHAR_ELEC_CURRENT_STATIS = BLE_ATT_UUID_16(0X2AF1), /**< Electric Current Statistics. */ + BLE_ATT_CHAR_ENERGY = BLE_ATT_UUID_16(0X2AF2), /**< Energy. */ + BLE_ATT_CHAR_ENERGY_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2AF3), /**< Energy In A Period Of Day. */ + BLE_ATT_CHAR_EVENT_STATIC = BLE_ATT_UUID_16(0X2AF4), /**< Event Statistics. */ + BLE_ATT_CHAR_FIXED_STR_SIXTEEN = BLE_ATT_UUID_16(0X2AF5), /**< Fixed String 16. */ + BLE_ATT_CHAR_FIXED_STR_TWENTY_FOUR = BLE_ATT_UUID_16(0X2AF6), /**< Fixed String 24. */ + BLE_ATT_CHAR_FIXED_STR_THIRTY_SIX = BLE_ATT_UUID_16(0X2AF7), /**< Fixed String 36. */ + BLE_ATT_CHAR_FIXED_STR_EIGHT = BLE_ATT_UUID_16(0X2AF8), /**< Fixed String 8. */ + BLE_ATT_CHAR_GENERIC_LEVEL = BLE_ATT_UUID_16(0X2AF9), /**< Generic Level. */ + BLE_ATT_CHAR_GLOB_TRADE_ITEM_NUM = BLE_ATT_UUID_16(0X2AFA), /**< Global Trade Item Number. */ + BLE_ATT_CHAR_ILLUMINANCE = BLE_ATT_UUID_16(0X2AFB), /**< Illuminance. */ + BLE_ATT_CHAR_LUMI_EFFICACY = BLE_ATT_UUID_16(0X2AFC), /**< Luminous Efficacy. */ + BLE_ATT_CHAR_LUMI_ENERGY = BLE_ATT_UUID_16(0X2AFD), /**< Luminous Energy. */ + BLE_ATT_CHAR_LUMI_EXPOSURE = BLE_ATT_UUID_16(0X2AFE), /**< Luminous Exposure. */ + BLE_ATT_CHAR_LUMI_FLUX = BLE_ATT_UUID_16(0X2AFE), /**< Luminous Flux. */ + BLE_ATT_CHAR_LUMI_FLUX_RANGE = BLE_ATT_UUID_16(0X2B00), /**< Luminous Flux Range. */ + BLE_ATT_CHAR_LUMI_INTENS = BLE_ATT_UUID_16(0X2B01), /**< Luminous Intensity. */ + BLE_ATT_CHAR_MASS_FLOW = BLE_ATT_UUID_16(0X2B02), /**< Mass Flow. */ + BLE_ATT_CHAR_PERCEIVED_LIGHT = BLE_ATT_UUID_16(0X2B03), /**< Perceived Lightness. */ + BLE_ATT_CHAR_PERC_EIGHT = BLE_ATT_UUID_16(0X2B04), /**< Percentage 8. */ + BLE_ATT_CHAR_POWER = BLE_ATT_UUID_16(0X2B05), /**< Power. */ + BLE_ATT_CHAR_POWER_SPEC = BLE_ATT_UUID_16(0X2B06), /**< Power Specification. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_CUR_RANGE = BLE_ATT_UUID_16(0X2B07), /**< Relative Runtime In A Current Range. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_GEN_LEVEL_RANGE = BLE_ATT_UUID_16(0X2B08), /**< Relative Runtime In A Generic Level Range. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_VOLT_RANGE = BLE_ATT_UUID_16(0X2B09), /**< Relative Value In A Voltage Range. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_ILLUM_RANGE = BLE_ATT_UUID_16(0X2B0A), /**< Relative Value In An Illuminance Range. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2B0B), /**< Relative Value In A Period Of Day. */ + BLE_ATT_CHAR_RELAT_RUNTIME_IN_TEMP_RANGE = BLE_ATT_UUID_16(0X2B0C), /**< Relative Value In A Temperature Range. */ + BLE_ATT_CHAR_TEMP_EIGHT = BLE_ATT_UUID_16(0X2B0D), /**< Temperature 8. */ + BLE_ATT_CHAR_TEMP_EIGHT_IN_PERIOD_OF_DAY = BLE_ATT_UUID_16(0X2B0E), /**< Temperature 8 In A Period Of Day. */ + BLE_ATT_CHAR_TEMP_EIGHT_STATIS = BLE_ATT_UUID_16(0X2B0F), /**< Temperature 8 Statistics. */ + BLE_ATT_CHAR_TEMP_RANGE = BLE_ATT_UUID_16(0X2B10), /**< Temperature Range. */ + BLE_ATT_CHAR_TEMP_STATIS = BLE_ATT_UUID_16(0X2B11), /**< Temperature Statistics. */ + BLE_ATT_CHAR_TIME_DECI_EIGHT = BLE_ATT_UUID_16(0X2B12), /**< Time Decihour 8. */ + BLE_ATT_CHAR_TIME_EXPON_EIGHT = BLE_ATT_UUID_16(0X2B13), /**< Time Exponential 8. */ + BLE_ATT_CHAR_TIME_HOUR_TWENTY_FOUR = BLE_ATT_UUID_16(0X2B14), /**< Time Hour 24. */ + BLE_ATT_CHAR_TIME_MS_TWENTY_FOUR = BLE_ATT_UUID_16(0X2B15), /**< Time Millisecond 24. */ + BLE_ATT_CHAR_TIME_SEC_SIXTEEN = BLE_ATT_UUID_16(0X2B16), /**< Time Second 16. */ + BLE_ATT_CHAR_TIME_SEC_EIGHT = BLE_ATT_UUID_16(0X2B17), /**< Time Second 8. */ + BLE_ATT_CHAR_VOLTAGE = BLE_ATT_UUID_16(0X2B18), /**< Voltage. */ + BLE_ATT_CHAR_VOLTAGE_SPEC = BLE_ATT_UUID_16(0X2B19), /**< Voltage Specification. */ + BLE_ATT_CHAR_VOLTAGE_STATIS = BLE_ATT_UUID_16(0X2B1A), /**< Voltage Statistics. */ + BLE_ATT_CHAR_VOLUME_FLOW = BLE_ATT_UUID_16(0X2B1B), /**< Volume Flow. */ + BLE_ATT_CHAR_CHROM_COORDINATE = BLE_ATT_UUID_16(0X2B1C), /**< Chromaticity Coordinate. */ + + BLE_ATT_CHAR_RC_FEAT = BLE_ATT_UUID_16(0x2B1D), /**< RC Feature. */ + BLE_ATT_CHAR_RC_SETTINGS = BLE_ATT_UUID_16(0x2B1E), /**< RC Settings. */ + BLE_ATT_CHAR_RECONNEC_CONFIG_CNTL_PT = BLE_ATT_UUID_16(0x2B1F), /**< Reconnection Configuration Control Point. */ + BLE_ATT_CHAR_IDD_STATUS_CHANGED = BLE_ATT_UUID_16(0x2B20), /**< IDD Status Changed. */ + BLE_ATT_CHAR_IDD_STATUS = BLE_ATT_UUID_16(0x2B21), /**< IDD Status. */ + BLE_ATT_CHAR_IDD_ANNU_STATUS = BLE_ATT_UUID_16(0x2B22), /**< IDD Annunciation Status. */ + BLE_ATT_CHAR_IDD_FEAT = BLE_ATT_UUID_16(0x2B23), /**< IDD Features. */ + BLE_ATT_CHAR_IDD_STATUS_READER_CNTL_PT = BLE_ATT_UUID_16(0x2B24), /**< IDD Status Reader Control Point. */ + BLE_ATT_CHAR_IDD_COMMAND_CNTL_PT = BLE_ATT_UUID_16(0x2B25), /**< IDD Command Control Point. */ + BLE_ATT_CHAR_IDD_COMMAND_DATA = BLE_ATT_UUID_16(0x2B26), /**< IDD Command Data. */ + BLE_ATT_CHAR_IDD_RECORD_ACCESS_CNTL_PT = BLE_ATT_UUID_16(0x2B27), /**< IDD Record Access Control Point. */ + BLE_ATT_CHAR_IDD_HISTORY_DATA = BLE_ATT_UUID_16(0x2B28), /**< IDD History Data. */ + BLE_ATT_CHAR_CLI_SUP_FEAT = BLE_ATT_UUID_16(0x2B29), /**< Client Supported Features. */ + BLE_ATT_CHAR_DB_HASH = BLE_ATT_UUID_16(0x2B2A), /**< Database Hash. */ + BLE_ATT_CHAR_BSS_CNTL_PT = BLE_ATT_UUID_16(0x2B2B), /**< BSS Control Point. */ + BLE_ATT_CHAR_BSS_RESPONSE = BLE_ATT_UUID_16(0x2B2C), /**< BSS Response. */ + BLE_ATT_CHAR_EMERGENCY_ID = BLE_ATT_UUID_16(0x2B2D), /**< Emergency ID. */ + BLE_ATT_CHAR_EMERGENCY_TEXT = BLE_ATT_UUID_16(0x2B2E), /**< Emergency Text. */ + + BLE_ATT_CHAR_REGISTERED_USER = BLE_ATT_UUID_16(0x2B37), /**< Registered User Characterisitc. */ + BLE_ATT_CHAR_SRV_SUP_FEAT = BLE_ATT_UUID_16(0x2B3A), /**< Server Supported Features. */ +} ble_att_uuid_t; /** * @brief Format for Characteristic Presentation. */ -typedef enum { +typedef enum +{ BLE_ATT_FORMAT_BOOL = 0x01, /**< Unsigned 1-bit: true or false. */ BLE_ATT_FORMAT_2BIT, /**< Unsigned 2-bit integer. */ BLE_ATT_FORMAT_NIBBLE, /**< Unsigned 4-bit integer. */ @@ -984,7 +568,7 @@ typedef enum { BLE_ATT_FORMAT_UTF16S, /**< UTF-16 string. */ BLE_ATT_FORMAT_STRUCT, /**< Opaque structure. */ BLE_ATT_FORMAT_LAST /**< Last format. */ -} att_format_t; +} ble_att_format_t; /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_audio.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_audio.h new file mode 100644 index 0000000..934c09b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_audio.h @@ -0,0 +1,252 @@ +/** + **************************************************************************************** + * + * @file ble_audio.h + * + * @brief BLE Audio API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __BLE_AUDIO_H__ +#define __BLE_AUDIO_H__ + +#if (CFG_SNIFFER) + + /** + * @addtogroup BLE + * @{ + * @brief Definitions and prototypes for the BLE SDK interface. + */ + + /** + * @addtogroup BLE_AUDIO Audio Library + * @{ + * @brief Definitions and prototypes for the Audio Application interface. + */ + +#include "ble_gapc.h" +#include "ble_error.h" + +#include // Standard Integer +#include +#include + +/** + * @defgroup BLE_AUDIO_ENUM Enumerations + * @{ + */ +/** @brief Switch role type */ +typedef enum +{ + AUDIO_SWITCH_ROLE_SINK_TYPE = 1 << 0, /**< Switch role for sink link. */ + AUDIO_SWITCH_ROLE_SNIFFER_TYPE = 1 << 1, /**< Switch role for sniffer link. */ +} audio_switch_role_type_t; + +/** + * @brief Definition of operation code used in the asynchronous operations + */ + typedef enum +{ + AUDIO_OPCODE_SWITCH_ROLE, /**< Switch Role. */ + AUDIO_OPCODE_TIME_SYNC, /**< Time Sync. */ + AUDIO_OPCODE_CREATE_SNIFFER, /** + +/**@addtogroup BLE_ERROR_CODES Defines + * @{ */ /**@defgroup SDK_ERROR_CODES SDK Specific Error Codes -* @{ +* @{ */ -#define SDK_SUCCESS 0x0000 /**< Successful. */ -#define SDK_ERR_INVALID_PARAM 0x0001 /**< Invalid parameter supplied. */ -#define SDK_ERR_POINTER_NULL 0x0002 /**< Invalid pointer supplied. */ -#define SDK_ERR_INVALID_CONN_IDX 0x0003 /**< Invalid connection index supplied. */ -#define SDK_ERR_INVALID_HANDLE 0x0004 /**< Invalid handle supplied. */ -#define SDK_ERR_PROFILE_COUNT 0x0005 /**< Maximum SDK profile count exceeded. */ -#define SDK_ERR_BUSY 0x0006 /**< SDK is busy internally. */ -#define SDK_ERR_TIMER_INSUFFICIENT 0x0007 /**< Timer is insufficient. */ -#define SDK_ERR_NVDS_NOT_INIT 0x0008 /**< NVDS is not initiated. */ -#define SDK_ERR_LIST_ITEM_NOT_FOUND 0x0009 /**< Item not found in list. */ -#define SDK_ERR_LIST_ITEM_ALREADY_EXISTED 0x000a /**< Item already exists in list. */ -#define SDK_ERR_LIST_FULL 0x000b /**< List is full. */ -#define SDK_ERR_SDK_INTERNAL 0x000c /**< Internal SDK error. */ -#define SDK_ERR_INVALID_BUFF_LENGTH 0x000d /**< The buffer's length is not enough. */ -#define SDK_ERR_INVALID_DATA_LENGTH 0x000e /**< Invalid data length supplied. */ -#define SDK_ERR_DISALLOWED 0x000f /**< Operation is disallowed. */ -#define SDK_ERR_NO_RESOURCES 0x0010 /**< Not enough resources for operation. */ -#define SDK_ERR_REQ_NOT_SUPPORTED 0x0011 /**< Request not supported. */ -#define SDK_ERR_INVALID_OFFSET 0x0012 /**< Offset exceeds the current attribute value length. */ -#define SDK_ERR_INVALID_ATT_VAL_LEN 0x0013 /**< Invalid length of the attribute value. */ -#define SDK_ERR_INVALID_PERM 0x0014 /**< Permission set in service/attribute is invalid. */ -#define SDK_ERR_INVALID_ADV_IDX 0x0015 /**< Invalid advertising index supplied. */ -#define SDK_ERR_INVALID_ADV_DATA_TYPE 0x0016 /**< Invalid advertising data type supplied. */ -#define SDK_ERR_INVALID_PSM_NUM 0x0017 /**< Invalid PSM number. */ -#define SDK_ERR_INVALID_PSM_ALREADY_REGISTERED 0x0018 /**< The PSM number has been registered. */ -#define SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM 0x0019 /**< The maximum PSM number limit is exceeded. */ -#define SDK_ERR_NTF_DISABLED 0x001A /**< Notification is NOT enabled. */ -#define SDK_ERR_IND_DISABLED 0x001B /**< Indication is NOT enabled. */ -#define SDK_ERR_DISCONNECTED 0x001C /**< Disconnection occurs. */ -#define SDK_ERR_INVALID_ADDRESS 0x001D /**< Invalid address supplied. */ -#define SDK_ERR_INVALID_ADV_INTERVAL 0x001F /**< Invalid advertising interval supplied. */ -#define SDK_ERR_INVALID_DISVCOVERY_MODE 0x0020 /**< Invalid discovery mode supplied. */ -#define SDK_ERR_INVALID_ADV_PARAM 0x0021 /**< Invalid advertising parameters supplied. */ -#define SDK_ERR_INVALID_ADV_PEER_ADDR 0x0022 /**< Invalid peer address supplied. */ -#define SDK_ERR_ADV_DATA_NOT_SET 0x0023 /**< Legacy advertising data not set. */ -#define SDK_ERR_PER_ADV_DATA_NOT_SET 0x0024 /**< Periodic advertising data not set. */ -#define SDK_ERR_EXT_SCAN_RSP_DATA_NOT_SET 0x0025 /**< Extended scan response data not set. */ -#define SDK_ERR_INVALID_DURATION_PARAM 0x0026 /**< Invalid duration parameter supplied. */ -#define SDK_ERR_INVALID_PER_SYNC_IDX 0x0027 /**< Invalid periodic synchronization index supplied. */ -#define SDK_ERR_INVALID_CID 0x0028 /**< Invalid CID supplied. */ -#define SDK_ERR_INVALID_CHL_NUM 0x0029 /**< Invalid channel number supplied. */ -#define SDK_ERR_NOT_ENOUGH_CREDITS 0x002A /**< Not enough credits. */ +#define SDK_SUCCESS 0x0000 /**< Successful. */ +#define SDK_ERR_INVALID_PARAM 0x0001 /**< Invalid parameter supplied. */ +#define SDK_ERR_POINTER_NULL 0x0002 /**< Invalid pointer supplied. */ +#define SDK_ERR_INVALID_CONN_IDX 0x0003 /**< Invalid connection index supplied. */ +#define SDK_ERR_INVALID_HANDLE 0x0004 /**< Invalid handle supplied. */ +#define SDK_ERR_PROFILE_COUNT 0x0005 /**< Maximum SDK profile count exceeded. */ +#define SDK_ERR_BUSY 0x0006 /**< SDK is busy internally. */ +#define SDK_ERR_TIMER_INSUFFICIENT 0x0007 /**< Timer is insufficient. */ +#define SDK_ERR_NVDS_NOT_INIT 0x0008 /**< NVDS is not initiated. */ +#define SDK_ERR_LIST_ITEM_NOT_FOUND 0x0009 /**< Item not found in list. */ +#define SDK_ERR_LIST_ITEM_ALREADY_EXISTED 0x000a /**< Item already exists in list. */ +#define SDK_ERR_LIST_FULL 0x000b /**< List is full. */ +#define SDK_ERR_SDK_INTERNAL 0x000c /**< Internal SDK error. */ +#define SDK_ERR_INVALID_BUFF_LENGTH 0x000d /**< The buffer's length is not enough. */ +#define SDK_ERR_INVALID_DATA_LENGTH 0x000e /**< Invalid data length supplied. */ +#define SDK_ERR_DISALLOWED 0x000f /**< Operation is disallowed. */ +#define SDK_ERR_NO_RESOURCES 0x0010 /**< Not enough resources for operation. */ +#define SDK_ERR_REQ_NOT_SUPPORTED 0x0011 /**< Request not supported. */ +#define SDK_ERR_INVALID_OFFSET 0x0012 /**< Offset exceeds the current attribute value length. */ +#define SDK_ERR_INVALID_ATT_VAL_LEN 0x0013 /**< Invalid length of the attribute value. */ +#define SDK_ERR_INVALID_PERM 0x0014 /**< Permission set in service/attribute is invalid. */ +#define SDK_ERR_INVALID_ADV_IDX 0x0015 /**< Invalid advertising index supplied. */ +#define SDK_ERR_INVALID_ADV_DATA_TYPE 0x0016 /**< Invalid advertising data type supplied. */ +#define SDK_ERR_INVALID_PSM_NUM 0x0017 /**< Invalid PSM number. */ +#define SDK_ERR_INVALID_PSM_ALREADY_REGISTERED 0x0018 /**< The PSM number has been registered. */ +#define SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM 0x0019 /**< The maximum PSM number limit is exceeded. */ +#define SDK_ERR_NTF_DISABLED 0x001A /**< Notification is NOT enabled. */ +#define SDK_ERR_IND_DISABLED 0x001B /**< Indication is NOT enabled. */ +#define SDK_ERR_DISCONNECTED 0x001C /**< Disconnection occurs. */ +#define SDK_ERR_INVALID_ADDRESS 0x001D /**< Invalid address supplied. */ +#define SDK_ERR_FEATURE_NOT_ENABLE 0x001E /**< Feature not enable in ble feature config. */ -#define SDK_ERR_APP_ERROR 0x0080 /**< Application error. */ +#define SDK_ERR_INVALID_ADV_INTERVAL 0x001F /**< Invalid advertising interval supplied. */ +#define SDK_ERR_INVALID_DISVCOVERY_MODE 0x0020 /**< Invalid discovery mode supplied. */ +#define SDK_ERR_INVALID_ADV_PARAM 0x0021 /**< Invalid advertising parameters supplied. */ +#define SDK_ERR_INVALID_ADV_PEER_ADDR 0x0022 /**< Invalid peer address supplied. */ +#define SDK_ERR_ADV_DATA_NOT_SET 0x0023 /**< Legacy advertising data not set. */ +#define SDK_ERR_PER_ADV_DATA_NOT_SET 0x0024 /**< Periodic advertising data not set. */ +#define SDK_ERR_EXT_SCAN_RSP_DATA_NOT_SET 0x0025 /**< Extended scan response data not set. */ +#define SDK_ERR_INVALID_DURATION_PARAM 0x0026 /**< Invalid duration parameter supplied. */ +#define SDK_ERR_INVALID_PER_SYNC_IDX 0x0027 /**< Invalid periodic synchronization index supplied. */ +#define SDK_ERR_INVALID_CID 0x0028 /**< Invalid CID supplied. */ +#define SDK_ERR_INVALID_CHL_NUM 0x0029 /**< Invalid channel number supplied. */ +#define SDK_ERR_NOT_ENOUGH_CREDITS 0x002A /**< Not enough credits. */ +#define SDK_ERR_REPEAT_CID 0x002B /**< Invalid repeat CID. */ +#define SDK_ERR_CACHE_NOT_ENABLE 0x002C /**< Cache feature is not enabled. */ +#define SDK_ERR_CACHE_INVALID 0x002D /**< Cache data is invalid. */ + +#define SDK_ERR_APP_ERROR 0x0080 /**< Application error. */ /**@} */ /**@defgroup BLE_STACK_ERROR_CODES BLE Stack specific error codes -* @{ +* @{ */ -#define BLE_SUCCESS 0x00 /**< Operation is Successful. */ +#define BLE_SUCCESS 0x00 /**< Operation is Successful. */ /**@brief ATT Specific Error. */ -#define BLE_ATT_ERR_INVALID_HANDLE 0x01 /**< The given attribute handle was not valid - on this server. */ -#define BLE_ATT_ERR_READ_NOT_PERMITTED 0x02 /**< The attribute cannot be read. */ -#define BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x03 /**< The attribute cannot be written. */ -#define BLE_ATT_ERR_INVALID_PDU 0x04 /**< The attribute PDU was invalid. */ -#define BLE_ATT_ERR_INSUFF_AUTHEN 0x05 /**< The attribute requires authentication before - it can be read or written. */ -#define BLE_ATT_ERR_REQUEST_NOT_SUPPORTED 0x06 /**< Attribute server does not support the request received - from the client. */ -#define BLE_ATT_ERR_INVALID_OFFSET 0x07 /**< Offset specified was past the end of the attribute. */ -#define BLE_ATT_ERR_INSUFF_AUTHOR 0x08 /**< The attribute requires authorization before - it can be read or written. */ -#define BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x09 /**< Too many prepare writes have been queued. */ -#define BLE_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0A /**< No attribute found within the given - attribute handle range. */ -#define BLE_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0B /**< The attribute cannot be read using - the Read Blob Request. */ -#define BLE_ATT_ERR_INSUFF_ENC_KEY_SIZE 0x0C /**< The Encryption Key Size used for encrypting - this link is insufficient. */ -#define BLE_ATT_ERR_INVALID_ATTRIBUTE_VAL_LEN 0x0D /**< The attribute value length is invalid - for the operation. */ -#define BLE_ATT_ERR_UNLIKELY_ERR 0x0E /**< The attribute request has encountered an unlikely error, - so the request could not be completed as requested. */ -#define BLE_ATT_ERR_INSUFF_ENC 0x0F /**< The attribute requires encryption before - it can be read or written. */ -#define BLE_ATT_ERR_UNSUPP_GRP_TYPE 0x10 /**< The attribute type is not a supported grouping attribute - as defined by a higher layer specification. */ -#define BLE_ATT_ERR_INSUFF_RESOURCE 0x11 /**< Insufficient resources to complete the request. */ +#define BLE_ATT_ERR_INVALID_HANDLE 0x01 /**< The given attribute handle was not valid on this server. */ +#define BLE_ATT_ERR_READ_NOT_PERMITTED 0x02 /**< The attribute cannot be read. */ +#define BLE_ATT_ERR_WRITE_NOT_PERMITTED 0x03 /**< The attribute cannot be written. */ +#define BLE_ATT_ERR_INVALID_PDU 0x04 /**< The attribute PDU was invalid. */ +#define BLE_ATT_ERR_INSUFF_AUTHEN 0x05 /**< The attribute requires authentication before it can be read or written. */ +#define BLE_ATT_ERR_REQUEST_NOT_SUPPORTED 0x06 /**< Attribute server does not support the request received from the client. */ +#define BLE_ATT_ERR_INVALID_OFFSET 0x07 /**< Offset specified was past the end of the attribute. */ +#define BLE_ATT_ERR_INSUFF_AUTHOR 0x08 /**< The attribute requires authorization before it can be read or written. */ +#define BLE_ATT_ERR_PREPARE_QUEUE_FULL 0x09 /**< Too many prepare writes have been queued. */ +#define BLE_ATT_ERR_ATTRIBUTE_NOT_FOUND 0x0A /**< No attribute found within the given attribute handle range. */ +#define BLE_ATT_ERR_ATTRIBUTE_NOT_LONG 0x0B /**< The attribute cannot be read using the Read Blob Request. */ +#define BLE_ATT_ERR_INSUFF_ENC_KEY_SIZE 0x0C /**< The Encryption Key Size used for encrypting this link is insufficient. */ +#define BLE_ATT_ERR_INVALID_ATTRIBUTE_VAL_LEN 0x0D /**< The attribute value length is invalid for the operation. */ +#define BLE_ATT_ERR_UNLIKELY_ERR 0x0E /**< The attribute request has encountered an unlikely error, so the request could not be completed as requested. */ +#define BLE_ATT_ERR_INSUFF_ENC 0x0F /**< The attribute requires encryption before it can be read or written. */ +#define BLE_ATT_ERR_UNSUPP_GRP_TYPE 0x10 /**< The attribute type is not a supported grouping attribute as defined by a higher layer specification. */ +#define BLE_ATT_ERR_INSUFF_RESOURCE 0x11 /**< Insufficient resources to complete the request. */ +#define BLE_ATT_ERR_DB_OUT_OF_SYNC 0x12 /**< The server requests the client to rediscover the database. */ +#define BLE_ATT_ERR_VALUE_NOT_ALLOWED 0x13 /**< The attribute parameter value was not allowed. */ /**@brief L2CAP Specific Error. */ -#define BLE_L2C_ERR_CONNECTION_LOST 0x30 /**< Message cannot be sent because connection - is lost (disconnected). */ -#define BLE_L2C_ERR_INVALID_MTU_EXCEED 0x31 /**< Invalid PDU length exceeds MTU. */ -#define BLE_L2C_ERR_INVALID_MPS_EXCEED 0x32 /**< Invalid PDU length exceeds MPS. */ -#define BLE_L2C_ERR_INVALID_CID 0x33 /**< Invalid Channel ID. */ -#define BLE_L2C_ERR_INVALID_PDU 0x34 /**< Invalid PDU. */ -#define BLE_L2C_ERR_NO_RES_AVAIL 0x35 /**< Connection refused because no resources are available. */ -#define BLE_L2C_ERR_INSUFF_AUTHEN 0x36 /**< Connection refused because of - insufficient authentication. */ -#define BLE_L2C_ERR_INSUFF_AUTHOR 0x37 /**< Connection refused because of - insufficient authorization. */ -#define BLE_L2C_ERR_INSUFF_ENC_KEY_SIZE 0x38 /**< Connection refused because of - insufficient encryption key size. */ -#define BLE_L2C_ERR_INSUFF_ENC 0x39 /**< Connection refused because of insufficient encryption. */ -#define BLE_L2C_ERR_LEPSM_NOT_SUPP 0x3A /**< Connection refused because LE_PSM is not supported. */ -#define BLE_L2C_ERR_INSUFF_CREDIT 0x3B /**< No more credit. */ -#define BLE_L2C_ERR_NOT_UNDERSTOOD 0x3C /**< Command not understood by peer device. */ -#define BLE_L2C_ERR_CREDIT_ERROR 0x3D /**< Credit error: invalid number of credit received. */ -#define BLE_L2C_ERR_CID_ALREADY_ALLOC 0x3E /**< Channel identifier already allocated. */ +#define BLE_L2C_ENH_CB_RECONFIG_INVALID_MTU 0x2C /**< Reconfiguration failed - reduction in size of MTU not allowed. */ +#define BLE_L2C_ENH_CB_RECONFIG_INVALID_MPS 0x2D /**< Reconfiguration failed - reduction in size of MPS not allowed for more than one channel at a time. */ +#define BLE_L2C_ENH_CB_RECONFIG_INVALID_CID 0x2E /**< Reconfiguration failed - one or more Destination CIDs invalid. */ +#define BLE_L2C_ENH_CB_RECONFIG_UNACCEPT_PARAM 0x2F /**< Reconfiguration failed - other unacceptable parameters. */ +#define BLE_L2C_ERR_CONNECTION_LOST 0x30 /**< Message cannot be sent because connection is lost (disconnected). */ +#define BLE_L2C_ERR_INVALID_MTU_EXCEED 0x31 /**< Invalid PDU length exceeds MTU. */ +#define BLE_L2C_ERR_INVALID_MPS_EXCEED 0x32 /**< Invalid PDU length exceeds MPS. */ +#define BLE_L2C_ERR_INVALID_CID 0x33 /**< Invalid Channel ID. */ +#define BLE_L2C_ERR_INVALID_PDU 0x34 /**< Invalid PDU. */ +#define BLE_L2C_ERR_NO_RES_AVAIL 0x35 /**< Connection refused because no resources are available. */ +#define BLE_L2C_ERR_INSUFF_AUTHEN 0x36 /**< Connection refused because of insufficient authentication. */ +#define BLE_L2C_ERR_INSUFF_AUTHOR 0x37 /**< Connection refused because of insufficient authorization. */ +#define BLE_L2C_ERR_INSUFF_ENC_KEY_SIZE 0x38 /**< Connection refused because of insufficient encryption key size. */ +#define BLE_L2C_ERR_INSUFF_ENC 0x39 /**< Connection refused because of insufficient encryption. */ +#define BLE_L2C_ERR_LEPSM_NOT_SUPP 0x3A /**< Connection refused because LE_PSM is not supported. */ +#define BLE_L2C_ERR_INSUFF_CREDIT 0x3B /**< No more credit. */ +#define BLE_L2C_ERR_NOT_UNDERSTOOD 0x3C /**< Command not understood by peer device. */ +#define BLE_L2C_ERR_CREDIT_ERROR 0x3D /**< Credit error: invalid number of credit received. */ +#define BLE_L2C_ERR_CID_ALREADY_ALLOC 0x3E /**< Channel identifier already allocated. */ +#define BLE_L2C_ERR_UNKNOWN_PDU 0x3F /**< Unknown pdu. */ /**@brief GAP Specific Error. */ -#define BLE_GAP_ERR_INVALID_PARAM 0x40 /**< Invalid parameters set. */ -#define BLE_GAP_ERR_PROTOCOL_PROBLEM 0x41 /**< Problem with protocol exchange, - resulting in unexpected responses. */ -#define BLE_GAP_ERR_NOT_SUPPORTED 0x42 /**< Request not supported by software configuration. */ -#define BLE_GAP_ERR_COMMAND_DISALLOWED 0x43 /**< Request not allowed in current state. */ -#define BLE_GAP_ERR_CANCELED 0x44 /**< Requested operation canceled. */ -#define BLE_GAP_ERR_TIMEOUT 0x45 /**< Requested operation timeout. */ -#define BLE_GAP_ERR_DISCONNECTED 0x46 /**< Link connection is lost during operation. */ -#define BLE_GAP_ERR_NOT_FOUND 0x47 /**< Search algorithm finished, but no result found. */ -#define BLE_GAP_ERR_REJECTED 0x48 /**< Request rejected by peer device. */ -#define BLE_GAP_ERR_PRIVACY_CFG_PB 0x49 /**< Problem with privacy configuration. */ -#define BLE_GAP_ERR_ADV_DATA_INVALID 0x4A /**< Duplicate or invalid advertising data. */ -#define BLE_GAP_ERR_INSUFF_RESOURCES 0x4B /**< Insufficient resources. */ -#define BLE_GAP_ERR_UNEXPECTED 0x4C /**< Unexpected error. */ -#define BLE_GAP_ERR_MISMATCH 0x4D /**< Feature mismatch. */ +#define BLE_GAP_ERR_INVALID_PARAM 0x40 /**< Invalid parameters set. */ +#define BLE_GAP_ERR_PROTOCOL_PROBLEM 0x41 /**< Problem with protocol exchange, resulting in unexpected responses. */ +#define BLE_GAP_ERR_NOT_SUPPORTED 0x42 /**< Request not supported by software configuration. */ +#define BLE_GAP_ERR_COMMAND_DISALLOWED 0x43 /**< Request not allowed in current state. */ +#define BLE_GAP_ERR_CANCELED 0x44 /**< Requested operation canceled. */ +#define BLE_GAP_ERR_TIMEOUT 0x45 /**< Requested operation timeout. */ +#define BLE_GAP_ERR_DISCONNECTED 0x46 /**< Link connection is lost during operation. */ +#define BLE_GAP_ERR_NOT_FOUND 0x47 /**< Search algorithm finished, but no result found. */ +#define BLE_GAP_ERR_REJECTED 0x48 /**< Request rejected by peer device. */ +#define BLE_GAP_ERR_PRIVACY_CFG_PB 0x49 /**< Problem with privacy configuration. */ +#define BLE_GAP_ERR_ADV_DATA_INVALID 0x4A /**< Duplicate or invalid advertising data. */ +#define BLE_GAP_ERR_INSUFF_RESOURCES 0x4B /**< Insufficient resources. */ +#define BLE_GAP_ERR_UNEXPECTED 0x4C /**< Unexpected error. */ +#define BLE_GAP_ERR_MISMATCH 0x4D /**< Feature mismatch. */ /**@brief GATT Specific Error. */ -#define BLE_GATT_ERR_INVALID_ATT_LEN 0x50 /**< Problem with ATTC protocol response. */ -#define BLE_GATT_ERR_INVALID_TYPE_IN_SVC_SEARCH 0x51 /**< Error in service search. */ -#define BLE_GATT_ERR_WRITE 0x52 /**< Invalid write data. */ -#define BLE_GATT_ERR_SIGNED_WRITE 0x53 /**< Signed write error. */ -#define BLE_GATT_ERR_ATTRIBUTE_CLIENT_MISSING 0x54 /**< No attribute client defined. */ -#define BLE_GATT_ERR_ATTRIBUTE_SERVER_MISSING 0x55 /**< No attribute server defined. */ -#define BLE_GATT_ERR_INVALID_PERM 0x56 /**< Permission set in service/attribute is invalid. */ -#define BLE_GATT_ERR_BROWSE_NO_ANY_MORE 0x57 /**< GATT browses no any more contents. */ +#define BLE_GATT_ERR_INVALID_ATT_LEN 0x50 /**< Problem with ATTC protocol response. */ +#define BLE_GATT_ERR_INVALID_TYPE_IN_SVC_SEARCH 0x51 /**< Error in service search. */ +#define BLE_GATT_ERR_WRITE 0x52 /**< Invalid write data. */ +#define BLE_GATT_ERR_SIGNED_WRITE 0x53 /**< Signed write error. */ +#define BLE_GATT_ERR_ATTRIBUTE_CLIENT_MISSING 0x54 /**< No attribute client defined. */ +#define BLE_GATT_ERR_ATTRIBUTE_SERVER_MISSING 0x55 /**< No attribute server defined. */ +#define BLE_GATT_ERR_INVALID_PERM 0x56 /**< Permission set in service/attribute is invalid. */ +#define BLE_GATT_ERR_BROWSE_NO_ANY_MORE 0x57 /**< GATT browses no any more contents. */ +#define BLE_GATT_ERR_CACHE_UPDATING 0x58 /**< GATT Cache in updating process. */ +#define BLE_GATT_ERR_CACHE_FINISH 0x59 /**< GATT Cache is updated or checked. */ + +/**@brief SEC Specific Error. */ +#define BLE_SEC_ERR_PASSKEY_ENTRY_FAIL 0x61 /**< The user input of passkey failed. */ +#define BLE_SEC_ERR_OOB_NOT_AVAILBL 0x62 /**< The OOB data is not available. */ +#define BLE_SEC_ERR_AUTH_REQ 0x63 /**< The pairing procedure cannot be performed as authentication requirements cannot be met due to IO incapability of one or both devices. */ +#define BLE_SEC_ERR_CONFIRM_VAL_FAIL 0x64 /**< The confirm value does not match the calculated compare value. */ +#define BLE_SEC_ERR_PAIRING_NOT_SUPPORT 0x65 /**< Pairing is not supported by the device. */ +#define BLE_SEC_ERR_ENCRPT_KEY_SIZE 0x66 /**< The resultant encryption key size is insufficient for the security requirements of this device. */ +#define BLE_SEC_ERR_COMMAND_NOT_SUPPORT 0x67 /**< The SMP command received is not supported on this device. */ +#define BLE_SEC_ERR_UNSPECIFIED 0x68 /**< Pairing failed due to an unspecified reason. */ +#define BLE_SEC_ERR_REPEAT_ATTEMPT 0x69 /**< Pairing or authentication procedure is disallowed because too little time has elapsed since last pairing request or security request. */ +#define BLE_SEC_ERR_INVALID_PARAM 0x6A /**< The Invalid Parameters error code indicates that the command length is invalid or that a parameter is outside of the specified range. */ +#define BLE_SEC_ERR_DHKEY_CHECK_FAIL 0x6B /**< Indicate to the remote device that the DHKey Check value received doesn't match the one calculated by the local device. */ +#define BLE_SEC_ERR_NUM_CMP_FAIL 0x6C /**< Indicate that the confirm values in the numeric comparison protocol do not match. */ +#define BLE_SEC_ERR_BR_EDR_IN_PROGRESS 0x6D /**< Indicate that the pairing over the LE transport failed due to a Pairing Request sent over the BR/EDR transport in process. */ +#define BLE_SEC_ERR_KEY_DRIV_GEN_NOT_ALLOW 0x6E /**< Indicate that the BR/EDR Link Key generated on the BR/EDR transport cannot be used to derive and distribute keys for the LE transport. */ +#define BLE_SEC_ERR_LTK_MISSING 0x6F /**< Indicate the LTK of peer devices missing. */ /**@brief LL Specific Error. */ -#define BLE_LL_ERR_UNKNOWN_HCI_COMMAND 0x91 /**< Unknown HCI Command. */ -#define BLE_LL_ERR_UNKNOWN_CONNECTION_ID 0x92 /**< Unknown Connection Identifier. */ -#define BLE_LL_ERR_HARDWARE_FAILURE 0x93 /**< Hardware Failure. */ -#define BLE_LL_ERR_PAGE_TIMEOUT 0x94 /**< BT Page Timeout. */ -#define BLE_LL_ERR_AUTH_FAILURE 0x95 /**< Authentication failure. */ -#define BLE_LL_ERR_PIN_MISSING 0x96 /**< Pin code missing. */ -#define BLE_LL_ERR_MEMORY_CAPA_EXCEED 0x97 /**< Memory capacity exceeded. */ -#define BLE_LL_ERR_CON_TIMEOUT 0x98 /**< Connection Timeout. */ -#define BLE_LL_ERR_CON_LIMIT_EXCEED 0x99 /**< Connection limit Exceed. */ -#define BLE_LL_ERR_SYNC_CON_LIMIT_DEV_EXCEED 0x9A /**< Synchronous Connection limit exceeded. */ -#define BLE_LL_ERR_ACL_CON_EXISTS 0x9B /**< ACL Connection exits. */ -#define BLE_LL_ERR_COMMAND_DISALLOWED 0x9C /**< Command Disallowed. */ -#define BLE_LL_ERR_CONN_REJ_LIMITED_RESOURCES 0x9D /**< Connection rejected due to limited resources. */ -#define BLE_LL_ERR_CONN_REJ_SECURITY_REASONS 0x9E /**< Connection rejected due to insecurity issues. */ -#define BLE_LL_ERR_CONN_REJ_UNACCEPTABLE_BDADDR 0x9F /**< Connection rejected due to unacceptable BD Addr. */ -#define BLE_LL_ERR_CONN_ACCEPT_TIMEOUT_EXCEED 0xA0 /**< Connection rejected due to Accept connection timeout. */ -#define BLE_LL_ERR_UNSUPPORTED 0xA1 /**< Not Supported. */ -#define BLE_LL_ERR_INVALID_HCI_PARAM 0xA2 /**< Invalid parameters. */ -#define BLE_LL_ERR_REMOTE_USER_TERM_CON 0xA3 /**< Remote user terminates connection. */ -#define BLE_LL_ERR_REMOTE_DEV_TERM_LOW_RESOURCES 0xA4 /**< Remote device loses connection due to low resources. */ -#define BLE_LL_ERR_REMOTE_DEV_POWER_OFF 0xA5 /**< Remote device loses connection due to power failure. */ -#define BLE_LL_ERR_CON_TERM_BY_LOCAL_HOST 0xA6 /**< Connection terminated by local host. */ -#define BLE_LL_ERR_REPEATED_ATTEMPTS 0xA7 /**< Repeated attempts. */ -#define BLE_LL_ERR_PAIRING_NOT_ALLOWED 0xA8 /**< Pairing not allowed. */ -#define BLE_LL_ERR_UNKNOWN_LMP_PDU 0xA9 /**< Unknown PDU Error. */ -#define BLE_LL_ERR_UNSUPPORTED_REMOTE_FEATURE 0xAA /**< Unsupported remote feature. */ -#define BLE_LL_ERR_SCO_OFFSET_REJECTED 0xAB /**< SCO Offset rejected. */ -#define BLE_LL_ERR_SCO_INTERVAL_REJECTED 0xAC /**< SCO Interval Rejected. */ -#define BLE_LL_ERR_SCO_AIR_MODE_REJECTED 0xAD /**< SCO air mode Rejected. */ -#define BLE_LL_ERR_INVALID_LMP_PARAM 0xAE /**< Invalid LMP parameters. */ -#define BLE_LL_ERR_UNSPECIFIED_ERROR 0xAF /**< Unspecified error. */ -#define BLE_LL_ERR_UNSUPPORTED_LMP_PARAM_VALUE 0xB0 /**< Unsupported LMP Parameter value. */ -#define BLE_LL_ERR_ROLE_CHANGE_NOT_ALLOWED 0xB1 /**< Role Change not allowed. */ -#define BLE_LL_ERR_LMP_RSP_TIMEOUT 0xB2 /**< LMP Response timeout. */ -#define BLE_LL_ERR_LMP_COLLISION 0xB3 /**< LMP Collision. */ -#define BLE_LL_ERR_LMP_PDU_NOT_ALLOWED 0xB4 /**< LMP PDU not allowed. */ -#define BLE_LL_ERR_ENC_MODE_NOT_ACCEPT 0xB5 /**< Encryption mode not accepted. */ -#define BLE_LL_ERR_LINK_KEY_CANT_CHANGE 0xB6 /**< Link Key cannot be changed. */ -#define BLE_LL_ERR_QOS_NOT_SUPPORTED 0xB7 /**< Quality of Service not supported. */ -#define BLE_LL_ERR_INSTANT_PASSED 0xB8 /**< Error, instant passed. */ -#define BLE_LL_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUP 0xB9 /**< Pairing with unit key not supported. */ -#define BLE_LL_ERR_DIFF_TRANSACTION_COLLISION 0xBA /**< Transaction collision. */ -#define BLE_LL_ERR_QOS_UNACCEPTABLE_PARAM 0xBC /**< Quality of Service not supported. */ -#define BLE_LL_ERR_QOS_REJECTED 0xBD /**< Quality of Service rejected. */ -#define BLE_LL_ERR_CHANNEL_CLASS_NOT_SUP 0xBE /**< Channel class not supported. */ -#define BLE_LL_ERR_INSUFFICIENT_SECURITY 0xBF /**< Insufficient security. */ -#define BLE_LL_ERR_PARAM_OUT_OF_MAND_RANGE 0xC0 /**< Parameters out of mandatory range. */ -#define BLE_LL_ERR_ROLE_SWITCH_PEND 0xC2 /**< Role switch pending. */ -#define BLE_LL_ERR_RESERVED_SLOT_VIOLATION 0xC4 /**< Reserved slot violation. */ -#define BLE_LL_ERR_ROLE_SWITCH_FAIL 0xC5 /**< Role Switch failed. */ -#define BLE_LL_ERR_EIR_TOO_LARGE 0xC6 /**< Error: EIR too large. */ -#define BLE_LL_ERR_SP_NOT_SUPPORTED_HOST 0xC7 /**< Simple pairing not supported by host. */ -#define BLE_LL_ERR_HOST_BUSY_PAIRING 0xC8 /**< Host pairing is busy. */ -#define BLE_LL_ERR_CONTROLLER_BUSY 0xCA /**< Controller is busy. */ -#define BLE_LL_ERR_UNACCEPTABLE_CONN_INT 0xCB /**< Unacceptable connection initialization. */ -#define BLE_LL_ERR_ADV_TO 0xCC /**< Advertising Timeout. */ -#define BLE_LL_ERR_TERMINATED_MIC_FAILURE 0xCD /**< Connection Terminated due to a MIC failure. */ -#define BLE_LL_ERR_CONN_FAILED_TO_BE_EST 0xCE /**< Connection failed to be established. */ +#define BLE_LL_ERR_UNKNOWN_HCI_COMMAND 0x91 /**< Unknown HCI Command. */ +#define BLE_LL_ERR_UNKNOWN_CONNECTION_ID 0x92 /**< Unknown Connection Identifier. */ +#define BLE_LL_ERR_HARDWARE_FAILURE 0x93 /**< Hardware Failure. */ +#define BLE_LL_ERR_PAGE_TIMEOUT 0x94 /**< BT Page Timeout. */ +#define BLE_LL_ERR_AUTH_FAILURE 0x95 /**< Authentication failure. */ +#define BLE_LL_ERR_PIN_MISSING 0x96 /**< Pin code missing. */ +#define BLE_LL_ERR_MEMORY_CAPA_EXCEED 0x97 /**< Memory capacity exceeded. */ +#define BLE_LL_ERR_CON_TIMEOUT 0x98 /**< Connection Timeout. */ +#define BLE_LL_ERR_CON_LIMIT_EXCEED 0x99 /**< Connection limit Exceed. */ +#define BLE_LL_ERR_SYNC_CON_LIMIT_DEV_EXCEED 0x9A /**< Synchronous Connection limit exceeded. */ +#define BLE_LL_ERR_ACL_CON_EXISTS 0x9B /**< ACL Connection exits. */ +#define BLE_LL_ERR_COMMAND_DISALLOWED 0x9C /**< Command Disallowed. */ +#define BLE_LL_ERR_CONN_REJ_LIMITED_RESOURCES 0x9D /**< Connection rejected due to limited resources. */ +#define BLE_LL_ERR_CONN_REJ_SECURITY_REASONS 0x9E /**< Connection rejected due to insecurity issues. */ +#define BLE_LL_ERR_CONN_REJ_UNACCEPTABLE_BDADDR 0x9F /**< Connection rejected due to unacceptable BD Addr. */ +#define BLE_LL_ERR_CONN_ACCEPT_TIMEOUT_EXCEED 0xA0 /**< Connection rejected due to Accept connection timeout. */ +#define BLE_LL_ERR_UNSUPPORTED 0xA1 /**< Not Supported. */ +#define BLE_LL_ERR_INVALID_HCI_PARAM 0xA2 /**< Invalid parameters. */ +#define BLE_LL_ERR_REMOTE_USER_TERM_CON 0xA3 /**< Remote user terminates connection. */ +#define BLE_LL_ERR_REMOTE_DEV_TERM_LOW_RESOURCES 0xA4 /**< Remote device loses connection due to low resources. */ +#define BLE_LL_ERR_REMOTE_DEV_POWER_OFF 0xA5 /**< Remote device loses connection due to power failure. */ +#define BLE_LL_ERR_CON_TERM_BY_LOCAL_HOST 0xA6 /**< Connection terminated by local host. */ +#define BLE_LL_ERR_REPEATED_ATTEMPTS 0xA7 /**< Repeated attempts. */ +#define BLE_LL_ERR_PAIRING_NOT_ALLOWED 0xA8 /**< Pairing not allowed. */ +#define BLE_LL_ERR_UNKNOWN_LMP_PDU 0xA9 /**< Unknown PDU Error. */ +#define BLE_LL_ERR_UNSUPPORTED_REMOTE_FEATURE 0xAA /**< Unsupported remote feature. */ +#define BLE_LL_ERR_SCO_OFFSET_REJECTED 0xAB /**< SCO Offset rejected. */ +#define BLE_LL_ERR_SCO_INTERVAL_REJECTED 0xAC /**< SCO Interval Rejected. */ +#define BLE_LL_ERR_SCO_AIR_MODE_REJECTED 0xAD /**< SCO air mode Rejected. */ +#define BLE_LL_ERR_INVALID_LMP_PARAM 0xAE /**< Invalid LMP parameters. */ +#define BLE_LL_ERR_UNSPECIFIED_ERROR 0xAF /**< Unspecified error. */ +#define BLE_LL_ERR_UNSUPPORTED_LMP_PARAM_VALUE 0xB0 /**< Unsupported LMP Parameter value. */ +#define BLE_LL_ERR_ROLE_CHANGE_NOT_ALLOWED 0xB1 /**< Role Change not allowed. */ +#define BLE_LL_ERR_LMP_RSP_TIMEOUT 0xB2 /**< LMP Response timeout. */ +#define BLE_LL_ERR_LMP_COLLISION 0xB3 /**< LMP Collision. */ +#define BLE_LL_ERR_LMP_PDU_NOT_ALLOWED 0xB4 /**< LMP PDU not allowed. */ +#define BLE_LL_ERR_ENC_MODE_NOT_ACCEPT 0xB5 /**< Encryption mode not accepted. */ +#define BLE_LL_ERR_LINK_KEY_CANT_CHANGE 0xB6 /**< Link Key cannot be changed. */ +#define BLE_LL_ERR_QOS_NOT_SUPPORTED 0xB7 /**< Quality of Service not supported. */ +#define BLE_LL_ERR_INSTANT_PASSED 0xB8 /**< Error, instant passed. */ +#define BLE_LL_ERR_PAIRING_WITH_UNIT_KEY_NOT_SUP 0xB9 /**< Pairing with unit key not supported. */ +#define BLE_LL_ERR_DIFF_TRANSACTION_COLLISION 0xBA /**< Transaction collision. */ +#define BLE_LL_ERR_QOS_UNACCEPTABLE_PARAM 0xBC /**< Quality of Service not supported. */ +#define BLE_LL_ERR_QOS_REJECTED 0xBD /**< Quality of Service rejected. */ +#define BLE_LL_ERR_CHANNEL_CLASS_NOT_SUP 0xBE /**< Channel class not supported. */ +#define BLE_LL_ERR_INSUFFICIENT_SECURITY 0xBF /**< Insufficient security. */ +#define BLE_LL_ERR_PARAM_OUT_OF_MAND_RANGE 0xC0 /**< Parameters out of mandatory range. */ +#define BLE_LL_ERR_ROLE_SWITCH_PEND 0xC2 /**< Role switch pending. */ +#define BLE_LL_ERR_RESERVED_SLOT_VIOLATION 0xC4 /**< Reserved slot violation. */ +#define BLE_LL_ERR_ROLE_SWITCH_FAIL 0xC5 /**< Role Switch failed. */ +#define BLE_LL_ERR_EIR_TOO_LARGE 0xC6 /**< Error: EIR too large. */ +#define BLE_LL_ERR_SP_NOT_SUPPORTED_HOST 0xC7 /**< Simple pairing not supported by host. */ +#define BLE_LL_ERR_HOST_BUSY_PAIRING 0xC8 /**< Host pairing is busy. */ +#define BLE_LL_ERR_CONTROLLER_BUSY 0xCA /**< Controller is busy. */ +#define BLE_LL_ERR_UNACCEPTABLE_CONN_INT 0xCB /**< Unacceptable connection initialization. */ +#define BLE_LL_ERR_ADV_TO 0xCC /**< Advertising Timeout. */ +#define BLE_LL_ERR_TERMINATED_MIC_FAILURE 0xCD /**< Connection Terminated due to a MIC failure. */ +#define BLE_LL_ERR_CONN_FAILED_TO_BE_EST 0xCE /**< Connection failed to be established. */ /**@} */ /** * @defgroup BLE_ERROR_TYPEDEF Typedefs * @{ */ - /**@brief Callback function error parameter type. */ -typedef unsigned char ble_err_t; +typedef uint8_t ble_err_t; /**@brief SDK API result type. */ -typedef unsigned short sdk_err_t; +typedef uint16_t sdk_err_t; /**@} */ /**@} */ + #endif /** @} */ /** @} */ + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_event.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_event.h new file mode 100644 index 0000000..1e3995a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_event.h @@ -0,0 +1,220 @@ +/** + **************************************************************************************** + * + * @file ble_event.h + * + * @brief BLE event header files + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + /** + * @addtogroup BLE + * @{ + */ + +/** + @addtogroup BLE_EVENT BLE Event + @{ + @brief BLE Event interface. + */ +#ifndef __BLE_EVENT_H__ +#define __BLE_EVENT_H__ + +#include "ble_gapm.h" +#include "ble_gapc.h" +#include "ble_gatts.h" +#include "ble_gattc.h" +#include "ble_sec.h" +#include "ble_l2cap.h" + +/** @addtogroup BLE_EVENT_DEFINES Defines + * @{ +*/ +/** @defgroup BLE_EVENT_BASE BLE Event Base + * @{ */ +#define BLE_COMMON_EVT_BASE 0x0100 /**< BLE Common Event base. */ +#define BLE_GAPM_EVT_BASE 0x0200 /**< BLE GAP Management Event base. */ +#define BLE_GAPC_EVT_BASE 0x0300 /**< BLE GAP Connection Control Event base. */ +#define BLE_GATTS_EVT_BASE 0x0400 /**< BLE GATTS Event base. */ +#define BLE_GATTC_EVT_BASE 0x0500 /**< BLE GATTC Event base. */ +#define BLE_GATT_COMMON_EVT_BASE 0x0600 /**< BLE GATT Event base. */ +#define BLE_SEC_EVT_BASE 0x0700 /**< BLE Security Event base. */ +#define BLE_L2CAP_EVT_BASE 0x0800 /**< BLE L2CAP Event base. */ +/** @} */ +/** @} */ + +/** + * @defgroup BLE_EVENT_ENUM Enumerations + * @{ + */ +/** + * @brief BLE Common Events. + */ +enum BLE_COMMON_EVTS +{ + BLE_COMMON_EVT_STACK_INIT = BLE_COMMON_EVT_BASE, /**< BLE Stack init complete event. */ + BLE_COMMON_EVT_MAX, +}; + +/**@brief BLE GAP Managerment Events. */ +enum BLE_GAPM_EVTS +{ + BLE_GAPM_EVT_CH_MAP_SET = BLE_GAPM_EVT_BASE, /**< Channel Map Set complete event. */ + BLE_GAPM_EVT_WHITELIST_SET, /**< Whitelist Set complete event. */ + BLE_GAPM_EVT_PER_ADV_LIST_SET, /**< Periodic Advertising List Set complete event. */ + BLE_GAPM_EVT_PRIVACY_MODE_SET, /**< Privacy Mode for Peer Device Set complete event. */ + BLE_GAPM_EVT_LEPSM_REGISTER, /**< LEPSM Register complete event. */ + BLE_GAPM_EVT_LEPSM_UNREGISTER, /**< LEPSM Unregister complete event. */ + BLE_GAPM_EVT_DEV_INFO_GOT, /**< Device Info Get event. */ + BLE_GAPM_EVT_ADV_START, /**< Advertising Start complete event. */ + BLE_GAPM_EVT_ADV_STOP, /**< Advertising Stop complete event. */ + BLE_GAPM_EVT_SCAN_REQUEST, /**< Scan Request event. */ + BLE_GAPM_EVT_ADV_DATA_UPDATE, /**< Advertising Data update event. */ + BLE_GAPM_EVT_SCAN_START, /**< Scan Start complete event. */ + BLE_GAPM_EVT_SCAN_STOP, /**< Scan Stop complete event. */ + BLE_GAPM_EVT_ADV_REPORT, /**< Advertising Report event. */ + BLE_GAPM_EVT_SYNC_ESTABLISH, /**< Periodic Advertising Synchronization Establish event. */ + BLE_GAPM_EVT_SYNC_STOP, /**< Periodic Advertising Synchronization Stop event. */ + BLE_GAPM_EVT_SYNC_LOST, /**< Periodic Advertising Synchronization Lost event. */ + BLE_GAPM_EVT_READ_RSLV_ADDR, /**< Read Resolvable Address event. */ + BLE_GAPM_EVT_MAX, +}; + +/**@brief BLE GAP Connection Control Events. */ +enum BLE_GAPC_EVTS +{ + BLE_GAPC_EVT_PHY_UPDATED = BLE_GAPC_EVT_BASE, /**< PHY Update event. */ + BLE_GAPC_EVT_CONNECTED, /**< Connected event. */ + BLE_GAPC_EVT_DISCONNECTED, /**< Disconnected event. */ + BLE_GAPC_EVT_CONNECT_CANCLE, /**< Connect Cancle event. */ + BLE_GAPC_EVT_AUTO_CONN_TIMEOUT, /**< Auto Connect Timeout event. */ + BLE_GAPC_EVT_CONN_PARAM_UPDATED, /**< Connect Parameter Updated event. */ + BLE_GAPC_EVT_CONN_PARAM_UPDATE_REQ, /**< Connect Parameter Request event. */ + BLE_GAPC_EVT_PEER_NAME_GOT, /**< peer Name Get event. */ + BLE_GAPC_EVT_CONN_INFO_GOT, /**< Connect Info Get event. */ + BLE_GAPC_EVT_PEER_INFO_GOT, /**< Peer Info Get event. */ + BLE_GAPC_EVT_DATA_LENGTH_UPDATED, /**< Data Length Updated event. */ + BLE_GAPC_EVT_MAX, +}; + +/**@brief BLE GATT Common Events. */ +enum BLE_GATT_COMMON_EVTS +{ + BLE_GATT_COMMON_EVT_MTU_EXCHANGE = BLE_GATT_COMMON_EVT_BASE, /**< MTU Exchange event. */ + BLE_GATT_COMMON_EVT_PRF_REGISTER, /**< Service Register event. */ + BLE_GATT_COMMON_EVT_MAX, +}; + +/**@brief BLE GATTS Events. */ +enum BLE_GATTS_EVTS +{ + BLE_GATTS_EVT_READ_REQUEST = BLE_GATTS_EVT_BASE, /**< GATTS Read Request event .*/ + BLE_GATTS_EVT_WRITE_REQUEST, /**< GATTS Write Request event .*/ + BLE_GATTS_EVT_PREP_WRITE_REQUEST, /**< GATTS Prepare Write Request event .*/ + BLE_GATTS_EVT_NTF_IND, /**< GATTS Notify or Indicate Complete event .*/ + BLE_GATTS_EVT_CCCD_RECOVERY, /**< GATTS CCCD Recovery event .*/ + BLE_GATTS_EVT_MAX, +}; + +/**@brief BLE GATTC Events. */ +enum BLE_GATTC_EVTS +{ + BLE_GATTC_EVT_SRVC_BROWSE = BLE_GATTC_EVT_BASE, /**< GATTC Service Browse event .*/ + BLE_GATTC_EVT_PRIMARY_SRVC_DISC, /**< GATTC Primary Service Discovery event .*/ + BLE_GATTC_EVT_INCLUDE_SRVC_DISC, /**< GATTC Include Service Discovery event .*/ + BLE_GATTC_EVT_CHAR_DISC, /**< GATTC Characteristic Discovery event .*/ + BLE_GATTC_EVT_CHAR_DESC_DISC, /**< GATTC Characteristic Descriptor Discovery event .*/ + BLE_GATTC_EVT_READ_RSP, /**< GATTC Read Response event. */ + BLE_GATTC_EVT_WRITE_RSP, /**< GATTC Write Response event. */ + BLE_GATTC_EVT_NTF_IND, /**< GATTC Notify or Indicate Receive event. */ + BLE_GATTC_EVT_MAX, +}; + +/**@brief BLE SEC Events. */ +enum BLE_SEC_EVTS +{ + BLE_SEC_EVT_LINK_ENC_REQUEST = BLE_SEC_EVT_BASE, /**< Link Encrypte Request event. */ + BLE_SEC_EVT_LINK_ENCRYPTED, /**< Link Encrypted event. */ + BLE_SEC_EVT_LTK_REQ, /**< LTK Request event. */ + BLE_SEC_EVT_KEY_PRESS_NTF, /**< Key Press event. */ + BLE_SEC_EVT_KEY_MISSING, /**< Key Missing event. */ + BLE_SEC_EVT_MAX, +}; + +/**@brief BLE L2CAP Events. */ +enum BLE_L2CAP_EVTS +{ + BLE_L2CAP_EVT_CONN_REQ = BLE_L2CAP_EVT_BASE, /**< L2cap Connect Request event. */ + BLE_L2CAP_EVT_CONN_IND, /**< L2cap Connected Indicate event. */ + BLE_L2CAP_EVT_ADD_CREDITS_IND, /**< L2cap Credits Add Indicate event. */ + BLE_L2CAP_EVT_DISCONNECTED, /**< L2cap Disconnected event. */ + BLE_L2CAP_EVT_SDU_RECV, /**< L2cap SDU Receive event. */ + BLE_L2CAP_EVT_SDU_SEND, /**< L2cap SDU Send event. */ + BLE_L2CAP_EVT_ADD_CREDITS_CPLT, /**< L2cap Credits Add Completed event. */ + BLE_L2CAP_EVT_MAX, +}; +/** @} */ + +/** @addtogroup BLE_COMMEN_STRUCTURES Structures + * @{ + */ +/**@brief BLE Event Information. */ +typedef struct +{ + uint16_t evt_id; /**< Event ID. */ + uint16_t evt_status; /**< Event Status. */ + union + { + ble_gapm_evt_t gapm_evt; /**< BLE GAP Management Event. */ + ble_gapc_evt_t gapc_evt; /**< BLE GAP Connection Control Event. */ + ble_gatts_evt_t gatts_evt; /**< BLE GATT Server Event. */ + ble_gattc_evt_t gattc_evt; /**< BLE GATT Client Event. */ + ble_gatt_common_evt_t gatt_common_evt; /**< BLE GATT Common Event. */ + ble_sec_evt_t sec_evt; /**< BLE Security Event. */ + ble_l2cap_evt_t l2cap_evt; /**< BLE L2CAP Event. */ + } evt; /**< BLE Event parameter. */ +} ble_evt_t; +/** @} */ + +/** @addtogroup BLE_EVENT_TYPEDEF Typedefs + * @{ + */ +/**@brief The BLE event handler type. */ +typedef void (*ble_evt_handler_t)(const ble_evt_t *p_evt); +/** @} */ + +#endif +/** @} */ +/** @} */ + + + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gapc.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gapc.h old mode 100755 new mode 100644 index 3c7bf34..552a314 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gapc.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gapc.h @@ -35,142 +35,116 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -* @brief Definitions and prototypes for the BLE SDK interface. -*/ - -/** -* @addtogroup BLE_GAP Generic Access Profile (GAP) -* @{ -* @brief Definitions and prototypes for the GAP interface. -*/ - -/** -* @defgroup BLE_GAPC Generic Access Profile (GAP) Connection Control -* @{ -* @brief Definitions and prototypes for the GAP Connection Control interface. -*/ + /** + * @addtogroup BLE + * @{ + * @brief Definitions and prototypes for the BLE SDK interface. + */ + + /** + * @addtogroup BLE_GAP Generic Access Profile (GAP) + * @{ + * @brief Definitions and prototypes for the GAP interface. + */ + + /** + * @defgroup BLE_GAPC Generic Access Profile (GAP) Connection Control + * @{ + * @brief Definitions and prototypes for the GAP Connection Control interface. + */ #ifndef __BLE_GAPC_H__ #define __BLE_GAPC_H__ -#include // Standard Integer -#include +#include "ble_error.h" #include "gr55xx_sys_cfg.h" +#include // Standard Integer +#include +#include /** * @defgroup BLE_GAPC_DEFINES Defines * @{ */ -#define GAP_CHNL_MAP_LEN 0x05 /**< The length of channel map. */ -#define GAP_FEATS_LEN 0x08 /**< The length of features. */ -#define GAP_ADDR_LEN 0x06 /**< The length of address. */ -#define GAP_INVALID_CONN_INDEX 0xFF /**< Invalid connection index. */ +#define BLE_GAP_CHNL_MAP_LEN 0x05 /**< The length of channel map. */ +#define BLE_GAP_FEATS_LEN 0x08 /**< The length of features. */ +#define BLE_GAP_ADDR_LEN 0x06 /**< The length of address. */ +#define BLE_GAP_INVALID_CONN_INDEX 0xFF /**< Invalid connection index. */ /**@defgroup BLE_GAP_ADDR_TYPES GAP Address types * @{ */ -#define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public (identity) address.*/ -#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static (identity) address. */ +#define BLE_GAP_ADDR_TYPE_PUBLIC 0x00 /**< Public (identity) address.*/ +#define BLE_GAP_ADDR_TYPE_RANDOM_STATIC 0x01 /**< Random static (identity) address. */ /**@} */ /**@defgroup BLE_GAP_PHY_OPTIONS GAP PHY OPTIONS (bitmask) * @{ */ -#define PHY_OPT_NO_CODING 0x00 /**< The Host has no preferred coding when transmitting on the LE Coded PHY. */ -#define PHY_OPT_S2_CODING 0x01 /**< The Host prefers that S=2 coding be used when transmitting on the LE Coded PHY. */ -#define PHY_OPT_S8_CODING 0x02 /**< The Host prefers that S=8 coding be used when transmitting on the LE Coded PHY. */ +#define BLE_GAP_PHY_OPT_NO_CODING 0x00 /**< The Host has no preferred coding when transmitting on the LE Coded PHY. */ +#define BLE_GAP_PHY_OPT_S2_CODING 0x01 /**< The Host prefers that S=2 coding be used when transmitting on the LE Coded PHY. */ +#define BLE_GAP_PHY_OPT_S8_CODING 0x02 /**< The Host prefers that S=8 coding be used when transmitting on the LE Coded PHY. */ /**@} */ /** @} */ /** - * @defgroup BLE_SDK_GAP_ENUM Enumerations + * @defgroup BLE_GAPC_ENUM Enumerations * @{ */ /** @brief The operation code used to get connection info */ -typedef enum { - GAP_GET_CON_RSSI = 0, /**< Get connection RSSI info. */ - GAP_GET_CON_CHANNEL_MAP, /**< Get connection channel map. */ - GAP_GET_PHY, /**< Get connection PHY. */ - GAP_GET_CHAN_SEL_ALGO /**< Get selection algorithm for connection channel. */ -} gap_get_conn_info_op_t; +typedef enum +{ + BLE_GAP_GET_CON_RSSI = 0, /**< Get connection RSSI info. */ + BLE_GAP_GET_CON_CHANNEL_MAP, /**< Get connection channel map. */ + BLE_GAP_GET_PHY, /**< Get connection PHY. */ + BLE_GAP_GET_CHAN_SEL_ALGO /**< Get selection algorithm for connection channel. */ +} ble_gap_get_conn_info_op_t; /**@brief The operation code used to get peer device info. */ -typedef enum { - GAP_GET_PEER_VERSION = 0, /**< Get peer device version info. */ - GAP_GET_PEER_FEATURES /**< Get peer device features info. */ -} gap_get_peer_info_op_t; - -/** @brief Advertising report type. */ -typedef enum { - GAP_REPORT_TYPE_ADV_EXT = 0, /**< Extended advertising report. */ - GAP_REPORT_TYPE_ADV_LEG, /**< Legacy advertising report. */ - GAP_REPORT_TYPE_SCAN_RSP_EXT, /**< Extended scan response report. */ - GAP_REPORT_TYPE_SCAN_RSP_LEG, /**< Legacy scan response report. */ - GAP_REPORT_TYPE_PER_ADV, /**< Periodic advertising report. */ -} gap_adv_report_type_t; - -/** @brief Advertising report information. */ -typedef enum { - GAP_REPORT_INFO_COMPLETE_BIT = (1 << 0), /**< Report is complete. */ - GAP_REPORT_INFO_CONN_ADV_BIT = (1 << 1), /**< Connectable advertising. */ - GAP_REPORT_INFO_SCAN_ADV_BIT = (1 << 2), /**< Scannable advertising. */ - GAP_REPORT_INFO_DIR_ADV_BIT = (1 << 3), /**< Directed advertising. */ -} gap_adv_report_info_t; - -/** @brief Stop reason code. */ -typedef enum { - GAP_STOPPED_REASON_TIMEOUT = 0, /**< Stop with timeout. */ - GAP_STOPPED_REASON_ON_USER, /**< Stop with user stopping it actively. */ - GAP_STOPPED_REASON_CONN_EST /**< Stop with connection established. */ -} gap_stopped_reason_t; +typedef enum +{ + BLE_GAP_GET_PEER_VERSION = 0, /**< Get peer device version info. */ + BLE_GAP_GET_PEER_FEATURES /**< Get peer device features info. */ +} ble_gap_get_peer_info_op_t; /** @brief Device role of LL layer type */ -typedef enum { - GAP_LL_ROLE_MASTER = 0, /**< Master role. */ - GAP_LL_ROLE_SLAVE = 1, /**< Slave role. */ -} gap_ll_role_type_t; +typedef enum +{ + BLE_GAP_LL_ROLE_MASTER = 0, /**< Master role. */ + BLE_GAP_LL_ROLE_SLAVE = 1, /**< Slave role. */ +} ble_gap_ll_role_type_t; /** * @brief Operation code used to set param(s). */ -typedef enum { - GAP_OPCODE_CHNL_MAP_SET, /**< Set Channel Map. */ - GAP_OPCODE_WHITELIST_SET, /**< Set white list. */ - GAP_OPCODE_PER_ADV_LIST_SET, /**< Set periodic advertising list. */ - GAP_OPCODE_PRIVACY_MODE_SET, /**< Set privacy mode for peer device. */ -} gap_param_set_op_id_t; - -/** - * @brief Operation code used to read resolvable address. - */ -typedef enum { - GAP_OPCODE_LOCAL_RSLV_ADDR_READ, /**< Local resolvable address operation. */ - GAP_OPCODE_PEER_RSLV_ADDR_READ, /**< Peer resolvable address operation. */ -} gap_rslv_addr_read_op_id_t; +typedef enum +{ + BLE_GAP_OPCODE_CHNL_MAP_SET, /**< Set Channel Map. */ + BLE_GAP_OPCODE_WHITELIST_SET, /**< Set white list. */ + BLE_GAP_OPCODE_PER_ADV_LIST_SET, /**< Set periodic advertising list. */ + BLE_GAP_OPCODE_PRIVACY_MODE_SET, /**< Set privacy mode for peer device. */ +} ble_gap_param_set_op_id_t; /** * @brief Operation code used for LEPSM manager. */ -typedef enum { - GAP_OPCODE_LEPSM_REGISTER, /**< LEPSM register operation. */ - GAP_OPCODE_LEPSM_UNREGISTER, /**< LEPSM unregister operation. */ -} gap_psm_manager_op_id_t; +typedef enum +{ + BLE_GAP_OPCODE_LEPSM_REGISTER, /**< LEPSM register operation. */ + BLE_GAP_OPCODE_LEPSM_UNREGISTER, /**< LEPSM unregister operation. */ +} ble_gap_psm_manager_op_id_t; /** * @brief The specified reason for terminating a connection. */ -typedef enum { - GAP_HCI_AUTHENTICATION_FAILURE = 0x05, /**< Authentication Failure. */ - GAP_HCI_REMOTE_USER_TERMINATED_CONNECTION = 0x13, /**< Remote User Terminated Connection. */ - GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14, /**< Remote Device Terminated Connection due to - Low Resources . */ - GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15, /**< Remote Device Terminated Connection due to - Power Off. */ - GAP_HCI_UNSUPPORTED_REMOTE_FEATURE = 0x1A, /**< Unsupported Remote Feature. */ - GAP_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED = 0X29, /**< Pairing With Unit Key Not Supported. */ - GAP_HCI_CONN_INTERVAL_UNACCEPTABLE = 0x3B, /**< Unacceptable Connection Parameters. */ -} gap_disconn_reason_t; +typedef enum +{ + BLE_GAP_HCI_AUTHENTICATION_FAILURE = 0x05, /**< Authentication Failure. */ + BLE_GAP_HCI_REMOTE_USER_TERMINATED_CONNECTION = 0x13, /**< Remote User Terminated Connection. */ + BLE_GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES = 0x14, /**< Remote Device Terminated Connection due to Low Resources . */ + BLE_GAP_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF = 0x15, /**< Remote Device Terminated Connection due to Power Off. */ + BLE_GAP_HCI_UNSUPPORTED_REMOTE_FEATURE = 0x1A, /**< Unsupported Remote Feature. */ + BLE_GAP_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED = 0X29, /**< Pairing With Unit Key Not Supported. */ + BLE_GAP_HCI_CONN_INTERVAL_UNACCEPTABLE = 0x3B, /**< Unacceptable Connection Parameters. */ +} ble_gap_disconn_reason_t; /** @} */ @@ -180,593 +154,312 @@ typedef enum { */ /** @brief The struct of device version. */ -typedef struct { - uint8_t hci_ver; /**< HCI version. */ - uint8_t lmp_ver; /**< LMP version. */ - uint8_t host_ver; /**< Host version. */ - uint16_t hci_subver; /**< HCI subversion. */ - uint16_t lmp_subver; /**< LMP subversion. */ - uint16_t host_subver; /**< Host subversion. */ - uint16_t manuf_name; /**< Manufacturer name. */ -} gap_dev_version_ind_t; +typedef struct +{ + uint8_t hci_ver; /**< HCI version. */ + uint8_t lmp_ver; /**< LMP version. */ + uint8_t host_ver; /**< Host version. */ + uint16_t hci_subver; /**< HCI subversion. */ + uint16_t lmp_subver; /**< LMP subversion. */ + uint16_t host_subver; /**< Host subversion. */ + uint16_t manuf_name; /**< Manufacturer name. */ +} ble_gap_dev_version_ind_t; /** @brief The struct of address. */ -typedef struct { - uint8_t addr[GAP_ADDR_LEN]; /**< 6-byte array address value. */ -} gap_addr_t; +typedef struct +{ + uint8_t addr[BLE_GAP_ADDR_LEN]; /**< 6-byte array address value. */ +} ble_gap_addr_t; /** @brief The struct of broadcast address with broadcast type. */ -typedef struct { - gap_addr_t gap_addr; /**< Device BD Address. */ - uint8_t addr_type; /**< Address type of the device: 0=public/1=random. please @ref BLE_GAP_ADDR_TYPES. */ -} gap_bdaddr_t; +typedef struct +{ + ble_gap_addr_t gap_addr; /**< Device BD Address. */ + uint8_t addr_type; /**< Address type of the device: 0=public/1=random. please @ref BLE_GAP_ADDR_TYPES. */ +} ble_gap_bdaddr_t; /** @brief Get broadcast address struct. */ -typedef struct { - uint8_t index; /**< Advertsing index. The valid range is: 0 - 4. */ - gap_bdaddr_t bd_addr; /**< BD address. */ -} gap_get_bd_addr_t; +typedef struct +{ + uint8_t index; /**< Advertsing index. The valid range is: 0 - 4. */ + ble_gap_bdaddr_t bd_addr; /**< BD address. */ +} ble_gap_get_bd_addr_t; /** @brief TX power info struct. */ -typedef struct { - int8_t power_lvl; /**< Advertising channel TX power level. Range: -20 to 10. Unit: dBm. Accuracy: +/-4dB. */ -} gap_dev_adv_tx_power_t; +typedef struct +{ + int8_t power_lvl; /**< Advertising channel TX power level. Range: -20 to 10. Unit: dBm. Accuracy: +/-4dB. */ +} ble_gap_dev_adv_tx_power_t; /** @brief TX power info struct. */ -typedef struct { +typedef struct +{ int8_t min_tx_pwr; /**< MIN of TX power. Size: 1 octet (signed integer). Range: -127 to +126. Unit: dBm. */ int8_t max_tx_pwr; /**< MAX of TX power. Size: 1 octet (signed integer). Range: -127 to +126. Unit: dBm. */ -} gap_dev_tx_power_t; +} ble_gap_dev_tx_power_t; /** @brief Max data length info struct. */ -typedef struct { - uint16_t suppted_max_tx_octets; /**< Maximum number of payload octets that the local Controller supports - for transmission of a single Link Layer packet on a data connection. - Range: 0x001B-0x00FB (all other values reserved for future use). */ - uint16_t suppted_max_tx_time; /**< Maximum time, in microseconds, that the local Controller supports - for transmission of a single Link Layer packet on a data connection. - Range: 0x0148-0x4290 (all other values reserved for future use). */ - uint16_t suppted_max_rx_octets; /**< Maximum number of payload octets that the local Controller supports - for reception of a single Link Layer packet on a data connection. - Range: 0x001B-0x00FB (all other values reserved for future use). */ - uint16_t suppted_max_rx_time; /**< Maximum time, in microseconds, that the local Controller supports - for reception of a single Link Layer packet on a data connection. - Range: 0x0148-0x4290 (all other values reserved for future use). */ -} gap_max_data_len_t; +typedef struct +{ + uint16_t suppted_max_tx_octets; /**< Maximum number of payload octets that the local Controller supports for transmission of a single Link Layer packet on a data connection. + Range: 0x001B-0x00FB (all other values reserved for future use). */ + uint16_t suppted_max_tx_time; /**< Maximum time, in microseconds, that the local Controller supports for transmission of a single Link Layer packet on a data connection. + Range: 0x0148-0x4290 (all other values reserved for future use). */ + uint16_t suppted_max_rx_octets; /**< Maximum number of payload octets that the local Controller supports for reception of a single Link Layer packet on a data connection. + Range: 0x001B-0x00FB (all other values reserved for future use). */ + uint16_t suppted_max_rx_time; /**< Maximum time, in microseconds, that the local Controller supports for reception of a single Link Layer packet on a data connection. + Range: 0x0148-0x4290 (all other values reserved for future use). */ +} ble_gap_max_data_len_t; /** @brief Suggested default data length info. */ -typedef struct { - uint16_t suggted_max_tx_octets; /**< The Host's suggested value for the Controller's maximum transmitted number of - payload octets to be used for new connections. - Range: 0x001B-0x00FB (all other values reserved for future use), - default: 0x001B */ - uint16_t suggted_max_tx_time; /**< The Host's suggested value for the Controller's maximum packet - transmissiontime to be used for new connections. - Range: 0x0148-0x4290 (all other values reserved for future use), - default: 0x0148 */ -} gap_sugg_dflt_data_len_t; +typedef struct +{ + uint16_t suggted_max_tx_octets; /**< The Host's suggested value for the Controller's maximum transmitted number of payload octets to be used for new connections. + Range: 0x001B-0x00FB (all other values reserved for future use), default: 0x001B */ + uint16_t suggted_max_tx_time; /**< The Host's suggested value for the Controller's maximum packet transmission time to be used for new connections. + Range: 0x0148-0x4290 (all other values reserved for future use), default: 0x0148*/ +} ble_gap_sugg_dflt_data_len_t; /** @brief Number of available advertising sets info. */ -typedef struct { - uint8_t nb_adv_sets; /**< Number of available advertising sets. */ -} gap_nb_adv_sets_t; +typedef struct +{ + uint8_t nb_adv_sets; /**< Number of available advertising sets. */ +} ble_gap_nb_adv_sets_t; /** @brief Maximum advertising data length info. */ -typedef struct { - uint16_t length; /**< Maximum advertising data length supported by controller. */ -} gap_max_adv_data_len_ind_t; +typedef struct +{ + uint16_t length; /**< Maximum advertising data length supported by controller. */ +} ble_gap_max_adv_data_len_ind_t; /** @brief RF path compensation values info. */ -typedef struct { - uint16_t tx_path_comp; /**< RF TX path compensation. */ - uint16_t rx_path_comp; /**< RF RX path compensation. */ -} gap_dev_rf_path_comp_ind_t; +typedef struct +{ + uint16_t tx_path_comp; /**< RF TX path compensation. */ + uint16_t rx_path_comp; /**< RF RX path compensation. */ +} ble_gap_dev_rf_path_comp_ind_t; /** @brief Device info. */ -typedef union { - gap_dev_version_ind_t dev_version; /**< Version info. */ - gap_get_bd_addr_t get_bd_addr; /**< Device BD address info. */ - gap_dev_adv_tx_power_t adv_tx_power; /**< Advertising TX power info. */ - gap_sugg_dflt_data_len_t sugg_dflt_data_len; /**< Suggested default data length info. */ - gap_max_data_len_t max_data_len; /**< Suggested MAX data length info. */ - gap_nb_adv_sets_t nb_adv_sets; /**< Number of available advertising sets. */ - gap_max_adv_data_len_ind_t max_adv_data_len; /**< Maximum advertising data length info. */ - gap_dev_tx_power_t dev_tx_power; /**< Device TX power info. */ - gap_dev_rf_path_comp_ind_t dev_rf_path_comp; /**< RF path compensation values. */ -} gap_dev_info_t; - -/** @brief Get device info operation struct. */ -typedef struct { - uint8_t operation; /**< Operation code. @see enum gap_dev_info_get_type_t. */ - gap_dev_info_t dev_info; /**< Device info. */ -} gap_dev_info_get_t; - -/** @brief Read resolvable address info struct. */ -typedef struct { - uint8_t op_code; /**< Operation code. @see enum gap_rslv_addr_read_op_id_t. */ - gap_addr_t gap_addr; /**< Resolvable address info. */ -} gap_rslv_addr_read_t; - -/** @brief Sync established indication. */ -typedef struct { - uint8_t phy; /**< PHY on which synchronization has been established. @see gap_phy_type. */ - uint16_t intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms). */ - uint8_t adv_sid; /**< Advertising SID. */ - uint8_t clk_acc; /**< Advertiser clock accuracy. @see enum gapm_clk_acc. */ - gap_bdaddr_t bd_addr; /**< Advertiser address. */ - uint16_t sync_hdl; /**< Sync handle. */ -} gap_sync_established_ind_t; - -/** @brief APP receives the extended advertising report indication info struct. */ -typedef struct { - uint8_t adv_type; /**< Advertising type. @see enum gap_adv_report_type_t. */ - uint8_t adv_info; /**< Bit field providing information about the received report. - @see enum gap_adv_report_info_t. */ - gap_bdaddr_t broadcaster_addr; /**< Broadcaster device address. */ - gap_bdaddr_t direct_addr; /**< Target address (in case of a directed advertising report). */ - int8_t tx_pwr; /**< TX power (in dBm). */ - int8_t rssi; /**< RSSI (between -127 and +20 dBm). */ - uint8_t phy_prim; /**< Primary PHY on which advertising report has been received. */ - uint8_t phy_second; /**< Secondary PHY on which advertising report has been received. */ - uint8_t adv_sid; /**< Advertising SID , valid only for periodic advertising report. */ - uint16_t period_adv_intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms), - valid only for periodic advertising report. */ - uint8_t per_sync_idx; /**< Periodic syncronization index, - valid only for periodic advertising report. */ - uint16_t length; /**< Report length. */ - uint8_t data[ARRAY_EMPTY]; /**< Report. */ -} gap_ext_adv_report_ind_t; - -/** @brief Name of peer device indication. */ -typedef struct { - gap_addr_t peer_addr; /**< Peer device bd address. */ - uint8_t addr_type; /**< Peer device address type. */ - uint8_t name_len; /**< Peer device name length. */ - uint8_t name[ARRAY_EMPTY]; /**< Peer device name. */ -} gap_peer_name_ind_t; - -/** @brief Connection parameter used to update connection parameters. */ -typedef struct { - uint16_t interval; /**< Connection interval. Range: 0x0006 to 0x0C80. - Unit: 1.25 ms. Time range: 7.5 ms to 4 s. */ - uint16_t latency; /**< Latency for the connection in number of connection events. - Range: 0x0000 to 0x01F3. */ - uint16_t sup_timeout; /**< Supervision timeout for the LE link. Range: 0x000A to 0x0C80, - unit: 10 ms, time range: 100 ms to 32 s. */ -} gap_conn_update_cmp_t; +typedef union +{ + ble_gap_dev_version_ind_t dev_version; /**< Version info. */ + ble_gap_get_bd_addr_t get_bd_addr; /**< Device BD address info. */ + ble_gap_dev_adv_tx_power_t adv_tx_power; /**< Advertising TX power info. */ + ble_gap_sugg_dflt_data_len_t sugg_dflt_data_len; /**< Suggested default data length info. */ + ble_gap_max_data_len_t max_data_len; /**< Suggested MAX data length info. */ + ble_gap_nb_adv_sets_t nb_adv_sets; /**< Number of available advertising sets. */ + ble_gap_max_adv_data_len_ind_t max_adv_data_len; /**< Maximum advertising data length info. */ + ble_gap_dev_tx_power_t dev_tx_power; /**< Device TX power info. */ + ble_gap_dev_rf_path_comp_ind_t dev_rf_path_comp; /**< RF path compensation values. */ +} ble_gap_dev_info_t; /** @brief The parameter of connection. */ -typedef struct { - uint16_t interval_min; /**< Minimum value for the connection interval. - This shall be less than or equal to Conn_Interval_Max. - Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s */ - uint16_t interval_max; /**< Maximum value for the connection interval. - This shall be greater than or equal to Conn_Interval_Min. - Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s. */ - uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. - Range: 0x0000 to 0x01F3. */ - uint16_t sup_timeout; /**< Supervision timeout for the LE link. Range: 0x000A to 0x0C80, - unit: 10 ms, time range: 100 ms to 32 s. */ -} gap_conn_param_t; +typedef struct +{ + uint16_t interval_min; /**< Minimum value for the connection interval. This shall be less than or equal to Conn_Interval_Max. + Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s*/ + uint16_t interval_max; /**< Maximum value for the connection interval. This shall be greater than or equal to Conn_Interval_Min. + Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s.*/ + uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */ + uint16_t sup_timeout; /**< Supervision timeout for the LE link. Range: 0x000A to 0x0C80, unit: 10 ms, time range: 100 ms to 32 s. */ +} ble_gap_conn_param_t; /** @brief The parameter of update connection. */ -typedef struct { - uint16_t interval_min; /**< Minimum value for the connection interval. - This shall be less than or equal to Conn_Interval_Max. - Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s */ - uint16_t interval_max; /**< Maximum value for the connection interval. - This shall be greater than or equal to Conn_Interval_Min. - Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s. */ - uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. - Range: 0x0000 to 0x01F3. */ - uint16_t sup_timeout; /**< Supervision timeout for the LE link. range: 0x000A to 0x0C80, - unit: 10 ms, Time range: 100 ms to 32 s. */ - uint16_t ce_len; /**< The length of connection event needed for this LE connection. - Range: 0x0002 to 0xFFFF, unit: 0.625 ms, time Range: 1.25 ms to 40.9 s. - recommended value: 0x0002 for 1M phy, 0x0006 for coded phy */ -} gap_conn_update_param_t; - -/** @brief Connection complete info. */ -typedef struct { - uint16_t - conhdl; /**< Connection_Handle. Range: 0x0000-0x0EFF (all other values reserved for future use). */ - uint16_t - con_interval; /**< Connection interval. Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s. */ - uint16_t - con_latency; /**< Latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */ - uint16_t - sup_to; /**< Connection supervision timeout. Range: 0x000A to 0x0C80, - unit: 10 ms, time range: 100 ms to 32 s. */ - uint8_t - clk_accuracy; /**< Clock accuracy (0x00: 500 ppm, 0x01: 250 ppm, 0x02: 150 ppm, 0x03: 100 ppm, 0x04: 75 ppm, - 0x05:50 ppm, 0x06:30 ppm, 0x07:20 ppm, others: reserved for future use). */ - uint8_t - peer_addr_type; /**< Peer address type(0x00: Public Device Address, 0x01 : Random Device Address, - others: reserved for future use). */ - gap_addr_t peer_addr; /**< Peer BT address. */ - gap_ll_role_type_t ll_role; /**< Device Role of LL Layer. */ -} gap_conn_cmp_t; +typedef struct +{ + uint16_t interval_min; /**< Minimum value for the connection interval. This shall be less than or equal to Conn_Interval_Max. + Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s*/ + uint16_t interval_max; /**< Maximum value for the connection interval. This shall be greater than or equal to Conn_Interval_Min. + Range: 0x0006 to 0x0C80, unit: 1.25 ms, time range: 7.5 ms to 4 s.*/ + uint16_t slave_latency; /**< Slave latency for the connection in number of connection events. Range: 0x0000 to 0x01F3. */ + uint16_t sup_timeout; /**< Supervision timeout for the LE link. range: 0x000A to 0x0C80, unit: 10 ms, Time range: 100 ms to 32 s. */ + uint16_t ce_len; /**< The length of connection event needed for this LE connection. Range: 0x0002 to 0xFFFF, unit: 0.625 ms, time Range: 1.25 ms to 40.9 s. + recommended value: 0x0002 for 1M phy, 0x0006 for coded phy */ +} ble_gap_conn_update_param_t; /** @brief Channel map structure. */ -typedef struct { - uint8_t map[GAP_CHNL_MAP_LEN]; /**< This parameter contains 37 1-bit fields. - The nth bit (n is in the range of 0 to 36) contains the value for - the link layer channel index n. - Channel n is unused = 0, channel n is used = 1. - The most significant bits are reserved for future use. */ -} gap_chnl_map_t; +typedef struct +{ + uint8_t map[BLE_GAP_CHNL_MAP_LEN]; /**< This parameter contains 37 1-bit fields. The nth bit (n is in the range of 0 to 36) contains the value for the link layer channel index n. + Channel n is unused = 0, channel n is used = 1. The most significant bits are reserved for future use.*/ +} ble_gap_chnl_map_t; /** @brief PHY info. */ -typedef struct { - uint8_t tx_phy; /**< LE PHY for data transmission. @see BLE_GAP_PHYS. */ - uint8_t rx_phy; /**< LE PHY for data reception. @see BLE_GAP_PHYS. */ -} gap_le_phy_ind_t; +typedef struct +{ + uint8_t tx_phy; /**< LE PHY for data transmission. @ref BLE_GAP_PHY_OPTIONS. */ + uint8_t rx_phy; /**< LE PHY for data reception. @ref BLE_GAP_PHY_OPTIONS. */ +} ble_gap_le_phy_ind_t; /** @brief Connection info. */ -typedef union { - int8_t rssi; /**< RSSI. */ - gap_chnl_map_t chnl_map; /**< channel map. */ - gap_le_phy_ind_t phy; /**< PHY indicaiton. */ - uint8_t chan_sel_algo; /**< Chanel Selection algorithm, 0x00: LE Channel Selection Algorithm #1 is used. - 0x01: LE Channel Selection Algorithm #2 is used.\n 0x02-0xFF: reserved. */ -} gap_conn_info_t; - -/** @brief The info of connecting operation. */ -typedef struct { - uint8_t opcode; /**< Operation code. See @ref gap_get_conn_info_op_t. */ - gap_conn_info_t info; /**< Connection info. */ -} gap_conn_info_param_t; +typedef union +{ + int8_t rssi; /**< RSSI. */ + ble_gap_chnl_map_t chnl_map; /**< channel map. */ + ble_gap_le_phy_ind_t phy; /**< PHY indicaiton. */ + uint8_t chan_sel_algo; /**< Chanel Selection algorithm, 0x00: LE Channel Selection Algorithm #1 is used. + 0x01: LE Channel Selection Algorithm #2 is used.\n 0x02-0xFF: reserved. */ +} ble_gap_conn_info_t; /** @brief Peer version info. */ -typedef struct { +typedef struct +{ uint16_t compid; /** // standard definitions +#include "ble_error.h" #include "ble_gapc.h" +#include +#include + /** @addtogroup BLE_GAPM Generic Access Profile (GAP) Management @{ @brief Definitions and prototypes for the GAP Management interface. */ + +/** @addtogroup BLE_GAPM_DEFINES Defines + * @{ */ -#define CO_BIT(pos) (1UL << (pos)) /**< Bit operation helper. */ -#define MAX_ADV_NUM 5 /**< Maximal advertising instance number. */ -#define MAX_PER_SYNC_NUM 5 /**< Maximal periodic syncronization instance number. */ -#define MAX_BOND_NUM 10 /**< Maximal bonding number. */ -#define MAX_WL_NUM 10 /**< Maximal white list number. */ +#define CO_BIT(pos)(1UL<<(pos)) /**< Bit operation helper. */ +#define BLE_GAP_MAX_ADV_NUM 5 /**< Maximal advertising instance number. */ +#define BLE_GAP_MAX_PER_SYNC_NUM 5 /**< Maximal periodic syncronization instance number. */ +#define BLE_GAP_MAX_BOND_NUM 10 /**< Maximal bonding number. */ +#define BLE_GAP_MAX_WL_NUM 10 /**< Maximal white list number. */ -#define MAX_PRD_ADV_NUM 4 /**< Maximal periodic advertising list number. */ -#define MAX_KEY_LEN 16 /**< The key length. */ -#define INVALID_ADV_IDX 0xFF /**< Invalid adv index. */ -#define BLE_GAP_DEVNAME_DEFAULT "GOODIX_BLE" /**< Default device name value. */ -#define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximal length of device name. */ +#define BLE_GAP_MAX_PRD_ADV_NUM 4 /**< Maximal periodic advertising list number. */ +#define BLE_GAP_MAX_KEY_LEN 16 /**< The key length. */ +#define BLE_GAP_NVALID_ADV_IDX 0xFF /**< Invalid adv index. */ +#define BLE_GAP_DEVNAME_DEFAULT "GOODIX_BLE" /**< Default device name value. */ +#define BLE_GAP_DEVNAME_MAX_LEN 248 /**< Maximal length of device name. */ #define BLE_APPEARANCE_UNKNOWN 0 /**< Unknown. */ #define BLE_APPEARANCE_GENERIC_PHONE 64 /**< Generic Phone. */ @@ -119,310 +125,295 @@ #define BLE_APPEARANCE_PULSE_OXIMETER_FINGERTIP 3137 /**< Fingertip (Pulse Oximeter subtype). */ #define BLE_APPEARANCE_PULSE_OXIMETER_WRIST_WORN 3138 /**< Wrist Worn(Pulse Oximeter subtype). */ #define BLE_APPEARANCE_GENERIC_WEIGHT_SCALE 3200 /**< Generic Weight Scale. */ -#define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Event. */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device - (Outdoor Sports Event subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device - (Outdoor Sports Event subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports - Event subtype). */ -#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports - Event subtype). */ +#define BLE_APPEARANCE_GENERIC_OUTDOOR_SPORTS_ACT 5184 /**< Generic Outdoor Sports Activity. */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_DISP 5185 /**< Location Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_DISP 5186 /**< Location and Navigation Display Device (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_POD 5187 /**< Location Pod (Outdoor Sports Activity subtype). */ +#define BLE_APPEARANCE_OUTDOOR_SPORTS_ACT_LOC_AND_NAV_POD 5188 /**< Location and Navigation Pod (Outdoor Sports Activity subtype). */ -/** @defgroup BLE_GAP_PHYS GAP PHYs (bitmask) +/**@defgroup BLE_GAP_PHYS GAP PHYs (bitmask) * @{ */ #define BLE_GAP_PHY_ANY 0x00 /**< No preferred PHY. */ #define BLE_GAP_PHY_LE_1MBPS (1 << 0) /**< LE 1M PHY preferred for an active link. */ #define BLE_GAP_PHY_LE_2MBPS (1 << 1) /**< LE 2M PHY preferred for an active link. */ #define BLE_GAP_PHY_LE_CODED (1 << 2) /**< LE Coded PHY preferred for an active link. */ -/** @} */ +/**@} */ -/** @defgroup BLE_GAP_ADV_CHANNEL GAP ADV CHANNEL (bitmask) +/**@defgroup BLE_GAP_ADV_CHANNEL GAP ADV CHANNEL (bitmask) * @{ */ -#define GAP_ADV_CHANNEL_37 0x01 /**< Advertising Channel 37 (2402MHz). */ -#define GAP_ADV_CHANNEL_38 0x02 /**< Advertising Channel 38 (2426MHz). */ -#define GAP_ADV_CHANNEL_39 0x04 /**< Advertising Channel 39 (2480MHz). */ -#define GAP_ADV_CHANNEL_37_38_39 0x07 /**< Advertising Channel 37, 38, 39. */ -/** @} */ -/** @} */ +#define BLE_GAP_ADV_CHANNEL_37 0x01 /**< Advertising Channel 37 (2402MHz). */ +#define BLE_GAP_ADV_CHANNEL_38 0x02 /**< Advertising Channel 38 (2426MHz). */ +#define BLE_GAP_ADV_CHANNEL_39 0x04 /**< Advertising Channel 39 (2480MHz). */ +#define BLE_GAP_ADV_CHANNEL_37_38_39 0x07 /**< Advertising Channel 37, 38, 39. */ +/**@} */ +/**@} */ /** @addtogroup BLE_GAPM_ENUMERATIONS Enumerations * @{ */ /** * @brief GAP role options */ -typedef enum { +typedef enum +{ BLE_GAP_ROLE_NONE = 0x00, /**< No role set yet. */ BLE_GAP_ROLE_OBSERVER = 0x01, /**< Observer role. */ BLE_GAP_ROLE_BROADCASTER = 0x02, /**< Broadcaster role. */ BLE_GAP_ROLE_CENTRAL = (0x04 | BLE_GAP_ROLE_OBSERVER), /**< Master/Central role. */ BLE_GAP_ROLE_PERIPHERAL = (0x08 | BLE_GAP_ROLE_BROADCASTER), /**< Peripheral/Slave role. */ - BLE_GAP_ROLE_ALL = (BLE_GAP_ROLE_CENTRAL | BLE_GAP_ROLE_PERIPHERAL), /**< Device has all roles, - both peripheral and central. */ -} gap_role_t; + BLE_GAP_ROLE_ALL = (BLE_GAP_ROLE_CENTRAL | BLE_GAP_ROLE_PERIPHERAL), /**< Device has all roles, both peripheral and central. */ +} ble_gap_role_t; /** * @brief Own BD address source of the device */ -typedef enum { - BLE_GAP_OWN_ADDR_STATIC = 0, /**< Public or Private Static Address according to device address configuration. */ - BLE_GAP_OWN_ADDR_GEN_RSLV, /**< Generated resolvable private random address. */ - BLE_GAP_OWN_ADDR_GEN_NON_RSLV, /**< Generated non-resolvable private random address. */ -} gap_own_addr_t; +typedef enum +{ + BLE_GAP_OWN_ADDR_STATIC = 0, /**< Public or Private Static Address according to device address configuration. */ + BLE_GAP_OWN_ADDR_GEN_RSLV, /**< Generated resolvable private random address. */ + BLE_GAP_OWN_ADDR_GEN_NON_RSLV, /**< Generated non-resolvable private random address. */ +} ble_gap_own_addr_t; /** * @brief Write permissions of the device name characteristic */ -typedef enum { - BLE_GAP_WRITE_PERM_DISABLE = 0, /**< Disable write access. */ - BLE_GAP_WRITE_PERM_NOAUTH, /**< LE Security Mode 1, Level 1. - Link does not need to be encrypted or authenticated. */ - BLE_GAP_WRITE_PERM_UNAUTH, /**< LE Security Mode 1, Level 2. - Link needs to be encrypted, but not to be authenticated. */ - BLE_GAP_WRITE_PERM_AUTH, /**< LE Security Mode 1, Level 3. - Link needs to be encrypted and authenticated (MITM). */ - BLE_GAP_WRITE_PERM_SEC_CON, /**< LE Security Mode 1, Level 4. - Link needs to be encrypted and authenticated (secure connections). */ -} gap_dev_name_write_perm_t; +typedef enum +{ + BLE_GAP_WRITE_PERM_DISABLE = 0, /**< Disable write access. */ + BLE_GAP_WRITE_PERM_NOAUTH, /**< LE Security Mode 1, Level 1. Link does not need to be encrypted or authenticated. */ + BLE_GAP_WRITE_PERM_UNAUTH, /**< LE Security Mode 1, Level 2. Link needs to be encrypted, but not to be authenticated. */ + BLE_GAP_WRITE_PERM_AUTH, /**< LE Security Mode 1, Level 3. Link needs to be encrypted and authenticated (MITM). */ + BLE_GAP_WRITE_PERM_SEC_CON, /**< LE Security Mode 1, Level 4. Link needs to be encrypted and authenticated (secure connections). */ +} ble_gap_dev_name_write_perm_t; /** * @brief Advertising data type */ -typedef enum { - BLE_GAP_ADV_DATA_TYPE_DATA = 0, /**< Advertising data. */ - BLE_GAP_ADV_DATA_TYPE_SCAN_RSP, /**< Scan response data. */ - BLE_GAP_ADV_DATA_TYPE_PER_DATA, /**< Periodic advertising data. */ -} gap_adv_data_type_t; +typedef enum +{ + BLE_GAP_ADV_DATA_TYPE_DATA = 0, /**< Advertising data. */ + BLE_GAP_ADV_DATA_TYPE_SCAN_RSP, /**< Scan response data. */ + BLE_GAP_ADV_DATA_TYPE_PER_DATA, /**< Periodic advertising data. */ +} ble_gap_adv_data_type_t; -/** @brief Get device parameters operation code. */ -typedef enum { - BLE_GAP_GET_DEV_VERSION = 0, /**< Get version information for the local Controller. */ - BLE_GAP_GET_DEV_BDADDR, /**< Get local device BD Address. */ - // BLE_GAP_GET_DEV_ADV_TX_POWER, /**< Get the transmit power level used for LE advertising channel packets. */ +/**@brief Get device parameters operation code. */ +typedef enum +{ + BLE_GAP_GET_DEV_VERSION = 0, /**< Get version information for the local Controller. */ + BLE_GAP_GET_DEV_BDADDR, /**< Get local device BD Address. */ + //BLE_GAP_GET_DEV_ADV_TX_POWER, /**< Get the transmit power level used for LE advertising channel packets. */ BLE_GAP_GET_SUGGESTED_DFLT_LE_DATA_LEN, /**< Get suggested values (SuggestedMaxTxOctets and SuggestedMaxTxTime) - for the Controller's maximum transmitted number of payload octets - and maximum packet transmission time to be used for new connections. */ - BLE_GAP_GET_MAX_LE_DATA_LEN, /**< Get the Controller' maximum supported payload octets and packet - duration times for transmission and reception (supportedMaxTxOctets - and supportedMaxTxTime, supportedMaxRxOctets, - and supportedMaxRxTime). */ - BLE_GAP_GET_NB_ADV_SETS, /**< Read the maximum number of advertising sets currently supported - by the controller. */ + for the Controller's maximum transmitted number of payload octets + and maximum packet transmission time to be used for new connections. */ + BLE_GAP_GET_MAX_LE_DATA_LEN, /**< Get the Controller' maximum supported payload octets and packet duration + times for transmission and reception (supportedMaxTxOctets and supportedMaxTxTime, + supportedMaxRxOctets, and supportedMaxRxTime). */ + BLE_GAP_GET_NB_ADV_SETS, /**< Read the maximum number of advertising sets currently supported by the controller. */ BLE_GAP_GET_MAX_LE_ADV_DATA_LEN, /**< Get maximum data length for advertising data. */ - BLE_GAP_GET_DEV_TX_POWER, /**< Read the minimum and maximum transmit powers supported by the - Controller. */ + BLE_GAP_GET_DEV_TX_POWER, /**< Read the minimum and maximum transmit powers supported by the Controller. */ BLE_GAP_GET_DEV_RF_RF_PATH_COMP, /**< Get RF path compensation values. */ -} gap_dev_info_get_type_t; +} ble_gap_dev_info_get_type_t; -/** @brief GAP advertising modes. */ -typedef enum { - GAP_ADV_TYPE_ADV_IND = 0, /**< Undirected connectable and scannable mode. */ - GAP_ADV_TYPE_ADV_NONCONN_IND, /**< Non-connectable and non-scanable mode. */ - GAP_ADV_TYPE_ADV_SCAN_IND, /**< Undirected scannable mode. */ - GAP_ADV_TYPE_ADV_HIGH_DIRECT_IND, /**< Directed high duty cycle mode. */ - GAP_ADV_TYPE_ADV_LOW_DIRECT_IND, /**< Directed low duty cycle mode. */ -} gap_adv_mode_t; +/**@brief GAP advertising modes. */ +typedef enum +{ + BLE_GAP_ADV_TYPE_ADV_IND = 0, /**< Undirected connectable and scannable mode. */ + BLE_GAP_ADV_TYPE_ADV_NONCONN_IND, /**< Non-connectable and non-scanable mode. */ + BLE_GAP_ADV_TYPE_ADV_SCAN_IND, /**< Undirected scannable mode. */ + BLE_GAP_ADV_TYPE_ADV_HIGH_DIRECT_IND, /**< Directed high duty cycle mode. */ + BLE_GAP_ADV_TYPE_ADV_LOW_DIRECT_IND, /**< Directed low duty cycle mode. */ +} ble_gap_adv_mode_t; -/** @brief GAP discoverability modes. */ -typedef enum { - GAP_DISC_MODE_NON_DISCOVERABLE = 0, /**< Non-discoverable mode. */ - GAP_DISC_MODE_GEN_DISCOVERABLE, /**< General-discoverable mode. */ - GAP_DISC_MODE_LIM_DISCOVERABLE, /**< Limited-discoverable mode. */ - GAP_DISC_MODE_BROADCASTER, /**< Broadcaster mode. */ -} gap_disc_mode_t; +/**@brief GAP discoverability modes. */ +typedef enum +{ + BLE_GAP_DISC_MODE_NON_DISCOVERABLE = 0, /**< Non-discoverable mode. */ + BLE_GAP_DISC_MODE_GEN_DISCOVERABLE, /**< General-discoverable mode. */ + BLE_GAP_DISC_MODE_LIM_DISCOVERABLE, /**< Limited-discoverable mode. */ + BLE_GAP_DISC_MODE_BROADCASTER, /**< Broadcaster mode. */ +} ble_gap_disc_mode_t; /** * @brief Advertising filter policy */ -typedef enum { - GAP_ADV_ALLOW_SCAN_ANY_CON_ANY = 0, /**< Allow both scan and connection requests from anyone. */ - GAP_ADV_ALLOW_SCAN_WLST_CON_ANY, /**< Allow scan req from white-list devices only - and connection req from anyone. */ - GAP_ADV_ALLOW_SCAN_ANY_CON_WLST, /**< Allow scan req from anyone and connection req - from white-list devices only. */ - GAP_ADV_ALLOW_SCAN_WLST_CON_WLST, /**< Allow scan and connection requests from white-list devices only. */ -} gap_adv_filter_policy_t; +typedef enum +{ + BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_ANY = 0, /**< Allow both scan and connection requests from anyone. */ + BLE_GAP_ADV_ALLOW_SCAN_WLST_CON_ANY, /**< Allow scan req from white-list devices only and connection req from anyone. */ + BLE_GAP_ADV_ALLOW_SCAN_ANY_CON_WLST, /**< Allow scan req from anyone and connection req from white-list devices only. */ + BLE_GAP_ADV_ALLOW_SCAN_WLST_CON_WLST, /**< Allow scan and connection requests from white-list devices only. */ +} ble_gap_adv_filter_policy_t; /** * @brief Specify what PHY the Controller has changed for TX/RX. HCI:7.7.65.12 */ -typedef enum { - GAP_PHY_UNDEF_VALUE = 0, /**< Undefined LE PHY. */ - GAP_PHY_1MBPS_VALUE = 1, /**< LE 1M PHY. */ - GAP_PHY_2MBPS_VALUE = 2, /**< LE 2M PHY. */ - GAP_PHY_CODED_VALUE = 3, /**< LE Coded PHY. */ -} gap_le_phy_value_t; +typedef enum +{ + BLE_GAP_PHY_UNDEF_VALUE = 0, /**< Undefined LE PHY. */ + BLE_GAP_PHY_1MBPS_VALUE = 1, /**< LE 1M PHY. */ + BLE_GAP_PHY_2MBPS_VALUE = 2, /**< LE 2M PHY. */ + BLE_GAP_PHY_CODED_VALUE = 3, /**< LE Coded PHY. */ +} ble_gap_le_phy_value_t; /** * @brief Advertising type */ -typedef enum { - GAP_ADV_TYPE_LEGACY = 0, /**< Legacy advertising. */ - GAP_ADV_TYPE_EXTENDED, /**< Extended advertising. */ - GAP_ADV_TYPE_PERIODIC, /**< Periodic advertising. */ -} gap_adv_type_t; +typedef enum +{ + BLE_GAP_ADV_TYPE_LEGACY = 0, /**< Legacy advertising. */ + BLE_GAP_ADV_TYPE_EXTENDED, /**< Extended advertising. */ + BLE_GAP_ADV_TYPE_PERIODIC, /**< Periodic advertising. */ +} ble_gap_adv_type_t; /** * @brief Advertising properties bit field and bit positions */ -typedef enum { - GAP_ADV_PROP_CONNECTABLE_POS = 0, /**< Indicate that advertising is connectable, reception of CONNECT_REQ or +typedef enum +{ + BLE_GAP_ADV_PROP_CONNECTABLE_POS = 0, /**< Indicate that advertising is connectable, reception of CONNECT_REQ or UX_CONNECT_REQ PDUs is accepted. Not applicable for periodic advertising. */ - GAP_ADV_PROP_SCANNABLE_POS, /**< Indicate that advertising is scannable, reception of SCAN_REQ or - AUX_SCAN_REQ PDUs is accepted. */ - GAP_ADV_PROP_DIRECTED_POS, /**< Indicate that advertising targets at a specific device. - Only applicable in following cases: + BLE_GAP_ADV_PROP_SCANNABLE_POS, /**< Indicate that advertising is scannable, reception of SCAN_REQ or AUX_SCAN_REQ PDUs is accepted. */ + BLE_GAP_ADV_PROP_DIRECTED_POS, /**< Indicate that advertising targets at a specific device. Only applicable in following cases: - Legacy advertising: if connectable - - Extended advertising: connectable or - (non-connectable and non-discoverable). */ - GAP_ADV_PROP_HDC_POS, /**< Indicate that High Duty Cycle has to be used for advertising on primary channel, + - Extended advertising: connectable or (non-connectable and non-discoverable). */ + BLE_GAP_ADV_PROP_HDC_POS, /**< Indicate that High Duty Cycle has to be used for advertising on primary channel, applicable only if created advertising is not an extended advertising. */ - GAP_ADV_PROP_USE_LEGACY_PDUS_POS, /**< Use legacy advertising PDUs. */ - GAP_ADV_PROP_ANONYMOUS_POS, /**< Enable anonymous mode. Device address will not appear in sending PDUs. + BLE_GAP_ADV_PROP_USE_LEGACY_PDUS_POS, /**< Use legacy advertising PDUs. */ + BLE_GAP_ADV_PROP_ANONYMOUS_POS, /**< Enable anonymous mode. Device address will not appear in sending PDUs. Valid only if the created advertising is an extended advertising. */ - GAP_ADV_PROP_TX_PWR_POS, /**< Include TX power in the extended header of the advertising PDU. + BLE_GAP_ADV_PROP_TX_PWR_POS, /**< Include TX power in the extended header of the advertising PDU. Valid only if the created advertising is not a legacy advertising. */ - GAP_ADV_PROP_PER_TX_PWR_POS, /**< Include TX power in the periodic advertising PDU. + BLE_GAP_ADV_PROP_PER_TX_PWR_POS, /**< Include TX power in the periodic advertising PDU. Valid only if the created advertising is a periodic advertising. */ - GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS, /**< Indicate if application must be informed - about receiving scan request PDUs. */ -} gap_adv_prop_pos_t; + BLE_GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS, /**< Indicate if application must be informed about receiving scan request PDUs. */ +} ble_gap_adv_prop_pos_t; /** * @brief Advertising properties bit field bit value */ -typedef enum { - GAP_ADV_PROP_CONNECTABLE_BIT = CO_BIT(GAP_ADV_PROP_CONNECTABLE_POS), - GAP_ADV_PROP_SCANNABLE_BIT = CO_BIT(GAP_ADV_PROP_SCANNABLE_POS), - GAP_ADV_PROP_DIRECTED_BIT = CO_BIT(GAP_ADV_PROP_DIRECTED_POS), - GAP_ADV_PROP_HDC_BIT = CO_BIT(GAP_ADV_PROP_HDC_POS), - GAP_ADV_PROP_USE_LEGACY_PDUS_BIT = CO_BIT(GAP_ADV_PROP_USE_LEGACY_PDUS_POS), - GAP_ADV_PROP_ANONYMOUS_BIT = CO_BIT(GAP_ADV_PROP_ANONYMOUS_POS), - GAP_ADV_PROP_TX_PWR_BIT = CO_BIT(GAP_ADV_PROP_TX_PWR_POS), - GAP_ADV_PROP_PER_TX_PWR_BIT = CO_BIT(GAP_ADV_PROP_PER_TX_PWR_POS), - GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT = CO_BIT(GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS), -} gap_adv_prop_t; +typedef enum +{ + BLE_GAP_ADV_PROP_CONNECTABLE_BIT = CO_BIT(BLE_GAP_ADV_PROP_CONNECTABLE_POS), + BLE_GAP_ADV_PROP_SCANNABLE_BIT = CO_BIT(BLE_GAP_ADV_PROP_SCANNABLE_POS), + BLE_GAP_ADV_PROP_DIRECTED_BIT = CO_BIT(BLE_GAP_ADV_PROP_DIRECTED_POS), + BLE_GAP_ADV_PROP_HDC_BIT = CO_BIT(BLE_GAP_ADV_PROP_HDC_POS), + BLE_GAP_ADV_PROP_USE_LEGACY_PDUS_BIT = CO_BIT(BLE_GAP_ADV_PROP_USE_LEGACY_PDUS_POS), + BLE_GAP_ADV_PROP_ANONYMOUS_BIT = CO_BIT(BLE_GAP_ADV_PROP_ANONYMOUS_POS), + BLE_GAP_ADV_PROP_TX_PWR_BIT = CO_BIT(BLE_GAP_ADV_PROP_TX_PWR_POS), + BLE_GAP_ADV_PROP_PER_TX_PWR_BIT = CO_BIT(BLE_GAP_ADV_PROP_PER_TX_PWR_POS), + BLE_GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT = CO_BIT(BLE_GAP_ADV_PROP_SCAN_REQ_NTF_EN_POS), +} ble_gap_adv_prop_t; /** * @brief Scanning types */ -typedef enum { - GAP_SCAN_ACTIVE = 0, /**< Active scan type. */ - GAP_SCAN_PASSIVE, /**< Passive scan type. */ -} gap_scan_type_t; +typedef enum +{ + BLE_GAP_SCAN_ACTIVE = 0, /**< Active scan type. */ + BLE_GAP_SCAN_PASSIVE, /**< Passive scan type. */ +} ble_gap_scan_type_t; /** * @brief Scanning modes */ -typedef enum { - GAP_SCAN_GEN_DISC_MODE = 0, /**< General discoverable mode. */ - GAP_SCAN_LIM_DISC_MODE, /**< Limited discoverable mode. */ - GAP_SCAN_OBSERVER_MODE, /**< Observer mode. */ -} gap_scan_mode_t; +typedef enum +{ + BLE_GAP_SCAN_GEN_DISC_MODE = 0, /**< General discoverable mode. */ + BLE_GAP_SCAN_LIM_DISC_MODE, /**< Limited discoverable mode. */ + BLE_GAP_SCAN_OBSERVER_MODE, /**< Observer mode. */ +} ble_gap_scan_mode_t; /** * @brief Duplicate filter policy */ -typedef enum { - GAP_SCAN_FILT_DUPLIC_DIS = 0, /**< Disable filtering of duplicate packets. */ - GAP_SCAN_FILT_DUPLIC_EN, /**< Enable filtering of duplicate packets. */ -} gap_scan_dup_filt_policy_t; +typedef enum +{ + BLE_GAP_SCAN_FILT_DUPLIC_DIS = 0, /**< Disable filtering of duplicate packets. */ + BLE_GAP_SCAN_FILT_DUPLIC_EN, /**< Enable filtering of duplicate packets. */ +} ble_gap_scan_dup_filt_policy_t; /** * @brief Extended scanning types */ -typedef enum { - GAP_EXT_SCAN_TYPE_GEN_DISC = 0, /**< General discovery. */ - GAP_EXT_SCAN_TYPE_LIM_DISC, /**< Limited discovery. */ - GAP_EXT_SCAN_TYPE_OBSERVER, /**< Observer. */ - GAP_EXT_SCAN_TYPE_SEL_OBSERVER, /**< Selective observer. */ - GAP_EXT_SCAN_TYPE_CONN_DISC, /**< Connectable discovery. */ - GAP_EXT_SCAN_TYPE_SEL_CONN_DISC, /**< Selective connectable discovery. */ -} gap_ext_scan_type_t; - -/** - * @brief Scanning properties bit field bit value - */ -typedef enum { - GAP_EXT_SCAN_PROP_PHY_1M_BIT = (1 << 0), /**< Scan advertisement on the LE 1M PHY. */ - GAP_EXT_SCAN_PROP_PHY_CODED_BIT = (1 << 1), /**< Scan advertisement on the LE Coded PHY. */ - GAP_EXT_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), /**< Active scan on LE 1M PHY (scan request PDUs may be sent). */ - GAP_EXT_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), /**< Active scan on LE Coded PHY (scan request PDUs may be sent). */ - GAP_EXT_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), /**< Accept directed advertising packets if the uesd RPA and - target address cannot be solved by the controller. */ - GAP_EXT_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), /**< Filter truncated advertising or scan response reports. */ -} gap_scan_prop_t; +typedef enum +{ + BLE_GAP_EXT_SCAN_TYPE_GEN_DISC = 0, /**< General discovery. */ + BLE_GAP_EXT_SCAN_TYPE_LIM_DISC, /**< Limited discovery. */ + BLE_GAP_EXT_SCAN_TYPE_OBSERVER, /**< Observer. */ + BLE_GAP_EXT_SCAN_TYPE_SEL_OBSERVER, /**< Selective observer. */ + BLE_GAP_EXT_SCAN_TYPE_CONN_DISC, /**< Connectable discovery. */ + BLE_GAP_EXT_SCAN_TYPE_SEL_CONN_DISC, /**< Selective connectable discovery. */ +} ble_gap_ext_scan_type_t; /** * @brief Filtering policy for duplicated packets */ -typedef enum { - GAP_EXT_DUP_FILT_DIS = 0, /**< Disable filtering of duplicated packets. */ - GAP_EXT_DUP_FILT_EN, /**< Enable filtering of duplicated packets. */ - GAP_EXT_DUP_FILT_EN_PERIOD, /**< Enable filtering of duplicated packets, reset for each scan period. */ -} gap_ext_scan_dup_filt_policy_t; +typedef enum +{ + BLE_GAP_EXT_DUP_FILT_DIS = 0, /**< Disable filtering of duplicated packets. */ + BLE_GAP_EXT_DUP_FILT_EN, /**< Enable filtering of duplicated packets. */ + BLE_GAP_EXT_DUP_FILT_EN_PERIOD, /**< Enable filtering of duplicated packets, reset for each scan period. */ +} ble_gap_ext_scan_dup_filt_policy_t; /** * @brief Initiating types */ -typedef enum { - GAP_INIT_TYPE_DIRECT_CONN_EST = 0, /**< Direct connection establishment: establish a connection with - an indicated device. */ - GAP_INIT_TYPE_AUTO_CONN_EST, /**< Automatic connection establishment: establish a connection with - all devices whose address is present in the white list. */ - GAP_INIT_TYPE_NAME_DISC, /**< Name discovery: establish a connection with an indicated device - in order to read content of its device name characteristic. - Connection is closed once this operation is stopped. */ -} gap_init_type_t; +typedef enum +{ + BLE_GAP_INIT_TYPE_DIRECT_CONN_EST = 0, /**< Direct connection establishment: establish a connection with an indicated device. */ + BLE_GAP_INIT_TYPE_AUTO_CONN_EST, /**< Automatic connection establishment: establish a connection with all devices whose address is present in the white list. */ + BLE_GAP_INIT_TYPE_NAME_DISC, /**< Name discovery: establish a connection with an indicated device in order to read content of its device name characteristic. Connection is closed once this operation is stopped. */ +} ble_gap_init_type_t; /** * @brief Initiating properties */ -typedef enum { - GAP_INIT_PROP_1M_BIT = (1 << 0), /**< Scan connectable advertisements on the LE 1M PHY. - Connection parameters for the LE 1M PHY are provided. */ - GAP_INIT_PROP_2M_BIT = (1 << 1), /**< Connection parameters for the LE 2M PHY are provided. */ - GAP_INIT_PROP_CODED_BIT = (1 << 2), /**< Scan connectable advertisements on the LE Coded PHY. - Connection parameters for the LE Coded PHY are provided. */ -} gap_init_prop_t; +typedef enum +{ + BLE_GAP_INIT_PROP_1M_BIT = (1 << 0), /**< Scan connectable advertisements on the LE 1M PHY. Connection parameters for the LE 1M PHY are provided. */ + BLE_GAP_INIT_PROP_2M_BIT = (1 << 1), /**< Connection parameters for the LE 2M PHY are provided. */ + BLE_GAP_INIT_PROP_CODED_BIT = (1 << 2), /**< Scan connectable advertisements on the LE Coded PHY. Connection parameters for the LE Coded PHY are provided. */ +} ble_gap_init_prop_t; /** * @brief Scanning properties bit field bit value */ -enum gap_scan_prop { - GAP_SCAN_PROP_PHY_1M_BIT = (1 << 0), /**< Scan advertisement on the LE 1M PHY. */ - GAP_SCAN_PROP_PHY_CODED_BIT = (1 << 1), /**< Scan advertisement on the LE Coded PHY. */ - GAP_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), /**< Active scan on LE 1M PHY (scan request PDUs may be sent). */ - GAP_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), /**< Active scan on LE Coded PHY (scan request PDUs may be sent). */ - GAP_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), /**< Accept directed advertising packets if the used RPA and - target address cannot be solved by the controller. */ - GAP_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), /**< Filter truncated advertising or scan response reports. */ -}; +typedef enum +{ + BLE_GAP_SCAN_PROP_PHY_1M_BIT = (1 << 0), /**< Scan advertisement on the LE 1M PHY. */ + BLE_GAP_SCAN_PROP_PHY_CODED_BIT = (1 << 1), /**< Scan advertisement on the LE Coded PHY. */ + BLE_GAP_SCAN_PROP_ACTIVE_1M_BIT = (1 << 2), /**< Active scan on LE 1M PHY (scan request PDUs may be sent). */ + BLE_GAP_SCAN_PROP_ACTIVE_CODED_BIT = (1 << 3), /**< Active scan on LE Coded PHY (scan request PDUs may be sent). */ + BLE_GAP_SCAN_PROP_ACCEPT_RPA_BIT = (1 << 4), /**< Accept directed advertising packets if the used RPA and target address cannot be solved by the controller. */ + BLE_GAP_SCAN_PROP_FILT_TRUNC_BIT = (1 << 5), /**< Filter truncated advertising or scan response reports. */ +} ble_gap_scan_prop_t; /** * @brief Periodic synchronization types */ -enum gap_per_sync_type { - GAP_PER_SYNC_TYPE_GENERAL = 0, /**< Do not use periodic advertiser list for synchronization. */ - GAP_PER_SYNC_TYPE_SELECTIVE, /**< Use periodic advertiser list for synchronization. */ -}; +typedef enum +{ + BLE_GAP_PER_SYNC_TYPE_GENERAL = 0, /**< Do not use periodic advertiser list for synchronization. */ + BLE_GAP_PER_SYNC_TYPE_SELECTIVE, /**< Use periodic advertiser list for synchronization. */ +} ble_gap_per_sync_type_t; /** * @brief Security level types */ -enum gap_sec_lvl_type { - GAP_SEC_LVL_NO_SECURITY = 0, /**< No encryption or auth. */ - GAP_SEC_LVL_ENC_NO_AUTH, /**< Encryption with no auth. */ - GAP_SEC_LVL_LE_ENC_AUTH, /**< Legacy encryption with auth. */ - GAP_SEC_LVL_SC_ENC_AUTH, /**< Security connection encryption with auth. */ -}; +typedef enum +{ + BLE_GAP_SEC_LVL_NO_SECURITY = 0, /**< No encryption or auth. */ + BLE_GAP_SEC_LVL_ENC_NO_AUTH, /**< Encryption with no auth. */ + BLE_GAP_SEC_LVL_LE_ENC_AUTH, /**< Legacy encryption with auth. */ + BLE_GAP_SEC_LVL_SC_ENC_AUTH, /**< Security connection encryption with auth. */ +} ble_gap_sec_lvl_type_t; /** * @brief GAP advertising types */ -typedef enum { +typedef enum +{ BLE_GAP_AD_TYPE_FLAGS = 0x01, /**< Flag. */ BLE_GAP_AD_TYPE_MORE_16_BIT_UUID = 0x02, /**< Use of more than 16-bit UUID. */ BLE_GAP_AD_TYPE_COMPLETE_LIST_16_BIT_UUID = 0x03, /**< Complete List of 16-bit UUID. */ @@ -456,330 +447,425 @@ typedef enum { BLE_GAP_AD_TYPE_3D_INFO = 0x3D, /**< 3D Information Data. */ BLE_GAP_AD_TYPE_MANU_SPECIFIC_DATA = 0xFF, /**< Manufacturer specific data. */ -} gap_ad_type_t; +} ble_gap_ad_type_t; /** * @brief AD Type Flag - Bit mask. */ -typedef enum { - GAP_ADV_FLAG_LE_LIMITED_DISC_MODE = 0x01, /**< Limited discovery flag: AD Flag. */ - GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = 0x02, /**< General discovery flag: AD Flag. */ - GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = 0x04, /**< Legacy BT not supported: AD Flag. */ - GAP_ADV_FLAG_SIMUL_BR_EDR_LE_CONTROLLER = 0x08, /**< Dual mode for controller supported (BR/EDR/LE): AD Flag. */ - GAP_ADV_FLAG_SIMUL_BR_EDR_LE_HOST = 0x10, /**< Dual mode for host supported (BR/EDR/LE): AD Flag. */ -} gap_adv_flags_t; +typedef enum +{ + BLE_GAP_ADV_FLAG_LE_LIMITED_DISC_MODE = 0x01, /**< Limited discovery flag: AD Flag. */ + BLE_GAP_ADV_FLAG_LE_GENERAL_DISC_MODE = 0x02, /**< General discovery flag: AD Flag. */ + BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED = 0x04, /**< Legacy BT not supported: AD Flag. */ + BLE_GAP_ADV_FLAG_SIMUL_BR_EDR_LE_CONTROLLER = 0x08, /**< Dual mode for controller supported (BR/EDR/LE): AD Flag. */ + BLE_GAP_ADV_FLAG_SIMUL_BR_EDR_LE_HOST = 0x10, /**< Dual mode for host supported (BR/EDR/LE): AD Flag. */ +} ble_gap_adv_flags_t; + +/** @brief Advertising report type. */ +typedef enum +{ + BLE_GAP_REPORT_TYPE_ADV_EXT = 0, /**< Extended advertising report. */ + BLE_GAP_REPORT_TYPE_ADV_LEG, /**< Legacy advertising report. */ + BLE_GAP_REPORT_TYPE_SCAN_RSP_EXT, /**< Extended scan response report. */ + BLE_GAP_REPORT_TYPE_SCAN_RSP_LEG, /**< Legacy scan response report. */ + BLE_GAP_REPORT_TYPE_PER_ADV, /**< Periodic advertising report. */ +} ble_gap_adv_report_type_t; + +/** @brief Advertising report information. */ +typedef enum +{ + BLE_GAP_REPORT_INFO_COMPLETE_BIT = (1 << 0), /**< Report is complete. */ + BLE_GAP_REPORT_INFO_CONN_ADV_BIT = (1 << 1), /**< Connectable advertising. */ + BLE_GAP_REPORT_INFO_SCAN_ADV_BIT = (1 << 2), /**< Scannable advertising. */ + BLE_GAP_REPORT_INFO_DIR_ADV_BIT = (1 << 3), /**< Directed advertising. */ +} ble_gap_adv_report_info_t; + +/** @brief Stop reason code. */ +typedef enum +{ + BLE_GAP_STOPPED_REASON_TIMEOUT = 0, /**< Stop with timeout. */ + BLE_GAP_STOPPED_REASON_ON_USER, /**< Stop with user stopping it actively. */ + BLE_GAP_STOPPED_REASON_CONN_EST /**< Stop with connection established. */ +} ble_gap_stopped_reason_t; /** * @brief Privacy mode. */ -typedef enum { - PRIVACY_MODE_NETWORK = 0x00, /**< Set to the network privacy mode for the peer device. */ - PRIVACY_MODE_DEVICE = 0x01, /**< Set to the device privacy mode for the peer device. */ -} privacy_mode_t; +typedef enum +{ + BLE_GAP_PRIVACY_MODE_NETWORK= 0x00, /**< Set to the network privacy mode for the peer device. */ + BLE_GAP_PRIVACY_MODE_DEVICE = 0x01, /**< Set to the device privacy mode for the peer device. */ +} ble_gap_privacy_mode_t; /** - * @brief Possible roles for the event. + * @brief Possible roles of the activity. */ -typedef enum { - GAP_EVENT_ROLE_ADV = 0, /**< Adertise role. */ - GAP_EVENT_ROLE_CON = 1, /**< Connect role. */ - GAP_EVENT_ROLE_SCAN_INIT = 2, /**< Scann role. */ - GAP_EVENT_ROLE_UNKNOWN = 0xf, /**< Unknown role. */ -} gap_event_role_t; +typedef enum +{ + BLE_GAP_ACTIVITY_ROLE_ADV = 0, /**< Adertise role. */ + BLE_GAP_ACTIVITY_ROLE_CON = 1, /**< Connect role. */ + BLE_GAP_ACTIVITY_ROLE_SCAN_INIT = 2, /**< Scann role. */ + BLE_GAP_ACTIVITY_ROLE_UNKNOWN = 0xf, /**< Unknown role. */ +} ble_gap_actv_role_t; /** - * @brief Event type. + * @brief Clock ACC error. */ -typedef enum { - TYPE_ADV = 0, - TYPE_SCAN, - TYPE_INIT, - TYPE_PER_SYNC, -} ble_actv_type_t; +typedef enum +{ + BLE_GAP_CLK_ACC_500 = 0, /**< 500 ppm. */ + BLE_GAP_CLK_ACC_250, /**< 250 ppm. */ + BLE_GAP_CLK_ACC_150, /**< 150 ppm. */ + BLE_GAP_CLK_ACC_100, /**< 10 ppm. */ + BLE_GAP_CLK_ACC_75, /**< 70 ppm. */ + BLE_GAP_CLK_ACC_50, /**< 50 ppm. */ + BLE_GAP_CLK_ACC_30, /**< 30 ppm. */ + BLE_GAP_CLK_ACC_20, /**< 20 ppm. */ +} ble_gap_clk_acc_t; + +/** + * @brief Activity type. + */ +typedef enum +{ + BLE_GAP_ACTV_TYPE_ADV = 0, + BLE_GAP_ACTV_TYPE_SCAN, + BLE_GAP_ACTV_TYPE_INIT, + BLE_GAP_ACTV_TYPE_PER_SYNC, +} ble_gap_actv_type_t; /** @} */ -/** @addtogroup BLE_GAPM_STRUCTURES Structures +/**@addtogroup BLE_GAPM_STRUCTURES Structures * @{ */ /** * @brief Advertising parameters for legacy advertising */ -typedef struct { - uint8_t adv_mode; /**< Advertising mode (see enum @ref gap_adv_mode_t). */ - uint8_t disc_mode; /**< Discovery mode (see enum @ref gap_disc_mode_t). */ - uint8_t filter_pol; /**< Advertising filtering policy (see enum @ref gap_adv_filter_policy_t). */ - gap_bdaddr_t - peer_addr; /**< Peer address configuration (only used in case of directed advertising, - or used to locate the IRK list). */ - uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ - uint16_t - adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ - uint8_t chnl_map; /**< Advertising channel map. See @ref BLE_GAP_ADV_CHANNEL. */ - bool - scan_req_ind_en; /**< Indicate if the application should be informed when receiving - a scan request from the scanner. */ - int8_t - max_tx_pwr; /**< Maximum power level at which the advertising packets - have to be transmitted (between -20dbm and 7dbm). - For the real value, please refer to GR551x Datasheet. */ -} gap_adv_param_t; +typedef struct +{ + ble_gap_adv_mode_t adv_mode; /**< Advertising mode (see enum @ref ble_gap_adv_mode_t). */ + ble_gap_disc_mode_t disc_mode; /**< Discovery mode (see enum @ref ble_gap_disc_mode_t). */ + ble_gap_adv_filter_policy_t filter_pol; /**< Advertising filtering policy (see enum @ref ble_gap_adv_filter_policy_t). */ + ble_gap_bdaddr_t peer_addr; /**< Peer address configuration (only used in case of directed advertising, or used to locate the IRK list). */ + uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ + uint16_t adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ + uint8_t chnl_map; /**< Advertising channel map. See @ref BLE_GAP_ADV_CHANNEL. */ + bool scan_req_ind_en; /**< Indicate if the application should be informed when receiving a scan request from the scanner. */ + int8_t max_tx_pwr; /**< Maximum power level at which the advertising packets have to be transmitted (between -20dbm and 7dbm).For the real value, please refer to Datasheet. */ +} ble_gap_adv_param_t; /** * @brief Configuration for advertising on primary channel */ -typedef struct { - uint32_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ - uint32_t adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ - uint8_t chnl_map; /**< Bit field indicating the channel map. See @ref BLE_GAP_ADV_CHANNEL. */ - gap_le_phy_value_t phy; /**< Indicate on which PHY primary advertising has to be performed. - See enum @ref gap_le_phy_value_t. Note that LE 2M PHY is not allowed and that - legacy advertising only supports LE 1M PHY. */ -} gap_adv_prim_cfg_t; +typedef struct +{ + uint32_t adv_intv_min; /**< Minimum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ + uint32_t adv_intv_max; /**< Maximum advertising interval (in unit of 625 us). Must be greater than 20 ms. */ + uint8_t chnl_map; /**< Bit field indicating the channel map. See @ref BLE_GAP_ADV_CHANNEL. */ + ble_gap_le_phy_value_t phy; /**< Indicate on which PHY primary advertising has to be performed. See enum @ref ble_gap_le_phy_value_t. Note that LE 2M PHY is not allowed and that legacy advertising only supports LE 1M PHY. */ +} ble_gap_adv_prim_cfg_t; /** * @brief Configuration for advertising on secondary channel */ -typedef struct { - uint8_t max_skip; /**< Maximum number of advertising events the controller can skip - before sending the AUX_ADV_IND packets. - The range is 0x00 to 0xFF. - 0x00 means that AUX_ADV_IND PDUs shall be sent prior to each advertising events. */ - gap_le_phy_value_t phy; /**< Indicate on which PHY secondary advertising has to be performed. - See enum @ref gap_le_phy_value_t. */ - uint8_t adv_sid; /**< Advertising SID. Allowed range is 0x00 to 0x0F. */ -} gap_adv_second_cfg_t; +typedef struct +{ + uint8_t max_skip; /**< Maximum number of advertising events the controller can skip before sending the AUX_ADV_IND packets. The range is 0x00 to 0xFF. 0x00 means that AUX_ADV_IND PDUs shall be sent prior to each advertising events. */ + ble_gap_le_phy_value_t phy; /**< Indicate on which PHY secondary advertising has to be performed. See enum @ref ble_gap_le_phy_value_t. */ + uint8_t adv_sid; /**< Advertising SID. Allowed range is 0x00 to 0x0F. */ +} ble_gap_adv_second_cfg_t; /** * @brief Configuration for periodic advertising */ -typedef struct { - uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */ - uint16_t - adv_intv_max; /**< Maximum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */ -} gap_adv_period_cfg_t; +typedef struct +{ + uint16_t adv_intv_min; /**< Minimum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */ + uint16_t adv_intv_max; /**< Maximum advertising interval (in unit of 1.25 ms). Must be greater than 20 ms. */ +} ble_gap_adv_period_cfg_t; /** * @brief Advertising parameters for extended advertising and periodic advertising */ -typedef struct { - uint8_t type; /**< Advertising type (see enum @ref gap_adv_type_t). */ - uint8_t disc_mode; /**< Discovery mode (see enum @ref gap_disc_mode_t). */ - uint16_t prop; /**< Bit field value provided by advertising properties. - See enum @ref gap_adv_prop_t for bit signification. */ - int8_t max_tx_pwr; /**< Maximum power level at which the advertising packets have to be transmitted - (between -20 and 7 dBm). */ - uint8_t filter_pol; /**< Advertising filtering policy (see enum @ref gap_adv_filter_policy_t). */ - gap_bdaddr_t peer_addr; /**< Peer address configuration (only used in case of directed advertising or - used to locate the IRK list). */ - gap_adv_prim_cfg_t prim_cfg; /**< Configuration for primary advertising. */ - gap_adv_second_cfg_t second_cfg; /**< Configuration for secondary advertising (valid only if advertising type is - GAP_ADV_TYPE_EXTENDED or GAP_ADV_TYPE_PERIODIC). */ - gap_adv_period_cfg_t period_cfg; /**< Configuration for periodic advertising - (valid only if advertising type is GAP_ADV_TYPE_PERIODIC). */ -} gap_ext_adv_param_t; +typedef struct +{ + ble_gap_adv_type_t type; /**< Advertising type (see enum @ref ble_gap_adv_type_t). */ + ble_gap_disc_mode_t disc_mode; /**< Discovery mode (see enum @ref ble_gap_disc_mode_t). */ + uint16_t prop; /**< Bit field value provided by advertising properties. See enum @ref ble_gap_adv_prop_t for bit signification. */ + int8_t max_tx_pwr; /**< Maximum power level at which the advertising packets have to be transmitted (between -20 and 7 dBm). */ + ble_gap_adv_filter_policy_t filter_pol; /**< Advertising filtering policy (see enum @ref ble_gap_adv_filter_policy_t). */ + ble_gap_bdaddr_t peer_addr; /**< Peer address configuration (only used in case of directed advertising or used to locate the IRK list). */ + ble_gap_adv_prim_cfg_t prim_cfg; /**< Configuration for primary advertising. */ + ble_gap_adv_second_cfg_t second_cfg; /**< Configuration for secondary advertising (valid only if advertising type is GAP_ADV_TYPE_EXTENDED or GAP_ADV_TYPE_PERIODIC). */ + ble_gap_adv_period_cfg_t period_cfg; /**< Configuration for periodic advertising (valid only if advertising type is GAP_ADV_TYPE_PERIODIC). */ +} ble_gap_ext_adv_param_t; /** * @brief Advertising timing parameter */ -typedef struct { - uint16_t duration; /**< Advertising duration (in unit of 10ms). - 0 means that advertising continues until the host disables it. - If Advertising discovery mode is GAP_DISC_MODE_LIM_DISCOVERABLE - (see enum @ref gap_disc_mode_t), the setting duration range is [1, 18000]. - If adv mode is high duty, duration time range is [1, 128]. */ - uint8_t max_adv_evt; /**< Maximum number of extended advertising events. - The controller shall attempt to send prior to terminating the extending advertising. - The range is [0, 255]. 0 means no maximum number of advertising events. - Valid only if the created advertising is an extended advertising. */ -} gap_adv_time_param_t; +typedef struct +{ + uint16_t duration; /**< Advertising duration (in unit of 10ms). 0 means that advertising continues until the host disables it. If Advertising discovery mode is GAP_DISC_MODE_LIM_DISCOVERABLE (see enum @ref ble_gap_disc_mode_t), the setting duration range is [1, 18000]. If adv mode is high duty, duration time range is [1, 128]. */ + uint8_t max_adv_evt; /**< Maximum number of extended advertising events. The controller shall attempt to send prior to terminating the extending advertising. The range is [0, 255]. 0 means no maximum number of advertising events. Valid only if the created advertising is an extended advertising. */ +} ble_gap_adv_time_param_t; /** * @brief Security key */ -typedef struct { - uint8_t key[MAX_KEY_LEN]; /**< Key value MSB -> LSB (MSB followed by LSB). */ -} gap_sec_key_t; +typedef struct +{ + uint8_t key[BLE_GAP_MAX_KEY_LEN]; /**< Key value MSB -> LSB (MSB followed by LSB). */ +} ble_gap_sec_key_t; /** * @brief Parameters for legacy scanning */ -typedef struct { - gap_scan_type_t scan_type; /**< Active scanning or passive scanning. */ - gap_scan_mode_t scan_mode; /**< Scan mode. */ - gap_scan_dup_filt_policy_t scan_dup_filt; /**< Duplicate filter policy. */ - bool use_whitelist; /**< Filter policy. */ - uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */ - uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */ - uint16_t timeout; /**< Scan timeout should be a value between 0x0001 and 0xFFFF(unit: 10 ms). - 0x0000 indicates that the timeout has no effect. */ -} gap_scan_param_t; +typedef struct +{ + ble_gap_scan_type_t scan_type; /**< Active scanning or passive scanning. */ + ble_gap_scan_mode_t scan_mode; /**< Scan mode. */ + ble_gap_scan_dup_filt_policy_t scan_dup_filt; /**< Duplicate filter policy. */ + bool use_whitelist; /**< Filter policy. */ + uint16_t interval; /**< Scan interval between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */ + uint16_t window; /**< Scan window between 0x0004 and 0x4000 in 0.625 ms (range: 2.5 ms to 10.24s). */ + uint16_t timeout; /**< Scan timeout should be a value between 0x0001 and 0xFFFF(unit: 10 ms). 0x0000 indicates that the timeout has no effect. */ +} ble_gap_scan_param_t; /** * @brief Scan Window operation parameters */ -typedef struct { +typedef struct +{ uint16_t scan_intv; /**< Scan interval between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s). */ uint16_t scan_wd; /**< Scan window between 0x0004 and 0xFFFF in 0.625 ms (range: 2.5 ms to 40.959375s). */ -} gap_scan_wd_op_param_t; +} ble_gap_scan_wd_op_param_t; /** * @brief Parameters for extended scanning */ -typedef struct { - uint8_t type; /**< Type of scanning to be started (see enum @ref gap_ext_scan_type_t). */ - uint8_t prop; /**< Properties for the scan procedure (see enum @ref gap_scan_prop for bit signification). */ - uint8_t dup_filt_pol; /**< Duplicate packet filtering policy (see enum @ref gap_ext_scan_dup_filt_policy_t). */ - uint8_t rsvd; /**< Reserved for future use. */ - gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */ - gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */ - uint16_t duration; /**< Scan duration (in unit of 10ms). 0 means that the controller will scan continuously - until receiving a stop command from the application (10 ms to 655.35s). */ - uint16_t period; /**< Scan period, which is the time interval between two consequent starts of a scan duration - by the controller. - 0 means that the scan procedure is not periodic, in unit of 1.28s (1.28s to 83,884.8s). */ -} gap_ext_scan_param_t; +typedef struct +{ + ble_gap_ext_scan_type_t type; /**< Type of scanning to be started (see enum ble_gap_ext_scan_type_t). */ + uint8_t prop; /**< Properties for the scan procedure (see enum ble_gap_scan_prop for bit signification). */ + ble_gap_ext_scan_dup_filt_policy_t dup_filt_pol; /**< Duplicate packet filtering policy (see enum ble_gap_ext_scan_dup_filt_policy_t). */ + uint8_t rsvd; /**< Reserved for future use. */ + ble_gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */ + ble_gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */ + uint16_t duration; /**< Scan duration (in unit of 10ms). 0 means that the controller will scan continuously until receiving a stop command from the application (10 ms to 655.35s). */ + uint16_t period; /**< Scan period, which is the time interval between two consequent starts of a scan duration by the controller. 0 means that the scan procedure is not periodic, in unit of 1.28s (1.28s to 83,884.8s). */ +} ble_gap_ext_scan_param_t; /** * @brief Periodic advertising information */ -typedef struct { - gap_bdaddr_t bd_addr; /**< Advertiser address information. */ - uint8_t adv_sid; /**< Advertising SID. */ -} gap_period_adv_addr_cfg_t; +typedef struct +{ + ble_gap_bdaddr_t bd_addr; /**< Advertiser address information. */ + uint8_t adv_sid; /**< Advertising SID. */ +} ble_gap_period_adv_addr_cfg_t; /** * @brief Periodic advertising synchronization parameters */ -typedef struct { - uint16_t skip; /**< Number of periodic advertising that can be skipped after a successful reception. - Maximum authorized value is 499. */ - uint16_t sync_to; /**< Synchronization timeout for the periodic advertising - (in unit of 10ms between 100ms and 163.84s). */ - uint8_t type; /**< Periodic synchronization type (see enum @ref gap_per_sync_type). */ - uint8_t rsvd; /**< Reserved for future use.*/ - gap_period_adv_addr_cfg_t adv_addr; /**< Address of advertiser with which synchronization has to be established - (used only if use_pal is false). */ -} gap_per_sync_param_t; +typedef struct +{ + uint16_t skip; /**< Number of periodic advertising that can be skipped after a successful reception. Maximum authorized value is 499. */ + uint16_t sync_to; /**< Synchronization timeout for the periodic advertising (in unit of 10ms between 100ms and 163.84s). */ + ble_gap_per_sync_type_t type; /**< Periodic synchronization type (see enum @ref ble_gap_per_sync_type_t). */ + uint8_t rsvd; /**< Reserved for future use.*/ + ble_gap_period_adv_addr_cfg_t adv_addr; /**< Address of advertiser with which synchronization has to be established(used only if use_pal is false). */ +} ble_gap_per_sync_param_t; /** * @brief Legacy initiating parameters */ -typedef struct { - uint8_t type; /**< Initiating type (see enum @ref gap_init_type_t). */ - gap_bdaddr_t peer_addr; /**< Peer device address. */ - uint16_t interval_min; /**< Minimum value for the connection interval (in unit of 1.25ms). - Shall be less than or equal to interval_max value. - Allowed range is 7.5 ms to 4s. */ - uint16_t interval_max; /**< Maximum value for the connection interval (in unit of 1.25ms). - Shall be greater than or equal to interval_min value. - Allowed range is 7.5 ms to 4s. */ - uint16_t slave_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */ - uint16_t sup_timeout; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */ - uint16_t conn_timeout; /**< Timeout for connection establishment (in unit of 10ms). - Cancel the procedure if connection has not been connected when the timeout occurs. - 0 means there is no timeout. */ -} gap_init_param_t; +typedef struct +{ + ble_gap_init_type_t type; /**< Initiating type (see enum @ref ble_gap_init_type_t). */ + ble_gap_bdaddr_t peer_addr; /**< Peer device address. */ + uint16_t interval_min; /**< Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to interval_max value. Allowed range is 7.5 ms to 4s. */ + uint16_t interval_max; /**< Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to interval_min value. Allowed range is 7.5 ms to 4s. */ + uint16_t slave_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */ + uint16_t sup_timeout; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */ + uint16_t conn_timeout; /**< Timeout for connection establishment (in unit of 10ms). Cancel the procedure if connection has not been connected when the timeout occurs. 0 means there is no timeout. */ +} ble_gap_init_param_t; /** * @brief Connection parameters */ -typedef struct { - uint16_t conn_intv_min; /**< Minimum value for the connection interval (in unit of 1.25ms). - Shall be less than or equal to conn_intv_max value. - Allowed range is 7.5 ms to 4s. */ - uint16_t conn_intv_max; /**< Maximum value for the connection interval (in unit of 1.25ms). - Shall be greater than or equal to conn_intv_min value. - Allowed range is 7.5 ms to 4s. */ - uint16_t conn_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */ - uint16_t supervision_to; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */ - uint16_t ce_len; /**< The length of connection event needed for this LE connection. - Range: 0x0002 to 0xFFFF, Unit:0.625 ms, Time Range: 1.25 ms to 40.9s. */ -} gap_ext_conn_param_t; +typedef struct +{ + uint16_t conn_intv_min; /**< Minimum value for the connection interval (in unit of 1.25ms). Shall be less than or equal to conn_intv_max value. Allowed range is 7.5 ms to 4s. */ + uint16_t conn_intv_max; /**< Maximum value for the connection interval (in unit of 1.25ms). Shall be greater than or equal to conn_intv_min value. Allowed range is 7.5 ms to 4s. */ + uint16_t conn_latency; /**< Slave latency. Number of events that can be missed by a connected slave device. */ + uint16_t supervision_to; /**< Link supervision timeout (in unit of 10ms). Allowed range is 100 ms to 32s. */ + uint16_t ce_len; /**< The length of connection event needed for this LE connection. Range: 0x0002 to 0xFFFF, Unit:0.625 ms, Time Range: 1.25 ms to 40.9s. */ +} ble_gap_ext_conn_param_t; /** * @brief Extended initiating parameters */ -typedef struct { - uint8_t type; /**< Initiating type (see enum @ref gap_init_type_t). */ - uint8_t prop; /**< Properties for the initiating procedure - (see enum @ref gap_init_prop_t for bit signification). */ - uint16_t conn_to; /**< Timeout for automatic connection establishment (in unit of 10ms). - Cancel the procedure if connection has not been connected when the timeout occurs. - 0 means there is no timeout. */ - gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */ - gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */ - gap_ext_conn_param_t conn_param_1m; /**< Connection parameters for LE 1M PHY. */ - gap_ext_conn_param_t conn_param_2m; /**< Connection parameters for LE 2M PHY. */ - gap_ext_conn_param_t conn_param_coded; /**< Connection parameters for LE Coded PHY. */ - gap_bdaddr_t peer_addr; /**< Address of peer device in case white list is not used for connection. */ -} gap_ext_init_param_t; +typedef struct +{ + ble_gap_init_type_t type; /**< Initiating type (see enum @ref ble_gap_init_type_t). */ + uint8_t prop; /**< Properties for the initiating procedure (see enum @ref ble_gap_init_prop_t for bit signification). */ + uint16_t conn_to; /**< Timeout for automatic connection establishment (in unit of 10ms). Cancel the procedure if connection has not been connected when the timeout occurs.0 means there is no timeout. */ + ble_gap_scan_wd_op_param_t scan_param_1m; /**< Scan window opening parameters for LE 1M PHY. */ + ble_gap_scan_wd_op_param_t scan_param_coded; /**< Scan window opening parameters for LE Coded PHY. */ + ble_gap_ext_conn_param_t conn_param_1m; /**< Connection parameters for LE 1M PHY. */ + ble_gap_ext_conn_param_t conn_param_2m; /**< Connection parameters for LE 2M PHY. */ + ble_gap_ext_conn_param_t conn_param_coded; /**< Connection parameters for LE Coded PHY. */ + ble_gap_bdaddr_t peer_addr; /**< Address of peer device in case white list is not used for connection. */ +} ble_gap_ext_init_param_t; /** * @brief LE Protocol/Service Multiplexer information */ -typedef struct { - uint16_t le_psm; /**< LE Protocol/Service Multiplexer (range: 1 to 255), PSMs should be odd. */ - uint8_t sec_lvl; /**< Security level requirement, see @ref gap_sec_lvl_type. */ - bool mks_flag; /**< Whether to use maximum-size key (16 bytes) or not. */ -} gap_lepsm_register_t; +typedef struct +{ + uint16_t le_psm; /**< LE Protocol/Service Multiplexer (range: 1 to 255), PSMs should be odd. */ + ble_gap_sec_lvl_type_t sec_lvl; /**< Security level requirement, see @ref ble_gap_sec_lvl_type_t. */ + bool mks_flag; /**< Whether to use maximum-size key (16 bytes) or not. */ +} ble_gap_lepsm_register_t; /** * @brief Bonded device list */ -typedef struct { - uint8_t num; /**< Number of bonded device. */ - gap_bdaddr_t items[MAX_BOND_NUM]; /**< Bonded device addr info. */ -} bond_dev_list_t; +typedef struct +{ + uint8_t num; /**< Number of bonded device. */ + ble_gap_bdaddr_t items[BLE_GAP_MAX_BOND_NUM]; /**< Bonded device addr info. */ +} ble_gap_bond_dev_list_t; /** - * @brief White list + * @brief White list */ -typedef struct { - uint8_t num; /**< Number of available items. */ - gap_bdaddr_t items[MAX_WL_NUM]; /**< Content of each item. */ -} white_list_t; +typedef struct +{ + uint8_t num; /**< Number of available items. */ + ble_gap_bdaddr_t items[BLE_GAP_MAX_WL_NUM]; /**< Content of each item. */ +} ble_gap_white_list_t; /** * @brief Periodic advertising list */ -typedef struct { - uint8_t num; /**< Number of available items. */ - gap_period_adv_addr_cfg_t items[MAX_PRD_ADV_NUM]; /**< Content of each item. */ -} period_adv_list_t; +typedef struct +{ + uint8_t num; /**< Number of available items. */ + ble_gap_period_adv_addr_cfg_t items[BLE_GAP_MAX_PRD_ADV_NUM]; /**< Content of each item. */ +} ble_gap_period_adv_list_t; /** - * @brief RPA list item info + * @brief RPA list item info */ -typedef struct { - gap_bdaddr_t bd_addr; /**< Peer device identity. */ - uint8_t priv_mode; /**< Privacy mode, see enum @ref privacy_mode_t. */ - uint8_t peer_irk[MAX_KEY_LEN]; /**< Peer IRK. */ - uint8_t local_irk[MAX_KEY_LEN]; /**< Local IRK. */ -} gap_ral_dev_info_t; +typedef struct +{ + ble_gap_bdaddr_t bd_addr; /**< Peer device identity. */ + ble_gap_privacy_mode_t priv_mode; /**< Privacy mode, see enum @ref ble_gap_privacy_mode_t. */ + uint8_t peer_irk[BLE_GAP_MAX_KEY_LEN]; /**< Peer IRK. */ + uint8_t local_irk[BLE_GAP_MAX_KEY_LEN]; /**< Local IRK. */ +} ble_gap_ral_dev_info_t; /** - * @brief RPA list info + * @brief RPA list info */ -typedef struct { - uint8_t num; /**< Number of RPA list. */ - gap_ral_dev_info_t items[MAX_BOND_NUM]; /**< RPA list item info. */ -} ral_dev_list_t; +typedef struct +{ + uint8_t num; /**< Number of RPA list. */ + ble_gap_ral_dev_info_t items[BLE_GAP_MAX_BOND_NUM]; /**< RPA list item info. */ +} ble_gap_ral_dev_list_t; /** - * @brief The BLE reslove rpa address callback. + * @brief Operation code used to read resolvable address. */ -typedef void (*reslv_rpa_addr_callback_t) (uint8_t status, gap_bdaddr_t *iden_addr, - uint8_t src_info); +typedef enum +{ + BLE_GAP_OPCODE_LOCAL_RSLV_ADDR_READ, /**< Local resolvable address operation. */ + BLE_GAP_OPCODE_PEER_RSLV_ADDR_READ, /**< Peer resolvable address operation. */ +} ble_gap_rslv_addr_read_op_id_t; -/** - * @brief The BLE rpa address report callback. +/** @brief Advertising Stop info. */ +typedef struct +{ + ble_gap_stopped_reason_t reason; /**< Advertising Stop info. */ +} ble_gap_evt_adv_stop_t; + +/** @brief Scan request info. */ +typedef struct +{ + ble_gap_bdaddr_t peer_addr; /**< Scan request info. */ +} ble_gap_evt_scan_req_t; + +/** @brief Scan Stop info struct. */ +typedef struct +{ + ble_gap_stopped_reason_t reason; /**< Scan Stop info. */ +} ble_gap_evt_scan_stop_t; + +/** @brief Advertising report event for @ref BLE_GAPM_EVT_ADV_REPORT. */ +typedef struct +{ + ble_gap_adv_report_type_t adv_type; /**< Advertising type. @ref ble_gap_adv_report_type_t. */ + ble_gap_adv_report_info_t adv_info; /**< Bit field providing information about the received report. @ref ble_gap_adv_report_info_t. */ + ble_gap_bdaddr_t broadcaster_addr; /**< Broadcaster device address. */ + ble_gap_bdaddr_t direct_addr; /**< Target address (in case of a directed advertising report). */ + int8_t tx_pwr; /**< TX power (in dBm). */ + int8_t rssi; /**< RSSI (between -127 and +20 dBm). */ + uint8_t phy_prim; /**< Primary PHY on which advertising report has been received. */ + uint8_t phy_second; /**< Secondary PHY on which advertising report has been received. */ + uint8_t adv_sid; /**< Advertising SID , valid only for periodic advertising report. */ + uint16_t period_adv_intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms), valid only for periodic advertising report. */ + uint8_t per_sync_idx; /**< Periodic syncronization index, valid only for periodic advertising report. */ + uint16_t length; /**< Report length. */ + uint8_t *data; /**< Report. */ +} ble_gap_evt_adv_report_t; + +/** @brief Sync established event for @ref BLE_GAPM_EVT_SYNC_ESTABLISH. */ +typedef struct +{ + uint8_t phy; /**< PHY on which synchronization has been established. */ + uint16_t intv; /**< Periodic advertising interval (in unit of 1.25ms, min is 7.5ms). */ + uint8_t adv_sid; /**< Advertising SID. */ + uint8_t clk_acc; /**< Advertiser clock accuracy. @ref ble_gap_clk_acc_t. */ + ble_gap_bdaddr_t bd_addr; /**< Advertiser address. */ + uint16_t sync_hdl; /**< Sync handle. */ +} ble_gap_evt_sync_established_t; + +/** @brief Read resolvable address event for @ref BLE_GAPM_EVT_READ_RSLV_ADDR. */ +typedef struct +{ + uint8_t op_code; /**< Operation code. @ref ble_gap_rslv_addr_read_op_id_t. */ + ble_gap_addr_t gap_addr; /**< Resolvable address info. */ + } ble_gap_evt_rslv_addr_read_t; + +/**@brief BLE GAPM event structure. */ +typedef struct +{ + uint8_t index; /**< Index of connection or advertising. */ + union + { + ble_gap_evt_dev_info_get_t dev_info; /**< Device info parameters. */ + ble_gap_evt_adv_stop_t adv_stop; /**< Advertising stop parameter. */ + ble_gap_evt_scan_req_t scan_req; /**< Scan Request parameter. */ + ble_gap_evt_scan_stop_t scan_stop; /**< Scan Stop parameter. */ + ble_gap_evt_adv_report_t adv_report; /**< Advertising Report parameter. */ + ble_gap_evt_sync_established_t sync_established; /**< Periodic Advertising Synchronization Established parameter. */ + ble_gap_evt_rslv_addr_read_t rslv_addr; /**< Read Resolvable Address parameter. */ + } params; /**< Event Parameters. */ +} ble_gapm_evt_t; +/** @} */ + +/** @addtogroup BLE_GAPM_TYPEDEF Typedefs + * @{ */ -typedef void (*rpa_addr_report_callback_t) (ble_actv_type_t type, uint8_t index, - const uint8_t *rpa_addr); +/** @brief The BLE reslove rpa address callback. */ +typedef void (*ble_gap_reslv_rpa_addr_callback_t) (uint8_t status, ble_gap_bdaddr_t *iden_addr, uint8_t src_info); +/** @brief The BLE rpa address report callback. */ +typedef void (*ble_gap_rpa_addr_report_callback_t) (ble_gap_actv_type_t type, uint8_t index, const uint8_t *rpa_addr); /** @} */ @@ -807,7 +893,7 @@ void ble_gap_pair_enable(bool enable); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gap_addr_set(gap_bdaddr_t const *p_addr); +uint16_t ble_gap_addr_set(ble_gap_bdaddr_t const *p_addr); /** **************************************************************************************** @@ -819,16 +905,16 @@ uint16_t ble_gap_addr_set(gap_bdaddr_t const *p_addr); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_addr_get(gap_bdaddr_t *p_addr); +uint16_t ble_gap_addr_get(ble_gap_bdaddr_t *p_addr); /** **************************************************************************************** * @brief Set the tx power * - * @param[in] role: Select the role to set tx power. @ref gap_event_role_t for possible roles. + * @param[in] role: Select the role to set tx power. @ref ble_gap_actv_role_t for possible roles. * @param[in] index: The idx parameter is interpreted on role. - * -If the role is @ref GAP_EVENT_ROLE_ADV, it's the index of Advertising. - * -If the role is @ref GAP_EVENT_ROLE_CON, it's the index of connection. + * -If role is @ref BLE_GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. + * -If role is @ref BLE_GAP_ACTIVITY_ROLE_CON, it's the index of connection. * -For all other roles, it should be ignored. * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. * @@ -838,17 +924,17 @@ uint16_t ble_gap_addr_get(gap_bdaddr_t *p_addr); * @retval ::SDK_ERR_INVALID_HANDLE: Invalid handle supplied. **************************************************************************************** */ -uint16_t ble_gap_tx_power_set(gap_event_role_t role, uint8_t index, int8_t txpwr_dbm); +uint16_t ble_gap_tx_power_set(ble_gap_actv_role_t role, uint8_t index, int8_t txpwr_dbm); /** **************************************************************************************** * @brief Get the tx power * - * @param[in] role: Select the role to Get tx power. @ref gap_event_role_t for possible roles. + * @param[in] role: Select the role to Get tx power. @ref ble_gap_actv_role_t for possible roles. * @param[in] index: The idx parameter is interpreted on role. - * -If the role is @ref GAP_EVENT_ROLE_ADV, it's the index of Advertising. - * -If the role is @ref GAP_EVENT_ROLE_CON, it's the index of connection. - * -For all other roles, it should be ignored. + * -If role is @ref BLE_GAP_ACTIVITY_ROLE_ADV, it's the index of Advertising. + * -If role is @ref BLE_GAP_ACTIVITY_ROLE_CON, it's the index of connection. + * -For all other roles, it should be ignored. * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. * * @retval ::SDK_SUCCESS: Operation is Success. @@ -857,32 +943,7 @@ uint16_t ble_gap_tx_power_set(gap_event_role_t role, uint8_t index, int8_t txpwr * @retval ::SDK_ERR_INVALID_HANDLE: Invalid handle supplied. **************************************************************************************** */ -uint16_t ble_gap_tx_power_get(gap_event_role_t role, uint8_t index, int8_t *txpwr_dbm); - -/** - **************************************************************************************** - * @brief Set the default tx power for all roles. - * - * @note This function should be called before BLE stack init. - * - * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. - * - * @retval ::SDK_SUCCESS: Operation is Success. - **************************************************************************************** - */ -uint16_t ble_gap_default_tx_power_set(int8_t txpwr_dbm); - -/** - **************************************************************************************** - * @brief Get the default tx power for all roles. - * - * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. - * - * @retval ::SDK_SUCCESS: Operation is Success. - **************************************************************************************** - */ -uint16_t ble_gap_default_tx_power_get(int8_t *txpwr_dbm); - +uint16_t ble_gap_tx_power_get(ble_gap_actv_role_t role, uint8_t index, int8_t *txpwr_dbm); /** **************************************************************************************** @@ -894,13 +955,13 @@ uint16_t ble_gap_default_tx_power_get(int8_t *txpwr_dbm); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_irk_set(gap_sec_key_t* p_irk); +uint16_t ble_gap_irk_set(ble_gap_sec_key_t* p_irk); /** **************************************************************************************** * @brief Set privacy related parameters. - * @param[in] renew_dur: Duration before regenerating a device address when privacy is enabled in seconds. - * Range: 0x0001 (1s) ~ 0xA1B8 (11.5 hr). The suggested time is 900s(15 minutes). + * @param[in] renew_dur: Duration before regenerating a device address when privacy is enabled in seconds. Range: 0x0001 (1s) ~ 0xA1B8 (11.5 hr). + * The suggested time is 900s(15 minutes). * @param[in] enable_flag: Indicate the controller privacy is enabled or disabled. * * @retval ::SDK_SUCCESS: Operation is successful. @@ -913,16 +974,14 @@ uint16_t ble_gap_privacy_params_set(uint16_t renew_dur, bool enable_flag); **************************************************************************************** * @brief Set suggested default LE data length. * - * @param[in] sugg_max_tx_octet: Suggested value for the Controller's maximum transmitted number of - * payload octets to be used, the range is 27~251. - * @param[in] sugg_max_tx_time: Suggested value for the Controller's maximum packet transmission time to be used, - * the range is 328~2120. + * @param[in] sugg_max_tx_octet: Suggested value for the Controller's maximum transmitted number of payload octets to be used, the range is 27~251. + * @param[in] sugg_max_tx_time: Suggested value for the Controller's maximum packet transmission time to be used, the range is 328~2120. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. **************************************************************************************** */ -uint16_t ble_gap_data_length_set(uint16_t sugg_max_tx_octet, uint16_t sugg_max_tx_time); +uint16_t ble_gap_data_length_set(uint16_t sugg_max_tx_octet,uint16_t sugg_max_tx_time); /** **************************************************************************************** @@ -930,34 +989,30 @@ uint16_t ble_gap_data_length_set(uint16_t sugg_max_tx_octet, uint16_t sugg_max_t * * @param[in] max_mtu: Maximal MTU acceptable for device, the range is 65~512. * @param[in] max_mps: Maximal MPS Packet size acceptable for device (for COC SDU), the range is 65~max_mtu. - * @param[in] max_nb_lecb: Maximum number of LE Credit based connection that can be established, - * this range is 0x00~0x20. The actual number is decided by resource available. + * @param[in] max_nb_lecb: Maximum number of LE Credit based connection that can be established, this range is 0x00~0x20. + * The actual number is decided by resource available. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * - * @note If these parameters are not set, the stack will config the default value as - * (max_mtu = 512, max_mps = 512 and max_nb_lecb = 10). + * @note If these parameters are not set, the stack will config the default value as (max_mtu = 512, max_mps = 512 and max_nb_lecb = 10). **************************************************************************************** */ -uint16_t ble_gap_l2cap_params_set(uint16_t max_mtu, uint16_t max_mps, uint8_t max_nb_lecb); +uint16_t ble_gap_l2cap_params_set(uint16_t max_mtu,uint16_t max_mps,uint8_t max_nb_lecb); /** **************************************************************************************** * @brief Set the preferred values for the transmitter PHY and receiver PHY. * - * @param[in] tx_pref_phy: A bit field that indicates the transmitter PHYs - * that the Host prefers the Controller to use(see @ref BLE_GAP_PHYS). - * @param[in] rx_pref_phy: A bit field that indicates the receiver PHYs that the Host prefers the - * Controller to use(see @ref BLE_GAP_PHYS). + * @param[in] tx_pref_phy: A bit field that indicates the transmitter PHYs that the Host prefers the Controller to use(see @ref BLE_GAP_PHY_OPTIONS). + * @param[in] rx_pref_phy: A bit field that indicates the receiver PHYs that the Host prefers the Controller to use(see @ref BLE_GAP_PHY_OPTIONS). **************************************************************************************** */ void ble_gap_pref_phy_set(uint8_t tx_pref_phy, uint8_t rx_pref_phy); /** **************************************************************************************** - * @brief Set the RF path gain or loss between the RF transceiver and the antenna - * contributed by intermediate components. + * @brief Set the RF path gain or loss between the RF transceiver and the antenna contributed by intermediate components. * * @param[in] tx_path_comp: RF TX Path Compensation value (from -128dB to 128dB, unit is 0.1dB). * @param[in] rx_path_comp: RF RX Path Compensation value (from -128dB to 128dB, unit is 0.1dB). @@ -972,18 +1027,25 @@ uint16_t ble_gap_path_compensation_set(int16_t tx_path_comp, int16_t rx_path_com **************************************************************************************** * @brief Set advertising channel map before advertising starts. * - * @param[in] p_chnl_map: Bitmask of LE channel map. See enum @ref gap_chnl_map_t for BT Core Spec version <= 4.2. + * @param[in] p_chnl_map: Bitmask of LE channel map. See enum @ref ble_gap_chnl_map_t for BT Core Spec version <= 4.2. * - * @retval ::SDK_SUCCESS: Operation is successful. + * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_CHNL_MAP_SET - will be called once the operation has completed. **************************************************************************************** */ -uint16_t ble_gap_chnl_map_set(gap_chnl_map_t* p_chnl_map); +uint16_t ble_gap_chnl_map_set(ble_gap_chnl_map_t* p_chnl_map); + +/** + **************************************************************************************** + * @brief Set ble channel map update timer enable or disable. + * + * @param[in] enable_flag: timer enable flag . true is enable,false is disable. + * + * @retval ::SDK_SUCCESS: Operation is successful. + **************************************************************************************** + */ +uint16_t ble_gap_chnl_map_timer_set(bool enable_flag); /** **************************************************************************************** @@ -997,7 +1059,7 @@ uint16_t ble_gap_chnl_map_set(gap_chnl_map_t* p_chnl_map); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_bond_devs_get(bond_dev_list_t *p_bond_list); +uint16_t ble_gap_bond_devs_get(ble_gap_bond_dev_list_t *p_bond_list); /** **************************************************************************************** @@ -1011,7 +1073,7 @@ uint16_t ble_gap_bond_devs_get(bond_dev_list_t *p_bond_list); * @retval ::SDK_ERR_INVALID_PARAM: The parameter is invalid. **************************************************************************************** */ -uint16_t ble_gap_bond_dev_addr_get(uint8_t conn_idx, gap_bdaddr_t *p_peer_addr); +uint16_t ble_gap_bond_dev_addr_get(uint8_t conn_idx, ble_gap_bdaddr_t *p_peer_addr); /** **************************************************************************************** @@ -1040,7 +1102,7 @@ uint16_t ble_gap_bond_devs_clear(void); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_bond_dev_del(const gap_bdaddr_t *p_peer_addr); +uint16_t ble_gap_bond_dev_del(const ble_gap_bdaddr_t *p_peer_addr); /** **************************************************************************************** @@ -1052,14 +1114,13 @@ uint16_t ble_gap_bond_dev_del(const gap_bdaddr_t *p_peer_addr); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_whitelist_get(white_list_t *p_whitelist); +uint16_t ble_gap_whitelist_get(ble_gap_white_list_t *p_whitelist); /** **************************************************************************************** - * @brief Add the devices into current white list. If white list is full or there are duplicated entries, - * it will return error. + * @brief Add the devices into current white list. If white list is full or there are duplicated entries, it will return error. * - * @param[in] p_whitelist: Pointer to input white list. + * @param[in] p_whitelist: Pointer to input white list. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. @@ -1067,20 +1128,15 @@ uint16_t ble_gap_whitelist_get(white_list_t *p_whitelist); * @retval ::SDK_ERR_LIST_FULL: List is full. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET - * will be called once the operation has completed. **************************************************************************************** */ -uint16_t ble_gap_whitelist_add(const white_list_t *p_whitelist); +uint16_t ble_gap_whitelist_add(const ble_gap_white_list_t *p_whitelist); /** **************************************************************************************** - * @brief Delete the devices out of current white list. If the entries do not exist in the current white list, - * it will return error. + * @brief Delete the devices out of current white list. If the entries do not exist in the current white list, it will return error. * - * @param[in] p_whitelist: Pointer to input white list. + * @param[in] p_whitelist: Pointer to input white list. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. @@ -1088,13 +1144,9 @@ uint16_t ble_gap_whitelist_add(const white_list_t *p_whitelist); * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET - * will be called once the operation has completed. **************************************************************************************** */ -uint16_t ble_gap_whitelist_del(const white_list_t *p_whitelist); +uint16_t ble_gap_whitelist_del(const ble_gap_white_list_t *p_whitelist); /** **************************************************************************************** @@ -1103,10 +1155,6 @@ uint16_t ble_gap_whitelist_del(const white_list_t *p_whitelist); * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_WHITELIST_SET - * will be called once the operation has completed. **************************************************************************************** */ uint16_t ble_gap_whitelist_clear(void); @@ -1121,7 +1169,7 @@ uint16_t ble_gap_whitelist_clear(void); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_per_adv_list_get(period_adv_list_t *p_pal_list); +uint16_t ble_gap_per_adv_list_get(ble_gap_period_adv_list_t *p_pal_list); /** **************************************************************************************** @@ -1136,18 +1184,13 @@ uint16_t ble_gap_per_adv_list_get(period_adv_list_t *p_pal_list); * @retval ::SDK_ERR_LIST_FULL: List is full. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET - * will be called once the operation has completed. **************************************************************************************** */ -uint16_t ble_gap_per_adv_list_add(const period_adv_list_t *p_pal_list); +uint16_t ble_gap_per_adv_list_add(const ble_gap_period_adv_list_t *p_pal_list); /** **************************************************************************************** - * @brief Delete the devices out of periodic advertising list. If the entries do not exist in the current list, - * an error will be returned. + * @brief Delete the devices out of periodic advertising list. If the entries do not exist in the current list, an error will be returned. * * @param[in] p_pal_list: Pointer to input periodic advertising list. * @@ -1157,22 +1200,14 @@ uint16_t ble_gap_per_adv_list_add(const period_adv_list_t *p_pal_list); * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET - * will be called once the operation has completed. **************************************************************************************** */ -uint16_t ble_gap_per_adv_list_del(const period_adv_list_t *p_pal_list); +uint16_t ble_gap_per_adv_list_del(const ble_gap_period_adv_list_t *p_pal_list); /** **************************************************************************************** * @brief Clear all the entries in the current periodic advertising list. * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_param_set_cb with op_id: @ref GAP_OPCODE_PER_ADV_LIST_SET - * will be called once the operation has completed. - * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. **************************************************************************************** @@ -1188,7 +1223,7 @@ uint16_t ble_gap_per_adv_list_clear(void); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_rpa_list_get(ral_dev_list_t *p_rpa_list); +uint16_t ble_gap_rpa_list_get(ble_gap_ral_dev_list_t *p_rpa_list); /** **************************************************************************************** @@ -1199,13 +1234,9 @@ uint16_t ble_gap_rpa_list_get(ral_dev_list_t *p_rpa_list); * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_dev_info_get_cb with the specified op_id (see @ref gap_dev_info_get_type_t) - * will be called once the requested parameters has been got. **************************************************************************************** */ -uint16_t ble_gap_dev_info_get(gap_dev_info_get_type_t type); +uint16_t ble_gap_dev_info_get(ble_gap_dev_info_get_type_t type); /** **************************************************************************************** @@ -1219,14 +1250,13 @@ uint16_t ble_gap_dev_info_get(gap_dev_info_get_type_t type); * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * + * - * @note Discovery mode param contains Flags AD type, setting adv data should not set the Flags AD type. + * @note Discovery mode param contains Flags AD type, setting adv data should not set the Flags AD type. * @note This API is for legacy advertsing (BT Core Spec version <= 4.2). **************************************************************************************** */ -uint16_t ble_gap_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, - gap_adv_param_t* p_adv_param); +uint16_t ble_gap_adv_param_set(uint8_t adv_idx, ble_gap_own_addr_t own_addr_type, ble_gap_adv_param_t* p_adv_param); /** **************************************************************************************** @@ -1244,13 +1274,11 @@ uint16_t ble_gap_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, * @note This API is for extended and periodic advertising (BT Core Spec version >= 5.0). **************************************************************************************** */ -uint16_t ble_gap_ext_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type, - gap_ext_adv_param_t* p_adv_param); +uint16_t ble_gap_ext_adv_param_set(uint8_t adv_idx, ble_gap_own_addr_t own_addr_type, ble_gap_ext_adv_param_t* p_adv_param); /** **************************************************************************************** - * @brief Set Advertising Data, Scan Response Data and Periodic Advertising Data. See ENUM @ref gap_ad_type_t - for ADV Type definitions. See ENUM @ref gap_adv_flags_t for ADV flag definitions. + * @brief Set Advertising Data, Scan Response Data and Periodic Advertising Data. * * @param[in] adv_idx: Advertising index, range is 0 to 4. * @param[in] type: Data type. @@ -1266,13 +1294,11 @@ uint16_t ble_gap_ext_adv_param_set(uint8_t adv_idx, gap_own_addr_t own_addr_type * @note User should not add extra Flags AD type as the BLE Stack has added the Flags AD type already. **************************************************************************************** */ -uint16_t ble_gap_adv_data_set(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t* p_data, - uint16_t length); +uint16_t ble_gap_adv_data_set(uint8_t adv_idx, ble_gap_adv_data_type_t type, const uint8_t* p_data, uint16_t length); /** **************************************************************************************** - * @brief Update Advertising Data, Scan Response Data and Periodic Advertising Data. See ENUM @ref gap_ad_type_t - * for ADV Type definitions. See ENUM @ref gap_adv_flags_t for ADV flag definitions. + * @brief Update Advertising Data, Scan Response Data and Periodic Advertising Data. * * @param[in] adv_idx: Advertising index, range is 0 to 4. * @param[in] type: Data type. @@ -1288,8 +1314,7 @@ uint16_t ble_gap_adv_data_set(uint8_t adv_idx, gap_adv_data_type_t type, const u * @note User should not add extra Flags AD type as the BLE Stack has added the Flags AD type already. **************************************************************************************** */ -uint16_t ble_gap_update_adv_data(uint8_t adv_idx, gap_adv_data_type_t type, const uint8_t* p_data, - uint16_t length); +uint16_t ble_gap_update_adv_data(uint8_t adv_idx, ble_gap_adv_data_type_t type, const uint8_t* p_data, uint16_t length); /** **************************************************************************************** @@ -1304,17 +1329,10 @@ uint16_t ble_gap_update_adv_data(uint8_t adv_idx, gap_adv_data_type_t type, cons * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. * - * @note If advertising mode is directed high duty cycle mode, - * duration should be set nonzero and not be greater than 1.28s. - * @note This API is asynchronous. - * @note If the field scan_req_ind_en in @ref gap_adv_param_t is TRUE passed in @ref ble_gap_adv_param_set function, - or if the GAP_ADV_PROP_SCAN_REQ_NTF_EN_BIT is set in @ref gap_adv_prop_t and - passed in @ref ble_gap_ext_adv_param_set function, - @ref gap_cb_fun_t::app_gap_scan_req_ind_cb will be called once a scan request has been received. - * @note @ref gap_cb_fun_t::app_gap_adv_start_cb will be called once the operation has completed. + * @note If advertising mode is directed high duty cycle mode, duration should be set nonzero and not be greater than 1.28s. **************************************************************************************** */ -uint16_t ble_gap_adv_start(uint8_t adv_idx, gap_adv_time_param_t* p_timeout); +uint16_t ble_gap_adv_start(uint8_t adv_idx, ble_gap_adv_time_param_t* p_timeout); /** **************************************************************************************** @@ -1324,10 +1342,6 @@ uint16_t ble_gap_adv_start(uint8_t adv_idx, gap_adv_time_param_t* p_timeout); * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_ADV_IDX: Invalid advertising index supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_adv_stop_cb will be called once the operation has completed - * or advertising has been stopped. **************************************************************************************** */ uint16_t ble_gap_adv_stop(uint8_t adv_idx); @@ -1342,11 +1356,9 @@ uint16_t ble_gap_adv_stop(uint8_t adv_idx); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is for legacy scanning (BT Core Spec version <= 4.2). **************************************************************************************** */ -uint16_t ble_gap_scan_param_set(gap_own_addr_t own_addr_type, gap_scan_param_t* p_scan_param); +uint16_t ble_gap_scan_param_set(ble_gap_own_addr_t own_addr_type, ble_gap_scan_param_t* p_scan_param); /** **************************************************************************************** @@ -1359,13 +1371,12 @@ uint16_t ble_gap_scan_param_set(gap_own_addr_t own_addr_type, gap_scan_param_t* * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. * * @note This API is for extended scanning (BT Core Spec version >= 5.0). - * The Scan window in p_scan_param should be enough to recieve one packet. For example. - * If you want to recieve packects with 1270 bytes on coded phy(S8), the scan_wd should be greater than 82ms. - * If you want to recieve packects with 1270 bytes on coded phy(S2), the scan_wd should be greater than 21ms. + * The Scan window in p_scan_param should be enough to recieve one packet. For example. + * If you want to recieve packects with 1270 bytes on coded phy(S8), the scan_wd should be greater than 82ms. + * If you want to recieve packects with 1270 bytes on coded phy(S2), the scan_wd should be greater than 21ms. **************************************************************************************** */ -uint16_t ble_gap_ext_scan_param_set(gap_own_addr_t own_addr_type, - gap_ext_scan_param_t* p_scan_param); +uint16_t ble_gap_ext_scan_param_set(ble_gap_own_addr_t own_addr_type, ble_gap_ext_scan_param_t* p_scan_param); /** **************************************************************************************** @@ -1374,11 +1385,6 @@ uint16_t ble_gap_ext_scan_param_set(gap_own_addr_t own_addr_type, * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_adv_report_ind_cb will be called once the advertising report has been received. - * @note @ref gap_cb_fun_t::app_gap_scan_stop_cb will be called once the scanning has been stopped. - * @note @ref gap_cb_fun_t::app_gap_scan_start_cb will be called once the operation has completed. **************************************************************************************** */ uint16_t ble_gap_scan_start(void); @@ -1389,10 +1395,6 @@ uint16_t ble_gap_scan_start(void); * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_scan_stop_cb will be called once the operation has completed - * or the scanning has been stopped. **************************************************************************************** */ uint16_t ble_gap_scan_stop(void); @@ -1409,22 +1411,17 @@ uint16_t ble_gap_scan_stop(void); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gap_per_sync_param_set(uint8_t per_sync_idx, gap_per_sync_param_t* p_per_sync_param); +uint16_t ble_gap_per_sync_param_set(uint8_t per_sync_idx, ble_gap_per_sync_param_t* p_per_sync_param); /** **************************************************************************************** - * @brief Start to synchronize with periodic advertising from an advertiser - * and begin receiving periodic advertising packets. + * @brief Start to synchronize with periodic advertising from an advertiser and begin receiving periodic advertising packets. * @param[in] per_sync_idx: Periodic synchronization index (range is 0 to 4). * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_INVALID_PER_SYNC_IDX: Invalid periodic syncronization index supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_sync_establish_cb will be called - * once the periodic advertising synchronization has been established. **************************************************************************************** */ uint16_t ble_gap_per_sync_start(uint8_t per_sync_idx); @@ -1437,9 +1434,6 @@ uint16_t ble_gap_per_sync_start(uint8_t per_sync_idx); * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PER_SYNC_IDX: Invalid periodic syncronization index supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_stop_sync_cb will be called once the operation has completed. **************************************************************************************** */ uint16_t ble_gap_per_sync_stop(uint8_t per_sync_idx); @@ -1454,17 +1448,11 @@ uint16_t ble_gap_per_sync_stop(uint8_t per_sync_idx); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * + * * @note This API is for legacy connection (BT Core Spec version <= 4.2). - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_connect_cb will be called once the operation has completed - * or the connection has been completed. - * @note @ref gap_cb_fun_t::app_gap_peer_name_ind_cb will be called once the peer name has been got for the - Name Discovery Procedure. See enum @ref GAP_INIT_TYPE_NAME_DISC of type @ref gap_init_type_t. **************************************************************************************** */ -uint16_t ble_gap_connect(gap_own_addr_t own_addr_type, gap_init_param_t* p_init_param); +uint16_t ble_gap_connect(ble_gap_own_addr_t own_addr_type, ble_gap_init_param_t* p_init_param); /** **************************************************************************************** @@ -1476,15 +1464,11 @@ uint16_t ble_gap_connect(gap_own_addr_t own_addr_type, gap_init_param_t* p_init_ * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * + * * @note This API is for extended connection (BT Core Spec version >= 5.0). - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_connect_cb will be called once\ - * the operation has completed or the connection has been completed. **************************************************************************************** */ -uint16_t ble_gap_ext_connect(gap_own_addr_t own_addr_type, gap_ext_init_param_t* p_init_param); +uint16_t ble_gap_ext_connect(ble_gap_own_addr_t own_addr_type, ble_gap_ext_init_param_t* p_init_param); /** **************************************************************************************** @@ -1492,9 +1476,6 @@ uint16_t ble_gap_ext_connect(gap_own_addr_t own_addr_type, gap_ext_init_param_t* * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. - * - * @note This API is asynchronous. - * @note @ref gap_cb_fun_t::app_gap_connect_cancel_cb will be called once the operation has completed. **************************************************************************************** */ uint16_t ble_gap_connect_cancel(void); @@ -1536,7 +1517,7 @@ void ble_gap_ppcp_present_set(bool present_flag); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_ppcp_set(gap_conn_param_t const *p_conn_params); +uint16_t ble_gap_ppcp_set(ble_gap_conn_param_t const *p_conn_params); /** **************************************************************************************** @@ -1547,22 +1528,20 @@ uint16_t ble_gap_ppcp_set(gap_conn_param_t const *p_conn_params); * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. **************************************************************************************** */ -uint16_t ble_gap_ppcp_get(gap_conn_param_t *p_conn_params); +uint16_t ble_gap_ppcp_get(ble_gap_conn_param_t *p_conn_params); /** **************************************************************************************** * @brief Set GAP device name. * @param[in] write_perm: Write permissions of the device name characteristic. - * @param[in] p_dev_name: The pointer to device name value. If p_dev_name is NULL, - this function will only set write permissions of the device name. + * @param[in] p_dev_name: The pointer to device name value. If p_dev_name is NULL, this function will only set write permissions of the device name. * @param[in] length: Device name length. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. **************************************************************************************** */ -uint16_t ble_gap_device_name_set(gap_dev_name_write_perm_t write_perm, uint8_t const *p_dev_name, - uint16_t length); +uint16_t ble_gap_device_name_set(ble_gap_dev_name_write_perm_t write_perm, uint8_t const *p_dev_name, uint16_t length); /** **************************************************************************************** @@ -1575,9 +1554,9 @@ uint16_t ble_gap_device_name_set(gap_dev_name_write_perm_t write_perm, uint8_t c * @retval ::SDK_ERR_INVALID_DATA_LENGTH: Invalid data size(s) supplied. * * @note If device name was not set, the default device name "GOODIX_BLE" will be available. - * @note If the device name is longer than the size of the supplied buffer,p_len will return - * the complete device name length, and not the number of bytes actually returned in p_dev_name. - * The application may use this information to allocate a suitable buffer size. + * @note If the device name is longer than the size of the supplied buffer,p_len will return the complete device name length, + * and not the number of bytes actually returned in p_dev_name. + * The application may use this information to allocate a suitable buffer size. **************************************************************************************** */ uint16_t ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_length); @@ -1592,12 +1571,9 @@ uint16_t ble_gap_device_name_get(uint8_t *p_dev_name, uint16_t *p_length); * @retval ::SDK_ERR_INVALID_PSM_NUM: Invalid psm number. * @retval ::SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM: The maximum psm number limit is exceeded. * @retval ::SDK_ERR_INVALID_PSM_ALREADY_REGISTERED: The psm number has been registered. - * - * @note This API is asynchronous. - * @ref gap_cb_fun_t::app_gap_psm_manager_cb callback with op_id: @ref GAP_OPCODE_LEPSM_REGISTER will be called. **************************************************************************************** */ -uint16_t ble_gap_lepsm_register(gap_lepsm_register_t* p_lepsm); +uint16_t ble_gap_lepsm_register(ble_gap_lepsm_register_t* p_lepsm); /** **************************************************************************************** @@ -1607,10 +1583,6 @@ uint16_t ble_gap_lepsm_register(gap_lepsm_register_t* p_lepsm); * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PSM_NUM: Invalid psm number. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * - * @note This API is asynchronous. - * @note app_gap_psm_manager_cb will be called once the operation has completed, - * @ref gap_cb_fun_t::app_gap_psm_manager_cb callback with op_id: @ref GAP_OPCODE_LEPSM_UNREGISTER will be called. **************************************************************************************** */ uint16_t ble_gap_lepsm_unregister(uint16_t le_psm); @@ -1619,29 +1591,28 @@ uint16_t ble_gap_lepsm_unregister(uint16_t le_psm); **************************************************************************************** * @brief Set privacy mode for peer device. * @param[in] peer_addr: The peer address. - * @param[in] mode: Privacy mode (see @ref privacy_mode_t). + * @param[in] mode: Privacy mode. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_DISALLOWED: Operation is disallowed. * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - * **************************************************************************************** */ -uint16_t ble_gap_privacy_mode_set(gap_bdaddr_t peer_addr, privacy_mode_t mode); +uint16_t ble_gap_privacy_mode_set(ble_gap_bdaddr_t peer_addr, ble_gap_privacy_mode_t mode); /** **************************************************************************************** * @brief Read peer or local resolvable address. - * @param[in] op_code: The operation code (see @ref gap_rslv_addr_read_op_id_t). - * @param[in] peer_iden_addr: The peer identity address. + * @param[in] op_code: The operation code (see @ref ble_gap_rslv_addr_read_op_id_t). + * @param[in] peer_iden_addr: The peer identity address. * * @retval ::SDK_SUCCESS: Operation is successful. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * **************************************************************************************** */ -uint16_t ble_gap_rslv_addr_read(gap_rslv_addr_read_op_id_t op_code, gap_bdaddr_t peer_iden_addr); +uint16_t ble_gap_rslv_addr_read(ble_gap_rslv_addr_read_op_id_t op_code, ble_gap_bdaddr_t peer_iden_addr); /** ***************************************************************************************** @@ -1655,8 +1626,7 @@ uint16_t ble_gap_rslv_addr_read(gap_rslv_addr_read_op_id_t op_code, gap_bdaddr_t * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. ***************************************************************************************** */ -uint16_t ble_gap_reslv_rpa_addr(uint8_t *reslv_addr, uint8_t src_info, - reslv_rpa_addr_callback_t cb); +uint16_t ble_gap_reslv_rpa_addr(uint8_t *reslv_addr, uint8_t src_info, ble_gap_reslv_rpa_addr_callback_t cb); /** ***************************************************************************************** @@ -1679,7 +1649,7 @@ uint16_t ble_gap_update_conn_param_method_set(uint8_t conn_idx, bool use_l2cap_f * ***************************************************************************************** */ -void ble_gap_rpa_addr_report_cb_register(rpa_addr_report_callback_t cb); +void ble_gap_rpa_addr_report_cb_register(ble_gap_rpa_addr_report_callback_t cb); /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatt.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatt.h old mode 100755 new mode 100644 index 7db12bb..4f9a5e6 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatt.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatt.h @@ -35,16 +35,16 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -*/ - -/** -* @addtogroup BLE_GATT Generic Attribute Profile (GATT) -* @{ -* @brief Definitions and prototypes for the GATT interface. -*/ + /** + * @addtogroup BLE + * @{ + */ + + /** + * @addtogroup BLE_GATT Generic Attribute Profile (GATT) + * @{ + * @brief Definitions and prototypes for the GATT interface. + */ /** @addtogroup BLE_GATTS Generic Attribute Profile (GATT) Common @@ -54,6 +54,7 @@ #ifndef __BLE_GATT_H__ #define __BLE_GATT_H__ +#include "ble_error.h" #include /** @addtogroup BLE_GATT_COMMON Enumerations @@ -62,10 +63,12 @@ /** * @brief GATT common events. */ -typedef enum { +typedef enum +{ BLE_GATT_NOTIFICATION = 0x00, /**< Handle Value Notification. */ BLE_GATT_INDICATION, /**< Handle Value Indication. */ -} gatt_evt_type_t; +} ble_gatt_evt_type_t; + /** @} */ /** @addtogroup BLE_GATT_COMMON_STRUCTURES Structures @@ -74,22 +77,38 @@ typedef enum { /** * @brief GATT UUID structure. */ -typedef struct { +typedef struct +{ uint8_t uuid_len; /**< UUID length. */ uint8_t *uuid; /**< UUID value. */ } ble_uuid_t; /** - * @brief GATT common callback function description. + * @brief GATT MTU Exchange event for @ref BLE_GATT_COMMON_EVT_MTU_EXCHANGE. */ -typedef struct { - /**< Exchange MTU callback function. */ - void (*app_gatt_mtu_exchange_cb)(uint8_t conn_idx, uint8_t status, uint16_t mtu); - /**< Profile register callback function. @note prf_index range is from 0 to profile count - 1. - prf_index is current profile index. */ - void (*app_gatt_prf_register_cb)(uint8_t status, uint8_t prf_index); -} gatt_common_cb_fun_t; +typedef struct +{ + uint16_t mtu; /**< MTU Exchanged value. */ + } ble_gatt_common_evt_mtu_exchange_t; + /** + * @brief GATT Server Profile Register event for @ref BLE_GATT_COMMON_EVT_PRF_REGISTER. + */ +typedef struct +{ + uint8_t prf_index; /**< Profile Index. */ + } ble_gatt_common_evt_prf_reg_t; + +/**@brief GATT Common structure. */ +typedef struct +{ + uint8_t index; /**< Index of connection. */ + union + { + ble_gatt_common_evt_mtu_exchange_t mtu_exchange; /**< MTU exchanged event. */ + ble_gatt_common_evt_prf_reg_t prf_reg; /**< Server Profile Register event. */ + } params; /**< Event Parameters. */ +} ble_gatt_common_evt_t; /** @} */ /** @addtogroup BLE_GATT_FUNCTIONS Functions @@ -98,9 +117,9 @@ typedef struct { /** **************************************************************************************** * @brief Set ATT_MTU size. - * + * * @param[in] mtu: ATT_MTU size. - * + * * @note This function should be called before exchange MTU operation. This MTU size is used to all connections. * If not set these parameters, the stack will config the default value as (max_mtu = 512). * diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gattc.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gattc.h old mode 100755 new mode 100644 index ca98364..a6e3583 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gattc.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gattc.h @@ -35,16 +35,16 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -*/ - -/** -* @addtogroup BLE_GATT Generic Attribute Profile (GATT) -* @{ -* @brief Definitions and prototypes for the GATT interface. -*/ + /** + * @addtogroup BLE + * @{ + */ + + /** + * @addtogroup BLE_GATT Generic Attribute Profile (GATT) + * @{ + * @brief Definitions and prototypes for the GATT interface. + */ /** @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client @@ -69,13 +69,14 @@ /** * @brief GATT Client Service Discover Attribute type IDs. */ -typedef enum { +typedef enum +{ BLE_GATTC_BROWSE_NONE, /**< No Attribute Information. */ BLE_GATTC_BROWSE_INC_SRVC, /**< Included Service information. */ BLE_GATTC_BROWSE_ATTR_CHAR, /**< Characteristic Declaration. */ BLE_GATTC_BROWSE_ATTR_VAL, /**< Attribute Value definition. */ BLE_GATTC_BROWSE_ATTR_DESC, /**< Attribute Descriptor. */ -} gatt_attr_t; +} ble_gattc_attr_type_t; /** @} */ @@ -85,114 +86,108 @@ typedef enum { /** * @brief GATTC discovery characteristic structure. */ -typedef struct { +typedef struct +{ uint16_t start_hdl; /**< Start handle. */ uint16_t end_hdl; /**< End handle. */ ble_uuid_t *p_uuid; /**< Characteristic UUID. */ -} gattc_disc_char_t; +} ble_gattc_disc_char_t; /** * @brief GATTC read by characteristic UUID structure. */ -typedef struct { +typedef struct +{ uint16_t start_hdl; /**< Start handle. */ uint16_t end_hdl; /**< End handle. */ ble_uuid_t *p_uuid; /**< Characteristic UUID. */ -} gattc_read_by_uuid_t; +} ble_gattc_read_by_uuid_t; /** * @brief GATTC write attribute value structure. */ -typedef struct { +typedef struct +{ uint16_t handle; /**< Attribute handle. */ uint16_t offset; /**< value offset to start with. */ uint16_t length; /**< Write length. */ uint8_t *p_value; /**< Value to write. */ -} gattc_write_attr_value_t; +} ble_gattc_write_attr_value_t; /** * @brief GATTC write without response structure. */ -typedef struct { +typedef struct +{ bool signed_write; /**< True if signed write should be used when possible/applicable. */ uint16_t handle; /**< Attribute handle. */ uint16_t length; /**< Write length. */ uint8_t *p_value; /**< Value to write. */ -} gattc_write_no_resp_t; +} ble_gattc_write_no_resp_t; -/** @brief Read Multiple Handles. */ -typedef struct { +/**@brief Read Multiple Handles. */ +typedef struct +{ uint16_t handle; /**< Attribute handle. */ uint16_t len; /**< Known value: length of the handle (len shall not be set to 0). */ -} read_multiple_t; +} ble_gattc_multiple_att_t; -/** @brief GATTC Read Multiple. */ -typedef struct { - uint16_t handle_count; /**< Handle count of the multiple attributes to be read. */ - read_multiple_t *p_read_multiple; /**< Pointer to the multiple attributes to be read. */ -} gattc_read_multiple_t; +/**@brief GATTC Read Multiple. */ +typedef struct +{ + uint16_t handle_count; /**< Handle count of the multiple attributes to be read. */ + ble_gattc_multiple_att_t *p_read_multiple; /**< Pointer to the multiple attributes to be read. */ + } ble_gattc_read_multiple_t; +/**@brief GATTC Browse information about Characteristic. */ +typedef struct +{ + ble_gattc_attr_type_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_ATTR_CHAR for Characteristic Declaration. */ + uint8_t prop; /**< Value property. */ + uint16_t handle; /**< Value handle. */ + uint8_t uuid_len; /**< Characteristic UUID length. */ + uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Characteristic UUID. */ +} ble_gattc_browse_attr_char_t; -/** @brief GATTC Browse information about Characteristic. */ -typedef struct { - uint8_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_ATTR_CHAR for Characteristic Declaration. */ - uint8_t prop; /**< Value property. */ - uint16_t handle; /**< Value handle. */ - uint8_t uuid_len; /**< Characteristic UUID length. */ - uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Characteristic UUID. */ -} gattc_browse_attr_char_t; +/**@brief GATTC Browse information about Included Service. */ +typedef struct +{ + ble_gattc_attr_type_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_INC_SRVC for Included Service Information. */ + uint8_t uuid_len; /**< Included Service UUID length. */ + uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Included Service UUID. */ + uint16_t start_hdl; /**< Included Service start handle. */ + uint16_t end_hdl; /**< Included Service end handle. */ +} ble_gattc_browse_inc_srvc_t; -/** @brief GATTC Browse information about Included Service. */ -typedef struct { - uint8_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_INC_SRVC for Included Service Information. */ - uint8_t uuid_len; /**< Included Service UUID length. */ - uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Included Service UUID. */ - uint16_t start_hdl; /**< Included Service start handle. */ - uint16_t end_hdl; /**< Included Service end handle. */ -} gattc_browse_inc_srvc_t; +/**@brief GATTC Browse information about Attribute. */ +typedef struct +{ + ble_gattc_attr_type_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_ATTR_VAL for Attribute Value. See @ref BLE_GATTC_BROWSE_ATTR_DESC for Attribute Descriptor. */ + uint8_t uuid_len; /**< Attribute UUID length. */ + uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Characteristic UUID or Characteristic Descriptor UUID. */ +} ble_gattc_browse_attr_t; -/** @brief GATTC Browse information about Attribute. */ -typedef struct { - uint8_t attr_type; /**< Attribute type. See @ref BLE_GATTC_BROWSE_ATTR_VAL for Attribute Value. - See @ref BLE_GATTC_BROWSE_ATTR_DESC for Attribute Descriptor. */ - uint8_t uuid_len; /**< Attribute UUID length. */ - uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Characteristic UUID or Characteristic Descriptor UUID. */ -} gattc_browse_attr_t; - -/** @brief GATTC Browse attribute information. */ -union gattc_browse_attr_info { - uint8_t attr_type; /**< Attribute type. See @ref gatt_attr_t. */ - gattc_browse_attr_char_t attr_char; /**< Information about Characteristic. - When union attr_type is @ref BLE_GATTC_BROWSE_ATTR_CHAR */ - gattc_browse_inc_srvc_t inc_srvc; /**< Information about Included Service. - When union attr_type is @ref BLE_GATTC_BROWSE_INC_SRVC */ - gattc_browse_attr_t attr; /**< Information about Attribute. When union attr_type is - @ref BLE_GATTC_BROWSE_ATTR_VAL or @ref BLE_GATTC_BROWSE_ATTR_DESC. */ +/**@brief GATTC Browse attribute information. */ +union ble_gattc_browse_attr_info +{ + ble_gattc_attr_type_t attr_type; /**< Attribute type. See @ref ble_gattc_attr_type_t. */ + ble_gattc_browse_attr_char_t attr_char; /**< Information about Characteristic. When union attr_type is @ref BLE_GATTC_BROWSE_ATTR_CHAR */ + ble_gattc_browse_inc_srvc_t inc_srvc; /**< Information about Included Service. When union attr_type is @ref BLE_GATTC_BROWSE_INC_SRVC */ + ble_gattc_browse_attr_t attr; /**< Information about Attribute. When union attr_type is @ref BLE_GATTC_BROWSE_ATTR_VAL or @ref BLE_GATTC_BROWSE_ATTR_DESC. */ }; -/** @brief GATTC Browse service(s) indication. */ -typedef struct { - uint8_t uuid_len; /**< Service UUID length. */ - uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Service UUID. */ - uint16_t start_hdl; /**< Service start handle. */ - uint16_t end_hdl; /**< Service end handle. */ - union gattc_browse_attr_info info[ARRAY_EMPTY]; /**< Attribute information presented in the service - (array length = end_hdl - start_hdl); - If attr_type is equal to BLE_GATTC_BROWSE_NONE,the last - attribute information has been found in previous one, - although not reach the service end handle. */ -} ble_gattc_browse_srvc_t; - -/** @brief GATT service. */ -typedef struct { +/**@brief GATT service. */ +typedef struct +{ uint16_t start_hdl; /**< Start handle. */ uint16_t end_hdl; /**< End handle. */ uint8_t uuid_len; /**< Service UUID length. */ uint8_t *p_uuid; /**< Service UUID. */ } ble_gattc_service_t; -/** @brief GATT include. */ -typedef struct { +/**@brief GATT include. */ +typedef struct +{ uint16_t attr_hdl; /**< Attribute handle. */ uint16_t start_hdl; /**< Start handle. */ uint16_t end_hdl; /**< End handle. */ @@ -200,96 +195,111 @@ typedef struct { uint8_t *p_uuid; /**< Service UUID. */ } ble_gattc_include_t; -/** @brief GATT characteristic. */ -typedef struct { +/**@brief GATT characteristic. */ +typedef struct +{ uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ uint16_t handle_value; /**< Handle of the Characteristic Value. */ uint8_t prop; /**< Properties. */ - uint8_t uuid_len; /**< Characteristic UUID length. */ + uint8_t uuid_len; /**< Characteristic UUID length. */ uint8_t *p_uuid; /**< Characteristic UUID. */ } ble_gattc_char_t; -/** @brief GATT descriptor. */ -typedef struct { +/**@brief GATT descriptor. */ +typedef struct +{ uint16_t attr_hdl; /**< Attribute handle. */ uint8_t uuid_len; /**< Descriptor UUID length. */ uint8_t *p_uuid; /**< Descriptor UUID. */ } ble_gattc_desc_t; -/** @brief GATT service discovery. */ -typedef struct { - uint16_t count; /**< Service count. */ - ble_gattc_service_t services[ARRAY_EMPTY]; /**< Service data. */ -} ble_gattc_srvc_disc_t; - -/** @brief GATT include discovery. */ -typedef struct { - uint16_t count; /**< Include count. */ - ble_gattc_include_t includes[ARRAY_EMPTY]; /**< Include data. */ -} ble_gattc_incl_disc_t; - -/** @brief GATT characteristic discovery. */ -typedef struct { - uint16_t count; /**< Characteristic count. */ - ble_gattc_char_t chars[ARRAY_EMPTY]; /**< Characteristic data. */ -} ble_gattc_char_disc_t; - -/** @brief GATT characteristic descriptor discovery. */ -typedef struct { - uint16_t count; /**< Descriptor count. */ - ble_gattc_desc_t char_descs[ARRAY_EMPTY]; /**< Descriptor data. */ -} ble_gattc_char_desc_disc_t; - -/** @brief GATT Client Read value. */ -typedef struct { +/**@brief GATT Client Read value. */ +typedef struct +{ uint16_t handle; /**< Attribute handle. */ uint16_t offset; /**< Offset of the attribute value. */ uint16_t length; /**< Attribute value length. */ uint8_t *p_value; /**< Pointer to the attribute value data. */ } ble_gattc_read_value_t; -/** @brief GATT value Read response. */ -typedef struct { - uint16_t count; /**< Value Count. */ - ble_gattc_read_value_t vals[ARRAY_EMPTY]; /**< Value(s) list. */ -} ble_gattc_read_rsp_t; +/**@brief GATTC Browse service(s) event for @ref BLE_GATTC_EVT_SRVC_BROWSE. */ +typedef struct +{ + uint8_t uuid_len; /**< Service UUID length. */ + uint8_t uuid[BLE_ATT_UUID_128_LEN]; /**< Service UUID. */ + uint16_t start_hdl; /**< Service start handle. */ + uint16_t end_hdl; /**< Service end handle. */ + union ble_gattc_browse_attr_info *info; /**< Attribute information presented in the service(array length = end_hdl - start_hdl);If attr_type is equal to BLE_GATTC_BROWSE_NONE, the last attribute information has been found in previous one, although not reach the service end handle. */ +} ble_gattc_evt_browse_srvc_t; + +/**@brief GATT service discovery event for @ref BLE_GATTC_EVT_PRIMARY_SRVC_DISC. */ +typedef struct +{ + uint16_t count; /**< Service count. */ + ble_gattc_service_t *services; /**< Service data. */ +}ble_gattc_evt_srvc_disc_t; + +/**@brief GATT include discovery event for @ref BLE_GATTC_EVT_INCLUDE_SRVC_DISC. */ +typedef struct +{ + uint16_t count; /**< Include count. */ + ble_gattc_include_t *includes; /**< Include data. */ +}ble_gattc_evt_incl_disc_t; + +/**@brief GATT characteristic discovery event for @ref BLE_GATTC_EVT_CHAR_DISC. */ +typedef struct +{ + uint16_t count; /**< Characteristic count. */ + ble_gattc_char_t *chars; /**< Characteristic data. */ +}ble_gattc_evt_char_disc_t; + +/**@brief GATT characteristic descriptor discovery event for @ref BLE_GATTC_EVT_CHAR_DESC_DISC. */ +typedef struct +{ + uint16_t count; /**< Descriptor count. */ + ble_gattc_desc_t *char_descs; /**< Descriptor data. */ +}ble_gattc_evt_char_desc_disc_t; + +/**@brief GATT Client Read response event for @ref BLE_GATTC_EVT_READ_RSP. */ +typedef struct +{ + uint16_t count; /**< Value Count. */ + ble_gattc_read_value_t *value; /**< Value(s) list. */ +}ble_gattc_evt_read_t; -/** @brief GATT Client Write. */ -typedef struct { +/**@brief GATT Client Write Response event for @ref BLE_GATTC_EVT_WRITE_RSP. */ +typedef struct +{ uint16_t handle; /**< Attribute handle. */ -} ble_gattc_write_t; +} ble_gattc_evt_write_t; -/** @brief GATTC Notification and Indication value indication. */ -typedef struct { - gatt_evt_type_t type; /**< Event type. */ - uint16_t length; /**< Attribute value length. */ - uint16_t handle; /**< Attribute handle. */ - uint8_t *p_value; /**< Pointer to the attribute value data. */ -} ble_gattc_ntf_ind_t; +/**@brief GATTC Notification and Indication event for @ref BLE_GATTC_EVT_NTF_IND. */ +typedef struct +{ + ble_gatt_evt_type_t type; /**< Event type. */ + uint16_t length; /**< Attribute value length. */ + uint16_t handle; /**< Attribute handle. */ + uint8_t *p_value; /**< Pointer to the attribute value data. */ +} ble_gattc_evt_ntf_ind_t; -/** @brief GATTC Event callback Structures. */ -typedef struct { - /**< Primary Service Discovery Response callback. */ - void (*app_gattc_srvc_disc_cb)(uint8_t conn_idx, uint8_t status, const ble_gattc_srvc_disc_t *p_prim_srvc_disc); - /**< Relationship Discovery Response callback. */ - void (*app_gattc_inc_srvc_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_incl_disc_t *p_inc_srvc_disc); - /**< Characteristic Discovery Response callback. */ - void (*app_gattc_char_disc_cb)(uint8_t conn_idx, uint8_t status, const ble_gattc_char_disc_t *p_char_disc); - /**< Descriptor Discovery Response callback. */ - void (*app_gattc_char_desc_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_char_desc_disc_t *p_char_desc_disc); - /**< Read Response callback. */ - void (*app_gattc_read_cb)(uint8_t conn_idx, uint8_t status, const ble_gattc_read_rsp_t *p_read_rsp); - /**< Write complete callback. */ - void (*app_gattc_write_cb)(uint8_t conn_idx, uint8_t status, uint16_t handle); - /**< Handle Value Notification/Indication Event callback. */ - void (*app_gattc_ntf_ind_cb)(uint8_t conn_idx, const ble_gattc_ntf_ind_t *p_ntf_ind); - /**< Service found callback during browsing procedure. */ - void (*app_gattc_srvc_browse_cb)(uint8_t conn_idx, uint8_t status, const ble_gattc_browse_srvc_t *p_browse_srvc); -} gattc_cb_fun_t; +/**@brief BLE GATTC event structure. */ +typedef struct +{ + uint8_t index; /**< Index of connection. */ + union + { + ble_gattc_evt_browse_srvc_t srvc_browse; /**< Browce service discovery response event. */ + ble_gattc_evt_srvc_disc_t prim_srvc_disc; /**< Primary service discovery response event. */ + ble_gattc_evt_incl_disc_t inc_srvc_disc; /**< Include service discovery response event. */ + ble_gattc_evt_char_disc_t char_disc; /**< Characteristic discovery response event. */ + ble_gattc_evt_char_desc_disc_t char_desc_disc; /**< Characteristic descriptor discovery response event. */ + ble_gattc_evt_read_t read_rsp; /**< Read response event. */ + ble_gattc_evt_write_t write_rsp; /**< Write response event. */ + ble_gattc_evt_ntf_ind_t ntf_ind; /**< Handle value Notification/Indication response. */ + } params; /**< Event Parameters. */ +} ble_gattc_evt_t; /** @} */ /** @addtogroup BLE_GATTC_FUNCTIONS Functions @@ -299,9 +309,6 @@ typedef struct { **************************************************************************************** * @brief Perform MTU Exchange. * - * @note MTU Exchange Callback @ref gatt_common_cb_fun_t::app_gatt_mtu_exchange_cb will be called to - * indicate to APP once receiving the peer response. - * * @param[in] conn_idx: Current connection index. * * @retval ::SDK_SUCCESS: Successfully send an MTU Exchange request. @@ -315,15 +322,11 @@ uint16_t ble_gattc_mtu_exchange(uint8_t conn_idx); **************************************************************************************** * @brief Browse all Primary Services or specific Primary Service information on remote GATT server. * - * @note This discovery automatically searches for Primary Services, Included Services, - * Characteristics and Descriptors of each service. + * @note This discovery automatically searches for Primary Services, Included Services, Characteristics and Descriptors of each service. * To discover one or more services only, use ble_gattc_primary_services_discover() instead. * This discovery is able to search all Primary Services or a specific one. * If srvc_uuid is NULL, all services are returned. * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_srvc_browse_cb will be called for - * all attributes of each service found. - * * @param[in] conn_idx: Current connection index. * @param[in] p_srvc_uuid: Pointer to Service UUID. If it is NULL, all services will be returned. * @@ -337,9 +340,7 @@ uint16_t ble_gattc_services_browse(uint8_t conn_idx, const ble_uuid_t *p_srvc_uu /** **************************************************************************************** * @brief Discover Primary Services on remote GATT server. - * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_srvc_disc_cb will be called for service(s) found. - * + * * @param[in] conn_idx: Current connection index. * @param[in] p_srvc_uuid: Pointer to Service UUID. If it is NULL, all Primary Services will be returned. * @@ -354,7 +355,6 @@ uint16_t ble_gattc_primary_services_discover(uint8_t conn_idx, const ble_uuid_t **************************************************************************************** * @brief Discover Included Services on remote GATT server. * - * @note Function callback @ref gattc_cb_fun_t:app_gattc_inc_srvc_disc_cb will be called for Included Service(s) found. * @param[in] conn_idx: Current connection index. * @param[in] start_hdl: Start handle. * @param[in] end_hdl: End handle. @@ -369,8 +369,7 @@ uint16_t ble_gattc_included_services_discover(uint8_t conn_idx, uint16_t start_h /** **************************************************************************************** * @brief Discover Characteristics on remote GATT server. - * @note Function callback @ref gattc_cb_fun_t::app_gattc_char_disc_cb will be called - * for Characteristic Declaration(s) found. + * * @param[in] conn_idx: Current connection index. * @param[in] start_hdl: Start handle. * @param[in] end_hdl: End handle. @@ -381,18 +380,12 @@ uint16_t ble_gattc_included_services_discover(uint8_t conn_idx, uint16_t start_h * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gattc_char_discover(uint8_t conn_idx, uint16_t start_hdl, - uint16_t end_hdl, const ble_uuid_t *p_char_uuid); +uint16_t ble_gattc_char_discover(uint8_t conn_idx, uint16_t start_hdl, uint16_t end_hdl, const ble_uuid_t *p_char_uuid); /** **************************************************************************************** * @brief Discover Characteristics Descriptors on remote GATT server. * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_char_desc_disc_cb will be called - * for Characteristic Descriptor(s) found. - * If the last Descriptor has not been reached, this function must be called again with an updated handle - * range to continue the discovery. - * * @param[in] conn_idx: Current connection index. * @param[in] start_hdl: Start handle. * @param[in] end_hdl: End handle. @@ -413,7 +406,6 @@ uint16_t ble_gattc_char_desc_discover(uint8_t conn_idx, uint16_t start_hdl, uint * attribute length is larger than the MTU, the "Read Long Characteristic Value" procedure or the * "Read Long Characteristic Descriptor" procedure will be used respectively. * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_read_cb will be called when Read is finished. * @param[in] conn_idx: Current connection index. * @param[in] handle: Attribute handle. * @param[in] offset: Value offset to start with. @@ -429,7 +421,6 @@ uint16_t ble_gattc_read(uint8_t conn_idx, uint16_t handle, uint16_t offset); **************************************************************************************** * @brief Read Attribute by UUID. * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_read_cb will be called when Read is finished. * @param[in] conn_idx: Current connection index. * @param[in] start_hdl: Start handle. * @param[in] end_hdl: End handle. @@ -442,14 +433,12 @@ uint16_t ble_gattc_read(uint8_t conn_idx, uint16_t handle, uint16_t offset); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gattc_read_by_uuid(uint8_t conn_idx, uint16_t start_hdl, - uint16_t end_hdl, const ble_uuid_t *p_char_uuid); +uint16_t ble_gattc_read_by_uuid(uint8_t conn_idx, uint16_t start_hdl, uint16_t end_hdl, const ble_uuid_t *p_char_uuid); /** **************************************************************************************** * @brief Initiate a Read Multiple Characteristic Values procedure * - * @note Function callback @ref gattc_cb_fun_t::app_gattc_read_cb will be called for each handle value which is read. * @param[in] conn_idx: Current connection index. * @param[in] p_param: Pointer to the parameters of the value. * @@ -459,7 +448,7 @@ uint16_t ble_gattc_read_by_uuid(uint8_t conn_idx, uint16_t start_hdl, * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gattc_read_multiple(uint8_t conn_idx, const gattc_read_multiple_t *p_param); +uint16_t ble_gattc_read_multiple(uint8_t conn_idx, const ble_gattc_read_multiple_t *p_param); /** **************************************************************************************** @@ -470,8 +459,6 @@ uint16_t ble_gattc_read_multiple(uint8_t conn_idx, const gattc_read_multiple_t * * or the attribute length is larger than the MTU, the "Write Long Characteristic Value" procedure * or the "Write Long Characteristic Descriptor" procedure will be used respectively. * - * @note Once completed @ref gattc_cb_fun_t::app_gattc_write_cb will be called. - * * @param[in] conn_idx: Current connection index. * @param[in] handle: The handle of the attribute to be written. * @param[in] offset: Offset into the attribute value to be written. @@ -490,8 +477,6 @@ uint16_t ble_gattc_write(uint8_t conn_idx, uint16_t handle, uint16_t offset, uin **************************************************************************************** * @brief Prepare Long/Reliable Write to remote GATT server. * - * @note When this function completes, @ref gattc_cb_fun_t::app_gattc_write_cb will be called. - * * @param[in] conn_idx: Current connection index. * @param[in] handle: Attribute handle. * @param[in] offset: Value offset to start with. @@ -504,15 +489,12 @@ uint16_t ble_gattc_write(uint8_t conn_idx, uint16_t handle, uint16_t offset, uin * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gattc_write_prepare(uint8_t conn_idx, uint16_t handle, uint16_t offset, uint16_t length, - const uint8_t *p_value); +uint16_t ble_gattc_write_prepare(uint8_t conn_idx, uint16_t handle, uint16_t offset, uint16_t length, const uint8_t *p_value); /** **************************************************************************************** * @brief Execute Reliable/Long Write to remote GATT server. * - * @note When this function completes, @ref gattc_cb_fun_t::app_gattc_write_cb will be called. - * * @param[in] conn_idx: Current connection index. * @param[in] execute: True if data shall be written; false if cancel all prepared writes. * @@ -529,9 +511,8 @@ uint16_t ble_gattc_write_execute(uint8_t conn_idx, bool execute); * * @note If signed_write is set to false, the "Write Without Response" procedure will be used. * If signed_write is set to true, the "Signed Write Without Response" procedure will be used on - * a link which is not encrypted. If a link is already encrypted, - * "Write Without Response" procedure shall be used instead of "Signed Write Without Response". - * @note Once completed @ref gattc_cb_fun_t::app_gattc_write_cb will be called. + * a link which is not encrypted. + * If a link is already encrypted, "Write Without Response" procedure shall be used instead of "Signed Write Without Response". * * @param[in] conn_idx: Current connection index. * @param[in] handle: Attribute handle. @@ -545,8 +526,7 @@ uint16_t ble_gattc_write_execute(uint8_t conn_idx, bool execute); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gattc_write_no_resp(uint8_t conn_idx, bool signed_write, uint16_t handle, uint16_t length, - const uint8_t *p_value); +uint16_t ble_gattc_write_no_resp(uint8_t conn_idx, bool signed_write, uint16_t handle, uint16_t length, const uint8_t *p_value); /** **************************************************************************************** diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatts.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatts.h old mode 100755 new mode 100644 index 0089d70..f544fac --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatts.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_gatts.h @@ -34,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************************** */ - + /** * @addtogroup BLE * @{ @@ -52,90 +52,68 @@ @brief Definitions and prototypes for the GATT server interface. */ - + #ifndef __BLE_GATTS_H__ #define __BLE_GATTS_H__ -#include +#include "ble_error.h" +#include "ble_att.h" #include "ble_gatt.h" +#include "ble_gapc.h" + +#include /** @addtogroup BLE_GATTS_DEFINES Defines * @{ */ /** @defgroup BLE_GATTS_MAX_INC_SRVC_NUM Max Number of Included Services * @{ */ -#define MAX_INC_SRVC_NUM (5) /**< The max number of Included Services a Primary/Secondary service - can have. Used by @ref gatts_create_db_t. */ +#define BLE_GATTS_MAX_INC_SRVC_NUM (5) /**< The max number of Included Services a Primary/Secondary service can have. Used by @ref ble_gatts_create_db_t. */ /** @} */ - + /** @defgroup BLE_GATTS_ATTR_PERM_BIT Attribute Permission Bit * @{ */ -#define BROADCAST (0x01) /**< In one byte, bit0 means: Broadcast bit. - Used by @ref BROADCAST_ENABLE. */ -#define READ (0x02) /**< In one byte, bit1 means: Read bit. - Used by @ref READ_PERM_UNSEC, @ref READ_PERM */ -#define WRITE_CMD (0x04) /**< In one byte, bit2 means: Write_cmd bit. - Used by @ref WRITE_CMD_PERM_UNSEC, @ref WRITE_CMD_PERM. */ -#define WRITE_REQ (0x08) /**< In one byte, bit3 means: Write_req bit. - Used by @ref WRITE_REQ_PERM_UNSEC, @ref WRITE_REQ_PERM. */ -#define NOTIFY (0x10) /**< In one byte, bit4 means: Notify bit. - Used by @ref NOTIFY_PERM_UNSEC, @ref NOTIFY_PERM. */ -#define INDICATE (0x20) /**< In one byte, bit5 means: Indicate bit. - Used by @ref INDICATE_PERM_UNSEC, @ref INDICATE_PERM */ -#define WRITE_SIGNED (0x40) /**< In one byte, bit6 means: Write_signed bit. - Used by @ref WRITE_SIGNED_PERM_UNSEC, @ref WRITE_SIGNED_PERM. */ -#define EXT_PROP (0x80) /**< In one byte, bit7 means: Ext_property bit. - Used by @ref EXT_PROP_ENABLE. */ +#define BLE_GATTS_BROADCAST (0x01) /**< In one byte, bit0 means: Broadcast bit. Used by @ref BLE_GATTS_BROADCAST_ENABLE. */ +#define BLE_GATTS_READ (0x02) /**< In one byte, bit1 means: Read bit. Used by @ref BLE_GATTS_READ_PERM_UNSEC, @ref BLE_GATTS_READ_PERM */ +#define BLE_GATTS_WRITE_CMD (0x04) /**< In one byte, bit2 means: Write_cmd bit. Used by @ref BLE_GATTS_WRITE_CMD_PERM_UNSEC, @ref BLE_GATTS_WRITE_CMD_PERM. */ +#define BLE_GATTS_WRITE_REQ (0x08) /**< In one byte, bit3 means: Write_req bit. Used by @ref BLE_GATTS_WRITE_REQ_PERM_UNSEC, @ref BLE_GATTS_WRITE_REQ_PERM. */ +#define BLE_GATTS_NOTIFY (0x10) /**< In one byte, bit4 means: Notify bit. Used by @ref BLE_GATTS_NOTIFY_PERM_UNSEC, @ref BLE_GATTS_NOTIFY_PERM. */ +#define BLE_GATTS_INDICATE (0x20) /**< In one byte, bit5 means: Indicate bit. Used by @ref BLE_GATTS_INDICATE_PERM_UNSEC, @ref BLE_GATTS_INDICATE_PERM */ +#define BLE_GATTS_WRITE_SIGNED (0x40) /**< In one byte, bit6 means: Write_signed bit. Used by @ref BLE_GATTS_WRITE_SIGNED_PERM_UNSEC, @ref BLE_GATTS_WRITE_SIGNED_PERM. */ +#define BLE_GATTS_EXT_PROP (0x80) /**< In one byte, bit7 means: Ext_property bit. Used by @ref BLE_GATTS_EXT_PROP_ENABLE. */ /** @} */ /** @defgroup BLE_GATTS_ATTR_PERM_POS Attribute Permission Value Position * @{ */ -#define READ_POS (0x00) /**< Bit position of read permission. Used by @ref READ_PERM. */ -#define WRITE_POS (0x02) /**< Bit position of write permission. Used by @ref WRITE_CMD_PERM, - @ref WRITE_REQ_PERM, @ref WRITE_SIGNED_PERM. */ -#define INDICATE_POS (0x04) /**< Bit position of indicate bit. Used by @ref INDICATE_PERM. */ -#define NOTIFY_POS (0x06) /**< Bit position of notify bit. Used by @ref NOTIFY_PERM. */ +#define BLE_GATTS_READ_POS (0x00) /**< Bit position of read permission. Used by @ref BLE_GATTS_READ_PERM. */ +#define BLE_GATTS_WRITE_POS (0x02) /**< Bit position of write permission. Used by @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM. */ +#define BLE_GATTS_INDICATE_POS (0x04) /**< Bit position of indicate bit. Used by @ref BLE_GATTS_INDICATE_PERM. */ +#define BLE_GATTS_NOTIFY_POS (0x06) /**< Bit position of notify bit. Used by @ref BLE_GATTS_NOTIFY_PERM. */ /** @} */ /** @defgroup BLE_GATTS_SEC_LEVEL Attribute and Service Access Rights * @{ */ - -#define NOAUTH (0x00) /**< LE security mode 1, level 1. - Link does not need to be encrypted or authenticated. - Parameter of @ref SRVC_PERM, @ref READ_PERM, - @ref WRITE_REQ_PERM, @ref WRITE_CMD_PERM, - @ref WRITE_SIGNED_PERM, @ref INDICATE_PERM, @ref NOTIFY_PERM. */ -#define UNAUTH (0x01) /**< LE security mode 1, level 2. - Link needs to be encrypted, but not to be authenticated. - Parameter of @ref SRVC_PERM, @ref READ_PERM, @ref WRITE_REQ_PERM, - @ref WRITE_CMD_PERM, @ref WRITE_SIGNED_PERM, @ref INDICATE_PERM, - @ref NOTIFY_PERM. */ -#define AUTH (0x02) /**< LE security mode 1, level 3. - Link needs to be encrypted and authenticated (MITM). - Parameter of @ref SRVC_PERM, @ref READ_PERM, @ref WRITE_REQ_PERM, - @ref WRITE_CMD_PERM, @ref WRITE_SIGNED_PERM, @ref INDICATE_PERM, - @ref NOTIFY_PERM. */ -#define SEC_CON (0x03) /**< LE security mode 1, level 4. - Link needs to be encrypted and authenticated (secure connections). - Parameter of @ref SRVC_PERM, @ref READ_PERM, @ref WRITE_REQ_PERM, - @ref WRITE_CMD_PERM, @ref WRITE_SIGNED_PERM, @ref INDICATE_PERM, - @ref NOTIFY_PERM. */ + +#define BLE_GATTS_NOAUTH (0x00) /**< LE security mode 1, level 1. Link does not need to be encrypted or authenticated. + Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */ +#define BLE_GATTS_UNAUTH (0x01) /**< LE security mode 1, level 2. Link needs to be encrypted, but not to be authenticated. + Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */ +#define BLE_GATTS_AUTH (0x02) /**< LE security mode 1, level 3. Link needs to be encrypted and authenticated (MITM). + Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */ +#define BLE_GATTS_SEC_CON (0x03) /**< LE security mode 1, level 4. Link needs to be encrypted and authenticateBLE_GATTS_d (secure connections). + Parameter of @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */ /** @} */ /** @defgroup BLE_GATTS_SEC_LEVEL_MASK Attribute and Service Security Level Mask * @{ */ -#define SEC_LEVEL_MASK (0x03) /**< Security level mask. - Used by @ref SRVC_PERM, @ref READ_PERM, @ref WRITE_REQ_PERM, - @ref WRITE_CMD_PERM, @ref WRITE_SIGNED_PERM, @ref INDICATE_PERM, - @ref NOTIFY_PERM. */ +#define BLE_GATTS_SEC_LEVEL_MASK (0x03) /**< Security level mask. + Used by @ref BLE_GATTS_SRVC_PERM, @ref BLE_GATTS_READ_PERM, @ref BLE_GATTS_WRITE_REQ_PERM, @ref BLE_GATTS_WRITE_CMD_PERM, @ref BLE_GATTS_WRITE_SIGNED_PERM, @ref BLE_GATTS_INDICATE_PERM, @ref BLE_GATTS_NOTIFY_PERM. */ /** @} */ /** @defgroup BLE_GATTS_UUID_TYPE Attribute and Service UUID Type * @{ */ -#define UUID_TYPE_16 (0x00) /**< 16-bit UUID length. - Parameter of @ref SRVC_UUID_TYPE_SET, @ref ATT_UUID_TYPE_SET. */ -#define UUID_TYPE_128 (0x02) /**< 128-bit UUID length. - Parameter of @ref SRVC_UUID_TYPE_SET, @ref ATT_UUID_TYPE_SET. */ +#define BLE_GATTS_UUID_TYPE_16 (0x00) /**< 16-bit UUID length. */ +#define BLE_GATTS_UUID_TYPE_128 (0x02) /**< 128-bit UUID length. */ /** @} */ /** @@ -155,16 +133,12 @@ /** @defgroup BLE_GATTS_SRVC_PERM Service Permission * @{ */ -#define SRVC_SECONDARY_SET (0x80) /**< Secondary service set. */ -#define SRVC_DISABLE (0x10) /**< Service disable. */ -#define SRVC_ENCRP_KEY_SIZE_16 (0x02) /**< 16 bytes service encryption key size . */ -#define SRVC_MULTI_ENABLE (0x01) /**< Service is multi-instantiated. */ - -/**< Service UUID length set. See @ref BLE_GATTS_UUID_TYPE. */ -#define SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5) - -/**< Service permission authentication. See @ref BLE_GATTS_SEC_LEVEL. */ -#define SRVC_PERM(sec_level) (((sec_level) & SEC_LEVEL_MASK) << 2) +#define BLE_GATTS_SRVC_SECONDARY_SET (0x80) /**< Secondary service set. */ +#define BLE_GATTS_SRVC_UUID_TYPE_SET(uuid_len) ((uuid_len) << 5) /**< Service UUID length set. See @ref BLE_GATTS_UUID_TYPE. */ +#define BLE_GATTS_SRVC_DISABLE (0x10) /**< Service disable. */ +#define BLE_GATTS_SRVC_PERM(sec_level) (((sec_level) & SEC_LEVEL_MASK) << 2) /**< Service permission authentication. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_SRVC_ENCRP_KEY_SIZE_16 (0x02) /**< 16 bytes service encryption key size . */ +#define BLE_GATTS_SRVC_MULTI_ENABLE (0x01) /**< Service is multi-instantiated. */ /** @} */ /** @@ -191,34 +165,20 @@ /** @defgroup BLE_GATTS_ATTR_PERM Attribute Permission * @{ */ -/**< Default Read permission. */ -#define READ_PERM_UNSEC (READ << 8) -/**< Read permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define READ_PERM(sec_level) (READ << 8 | (((sec_level) & SEC_LEVEL_MASK) << READ_POS)) -/**< Default Write Permission. */ -#define WRITE_REQ_PERM_UNSEC (WRITE_REQ << 8) -/**< Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define WRITE_REQ_PERM(sec_level) (WRITE_REQ << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS)) -/**< Default Write without Response Permission. */ -#define WRITE_CMD_PERM_UNSEC (WRITE_CMD << 8) -/**< Write without Response permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define WRITE_CMD_PERM(sec_level) (WRITE_CMD << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS)) -/**< Default Authenticated Signed Write Permission. */ -#define WRITE_SIGNED_PERM_UNSEC (WRITE_SIGNED << 8) -/**< Authenticated Signed Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define WRITE_SIGNED_PERM(sec_level) (WRITE_SIGNED << 8 | (((sec_level) & SEC_LEVEL_MASK) << WRITE_POS)) -/**< Default Indicate Permission. */ -#define INDICATE_PERM_UNSEC (INDICATE << 8) -/**< Indicate permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define INDICATE_PERM(sec_level) (INDICATE << 8 | (((sec_level) & SEC_LEVEL_MASK) << INDICATE_POS)) -/**< Default Notify Permission. */ -#define NOTIFY_PERM_UNSEC (NOTIFY << 8) -/**< Notify permission set. See @ref BLE_GATTS_SEC_LEVEL. */ -#define NOTIFY_PERM(sec_level) (NOTIFY << 8 | (((sec_level) & SEC_LEVEL_MASK) << NOTIFY_POS)) -/**< Broadcast enable. */ -#define BROADCAST_ENABLE (BROADCAST << 8) -/**< Extended Properties enable. */ -#define EXT_PROP_ENABLE (EXT_PROP << 8) +#define BLE_GATTS_READ_PERM_UNSEC (BLE_GATTS_READ << 8) /**< Default Read permission. */ +#define BLE_GATTS_READ_PERM(sec_level) (BLE_GATTS_READ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_READ_POS)) /**< Read permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_WRITE_REQ_PERM_UNSEC (BLE_GATTS_WRITE_REQ << 8) /**< Default Write Permission. */ +#define BLE_GATTS_WRITE_REQ_PERM(sec_level) (BLE_GATTS_WRITE_REQ << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_WRITE_CMD_PERM_UNSEC (BLE_GATTS_WRITE_CMD << 8) /**< Default Write without Response Permission. */ +#define BLE_GATTS_WRITE_CMD_PERM(sec_level) (BLE_GATTS_WRITE_CMD << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Write without Response permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_WRITE_SIGNED_PERM_UNSEC (BLE_GATTS_WRITE_SIGNED << 8) /**< Default Authenticated Signed Write Permission. */ +#define BLE_GATTS_WRITE_SIGNED_PERM(sec_level) (BLE_GATTS_WRITE_SIGNED << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_WRITE_POS)) /**< Authenticated Signed Write permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_INDICATE_PERM_UNSEC (BLE_GATTS_INDICATE << 8) /**< Default Indicate Permission. */ +#define BLE_GATTS_INDICATE_PERM(sec_level) (BLE_GATTS_INDICATE << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_INDICATE_POS)) /**< Indicate permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_NOTIFY_PERM_UNSEC (BLE_GATTS_NOTIFY << 8) /**< Default Notify Permission. */ +#define BLE_GATTS_NOTIFY_PERM(sec_level) (BLE_GATTS_NOTIFY << 8 | (((sec_level) & BLE_GATTS_SEC_LEVEL_MASK) << BLE_GATTS_NOTIFY_POS)) /**< Notify permission set. See @ref BLE_GATTS_SEC_LEVEL. */ +#define BLE_GATTS_BROADCAST_ENABLE (BLE_GATTS_BROADCAST << 8) /**< Broadcast enable. */ +#define BLE_GATTS_EXT_PROP_ENABLE (BLE_GATTS_EXT_PROP << 8) /**< Extended Properties enable. */ /** @} */ /** @@ -236,15 +196,13 @@ /** @defgroup BLE_GATTS_ATTR_EXT_PERM Attribute Extend Permission * @{ */ -#define ATT_VAL_LOC_USER (1 << 15) /**< Value location which means value saved in user space, - the profile's read/write callback will be called. */ -#define ATT_VAL_LOC_STACK (0 << 15) /**< Value location which means value saved in BLE Stack. */ -#define ATT_ENC_KEY_SIZE_16 (0x1000) /**< 16 bytes attribute encryption key size . */ - -/**< Attribute UUID length set. See @ref BLE_GATTS_UUID_TYPE */ -#define ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13) +#define BLE_GATTS_ATT_VAL_LOC_USER (1 << 15) /**< Value location which means value saved in user space, the profile's read/write callback will be called. */ +#define BLE_GATTS_ATT_VAL_LOC_STACK (0 << 15) /**< Value location which means value saved in BLE Stack. */ +#define BLE_GATTS_ATT_UUID_TYPE_SET(uuid_len) ((uuid_len) << 13) /**< Attribute UUID length set. See @ref BLE_GATTS_UUID_TYPE */ +#define BLE_GATTS_ATT_ENC_KEY_SIZE_16 (0x1000) /**< 16 bytes attribute encryption key size . */ /** @} */ + /** @} */ /** @addtogroup BLE_GATTS_ENUMERATIONS Enumerations @@ -253,137 +211,193 @@ /** * @brief Service table type. */ -typedef enum { - SERVICE_TABLE_TYPE_16 = 0x00, /**< 16-bit service table type. */ - SERVICE_TABLE_TYPE_128, /**< 128-bit service table type. */ -} gatts_service_type_t; +typedef enum +{ + BLE_GATTS_SERVICE_TABLE_TYPE_16 = 0x00, /**< 16-bit service table type. */ + BLE_GATTS_SERVICE_TABLE_TYPE_128, /**< 128-bit service table type. */ +} ble_gatts_service_type_t; + /** @} */ + /** @addtogroup BLE_GATTS_STRUCTURES Structures * @{ */ /** * @brief Service(16-bit UUID) description. */ -typedef struct { - uint16_t uuid; /**< 16-bit LSB-first UUID */ - uint16_t perm; /**< Attribute permissions, see @ref BLE_GATTS_ATTR_PERM. \n - - For Primary/Secondary/Included Services, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Declaration, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Extended Properties, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Presentation Format, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Aggregate Format, must be @ref READ_PERM_UNSEC. */ - - uint16_t ext_perm; /**< Attribute extended permissions, see @ref BLE_GATTS_ATTR_EXT_PERM. \n - - For Primary/Secondary/Included Services, this field is not used and should be set to 0.\n - - For Characteristic Declaration, this field is not used and should be set to 0. \n - - For Characteristic Extended Properties, this field is not used and should be set to 0. \n - - For Client Characteristic Configuration and Server Characteristic Configuration, - value must be saved in user space, user needn't to set this value location bit. - The UUID length type must be set to 0. */ - - uint16_t max_size; /**< Attribute max size. \n - - For Primary/Secondary/Included Services, this field is not used, set to 0. \n - - For Characteristic Declaration, this field is not used, set to 0. \n - - For Characteristic Extended Properties, this field contains 2-byte value. \n - - For Client Characteristic Configuration and Server Characteristic Configuration, - this field is not used, set to 0. \n - - For others, this field is attribute max size. */ -} attm_desc_t; - -/** - * @brief Service(128 bits UUID) description. - */ -typedef struct { - uint8_t uuid[16]; /**< 128 bits UUID LSB First. */ +typedef struct +{ + uint16_t uuid; /**< 16-bit LSB-first UUID */ uint16_t perm; /**< Attribute permissions, see @ref BLE_GATTS_ATTR_PERM. \n - - For Primary/Secondary/Included Services, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Declaration, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Extended Properties, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Presentation Format, must be @ref READ_PERM_UNSEC. \n - - For Characteristic Aggregate Format, must be @ref READ_PERM_UNSEC. */ - + - For Primary/Secondary/Included Services, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Declaration, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Extended Properties, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Presentation Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Aggregate Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. */ + uint16_t ext_perm; /**< Attribute extended permissions, see @ref BLE_GATTS_ATTR_EXT_PERM. \n - - For Primary/Secondary/Included Services, this field is not used, set to 0. \n - - For Characteristic Declaration, this field is not used, set to 0. \n - - For Characteristic Extended Properties, this field is not used, set to 0. \n - - For Client Characteristic Configuration and Server Characteristic Configuration, - value must be saved in user space, user needn't to set this value location bit. - The UUID length type must be set to 0. */ - + - For Primary/Secondary/Included Services, this field is not used and should be set to 0. \n + - For Characteristic Declaration, this field is not used and should be set to 0. \n + - For Characteristic Extended Properties, this field is not used and should be set to 0. \n + - For Client Characteristic Configuration and Server Characteristic Configuration, value must be saved in user space, + user needn't to set this value location bit. The UUID length type must be set to 0.*/ + uint16_t max_size; /**< Attribute max size. \n - For Primary/Secondary/Included Services, this field is not used, set to 0. \n - For Characteristic Declaration, this field is not used, set to 0. \n - For Characteristic Extended Properties, this field contains 2-byte value. \n - - For Client Characteristic Configuration and Server Characteristic Configuration, - this field is not used, set to 0. \n + - For Client Characteristic Configuration and Server Characteristic Configuration, this field is not used, set to 0. \n - For others, this field is attribute max size. */ -} attm_desc_128_t; +} ble_gatts_attm_desc_t; + +/** + * @brief Service(128 bits UUID) description. + */ +typedef struct +{ + uint8_t uuid[16]; /**< 128 bits UUID LSB First. */ + uint16_t perm; /**< Attribute permissions, see @ref BLE_GATTS_ATTR_PERM. \n + - For Primary/Secondary/Included Services, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Declaration, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Extended Properties, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Presentation Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. \n + - For Characteristic Aggregate Format, must be @ref BLE_GATTS_READ_PERM_UNSEC. */ + + uint16_t ext_perm; /**< Attribute extended permissions, see @ref BLE_GATTS_ATTR_EXT_PERM. \n + - For Primary/Secondary/Included Services, this field is not used, set to 0. \n + - For Characteristic Declaration, this field is not used, set to 0. \n + - For Characteristic Extended Properties, this field is not used, set to 0. \n + - For Client Characteristic Configuration and Server Characteristic Configuration, value must be saved in user space, + user needn't to set this value location bit. The UUID length type must be set to 0.*/ + + uint16_t max_size; /**< Attribute max size. \n + - For Primary/Secondary/Included Services, this field is not used, set to 0. \n + - For Characteristic Declaration, this field is not used, set to 0. \n + - For Characteristic Extended Properties, this field contains 2-byte value. \n + - For Client Characteristic Configuration and Server Characteristic Configuration, this field is not used, set to 0. \n + - For others, this field is attribute max size. */ +} ble_gatts_attm_desc_128_t; /** * @brief Parameter of Added service description. */ -typedef struct { - uint16_t *shdl; /**< Service start handle pointer. - If *shdl = 0, it returns a handle using the first available handle (*shdl is modified); - otherwise it verifies if the given start handle can be used to allocate handle range. */ - const uint8_t *uuid; /**< Service UUID pointer. The pointer points to the Service UUID LSB. */ - uint8_t *attr_tab_cfg; /**< Attribute table selector pointer. It can be set to NULL to select all items of - attribute table. Each bit matches with an attribute of attribute table. \n - EXAMPLE:if attr_tab_cfg points to array {0x3F, 0x03},it means that - the 0.1.2.3.4.5.8.9 items of attribute table will be added to database. */ +typedef struct +{ - uint8_t max_nb_attr; /**< Number of attributes in attribute table. */ - union attribute_table { /**< Attribute table. */ - const attm_desc_t *attr_tab_16; /**< 16 bits service description. The pointer point to attribute - table of 16 bits service. See @ref attm_desc_t. */ - const attm_desc_128_t *attr_tab_128; /**< 128 bits service description. The pointer point to attribute - table of 128 bits service. See @ref attm_desc_128_t. */ - } attr_tab; /**< Attribute table. */ - uint16_t *inc_srvc_handle[MAX_INC_SRVC_NUM]; /**< Pointer array of Included Service start handle's address. */ - uint16_t inc_srvc_num; /**< Included Service number for this service. */ - uint8_t srvc_perm; /**< Service permission. See @ref BLE_GATTS_SRVC_PERM. */ - gatts_service_type_t attr_tab_type; /**< Service table type. See @ref gatts_service_type_t. */ -} gatts_create_db_t; + uint16_t *shdl; /**< Service start handle pointer. If *shdl = 0, it returns a handle using the first available handle (*shdl is modified); otherwise it verifies if the given start handle can be used to allocate handle range. */ + const uint8_t *uuid; /**< Service UUID pointer. The pointer points to the Service UUID LSB. */ + uint8_t *attr_tab_cfg; /**< Attribute table selector pointer. It can be set to NULL to select all items of attribute table. Each bit matches with an attribute of attribute table. \n EXAMPLE:if attr_tab_cfg points to array {0x3F, 0x03}, it means that the 0.1.2.3.4.5.8.9 items of attribute table will be added to database. */ + uint8_t max_nb_attr; /**< Number of attributes in attribute table. */ + union attribute_table /**< Attribute table. */ + { + const ble_gatts_attm_desc_t *attr_tab_16; /**< 16 bits service description. The pointer point to attribute table of 16 bits service. See @ref ble_gatts_attm_desc_t. */ + const ble_gatts_attm_desc_128_t *attr_tab_128; /**< 128 bits service description. The pointer point to attribute table of 128 bits service. See @ref ble_gatts_attm_desc_128_t. */ + } attr_tab; /**< Attribute table. */ + uint16_t *inc_srvc_handle[BLE_GATTS_MAX_INC_SRVC_NUM]; /**< Pointer array of Included Service start handle's address. */ + uint16_t inc_srvc_num; /**< Included Service number for this service. */ + uint8_t srvc_perm; /**< Service permission. See @ref BLE_GATTS_SRVC_PERM. */ + ble_gatts_service_type_t attr_tab_type; /**< Service table type. See @ref ble_gatts_service_type_t. */ +} ble_gatts_create_db_t; /** * @brief GATT read attribute result description. */ -typedef struct { +typedef struct +{ uint16_t handle; /**< Handle of the read attribute. */ uint16_t length; /**< Length of read data. */ uint8_t status; /**< Status of read operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/ uint8_t *value; /**< Attribute value pointer. */ -} gatts_read_cfm_t; +} ble_gatts_read_cfm_t; /** * @brief GATT write attribute result description. */ -typedef struct { +typedef struct +{ uint16_t handle; /**< Handle of the attribute written. */ uint8_t status; /**< Status of write operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/ -} gatts_write_cfm_t; +} ble_gatts_write_cfm_t; /** * @brief GATT prepare write result description. */ -typedef struct { +typedef struct +{ uint16_t handle; /**< Handle of the attribute in prepare write operation. */ uint16_t length; /**< Current length of the attribute. */ uint8_t status; /**< Status of prepare write operation by upper layers. See @ref BLE_STACK_ERROR_CODES.*/ -} gatts_prep_write_cfm_t; +} ble_gatts_prep_write_cfm_t; /** * @brief GATT sending Notification or Indication event param description. */ -typedef struct { - gatt_evt_type_t type; /**< Request type (Notification/Indication). see @ref gatt_evt_type_t. */ +typedef struct +{ + ble_gatt_evt_type_t type; /**< Request type (Notification/Indication). see @ref ble_gatt_evt_type_t. */ uint16_t handle; /**< Characteristic Value handle to be notified or indicated. */ uint16_t length; /**< Length of Characteristic Value to be sent. */ uint8_t *value; /**< Characteristic Value pointer. */ -} gatts_noti_ind_t; +} ble_gatts_noti_ind_t; + +/** + * @brief GATT read request event for @ref BLE_GATTS_EVT_READ_REQUEST. + */ +typedef struct +{ + uint16_t handle; /**< Handle of the attribute to be read. */ +} ble_gatts_evt_read_t; + +/** + * @brief GATT write request event for @ref BLE_GATTS_EVT_WRITE_REQUEST. + */ +typedef struct +{ + uint16_t handle; /**< Handle of the attribute to be written. */ + uint16_t offset; /**< Offset at which the data has to be written. */ + uint16_t length; /**< Data length to be written. */ + uint8_t *value; /**< Data to be written to characteristic value. */ +} ble_gatts_evt_write_t; + +/** + * @brief GATT prepare write request event for @ref BLE_GATTS_EVT_PREP_WRITE_REQUEST. + */ +typedef struct +{ + uint16_t handle; /**< Handle of the attribute for whose value is requested. */ +} ble_gatts_evt_prep_write_t; + +/**@brief Gatt Notification or indication event for @ref BLE_GATTS_EVT_NTF_IND. */ +typedef struct +{ + ble_gatt_evt_type_t type; /**< Notification or indication event type. */ + uint16_t handle; /**< Handle of the write operation, or notification/indication operation. */ +} ble_gatts_evt_ntf_ind_t; + +/**@brief Gatt cccd recovery event for @ref BLE_GATTS_EVT_CCCD_RECOVERY. */ +typedef struct +{ + ble_gap_bdaddr_t peer_addr; /**< Pointer to peer address. */ + uint16_t handle; /**< Handle of attribute. */ + uint16_t cccd_val; /**< CCCD value. */ +} ble_gatts_evt_cccd_rec_t; + +/**@brief BLE GATTS event structure. */ +typedef struct +{ + uint8_t index; /**< Index of connection. */ + union + { + ble_gatts_evt_read_t read_req; /**< Read request event. */ + ble_gatts_evt_write_t write_req; /**< Write request event. */ + ble_gatts_evt_prep_write_t prep_wr_req; /**< Prepare write request event. */ + ble_gatts_evt_ntf_ind_t ntf_ind_sended; /**< Notification or indication sened event. */ + ble_gatts_evt_cccd_rec_t cccd_recovery; /**< Gatt cccd recovery event . */ + } params; /**< Event Parameters. */ +} ble_gatts_evt_t; /** @} */ @@ -394,18 +408,17 @@ typedef struct { **************************************************************************************** * @brief Register a service's attribute list. * - * @param[in, out] p_param: Pointer to the parameter used in creating databases. see @ref gatts_create_db_t. + * @param[in] p_param: Pointer to the parameter used in creating databases. see @ref ble_gatts_create_db_t. * * @retval ::SDK_SUCCESS: Database has been registered successfully. * @retval ::SDK_ERR_POINTER_NULL: Param is NULL or param's members are NULL. * @retval ::SDK_ERR_INVALID_PARAM: The member of param is invalid. * @retval ::SDK_ERR_INVALID_HANDLE: The service handles can not be allocated. * @retval ::SDK_ERR_NO_RESOURCES: There is not enough memory to allocate service buffer. - * @retval ::SDK_ERR_INVALID_PERM: Permissions of Client Characteristic Configuration or - * Server Characteristic Configuration are not set correctly. - **************************************************************************************** + * @retval ::SDK_ERR_INVALID_PERM: Permissions of Client Characteristic Configuration or Server Characteristic Configuration are not set correctly. + **************************************************************************************** */ -uint16_t ble_gatts_srvc_db_create(gatts_create_db_t *p_param); +uint16_t ble_gatts_srvc_db_create(ble_gatts_create_db_t *p_param); /** **************************************************************************************** @@ -414,16 +427,15 @@ uint16_t ble_gatts_srvc_db_create(gatts_create_db_t *p_param); * @param[in] handle: Attribute handle. * @param[in] length: Size of the value to set. * @param[in] offset: Data offset of the value in attribute value. - * @param[in] p_value: The value to set. If offset = 0, the value is the new attribute value; otherwise, - * the value is part of the new attribute value. + * @param[in] p_value: The value to set. If offset = 0, the value is the new attribute value; otherwise, the value is part of the new attribute value. * * @retval ::SDK_SUCCESS: Successfully update the attribute value. * @retval ::SDK_ERR_POINTER_NULL: Value is NULL. * @retval ::SDK_ERR_INVALID_HANDLE: Handle not exist in database. - * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database or cannot be modified. - * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: New value length exceeds maximum attribute value length. + * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database or cannot be modified. + * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: New value length exceeds maximum attribute value length. * @retval ::SDK_ERR_INVALID_OFFSET: Offset exceeds current attribute value length. - **************************************************************************************** + **************************************************************************************** */ uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, const uint8_t* p_value); @@ -441,17 +453,15 @@ uint16_t ble_gatts_value_set(uint16_t handle, uint16_t length, uint16_t offset, * @retval ::SDK_ERR_REQ_NOT_SUPPORTED: Attribute data is not present in database. * @retval ::SDK_ERR_INVALID_ATT_VAL_LEN: Attribute data value size is bigger than buffer size. * @retval ::SDK_ERR_APP_ERROR: Database is not correctly initialized by application. - **************************************************************************************** + **************************************************************************************** */ uint16_t ble_gatts_value_get(uint16_t handle, uint16_t* p_length, uint8_t* p_value); /** **************************************************************************************** * @brief Update attribute permission. - * @note The modifications of attribute permission to - * service/character/include/character_extended_properties_descriptor declaration: not supported. \n - * The modifications of attribute permission to others: perm can be updated and EKS of ext_perm can be updated. - * See @ref BLE_GATTS_ATTR_PERM. + * @note The modifications of attribute permission to service/character/include/character_extended_properties_descriptor declaration: not supported. \n + * The modifications of attribute permission to others: perm can be updated and EKS of ext_perm can be updated.See @ref BLE_GATTS_ATTR_PERM. * * @param[in] handle: Attribute handle. * @param[in] perm: New attribute permission. @@ -481,15 +491,13 @@ uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16 /** **************************************************************************************** - * @brief Respond to an attribute read request. It is used in profile read callback function - * @ref gatts_prf_cbs_t::app_gatts_read_cb - * to send attribute value to stack which is saved in user space. + * @brief Respond to an attribute read request.. * * @note The status member gatts_read_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR * to control the authorization of particular read operations of a client. * * @param[in] conn_idx: Current connection index. - * @param[in] p_param: Pointer to the parameters filled by profile. See @ref gatts_read_cfm_t. + * @param[in] p_param: Pointer to the parameters filled by profile. See @ref ble_gatts_read_cfm_t. * * @retval ::SDK_SUCCESS: Send read confirm value to stack successfully. * @retval ::SDK_ERR_POINTER_NULL: Param is NULL. @@ -497,18 +505,17 @@ uint16_t ble_gatts_attr_permission_get(uint16_t handle, uint16_t *p_perm, uint16 * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const gatts_read_cfm_t *p_param); +uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const ble_gatts_read_cfm_t *p_param); /** **************************************************************************************** - * @brief Respond to an attribute write request. It is used in profile write callback function - * @ref gatts_prf_cbs_t::app_gatts_write_cb to send write operation status to stack. + * @brief Respond to an attribute write request. * * @note The status member gatts_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR * to control the authorization of particular client's write operation. * * @param[in] conn_idx: Current connection index. - * @param[in] p_param: Pointer to the parameters filled by profile. see @ref gatts_write_cfm_t. + * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_write_cfm_t. * * @retval ::SDK_SUCCESS: Send write confirm status to stack successfully. * @retval ::SDK_ERR_POINTER_NULL: Param is NULL. @@ -516,18 +523,17 @@ uint16_t ble_gatts_read_cfm(uint8_t conn_idx, const gatts_read_cfm_t *p_param); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const gatts_write_cfm_t *p_param); +uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const ble_gatts_write_cfm_t *p_param); /** **************************************************************************************** - * @brief Respond to an attribute prepare write request. It is used in profile prepare write callback - * function @ref gatts_prf_cbs_t::app_gatts_prep_write_cb to send prepare write operation status to stack. + * @brief Respond to an attribute prepare write request. * * @note The status member gatts_prep_write_cfm_t::status should be set to @ref BLE_ATT_ERR_INSUFF_AUTHOR * to control the authorization of particular client's write operation. * * @param[in] conn_idx: Current connection index. - * @param[in] p_param: Pointer to the parameters filled by profile. see @ref gatts_prep_write_cfm_t. + * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_prep_write_cfm_t. * * @retval ::SDK_SUCCESS: Send prepare write confirm status to stack successfully. * @retval ::SDK_ERR_POINTER_NULL: Param is NULL. @@ -535,18 +541,17 @@ uint16_t ble_gatts_write_cfm(uint8_t conn_idx, const gatts_write_cfm_t *p_param) * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const gatts_prep_write_cfm_t *p_param); +uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const ble_gatts_prep_write_cfm_t *p_param); /** **************************************************************************************** - * @brief Send out a notification or an indication. The execution status of sending notification or - * indication will be retrieved in the complete callback function @ref gatts_prf_cbs_t::app_gatts_ntf_ind_cb. + * @brief Send out a notification or an indication. * * @note Check whether the relevant Client Characteristic Configuration Descriptor is enabled before using this API. * * @param[in] conn_idx: Current connection index. - * @param[in] p_param: Pointer to the parameters filled by profile. see @ref gatts_noti_ind_t. - * + * @param[in] p_param: Pointer to the parameters filled by profile. see @ref ble_gatts_noti_ind_t. + * * @retval ::SDK_SUCCESS: Send Notification or Indication event to stack successfully. * @retval ::SDK_ERR_POINTER_NULL: Param is NULL. * @retval ::SDK_ERR_INVALID_CONN_IDX: Conidx is invalid. @@ -555,7 +560,7 @@ uint16_t ble_gatts_prepare_write_cfm(uint8_t conn_idx, const gatts_prep_write_cf * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const gatts_noti_ind_t *p_param); +uint16_t ble_gatts_noti_ind(uint8_t conn_idx, const ble_gatts_noti_ind_t *p_param); /** **************************************************************************************** diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_l2cap.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_l2cap.h old mode 100755 new mode 100644 index 9b4bf01..30c7443 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_l2cap.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_l2cap.h @@ -35,167 +35,173 @@ ***************************************************************************************** */ -/** -* @addtogroup BLE -* @{ -*/ - -/** - @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) - @{ - @brief Definitions and prototypes for the L2CAP interface. -*/ - + /** + * @addtogroup BLE + * @{ + */ + + /** + @addtogroup BLE_L2CAP Logical Link Control and Adaptation Protocol (L2CAP) + @{ + @brief Definitions and prototypes for the L2CAP interface. + */ + #ifndef __BLE_L2CAP_H__ #define __BLE_L2CAP_H__ -#include -#include +#include "ble_error.h" #include "gr55xx_sys_cfg.h" +#include +#include -/** @addtogroup BLE_L2CAP_ENUMERATIONS Enumerations +/**@addtogroup BLE_L2CAP_ENUMERATIONS Enumerations * @{ */ -/** @brief LE credit based disconnection reasons. */ -typedef enum { - REMOTE_USER_TERM_CON = 0x00, /**< Remote user terminates the connection. */ - LOCAL_USER_TERM_CON = 0x01, /**< Local user terminates the connection. */ -} lecb_disconnect_reason_t; +/**@brief LE credit based disconnection reasons. */ +typedef enum +{ + BLE_L2CAP_REMOTE_USER_TERM_CON = 0x00, /**< Remote user terminates the connection. */ + BLE_L2CAP_LOCAL_USER_TERM_CON = 0x01, /**< Local user terminates the connection. */ +} ble_l2cap_lecb_disconn_reason_t; /** @} */ /** @addtogroup BLE_L2CAP_STRUCTURES Structures * @{ */ -/** @brief The parameter of LE credit based connection request packet sending. - * @note The le_psm should be registered by the peer device, otherwise the peer device will reject - * this request with result of LE_PSM not supported. - * @note The local_cid should be 0x0040-0x007F. If the local_cid is set to 0, the stack will assign it dynamically. - * @note The local_credit is required to be sure that at least one SDU can be received, - * otherwise the stack will use the default value: (MTU + MPS + 1) /MPS + 1. +/** @brief The parameter of LE credit based connection request packet sending. + * @note The le_psm should be registered by the peer device, otherwise the peer device will reject this request with result of LE_PSM not supported. + * @note The local_cid should be 0x0040-0x007F. If the local_cid is set to 0, the stack will assign it dynamically. + * @note The local_credit is required to be sure that at least one SDU can be received, otherwise the stack will use the default value: (MTU + MPS + 1) /MPS + 1. * @note The MTU range is [23~max_mtu]. * @note The MPS range is [23~max_mps]. - * @note About max_mtu and max_mps config, please see @ref ble_gap_l2cap_params_set. + * @note About max_mtu and max_mps config, please see @ref ble_gap_l2cap_params_set. */ -typedef struct { +typedef struct +{ uint16_t le_psm; /**< The le_psm number. */ uint16_t local_cid; /**< The local CID. */ - uint16_t local_credits; /**< The local credits indicate the number of LE-frames that the peer devicecan send - to the L2CAP layer entity sending the LE Credit Based Connection Request. */ - uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer - entity sending the LE Credit Based Connection Request - can receive on this channel. */ - uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that - the L2CAP layer entity sending the LE Credit Based Connection Request - is capable of receiving on this channel. */ -} lecb_conn_req_t; + uint16_t local_credits; /**< The local credits indicate the number of LE-frames that the peer device can send to the L2CAP layer entity sending the LE Credit Based Connection Request. */ + uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request can receive on this channel. */ + uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit Based Connection Request is capable of receiving on this channel. */ +} ble_l2cap_lecb_conn_req_t; -/** @brief LE credit based connection confirm parameter. +/** @brief LE credit based connection confirm parameter. * @note The accept flag indicates whether the App accepts the LE Credit Based connection request. * @note The peer_cid represents the channel endpoint on the peer device. * @note The local_cid should be 0x0040-0x007F. If the local_cid is set to 0, the stack will assign it dynamically. - * @note The local_credits required to be sure that at least one SDU can be received, otherwise the stack - * will use the default value: (MTU + MPS + 1) /MPS + 1. + * @note The local_credits required to be sure that at least one SDU can be received, otherwise the stack will use the default value: (MTU + MPS + 1) /MPS + 1. * @note The MTU range is [23~max_mtu]. * @note The MPS range is [23~max_mps]. * @note About the max_mtu and max_mps config, please see @ref ble_gap_l2cap_params_set. */ -typedef struct { - bool accept; /**< Whether to accept the connection request. */ - uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request - and receiving the response. */ - uint16_t local_cid; /**< Local CID. */ - uint16_t local_credits; /**< It indicates the number of LE-frames that the peer device can send to the - L2CAP layer entity sending the LE Credit Based Connection Respone. */ - uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity - sending the LE Credit Based Connection Request can receive on this channel. */ - uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that the L2CAP layer - entity sending the LE Credit Based Connection Request is capable of receiving - on this channel. */ -} lecb_cfm_conn_t; +typedef struct +{ + bool accept; /**< Whether to accept the connection request. */ + uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request and receiving the response. */ + uint16_t local_cid; /**< Local CID. */ + uint16_t local_credits; /**< It indicates the number of LE-frames that the peer device can send to the L2CAP layer entity sending the LE Credit Based Connection Respone. */ + uint16_t mtu; /**< The MTU field specifies the maximum SDU size (in octets) that the L2CAP layer entity sending + the LE Credit Based Connection Request can receive on this channel. */ + uint16_t mps; /**< The MPS field specifies the maximum payload size (in octets) that the L2CAP layer entity sending + the LE Credit Based Connection Request is capable of receiving on this channel. */ +} ble_l2cap_lecb_cfm_conn_t; /** @brief LE flow control credit packet parameter. */ -typedef struct { +typedef struct +{ uint16_t local_cid; /**< The local source channel ID. */ uint16_t credits; /**< Number of credits that the receiving device can increment. */ -} lecb_add_credits_t; +} ble_l2cap_lecb_add_credits_t; -/** @brief SDU packet parameter. +/** @brief SDU packet parameter. * @note The length should be less than peer_mtu when sending sdu packet. - * @note The credits is 0 if this packet is being sent, or it represents the number of credits consumed - * by this sdu if this packet is received. - * @note When the application receives a sdu, it should firstly copy this sdu packet before handling it, - * because the stack will free it after invoking the callback function. - * @note Similarly, the application should free the packet if it is malloced - * after invoking the function to send sdu packet. + * @note The credits is 0 if this packet is being sent, or it represents the number of credits consumed by this sdu if this packet is received. + * @note When the application receives a sdu, it should firstly copy this sdu packet before handling it, because the stack will free it after invoking the callback function. + * @note Similarly, the application should free the packet if it is malloced after invoking the function to send sdu packet. */ -typedef struct { - uint16_t cid; /**< The local source channel. */ - uint16_t credits; /**< The credits is 0 if this packet is being sent, - otherwise it represents the number of credits consumed by the sdu. */ - uint16_t length; /**< The lenght of data. */ - uint8_t data[ARRAY_EMPTY]; /**< The data of this sdu packet. */ -} lecb_sdu_t; +typedef struct +{ + uint16_t cid; /**< The local source channel. */ + uint16_t credits; /**< The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed by the sdu. */ + uint16_t length; /**< The lenght of data. */ + uint8_t *data; /**< The data of this sdu packet. */ +} ble_l2cap_lecb_sdu_t; -/** @brief Receive LE credit based connection request packet indication. */ -typedef struct { +/** @brief L2cap Connect Request event for @ref BLE_L2CAP_EVT_CONN_REQ. */ +typedef struct +{ uint16_t le_psm; /**< Le_psm number that should be registered by local device. */ - uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request - and receiving the response. */ - uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending - the LE Credit Based Connection Request can receive on this channel. */ - uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending - the LE Credit Based Connection Request is capable of receiving on this channe. */ -} lecb_conn_req_ind_t; + uint16_t peer_cid; /**< It represents the channel endpoint on the device sending the request and receiving the response. */ + uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit + Based Connection Request can receive on this channel. */ + uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit + Based Connection Request is capable of receiving on this channe. */ +} ble_l2cap_evt_conn_req_t; -/** @brief LE credit based connection created indication. */ -typedef struct { +/** @brief L2cap Connected Indicate event for @ref BLE_L2CAP_EVT_CONN_IND. */ +typedef struct +{ uint16_t le_psm; /**< Le_psm number. */ uint16_t local_cid; /**< The local source channel ID. */ uint16_t local_credits; /**< It indicates the number of LE-frames that the local device can receive. */ uint16_t peer_credits; /**< It indicates the number of LE-frames that the peer device can receive. */ - uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending - the LE Credit Based Connection Request can receive on this channel. */ - uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending - the LE Credit Based Connection Request is capable of receiving on this channe. */ -} lecb_conn_ind_t; + uint16_t peer_mtu; /**< It indicates the maximum SDU size (in octets) that the L2CAP layer entity sending the LE Credit + Based Connection Request can receive on this channel. */ + uint16_t peer_mps; /**< It indicates the maximum payload size (in octets) that the L2CAP layer entity sending the LE Credit + Based Connection Request is capable of receiving on this channe. */ +} ble_l2cap_evt_conn_ind_t; -/** @brief LE credit based disconnect indication. */ -typedef struct { - uint16_t local_cid; /**< The local source channel ID. */ - uint8_t reason; /**< The reason for disconnection, see @ref lecb_disconnect_reason_t . */ -} lecb_disconn_ind_t; - -/** @brief LE credit based connection addition indication. */ -typedef struct { +/** @brief L2cap Credits Add Indicate event for @ref BLE_L2CAP_EVT_ADD_CREDITS_IND. */ +typedef struct +{ uint16_t local_cid; /**< The local source channel ID. */ uint16_t peer_added_credits; /**< Represent number of credits the receiving device can increment. */ -} lecb_add_credits_ind_t; +} ble_l2cap_evt_add_credits_ind_t; -/** @brief LE credit based SDU sending complete event. */ -typedef struct { +/** @brief L2cap disconnect event for @ref BLE_L2CAP_EVT_DISCONNECTED. */ +typedef struct +{ + uint16_t local_cid; /**< The local source channel ID. */ + ble_l2cap_lecb_disconn_reason_t reason; /**< The reason for disconnection, see @ref ble_l2cap_lecb_disconn_reason_t . */ +} ble_l2cap_evt_disconnect_t; + +/**@brief L2cap SDU Receive event for @ref BLE_L2CAP_EVT_SDU_RECV. */ +typedef struct +{ + uint16_t cid; /**< The local source channel. */ + uint16_t credits; /**< The credits is 0 if this packet is being sent, otherwise it represents the number of credits consumed by the sdu. */ + uint16_t length; /**< The lenght of data. */ + uint8_t *data; /**< The data of this sdu packet. */ +} ble_l2cap_evt_sdu_recv_t; + +/**@brief L2cap SDU Send event for @ref BLE_L2CAP_EVT_SDU_SEND. */ +typedef struct +{ uint16_t cid; /**< Channel ID that is the local CID. */ uint16_t credits; /**< Number of peer credit used. */ -} lecb_sdu_send_evt_t; - -/** @brief Callback registered by APP. */ -typedef struct { - /**< Callback for receiving LE credit based connection request. */ - void (*app_l2cap_lecb_conn_req_cb)(uint8_t conn_idx, lecb_conn_req_ind_t *p_conn_req); - /**< Callback for receiving LE credit based connection created indication. */ - void (*app_l2cap_lecb_conn_cb)(uint8_t conn_idx, uint8_t status, lecb_conn_ind_t *p_conn_ind); - /**< Callback for receiving LE credit based connection addition indication. */ - void (*app_l2cap_lecb_add_credits_ind_cb)(uint8_t conn_idx, lecb_add_credits_ind_t *p_add_credits_ind); - /**< Callback for receiving LE credit based disconnection indication. */ - void (*app_l2cap_lecb_disconn_cb)(uint8_t conn_idx, uint8_t status, lecb_disconn_ind_t *p_disconn_ind); - /**< Callback for receiving SDU packet. */ - void (*app_l2cap_lecb_sdu_recv_cb)(uint8_t conn_idx, lecb_sdu_t *p_sdu); - /**< Callback for sending SDU operation complete event. */ - void (*app_l2cap_lecb_sdu_send_cb)(uint8_t conn_idx, uint8_t status, lecb_sdu_send_evt_t *p_sdu_send_evt); - /**< Callback for LE credit add complete event. */ - void (*app_l2cap_lecb_credit_add_cmp_cb)(uint8_t conn_idx, uint8_t status, uint16_t local_cid); -} l2cap_lecb_cb_fun_t; +}ble_l2cap_evt_sdu_send_t; +/**@brief L2cap Credits Add Completed event for @ref BLE_GATTC_EVT_NTF_IND. */ +typedef struct +{ + uint16_t local_cid; /**< Channel ID that is the local CID. */ +}ble_l2cap_evt_add_credits_cplt_t; +/**@brief BLE L2cap event structure. */ +typedef struct +{ + uint8_t index; /**< Index of connection or advertising. */ + union + { + ble_l2cap_evt_conn_req_t conn_req; /**< L2cap Connect Request event. */ + ble_l2cap_evt_conn_ind_t conn_ind; /**< L2cap Connected Indicate event. */ + ble_l2cap_evt_add_credits_ind_t add_credits_ind; /**< L2cap Credits Add Indicate event. */ + ble_l2cap_evt_disconnect_t disconnected; /**< L2cap Disconnected event. */ + ble_l2cap_evt_sdu_recv_t sdu_recv; /**< L2cap SDU Receive event. */ + ble_l2cap_evt_sdu_send_t sdu_send; /**< L2cap SDU Send event. */ + ble_l2cap_evt_add_credits_cplt_t add_credits_cplt; /**< L2cap Credits Add Completed event. */ + } params; /**< Event Parameters. */ +} ble_l2cap_evt_t; /** @} */ /** @addtogroup BLE_L2CAP_FUNCTIONS Functions @@ -203,10 +209,8 @@ typedef struct { /** **************************************************************************************** * @brief Create the LE credit based connection. - * @note After the COC created, the callback @ref l2cap_lecb_cb_fun_t::app_l2cap_lecb_conn_cb will be called. * - * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0, - * and the index will be increased one by one. + * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0, and the index will be increased one by one. * @param[in] p_conn_req: Pointer to the LE Credit Based Connection Request structure. * * @retval ::SDK_SUCCESS: The LE Credit Based connection request is successfully set to the BLE stack. @@ -215,15 +219,13 @@ typedef struct { * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_l2cap_lecb_conn_create(uint8_t conn_idx, const lecb_conn_req_t *p_conn_req); +uint16_t ble_l2cap_lecb_conn_create(uint8_t conn_idx, const ble_l2cap_lecb_conn_req_t *p_conn_req); /** **************************************************************************************** * @brief Confirm the LE credit based connection after receiving the connection request packet from the peer device. - * @note This function should be invoked in the handle of callback @ref l2cap_lecb_cb_fun_t:app_l2cap_lecb_conn_req_cb. - * And after the COC created, the callback @ref l2cap_lecb_cb_fun_t::app_l2cap_lecb_conn_cb should be called. - * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and - * the index will be increased one by one. + * + * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one. * @param[in] p_cfm_conn: Pointer to the LE Credit Based Connection Confirm structure. * * @retval ::SDK_SUCCESS: The LE Credit Based connection confirmation is successfully set to the BLE stack. @@ -233,15 +235,13 @@ uint16_t ble_l2cap_lecb_conn_create(uint8_t conn_idx, const lecb_conn_req_t *p_c * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_l2cap_lecb_conn_cfm(uint8_t conn_idx, const lecb_cfm_conn_t *p_cfm_conn); +uint16_t ble_l2cap_lecb_conn_cfm(uint8_t conn_idx, const ble_l2cap_lecb_cfm_conn_t *p_cfm_conn); /** **************************************************************************************** * @brief Disconnect the LE credit based connection. - * @note After COC disconnected, the callback @ref l2cap_lecb_cb_fun_t::app_l2cap_lecb_disconn_cb should be called. * - * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and - * the index will be increased one by one. + * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one. * @param[in] local_cid: The local source channel ID. * * @retval ::SDK_SUCCESS: LE Credit Based disconnection request is successfully set to the BLE stack. @@ -253,8 +253,7 @@ uint16_t ble_l2cap_lecb_disconnect(uint8_t conn_idx, uint16_t local_cid); /** **************************************************************************************** - * @brief Send a LE Flow Control Credit packet when the device is capable of receiving additional LE-frames - * (for example after the device has processed the sdu). + * @brief Send a LE Flow Control Credit packet when the device is capable of receiving additional LE-frames (for example after the device has processed the sdu). * * @param[in] conn_idx: ACL connection index, the first ACL connection index is 0, and increased one by one. * @param[in] p_add_credits: Pointer to the LE Flow Control Credit structure. @@ -265,14 +264,13 @@ uint16_t ble_l2cap_lecb_disconnect(uint8_t conn_idx, uint16_t local_cid); * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_l2cap_lecb_credits_add(uint8_t conn_idx, const lecb_add_credits_t *p_add_credits); +uint16_t ble_l2cap_lecb_credits_add(uint8_t conn_idx, const ble_l2cap_lecb_add_credits_t *p_add_credits); /** **************************************************************************************** * @brief Send an SDU packet to the peer device. * - * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and - * the index will be increased one by one. + * @param[in] conn_idx: ACL connection index. The first ACL connection index is 0 and the index will be increased one by one. * @param[in] p_sdu: Pointer to the sdu packet structure. * * @retval ::SDK_SUCCESS: The sdu packet is successfully set to the BLE stack. @@ -281,22 +279,20 @@ uint16_t ble_l2cap_lecb_credits_add(uint8_t conn_idx, const lecb_add_credits_t * * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. **************************************************************************************** */ -uint16_t ble_l2cap_lecb_sdu_send(uint8_t conn_idx, const lecb_sdu_t *p_sdu); +uint16_t ble_l2cap_lecb_sdu_send(uint8_t conn_idx, const ble_l2cap_lecb_sdu_t *p_sdu); /** **************************************************************************************** - * @brief Register the callback for the PSM. + * @brief Register PSM. * * @param[in] le_psm: The le_psm number. - * @param[in] p_cb: Pointer to the callback structure. * * @retval ::SDK_SUCCESS: The callback is successfully registered to the BLE stack. * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. * @retval ::SDK_ERR_INVALID_PSM_EXCEEDED_MAX_PSM_NUM: The maximum PSM number limit is exceeded. **************************************************************************************** */ -uint16_t ble_l2cap_lecb_cb_register(uint16_t le_psm, const l2cap_lecb_cb_fun_t *p_cb); - +uint16_t ble_l2cap_lecb_psm_register(uint16_t le_psm); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_lcp.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_lcp.h new file mode 100644 index 0000000..74994ad --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_lcp.h @@ -0,0 +1,230 @@ +/** + **************************************************************************************** + * + * @file ble_lcp.h + * + * @brief LCP SDK API + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + + /** + * @addtogroup BLE + * @{ + * @brief Definitions and prototypes for the BLE SDK interface. + */ + + /** + * @addtogroup BLE_LCP Light Communication Protocol (LCP) + * @{ + * @brief Definitions and prototypes for the LCP interface. + */ + +#ifndef _BLE_LCP_H_ +#define _BLE_LCP_H_ + + +/**@addtogroup BLE_LCP_TYPEDEFS Typedefs + * @{ */ +/**@brief RX handler callback function. */ +typedef uint16_t (*rx_handler_cb_t) (uint8_t header, uint8_t length, uint8_t *p_payload); +/** @} */ + +/**@addtogroup BLE_LCP_ENUMERATIONS Enumerations + * @{ */ +/**@brief Protocol Mode. */ +enum PROTOCOL_MODE +{ + BLE_ADV, /**< BLE ADV mode. */ + BLE_SCAN, /**< BLE SCAN mode. */ + LCP_TX, /**< LCP TX mode. */ + LCP_RX, /**< LCP RX mode. */ +}; +/** @} */ + +/**@addtogroup BLE_LCP_STRUCTURES Structures + * @{ */ +/**@brief LCP Parameter. */ +typedef struct +{ + uint8_t mode; /**< Set protocol mode, see @ref PROTOCOL_MODE. */ + int8_t txpwr_dbm; /**< The value of the tx power(range: -20-7), uint: dBm. */ + uint8_t ch_idx; /**< The value of the channel index(range: 0-39). */ + uint32_t freq; /**< The value of the frequency(range: 2360-2520), uint: MHz. */ + uint32_t access_address; /**< The value of the access address. */ + uint32_t crc_init; /**< The initial value of the crc. */ + rx_handler_cb_t rx_handler_cb; /**< The callback function of rx. */ +} gdx_lcp_config_t; +/** @} */ + +/** @addtogroup BLE_LCP_FUNCTIONS Functions + * @{ */ +/** + **************************************************************************************** + * @brief Initialize LCP. + * + * @param[in] gdx_lcp_config: Configure the parameter of LCP, @ref gdx_lcp_config_t. + * + * @retval ::SDK_SUCCESS: The LCP parameter is successfully configured. + * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. + * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_init(gdx_lcp_config_t *gdx_lcp_config); + +/** + **************************************************************************************** + * @brief Deinitialize LCP. + * + * @retval ::SDK_SUCCESS: The LCP is successfully Deinitialized. + **************************************************************************************** + */ +uint16_t gdx_lcp_deinit(void); + +/** + **************************************************************************************** + * @brief Set the tx power of LCP. + * + * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. + * + * @retval ::SDK_SUCCESS: Operation is Success. + * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_tx_power_set(int8_t txpwr_dbm); + +/** + **************************************************************************************** + * @brief Get the tx power of LCP. + * + * @param[in] txpwr_dbm: The value of the tx power, Range: -20dbm to 7dbm. + * + * @retval ::SDK_SUCCESS: Operation is Success. + * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_tx_power_get(int8_t *txpwr_dbm); + +/** + **************************************************************************************** + * @brief Set the channel of LCP. + * + * @param[in] freq: The value of the frequency, Range: 2360MHz to 2520MHz. + * @param[in] ch_idx: The value of the channel index, Range: 0 to 39. + * + * @retval ::SDK_SUCCESS: Operation is Success. + * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_channel_set(uint32_t freq, uint8_t ch_idx); + +/** + **************************************************************************************** + * @brief Get the channel of LCP. + * + * @param[in] freq: The value of the frequency, Range: 2360MHz to 2520MHz. + * @param[in] ch_idx: The value of the channel index, Range: 0 to 39. + * + * @retval ::SDK_SUCCESS: Operation is Success. + * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_channel_get(uint32_t *freq, uint8_t *ch_idx); + +/** + **************************************************************************************** + * @brief Set the rate of LCP. + * + * @param[in] rate: The phy rate of LCP communication. Should be called before gdx_lcp_init + * + * @retval :void. + **************************************************************************************** + */ +void gdx_lcp_rate_set(bool rate); + +/** + **************************************************************************************** + * @brief Get the rate of LCP. + * + * + * @retval ::0: 1Mbps. + * @retval ::1: 2Mbps. + **************************************************************************************** + */ +bool gdx_lcp_rate_get(void); + +/** + **************************************************************************************** + * @brief Get the rssi of LCP. + * + * + * @retval ::Rssi of current channel. Should be called after gdx_lcp_rx_start + **************************************************************************************** + */ +int8_t gdx_lcp_rssi_get(void); + +/** + **************************************************************************************** + * @brief Transmmit a packet. + * + * @param[in] header: The header of the packet. + * @param[in] length: The length of the packet payload. + * @param[in] p_payload: The pointer of the packet payload. + * + * @retval ::SDK_SUCCESS: Operation is Success. + * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter supplied. + **************************************************************************************** + */ +uint16_t gdx_lcp_data_tx(uint8_t header, uint8_t length, uint8_t *p_payload); + +/** + **************************************************************************************** + * @brief Start receiving packets + * + * @retval ::SDK_SUCCESS: Operation is Success. + **************************************************************************************** + */ +uint16_t gdx_lcp_rx_start(void); + +/** + **************************************************************************************** + * @brief Stop receiving packets + * + * @retval ::SDK_SUCCESS: Operation is Success. + **************************************************************************************** + */ +uint16_t gdx_lcp_rx_stop(void); + +/** @} */ + +#endif + +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_prf.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_prf.h old mode 100755 new mode 100644 index eb3713e..6016517 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_prf.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_prf.h @@ -49,574 +49,43 @@ #ifndef __BLE_PRF_H__ #define __BLE_PRF_H__ +#include "ble_error.h" +#include "ble_att.h" #include "ble_gatts.h" #include "ble_gattc.h" #include "ble_gatt.h" - -/** - @addtogroup BLE_PRF_COMMON Profile Common - @{ - @brief Definitions and prototypes for Profile Common interface. - */ - -/** @addtogroup BLE_PRF_MANAGER_TYPEDEFS Typedefs - * @{ */ -/** -**************************************************************************************** -* @brief Initialization of the Profile module. -* @note This function performs all the initializations of the Profile module, and it will be automatically -* called after the ble_server_prf_add() or ble_client_prf_add() function. -* - Creation of database (if it's a service) and ble_gatts_srvc_db_create should be called. -* - Allocation of profile-required memory. -* -* @retval status code to know if profile initialization succeeds or not. - **************************************************************************************** - */ -typedef uint8_t (*prf_init_func_t)(void); - -/** -**************************************************************************************** -* @brief Handles Connection creation. There is no need to recovery CCCD because stack will do that. -* -* @param[in] conn_idx: Connection index. - **************************************************************************************** - */ -typedef void (*prf_on_connect_func_t)(uint8_t conn_idx); - -/** -**************************************************************************************** -* @brief Handles Disconnection. There is no need to recovery CCCD because stack will do that. -* -* @param[in] conn_idx: Connection index. -* @param[in] reason: Disconnection reason. - **************************************************************************************** - */ -typedef void (*prf_on_disconnect_func_t)(uint8_t conn_idx, uint8_t reason); - -/** @addtogroup BLE_PRF_MANAGER_STRUCTURES Structures -* @{ */ -/** -* @brief Profile manager callbacks. -*/ -/** @} */ -typedef struct { - prf_init_func_t init; /**< Initialization callback. See @ref prf_init_func_t. */ - prf_on_connect_func_t on_connect; /**< Connection callback. See @ref prf_on_connect_func_t. */ - prf_on_disconnect_func_t on_disconnect; /**< Disconnection callback. See @ref prf_on_disconnect_func_t. */ -} ble_prf_manager_cbs_t; - -/** @} */ - -/** @} */ - -/** - @addtogroup BLE_PRF_SERVER Profile Server - @{ - @brief Definitions and prototypes for Profile Server interface. - */ - -/** @addtogroup BLE_PRF_SERVER_STRUCTURES Structures - * @{ */ -/** - * @brief GATT read request struct. - */ -typedef struct { - uint16_t handle; /**< Handle of the attribute to be read. */ -} gatts_read_req_cb_t; - -/** - * @brief GATT write request struct. - */ -typedef struct { - uint16_t handle; /**< Handle of the attribute to be written. */ - uint16_t offset; /**< Offset at which the data has to be written. */ - uint16_t length; /**< Data length to be written. */ - uint8_t value[ARRAY_EMPTY]; /**< Data to be written to characteristic value. */ -} gatts_write_req_cb_t; - -/** - * @brief GATT prepare write request struct. - */ -typedef struct { - uint16_t handle; /**< Handle of the attribute for whose value is requested. */ -} gatts_prep_write_req_cb_t; - -/** - * @brief GATTS Operation Complete event structure. - */ -typedef struct { - gatt_evt_type_t type; /**< Notification or indication event type. */ - uint16_t handle; /**< Handle of the write operation, or notification/indication operation. */ -} ble_gatts_ntf_ind_t; - -/** - * @brief GATT server callback function in relation to a profile. - */ -typedef struct { - /**< Read attribute value callback which is used when value is present in user space. - Function @ref ble_gatts_read_cfm should be called to send attribute value to stack. */ - void (*app_gatts_read_cb)(uint8_t conidx, const gatts_read_req_cb_t *p_read_req); - /**< Write attribute value callback. Function @ref ble_gatts_write_cfm should be called to - send write attribute value status to stack no matter the value is in user's zone or BLE stack. */ - void (*app_gatts_write_cb)(uint8_t conidx, const gatts_write_req_cb_t *p_write_req); - /**< Prepare write value callback function.Function @ref ble_gatts_prepare_write_cfm should be called to - send prepare write attribute value status to stack no matter the value is in user's zone or BLE stack. */ - void (*app_gatts_prep_write_cb)(uint8_t conidx, const gatts_prep_write_req_cb_t *p_prep_req); - /**< Notification or indication callback function. */ - void (*app_gatts_ntf_ind_cb)(uint8_t conidx, uint8_t status, const ble_gatts_ntf_ind_t *p_ntf_ind); - /**< Set CCCD value callback is called when connected with peer device. If bonded, recovery CCCD; - otherwise, set default value(0x0000) for CCCD. */ - void (*app_gatts_cccd_set_cb)(uint8_t conidx, uint16_t handle, uint16_t cccd_val); -} gatts_prf_cbs_t; - -/** - * @brief Profile server register information structure. - */ -typedef struct { - uint16_t max_connection_nb; /**< Maximum connections the profile supports. */ - ble_prf_manager_cbs_t* manager_cbs; /**< Profile manager callbacks. */ - gatts_prf_cbs_t *gatts_prf_cbs; /**< GATT server callback function in relation to the specific profile. */ -} prf_server_info_t; - -/** @} */ +#include "ble_event.h" /** @addtogroup BLE_PRF_FUNCTIONS Functions * @{ */ /** **************************************************************************************** - * @brief Add a server profile by providing its detailed information, including manager callback functions and - * GATT server callback functions. - * This API should be called in application initialization function. + * @brief Add a server profile by providing its detailed information.. * - * @param[in] p_server_prf_info: Pointer to the prf_info. See @ref prf_server_info_t. + * @param[in] p_gatts_db: Pointer to the prf_info. See @ref ble_gatts_create_db_t. + * @param[in] evt_handler: Pointer to ble events handler. * - * @note If there are several profiles which need to be added, this function should be called corresponding times. + * @retval ::SDK_SUCCESS: The profile info is recorded successfully, and the database will be created in profile initialization callback function. + * @retval ::SDK_ERR_POINTER_NULL: The parameter p_gatts_db or evt_handler is NULL. + * @retval ::SDK_ERR_NO_RESOURCES: The profile number is up to the maximum number the system can support. + **************************************************************************************** + */ +uint16_t ble_gatts_prf_add(ble_gatts_create_db_t *p_gatts_db, ble_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief Add a client profile by providing its detail information. * - * @retval ::SDK_SUCCESS: The profile info is recorded successfully, and the database will be created in profile - * initialization callback function. - * @retval ::SDK_ERR_POINTER_NULL: The parameter prf_info is NULL, or input parameters that prf_info points - * to are invalid. + * @param[in] p_uuid: Pointer to the target service uuid. See @ref ble_uuid_t. + * @param[out] evt_handler: Pointer to ble events handler.. + * + * @retval ::SDK_SUCCESS: The profile info is recorded successfully, and the profile ENV will be initialized in profile initialization callback function. + * @retval ::SDK_ERR_POINTER_NULL: The parameter p_uuid or evt_handler is NULL, or input parameters that prf_info points to are invalid. * @retval ::SDK_ERR_NO_RESOURCES: The profile number is up to the maximum number the system can support. **************************************************************************************** */ -uint16_t ble_server_prf_add(const prf_server_info_t *p_server_prf_info); -/** @} */ - -/** @} */ - -/** - @addtogroup BLE_PRF_CLIENT Profile Client - @{ - @brief Definitions and prototypes for Profile Client interface. - */ - -/** @addtogroup BLE_PRF_CLIENT_STRUCTURES Structures - * @{ */ - -/** - * @brief GATTC profile register to peer event info structure. - */ -typedef struct { - uint16_t start_hdl; /**< Attribute start handle. */ - uint16_t end_hdl; /**< Attribute end handle. */ -} gattc_prf_reg_peer_evt_t; - -/** - * @brief GATTC profile register enumeration. - */ -typedef enum { - GATTC_EVT_REGISTER, /**< GATT client event register. */ - GATTC_EVT_UNREGISTER, /**< GATT client event unregister. */ -} gattc_prf_reg_evt_t; - -/** @brief GATTC Profile callback Structures. */ -typedef struct { - /**< Primary Service Discovery Response callback. */ - void (*app_gattc_srvc_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_srvc_disc_t *p_prim_srvc_disc); - /**< Relationship Discovery Response callback. */ - void (*app_gattc_inc_srvc_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_incl_disc_t *p_inc_srvc_disc); - /**< Characteristic Discovery Response callback. */ - void (*app_gattc_char_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_char_disc_t *p_char_disc); - /**< Descriptor Discovery Response callback. */ - void (*app_gattc_char_desc_disc_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_char_desc_disc_t *p_char_desc_disc); - /**< Read Response callback. */ - void (*app_gattc_read_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_read_rsp_t *p_read_rsp); - /**< Write complete callback. */ - void (*app_gattc_write_cb)(uint8_t conn_idx, uint8_t status, - uint16_t handle); - /**< Handle Value Notification/Indication Event callback. */ - void (*app_gattc_ntf_ind_cb)(uint8_t conn_idx, - const ble_gattc_ntf_ind_t *p_ntf_ind); - /**< Service found callback during browsing procedure. */ - void (*app_gattc_srvc_browse_cb)(uint8_t conn_idx, uint8_t status, - const ble_gattc_browse_srvc_t *p_browse_srvc); - /**< GATT client event register complete callback. */ - void (*app_gattc_prf_reg_cb)(uint8_t conn_idx, uint8_t status, - gattc_prf_reg_evt_t reg_evt); -} gattc_prf_cbs_t; - -/** - * @brief Profile client register information structure. - */ -typedef struct { - uint16_t max_connection_nb; /**< Maximum connections the profile supports. */ - ble_prf_manager_cbs_t *manager_cbs; /**< Profile manager callbacks. */ - gattc_prf_cbs_t *gattc_prf_cbs; /**< GATT client callback function in relation to - the specific profile. */ -} prf_client_info_t; - -/** @} */ - -/** - @addtogroup BLE_PRF_CLIENT_FUNCTIONS Functions - @{ - @brief Definitions and prototypes for Profile Client interface. - */ -/** - **************************************************************************************** - * @brief Add a client profile by providing its detail information, - * including manager callback functions and GATT client callback functions. - * This API should be called in application initialization function. - * - * @param[in] p_client_prf_info: Pointer to the p_client_prf_info. See @ref prf_client_info_t. - * @param[out] p_client_prf_id: Pointer to the client profile id. - * - * @note If there are several profiles which need to be added, this function should be called corresponding times. - * - * @retval ::SDK_SUCCESS: The profile info is recorded successfully, and the profile ENV will be - * initialized in profile initialization callback function. - * @retval ::SDK_ERR_POINTER_NULL: The parameter p_client_prf_info or p_client_prf_id is NULL, - * or input parameters that prf_info points to are invalid. - * @retval ::SDK_ERR_NO_RESOURCES: The profile number is up to the maximum number the system can support. - **************************************************************************************** - */ -uint16_t ble_client_prf_add(const prf_client_info_t *p_client_prf_info, uint8_t *p_client_prf_id); - -/** - **************************************************************************************** - * @brief Profile client Browse Specific Primary Service information on remote GATT server. - * - * @note This discovery automatically searches for Primary Services, Included Services, - * Characteristics and Descriptors of each service. - * To discover one or more services only, use ble_gattc_primary_services_discover() instead. - * This discovery is able to search a specific Primary Service. - * If p_srvc_uuid is NULL, the invalid pointer error code will be returned immediately. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_srvc_browse_cb will be called for all attributes - * of each service found. After completed service handle range registeration for receiving peer device - * indication/notification will be executed internally. Because secondary service can't be browsed, - * so handle range registeration for receiving peer device indication/notification to this client - * profile may be necessary. App can call function ble_gattc_prf_evt_handle_register for registeration, - * it depends on user app. If user don't call this function, user shall call ble_gattc_prf_evt_handle_register to - * register handle range for receiving peer device indication/notification in specific client profile callback. - * - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_srvc_uuid: Pointer to Service UUID. - * - * @retval ::SDK_SUCCESS: Successfully start the Browse Service(s) procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_services_browse(uint8_t prf_id, uint8_t conn_idx, const ble_uuid_t *p_srvc_uuid); - -/** - **************************************************************************************** - * @brief Profile client Discover Primary Services on remote GATT server. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_srvc_disc_cb will be called for service(s) found. - * If p_srvc_uuid is NULL, the invalid pointer error code will be returned immediately. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_srvc_uuid: Pointer to Service UUID. - * - * @retval ::SDK_SUCCESS: Successfully start the Primary Service Discovery procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_primary_services_discover(uint8_t prf_id, uint8_t conn_idx, const ble_uuid_t *p_srvc_uuid); - -/** - **************************************************************************************** - * @brief Profile client Discover Included Services on remote GATT server. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_inc_srvc_disc_cb will be called - * for Included Service(s) found. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] start_hdl: Start handle. - * @param[in] end_hdl: End handle. - * - * @retval ::SDK_SUCCESS: Successfully start the Relationship Discovery procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_included_services_discover(uint8_t prf_id, uint8_t conn_idx, uint16_t start_hdl, - uint16_t end_hdl); - -/** - **************************************************************************************** - * @brief Profile client Discover Characteristics on remote GATT server. - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_char_disc_cb will be called for Characteristic\ - * Declaration(s) found. If p_disc_char is NULL, the invalid pointer error code will be returned immediately. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_disc_char: Pointer to discover by characteristic UUID info. - * - * @retval ::SDK_SUCCESS: Successfully start the Characteristic Discovery procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_char_discover(uint8_t prf_id, uint8_t conn_idx, gattc_disc_char_t *p_disc_char); - -/** - **************************************************************************************** - * @brief Profile client Discover Characteristics Descriptors on remote GATT server. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_char_desc_disc_cb will be called for - * Characteristic Descriptor(s) found. If the last Descriptor has not been reached, this function must be called - * again with an updated handle range to continue the discovery. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] start_hdl: Start handle. - * @param[in] end_hdl: End handle. - * - * @retval ::SDK_SUCCESS: Successfully start the Descriptor Discovery procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_char_desc_discover(uint8_t prf_id, uint8_t conn_idx, uint16_t start_hdl, uint16_t end_hdl); - -/** - **************************************************************************************** - * @brief Profile client Read Attribute from remote GATT server. - * - * @note This uses either the "Read Characteristic Value" procedure or the "Read Characteristic Descriptor" - * procedure, depending on the attribute pointed by handle. If offset is non-zero or the - * attribute length is larger than the MTU, the "Read Long Characteristic Value" procedure or the - * "Read Long Characteristic Descriptor" procedure will be used respectively. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_read_cb will be called when Read is finished. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] handle: Attribute handle. - * @param[in] offset: Value offset to start with. - * - * @retval ::SDK_SUCCESS: Successfully start the Read (Long) procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_read(uint8_t prf_id, uint8_t conn_idx, uint16_t handle, uint16_t offset); - -/** - **************************************************************************************** - * @brief Profile client Read Attribute by UUID. - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_read_cb will be called when Read is finished. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_read_by_uuid: Pointer to Read by Characteristic UUID info. - * - * @retval ::SDK_SUCCESS: Successfully start the Read Using Characteristic UUID procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_read_by_uuid(uint8_t prf_id, uint8_t conn_idx, gattc_read_by_uuid_t *p_read_by_uuid); - -/** - **************************************************************************************** - * @brief Profile client Initiate a Read Multiple Characteristic Values procedure - * - * @note Function callback @ref gattc_prf_cbs_t::app_gattc_read_cb will be called for each handle value which is read. - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_param: Pointer to the parameters of the value. - * - * @retval ::SDK_SUCCESS: Successfully start the Read Multiple Characteristic Values procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_read_multiple(uint8_t prf_id, uint8_t conn_idx, const gattc_read_multiple_t *p_param); - -/** - **************************************************************************************** - * @brief Profile client Write (Long) Characteristic (Descriptor) Value. - * - * @note This uses either the "Write Characteristic Value" procedure or the "Write Characteristic - * Descriptor" procedure, depending on the attribute pointed by handle. If offset is non-zero - * or the attribute length is larger than the MTU, the "Write Long Characteristic Value" procedure - * or the "Write Long Characteristic Descriptor" procedure will be used respectively. - * - * @note Once completed @ref gattc_prf_cbs_t::app_gattc_write_cb will be called. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_write_attr_value: Pointer to the write attribue value info. - * - * @retval ::SDK_SUCCESS: Successfully start the Write procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_write(uint8_t prf_id, uint8_t conn_idx, gattc_write_attr_value_t *p_write_attr_value); - -/** - **************************************************************************************** - * @brief Profile client Prepare Long/Reliable Write to remote GATT server. - * @note Once completed @ref gattc_prf_cbs_t::app_gattc_write_cb will be called. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_write_attr_value: Pointer to the write attribue value info. - * - * @retval ::SDK_SUCCESS: Successfully send prepare write request. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_write_prepare(uint8_t prf_id, uint8_t conn_idx, gattc_write_attr_value_t *p_write_attr_value); - -/** - **************************************************************************************** - * @brief Profile client Execute Reliable/Long Write to remote GATT server. - * - * @note Once completed @ref gattc_prf_cbs_t::app_gattc_write_cb will be called. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] execute: True if data shall be written; False if cancel all prepared writes. - * - * @retval ::SDK_SUCCESS: Successfully send an Execute Write request. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_write_execute(uint8_t prf_id, uint8_t conn_idx, bool execute); - -/** - **************************************************************************************** - * @brief Profile client Write Attribute to remote GATT server (without response). - * - * @note If signed_write is set to false, the "Write Without Response" procedure will be used. - * If signed_write is set to true, the "Signed Write Without Response" procedure will be used on - * a link which is not encrypted. If a link is already encrypted, "Write Without Response" - * procedure shall be used instead of "Signed Write Without Response". - * @note Once completed @ref gattc_prf_cbs_t::app_gattc_write_cb will be called. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] p_write_no_resp: Pointer to the write without response info. - * - * @retval ::SDK_SUCCESS Successfully: start the (Signed) Write Without Response procedure. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_write_no_resp(uint8_t prf_id, uint8_t conn_idx, gattc_write_no_resp_t *p_write_no_resp); - -/** - **************************************************************************************** - * @brief Profile client Confirm Reception of Indication. - * - * @note Confirm indication which has been correctly received from the peer. - * - * @param[in] prf_id Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] handle: Value handle. - * - * @retval ::SDK_SUCCESS: Successfully send a Confirm Reception of Indication request. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_indicate_cfm(uint8_t prf_id, uint8_t conn_idx, uint16_t handle); - - -/** - **************************************************************************************** - * @brief Profile client Register Indication/Notification event. - * - * @note Registration to peer device events (Indication/Notification) for specific client profile. - * Once completed @ref gattc_prf_cbs_t::app_gattc_prf_reg_cb with type: @ref GATTC_EVT_UNREGISTER will be called. - * If user don't call ble_gattc_prf_services_browse, user shall call this function to register handle range - * for receiving peer device indication/notification in specific client profile callback. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] env: Pointer to the profile registeration event info. - * - * @retval ::SDK_SUCCESS: Successfully register Indication/Notification event. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_evt_handle_register(uint8_t prf_id, uint8_t conn_idx, gattc_prf_reg_peer_evt_t *env); - -/** - **************************************************************************************** - * @brief Profile client Unregister Indication/Notification event. - * - * @note Unregistration to peer device events (Indication/Notification) for specific client profile. - * Once completed @ref gattc_prf_cbs_t::app_gattc_prf_reg_cb with type: @ref GATTC_EVT_UNREGISTER will be called. - * - * @param[in] prf_id: Profile id. - * @param[in] conn_idx: Current connection index. - * @param[in] env: Pointer to the profile registeration event info. - * - * @retval ::SDK_SUCCESS: Successfully unregister Indication/Notification event. - * @retval ::SDK_ERR_INVALID_CONN_IDX: Invalid connection index supplied. - * @retval ::SDK_ERR_POINTER_NULL: Invalid pointer supplied. - * @retval ::SDK_ERR_INVALID_PARAM: Invalid parameter(s) supplied. - * @retval ::SDK_ERR_NO_RESOURCES: Not enough resources. - **************************************************************************************** - */ -uint16_t ble_gattc_prf_evt_handle_unregister(uint8_t prf_id, uint8_t conn_idx, gattc_prf_reg_peer_evt_t *env); - -/** @} */ +uint16_t ble_gattc_prf_add(ble_uuid_t *p_uuid, ble_evt_handler_t evt_handler); /** @} */ #endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_sec.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_sec.h old mode 100755 new mode 100644 index 4b5c86f..ba6a7eb --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_sec.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/ble_sec.h @@ -40,196 +40,201 @@ * @{ */ -/** -@addtogroup BLE_SEC Security Manager(SM) -@{ -@brief Definitions and prototypes for the BLE_SEC interface. -*/ + /** + @addtogroup BLE_SEC Security Manager(SM) + @{ + @brief Definitions and prototypes for the BLE_SEC interface. + */ #ifndef __BLE_SEC_H__ #define __BLE_SEC_H__ +#include "ble_error.h" #include -/** @addtogroup BLE_SM_DEFINES Defines +/**@addtogroup BLE_SM_DEFINES Defines * @{ */ -/** @defgroup SEC_AUTH_FLAG SEC Auth Flag +/**@defgroup BLE_SEC_AUTH_FLAG SEC Auth Flag * @{ */ -#define AUTH_NONE 0 /**< No auth requirement. */ -#define AUTH_BOND (1 << 0) /**< Bond flag. */ -#define AUTH_MITM (1 << 2) /**< MITM flag. */ -#define AUTH_SEC_CON (1 << 3) /**< Security connection flag. */ -#define AUTH_KEY_PRESS_NOTIFY (1 << 4) /**< Key press notify flag. */ -#define AUTH_ALL (AUTH_BOND | AUTH_MITM | AUTH_SEC_CON | AUTH_KEY_PRESS_NOTIFY) /**< All authentication - flags are on. */ -/** @} */ +#define BLE_SEC_AUTH_NONE 0 /**< No auth requirement. */ +#define BLE_SEC_AUTH_BOND (1 << 0) /**< Bond flag. */ +#define BLE_SEC_AUTH_MITM (1 << 2) /**< MITM flag. */ +#define BLE_SEC_AUTH_SEC_CON (1 << 3) /**< Security connection flag. */ +#define BLE_SEC_AUTH_KEY_PRESS_NOTIFY (1 << 4) /**< Key press notify flag. */ +#define BLE_SEC_AUTH_ALL (AUTH_BOND | AUTH_MITM | AUTH_SEC_CON | AUTH_KEY_PRESS_NOTIFY) /**< All authentication flags are on. */ +/**@} */ -/** @defgroup SEC_KEY_DIST_FLAG SEC Key Distribution Flag -* @{ +/**@defgroup BLE_SEC_KEY_DIST_FLAG SEC Key Distribution Flag +* @{ */ -#define KDIST_NONE 0 /**< No key needs to be distributed. */ -#define KDIST_ENCKEY (1 << 0) /**< Distribute encryption and master identification info. */ -#define KDIST_IDKEY (1 << 1) /**< Distribute identity and address info. */ -#define KDIST_SIGNKEY (1 << 2) /**< Distribute signing info. */ -#define KDIST_ALL (KDIST_ENCKEY | KDIST_IDKEY | KDIST_SIGNKEY) /**< Distribute all info. */ +#define BLE_SEC_KDIST_NONE 0 /**< No key needs to be distributed. */ +#define BLE_SEC_KDIST_ENCKEY (1 << 0) /**< Distribute encryption and master identification info. */ +#define BLE_SEC_KDIST_IDKEY (1 << 1) /**< Distribute identity and address info. */ +#define BLE_SEC_KDIST_SIGNKEY (1 << 2) /**< Distribute signing info. */ +#define BLE_SEC_KDIST_LINKKEY (1 << 3) /**< Distribute link key info. */ +#define BLE_SEC_KDIST_ALL (BLE_SEC_KDIST_ENCKEY | BLE_SEC_KDIST_IDKEY | BLE_SEC_KDIST_SIGNKEY ) /**< Distribute all info. */ +#define BLE_BT_SEC_KDIST_ALL (BLE_SEC_KDIST_ENCKEY | BLE_SEC_KDIST_IDKEY | BLE_SEC_KDIST_SIGNKEY | BLE_SEC_KDIST_LINKKEY) /**< Distribute all info inlcude link key. */ -/** @} */ -/** @} */ +/**@} */ +/**@} */ -/** @addtogroup BLE_SEC_ENUMERATIONS Enumerations +/**@addtogroup BLE_SEC_ENUMERATIONS Enumerations * @{ */ -/** @brief SEC IO Capability. */ -typedef enum { - IO_DISPLAY_ONLY = 0x00, /**< Display only. */ - IO_DISPLAY_YES_NO = 0x01, /**< Display and input yes or no. */ - IO_KEYBOARD_ONLY = 0x02, /**< Keyboard only. */ - IO_NO_INPUT_NO_OUTPUT = 0x03, /**< No input and no output. */ - IO_KEYBOARD_DISPLAY = 0x04 /**< Keyboard and display. */ -} sec_io_cap_t; +/**@brief SEC IO Capability. */ +typedef enum +{ + BLE_SEC_IO_DISPLAY_ONLY = 0x00, /**< Display only. */ + BLE_SEC_IO_DISPLAY_YES_NO = 0x01, /**< Display and input yes or no. */ + BLE_SEC_IO_KEYBOARD_ONLY = 0x02, /**< Keyboard only. */ + BLE_SEC_IO_NO_INPUT_NO_OUTPUT = 0x03, /**< No input and no output. */ + BLE_SEC_IO_KEYBOARD_DISPLAY = 0x04 /**< Keyboard and display. */ +} ble_sec_io_cap_t; -/** @brief SEC Encryption Request Type. - * @note These types indicate some operations need to interact with app during pair process. +/**@brief SEC Encryption Request Type. + *@note These types indicate some operations need to interact with app during pair process. */ -typedef enum { - PAIR_REQ, /**< Pair request. Apps need to decide whether to accept this request. */ - TK_REQ, /**< TK request. Apps need to set the TK value. */ - OOB_REQ, /**< OOB request. Apps need to set the OOB value. */ - NC_REQ /**< Number comparison request. - Apps need to check if it is the same number displayed in Master and Slave. */ -} sec_enc_req_type_t; +typedef enum +{ + BLE_SEC_PAIR_REQ, /**< Pair request. Apps need to decide whether to accept this request. */ + BLE_SEC_TK_REQ, /**< TK request. Apps need to set the TK value. */ + BLE_SEC_OOB_REQ, /**< OOB request. Apps need to set the OOB value. */ + BLE_SEC_NC_REQ /**< Number comparison request. Apps need to check if it is the same number displayed in Master and Slave. */ +} ble_sec_enc_req_type_t; -/** @brief SEC Key Press Notify. */ -typedef enum { - KEY_PRESS_STARTED = 0x00, /**< Passkey entry started. */ - KEY_PRESS_ENTERED = 0x01, /**< Passkey digit entered. */ - KEY_PRESS_ERASED = 0x02, /**< Passkey digit erased. */ - KEY_PRESS_CLEARED = 0x03, /**< Passkey cleared. */ - KEY_PRESS_COMPLETED = 0x04 /**< Passkey entry completed. */ -} sec_keypress_notify_t; +/**@brief SEC Key Press Notify. */ +typedef enum +{ + BLE_SEC_KEY_PRESS_STARTED = 0x00, /**< Passkey entry started. */ + BLE_SEC_KEY_PRESS_ENTERED = 0x01, /**< Passkey digit entered. */ + BLE_SEC_KEY_PRESS_ERASED = 0x02, /**< Passkey digit erased. */ + BLE_SEC_KEY_PRESS_CLEARED = 0x03, /**< Passkey cleared. */ + BLE_SEC_KEY_PRESS_COMPLETED = 0x04 /**< Passkey entry completed. */ +} ble_sec_keypress_notify_t; -/** @brief SEC pair result. */ -typedef enum { - ENC_SUCCESS = 0x00, /**< Encrypt success. */ - ENC_FAIL_PASSKEY_ENTRY_FAIL = 0x01, /**< The user input of passkey failed, for example, - the user cancelled the operation. */ - ENC_FAIL_OOB_NOT_AVAILBL = 0x02, /**< The OOB data is not available. */ - ENC_FAIL_AUTH_REQ = 0x03, /**< The pairing procedure cannot be performed as authentication - requirements cannot be met due to IO incapability of - one or both devices. */ - ENC_FAIL_CONFIRM_VAL_FAIL = 0x04, /**< The confirm value does not match the calculated compare value. */ - ENC_FAIL_PAIRING_NOT_SUPPORT = 0x05, /**< Pairing is not supported by the device. */ - ENC_FAIL_ENCRPT_KEY_SIZE = 0x06, /**< The resultant encryption key size is insufficient for the security - requirements of this device. */ - ENC_FAIL_COMMAND_NOT_SUPPORT = 0x07, /**< The SMP command received is not supported on this device. */ - ENC_FAIL_UNSPECIFIED = 0x08, /**< Pairing failed due to an unspecified reason. */ - ENC_FAIL_REPEAT_ATTEMPT = 0x09, /**< Pairing or authentication procedure is disallowed because too little - time has elapsed since last pairing request or security request. */ - ENC_FAIL_INVALID_PARAM = 0x0A, /**< The Invalid Parameters error code indicates that the command length is - invalid or that a parameter is outside of the specified range. */ - ENC_FAIL_DHKEY_CHECK_FAIL = 0x0B, /**< Indicate to the remote device that the DHKey Check value received - doesn't match the one calculated by the local device. */ - ENC_FAIL_NUM_CMP_FAIL = 0x0C, /**< Indicate that the confirm values in the numeric comparison protocol - do not match. */ - ENC_FAIL_BR_EDR_IN_PROGRESS = 0x0D, /**< Indicate that the pairing over the LE transport failed due to - a Pairing Request sent over the BR/EDR transport in process. */ - ENC_FAIL_KEY_DRIV_GEN_NOT_ALLOW = 0x0E, /**< Indicate that the BR/EDR Link Key generated on the BR/EDR transport - cannot be used to derive and distribute keys for the LE transport. */ - ENC_FAIL_LTK_MISSING = 0x0F, /**< Indicate the LTK of peer devices missing. */ -} sec_enc_ind_t; +/**@brief SEC mode and level. */ +typedef enum +{ + BLE_SEC_MODE1_LEVEL1 = 0x00, /**< No security is needed. */ + BLE_SEC_MODE1_LEVEL2 = 0x01, /**< Encrypted link is required. Unnecessary: MITM and SC. */ + BLE_SEC_MODE1_LEVEL3 = 0x02, /**< Encrypted link is required. Necessary: MITM; unnecessary: SC. */ + BLE_SEC_MODE1_LEVEL4 = 0x03, /**< Encrypted link is required. Necessary: MITM and SC. */ + BLE_SEC_MODE2_LEVEL1 = 0x04, /**< Data signing is required. Unnecessary: MITM and SC. */ + BLE_SEC_MODE2_LEVEL2 = 0x05, /**< Data signing is required. Necessary: MITM; unnecessary: SC. */ +} ble_sec_mode_level_t; -/** @brief SEC mode and level. */ -typedef enum { - SEC_MODE1_LEVEL1 = 0x00, /**< No security is needed. */ - SEC_MODE1_LEVEL2 = 0x01, /**< Encrypted link is required. Unnecessary: MITM and SC. */ - SEC_MODE1_LEVEL3 = 0x02, /**< Encrypted link is required. Necessary: MITM; unnecessary: SC. */ - SEC_MODE1_LEVEL4 = 0x03, /**< Encrypted link is required. Necessary: MITM and SC. */ - SEC_MODE2_LEVEL1 = 0x04, /**< Data signing is required. Unnecessary: MITM and SC. */ - SEC_MODE2_LEVEL2 = 0x05, /**< Data signing is required. Necessary: MITM; unnecessary: SC. */ -} sec_mode_level_t; +/**@brief SEC TK type. */ +typedef enum +{ + BLE_SEC_TK_OOB = 0x00, /** UART0_TXD(MUX0),GPIO0_PIN4 -> UART0_RXD(MUX0)*/ - DFU_UART_PIN_GROUP_1, /**< GPIO0_PIN10 -> UART0_TXD(MUX2),GPIO0_PIN11 -> UART0_RXD(MUX2)*/ - DFU_UART_PIN_GROUP_2, /**< GPIO0_PIN0 -> UART0_TXD(MUX4),GPIO0_PIN1 -> UART0_RXD(MUX4)*/ - DFU_UART_PIN_GROUP_3, /**< GPIO1_PIN14 -> UART0_TXD(MUX5),GPIO1_PIN10 -> UART0_RXD(MUX5)*/ - DFU_UART_PIN_GROUP_4, /**< GPIO0_PIN7 -> UART1_TXD(MUX3),GPIO0_PIN6 -> UART1_RXD(MUX3)*/ - DFU_UART_PIN_GROUP_5, /**< GPIO0_PIN9 -> UART1_TXD(MUX3),GPIO0_PIN8 -> UART1_RXD(MUX3)*/ -} dfu_uart_pin_group_t; - -/** @brief DFU informatica status. */ -typedef enum { - DFU_INFO_DISABLE = 0x5775, /**< DFU Config Info Disable. */ - DFU_INFO_ENABLE = 0x7ff7, /**< DFU Config Info Enable. */ - DFU_INFO_DEFAULT = 0x4774, /**< DFU Config Info DEFAULT */ -} dfu_info_state; -/** @} */ - -/** @addtogroup DFU_STRUCTURES Structures - * @{ */ - -/** @brief BootLoader information definition. */ -typedef struct { - uint32_t bin_size; /**< Firmware Size. */ - uint32_t check_sum; /**< Firmware Check Sum Value. */ - uint32_t load_addr; /**< Firmware Load Address. */ - uint32_t run_addr ; /**< Firmware Run Address. */ - uint32_t xqspi_xip_cmd; /**< XIP Read Mode. 0x03: Read mode, 0x0B: Fast Read mode, - 0x3B: DualOut Fast Read mode, - 0xBB: DualIO Fast Read mode, - 0x6B: QuadOut Fast Read mode, - 0xEB: QuadIO Fast Read mode */ - uint32_t xqspi_speed : 4; /**< Bit: 0-3 clock speed. 0 :64 MHz, 1:48 MHz, - 2:32 MHz, 3:24 MHz, 4:16 MHz. */ - uint32_t code_copy_mode : 1; /**< Bit: 4 code copy mode. 0:XIP,1:QSPI. */ - uint32_t system_clk : 3; /**< Bit: 5-7 system clock. 0:64 MHz, 1:48 MHz, 2:32 MHz(xo), - 3:24 MHz, 4:16 MHz, 5:32 MHz(cpll). */ - uint32_t check_image : 1; /**< Bit: 8 check image. */ - uint32_t boot_delay : 1; /**< Bit: Boot delay flag. */ - uint32_t is_dap_boot : 1; /**< Bit: 11 check if boot dap mode. */ - uint32_t reserved : 21; /**< Bit: 24 reserved. */ -} boot_info_t; +/**@brief Image information definition. */ +typedef struct +{ + uint16_t pattern; /**< Image info pattern. */ + uint16_t version; /**< Image version. */ + dfu_boot_info_t boot_info; /**< Image boot info. */ + uint8_t comments[12]; /**< Image comments. */ +} dfu_image_info_t; -/** @brief DFU uart config definition. */ -typedef struct { - dfu_info_state state; /**< DFU UART Enable or Disable. This parameter can be a value of - @ref dfu_info_state. */ - dfu_uart_baudrate_t baud_rate; /**< UART communication baudrate. This parameter can be a value of - @ref dfu_uart_baudrate_t. */ - dfu_uart_data_bit_t data_bit; /**< The number of data bits transmitted or received in a frame. - This parameter can be a value of @ref dfu_uart_data_bit_t. */ - dfu_uart_stop_bit_t stop_bits; /**< The number of stop bits transmitted. - This parameter can be a value of @ref dfu_uart_stop_bit_t. */ - dfu_uart_parity_bit_t parity; /**< Specify the parity mode. This parameter can be a value of - @ref dfu_uart_parity_bit_t. */ - dfu_uart_pin_group_t pin_group; /**< Uart pin group. This parameter can be a value of - @ref dfu_uart_pin_group_t. */ -} dfu_uart_info_t; - -/** @brief DFU Advertisement name config definition. */ -typedef struct { - dfu_info_state state; /**< If a set name is used, this parameter can be a value of - @ref dfu_info_state. */ - uint8_t adv_name[DFU_ADV_MAX_LENGTH]; /**< Adv name data. */ - uint16_t adv_name_length; /**< The length of the name. */ -} dfu_adv_name_info_t; - -/** @brief DFU NVDS init info definition. */ -typedef struct { - dfu_info_state state; /**< If NVDS init is required, this parameter can be a value of - @ref dfu_info_state. */ - uint16_t page_size; /**< NVDS page size. */ - uint32_t start_address; /**< NVDS start address. */ -} dfu_nvds_info_t; - -/** @brief DFU cmd disable info definition. */ -typedef struct { - dfu_info_state state; /**< If DFU cmd disable config is required, this parameter can be a value of - @ref dfu_info_state. */ - uint16_t cmd_bit_map; /**< NVDS start address. */ -} dfu_cmd_disable_t; - - -/** @brief DFU used functions config definition. */ -typedef struct { - /**< The function is used to send data to master by BLE. */ - void (*dfu_ble_send_data)(uint8_t *p_data, uint16_t length); - /**< The function is used to send data to master by UART. */ - void (*dfu_uart_send_data)(uint8_t *p_data, uint16_t length); - /**< The function is used to read data from flash. */ - uint32_t (*dfu_flash_read)(const uint32_t addr, uint8_t *p_buf, const uint32_t size); - /**< The function is used to write data to flash. */ - uint32_t (*dfu_flash_write)(const uint32_t addr, const uint8_t *p_buf, const uint32_t size); - /**< The function is used to erase flash by address. */ - bool (*dfu_flash_erase)(const uint32_t addr, const uint32_t size); - /**< The function is used to erase flash chip. */ - bool (*dfu_flash_erase_chip)(void); - /**< The function is used to set the flash security mode as Enable or Disable. */ - void (*dfu_flash_set_security)(bool enable); - /**< The function is used to get the flash security mode (Enable or Disable). */ - bool (*dfu_flash_get_security)(void); - /**< The function is used to get the flash id and size. */ - void (*dfu_flash_get_info)(uint32_t *id, uint32_t *size); +/**@brief DFU used functions config definition. */ +typedef struct +{ + void (*dfu_ble_send_data)(uint8_t *p_data, uint16_t length); /**< The function is used to send data to master by BLE. */ + void (*dfu_uart_send_data)(uint8_t *p_data, uint16_t length); /**< The function is used to send data to master by UART. */ + uint32_t (*dfu_flash_read)(const uint32_t addr, uint8_t *p_buf, const uint32_t size); /**< The function is used to read data from flash. */ + uint32_t (*dfu_flash_write)(const uint32_t addr, const uint8_t *p_buf, const uint32_t size); /**< The function is used to write data to flash. */ + bool (*dfu_flash_erase)(const uint32_t addr, const uint32_t size); /**< The function is used to erase flash by address. */ + bool (*dfu_flash_erase_chip)(void); /**< The function is used to erase flash chip. */ + void (*dfu_flash_set_security)(bool enable); /**< The function is used to set the flash security mode as Enable or Disable. */ + bool (*dfu_flash_get_security)(void); /**< The function is used to get the flash security mode (Enable or Disable). */ + void (*dfu_flash_get_info)(uint32_t *id, uint32_t *size); /**< The function is used to get the flash id and size. */ } dfu_func_t; -/** @brief SPI used functions config definition. */ -typedef struct { - /**< The function is used to config flash spi. */ - void (*dfu_spi_flash_init)(uint8_t *p_data); - /**< The function is used to read external flash . */ - uint32_t (*dfu_spi_flash_read)(uint32_t addr, uint8_t *buf, uint32_t size); - /**< The function is used to write external flash. */ - uint32_t (*dfu_spi_flash_write)(uint32_t addr, uint8_t *buf, uint32_t size); - /**< The function is used to erase external flash by address. */ - bool (*dfu_spi_flash_erase)(uint32_t addr, uint32_t size); - /**< The function is used to erase exteral flash chip. */ - bool (*dfu_spi_flash_erase_chip)(void); - /**< The function is used to get external flash id and size. */ - void (*dfu_spi_flash_get_info)(uint32_t *id, uint32_t *size); -} dfu_spi_flash_func_t; +/**@brief SPI used functions config definition. */ +typedef struct +{ + void (*dfu_spi_flash_init)(uint8_t *p_data); /**< The function is used to config flash spi. */ + uint32_t (*dfu_spi_flash_read)(uint32_t addr, uint8_t *buf, uint32_t size); /**< The function is used to read external flash . */ + uint32_t (*dfu_spi_flash_write)(uint32_t addr, uint8_t *buf, uint32_t size); /**< The function is used to write external flash. */ + bool (*dfu_spi_flash_erase)(uint32_t addr, uint32_t size); /**< The function is used to erase external flash by address. */ + bool (*dfu_spi_flash_erase_chip)(void); /**< The function is used to erase exteral flash chip. */ + void (*dfu_spi_flash_get_info)(uint32_t *id, uint32_t *size); /**< The function is used to get external flash id and size. */ +}dfu_spi_flash_func_t; -/** @brief DFU program state callback definition. */ -typedef struct { +/**@brief DFU program state callback definition. */ +typedef struct +{ void (*dfu_program_start_callback)(void); /** +#include +#include /** - * @addtogroup GR55XX_FPB_ENUMERATIONS Enumerations + *@addtogroup GR55XX_FPB_ENUMERATIONS Enumerations * @{ */ -/** @brief FPB mode. */ -typedef enum { +/**@brief FPB mode. */ +typedef enum +{ FPB_MODE_PATCH_ONLY = 0, /**< FPB MODE ENABLE FOR PATCH ONLY*/ FPB_MODE_DEBUG_ONLY, /**< FPB MODE ENABLE FOR DEBUG ONLY*/ FPB_MODE_PATCH_AND_DEBUG, /**< FPB MODE ENABLE FOR PATCH AND DEBUG*/ } fpb_mode_t ; -/** @brief FPB state. */ -typedef enum { +/**@brief FPB state. */ +typedef enum +{ FPB_PATCH_OFF = 0, /**< FPB patch disable */ FPB_PATCH_ON, /**< FPB patch enable */ } fpb_state_t; -/** @brief FPB register. */ -typedef struct { - volatile uint32_t CTRL; /**< Offset: 0x000 (R/W) Data */ +/**@brief FPB register. */ +typedef struct +{ + volatile uint32_t CTRL; /**< Offset: 0x000 (R/W) Data */ volatile uint32_t REMAP; /**< Offset: 0x004 (R/W) Data */ volatile uint32_t COMP[8]; /**< Offset: 0x008 (R) Data */ } FPB_REG_TypeDef; @@ -85,7 +90,7 @@ typedef struct { * @defgroup GR55XX_FPB_TYPEDEF Typedefs * @{ */ -/** @brief FPB function.*/ +/**@brief FPB function.*/ typedef void(*fun_t)(void); /** @} */ @@ -93,15 +98,14 @@ typedef void(*fun_t)(void); * @defgroup GR55XX_FPB_FUNCTION Functions * @{ */ -/** -**************************************************************************************** -* @brief Enabling patch function -* @param[in] index_start : Start Index Number -* @param[in] index_end : End Index Number -* @retval : void -**************************************************************************************** -*/ -void fpb_enable(uint8_t index_start, uint8_t index_end); + /** + **************************************************************************************** + * @brief Enabling patch function + * @param[in] index_start : Start Index Number + * @param[in] index_end : End Index Number + **************************************************************************************** + */ +void fpb_enable(uint8_t index_start ,uint8_t index_end); /** **************************************************************************************** @@ -109,81 +113,75 @@ void fpb_enable(uint8_t index_start, uint8_t index_end); * @param[in] ori_func : primitive function address * @param[in] rep_func : replacement function address * @param[in] patch_table_num : group number - * @retval : void + * @return -1: Error Otherwise: Patch table number **************************************************************************************** */ int fun_replace_by_svc(uint32_t ori_func, uint32_t rep_func, uint8_t patch_table_num); -/** -**************************************************************************************** -* @brief SVC handler process function -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief SVC handler process function + * @return 0: Function not found in SVc table, Otherwise: Function address for hardware patching + **************************************************************************************** + */ uint32_t SVC_handler_proc(uint32_t *svc_args); - -/** -**************************************************************************************** -* @brief Register FPB patch enable function -* @param[in] patch_enable_func : pointer of function -* @retval : void -**************************************************************************************** -*/ + + /** + **************************************************************************************** + * @brief Register FPB patch enable function + * @param[in] patch_enable_func : pointer of function + **************************************************************************************** + */ void fpb_register_patch_init_func(fun_t patch_enable_func); -/** -**************************************************************************************** -* @brief FPB init function -* @param[in] fpb_mode : the mode of FPB -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief FPB init function + * @param[in] fpb_mode : the mode of FPB + **************************************************************************************** + */ void fpb_init(fpb_mode_t fpb_mode); -/** -**************************************************************************************** -* @brief svc sub-function register -* @param[in] svc_num : the number of svc -* @param[in] func : sub-function callback -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief svc sub-function register + * @param[in] svc_num : the number of svc + * @param[in] func : sub-function callback + **************************************************************************************** + */ void svc_func_register(uint8_t svc_num, uint32_t func); -/** -**************************************************************************************** -* @brief register sve table function -* @param[in] p_svc_table : the pointer of sve table -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief register sve table function + * @param[in] p_svc_table : the pointer of sve table + **************************************************************************************** + */ void svc_table_register(uint32_t *p_svc_table); /** **************************************************************************************** * @brief register fpb space from user layer * @param[in] user_fpb_space : the pointer of fpb user space - * @retval : void **************************************************************************************** */ void fpb_register_user_space(uint32_t *user_fpb_space); -/** -**************************************************************************************** -* @brief save the FPB state -* -* @retval : FPB state -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief save the FPB state + * + * @returns FPB state ::fpb_state_t + **************************************************************************************** + */ fpb_state_t fpb_save_state(void); -/** -**************************************************************************************** -* @brief load the FPB state -* @param[in] state : the FPB state that needs to be loaded -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief load the FPB state + * @param[in] state : the FPB state that needs to be loaded + **************************************************************************************** + */ void fpb_load_state(fpb_state_t state); /** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_nvds.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_nvds.h old mode 100755 new mode 100644 index 1d95918..3066467 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_nvds.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_nvds.h @@ -39,11 +39,11 @@ * @addtogroup SYSTEM * @{ */ -/** - @addtogroup NVDS Non-Volatile Data Storage - @{ - @brief Definitions and prototypes for the NVDS interface. -*/ + /** + @addtogroup NVDS Non-Volatile Data Storage + @{ + @brief Definitions and prototypes for the NVDS interface. + */ #ifndef __GR55XX_NVDS_H__ #define __GR55XX_NVDS_H__ @@ -55,22 +55,18 @@ * @{ */ #define NV_TAGCAT_APP 0x4000 /**< NVDS tag mask for user application. */ -/** @brief Get NVDS tag for user application. +/**@brief Get NVDS tag for user application. * The values of Tag 0x0000 and 0xFFFF are invalid. idx should not be used * as the parameter of NVDS APIs directly. The range of idx is 0x0001~0x3FFF. */ -static inline uint32_t ble_nv_tag_app(uint32_t idx) -{ - return (NV_TAGCAT_APP | ((idx) & 0x3FFF)); -} - -#define NV_TAG_APP(idx) ble_nv_tag_app(idx) +#define NV_TAG_APP(idx) (NV_TAGCAT_APP | ((idx) & 0x3FFF)) /** @} */ -/** @addtogroup NVDS_ENUMERATIONS Enumerations +/**@addtogroup NVDS_ENUMERATIONS Enumerations * @{ */ -/** @brief NVDS Returned Status. */ -enum NVDS_STATUS { +/**@brief NVDS Returned Status. */ +enum NVDS_STATUS +{ NVDS_SUCCESS, /**< NVDS succeeds. */ NVDS_FAIL, /**< NVDS failed. */ NVDS_TAG_NOT_EXISTED, /**< NVDS tag does not exist. */ @@ -80,17 +76,17 @@ enum NVDS_STATUS { NVDS_INVALID_START_ADDR, /**< NVDS invalid start address. */ NVDS_INVALID_SECTORS, /**< NVDS invalid sector. */ NVDS_COMPACT_FAILED, /**< NVDS failed to compact sectors. */ - NVDS_STORAGE_ACCESS_FAILED, /**< NVDS failed to access storage. */ + NVDS_STORAGE_ACCESS_FAILED , /**< NVDS failed to access storage. */ NVDS_GC_COMPLETE, /**< NVDS garbage collection complete. */ NVDS_NOT_INIT, /**< NVDS not initialize. */ NVDS_POINTER_NULL /**< NVDS or driver function repalce error: NULL. */ }; /** @} */ -/** @addtogroup NVDS_STRUCTURES Structures +/**@addtogroup NVDS_STRUCTURES Structures * @{ */ -/** @brief NVDS Item tag. */ -typedef unsigned short NvdsTag_t; +/**@brief NVDS Item tag. */ +typedef uint16_t NvdsTag_t; /** @} */ /** @addtogroup NVDS_FUNCTIONS Functions @@ -113,6 +109,24 @@ typedef unsigned short NvdsTag_t; */ uint8_t nvds_init(uint32_t start_addr, uint8_t sectors); +/** @addtogroup NVDS_FUNCTIONS Functions + * @{ */ +/** + **************************************************************************************** + * @brief De-initialize the sectors for NVDS. + * + * @note nvds_deinit will erase the flash sectors. + * + * @param[in] start_addr: Start address of NVDS area. If the value does not equal zero, + it must be sector-aligned. If the value equals zero, + NVDS area will locate in the last sector(s) in flash memory. + * @param[in] sectors: The number of sectors. + * + * @return Result of nvds deinit. + **************************************************************************************** + */ +uint8_t nvds_deinit(uint32_t start_addr, uint8_t sectors); + /** **************************************************************************************** * @brief Read data from NVDS. @@ -132,7 +146,7 @@ uint8_t nvds_get(NvdsTag_t tag, uint16_t *p_len, uint8_t *p_buf); * @brief Write data to NVDS. If the tag does not exist, create one. * * @param[in] tag: Valid NVDS item tag. - * @param[in] len: Length of data to be written. + * @param[in] len: Length of data to be written, the max length of data is 1024 bytes. * @param[in] p_buf: Data to be written. * * @return ::NVDS_SUCCESS: if successful. @@ -168,7 +182,7 @@ uint16_t nvds_tag_length(NvdsTag_t tag); /** @addtogroup LOCAL_FLASH_FUNCTIONS Local Flash Functions * @{ */ -/** @brief Flash operation API based on hal flash.*/ +/**@brief Flash operation API based on hal flash.*/ /** **************************************************************************************** * @brief Erase flash chip. @@ -257,7 +271,7 @@ void local_hal_flash_set_security(bool enable); /** ******************************************************************************* - * @brief Write flash Memory reliably. + * @brief Write flash Memory reliably. * * @note It's possible that the data was not written into Flash Memory * successfully. This function reads the data from Flash Memory to check diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_pwr.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_pwr.h old mode 100755 new mode 100644 index 840f5d0..54bbed1 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_pwr.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_pwr.h @@ -39,7 +39,7 @@ * @addtogroup SYSTEM * @{ */ - + /** * @addtogroup PWR Power Manager * @{ @@ -61,108 +61,114 @@ * @{ */ -/** @brief power manager setting parameter. - * Use pwr_mgmt_var_set to transfer the parameters in the structure to PMU, +/**@brief power manager setting parameter. + * Use pwr_mgmt_var_set to transfer the parameters in the structure to PMU, * and then the pwr_mgmt_mode_set function will use the new parameters for * power management. - * Note that this is an advanced API, the wrong setting of parameters may + * Note that this is an advanced API, the wrong setting of parameters may * lead to abnormal power management, so please use it carefully. */ -typedef struct { +typedef struct +{ uint32_t pwr_mgmt_app_timer_thrd; /**< App timer threshold. */ uint32_t pwr_mgmt_ble_core_thrd; /**< BLE timer threshold. */ uint32_t pwr_mgmt_rtc_timer_thrd; /**< RTC timer threshold. */ } pwr_mgmt_var_box_t; -/** @brief power manager boot type. */ -typedef enum { +/**@brief power manager boot type. */ +typedef enum +{ COLD_BOOT = 0, /**< Cold boot state. */ WARM_BOOT, /**< Warm boot state. */ } boot_mode_t; -/** @brief power manager model. */ -typedef enum { +/**@brief power manager model. */ +typedef enum +{ PMR_MGMT_ACTIVE_MODE = 0x0, /**< Full speed state. */ PMR_MGMT_IDLE_MODE, /**< Idle state. */ PMR_MGMT_SLEEP_MODE, /**< Deep sleep state. */ } pwr_mgmt_mode_t; -/** @brief power manager device work state. */ -typedef enum { +/**@brief power manager device work state. */ +typedef enum +{ DEVICE_BUSY = 0x0, /**< Device busy state. */ DEVICE_IDLE, /**< Device idle state. */ } pwr_mgmt_dev_state_t; -/** @brief power manager app timer work state. */ -typedef enum { +/**@brief power manager app timer work state. */ +typedef enum +{ EVENT_APP_TIMER_START = 0, /**< App-timer start state. */ EVENT_APP_TIMER_STOP, /**< App-timer stop state. */ } notify_timer_event_t; -/** @brief PMU Tracking*/ -enum { - TRC_PWR_WFE_MODE = 0, /**< WFE mode. */ - TRC_PWR_DSLEEP_MODE, /**< Deep sleep mode. */ - TRC_PWR_ACTIVE_MODE, /**< Active mode. */ - TRC_PWR_BLE_RET_DSLEEP, /**< BLE return deep sleep. */ - TRC_PWR_APP_TIMER_REFUSE, /**< App timer refuse. */ - TRC_PWR_APP_TIMER_PASS, /**< App timer pass. */ - TRC_PWR_BLE_TIMER_PASS, /**< BLE timer pass. */ +/**@brief PMU Tracking*/ +enum +{ + TRC_PWR_WFE_MODE = 0, /**< WFE mode. */ + TRC_PWR_DSLEEP_MODE, /**< Deep sleep mode. */ + TRC_PWR_ACTIVE_MODE, /**< Active mode. */ + TRC_PWR_BLE_RET_DSLEEP, /**< BLE return deep sleep. */ + TRC_PWR_APP_TIMER_REFUSE, /**< App timer refuse. */ + TRC_PWR_APP_TIMER_PASS, /**< App timer pass. */ + TRC_PWR_BLE_TIMER_PASS, /**< BLE timer pass. */ }; -/** @brief parameter configuration table. */ -typedef struct { - uint16_t pwr_dur; /**< Duration. */ - uint16_t pwr_ext; /**< External wake-up. */ - uint16_t pwr_osc; /**< OSC. */ - uint8_t pwr_delay_hslot; /**< Delay half slot. */ - uint16_t pwr_delay_hus; /**< Delay half us. */ - uint16_t pwr_push_hus; /**< Push half us. */ - uint32_t pwr_timer_ths; /**< APP timer threshold. */ - uint32_t pwr_ble_ths; /**< BLE timer threshold. */ -} pwr_table_t; +/**@brief parameter configuration table. */ +typedef struct +{ + uint16_t pwr_dur; /**< Duration. */ + uint16_t pwr_ext; /**< External wake-up. */ + uint16_t pwr_osc; /**< OSC. */ + uint8_t pwr_delay_hslot; /**< Delay half slot. */ + uint16_t pwr_delay_hus; /**< Delay half us. */ + uint16_t pwr_push_hus; /**< Push half us. */ + uint32_t pwr_timer_ths; /**< APP timer threshold. */ + uint32_t pwr_ble_ths; /**< BLE timer threshold. */ +} pwr_table_t; -/** @brief Trace function type. */ +/**@brief Trace function type. */ typedef void (*trace_func_t)(uint8_t); -/** @brief Peripheral function type. */ +/**@brief Peripheral function type. */ typedef void (*periph_func_t)(void); -/** @brief Before sleep function type. */ +/**@brief Before sleep function type. */ typedef void (*pwr_before_sleep_func_t)(void); -/** @brief Device check function type. */ +/**@brief Device check function type. */ typedef pwr_mgmt_dev_state_t (*pwr_dev_check_func_t)(void); -/** @brief function registered to dump io configuration. */ +/**@brief function registered to dump io configuration. */ typedef void (*io_dump_func_t)(void); -/** @brief mem check process type. */ +/**@brief mem check process type. */ typedef void (*mem_check_proc_t)(void); -/** @brief pwr table. */ -#define MAX_PWR_TABLE_LEN 12 -extern pwr_table_t pwr_table[MAX_PWR_TABLE_LEN]; - +/**@brief pwr table. */ +extern pwr_table_t pwr_table[]; + /** @} */ /** @addtogroup GR55XX_PWR_FUNCTIONS Functions * @{ */ /** ***************************************************************************************** - * @brief This function allows ARM to enter deep sleep mode, but users should not use this + * @brief This function allows ARM to enter deep sleep mode, but users should not use this * function directly. - * Note that this function is only available in environments where non-RTOS is used, + * Note that this function is only available in environments where non-RTOS is used, * and that users can only execute it while in main.c. - * @retval : pwr_mgmt_mode_t + * @return Power Management Mode :: pwr_mgmt_mode_t ***************************************************************************************** */ pwr_mgmt_mode_t pwr_mgmt_shutdown(void); /** **************************************************************************************** - * @brief Get the current boot mode. - * @retval : cold boot or warm boot. + * @brief Get the current boot mode. + * @return Boot Mode ::boot_mode_t **************************************************************************************** */ boot_mode_t pwr_mgmt_get_wakeup_flag(void); @@ -171,7 +177,6 @@ boot_mode_t pwr_mgmt_get_wakeup_flag(void); **************************************************************************************** * @brief Mark the mode of next boot, cold boot or warm boot. * @param[in] boot_mode : cold boot or warm boot. - * @retval : void **************************************************************************************** */ void pwr_mgmt_set_wakeup_flag(boot_mode_t boot_mode); @@ -179,45 +184,45 @@ void pwr_mgmt_set_wakeup_flag(boot_mode_t boot_mode); /** **************************************************************************************** * @brief Set the specified sleep mode. When the setting is completed, the system will - * automatically enter the specified sleep mode through the strategy. + * automatically enter the specified sleep mode through the strategy. * @param[in] pm_mode : sleep level - * @retval : void **************************************************************************************** */ void pwr_mgmt_mode_set(pwr_mgmt_mode_t pm_mode); /** **************************************************************************************** - * @brief Get the specified sleep mode. - * @retval : pwr_mgmt_mode_t + * @brief Get the specified sleep mode. + * @return Power Management Mode :: pwr_mgmt_mode_t **************************************************************************************** */ pwr_mgmt_mode_t pwr_mgmt_mode_get(void); /** **************************************************************************************** - * @brief Get the power state of baseband. - * @retval : pwr_mgmt_mode_t + * @brief Get the power state of baseband. + * @return Power Management Mode :: pwr_mgmt_mode_t **************************************************************************************** */ pwr_mgmt_mode_t pwr_mgmt_baseband_state_get(void); /** **************************************************************************************** - * @brief Get the state of extenal timer. - * @retval : pwr_mgmt_mode_t + * @brief Get the state of extenal timer. + * @return Power Management Mode :: pwr_mgmt_mode_t **************************************************************************************** */ pwr_mgmt_mode_t pwr_mgmt_check_ext_timer(void); + + /** **************************************************************************************** * @brief Sleep Policy Scheduling Function. * Note that: - * 1. This function shall only be used in non-RTOS environments; + * 1. This function shall only be used in non-RTOS environments; * 2. This function shall only be used in main function; * 3. Local variables shall not be used in main function when this api used. - * @retval : void **************************************************************************************** */ void pwr_mgmt_schedule(void); @@ -225,12 +230,10 @@ void pwr_mgmt_schedule(void); /** **************************************************************************************** * @brief Wake the BLE core via an external request. - * @return status - * @retval The status of the requested operation. - * - * false, if the BLE core is not sleeping. - * true, if the BLE core was woken up successfully. - * + * @return The status of the requested operation. + * @retval False The BLE core is not sleeping. + * @retval True The BLE core was woken up successfully. + * **************************************************************************************** */ bool pwr_mgmt_ble_wakeup(void); @@ -239,18 +242,17 @@ bool pwr_mgmt_ble_wakeup(void); /** **************************************************************************************** * @brief Check whether there are ble events in the queue, and if so, handle them immediately. - * @retval : void **************************************************************************************** */ void pwr_mgmt_check_ble_event(void); + /** **************************************************************************************** - * @brief This function is used to push startup information in app timer. - * This information will optimize power management strategy. + * @brief This function is used to push startup information in app timer. + * This information will optimize power management strategy. * Note that this function is an advanced API and users should not use it directly. * @param[in] timer_event : EVENT_APP_TIMER_START or EVENT_APP_TIMER_STOP - * @retval : void **************************************************************************************** */ void pwr_mgmt_notify_timer_event(notify_timer_event_t timer_event); @@ -258,36 +260,34 @@ void pwr_mgmt_notify_timer_event(notify_timer_event_t timer_event); /** **************************************************************************************** * @brief Query the sleep mode that the current system can access. - * @retval : void + * @return Power Management Mode :: pwr_mgmt_mode_t **************************************************************************************** */ pwr_mgmt_mode_t pwr_mgmt_get_sleep_mode(void); + /** **************************************************************************************** * @brief Update wakeup param. - * @retval : void **************************************************************************************** */ void pwr_mgmt_update_wkup_param(void); /** **************************************************************************************** - * @brief Execution of this function allows ARM to enter the WFE state and exit the WFE + * @brief Execution of this function allows ARM to enter the WFE state and exit the WFE * state when an event or interrupt occurs. - * @retval : void **************************************************************************************** */ void pwr_mgmt_wfe_sleep(void); /** **************************************************************************************** - * @brief Execution of this function allows ARM to enter the ultra sleep state and wakeup + * @brief Execution of this function allows ARM to enter the ultra sleep state and wakeup * the chip when an event occurs. * @param time_ms : Specifies the wake-up time during ultra sleep. If time_ms is equal to 0, then sleep timer will not be enabled. This parameter must be a number between min_value = 0 and max_value = 131071 - * @retval : void **************************************************************************************** */ void pwr_mgmt_ultra_sleep(uint32_t time_ms); @@ -297,16 +297,14 @@ void pwr_mgmt_ultra_sleep(uint32_t time_ms); * @brief PMU Initialization Function. * @param p_pwr_table : PMU parameter configuration table. * @param sys_clk : the clock of system - * @return void **************************************************************************************** */ -void pwr_mgmt_init(pwr_table_t *p_pwr_table, mcu_clock_type_t sys_clk); +void pwr_mgmt_init( pwr_table_t *p_pwr_table, mcu_clock_type_t sys_clk); /** **************************************************************************************** * @brief Peripheral Controller Initialization Register interface. * @param p_periph_init : the pointer of device init function. - * @return void **************************************************************************************** */ void pwr_mgmt_dev_init(periph_func_t p_periph_init); @@ -314,7 +312,6 @@ void pwr_mgmt_dev_init(periph_func_t p_periph_init); /** **************************************************************************************** * @brief Device config resume interface. - * @return void **************************************************************************************** */ void pwr_mgmt_dev_resume(void); @@ -322,7 +319,7 @@ void pwr_mgmt_dev_resume(void); /** **************************************************************************************** * @brief Device config suspend interface. - * @return void + * @return Power Management Device state ::pwr_mgmt_dev_state_t **************************************************************************************** */ pwr_mgmt_dev_state_t pwr_mgmt_dev_suspend(void); @@ -332,7 +329,6 @@ pwr_mgmt_dev_state_t pwr_mgmt_dev_suspend(void); * @brief Mem state control under deep sleep & work state. * @param mem_sleep_state : control in deep sleep. * @param mem_work_state : control in work state. - * @return void **************************************************************************************** */ void pwr_mgmt_mem_ctl_set(uint32_t mem_sleep_state, uint32_t mem_work_state); @@ -342,69 +338,62 @@ void pwr_mgmt_mem_ctl_set(uint32_t mem_sleep_state, uint32_t mem_work_state); * @brief Set PMU callback function. * @param dev_check_fun : Device check callback function. * @param before_sleep_fun : Pre-execution callback function for deep sleep. - * @return void **************************************************************************************** */ void pwr_mgmt_set_callback(pwr_dev_check_func_t dev_check_fun, pwr_before_sleep_func_t before_sleep_fun); -/** -**************************************************************************************** -* @brief Set the wakeup source. -* @param[in] wakeup_source : -* PWR_WKUP_COND_EXT -* PWR_WKUP_COND_TIMER -* PWR_WKUP_COND_BLE -* PWR_WKUP_COND_CALENDAR -* PWR_WKUP_COND_BOD_FEDGE -* PWR_WKUP_COND_MSIO_COMP -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief Set the wakeup source. + * @param[in] wakeup_source : + * PWR_WKUP_COND_EXT + * PWR_WKUP_COND_TIMER + * PWR_WKUP_COND_BLE + * PWR_WKUP_COND_CALENDAR + * PWR_WKUP_COND_BOD_FEDGE + * PWR_WKUP_COND_MSIO_COMP + **************************************************************************************** + */ void pwr_mgmt_wakeup_source_setup(uint32_t wakeup_source); -/** -**************************************************************************************** -* @brief Clear the wakeup source. -* @param[in] wakeup_source : -* PWR_WKUP_COND_EXT -* PWR_WKUP_COND_TIMER -* PWR_WKUP_COND_BLE -* PWR_WKUP_COND_CALENDAR -* PWR_WKUP_COND_BOD_FEDGE -* PWR_WKUP_COND_MSIO_COMP -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief Clear the wakeup source. + * @param[in] wakeup_source : + * PWR_WKUP_COND_EXT + * PWR_WKUP_COND_TIMER + * PWR_WKUP_COND_BLE + * PWR_WKUP_COND_CALENDAR + * PWR_WKUP_COND_BOD_FEDGE + * PWR_WKUP_COND_MSIO_COMP + **************************************************************************************** + */ void pwr_mgmt_wakeup_source_clear(uint32_t wakeup_source); -/** -**************************************************************************************** -* @brief Save context function. -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief Save context function. + **************************************************************************************** + */ void pwr_mgmt_save_context(void); -/** -**************************************************************************************** -* @brief Load context function. -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief Load context function. + **************************************************************************************** + */ void pwr_mgmt_load_context(void); -/** -**************************************************************************************** -* @brief Disable nvic irq. -* @retval : void -**************************************************************************************** -*/ + /** + **************************************************************************************** + * @brief Disable nvic irq. + **************************************************************************************** + */ void pwr_mgmt_disable_nvic_irq(void); /** **************************************************************************************** * @brief Enable nvic irq. - * @retval : void **************************************************************************************** */ void pwr_mgmt_enable_nvic_irq(void); @@ -412,7 +401,6 @@ void pwr_mgmt_enable_nvic_irq(void); /** **************************************************************************************** * @brief Check nvic irq. - * @retval : void **************************************************************************************** */ bool pwr_mgmt_check_pend_irq(void); @@ -420,8 +408,7 @@ bool pwr_mgmt_check_pend_irq(void); /** **************************************************************************************** * @brief Trace function register. - * @param[in] trace_func: Trace function. - * @retval : void + * @param[in] trace_func: Trace function. **************************************************************************************** */ void pwr_mgmt_register_trace_func(trace_func_t trace_func); @@ -429,7 +416,7 @@ void pwr_mgmt_register_trace_func(trace_func_t trace_func); /** **************************************************************************************** * @brief function registered to dump io configuration. - * @retval : void + * @param[in] dump_func Pointer to IO configuration dump function **************************************************************************************** */ void pwr_mgmt_register_io_dump_func(io_dump_func_t dump_func); diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys.h old mode 100755 new mode 100644 index adabee8..41e0851 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys.h @@ -46,11 +46,14 @@ * @brief Definitions and prototypes for the system SDK interface. */ + + #ifndef __GR55XX_SYS_H__ #define __GR55XX_SYS_H__ #include "gr55xx_sys_cfg.h" #include "gr55xx_nvds.h" +#include "gr55xx_dfu.h" #include "gr55xx_pwr.h" #include "gr55xx_fpb.h" #include "ble.h" @@ -63,94 +66,95 @@ /** @addtogroup GR55XX_SYS_DEFINES Defines * @{ */ -#define SYS_INVALID_TIMER_ID 0xFF /**< Invalid system Timer ID. */ -#define SYS_BD_ADDR_LEN GAP_ADDR_LEN /**< Length of Bluetoth Device Address. */ -#define SYS_CHIP_UID_LEN 0x10 /**< Length of Bluetoth Chip UID. */ - -static inline uint8_t ble_sys_set_bd_addr(uint8_t *BD_ADDR_ARRAY) -{ - return nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY); -} - -#define SYS_SET_BD_ADDR(BD_ADDR_ARRAY) ble_sys_set_bd_addr(BD_ADDR_ARRAY) /**< NVDS put BD address. */ +#define SYS_INVALID_TIMER_ID 0xFF /**< Invalid system Timer ID. */ +#define SYS_BD_ADDR_LEN BLE_GAP_ADDR_LEN /**< Length of Bluetoth Device Address. */ +#define SYS_CHIP_UID_LEN 0x10 /**< Length of Bluetoth Chip UID. */ +#define SYS_SET_BD_ADDR(BD_ADDR_ARRAY) nvds_put(0xC001, SYS_BD_ADDR_LEN, BD_ADDR_ARRAY) /**< NVDS put BD address. */ +#define SYS_ROM_VERSION_ADDR 0x45000 /**< The rom version address. */ /** @} */ /** * @defgroup GR55XX_SYS_TYPEDEF Typedefs * @{ */ -/** @brief The function pointers to register event callback. */ +/**@brief The function pointers to register event callback. */ typedef void (*callback_t)(int); /** @brief Timer callback type. */ typedef void (*timer_callback_t)(uint8_t timer_id); -/** @brief Printf callback type. */ +/**@brief Printf callback type. */ typedef int (*vprintf_callback_t) (const char *fmt, va_list argp); -/** @brief Low power clock update function type. */ +/**@brief Low power clock update function type. */ typedef void (*void_func_t)(void); -/** @brief Low power clock update function type with resturn. */ +/**@brief Low power clock update function type with resturn. */ typedef int (*int_func_t)(void); -/** @brief Function type for saving user context before deep sleep. */ +/**@brief Function type for saving user context before deep sleep. */ typedef void (*sys_context_func_t)(void); -/** @brief Error assert callback type. */ +/**@brief Error assert callback type. */ typedef void (*assert_err_cb_t)(const char *expr, const char *file, int line); -/** @brief Parameter assert callback type. */ +/**@brief Parameter assert callback type. */ typedef void (*assert_param_cb_t)(int param0, int param1, const char *file, int line); -/** @brief Warning assert callback type. */ +/**@brief Warning assert callback type. */ typedef void (*assert_warn_cb_t)(int param0, int param1, const char *file, int line); /** @} */ /** @addtogroup GR55XX_SYS_ENUMERATIONS Enumerations * @{ */ -/** @brief Definition of Device SRAM Size Enumerations. */ -typedef enum { +/**@brief Definition of Device SRAM Size Enumerations. */ +typedef enum +{ SYS_DEV_SRAM_64K = 0x02, /**< Supported 64K SRAM. */ SYS_DEV_SRAM_128K = 0x01, /**< Supported 128K SRAM. */ SYS_DEV_SRAM_256K = 0x00, /**< Supported 256K SRAM. */ } sram_size_t; -/** @brief package type. */ -typedef enum { +/**@brief package type. */ +typedef enum +{ PACKAGE_NONE = 0, /**< Package unused. */ PACKAGE_GR5515RGBD = 1, /**< BGA68 package. */ PACKAGE_GR5515GGBD = 2, /**< BGA55 package. */ - PACKAGE_GR5515IGND = 3, /**< QFN56 + 1024K flash package. */ - PACKAGE_GR5515I0ND = 4, /**< QFN56 + no flash package, support external high voltage flash only */ + PACKAGE_GR5515IGND = 3, /**< QFN56 + 1024KB flash package. */ + PACKAGE_GR5515I0ND = 4, /**< QFN56 + no flash package, support external high voltage flash only*/ PACKAGE_GR5513BEND = 5, /**< QFN40 + 128KB RAM + 512KB flash packet. */ PACKAGE_GR5515BEND = 6, /**< QFN40 + 256KB RAM + 512KB flash packet. */ - PACKAGE_GR5513BENDU = 7, /**< QFN40 + 256KB RAM + 512KB flash packet @1.7V ~ 3.6V. */ + PACKAGE_GR5513BENDU = 7, /**< QFN40 + 128KB RAM + 512KB flash packet @1.7V ~ 3.6V. */ PACKAGE_GR5515I0NDA = 8, /**< QFN56 + no flash package, support external high/low voltage flash */ + PACKAGE_GR5515IENDU = 9, /**< QFN56 + 512KB flash package */ } package_type_t; /** @} */ /** @addtogroup GR55XX_SYS_STRUCTURES Structures * @{ */ -/** @brief SDK version definition. */ -typedef struct { +/**@brief SDK version definition. */ +typedef struct +{ uint8_t major; /**< Major version. */ uint8_t minor; /**< Minor version. */ uint16_t build; /**< Build number. */ uint32_t commit_id; /**< commit ID. */ -} sdk_version_t; +}sdk_version_t; -/** @brief Assert callbacks.*/ -typedef struct { +/**@brief Assert callbacks.*/ +typedef struct +{ assert_err_cb_t assert_err_cb; /**< Assert error type callback. */ assert_param_cb_t assert_param_cb; /**< Assert parameter error type callback. */ assert_warn_cb_t assert_warn_cb; /**< Assert warning type callback. */ -} sys_assert_cb_t; +}sys_assert_cb_t; -/** @brief Link RX information definition. */ -typedef struct { +/**@brief Link RX information definition. */ +typedef struct +{ uint32_t rx_total_cnt; /**< Counts of RX times. */ uint32_t rx_sync_err_cnt; /**< Counts of RX sync error times. */ uint32_t rx_crc_err_cnt; /**< Counts of RX crc error times. */ @@ -160,34 +164,37 @@ typedef struct { uint32_t rx_normal_cnt; /**< Counts of RX normal times. */ } link_rx_info_t; -/** @brief RF trim parameter information definition. */ -typedef struct { +/**@brief RF trim parameter information definition. */ +typedef struct +{ int8_t rssi_cali; /**< RSSI calibration. */ int8_t tx_power; /**< TX power. */ } rf_trim_info_t; -/** @brief ADC trim parameter information definition. */ -typedef struct { - uint16_t adc_temp; /** < ADC TEMP. */ - uint16_t slope_int_0p8; /** < Internal reference 0.8v. */ - uint16_t offset_int_0p8; /** < Internal reference 0.8v. */ - uint16_t slope_int_1p2; /** < Internal reference 1.2v. */ - uint16_t offset_int_1p2; /** < Internal reference 1.2v. */ - uint16_t slope_int_1p6; /** < Internal reference 1.6v. */ - uint16_t offset_int_1p6; /** < Internal reference 1.6v. */ - uint16_t slope_int_2p0; /** < Internal reference 2.0v. */ - uint16_t offset_int_2p0; /** < Internal reference 2.0v. */ - uint16_t slope_ext_1p0; /** < External reference 1.0v. */ - uint16_t offset_ext_1p0; /** < External reference 1.0v. */ +/**@brief ADC trim parameter information definition. */ +typedef struct +{ + uint16_t adc_temp; /**< ADC TEMP. */ + uint16_t slope_int_0p8; /**< Internal reference 0.8v. */ + uint16_t offset_int_0p8; /**< Internal reference 0.8v. */ + uint16_t slope_int_1p2; /**< Internal reference 1.2v. */ + uint16_t offset_int_1p2; /**< Internal reference 1.2v. */ + uint16_t slope_int_1p6; /**< Internal reference 1.6v. */ + uint16_t offset_int_1p6; /**< Internal reference 1.6v. */ + uint16_t slope_int_2p0; /**< Internal reference 2.0v. */ + uint16_t offset_int_2p0; /**< Internal reference 2.0v. */ + uint16_t slope_ext_1p0; /**< External reference 1.0v. */ + uint16_t offset_ext_1p0; /**< External reference 1.0v. */ } adc_trim_info_t; -/** @brief PMU trim parameter information definition. */ -typedef struct { - uint8_t io_ldo_bypass; /** < IO LDO bypass */ - uint8_t io_ldo_vout; /** < IO LDO Vout. */ - uint8_t dig_ldo_64m; /** < DIG LDO 64m. */ - uint8_t dig_ldo_16m; /** < DIG LDO 16m */ - uint8_t dcdc_vout; /** < DCDC Vout */ +/**@brief PMU trim parameter information definition. */ +typedef struct +{ + uint8_t io_ldo_bypass; /**< IO LDO bypass */ + uint8_t io_ldo_vout; /**< IO LDO Vout. */ + uint8_t dig_ldo_64m; /**< DIG LDO 64m. */ + uint8_t dig_ldo_16m; /**< DIG LDO 16m */ + uint8_t dcdc_vout; /**< DCDC Vout */ } pmu_trim_info_t; /** @} */ @@ -240,7 +247,7 @@ void *sys_malloc(uint32_t size); * @param[in] p_mem: Pointer to memory block. ***************************************************************************************** */ -void sys_free(uint8_t *p_mem); +void sys_free(void *p_mem); /** ***************************************************************************************** @@ -376,12 +383,28 @@ uint16_t sys_crystal_trim_get(uint16_t *p_crystal_trim); /** ***************************************************************************************** - * @brief Jump to firmware and run. + * @brief app boot project turn on the encrypt clock. * - * @param[in] fw_addr: Firmware run address. ***************************************************************************************** */ -void sys_firmware_jump(uint32_t fw_addr); +void app_boot_turn_on_encrypt_clock(void); + +/** + ***************************************************************************************** + * @brief app boot project set the security clock. + * + ***************************************************************************************** + */ +void app_boot_security_clock_set(void); + +/** + ***************************************************************************************** + * @brief jump to app firmware. 69 + * + * @param[in] p_boot_info: Firmware system firmware information 71 + ***************************************************************************************** + */ +void sys_firmware_jump(dfu_boot_info_t *p_boot_info); /** ***************************************************************************************** @@ -449,9 +472,6 @@ uint16_t sys_device_sram_get(sram_size_t *p_sram_size); */ uint16_t sys_device_package_get(package_type_t *p_package_type); - -#if defined(GR5515_D) - /** ***************************************************************************************** * @brief Get the chip's IO LDO voltage. @@ -465,8 +485,6 @@ uint16_t sys_device_package_get(package_type_t *p_package_type); */ uint16_t sys_get_efuse_io_ldo(uint16_t *io_ldo); -#endif - /** ***************************************************************************************** * @brief Set low power CLK frequency. @@ -478,12 +496,12 @@ void sys_lpclk_set(uint32_t user_lpclk); /** **************************************************************************************** - * @brief Convert a duration in μs into a duration in lp cycles. + * @brief Convert a duration in us into a duration in lp cycles. * - * The function converts a duration in μs into a duration in lp cycles, according to the + * The function converts a duration in us into a duration in lp cycles, according to the * low power clock frequency (32768Hz or 32000Hz). * - * @param[in] us: Duration in μs. + * @param[in] us: Duration in us. * * @return Duration in lpcycles. **************************************************************************************** @@ -492,41 +510,50 @@ uint32_t sys_us_2_lpcycles(uint32_t us); /** **************************************************************************************** - * @brief Convert a duration in lp cycles into a duration in half μs. + * @brief Convert a duration in lp cycles into a duration in half us. * - * The function converts a duration in lp cycles into a duration in half μs, according to the + * The function converts a duration in lp cycles into a duration in half us, according to the * low power clock frequency (32768Hz or 32000Hz). * @param[in] lpcycles: Duration in lp cycles. - * @param[in,out] error_corr: Insert and retrieve error created by truncating the LP Cycle - * Time to a half μs (in half μs). + * @param[in,out] error_corr: Insert and retrieve error created by truncating the LP Cycle Time to a half us (in half us). * - * @return Duration in half μs + * @return Duration in half us **************************************************************************************** */ uint32_t sys_lpcycles_2_hus(uint32_t lpcycles, uint32_t *error_corr); +/** + ***************************************************************************************** + * @brief Reverse the policy for static address created by chip uuid . + * @note After sdk_v1.6.10, this policy has been updated. + * + ***************************************************************************************** + */ +void sys_ble_static_addr_policy_reverse(void); + /** ***************************************************************************************** * @brief Set BLE Sleep HeartBeat Period. * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE. * * @param[in] period_hus: The wake up duration of BLE when BLE is IDEL. - * Range 0x00000000-0xFFFFFFFF (in unit of μs). - * - * @retval SDK_SUCCESS: Operation is Success. + * Range 0x00000000-0xFFFFFFFF (in unit of us). + * + * @retval ::SDK_SUCCESS Operation is Success. ***************************************************************************************** */ uint16_t sys_ble_heartbeat_period_set(uint32_t period_hus); + /** ***************************************************************************************** * @brief Get BLE Sleep HeartBeat Period. * @note The BLE Sleep HeartBeat Period is used to Wakeup BLE Periodically when BLE is IDLE. * * @param[in] p_period_hus: Pointer to the wake up duration. - * Range 0x00000000-0xFFFFFFFF (in unit of μs). - * - * @retval SDK_SUCCESS: Operation is Success. + * Range 0x00000000-0xFFFFFFFF (in unit of us). + * + * @retval ::SDK_SUCCESS Operation is Success. ***************************************************************************************** */ uint16_t sys_ble_heartbeat_period_get(uint32_t* p_period_hus); @@ -700,7 +727,6 @@ void sys_swd_disable(void); /** **************************************************************************************** * @brief RTC calibration function. - * @retval : void **************************************************************************************** */ void rtc_calibration(void); @@ -709,7 +735,6 @@ void rtc_calibration(void); **************************************************************************************** * @brief RNG calibration function. * @note The function will call between platform_init_push and platform_init_pop. - * @retval : void **************************************************************************************** */ void rng_calibration(void); @@ -717,7 +742,7 @@ void rng_calibration(void); /** **************************************************************************************** * @brief Reverse byte order (32 bit). For example, 0x12345678 becomes 0x78563412. - * @retval : Reversed value + * @return Byte Reversed value **************************************************************************************** */ uint32_t sys_reverse_word(uint32_t value); @@ -725,7 +750,7 @@ uint32_t sys_reverse_word(uint32_t value); /** **************************************************************************************** * @brief Reverse byte order (16 bit). For example, 0x1234 becomes 0x3412. - * @retval : Reversed value + * @return Byte Reversed value **************************************************************************************** */ uint16_t sys_reverse_hword(uint16_t value); diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys_cfg.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys_cfg.h old mode 100755 new mode 100644 index 54ece0b..8fac421 --- a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys_cfg.h +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr55xx_sys_cfg.h @@ -35,17 +35,17 @@ ***************************************************************************************** */ -/** -* @addtogroup SYSTEM -* @{ -*/ - + /** + * @addtogroup SYSTEM + * @{ + */ + /** * @addtogroup SYS_CFG System Configuration * @{ * @brief Definitions and prototypes for SYS_CFG interface. */ - + #ifndef __GR55XX_SYS_CFG_H__ #define __GR55XX_SYS_CFG_H__ @@ -54,31 +54,33 @@ /** @addtogroup GR55XX_SYS_CFG_DEFINES Defines * @{ */ -#define ARRAY_EMPTY /** < Empty Array. */ +#define __ARRAY_EMPTY /**< Empty Array. */ /** @} */ /** * @defgroup GR55XX_SYS_CFG_STRUCT Structures * @{ */ -/** @brief BLE Sleep configure defination. */ -typedef struct { +/**@brief BLE Sleep configure defination. */ +typedef struct +{ uint8_t sleep_enable; /**< Sleep enable flag. */ uint8_t ext_wakeup_enable; /**< External wake-up support. */ uint16_t twosc; /**< Twosc delay. */ uint16_t twext; /**< Twext delay. */ uint16_t twrm; /**< Twrm delay. */ - uint16_t sleep_algo_dur; /**< Duration of sleep and wake-up algorithm - (depends on CPU speed) expressed in half us.. */ + uint16_t sleep_algo_dur; /**< Duration of sleep and wake-up algorithm (depends on CPU speed) expressed in half us.. */ } ble_slp_config_t ; -/** @brief BLE Scheduler configure defination. */ -typedef struct { +/**@brief BLE Scheduler configure defination. */ +typedef struct +{ uint8_t prog_delay; /**< Programme delay. */ } ble_sch_config_t; -/** @brief GR55XX Chip configure defination */ -typedef struct { +/**@brief GR55XX Chip configure defination */ +typedef struct +{ ble_slp_config_t ble_slp_cfg; /**< BLE Sleep configure. */ ble_sch_config_t ble_sch_cfg; /**< BLE Sch configure. */ } gr55xx_chip_config_t; diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr_includes.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr_includes.h new file mode 100644 index 0000000..4195d9e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/gr_includes.h @@ -0,0 +1,66 @@ +/** + ******************************************************************************* + * + * @file gr_includes.h + * + * @brief Include Files API + * + ******************************************************************************* + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/** + @addtogroup SYSTEM + @{ + */ + +/** + * @addtogroup SYS System SDK + * @{ + * @brief Definitions and prototypes for the system SDK interface. +*/ + +#ifndef __GR_INCLUDES_H__ +#define __GR_INCLUDES_H__ + + +#include "ble_cfg.h" +#include "ble.h" +#include "grx_soc_reg.h" +#include "grx_hal.h" +#include "grx_sys.h" +#include +#include +#include + + +/** @} */ +#endif + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/grx_sys.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/grx_sys.h new file mode 100644 index 0000000..acae82b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/grx_sys.h @@ -0,0 +1,67 @@ +/** + ******************************************************************************* + * + * @file gr55xx_sys.h + * + * @brief GR55XX System API + * + ******************************************************************************* + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/** + @addtogroup SYSTEM + @{ + */ + +/** + * @addtogroup SYS System SDK + * @{ + * @brief Definitions and prototypes for the system SDK interface. +*/ + +#ifndef __GRX_SYS_H__ +#define __GRX_SYS_H__ + +#include "gr55xx.h" +#include "gr55xx_hal.h" +#include "gr55xx_sys.h" +#include "gr55xx_fpb.h" +#include "gr55xx_nvds.h" +#include "gr55xx_pwr.h" +#include "gr55xx_dfu.h" + +#include +#include +#include + +/** @} */ +#endif + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/components/sdk/patch.h b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/patch.h new file mode 100644 index 0000000..528f008 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/components/sdk/patch.h @@ -0,0 +1,106 @@ +/** + ****************************************************************************** + * + * @file patch.h + * + * @brief offer the interface for the patch function based on the FPB of the cortex arm-m4; + * + ****************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +#ifndef __PATCH_H_ +#define __PATCH_H_ + +/* + * ENUMERATIONS + **************************************************************************************** + */ +enum +{ + BIT_HCI_SEND_2_CONTROLLER, + BIT_HAL_XQSPI_SET_XIP_PRESENT_STATUS, + BIT_LL_XQSPI_INIT, + BIT_HAL_EXFLASH_WRITE, + BIT_HAL_EXFLASH_ERASE, + BIT_HAL_EXFLASH_READ, + BIT_BLE_BM_SET_SEC_INFO, + BIT_KE_TASK_SCHEDULE, +}; + + +/* + * MACRO DECLARATIONS + **************************************************************************************** + */ +#define PATCH_ENABLE_FLAG(BIT) (1< +#include "grx_hal.h" +#include "app_io.h" +#include "app_qspi.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) +#include "app_qspi_user_config.h" +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_GRAPHICS_QSPI_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Read data block in Memory mapped Mode(XIP Mode), The Data is ordered by the order in flash/psram device + * + * @param[in] id : QSPI module ID. + * @param[in] address : the address of device connected to QSPI, start from 0x000000 + * @param[in] buffer : memory pointer to save the read data + * @param[in] length : the read length in byte + * @return true/false + **************************************************************************************** + */ +bool app_qspi_dma_mmap_read_block(app_qspi_id_t id, uint32_t address, uint8_t * buffer, uint32_t length); + +/** + **************************************************************************************** + * @brief Special Async API to write QuadSPI Screen from memory mapped device(flash or psram) + * Must enable the two micro-defines to enable this API: + * QSPI_ASYNC_SCROLL_DRAW_SCREEN_SUPPORT + * + * @param[in] screen_id: QSPI module ID for screen, MUST config screen qspi to register mode. + * @param[in] storage_id: QSPI module ID for storage, MUST config storage qspi to mmap(xip) mode. + * @param[in] p_screen_cmd: pointer to the screen control command + * @param[in] p_screen_info: pointer to the screen information + * @param[in] p_scroll_config: pointer to the scrolling-config + * @param[in] is_first_call: When called in foreground task, please set true + * @return true/false + **************************************************************************************** + */ +bool app_qspi_async_draw_screen(app_qspi_id_t screen_id, + app_qspi_id_t storage_id, + const app_qspi_screen_command_t * const p_screen_cmd, + const app_qspi_screen_info_t * const p_screen_info, + app_qspi_screen_scroll_t * p_scroll_config, + bool is_first_call); + +/** + **************************************************************************************** + * @brief Special Async API to write Screen in vertical direction, and veritical lines are organized in linked list. + * Must enable the two micro-defines to enable this API: + * QSPI_ASYNC_VERI_LINK_DRAW_SCREEN_SUPPORT + * + * @param[in] screen_id: QSPI module ID for screen, MUST config screen qspi to register mode. + * @param[in] storage_id: QSPI module ID for storage, MUST config storage qspi to mmap(xip) mode. + * @param[in] p_screen_cmd: pointer to the screen control command + * @param[in] p_screen_info: pointer to the screen information + * @param[in] p_link_scroll: pointer to the linked list structure + * @param[in] is_first_call: When called in foreground task, please set true + * @return true/false + **************************************************************************************** + */ +bool app_qspi_async_veri_draw_screen(app_qspi_id_t screen_id, + app_qspi_id_t storage_id, + const app_qspi_screen_command_t * const p_screen_cmd, + const app_qspi_screen_info_t * const p_screen_info, + app_qspi_screen_veri_link_scroll_t * p_link_scroll, + bool is_first_call); + +/** + **************************************************************************************** + * @brief Special Async API to write one block of the Screen by DMA-LLP, every line of the block is organized in linked list. + * Must enable the micro-defines to enable this API: + * QSPI_ASYNC_VERI_LINK_DRAW_SCREEN_SUPPORT + * + * @param[in] screen_id: QSPI module ID for screen, MUST config screen qspi to register mode. + * @param[in] storage_id: QSPI module ID for storage, MUST config storage qspi to mmap(xip) mode. + * @param[in] p_screen_cmd: pointer to the screen control command + * @param[in] p_screen_info: pointer to the screen information + * @param[in] p_block_info: pointer to the block information structure + * @param[in] is_first_call: When first call, please set true(used this flag to decide whether send cmd or not) + * @return true/false + * @NOTE You need to control the CS outsize if (is_one_take_cs) is set true + * @NOTE It will generate APP_QSPI_EVT_TX_CPLT event when finish transmission. + **************************************************************************************** + */ +bool app_qspi_async_llp_draw_block(app_qspi_id_t screen_id, + app_qspi_id_t storage_id, + const app_qspi_screen_command_t *const p_screen_cmd, + const app_qspi_screen_info_t *const p_screen_info, + app_qspi_screen_block_t *p_block_info, + bool is_first_call); +/** + **************************************************************************************** + * @brief Special API to Blit Image from memory mapped device to RAM Buffer + * Must enable the two micro-defines to enable this API: + * QSPI_BLIT_RECT_IMAGE_SUPPORT + * + * @param[in] storage_id : QSPI module ID for storage, MUST config storage qspi to mmap(xip) mode. + * @param[in] p_blit_config : pointer to blit config + * @param[in] xfer_type : pointer to the scrolling-config + * @return true/false + **************************************************************************************** + */ +bool app_qspi_mmap_blit_image(app_qspi_id_t storage_id, blit_image_config_t * p_blit_config, blit_xfer_type_e xfer_type); +/** @} */ + +#ifdef __cplusplus +} +#endif +#endif +#endif +#endif +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c.h new file mode 100644 index 0000000..745c370 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c.h @@ -0,0 +1,457 @@ +/** + **************************************************************************************** + * + * @file app_i2c.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2C app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_IIC IIC + * @brief IIC APP module driver. + * @{ + */ + + +#ifndef _APP_I2C_H_ +#define _APP_I2C_H_ + +#include "grx_hal.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_I2C_MODULE_ENABLED + +/** @addtogroup APP_I2C_ENUM Enumerations + * @{ + */ + +/** + * @brief I2C module Enumerations definition + */ +typedef enum +{ + APP_I2C_ID_0, /**< I2C module 0. */ + APP_I2C_ID_1, /**< I2C module 1. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + APP_I2C_ID_2, /**< I2C module 2. */ + APP_I2C_ID_3, /**< I2C module 3. */ +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + APP_I2C_ID_4, /**< I2C module 4. */ + APP_I2C_ID_5, /**< I2C module 5. */ +#endif + APP_I2C_ID_MAX /**< Only for check parameter, not used as input parameters. */ +} app_i2c_id_t; + +/** + * @brief I2C role Enumerations definition + */ +typedef enum +{ + APP_I2C_ROLE_MASTER, /**< I2C master device. */ + APP_I2C_ROLE_SLAVE, /**< I2C slave device. */ + APP_I2C_ROLE_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_i2c_role_t; + +/** + * @brief I2C event Enumerations definition + */ +typedef enum +{ + APP_I2C_EVT_ERROR, /**< Error reported by I2C peripheral. */ + APP_I2C_EVT_TX_CPLT, /**< Requested TX transfer completed. */ + APP_I2C_EVT_RX_DATA, /**< Requested RX transfer completed. */ + APP_I2C_ABORT, /**< abort reported by I2C peripheral. */ +} app_i2c_evt_type_t; +/** @} */ + +/** @addtogroup APP_I2C_STRUCTURES Structures + * @{ + */ +/** + * @brief I2C pins Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of SPI IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ +} app_i2c_pin_t; + +/** + * @brief I2C pins config Structures + */ +typedef struct +{ + app_i2c_pin_t scl; /**< Set the configuration of I2C SCL pin. */ + app_i2c_pin_t sda; /**< Set the configuration of I2C SDA pin. */ +} app_i2c_pin_cfg_t; + +/** + * @brief I2C operate mode Enumerations definition + */ +typedef struct +{ + dma_regs_t *tx_dma_instance;/**< Specifies the TX DMA instance.*/ + dma_regs_t *rx_dma_instance;/**< Specifies the RX DMA instance.*/ + dma_channel_t tx_dma_channel; /**< Specifies the dma channel of I2C TX. */ + dma_channel_t rx_dma_channel; /**< Specifies the dma channel of I2C RX. */ +} app_i2c_dma_cfg_t; + +/** + * @brief I2C event structure definition + */ +typedef struct +{ + app_i2c_evt_type_t type; /**< Type of event. */ + union + { + uint32_t error_code; /**< I2C Error code . */ + uint16_t size; /**< I2C transmitted/received counter. */ + } data; /**< Data of event. */ + uint16_t slave_addr; /**< I2C slave address. */ +} app_i2c_evt_t; + +/**@brief App i2c state types. */ +typedef enum +{ + APP_I2C_INVALID = 0, + APP_I2C_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_I2C_SLEEP, +#endif +} app_i2c_state_t; + +/**@brief App i2c dma state types. */ +typedef enum +{ + APP_I2C_DMA_INVALID = 0, + APP_I2C_DMA_ACTIVITY, +} app_i2c_dma_state_t; + +/** + * @brief I2C event callback definition + */ +typedef void (*app_i2c_evt_handler_t)(app_i2c_evt_t *p_evt); + +/** @} */ + +/** + * @brief I2C device structure definition + */ +typedef struct +{ + app_i2c_evt_handler_t evt_handler; /**< I2C event callback definition. */ + i2c_handle_t handle; /**< I2C handle definition. */ + app_i2c_role_t role; /**< I2C role Enumerations definition. */ + app_i2c_pin_cfg_t *p_pin_cfg; /**< I2C pins config Structures. */ + dma_id_t dma_id[2]; /**< DMA id definition. */ + app_i2c_state_t i2c_state; /**< I2C state types. */ + app_i2c_dma_state_t i2c_dma_state; /**< I2C dma state types. */ + volatile bool start_flag; /**< Start flag definition. */ + uint16_t slv_dev_addr; /**< I2C Slave address. */ +} i2c_env_t; + +/** + * @brief I2C parameters structure definition + */ +typedef struct +{ + app_i2c_id_t id; /**< specified I2C module ID. */ + app_i2c_role_t role; /**< specified the role of I2C. */ + app_i2c_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified I2C module. */ + app_i2c_dma_cfg_t dma_cfg; /**< I2C operate mode. */ + i2c_init_t init; /**< I2C communication parameters. */ + i2c_env_t i2c_dev; /**< I2C device structure definition. */ +} app_i2c_params_t; + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_I2C_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP I2C DRIVER according to the specified parameters + * in the app_i2c_params_t and app_i2c_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_i2c_params_t parameter which contains the + * configuration information for the specified I2C module. + * @param[in] evt_handler: I2C user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_i2c_init(app_i2c_params_t *p_params, app_i2c_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP I2C DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_i2c_deinit(app_i2c_id_t id); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which I2C module want to receive. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_receive_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] id: which I2C module want to receive. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which I2C module want to transmit. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_transmit_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] id: which I2C module want to transmit. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data in blocking mode from a specific memory address + * + * @param[in] id: which I2C module want to read. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_mem_read_sync(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address + * + * @param[in] id: which I2C module want to read. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Write an amount of data in blocking mode to a specific memory address + * + * @param[in] id: which I2C module want to write. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_mem_write_sync(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address + * + * @param[in] id: which I2C module want to write. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Return the I2C handle. + * + * @param[in] id: I2C Channel ID. + * + * @return Pointer to the specified ID's I2C handle. + **************************************************************************************** + */ +i2c_handle_t *app_i2c_get_handle(app_i2c_id_t id); + +/** + **************************************************************************************** + * @brief Abort a master I2C IT or DMA process communication with Interrupt + * + * @param[in] id: I2C Channel ID. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_master_abort_it(app_i2c_id_t id); + +/** + **************************************************************************************** + * @brief Adjust I2C timing value to adapt to real load. + * + * @param[in] id: I2C Channel ID. + * @param[in] timing_type: Timing type. See I2C_Timing_type. + * @param[in] delta: timing change value(unit: I2C work clock cycles). + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_timing_adjust(app_i2c_id_t id, uint32_t timing_type, int32_t delta); + +/** + **************************************************************************************** + * @brief Get I2C timing value. + * + * @param[in] id: I2C Channel ID. + * @param[in] timing_type: Timing type. See I2C_Timing_type. + * @param[in] p_timing_value: Pointer of I2C timing value(unit: I2C work clock cycles). + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_timing_get(app_i2c_id_t id, uint32_t timing_type, uint32_t *p_timing_value); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Transmits than receives in master mode or receives than transmits in slave mode with only one stop bit. + * + * @param[in] id: which I2C module want to transmit. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_tdata: Pointer to transmited data buffer + * @param[in] tsize: Amount of data to be sent + * @param[in] p_rdata: Pointer to received data buffer + * @param[in] rsize: Amount of data to be receive + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_transmit_receive_sync(app_i2c_id_t id, uint16_t dev_address, uint8_t *p_tdata, uint16_t tsize, uint8_t *p_rdata, uint16_t rsize, uint32_t timeout); +#endif + +/** @} */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c_dma.h new file mode 100644 index 0000000..0374048 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2c_dma.h @@ -0,0 +1,179 @@ +/** + **************************************************************************************** + * + * @file app_i2c_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2C app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_IIC IIC + * @brief IIC APP module driver. + * @{ + */ + + +#ifndef _APP_I2C_DMA_H_ +#define _APP_I2C_DMA_H_ + +#include "grx_hal.h" +#include "app_io.h" +#include "app_i2c.h" +#include "app_drv_error.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_I2C_MODULE_ENABLED + +/** @addtogroup APP_I2C_ENUM Enumerations + * @{ + */ + + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_I2C_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP I2C DRIVER according to the specified parameters + * in the app_i2c_params_t and app_i2c_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_i2c_params_t parameter which contains the + * configuration information for the specified I2C module. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_i2c_dma_init(app_i2c_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize the APP I2C DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_i2c_dma_deinit(app_i2c_id_t id); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] id: which I2C module want to receive. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_dma_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] id: which I2C module want to transmit. + * @param[in] target_address: Target device address: The device 7 bits address value in datasheet + must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_dma_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data in non-blocking mode with Interrupt/DMA from a specific memory address + * + * @param[in] id: which I2C module want to read. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_dma_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Write an amount of data in non-blocking mode with Interrupt/DMA to a specific memory address + * + * @param[in] id: which I2C module want to write. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2c_dma_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** @} */ +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s.h new file mode 100644 index 0000000..12d31b3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s.h @@ -0,0 +1,431 @@ +/** + **************************************************************************************** + * + * @file app_i2s.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2S app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_I2S I2S + * @brief I2S APP module driver. + * @{ + */ + + +#ifndef _APP_I2S_H_ +#define _APP_I2S_H_ + +#include +#include "grx_hal.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_drv_error.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_I2S_MODULE_ENABLED + +/** @addtogroup APP_I2S_ENUM Enumerations + * @{ + */ + +/** + * @brief I2S module Enumerations definition + */ +typedef enum +{ + APP_I2S_ID_SLAVE, /**< I2S slave module. */ + APP_I2S_ID_MASTER, /**< I2S master module. */ + APP_I2S_ID_MAX /**< Only for check parameter, not used as input parameters. */ +} app_i2s_id_t; + +/** + * @brief I2S event Enumerations definition + */ +typedef enum +{ + APP_I2S_EVT_ERROR, /**< Error reported by UART peripheral. */ + APP_I2S_EVT_TX_CPLT, /**< Requested TX transfer completed. */ + APP_I2S_EVT_RX_DATA, /**< Requested RX transfer completed. */ + APP_I2S_EVT_TX_RX, /**< Requested TX/RX transfer completed. */ +} app_i2s_evt_type_t; +/** @} */ + + +/** @addtogroup APP_I2S_STRUCTURES Structures + * @{ + */ + +/** + * @brief I2S pins Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of I2S IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ +} app_i2s_pin_t; + +/** + * @brief I2S pins config Structures + */ +typedef struct +{ + app_i2s_pin_t ws; /**< Set the configuration of I2S WS pin. */ + app_i2s_pin_t sdo; /**< Set the configuration of I2S SDO pin. */ + app_i2s_pin_t sdi; /**< Set the configuration of I2S SDI pin. */ + app_i2s_pin_t sclk; /**< Set the configuration of I2S SCLK pin. */ +} app_i2s_pin_cfg_t; + +/** + * @brief I2S operate mode Enumerations definition + */ +typedef struct +{ + dma_regs_t *tx_dma_instance;/**< Specifies the TX DMA inistall.*/ + dma_regs_t *rx_dma_instance;/**< Specifies the RX DMA inistall.*/ + dma_channel_t tx_dma_channel; /**< Specifies the dma channel of I2S TX. */ + dma_channel_t rx_dma_channel; /**< Specifies the dma channel of I2S RX. */ +} app_i2s_dma_cfg_t; + +/** + * @brief I2S event structure definition + */ +typedef struct +{ + app_i2s_evt_type_t type; /**< Type of event. */ + union + { + uint32_t error_code; /**< I2S Error code . */ + uint16_t size; /**< I2S transmitted/received counter. */ + } data; /**< Data of event. */ +} app_i2s_evt_t; + +/**@brief App i2s state types. */ +typedef enum +{ + APP_I2S_INVALID = 0, + APP_I2S_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_I2S_SLEEP, +#endif +} app_i2s_state_t; + + +/**@brief App i2s dma state types. */ +typedef enum +{ + APP_I2S_DMA_INVALID = 0, + APP_I2S_DMA_ACTIVITY, +} app_i2s_dma_state_t; + +/** + * @brief I2S event callback definition + */ +typedef void (*app_i2s_evt_handler_t)(app_i2s_evt_t *p_evt); + +/** @} */ + +/** + * @brief I2S device structure definition + */ +typedef struct +{ + app_i2s_evt_handler_t evt_handler; /**< I2S event callback definition. */ + i2s_handle_t handle; /**< I2S handle definition. */ + app_i2s_pin_cfg_t *p_pin_cfg; /**< I2S pins config Structures. */ + dma_id_t dma_id[2]; /**< DMA id definition. */ + app_i2s_state_t i2s_state; /**< I2S state types. */ + app_i2s_dma_state_t i2s_dma_state; /**< I2S dma state types.. */ + bool start_flag; /**< Start flag definition. */ +} i2s_env_t; + +/** + * @brief I2S parameters structure definition + */ +typedef struct +{ + app_i2s_id_t id; /**< specified I2S module ID. */ + app_i2s_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified I2S module. */ + app_i2s_dma_cfg_t dma_cfg; /**< I2S operate mode Enumerations definition. */ + i2s_init_t init; /**< I2S communication parameters. */ + i2s_env_t i2s_env; /**< I2S device structure definition. */ +} app_i2s_params_t; + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_I2S_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the APP I2S DRIVER according to the specified parameters + * in the app_i2s_params_t and app_i2s_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_i2s_params_t parameter which contains the + * configuration information for the specified I2S module. + * @param[in] evt_handler: I2S user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_i2s_init(app_i2s_params_t *p_params, app_i2s_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP I2S DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_i2s_deinit(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which I2S module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_receive_sync(app_i2s_id_t id, uint16_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which I2S module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which I2S module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_transmit_sync(app_i2s_id_t id, uint16_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which I2S module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Enable the I2S moudle. + * + * @param[in] id: The I2S module id. + * + * @return Result of operation. + **************************************************************************************** + */ + +uint16_t app_i2s_enable(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Disable the I2S moudle. + * + * @param[in] id: The I2S module id. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_disable(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Enable the master I2S clock. + * + * @param[in] id: The I2S master module id. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_enable_clock(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Disable the master I2S clock. + * + * @param[in] id: The I2S master module id. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_disable_clock(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Flush the I2S transmitter FIFO. + * + * @param[in] id: which I2S module want to flush. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_flush_tx_fifo(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Flush the I2S receiver FIFO. + * + * @param[in] id: which I2S module want to flush. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_flush_rx_fifo(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Return the I2S handle. + * + * @param[in] id: I2S Channel ID. + * + * @return Pointer to the specified ID's I2S handle. + **************************************************************************************** + */ +i2s_handle_t *app_i2s_get_handle(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (blocking mode). + * @param id I2S ID + * @note This procedure is executed in blocking mode: When exiting + * function, Abort is considered as completed. + * @retval ::APP_DRV_SUCCESS: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + * @retval ::APP_DRV_ERR_INVALID_PARAM: Parameter error. + **************************************************************************************** + */ +uint16_t app_i2s_abort(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in blocking mode. + * @param id I2S ID + * @param p_tx_data Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @param[in] timeout: Timeout duration + * @retval ::APP_DRV_SUCCESS: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + * @retval ::APP_DRV_ERR_INVALID_PARAM: Parameter error. + * @retval ::APP_DRV_ERR_BUSY: Driver is busy. + **************************************************************************************** + */ +uint16_t app_i2s_transmit_receive_sync(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length, + uint32_t timeout); +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] id: I2S ID + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @retval ::APP_DRV_SUCCESS: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + * @retval ::APP_DRV_ERR_INVALID_PARAM: Parameter error. + * @retval ::APP_DRV_ERR_BUSY: Driver is busy. + **************************************************************************************** + */ +uint16_t app_i2s_transmit_receive_async(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length); + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ +/** @} */ +/** @} */ + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s_dma.h new file mode 100644 index 0000000..77ba0d5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_i2s_dma.h @@ -0,0 +1,157 @@ +/** + **************************************************************************************** + * + * @file app_i2s_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2S app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_I2S I2S + * @brief I2S APP module driver. + * @{ + */ + + +#ifndef _APP_I2S_DMA_PUB_H_ +#define _APP_I2S_DMA_PUB_H_ + +#include "grx_hal.h" +#include "app_io.h" +#include "app_i2s.h" +#include "app_drv_error.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_I2S_MODULE_ENABLED + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_I2S_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the APP I2S DRIVER according to the specified parameters + * in the app_i2s_params_t and app_i2s_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_i2s_params_t parameter which contains the + * configuration information for the specified I2S module. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_i2s_dma_init(app_i2s_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize the APP I2S DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_i2s_dma_deinit(app_i2s_id_t id); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which I2S module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_dma_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which I2S module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_i2s_dma_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] id: I2S ID + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @retval ::APP_DRV_SUCCESS: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + * @retval ::APP_DRV_ERR_INVALID_PARAM: Parameter error. + * @retval ::APP_DRV_ERR_BUSY: Driver is busy. + **************************************************************************************** + */ +uint16_t app_i2s_dma_transmit_receive_async(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length); + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif +/** @} */ +/** @} */ +/** @} */ + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_io.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_io.h new file mode 100644 index 0000000..2c9bece --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_io.h @@ -0,0 +1,485 @@ +/** + **************************************************************************************** + * + * @file app_io.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of GPIO app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_GPIO GPIO + * @brief GPIO APP module driver. + * @{ + */ + + +#ifndef _APP_IO_H_ +#define _APP_IO_H_ + +#include "app_drv_error.h" +#include "app_drv_config.h" +#include + +/** @addtogroup APP_GPIO_PIN_DEFINES Defines + * @{ + */ +/** @addtogroup GR5xxx_pins Defines + * @{ + */ + +/** +* @brief APP_GPIO_DEFINE IO pins +*/ +#define APP_IO_PIN_0 ((uint32_t)0x00000001U) /**< Pin 0 selected */ +#define APP_IO_PIN_1 ((uint32_t)0x00000002U) /**< Pin 1 selected */ +#define APP_IO_PIN_2 ((uint32_t)0x00000004U) /**< Pin 2 selected */ +#define APP_IO_PIN_3 ((uint32_t)0x00000008U) /**< Pin 3 selected */ +#define APP_IO_PIN_4 ((uint32_t)0x00000010U) /**< Pin 4 selected */ +#define APP_IO_PIN_5 ((uint32_t)0x00000020U) /**< Pin 5 selected */ +#define APP_IO_PIN_6 ((uint32_t)0x00000040U) /**< Pin 6 selected */ +#define APP_IO_PIN_7 ((uint32_t)0x00000080U) /**< Pin 7 selected */ +#define APP_IO_PIN_8 ((uint32_t)0x00000100U) /**< Pin 8 selected */ +#define APP_IO_PIN_9 ((uint32_t)0x00000200U) /**< Pin 9 selected */ +#define APP_IO_PIN_10 ((uint32_t)0x00000400U) /**< Pin 10 selected */ +#define APP_IO_PIN_11 ((uint32_t)0x00000800U) /**< Pin 11 selected */ +#define APP_IO_PIN_12 ((uint32_t)0x00001000U) /**< Pin 12 selected */ +#define APP_IO_PIN_13 ((uint32_t)0x00002000U) /**< Pin 13 selected */ +#define APP_IO_PIN_14 ((uint32_t)0x00004000U) /**< Pin 14 selected */ +#define APP_IO_PIN_15 ((uint32_t)0x00008000U) /**< Pin 15 selected */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define APP_IO_PIN_16 ((uint32_t)0x00010000U) /**< Pin 16 selected */ +#define APP_IO_PIN_17 ((uint32_t)0x00020000U) /**< Pin 17 selected */ +#define APP_IO_PIN_18 ((uint32_t)0x00040000U) /**< Pin 18 selected */ +#define APP_IO_PIN_19 ((uint32_t)0x00080000U) /**< Pin 19 selected */ +#define APP_IO_PIN_20 ((uint32_t)0x00100000U) /**< Pin 20 selected */ +#define APP_IO_PIN_21 ((uint32_t)0x00200000U) /**< Pin 21 selected */ +#define APP_IO_PIN_22 ((uint32_t)0x00400000U) /**< Pin 22 selected */ +#define APP_IO_PIN_23 ((uint32_t)0x00800000U) /**< Pin 23 selected */ +#define APP_IO_PIN_24 ((uint32_t)0x01000000U) /**< Pin 24 selected */ +#define APP_IO_PIN_25 ((uint32_t)0x02000000U) /**< Pin 25 selected */ +#define APP_IO_PIN_26 ((uint32_t)0x04000000U) /**< Pin 26 selected */ +#define APP_IO_PIN_27 ((uint32_t)0x08000000U) /**< Pin 27 selected */ +#define APP_IO_PIN_28 ((uint32_t)0x10000000U) /**< Pin 28 selected */ +#define APP_IO_PIN_29 ((uint32_t)0x20000000U) /**< Pin 29 selected */ +#define APP_IO_PIN_30 ((uint32_t)0x40000000U) /**< Pin 30 selected */ +#define APP_IO_PIN_31 ((uint32_t)0x80000000U) /**< Pin 31 selected */ +#endif + +#define APP_IO_PINS_0_7 ((uint32_t)0x000000FFU) /**< 0~7 pins selected */ +#define APP_IO_PINS_0_15 ((uint32_t)0x0000FFFFU) /**< 0~15 pins selected */ +#define APP_IO_PINS_16_31 ((uint32_t)0xFFFF0000U) /**< 16~31 pins selected */ +#define APP_IO_PIN_ALL ((uint32_t)0x0000FFFFU) /**< All pins selected */ +#define APP_AON_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All AON pins selected */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +#define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000003FFU) /**< All MISO pins selected */ +#else +#define APP_MSIO_IO_PIN_ALL ((uint32_t)0x000000FFU) /**< All MISO pins selected */ +#endif +#define APP_IO_PIN_MASK ((uint32_t)0xFFFFFFFFU) /**< PIN mask for assert test */ + +/** + * @brief GR5xxx_APP_GPIO_default_config initStruct default configuart APP_GPIOn + */ +#define APP_IO_DEFAULT_CONFIG \ +{ \ + .pin = APP_IO_PIN_ALL, \ + .mode = APP_IO_MODE_INPUT, \ + .pull = APP_IO_PULLDOWN, \ +} + +/** @} */ + + +/** @addtogroup APP_GPIO_ENUMERATIONS Enumerations + * @{ + */ +/** + * @brief GPIO state Enumerations definition + */ +typedef enum +{ + APP_IO_PIN_RESET, /**< IO pin low level. */ + APP_IO_PIN_SET, /**< IO pin high level. */ +} app_io_pin_state_t; + +/** + * @brief GPIO type Enumerations definition + */ +typedef enum +{ + APP_IO_TYPE_GPIOA, /**< General Purpose Input/Output. */ + APP_IO_TYPE_GPIOB, /**< General Purpose Input/Output. */ + APP_IO_TYPE_GPIOC, /**< General Purpose Input/Output. */ +// #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + APP_IO_TYPE_NORMAL, /**< General Purpose Input/Output. */ +// #endif + APP_IO_TYPE_AON, /**< Always-on Input/Output. */ + APP_IO_TYPE_MSIO, /**< Mixed Signal I/O. */ + APP_IO_TYPE_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_io_type_t; + +/** + * @brief GPIO mode Enumerations definition + */ +typedef enum +{ + APP_IO_MODE_NONE, + APP_IO_MODE_INPUT, /**< Input Mode. */ + APP_IO_MODE_OUTPUT, /**< Output Mode. */ + APP_IO_MODE_MUX, /**< Mux Mode. */ + APP_IO_MODE_IT_RISING, /**< Interrupt Mode with Rising edge trigger detection. */ + APP_IO_MODE_IT_FALLING, /**< Interrupt Mode with Falling edge trigger detection. */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + APP_IO_MODE_IT_BOTH_EDGE, /**< Interrupt Mode with Rising and Falling edge trigger detection */ +#endif + APP_IO_MODE_IT_HIGH, /**< Interrupt Mode with High-level trigger detection. */ + APP_IO_MODE_IT_LOW, /**< Interrupt Mode with Low-level trigger detection. */ + APP_IO_MODE_ANALOG, /**< Analog IO Mode. */ + APP_IO_MODE_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_io_mode_t; + +/** + * @brief GPIO pull Enumerations definition + */ +typedef enum +{ + APP_IO_NOPULL, /**< No Pull-up or Pull-down activation. */ + APP_IO_PULLUP, /**< Pull-up activation. */ + APP_IO_PULLDOWN, /**< Pull-down activation. */ + APP_IO_PULL_MAX /**< Only for check parameter, not used as input parameters. */ +} app_io_pull_t; + +/** + * @brief GPIO mux Enumerations definition + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +typedef enum +{ + APP_IO_MUX_0, /**< IO_MUX_GPIO. */ + APP_IO_MUX_1, /**< IO_MUX_I2C0_SCL. */ + APP_IO_MUX_2, /**< IO_MUX_I2C0_SDA. */ + APP_IO_MUX_3, /**< IO_MUX_I2C1_SCL. */ + APP_IO_MUX_4, /**< IO_MUX_I2C1_SDA. */ + APP_IO_MUX_5, /**< IO_MUX_UART0_CTS. */ + APP_IO_MUX_6, /**< IO_MUX_UART0_RTS. */ + APP_IO_MUX_7, /**< IO_MUX_UART0_TX. */ + APP_IO_MUX_8, /**< IO_MUX_UART0_RX. */ + APP_IO_MUX_9, /**< IO_MUX_UART1_CTS. */ + APP_IO_MUX_10, /**< IO_MUX_UART1_RTS. */ + APP_IO_MUX_11, /**< IO_MUX_UART1_TX. */ + APP_IO_MUX_12, /**< IO_MUX_UART1_RX.*/ + APP_IO_MUX_13, /**< IO_MUX_PWM0. */ + APP_IO_MUX_14, /**< IO_MUX_PWM1. */ + APP_IO_MUX_15, /**< IO_MUX_PWM2. */ + APP_IO_MUX_16, /**< IO_MUX_PWM3. */ + APP_IO_MUX_17, /**< IO_MUX_PWM4. */ + APP_IO_MUX_18, /**< IO_MUX_PWM5. */ + APP_IO_MUX_19, /**< IO_MUX_df_ant_sw_0.*/ + APP_IO_MUX_20, /**< IO_MUX_df_ant_sw_1.*/ + APP_IO_MUX_21, /**< IO_MUX_df_ant_sw_2.*/ + APP_IO_MUX_22, /**< IO_MUX_df_ant_sw_3.*/ + APP_IO_MUX_23, /**< IO_MUX_df_ant_sw_4.*/ + APP_IO_MUX_24, /**< IO_MUX_df_ant_sw_5.*/ + APP_IO_MUX_25, /**< IO_MUX_df_ant_sw_6.*/ + APP_IO_MUX_26, /**< IO_MUX_ferp_gpio_trig_0.*/ + APP_IO_MUX_27, /**< IO_MUX_SWO.*/ + APP_IO_MUX_28, /**< IO_MUX_coex_ble_rx.*/ + APP_IO_MUX_29, /**< IO_MUX_coex_ble_tx.*/ + APP_IO_MUX_30, /**< IO_MUX_coex_wlan_rx.*/ + APP_IO_MUX_31, /**< IO_MUX_coex_wlan_tx.*/ + APP_IO_MUX_32, /**< IO_MUX_coex_ble_in_process.*/ + APP_IO_MUX_33, /**< IO_MUX_SWD_CLK.*/ + APP_IO_MUX_34, /**< IO_MUX_SWD_DATA.*/ + APP_IO_MUX_35, /**< IO_MUX_reserve3.*/ + APP_IO_MUX_36, /**< IO_MUX_reserve4.*/ + APP_IO_MUX_37, /**< IO_MUX_reserve5.*/ + APP_IO_MUX_38, /**< IO_MUX_SPI_S_MOSI.*/ + APP_IO_MUX_39, /**< IO_MUX_SPI_S_CS_N.*/ + APP_IO_MUX_40, /**< IO_MUX_SPI_S_CLK.*/ + APP_IO_MUX_41, /**< IO_MUX_SPI_S_MISO.*/ + APP_IO_MUX_42, /**< IO_MUX_SPI_M_CLK.*/ + APP_IO_MUX_43, /**< IO_MUX_SPI_M_CS0_N.*/ + APP_IO_MUX_44, /**< IO_MUX_SPI_M_CS1_N.*/ + APP_IO_MUX_45, /**< IO_MUX_SPI_M_MISO.*/ + APP_IO_MUX_46, /**< IO_MUX_SPI_M_MOSIss*/ + APP_IO_MUX_47, /**< RESERVED */ + APP_IO_MUX_48, /**< RESERVED */ + APP_IO_MUX_49, /**< IO_MUX_DUAL_TIMER0_A */ + APP_IO_MUX_50, /**< IO_MUX_DUAL_TIMER0_B */ + APP_IO_MUX_51, /**< IO_MUX_DUAL_TIMER0_C */ + APP_IO_MUX_52, /**< IO_MUX_DUAL_TIMER1_A */ + APP_IO_MUX_53, /**< IO_MUX_DUAL_TIMER1_B */ + APP_IO_MUX_54, /**< IO_MUX_DUAL_TIMER1_C */ + APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_io_mux_t; +#else +typedef enum +{ + APP_IO_MUX_0, /**< IO mux mode 0. */ + APP_IO_MUX_1, /**< IO mux mode 1. */ + APP_IO_MUX_2, /**< IO mux mode 2. */ + APP_IO_MUX_3, /**< IO mux mode 3. */ + APP_IO_MUX_4, /**< IO mux mode 4. */ + APP_IO_MUX_5, /**< IO mux mode 5. */ + APP_IO_MUX_6, /**< IO mux mode 6. */ + APP_IO_MUX_7, /**< IO mux mode 7. */ + APP_IO_MUX_8, /**< IO mux mode 8. */ + APP_IO_MUX_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_io_mux_t; +#endif + +/** +* @brief GPIO mux for different APP_DRIVER_CHIP_TYPE +*/ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +#define APP_IO_MUX APP_IO_MUX_0 /**< IO mux for GR5332X. */ +#elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#define APP_IO_MUX APP_IO_MUX_8 /**< IO mux for GR5525X. */ +#else +#define APP_IO_MUX APP_IO_MUX_7 /**< IO mux for others. */ +#endif + +/** @} */ + +/** @addtogroup APP_GPIO_STRUCT Structures + * @{ + */ +/** + * @brief GPIO parameter structure definition + */ +typedef struct +{ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins */ + app_io_mode_t mode; /**< Specifies the operating mode for the selected pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ +} app_io_init_t; +/** @} */ + +/** + * @brief GPIO Interrupt event Structure definition + */ +typedef struct +{ + app_io_type_t type; /**< Type of event. */ + uint32_t pin; /**< Specifies the IO pins to be configured. */ + void *arg; /**< User parameters */ +} app_io_evt_t; + +/** + * @brief GPIO Speed Structure definition + */ +typedef enum { + APP_IO_SPPED_MEDIUM, /**< Select medium speed. */ + APP_IO_SPPED_HIGH, /**< Select high speed. */ + APP_IO_SPPED_MAX /**< Only for check parameter, not used as input parameters. */ +} app_io_speed_t; + + +/** + * @brief GPIO Input type Structure definition + */ +typedef enum { + APP_IO_INPUT_TYPE_CMOS, /**< Select CMOS input. */ + APP_IO_INPUT_TYPE_SCHMITT, /**< Select Schmitt input. */ + APP_IO_INPUT_TYPE_MAX /**< Only for check parameter, not used as input parameters. */ +} app_io_input_type_t; + +/** + * @brief GPIO Strength Structure definition + */ +typedef enum { + APP_IO_STRENGTH_LOW, /**< Select low output driver strength */ + APP_IO_STRENGTH_MEDIUM, /**< Select medium output driver strength */ + APP_IO_STRENGTH_HIGH, /**< Select high output driver strength */ + APP_IO_STRENGTH_ULTRA, /**< Select high output driver strength */ + APP_IO_STRENGTH_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_io_strength_t; + +/** + * @brief GPIO callback type. + */ +typedef void (*app_io_callback_t)(app_io_evt_t *p_evt); + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_GPIO_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP GPIO DRIVER according to the specified parameters + * in the app_io_type_t and app_io_init_t. + * + * @param[in] type: GPIO type. + * @param[in] p_init: Pointer to app_io_init_t parameter which contains the + * configuration information for the specified GPIO. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_io_init(app_io_type_t type, app_io_init_t *p_init); + +/** + **************************************************************************************** + * @brief De-initialize the GPIOx peripheral. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to De-initialization. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_io_deinit(app_io_type_t type, uint32_t pin); + +/** + **************************************************************************************** + * @brief Read the specified input port pin.. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to read. + * + * @return The GPIO state. + **************************************************************************************** + */ +app_io_pin_state_t app_io_read_pin(app_io_type_t type, uint32_t pin); + +/** + **************************************************************************************** + * @brief Set or clear the selected data port bit. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to set or clear. + * @param[in] pin_state: Specifies the value to be written to the selected bit. + * + * @return Result of write. + **************************************************************************************** + */ +uint16_t app_io_write_pin(app_io_type_t type, uint32_t pin, app_io_pin_state_t pin_state); + +/** + **************************************************************************************** + * @brief Toggle the specified GPIO pin. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to toggle. + * + * @return Result of toggle. + **************************************************************************************** + */ +uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin); + +/** + **************************************************************************************** + * @brief Set the speed of the GPIO. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to set. + * @param[in] speed: GPIO speed type, See app_io_speed_t. + * + * @return Result of seting. + **************************************************************************************** + */ +uint16_t app_io_set_speed(app_io_type_t type, uint32_t pin, app_io_speed_t speed); + +/** + **************************************************************************************** + * @brief Set the strength of the GPIO. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to set. + * @param[in] strength: GPIO strength type, See app_io_strength_t. + * + * @return Result of seting. + **************************************************************************************** + */ +uint16_t app_io_set_strength(app_io_type_t type, uint32_t pin, app_io_strength_t strength); + +/** + **************************************************************************************** + * @brief Set the input type of the GPIO. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to toggle. + * @param[in] input_type: GPIO input type, See app_io_input_type_t. + * + * @return Result of seting. + **************************************************************************************** + */ +uint16_t app_io_set_intput_type(app_io_type_t type, uint32_t pin, app_io_input_type_t input_type); + +/** + **************************************************************************************** + * @brief Initialize GPIO to interrupt mode and register interrupt callback function. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] p_init: Pointer to app_io_init_t parameter which contains the + * configuration information for the specified GPIO. + * @param[in] io_evt_cb: Interrupt callback function. + * @param[in] arg: User parameters. + * + * @return Result of register. + **************************************************************************************** + */ +uint16_t app_io_event_register_cb(app_io_type_t type, app_io_init_t *p_init, app_io_callback_t io_evt_cb, void *arg); + +/** + **************************************************************************************** + * @brief Deinitialize GPIO to normal mode and unregister interrupt. + * + * @param[in] type: GPIO type, See app_io_type_t. + * @param[in] pin: The pin want to unregister. + * + * @return Result of unregister. + **************************************************************************************** + */ +uint16_t app_io_event_unregister(app_io_type_t type, uint32_t pin); + +/** @} */ +#endif + +/** @} */ + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_iso7816.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_iso7816.h new file mode 100644 index 0000000..dcc8059 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_iso7816.h @@ -0,0 +1,429 @@ +/** + **************************************************************************************** + * + * @file app_iso7816.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ISO7816 app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_ISO7816 ISO7816 + * @brief ISO7816 APP module driver. + * @{ + */ + + +#ifndef _APP_ISO7816_H_ +#define _APP_ISO7816_H_ + +#include "grx_hal.h" +#include "app_io.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#include "stdbool.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_ISO7816_MODULE_ENABLED +/** @addtogroup APP_ISO7816_DEFINE Defines + * @{ + */ + +/** @defgroup APP_ISO7816_ACTION Action state + * @{ + */ +#define APP_ISO7816_ACTION_NONE HAL_ISO7816_ACTION_NONE /**< Do Nothing. */ +#define APP_ISO7816_ACTION_OFF HAL_ISO7816_ACTION_OFF /**< Switch Off. */ +#define APP_ISO7816_ACTION_STOPCLK HAL_ISO7816_ACTION_STOPCLK /**< Stop the clock. */ +#define APP_ISO7816_ACTION_ON HAL_ISO7816_ACTION_ON /**< Switch on and receive ATR. */ +#define APP_ISO7816_ACTION_WARMRST HAL_ISO7816_ACTION_WARMRST /**< Trigger warm reset and receive ATR.*/ +#define APP_ISO7816_ACTION_RX HAL_ISO7816_ACTION_RX /**< Receive. */ +#define APP_ISO7816_ACTION_TX HAL_ISO7816_ACTION_TX /**< Transmit. */ +#define APP_ISO7816_ACTION_TXRX HAL_ISO7816_ACTION_TXRX /**< Transmit, followed by RX. */ +/** @} */ + +/** @defgroup APP_ISO7816_Interrupt_definition ISO7816 Interrupt Definition + * @{ + */ +#define APP_ISO7816_INTR_PRESENCE HAL_ISO7816_INTR_PRESENCE /**< Source presence interrupt */ +#define APP_ISO7816_INTR_STATE_ERR HAL_ISO7816_INTR_STATE_ERR /**< Source state error interrupt */ +#define APP_ISO7816_INTR_DMA_ERR HAL_ISO7816_INTR_DMA_ERR /**< Source dma error interrupt */ +#define APP_ISO7816_INTR_RETRY_ERR HAL_ISO7816_INTR_RETRY_ERR /**< Source retry error interrupt */ +#define APP_ISO7816_INTR_RX_ERR HAL_ISO7816_INTR_RX_ERR /**< Source rx error interrupt */ +#define APP_ISO7816_INTR_DONE HAL_ISO7816_INTR_DONE /**< Source done error interrupt */ +/** @} */ + + +/** @defgroup APP_ISO7816_CARD_PRESENCE Card Presence Defines + * @{ + */ +#define APP_ISO7816_CARD_ABSENT HAL_ISO7816_CARD_ABSENT /**< SIM Card is absent. */ +#define APP_ISO7816_CARD_PRESENT HAL_ISO7816_CARD_PRESENT /**< SIM Card is present. */ +/** @} */ + +/** @defgroup APP_ISO7816_IO_STATES IO States Defines + * @{ + */ +#define APP_ISO7816_IO_STATE_OFF HAL_ISO7816_IO_STATE_OFF /**< Off */ +#define APP_ISO7816_IO_STATE_IDLE HAL_ISO7816_IO_STATE_IDLE /**< Idle */ +#define APP_ISO7816_IO_STATE_RX_WAIT HAL_ISO7816_IO_STATE_RX_WAIT /**< Receive Wait */ +#define APP_ISO7816_IO_STATE_RX HAL_ISO7816_IO_STATE_RX /**< Receive */ +#define APP_ISO7816_IO_STATE_TX HAL_ISO7816_IO_STATE_TX /**< Transmit */ +#define APP_ISO7816_IO_STATE_TX_GUARD HAL_ISO7816_IO_STATE_TX_GUARD /**< Transmit Guard */ +/** @} */ + +/** @defgroup APP_ISO7816_PWR_STATES Power States Defines + * @{ + */ +#define APP_ISO7816_PWR_STATE_OFF HAL_ISO7816_PWR_STATE_OFF /**< Off */ +#define APP_ISO7816_PWR_STATE_PWRUP_VCC HAL_ISO7816_PWR_STATE_PWRUP_VCC /**< Power up VCC */ +#define APP_ISO7816_PWR_STATE_PWRUP_RST HAL_ISO7816_PWR_STATE_PWRUP_RST /**< Power up reset */ +#define APP_ISO7816_PWR_STATE_PWRDN_RST HAL_ISO7816_PWR_STATE_PWRDN_RST /**< Power Down reset */ +#define APP_ISO7816_PWR_STATE_PWRDN_VCC HAL_ISO7816_PWR_STATE_PWRDN_VCC /**< Power Down VCC */ +#define APP_ISO7816_PWR_STATE_STOP_PRE HAL_ISO7816_PWR_STATE_STOP_PRE /**< Preparing Clock Stop */ +#define APP_ISO7816_PWR_STATE_STOP HAL_ISO7816_PWR_STATE_STOP /**< Clock Stopped */ +#define APP_ISO7816_PWR_STATE_STOP_POST HAL_ISO7816_PWR_STATE_STOP_POST /**< Exiting Clock Stop */ +#define APP_ISO7816_PWR_STATE_IDLE HAL_ISO7816_PWR_STATE_IDLE /**< Idle */ +#define APP_ISO7816_PWR_STATE_RX_TS0 HAL_ISO7816_PWR_STATE_RX_TS0 /**< RX TS Character */ +#define APP_ISO7816_PWR_STATE_RX_TS1 HAL_ISO7816_PWR_STATE_RX_TS1 /**< RX TS Character */ +#define APP_ISO7816_PWR_STATE_RX HAL_ISO7816_PWR_STATE_RX /**< Receive */ +#define APP_ISO7816_PWR_STATE_TX HAL_ISO7816_PWR_STATE_TX /**< Transmit */ +#define APP_ISO7816_PWR_STATE_TX_RX HAL_ISO7816_PWR_STATE_TX_RX /**< Transmit and Receive */ +/** @} */ + +/** @} */ + +/** @addtogroup APP_ISO7816_ENUM Enumerations + * @{ + */ + +/** + * @brief ISO7816 operating mode Enumerations definition + */ +typedef enum +{ + APP_ISO7816_TYPE_INTERRUPT, /**< Interrupt operation mode */ + APP_ISO7816_TYPE_POLLING, /**< Polling operation mode */ + APP_ISO7816_TYPE_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_iso7816_mode_t; + +/** + * @brief ISO7816 event Enumerations definition + */ +typedef enum +{ + APP_ISO7816_EVT_ERROR, /**< Error reported by ISO7816 peripheral. */ + APP_ISO7816_EVT_ABORT, /**< Error reported by ISO7816 peripheral. */ + APP_ISO7816_EVT_PRESENCE, /**< Requested RX transfer completed. */ + APP_ISO7816_EVT_ATR_CPLT, /**< Requested TX transfer completed. */ + APP_ISO7816_EVT_TX_CPLT, /**< Requested TX transfer completed. */ + APP_ISO7816_EVT_RX_CPLT, /**< Requested RX transfer completed. */ + APP_ISO7816_EVT_TX_RX_CPLT, /**< Requested RX transfer completed. */ +} app_iso7816_evt_type_t; +/** @} */ + +/** @addtogroup APP_ISO7816_STRUCTURES Structures + * @{ + */ + +/** + * @brief ISO7816 IO configuration Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ +} app_iso7816_pin_t; + +/** + * @brief ISO7816 pin configure structure definition + */ +typedef struct +{ + app_iso7816_pin_t clk; /**< Set the configuration of ISO7816 clock pin. */ + app_iso7816_pin_t rst; /**< Set the configuration of ISO7816 reset pin. */ + app_iso7816_pin_t io; /**< Set the configuration of ISO7816 io pin. */ + app_iso7816_pin_t presence; /**< Set the configuration of ISO7816 presence pin.*/ +} app_iso7816_pin_cfg_t; + +/** + * @brief ISO7816 event structure definition + */ +typedef struct +{ + app_iso7816_evt_type_t type; /**< Type of event. */ + union + { + uint32_t error_code; /**< ISO7816 Error code. */ + uint16_t size; /**< ISO7816 transmitted/received counter. */ + } data; /**< ISO7816 union data. */ +} app_iso7816_evt_t; + +/** @} */ + +/** @addtogroup APP_ISO7816_TYPEDEFS Type definitions + * @{ + */ + +/** + * @brief ISO7816 event callback definition + */ +typedef void (*app_iso7816_evt_handler_t)(app_iso7816_evt_t *p_evt); + +/** @} */ + +/** @addtogroup APP_ISO7816_ENUM Enumerations + * @{ + */ + +/**@brief App iso7816 state types. */ +typedef enum +{ + APP_ISO7816_INVALID = 0, + APP_ISO7816_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_ISO7816_SLEEP, +#endif +} app_iso7816_state_t; + +/** @} */ + +/** @addtogroup APP_ISO7816_STRUCTURES Structures + * @{ + */ +/** + * @brief ISO7816 device structure definition + */ +typedef struct +{ + app_iso7816_evt_handler_t evt_handler; /**< ISO7816 event callback. */ + iso7816_handle_t handle; /**< ISO7816 handle Structure. */ + app_iso7816_mode_t use_mode; /**< ISO7816 operating mode Enumerations. */ + app_iso7816_pin_cfg_t *p_pin_cfg; /**< ISO7816 pin configure structure. */ + app_iso7816_state_t iso7816_state; /**< ISO7816 state configure structure. */ + bool start_flag; /**< ISO7816 start_flage. */ +}iso7816_env_t; + +/** + * @brief ISO7816 parameters structure definition + */ +typedef struct +{ + app_iso7816_mode_t use_mode; /**< Specifies the operation mode of ISO7816. */ + app_iso7816_pin_cfg_t pin_cfg; /**< The pin configuration information for the ISO7816. */ + iso7816_init_t init; /**< ISO7816 communication parameters. */ + iso7816_env_t iso7816_env; /**< ISO7816 device structure definition. */ +} app_iso7816_params_t; + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_ISO7816_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP ISO7816 DRIVER according to the specified parameters + * in the app_iso7816_params_t and app_iso7816_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_iso7816_params_t parameter which contains the + * configuration information for the specified ISO7816 module. + * @param[in] evt_handler: ISO7816 user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_iso7816_init(app_iso7816_params_t *p_params, app_iso7816_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP ISO7816 DRIVER peripheral. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_iso7816_deinit(void); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_receive_sync(uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_receive_async(uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits an amount of data in blocking mode. + * + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_transmit_sync(uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits an amount of data in non-blocking mode with Interrupt/DMA. + * + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_transmit_async(uint16_t size); + +/** + **************************************************************************************** + * @brief Transmit and receive in master mode an amount of data in blocking mode. + * + * @param[in] tx_size: Amount of data to be sent + * @param[in] rx_size: Amount of data to be receive + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_transmit_receive_sync(uint16_t tx_size, uint16_t rx_size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit and receive in master mode an amount of data in non-blocking mode. + * + * @param[in] tx_size: Amount of data to be sent + * @param[in] rx_size: Amount of data to be receive + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_iso7816_transmit_receive_async(uint16_t tx_size, uint16_t rx_size); + +/** + * @brief Request ISO7816 to go to the next action. + * @param action: This parameter can be one of the following values: + * @arg @ref APP_ISO7816_ACTION_NONE + * @arg @ref APP_ISO7816_ACTION_OFF + * @arg @ref APP_ISO7816_ACTION_STOPCLK + * @arg @ref APP_ISO7816_ACTION_ON + * @arg @ref APP_ISO7816_ACTION_WARMRST + * @arg @ref APP_ISO7816_ACTION_RX + * @arg @ref APP_ISO7816_ACTION_TX + * @arg @ref APP_ISO7816_ACTION_TXRX + * + * @return Result of operation. + */ +uint16_t app_iso7816_set_action(uint32_t action); + +/** + * @brief Get ISO7816 Power States. + * @return Returned value can be one of the following values: + * @arg @ref APP_ISO7816_PWR_STATE_OFF + * @arg @ref APP_ISO7816_PWR_STATE_PWRUP_VCC + * @arg @ref APP_ISO7816_PWR_STATE_PWRUP_RST + * @arg @ref APP_ISO7816_PWR_STATE_PWRDN_RST + * @arg @ref APP_ISO7816_PWR_STATE_PWRDN_VCC + * @arg @ref APP_ISO7816_PWR_STATE_STOP_PRE + * @arg @ref APP_ISO7816_PWR_STATE_STOP + * @arg @ref APP_ISO7816_PWR_STATE_STOP_POST + * @arg @ref APP_ISO7816_PWR_STATE_IDLE + * @arg @ref APP_ISO7816_PWR_STATE_RX_TS0 + * @arg @ref APP_ISO7816_PWR_STATE_RX_TS1 + * @arg @ref APP_ISO7816_PWR_STATE_RX + * @arg @ref APP_ISO7816_PWR_STATE_TX + * @arg @ref APP_ISO7816_PWR_STATE_TX_RX + */ +uint32_t app_iso7816_get_power_states(void); + +/** + * @brief Set divide ISO7816 clock. + * @note Divide SIM clock by this value+1 to define ETU length. The reset value + * is the one, needed for theATR. + * @param divide This parameter should range between 0x0 and 0x3FF. + * + * @return Result of operation. + */ +uint16_t app_iso7816_set_etudiv(uint32_t divide); + +/** + **************************************************************************************** + * @brief Return the ISO7816 handle. + * + * @return Pointer to the specified ID's ISO7816 handle. + **************************************************************************************** + */ +iso7816_handle_t *app_iso7816_get_handle(void); + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _APP_ISO7816_H_ */ + +/** @} */ +/** @} */ +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm.h new file mode 100644 index 0000000..2fa0c2c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm.h @@ -0,0 +1,437 @@ +/** + **************************************************************************************** + * + * @file app_pwm.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWM app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_PWM PWM + * @brief PWM APP module driver. + * @{ + */ +#ifndef _APP_PWM_H_ +#define _APP_PWM_H_ + +#include "grx_hal.h" +#include "app_io.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +#include "app_dma.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_PWM_MODULE_ENABLED + +/** @addtogroup APP_PWM_DEFINE Defines + * @{ + */ + +#define APP_PWM_PIN_ENABLE 1 /**< PWM pin enable */ +#define APP_PWM_PIN_DISABLE 0 /**< PWM pin disable */ + +/** @} */ + +/** @addtogroup APP_PWM_ENUM Enumerations + * @{ + */ + +/** + * @brief PWM module Enumerations definition + */ +typedef enum +{ + APP_PWM_ID_0, /**< PWM module 0 */ + APP_PWM_ID_1, /**< PWM module 1 */ + APP_PWM_ID_MAX /**< Only for check parameter, not used as input parameters. */ +} app_pwm_id_t; + +/** + * @brief PWM active channel Enumerations definition + */ +typedef enum +{ + APP_PWM_ACTIVE_CHANNEL_A = 0x01, /**< The active channel is A */ + APP_PWM_ACTIVE_CHANNEL_B = 0x02, /**< The active channel is B */ + APP_PWM_ACTIVE_CHANNEL_C = 0x04, /**< The active channel is C */ + APP_PWM_ACTIVE_CHANNEL_ALL = 0x07, /**< The active channels are ALL */ + APP_PWM_ACTIVE_CHANNEL_CLEARED = 0x00 /**< All active channels are cleared */ +} app_pwm_active_channel_t; + +/**@brief App pwm state types. */ +typedef enum +{ + APP_PWM_INVALID = 0, + APP_PWM_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_PWM_SLEEP, +#endif + +} app_pwm_state_t; + +/**@brief App pwm module state types. */ +typedef enum +{ + APP_PWM_STOP = 0, + APP_PWM_START, +} app_pwm_module_state_t; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + * @brief PWM event Enumerations definition + */ +typedef enum +{ + APP_PWM_CHANNEL_A_ERROR, /**< Channel A error in coding mode. */ + APP_PWM_CHANNEL_B_ERROR, /**< Channel B error in coding mode. */ + APP_PWM_CHANNEL_C_ERROR, /**< Channel C error in coding mode. */ + APP_PWM_CODING_DONE, /**< Coding done in coding mode. */ + APP_PWM_CODING_LOAD, /**< Coding load in coding mode. */ +} app_pwm_evt_type_t; +#endif + +/** @} */ + +/** @addtogroup APP_PWM_STRUCTURES Structures + * @{ + */ + +/** + * @brief PWM IO configuration Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of PWM IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ + uint8_t enable; /**< Enable or disable the pin. */ +} app_pwm_pin_t; + +/** + * @brief PWM configuration Structures + */ +typedef struct +{ + app_pwm_pin_t channel_a; /**< Set the configuration of PWM channel A pin. */ + app_pwm_pin_t channel_b; /**< Set the configuration of PWM channel B pin. */ + app_pwm_pin_t channel_c; /**< Set the configuration of PWM channel C pin. */ +} app_pwm_pin_cfg_t; + +/** + * @brief PWM Channel init Structure definition + */ +typedef struct +{ + uint8_t duty; /**< Specifies the duty in PWM output mode. + This parameter must be a number between 0 ~ 100.*/ + + uint8_t drive_polarity; /**< Specifies the drive polarity in PWM output mode. + This parameter can be a value of @ref PWM_Drive_Polarity.*/ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + uint32_t fstoplvl; /**< Specifies the PWM io level when stop. + This parameter can be a value of @ref PWM_STOP_LVL */ +#endif +} app_pwm_channel_init_t; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + * @brief PWM operate mode Enumerations definition + */ +typedef struct +{ + dma_regs_t *pwm_dma_instance; /**< Specifies the DMA instance.*/ + dma_channel_t pwm_dma_channel; /**< Specifies the dma channel of PWM. */ +} app_pwm_mode_t; + +/** + * @brief PWM event structure definition + */ +typedef struct +{ + app_pwm_evt_type_t type; /**< Type of event. */ + uint32_t error_code; /**< Error code */ +} app_pwm_evt_t; + +/** + * @brief PWM event callback definition + */ +typedef void (*app_pwm_evt_handler_t)(app_pwm_evt_t *p_evt); +#endif + +/** + * @brief PWM device structure definition + */ +typedef struct +{ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + app_pwm_evt_handler_t evt_handler; +#endif + app_pwm_pin_cfg_t *p_pin_cfg; /**< PWM configuration Structures. */ + app_pwm_state_t pwm_state; /**< App pwm state types. */ + app_pwm_module_state_t pwm_module_state; /**< App pwm module state types. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + app_pwm_mode_t use_mode; + dma_id_t dma_id[1]; +#endif + pwm_handle_t handle; /**< PWM handle Structure. */ +} pwm_env_t; + +/** + * @brief PWM parameters structure definition + */ +typedef struct +{ + app_pwm_id_t id; /**< specified PWM module ID. */ + app_pwm_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified PWM module. */ + app_pwm_active_channel_t active_channel; /**< PWM operate mode. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + app_pwm_mode_t use_mode; /**< PWM operate mode. */ +#endif + pwm_init_t init; /**< PWM communication parameters. */ + pwm_env_t pwm_env; /**< PWM device structure definition. */ +} app_pwm_params_t; +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_PWM_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the pwm peripheral. + * + * @param[in] p_params: Pointer to app_pwm_params_t parameter which contains the + * configuration information for the specified PWM module. + * + * @return Result of initialization. + **************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +uint16_t app_pwm_init(app_pwm_params_t *p_params, app_pwm_evt_handler_t evt_handler); +#else +uint16_t app_pwm_init(app_pwm_params_t *p_params); +#endif + +/** + **************************************************************************************** + * @brief De-initialize the pwm peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_pwm_deinit(app_pwm_id_t id); + + +/** + **************************************************************************************** + * @brief Starts the PWM signal generation on the output. + * + * @param[in] id: which PWM module want to output. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_start(app_pwm_id_t id); + + +/** + **************************************************************************************** + * @brief Stops the PWM signal generation on the output. + * + * @param[in] id: which PWM module want to stop output. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_stop(app_pwm_id_t id); + +/** + **************************************************************************************** + * @brief Update the PWM frequency on the output. + * + * @param[in] id: which PWM module want to config. + * @param[in] freq: This parameter ranges between min = 0 and max = SystemFreq / 2. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_update_freq(app_pwm_id_t id, uint32_t freq); + +/** + **************************************************************************************** + * @brief Initialize the PWM channels according to the specified parameters. + * + * @param[in] id: which PWM module want to config. + * @param[in] channel: PWM Channels to be configured. + * @param[in] p_config: PWM Channels configuration structure. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_config_channel(app_pwm_id_t id, app_pwm_active_channel_t channel, app_pwm_channel_init_t *p_config); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + **************************************************************************************** + * @brief Resume the PWM signal generation on the output. + * + * @param[in] id: which PWM module want to output. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_resume(app_pwm_id_t id); + +/** + **************************************************************************************** + * @brief Pause the PWM signal generation on the output. + * + * @param[in] id: which PWM module want to stop output. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_pause(app_pwm_id_t id); +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Set the specified PWM channel inactive + * + * @param[in] id: PWM ID. + * @param[in] channel: PWM Channels to be configured. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_inactive_channel(app_pwm_id_t id, app_pwm_active_channel_t channel); +#endif + +/** + **************************************************************************************** + * @brief Return the PWM handle. + * + * @param[in] id: PWM ID. + * + * @return Pointer to the specified ID's PWM handle. + **************************************************************************************** + */ +pwm_handle_t *app_pwm_get_handle(app_pwm_id_t id); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + **************************************************************************************** + * @brief Set coding data in one channel mode + * + * @param[in] id: which PWM module want to config. + * @param[in] coding_data: every bit represent compa0 or compa1 in coding data. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_set_coding_data_in_one_channel(app_pwm_id_t id, uint32_t coding_data); + +/** + **************************************************************************************** + * @brief Set coding data in three channels mode + * + * @param[in] id: which PWM module want to config. + * @param[in] coding_data0: every bit represent compa0 or compa1 in coding data0. + * @param[in] coding_data1: every bit represent compb0 or compb1 in coding data1. + * @param[in] coding_data2: every bit represent compc0 or compc1 in coding data2. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_set_coding_data_in_three_channels(app_pwm_id_t id, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2); + +/** + **************************************************************************************** + * @brief Start generate one channel wave form in Interrupt mode + * + * @param[in] id: which PWM module want to config. + * @param[in] coding_data: every bit represent compa0 or compa1 in coding data. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_start_coding_in_one_channel(app_pwm_id_t id, uint32_t coding_data); + +/** + **************************************************************************************** + * @brief Start generate three channels wave form in Interrupt mode + * + * @param[in] id: which PWM module want to config. + * @param[in] coding_data0: every bit represent compa0 or compa1 in coding data0. + * @param[in] coding_data1: every bit represent compb0 or compb1 in coding data1. + * @param[in] coding_data2: every bit represent compc0 or compc1 in coding data2. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_start_coding_in_three_channels(app_pwm_id_t id, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm_dma.h new file mode 100644 index 0000000..8dc7d3c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwm_dma.h @@ -0,0 +1,125 @@ +/** + **************************************************************************************** + * + * @file app_pwm_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWM app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +#ifndef _APP_PWM_DMA_H_ +#define _APP_PWM_DMA_H_ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_PWM PWM + * @brief PWM APP module driver. + * @{ + */ + + +#include "app_io.h" +#include "app_dma.h" +#include "app_pwm.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_PWM_MODULE_ENABLED +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_PWM_DMA_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP PWM DMA DRIVER according to the specified parameters + * in the app_pwm_params_t and app_pwm_evt_handler_t. + * + * @param[in] p_params: Pointer to app_pwm_params_t parameter which contains the + * configuration information for the specified PWM module. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_pwm_dma_init(app_pwm_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize the APP PWM DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_pwm_dma_deinit(app_pwm_id_t id); + +/** + **************************************************************************************** + * @brief Start generate wave form in DMA mode + * + * @param[in] id: which PWM module want to config. + * @param[in] p_data: the coding data address. + * @param[in] size: coding data size. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_pwm_start_coding_with_dma(app_pwm_id_t id, uint32_t *p_data, uint16_t size); + +/** @} */ + + +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwr_mgmt.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwr_mgmt.h new file mode 100644 index 0000000..7bb92a8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_pwr_mgmt.h @@ -0,0 +1,131 @@ +/** + **************************************************************************************** + * + * @file app_pwr_mgmt.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of UART PWR library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_PWR_MGMT PWR MGMT + * @brief PWR MGMT APP module driver. + * @{ + */ + + +#ifndef _APP_PWR_MGMT_H_ +#define _APP_PWR_MGMT_H_ + +#include "grx_sys.h" +#include "app_drv_config.h" +#include +#include + +/** @addtogroup APP_PWR_DEFINE Defines + * @{ + */ +/** + * @brief PWR MAX value for sleep check + */ +#define APP_SLEEP_CB_MAX 16 +/** @} */ + +/** @addtogroup APP_PWR_STRUCTURES Structures + * @{ + */ +/** + * @brief PWR id + */ +typedef int16_t pwr_id_t; + +/** + * @brief PWR sleep check function Structure + */ +typedef struct +{ + bool (*app_prepare_for_sleep)(void); /** +#include "grx_hal.h" +#include "app_io.h" +#include "app_qspi.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#include "app_qspi_user_config.h" +#endif +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_QSPI_MODULE_ENABLED + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_APP_QSPI_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP QSPI DRIVER according to the specified parameters + * in the app_qspi_params_t and app_qspi_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_qspi_params_t parameter which contains the + * configuration information for the specified QSPI module. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_qspi_dma_init(app_qspi_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize the APP QSPI DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_qspi_dma_deinit(app_qspi_id_t id); + +/** + **************************************************************************************** + * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Read Mode. + * @param[in] id: which QSPI module want to receive. + * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_command_receive_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Read Mode. + * @param[in] id: which QSPI module want to transmit. + * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_command_transmit_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Transmit instruction in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Write Mode. + * @param[in] id: which QSPI module want to transmit command. + * @param[in] p_cmd: Pointer to a app_qspi_command_t structure that contains the instruction and address for data transfer. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_command_async(app_qspi_id_t id, app_qspi_command_t *p_cmd); + +/** + **************************************************************************************** + * @brief Transmit data without command, support std/dual/quad mode + * + * @param[in] id : QSPI module ID. + * @param[in] qspi_mode : @ref QSPI_DATA_MODE_SPI + * @ref QSPI_DATA_MODE_DUALSPI + * @ref QSPI_DATA_MODE_QUADSPI + * @param[in] data_width :@ref QSPI_DATASIZE_08_BITS + * @ref QSPI_DATASIZE_16_BITS + * @ref QSPI_DATASIZE_32_BITS + * @param[in] p_data : data Pointer to transmit + * @param[in] length : byte length of data + * + * @return true/false + **************************************************************************************** + */ +uint16_t app_qspi_dma_transmit_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode at standard SPI with Interrupt. + * @note This function is used only in Indirect Write Mode. + * @param[in] id: which QSPI module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_transmit_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length); +#endif + +/** + **************************************************************************************** + * @brief Receive data without command, support std/dual/quad mode + * + * @param[in] id : QSPI module ID. + * @param[in] qspi_mode : @ref QSPI_DATA_MODE_SPI + * @ref QSPI_DATA_MODE_DUALSPI + * @ref QSPI_DATA_MODE_QUADSPI + * @param[in] data_width :@ref QSPI_DATASIZE_08_BITS + * @ref QSPI_DATASIZE_16_BITS + * @ref QSPI_DATASIZE_32_BITS + * @param[in] p_data : data Pointer to transmit + * @param[in] length : byte length of data + * + * @return true/false + **************************************************************************************** + */ +uint16_t app_qspi_dma_receive_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode at standard SPI with Interrupt. + * @note This function is used only in Indirect Read Mode. + * @param[in] id: which QSPI module want to receive. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_receive_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Transmit an amount of data in QPI mode (Async Mode). + * @param[in] id: Which QSPI module want to Transmit. + * @param[in] data_width: Just support @ref QSPI_DATASIZE_08_BITS @ref QSPI_DATASIZE_16_BITS @ref QSPI_DATASIZE_32_BITS + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be transmitted in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_qspi_dma_transmit_in_qpi_async(app_qspi_id_t id, uint32_t data_width, uint8_t *p_data, uint32_t length); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rng.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rng.h new file mode 100644 index 0000000..6362c63 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rng.h @@ -0,0 +1,219 @@ +/** + **************************************************************************************** + * + * @file app_rng.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of RNG app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_RNG RNG + * @brief RNG APP module driver. + * @{ + */ + + +#ifndef _APP_RNG_H_ +#define _APP_RNG_H_ + +#include "grx_hal.h" +#include "app_drv_error.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_RNG_MODULE_ENABLED + +/** @addtogroup APP_RNG_ENUM Enumerations + * @{ + */ + +/** + * @brief RNG operating mode Enumerations definition + */ +typedef enum +{ + APP_RNG_TYPE_INTERRUPT, /**< Interrupt operation mode */ + APP_RNG_TYPE_POLLING, /**< Polling operation mode */ + APP_RNG_TYPE_MAX /**< Only for check parameter, not used as input parameters. */ +} app_rng_type_t; + +/** + * @brief RNG event Enumerations definition + */ +typedef enum +{ + APP_RNG_EVT_DONE, /**< Generated random by UART peripheral. */ + APP_RNG_EVT_ERROR, /**< Error reported by UART peripheral. */ +} app_rng_evt_type_t; +/** @} */ + +/** @addtogroup HAL_APP_RNG_STRUCTURES Structures + * @{ + */ +/** + * @brief RNG event structure definition + */ +typedef struct +{ + app_rng_evt_type_t type; /**< Type of event. */ + uint32_t random_data; /**< Random number. */ +} app_rng_evt_t; + +/** + * @brief RNG event callback definition + */ +typedef void (*app_rng_evt_handler_t)(app_rng_evt_t *p_evt); + +/**@brief App rng state types. */ +typedef enum +{ + APP_RNG_INVALID = 0, + APP_RNG_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_RNG_SLEEP, +#endif +} app_rng_state_t; + +/** + * @brief RNG device structure definition + */ +typedef struct +{ + app_rng_evt_handler_t evt_handler; /**< RNG event callback. */ + rng_handle_t handle; /**< RNG handle Structure. */ + app_rng_type_t use_type; /**< RNG operating mode. */ + app_rng_state_t rng_state; /**< App rng state types. */ +} rng_env_t; +/** + * @brief RNG parameters structure definition + */ +typedef struct +{ + app_rng_type_t use_type; /**< Specifies the operation mode of RNG. */ + rng_init_t init; /**< RNG required parameters. */ + rng_env_t rng_env; /**< RNG device structure definition. */ +} app_rng_params_t; + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_RNG_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the APP RNG DRIVER according to the specified parameters + * in the app_rng_params_t and app_rng_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_rng_params_t parameter which contains the + * configuration information for the specified RNG module. + * @param[in] evt_handler: RNG user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_rng_init(app_rng_params_t *p_params, app_rng_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP RNG DRIVER peripheral. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_rng_deinit(void); + +/** + **************************************************************************************** + * @brief Generate a 32-bit random number. + * + * @param[in] p_seed: user configured seeds. the seed is valid when seed_mode member of + * rng_init_t is configured as RNG_SEED_USER. If 59-bit random number is + * selected, the seed need to provide [0~58] bit spaces. If 128-bit random + * number is selected, the seed need to provide [0~127] bit spaces. + * @param[out] p_random32bit: Pointer to generated random number variable if successful. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rng_gen_sync(uint16_t *p_seed, uint32_t *p_random32bit); + +/** + **************************************************************************************** + * @brief Generate a 32-bit random number in interrupt mode. + * + * @param[in] p_seed: user configured seeds. the seed is valid when seed_mode member of + * rng_init_t is configured as RNG_SEED_USER. If 59-bit random number is + * selected, the seed need to provide [0~58] bit spaces. If 128-bit random + * number is selected, the seed need to provide [0~127] bit spaces. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rng_gen_async(uint16_t *p_seed); + +/** + **************************************************************************************** + * @brief Return the RNG handle. + * + * @return Pointer to the RNG handle. + **************************************************************************************** + */ +rng_handle_t *app_rng_get_handle(void); + +#endif +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtc.h new file mode 100644 index 0000000..008924a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtc.h @@ -0,0 +1,232 @@ +/** + **************************************************************************************** + * + * @file app_rtc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of RTC app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_RTC RTC + * @brief RTC APP module driver. + * @{ + */ + + +#ifndef _APP_RTC_H_ +#define _APP_RTC_H_ + +#include "grx_hal.h" +#include "app_drv_error.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_CALENDAR_MODULE_ENABLED + +/** @addtogroup APP_RTC_DEFINE Defines + * @{ + */ + +/** + * @brief App rtc time disable macro definition + */ + +#define APP_RTC_ALARM_DISABLE_DATE CALENDAR_ALARM_DISABLE_DATE /**< Disable rtc date alarm */ +#define APP_RTC_ALARM_DISABLE_TICK CALENDAR_ALARM_DISABLE_TICK /**< Disable rtc tick alarm */ +#define APP_RTC_ALARM_DISABLE_ALL CALENDAR_ALARM_DISABLE_ALL /**< Disable rtc all alarm */ +/** @} */ + +/** @addtogroup APP_RTC_ENUM Enumerations + * @{ + */ +/** + * @brief RTC event Enumerations definition + */ +typedef enum +{ + APP_RTC_EVT_DATE_ALARM, /**< Date alarm event. */ + APP_RTC_EVT_TICK_ALARM, /**< Tick alarm event. */ + APP_RTC_EVT_OVERFLOW, /**< Overflow event. */ +} app_rtc_evt_type_t; +/** @} */ + +/** @addtogroup APP_RTC_STRUCTURES Structures + * @{ + */ +/** + * @brief App time structure definition + */ +typedef calendar_time_t app_rtc_time_t; + +/** + * @brief App alarm structure definition + */ +typedef calendar_alarm_t app_rtc_alarm_t; + + +/** + * @brief RTC event structure definition + */ +typedef struct +{ + app_rtc_evt_type_t type; /**< Type of event. */ +} app_rtc_evt_t; + +/** + * @brief RTC event callback definition + */ +typedef void (*app_rtc_evt_handler_t)(app_rtc_evt_t *p_evt); + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_RTC_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP RTC DRIVER. + * + * @param[in] evt_handler: RTC user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_rtc_init(app_rtc_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the app rtc. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_rtc_deinit(void); + +/** + **************************************************************************************** + * @brief Initialize the rtc time. + * + * @param[in] p_time: Pointer to a app_rtc_time_t time struction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rtc_init_time(app_rtc_time_t *p_time); + +/** + **************************************************************************************** + * @brief Get current rtc time. + * + * @param[in] p_time: Pointer to a app_rtc_time_t time struction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rtc_get_time(app_rtc_time_t *p_time); + +/** + **************************************************************************************** + * @brief Set a rtc date alarm. + * + * @param[in] p_alarm: After seconds will generate an date alarm interrupt. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rtc_setup_alarm(app_rtc_alarm_t *p_alarm); + +/** + **************************************************************************************** + * @brief Set a rtc tick alarm. + * + * @param[in] interval: After milliseconds will generate an tick alarm interrupt. + * The value of interval is greater than or equal to 10ms. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rtc_setup_tick(uint32_t interval); + +/** + **************************************************************************************** + * @brief Disable rtc alarm event. + * + * @param[in] disable_mode: Disable specified CALENDAR alarm mode. + * This parameter can be the following values: + * @arg @ref APP_RTC_ALARM_DISABLE_DATE + * @arg @ref APP_RTC_ALARM_DISABLE_TICK + * @arg @ref APP_RTC_ALARM_DISABLE_ALL + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_rtc_disable_event(uint32_t disable_mode); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + **************************************************************************************** + * @brief Synchronous RTC low speed clock. + * + * @param[in] SlowClockFreq: Number of slow clocks + * + * @return None. + **************************************************************************************** + */ +void app_rtc_time_sync(uint16_t SlowClockFreq); +#endif +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ +/** @} */ +/** @} */ + + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtos_cfg.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtos_cfg.h new file mode 100644 index 0000000..e2909e3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_rtos_cfg.h @@ -0,0 +1,280 @@ +/** + **************************************************************************************** + * + * @file app_rtos_cfg.h + * @author BLE Driver Team + * @brief Header file of app rtos config code. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_RTOS_CONFIG RTOS CONFIG + * @brief ADC RTOS CONFIG + * @{ + */ + + +#ifndef __APP_RTOS_ADAPTER_H +#define __APP_RTOS_ADAPTER_H +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include + +#ifdef ENV_USE_FREERTOS + +#include "FreeRTOS.h" +#include "semphr.h" + +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define ENV_USE_RTOS +/** @} */ + +/** + * @defgroup APP_RTOS_CONFIG_TYPEDEF Typedefs + * @{ + */ + +/** + * @brief Semaphore type definition + */ +typedef SemaphoreHandle_t sem_t; + +/** + * @brief mutex type definition + */ +typedef SemaphoreHandle_t mutex_t; + +/** @} */ + +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define OS_WAIT_FOREVER portMAX_DELAY /**< Block forever until get resource */ + +#define SEM_WAIT_FOREVER portMAX_DELAY /**< Wait for the semaphore forever */ +#define SEM_NO_WAIT (0) /**< Non-block */ + +#define MUTEX_WAIT_FOREVER portMAX_DELAY /**< Wait for the mutex forever */ +#define MUTEX_NO_WAIT (0) /**< Non-block */ +/** @} */ + +#else + +/** + * @defgroup APP_RTOS_CONFIG_TYPEDEF Typedefs + * @{ + */ + +/** + * @brief Semaphore type definition + */ +typedef void * sem_t; + +/** + * @brief mutex type definition + */ +typedef void * mutex_t; +/** @} */ + +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define SEM_WAIT_FOREVER (0xFFFFUL) /**< Wait for the semaphore forever. */ +#define SEM_NO_WAIT (0) /**< Non-block */ + +#define MUTEX_WAIT_FOREVER (0xFFFFUL) /**< Wait for the mutex forever */ +#define MUTEX_NO_WAIT (0) /**< Non-block */ +/** @} */ + +#endif + +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define APP_DRV_SEM_DECL(sem) sem_t sem /**< Define a semaphore instance */ +#define APP_DRV_MUTEX_DECL(mutex) mutex_t mutex /**< Define a mutex instance */ + +#define APP_DRV_SEM_STATIC(sem) static APP_DRV_SEM_DECL(sem) /**< Define a static semaphore instance */ +#define APP_DRV_MUTEX_STATIC(mutex) static APP_DRV_MUTEX_DECL(mutex) /**< Define a static mutex instance */ +/** @} */ + +#ifdef ENV_USE_RTOS +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define ENV_RTOS_USE_SEMP 1 /**< Enable semaphore in app driver */ +//#define ENV_RTOS_USE_MUTEX 1 /**< Enable mutex in app driver */ +/** @} */ + +/** @addtogroup APP_RTOS_CONFIG_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize a semaphore. + * + * @param[in] sem: Pointer to a sem_t parameter which contains the address of the semaphore object. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_driver_sem_init(sem_t *sem); + +/** + **************************************************************************************** + * @brief De-initialize a semaphore. + * + * @param[in] sem: the semaphore object. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +void app_driver_sem_deinit(sem_t sem); + +/** + **************************************************************************************** + * @brief This function will take a semaphore, if the semaphore is unavailable, the + thread shall wait for a specified time. + * + * @param[in] sem: The semaphore object. + * @param[in] time_out: The waiting time in milliseconds. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_driver_sem_pend(sem_t sem, uint32_t time_out); + +/** + **************************************************************************************** + * @brief This function will release a semaphore, if there are threads suspended on + * semaphore, it will be waked up. + * + * @param[in] sem: The semaphore object. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_driver_sem_post(sem_t sem); + +/** + **************************************************************************************** + * @brief This function will release a semaphore, it is used in interrupt service function, + * if there are threads suspended on semaphore, it will be waked up. + * + * @param[in] sem: The semaphore object. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_driver_sem_post_from_isr(sem_t sem); + +/** + **************************************************************************************** + * @brief Initialize a mutex. + * + * @param[in] mutex: Pointer to mutex_t parameter which contains the address of the mutex object. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_driver_mutex_init(mutex_t *mutex); + +/** + **************************************************************************************** + * @brief De-initialize a mutex. + * + * @param[in] mutex: the mutex object. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +void app_driver_mutex_deinit(mutex_t mutex); + +/** + **************************************************************************************** + * @brief This function will take a mutex, if the mutex is unavailable, the thread shall + * wait for a specified time. + * + * @param[in] mutex: The mutex object. + * @param[in] time_out: The waiting time in milliseconds. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_driver_mutex_pend(mutex_t mutex, uint32_t time_out); + +/** + **************************************************************************************** + * @brief This function will release a mutex, if there are threads suspended on mutex, + * it will be waked up. + * + * @param[in] mutex: The mutex object. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_driver_mutex_post(mutex_t mutex); +/** @} */ + +#else +/** @addtogroup APP_RTOS_CONFIG_DEFINES Defines + * @{ + */ +#define app_driver_sem_init(x) (0) /**< Initialize the semaphore. */ +#define app_driver_sem_deinit(x) /**< Deinitialize the semphore. */ +#define app_driver_sem_pend(x, y) (0) /**< Pend the semaphore. */ +#define app_driver_sem_post(x) /**< Post the semaphore. */ +#define app_driver_sem_post_from_isr(x) /**< Post the semaphore from interrupt. */ + +#define app_driver_mutex_init(x) (0) /**< Initialize the mutex. */ +#define app_driver_mutex_deinit(x) /**< Deinitialize the mutex. */ +#define app_driver_mutex_pend(x, y) /**< Pend the mutex. */ +#define app_driver_mutex_post(x) /**< Post the mutex. */ +/** @} */ + +#endif + +#endif +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_soft_encoder.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_soft_encoder.h new file mode 100644 index 0000000..8ca487a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_soft_encoder.h @@ -0,0 +1,141 @@ +/** + **************************************************************************************** + * + * @file app_soft_encoder.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of TIM app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_SOFT_ENCODER SOFT ENCODER + * @brief SOFT ENCODER APP module driver. + * @{ + */ + + +#ifndef _APP_SOFT_ENCODER_H_ +#define _APP_SOFT_ENCODER_H_ + +#include "app_drv_error.h" +#include "app_drv_config.h" +#include "app_io.h" +#include "app_gpiote.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup APP_SOFT_ENCODER_ENUM Enumerations + * @{ + */ + +/** + * @brief SOFT_ENCODER module Enumerations definition + */ +typedef enum +{ + APP_SOFT_ENCODER_SIGNAL_A = 0, + APP_SOFT_ENCODER_SIGNAL_B, + APP_SOFT_ENCODER_SINGAL_NUMBER, +} app_soft_encoder_signal_t; + +/** + * @brief SOFT_ENCODER module DIRECTION definition + */ +typedef enum +{ + APP_SOFT_ENCODER_STOP, + APP_SOFT_ENCODER_POSITIVE, + APP_SOFT_ENCODER_REVERSE, +} app_soft_encoder_direction_t; + +/** @} */ + +/** @addtogroup APP_SOFT_ENCODER_STRUCTURES Structures + * @{ + */ + +/** + * @brief SOFT_ENCODER io config + */ +typedef struct +{ + app_io_type_t type; + uint32_t pin; + app_io_mode_t mode; + app_io_pull_t pull; +} app_soft_encoder_io_param_t; + +/** + * @brief SOFT_ENCODER event callback definition + */ +typedef void (*app_soft_encoder_callback)(app_soft_encoder_direction_t direction,int distance); + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_SOFT_ENODER_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP TIM DRIVER according to the specified parameters + * in the app_soft_encoder_params_t and app_soft_encoder_evt_handler_t. + * + * @param[in] p_params: Pointer to app_soft_encoder_params_t parameter which contains the + * configuration information for the specified SOFT_ENODER module. + * @param[in] evt_handler: SOFT_ENODER user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_soft_encoder_init(app_soft_encoder_io_param_t *p_a_params, + app_soft_encoder_io_param_t *p_b_params, + app_soft_encoder_callback evt_handler); +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +/** @} */ +/** @} */ +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi.h new file mode 100644 index 0000000..fbaf861 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi.h @@ -0,0 +1,486 @@ +/** + **************************************************************************************** + * + * @file app_spi.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of SPI app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_SPI SPI + * @brief SPI APP module driver. + * @{ + */ + + +#ifndef _APP_SPI_H_ +#define _APP_SPI_H_ + +#include "app_io.h" +#include "app_dma.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#include +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_SPI_MODULE_ENABLED + +/** @addtogroup APP_SPI_DEFINE Defines + * @{ + */ + +#define APP_SPI_PIN_ENABLE 1 /**< SPI pin enable */ +#define APP_SPI_PIN_DISABLE 0 /**< SPI pin disable */ + +/** @} */ + +/** @addtogroup APP_SPI_ENUM Enumerations + * @{ + */ + +/** + * @brief SPI module Enumerations definition + */ +typedef enum +{ + APP_SPI_ID_SLAVE, /**< SPI slave module. */ + APP_SPI_ID_MASTER, /**< SPI master module. */ + APP_SPI_ID_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_spi_id_t; + + +/** + * @brief SPI event Enumerations definition + */ +typedef enum +{ + APP_SPI_EVT_ERROR, /**< Error reported by UART peripheral. */ + APP_SPI_EVT_TX_CPLT, /**< Requested TX transfer completed. */ + APP_SPI_EVT_RX_CPLT, /**< Requested RX transfer completed. */ + APP_SPI_EVT_TX_RX_CPLT, /**< Requested TX/RX transfer completed. */ + APP_SPI_EVT_ABORT, /**< Abort reported by SPI peripheral. */ +} app_spi_evt_type_t; +/** @} */ + +/** @addtogroup APP_SPI_STRUCTURES Structures + * @{ + */ +/** + * @brief SPI IO Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of SPI IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_mode_t mode; /**< Specifies the mode for the selected pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ + uint8_t enable; /**< Enable or disable the pin. */ +} app_spi_pin_t; + +/** + * @brief SPI IO configuration Structures + */ +typedef struct +{ + app_spi_pin_t cs; /**< Set the configuration of SPI CS pin. */ + app_spi_pin_t clk; /**< Set the configuration of SPI CLK pin. */ + app_spi_pin_t mosi; /**< Set the configuration of SPI MOSI pin. */ + app_spi_pin_t miso; /**< Set the configuration of SPI MISO pin. */ +} app_spi_pin_cfg_t; + +/** + * @brief SPI configuration definition. + */ +typedef struct +{ + dma_regs_t * tx_dma_instance; /**< Specifies the TX DMA inistall. */ + dma_regs_t * rx_dma_instance; /**< Specifies the RX DMA inistall. */ + dma_channel_t tx_dma_channel; /**< Specifies the dma channel of SPI TX. */ + dma_channel_t rx_dma_channel; /**< Specifies the dma channel of SPI RX. */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + uint32_t wait_timeout_ms; /**< Specifies timout time of polling and dead wait, ms. */ + uint32_t extend; /**< Specifies extend segment, to use */ +#endif +} app_spi_dma_cfg_t; + +/** + * @brief SPI event structure definition + */ +typedef struct +{ + app_spi_evt_type_t type; /**< Type of event. */ + union + { + uint32_t error_code; /**< SPI Error code . */ + uint16_t size; /**< SPI transmitted/received counter. */ + } data; /**< SPI data. */ +} app_spi_evt_t; +/** + * @brief SPI event callback definition + */ +typedef void (*app_spi_evt_handler_t)(app_spi_evt_t *p_evt); + +/**@brief App spi state types. */ +typedef enum +{ + APP_SPI_INVALID = 0, + APP_SPI_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_SPI_SLEEP, +#endif +} app_spi_state_t; + +/**@brief App spi dma state types. */ +typedef enum +{ + APP_SPI_DMA_INVALID = 0, + APP_SPI_DMA_ACTIVITY, +} app_spi_dma_state_t; + +/** + * @brief SPI device structure definition + */ +typedef struct +{ + app_spi_evt_handler_t evt_handler; /**< SPI event callback. */ + spi_handle_t handle; /**< SPI handle Structure. */ + app_spi_pin_cfg_t *p_pin_cfg; /**< SPI IO configuration Structures. */ + dma_id_t dma_id[2]; /**< DMA id. */ + app_spi_state_t spi_state; /**< App spi state types. */ + app_spi_dma_state_t spi_dma_state; /**< App spi dma state types. */ + volatile bool start_flag; /**< start flag. */ + volatile bool is_soft_cs; /**< soft cs. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + volatile uint8_t rx_done; /**< rx done. */ + volatile uint8_t tx_done; /**< tx done. */ +#endif +} spi_env_t; + +/** + * @brief SPI parameters structure definition + */ +typedef struct +{ + app_spi_id_t id; /**< specified SPI module ID. */ + app_spi_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified SPI module. */ + app_spi_dma_cfg_t dma_cfg; /**< SPI DMA configuration. */ + spi_init_t init; /**< SPI communication parameters. */ + bool is_soft_cs; /**< config whether to control CS signal by software */ + spi_env_t spi_env; /**< SPI device structure definition. */ +} app_spi_params_t; + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_SPI_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP SPI DRIVER according to the specified parameters + * in the app_spi_params_t and app_spi_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_spi_params_t parameter which contains the + * configuration information for the specified SPI module. + * @param[in] evt_handler: SPI user callback function. + * + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_spi_init(app_spi_params_t *p_params, app_spi_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP SPI DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_spi_deinit(app_spi_id_t id); + +/** + **************************************************************************************** + * @brief Abort spi communication with Interrupt. + * + * @param[in] id: SPI module ID. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_abort(app_spi_id_t id); + +/** + **************************************************************************************** + * @brief SPI master transmit with 1-byte inst and 3-byte addr, can use to write flash/display/eeprom, etc + * @note DO NOT Support interrupt mode + * @param[in] id : just support APP_SPI_ID_MASTER + * @param[in] instruction : 1-byte instruction phase + * @param[in] address : 3-byte address phase + * @param[in] p_data : pointer to transmit buffer + * @param[in] data_length : length of buffer, unit in byte + * + * @return APP_DRV_* in app_drv_error.h + **************************************************************************************** + */ +uint16_t app_spim_transmit_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t * p_data, uint16_t data_length); + +/** + **************************************************************************************** + * @brief SPI master receive with 1-byte inst and 3-byte addr and 0~4 dummy Byte, can use to read flash/display/eeprom, etc + * + * @param[in] id : just support APP_SPI_ID_MASTER + * @param[in] instruction : 1-byte instruction phase + * @param[in] address : 3-byte address phase + * @param[in] dummy_bytes : dummy bytes, 0 ~ 4 + * @param[in] p_data : pointer to transmit buffer + * @param[in] data_length : length of buffer, unit in byte + * + * @return APP_DRV_* in app_drv_error.h + **************************************************************************************** + */ +uint16_t app_spim_receive_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t dummy_bytes, uint8_t * p_data, uint16_t data_length); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_receive_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_receive_async(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_transmit_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_transmit_async(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits and receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to tx data buffer + * @param[in] p_rx_data: Pointer to rx data buffer + * @param[in] size: Amount of data to be sent and receive + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_transmit_receive_sync(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits and receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to tx data buffer + * @param[in] p_rx_data: Pointer to rx data buffer + * @param[in] size: Amount of data to be sent and receive + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_transmit_receive_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in blocking mode. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_size: Amount of data to be sent in bytes + * @param[in] rx_size: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_read_eeprom_sync(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with Interrupt. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_size: Amount of data to be sent in bytes + * @param[in] rx_size: Amount of data to be received in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_read_eeprom_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size); + +/** + **************************************************************************************** + * @brief Return the SPI handle. + * + * @param[in] id: SPI Channel ID. + * + * @return Pointer to the specified ID's SPI handle. + **************************************************************************************** + */ +spi_handle_t *app_spi_get_handle(app_spi_id_t id); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with DMA + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_cmd_data: Pointer to command data buffer + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[in] cmd_size: Amount of command data to be sent in bytes + * @param[in] tx_size: Amount of data to be sent in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_write_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_tx_data, uint32_t cmd_size, uint32_t tx_size); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with DMA. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_cmd_data: Pointer to command data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] cmd_size: Amount of command data to be sent in bytes + * @param[in] rx_size: Amount of data to be received in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_read_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_rx_data, uint32_t cmd_size, uint32_t rx_size); + +/** + **************************************************************************************** + * @brief [High speed] Receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_receive_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief [High speed] Transmit in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_transmit_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi_dma.h new file mode 100644 index 0000000..7d2ed9c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_spi_dma.h @@ -0,0 +1,256 @@ +/** + **************************************************************************************** + * + * @file app_spi_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of SPI app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_SPI SPI + * @brief SPI APP module driver. + * @{ + */ + + +#ifndef _APP_SPI_DMA_H_ +#define _APP_SPI_DMA_H_ + +#include "app_io.h" +#include "app_dma.h" +#include "app_spi.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#include +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_SPI_MODULE_ENABLED + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_SPI_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP SPI DRIVER according to the specified parameters + * in the app_spi_params_t and app_spi_evt_handler_t. + * @note If interrupt mode is set, you can use blocking mode. Conversely, if blocking mode + * is set, you can't use interrupt mode. + * + * @param[in] p_params: Pointer to app_spi_params_t parameter which contains the + * configuration information for the specified SPI module. + * + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_spi_dma_init(app_spi_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize the APP SPI DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_spi_dma_deinit(app_spi_id_t id); +/** + **************************************************************************************** + * @brief SPI master transmit with 1-byte inst and 3-byte addr, can use to write flash/display/eeprom, etc + * @note DO NOT Support interrupt mode + * @param[in] id : just support APP_SPI_ID_MASTER + * @param[in] instruction : 1-byte instruction phase + * @param[in] address : 3-byte address phase + * @param[in] p_data : pointer to transmit buffer + * @param[in] data_length : length of buffer, unit in byte + * + * @return APP_DRV_* in app_drv_error.h + **************************************************************************************** + */ +uint16_t app_spim_dma_transmit_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t * p_data, uint16_t data_length); + +/** + **************************************************************************************** + * @brief SPI master receive with 1-byte inst and 3-byte addr and 0~4 dummy Byte, can use to read flash/display/eeprom, etc + * + * @param[in] id : just support APP_SPI_ID_MASTER + * @param[in] instruction : 1-byte instruction phase + * @param[in] address : 3-byte address phase + * @param[in] dummy_bytes : dummy bytes, 0 ~ 4 + * @param[in] p_data : pointer to transmit buffer + * @param[in] data_length : length of buffer, unit in byte + * + * @return APP_DRV_* in app_drv_error.h + **************************************************************************************** + */ +uint16_t app_spim_dma_receive_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t dummy_bytes, uint8_t * p_data, uint16_t data_length); + +/** + **************************************************************************************** + * @brief Receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_receive_async(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_transmit_async(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmits and receive in master or slave mode an amount of data in non-blocking mode with Interrupt + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to tx data buffer + * @param[in] p_rx_data: Pointer to rx data buffer + * @param[in] size: Amount of data to be sent and receive + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_transmit_receive_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with Interrupt. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_size: Amount of data to be sent in bytes + * @param[in] rx_size: Amount of data to be received in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_read_eeprom_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/** + **************************************************************************************** + * @brief Transmits in master or slave mode an amount of data in non-blocking mode with DMA + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_cmd_data: Pointer to command data buffer + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[in] cmd_size: Amount of command data to be sent in bytes + * @param[in] tx_size: Amount of data to be sent in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_write_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_tx_data, uint32_t cmd_size, uint32_t tx_size); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with DMA. + * + * @param[in] id: which SPI module want to transmit. + * @param[in] p_cmd_data: Pointer to command data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] cmd_size: Amount of command data to be sent in bytes + * @param[in] rx_size: Amount of data to be received in bytes + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_read_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_rx_data, uint32_t cmd_size, uint32_t rx_size); + +/** + **************************************************************************************** + * @brief [High speed] Receive in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_receive_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief [High speed] Transmit in master or slave mode an amount of data in blocking mode. + * + * @param[in] id: which SPI module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_spi_dma_transmit_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_tim.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_tim.h new file mode 100644 index 0000000..199e614 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_tim.h @@ -0,0 +1,256 @@ +/** + **************************************************************************************** + * + * @file app_tim.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of TIM app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_TIMER TIMER + * @brief TIMER APP module driver. + * @{ + */ + + +#ifndef _APP_TIM_H_ +#define _APP_TIM_H_ + +#include "grx_hal.h" +#include "app_drv_error.h" +#include "app_drv_config.h" +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_TIMER_MODULE_ENABLED + +/** @addtogroup APP_TIM_ENUM Enumerations + * @{ + */ + +/** + * @brief TIM module Enumerations definition + */ +typedef enum +{ + APP_TIM_ID_0, /**< TIMER module 0 */ + APP_TIM_ID_1, /**< TIMER module 1 */ + APP_TIM_ID_MAX /**< Only for check parameter, not used as input parameters. */ +} app_tim_id_t; + +/** + * @brief TIM event Enumerations definition + */ +typedef enum +{ + APP_TIM_EVT_ERROR, /**< Error reported by TIMER peripheral. */ + APP_TIM_EVT_DONE, /**< Countdone event by TIMER peripheral. */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + APP_TIM_EVT_CHANNEL0, /**< Channle0 event by TIMER peripheral. */ + APP_TIM_EVT_CHANNEL1, /**< Channle1 event by TIMER peripheral. */ + APP_TIM_EVT_CHANNEL2, /**< Channle2 event by TIMER peripheral. */ + APP_TIM_EVT_CHANNEL3, /**< Channle3 event by TIMER peripheral. */ +#endif +} app_tim_evt_t; +/** @} */ + +/** @addtogroup APP_TIM_STRUCTURES Structures + * @{ + */ + +/** + * @brief TIM event callback definition + */ +typedef void (*app_tim_evt_handler_t)(app_tim_evt_t *p_evt); + +/**@brief App tim state types. */ +typedef enum +{ + APP_TIM_INVALID = 0, + APP_TIM_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_TIM_SLEEP, +#endif +} app_tim_state_t; + +/** + * @brief TIM device structure definition + */ +typedef struct +{ + app_tim_evt_handler_t evt_handler; /**< TIM event callback. */ + timer_handle_t handle; /**< TIMER handle Structure. */ + app_tim_state_t tim_state; /**< App tim state types. */ +}tim_env_t; + +/** + * @brief TIM parameters structure definition + */ +typedef struct +{ + app_tim_id_t id; /**< specified TIMER module ID. */ + timer_init_t init; /**< TIMER Base required parameters. */ + tim_env_t tim_env; /**< TIM device structure definition. */ +} app_tim_params_t; + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_TIM_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP TIM DRIVER according to the specified parameters + * in the app_tim_params_t and app_tim_evt_handler_t. + * + * @param[in] p_params: Pointer to app_tim_params_t parameter which contains the + * configuration information for the specified TIM module. + * @param[in] evt_handler: TIM user callback function. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_tim_init(app_tim_params_t *p_params, app_tim_evt_handler_t evt_handler); + +/** + **************************************************************************************** + * @brief De-initialize the APP TIM DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_tim_deinit(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Starts the TIM counter in interrupt mode. + * @param[in] id: which TIM module want to start. + * + * @return Result of initialization. + * + **************************************************************************************** + */ +uint16_t app_tim_start(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Stops the TIM counter in interrupt mode. + * @param[in] id: which TIM module want to stop. + * + * @return Result of initialization. + * + **************************************************************************************** + */ +uint16_t app_tim_stop(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Return the TIM handle. + * + * @param[in] id: TIM Channel ID. + * + * @return Pointer to the specified ID's TIM handle. + **************************************************************************************** + */ +timer_handle_t *app_tim_get_handle(app_tim_id_t id); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +/** + **************************************************************************************** + * @brief Return channel0 value. + * + * @param[in] id: TIM Channel ID. + * + * @return Current value when channel0 captured. + **************************************************************************************** + */ +uint32_t app_tim_get_channel0_val(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Return channel1 value. + * + * @param[in] id: TIM Channel ID. + * + * @return Current value when channel1 captured. + **************************************************************************************** + */ +uint32_t app_tim_get_channel1_val(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Return channel2 value. + * + * @param[in] id: TIM Channel ID. + * + * @return Current value when channel2 captured. + **************************************************************************************** + */ +uint32_t app_tim_get_channel2_val(app_tim_id_t id); + +/** + **************************************************************************************** + * @brief Return channel3 value. + * + * @param[in] id: TIM Channel ID. + * + * @return Current value when channel3 captured. + **************************************************************************************** + */ +uint32_t app_tim_get_channel3_val(app_tim_id_t id); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ +/** @} */ +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart.h new file mode 100644 index 0000000..94f1c6f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart.h @@ -0,0 +1,395 @@ +/** + **************************************************************************************** + * + * @file app_uart.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of UART app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_UART UART + * @brief UART APP module driver. + * @{ + */ + + +#ifndef _APP_UART_H_ +#define _APP_UART_H_ + +#include "grx_hal.h" +#include "ring_buffer.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_UART_MODULE_ENABLED + +/** @addtogroup APP_UART_MACRO Defines + * @{ + */ + +#define TX_ONCE_MAX_SIZE 128 /**< UART max bytes size transmitted at one time */ + +/** @} */ + +/** @addtogroup APP_UART_ENUMERATIONS Enumerations + * @{ + */ + +/** + * @brief UART module Enumerations definition + */ +typedef enum +{ + APP_UART_ID_0, /**< UART module 0 */ + APP_UART_ID_1, /**< UART module 1 */ +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) + APP_UART_ID_2, /**< UART module 2 */ + APP_UART_ID_3, /**< UART module 3 */ +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + APP_UART_ID_4, /**< UART module 4 */ + APP_UART_ID_5, /**< UART module 5 */ +#endif + APP_UART_ID_MAX, /**< Only for check parameter, not used as input parameters. */ +} app_uart_id_t; + +/** + * @brief UART event Enumerations definition + */ +typedef enum +{ + APP_UART_EVT_ERROR, /**< Error reported by UART peripheral. */ + APP_UART_EVT_TX_CPLT, /**< Requested TX transfer completed. */ + APP_UART_EVT_RX_DATA, /**< Requested RX transfer completed. */ + APP_UART_EVT_ABORT_TX, /**< Requested TX abort completed. */ + APP_UART_EVT_ABORT_RX, /**< Requested RX abort completed. */ + APP_UART_EVT_ABORT_TXRX, /**< Requested TX, RX abort completed. */ +} app_uart_evt_type_t; + +/**@brief App uart state types. */ +typedef enum +{ + APP_UART_INVALID = 0, + APP_UART_ACTIVITY, +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + APP_UART_SLEEP, +#endif +} app_uart_state_t; + +/** @} */ + +/** @addtogroup APP_UART_STRUCTURES Structures + * @{ + */ + +/** + * @brief UART pins Structures + */ +typedef struct +{ + app_io_type_t type; /**< Specifies the type of UART IO. */ + app_io_mux_t mux; /**< Specifies the Peripheral to be connected to the selected pins. */ + uint32_t pin; /**< Specifies the IO pins to be configured. + This parameter can be any value of @ref GR5xxx_pins. */ + app_io_pull_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. */ + +} app_uart_pin_t; + +/** + * @brief UART pins config Structures + */ +typedef struct +{ + app_uart_pin_t tx; /**< Set the configuration of UART TX pin. */ + app_uart_pin_t rx; /**< Set the configuration of UART RX pin. */ + app_uart_pin_t cts; /**< Set the configuration of UART CTS pin. */ + app_uart_pin_t rts; /**< Set the configuration of UART RTS pin. */ +} app_uart_pin_cfg_t; + +/** + * @brief UART DMA configuration structure definition + */ +typedef struct +{ + dma_regs_t *tx_dma_instance;/**< Specifies the TX DMA inistall.*/ + dma_regs_t *rx_dma_instance;/**< Specifies the RX DMA inistall.*/ + dma_channel_t tx_dma_channel; /**< Specifies the dma channel of UART TX. */ + dma_channel_t rx_dma_channel; /**< Specifies the dma channel of UART RX. */ +} app_uart_dma_cfg_t; + + +/**@brief App uart dma state types. */ +typedef enum +{ + APP_UART_DMA_INVALID = 0, + APP_UART_DMA_ACTIVITY, +} app_uart_dma_state_t; + +/** + * @brief UART event structure definition + */ +typedef struct +{ + app_uart_evt_type_t type; /**< Type of event. */ + union + { + uint32_t error_code; /**< UART Error code . */ + uint16_t size; /**< UART transmitted/received counter. */ + } data; /**< Data of event. */ +} app_uart_evt_t; + +/** @} */ + +/** @addtogroup APP_UART_TYPEDEFS Type definitions + * @{ + */ + +/** + * @brief UART event callback definition + */ +typedef void (*app_uart_evt_handler_t)(app_uart_evt_t *p_evt); + +/** @} */ + +/** @addtogroup APP_UART_STRUCTURES Structures + * @{ + */ + + +/** + * @brief UART device structure definition + */ +typedef struct +{ + app_uart_evt_handler_t evt_handler; /**< UART event callback. */ + uart_handle_t handle; /**< UART handle Structure. */ + app_uart_pin_cfg_t *p_pin_cfg; /**< UART pins config Structures. */ + dma_id_t dma_id[2]; /**< DMA id. */ + app_uart_state_t uart_state; /**< App uart state types. */ + app_uart_dma_state_t uart_dma_state; /**< App uart dma state types. */ + ring_buffer_t tx_ring_buffer; /**< RING_BUFFER_STRUCT Structures. */ + uint8_t tx_send_buf[TX_ONCE_MAX_SIZE]; /**< tx send buf. */ + volatile bool start_tx_flag; /**< start tx flag. */ + volatile bool start_flush_flag; /**< start flush flag. */ + bool tx_abort_flag; /**< tx abort flag. */ + bool rx_abort_flag; /**< rx abort flag. */ + bool is_dma_tx_mode; /**< dma tx mode. */ +} uart_env_t; + +/** + * @brief UART parameters structure definition + */ +typedef struct +{ + app_uart_id_t id; /**< specified UART module ID. */ + app_uart_pin_cfg_t pin_cfg; /**< the pin configuration information for the specified UART module. */ + app_uart_dma_cfg_t dma_cfg; /**< UART DMA configuration. */ + uart_init_t init; /**< UART communication parameters. */ + uart_env_t uart_dev; /**< UART event data. */ +} app_uart_params_t; + +/** + * @brief UART buffer structure definition + */ +typedef struct +{ + uint8_t * tx_buf; /**< Pointer to the TX buffer. */ + uint32_t tx_buf_size; /**< Size of the TX buffer. */ +} app_uart_tx_buf_t; +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_UART_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Initialize the APP UART DRIVER according to the specified parameters + * in the app_uart_params_t and app_uart_evt_handler_t. + * + * @param[in] p_params: Pointer to app_uart_params_t parameter which contains the + * configuration information for the specified UART module. + * @param[in] evt_handler: UART user callback function. + * @param[in] tx_buffer: Pointer to tx send buffer. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_uart_init(app_uart_params_t *p_params, app_uart_evt_handler_t evt_handler, app_uart_tx_buf_t *tx_buffer); + +/** + **************************************************************************************** + * @brief De-initialize the APP UART DRIVER peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_uart_deinit(app_uart_id_t id); + +/** + **************************************************************************************** + * @brief Send an amount of data in interrupt mode. + * + * @param[in] id: which UART module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_transmit_async(app_uart_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Send an amount of data in blocking mode. + * + * @param[in] id: which UART module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_transmit_sync(app_uart_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in interrupt mode. + * + * @param[in] id: which UART module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_receive_async(app_uart_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * + * @param[in] id: which UART module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_receive_sync(app_uart_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Return the UART handle. + * + * @param[in] id: UART Channel ID. + * + * @return Pointer to the specified ID's UART handle. + **************************************************************************************** + */ +uart_handle_t *app_uart_get_handle(app_uart_id_t id); + +/** + ***************************************************************************************** + * @brief Flush all log entries from the buffer + * + * @param[in] id: UART Channel ID. + * + ***************************************************************************************** + */ +void app_uart_flush(app_uart_id_t id); + +/** + **************************************************************************************** + * @brief Abort transmit and receive process and generate abort callback. + * + * @param[in] id: which UART module want to use. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_abort(app_uart_id_t id); + +/** + **************************************************************************************** + * @brief Abort transmit process and generate abort transmit callback. + * + * @param[in] id: which UART module want to use. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_abort_transmit(app_uart_id_t id); + +/** + **************************************************************************************** + * @brief Abort receive process and generate abort receive callback. + * + * @param[in] id: which UART module want to use. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_abort_receive(app_uart_id_t id); + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart_dma.h new file mode 100644 index 0000000..1564870 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/app_uart_dma.h @@ -0,0 +1,165 @@ +/** + **************************************************************************************** + * + * @file app_uart_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of UART app library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup APP_DRIVER APP DRIVER + * @{ + */ + +/** @defgroup APP_UART UART + * @brief UART APP module driver. + * @{ + */ + + +#ifndef _APP_UART_DMA_H_ +#define _APP_UART_DMA_H_ + +#include "app_uart.h" +#include "grx_hal.h" +#include "app_drv_config.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAL_UART_MODULE_ENABLED + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup APP_DMA_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize dma mode of the APP UART DRIVER according to the specified parameters + * in the app_uart_params_t. + * + * @param[in] p_params: Pointer to app_uart_params_t parameter which contains the + * configuration information for the specified UART module. + * + * @return Result of initialization. + **************************************************************************************** + */ +uint16_t app_uart_dma_init(app_uart_params_t *p_params); + +/** + **************************************************************************************** + * @brief De-initialize dma mode of the APP UART peripheral. + * + * @param[in] id: De-initialize for a specific ID. + * + * @return Result of De-initialization. + **************************************************************************************** + */ +uint16_t app_uart_dma_deinit(app_uart_id_t id); + +/** + **************************************************************************************** + * @brief Receive an amount of data in dma mode. + * + * @param[in] id: which UART module want to receive. + * @param[in] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to receive. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_dma_receive_async(app_uart_id_t id, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Send an amount of data in dma mode. + * + * @param[in] id: which UART module want to send. + * @param[in] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be sent. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_dma_transmit_async(app_uart_id_t id, uint8_t *p_data, uint16_t size); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +/** + **************************************************************************************** + * @brief Send an amount of data in DMA mode with DMA sg and llp function. + * + * @param[in] id: which UART module want to receive. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] sg_llp_config: The config of source and destination's sg and llp fuction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_transmit_dma_sg_llp(app_uart_id_t id, uint8_t *p_data, uint16_t size, dma_sg_llp_config_t *sg_llp_config); + +/** + **************************************************************************************** + * @brief Receive an amount of data in in dma_sg_llp mode. + * + * @param[in] id: which UART module want to transmit. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] sg_llp_config: The config of source and destination's sg and llp fuction. + * + * @return Result of operation. + **************************************************************************************** + */ +uint16_t app_uart_receive_dma_sg_llp(app_uart_id_t id, uint8_t *p_data, uint16_t size, dma_sg_llp_config_t *sg_llp_config); +#endif + +/** @} */ + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_delay.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_delay.h new file mode 100644 index 0000000..7e37dd5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_delay.h @@ -0,0 +1,328 @@ +/** + **************************************************************************************** + * + * @file gr55xx_delay.h + * @author BLE Driver Team + * @brief PERIPHERAL API DELAY DRIVER + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +#ifndef __GR55xx_DELAY_H__ +#define __GR55xx_DELAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "gr55xx.h" + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_DELAY DELAY + * @brief Delay HAL module driver. + * @{ + */ +/** @addtogroup HAL_DELAY_DEFINES Defines + * @{ + */ +#define DELAY_US_DWT /**< dealy us dwt define */ + +#if defined ( __CC_ARM ) + +#ifndef __STATIC_FORCEINLINE +#define __STATIC_FORCEINLINE static __forceinline /**< Static inline define */ +#endif + +#elif defined ( __GNUC__ ) + +#ifndef __STATIC_FORCEINLINE +#define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline /**< Static inline define */ +#endif + +#else + +#ifndef __STATIC_FORCEINLINE +#define __STATIC_FORCEINLINE __STATIC_INLINE /**< Static inline define */ +#endif + +#endif +/** @} */ + +#ifndef DELAY_US_DWT +/** @addtogroup HAL_DELAY_TYPEDEFS Typedefs + * @{ + */ +/** + * @brief Pointer to a function for delaying execution + */ +typedef void (* delay_func_t)(uint32_t); +/** @} */ +#endif + +#ifdef DELAY_US_DWT +/** @addtogroup HAL_DELAY_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Enable the DWT. + * @param _demcr_initial: demcr initial. + * @param _dwt_ctrl_initial: dwt ctrl initial. + **************************************************************************************** + */ +void hal_dwt_enable(uint32_t _demcr_initial, uint32_t _dwt_ctrl_initial); + +/** + **************************************************************************************** + * @brief Disable the DWT. + * @param _demcr_initial: demcr initial. + * @param _dwt_ctrl_initial: dwt ctrl initial. + **************************************************************************************** + */ +void hal_dwt_disable(uint32_t _demcr_initial, uint32_t _dwt_ctrl_initial); +/** @} */ + +/** @addtogroup HAL_DELAY_DEFINES Defines + * @{ + */ +/** + * @brief Timeout module init. This macro must be used in + * conjunction with the @ref HAL_TIMEOUT_DEINIT macro + */ +#define HAL_TIMEOUT_INIT() \ + uint32_t _demcr_initial = CoreDebug->DEMCR; \ + uint32_t _dwt_ctrl_initial = DWT->CTRL; \ +do { \ + hal_dwt_enable(_demcr_initial, _dwt_ctrl_initial); \ +} while (0) + +/** + * @brief Timeout module deinit. This macro must be used in + * conjunction with the @ref HAL_TIMEOUT_INIT macro + */ +#define HAL_TIMEOUT_DEINIT() \ +do { \ + hal_dwt_disable(_demcr_initial, _dwt_ctrl_initial); \ +} while(0) +/** @} */ + +/** @addtogroup HAL_DELAY_FUNCTIONS Functions + * @{ + */ +/** + **************************************************************************************** + * @brief Function for delaying execution for number of us. + * @note GR55xxx is based on ARM Cortex-M4, and this fuction is based on Data Watchpoint and Trace (DWT) unit so delay is precise. + * @param number_of_us: The maximum delay time is about 67 seconds in 64M system clock. + * The faster the system clock, the shorter the maximum delay time. + **************************************************************************************** + */ +__STATIC_FORCEINLINE void delay_us(uint32_t number_of_us) +{ + const uint8_t clocks[] = {64, 48, 16, 24, 16, 32}; + uint32_t cycles = number_of_us * (clocks[AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL]); + + if (number_of_us == 0) + { + return; + } + + HAL_TIMEOUT_INIT(); + + // Get start value of the cycle counter. + uint32_t cyccnt_initial = DWT->CYCCNT; + + // Wait time end + while ((DWT->CYCCNT - cyccnt_initial) < cycles) + {} + + HAL_TIMEOUT_DEINIT(); +} +/** @} */ +#endif + +#ifndef DELAY_US_DWT + +#if defined ( __CC_ARM ) + +#pragma push +#pragma O2 +/** @addtogroup HAL_DELAY_FUNCTIONS Functions + * @{ + */ + /** + **************************************************************************************** + * @brief Function for delaying execution for number of us. + * @note GR55xxx is based on ARM Cortex-M4, and this fuction is based on Data Watchpoint and Trace (DWT) unit so delay is precise. + * @param number_of_us: The maximum delay time is about 67 seconds in 64M system clock. + * The faster the system clock, the shorter the maximum delay time. + **************************************************************************************** + */ +__STATIC_FORCEINLINE void delay_us(uint32_t number_of_us) +{ + uint32_t pc = (unsigned int)__current_pc(); + uint8_t clocks[] = {64, 48, 16, 24, 16, 32}; + + if (number_of_us == 0) + { + return; + } + + static const uint16_t delay_ramcode[] = { + 0x3809, // SUBS r0, #9 + 0xd8fd, // BHI .-2 + 0x4770 // BX LR + }; + // Set LSB to 1 to execute code in Thumb mode. + const delay_func_t delay_ram_cycles = (delay_func_t)((((uint32_t)delay_ramcode) | 1)); + + static const uint16_t delay_flashcode[] = { + 0x3803, // SUBS r0, #3 + 0xd8fd, // BHI .-2 + 0x4770 // BX LR + }; + // Set LSB to 1 to execute code in Thumb mode. + const delay_func_t delay_flash_cycles = (delay_func_t)((((uint32_t)delay_flashcode) | 1)); + + static const uint16_t delay_aliascode[] = { + 0x3803, // SUBS r0, #3 + 0xd8fd, // BHI .-2 + 0x4770 // BX LR + }; + // Set LSB to 1 to execute code in Thumb mode. + const delay_func_t delay_alias_cycles = (delay_func_t)((((uint32_t)delay_aliascode) | 1)); + + uint32_t cycles = number_of_us * (clocks[AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL]); + + if(pc & GR55XX_RAM_ADDRESS) + delay_ram_cycles(cycles); + else if(pc & GR55XX_FLASH_ADDRESS) + delay_flash_cycles(cycles); + else if(pc & GR55XX_ALIAS_ADDRESS) + delay_alias_cycles(cycles); + else + { + cycles = cycles / 4; + __asm + { + loop: + NOP + SUBS cycles, #1 + BNE loop + } + } +} +#pragma pop + +#elif defined ( _WIN32 ) || defined ( __unix ) || defined ( __APPLE__ ) + +#ifndef CUSTOM_DELAY_US +/** + **************************************************************************************** + * @brief Function for delaying execution for number of us. + * @param number_of_us: The maximum delay time is about 67 seconds in 64M system clock. + * The faster the system clock, the shorter the maximum delay time. + **************************************************************************************** + */ +__STATIC_FORCEINLINE void delay_us(uint32_t number_of_us) +{ +} +#endif + +#elif defined ( __GNUC__ ) || ( __ICCARM__ ) +/** + **************************************************************************************** + * @brief Function for delaying execution for number of us. + * @param number_of_us: The maximum delay time is about 67 seconds in 64M system clock. + * The faster the system clock, the shorter the maximum delay time. + **************************************************************************************** + */ +__STATIC_FORCEINLINE void delay_us(uint32_t number_of_us) +{ + uint8_t clocks[] = {64, 48, 16, 24, 16, 32}; + + if (number_of_us) + { + uint32_t cycles; + cycles = number_of_us*(clocks[AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL])/6; + __asm__ volatile ("1:\n" + "NOP\n" + "NOP\n" + "NOP\n" + "SUBS %[cycles], %[cycles], #1\n" + "BNE.N 1b\n" + : [cycles] "=r" (cycles) + : "[cycles]" "r" (cycles) + ); + } +} +/** @} */ +#endif + +#endif + +/** @addtogroup HAL_DELAY_FUNCTIONS Functions + * @{ + */ +/** + * @brief Function for delaying execution for number of milliseconds. + * + * @note GR55xx is based on ARM Cortex-M4, and this fuction is based on Data Watchpoint and Trace (DWT) unit so delay is precise. + * + * @note Function internally calls @ref delay_us so the maximum delay is the + * same as in case of @ref delay_us. + * + * @param number_of_ms: The maximum delay time is about 67 seconds in 64M system clock. + * The faster the system clock, the shorter the maximum delay time. + * + */ +__STATIC_FORCEINLINE void delay_ms(uint32_t number_of_ms) +{ + delay_us(1000 * number_of_ms); + return; +} +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_DELAY_H__ */ +/** @} */ +/** @} */ +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal.h new file mode 100644 index 0000000..99ec139 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal.h @@ -0,0 +1,376 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal.h + * @author BLE Driver Team + * @brief This file contains all the functions prototypes for the HAL + * module driver. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_HAL HAL + * @brief HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_H__ +#define __GR55xx_HAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" +#include "gr55xx_hal_conf.h" +#include "gr55xx_delay.h" + +/** @addtogroup HAL_HAL_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_HAL_Callback Callback + * @{ + */ + +/** + * @brief HAL_HAL Callback function definition + */ + +typedef struct _hal_callback +{ + void (*msp_init)(void); /**< HAL init MSP callback */ + void (*msp_deinit)(void); /**< HAL de-init MSP callback */ +} hal_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_MACRO Defines + * @{ + */ + +/* Private macros ------------------------------------------------------------*/ +/* Exported macros ------------------------------------------------------------*/ +/** @defgroup HAL_Exported_Constants HAL Exported Constants + * @{ + */ + +/** @brief compare if a > b + * @sa CO_MAX + */ +#define CO_MAX(a,b) ((a) > (b) ? (a) : (b)) + +/** @brief Disable BLE_IRQn and BLESLP_IRQn. + * @sa BLE_INT_DISABLE + */ +#define BLE_INT_DISABLE() \ +do { \ + volatile uint32_t __ble_l_irq_rest = __get_PRIMASK(); \ + volatile bool __ble_int_status = NVIC_GetEnableIRQ(BLE_IRQn) || NVIC_GetEnableIRQ(BLESLP_IRQn); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_DisableIRQ(BLE_IRQn); \ + NVIC_DisableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); + +/** @brief Restore BLE_IRQn and BLESLP_IRQn. + * @sa BLE_INT_RESTORE + */ +#define BLE_INT_RESTORE() \ + __ble_l_irq_rest = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_EnableIRQ(BLE_IRQn); \ + NVIC_EnableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); \ +} while(0) + +/** @brief Disable interrupts globally in the system. + * This macro must be used in conjunction with the @ref GLOBAL_INT_RESTORE macro + * since this last one will close the brace that the current macro opens. This + * means that both macros must be located at the same scope level. + */ +#define GLOBAL_INT_DISABLE() \ +do { \ + volatile uint32_t __nvic_iser0 = 0xFFFFFFFF; \ + volatile uint32_t __nvic_iser1 = 0xFFFFFFFF; \ + volatile uint32_t __ret_pri = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + if( (NVIC->ICER[0] != 0xFFFFFFFF) || (NVIC->ICER[1] != 0xFFFFFFFF) ) \ + { \ + __nvic_iser0 = NVIC->ISER[0]; \ + __nvic_iser1 = NVIC->ISER[1]; \ + NVIC->ICER[0] = 0xFFFFFFFF; \ + NVIC->ICER[1] = 0xFFFFFFFF; \ + } \ + __set_PRIMASK(__ret_pri); \ + __DSB(); \ + __ISB(); \ + +/** @brief Restore external interrupts(Exception Type: 16~255) from the previous disable. + * @sa GLOBAL_INT_RESTORE + */ +#define GLOBAL_INT_RESTORE() \ + __ret_pri = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + if( (__nvic_iser0 != 0xFFFFFFFF) || (__nvic_iser1 != 0xFFFFFFFF) ) \ + { \ + NVIC->ISER[0] = __nvic_iser0; \ + NVIC->ISER[1] = __nvic_iser1; \ + } \ + __set_PRIMASK(__ret_pri); \ +} while(0) + +/** @brief Disable external interrupts with a priority lower than IRQn_Type in the system. + * This macro must be used in conjunction with the @ref LOCAL_INT_RESTORE macro + * since this last one will close the brace that the current macro opens. This + * means that both macros must be located at the same scope level. + */ +#define LOCAL_INT_DISABLE(IRQn_Type) \ +do { \ + uint32_t __l_irq_rest = __get_BASEPRI(); \ + __set_BASEPRI(NVIC_GetPriority(IRQn_Type) + \ + (1 << (NVIC_GetPriorityGrouping() + 1))); \ + +/** @brief Restore external interrupts(apart from the BLE) from the previous disable. + * @sa EXP_BLE_INT_RESTORE + */ +#define LOCAL_INT_RESTORE() \ + __set_BASEPRI(__l_irq_rest); \ +} while(0) + + +/** @brief Check if the program is running on the FPGA platform. + */ +#define CHECK_IS_ON_FPGA() (AON->FPGA_CTRL & AON_REG_FPGA_CTRL_EXIST) + +#define SYSTICK_RELOAD_VALUE (SysTick->LOAD) /**< SysTick Reload value. */ +#define SYSTICK_CURRENT_VALUE (SysTick->VAL) /**< SysTick Current value. */ + +/** @} */ + +/** @} */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_HAL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup HAL_Exported_Functions_Group1 Initialization and De-initialization Functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Initialize the Flash interface, the NVIC allocation and initial clock + configuration. It also initializes the source of time base when timeout + is needed. + (+) De-initialize common part of the HAL. + (+) Configure The time base source to have 1ms time base with a dedicated + Tick interrupt priority. + (++) SysTick timer is used by default as source of time base, but user can + eventually implement his or her proper time base source (a general purpose + timer for example or other time source), keeping in mind that Time base + duration should be kept as 1ms since PPP_TIMEOUT_VALUEs are defined and + handled in milliseconds basis. + (++) Time base configuration function (hal_init_tick()) is called automatically + at the beginning of the program after reset by hal_init(). + (++) Source of time base is configured to generate interrupts at regular + time intervals. Care must be taken if hal_delay() is called from a + peripheral ISR process, the Tick interrupt line must have higher priority + (numerically lower) than the peripheral interrupt. Otherwise the caller + ISR process will be blocked. + (++) Functions affecting time base configurations are declared as __Weak + to make override possible in case of other implementations in user file. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief This function configures time base source, NVIC and Low level hardware. + * + * @note This function is called at the beginning of program after reset and before + * the clock configuration. + * The SysTick configuration is based on AHB clock and the NVIC configuration + * is set to Priority group 4. + * When the time base configuration is done, time base tick starts incrementing. + * In the default implementation, SysTick is used as source of time base. + * The tick variable is incremented each 1ms in its ISR. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_init(void); + +/** + **************************************************************************************** + * @brief This function de-initializes common part of the HAL and stops the source + * of time base. + * + * @note This function is optional. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_deinit(void); + +/** + **************************************************************************************** + * @brief Initialize the MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_msp_init could be implemented in the user file. + **************************************************************************************** + */ +void hal_msp_init(void); + +/** + **************************************************************************************** + * @brief De-initialize the MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_msp_deinit could be implemented in the user file. + **************************************************************************************** + */ +void hal_msp_deinit(void); + +/** + **************************************************************************************** + * @brief This function configures the source of the time base. + * + * @param[in] tick_priority: Tick interrupt priority. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_init_tick (uint32_t tick_priority); + +/** @} */ + +/** @addtogroup HAL_Exported_Functions_Group2 HAL Control functions + * @brief HAL Control functions + * +@verbatim + =============================================================================== + ##### HAL Control functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Suspend the time base source interrupt + (+) Resume the time base source interrupt + (+) Get the HAL API driver version + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Suspend Tick increment. + * + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once hal_suspend_tick() + * is called, the SysTick interrupt will be disabled so Tick increment + * is suspended. + * This function is declared as __WEAK to be overwritten in case of other + * implementations in user file. + **************************************************************************************** + */ +void hal_suspend_tick(void); + +/** + **************************************************************************************** + * @brief Resume Tick increment. + * + * @note In the default implementation , SysTick timer is the source of time base. It is + * used to generate interrupts at regular time intervals. Once hal_resume_tick() + * is called, the SysTick interrupt will be enabled so Tick increment + * is resumed. + * The function is declared as __WEAK to be overwritten in case of other + * implementations in user file. + **************************************************************************************** + */ +void hal_resume_tick(void); + +/** + **************************************************************************************** + * @brief This function returns the HAL revision + * + * @return version: 0xXYZR (8 bits for each decimal, R for RC) + **************************************************************************************** + */ +uint32_t hal_get_hal_version(void); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc.h new file mode 100644 index 0000000..dd81b67 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc.h @@ -0,0 +1,608 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_adc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ADC HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_ADC ADC + * @brief ADC HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_ADC_H__ +#define __GR55xx_HAL_ADC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_adc.h" +#include "gr55xx_hal_def.h" +#include "gr55xx_hal_dma.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_ADC_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_ADC_state HAL ADC State + * @{ + */ + +/** + * @brief HAL ADC State Enumerations definition + */ +typedef enum +{ + HAL_ADC_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_ADC_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_ADC_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_ADC_STATE_ERROR = 0x04 /**< Peripheral in error */ + +} hal_adc_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_ADC_STRUCTURES Structures + * @{ + */ + +/** @defgroup ADC_Configuration ADC Configuration + * @{ + */ + +/** + * @brief ADC init structure definition + */ +typedef ll_adc_init_t adc_init_t; +/** @} */ + +/** @defgroup ADC_handle ADC Handle + * @{ + */ + +/** + * @brief ADC handle Structure definition + */ +typedef struct _adc_handle +{ + adc_init_t init; /**< ADC configuration parameters */ + + uint16_t *p_buffer; /**< Pointer to ADC conversion buffer */ + + __IO uint32_t buff_size; /**< Conversion buffer size */ + + __IO uint32_t buff_count; /**< Conversion buffer counter */ + + dma_handle_t *p_dma; /**< ADC DMA Handle parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_adc_state_t state; /**< ADC communication state */ + + __IO uint32_t error_code; /**< ADC error code */ + + uint32_t retention[2]; /**< ADC important register information. */ + +} adc_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_ADC_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup ADC_Callback ADC Callback + * @{ + */ + +/** + * @brief HAL ADC Callback function definition + */ +typedef struct _adc_callback +{ + void (*adc_msp_init)(adc_handle_t *p_adc); /**< ADC init MSP callback */ + void (*adc_msp_deinit)(adc_handle_t *p_adc); /**< ADC de-init MSP callback */ + void (*adc_conv_cplt_callback)(adc_handle_t *p_adc); /**< ADC conversion completed callback */ +} adc_callback_t; + +/** @} */ + +/** @} */ + +/** + * @brief ADC init structure definition + */ + +/** + * @defgroup HAL_ADC_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup ADC_Exported_Constants ADC Exported Constants + * @{ + */ + +/** @defgroup ADC_Error_Code ADC Error Code + * @{ + */ +#define HAL_ADC_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_ADC_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_ADC_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */ +#define HAL_ADC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error */ +/** @} */ + +/** @defgroup ADC_CLK ADC Clock Select + * @{ + */ +#define ADC_CLK_16M LL_ADC_CLK_16 /**< ADC Clock = 16 MHz */ +#define ADC_CLK_1P6M LL_ADC_CLK_1P6 /**< ADC Clock = 1.6 MHz */ +#define ADC_CLK_8M LL_ADC_CLK_8 /**< ADC Clock = 8 MHz */ +#define ADC_CLK_4M LL_ADC_CLK_4 /**< ADC Clock = 4 MHz */ +#define ADC_CLK_2M LL_ADC_CLK_2 /**< ADC Clock = 2 MHz */ +#define ADC_CLK_1M LL_ADC_CLK_1 /**< ADC Clock = 1 MHz */ +/** @} */ + +/** @defgroup ADC_REFERENCE ADC Reference Value Select + * @{ + */ +#define ADC_REF_VALUE_0P8 LL_ADC_REF_VALUE_0P8 /**< Reference = 0.85 V */ +#define ADC_REF_VALUE_1P2 LL_ADC_REF_VALUE_1P2 /**< Reference = 1.28 V */ +#define ADC_REF_VALUE_1P6 LL_ADC_REF_VALUE_1P6 /**< Reference = 1.60 V */ +/** @} */ + +/** @defgroup ADC_INPUT_MODE ADC Input Mode + * @brief Single or Differential mode + * @{ + */ +#define ADC_INPUT_SINGLE LL_ADC_INPUT_SINGLE /**< Single ended mode */ +#define ADC_INPUT_DIFFERENTIAL LL_ADC_INPUT_DIFFERENTIAL/**< Differential mode */ +/** @} */ + +/** @defgroup ADC_INPUT_SOURCE ADC Input Channel Select + * @{ + */ +#define ADC_INPUT_SRC_IO0 LL_ADC_INPUT_SRC_IO0 /**< Select MSIO0 as input */ +#define ADC_INPUT_SRC_IO1 LL_ADC_INPUT_SRC_IO1 /**< Select MSIO1 as input */ +#define ADC_INPUT_SRC_IO2 LL_ADC_INPUT_SRC_IO2 /**< Select MSIO2 as input */ +#define ADC_INPUT_SRC_IO3 LL_ADC_INPUT_SRC_IO3 /**< Select MSIO3 as input */ +#define ADC_INPUT_SRC_IO4 LL_ADC_INPUT_SRC_IO4 /**< Select MSIO4 as input */ +#define ADC_INPUT_SRC_TMP LL_ADC_INPUT_SRC_TMP /**< Select temperature as input */ +#define ADC_INPUT_SRC_BAT LL_ADC_INPUT_SRC_BAT /**< Select Vbattery as input */ +#define ADC_INPUT_SRC_REF LL_ADC_INPUT_SRC_REF /**< Select reference as input */ + +/** @} */ + +/** @defgroup ADC_REFERENCE_SOURCE ADC Reference Source Select + * @{ + */ +#define ADC_REF_SRC_BUF_INT LL_ADC_REF_SRC_BUF_INT /**< Select buffered internal reference as reference */ +#define ADC_REF_SRC_IO0 LL_ADC_REF_SRC_IO0 /**< Select MSIO0 as reference */ +#define ADC_REF_SRC_IO1 LL_ADC_REF_SRC_IO1 /**< Select MSIO1 as reference */ +#define ADC_REF_SRC_IO2 LL_ADC_REF_SRC_IO2 /**< Select MSIO2 as reference */ +#define ADC_REF_SRC_IO3 LL_ADC_REF_SRC_IO3 /**< Select MSIO3 as reference */ +/** @} */ + +/** + * @brief ADC_default_config initStruct default configuartion + */ +#define ADC_DEFAULT_CONFIG LL_ADC_DEFAULT_CONFIG +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup ADC_Exported_Macros ADC Exported Macros + * @{ + */ + +/** @brief Reset ADC handle states. + * @param __HANDLE__ ADC handle. + * @retval None + */ +#define __HAL_ADC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_ADC_STATE_RESET) + +/** @brief Enable the specified ADC peripheral. + * @param __HANDLE__ Specify the ADC Handle. + * @retval None + */ +#define __HAL_ADC_ENABLE(__HANDLE__) ll_adc_enable() + +/** @brief Disable the specified ADC peripheral. + * @param __HANDLE__ Specify the ADC Handle. + * @retval None + */ +#define __HAL_ADC_DISABLE(__HANDLE__) ll_adc_disable() + +/** @brief Enable the specified ADC clock. + * @param __HANDLE__ Specify the ADC Handle. + * @retval None + */ +#define __HAL_ADC_ENABLE_CLOCK(__HANDLE__) ll_adc_enable_clock() + +/** @brief Disable the specified ADC clock. + * @param __HANDLE__ Specify the ADC Handle. + * @retval None + */ +#define __HAL_ADC_DISABLE_CLOCK(__HANDLE__) ll_adc_disable_clock() + +/** @brief Check the FIFO is not empty. + * @param __HANDLE__ Specify the ADC Handle. + * @retval The new state of notempty flag (TRUE or FALSE). + */ +#define __HAL_ADC_GET_FLAG_NOTEMPTY(__HANDLE__) ll_adc_is_fifo_notempty() + +/** @brief Flush the FIFO. + * @param __HANDLE__ Specify the ADC Handle. + * @retval None + */ +#define __HAL_ADC_FLUSH_FIFO(__HANDLE__) do { \ + while(ll_adc_is_fifo_notempty()) \ + { \ + ll_adc_read_fifo(); \ + } \ + } while(0) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup ADC_Private_Macros ADC Private Macros + * @{ + */ + +/** + * @brief Check if ADC input source is valid. + * @param __INPUT__ ADC input source. + * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) + */ +#define IS_ADC_INPUT(__INPUT__) (((__INPUT__) == ADC_INPUT_SRC_IO0) || \ + ((__INPUT__) == ADC_INPUT_SRC_IO1) || \ + ((__INPUT__) == ADC_INPUT_SRC_IO2) || \ + ((__INPUT__) == ADC_INPUT_SRC_IO3) || \ + ((__INPUT__) == ADC_INPUT_SRC_IO4) || \ + ((__INPUT__) == ADC_INPUT_SRC_TMP) || \ + ((__INPUT__) == ADC_INPUT_SRC_BAT) || \ + ((__INPUT__) == ADC_INPUT_SRC_REF)) + +/** + * @brief Check if ADC input mode is valid. + * @param __MODE__ ADC input mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_ADC_INPUT_MODE(__MODE__) (((__MODE__) == ADC_INPUT_SINGLE) || \ + ((__MODE__) == ADC_INPUT_DIFFERENTIAL) + +/** + * @brief Check if ADC reference source is valid. + * @param __INPUT__ ADC reference source. + * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) + */ +#define IS_ADC_REF(__INPUT__) (((__INPUT__) == ADC_REF_SRC_BUF_INT) || \ + ((__INPUT__) == ADC_REF_SRC_INT) || \ + ((__INPUT__) == ADC_REF_SRC_IO0) || \ + ((__INPUT__) == ADC_REF_SRC_IO1) || \ + ((__INPUT__) == ADC_REF_SRC_IO2) || \ + ((__INPUT__) == ADC_REF_SRC_IO3)) + +/** + * @brief Check if ADC reference value is valid. + * @param __VALUE__ ADC reference value. + * @retval SET (__VALUE__ is valid) or RESET (__VALUE__ is invalid) + */ +#define IS_ADC_REF_VALUE(__VALUE__) (((__VALUE__) >= ADC_REF_VALUE_0P8) && \ + ((__VALUE__) <= ADC_REF_VALUE_1P6)) + +/** + * @brief Check if ADC clock is valid. + * @param __CLOCK__ ADC clock. + * @retval SET (__CLOCK__ is valid) or RESET (__CLOCK__ is invalid) + */ +#define IS_ADC_CLOCK(__CLOCK__) (((__CLOCK__) == ADC_CLK_16M) || \ + ((__CLOCK__) == ADC_CLK_8M) || \ + ((__CLOCK__) == ADC_CLK_4M) || \ + ((__CLOCK__) == ADC_CLK_2M) || \ + ((__CLOCK__) == ADC_CLK_1M) || \ + ((__CLOCK__) == ADC_CLK_1P6M)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_ADC_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup ADC_Exported_Functions_Group1 Initialization and de-initialization Functions + * @brief Initialization and Configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the ADC according to the specified parameters + * in the adc_init_t and initialize the associated handle. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_init(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief De-initialize the ADC peripheral. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_deinit(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Initialize the ADC MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_adc_msp_deinit can be implemented in the user file. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + **************************************************************************************** + */ +void hal_adc_msp_init(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief De-initialize the ADC MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_adc_msp_deinit can be implemented in the user file. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + **************************************************************************************** + */ +void hal_adc_msp_deinit(adc_handle_t *p_adc); + +/** @} */ + +/** @addtogroup ADC_Exported_Functions_Group2 IO Operation Functions + * @brief ADC polling and DMA conversion management functions. + * @{ + */ + + /** + **************************************************************************************** + * @brief Set the FIFO threshold for DMA trigger. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * @param[in] threshold: FIFO threshold value ranging bwtween 0x0U ~ 0x64U. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_set_dma_threshold(adc_handle_t *p_adc, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Get the FIFO threshold for DMA trigger. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * + * @return FIFO threshold + **************************************************************************************** + */ +uint32_t hal_adc_get_dma_threshold(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Polling for conversion. + * + * @param[in] p_adc: Pointer to an ADC handle. + * @param[in] p_data: Pointer to data buffer which to store ADC conversion results. + * @param[in] length: Length of data buffer. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_poll_for_conversion(adc_handle_t *p_adc, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief DMA for conversion. + * + * @param[in] p_adc: Pointer to an ADC handle. + * @param[in] p_data: Pointer to data buffer which to store ADC conversion results. + * @param[in] length: Length of data buffer, ranging between 0 and 4095. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_start_dma(adc_handle_t *p_adc, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Abort ongoing conversion (blocking mode). + * + * @note This procedure could be only used for aborting conversion started in DMA mode. + * This procedure performs following operations: + * - Disable ADC clock, stop conversion + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY. + * This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * + * @param[in] p_adc: ADC handle. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_stop_dma(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Conversion completed callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_adc_msp_deinit can be implemented in the user file. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + **************************************************************************************** + */ +void hal_adc_conv_cplt_callback(adc_handle_t* p_adc); + +/** @} */ + +/** @defgroup ADC_Exported_Functions_Group3 Peripheral State and Errors Functions + * @brief ADC control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the ADC. + (+) hal_adc_get_state() API can be helpful to check in run-time the state of the ADC peripheral. + (+) hal_adc_get_error() check in run-time Errors occurring during communication. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the ADC handle state. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * + * @retval ::HAL_ADC_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_ADC_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_ADC_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_ADC_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_adc_state_t hal_adc_get_state(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Return the ADC error code. + * + * @param[in] p_adc: Pointer to an ADC handle which contains the configuration information for + * the specified ADC module. + * + * @return ADC error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_adc_get_error(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Suspend some registers related to ADC configuration before sleep. + * @param[in] p_adc: Pointer to a ADC handle which contains the configuration + * information for the specified ADC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_suspend_reg(adc_handle_t *p_adc); + +/** + **************************************************************************************** + * @brief Restore some registers related to ADC configuration after sleep. + * This function must be used in conjunction with the hal_adc_suspend_reg(). + * @param[in] p_adc: Pointer to a ADC handle which contains the configuration + * information for the specified ADC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_adc_resume_reg(adc_handle_t *p_adc); + +/** @} */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_ADC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_temp_api.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_temp_api.h new file mode 100644 index 0000000..138fc6d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_temp_api.h @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_adc_temp_api.h + * + * @brief Header file - GR55xx temperature module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __GR55XX_HAL_ADC_TEMP_API_H__ +#define __GR55XX_HAL_ADC_TEMP_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize ADC temperature detection. + * + **************************************************************************************** + */ +void hal_adc_temp_init(void); + +/** + **************************************************************************************** + * @brief Get the chip internal temperature. + * + * @return The value of temperature. Unit (Centigrade). + **************************************************************************************** + */ +double hal_adc_temp_read(void); + +#ifdef __cplusplus +} +#endif + +#endif // __GR55XX_HAL_ADC_TEMP_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_vbat_api.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_vbat_api.h new file mode 100644 index 0000000..2cffde5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_vbat_api.h @@ -0,0 +1,75 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_adc_vbat_api.h + * + * @brief Header file - GR55xx battery module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __GR55XX_HAL_ADC_VBAT_API_H__ +#define __GR55XX_HAL_ADC_VBAT_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Initialize ADC battery voltage detection. + * + **************************************************************************************** + */ +void hal_adc_vbat_init(void); + +/** + **************************************************************************************** + * @brief Get the battery voltage. + * + * @return The volatge of battery. Unit (volt). + **************************************************************************************** + */ +double hal_adc_vbat_read(void); + +#ifdef __cplusplus +} +#endif + +#endif // __GR55XX_HAL_ADC_VBAT_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_voltage_api.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_voltage_api.h new file mode 100644 index 0000000..d57a823 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_adc_voltage_api.h @@ -0,0 +1,90 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_adc_voltage_api.h + * + * @brief Header file - GR55xx ADC voltage module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __GR55XX_HAL_ADC_VOLTAGE_API_H__ +#define __GR55XX_HAL_ADC_VOLTAGE_API_H__ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "gr55xx_hal_adc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +/** + **************************************************************************************** + * @brief Convert the ADC conversion results to a voltage value(internal reference). + * + * @param[in] hadc: Pointer to a ADC handle which contains the configuration information for + * the specified ADC module. + * @param[in] inbuf: Pointer to data buffer which storage ADC conversion results. + * @param[out] outbuf: Pointer to data buffer which to storage voltage results. + * @param[in] buflen: Length of data buffer, ranging between 0 and 4095. + * + * @return Result of operation. + **************************************************************************************** + */ +void hal_adc_voltage_intern(adc_handle_t *hadc, uint16_t *inbuf, double *outbuf, uint32_t buflen); + +/** + **************************************************************************************** + * @brief Convert the ADC conversion results to a voltage value(external reference). + * + * @param[in] hadc: Pointer to a ADC handle which contains the configuration information for + * the specified ADC module. + * @param[in] vref: slope of ADC. + * @param[in] inbuf: Pointer to data buffer which storage ADC conversion results. + * @param[out] outbuf: Pointer to data buffer which to storage voltage results. + * @param[in] buflen: Length of data buffer, ranging between 0 and 4095. + * + * @return Result of operation. + **************************************************************************************** + */ +void hal_adc_voltage_extern(adc_handle_t *hadc, double vref, uint16_t *inbuf, double *outbuf, uint32_t buflen); + +#ifdef __cplusplus +} +#endif + +#endif // __GR55XX_HAL_ADC_VOLTAGE_API_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aes.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aes.h new file mode 100644 index 0000000..d5fdcac --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aes.h @@ -0,0 +1,851 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_aes.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AES HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_AES AES + * @brief AES HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_AES_H__ +#define __GR55xx_HAL_AES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_aes.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_AES_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_AES_state HAL AES State + * @{ + */ + +/** + * @brief HAL AES State Enumerations definition + */ +typedef enum +{ + HAL_AES_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_AES_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_AES_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_AES_STATE_ERROR = 0x03, /**< Peripheral in error */ + HAL_AES_STATE_TIMEOUT = 0x04, /**< Peripheral in timeout */ + HAL_AES_STATE_SUSPENDED = 0x05, /**< Peripheral in suspended */ +} hal_aes_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_AES_STRUCTURES Structures + * @{ + */ + +/** @defgroup AES_Configuration AES Configuration + * @{ + */ + +/** + * @brief AES Init Structure definition + */ +typedef struct _aes_init +{ + uint32_t key_size; /**< 128, 192 or 256-bits key length. + This parameter can be a value of @ref AES_Key_Size */ + + uint32_t operation_mode; /**< AES operating mode. + This parameter can be a value of @ref AES_OPERATION_MODE */ + + uint32_t chaining_mode; /**< AES chaining mode. + This parameter can be a value of @ref AES_CHAININGMODE */ + + uint32_t *p_key; /**< Encryption/Decryption Key. + Normally, it should be a global pointer. */ + + uint32_t *p_init_vector; /**< Initialization Vector used for CBC modes */ + + uint32_t dpa_mode; /**< DPA Mode */ + + uint32_t *p_seed; /**< Random seeds */ + +} aes_init_t; +/** @} */ + +/** @defgroup AES_handle AES Handle + * @{ + */ + +/** + * @brief AES handle Structure definition + */ +typedef struct _aes_handle +{ + aes_regs_t *p_instance; /**< AES registers base address */ + + aes_init_t init; /**< AES operation parameters */ + + uint32_t *p_cryp_input_buffer; /**< Pointer to CRYP processing (encryption or decryption) input buffer */ + + uint32_t *p_cryp_output_buffer; /**< Pointer to CRYP processing (encryption or decryption) output buffer */ + + uint32_t block_size; /**< Data size in blocks (16 bytes per block) */ + + uint32_t block_count; /**< Blocks count */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_aes_state_t state; /**< AES operation state */ + + __IO uint32_t error_code; /**< AES Error code */ + + uint32_t timeout; /**< Timeout for the AES operation */ + + uint32_t retention[18]; /**< AES important register information. */ + +} aes_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_AES_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup AES_Callback AES Callback + * @{ + */ + +/** + * @brief HAL AES Callback function definition + */ +typedef struct _aes_callback +{ + void (*aes_msp_init)(aes_handle_t *p_aes); /**< AES init MSP callback */ + void (*aes_msp_deinit)(aes_handle_t *p_aes); /**< AES de-init MSP callback */ + void (*aes_error_callback)(aes_handle_t *p_aes); /**< AES error callback */ + void (*aes_done_callback)(aes_handle_t *p_aes); /**< AES encrypt or decrypt done callback */ +} aes_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_AES_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup AES_Exported_Constants AES Exported Constants + * @{ + */ + +/** @defgroup AES_Error_Code AES Error Code + * @{ + */ +#define HAL_AES_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_AES_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_AES_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_AES_ERROR_INVALID_PARAM ((uint32_t)0x00000004) /**< Invalid parameters error */ +/** @} */ + +/** @defgroup AES_Key_Size AES Key Size + * @{ + */ +#define AES_KEYSIZE_128BITS LL_AES_KEY_SIZE_128 /**< 128 bits */ +#define AES_KEYSIZE_192BITS LL_AES_KEY_SIZE_192 /**< 192 bits */ +#define AES_KEYSIZE_256BITS LL_AES_KEY_SIZE_256 /**< 256 bits */ +/** @} */ + +/** @defgroup AES_Block_Size AES Block Size + * @{ + */ +#define AES_BLOCK_MAX (2048) /**< Block max size */ +#define AES_BLOCKSIZE_BITS (128) /**< Block size in bits */ +#define AES_BLOCKSIZE_BYTES (AES_BLOCKSIZE_BITS >> 3) /**< Block size in bytes */ +#define AES_BLOCKSIZE_WORDS (AES_BLOCKSIZE_BYTES >> 2) /**< Block size in words */ +/** @} */ + +/** @defgroup AES_OPERATION_MODE AES Operation Mode + * @{ + */ +#define AES_OPERATION_MODE_ENCRYPT (1) /**< Encrypt operation mode */ +#define AES_OPERATION_MODE_DECRYPT (0) /**< Decrypt operation mode */ +/** @} */ + +/** @defgroup AES_CHAININGMODE AES Chaining Mode + * @{ + */ +#define AES_CHAININGMODE_ECB LL_AES_OPERATION_MODE_ECB /**< ECB chaining mode */ +#define AES_CHAININGMODE_CBC LL_AES_OPERATION_MODE_CBC /**< CBC chaining mode */ +/** @} */ + +/** @defgroup AES_Flags_definition AES Flags Definition + * @{ + */ +#define AES_FLAG_DATAREADY LL_AES_FLAG_DATAREADY /**< Data ready flag */ +#define AES_FLAG_DMA_DONE LL_AES_FLAG_DMA_DONE /**< DMA transfer done flag */ +#define AES_FLAG_DMA_ERR LL_AES_FLAG_DMA_ERR /**< DMA transfer error flag */ +#define AES_FLAG_KEY_VALID LL_AES_FLAG_KEY_VALID /**< Key valid flag */ +/** @} */ + +/** @defgroup AES_Interrupt_definition AES Interrupt definition + * @{ + */ +#define AES_IT_DONE ((uint32_t)0x00000001) /**< AES Encrypted or Decrypted Data Done Interrupt source */ +/** @} */ + +/** @defgroup AES_Timeout_definition AES Timeout definition + * @{ + */ +#define HAL_AES_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup AES_Exported_Macros AES Exported Macros + * @{ + */ + +/** @brief Reset AES handle states. + * @param __HANDLE__ AES handle. + * @retval None + */ +#define __HAL_AES_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_AES_STATE_RESET) + +/** @brief Enable the specified AES peripheral. + * @param __HANDLE__ Specifies the AES Handle. + * @retval None + */ +#define __HAL_AES_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, AES_CTRL_ENABLE) + +/** @brief Disable the specified AES peripheral. + * @param __HANDLE__ Specifies the AES Handle. + * @retval None + */ +#define __HAL_AES_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, AES_CTRL_ENABLE) + +/** @brief Enable the AES interrupt. + * @param __HANDLE__ Specifies the AES Handle. + * @retval None + */ +#define __HAL_AES_ENABLE_IT(__HANDLE__) ll_aes_enable_it_done((__HANDLE__)->p_instance) + +/** @brief Disable the AES interrupt. + * @param __HANDLE__ Specifies the AES Handle. + * @retval None + */ +#define __HAL_AES_DISABLE_IT(__HANDLE__) ll_aes_disable_it_done((__HANDLE__)->p_instance) + +/** @brief Check whether the specified AES interrupt flag is set or not. + * @param __HANDLE__ Specifies the AES Handle. + * @param __FLAG__ Specifies the interrupt flag to check. + * This parameter can be the following value: + * @arg @ref AES_IT_DONE Encrypted or Decrypted Data Done Interrupt + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_AES_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INTERRUPT, (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified AES interrupt flag. + * @param __HANDLE__ Specifies the AES interrupt Handle. + * @param __FLAG__ Specifies the flag to clear. + * This parameter can be the following value: + * @arg @ref AES_IT_DONE Encrypted or Decrypted Data Done Interrupt + * @retval None + */ +#define __HAL_AES_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INTERRUPT, (__FLAG__)) + +/** @brief Check whether the specified AES flag is set or not. + * @param __HANDLE__ Specifies the AES Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref AES_FLAG_DATAREADY Data ready flag + * @arg @ref AES_FLAG_DMA_DONE DMA transfer done flag + * @arg @ref AES_FLAG_DMA_ERR DMA transfer error flag + * @arg @ref AES_FLAG_KEY_VALID Key valid flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_AES_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STATUS, (__FLAG__)) != 0) ? SET : RESET) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup AES_Private_Macro AES Private Macros + * @{ + */ + +/** @brief Check if AES Key Size is valid. + * @param __SIZE__ AES Key Size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_AES_KEY_SIZE(__SIZE__) (((__SIZE__) == AES_KEYSIZE_128BITS) || \ + ((__SIZE__) == AES_KEYSIZE_192BITS) || \ + ((__SIZE__) == AES_KEYSIZE_256BITS)) + +/** @brief Check if AES Operation Mode is valid. + * @param __MODE__ AES Operation Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_AES_OPERATION_MODE(__MODE__) (((__MODE__) == AES_OPERATION_MODE_ENCRYPT) || \ + ((__MODE__) == AES_OPERATION_MODE_DECRYPT)) + +/** @brief Check if AES Chaining Mode is valid. + * @param __MODE__ AES Chaining Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_AES_CHAININGMODE(__MODE__) (((__MODE__) == AES_CHAININGMODE_ECB) || \ + ((__MODE__) == AES_CHAININGMODE_CBC)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_AES_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup AES_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the AESx peripheral: + + (+) User must implement hal_aes_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_aes_init() to configure the selected device with + the selected configuration: + (++) Key Size + (++) operation_mode + (++) ChainingMode + (++) key + (++) init_vector + (++) DPAMode + (++) Seed + + (+) Call the function hal_aes_deinit() to restore the default configuration + of the selected AESx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the AES according to the specified parameters + * in the aes_init_t and initialize the associated handle. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration + * information for the specified AES module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_init(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief De-initialize the AES peripheral. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration + * information for the specified AES module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_deinit(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief Initialize the AES MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_aes_msp_deinit can be implemented in the user file. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration + * information for the specified AES module. + **************************************************************************************** + */ +void hal_aes_msp_init(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief De-initialize the AES MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_aes_msp_deinit can be implemented in the user file. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration + * information for the specified AES module. + **************************************************************************************** + */ +void hal_aes_msp_deinit(aes_handle_t *p_aes); + +/** @} */ + +/** @addtogroup AES_Exported_Functions_Group2 IO operation functions + * @brief AES Encrypt/Decrypt functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + This subsection provides a set of functions allowing to manage the AES encrypt or decrypt. + + (#) There are two mode of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing are returned by the same function + after finishing transfer. + (++) Non-Blocking mode: The communication is performed using Interrupts + or DMA. These API return the HAL status. + The end of the data processing will be indicated through the + dedicated AES IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_aes_done_callback() user callbacks will be executed respectively + at the end of the encrypt or decrypt process + The hal_aes_error_callback() user callback will be executed when a error is detected + + (#) Blocking mode API's are : + (++) hal_aes_ecb_encrypt() + (++) hal_aes_ecb_decrypt() + (++) hal_aes_cbc_encrypt() + (++) hal_aes_cbc_decrypt() + + (#) Non-Blocking mode API's with Interrupt are : + (++) hal_aes_ecb_encrypt_it() + (++) hal_aes_ecb_decrypt_it() + (++) hal_aes_cbc_encrypt_it() + (++) hal_aes_cbc_decrypt_it() + + (#) Non-Blocking mode API's with DMA are : + (++) hal_aes_ecb_encrypt_dma() + (++) hal_aes_ecb_decrypt_dma() + (++) hal_aes_cbc_encrypt_dma() + (++) hal_aes_cbc_decrypt_dma() + + (#) A set of encrypt or decrypt Callbacks are provided in Non_Blocking mode: + (++) hal_aes_done_callback() + (++) hal_aes_error_callback() + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in blocking mode in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_encrypt(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in blocking mode in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_decrypt(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in blocking mode in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_encrypt(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in blocking mode in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_decrypt(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in non-blocking mode with Interrupt in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_encrypt_it(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in non-blocking mode with Interrupt in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_decrypt_it(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data); + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in non-blocking mode with Interrupt in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_encrypt_it(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in non-blocking mode with Interrupt in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_decrypt_it(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data); + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in non-blocking mode with DMA in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_encrypt_dma(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in non-blocking mode with DMA in ECB mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_ecb_decrypt_dma(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data); + +/** + **************************************************************************************** + * @brief Encrypted an amount of data in non-blocking mode with DMA in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_plain_data: Pointer to plain data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_cypher_data: Pointer to cypher data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_encrypt_dma(aes_handle_t *p_aes, uint32_t *p_plain_data, uint32_t number, uint32_t *p_cypher_data); + +/** + **************************************************************************************** + * @brief Decrypted an amount of data in non-blocking mode with DMA in CBC mode. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] p_cypher_data: Pointer to cypher data buffer + * @param[in] number: Amount of data to be decrypted in bytes + * @param[out] p_plain_data: Pointer to plain data buffer + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_cbc_decrypt_dma(aes_handle_t *p_aes, uint32_t *p_cypher_data, uint32_t number, uint32_t *p_plain_data); + +/** @} */ + +/** @addtogroup AES_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle AES interrupt request. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified the specified AES module. + **************************************************************************************** + */ +void hal_aes_irq_handler(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief Encrypt or decrypt Done callback. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + **************************************************************************************** + */ +void hal_aes_done_callback(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief AES error callback. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + **************************************************************************************** + */ +void hal_aes_error_callback(aes_handle_t *p_aes); + +/** @} */ + +/** @defgroup AES_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief AES control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the AES. + (+) hal_aes_get_state() API can be helpful to check in run-time the state of the AES peripheral. + (+) hal_aes_get_error() check in run-time Errors occurring during communication. + (+) hal_aes_set_timeout() set the timeout during internal process. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the AES handle state. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * + * @retval ::HAL_AES_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_AES_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_AES_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_AES_STATE_ERROR: Peripheral in error. + * @retval ::HAL_AES_STATE_TIMEOUT: Peripheral in timeout. + * @retval ::HAL_AES_STATE_SUSPENDED: Peripheral in suspended. + **************************************************************************************** + */ +hal_aes_state_t hal_aes_get_state(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief Return the AES error code. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * + * @return AES error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_aes_get_error(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief Set the AES internal process timeout value. + * + * @param[in] p_aes: Pointer to an AES handle which contains the configuration information for + * the specified AES module. + * @param[in] timeout: Internal process timeout value. + **************************************************************************************** + */ +void hal_aes_set_timeout(aes_handle_t *p_aes, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Suspend some registers related to AES configuration before sleep. + * @param[in] p_aes: Pointer to a AES handle which contains the configuration + * information for the specified AES module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_suspend_reg(aes_handle_t *p_aes); + +/** + **************************************************************************************** + * @brief Restore some registers related to AES configuration after sleep. + * This function must be used in conjunction with the hal_aes_suspend_reg(). + * @param[in] p_aes: Pointer to a AES handle which contains the configuration + * information for the specified AES module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aes_resume_reg(aes_handle_t *p_aes); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_AES_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio.h new file mode 100644 index 0000000..c186db0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio.h @@ -0,0 +1,419 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_aon_gpio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AON GPIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_AON_GPIO AON_GPIO + * @brief AON_GPIO HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_AON_GPIO_H__ +#define __GR55xx_HAL_AON_GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_aon_gpio.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_AON_GPIO_ENUMERATIONS Enumerations + * @{ + */ + +/** + * @brief AON_GPIO Bit SET and Bit RESET enumerations + */ +typedef enum +{ + AON_GPIO_PIN_RESET = 0U, /**< AON GPIO pin low level.*/ + AON_GPIO_PIN_SET /**< AON GPIO pin high level.*/ +} aon_gpio_pin_state_t; + +/** @} */ + +/** @addtogroup HAL_AON_GPIO_STRUCTURES Structures + * @{ + */ + +/** + * @brief AON_GPIO init structure definition + */ +typedef struct _aon_gpio_init +{ + uint32_t pin; /**< Specifies the AON_GPIO pins to be configured. + This parameter can be any value of @ref AON_GPIO_Pins */ + + uint32_t mode; /**< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref AON_GPIO_Mode */ + + uint32_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. + This parameter can be a value of @ref AON_GPIO_Pull */ + + uint32_t mux; /**< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref GPIOEx_Mux_Function_Selection. */ +} aon_gpio_init_t; + +/** @} */ + +/** @addtogroup HAL_AON_GPIO_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup AON_GPIO_Callback AON_GPIO Callback + * @{ + */ + +/** + * @brief HAL AON_GPIO Callback function definition + */ +typedef struct _aon_gpio_callback +{ + void (*aon_gpio_callback)(uint16_t aon_gpio_pin); /**< AON GPIO pin detection callback */ +} aon_gpio_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_AON_GPIO_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup AON_GPIO_Exported_Constants AON_GPIO Exported Constants + * @{ + */ + +/** @defgroup AON_GPIO_Pins AON_GPIO pins + * @{ + */ +#define AON_GPIO_PIN_0 ((uint16_t)0x0001U) /**< Pin 0 selected */ +#define AON_GPIO_PIN_1 ((uint16_t)0x0002U) /**< Pin 1 selected */ +#define AON_GPIO_PIN_2 ((uint16_t)0x0004U) /**< Pin 2 selected */ +#define AON_GPIO_PIN_3 ((uint16_t)0x0008U) /**< Pin 3 selected */ +#define AON_GPIO_PIN_4 ((uint16_t)0x0010U) /**< Pin 4 selected */ +#define AON_GPIO_PIN_5 ((uint16_t)0x0020U) /**< Pin 5 selected */ +#define AON_GPIO_PIN_6 ((uint16_t)0x0040U) /**< Pin 6 selected */ +#define AON_GPIO_PIN_7 ((uint16_t)0x0080U) /**< Pin 7 selected */ + +#define AON_GPIO_PIN_ALL ((uint16_t)0x00FFU) /**< All pins selected */ + +#define AON_GPIO_PIN_MASK (0x000000FFU) /**< PIN mask for assert test */ +/** @} */ + +/** @defgroup AON_GPIO_Mode AON_GPIO mode + * @brief AON_GPIO Configuration Mode + * Elements values convention: 0x000000YX + * - X : IO Direction mode (Input, Output, Mux) + * - Y : IT trigger detection + * @{ + */ +#define AON_GPIO_MODE_INPUT (LL_AON_GPIO_MODE_INPUT << 0) /**< Input Mode */ +#define AON_GPIO_MODE_OUTPUT (LL_AON_GPIO_MODE_OUTPUT << 0) /**< Output Mode */ +#define AON_GPIO_MODE_MUX (LL_GPIO_MODE_MUX << 0) /**< Mux Mode */ +#define AON_GPIO_MODE_IT_RISING (LL_AON_GPIO_TRIGGER_RISING << 4) /**< Interrupt Mode with Rising edge trigger detection */ +#define AON_GPIO_MODE_IT_FALLING (LL_AON_GPIO_TRIGGER_FALLING << 4) /**< Interrupt Mode with Falling edge trigger detection */ +#define AON_GPIO_MODE_IT_HIGH (LL_AON_GPIO_TRIGGER_HIGH << 4) /**< Interrupt Mode with High-level trigger detection */ +#define AON_GPIO_MODE_IT_LOW (LL_AON_GPIO_TRIGGER_LOW << 4) /**< Interrupt Mode with Low-level trigger detection */ +/** @} */ + + +/** @defgroup AON_GPIO_Pull AON_GPIO pull + * @brief AON_GPIO Pull-Up or Pull-Down activation + * @{ + */ +#define AON_GPIO_NOPULL LL_AON_GPIO_PULL_NO /**< No Pull-up or Pull-down activation */ +#define AON_GPIO_PULLUP LL_AON_GPIO_PULL_UP /**< Pull-up activation */ +#define AON_GPIO_PULLDOWN LL_AON_GPIO_PULL_DOWN /**< Pull-down activation */ +/** @} */ + +/** + * @brief AON_GPIO_default_config initStruct default configuartion + */ +#define AON_GPIO_DEFAULT_CONFIG \ +{ \ + .pin = AON_GPIO_PIN_ALL, \ + .mode = AON_GPIO_MODE_INPUT, \ + .pull = AON_GPIO_PULLDOWN, \ + .mux = AON_GPIO_MUX_7, \ +} +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup AON_GPIO_Exported_Macros AON_GPIO Exported Macros + * @{ + */ + +/** + * @brief Check whether the specified AON_GPIO pin is asserted or not. + * @param __AON_GPIO_PIN__ specifies the AON_GPIO pin to be checked. + * This parameter can be AON_GPIO_PIN_x where x can be (0..15). + * @retval The new state of __AON_GPIO_PIN__ (SET or RESET). + */ +#define __HAL_AON_GPIO_IT_GET_IT(__AON_GPIO_PIN__) ll_aon_gpio_read_flag_it(__AON_GPIO_PIN__) + +/** + * @brief Clear the AON_GPIO pin pending bits. + * @param __AON_GPIO_PIN__ specifies the AON_GPIO pins to be cleared. + * This parameter can be any combination of AON_GPIO_PIN_x where x can be (0..15). + * @retval None + */ +#define __HAL_AON_GPIO_IT_CLEAR_IT(__AON_GPIO_PIN__) ll_aon_gpio_clear_flag_it(__AON_GPIO_PIN__) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup AON_GPIO_Private_Macros AON_GPIO Private Macros + * @{ + */ + +/** + * @brief Check if AON GPIO pin action is valid. + * @param __ACTION__ AON GPIO pin action. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_AON_GPIO_PIN_ACTION(__ACTION__) (((__ACTION__) == AON_GPIO_PIN_RESET) || ((__ACTION__) == AON_GPIO_PIN_SET)) + +/** + * @brief Check if AON GPIO pins are valid. + * @param __PIN__ AON GPIO pins. + * @retval SET (__PIN__ is valid) or RESET (__PIN__ is invalid) + */ +#define IS_AON_GPIO_PIN(__PIN__) ((((__PIN__) & AON_GPIO_PIN_MASK) != 0x00U) &&\ + (((__PIN__) & ~AON_GPIO_PIN_MASK) == 0x00U)) + +/** + * @brief Check if AON GPIO mode is valid. + * @param __MODE__ AON GPIO mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_AON_GPIO_MODE(__MODE__) (((__MODE__) == AON_GPIO_MODE_INPUT) ||\ + ((__MODE__) == AON_GPIO_MODE_OUTPUT) ||\ + ((__MODE__) == AON_GPIO_MODE_MUX) ||\ + ((__MODE__) == AON_GPIO_MODE_IT_RISING) ||\ + ((__MODE__) == AON_GPIO_MODE_IT_FALLING) ||\ + ((__MODE__) == AON_GPIO_MODE_IT_HIGH) ||\ + ((__MODE__) == AON_GPIO_MODE_IT_LOW)) + +/** + * @brief Check if AON GPIO pull type is valid. + * @param __PULL__ AON GPIO pull type. + * @retval SET (__PULL__ is valid) or RESET (__PULL__ is invalid) + */ +#define IS_AON_GPIO_PULL(__PULL__) (((__PULL__) == AON_GPIO_NOPULL) ||\ + ((__PULL__) == AON_GPIO_PULLUP) || \ + ((__PULL__) == AON_GPIO_PULLDOWN)) + +/** @} */ + +/** @} */ + +/* Include AON GPIO HAL Extended module */ +#include "gr55xx_hal_aon_gpio_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_AON_GPIO_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup AON_GPIO_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the AON_GPIOx peripheral according to the specified parameters in the @ref aon_gpio_init_t. + * + * @param[in] p_aon_gpio_init: Pointer to an @ref aon_gpio_init_t structure that contains + * the configuration information for the specified AON_GPIO peripheral port. + **************************************************************************************** + */ +void hal_aon_gpio_init(aon_gpio_init_t *p_aon_gpio_init); + +/** + **************************************************************************************** + * @brief De-initialize the AON_GPIOx peripheral registers to their default reset values. + * + * @param[in] aon_gpio_pin: Specifies the port bit to be written. + * This parameter can be a combination of the following values: + * @arg @ref AON_GPIO_PIN_0 + * @arg @ref AON_GPIO_PIN_1 + * @arg @ref AON_GPIO_PIN_2 + * @arg @ref AON_GPIO_PIN_3 + * @arg @ref AON_GPIO_PIN_4 + * @arg @ref AON_GPIO_PIN_5 + * @arg @ref AON_GPIO_PIN_6 + * @arg @ref AON_GPIO_PIN_7 + * @arg @ref AON_GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_aon_gpio_deinit(uint32_t aon_gpio_pin); + +/** @} */ + +/** @addtogroup AON_GPIO_Exported_Functions_Group2 IO operation functions + * @brief AON_GPIO Read, Write, Toggle, Lock and EXTI management functions. + * @{ + */ + +/** + **************************************************************************************** + * @brief Read the specified input port pin. + * + * @param[in] aon_gpio_pin: Specifies the port bit to be read. + * This parameter can be one of the following values: + * @arg @ref AON_GPIO_PIN_0 + * @arg @ref AON_GPIO_PIN_1 + * @arg @ref AON_GPIO_PIN_2 + * @arg @ref AON_GPIO_PIN_3 + * @arg @ref AON_GPIO_PIN_4 + * @arg @ref AON_GPIO_PIN_5 + * @arg @ref AON_GPIO_PIN_6 + * @arg @ref AON_GPIO_PIN_7 + * + * @return The input port pin value. + **************************************************************************************** + */ +aon_gpio_pin_state_t hal_aon_gpio_read_pin(uint16_t aon_gpio_pin); + +/** + **************************************************************************************** + * @brief Set or clear the selected data port bit. + * + * @param[in] aon_gpio_pin: Specifies the port bit to be written. + * This parameter can be a combination of the following values: + * @arg @ref AON_GPIO_PIN_0 + * @arg @ref AON_GPIO_PIN_1 + * @arg @ref AON_GPIO_PIN_2 + * @arg @ref AON_GPIO_PIN_3 + * @arg @ref AON_GPIO_PIN_4 + * @arg @ref AON_GPIO_PIN_5 + * @arg @ref AON_GPIO_PIN_6 + * @arg @ref AON_GPIO_PIN_7 + * @arg @ref AON_GPIO_PIN_ALL + * @param[in] pin_state: Specifies the value to be written to the selected bit. + * This parameter can be one of the AON_GPIO_PinState enum values: + * @arg AON_GPIO_PIN_RESET: to clear the port pin + * @arg AON_GPIO_PIN_SET: to set the port pin + **************************************************************************************** + */ +void hal_aon_gpio_write_pin(uint16_t aon_gpio_pin, aon_gpio_pin_state_t pin_state); + +/** + **************************************************************************************** + * @brief Toggle the specified AON_GPIO pin. + * + * @param[in] aon_gpio_pin: Specifies the pin to be toggled. + * This parameter can be a combination of the following values: + * @arg @ref AON_GPIO_PIN_0 + * @arg @ref AON_GPIO_PIN_1 + * @arg @ref AON_GPIO_PIN_2 + * @arg @ref AON_GPIO_PIN_3 + * @arg @ref AON_GPIO_PIN_4 + * @arg @ref AON_GPIO_PIN_5 + * @arg @ref AON_GPIO_PIN_6 + * @arg @ref AON_GPIO_PIN_7 + * @arg @ref AON_GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_aon_gpio_toggle_pin(uint16_t aon_gpio_pin); + +/** @} */ + +/** @addtogroup AON_GPIO_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle AON_GPIO interrupt request. + **************************************************************************************** + */ +void hal_aon_gpio_irq_handler(void); + +/** + **************************************************************************************** + * @brief AON GPIO pin detection callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_aon_gpio_callback can be implemented in the user file. + * + * @param[in] aon_gpio_pin: Indicate the port pin whose interrupt was triggered. + * This parameter can be a combination of the following values: + * @arg @ref AON_GPIO_PIN_0 + * @arg @ref AON_GPIO_PIN_1 + * @arg @ref AON_GPIO_PIN_2 + * @arg @ref AON_GPIO_PIN_3 + * @arg @ref AON_GPIO_PIN_4 + * @arg @ref AON_GPIO_PIN_5 + * @arg @ref AON_GPIO_PIN_6 + * @arg @ref AON_GPIO_PIN_7 + * @arg @ref AON_GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_aon_gpio_callback(uint16_t aon_gpio_pin); + +/** @} */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_AON_GPIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio_ex.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio_ex.h new file mode 100644 index 0000000..9e76eb3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_gpio_ex.h @@ -0,0 +1,181 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_aon_gpio_ex.h + * @author BLE Driver Team + * @brief Header file containing extended macro of AON GPIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_AON_GPIOEx AON_GPIOEx + * @brief AON_GPIOEx HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_AON_GPIO_EX_H__ +#define __GR55xx_HAL_AON_GPIO_EX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_gpio.h" + +/* Exported types ------------------------------------------------------------*/ + +/** + * @defgroup HAL_AON_GPIOEX_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup AON_GPIOEx_Exported_Constants AON_GPIOEx Exported Constants + * @{ + */ + +/** @defgroup AON_GPIOEx_Mux_Mode AON_GPIOEx Mux Mode definition + * @{ + */ +#define AON_GPIO_MUX_0 LL_AON_GPIO_MUX_0 /**< AON GPIO Mux mode 0 */ +#define AON_GPIO_MUX_1 LL_AON_GPIO_MUX_1 /**< AON GPIO Mux mode 1 */ +#define AON_GPIO_MUX_2 LL_AON_GPIO_MUX_2 /**< AON GPIO Mux mode 2 */ +#define AON_GPIO_MUX_3 LL_AON_GPIO_MUX_3 /**< AON GPIO Mux mode 3 */ +#define AON_GPIO_MUX_4 LL_AON_GPIO_MUX_4 /**< AON GPIO Mux mode 4 */ +#define AON_GPIO_MUX_5 LL_AON_GPIO_MUX_5 /**< AON GPIO Mux mode 5 */ +#define AON_GPIO_MUX_6 LL_AON_GPIO_MUX_6 /**< AON GPIO Mux mode 6 */ +#define AON_GPIO_MUX_7 LL_AON_GPIO_MUX_7 /**< AON GPIO Mux mode 7 */ +/** @} */ + +/** @defgroup AON_GPIOEx_Mux_Function_Selection AON_GPIOEx Mux function selection + * @{ + */ + +#if defined (GR551xx) +/*---------------------------------- GR551xx ------------------------------*/ + +/** @defgroup AON_GPIOEx_Common_Selection AON_GPIO PIN common MUX selection(Available for all AON GPIO pins) + * @{ + */ + +#define AON_GPIO_PIN_MUX_GPIO AON_GPIO_MUX_7 /**< AON GPIO PIN x Mux Select GPIO */ + +/** @} */ + +/** @defgroup AON_GPIOEx_PIN0_Mux_Selection AON_GPIO_PIN1 MUX selection + * @{ + */ +#define AON_GPIO_PIN1_MUX_QSPIM0_CS_N AON_GPIO_MUX_5 /**< AON_GPIO_PIN1 Mux Select QSPIM0_CS_N */ +#define AON_GPIO_PIN1_MUX_COEX_BLE_TX AON_GPIO_MUX_6 /**< AON_GPIO_PIN1 Mux Select COEX_BLE_TX */ +/** @} */ + +/** @defgroup AON_GPIOEx_PIN2_Mux_Selection AON_GPIO_PIN2 MUX selection + * @{ + */ +#define AON_GPIO_PIN2_MUX_SIM_PRESENCE AON_GPIO_MUX_0 /**< AON_GPIO_PIN2 Mux Select SIM_PRESENCE */ +#define AON_GPIO_PIN2_MUX_QSPIM1_CS_N AON_GPIO_MUX_1 /**< AON_GPIO_PIN2 Mux Select QSPIM1_CS_N */ +#define AON_GPIO_PIN2_MUX_I2S_WS AON_GPIO_MUX_2 /**< AON_GPIO_PIN2 Mux Select I2S_WS */ +#define AON_GPIO_PIN2_MUX_I2S_S_WS AON_GPIO_MUX_3 /**< AON_GPIO_PIN2 Mux Select I2S_S_WS */ +#define AON_GPIO_PIN2_MUX_PWM0_C AON_GPIO_MUX_5 /**< AON_GPIO_PIN2 Mux Select PWM0_C */ +#define AON_GPIO_PIN2_MUX_COEX_BLE_PROC AON_GPIO_MUX_6 /**< AON_GPIO_PIN2 Mux Select COEX_BLE_PROC */ +/** @} */ + +/** @defgroup AON_GPIOEx_PIN3_Mux_Selection AON_GPIO_PIN3 MUX selection + * @{ + */ +#define AON_GPIO_PIN3_MUX_SIM_RST_N AON_GPIO_MUX_0 /**< AON_GPIO_PIN3 Mux Select SIM_RST_N */ +#define AON_GPIO_PIN3_MUX_QSPIM1_IO_0 AON_GPIO_MUX_1 /**< AON_GPIO_PIN3 Mux Select QSPIM1_IO_0 */ +#define AON_GPIO_PIN3_MUX_I2S_TX_SDO AON_GPIO_MUX_2 /**< AON_GPIO_PIN3 Mux Select I2S_TX_SDO */ +#define AON_GPIO_PIN3_MUX_I2S_S_TX_SDO AON_GPIO_MUX_3 /**< AON_GPIO_PIN3 Mux Select I2S_S_TX_SDO */ +#define AON_GPIO_PIN3_MUX_PWM1_A AON_GPIO_MUX_5 /**< AON_GPIO_PIN3 Mux Select PWM1_A */ +#define AON_GPIO_PIN3_MUX_COEX_WLAN_RX AON_GPIO_MUX_6 /**< AON_GPIO_PIN3 Mux Select COEX_WLAN_RX */ +/** @} */ + +/** @defgroup AON_GPIOEx_PIN4_Mux_Selection AON_GPIO_PIN4 MUX selection + * @{ + */ +#define AON_GPIO_PIN4_MUX_SIM_IO AON_GPIO_MUX_0 /**< AON_GPIO_PIN4 Mux Select SIM_IO */ +#define AON_GPIO_PIN4_MUX_QSPIM1_IO_1 AON_GPIO_MUX_1 /**< AON_GPIO_PIN4 Mux Select QSPIM1_IO_1 */ +#define AON_GPIO_PIN4_MUX_I2S_RX_SDI AON_GPIO_MUX_2 /**< AON_GPIO_PIN4 Mux Select I2S_RX_SDI */ +#define AON_GPIO_PIN4_MUX_I2S_S_RX_SDI AON_GPIO_MUX_3 /**< AON_GPIO_PIN4 Mux Select I2S_S_RX_SDI */ +#define AON_GPIO_PIN4_MUX_PWM1_B AON_GPIO_MUX_5 /**< AON_GPIO_PIN4 Mux Select PWM1_B */ +#define AON_GPIO_PIN4_MUX_COEX_BLE_RX AON_GPIO_MUX_6 /**< AON_GPIO_PIN4 Mux Select COEX_BLE_RX */ +/** @} */ + +/** @defgroup AON_GPIOEx_PIN5_Mux_Selection AON_GPIO_PIN5 MUX selection + * @{ + */ +#define AON_GPIO_PIN5_MUX_SIM_CLK AON_GPIO_MUX_0 /**< AON_GPIO_PIN5 Mux Select SIM_CLK */ +#define AON_GPIO_PIN5_MUX_QSPIM1_CLK AON_GPIO_MUX_1 /**< AON_GPIO_PIN5 Mux Select QSPIM1_CLK */ +#define AON_GPIO_PIN5_MUX_I2S_SCLK AON_GPIO_MUX_2 /**< AON_GPIO_PIN5 Mux Select I2S_SCLK */ +#define AON_GPIO_PIN5_MUX_I2S_S_SCLK AON_GPIO_MUX_3 /**< AON_GPIO_PIN5 Mux Select I2S_S_SCLK */ +#define AON_GPIO_PIN5_MUX_PWM1_C AON_GPIO_MUX_5 /**< AON_GPIO_PIN5 Mux Select PWM1_C */ +#define AON_GPIO_PIN5_MUX_COEX_WLAN_TX AON_GPIO_MUX_6 /**< AON_GPIO_PIN5 Mux Select COEX_WLAN_TX */ +/** @} */ + +/** + * @brief Check if AON GPIO Mux mode is valid. + * @param __MUX__ AON GPIO Mux mode. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_AON_GPIO_MUX(__MUX__) (((__MUX__) <= AON_GPIO_MUX_7)) + +/*------------------------------------------------------------------------------------------*/ +#endif /* GR551xx */ + +/** @} */ + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_AON_GPIO_EX_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_wdt.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_wdt.h new file mode 100644 index 0000000..6883000 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_aon_wdt.h @@ -0,0 +1,267 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_aon_wdt.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AON WDT HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_AON_WDT AON_WDT + * @brief WDT HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_AON_WDT_H__ +#define __GR55xx_HAL_AON_WDT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_aon_wdt.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_AON_WDT_STRUCTURES Structures + * @{ + */ + +/** @defgroup AON_WDT_Configuration AON_WDT Configuration + * @{ + */ + +/** + * @brief AON_WDT_Configuration init structure definition + */ +typedef struct _aon_wdt_init +{ + uint32_t counter; /**< Specifies the AON_WDT free-running downcounter value. + This parameter can be a number ranging between 0x0U ~ 0xFFFFFFFFU. */ + + uint32_t alarm_counter; /**< Specifies the AON_WDT downcounter alarm value before system reset. + When counter counts down to the alarm value, AON_WDT will generate + an interrupt. After counter counts down to 0, AON_WDT will then + request a SoC Reset. + + This parameter can be a number ranging between 0x0U ~ 0x1FU, and the default value is 20U. */ + +} aon_wdt_init_t; + +/** @} */ + +/** @defgroup AON_WDT_handle AON_WDT handle + * @{ + */ + +/** + * @brief AON_WDT handle Structure definition + */ +typedef struct _aon_wdt_handle +{ + aon_wdt_init_t init; /**< AON_WDT required parameters */ + + hal_lock_t lock; /**< AON_WDT locking object */ + +} aon_wdt_handle_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_AON_WDT_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_AON_WDT_Callback Callback + * @{ + */ + +/** + * @brief HAL_AON_WDT Callback function definition + */ + +typedef struct _aon_wdt_callback +{ + void (*aon_wdt_alarm_callback)(aon_wdt_handle_t *p_aon_wdt); /**< AON_WDT count complete callback */ +} hal_aon_wdt_callback_t; + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_AON_WDT_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup AON_WDT_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions. + * +@verbatim + ============================================================================== + ##### Initialization and Configuration functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and start the AON_WDT according to the specified parameters + in the wdt_init_t of associated handle. + (+) Initialize the AON_WDT MSP. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the AON_WDT according to the specified parameters in the wdt_init_t + * of associated handle. + * + * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration + * information for the specified AON_WDT module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aon_wdt_init(aon_wdt_handle_t *p_aon_wdt); + +/** + **************************************************************************************** + * @brief De-initialize the AON_WDT peripheral. + * + * @param[in] p_aon_wdt: AON_WDT handle. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aon_wdt_deinit(aon_wdt_handle_t *p_aon_wdt); + +/** @} */ + +/** @addtogroup AON_WDT_Exported_Functions_Group2 IO operation functions + * @brief IO operation functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Refresh the AON_WDT. + (+) Handle AON_WDT interrupt request and associated function callback. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Refresh the AON_WDT. + * + * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration + * information for the specified AON_WDT module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_aon_wdt_refresh(aon_wdt_handle_t *p_aon_wdt); + +/** @} */ + + +/** @addtogroup AON_WDT_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle AON_WDT interrupt request. + * + * @note The count completed can be used if specific safety operations + * or data logging must be performed before the actual reset is generated. + * When RESET Mode is enabled, AON_WDT will generate an interrupt on first timeout. + * If interrupt has not been cleared before the second timeout, AON_WDT will then + * request a SoC Reset. + * + * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration + * information for the specified AON_WDT module. + **************************************************************************************** + */ +void hal_aon_wdt_irq_handler(aon_wdt_handle_t *p_aon_wdt); + +/** + **************************************************************************************** + * @brief AON_WDT count complete (counter reaches to 0) callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_wdt_count_cplt_callback can be implemented in the user file. + * + * @param[in] p_aon_wdt: Pointer to a AON_WDT handle which contains the configuration + * information for the specified AON_WDT module. + **************************************************************************************** + */ +void hal_aon_wdt_alarm_callback(aon_wdt_handle_t *p_aon_wdt); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_AON_WDT_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_bod.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_bod.h new file mode 100644 index 0000000..a791db6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_bod.h @@ -0,0 +1,297 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_bod.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ADC HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_BOD BOD + * @brief BOD HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_BOD_H__ +#define __GR55xx_HAL_BOD_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_bod.h" +#include "gr55xx_hal_def.h" +#include + +/* Exported types ------------------------------------------------------------*/ + + +/** @addtogroup HAL_BOD_TYPEDEFS Structures + * @{ + */ +/** + * @brief BOD init structure definition + */ +typedef ll_bod_init_t bod_init_t; +/** + * @brief BOD handle Structure definition + */ +typedef struct _bod_handle +{ + bod_init_t init; /**< BOD configuration parameters */ + __IO hal_lock_t lock; /**< Locking object */ +} bod_handle_t; +/** @} */ + +/** + * @defgroup HAL_BOD_MACRO Defines + * @{ + */ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup BOD_Exported_Constants BOD Exported Constants + * @{ + */ + +/** @defgroup BOD_HAL_ENABLE BOD ENABLE + * @{ + */ +#define HAL_BOD_ENABLE LL_BOD_ENABLE /**< BOD enable */ +#define HAL_BOD_DISABLE LL_BOD_DISABLE /**< BOD disable */ +/** @} */ + +/** @defgroup BOD2_HAL_ENABLE BOD2 ENABLE + * @{ + */ +#define HAL_BOD2_ENABLE LL_BOD2_ENABLE /**< BOD2 enable */ +#define HAL_BOD2_DISABLE LL_BOD2_DISABLE /**< BOD2 disable */ +/** @} */ + +/** @defgroup BOD_HAL_STATIC_ENABLE BOD STATIC ENABLE + * @{ + */ +#define HAL_BOD_STATIC_ENABLE LL_BOD_STATIC_ENABLE /**< BOD STATIC enable */ +#define HAL_BOD_STATIC_DISABLE LL_BOD_STATIC_DISABLE /**< BOD STATIC disable */ +/** @} */ + +/** @defgroup BOD2_HAL_LEVEL BOD2 LVEVL + * @{ + */ +#define HAL_BOD2_LEVEL_0 LL_BOD2_LEVEL_0 /**< BOD2 Level 0 */ +#define HAL_BOD2_LEVEL_1 LL_BOD2_LEVEL_1 /**< BOD2 Level 1 */ +#define HAL_BOD2_LEVEL_2 LL_BOD2_LEVEL_2 /**< BOD2 Level 2 */ +#define HAL_BOD2_LEVEL_3 LL_BOD2_LEVEL_3 /**< BOD2 Level 3 */ +#define HAL_BOD2_LEVEL_4 LL_BOD2_LEVEL_4 /**< BOD2 Level 4 */ +#define HAL_BOD2_LEVEL_5 LL_BOD2_LEVEL_5 /**< BOD2 Level 5 */ +#define HAL_BOD2_LEVEL_6 LL_BOD2_LEVEL_6 /**< BOD2 Level 6 */ +#define HAL_BOD2_LEVEL_7 LL_BOD2_LEVEL_7 /**< BOD2 Level 7 */ +/** @} */ +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_BOD_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup BOD_Exported_Functions_Group1 Initialization and de-initialization Functions + * @brief Initialization and Configuration functions + * @{ + */ +/* Exported functions --------------------------------------------------------*/ + +/** + **************************************************************************************** + * @brief Initialize the BOD according to the specified parameters + * in the bod_init_t and initialize the associated handle. + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_bod_init(bod_handle_t *p_bod); + +/** + **************************************************************************************** + * @brief De-initialize the BOD peripheral. + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_bod_deinit(bod_handle_t *p_bod); + +/** + **************************************************************************************** + * @brief Initialize the BOD MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_bod_msp_init could be implemented in the user file + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + **************************************************************************************** + */ +void hal_bod_msp_init(bod_handle_t *p_bod); + +/** + **************************************************************************************** + * @brief De-initialize the BOD MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_bod_msp_deinit could be implemented in the user file + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + **************************************************************************************** + */ +void hal_bod_msp_deinit(bod_handle_t *p_bod); + +/** + **************************************************************************************** + * @brief BOD fall edge callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_bod_fedge_callback can be implemented in the user file. + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + **************************************************************************************** + */ +void hal_bod_fedge_callback(bod_handle_t *p_bod); + +/** + **************************************************************************************** + * @brief Handle BOD fall edge interrupt request. + * + * @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for + * the specified BOD module. + **************************************************************************************** + */ +void hal_bod_fedge_irq_handler(bod_handle_t *p_bod); + +/** +**************************************************************************************** +* @brief enable bod +* +* @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for +* the specified BOD module. +* @param[in] enable: bod enable flag. the value can be HAL_BOD_ENABLE or HAL_BOD_DISABLE +* +* @retval ::HAL_OK: Operation is OK. +* @retval ::HAL_ERROR: Parameter error or operation not supported. +* @retval ::HAL_BUSY: Driver is busy. +* @retval ::HAL_TIMEOUT: Timeout occurred. +**************************************************************************************** +*/ +hal_status_t hal_bod_enable(bod_handle_t *p_bod, uint8_t enable); + +/** +**************************************************************************************** +* @brief enable bod2 +* +* @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for +* the specified BOD module. +* @param[in] enable: bod2 enable flag. the value can be HAL_BOD2_ENABLE or HAL_BOD2_DISABLE +* +* @retval ::HAL_OK: Operation is OK. +* @retval ::HAL_ERROR: Parameter error or operation not supported. +* @retval ::HAL_BUSY: Driver is busy. +* @retval ::HAL_TIMEOUT: Timeout occurred. +**************************************************************************************** +*/ +hal_status_t hal_bod2_enable(bod_handle_t *p_bod, uint8_t enable); + +/** +**************************************************************************************** +* @brief Set BOD2 control level. +* +* @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for +* the specified BOD module. +* @param[in] level: the level of bod2 control.the value range between 0x0 ~ 0xF +* +* @retval ::HAL_OK: Operation is OK. +* @retval ::HAL_ERROR: Parameter error or operation not supported. +* @retval ::HAL_BUSY: Driver is busy. +* @retval ::HAL_TIMEOUT: Timeout occurred. +**************************************************************************************** +*/ +hal_status_t hal_bod2_set_level(bod_handle_t *p_bod, uint8_t level); + +/** +**************************************************************************************** +* @brief enable/disable static mode +* +* @param[in] p_bod: Pointer to an BOD handle which contains the configuration information for +* the specified BOD module. +* @param[in] enable: static enable flag. the value can be HAL_BOD_STATIC_ENABLE or HAL_BOD_STATIC_DISABLE +* +* @retval ::HAL_OK: Operation is OK. +* @retval ::HAL_ERROR: Parameter error or operation not supported. +* @retval ::HAL_BUSY: Driver is busy. +* @retval ::HAL_TIMEOUT: Timeout occurred. +**************************************************************************************** +*/ +hal_status_t hal_bod_static_mode_enable(bod_handle_t *p_bod, uint8_t enable); +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_BOD_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_calendar.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_calendar.h new file mode 100644 index 0000000..f34a768 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_calendar.h @@ -0,0 +1,575 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_calendar.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of CALENDAR HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_CALENDAR CALENDAR + * @brief CALENDAR HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_CALENDAR_H__ +#define __GR55xx_HAL_CALENDAR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_calendar.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_CALENDAR_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_CALENDAR_STATE HAL CALENDAR state + * @{ + */ +/** + * @brief HAL CALENDAR State Enumerations definition + */ +typedef enum +{ + HAL_CALENDAR_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_CALENDAR_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_CALENDAR_STATE_ERROR = 0x04 /**< Peripheral in error */ +} hal_calender_state_t; + +/** @} */ +/** @} */ + + +/** @addtogroup HAL_CALENDAR_STRUCTURES Structures + * @{ + */ +/** @defgroup CALENDAR_Time CALENDAR Time + * @{ + */ + +/** + * @brief CALENDAR_Time calendar time structure definition + */ +typedef struct _calendar_time +{ + uint8_t sec; /**< Specifies the Calendar time seconds. + This parameter must be a number between min_value = 0 and max_value = 59. */ + + uint8_t min; /**< Specifies the Calendar time minutes. + This parameter must be a number between min_value = 0 and max_value = 59. */ + + uint8_t hour; /**< Specifies the Calendar time hour. + This parameter must be a number between min_value = 0 and max_value = 23. */ + + uint8_t date; /**< Specifies the Calendar date. + This parameter must be a number between min_value = 1 and max_value = 31. */ + + uint8_t mon; /**< Specifies the Calendar month. + This parameter must be a number between min_value = 1 and max_value = 12. */ + + uint8_t year; /**< Specifies the Calendar year which stars from 2010. + This parameter must be a number between min_value = 10 and max_value = 99. */ + + uint8_t week; /**< Specifies the Calendar weekday. + This parameter must be a number between min_value = 0 and max_value = 6. */ + + uint16_t ms; /**< The Calendar time milliseconds. + This parameter must be a number between min_value = 0 and max_value = 999. + Note: This parameter is used for internal calculation, the user does not need to care*/ +} calendar_time_t; + +/** + * @brief CALENDAR_Alarm calendar alarm structure definition + */ +typedef struct _calendar_alarm +{ + uint8_t min; /**< Specifies the alarm time minutes. + This parameter must be a number between min_value = 0 and max_value = 59. */ + + uint8_t hour; /**< Specifies the alarm time hour. + This parameter must be a number between min_value = 0 and max_value = 23. */ + + uint8_t alarm_sel; /**< Specifies the alarm is on date or weekday. + This parameter can be a value of @ref CALENDAR_ALARM_SEL. */ + + uint8_t alarm_date_week_mask; /**< Specifies the alarm date/weekday. + If the alarm date is selected, this parameter must be set to a value in the 1 ~ 31 range. + If the alarm weekday is selected, this parameter must be a value of @ref CALENDAR_ALARM_WEEKDAY. */ + +} calendar_alarm_t; + +/** @} */ + +/** @defgroup CALENDAR_handle CALENDAR handle + * @{ + */ + +/** + * @brief CALENDAR handle Structure definition + */ +typedef struct _calendar_handle +{ + calendar_time_t time_init; /**< Specifies the Calendar inital time. */ + + calendar_alarm_t alarm; /**< Specifies the Calendar date alarm. */ + + hal_lock_t lock; /**< Specifies the Calendar locking object. */ + + uint32_t prev_ms; /**< Accumulated millisecond count .*/ + + uint32_t interval; /**< Specifies the Calendar milliseconds alarm. */ + + uint8_t mode; /**< Specifies the Calendar alarm mode. */ + + uint8_t sec; /**< The seconds for the date alarm. */ + + uint16_t ms; /**< The milliseconds for the date alarm. */ + + hal_calender_state_t state; /**< Calendar state */ +} calendar_handle_t; + +/** @} */ +/** @} */ + + +/** @addtogroup HAL_CALENDAR_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_CALENDAR_Callback Callback + * @{ + */ + +/** + * @brief HAL_CALENDAR Callback function definition + */ + +typedef struct _hal_calendar_callback +{ + void (*calendar_alarm_callback)(calendar_handle_t *p_calendar); /**< CALENDAR date count complete callback */ + void (*calendar_tick_callback)(calendar_handle_t *p_calendar); /**< CALENDAR tick count complete callback */ + void (*calendar_overflow_callback)(calendar_handle_t *p_calendar); /**< CALENDAR count overflow callback */ +} hal_calendar_callback_t; + +/** @} */ + +/** @} */ + + +/** + * @defgroup HAL_CALENDAR_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup CALENDAR_Exported_Constants CALENDAR Exported Constants + * @{ + */ + +/** @defgroup CALENDAR_Interrupts CALENDAR Interrupts + * @{ + */ +#define CALENDAR_IT_ALARM AON_CALENDAR_TIMER_CTL_ALARM_INT_EN /**< Alarm interrupt */ +#define CALENDAR_IT_WARP AON_CALENDAR_TIMER_CTL_WRAP_INT_EN /**< Warp interrupt */ +/** @} */ + +/** @defgroup CALENDAR_Flags CALENDAR Flags + * @{ + */ +#define CALENDAR_FLAG_ALARM AON_SLP_EVENT_CALENDAR_TIMER_ALARM /**< Alarm interrupt flag */ +#define CALENDAR_FLAG_WARP AON_SLP_EVENT_CALENDAR_TIMER_WRAP /**< Warp interrupt flag */ +/** @} */ + +/** @defgroup CALENDAR_ALARM_SEL CALENDAR Alarm type select + * @{ + */ +#define CALENDAR_ALARM_SEL_DATE (0UL) /**< Alarm in date */ +#define CALENDAR_ALARM_SEL_WEEKDAY (1UL) /**< Alarm in weekday */ +/** @} */ + +/** @defgroup CALENDAR_ALARM_WEEKDAY CALENDAR Alarm weekday + * @{ + */ +#define CALENDAR_ALARM_WEEKDAY_SUN (0x01ul) /**< Alarm weekday mask Sunday */ +#define CALENDAR_ALARM_WEEKDAY_MON (0x02ul) /**< Alarm weekday mask Monday */ +#define CALENDAR_ALARM_WEEKDAY_TUE (0x04ul) /**< Alarm weekday mask Tuesday */ +#define CALENDAR_ALARM_WEEKDAY_WED (0x08ul) /**< Alarm weekday mask Wednesday */ +#define CALENDAR_ALARM_WEEKDAY_THU (0x10ul) /**< Alarm weekday mask Thursday */ +#define CALENDAR_ALARM_WEEKDAY_FRI (0x20ul) /**< Alarm weekday mask Friday */ +#define CALENDAR_ALARM_WEEKDAY_SAT (0x40ul) /**< Alarm weekday mask Saturday */ +/** @} */ + +/** @defgroup CALENDAR_ALARM_DISABLE CALENDAR Alarm mdoe + * @{ + */ +#define CALENDAR_ALARM_DISABLE_DATE (1UL) /**< Disable date alarm */ +#define CALENDAR_ALARM_DISABLE_TICK (2UL) /**< Disable tick alarm */ +#define CALENDAR_ALARM_DISABLE_ALL ((CALENDAR_ALARM_DISABLE_DATE) | CALENDAR_ALARM_DISABLE_TICK) /**< Disable all alarm */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup CALENDAR_Exported_Macros CALENDAR Exported Macros + * @{ + */ + +/** @brief Enable the specified CALENDAR peripheral. + * @retval None + */ +#define __HAL_CALENDAR_ENABLE() SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN) + +/** @brief Disable the specified CALENDAR peripheral. + * @retval None + */ +#define __HAL_CALENDAR_DISABLE() CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN) + +/** @brief Enable the specified CALENDAR interrupts. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt + * @arg @ref CALENDAR_IT_WARP Warp Interrupt + * @retval None + */ +#define __HAL_CALENDAR_ENABLE_IT(__INTERRUPT__) SET_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__)) + +/** @brief Disable the specified CALENDAR interrupts. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref CALENDAR_IT_ALARM Alarm Interrupt + * @arg @ref CALENDAR_IT_WARP Warp Interrupt + * @retval None + */ +#define __HAL_CALENDAR_DISABLE_IT(__INTERRUPT__) CLEAR_BITS(AON->CALENDAR_TIMER_CTL, (__INTERRUPT__)) + +/** @brief Check whether the specified CALENDAR interrupt flag is set or not. + * @param __FLAG__ Specifies the interrupt source to check. + * This parameter can be one of the following values: + * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event + * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event + * @retval The new state of __IT__ (TRUE or FALSE). + */ +#define __HAL_CALENDAR_GET_IT_SOURCE(__FLAG__) (READ_BITS(AON->SLP_EVENT, (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified CALENDAR flag. + * @param __FLAG__ Specifies the flag to clear. + * This parameter can be one of the following values: + * @arg @ref CALENDAR_FLAG_ALARM Alarm Interrupt event + * @arg @ref CALENDAR_FLAG_WARP Warp Interrupt event + * @retval None + */ +#define __HAL_CALENDAR_CLEAR_FLAG(__FLAG__) WRITE_REG(AON->SLP_EVENT, ~(__FLAG__)) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup CALENDAR_Private_Macro CALENDAR Private Macros + * @{ + */ + +/** @brief Check if CALENDAR Alarm Type is valid. + * @param __TYPE__ CALENDAR Alarm Type. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_CALENDAR_ALARM_TYPE(__TYPE__) (((__TYPE__) == CALENDAR_ALARM_SEL_DATE) || \ + ((__TYPE__) == CALENDAR_ALARM_SEL_WEEKDAY)) + +/** @brief Check if CALENDAR Date is valid. + * @param __DATE__ CALENDAR Date. + * @retval SET (__DATE__ is valid) or RESET (__DATE__ is invalid) + */ +#define IS_CALENDAR_DATE(__DATE__) (((__DATE__) > 0) && ((__DATE__) <= 31)) + +/** @brief Check if CALENDAR Weekday is valid. + * @param __WEEKDAY__ CALENDAR Weekday. + * @retval SET (__WEEKDAY__ is valid) or RESET (__WEEKDAY__ is invalid) + */ +#define IS_CALENDAR_WEEKDAY(__WEEKDAY__) (((__WEEKDAY__) >= 0) && ((__WEEKDAY__) <= 6)) + +/** @brief Check if CALENDAR year is leap year. + * @param __YEAR__ CALENDAR Year. + * @retval SET (__YEAR__ is leap year) or RESET (__YEAR__ is nonleap year) + */ +#define IS_CALENDAR_LEAP_YEAR(__YEAR__) ((((__YEAR__) % 4) == 0 && ((__YEAR__) % 100) != 0) || \ + ((__YEAR__) % 400) == 0) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_CALENDAR_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup CALENDAR_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions. + * +@verbatim + ============================================================================== + ##### Initialization and Configuration functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and start the CALENDAR according to the specified parameters + in the cslendar_init_t of associated handle. + (+) Initialize the CALENDAR MSP. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the CALENDAR according to the specified parameters in the + * calendar_init_t of associated handle. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_init(calendar_handle_t *p_calendar); + +/** + **************************************************************************************** + * @brief De-initialize the CALENDAR peripheral. + * + * @param[in] p_calendar: CALENDAR handle. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_deinit(calendar_handle_t *p_calendar); + +/** @} */ + +/** @addtogroup CALENDAR_Exported_Functions_Group2 IO operation functions + * @brief IO operation functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Init the CALENDAR time. + (+) Get the CALENDAR time. + (+) Set the CALENDAR alarm. + (+) Disable the CALENDAR alarm. + (+) Handle CALENDAR interrupt request and associated function callback. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the CALENDAR time. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * @param[in] p_time: Pointer to a CALENDAR time struction. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_init_time(calendar_handle_t *p_calendar, calendar_time_t *p_time); + +/** + **************************************************************************************** + * @brief Get current CALENDAR time. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * @param[in] p_time: Pointer to a CALENDAR time struction. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_get_time(calendar_handle_t *p_calendar, calendar_time_t *p_time); + +/** + **************************************************************************************** + * @brief Set a CALENDAR date alarm. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * @param[in] p_alarm: After seconds will generate an date alarm interrupt. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_set_alarm(calendar_handle_t *p_calendar, calendar_alarm_t *p_alarm); + +/** + **************************************************************************************** + * @brief Set a CALENDAR tick alarm. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * @param[in] interval: After milliseconds will generate an milliseconds alarm interrupt. + * The value of interval is greater than or equal to 5ms.(Max: 3600*1000 ms) + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_set_tick(calendar_handle_t *p_calendar, uint32_t interval); + +/** + **************************************************************************************** + * @brief Disable CALENDAR alarm event. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + * @param[in] disable_mode: Disable specified CALENDAR alarm mode. + * This parameter can be the following values: + * @arg @ref CALENDAR_ALARM_DISABLE_DATE + * @arg @ref CALENDAR_ALARM_DISABLE_TICK + * @arg @ref CALENDAR_ALARM_DISABLE_ALL + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_calendar_disable_event(calendar_handle_t *p_calendar, uint32_t disable_mode); + +/** @} */ + + +/** @addtogroup CALENDAR_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle CALENDAR interrupt request. + * + * @note When alarm is enabled, CALENDAR will generate an interrupt on conter match alarm value. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + **************************************************************************************** + */ +void hal_calendar_irq_handler(calendar_handle_t *p_calendar); + +/** + **************************************************************************************** + * @brief CALENDAR date count complete callback. + * + * @note This function should not be modified. when the callback is needed, + * the hal_calendar_alarm_callback can be implemented in the user file. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + **************************************************************************************** + */ +void hal_calendar_alarm_callback(calendar_handle_t *p_calendar); + +/** + **************************************************************************************** + * @brief CALENDAR milliseconds count complete callback. + * + * @note This function should not be modified. when the callback is needed, + * the hal_calendar_tick_callback can be implemented in the user file. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + **************************************************************************************** + */ +void hal_calendar_tick_callback(calendar_handle_t *p_calendar); + +/** + **************************************************************************************** + * @brief CALENDAR overflow callback. + * + * @note This function should not be modified. when the callback is needed, + * the hal_calendar_overflow_callback can be implemented in the user file. + * + * @note The overflow time is about 36 hours. + * + * @param[in] p_calendar: Pointer to a CALENDAR handle which contains the configuration + * information for the specified CALENDAR module. + **************************************************************************************** + */ +void hal_calendar_overflow_callback(calendar_handle_t *p_calendar); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_CALENDAR_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cgc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cgc.h new file mode 100644 index 0000000..9bfcbf3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cgc.h @@ -0,0 +1,362 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_cgc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of CGC HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_CGC CGC + * @brief CGC HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_CGC_H__ +#define __GR55xx_HAL_CGC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_cgc.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_CGC_ENUMERATIONS Enumerations + * @{ + */ + +/** + * @brief CGC Bit Open and Bit Close Enumerations + */ +typedef enum +{ + CGC_CLK_ON = 0U, /**< Turn on the clock.*/ + CGC_CLK_OFF = 1U, /**< Turn off the clock.*/ +} cgc_clk_state_t; + +/** @} */ + +/** @addtogroup HAL_CGC_STRUCTURES Structures + * @{ + */ + +/** + * @brief CGC init structure definition + */ +typedef struct _cgc_init +{ + uint32_t wfi_clk; /**< Specifies the blocks that automatically closes the clock. + This parameter can be a combination of group CGC_LL_EC_WFI_CLK0 */ + + uint32_t force_clk; /**< Specifies the blocks to forcibly turn off the clock. + This parameter can be a combination of group CGC_LL_EC_FRC_CLK0 */ +} cgc_init_t; + +/** @} */ + + +/** + * @defgroup HAL_CGC_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup CGC_Exported_Constants CGC Exported Constants + * @{ + */ + +/** @defgroup CGC_auto_clk Automatic Turn off clocks + * @{ + */ +#define CGC_WFI_SECU_HCLK ((uint32_t)0x00000001U) /**< Hclk for all security blocks */ +#define CGC_WFI_SIM_HCLK ((uint32_t)0x00000002U) /**< Hclk for sim card interface */ +#define CGC_WFI_HTB_HCLK ((uint32_t)0x00000004U) /**< Hclk for hopping table */ +#define CGC_WFI_PWM_HCLK ((uint32_t)0x00000008U) /**< Hclk for PWM */ +#define CGC_WFI_ROM_HCLK ((uint32_t)0x00000010U) /**< Hclk for ROM */ +#define CGC_WFI_SNSADC_HCLK ((uint32_t)0x00000020U) /**< Hclk for sense ADC */ +#define CGC_WFI_GPIO_HCLK ((uint32_t)0x00000040U) /**< Hclk for GPIOs */ +#define CGC_WFI_DMA_HCLK ((uint32_t)0x00000080U) /**< Hclk for DMA engine */ +#define CGC_WFI_BLE_BRG_HCLK ((uint32_t)0x00000100U) /**< Hclk for BLE MCU bridge */ +#define CGC_WFI_APB_SUB_HCLK ((uint32_t)0x00000200U) /**< Hclk for APB subsystem */ +#define CGC_WFI_SERIAL_HCLK ((uint32_t)0x00000400U) /**< Hclk for serial blocks */ +#define CGC_WFI_I2S_S_HCLK ((uint32_t)0x00000800U) /**< Hclk for I2S slave */ +#define CGC_WFI_AON_MCUSUB_HCLK ((uint32_t)0x00001000U) /**< Hclk for Always-on register */ +#define CGC_WFI_XF_XQSPI_HCLK ((uint32_t)0x00002000U) /**< Hclk for cache top */ +#define CGC_WFI_SRAM_HCLK ((uint32_t)0x00004000U) /**< Hclk for SRAMs */ +#define CGC_WFI_SECU_DIV4_PCLK ((uint32_t)0x00008000U) /**< Div4 clk for security blocks */ +#define CGC_WFI_XQSPI_DIV4_PCLK ((uint32_t)0x00020000U) /**< Div4 clk for xf qspi */ + +#define CGC_WFI_ALL_CLK ((uint32_t)0x0002FFFFU) /**< All clocks */ +/** @} */ + +/** @defgroup CGC_force_clk Force cloks off + * @{ + */ +#define CGC_FRC_SECU_HCLK ((uint32_t)0x00000001U) /**< Hclk for all security blocks */ +#define CGC_FRC_SIM_HCLK ((uint32_t)0x00000002U) /**< Hclk for sim card interface */ +#define CGC_FRC_HTB_HCLK ((uint32_t)0x00000004U) /**< Hclk for hopping table */ +#define CGC_FRC_PWM_HCLK ((uint32_t)0x00000008U) /**< Hclk for PWM */ +#define CGC_FRC_ROM_HCLK ((uint32_t)0x00000010U) /**< Hclk for ROM */ +#define CGC_FRC_SNSADC_HCLK ((uint32_t)0x00000020U) /**< Hclk for sense ADC */ +#define CGC_FRC_GPIO_HCLK ((uint32_t)0x00000040U) /**< Hclk for GPIOs */ +#define CGC_FRC_DMA_HCLK ((uint32_t)0x00000080U) /**< Hclk for DMA engine */ +#define CGC_FRC_BLE_BRG_HCLK ((uint32_t)0x00000100U) /**< Hclk for BLE MCU bridge */ +#define CGC_FRC_APB_SUB_HCLK ((uint32_t)0x00000200U) /**< Hclk for APB subsystem */ +#define CGC_FRC_SERIAL_HCLK ((uint32_t)0x00000400U) /**< Hclk for serial blocks */ +#define CGC_FRC_I2S_S_HCLK ((uint32_t)0x00000800U) /**< Hclk for I2S slave */ +#define CGC_FRC_AON_MCUSUB_HCLK ((uint32_t)0x00001000U) /**< Hclk for Always-on register */ +#define CGC_FRC_XF_XQSPI_HCLK ((uint32_t)0x00002000U) /**< Hclk for cache top */ +#define CGC_FRC_SRAM_HCLK ((uint32_t)0x00004000U) /**< Hclk for SRAMs */ +#define CGC_FRC_UART0_HCLK ((uint32_t)0x00008000U) /**< Hclk for uart0 */ +#define CGC_FRC_UART1_HCLK ((uint32_t)0x00010000U) /**< Hclk for uart1 */ +#define CGC_FRC_I2C0_HCLK ((uint32_t)0x00020000U) /**< Hclk for i2c0 */ +#define CGC_FRC_I2C1_HCLK ((uint32_t)0x00040000U) /**< Hclk for i2c1 */ +#define CGC_FRC_SPIM_HCLK ((uint32_t)0x00080000U) /**< Hclk for spim */ +#define CGC_FRC_SPIS_HCLK ((uint32_t)0x00100000U) /**< Hclk for spis */ +#define CGC_FRC_QSPI0_HCLK ((uint32_t)0x00200000U) /**< Hclk for qspi0 */ +#define CGC_FRC_QSPI1_HCLK ((uint32_t)0x00400000U) /**< Hclk for qspi1 */ +#define CGC_FRC_I2S_HCLK ((uint32_t)0x00800000U) /**< Hclk for i2s */ +#define CGC_FRC_SECU_DIV4_PCLK ((uint32_t)0x01000000U) /**< Div4 clk for security blocks */ +#define CGC_FRC_XQSPI_DIV4_PCLK ((uint32_t)0x04000000U) /**< Div4 clk for xf qspi */ + +#define CGC_FRC_ALL_CLK ((uint32_t)0x05FFFFFFU) /**< All clocks */ +/** @} */ + + + +/** + * @brief CGC_default_config init Struct default configuartion + */ +#define CGC_DEFAULT_CONFIG \ +{ \ + .wfi_clk = ~CGC_WFI_ALL_CLK, \ + .force_clk = ~CGC_FRC_ALL_CLK, \ +} +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_CGC_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup CGC_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the CGC registers according to the specified parameters in the @ref cgc_init_t. + * @param[in] p_cgc_init: Pointer to a @ref cgc_init_t structure that contains + * the configuration information for the specified CGC registers. + **************************************************************************************** + */ +void hal_cgc_init(cgc_init_t *p_cgc_init); + +/** + **************************************************************************************** + * @brief De-initialize the CGC registers to their default reset values. + **************************************************************************************** + */ +void hal_cgc_deinit(void); + +/** @} */ + +/** @addtogroup CGC_Exported_Functions_Group2 Peripheral Control functions. + * @brief Clock Gate Open and Closemanagement functions. + * @{ + */ + +/** + **************************************************************************************** + * @brief Configure the clock state for a specified block during WFI. + * @param[in] blocks: Specifies the peripheral blocks. + * This parameter can be a combiantion of the following values: + * @arg @ref CGC_WFI_SECU_HCLK + * @arg @ref CGC_WFI_SIM_HCLK + * @arg @ref CGC_WFI_HTB_HCLK + * @arg @ref CGC_WFI_PWM_HCLK + * @arg @ref CGC_WFI_ROM_HCLK + * @arg @ref CGC_WFI_SNSADC_HCLK + * @arg @ref CGC_WFI_GPIO_HCLK + * @arg @ref CGC_WFI_DMA_HCLK + * @arg @ref CGC_WFI_BLE_BRG_HCLK + * @arg @ref CGC_WFI_APB_SUB_HCLK + * @arg @ref CGC_WFI_SERIAL_HCLK + * @arg @ref CGC_WFI_I2S_S_HCLK + * @arg @ref CGC_WFI_AON_MCUSUB_HCLK + * @arg @ref CGC_WFI_XF_XQSPI_HCLK + * @arg @ref CGC_WFI_SRAM_HCLK + * @arg @ref CGC_WFI_SECU_DIV4_PCLK + * @arg @ref CGC_WFI_XQSPI_DIV4_PCLK + * @param[in] clk_state: Specifies the clock state during WFI. + * This parameter can be one of the following values: + * @arg @ref CGC_CLK_ON + * @arg @ref CGC_CLK_OFF + **************************************************************************************** + */ +void hal_cgc_config_wfi_clk(uint32_t blocks, cgc_clk_state_t clk_state); + +/** + **************************************************************************************** + * @brief Get the clock state for a specified block during WFI. + * @param[in] block: Specifies the peripheral blocks. + * This parameter can be one of the following values: + * @arg @ref CGC_WFI_SECU_HCLK + * @arg @ref CGC_WFI_SIM_HCLK + * @arg @ref CGC_WFI_HTB_HCLK + * @arg @ref CGC_WFI_PWM_HCLK + * @arg @ref CGC_WFI_ROM_HCLK + * @arg @ref CGC_WFI_SNSADC_HCLK + * @arg @ref CGC_WFI_GPIO_HCLK + * @arg @ref CGC_WFI_DMA_HCLK + * @arg @ref CGC_WFI_BLE_BRG_HCLK + * @arg @ref CGC_WFI_APB_SUB_HCLK + * @arg @ref CGC_WFI_SERIAL_HCLK + * @arg @ref CGC_WFI_I2S_S_HCLK + * @arg @ref CGC_WFI_AON_MCUSUB_HCLK + * @arg @ref CGC_WFI_XF_XQSPI_HCLK + * @arg @ref CGC_WFI_SRAM_HCLK + * @arg @ref CGC_WFI_SECU_DIV4_PCLK + * @arg @ref CGC_WFI_XQSPI_DIV4_PCLK + * @retval ::CGC_CLK_ON: Clock On. + * @retval ::CGC_CLK_OFF: Clock Off. + **************************************************************************************** + */ +cgc_clk_state_t hal_cgc_get_wfi_clk(uint32_t block); + +/** + **************************************************************************************** + * @brief Forced to Configure the clock state for a specified block. + * @param[in] blocks: Specifies the peripheral blocks. + * This parameter can be a combiantion of the following values: + * @arg @ref CGC_FRC_SECU_HCLK + * @arg @ref CGC_FRC_SIM_HCLK + * @arg @ref CGC_FRC_HTB_HCLK + * @arg @ref CGC_FRC_PWM_HCLK + * @arg @ref CGC_FRC_ROM_HCLK + * @arg @ref CGC_FRC_SNSADC_HCLK + * @arg @ref CGC_FRC_GPIO_HCLK + * @arg @ref CGC_FRC_DMA_HCLK + * @arg @ref CGC_FRC_BLE_BRG_HCLK + * @arg @ref CGC_FRC_APB_SUB_HCLK + * @arg @ref CGC_FRC_SERIAL_HCLK + * @arg @ref CGC_FRC_I2S_S_HCLK + * @arg @ref CGC_FRC_AON_MCUSUB_HCLK + * @arg @ref CGC_FRC_XF_XQSPI_HCLK + * @arg @ref CGC_FRC_SRAM_HCLK + * @arg @ref CGC_FRC_UART0_HCLK + * @arg @ref CGC_FRC_UART1_HCLK + * @arg @ref CGC_FRC_I2C0_HCLK + * @arg @ref CGC_FRC_I2C1_HCLK + * @arg @ref CGC_FRC_SPIM_HCLK + * @arg @ref CGC_FRC_SPIS_HCLK + * @arg @ref CGC_FRC_QSPI0_HCLK + * @arg @ref CGC_FRC_QSPI1_HCLK + * @arg @ref CGC_FRC_I2S_HCLK + * @arg @ref CGC_FRC_SECU_DIV4_PCLK + * @arg @ref CGC_FRC_XQSPI_DIV4_PCLK + * @param[in] clk_state: Specifies the clock state. + * This parameter can be one of the following values: + * @arg @ref CGC_CLK_ON + * @arg @ref CGC_CLK_OFF + **************************************************************************************** + */ +void hal_cgc_config_force_clk(uint32_t blocks, cgc_clk_state_t clk_state); + +/** + **************************************************************************************** + * @brief Get the clock status of the currently specified block. + * @param[in] block: Specifies the peripheral blocks. + * This parameter can be one of the following values: + * @arg @ref CGC_FRC_SECU_HCLK + * @arg @ref CGC_FRC_SIM_HCLK + * @arg @ref CGC_FRC_HTB_HCLK + * @arg @ref CGC_FRC_PWM_HCLK + * @arg @ref CGC_FRC_ROM_HCLK + * @arg @ref CGC_FRC_SNSADC_HCLK + * @arg @ref CGC_FRC_GPIO_HCLK + * @arg @ref CGC_FRC_DMA_HCLK + * @arg @ref CGC_FRC_BLE_BRG_HCLK + * @arg @ref CGC_FRC_APB_SUB_HCLK + * @arg @ref CGC_FRC_SERIAL_HCLK + * @arg @ref CGC_FRC_I2S_S_HCLK + * @arg @ref CGC_FRC_AON_MCUSUB_HCLK + * @arg @ref CGC_FRC_XF_XQSPI_HCLK + * @arg @ref CGC_FRC_SRAM_HCLK + * @arg @ref CGC_FRC_UART0_HCLK + * @arg @ref CGC_FRC_UART1_HCLK + * @arg @ref CGC_FRC_I2C0_HCLK + * @arg @ref CGC_FRC_I2C1_HCLK + * @arg @ref CGC_FRC_SPIM_HCLK + * @arg @ref CGC_FRC_SPIS_HCLK + * @arg @ref CGC_FRC_QSPI0_HCLK + * @arg @ref CGC_FRC_QSPI1_HCLK + * @arg @ref CGC_FRC_I2S_HCLK + * @arg @ref CGC_FRC_SECU_DIV4_PCLK + * @arg @ref CGC_FRC_XQSPI_DIV4_PCLK + * @retval ::CGC_CLK_ON: Clock On. + * @retval ::CGC_CLK_OFF: Clock Off. + **************************************************************************************** + */ +cgc_clk_state_t hal_cgc_get_force_clk(uint32_t block); + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_CGC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_comp.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_comp.h new file mode 100644 index 0000000..1c69696 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_comp.h @@ -0,0 +1,448 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_comp.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of COMP HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_COMP COMP + * @brief COMP HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_COMP_H__ +#define __GR55xx_HAL_COMP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_comp.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_COMP_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_COMP_state HAL COMP state + * @{ + */ + +/** + * @brief HAL COMP State Enumerations definition + */ +typedef enum +{ + HAL_COMP_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_COMP_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_COMP_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_COMP_STATE_ERROR = 0x04 /**< Peripheral in error */ +} hal_comp_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_COMP_STRUCTURES Structures + * @{ + */ + +/** @defgroup COMP_Configuration COMP Configuration + * @{ + */ + +/** + * @brief COMP init structure definition + */ +typedef ll_comp_init_t comp_init_t; +/** @} */ + +/** @defgroup COMP_handle COMP handle + * @{ + */ + +/** + * @brief COMP handle Structure definition + */ +typedef struct _comp_handle +{ + comp_init_t init; /**< COMP configuration parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_comp_state_t state; /**< COMP communication state */ + + __IO uint32_t error_code; /**< COMP error code */ + + uint32_t retention[1]; /**< COMP important register information. */ + +} comp_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_COMP_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup COMP_Callback COMP Callback + * @{ + */ + +/** + * @brief HAL COMP Callback function definition + */ +typedef struct _comp_callback +{ + void (*comp_msp_init)(comp_handle_t *p_comp); /**< COMP init MSP callback */ + void (*comp_msp_deinit)(comp_handle_t *p_comp); /**< COMP de-init MSP callback */ + void (*comp_trigger_callback)(comp_handle_t *p_comp); /**< COMP comparator callback */ +} comp_callback_t; + +/** @} */ + +/** @} */ + + +/** + * @defgroup HAL_COMP_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup COMP_Exported_Constants COMP Exported Constants + * @{ + */ + +/** @defgroup COMP_Error_Code COMP Error Code + * @{ + */ +#define HAL_COMP_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_COMP_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_COMP_ERROR_INVALID_PARAM ((uint32_t)0x00000002) /**< Invalid parameters error */ +/** @} */ + + +/** @defgroup COMP_INPUT_SOURCE COMP Input Channel Select + * @{ + */ +#define COMP_INPUT_SRC_IO0 LL_COMP_INPUT_SRC_IO0 /**< Set MSIO_0 as inputs for the comparator */ +#define COMP_INPUT_SRC_IO1 LL_COMP_INPUT_SRC_IO1 /**< Set MSIO_1 as inputs for the comparator */ +#define COMP_INPUT_SRC_IO2 LL_COMP_INPUT_SRC_IO2 /**< Set MSIO_2 as inputs for the comparator */ +#define COMP_INPUT_SRC_IO3 LL_COMP_INPUT_SRC_IO3 /**< Set MSIO_3 as inputs for the comparator */ +#define COMP_INPUT_SRC_IO4 LL_COMP_INPUT_SRC_IO4 /**< Set MSIO_4 as inputs for the comparator */ +/** @} */ + +/** @defgroup COMP_REFERENCE_SOURCE COMP Reference Source Select + * @{ + */ +#define COMP_REF_SRC_IO0 LL_COMP_REF_SRC_IO0 /**< Set MSIO_0 as references for the comparator */ +#define COMP_REF_SRC_IO1 LL_COMP_REF_SRC_IO1 /**< Set MSIO_1 as references for the comparator */ +#define COMP_REF_SRC_IO2 LL_COMP_REF_SRC_IO2 /**< Set MSIO_2 as references for the comparator */ +#define COMP_REF_SRC_IO3 LL_COMP_REF_SRC_IO3 /**< Set MSIO_3 as references for the comparator */ +#define COMP_REF_SRC_IO4 LL_COMP_REF_SRC_IO4 /**< Set MSIO_4 as references for the comparator */ +#define COMP_REF_SRC_VBAT LL_COMP_REF_SRC_VBAT /**< Set VBATT as references for the comparator */ +#define COMP_REF_SRC_VREF LL_COMP_REF_SRC_VREF /**< Set VREF as references for the comparator */ +/** @} */ + +/** + * @brief Default configuartion for initializing structure + */ +#define COMP_DEFAULT_CONFIG LL_COMP_DEFAULT_CONFIG +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup COMP_Private_Macros COMP Private Macros + * @{ + */ + +/** + * @brief Check if COMP input source is valid. + * @param __INPUT__ COMP input source. + * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) + */ +#define IS_COMP_INPUT(__INPUT__) (((__INPUT__) == COMP_INPUT_SRC_IO0) || \ + ((__INPUT__) == COMP_INPUT_SRC_IO1) || \ + ((__INPUT__) == COMP_INPUT_SRC_IO2) || \ + ((__INPUT__) == COMP_INPUT_SRC_IO3) || \ + ((__INPUT__) == COMP_INPUT_SRC_IO4)) + +/** + * @brief Check if COMP reference source is valid. + * @param __INPUT__ COMP reference source. + * @retval SET (__INPUT__ is valid) or RESET (__INPUT__ is invalid) + */ +#define IS_COMP_REF(__INPUT__) (((__INPUT__) == COMP_REF_SRC_IO0) || \ + ((__INPUT__) == COMP_REF_SRC_IO1) || \ + ((__INPUT__) == COMP_REF_SRC_IO2) || \ + ((__INPUT__) == COMP_REF_SRC_IO3) || \ + ((__INPUT__) == COMP_REF_SRC_IO4) || \ + ((__INPUT__) == COMP_REF_SRC_VBAT) || \ + ((__INPUT__) == COMP_REF_SRC_VREF)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_COMP_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup COMP_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the COMP according to the specified parameters + * in the comp_init_t and initialize the associated handle. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_init(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief De-initialize the COMP peripheral. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_deinit(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief Initialize the COMP MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_comp_msp_deinit can be implemented in the user file. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + **************************************************************************************** + */ +void hal_comp_msp_init(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief De-initialize the COMP MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_comp_msp_deinit can be implemented in the user file. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + **************************************************************************************** + */ +void hal_comp_msp_deinit(comp_handle_t *p_comp); + +/** @} */ + +/** @addtogroup COMP_Exported_Functions_Group2 IO operation functions + * @brief COMP polling and DMA conversion management functions. + * @{ + */ + + /** + **************************************************************************************** + * @brief Start the comparator. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_start(comp_handle_t *p_comp); + + /** + **************************************************************************************** + * @brief Stop the comparator. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_stop(comp_handle_t *p_comp); + +/** @} */ + +/** @addtogroup COMP_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle COMP interrupt request. + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information + * for the specified COMP module. + **************************************************************************************** + */ +void hal_comp_irq_handler(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief comparator callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_comp_trigger_callback can be implemented in the user file. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + **************************************************************************************** + */ +void hal_comp_trigger_callback(comp_handle_t *p_comp); + +/** @} */ + +/** @defgroup COMP_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief COMP control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the COMP. + (+) hal_comp_get_state() API can be helpful to check in run-time the state of the COMP peripheral. + (+) hal_comp_get_error() check in run-time Errors occurring during communication. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the COMP handle state. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @retval ::HAL_COMP_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_COMP_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_COMP_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_COMP_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_comp_state_t hal_comp_get_state(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief Return the COMP error code. + * + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration information for + * the specified COMP module. + * + * @return COMP error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_comp_get_error(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief Suspend some registers related to COMP configuration before sleep. + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration + * information for the specified COMP module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_suspend_reg(comp_handle_t *p_comp); + +/** + **************************************************************************************** + * @brief Restore some registers related to COMP configuration after sleep. + * This function must be used in conjunction with the hal_comp_suspend_reg(). + * @param[in] p_comp: Pointer to a COMP handle which contains the configuration + * information for the specified COMP module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_comp_resume_reg(comp_handle_t *p_comp); + +/** @} */ + +/** @} */ + + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_COMP_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_conf.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_conf.h new file mode 100644 index 0000000..2f98e0f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_conf.h @@ -0,0 +1,254 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_conf.h + * @author BLE Driver Team + * @brief HAL configuration file. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_CONF_H__ +#define __GR55xx_HAL_CONF_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ +#define HAL_MODULE_ENABLED /**< Enable HAL module driver */ +#define HAL_ADC_MODULE_ENABLED /**< Enable ADC HAL module driver */ +#define HAL_AON_GPIO_MODULE_ENABLED /**< Enable AON GPIO HAL module driver */ +#define HAL_CORTEX_MODULE_ENABLED /**< Enable CORTEX HAL module driver */ +#define HAL_DMA_MODULE_ENABLED /**< Enable DMA HAL module driver */ +#define HAL_DUAL_TIMER_MODULE_ENABLED /**< Enable DUAL TIM module driver */ +#define HAL_EXFLASH_MODULE_ENABLED /**< Enable EXFLASH module driver */ +#define HAL_GPIO_MODULE_ENABLED /**< Enable GPIO module driver */ +#define HAL_I2C_MODULE_ENABLED /**< Enable I2C module driver */ +#define HAL_MSIO_MODULE_ENABLED /**< Enable MSIO module driver */ +#define HAL_PKC_MODULE_ENABLED /**< Enable PKC module driver */ +#define HAL_PWM_MODULE_ENABLED /**< Enable PWM module driver */ +#define HAL_PWR_MODULE_ENABLED /**< Enable PWR module driver */ +#define HAL_QSPI_MODULE_ENABLED /**< Enable QSPI module driver */ +#define HAL_SPI_MODULE_ENABLED /**< Enable SPI module driver */ +//#define HAL_SPI_V2_MODULE_ENABLED /**< Enable SPI.v2 module driver */ +#define HAL_TIMER_MODULE_ENABLED /**< Enable TIM module driver */ +#define HAL_UART_MODULE_ENABLED /**< Enable UART module driver */ +#define HAL_WDT_MODULE_ENABLED /**< Enable WDT module driver */ +#define HAL_XQSPI_MODULE_ENABLED /**< Enable XQSPI module driver */ +#define HAL_AON_WDT_MODULE_ENABLED /**< Enable AON WDT module driver */ +#define HAL_CALENDAR_MODULE_ENABLED /**< Enable CALENDAR module driver */ +#define HAL_HMAC_MODULE_ENABLED /**< Enable HMAC module driver */ +#define HAL_I2S_MODULE_ENABLED /**< Enable I2S module driver */ +#define HAL_AES_MODULE_ENABLED /**< Enable AES module driver */ +#define HAL_EFUSE_MODULE_ENABLED /**< Enable EFUSE module driver */ +#define HAL_ISO7816_MODULE_ENABLED /**< Enable ISO7816 module driver */ +#define HAL_CGC_MODULE_ENABLED /**< Enable CGC module driver */ +#define HAL_RNG_MODULE_ENABLED /**< Enable RNG module driver */ +#define HAL_COMP_MODULE_ENABLED /**< Enable COMP module driver */ +#define HAL_SLEEP_TIMER_MODULE_ENABLED /**< Enable SLEPP TIMER module driver */ +#define HAL_BOD_MODULE_ENABLED /**< Enable BOD module driver */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define TICK_INT_PRIORITY ((uint32_t)(1U<<(__NVIC_PRIO_BITS - 4)) - 1U) /*!< tick interrupt priority (lowest by default) by group priority 4. */ +#define USE_RTOS 0U /*!< use rtos */ + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "gr_assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1U */ + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" +/** + * @brief Include module's header file + */ +#ifdef HAL_CORTEX_MODULE_ENABLED +#include "gr55xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED +#include "gr55xx_hal_adc.h" +#include "gr55xx_hal_adc_voltage_api.h" +#include "gr55xx_hal_adc_temp_api.h" +#include "gr55xx_hal_adc_vbat_api.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_AES_MODULE_ENABLED +#include "gr55xx_hal_aes.h" +#endif /* HAL_AES_MODULE_ENABLED */ + +#ifdef HAL_AON_GPIO_MODULE_ENABLED +#include "gr55xx_hal_aon_gpio.h" +#endif /* HAL_AON_GPIO_MODULE_ENABLED */ + +#ifdef HAL_AON_WDT_MODULE_ENABLED +#include "gr55xx_hal_aon_wdt.h" +#endif /* HAL_AON_WDT_MODULE_ENABLED */ + +#ifdef HAL_CALENDAR_MODULE_ENABLED +#include "gr55xx_hal_calendar.h" +#endif /* HAL_CALENDAR_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED +#include "gr55xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_DUAL_TIMER_MODULE_ENABLED +#include "gr55xx_hal_dual_tim.h" +#endif /* HAL_DUAL_TIMER_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED +#include "gr55xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_HMAC_MODULE_ENABLED +#include "gr55xx_hal_hmac.h" +#endif /* HAL_HMAC_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED +#include "gr55xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED +#include "gr55xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_MSIO_MODULE_ENABLED +#include "gr55xx_hal_msio.h" +#endif /* HAL_MSIO_MODULE_ENABLED */ + +#ifdef HAL_PKC_MODULE_ENABLED +#include "gr55xx_hal_pkc.h" +#endif /* HAL_PKC_MODULE_ENABLED */ + +#ifdef HAL_PWM_MODULE_ENABLED +#include "gr55xx_hal_pwm.h" +#endif /* HAL_PWM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED +#include "gr55xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_QSPI_MODULE_ENABLED +#include "gr55xx_hal_qspi.h" +#endif /* HAL_QSPI_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED +#include "gr55xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_SPI_V2_MODULE_ENABLED +#include "gr55xx_hal_spi_v2.h" +#endif /* HAL_SPI_V2_MODULE_ENABLED */ + +#ifdef HAL_TIMER_MODULE_ENABLED +#include "gr55xx_hal_tim.h" +#endif /* HAL_TIMER_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED +#include "gr55xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_WDT_MODULE_ENABLED +#include "gr55xx_hal_wdt.h" +#endif /* HAL_WDT_MODULE_ENABLED */ + +#ifdef HAL_XQSPI_MODULE_ENABLED +#include "gr55xx_hal_xqspi.h" +#endif /* HAL_XQSPI_MODULE_ENABLED */ + +#ifdef HAL_EXFLASH_MODULE_ENABLED +#include "gr55xx_hal_exflash.h" +#endif /* HAL_EXFLASH_MODULE_ENABLED */ + +#ifdef HAL_EFUSE_MODULE_ENABLED +#include "gr55xx_hal_efuse.h" +#endif /* HAL_EFUSE_MODULE_ENABLED */ + +#ifdef HAL_CGC_MODULE_ENABLED +#include "gr55xx_hal_cgc.h" +#endif /* HAL_CGC_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED +#include "gr55xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED +#include "gr55xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_ISO7816_MODULE_ENABLED +#include "gr55xx_hal_iso7816.h" +#endif /* HAL_ISO7816_MODULE_ENABLED */ + +#ifdef HAL_SLEEP_TIMER_MODULE_ENABLED +#include "gr55xx_hal_sleep_timer.h" +#endif /* HAL_SLEEP_TIMER_MODULE_ENABLED */ + +#ifdef HAL_BOD_MODULE_ENABLED +#include "gr55xx_hal_bod.h" +#endif /* HAL_BOD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The gr_assert_param macro is used for function's parameters check. + * @param expr If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ +#define gr_assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ +void assert_failed(char *file, uint32_t line); +#else +#define gr_assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_CONF_H__ */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cortex.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cortex.h new file mode 100644 index 0000000..1482e82 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_cortex.h @@ -0,0 +1,770 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_cortex.h + * @author BLE Driver Team + * @brief Header file of CORTEX HAL module. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_CORTEX CORTEX + * @brief CORTEX HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_CORTEX_H__ +#define __GR55xx_HAL_CORTEX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ + +/** @addtogroup HAL_CORTEX_STRUCTURES Structures + * @{ + */ + +#if (__MPU_PRESENT == 1U) + +/** @defgroup CORTEX_MPU_Region_Configuration MPU Region Configuration + * @{ + */ + +/** + * @brief MPU Region initialization structure + */ +typedef struct _mpu_region_init_t +{ + uint8_t enable; /**< Specifies the status of the region. + This parameter can be a value of @ref CORTEX_MPU_Region_Enable */ + + uint8_t number; /**< Specifies the number of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Number */ + + uint32_t base_address; /**< Specifies the base address of the region to protect. */ + + uint8_t size; /**< Specifies the size of the region to protect. + This parameter can be a value of @ref CORTEX_MPU_Region_Size */ + + uint8_t subregion_disable; /**< Specifies the number of the subregion protection to disable. + This parameter must be a number between Min_Data = 0x00 and Max_Data = 0xFF */ + + uint8_t type_tex_field; /**< Specifies the TEX field level. + This parameter can be a value of @ref CORTEX_MPU_TEX_Levels */ + + uint8_t access_permission; /**< Specifies the region access permission type. + This parameter can be a value of @ref CORTEX_MPU_Region_Permission_Attributes */ + + uint8_t disable_exec; /**< Specifies the instruction access status. + This parameter can be a value of @ref CORTEX_MPU_Instruction_Access */ + + uint8_t is_shareable; /**< Specifies the shareability status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Shareable */ + + uint8_t is_cacheable; /**< Specifies the cacheable status of the region protected. + This parameter can be a value of @ref CORTEX_MPU_Access_Cacheable */ + + uint8_t is_bufferable; /**< Specifies the bufferable status of the protected region. + This parameter can be a value of @ref CORTEX_MPU_Access_Bufferable */ + +} mpu_region_init_t; + +/** @} */ + +#endif /* __MPU_PRESENT */ + +/** @} */ + + +/** + * @defgroup HAL_CORTEX_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ + +/** @defgroup CORTEX_Exported_Constants CORTEX Exported Constants + * @{ + */ + +/** @defgroup CORTEX_Preemption_Priority_Group CORTEX Preemption Priority Group + * @{ + */ +#define NVIC_PRIORITYGROUP_0 (0x00000007U) /**< 0 bit for pre-emption priority, + 8 bits for subpriority */ +#define NVIC_PRIORITYGROUP_1 (0x00000006U) /**< 1 bit for pre-emption priority, + 7 bits for subpriority */ +#define NVIC_PRIORITYGROUP_2 (0x00000005U) /**< 2 bits for pre-emption priority, + 6 bits for subpriority */ +#define NVIC_PRIORITYGROUP_3 (0x00000004U) /**< 3 bits for pre-emption priority, + 5 bits for subpriority */ +#define NVIC_PRIORITYGROUP_4 (0x00000003U) /**< 4 bits for pre-emption priority, + 4 bits for subpriority */ +#define NVIC_PRIORITYGROUP_5 (0x00000002U) /**< 5 bits for pre-emption priority, + 3 bits for subpriority */ +#define NVIC_PRIORITYGROUP_6 (0x00000001U) /**< 6 bits for pre-emption priority, + 2 bits for subpriority */ +#define NVIC_PRIORITYGROUP_7 (0x00000000U) /**< 7 bits for pre-emption priority, + 1 bit for subpriority */ +/** @} */ + +/** @defgroup CORTEX_SysTick_clock_source CORTEX SysTick clock source + * @{ + */ +#define SYSTICK_CLKSOURCE_REFCLK (0x00000000U) /**< SYSTICK clock source External Reference Clock */ +#define SYSTICK_CLKSOURCE_HCLK (0x00000004U) /**< SYSTICK clock source HCLK */ +/** @} */ + +#if (__MPU_PRESENT == 1U) +/** @defgroup CORTEX_MPU_HFNMI_PRIVDEF_Control MPU HFNMI and PRIVILEGED Access control + * @{ + */ +#define MPU_HFNMI_PRIVDEF_NONE (0x00000000U) /**< HFNMIENA disable, PRIVDEFENA disable */ +#define MPU_HARDFAULT_NMI (0x00000002U) /**< HFNMIENA enable, PRIVDEFENA disable */ +#define MPU_PRIVILEGED_DEFAULT (0x00000004U) /**< HFNMIENA disable, PRIVDEFENA enable */ +#define MPU_HFNMI_PRIVDEF (0x00000006U) /**< HFNMIENA enable, PRIVDEFENA enable */ +/** @} */ + +/** @defgroup CORTEX_MPU_Region_Enable CORTEX MPU Region Enable + * @{ + */ +#define MPU_REGION_ENABLE ((uint8_t)0x01U) /**< MPU Region Enable */ +#define MPU_REGION_DISABLE ((uint8_t)0x00U) /**< MPU Region Disable */ +/** @} */ + +/** @defgroup CORTEX_MPU_Instruction_Access CORTEX MPU Instruction Access + * @{ + */ +#define MPU_INSTRUCTION_ACCESS_ENABLE ((uint8_t)0x00U) /**< MPU Instruction Access Enable */ +#define MPU_INSTRUCTION_ACCESS_DISABLE ((uint8_t)0x01U) /**< MPU Instruction Access Disable */ +/** @} */ + +/** @defgroup CORTEX_MPU_Access_Shareable CORTEX MPU Instruction Access Shareable + * @{ + */ +#define MPU_ACCESS_SHAREABLE ((uint8_t)0x01U) /**< MPU Instruction Access Shareable */ +#define MPU_ACCESS_NOT_SHAREABLE ((uint8_t)0x00U) /**< MPU Instruction Access Not Shareable */ +/** @} */ + +/** @defgroup CORTEX_MPU_Access_Cacheable CORTEX MPU Instruction Access Cacheable + * @{ + */ +#define MPU_ACCESS_CACHEABLE ((uint8_t)0x01U) /**< MPU Instruction Access Cacheable */ +#define MPU_ACCESS_NOT_CACHEABLE ((uint8_t)0x00U) /**< MPU Instruction Access Not Cacheable */ +/** @} */ + +/** @defgroup CORTEX_MPU_Access_Bufferable CORTEX MPU Instruction Access Bufferable + * @{ + */ +#define MPU_ACCESS_BUFFERABLE ((uint8_t)0x01U) /**< MPU Instruction Access Bufferable */ +#define MPU_ACCESS_NOT_BUFFERABLE ((uint8_t)0x00U) /**< MPU Instruction Access Not Bufferable */ +/** @} */ + +/** @defgroup CORTEX_MPU_TEX_Levels MPU TEX Levels + * @{ + */ +#define MPU_TEX_LEVEL0 ((uint8_t)0x00U) /**< MPU TEX Level 0 */ +#define MPU_TEX_LEVEL1 ((uint8_t)0x01U) /**< MPU TEX Level 1 */ +#define MPU_TEX_LEVEL2 ((uint8_t)0x02U) /**< MPU TEX Level 2 */ +/** @} */ + +/** @defgroup CORTEX_MPU_Region_Size CORTEX MPU Region Size + * @{ + */ +#define MPU_REGION_SIZE_32B ((uint8_t)0x04U) /**< MPU Region Size 32B */ +#define MPU_REGION_SIZE_64B ((uint8_t)0x05U) /**< MPU Region Size 64B */ +#define MPU_REGION_SIZE_128B ((uint8_t)0x06U) /**< MPU Region Size 128B */ +#define MPU_REGION_SIZE_256B ((uint8_t)0x07U) /**< MPU Region Size 256B */ +#define MPU_REGION_SIZE_512B ((uint8_t)0x08U) /**< MPU Region Size 512B */ +#define MPU_REGION_SIZE_1KB ((uint8_t)0x09U) /**< MPU Region Size 1KB */ +#define MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) /**< MPU Region Size 2KB */ +#define MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) /**< MPU Region Size 4KB */ +#define MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) /**< MPU Region Size 8KB */ +#define MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) /**< MPU Region Size 16KB */ +#define MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) /**< MPU Region Size 32KB */ +#define MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) /**< MPU Region Size 64KB */ +#define MPU_REGION_SIZE_128KB ((uint8_t)0x10U) /**< MPU Region Size 128KB */ +#define MPU_REGION_SIZE_256KB ((uint8_t)0x11U) /**< MPU Region Size 256KB */ +#define MPU_REGION_SIZE_512KB ((uint8_t)0x12U) /**< MPU Region Size 512KB */ +#define MPU_REGION_SIZE_1MB ((uint8_t)0x13U) /**< MPU Region Size 1MB */ +#define MPU_REGION_SIZE_2MB ((uint8_t)0x14U) /**< MPU Region Size 2MB */ +#define MPU_REGION_SIZE_4MB ((uint8_t)0x15U) /**< MPU Region Size 4MB */ +#define MPU_REGION_SIZE_8MB ((uint8_t)0x16U) /**< MPU Region Size 8MB */ +#define MPU_REGION_SIZE_16MB ((uint8_t)0x17U) /**< MPU Region Size 16MB */ +#define MPU_REGION_SIZE_32MB ((uint8_t)0x18U) /**< MPU Region Size 32MB */ +#define MPU_REGION_SIZE_64MB ((uint8_t)0x19U) /**< MPU Region Size 64MB */ +#define MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) /**< MPU Region Size 128MB */ +#define MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) /**< MPU Region Size 256MB */ +#define MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) /**< MPU Region Size 512MB */ +#define MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) /**< MPU Region Size 1GB */ +#define MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) /**< MPU Region Size 2GB */ +#define MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) /**< MPU Region Size 4GB */ +/** @} */ + +/** @defgroup CORTEX_MPU_Region_Permission_Attributes CORTEX MPU Region Permission Attributes + * @{ + */ +#define MPU_REGION_NO_ACCESS ((uint8_t)0x00U) /**< All accesses generate a permission fault */ +#define MPU_REGION_PRIV_RW ((uint8_t)0x01U) /**< Access from privileged software only */ +#define MPU_REGION_PRIV_RW_URO ((uint8_t)0x02U) /**< Writes by unprivileged software generate a permission fault */ +#define MPU_REGION_FULL_ACCESS ((uint8_t)0x03U) /**< Full access */ +#define MPU_REGION_PRIV_RO ((uint8_t)0x05U) /**< Reads by privileged software only */ +#define MPU_REGION_PRIV_RO_URO ((uint8_t)0x06U) /**< Read only, by privileged or unprivileged software */ +/** @} */ + +/** @defgroup CORTEX_MPU_Region_Number CORTEX MPU Region Number + * @{ + */ +#define MPU_REGION_NUMBER0 ((uint8_t)0x00U) /**< MPU Region Number 0 */ +#define MPU_REGION_NUMBER1 ((uint8_t)0x01U) /**< MPU Region Number 1 */ +#define MPU_REGION_NUMBER2 ((uint8_t)0x02U) /**< MPU Region Number 2 */ +#define MPU_REGION_NUMBER3 ((uint8_t)0x03U) /**< MPU Region Number 3 */ +#define MPU_REGION_NUMBER4 ((uint8_t)0x04U) /**< MPU Region Number 4 */ +#define MPU_REGION_NUMBER5 ((uint8_t)0x05U) /**< MPU Region Number 5 */ +#define MPU_REGION_NUMBER6 ((uint8_t)0x06U) /**< MPU Region Number 6 */ +#define MPU_REGION_NUMBER7 ((uint8_t)0x07U) /**< MPU Region Number 7 */ +/** @} */ +#endif /* __MPU_PRESENT */ + +/** @} */ + +/* Exported Macros -----------------------------------------------------------*/ +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup CORTEX_Private_Macros CORTEX Private Macros + * @{ + */ + +/** + * @brief Check if NVIC priority group is valid. + * @param __GROUP__ NVIC priority group. + * @retval SET (__GROUP__ is valid) or RESET (__GROUP__ is invalid) + */ +#define IS_NVIC_PRIORITY_GROUP(__GROUP__) (((__GROUP__) == NVIC_PRIORITYGROUP_0) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_1) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_2) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_3) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_4) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_5) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_6) || \ + ((__GROUP__) == NVIC_PRIORITYGROUP_7)) + +/** + * @brief Check if NVIC priority group is valid. + * @param __PRIORITY__ NVIC priority group. + * @retval SET (__PRIORITY__ is valid) or RESET (__PRIORITY__ is invalid) + */ +#define IS_NVIC_PREEMPTION_PRIORITY(__PRIORITY__) ((__PRIORITY__) < 0x80U) + +/** + * @brief Check if NVIC sub priority is valid. + * @param __PRIORITY__ NVIC sub priority. + * @retval SET (__PRIORITY__ is valid) or RESET (__PRIORITY__ is invalid) + */ +#define IS_NVIC_SUB_PRIORITY(__PRIORITY__) ((__PRIORITY__) <= 0xFFU) + +/** + * @brief Check if NVIC deivce IRQ is valid. + * @param __IRQ__ NVIC device IRQ. + * @retval SET (__IRQ__ is valid) or RESET (__IRQ__ is invalid) + */ +#define IS_NVIC_DEVICE_IRQ(__IRQ__) ((__IRQ__) >= 0x00) + +/** + * @brief Check if SYSTICK clock source is valid. + * @param __SOURCE__ SYSTICK clock source. + * @retval SET (__SOURCE__ is valid) or RESET (__SOURCE__ is invalid) + */ +#define IS_SYSTICK_CLK_SOURCE(__SOURCE__) (((__SOURCE__) == SYSTICK_CLKSOURCE_HCLK) || \ + ((__SOURCE__) == SYSTICK_CLKSOURCE_REFCLK)) + +#if (__MPU_PRESENT == 1U) + +/** + * @brief Check if MPU enable state is valid. + * @param __STATE__ Enable state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is not invalid) + */ +#define IS_MPU_REGION_ENABLE(__STATE__) (((__STATE__) == MPU_REGION_ENABLE) || \ + ((__STATE__) == MPU_REGION_DISABLE)) + +/** + * @brief Check if MPU instruction access state is valid. + * @param __STATE__ MPU instruction access state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is not invalid) + */ +#define IS_MPU_INSTRUCTION_ACCESS(__STATE__) (((__STATE__) == MPU_INSTRUCTION_ACCESS_ENABLE) || \ + ((__STATE__) == MPU_INSTRUCTION_ACCESS_DISABLE)) + +/** + * @brief Check if MPU access shareable state is valid. + * @param __STATE__ MPU access shareable state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is not invalid) + */ +#define IS_MPU_ACCESS_SHAREABLE(__STATE__) (((__STATE__) == MPU_ACCESS_SHAREABLE) || \ + ((__STATE__) == MPU_ACCESS_NOT_SHAREABLE)) + +/** + * @brief Check if MPU access cacheable state is valid. + * @param __STATE__ MPU access cacheable state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is not invalid) + */ +#define IS_MPU_ACCESS_CACHEABLE(__STATE__) (((__STATE__) == MPU_ACCESS_CACHEABLE) || \ + ((__STATE__) == MPU_ACCESS_NOT_CACHEABLE)) + +/** + * @brief Check if MPU access bufferable state is valid. + * @param __STATE__ MPU access bufferable state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is not invalid) + */ +#define IS_MPU_ACCESS_BUFFERABLE(__STATE__) (((__STATE__) == MPU_ACCESS_BUFFERABLE) || \ + ((__STATE__) == MPU_ACCESS_NOT_BUFFERABLE)) + +/** + * @brief Check if MPU Tex level is valid. + * @param __TYPE__ MPU Tex level. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_MPU_TEX_LEVEL(__TYPE__) (((__TYPE__) == MPU_TEX_LEVEL0) || \ + ((__TYPE__) == MPU_TEX_LEVEL1) || \ + ((__TYPE__) == MPU_TEX_LEVEL2)) + +/** + * @brief Check if MPU region permission attribute type is valid. + * @param __TYPE__ MPU region permission attribute type. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_MPU_REGION_PERMISSION_ATTRIBUTE(__TYPE__) (((__TYPE__) == MPU_REGION_NO_ACCESS) || \ + ((__TYPE__) == MPU_REGION_PRIV_RW) || \ + ((__TYPE__) == MPU_REGION_PRIV_RW_URO) || \ + ((__TYPE__) == MPU_REGION_FULL_ACCESS) || \ + ((__TYPE__) == MPU_REGION_PRIV_RO) || \ + ((__TYPE__) == MPU_REGION_PRIV_RO_URO)) + +/** + * @brief Check if MPU region number is valid. + * @param __NUMBER__ MPU region number. + * @retval SET (__NUMBER__ is valid) or RESET (__NUMBER__ is invalid) + */ +#define IS_MPU_REGION_NUMBER(__NUMBER__) (((__NUMBER__) == MPU_REGION_NUMBER0) || \ + ((__NUMBER__) == MPU_REGION_NUMBER1) || \ + ((__NUMBER__) == MPU_REGION_NUMBER2) || \ + ((__NUMBER__) == MPU_REGION_NUMBER3) || \ + ((__NUMBER__) == MPU_REGION_NUMBER4) || \ + ((__NUMBER__) == MPU_REGION_NUMBER5) || \ + ((__NUMBER__) == MPU_REGION_NUMBER6) || \ + ((__NUMBER__) == MPU_REGION_NUMBER7)) + +/** + * @brief Check if MPU region size is valid. + * @param __SIZE__ MPU region size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_MPU_REGION_SIZE(__SIZE__) (((__SIZE__) == MPU_REGION_SIZE_32B) || \ + ((__SIZE__) == MPU_REGION_SIZE_64B) || \ + ((__SIZE__) == MPU_REGION_SIZE_128B) || \ + ((__SIZE__) == MPU_REGION_SIZE_256B) || \ + ((__SIZE__) == MPU_REGION_SIZE_512B) || \ + ((__SIZE__) == MPU_REGION_SIZE_1KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_2KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_4KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_8KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_16KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_32KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_64KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_128KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_256KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_512KB) || \ + ((__SIZE__) == MPU_REGION_SIZE_1MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_2MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_4MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_8MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_16MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_32MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_64MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_128MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_256MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_512MB) || \ + ((__SIZE__) == MPU_REGION_SIZE_1GB) || \ + ((__SIZE__) == MPU_REGION_SIZE_2GB) || \ + ((__SIZE__) == MPU_REGION_SIZE_4GB)) + + +/** + * @brief Check if MPU sub region is valid. + * @param __SUBREGION__ MPU sub region. + * @retval SET (__SUBREGION__ is valid) or RESET (__SUBREGION__ is invalid) + */ +#define IS_MPU_SUB_REGION_DISABLE(__SUBREGION__) ((__SUBREGION__) < (uint16_t)0x00FFU) +#endif /* __MPU_PRESENT */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_CORTEX_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup CORTEX_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions. + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] + This section provides the CORTEX HAL driver functions allowing to configure Interrupts + Systick functionalities + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Set the priority grouping field (pre-emption priority and subpriority) + * using the required unlock sequence. + * + * @note When the NVIC_PriorityGroup_0 is selected, IRQ pre-emption is no more possible. + * The pending IRQ priority will be managed only by the subpriority. + * + * @param[in] priority_group: The priority grouping bits length. + * This parameter can be one of the following values: + * @arg @ref NVIC_PRIORITYGROUP_0 0 bit for pre-emption priority, + * 8 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_1 1 bit for pre-emption priority, + * 7 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_2 2 bits for pre-emption priority, + * 6 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_3 3 bits for pre-emption priority, + * 5 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_4 4 bits for pre-emption priority, + * 4 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_5 5 bits for pre-emption priority, + * 3 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_6 6 bits for pre-emption priority, + * 2 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_7 7 bits for pre-emption priority, + * 1 bit for subpriority + **************************************************************************************** + */ +void hal_nvic_set_priority_grouping(uint32_t priority_group); + +/** + **************************************************************************************** + * @brief Set the priority of an interrupt. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + * @param[in] preempt_priority: The pre-emption priority for the IRQn channel. + * This parameter can be a value between 0 and 127 as described in the table CORTEX_NVIC_Priority_Table. + * A lower priority value indicates a higher priority + * @param[in] sub_priority: The subpriority level for the IRQ channel. + * This parameter can be a value between 0 and 255 as described in the table CORTEX_NVIC_Priority_Table. + * A lower priority value indicates a higher priority. + **************************************************************************************** + */ +void hal_nvic_set_priority(IRQn_Type IRQn, uint32_t preempt_priority, uint32_t sub_priority); + +/** + **************************************************************************************** + * @brief Enable a device specific interrupt in the NVIC interrupt controller. + * + * @note To configure interrupts priority correctly, the NVIC_PriorityGroupConfig() + * function should be called before. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + **************************************************************************************** + */ +void hal_nvic_enable_irq(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Disable a device specific interrupt in the NVIC interrupt controller. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + **************************************************************************************** + */ +void hal_nvic_disable_irq(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Initiate a system reset request to reset the MCU. + **************************************************************************************** + */ +void hal_nvic_system_reset(void); + + +/** + **************************************************************************************** + * @brief Initialize the System Timer and its interrupt, and start the System Tick Timer. + * Counter is in free running mode to generate periodic interrupts. + * + * @param[in] ticks_number: Specifies the number of ticks between two interrupts. + * + * @retval status + * - 0 Function succeeded. + * - 1 Function failed. + **************************************************************************************** + */ +uint32_t hal_systick_config(uint32_t ticks_number); + +/** @} */ + +/** @addtogroup CORTEX_Exported_Functions_Group2 Peripheral Control functions + * @brief Cortex control functions. + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This subsection provides a set of functions allowing to control the CORTEX + (NVIC, SYSTICK, MPU) functionalities. + + +@endverbatim + * @{ + */ + +#if (__MPU_PRESENT == 1U) +/** + **************************************************************************************** + * @brief Initialize and configures the Region and the memory to be protected. + * + * @param[in] p_mpu_init: Pointer to a mpu_region_init_t structure that contains + * the initialization and configuration information. + **************************************************************************************** + */ +void hal_mpu_config_region(mpu_region_init_t *p_mpu_init); +#endif /* __MPU_PRESENT */ + +/** + **************************************************************************************** + * @brief Get the priority grouping field from the NVIC Interrupt Controller. + * + * @return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field) + **************************************************************************************** + */ +uint32_t hal_nvic_get_priority_grouping(void); + +/** + **************************************************************************************** + * @brief Get the priority of an interrupt. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration. + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + * @param[in] priority_group: The priority grouping bits length. + * This parameter can be one of the following values: + * @arg @ref NVIC_PRIORITYGROUP_0 0 bit for pre-emption priority, + * 8 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_1 1 bit for pre-emption priority, + * 7 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_2 2 bits for pre-emption priority, + * 6 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_3 3 bits for pre-emption priority, + * 5 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_4 4 bits for pre-emption priority, + * 4 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_5 5 bits for pre-emption priority, + * 3 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_6 6 bits for pre-emption priority, + * 2 bits for subpriority + * @arg @ref NVIC_PRIORITYGROUP_7 7 bits for pre-emption priority, + * 1 bit for subpriority + * @param[in] p_preempt_priority: Pointer on the Preemptive priority value (starting from 0). + * @param[in] p_sub_priority: Pointer on the Subpriority value (starting from 0). + **************************************************************************************** + */ +void hal_nvic_get_priority(IRQn_Type IRQn, uint32_t priority_group, uint32_t *p_preempt_priority, uint32_t *p_sub_priority); + +/** + **************************************************************************************** + * @brief Set Pending bit of an external interrupt. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + **************************************************************************************** + */ +void hal_nvic_set_pending_irq(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Get Pending Interrupt (reads the pending register in the NVIC + * and returns the pending bit for the specified interrupt). + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + * + * @return status + * - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + **************************************************************************************** + */ +uint32_t hal_nvic_get_pending_irq(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Clear the pending bit of an external interrupt. + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + **************************************************************************************** + */ +void hal_nvic_clear_pending_irq(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Get active interrupt (reads the active register in NVIC and returns the active bit). + * + * @param[in] IRQn: External interrupt number. + * This parameter can be an enumerator of IRQn_Type enumeration + * (For the complete GR55xx Devices IRQ Channels list, please refer to the appropriate CMSIS device file (gr55xxxx.h)) + * + * @return status + * - 0 Interrupt status is not pending. + * - 1 Interrupt status is pending. + **************************************************************************************** + */ +uint32_t hal_nvic_get_active(IRQn_Type IRQn); + +/** + **************************************************************************************** + * @brief Configure the SysTick clock source. + * + * @param[in] clk_source: specifies the SysTick clock source. + * This parameter can be one of the following values: + * @arg @ref SYSTICK_CLKSOURCE_REFCLK External Reference Clock as SysTick clock source. + * @arg @ref SYSTICK_CLKSOURCE_HCLK AHB clock selected as SysTick clock source. + **************************************************************************************** + */ +void hal_systick_clk_source_config(uint32_t clk_source); + +/** @} */ + +/** @addtogroup CORTEX_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions. + * @{ + */ + +/** + **************************************************************************************** + * @brief This function handles SYSTICK interrupt request. + **************************************************************************************** + */ +void hal_systick_irq_handler(void); + +/** + **************************************************************************************** + * @brief SYSTICK callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_systick_callback can be implemented in the user file. + **************************************************************************************** + */ +void hal_systick_callback(void); + +/** @} */ + +/* Private functions ---------------------------------------------------------*/ +/** @defgroup CORTEX_Private_Functions CORTEX Private Functions + * @brief CORTEX private functions + * @{ + */ + +#if (__MPU_PRESENT == 1U) + +/** + **************************************************************************************** + * @brief Disables the MPU and clears the HFNMIENA bit (ARM recommendation) + **************************************************************************************** + */ +void hal_mpu_disable(void); + +/** + **************************************************************************************** + * @brief Enable the MPU + * + * @param[in] mpu_control: Specifies the control mode of the MPU during hard fault, + * NMI, FAULTMASK and privileged access to the default memory. + * This parameter can be one of the following values: + * @arg @ref MPU_HFNMI_PRIVDEF_NONE + * @arg @ref MPU_HARDFAULT_NMI + * @arg @ref MPU_PRIVILEGED_DEFAULT + * @arg @ref MPU_HFNMI_PRIVDEF + **************************************************************************************** + */ +void hal_mpu_enable(uint32_t mpu_control); + +#endif /* __MPU_PRESENT */ + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_CORTEX_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_def.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_def.h new file mode 100644 index 0000000..17b0527 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_def.h @@ -0,0 +1,234 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_def.h + * @author BLE Driver Team + * @brief This file contains HAL common definitions, enumeration, macros and structures definitions. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_DEF HAL DEFINE + * @brief HAL common definitions. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_DEF__ +#define __GR55xx_HAL_DEF__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" +#include + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_ENUMERATIONS Enumerations + * @{ */ +/** + * @brief HAL Status structures definition + */ +typedef enum +{ + HAL_OK = 0x00U, /**< Operation is OK. */ + HAL_ERROR = 0x01U, /**< Parameter error or operation is not supported. */ + HAL_BUSY = 0x02U, /**< Driver is busy. */ + HAL_TIMEOUT = 0x03 /**< Timeout occurred. */ +} hal_status_t; + +/** + * @brief HAL Lock structures definition + */ +typedef enum +{ + HAL_UNLOCKED = 0x00U, /**< Object is unlocked. */ + HAL_LOCKED = 0x01 /**< Object is locked. */ +} hal_lock_t; +/** @} */ + +/** + * @defgroup HAL_DEF_MACRO Defines + * @{ + */ + +/* Exported macro ------------------------------------------------------------*/ +/** + * @brief HAL max delay definition + */ +#define HAL_MAX_DELAY (0xFFFFFFFFU) + +/** + * @brief Check whether the bits of register are set. + * @param REG specifies the register. + * @param BIT specifies the bits will be checked. + * @retval SET (BIT is set) or RESET (BIT is not set) + */ +#define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) +/** + * @brief Check whether the bits of register are clear. + * @param REG specifies the register. + * @param BIT specifies the bits will be checked. + * @retval SET (BIT is clear) or RESET (BIT is not clear) + */ +#define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) + +/** + * @brief Link DMA handle and peripheral handle. + * @param __HANDLE__ specifies the peripheral handle. + * @param __PPP_DMA_FIELD_ specifies the DMA pointer in struction of peripheral handle. + * @param __DMA_HANDLE_ specifies the DMA handle. + * @retval None + */ +#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \ + do{ \ + (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \ + (__DMA_HANDLE_).p_parent = (__HANDLE__); \ + } while(0U) + +/** @brief Reset the Handle's State field. + * @param __HANDLE__ specifies the Peripheral Handle. + * @note This macro can be used for the following purposes: + * - When the Handle is declared as local variable; before passing it as parameter + * to hal_ppp_init() for the first time, it is mandatory to use this macro + * to set the Handle's "State" field to 0. + * Otherwise, "State" field may have any random value and the first time the function + * hal_ppp_init() is called, the low level hardware initialization will be missed + * (i.e. hal_ppp_msp_init() will not be executed). + * - When there is a need to reconfigure the low level hardware: instead of calling + * hal_ppp_deinit() then hal_ppp_init(), user can make a call to this macro then hal_ppp_init(). + * In this later function, when the Handle's "State" field is set to 0, it will execute the function + * hal_ppp_msp_init which will reconfigure the low level hardware. + * @retval None + */ +#define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = 0U) + +#if (USE_RTOS == 1U) +#error " USE_RTOS should be 0 in the current HAL release " +#else +/** + * @brief Lock peripheral handle. + * @param __HANDLE__ specifies the peripheral handle. + * @retval HAL_BUSY If handle is locked. + */ +#define __HAL_LOCK(__HANDLE__) \ + do{ \ + if((__HANDLE__)->lock == HAL_LOCKED) \ + { \ + return HAL_BUSY; \ + } \ + else \ + { \ + (__HANDLE__)->lock = HAL_LOCKED; \ + } \ + }while (0U) + +/** + * @brief Unlock peripheral handle. + * @param __HANDLE__ specifies the peripheral handle. + * @retval None + */ +#define __HAL_UNLOCK(__HANDLE__) \ + do{ \ + (__HANDLE__)->lock = HAL_UNLOCKED; \ + }while (0U) +#endif /* USE_RTOS */ + + +#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ +#ifndef __weak +#define __weak __attribute__((weak)) +#endif /* __weak */ +#ifndef __packed +#define __packed __attribute__((__packed__)) +#endif /* __packed */ +#endif /* __GNUC__ */ + + +/* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ +#if defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ +#ifndef __ALIGN_END +#define __ALIGN_END __attribute__((aligned(4))) +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#define __ALIGN_BEGIN +#endif /* __ALIGN_BEGIN */ +#else +#ifndef __ALIGN_END +#define __ALIGN_END /**< ALIGN END */ +#endif /* __ALIGN_END */ +#ifndef __ALIGN_BEGIN +#if defined(__CC_ARM) /* ARM Compiler */ +#define __ALIGN_BEGIN __align(4) +#elif defined(__ICCARM__) /* IAR Compiler */ +#define __ALIGN_BEGIN +#endif /* __CC_ARM */ +#endif /* __ALIGN_BEGIN */ +#endif /* __GNUC__ */ + +/** + * @brief __NOINLINE definition + */ +#if defined(__CC_ARM) || defined(__GNUC__) +/* ARM & GNUCompiler + ---------------- +*/ +#define __NOINLINE __attribute__((noinline)) + +#elif defined(__ICCARM__) +/* ICCARM Compiler + --------------- +*/ +#define __NOINLINE _Pragma("optimize = no_inline") + +#endif + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ___GR55xx_HAL_DEF__ */ +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dma.h new file mode 100644 index 0000000..2463ec8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dma.h @@ -0,0 +1,736 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of DMA HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_DMA DMA + * @brief DMA HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_DMA_H__ +#define __GR55xx_HAL_DMA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_dma.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_DMA_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_DMA_state HAL DMA state + * @{ + */ + +/** + * @brief HAL DMA State Enumerations definition + */ +typedef enum +{ + HAL_DMA_STATE_RESET = 0x00U, /**< DMA not yet initialized or disabled */ + HAL_DMA_STATE_READY = 0x01U, /**< DMA process success and ready for use */ + HAL_DMA_STATE_BUSY = 0x02U, /**< DMA process is ongoing */ + HAL_DMA_STATE_TIMEOUT = 0x03U, /**< DMA timeout state */ + HAL_DMA_STATE_ERROR = 0x04U, /**< DMA error state */ +} hal_dma_state_t; +/** @} */ + +/** @defgroup HAL_DMA_channel HAL DMA channel + * @{ + */ + +/** + * @brief HAL DMA Channel Enumerations definition + */ +typedef enum +{ + DMA_Channel0 = 0U, /**< Channel 0 */ + DMA_Channel1 = 1U, /**< Channel 1 */ + DMA_Channel2 = 2U, /**< Channel 2 */ + DMA_Channel3 = 3U, /**< Channel 3 */ + DMA_Channel4 = 4U, /**< Channel 4 */ + DMA_Channel5 = 5U, /**< Channel 5 */ + DMA_Channel6 = 6U, /**< Channel 6 */ + DMA_Channel7 = 7U, /**< Channel 7 */ +} dma_channel_t; +/** @} */ + +/** @defgroup HAL_DMA_callback_ID HAL DMA callback ID + * @{ + */ + +/** + * @brief HAL DMA Callback ID Enumerations definition + */ +typedef enum +{ + HAL_DMA_XFER_TFR_CB_ID = 0x00, /**< Full transfer */ + HAL_DMA_XFER_BLK_CB_ID = 0x01, /**< Block transfer */ + HAL_DMA_XFER_ERROR_CB_ID = 0x02, /**< Error */ + HAL_DMA_XFER_ABORT_CB_ID = 0x03, /**< Abort */ + HAL_DMA_XFER_ALL_CB_ID = 0x04 /**< All */ +} hal_dma_callback_id_t; +/** @} */ + +/** @} */ + + +/** @addtogroup HAL_DMA_STRUCTURES Structures + * @{ + */ + +/** @defgroup DMA_Configuration DMA Configuration + * @{ + */ + +/** + * @brief DMA Configuration Structure definition + */ +typedef struct _dma_init +{ + uint32_t src_request; /**< Specifies the source request selected for the specified channel. + This parameter can be a value of @ref DMA_request */ + + uint32_t dst_request; /**< Specifies the destination request selected for the specified channel. + This parameter can be a value of @ref DMA_request */ + + uint32_t direction; /**< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory. + This parameter can be a value of @ref DMA_Data_transfer_direction */ + + uint32_t src_increment; /**< Specifies whether the srouce address register should be incremented or decrement or not. + This parameter can be a value of @ref DMA_Source_incremented_mode */ + + uint32_t dst_increment; /**< Specifies whether the destination address register should be incremented or decrement or not. + This parameter can be a value of @ref DMA_Destination_incremented_mode */ + + uint32_t src_data_alignment; /**< Specifies the source data width. + This parameter can be a value of @ref DMA_Source_data_size */ + + uint32_t dst_data_alignment; /**< Specifies the destination data width. + This parameter can be a value of @ref DMA_Destination_data_size */ + + uint32_t mode; /**< Specifies the operation mode of the DMA Channel(Normal or Circular). + This parameter can be a value of @ref DMA_mode + @note The circular buffer mode cannot be used if the memory-to-memory + data transfer is configured on the selected Channel */ + + uint32_t priority; /**< Specifies the software priority for the DMA Channel. + This parameter can be a value of @ref DMA_Priority_level */ +} dma_init_t; + +/** @} */ + +/** @defgroup DMA_handle DMA handle + * @{ + */ + +/** + * @brief DMA handle Structure definition + */ +typedef struct _dma_handle +{ + dma_channel_t channel; /**< DMA Channel Number */ + + dma_init_t init; /**< DMA communication parameters */ + + hal_lock_t lock; /**< DMA locking object */ + + __IO hal_dma_state_t state; /**< DMA transfer state */ + + void *p_parent; /**< Parent object state */ + + void (* xfer_tfr_callback)(struct _dma_handle *p_dma); /**< DMA transfer complete callback */ + + void (* xfer_blk_callback)(struct _dma_handle *p_dma); /**< DMA block complete callback */ + + void (* xfer_error_callback)(struct _dma_handle *p_dma); /**< DMA transfer error callback */ + + void (* xfer_abort_callback)(struct _dma_handle *p_dma); /**< DMA transfer abort callback */ + + __IO uint32_t error_code; /**< DMA Error code */ + + uint32_t retention[5]; /**< DMA important register information. */ +} dma_handle_t; + +/** @} */ + +/** @} */ + + +/** + * @defgroup HAL_DMA_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DMA_Exported_Constants DMA Exported Constants + * @{ + */ + +/** @defgroup DMA_Error_Code DMA Error Code + * @{ + */ +#define HAL_DMA_ERROR_NONE ((uint32_t)0x00000000U) /**< No error */ +#define HAL_DMA_ERROR_TE ((uint32_t)0x00000001U) /**< Transfer error */ +#define HAL_DMA_ERROR_NO_XFER ((uint32_t)0x00000004U) /**< no ongoing transfer */ +#define HAL_DMA_ERROR_TIMEOUT ((uint32_t)0x00000020U) /**< Timeout error */ +/** @} */ + +/** @defgroup DMA_request DMA request definitions + * @{ + */ +#define DMA_REQUEST_SPIM_TX LL_DMA_PERIPH_SPIM_TX /**< DMA SPIM transmit request */ +#define DMA_REQUEST_SPIM_RX LL_DMA_PERIPH_SPIM_RX /**< DMA SPIM receive request */ +#define DMA_REQUEST_SPIS_TX LL_DMA_PERIPH_SPIS_TX /**< DMA SPIS transmit request */ +#define DMA_REQUEST_SPIS_RX LL_DMA_PERIPH_SPIS_RX /**< DMA SPIS receive request */ +#define DMA_REQUEST_QSPI0_TX LL_DMA_PERIPH_QSPI0_TX /**< DMA QSPI0 transmit request */ +#define DMA_REQUEST_QSPI0_RX LL_DMA_PERIPH_QSPI0_RX /**< DMA QSPI0 receive request */ +#define DMA_REQUEST_I2C0_TX LL_DMA_PERIPH_I2C0_TX /**< DMA I2C0 transmit request */ +#define DMA_REQUEST_I2C0_RX LL_DMA_PERIPH_I2C0_RX /**< DMA I2C0 receive request */ +#define DMA_REQUEST_I2C1_TX LL_DMA_PERIPH_I2C1_TX /**< DMA I2C1 transmit request */ +#define DMA_REQUEST_I2C1_RX LL_DMA_PERIPH_I2C1_RX /**< DMA I2C1 receive request */ +#define DMA_REQUEST_I2S_S_TX LL_DMA_PERIPH_I2S_S_TX /**< DMA I2S_S transmit request */ +#define DMA_REQUEST_I2S_S_RX LL_DMA_PERIPH_I2S_S_RX /**< DMA I2S_S receive request */ +#define DMA_REQUEST_UART0_TX LL_DMA_PERIPH_UART0_TX /**< DMA UART0 transmit request */ +#define DMA_REQUEST_UART0_RX LL_DMA_PERIPH_UART0_RX /**< DMA UART0 receive request */ +#define DMA_REQUEST_QSPI1_TX LL_DMA_PERIPH_QSPI1_TX /**< DMA QSPI1 transmit request */ +#define DMA_REQUEST_QSPI1_RX LL_DMA_PERIPH_QSPI1_RX /**< DMA QSPI1 receive request */ +#define DMA_REQUEST_I2S_M_TX LL_DMA_PERIPH_I2S_M_TX /**< DMA I2S_M transmit request */ +#define DMA_REQUEST_I2S_M_RX LL_DMA_PERIPH_I2S_M_RX /**< DMA I2S_M receive request */ +#define DMA_REQUEST_SNSADC LL_DMA_PERIPH_SNSADC /**< DMA SenseADC request */ +#define DMA_REQUEST_MEM LL_DMA_PERIPH_MEM /**< DMA Memory request */ + +#define DMA0_REQUEST_SPIM_TX DMA_REQUEST_SPIM_TX /**< DMA SPIM transmit request */ +#define DMA0_REQUEST_SPIM_RX DMA_REQUEST_SPIM_RX /**< DMA SPIM receive request */ +#define DMA0_REQUEST_SPIS_TX DMA_REQUEST_SPIS_TX /**< DMA SPIS transmit request */ +#define DMA0_REQUEST_SPIS_RX DMA_REQUEST_SPIS_RX /**< DMA SPIS receive request */ +#define DMA0_REQUEST_QSPI0_TX DMA_REQUEST_QSPI0_TX /**< DMA QSPI0 transmit request */ +#define DMA0_REQUEST_QSPI0_RX DMA_REQUEST_QSPI0_RX /**< DMA QSPI0 receive request */ +#define DMA0_REQUEST_I2C0_TX DMA_REQUEST_I2C0_TX /**< DMA I2C0 transmit request */ +#define DMA0_REQUEST_I2C0_RX DMA_REQUEST_I2C0_RX /**< DMA I2C0 receive request */ +#define DMA0_REQUEST_I2C1_TX DMA_REQUEST_I2C1_TX /**< DMA I2C1 transmit request */ +#define DMA0_REQUEST_I2C1_RX DMA_REQUEST_I2C1_RX /**< DMA I2C1 receive request */ +#define DMA0_REQUEST_I2S_S_TX DMA_REQUEST_I2S_S_TX /**< DMA I2S_S transmit request */ +#define DMA0_REQUEST_I2S_S_RX DMA_REQUEST_I2S_S_RX /**< DMA I2S_S receive request */ +#define DMA0_REQUEST_UART0_TX DMA_REQUEST_UART0_TX /**< DMA UART0 transmit request */ +#define DMA0_REQUEST_UART0_RX DMA_REQUEST_UART0_RX /**< DMA UART0 receive request */ +#define DMA0_REQUEST_QSPI1_TX DMA_REQUEST_QSPI1_TX /**< DMA QSPI1 transmit request */ +#define DMA0_REQUEST_QSPI1_RX DMA_REQUEST_QSPI1_RX /**< DMA QSPI1 receive request */ +#define DMA0_REQUEST_I2S_M_TX DMA_REQUEST_I2S_M_TX /**< DMA I2S_M transmit request */ +#define DMA0_REQUEST_I2S_M_RX DMA_REQUEST_I2S_M_RX /**< DMA I2S_M receive request */ +#define DMA0_REQUEST_SNSADC DMA_REQUEST_SNSADC /**< DMA SenseADC request */ +#define DMA0_REQUEST_MEM DMA_REQUEST_MEM /**< DMA Memory request */ +/** @} */ + +/** @defgroup DMA_Data_transfer_direction DMA Data Transfer directions + * @{ + */ +#define DMA_MEMORY_TO_MEMORY LL_DMA_DIRECTION_MEMORY_TO_MEMORY /**< Memory to memory direction */ +#define DMA_MEMORY_TO_PERIPH LL_DMA_DIRECTION_MEMORY_TO_PERIPH /**< Memory to peripheral direction */ +#define DMA_PERIPH_TO_MEMORY LL_DMA_DIRECTION_PERIPH_TO_MEMORY /**< Peripheral to memory direction */ +#define DMA_PERIPH_TO_PERIPH LL_DMA_DIRECTION_PERIPH_TO_PERIPH /**< Peripheral to Peripheral direction */ +/** @} */ + +/** @defgroup DMA_Source_incremented_mode DMA Source Incremented Mode + * @{ + */ +#define DMA_SRC_INCREMENT LL_DMA_SRC_INCREMENT /**< Source increment mode */ +#define DMA_SRC_DECREMENT LL_DMA_SRC_DECREMENT /**< Source decrement mode */ +#define DMA_SRC_NO_CHANGE LL_DMA_SRC_NO_CHANGE /**< Source no change mode */ +/** @} */ + +/** @defgroup DMA_Destination_incremented_mode DMA Destination Incremented Mode + * @{ + */ +#define DMA_DST_INCREMENT LL_DMA_DST_INCREMENT /**< Destination increment mode */ +#define DMA_DST_DECREMENT LL_DMA_DST_DECREMENT /**< Destination decrement mode */ +#define DMA_DST_NO_CHANGE LL_DMA_DST_NO_CHANGE /**< Destination no change mode */ +/** @} */ + +/** @defgroup DMA_Source_data_size DMA Source Data Size Alignment + * @{ + */ +#define DMA_SDATAALIGN_BYTE LL_DMA_SDATAALIGN_BYTE /**< Source data alignment : Byte */ +#define DMA_SDATAALIGN_HALFWORD LL_DMA_SDATAALIGN_HALFWORD /**< Source data alignment : HalfWord */ +#define DMA_SDATAALIGN_WORD LL_DMA_SDATAALIGN_WORD /**< Source data alignment : Word */ +/** @} */ + +/** @defgroup DMA_Destination_data_size DMA Destination Data Size Alignment + * @{ + */ +#define DMA_DDATAALIGN_BYTE LL_DMA_DDATAALIGN_BYTE /**< Destination data alignment : Byte */ +#define DMA_DDATAALIGN_HALFWORD LL_DMA_DDATAALIGN_HALFWORD /**< Destination data alignment : HalfWord */ +#define DMA_DDATAALIGN_WORD LL_DMA_DDATAALIGN_WORD /**< Destination data alignment : Word */ +/** @} */ + +/** @defgroup DMA_mode DMA Mode + * @{ + */ +#define DMA_NORMAL LL_DMA_MODE_SINGLE_BLOCK /**< Normal Mode */ +#define DMA_CIRCULAR LL_DMA_MODE_MULTI_BLOCK_ALL_RELOAD /**< Circular Mode */ + +/** @} */ + +/** @defgroup DMA_Priority_level DMA Priority Level + * @{ + */ +#define DMA_PRIORITY_LOW LL_DMA_PRIORITY_0 /**< Priority level : Low */ +#define DMA_PRIORITY_MEDIUM LL_DMA_PRIORITY_2 /**< Priority level : Medium */ +#define DMA_PRIORITY_HIGH LL_DMA_PRIORITY_5 /**< Priority level : High */ +#define DMA_PRIORITY_VERY_HIGH LL_DMA_PRIORITY_7 /**< Priority level : Very High */ +/** @} */ + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup DMA_Private_Macro DMA Private Macros + * @{ + */ + +/** @brief Check if DMA channel instance is valid. + * @param __instance__ DMA channel instance. + * @retval SET (__instance__ is valid) or RESET (__instance__ is invalid) + */ +#define IS_DMA_ALL_INSTANCE(__instance__) (((__instance__) == DMA_Channel0) || \ + ((__instance__) == DMA_Channel1) || \ + ((__instance__) == DMA_Channel2) || \ + ((__instance__) == DMA_Channel3) || \ + ((__instance__) == DMA_Channel4) || \ + ((__instance__) == DMA_Channel5) || \ + ((__instance__) == DMA_Channel6) || \ + ((__instance__) == DMA_Channel7)) + +/** @brief Check if DMA request is valid. + * @param __REQUEST__ DMA request. + * @retval SET (__REQUEST__ is valid) or RESET (__REQUEST__ is invalid) + */ +#define IS_DMA_ALL_REQUEST(__REQUEST__) (((__REQUEST__) == DMA_REQUEST_SPIM_TX) || \ + ((__REQUEST__) == DMA_REQUEST_SPIM_RX) || \ + ((__REQUEST__) == DMA_REQUEST_SPIS_TX) || \ + ((__REQUEST__) == DMA_REQUEST_SPIS_RX) || \ + ((__REQUEST__) == DMA_REQUEST_QSPI0_TX) || \ + ((__REQUEST__) == DMA_REQUEST_QSPI0_RX) || \ + ((__REQUEST__) == DMA_REQUEST_I2C0_TX) || \ + ((__REQUEST__) == DMA_REQUEST_I2C0_RX) || \ + ((__REQUEST__) == DMA_REQUEST_I2C1_TX) || \ + ((__REQUEST__) == DMA_REQUEST_I2C1_RX) || \ + ((__REQUEST__) == DMA_REQUEST_I2S_S_TX) || \ + ((__REQUEST__) == DMA_REQUEST_I2S_S_RX) || \ + ((__REQUEST__) == DMA_REQUEST_UART0_TX) || \ + ((__REQUEST__) == DMA_REQUEST_UART0_RX) || \ + ((__REQUEST__) == DMA_REQUEST_QSPI1_TX) || \ + ((__REQUEST__) == DMA_REQUEST_QSPI1_RX) || \ + ((__REQUEST__) == DMA_REQUEST_I2S_M_TX) || \ + ((__REQUEST__) == DMA_REQUEST_I2S_M_RX) || \ + ((__REQUEST__) == DMA_REQUEST_SNSADC) || \ + ((__REQUEST__) == DMA_REQUEST_MEM)) + +/** @brief Check if DMA direction is valid. + * @param __DIRECTION__ DMA direction. + * @retval SET (__DIRECTION__ is valid) or RESET (__DIRECTION__ is invalid) + */ +#define IS_DMA_DIRECTION(__DIRECTION__) (((__DIRECTION__) == DMA_MEMORY_TO_MEMORY) || \ + ((__DIRECTION__) == DMA_MEMORY_TO_PERIPH) || \ + ((__DIRECTION__) == DMA_PERIPH_TO_MEMORY) || \ + ((__DIRECTION__) == DMA_PERIPH_TO_PERIPH)) + +/** @brief Check if DMA buffer size is valid. + * @param __SIZE__ DMA buffer size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_DMA_BUFFER_SIZE(__SIZE__) (((__SIZE__) >= 0x1) && ((__SIZE__) < 0xFFF)) + +/** @brief Check if DMA source address increment state is valid. + * @param __STATE__ DMA source address increment state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) + */ +#define IS_DMA_SOURCE_INC_STATE(__STATE__) (((__STATE__) == DMA_SRC_INCREMENT) || \ + ((__STATE__) == DMA_SRC_DECREMENT) || \ + ((__STATE__) == DMA_SRC_NO_CHANGE)) + +/** @brief Check if DMA destination address increment state is valid. + * @param __STATE__ DMA destination address increment state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) + */ +#define IS_DMA_DESTINATION_INC_STATE(__STATE__) (((__STATE__) == DMA_DST_INCREMENT) || \ + ((__STATE__) == DMA_DST_DECREMENT) || \ + ((__STATE__) == DMA_DST_NO_CHANGE)) + +/** @brief Check if DMA source data size is valid. + * @param __SIZE__ DMA source data size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_DMA_SOURCE_DATA_SIZE(__SIZE__) (((__SIZE__) == DMA_SDATAALIGN_BYTE) || \ + ((__SIZE__) == DMA_SDATAALIGN_HALFWORD) || \ + ((__SIZE__) == DMA_SDATAALIGN_WORD)) + +/** @brief Check if DMA destination data size is valid. + * @param __SIZE__ DMA destination data size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_DMA_DESTINATION_DATA_SIZE(__SIZE__) (((__SIZE__) == DMA_DDATAALIGN_BYTE) || \ + ((__SIZE__) == DMA_DDATAALIGN_HALFWORD) || \ + ((__SIZE__) == DMA_DDATAALIGN_WORD )) + +/** @brief Check if DMA mode is valid. + * @param __MODE__ DMA mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_DMA_MODE(__MODE__) (((__MODE__) == DMA_NORMAL ) || \ + ((__MODE__) == DMA_CIRCULAR)) + +/** @brief Check if DMA priority is valid. + * @param __PRIORITY__ DMA priority. + * @retval SET (__PRIORITY__ is valid) or RESET (__PRIORITY__ is invalid) + */ +#define IS_DMA_PRIORITY(__PRIORITY__) (((__PRIORITY__) == DMA_PRIORITY_LOW ) || \ + ((__PRIORITY__) == DMA_PRIORITY_MEDIUM) || \ + ((__PRIORITY__) == DMA_PRIORITY_HIGH) || \ + ((__PRIORITY__) == DMA_PRIORITY_VERY_HIGH)) +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_DMA_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup DMA_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to initialize the DMA Channel source + and destination addresses, incrementation and data sizes, transfer direction, + circular/normal mode selection, memory-to-memory mode selection and Channel priority value. + [..] + The hal_dma_init() function follows the DMA configuration procedures as described in + reference manual. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the DMA according to the specified + * parameters in the dma_init_t and initialize the associated handle. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_init(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief De-initialize the DMA peripheral. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_deinit (dma_handle_t *p_dma); + +/** @} */ + + +/** @defgroup DMA_Exported_Functions_Group2 Input and Output operation functions + * @brief Input and Output operation functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] This section provides functions allowing to: + (+) Configure the source, destination address and data length and Start DMA transfer + (+) Configure the source, destination address and data length and + Start DMA transfer with interrupt + (+) Abort DMA transfer + (+) Poll for transfer complete + (+) Handle DMA interrupt request + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Start the DMA Transfer. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * @param[in] src_address: The source memory Buffer address + * @param[in] dst_address: The destination memory Buffer address + * @param[in] data_length: The length of data to be transferred from source to destination, ranging between 0 and 4095. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_start (dma_handle_t *p_dma, uint32_t src_address, uint32_t dst_address, uint32_t data_length); + +/** + **************************************************************************************** + * @brief Start the DMA Transfer with interrupt enabled. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * @param[in] src_address: The source memory Buffer address + * @param[in] dst_address: The destination memory Buffer address + * @param[in] data_length: The length of data to be transferred from source to destination, ranging between 0 and 4095. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_start_it(dma_handle_t *p_dma, uint32_t src_address, uint32_t dst_address, uint32_t data_length); + +/** + **************************************************************************************** + * @brief Abort the DMA Transfer. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_abort(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Aborts the DMA Transfer in Interrupt mode. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_abort_it(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Polling for transfer complete. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * @param[in] timeout: Timeout duration. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_poll_for_transfer(dma_handle_t *p_dma, uint32_t timeout); + +/** @} */ + +/** @addtogroup DMA_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle DMA interrupt request. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + **************************************************************************************** + */ +void hal_dma_irq_handler(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Register callbacks + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * @param[in] id: User Callback identifer. This parameter can be one of the following values: + * @arg @ref HAL_DMA_XFER_TFR_CB_ID + * @arg @ref HAL_DMA_XFER_BLK_CB_ID + * @arg @ref HAL_DMA_XFER_ERROR_CB_ID + * @arg @ref HAL_DMA_XFER_ABORT_CB_ID + * @param[in] callback: Pointer to private callbacsk function which has pointer to a dma_handle_t structure as parameter. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_register_callback(dma_handle_t *p_dma, hal_dma_callback_id_t id, void (* callback)( dma_handle_t * p_dma)); + +/** + **************************************************************************************** + * @brief UnRegister callbacks + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * @param[in] id: User Callback identifer. This parameter can be a combiantion of the following values: + * @arg @ref HAL_DMA_XFER_TFR_CB_ID + * @arg @ref HAL_DMA_XFER_BLK_CB_ID + * @arg @ref HAL_DMA_XFER_ERROR_CB_ID + * @arg @ref HAL_DMA_XFER_ABORT_CB_ID + * @arg @ref HAL_DMA_XFER_ALL_CB_ID + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_unregister_callback(dma_handle_t *p_dma, hal_dma_callback_id_t id); + +/** @} */ + +/** @defgroup DMA_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief Peripheral State and Errors functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides functions allowing to + (+) Check the DMA state + (+) Get error code + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the DMA hande state. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @retval ::HAL_DMA_STATE_RESET: DMA not yet initialized or disabled. + * @retval ::HAL_DMA_STATE_READY: DMA process succeeded and ready for use. + * @retval ::HAL_DMA_STATE_BUSY: DMA process is ongoing. + * @retval ::HAL_DMA_STATE_TIMEOUT: DMA timeout state. + * @retval ::HAL_DMA_STATE_ERROR: DMA error state. + **************************************************************************************** + */ +hal_dma_state_t hal_dma_get_state(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Return the DMA error code. + * + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration information for the specified DMA Channel. + * + * @return DMA Error Code + **************************************************************************************** + */ +uint32_t hal_dma_get_error(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Suspend some registers related to DMA configuration before sleep. + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration + * information for the specified DMA module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_suspend_reg(dma_handle_t *p_dma); + +/** + **************************************************************************************** + * @brief Restore some registers related to DMA configuration after sleep. + * This function must be used in conjunction with the hal_dma_resume_reg(). + * @param[in] p_dma: Pointer to a DMA handle which contains the configuration + * information for the specified DMA module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dma_resume_reg(dma_handle_t *p_dma); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_DMA_H__*/ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dual_tim.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dual_tim.h new file mode 100644 index 0000000..b794960 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_dual_tim.h @@ -0,0 +1,493 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_dual_tim.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of DUAL TIMER HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_DUAL_TIMER DUAL TIMER + * @brief DUAL TIM HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_DUAL_TIMER_H__ +#define __GR55xx_HAL_DUAL_TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_dual_tim.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_DUAL_TIMER_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_DUAL_TIMER_state HAL DUAL TIM state + * @{ + */ + +/** + * @brief HAL DUAL TIMER State Enumerations definition + */ +typedef enum +{ + HAL_DUAL_TIMER_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */ + HAL_DUAL_TIMER_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */ + HAL_DUAL_TIMER_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_DUAL_TIMER_STATE_ERROR = 0x04 /**< Reception process is ongoing */ +} hal_dual_timer_state_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_DUAL_TIMER_STRUCTURES Structures + * @{ + */ + +/** @defgroup DUAL_TIMER_Configuration DUAL TIMER Configuration + * @{ + */ + +/** + * @brief DUAL TIMER init Structure definition + */ +typedef struct _dual_timer_init +{ + uint32_t prescaler; /**< Specifies the prescaler value used to divide the DUAL_TIMER clock. + This parameter can be a value of @ref DUAL_TIMER_Prescaler_Div */ + + uint32_t counter_mode; /**< Specifies the counter mode. + This parameter can be a value of @ref DUAL_TIMER_Counter_Mode */ + + uint32_t auto_reload; /**< Specifies the auto-reload value. */ + +} dual_timer_init_t; + +/** @} */ + +/** @defgroup DUAL_TIMER_handle DUAL TIMER handle + * @{ + */ + +/** + * @brief DUAL_TIMER handle Structure definition + */ +typedef struct _dual_timer_handle +{ + dual_timer_regs_t *p_instance; /**< Register base address */ + + dual_timer_init_t init; /**< DUAL_TIMER Base required parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_dual_timer_state_t state; /**< DUAL_TIMER operation state */ + +} dual_timer_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_DUAL_TIMER_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_DUAL_TIMER_Callback Callback + * @{ + */ + +/** + * @brief HAL_DUAL_TIMER Callback function definition + */ + +typedef struct _hal_dual_timer_callback +{ + void (*dual_timer_msp_init)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER init MSP callback */ + void (*dual_timer_msp_deinit)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER de-init MSP callback */ + void (*dual_timer_period_elapsed_callback)(dual_timer_handle_t *p_dual_timer); /**< DUAL_TIMER period elapsed callback */ +} hal_dual_timer_callback_t; +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_DUAL_TIMER_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_Exported_Constants DUAL TIMER Exported Constants + * @{ + */ + +/** @defgroup DUAL_TIMER_Prescaler_Div DUAL TIMER Prescaler Division + * @{ + */ +#define DUAL_TIMER_PRESCALER_DIV0 LL_DUAL_TIMER_PRESCALER_DIV0 /**< 0 stage of prescale, clock is divided by 1. */ +#define DUAL_TIMER_PRESCALER_DIV16 LL_DUAL_TIMER_PRESCALER_DIV16 /**< 4 stages of prescale, clock is divided by 16. */ +#define DUAL_TIMER_PRESCALER_DIV256 LL_DUAL_TIMER_PRESCALER_DIV256 /**< 8 stages of prescale, clock is divided by 256. */ +/** @} */ + +/** @defgroup DUAL_TIMER_Counter_Mode DUAL TIMER Counter Mode + * @{ + */ +#define DUAL_TIMER_COUNTERMODE_LOOP 0x00000000U /**< DUAL TIMER Loop mode.*/ +#define DUAL_TIMER_COUNTERMODE_ONESHOT DUAL_TIMER_CTRL_ONESHOT /**< DUAL TIMER One-shot mode. */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_Exported_Macros DUAL TIMER Exported Macros + * @{ + */ + +/** @brief Reset DUAL TIMER handle states. + * @param __HANDLE__ DUAL TIMER handle. + * @retval None + */ +#define __HAL_DUAL_TIMER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_DUAL_TIMER_STATE_RESET) + +/** @brief Enable the specified DUAL TIMER peripheral. + * @param __HANDLE__ Specifies the DUAL TIMER Handle. + * @retval None + */ +#define __HAL_DUAL_TIMER_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN) + +/** @brief Disable the specified DUAL TIMER peripheral. + * @param __HANDLE__ Specifies the DUAL TIMER Handle. + * @retval None + */ +#define __HAL_DUAL_TIMER_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_EN) + +/** @brief Enable the DUAL TIMER interrupt. + * @param __HANDLE__ Specifies the DUAL TIM Handle. + * @retval None + */ +#define __HAL_DUAL_TIMER_ENABLE_IT(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN) + +/** @brief Disable the DUAL TIMER interrupt. + * @param __HANDLE__ Specifies the DUAL TIM Handle. + * @retval None + */ +#define __HAL_DUAL_TIMER_DISABLE_IT(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, DUAL_TIMER_CTRL_INTEN) + +/** @brief Check whether the DUAL TIMER interrupt has occurred or not. + * @param __HANDLE__ Specifies the DUAL TIMER Handle. + * @retval The new state of DUAL TIMER interrupt (SET or RESET). + */ +#define __HAL_DUAL_TIMER_GET_FLAG_IT(__HANDLE__) ll_dual_timer_is_active_flag_it(__HANDLE__->p_instance) + +/** @brief Clear the DUAL TIMER interrupt flag. + * @param __HANDLE__ Specifies the DUAL TIMER Handle. + * @retval None. + */ +#define __HAL_DUAL_TIMER_CLEAR_FLAG_IT(__HANDLE__) ll_dual_timer_clear_flag_it(__HANDLE__->p_instance) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_Private_Macros DUAL TIMER Private Macros + * @{ + */ + +/** @brief Check if DUAL TIMER prescaler is valid. + * @param __PRESCALER__ DUAL TIMER prescaler. + * @retval SET (__PRESCALER__ is valid) or RESET (__PRESCALER__ is invalid) + */ +#define IS_DUAL_TIMER_PRESCALER(__PRESCALER__) (((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV0) || \ + ((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV16) || \ + ((__PRESCALER__) == DUAL_TIMER_PRESCALER_DIV256)) + +/** @brief Check if DUAL TIMER counter mode is valid. + * @param __MODE__ DUAL TIMER counter mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_DUAL_TIMER_COUNTERMODE(__MODE__) (((__MODE__) == DUAL_TIMER_COUNTERMODE_LOOP) || \ + ((__MODE__) == DUAL_TIMER_COUNTERMODE_ONESHOT)) +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_DUAL_TIMER_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup DUAL_TIMER_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * + * @verbatim +=============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the DUAL TIMER. + (+) De-initialize the DUAL TIMER. + (+) Start the Timer. + (+) Stop the Timer. + (+) Start the Timer and enable interrupt. + (+) Stop the Timer and disable interrupt. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the DUAL TIMER according to the specified parameters + * in the dual_timer_init_t and initialize the associated handle. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_init(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief De-initialize the DUAL TIMER peripheral. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_deinit(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Initialize the DUAL TIMER MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_dual_timer_base_msp_init could be implemented in the user file + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + **************************************************************************************** + */ +void hal_dual_timer_base_msp_init(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief De-initialize the DUAL TIMER MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_dual_timer_base_msp_deinit could be implemented in the user file + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER. + **************************************************************************************** + */ +void hal_dual_timer_base_msp_deinit(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Starts the DUAL TIMER counter. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_start(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Stops the DUAL TIMER counter. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_stop(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Starts the DUAL TIMER counter in interrupt mode. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIM handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_start_it(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Stops the DUAL TIMER counter in interrupt mode. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_base_stop_it(dual_timer_handle_t *p_dual_timer); + +/** @} */ + +/** @addtogroup DUAL_TIMER_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle DUAL TIMER interrupt request. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + **************************************************************************************** + */ +void hal_dual_timer_irq_handler(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief Period elapsed callback in non-blocking mode. + * + * @note This function should not be modified. When the callback is needed, + * the hal_dual_timer_period_elapsed_callback can be implemented in the user file. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + **************************************************************************************** + */ +void hal_dual_timer_period_elapsed_callback(dual_timer_handle_t *p_dual_timer); + +/** @} */ + +/** @addtogroup DUAL_TIMER_Exported_Functions_Group2 Peripheral Control and State functions + * @brief DUAL TIMER Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral Control and State functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) Return the DUAL TIMER handle state. + (+) Configure the DUAL TIMER. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the DUAL TIMER handle state. + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * + * @retval ::HAL_DUAL_TIMER_STATE_RESET: Peripheral not yet initialized or disabled. + * @retval ::HAL_DUAL_TIMER_STATE_READY: Peripheral Initialized and ready for use. + * @retval ::HAL_DUAL_TIMER_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_DUAL_TIMER_STATE_ERROR: Reception process is ongoing. + **************************************************************************************** + */ +hal_dual_timer_state_t hal_dual_timer_get_state(dual_timer_handle_t *p_dual_timer); + +/** + **************************************************************************************** + * @brief DUAL TIMER configuration + * + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * @param[in] p_structure: The DUAL TIMER configuration structure + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_set_config(dual_timer_handle_t *p_dual_timer, dual_timer_init_t *p_structure); + +/** + **************************************************************************************** + * @brief DUAL TIMER set background reload value + * The background reload value contains the value from which the counter is to decrement. + * This is the value used to reload the counter when Periodic mode is enabled, and the current count reaches 0. + * The difference is that writes to background reload value do not cause the counter to immediately restart from the new value. + * @param[in] p_dual_timer: Pointer to a DUAL_TIMER handle which contains the configuration information for the specified DUAL TIMER. + * @param[in] reload_value: Background reload value + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + **************************************************************************************** + */ +hal_status_t hal_dual_timer_set_background_reload(dual_timer_handle_t *p_dual_timer, uint32_t reload_value); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_DUAL_TIMER_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_efuse.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_efuse.h new file mode 100644 index 0000000..2f3359d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_efuse.h @@ -0,0 +1,514 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_efuse.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of eFuse HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_EFUSE EFUSE + * @brief eFuse HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_EFUSE_H__ +#define __GR55xx_HAL_EFUSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_efuse.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_EFUSE_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_EFUSE_state HAL EFUSE state + * @{ + */ + +/** + * @brief HAL eFuse State Enumerations definition + */ +typedef enum +{ + HAL_EFUSE_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */ + HAL_EFUSE_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */ + HAL_EFUSE_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_EFUSE_STATE_ERROR = 0x04 /**< Reception process is error */ +} hal_efuse_state_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_EFUSE_STRUCTURES Structures + * @{ + */ + +/** @defgroup EFUSE_Configuration EFUSE Configuration + * @{ + */ + +/** + * @brief eFuse init Structure definition + */ +typedef struct _efuse_init +{ + uint32_t info_mode; /**< Specifies the info mode, enable or disable main or backup info. */ + +} efuse_init_t; + +/** @} */ + +/** @defgroup EFUSE_handle EFUSE handle + * @{ + */ + +/** + * @brief eFuse handle Structure definition + */ +typedef struct _efuse_handle +{ + efuse_regs_t *p_instance; /**< Register base address */ + + efuse_init_t init; /**< eFuse base required parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_efuse_state_t state; /**< eFuse operation state */ + + __IO uint32_t error_code; /**< eFuse Error code */ + +} efuse_handle_t; +/** @} */ + +/** @defgroup EFUSE_Keyram Keyram configuration + * @{ + */ + +/** + * @brief eFuse Keyram Structure definition + */ +typedef struct _keyram_mask +{ + uint32_t aes_mask; /**< AES port mask. */ + + uint32_t hmac_mask; /**< HMAC port mask. */ + + uint32_t present_mcu_mask; /**< Present of MCU port mask. */ + + uint32_t present_xip_mask; /**< Present of XIP port mask. */ + + uint32_t efuse_mask; /**< eFuse port mask. */ + + uint32_t enc_key_low; /**< encrypt key low 32bit mask. */ + + uint32_t enc_key_high; /**< encrypt key high 32bit mask. */ +} keyram_mask_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_EFUSE_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_EFUSE_Callback Callback + * @{ + */ + +/** + * @brief HAL_EFUSE Callback function definition + */ + +typedef struct _hal_efuse_callback +{ + void (*efuse_msp_init)(efuse_handle_t *p_efuse); /**< EFUSE init MSP callback */ + void (*efuse_msp_deinit)(efuse_handle_t *p_efuse); /**< EFUSE de-init MSP callback */ +} hal_efuse_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_EFUSE_MACRO Defines + * @{ + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EFUSE_Exported_Macros EFUSE Exported Macros + * @{ + */ + +/** @defgroup EFUSE_Error_Code EFUSE Error Code + * @{ + */ +#define HAL_EFUSE_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_EFUSE_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_EFUSE_ERROR_INVALID_PARAM ((uint32_t)0x00000002) /**< Invalid parameters error */ +/** @} */ + +/** @defgroup EFUSE_Flags EFUSE Flags + * @{ + */ +#define EFUSE_FLAG_WRITE_KEYRAM_BUSY LL_EFUSE_WRITE_KEYRAM_BUSY /**< Write keyram operation is in process */ +#define EFUSE_FLAG_READ_TRIM_DONE LL_EFUSE_READ_TRIM_DONE /**< Read trim from eFuse has done */ +#define EFUSE_FLAG_CRC_CHECK_DONE LL_EFUSE_CRC_CHECK_DONE /**< eFuse CRC check done */ +#define EFUSE_FLAG_CRC_CHECK_SUCCESS LL_EFUSE_CRC_CHECK_SUCCESS /**< CRC check succeeded */ +#define EFUSE_FLAG_INIT_CHECK_DONE LL_EFUSE_INIT_CHECK_DONE /**< eFuse initial value check done */ +#define EFUSE_FLAG_INIT_CHECK_SUCCESS LL_EFUSE_INIT_CHECK_SUCCESS /**< eFuse initial value check succeeded */ +#define EFUSE_FLAG_WRITE_DONE LL_EFUSE_WRITE_DONE /**< eFuse one word write done */ +#define EFUSE_FLAG_TEST_DONE LL_EFUSE_TEST_DONE /**< Read from eFuse has done in test mode */ +/** @} */ + +/** @defgroup EFUSE_Loyout_Map EFUSE Loyout Map + * @{ + */ +#define EFUSE_OFFSET_USER_DSVD (0x0000UL) /**< Reserved offset in backup info block */ +#define EFUSE_OFFSET_BBLK_TRIM (0x0020UL) /**< Triming offset in backup info block */ +#define EFUSE_OFFSET_BBLK_CONFIG (0x005CUL) /**< Configuration offset in backup info block */ +#define EFUSE_OFFSET_BBLK_SWD (0x0060UL) /**< SWD Enable offset in backup info block */ +#define EFUSE_OFFSET_BBLK_EncMode (0x0062UL) /**< Encryption Mode offset in backup info block */ +#define EFUSE_OFFSET_BBLK_CRC32 (0x0064UL) /**< CRC32 offset in backup info block */ +#define EFUSE_OFFSET_BBLK_CHIP_ID (0x0068UL) /**< Chip ID offset in backup info block */ +#define EFUSE_OFFSET_BBLK_PRODUCT_ID (0x006EUL) /**< Product ID offset in backup info block */ +#define EFUSE_OFFSET_BBLK_FW_PUBLICKEY (0x0070UL) /**< Firmware public key offset in backup info block */ +#define EFUSE_OFFSET_BBLK_ROOT_PUBLICKEY (0x0080UL) /**< Root public key offset in backup info block */ +#define EFUSE_OFFSET_BBLK_ECC_KEY (0x0090UL) /**< ECC key offset in backup info block */ +#define EFUSE_OFFSET_BBLK_FW_KEY (0x00B0UL) /**< Firmware key offset in backup info block */ +#define EFUSE_OFFSET_BBLK_HMAC_KEY (0x00D0UL) /**< HMAC key offset in backup info block */ +#define EFUSE_OFFSET_BBLK_DATA_KEY (0x00F0UL) /**< Data key offset in backup info block */ +#define EFUSE_OFFSET_MBLK_TRIM (0x0110UL) /**< Triming offset in main info block */ +#define EFUSE_OFFSET_MBLK_CONFIG (0x014CUL) /**< Configuration offset in main info block */ +#define EFUSE_OFFSET_MBLK_SWD (0x0150UL) /**< SWD Enable offset in main info block */ +#define EFUSE_OFFSET_MBLK_EncMode (0x0152UL) /**< Encryption Mode offset in main info block */ +#define EFUSE_OFFSET_MBLK_CRC32 (0x0154UL) /**< CRC32 offset in main info block */ +#define EFUSE_OFFSET_MBLK_CHIP_ID (0x0158UL) /**< Chip ID offset in main info block */ +#define EFUSE_OFFSET_MBLK_PRODUCT_ID (0x015EUL) /**< Product ID offset in main info block */ +#define EFUSE_OFFSET_MBLK_FW_PUBLICKEY (0x0160UL) /**< Firmware public key offset in main info block */ +#define EFUSE_OFFSET_MBLK_ROOT_PUBLICKEY (0x0170UL) /**< Root public key offset in main info block */ +#define EFUSE_OFFSET_MBLK_ECC_KEY (0x0180UL) /**< ECC key offset in main info block */ +#define EFUSE_OFFSET_MBLK_FW_KEY (0x01A0UL) /**< Firmware key offset in main info block */ +#define EFUSE_OFFSET_MBLK_HMAC_KEY (0x01C0UL) /**< HMAC key offset in main info block */ +#define EFUSE_OFFSET_MBLK_DATA_KEY (0x01E0UL) /**< Data key offset in main info block */ +#define EFUSE_OFFSET_END (0x0200UL) /**< eFuse Offset end */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EFUSE_Exported_Macros EFUSE Exported Macros + * @{ + */ + +/** @brief Enable the eFuse main or backup. + * @param __HANDLE__ Specifies the eFuse Handle. + * @retval None. + */ +#define __HAL_EFUSE_ENABLE_MAIN_BACKUP(__HANDLE__) ll_efuse_enable_main_backup((__HANDLE__)->p_instance) + +/** @brief Disable the eFuse main or backup. + * @param __HANDLE__ Specifies the eFuse Handle. + * @retval None. + */ +#define __HAL_EFUSE_DISABLE_MAIN_BACKUP(__HANDLE__) ll_efuse_disable_main_backup((__HANDLE__)->p_instance) + +/** @brief Enable the eFuse PGENB. + * @param __HANDLE__ Specifies the eFuse Handle. + * @retval None. + */ +#define __HAL_EFUSE_ENABLE_PGENB(__HANDLE__) ll_efuse_enable_pgenb((__HANDLE__)->p_instance) + +/** @brief Disable the eFuse PGENB. + * @param __HANDLE__ Specifies the eFuse Handle. + * @retval None. + */ +#define __HAL_EFUSE_DISABLE_PGENB(__HANDLE__) ll_efuse_disable_pgenb((__HANDLE__)->p_instance) + +/** @brief Check whether the specified eFuse flag is set or not. + * @param __HANDLE__ specifies the eFuse Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref EFUSE_FLAG_WRITE_KEYRAM_BUSY Write keyram operation is in process + * @arg @ref EFUSE_FLAG_READ_TRIM_DONE Read trim from eFuse has done + * @arg @ref EFUSE_FLAG_CRC_CHECK_DONE eFuse CRC check done + * @arg @ref EFUSE_FLAG_CRC_CHECK_SUCCESS CRC check succeeded + * @arg @ref EFUSE_FLAG_INIT_CHECK_DONE eFuse initial value check done + * @arg @ref EFUSE_FLAG_INIT_CHECK_SUCCESS eFuse initial value check succeeded + * @arg @ref EFUSE_FLAG_WRITE_DONE eFuse one word write done + * @arg @ref EFUSE_FLAG_TEST_DONE Read from eFuse has done in test mode + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_EFUSE_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET) +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_EFUSE_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup EFUSE_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the EFUSEx peripheral: + + (+) User must implement hal_efuse_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_efuse_init() to configure the selected device with + the selected configuration: + (++) info_mode + + (+) Call the function hal_efuse_deinit() to restore the default configuration + of the selected EFUSEx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the eFuse according to the specified parameters + * in the efuse_init_t and initialize the associated handle. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_init(efuse_handle_t *p_efuse); + +/** + **************************************************************************************** + * @brief De-initialize the eFuse peripheral. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_deinit(efuse_handle_t *p_efuse); + +/** + **************************************************************************************** + * @brief Initialize the eFuse MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_efuse_msp_deinit can be implemented in the user file. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + **************************************************************************************** + */ +void hal_efuse_msp_init(efuse_handle_t *p_efuse); + +/** + **************************************************************************************** + * @brief De-initialize the eFuse MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_efuse_msp_deinit can be implemented in the user file. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + **************************************************************************************** + */ +void hal_efuse_msp_deinit(efuse_handle_t *p_efuse); + +/** @} */ + +/** @defgroup EFUSE_Exported_Functions_Group2 IO operation functions + * @brief eFuse Data manage functions + * + * @{ + */ + +/** + **************************************************************************************** + * @brief Write the eFuse memory data. + * + * @note Address should be eFuse memory address. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80. + * @param[in] p_data: Pointer to data buffer for storage eFuse data. + * @param[in] nword: Size of data to be write, unit word. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_write(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword); + +/** + **************************************************************************************** + * @brief Read the eFuse memory data. + * + * @note Address should be eFuse memory address. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x000 ~ 0x80. + * @param[in] p_data: Pointer to data buffer for storage eFuse data. + * @param[in] nword: Size of data to be read, unit word. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_read(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword); + +/** + **************************************************************************************** + * @brief Read the key from eFuse memory and write to keyram. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * @param[in] p_mask: Pointer to a KEYRAM handle which contains the configuration information for the specified KEYRAM MASK. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_write_keyram(efuse_handle_t *p_efuse, keyram_mask_t *p_mask); + +/** + **************************************************************************************** + * @brief Check the eFuse memory with 0, if memory are all 0, return HAL_OK, then return HAL_ERROR. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_initial_value_check(efuse_handle_t *p_efuse); + +/** + **************************************************************************************** + * @brief Calculate CRC of the eFuse memory data. + * + * @note Address must be main info eFuse memory address. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80. + * @param[in] nword: Size of data to be read, unit word, this parament can be a value between: 1 ~ 60. + * @param[in] p_result: Pointer to result. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_crc_calculate(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t nword, uint32_t *p_result); + +/** + **************************************************************************************** + * @brief Read trim from eFuse memory data. + * + * @note Address must be main info eFuse memory address. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * @param[in] word_offset: eFuse memory offset, unit word, this parament can be a value between: 0x00 ~ 0x80. + * @param[in] p_data: Pointer to data buffer for storage eFuse data. + * @param[in] nword: Size of data to be read, unit word, this parament can be a value between: 1 ~ 20. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_read_trim(efuse_handle_t *p_efuse, uint32_t word_offset, uint32_t *p_data, uint32_t nword); + +/** + **************************************************************************************** + * @brief Set the main or backup info of the eFuse memory. + * + * @param[in] p_efuse: Pointer to a eFuse handle which contains the configuration information for the specified eFuse module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_efuse_set_main_backup(efuse_handle_t *p_efuse); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_EFUSE_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_exflash.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_exflash.h new file mode 100644 index 0000000..7ce0992 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_exflash.h @@ -0,0 +1,778 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_exflash.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of EXFLASH HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_EXFLASH EXFLASH + * @brief exFlash HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_EXFLASH_H__ +#define __GR55xx_HAL_EXFLASH_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_xqspi.h" +#include "gr55xx_hal_xqspi.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_EXFLASH_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_EXFLASH_STATE HAL EXFLASH State + * @{ + */ + +/** + * @brief HAL exFlash State Enumerations definition + */ +typedef enum +{ + HAL_EXFLASH_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_EXFLASH_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_EXFLASH_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_EXFLASH_STATE_BUSY_READ = 0x12, /**< Peripheral in indirect mode with reception ongoing */ + HAL_EXFLASH_STATE_BUSY_WRITE = 0x22, /**< Peripheral in indirect mode with transmission ongoing */ + HAL_EXFLASH_STATE_BUSY_ERASE = 0x42, /**< Peripheral in indirect mode with erase ongoing */ + HAL_EXFLASH_STATE_SUSPEND_WRITE = 0x21, /**< Peripheral in suspend mode from transmission */ + HAL_EXFLASH_STATE_SUSPEND_ERASE = 0x41, /**< Peripheral in suspend mode from erase */ + HAL_EXFLASH_STATE_ERROR = 0x04 /**< Peripheral in error */ +} hal_exflash_state_t; + +/** + * @brief HAL exFlash Security Enumerations definition + */ +typedef enum +{ + HAL_EXFLASH_UNENCRYPTED = 0x00, /**< Data will not be encrypted and decrypted in write-read operations */ + HAL_EXFLASH_ENCRYPTED = 0x01, /**< Data will be encrypted and decrypted in write-read operations */ +} hal_eflash_security; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_EXFLASH_STRUCTURES Structures + * @{ + */ + +/** @defgroup EXFLASH_HANDLE EXFLASH handle + * @{ + */ + +/** + * @brief exFlash handle Structure definition + */ +typedef struct _exflash_handle +{ + xqspi_handle_t *p_xqspi; /**< exFlash XQSPI Handle parameters */ + + __IO uint32_t fw_mode; /**< exFlash firmware mode */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_exflash_state_t state; /**< exFlash communication state */ + + __IO hal_eflash_security security; /**< exFlash data security */ + + __IO uint32_t flash_id; /**< exFlash ID */ + + __IO uint32_t flash_size; /**< exFlash Size */ + + __IO uint32_t count; /**< exFlash count for suspend and resume */ + + __IO uint32_t error_code; /**< exFlash Error code */ + + uint32_t retry; /**< Repeat times for the exFlash memory access */ + +} exflash_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_EXFLASH_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_EXFLASH_Callback Callback + * @{ + */ + +/** + * @brief HAL_EXFLASH Callback function definition + */ + +typedef struct _hal_exflash_callback +{ + void (*exflash_msp_init)(exflash_handle_t *p_exflash); /**< EXFLASH init MSP callback */ + void (*exflash_msp_deinit)(exflash_handle_t *p_exflash); /**< EXFLASH de-init MSP callback */ +} hal_exflash_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_EXFLASH_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EXFLASH_EXPORTED_CONSTANTS EXFLASH Exported Constants + * @{ + */ + +/** @defgroup EXFLASH_ERROR_CODE EXFLASH Error Code + * @{ + */ +#define HAL_EXFLASH_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_EXFLASH_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_EXFLASH_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_EXFLASH_ERROR_ID ((uint32_t)0x00000003) /**< Flash ID error */ +#define HAL_EXFLASH_ERROR_QUAD ((uint32_t)0x00000004) /**< Quad mode error */ +#define HAL_EXFLASH_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +/** @} */ + +/** @defgroup EXFLASH_ERASE_TYPE EXFLASH Erase Type + * @{ + */ +#define EXFLASH_ERASE_SECTOR 0 /**< Sector erase */ +#define EXFLASH_ERASE_CHIP 1 /**< Chip erase */ +/** @} */ + +/** @defgroup EXFLASH_SIZE_INFO EXFLASH Size Information + * @{ + */ +#define EXFLASH_SIZE_PAGE_BYTES ((uint32_t)256) /**< Page size in Bytes */ +#define EXFLASH_SIZE_SECTOR_BYTES ((uint32_t)4096) /**< Sector size in Bytes */ +#define EXFLASH_SIZE_CHIP_BYTES ((uint32_t)0x800000) /**< Chip size in Bytes */ +#define EXFLASH_START_ADDR FLASH_BASE /**< Flash start address */ +#define EXFLASH_SIZE (0x00800000UL) /**< Flash size */ +#define EXFLASH_END_ADDR (EXFLASH_START_ADDR + EXFLASH_SIZE) /**< Flash end address */ +#define EXFLASH_ALIAS_OFFSET (0x02000000UL) /**< Alias address offset */ +#define EXFLASH_ALIAS_ADDR (EXFLASH_START_ADDR + EXFLASH_ALIAS_OFFSET) /**< Alias start address */ +/** @} */ + +/** @defgroup EXFLASH_LOCK_AREA_TYPE EXFLASH Lock Area Type + * @{ + */ +#define EXFLASH_LOCK_AREA_NONE 0 /**< Offset NONE */ +#define EXFLASH_LOCK_AREA_UPPER_1_8 1 /**< Offset 0x070000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_1_4 2 /**< Offset 0x060000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_1_2 3 /**< Offset 0x040000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_LOWER_1_8 9 /**< Offset 0x000000 - 0x00FFFF */ +#define EXFLASH_LOCK_AREA_LOWER_1_4 10 /**< Offset 0x000000 - 0x01FFFF */ +#define EXFLASH_LOCK_AREA_LOWER_1_2 11 /**< Offset 0x000000 - 0x03FFFF */ +#define EXFLASH_LOCK_AREA_ALL 12 /**< Offset 0x000000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_TOP_4K 17 /**< Offset 0x07F000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_TOP_8K 18 /**< Offset 0x07E000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_TOP_16K 19 /**< Offset 0x07C000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_TOP_32K 20 /**< Offset 0x078000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_BOTTOM_4K 25 /**< Offset 0x000000 - 0x000FFF */ +#define EXFLASH_LOCK_AREA_BOTTOM_8K 26 /**< Offset 0x000000 - 0x001FFF */ +#define EXFLASH_LOCK_AREA_BOTTOM_16K 27 /**< Offset 0x000000 - 0x003FFF */ +#define EXFLASH_LOCK_AREA_BOTTOM_32K 28 /**< Offset 0x000000 - 0x007FFF */ +#define EXFLASH_LOCK_AREA_LOWER_7_8 33 /**< Offset 0x070000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_LOWER_3_4 34 /**< Offset 0x060000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_7_8 41 /**< Offset 0x000000 - 0x00FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_3_4 42 /**< Offset 0x000000 - 0x01FFFF */ +#define EXFLASH_LOCK_AREA_LOWER_127_128 49 /**< Offset 0x000000 - 0x07EFFF */ +#define EXFLASH_LOCK_AREA_LOWER_63_64 50 /**< Offset 0x000000 - 0x07DFFF */ +#define EXFLASH_LOCK_AREA_LOWER_31_32 51 /**< Offset 0x000000 - 0x07BFFF */ +#define EXFLASH_LOCK_AREA_LOWER_15_16 52 /**< Offset 0x000000 - 0x077FFF */ +#define EXFLASH_LOCK_AREA_UPPER_127_128 57 /**< Offset 0x001000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_63_64 58 /**< Offset 0x002000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_31_32 59 /**< Offset 0x004000 - 0x07FFFF */ +#define EXFLASH_LOCK_AREA_UPPER_15_16 60 /**< Offset 0x008000 - 0x07FFFF */ +/** @} */ + +/** @defgroup EXFLASH_RETRY_DEFINITION EXFLASH Repeat Times definition + * @{ + */ +#define HAL_EXFLASH_RETRY_DEFAULT_VALUE ((uint32_t)400000) /**< 400000 times */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EXFLASH_EXPORTED_MACROS EXFLASH Exported Macros + * @{ + */ + +/** @brief Reset exFlash handle states. + * @param __HANDLE__ exFlash handle. + * @retval None + */ +#define __HAL_EXFLASH_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_EXFLASH_STATE_RESET) + +/** @brief Enable the specified exFlash power. + * @retval None + */ +#define __HAL_EXFLASH_POWER_ON() ll_xqspi_enable_exflash_power() + +/** @brief Disable the specified exFlash power. + * @retval None + */ +#define __HAL_EXFLASH_POWER_OFF() ll_xqspi_disable_exflash_power() + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup EXFLASH_PRIVATE_MACRO EXFLASH Private Macros + * @{ + */ + +/** + * @brief Check if exFlash erase type is valid. + * @param __TYPE__ exFlash erase type. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_EXFLASH_ERASE_TYPE(__TYPE__) (((__TYPE__) == EXFLASH_ERASE_SECTOR) || \ + ((__TYPE__) == EXFLASH_ERASE_CHIP)) + +/** + * @brief Check if exFlash lock area type is valid. + * @param __AREA__ exFlash lock area type. + * @retval SET (__AREA__ is valid) or RESET (__AREA__ is invalid) + */ +#define IS_EXFLASH_LOCK_AREA(__AREA__) (((__AREA__) == EXFLASH_LOCK_AREA_NONE) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_1_8) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_1_4) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_1_2) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_1_8) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_1_4) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_1_2) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_ALL) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_TOP_4K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_TOP_8K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_TOP_16K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_TOP_32K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_BOTTOM_4K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_BOTTOM_8K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_BOTTOM_16K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_BOTTOM_32K) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_7_8) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_3_4) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_7_8) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_3_4) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_127_128) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_63_64) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_31_32) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_LOWER_15_16) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_127_128) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_63_64) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_31_32) || \ + ((__AREA__) == EXFLASH_LOCK_AREA_UPPER_15_16)) +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_EXFLASH_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup EXFLASH_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the exFlash peripheral: + + (+) User must implement hal_exflash_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_exflash_deinit() to restore the default configuration + of the selected exFlash peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the exFlash according to the specified parameters + * in the exflash_init_t and initialize the associated handle. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_init(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief De-initialize the exFlash peripheral. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_deinit(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Initialize the exFlash MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_exflash_msp_deinit can be implemented in the user file. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + **************************************************************************************** + */ +void hal_exflash_msp_init(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief De-initialize the exFlash MSP. + * + * @note This function should not be modified. When the callback is needed, + * the hal_exflash_msp_deinit can be implemented in the user file. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + **************************************************************************************** + */ +void hal_exflash_msp_deinit(exflash_handle_t *p_exflash); + +/** @} */ + +/** @defgroup EXFLASH_EXPORTED_FUNCTIONS_GROUP2 IO operation functions + * @brief Data transfers functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the exFlash + data transfers. + + [..] The exFlash supports XIP and QSPI mode: + + (#) There are only one modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + +@endverbatim + * @{ + */ +/** + **************************************************************************************** + * @brief During Flash erase/write operation, Disable external interrupts with a priority less than or equal to base_priority in the system. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] base_priority: Base Priority value to set. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_operation_protection(exflash_handle_t *p_exflash, uint32_t base_priority); + +/** + **************************************************************************************** + * @brief Write an amount of data with specified instruction and address to flash. + * + * @note This function is used only in Indirect Write Mode. In secure mode, address alignment requires 4 bytes. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] addr: Address to write data in flash, start at @ref EXFLASH_START_ADDR. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Size of buffer bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_write(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data with specified instruction and address from flash. + * + * @note This function is used only in non-encrypted Indirect Read Mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] addr: Address to read data in flash, start at @ref EXFLASH_START_ADDR. + * @param[out] p_data: Pointer to data buffer + * @param[in] size: Size of buffer bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_read(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); + +/** + **************************************************************************************** + * @brief [High speed]Read an amount of data with specified instruction and address from flash. + * + * @note This function is used only in non-encrypted Indirect Read Mode. + * Data content needs to be processed in 4-byte reverse order. + * And all parameters need to be aligned with 4 bytes. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] addr: Address to read data in flash, start at @ref EXFLASH_START_ADDR.(Aligned with 4 bytes) + * @param[out] p_data: Pointer to data buffer.(Pointer aligned with 4 bytes) + * @param[in] size: Size of buffer bytes.number of bytes to read.(A multiple of 4) + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_read_align_word(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); + +/** + **************************************************************************************** + * @brief Erase flash region. + * + * @note All sectors that have address in range of [addr, addr+len] will be erased. If addr is not sector aligned, + * preceding data on the sector that addr belongs to will also be erased. If (addr + size) is not sector + * aligned, the whole sector will also be erased. If erase_type is @ref EXFLASH_ERASE_CHIP , all data in flash + * will be erased ignored addr and size. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] erase_type: Erase flash with page/sector/chip. + * @arg @ref EXFLASH_ERASE_SECTOR + * @arg @ref EXFLASH_ERASE_CHIP + * @param[in] addr: Address to erased data in flash, start at @ref EXFLASH_START_ADDR. + * @param[in] size: Size of erased bytes. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_erase(exflash_handle_t *p_exflash, uint32_t erase_type, uint32_t addr, uint32_t size); + +/** + **************************************************************************************** + * @brief Suspend flash pragram/erase. + * + * @note The Suspend instruction interrupts a Page Program, Sector Erase, or Block Erase operation to allow access + * to the memory array. After the program or erase operation has entered the suspended state, the memory + * array can be read except for the page being programmed or the sector or block being erased. This function + * is only used in XIP mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_suspend(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Resume flash pragram/erase. + * + * @note The Resume instruction resumes a suspended Page Program, Sector Erase, or Block Erase operation. + * Before issuing the Resume instruction to restart a suspended erase operation, make sure that there is no + * Page Program operation in progress. This function is only used in XIP mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_resume(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Lock area of flash to be software protected against Write and Erase operation. + * + * @note Locked area only to be read. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] lock_type Area need to lock + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_lock(exflash_handle_t *p_exflash, uint32_t lock_type); + +/** + **************************************************************************************** + * @brief Unlock write/erase protected in flash. + * + * @note This function will unlock all chip. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_unlock(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief the exFlash will go to the Deep Power-Down Mode. + * + * @note This function is used only in Indirect Write Mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_deepsleep(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief exFlash will be released from Deep Power-Down Mode. + * + * @note This function is used only in Indirect Write Mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_wakeup(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Reset exFlash. exFlash will return to its default power-on state and lose all + * the current volatile settings. + * + * @note This function is used only in Indirect Write Mode. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_reset(exflash_handle_t *p_exflash); + +#if defined(ENCRYPT_ENABLE) + +/** + **************************************************************************************** + * @brief Specify the offset address and encrypted KEY address read by XIP. + * + * @param[in] p_exflash Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] read_offset The value must be 0x0 and EXFLASH_ALIAS_OFFSET. + * @param[in] key_addr The value must be FWCODEKEY_BASE_ADDR(0xA00170E0) and AESKEY_BASE_ADDR(0xA0017060). + **************************************************************************************** + */ +hal_status_t hal_exflash_encrypt_mode(exflash_handle_t *p_exflash, uint32_t read_offset, uint32_t key_addr); + +/** + **************************************************************************************** + * @brief Expand write an amount of data with specified instruction and address to flash. + * + * @note This function is used only in Indirect Write Mode. In secure mode, address alignment requires 4 bytes. + * Can specify write data to data area or code area. Need to call first hal_exflash_encrypt_mode + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] addr: Address to write data in flash, start at @ref EXFLASH_START_ADDR. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Size of buffer bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_write_expand(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); + +/** + **************************************************************************************** + * @brief Expand read an amount of data with specified instruction and address from flash. + * + * @note This function is used only in non-encrypted Indirect Read Mode. + * Can specify read data from data area or code area. Need to call first hal_exflash_encrypt_mode + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] addr: Address to read data in flash, start at @ref EXFLASH_START_ADDR. + * @param[out] p_data: Pointer to data buffer + * @param[in] size: Size of buffer bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_exflash_read_expand(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); + + + +#endif + +/** @} */ + +/** @defgroup EXFLASH_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief exFlash control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the exFlash. + (+) hal_exflash_get_state()API can be helpful to check in run-time the state of the exFlash peripheral. + (+) hal_exflash_get_error() check in run-time Errors occurring during communication. + (+) hal_exflash_set_timeout() set the timeout during internal process. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the exFlash handle state. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @retval ::HAL_EXFLASH_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_EXFLASH_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_EXFLASH_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_EXFLASH_STATE_BUSY_WRITE: Peripheral in indirect mode with transmission ongoing. + * @retval ::HAL_EXFLASH_STATE_BUSY_READ: Peripheral in indirect mode with reception ongoing. + * @retval ::HAL_EXFLASH_STATE_BUSY_ERASE: Peripheral in indirect mode with erase ongoing. + * @retval ::HAL_EXFLASH_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_exflash_state_t hal_exflash_get_state(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Return the exFlash error code. + * + * @param[in] p_exflash: Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * + * @return exFlash error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_exflash_get_error(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Set the exFlash internal process timeout value. + * + * @param[in] p_exflash Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] retry Internal process repeat times value. + **************************************************************************************** + */ +void hal_exflash_set_retry(exflash_handle_t *p_exflash, uint32_t retry); + + +/** + * @brief HAL exFlash operation function + */ +typedef hal_status_t (*exflash_operation_func)(exflash_handle_t *p_exflash); + +/** + **************************************************************************************** + * @brief Call user XIP Flash operation functon. + * + * @param[in] p_exflash Pointer to an exFlash handle which contains the configuration information for the specified exFlash module. + * @param[in] p_func_exflash_operation HAL exFlash operation function. + **************************************************************************************** + */ +hal_status_t hal_exflash_operation(exflash_handle_t *p_exflash, exflash_operation_func p_func_exflash_operation); +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_EXFLASH_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio.h new file mode 100644 index 0000000..a4d3f9a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio.h @@ -0,0 +1,477 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_gpio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of GPIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_GPIO GPIO + * @brief GPIO HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_GPIO_H__ +#define __GR55xx_HAL_GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_gpio.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_GPIO_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_GPIO_Callback Callback + * @{ + */ + +/** + * @brief HAL_GPIO Callback function definition + */ + +typedef struct _hal_gpio_callback +{ + void (*gpio_callback)(gpio_regs_t *GPIOx, uint16_t gpio_pin); /**< GPIO pin detection callback */ +} hal_gpio_callback_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_GPIO_ENUMERATIONS Enumerations + * @{ + */ + +/** + * @brief GPIO Bit SET and Bit RESET Enumerations + */ +typedef enum +{ + GPIO_PIN_RESET = 0U, /**< GPIO pin low level.*/ + GPIO_PIN_SET /**< GPIO pin high level.*/ +} gpio_pin_state_t; + +/** @} */ + + +/** @addtogroup HAL_GPIO_STRUCTURES Structures + * @{ + */ + +/** + * @brief GPIO init structure definition + */ +typedef struct _gpio_init +{ + uint32_t pin; /**< Specifies the GPIO pins to be configured. + This parameter can be any value of @ref GPIO_pins */ + + uint32_t mode; /**< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_mode */ + + uint32_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. + This parameter can be a value of @ref GPIO_pull */ + + uint32_t mux; /**< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref GPIOEx_Mux_Function_Selection. */ +} gpio_init_t; + +/** @} */ + +/** + * @defgroup HAL_GPIO_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_pins GPIO pins + * @{ + */ +#define GPIO_PIN_0 ((uint16_t)0x0001U) /**< Pin 0 selected */ +#define GPIO_PIN_1 ((uint16_t)0x0002U) /**< Pin 1 selected */ +#define GPIO_PIN_2 ((uint16_t)0x0004U) /**< Pin 2 selected */ +#define GPIO_PIN_3 ((uint16_t)0x0008U) /**< Pin 3 selected */ +#define GPIO_PIN_4 ((uint16_t)0x0010U) /**< Pin 4 selected */ +#define GPIO_PIN_5 ((uint16_t)0x0020U) /**< Pin 5 selected */ +#define GPIO_PIN_6 ((uint16_t)0x0040U) /**< Pin 6 selected */ +#define GPIO_PIN_7 ((uint16_t)0x0080U) /**< Pin 7 selected */ +#define GPIO_PIN_8 ((uint16_t)0x0100U) /**< Pin 8 selected */ +#define GPIO_PIN_9 ((uint16_t)0x0200U) /**< Pin 9 selected */ +#define GPIO_PIN_10 ((uint16_t)0x0400U) /**< Pin 10 selected */ +#define GPIO_PIN_11 ((uint16_t)0x0800U) /**< Pin 11 selected */ +#define GPIO_PIN_12 ((uint16_t)0x1000U) /**< Pin 12 selected */ +#define GPIO_PIN_13 ((uint16_t)0x2000U) /**< Pin 13 selected */ +#define GPIO_PIN_14 ((uint16_t)0x4000U) /**< Pin 14 selected */ +#define GPIO_PIN_15 ((uint16_t)0x8000U) /**< Pin 15 selected */ +#define GPIO_PIN_ALL ((uint16_t)0xFFFFU) /**< All pins selected */ + +#define GPIO_PIN_MASK (0x0000FFFFU) /**< PIN mask for assert test */ +/** @} */ + +/** @defgroup GPIO_mode GPIO mode + * @brief GPIO Configuration Mode + * Elements values convention: 0x000000YX + * - X : IO Direction mode (Input, Output, Mux) + * - Y : IT trigger detection + * @{ + */ +#define GPIO_MODE_INPUT (LL_GPIO_MODE_INPUT << 0) /**< Input Mode */ +#define GPIO_MODE_OUTPUT (LL_GPIO_MODE_OUTPUT << 0) /**< Output Mode */ +#define GPIO_MODE_MUX (LL_GPIO_MODE_MUX << 0) /**< Mux Mode */ +#define GPIO_MODE_IT_RISING (LL_GPIO_TRIGGER_RISING << 4) /**< Interrupt Mode with Rising edge trigger detection */ +#define GPIO_MODE_IT_FALLING (LL_GPIO_TRIGGER_FALLING << 4) /**< Interrupt Mode with Falling edge trigger detection */ +#define GPIO_MODE_IT_HIGH (LL_GPIO_TRIGGER_HIGH << 4) /**< Interrupt Mode with High-level trigger detection */ +#define GPIO_MODE_IT_LOW (LL_GPIO_TRIGGER_LOW << 4) /**< Interrupt Mode with Low-level trigger detection */ +/** @} */ + +/** @defgroup GPIO_pull GPIO pull + * @brief GPIO Pull-Up or Pull-Down Activation + * @{ + */ +#define GPIO_NOPULL LL_GPIO_PULL_NO /**< No Pull-up or Pull-down activation */ +#define GPIO_PULLUP LL_GPIO_PULL_UP /**< Pull-up activation */ +#define GPIO_PULLDOWN LL_GPIO_PULL_DOWN /**< Pull-down activation */ +/** @} */ + +/** + * @brief GPIO_default_config InitStruct default configuartion + */ +#define GPIO_DEFAULT_CONFIG \ +{ \ + .pin = GPIO_PIN_ALL, \ + .mode = GPIO_MODE_INPUT, \ + .pull = GPIO_PULLDOWN, \ + .mux = GPIO_PIN_MUX_GPIO, \ +} + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** + * @brief Check whether the specified GPIO pin is asserted or not. + * @param __GPIOX__ Where X can be (0, 1) to select the GPIO peripheral port + * @param __GPIO_PIN__ Specifies the GPIO pin to check. + * This parameter can be GPIO_PIN_x where x can be (0..15) + * @retval The new state of __GPIO_PIN__ (SET or RESET). + */ +#define __HAL_GPIO_IT_GET_IT(__GPIOX__, __GPIO_PIN__) ll_gpio_read_flag_it(__GPIOX__, __GPIO_PIN__) + +/** + * @brief Clear the GPIO pin pending bits. + * @param __GPIOX__ Where X can be (0, 1) to select the GPIO peripheral port + * @param __GPIO_PIN__ Specifies the GPIO pins to clear. + * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) + * @retval None + */ +#define __HAL_GPIO_IT_CLEAR_IT(__GPIOX__, __GPIO_PIN__) ll_gpio_clear_flag_it(__GPIOX__, __GPIO_PIN__) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup GPIO_Private_Macros GPIO Private Macros + * @{ + */ + +/** + * @brief Check if GPIO pin action is valid. + * @param __ACTION__ GPIO pin action. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_GPIO_PIN_ACTION(__ACTION__) (((__ACTION__) == GPIO_PIN_RESET) || ((__ACTION__) == GPIO_PIN_SET)) + +/** + * @brief Check if GPIO pins are valid. + * @param __PIN__ GPIO pins. + * @retval SET (__PIN__ is valid) or RESET (__PIN__ is invalid) + */ +#define IS_GPIO_PIN(__PIN__) ((((__PIN__) & GPIO_PIN_MASK) != 0x00U) &&\ + (((__PIN__) & ~GPIO_PIN_MASK) == 0x00U)) + +/** + * @brief Check if GPIO mode is valid. + * @param __MODE__ GPIO mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_GPIO_MODE(__MODE__) (((__MODE__) == GPIO_MODE_INPUT) ||\ + ((__MODE__) == GPIO_MODE_OUTPUT) ||\ + ((__MODE__) == GPIO_MODE_MUX) ||\ + ((__MODE__) == GPIO_MODE_IT_RISING) ||\ + ((__MODE__) == GPIO_MODE_IT_FALLING) ||\ + ((__MODE__) == GPIO_MODE_IT_HIGH) ||\ + ((__MODE__) == GPIO_MODE_IT_LOW)) + +/** + * @brief Check if GPIO pull type is valid. + * @param __PULL__ GPIO pull type. + * @retval SET (__PULL__ is valid) or RESET (__PULL__ is invalid) + */ +#define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\ + ((__PULL__) == GPIO_PULLUP) || \ + ((__PULL__) == GPIO_PULLDOWN)) + +/** @} */ + +/** @} */ + +/* Include GPIO HAL Extended module */ +#include "gr55xx_hal_gpio_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_GPIO_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions + * @brief Initialization and de-initialization functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the GPIOx peripheral according to the specified parameters in the p_gpio_init. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + * @param[in] p_gpio_init: Pointer to a gpio_init_t structure that contains the configuration information + * for the specified GPIO peripheral port. + **************************************************************************************** + */ +void hal_gpio_init(gpio_regs_t *GPIOx, gpio_init_t *p_gpio_init); + +/** + **************************************************************************************** + * @brief De-initialize the GPIOx peripheral registers to their default reset values. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port for GR55xx device + * @param[in] gpio_pin: Specifies the port bit to be written. + * This parameter can be a combiantion of the following values: + * @arg @ref GPIO_PIN_0 + * @arg @ref GPIO_PIN_1 + * @arg @ref GPIO_PIN_2 + * @arg @ref GPIO_PIN_3 + * @arg @ref GPIO_PIN_4 + * @arg @ref GPIO_PIN_5 + * @arg @ref GPIO_PIN_6 + * @arg @ref GPIO_PIN_7 + * @arg @ref GPIO_PIN_8 + * @arg @ref GPIO_PIN_9 + * @arg @ref GPIO_PIN_10 + * @arg @ref GPIO_PIN_11 + * @arg @ref GPIO_PIN_12 + * @arg @ref GPIO_PIN_13 + * @arg @ref GPIO_PIN_14 + * @arg @ref GPIO_PIN_15 + * @arg @ref GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_gpio_deinit(gpio_regs_t *GPIOx, uint32_t gpio_pin); + +/** @} */ + +/** @addtogroup GPIO_Exported_Functions_Group2 IO operation functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Read the specified input port pin. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + * @param[in] gpio_pin: Specifies the port bit to be read. + * This parameter can be a one of the following values: + * @arg @ref GPIO_PIN_0 + * @arg @ref GPIO_PIN_1 + * @arg @ref GPIO_PIN_2 + * @arg @ref GPIO_PIN_3 + * @arg @ref GPIO_PIN_4 + * @arg @ref GPIO_PIN_5 + * @arg @ref GPIO_PIN_6 + * @arg @ref GPIO_PIN_7 + * @arg @ref GPIO_PIN_8 + * @arg @ref GPIO_PIN_9 + * @arg @ref GPIO_PIN_10 + * @arg @ref GPIO_PIN_11 + * @arg @ref GPIO_PIN_12 + * @arg @ref GPIO_PIN_13 + * @arg @ref GPIO_PIN_14 + * @arg @ref GPIO_PIN_15 + * + * @retval ::GPIO_PIN_RESET: GPIO pin low level. + * @retval ::GPIO_PIN_SET: GPIO pin high level. + **************************************************************************************** + */ +gpio_pin_state_t hal_gpio_read_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin); + +/** + **************************************************************************************** + * @brief Set or clear the selected data port bit. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + * @param[in] gpio_pin: Specifies the port bit to be written. + * This parameter can be a combiantion of the following values: + * @arg @ref GPIO_PIN_0 + * @arg @ref GPIO_PIN_1 + * @arg @ref GPIO_PIN_2 + * @arg @ref GPIO_PIN_3 + * @arg @ref GPIO_PIN_4 + * @arg @ref GPIO_PIN_5 + * @arg @ref GPIO_PIN_6 + * @arg @ref GPIO_PIN_7 + * @arg @ref GPIO_PIN_8 + * @arg @ref GPIO_PIN_9 + * @arg @ref GPIO_PIN_10 + * @arg @ref GPIO_PIN_11 + * @arg @ref GPIO_PIN_12 + * @arg @ref GPIO_PIN_13 + * @arg @ref GPIO_PIN_14 + * @arg @ref GPIO_PIN_15 + * @arg @ref GPIO_PIN_ALL + * @param[in] pin_state: Specifies the value to be written to the selected bit. + * This parameter can be one of the GPIO_PinState enum values: + * @arg @ref GPIO_PIN_RESET clear the port pin + * @arg @ref GPIO_PIN_SET set the port pin + **************************************************************************************** + */ +void hal_gpio_write_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin, gpio_pin_state_t pin_state); + +/** + **************************************************************************************** + * @brief Toggle the specified GPIO pin. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + * @param[in] gpio_pin: Specifies the pin to be toggled. + * This parameter can be a combiantion of the following values: + * @arg @ref GPIO_PIN_0 + * @arg @ref GPIO_PIN_1 + * @arg @ref GPIO_PIN_2 + * @arg @ref GPIO_PIN_3 + * @arg @ref GPIO_PIN_4 + * @arg @ref GPIO_PIN_5 + * @arg @ref GPIO_PIN_6 + * @arg @ref GPIO_PIN_7 + * @arg @ref GPIO_PIN_8 + * @arg @ref GPIO_PIN_9 + * @arg @ref GPIO_PIN_10 + * @arg @ref GPIO_PIN_11 + * @arg @ref GPIO_PIN_12 + * @arg @ref GPIO_PIN_13 + * @arg @ref GPIO_PIN_14 + * @arg @ref GPIO_PIN_15 + * @arg @ref GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_gpio_toggle_pin(gpio_regs_t *GPIOx, uint16_t gpio_pin); + +/** @} */ + +/** @addtogroup GPIO_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle GPIO interrupt request. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + **************************************************************************************** + */ +void hal_gpio_exti_irq_handler(gpio_regs_t *GPIOx); + +/** + **************************************************************************************** + * @brief GPIO pin detection callback. + * + * @note This function should not be modified. When the callback is needed, + * the hal_gpio_exti_callback can be implemented in the user file. + * + * @param[in] GPIOx: Where x can be (0, 1) to select the GPIO peripheral port + * @param[in] gpio_pin: Indicate the port pin whose interrupt was triggered. + * This parameter can be a combiantion of the following values: + * @arg @ref GPIO_PIN_0 + * @arg @ref GPIO_PIN_1 + * @arg @ref GPIO_PIN_2 + * @arg @ref GPIO_PIN_3 + * @arg @ref GPIO_PIN_4 + * @arg @ref GPIO_PIN_5 + * @arg @ref GPIO_PIN_6 + * @arg @ref GPIO_PIN_7 + * @arg @ref GPIO_PIN_8 + * @arg @ref GPIO_PIN_9 + * @arg @ref GPIO_PIN_10 + * @arg @ref GPIO_PIN_11 + * @arg @ref GPIO_PIN_12 + * @arg @ref GPIO_PIN_13 + * @arg @ref GPIO_PIN_14 + * @arg @ref GPIO_PIN_15 + * @arg @ref GPIO_PIN_ALL + **************************************************************************************** + */ +void hal_gpio_exti_callback(gpio_regs_t *GPIOx, uint16_t gpio_pin); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_GPIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio_ex.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio_ex.h new file mode 100644 index 0000000..3a99c44 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_gpio_ex.h @@ -0,0 +1,497 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_gpio_ex.h + * @author BLE Driver Team + * @brief Header file containing extended macro of GPIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_GPIOEx GPIOEx + * @brief GPIOEx HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_GPIO_EX_H__ +#define __GR55xx_HAL_GPIO_EX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_gpio.h" + +/* Exported types ------------------------------------------------------------*/ + +/** + * @defgroup HAL_GPIOEX_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants + * @{ + */ + +/** @defgroup GPIOEx_Mux_Mode GPIOEx Mux Mode definition + * @{ + */ +#define GPIO_MUX_0 LL_GPIO_MUX_0 /**< GPIO Mux mode 0 */ +#define GPIO_MUX_1 LL_GPIO_MUX_1 /**< GPIO Mux mode 1 */ +#define GPIO_MUX_2 LL_GPIO_MUX_2 /**< GPIO Mux mode 2 */ +#define GPIO_MUX_3 LL_GPIO_MUX_3 /**< GPIO Mux mode 3 */ +#define GPIO_MUX_4 LL_GPIO_MUX_4 /**< GPIO Mux mode 4 */ +#define GPIO_MUX_5 LL_GPIO_MUX_5 /**< GPIO Mux mode 5 */ +#define GPIO_MUX_6 LL_GPIO_MUX_6 /**< GPIO Mux mode 6 */ +#define GPIO_MUX_7 LL_GPIO_MUX_7 /**< GPIO Mux mode 7 */ +#define GPIO_MUX_8 LL_GPIO_MUX_8 /**< GPIO Mux mode 8 */ +/** @} */ + +/** @defgroup GPIOEx_Mux_Function_Selection GPIOEx Mux function selection + * @{ + */ + +#if defined (GR551xx) +/*---------------------------------- GR551xx ------------------------------*/ + +/** @defgroup GPIOEx_Common_Selection GPIO PIN common MUX selection(Available for all GPIO pins) + * @{ + */ +#define GPIO_PIN_MUX_TESTBUS GPIO_MUX_8 /**< GPIO PIN x Mux Select TESTBUS */ + +#define GPIO_PIN_MUX_GPIO GPIO_MUX_7 /**< GPIO PIN x Mux Select GPIO */ + +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN0_Mux_Selection GPIO0_PIN0 MUX selection + * @{ + */ +#define GPIO0_PIN0_MUX_SWD_CLK GPIO_MUX_0 /**< GPIO0_PIN0 Mux Select SWD_CLK */ +#define GPIO0_PIN0_MUX_I2C0_SCL GPIO_MUX_1 /**< GPIO0_PIN0 Mux Select I2C0_SCL */ +#define GPIO0_PIN0_MUX_I2C1_SCL GPIO_MUX_2 /**< GPIO0_PIN0 Mux Select I2C1_SCL */ +#define GPIO0_PIN0_MUX_UART1_RTS GPIO_MUX_3 /**< GPIO0_PIN0 Mux Select UART1_RTS */ +#define GPIO0_PIN0_MUX_UART0_TX GPIO_MUX_4 /**< GPIO0_PIN0 Mux Select UART0_TX */ +#define GPIO0_PIN0_MUX_UART1_TX GPIO_MUX_5 /**< GPIO0_PIN0 Mux Select UART1_TX */ +#define GPIO0_PIN0_MUX_UART0_RTS GPIO_MUX_6 /**< GPIO0_PIN0 Mux Select UART0_RTS */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN1_Mux_Selection GPIO0_PIN1 MUX selection + * @{ + */ +#define GPIO0_PIN1_MUX_SWD_IO GPIO_MUX_0 /**< GPIO0_PIN1 Mux Select SWD_IO */ +#define GPIO0_PIN1_MUX_I2C0_SDA GPIO_MUX_1 /**< GPIO0_PIN1 Mux Select I2C0_SDA */ +#define GPIO0_PIN1_MUX_I2C1_SDA GPIO_MUX_2 /**< GPIO0_PIN1 Mux Select I2C1_SDA */ +#define GPIO0_PIN1_MUX_UART1_CTS GPIO_MUX_3 /**< GPIO0_PIN1 Mux Select UART1_CTS */ +#define GPIO0_PIN1_MUX_UART0_RX GPIO_MUX_4 /**< GPIO0_PIN1 Mux Select UART0_RX */ +#define GPIO0_PIN1_MUX_UART1_RX GPIO_MUX_5 /**< GPIO0_PIN1 Mux Select UART1_RX */ +#define GPIO0_PIN1_MUX_UART0_CTS GPIO_MUX_6 /**< GPIO0_PIN1 Mux Select UART0_CTS */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN2_Mux_Selection GPIO0_PIN2 MUX selection + * @{ + */ +#define GPIO0_PIN2_MUX_UART0_CTS GPIO_MUX_0 /**< GPIO0_PIN2 Mux Select UART0_CTS */ +#define GPIO0_PIN2_MUX_SIM_PRESENCE GPIO_MUX_1 /**< GPIO0_PIN2 Mux Select SIM_PRESENCE */ +#define GPIO0_PIN2_MUX_SWV GPIO_MUX_2 /**< GPIO0_PIN2 Mux Select SWV */ +#define GPIO0_PIN2_MUX_SPIS_CS_N GPIO_MUX_3 /**< GPIO0_PIN2 Mux Select SPIS_CS_N */ +#define GPIO0_PIN2_MUX_I2C0_SDA GPIO_MUX_4 /**< GPIO0_PIN2 Mux Select I2C0_SDA */ +#define GPIO0_PIN2_MUX_PWM0_A GPIO_MUX_5 /**< GPIO0_PIN2 Mux Select PWM0_A */ +#define GPIO0_PIN2_MUX_FERP_TRIG GPIO_MUX_6 /**< GPIO0_PIN2 Mux Select FERP_TRIG */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN3_Mux_Selection GPIO0_PIN3 MUX selection + * @{ + */ +#define GPIO0_PIN3_MUX_UART0_TX GPIO_MUX_0 /**< GPIO0_PIN3 Mux Select UART0_TX */ +#define GPIO0_PIN3_MUX_SIM_RST_N GPIO_MUX_1 /**< GPIO0_PIN3 Mux Select SIM_RST_N */ +#define GPIO0_PIN3_MUX_SPIM_CLK GPIO_MUX_2 /**< GPIO0_PIN3 Mux Select SPIM_CLK */ +#define GPIO0_PIN3_MUX_SPIS_CLK GPIO_MUX_3 /**< GPIO0_PIN3 Mux Select SPIS_CLK */ +#define GPIO0_PIN3_MUX_SPIM_CS1 GPIO_MUX_4 /**< GPIO0_PIN3 Mux Select SPIM_CS1 */ +#define GPIO0_PIN3_MUX_PWM0_B GPIO_MUX_5 /**< GPIO0_PIN3 Mux Select PWM0_B */ +#define GPIO0_PIN3_MUX_COEX_BLE_TX GPIO_MUX_6 /**< GPIO0_PIN3 Mux Select COEX_BLE_TX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN4_Mux_Selection GPIO0_PIN4 MUX selection + * @{ + */ +#define GPIO0_PIN4_MUX_UART0_RX GPIO_MUX_0 /**< GPIO0_PIN4 Mux Select UART0_RX */ +#define GPIO0_PIN4_MUX_SIM_IO GPIO_MUX_1 /**< GPIO0_PIN4 Mux Select SIM_IO */ +#define GPIO0_PIN4_MUX_SPIM_MOSI GPIO_MUX_2 /**< GPIO0_PIN4 Mux Select SPIM_MOSI */ +#define GPIO0_PIN4_MUX_SPIS_MISO GPIO_MUX_3 /**< GPIO0_PIN4 Mux Select SPIS_MISO */ +#define GPIO0_PIN4_MUX_SPIM_CS0 GPIO_MUX_4 /**< GPIO0_PIN4 Mux Select SPIM_CS0 */ +#define GPIO0_PIN4_MUX_PWM0_C GPIO_MUX_5 /**< GPIO0_PIN3 Mux Select PWM0_C */ +#define GPIO0_PIN4_MUX_COEX_BLE_RX GPIO_MUX_6 /**< GPIO0_PIN4 Mux Select COEX_BLE_RX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN5_Mux_Selection GPIO0_PIN5 MUX selection + * @{ + */ +#define GPIO0_PIN5_MUX_UART0_RTS GPIO_MUX_0 /**< GPIO0_PIN5 Mux Select UART0_RTS */ +#define GPIO0_PIN5_MUX_SIM_CLK GPIO_MUX_1 /**< GPIO0_PIN5 Mux Select SIM_CLK */ +#define GPIO0_PIN5_MUX_SPIM_MISO GPIO_MUX_2 /**< GPIO0_PIN5 Mux Select SPIM_MISO */ +#define GPIO0_PIN5_MUX_SPIS_MOSI GPIO_MUX_3 /**< GPIO0_PIN5 Mux Select SPIS_MOSI */ +//#define GPIO0_PIN5_MUX_SPIM_MISO GPIO_MUX_4 /**< GPIO0_PIN5 Mux Select SPIM_MISO */ +#define GPIO0_PIN5_MUX_I2C0_SCL GPIO_MUX_5 /**< GPIO0_PIN5 Mux Select I2C0_SCL */ +#define GPIO0_PIN5_MUX_COEX_WLAN_TX GPIO_MUX_6 /**< GPIO0_PIN5 Mux Select COEX_WLAN_TX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN6_Mux_Selection GPIO0_PIN6 MUX selection + * @{ + */ +#define GPIO0_PIN6_MUX_I2SM_WS GPIO_MUX_0 /**< GPIO0_PIN6 Mux Select I2S_WS */ +#define GPIO0_PIN6_MUX_I2SS_WS GPIO_MUX_1 /**< GPIO0_PIN6 Mux Select I2S_S_WS */ +#define GPIO0_PIN6_MUX_SPIM_CS0 GPIO_MUX_2 /**< GPIO0_PIN6 Mux Select SPIM_CS0 */ +#define GPIO0_PIN6_MUX_UART1_RX GPIO_MUX_3 /**< GPIO0_PIN6 Mux Select UART1_RX */ +#define GPIO0_PIN6_MUX_SPIM_MOSI GPIO_MUX_4 /**< GPIO0_PIN6 Mux Select SPIM_MOSI */ +#define GPIO0_PIN6_MUX_I2C0_SDA GPIO_MUX_5 /**< GPIO0_PIN6 Mux Select I2C0_SDA */ +#define GPIO0_PIN6_MUX_COEX_WLAN_RX GPIO_MUX_6 /**< GPIO0_PIN6 Mux Select COEX_WLAN_RX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN7_Mux_Selection GPIO0_PIN7 MUX selection + * @{ + */ +#define GPIO0_PIN7_MUX_I2SM_TX_SDO GPIO_MUX_0 /**< GPIO0_PIN7 Mux Select I2SM_TX_SDO */ +#define GPIO0_PIN7_MUX_I2SS_TX_SDO GPIO_MUX_1 /**< GPIO0_PIN7 Mux Select I2SS_TX_SDO */ +#define GPIO0_PIN7_MUX_SPIM_CS1 GPIO_MUX_2 /**< GPIO0_PIN7 Mux Select SPIM_CS1 */ +#define GPIO0_PIN7_MUX_UART1_TX GPIO_MUX_3 /**< GPIO0_PIN7 Mux Select UART1_TX */ +#define GPIO0_PIN7_MUX_SPIM_CLK GPIO_MUX_4 /**< GPIO0_PIN7 Mux Select SPIM_CLK */ +#define GPIO0_PIN7_MUX_PWM1_A GPIO_MUX_5 /**< GPIO0_PIN7 Mux Select PWM1_A */ +#define GPIO0_PIN7_MUX_COEX_BLE_PROC GPIO_MUX_6 /**< GPIO0_PIN7 Mux Select COEX_BLE_PROC */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN8_Mux_Selection GPIO0_PIN8 MUX selection + * @{ + */ +#define GPIO0_PIN8_MUX_XQSPIM_IO_0 GPIO_MUX_0 /**< GPIO0_PIN8 Mux Select XQSPIM_IO_0 */ +#define GPIO0_PIN8_MUX_I2C1_SDA GPIO_MUX_1 /**< GPIO0_PIN8 Mux Select I2C1_SDA */ +#define GPIO0_PIN8_MUX_QSPIM1_IO_0 GPIO_MUX_2 /**< GPIO0_PIN8 Mux Select QSPIM1_IO_0 */ +#define GPIO0_PIN8_MUX_UART1_RX GPIO_MUX_3 /**< GPIO0_PIN8 Mux Select UART1_RX */ +#define GPIO0_PIN8_MUX_PWM1_B GPIO_MUX_5 /**< GPIO0_PIN8 Mux Select PWM1_B */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN9_Mux_Selection GPIO0_PIN9 MUX selection + * @{ + */ +#define GPIO0_PIN9_MUX_XQSPIM_CLK GPIO_MUX_0 /**< GPIO0_PIN9 Mux Select XQSPIM_CLK */ +#define GPIO0_PIN9_MUX_I2C1_SCL GPIO_MUX_1 /**< GPIO0_PIN9 Mux Select I2C1_SCL */ +#define GPIO0_PIN9_MUX_QSPIM1_CLK GPIO_MUX_2 /**< GPIO0_PIN9 Mux Select QSPIM1_CLK */ +#define GPIO0_PIN9_MUX_UART1_TX GPIO_MUX_3 /**< GPIO0_PIN9 Mux Select UART1_TX */ +#define GPIO0_PIN9_MUX_PWM1_C GPIO_MUX_5 /**< GPIO0_PIN9 Mux Select PWM1_C */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN10_Mux_Selection GPIO0_PIN10 MUX selection + * @{ + */ +#define GPIO0_PIN10_MUX_I2SM_RX_SDI GPIO_MUX_0 /**< GPIO0_PIN10 Mux Select I2SM_RX_SDI */ +#define GPIO0_PIN10_MUX_I2SS_RX_SDI GPIO_MUX_1 /**< GPIO0_PIN10 Mux Select I2SS_RX_SDI */ +#define GPIO0_PIN10_MUX_UART0_TX GPIO_MUX_2 /**< GPIO0_PIN10 Mux Select UART0_TX */ +#define GPIO0_PIN10_MUX_I2C0_SCL GPIO_MUX_4 /**< GPIO0_PIN10 Mux Select I2C0_SCL */ +#define GPIO0_PIN10_MUX_PWM1_B GPIO_MUX_5 /**< GPIO0_PIN10 Mux Select PWM1_B */ +#define GPIO0_PIN10_MUX_COEX_BLE_TX GPIO_MUX_6 /**< GPIO0_PIN10 Mux Select COEX_BLE_TX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN11_Mux_Selection GPIO0_PIN11 MUX selection + * @{ + */ +#define GPIO0_PIN11_MUX_I2SM_SCLK GPIO_MUX_0 /**< GPIO0_PIN10 Mux Select I2SM_SCLK */ +#define GPIO0_PIN11_MUX_I2SS_SCLK GPIO_MUX_1 /**< GPIO0_PIN10 Mux Select I2SS_SCLK */ +#define GPIO0_PIN11_MUX_UART0_RX GPIO_MUX_2 /**< GPIO0_PIN10 Mux Select UART0_RX */ +#define GPIO0_PIN11_MUX_I2C0_SDA GPIO_MUX_4 /**< GPIO0_PIN10 Mux Select I2C0_SDA */ +#define GPIO0_PIN11_MUX_PWM1_C GPIO_MUX_5 /**< GPIO0_PIN10 Mux Select PWM1_C */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN12_Mux_Selection GPIO0_PIN12 MUX selection + * @{ + */ +#define GPIO0_PIN12_MUX_XQSPIM_IO_3 GPIO_MUX_0 /**< GPIO0_PIN12 Mux Select XQSPIM_IO_3 */ +#define GPIO0_PIN12_MUX_SPIM_CLK GPIO_MUX_1 /**< GPIO0_PIN12 Mux Select SPIM_CLK */ +#define GPIO0_PIN12_MUX_QSPIM1_IO3 GPIO_MUX_2 /**< GPIO0_PIN12 Mux Select QSPIM1_IO3 */ +#define GPIO0_PIN12_MUX_SIM_PRESENCE GPIO_MUX_3 /**< GPIO0_PIN12 Mux Select SIM_PRESENCE */ +#define GPIO0_PIN12_MUX_I2SM_WS GPIO_MUX_4 /**< GPIO0_PIN12 Mux Select I2SM_WS */ +#define GPIO0_PIN12_MUX_I2SS_WS GPIO_MUX_5 /**< GPIO0_PIN12 Mux Select I2SS_WS */ +#define GPIO0_PIN12_MUX_SPIS_CS GPIO_MUX_6 /**< GPIO0_PIN12 Mux Select I2SS_WS */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN13_Mux_Selection GPIO0_PIN13 MUX selection + * @{ + */ +#define GPIO0_PIN13_MUX_XQSPIM_IO_2 GPIO_MUX_0 /**< GPIO0_PIN13 Mux Select XQSPIM_IO_2 */ +#define GPIO0_PIN13_MUX_SPIM_MOSI GPIO_MUX_1 /**< GPIO0_PIN13 Mux Select SPIM_MOSI */ +#define GPIO0_PIN13_MUX_QSPIM1_IO_2 GPIO_MUX_2 /**< GPIO0_PIN13 Mux Select QSPIM1_IO_2 */ +#define GPIO0_PIN13_MUX_SIM_RST_N GPIO_MUX_3 /**< GPIO0_PIN13 Mux Select SIM_RST_N */ +#define GPIO0_PIN13_MUX_I2SM_TX_SDO GPIO_MUX_4 /**< GPIO0_PIN13 Mux Select I2SM_TX_SDO */ +#define GPIO0_PIN13_MUX_I2SS_TX_SDO GPIO_MUX_5 /**< GPIO0_PIN13 Mux Select I2SS_TX_SDO */ +#define GPIO0_PIN13_MUX_SPIS_CLK GPIO_MUX_6 /**< GPIO0_PIN13 Mux Select SPIS_CLK */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN14_Mux_Selection GPIO0_PIN14 MUX selection + * @{ + */ +#define GPIO0_PIN14_MUX_XQSPIM_IO_1 GPIO_MUX_0 /**< GPIO0_PIN14 Mux Select XQSPIM_IO_1 */ +#define GPIO0_PIN14_MUX_SPIM_MISO GPIO_MUX_1 /**< GPIO0_PIN14 Mux Select SPIM_MISO */ +#define GPIO0_PIN14_MUX_QSPIM1_IO1 GPIO_MUX_2 /**< GPIO0_PIN14 Mux Select QSPIM1_IO1 */ +#define GPIO0_PIN14_MUX_SIM_IO GPIO_MUX_3 /**< GPIO0_PIN14 Mux Select SIM_IO */ +#define GPIO0_PIN14_MUX_I2SM_RX_SDI GPIO_MUX_4 /**< GPIO0_PIN14 Mux Select I2SM_RX_SDI */ +#define GPIO0_PIN14_MUX_I2SS_RX_SDI GPIO_MUX_5 /**< GPIO0_PIN14 Mux Select I2SS_RX_SDI */ +#define GPIO0_PIN14_MUX_SPIS_MISO GPIO_MUX_6 /**< GPIO0_PIN14 Mux Select SPIS_MISO */ +/** @} */ + +/** @defgroup GPIOEx_GPIO0_PIN15_Mux_Selection GPIO0_PIN15 MUX selection + * @{ + */ +#define GPIO0_PIN15_MUX_XQSPIM_CS_N GPIO_MUX_0 /**< GPIO0_PIN15 Mux Select QSPIM_CS_N */ +#define GPIO0_PIN15_MUX_SPIM_CS0 GPIO_MUX_1 /**< GPIO0_PIN15 Mux Select SPIM_CS0 */ +#define GPIO0_PIN15_MUX_QSPIM1_CS_N GPIO_MUX_2 /**< GPIO0_PIN15 Mux Select QSPIM1_CS_N */ +#define GPIO0_PIN15_MUX_SIM_CLK GPIO_MUX_3 /**< GPIO0_PIN15 Mux Select SIM_CLK */ +#define GPIO0_PIN15_MUX_I2SM_SCLK GPIO_MUX_4 /**< GPIO0_PIN15 Mux Select I2SM_SCLK */ +#define GPIO0_PIN15_MUX_I2SS_SCLK GPIO_MUX_5 /**< GPIO0_PIN15 Mux Select I2SS_SCLK */ +#define GPIO0_PIN15_MUX_SPIS_MOSI GPIO_MUX_6 /**< GPIO0_PIN15 Mux Select SPIS_MOSI */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN0_Mux_Selection GPIO1_PIN0 MUX selection + * @{ + */ +#define GPIO1_PIN0_MUX_SPIM_MISO GPIO_MUX_0 /**< GPIO1_PIN0 Mux Select SPIM_MISO */ +#define GPIO1_PIN0_MUX_SPIS_MOSI GPIO_MUX_1 /**< GPIO1_PIN0 Mux Select SPIS_MOSI */ +#define GPIO1_PIN0_MUX_SIM_IO GPIO_MUX_2 /**< GPIO1_PIN0 Mux Select SIM_IO */ +#define GPIO1_PIN0_MUX_I2SM_RX_SDI GPIO_MUX_3 /**< GPIO1_PIN0 Mux Select I2SM_RX_SDI */ +#define GPIO1_PIN0_MUX_I2SS_RX_SDI GPIO_MUX_4 /**< GPIO1_PIN0 Mux Select I2SS_RX_SDI */ +#define GPIO1_PIN0_MUX_QSPIM0_IO_1 GPIO_MUX_5 /**< GPIO1_PIN0 Mux Select QSPIM0_IO_1 */ +#define GPIO1_PIN0_MUX_ISO_SYNC GPIO_MUX_6 /**< GPIO1_PIN0 Mux Select ISO_SYNC */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN1_Mux_Selection GPIO1_PIN1 MUX selection + * @{ + */ +#define GPIO1_PIN1_MUX_SPIM_CS0 GPIO_MUX_0 /**< GPIO1_PIN1 Mux Select SPIM_CS0 */ +#define GPIO1_PIN1_MUX_SPIS_CS GPIO_MUX_1 /**< GPIO1_PIN1 Mux Select SPIS_CS */ +#define GPIO1_PIN1_MUX_SIM_CLK GPIO_MUX_2 /**< GPIO1_PIN1 Mux Select SIM_CLK */ +#define GPIO1_PIN1_MUX_I2SM_SCLK GPIO_MUX_3 /**< GPIO1_PIN1 Mux Select I2SM_SCLK */ +#define GPIO1_PIN1_MUX_I2SS_SCLK GPIO_MUX_4 /**< GPIO1_PIN1 Mux Select I2SS_SCLK */ +#define GPIO1_PIN1_MUX_QSPIM0_IO_2 GPIO_MUX_5 /**< GPIO1_PIN1 Mux Select QSPIM0_IO_2 */ +#define GPIO1_PIN1_MUX_COEX_BLE_RX GPIO_MUX_6 /**< GPIO1_PIN1 Mux Select COEX_BLE_RX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN2_Mux_Selection GPIO1_PIN2 MUX selection + * @{ + */ +#define GPIO1_PIN2_MUX_QSPIM0_CS_N GPIO_MUX_0 /**< GPIO1_PIN2 Mux Select QSPIM0_CS_N */ +#define GPIO1_PIN2_MUX_XQSPIM_CS_N GPIO_MUX_1 /**< GPIO1_PIN2 Mux Select XQSPIM_CS_N */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN3_Mux_Selection GPIO1_PIN3 MUX selection + * @{ + */ +#define GPIO1_PIN3_MUX_QSPIM0_IO_3 GPIO_MUX_0 /**< GPIO1_PIN3 Mux Select QSPIM0_IO_3 */ +#define GPIO1_PIN3_MUX_XQSPIM_IO_3 GPIO_MUX_1 /**< GPIO1_PIN3 Mux Select XQSPIM_IO_3 */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN4_Mux_Selection GPIO1_PIN4 MUX selection + * @{ + */ +#define GPIO1_PIN4_MUX_QSPIM0_CLK GPIO_MUX_0 /**< GPIO1_PIN4 Mux Select QSPIM0_CLK */ +#define GPIO1_PIN4_MUX_XQSPIM_CLK GPIO_MUX_1 /**< GPIO1_PIN4 Mux Select XQSPIM_CLK */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN5_Mux_Selection GPIO1_PIN5 MUX selection + * @{ + */ +#define GPIO1_PIN5_MUX_QSPIM0_IO_2 GPIO_MUX_0 /**< GPIO1_PIN5 Mux Select QSPIM0_IO_2 */ +#define GPIO1_PIN5_MUX_XQSPIM_IO_2 GPIO_MUX_1 /**< GPIO1_PIN5 Mux Select XQSPIM_IO_2 */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN6_Mux_Selection GPIO1_PIN6 MUX selection + * @{ + */ +#define GPIO1_PIN6_MUX_QSPIM0_IO_1 GPIO_MUX_0 /**< GPIO1_PIN6 Mux Select QSPIM0_IO_1 */ +#define GPIO1_PIN6_MUX_XQSPIM_IO_1 GPIO_MUX_1 /**< GPIO1_PIN6 Mux Select XQSPIM_IO_1 */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN7_Mux_Selection GPIO1_PIN7 MUX selection + * @{ + */ +#define GPIO1_PIN7_MUX_QSPIM0_IO_0 GPIO_MUX_0 /**< GPIO1_PIN7 Mux Select QSPIM0_IO_0 */ +#define GPIO1_PIN7_MUX_XQSPIM_IO_0 GPIO_MUX_1 /**< GPIO1_PIN7 Mux Select XQSPIM_IO_0 */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN8_Mux_Selection GPIO1_PIN8 MUX selection + * @{ + */ +#define GPIO1_PIN8_MUX_SPIM_CLK GPIO_MUX_0 /**< GPIO1_PIN8 Mux Select SPIM_CLK */ +#define GPIO1_PIN8_MUX_SPIS_CLK GPIO_MUX_1 /**< GPIO1_PIN8 Mux Select SPIS_CLK */ +#define GPIO1_PIN8_MUX_SIM_PRESENCE GPIO_MUX_2 /**< GPIO1_PIN8 Mux Select SIM_PRESENCE */ +#define GPIO1_PIN8_MUX_I2SM_WS GPIO_MUX_3 /**< GPIO1_PIN8 Mux Select I2SM_WS */ +#define GPIO1_PIN8_MUX_I2SS_WS GPIO_MUX_4 /**< GPIO1_PIN8 Mux Select I2SS_WS */ +#define GPIO1_PIN8_MUX_QSPIM0_CLK GPIO_MUX_5 /**< GPIO1_PIN8 Mux Select QSPIM0_CLK */ +#define GPIO1_PIN8_MUX_COEX_WLAN_TX GPIO_MUX_6 /**< GPIO1_PIN8 Mux Select COEX_WLAN_TX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN9_Mux_Selection GPIO1_PIN9 MUX selection + * @{ + */ +#define GPIO1_PIN9_MUX_SPIM_MOSI GPIO_MUX_0 /**< GPIO1_PIN9 Mux Select SPIM_MOSI */ +#define GPIO1_PIN9_MUX_SPIS_MISO GPIO_MUX_1 /**< GPIO1_PIN9 Mux Select SPIS_MISO */ +#define GPIO1_PIN9_MUX_SIM_RST_N GPIO_MUX_2 /**< GPIO1_PIN9 Mux Select SIM_RST_N */ +#define GPIO1_PIN9_MUX_I2SM_TX_SD0 GPIO_MUX_3 /**< GPIO1_PIN9 Mux Select I2SM_TX_SD0 */ +#define GPIO1_PIN9_MUX_I2SS_TX_SD0 GPIO_MUX_4 /**< GPIO1_PIN9 Mux Select I2SS_TX_SD0 */ +#define GPIO1_PIN9_MUX_QSPIM0_IO_0 GPIO_MUX_5 /**< GPIO1_PIN9 Mux Select QSPIM0_IO_0 */ +#define GPIO1_PIN9_MUX_COEX_BLE_PROC GPIO_MUX_6 /**< GPIO1_PIN9 Mux Select COEX_BLE_PROC */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN10_Mux_Selection GPIO1_PIN10 MUX selection + * @{ + */ +#define GPIO1_PIN10_MUX_I2C1_SDA GPIO_MUX_0 /**< GPIO1_PIN10 Mux Select I2C1_SDA */ +#define GPIO1_PIN10_MUX_UART1_RX GPIO_MUX_1 /**< GPIO1_PIN10 Mux Select UART1_RX */ +#define GPIO1_PIN10_MUX_I2C0_SDA GPIO_MUX_2 /**< GPIO1_PIN10 Mux Select I2C0_SDA */ +#define GPIO1_PIN10_MUX_PWM0_C GPIO_MUX_3 /**< GPIO1_PIN10 Mux Select PWM0_C */ +#define GPIO1_PIN10_MUX_PWM1_C GPIO_MUX_4 /**< GPIO1_PIN10 Mux Select PWM5 */ +#define GPIO1_PIN10_MUX_UART0_RX GPIO_MUX_5 /**< GPIO1_PIN10 Mux Select UART0_RX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN11_Mux_Selection GPIO1_PIN11 MUX selection + * @{ + */ +#define GPIO1_PIN11_MUX_UART1_RTS GPIO_MUX_1 /**< GPIO1_PIN11 Mux Select UART1_RTS */ +#define GPIO1_PIN11_MUX_UART0_RTS GPIO_MUX_5 /**< GPIO1_PIN11 Mux Select UART0_RTS */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN12_Mux_Selection GPIO1_PIN12 MUX selection + * @{ + */ +#define GPIO1_PIN12_MUX_UART1_CTS GPIO_MUX_1 /**< GPIO1_PIN12 Mux Select UART1_CTS */ +#define GPIO1_PIN12_MUX_UART0_CTS GPIO_MUX_5 /**< GPIO1_PIN12 Mux Select UART0_CTS */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN13_Mux_Selection GPIO1_PIN13 MUX selection + * @{ + */ + +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN14_Mux_Selection GPIO1_PIN14 MUX selection + * @{ + */ +#define GPIO1_PIN14_MUX_I2C1_SCL GPIO_MUX_0 /**< GPIO1_PIN14 Mux Select I2C1_SCL */ +#define GPIO1_PIN14_MUX_UART1_TX GPIO_MUX_1 /**< GPIO1_PIN14 Mux Select UART1_TX */ +#define GPIO1_PIN14_MUX_I2C0_SCL GPIO_MUX_2 /**< GPIO1_PIN14 Mux Select I2C0_SCL */ +#define GPIO1_PIN14_MUX_PWM0_B GPIO_MUX_3 /**< GPIO1_PIN14 Mux Select PWM0_B */ +#define GPIO1_PIN14_MUX_PWM1_B GPIO_MUX_4 /**< GPIO1_PIN14 Mux Select PWM1_B */ +#define GPIO1_PIN14_MUX_UART0_TX GPIO_MUX_5 /**< GPIO1_PIN14 Mux Select UART0_TX */ +#define GPIO1_PIN14_MUX_COEX_BLE_TX GPIO_MUX_6 /**< GPIO1_PIN14 Mux Select COEX_BLE_TX */ +/** @} */ + +/** @defgroup GPIOEx_GPIO1_PIN15_Mux_Selection GPIO1_PIN15 MUX selection + * @{ + */ +#define GPIO1_PIN15_MUX_SPIM_CS1 GPIO_MUX_0 /**< GPIO1_PIN15 Mux Select SPIM_CS1 */ +#define GPIO1_PIN15_MUX_PWM0_A GPIO_MUX_3 /**< GPIO1_PIN15 Mux Select PWM0_A */ +#define GPIO1_PIN15_MUX_PWM1_A GPIO_MUX_4 /**< GPIO1_PIN15 Mux Select PWM1_A */ +#define GPIO1_PIN15_MUX_QSPIM0_IO_3 GPIO_MUX_5 /**< GPIO1_PIN15 Mux Select QSPIM0_IO_3 */ +#define GPIO1_PIN15_MUX_COEX_WLAN_TX GPIO_MUX_6 /**< GPIO1_PIN15 Mux Select COEX_WLAN_TX */ +/** @} */ + +/** + * @brief Check if GPIO Mux mode is valid. + * @param __MUX__ GPIO mux mode. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_GPIO_MUX(__MUX__) (((__MUX__) <= GPIO_MUX_8)) + +/*------------------------------------------------------------------------------------------*/ +#endif /* GR551xx */ + +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros + * @{ + */ + +/** @defgroup GPIOEx_Get_Port_Index GPIOEx_Get Port Index +* @{ + */ +#if defined(GR551xx) + +/** + * @brief Get GPIO Port Index. + * @param __GPIOx__ GPIO instance. + * @retval Port Index. + */ +#define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIO0))? 0U : 1U) + +#endif /* GR551xx */ +/** @} */ + +/** @defgroup GPIOEx_Get_Port_IRQNum GPIOEx_Get Port IRQ number +* @{ + */ +#if defined(GR551xx) + +/** + * @brief Get GPIO Port IRQ number. + * @param __GPIOx__ GPIO instance. + * @retval Port IRQ number. + */ +#define GPIO_GET_IRQNUM(__GPIOx__) (((__GPIOx__) == (GPIO0))? EXT0_IRQn : EXT1_IRQn) + +#endif /* GR551xx */ + +/** @} */ + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_GPIO_EX_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_hmac.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_hmac.h new file mode 100644 index 0000000..cdd36f9 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_hmac.h @@ -0,0 +1,615 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_hmac.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of HMAC HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_HMAC HMAC + * @brief HMAC HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_HMAC_H__ +#define __GR55xx_HAL_HMAC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_hmac.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_HMAC_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_HMAC_state HAL HMAC state + * @{ + */ + +/** + * @brief HAL HMAC State enumerations definition + * @note HAL HMAC State value is a combination of 2 different substates: gState and RxState. + */ +typedef enum +{ + HAL_HMAC_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_HMAC_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_HMAC_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_HMAC_STATE_ERROR = 0x03, /**< Peripheral in error */ + HAL_HMAC_STATE_TIMEOUT = 0x04, /**< Peripheral in timeout */ + HAL_HMAC_STATE_SUSPENDED = 0x05, /**< Peripheral in suspended */ + +} hal_hmac_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_HMAC_STRUCTURES Structures + * @{ + */ + +/** @defgroup HMAC_Configuration HMAC Configuration + * @{ + */ + +/** + * @brief HMAC init Structure definition + */ +typedef struct _hmac_init +{ + uint32_t mode; /**< Operating mode */ + + uint32_t *p_key; /**< Encryption/Decryption Key */ + + uint32_t *p_user_hash; /**< Initialization HASH value */ + + uint32_t key_fetch_type; /**< @ref HAL_HMAC_KEYTYPE_MCU Fetch key from ram; + { Start_private + @ref HAL_HMAC_KEYTYPE_AHB Fetch key from AHB; + } End_private + @ref HAL_HMAC_KEYTYPE_KRAM Fetch key from keyport */ + uint32_t dpa_mode; /**< DPA Mode */ + +} hmac_init_t; +/** @} */ + +/** @defgroup HMAC_handle HMAC handle + * @{ + */ + +/** + * @brief HMAC handle Structure definition + */ +typedef struct _hmac_handle +{ + hmac_regs_t *p_instance; /**< HMAC registers base address */ + + hmac_init_t init; /**< HMAC operation parameters */ + + uint32_t *p_message; /**< Pointer to message input buffer */ + + uint32_t *p_digest; /**< Pointer to digest output buffer */ + + uint32_t block_size; /**< Data size in blocks (64 bytes per block) */ + + uint32_t block_count; /**< Blocks count */ + + uint32_t is_last_trans; /**< Flag for last transfer */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_hmac_state_t state; /**< HMAC operation state */ + + __IO uint32_t error_code; /**< HMAC Error code */ + + uint32_t timeout; /**< Timeout for the HMAC operation */ + + uint32_t retention[17]; /**< HMAC important register information. */ + +} hmac_handle_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_HMAC_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_HMAC_Callback Callback + * @{ + */ + +/** + * @brief HAL_HMAC Callback function definition + */ + +typedef struct _hal_hmac_callback +{ + void (*hmac_msp_init)(hmac_handle_t *p_hmac); /**< HMAC init MSP callback */ + void (*hmac_msp_deinit)(hmac_handle_t *p_hmac); /**< HMAC de-init MSP callback */ + void (*hmac_done_callback)(hmac_handle_t *p_hmac); /**< HMAC digest done callback */ + void (*hmac_error_callback)(hmac_handle_t *p_hmac); /**< HMAC error callback */ +} hal_hmac_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_HMAC_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup HMAC_Exported_Constants HMAC Exported Constants + * @{ + */ + +/** @defgroup HMAC_Error_Code HMAC Error Code + * @{ + */ +#define HAL_HMAC_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_HMAC_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_HMAC_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_HMAC_ERROR_INVALID_PARAM ((uint32_t)0x00000004) /**< Invalid parameters error */ +/** @} */ + +/** @defgroup HMAC_Mode HMAC Mode + * @{ + */ +#define HMAC_MODE_SHA LL_HMAC_CALCULATETYPE_SHA /**< SHA mode */ +#define HMAC_MODE_HMAC LL_HMAC_CALCULATETYPE_HMAC /**< HMAC mode */ +/** @} */ + +/** @defgroup HMAC_Block_Size HAMC Block Size + * @{ + */ +#define HMAC_BLOCK_MAX (512) /**< Block max size */ +#define HMAC_BLOCKSIZE_BITS (512) /**< Block size in bits */ +#define HMAC_BLOCKSIZE_BYTES (HMAC_BLOCKSIZE_BITS >> 3) /**< Block size in bytes */ +#define HMAC_BLOCKSIZE_WORDS (HMAC_BLOCKSIZE_BYTES >> 2) /**< Block size in words */ +#define HMAC_DIGESTSIZE_BITS (256) /**< Digest size in bits */ +#define HMAC_DIGESTSIZE_BYTES (HMAC_DIGESTSIZE_BITS >> 3) /**< Digest size in bytes */ +#define HMAC_DIGESTSIZE_WORDS (HMAC_DIGESTSIZE_BYTES >> 2) /**< Digest size in words */ +#define HMAC_DMA_BLOCK_MAX (512) /**< DMA Block max size */ +/** @} */ + +/** @defgroup HMAC_Flags_definition HAMC Flags Definition + * @{ + */ +#define HMAC_FLAG_DATAREADY_SHA LL_HMAC_FLAG_DATAREADY_SHA /**< HMAC data ready (SHA mode) */ +#define HMAC_FLAG_DATAREADY_HMAC LL_HMAC_FLAG_DATAREADY_HMAC /**< HMAC data ready (HAMC mode) */ +#define HMAC_FLAG_DMA_MESSAGEDONE LL_HMAC_FLAG_DMA_MESSAGEDONE /**< HMAC DMA message done */ +#define HMAC_FLAG_DMA_DONE LL_HMAC_FLAG_DMA_DONE /**< HMAC DMA transfer done */ +#define HMAC_FLAG_DMA_ERR LL_HMAC_FLAG_DMA_ERR /**< HMAC DMA transfer error */ +#define HMAC_FLAG_KEY_VALID LL_HMAC_FLAG_KEY_VALID /**< HMAC has fetched key */ +/** @} */ + +/** @defgroup HMAC_HAL_KEY_TYPE Key Type + * @{ + */ +#define HAL_HMAC_KEYTYPE_MCU LL_HMAC_KEYTYPE_MCU /**< Key from MCU */ +/* { Start_private */ +#define HAL_HMAC_KEYTYPE_AHB LL_HMAC_KEYTYPE_AHB /**< Key from AHB master */ +/* } End_private */ +#define HAL_HMAC_KEYTYPE_KRAM LL_HMAC_KEYTYPE_KRAM /**< Key from Key Port */ +/** @} */ + +/** @defgroup HMAC_Interrupt_definition HMAC Interrupt_definition + * @{ + */ +#define HMAC_IT_DONE ((uint32_t)0x00000001) /**< Operation Done Interrupt source */ +/** @} */ + +/** @defgroup HMAC_Timeout_definition HMAC Timeout_definition + * @{ + */ +#define HAL_HMAC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup HMAC_Exported_Macros HMAC Exported Macros + * @{ + */ + +/** @brief Reset HMAC handle states. + * @param __HANDLE__ HMAC handle. + * @retval None + */ +#define __HAL_HMAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_HMAC_STATE_RESET) + +/** @brief Enable the specified HMAC peripheral. + * @param __HANDLE__ Specifies the HMAC Handle. + * @retval None + */ +#define __HAL_HMAC_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, HMAC_CTRL_ENABLE) + +/** @brief Disable the specified HMAC peripheral. + * @param __HANDLE__ Specifies the HMAC Handle. + * @retval None + */ +#define __HAL_HMAC_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, HMAC_CTRL_ENABLE) + +/** @brief Enable the HMAC interrupt. + * @param __HANDLE__ Specifies the HMAC Handle. + * @retval None + */ +#define __HAL_HMAC_ENABLE_IT(__HANDLE__) ll_hmac_enable_it_done((__HANDLE__)->p_instance) + +/** @brief Disable the HMAC interrupt. + * @param __HANDLE__ Specifies the HMAC Handle. + * @retval None + */ +#define __HAL_HMAC_DISABLE_IT(__HANDLE__) ll_hmac_disable_it_done((__HANDLE__)->p_instance) + +/** @brief Check whether the specified HMAC interrupt flag is set or not. + * @param __HANDLE__ Specifies the HMAC Handle. + * @param __FLAG__ Specifies the interrupt flag to check. + * This parameter can be one of the following values: + * @arg @ref HMAC_IT_DONE Encrypted or Decrypted Data Done Interrupt + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_HMAC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INTERRUPT, (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified HMAC interrupt flag. + * @param __HANDLE__ Specifies the HMAC interrupt Handle. + * @param __FLAG__ Specifies the flag to clear. + * This parameter can be one of the following values: + * @arg @ref HMAC_IT_DONE Encrypted or Decrypted Data Done Interrupt + * @retval None + */ +#define __HAL_HMAC_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INTERRUPT, (__FLAG__)) + +/** @brief Check whether the specified HMAC flag is set or not. + * @param __HANDLE__ Specifies the HMAC Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref HMAC_FLAG_DATAREADY_SHA Data ready (SHA mode) flag + * @arg @ref HMAC_FLAG_DATAREADY_HMAC Data ready (HMAC mode) flag + * @arg @ref HMAC_FLAG_DMA_DONE DMA transfer done flag + * @arg @ref HMAC_FLAG_DMA_ERR DMA transfer error flag + * @arg @ref HMAC_FLAG_KEY_VALID Key valid flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_HMAC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STATUS, (__FLAG__)) != 0) ? SET : RESET) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_HMAC_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup HMAC_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the HMACx peripheral: + + (+) User must implement hal_hmac_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_hmac_init() to configure the selected device with + the selected configuration: + (++) mode + (++) key + (++) user_hash + (++) dpa_mode + + (+) Call the function hal_hmac_deinit() to restore the default configuration + of the selected HMACx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the HMAC according to the specified parameters + * in the hmac_init_t and initialize the associated handle. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_init(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief De-initialize the HMAC peripheral. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_deinit(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief Initialize the HMAC MSP. + * @note This function should not be modified. When the callback is needed, + the hal_hmac_msp_deinit can be implemented in the user file. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + **************************************************************************************** + */ +void hal_hmac_msp_init(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief De-initialize the HMAC MSP. + * @note This function should not be modified. When the callback is needed, + the HAL_HMAC_MspDeInit can be implemented in the user file. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + **************************************************************************************** + */ +void hal_hmac_msp_deinit(hmac_handle_t *p_hmac); + +/** @} */ + +/** @addtogroup HMAC_Exported_Functions_Group2 IO operation functions + * @brief HMAC Encrypt/Decrypt functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + This subsection provides a set of functions allowing to manage the HMAC encrypt or decrypt. + + (#) There are two mode of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) Non-Blocking mode: The communication is performed using Interrupts + or DMA, These API's return the HAL status. + The end of the data processing will be indicated through the + dedicated HMAC IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_hmac_done_callback() user callbacks will be executed respectively + at the end of the encrypt or decrypt process + The hal_hmac_error_callback() user callback will be executed when a error is detected + + (#) Blocking mode API's are : + (++) hal_hmac_sha256_digest() + + (#) Non-Blocking mode API's with Interrupt are : + (++) hal_hmac_sha256_digest_it() + + (#) Non-Blocking mode API's with DMA are : + (++) hal_hmac_sha256_digest_dma() + + (#) A set of encrypt or decrypt Callbacks are provided in Non_Blocking mode: + (++) hal_hmac_done_callback() + (++) hal_hmac_error_callback() + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief xxx in blocking mode in SHA/HMAC mode. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @param[in] p_message: Pointer to message buffer + * @param[in] number: Amount of data + * @param[out] p_digest: Pointer to digest buffer + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_sha256_digest(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest, uint32_t timeout); + +/** + **************************************************************************************** + * @brief xxx in non-blocking mode with interrupt in SHA/HMAC mode. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @param[in] p_message: Pointer to message buffer + * @param[in] number: Amount of data + * @param[out] p_digest: Pointer to digest buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_sha256_digest_it(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest); + +/** + **************************************************************************************** + * @brief xxx in non-blocking mode with DMA in SHA/HMAC mode. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @param[in] p_message: Pointer to massage buffer + * @param[in] number: Amount of data + * @param[out] p_digest: Pointer to digest buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_sha256_digest_dma(hmac_handle_t *p_hmac, uint32_t *p_message, uint32_t number, uint32_t *p_digest); + +/** @} */ + +/** @addtogroup HMAC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle HMAC interrupt request. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + **************************************************************************************** + */ +void hal_hmac_irq_handler(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief Digest Done callback. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + **************************************************************************************** + */ +void hal_hmac_done_callback(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief HMAC error callback. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + **************************************************************************************** + */ +void hal_hmac_error_callback(hmac_handle_t *p_hmac); + +/** @} */ + +/** @defgroup HMAC_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief HMAC control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the HMAC. + (+) hal_hmac_get_state() API can be helpful to check in run-time the state of the HMAC peripheral. + (+) hal_hmac_get_error() check in run-time Errors occurring during communication. + (+) hal_hmac_set_timeout() set the timeout during internal process. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the HMAC handle state. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @retval ::HAL_HMAC_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_HMAC_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_HMAC_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_HMAC_STATE_ERROR: Peripheral in error. + * @retval ::HAL_HMAC_STATE_TIMEOUT: Peripheral in timeout. + * @retval ::HAL_HMAC_STATE_SUSPENDED: Peripheral in suspended. + **************************************************************************************** + */ +hal_hmac_state_t hal_hmac_get_state(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief Return the HMAC error code. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @return HMAC error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_hmac_get_error(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief Set the HMAC internal process timeout value. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration information for the specified HMAC module. + * @param[in] timeout: Internal process timeout value. + **************************************************************************************** + */ +void hal_hmac_set_timeout(hmac_handle_t *p_hmac, uint32_t timeout); + + +/** + **************************************************************************************** + * @brief Suspend some registers related to HMAC configuration before sleep. + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration + * information for the specified HMAC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_suspend_reg(hmac_handle_t *p_hmac); + +/** + **************************************************************************************** + * @brief Restore some registers related to HMAC configuration after sleep. + * This function must be used in conjunction with the hal_hmac_suspend_reg(). + * @param[in] p_hmac: Pointer to a HMAC handle which contains the configuration + * information for the specified HMAC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_hmac_resume_reg(hmac_handle_t *p_hmac); + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_HMAC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2c.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2c.h new file mode 100644 index 0000000..a921016 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2c.h @@ -0,0 +1,1245 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_i2c.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2C HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_I2C I2C + * @brief I2C HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_I2C_H__ +#define __GR55xx_HAL_I2C_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_i2c.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_I2C_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_I2C_state HAL I2C state + * @{ + */ + +/** + * @brief HAL I2C State Enumerations definition + * @note HAL I2C State value coding follow below described bitmap :\n + * @verbatim + b7-b6 Error information + 00 : No Error + 01 : Abort (Abort user request on going) + 10 : Timeout + 11 : Error + b5 IP initilisation status + 0 : Reset (IP not initialized) + 1 : init done (IP initialized and ready to use. HAL I2C init function called) + b4 (not used) + x : Should be set to 0 + b3 + 0 : Ready or Busy (No Listen mode ongoing) + 1 : Listen (IP in Address Listen Mode) + b2 Intrinsic process state + 0 : Ready + 1 : Busy (IP busy with some configuration or internal operations) + b1 Rx state + 0 : Ready (no Rx operation ongoing) + 1 : Busy (Rx operation ongoing) + b0 Tx state + 0 : Ready (no Tx operation ongoing) + 1 : Busy (Tx operation ongoing) + * @endverbatim + */ +typedef enum +{ + HAL_I2C_STATE_RESET = 0x00U, /**< Peripheral is not yet Initialized */ + HAL_I2C_STATE_READY = 0x20U, /**< Peripheral Initialized and ready for use */ + HAL_I2C_STATE_BUSY = 0x24U, /**< An internal process is ongoing */ + HAL_I2C_STATE_BUSY_TX = 0x21U, /**< Data Transmission process is ongoing */ + HAL_I2C_STATE_BUSY_RX = 0x22U, /**< Data Reception process is ongoing */ + HAL_I2C_STATE_LISTEN = 0x28U, /**< Address Listen Mode is ongoing */ + HAL_I2C_STATE_BUSY_TX_LISTEN = 0x29U, /**< Address Listen Mode and Data Transmission + process is ongoing */ + HAL_I2C_STATE_BUSY_RX_LISTEN = 0x2AU, /**< Address Listen Mode and Data Reception + process is ongoing */ + HAL_I2C_STATE_ABORT = 0x60U, /**< Abort user request ongoing */ + HAL_I2C_STATE_TIMEOUT = 0xA0U, /**< Timeout state */ + HAL_I2C_STATE_ERROR = 0xE0U /**< Error */ + +} hal_i2c_state_t; +/** @} */ + +/** @defgroup HAL_I2C_mode HAL I2C mode + * @{ + */ + +/** + * @brief HAL I2C Mode Enumerations definition + * @note HAL I2C Mode value coding follow below described bitmap :\n + * @verbatim + b7 (not used) + x : Should be set to 0 + b6 + 0 : None + 1 : Memory (HAL I2C communication is in Memory Mode) + b5 + 0 : None + 1 : Slave (HAL I2C communication is in Slave Mode) + b4 + 0 : None + 1 : Master (HAL I2C communication is in Master Mode) + b3-b2-b1-b0 (not used) + xxxx : Should be set to 0000 + * @endverbatim + */ +typedef enum +{ + HAL_I2C_MODE_NONE = 0x00U, /**< No I2C communication on going */ + HAL_I2C_MODE_MASTER = 0x10U, /**< I2C communication is in Master Mode */ + HAL_I2C_MODE_SLAVE = 0x20U, /**< I2C communication is in Slave Mode */ + HAL_I2C_MODE_MEM = 0x40U /**< I2C communication is in Memory Mode */ + +} hal_i2c_mode_t; +/** @} */ + +/** @} */ + + +/** @addtogroup HAL_I2C_STRUCTURES Structures + * @{ + */ + +/** @defgroup I2C_Configuration I2C Configuration + * @{ + */ + +/** + * @brief I2C Configuration Structure definition + */ +typedef struct _i2c_init +{ + uint32_t speed; /**< Specifies the I2C transfer speed. + This parameter can be a value of @ref I2C_Speed */ + + uint32_t own_address; /**< Specifies the device own address. + This parameter can be a 7-bit or 10-bit address. */ + + uint32_t addressing_mode; /**< Specifies if 7-bit or 10-bit addressing mode is selected. + This parameter can be a value of @ref I2C_Addressing_Mode */ + + uint32_t general_call_mode; /**< Specifies if general call mode is selected. + This parameter can be a value of @ref I2C_General_Call_Addressing_Mode */ + +} i2c_init_t; +/** @} */ + +/** @defgroup I2C_handle I2C handle + * @{ + */ + +/** + * @brief I2C handle Structure definition + */ +typedef struct _i2c_handle +{ + i2c_regs_t *p_instance; /**< I2C registers base address */ + + i2c_init_t init; /**< I2C communication parameters */ + + uint8_t *p_buffer; /**< Pointer to I2C transfer buffer */ + + uint16_t xfer_size; /**< I2C transfer size */ + + __IO uint16_t xfer_count; /**< I2C transfer counter */ + + __IO uint16_t master_ack_count; /**< I2C master acknowledge counter in master receive progress */ + + __IO uint32_t xfer_options; /**< I2C sequantial transfer options, this parameter can + be a value of @ref I2C_XferOptions */ + + __IO uint32_t previous_state; /**< I2C communication Previous state */ + + hal_status_t(*xfer_isr)(struct _i2c_handle *p_i2c, uint32_t it_source, uint32_t abort_sources); + /**< I2C transfer IRQ handler function pointer */ + + dma_handle_t *p_dmatx; /**< I2C Tx DMA handle parameters */ + + dma_handle_t *p_dmarx; /**< I2C Rx DMA handle parameters */ + + hal_lock_t lock; /**< I2C locking object */ + + __IO hal_i2c_state_t state; /**< I2C communication state */ + + __IO hal_i2c_mode_t mode; /**< I2C communication mode */ + + __IO uint32_t error_code; /**< I2C Error code */ + + uint32_t retention[19]; /**< I2C important register information. */ +} i2c_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_I2C_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_I2C_Callback Callback + * @{ + */ + +/** + * @brief HAL_I2C Callback function definition + */ + +typedef struct _hal_i2c_callback +{ + void (*i2c_msp_init)(i2c_handle_t *p_i2c); /**< I2C init MSP callback */ + void (*i2c_msp_deinit)(i2c_handle_t *p_i2c); /**< I2C de-init MSP callback */ + void (*i2c_master_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C master tx transfer completed callbac */ + void (*i2c_master_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C master rx transfer completed callback */ + void (*i2c_slave_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C slave tx transfer completed callback */ + void (*i2c_slave_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C slave rx transfer completed callback */ + void (*i2c_listen_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C listen Complete callback */ + void (*i2c_mem_tx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C mem tx transfer completed callback */ + void (*i2c_mem_rx_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C mem rx transfer completed callback */ + void (*i2c_error_callback)(i2c_handle_t *p_i2c); /**< I2C error callback */ + void (*i2c_abort_cplt_callback)(i2c_handle_t *p_i2c); /**< I2C abort completed callback */ +} hal_i2c_callback_t; + +/** @} */ + +/** @} */ + +/** @defgroup HAL_I2C_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup I2C_Exported_Constants I2C Exported Constants + * @{ + */ + +/** @defgroup I2C_Error_Code_definition I2C Error Code definition + * @{ + */ +#define HAL_I2C_ERROR_NONE (0x00000000U) /**< No error */ +#define HAL_I2C_ERROR_ARB_LOST (0x00000002U) /**< Arbitration lost error */ +#define HAL_I2C_ERROR_NOACK (0x00000004U) /**< No acknowledge error */ +#define HAL_I2C_ERROR_OVER (0x00000008U) /**< RX_OVER error */ +#define HAL_I2C_ERROR_DMA (0x00000010U) /**< DMA transfer error */ +#define HAL_I2C_ERROR_TIMEOUT (0x00000020U) /**< Timeout error */ +/** @} */ + +/** @defgroup I2C_Speed I2C Transfer Speed + * @{ + */ +#define I2C_SPEED_100K LL_I2C_SPEED_100K /**< Standard speed. */ +#define I2C_SPEED_400K LL_I2C_SPEED_400K /**< Fast speed. */ +#define I2C_SPEED_1000K LL_I2C_SPEED_1000K /**< Fast Plus speed. */ +#define I2C_SPEED_2000K LL_I2C_SPEED_2000K /**< High speed. */ +/** @} */ + +/** @defgroup I2C_Addressing_Mode I2C Addressing Mode + * @{ + */ +#define I2C_ADDRESSINGMODE_7BIT (0x00000001U) /**< 7-bit addressing mode. */ +#define I2C_ADDRESSINGMODE_10BIT (0x00000002U) /**< 10-bit addressing mode. */ +/** @} */ + +/** @defgroup I2C_General_Call_Addressing_Mode I2C General Call Addressing Mode + * @{ + */ +#define I2C_GENERALCALL_DISABLE (0x00000000U) /**< General call mode disable. */ +#define I2C_GENERALCALL_ENABLE (0x00000001U) /**< General call mode enable. */ +/** @} */ + +/** @defgroup I2C_Memory_Address_Size I2C Memory Address Size + * @{ + */ +#define I2C_MEMADD_SIZE_8BIT (0x00000001U) /**< 8-bit memory address. */ +#define I2C_MEMADD_SIZE_16BIT (0x00000002U) /**< 16-bit memory address. */ +/** @} */ + +/** @defgroup I2C_XferOptions I2C Sequential Transfer Options + * @{ + */ +#define I2C_FIRST_FRAME (0x00000000U) /**< First transfer frame. */ +#define I2C_FIRST_AND_NEXT_FRAME (0x00000001U) /**< First and next transfer frames. */ +#define I2C_NEXT_FRAME (0x00000002U) /**< Next transfer frame. */ +#define I2C_FIRST_AND_LAST_FRAME (0x00000003U) /**< First and last transfer frames. */ +#define I2C_LAST_FRAME (0x00000004U) /**< Last transfer frame. */ +/** @} */ + +/** @defgroup I2C_Timing_type I2C Timing type + * @{ + */ +#define I2C_TIMING_SS_SCL_LOW (0x00000000U) /**< Standard speed(0, 100K] SCL low time. */ +#define I2C_TIMING_SS_SCL_HIGH (0x00000001U) /**< Standard speed(0, 100K] SCL high time. */ +#define I2C_TIMING_FS_SCL_LOW (0x00000002U) /**< Fast and fast puls speed(100K, 1000K] SCL low time. */ +#define I2C_TIMING_FS_SCL_HIGH (0x00000003U) /**< Fast and fast puls speed(100K, 1000K] SCL high time. */ +#define I2C_TIMING_HS_SCL_LOW (0x00000004U) /**< High speed(1000K, 3400K] SCL low time. */ +#define I2C_TIMING_HS_SCL_HIGH (0x00000005U) /**< High speed(1000K, 3400K] SCL high time. */ +#define I2C_TIMING_FS_SPK (0x00000006U) /**< Fast and fast puls speed(100K, 1000K] spike suppression time. */ +#define I2C_TIMING_HS_SPK (0x00000007U) /**< High speed(1000K, 3400K] spike suppression time. */ +#define I2C_TIMING_SDA_TX_HOLD (0x00000008U) /**< SDA hold time when TX. (Hold time: Time of master and slave exchange SDA control) */ +#define I2C_TIMING_SDA_RX_HOLD (0x00000009U) /**< SDA hold time when RX. (Hold time: Time of master and slave exchange SDA control) */ +/** @} */ + +/** + * @brief I2C InitStruct default configuartion + */ +#define I2C_DEFAULT_CONFIG \ +{ \ + .speed = I2C_SPEED_400K, \ + .own_address = 0x55U, \ + .addressing_mode = I2C_ADDRESSINGMODE_7BIT, \ + .general_call_mode = I2C_GENERALCALL_DISABLE, \ +} + +/** @} */ + +/* Exported macros -----------------------------------------------------------*/ +/** @defgroup I2C_Exported_Macros I2C Exported Macros + * @{ + */ + +/** @brief Reset I2C handle state. + * @param __HANDLE__ Specifies the I2C Handle. + * @retval None + */ +#define __HAL_I2C_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_I2C_STATE_RESET) +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup I2C_Private_Macro I2C Private Macros + * @{ + */ + +/** + * @brief Check if the I2C speed is valid. + * @param __SPEED__ I2C transfer speed. + * @retval SET (__SPEED__ is valid) or RESET (__SPEED__ is invalid) + */ +#define IS_I2C_SPEED(__SPEED__) (((__SPEED__) == I2C_SPEED_100K) || \ + ((__SPEED__) == I2C_SPEED_400K) || \ + ((__SPEED__) == I2C_SPEED_1000K) || \ + ((__SPEED__) == I2C_SPEED_2000K)) + +/** + * @brief Check if the I2C addressing mode is valid. + * @param __MODE__ I2C addressing mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_I2C_ADDRESSING_MODE(__MODE__) (((__MODE__) == I2C_ADDRESSINGMODE_7BIT) || \ + ((__MODE__) == I2C_ADDRESSINGMODE_10BIT)) + +/** + * @brief Check if the I2C general call mode is valid. + * @param __CALL__ I2C general call mode. + * @retval SET (__CALL__ is valid) or RESET (__CALL__ is invalid) + */ +#define IS_I2C_GENERAL_CALL(__CALL__) (((__CALL__) == I2C_GENERALCALL_DISABLE) || \ + ((__CALL__) == I2C_GENERALCALL_ENABLE)) + +/** + * @brief Check if the I2C memory address size is valid. + * @param __SIZE__ I2C memory address size. + * @retval SET (__SIZE__ is valid) or RESET (__SIZE__ is invalid) + */ +#define IS_I2C_MEMADD_SIZE(__SIZE__) (((__SIZE__) == I2C_MEMADD_SIZE_8BIT) || \ + ((__SIZE__) == I2C_MEMADD_SIZE_16BIT)) + +/** + * @brief Check if the I2C transfer request command is valid. + * @param __REQUEST__ I2C transfer request command. + * @retval SET (__REQUEST__ is valid) or RESET (__REQUEST__ is invalid) + */ +#define IS_TRANSFER_REQUEST(__REQUEST__) (((__REQUEST__) == I2C_CMD_SLV_NONE) || \ + ((__REQUEST__) == I2C_CMD_MST_WRITE) || \ + ((__REQUEST__) == I2C_CMD_MST_READ) || \ + ((__REQUEST__) == I2C_CMD_MST_GEN_STOP) || \ + ((__REQUEST__) == I2C_CMD_MST_GEN_RESTART)) + +/** + * @brief Check if the I2C transfer options request is valid. + * @param __REQUEST__ I2C transfer options request. + * @retval SET (__REQUEST__ is valid) or RESET (__REQUEST__ is invalid) + */ +#define IS_I2C_TRANSFER_OPTIONS_REQUEST(__REQUEST__) (((__REQUEST__) == I2C_FIRST_FRAME) || \ + ((__REQUEST__) == I2C_FIRST_AND_NEXT_FRAME) || \ + ((__REQUEST__) == I2C_NEXT_FRAME) || \ + ((__REQUEST__) == I2C_FIRST_AND_LAST_FRAME) || \ + ((__REQUEST__) == I2C_LAST_FRAME)) + +/** + * @brief Check if the I2C slave address is valid. + * @param __ADDRESS__ I2C slave address. + * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid) + */ +#define IS_I2C_SLV_ADDRESS(__ADDRESS__) ((__ADDRESS__) < 0x03FFU) + +/** + * @brief Check if the I2C own address is valid. + * @param __ADDRESS__ I2C own address. + * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid) + */ +#define IS_I2C_OWN_ADDRESS(__ADDRESS__) ((((__ADDRESS__) > 0x0007U) && ((__ADDRESS__) < 0x0078U)) || \ + (((__ADDRESS__) > 0x007FU) && ((__ADDRESS__) < 0x03FFU))) + +/** + * @brief Get the Most Significant 8 Bits of memory address. + * @param __ADDRESS__ Memory address. + * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid) + */ +#define I2C_MEM_ADD_MSB(__ADDRESS__) ((uint8_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0xFF00U))) >> 8U))) + +/** + * @brief Get the Least Significant 8 Bits of memory address. + * @param __ADDRESS__ Memory address. + * @retval SET (__ADDRESS__ is valid) or RESET (__ADDRESS__ is invalid) + */ +#define I2C_MEM_ADD_LSB(__ADDRESS__) ((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FFU)))) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_I2C_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup I2C_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * @verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the I2Cx peripheral: + + (+) User must Implement hal_i2c_msp_init() function in which he configures + all related peripherals resources (CLOCK, GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_i2c_init() to configure the selected device with + the selected configuration: + (++) Speed + (++) Own Address + (++) Addressing mode (Master, Slave) + (++) General call mode + + (+) Call the function hal_i2c_deinit() to restore the default configuration + of the selected I2Cx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initializes the I2C according to the specified parameters + * in the i2c_init_t and initialize the associated handle. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration + * information for the specified I2C. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_init(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief De-initialize the I2C peripheral. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_deinit(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Initialize the I2C MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_msp_init could be implemented in the user file. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_msp_init(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief De-initialize the I2C MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_msp_deinit could be implemented in the user file. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_msp_deinit(i2c_handle_t *p_i2c); + +/** @} */ + +/** @addtogroup I2C_Exported_Functions_Group2 IO operation functions + * @brief Data transfers functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the I2C data + transfers. + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in the polling mode. + The status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts + or DMA. These functions return the status of the transfer startup. + The end of the data processing will be indicated through the + dedicated I2C IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + + (#) Blocking mode functions are : + (++) hal_i2c_master_transmit() + (++) hal_i2c_master_receive() + (++) hal_i2c_slave_transmit() + (++) hal_i2c_slave_receive() + (++) hal_i2c_mem_write() + (++) hal_i2c_mem_read() + (++) hal_i2c_is_device_ready() + + (#) No-Blocking mode functions with Interrupt are : + (++) hal_i2c_master_transmit_it() + (++) hal_i2c_master_receive_it() + (++) hal_i2c_slave_transmit_it() + (++) hal_i2c_slave_receive_it() + (++) hal_i2c_mem_write_it() + (++) hal_i2c_mem_read_it() + + (#) No-Blocking mode functions with DMA are : + (++) hal_i2c_master_transmit_dma() + (++) hal_i2c_master_recevice_dma() + (++) hal_i2c_slave_transmit_dma() + (++) hal_i2c_slave_receive_dma() + (++) hal_i2c_mem_write_dma() + (++) hal_i2c_mem_read_dma() + + (#) A set of Transfer Complete Callbacks are provided in non Blocking mode: + (++) hal_i2c_mem_tx_cplt_callback() + (++) hal_i2c_mem_rx_cplt_callback() + (++) hal_i2c_master_tx_cplt_callback() + (++) hal_i2c_master_rx_cplt_callback() + (++) hal_i2c_slave_tx_cplt_callback() + (++) hal_i2c_slave_rx_cplt_callback()() + (++) hal_i2c_error_callback() + +@endverbatim + * @{ + */ + +/******* Blocking mode: Polling */ + +/** + **************************************************************************************** + * @brief Transmits in master mode an amount of data in blocking mode. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_transmit(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receives in master mode an amount of data in blocking mode. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + * @note This function will return HAL_OK even if the length of data sent by slave is + * less than the expected Size. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_receive(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmits in slave mode an amount of data in blocking mode. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_transmit(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive in slave mode an amount of data in blocking mode + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_receive(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Write an amount of data in blocking mode to a specific memory address + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_write(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Read an amount of data in blocking mode from a specific memory address + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_read(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/******* Non-Blocking mode: Interrupt */ + +/** + **************************************************************************************** + * @brief Transmit in master mode an amount of data in non-blocking mode with Interrupt + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive in master mode an amount of data in non-blocking mode with Interrupt + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmit in slave mode an amount of data in non-blocking mode with Interrupt + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive in slave mode an amount of data in non-blocking mode with Interrupt + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Write an amount of data in non-blocking mode with Interrupt to a specific memory address + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_write_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Read an amount of data in non-blocking mode with Interrupt from a specific memory address + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_read_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Sequentially transmit in master I2C mode an amount of data in non-blocking mode with Interrupt. + * @note This interface allows to manage repeated start condition when a direction changes during transfer + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_sequential_transmit_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options); + +/** + **************************************************************************************** + * @brief Sequentially receive in master I2C mode an amount of data in non-blocking mode with Interrupt + * @note This interface allows to manage repeated start condition when a direction changes during transfer + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_sequential_receive_it(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size, uint32_t xfer_options); + +/** + **************************************************************************************** + * @brief Sequential transmit in slave/device I2C mode an amount of data in non-blocking mode with Interrupt + * @note This interface allow to manage repeated start condition when a direction change during transfer + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_sequential_transmit_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options); + +/** + **************************************************************************************** + * @brief Sequential receive in slave/device I2C mode an amount of data in non-blocking mode with Interrupt + * @note This interface allow to manage repeated start condition when a direction change during transfer + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent + * @param[in] xfer_options: Options of Transfer, value of @ref I2C_XferOptions + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_sequential_receive_it(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size, uint32_t xfer_options); + +/** + **************************************************************************************** + * @brief Enable the Master Read Request listen mode with Interrupt. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_enable_listen_it(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Disable the Master Read Request listen mode with Interrupt. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_disable_listen_it(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Abort a master I2C IT or DMA process communication with Interrupt. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_abort_it(i2c_handle_t *p_i2c); + +/******* Non-Blocking mode: DMA */ + +/** + **************************************************************************************** + * @brief Transmit in master mode an amount of data in non-blocking mode with DMA + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_transmit_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive in master mode an amount of data in non-blocking mode with DMA + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_receive_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Transmit in slave mode an amount of data in non-blocking mode with DMA + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_transmit_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive in slave mode an amount of data in non-blocking mode with DMA + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_receive_dma(i2c_handle_t *p_i2c, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Write an amount of data in non-blocking mode with DMA to a specific memory address + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_write_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Reads an amount of data in non-blocking mode with DMA from a specific memory address. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] mem_address: Internal memory address + * @param[in] mem_addr_size: Size of internal memory address + * @param[in] p_data: Pointer to data buffer + * @param[in] size: Amount of data to be sent, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_mem_read_dma(i2c_handle_t *p_i2c, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size); + +/** @} */ + +/** @addtogroup I2C_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief This function handles I2C event interrupt request. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_irq_handler(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Master Tx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_master_tx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_master_tx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Master Rx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_master_rx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_master_rx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Slave Tx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_slave_tx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_slave_tx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Slave Rx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_slave_rx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_slave_rx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Memory Tx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_mem_tx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_mem_tx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Memory Rx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_mem_rx_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_mem_rx_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Listen Complete callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_listen_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_listen_cplt_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief I2C error callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_error_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_error_callback(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief I2C abort callback. + * @note This function should not be modified. When the callback is needed, + * the hal_i2c_abort_cplt_callback can be implemented in the user file + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + **************************************************************************************** + */ +void hal_i2c_abort_cplt_callback(i2c_handle_t *p_i2c); + +/** @} */ + +/** @addtogroup I2C_Exported_Functions_Group3 Peripheral State, Mode and Error functions + * @brief Peripheral State, Mode and Error functions + * +@verbatim + =============================================================================== + ##### Peripheral State, Mode and Error functions ##### + =============================================================================== + [..] + This subsection permit to get in run-time the status of the peripheral + and the data flow. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the I2C handle state. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_I2C_STATE_RESET: Peripheral is not yet Initialized. + * @retval ::HAL_I2C_STATE_READY: Peripheral Initialized and ready for use. + * @retval ::HAL_I2C_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_I2C_STATE_BUSY_TX: Data Transmission process is ongoing. + * @retval ::HAL_I2C_STATE_BUSY_RX: Data Reception process is ongoing. + * @retval ::HAL_I2C_STATE_LISTEN: Address Listen Mode is ongoing. + * @retval ::HAL_I2C_STATE_BUSY_TX_LISTEN: Address Listen Mode and Data Transmission process is ongoing. + * @retval ::HAL_I2C_STATE_BUSY_RX_LISTEN: Address Listen Mode and Data Reception process is ongoing. + * @retval ::HAL_I2C_STATE_ABORT: Abort user request ongoing. + * @retval ::HAL_I2C_STATE_TIMEOUT: Timeout state. + * @retval ::HAL_I2C_STATE_ERROR: Error. + **************************************************************************************** + */ +hal_i2c_state_t hal_i2c_get_state(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Returns the I2C Master, Slave, Memory or no mode. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @retval ::HAL_I2C_MODE_NONE: No I2C communication on going. + * @retval ::HAL_I2C_MODE_MASTER: I2C communication is in Master Mode. + * @retval ::HAL_I2C_MODE_SLAVE: I2C communication is in Slave Mode. + * @retval ::HAL_I2C_MODE_MEM: I2C communication is in Memory Mode. + **************************************************************************************** + */ +hal_i2c_mode_t hal_i2c_get_mode(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Return the I2C error code. + * @param[in] p_i2c: Pointer to an I2C handle which contains the configuration information for the specified I2C. + * @return I2C Error Code + **************************************************************************************** + */ +uint32_t hal_i2c_get_error(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Suspend some registers related to I2C configuration before sleep. + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * information for the specified I2C module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_suspend_reg(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Restore some registers related to I2C configuration after sleep. + * This function must be used in conjunction with the hal_i2c_suspend_reg(). + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * information for the specified I2C module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2c_resume_reg(i2c_handle_t *p_i2c); + +/** + **************************************************************************************** + * @brief Adjust I2C timing value to adapt to real load. + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * information for the specified I2C module. + * @param[in] timing_type: Timing type. See I2C_Timing_tpye. + * @param[in] delta: timing change value(uinit: I2C work clock cycles). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + **************************************************************************************** + */ +hal_status_t hal_i2c_timing_adjust(i2c_handle_t *p_i2c, uint32_t timing_type, int32_t delta); + +/** + **************************************************************************************** + * @brief Get the I2C timing value. + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * information for the specified I2C module. + * @param[in] timing_type: Timing type. See I2C_Timing_tpye. + * @param[in] p_timing_value: Pointer of I2C timing value(uinit: I2C work clock cycles). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error. + **************************************************************************************** + */ +hal_status_t hal_i2c_timing_get(i2c_handle_t *p_i2c, uint32_t timing_type, uint32_t *p_timing_value); + +/** + **************************************************************************************** + * @brief I2C MASTER transmit and receive data with only one bit. For Microsoft HID Over I2C protocol. + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * @param[in] dev_address: Target device address: The device 7 bits address value in datasheet must be shifted at right before call interface + * @param[in] p_tdata: Pointer to transmit data buffer + * @param[in] tsize: Amount of data to be sent + * @param[in] p_rdata: Pointer to receive data buffer + * @param[in] rsize: Amount of data to be received + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error. + **************************************************************************************** + */ +hal_status_t hal_i2c_master_transmit_receive(i2c_handle_t *p_i2c, uint16_t dev_address, uint8_t *p_tdata, uint16_t tsize, uint8_t *p_rdata, uint16_t rsize, uint32_t timeout); + +/** + **************************************************************************************** + * @brief I2C SLAVE receive and transmit data with only one bit. Add for hal_i2c_master_transmit_receive. + * @param[in] p_i2c: Pointer to a I2C handle which contains the configuration + * @param[in] p_tdata: Pointer to transmit data buffer + * @param[in] tsize: Amount of data to be sent + * @param[in] p_rdata: Pointer to receive data buffer + * @param[in] rsize: Amount of data to be received + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error. + **************************************************************************************** + */ +hal_status_t hal_i2c_slave_receive_transmit(i2c_handle_t *p_i2c, uint8_t *p_tdata, uint16_t tsize, uint8_t *p_rdata, uint16_t rsize, uint32_t timeout); +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_I2C_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2s.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2s.h new file mode 100644 index 0000000..f05c30b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_i2s.h @@ -0,0 +1,975 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_i2s.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2S HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_I2S I2S + * @brief I2S HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_I2S_H__ +#define __GR55xx_HAL_I2S_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_i2s.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_I2S_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_I2S_state HAL I2S state + * @{ + */ + +/** + * @brief HAL I2S State Enumerations definition + */ +typedef enum +{ + HAL_I2S_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_I2S_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_I2S_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_I2S_STATE_BUSY_TX = 0x12, /**< Data Transmission process is ongoing */ + HAL_I2S_STATE_BUSY_RX = 0x22, /**< Data Reception process is ongoing */ + HAL_I2S_STATE_BUSY_TX_RX = 0x32, /**< Data Transmission and Reception process is ongoing */ + HAL_I2S_STATE_ABORT = 0x08, /**< Peripheral with abort request ongoing */ + HAL_I2S_STATE_ERROR = 0x04 /**< Peripheral in error */ + +} hal_i2s_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_I2S_STRUCTURES Structures + * @{ + */ + +/** @defgroup I2S_Configuration I2S Configuration + * @{ + */ + +/** + * @brief I2S init Structure definition + */ +typedef struct _i2s_init +{ + uint32_t data_size; /**< Specifies the data size for I2S communication. + This parameter can be a value of @ref I2S_Data_Size */ + + uint32_t clock_source; /**< Specifies the source of the I2S clock. + This parameter can be a value of @ref I2S_Clock_Source */ + + uint32_t audio_freq; /**< Specifies the frequency selected for the I2S communication. + @note The communication clock is derived from the master + clock. The slave clock does not need to be set. */ +#if I2S_CHANNEL_NUM > 1 + uint32_t channel_active; /**< Specifies the active channels for I2S communication. + This parameter can be one or more value of @ref I2S_Channel */ +#endif + +} i2s_init_t; +/** @} */ + +/** @defgroup I2S_handle I2S handle + * @{ + */ + +/** + * @brief I2S handle Structure definition + */ +typedef struct _i2s_handle +{ + i2s_regs_t *p_instance; /**< I2S registers base address */ + + i2s_init_t init; /**< I2S communication parameters */ + + uint16_t *p_tx_buffer; /**< Pointer to I2S TX transfer Buffer */ + + __IO uint32_t tx_xfer_size; /**< I2S TX Transfer size */ + + __IO uint32_t tx_xfer_count; /**< I2S TX Transfer Counter */ + + uint16_t *p_rx_buffer; /**< Pointer to I2S RX transfer Buffer */ + + __IO uint32_t rx_xfer_size; /**< I2S RX Transfer size */ + + __IO uint32_t rx_xfer_count; /**< I2S RX Transfer Counter */ + + void (*write_fifo)(struct _i2s_handle *p_i2s); /**< Pointer to I2S Tx transfer FIFO write function */ + + void (*read_fifo)(struct _i2s_handle *p_i2s); /**< Pointer to I2S Rx transfer FIFO read function */ + + dma_handle_t *p_dmatx; /**< I2S TX DMA Handle parameters */ + + dma_handle_t *p_dmarx; /**< I2S RX DMA Handle parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_i2s_state_t state; /**< I2S communication state */ + + __IO uint32_t error_code; /**< I2S Error code */ + + uint32_t timeout; /**< Timeout for the I2S memory access */ + + uint32_t retention[7]; /**< I2S important register information. */ +} i2s_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_I2S_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_I2S_Callback Callback + * @{ + */ + +/** + * @brief HAL_I2S Callback function definition + */ + +typedef struct _hal_i2s_callback +{ + void (*i2s_msp_init)(i2s_handle_t *p_i2s); /**< I2S init MSP callback */ + void (*i2s_msp_deinit)(i2s_handle_t *p_i2s); /**< I2S de-init MSP callback */ + void (*i2s_error_callback)(i2s_handle_t *p_i2s); /**< I2S error callback */ + void (*i2s_rx_cplt_callback)(i2s_handle_t *p_i2s); /**< I2S rx transfer completed callback */ + void (*i2s_tx_cplt_callback)(i2s_handle_t *p_i2s); /**< I2S tx transfer completed callbac */ + void (*i2s_tx_rx_cplt_callback)(i2s_handle_t *p_i2s); /**< I2S tx/rx transfer completed callback */ +} hal_i2s_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_I2S_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup I2S_Exported_Constants I2S Exported Constants + * @{ + */ + +/** @defgroup I2S_Direction I2S Direction + * @{ + */ +#define I2S_DIRECTION_FULL_DUPLEX LL_I2S_FULL_DUPLEX /**< Full Duplex: Transmit & Receive */ +#define I2S_DIRECTION_SIMPLEX_TX LL_I2S_SIMPLEX_TX /**< Simplex TX: Transmit only */ +#define I2S_DIRECTION_SIMPLEX_RX LL_I2S_SIMPLEX_RX /**< Simplex RX: Receive only */ +/** @} */ + +/** @defgroup I2S_Error_Code I2S Error Code + * @{ + */ +#define HAL_I2S_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_I2S_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_I2S_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_I2S_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */ +#define HAL_I2S_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +#define HAL_I2S_ERROR_TX_OVERFLOW ((uint32_t)0x00000010) /**< Transmit overflow error */ +#define HAL_I2S_ERROR_RX_OVERFLOW ((uint32_t)0x00000020) /**< Receive overflow error */ +/** @} */ + +/** @defgroup I2S_Data_Size I2S Data Size + * @{ + */ +#define I2S_DATASIZE_12BIT LL_I2S_DATASIZE_12BIT /**< 12-bit serial data transfer */ +#define I2S_DATASIZE_16BIT LL_I2S_DATASIZE_16BIT /**< 16-bit serial data transfer */ +#define I2S_DATASIZE_20BIT LL_I2S_DATASIZE_20BIT /**< 20-bit serial data transfer */ +#define I2S_DATASIZE_24BIT LL_I2S_DATASIZE_24BIT /**< 24-bit serial data transfer */ +#define I2S_DATASIZE_32BIT LL_I2S_DATASIZE_32BIT /**< 32-bit serial data transfer */ +/** @} */ + +/** @defgroup I2S_Clock_Source I2S Clock Source + * @{ + */ +#define I2S_CLOCK_SRC_96M LL_I2S_CLOCK_SRC_96M /**< Inactive state of SCLK is low */ +#define I2S_CLOCK_SRC_32M LL_I2S_CLOCK_SRC_32M /**< Inactive state of SCLK is high */ +/** @} */ + +/** @defgroup I2S_FIFO_LEVEL_MAX I2S FIFO Level Max + * @{ + */ +#define I2S_TX_FIFO_LEVEL_MAX 16 /**< I2S TX FIFO Level Max Value */ +#define I2S_RX_FIFO_LEVEL_MAX 16 /**< I2S RX FIFO Level Max Value */ +/** @} */ + +/** @defgroup I2S_Flags_definition I2S Flags Definition + * @{ + */ +#define I2S_FLAG_TXFO LL_I2S_STATUS_TXFO /**< TX FIFO write overflow flag */ +#define I2S_FLAG_TXFE LL_I2S_STATUS_TXFE /**< TX FIFO empty trigger flag */ +#define I2S_FLAG_RXFO LL_I2S_STATUS_RXFO /**< RX FIFO receive overflow flag */ +#define I2S_FLAG_RXDA LL_I2S_STATUS_RXDA /**< RX FIFO data available flag */ +/** @} */ + +/** @defgroup I2S_Interrupt_definition I2S Interrupt Definition + * @{ + */ +#define I2S_IT_TXFO LL_I2S_INT_TXFO /**< TX FIFO write overflow interrupt */ +#define I2S_IT_TXFE LL_I2S_INT_TXFE /**< TX FIFO empty trigger interrupt */ +#define I2S_IT_RXFO LL_I2S_INT_RXFO /**< RX FIFO receive overflow interrupt */ +#define I2S_IT_RXDA LL_I2S_INT_RXDA /**< RX FIFO data available interrupt */ +/** @} */ + +/** @defgroup I2S_Timeout_definition I2S Timeout_definition + * @{ + */ +#define HAL_I2S_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup I2S_Exported_Macros I2S Exported Macros + * @{ + */ + +/** @brief Reset I2S handle states. + * @param __HANDLE__ I2S handle. + * @retval None + */ +#define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_I2S_STATE_RESET) + +/** @brief Enable the specified I2S peripheral. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->ENABLE, I2S_ENABLE_EN) + +/** @brief Disable the specified I2S peripheral. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->ENABLE, I2S_ENABLE_EN) + +/** @brief Enable the specified I2S clock. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_ENABLE_CLOCK(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CLKEN, I2S_CLKEN_EN) + +/** @brief Disable the specified I2S clock. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_DISABLE_CLOCK(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CLKEN, I2S_CLKEN_EN) + +/** @brief Enable the specified I2S transmitter block. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_ENABLE_TX_BLOCK(__HANDLE__) ll_i2s_enable_txblock((__HANDLE__)->p_instance) + +/** @brief Disable the specified I2S transmitter block. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_DISABLE_TX_BLOCK(__HANDLE__) ll_i2s_disable_txblock((__HANDLE__)->p_instance) + +/** @brief Enable the specified I2S receiver block. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_ENABLE_RX_BLOCK(__HANDLE__) ll_i2s_enable_rxblock((__HANDLE__)->p_instance) + +/** @brief Disable the specified I2S receiver block. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_DISABLE_RX_BLOCK(__HANDLE__) ll_i2s_disable_rxblock((__HANDLE__)->p_instance) + +/** @brief Enable the specified I2S transmitter channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __CH__ Specifies the I2S channel. + * @retval None + */ +#define __HAL_I2S_ENABLE_TX_CHANNEL(__HANDLE__, __CH__) ll_i2s_enable_tx((__HANDLE__)->p_instance, (__CH__)) + +/** @brief Disable the specified I2S transmitter channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __CH__ Specifies the I2S channel. + * @retval None + */ +#define __HAL_I2S_DISABLE_TX_CHANNEL(__HANDLE__, __CH__) ll_i2s_disable_tx((__HANDLE__)->p_instance, (__CH__)) + +/** @brief Enable the specified I2S receiver channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __CH__ Specifies the I2S channel. + * @retval None + */ +#define __HAL_I2S_ENABLE_RX_CHANNEL(__HANDLE__, __CH__) ll_i2s_enable_rx((__HANDLE__)->p_instance, (__CH__)) + +/** @brief Disable the specified I2S receiver channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __CH__ Specifies the I2S channel. + * @retval None + */ +#define __HAL_I2S_DISABLE_RX_CHANNEL(__HANDLE__, __CH__) ll_i2s_disable_rx((__HANDLE__)->p_instance, (__CH__)) + +/** @brief Flush the I2S transmitter FIFO. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_FLUSH_TX_FIFO(__HANDLE__) ll_i2s_clr_txfifo_all((__HANDLE__)->p_instance) + +/** @brief Flush the I2S receiver FIFO. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_FLUSH_RX_FIFO(__HANDLE__) ll_i2s_clr_rxfifo_all((__HANDLE__)->p_instance) + +/** @brief Enable the I2S DMA Request. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_ENABLE_DMA(__HANDLE__) ll_i2s_enable_dma(__HANDLE__->p_instance) + +/** @brief Disable the I2S DMA Request. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_DISABLE_DMA(__HANDLE__) ll_i2s_disable_dma(__HANDLE__->p_instance) + +/** @brief Reset the I2S TX DMA request to the lowest enabled channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_RESET_TXDMA(__HANDLE__) WRITE_REG((__HANDLE__)->p_instance->TXDMA_RST, I2S_TXDMA_RST) + +/** @brief Reset the I2S RX DMA request to the lowest enabled channel. + * @param __HANDLE__ Specifies the I2S Handle. + * @retval None + */ +#define __HAL_I2S_RESET_RXDMA(__HANDLE__) WRITE_REG((__HANDLE__)->p_instance->RXDMA_RST, I2S_RXDMA_RST) + +/** @brief Enable the specified I2S interrupts. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref I2S_IT_TXFO TX FIFO write overflow interrupt + * @arg @ref I2S_IT_TXFE TX FIFO empty trigger interrupt + * @arg @ref I2S_IT_RXFO RX FIFO receive overflow interrupt + * @arg @ref I2S_IT_RXDA RX FIFO data available interrupt + * @retval None + */ +#define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTMASK, (__INTERRUPT__)) + +/** @brief Disable the specified I2S interrupts. + * @param __HANDLE__ Specifies the I2S handle. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref I2S_IT_TXFO TX FIFO write overflow interrupt + * @arg @ref I2S_IT_TXFE TX FIFO empty trigger interrupt + * @arg @ref I2S_IT_RXFO RX FIFO receive overflow interrupt + * @arg @ref I2S_IT_RXDA RX FIFO data available interrupt + * @retval None + */ +#define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTMASK, (__INTERRUPT__)) + +/** @brief Check whether the specified I2S flag is set or not. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref I2S_FLAG_TXFO TX FIFO write overflow flag + * @arg @ref I2S_FLAG_TXFE TX FIFO empty trigger flag + * @arg @ref I2S_FLAG_RXFO RX FIFO receive overflow flag + * @arg @ref I2S_FLAG_RXDA RX FIFO data available flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].INTSTAT, (__FLAG__)) != 0) ? SET : RESET) + +/** @brief Clear the specified I2S flag. + * @param __HANDLE__ Specifies the I2S Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref I2S_FLAG_TXFO TX FIFO write overflow flag + * @arg @ref I2S_FLAG_RXFO RX FIFO receive overflow flag + * @retval None + */ +#define __HAL_I2S_CLEAR_FLAG(__HANDLE__, __FLAG__) do { \ + if ((__FLAG__) & I2S_FLAG_RXFO) \ + { \ + READ_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].RXOVR, I2S_RXOVR_RXCHO);\ + } \ + if ((__FLAG__) & I2S_FLAG_TXFO) \ + { \ + READ_BITS((__HANDLE__)->p_instance->I2S_CHANNEL[0].TXOVR, I2S_TXOVR_TXCHO);\ + } \ + } while(0); + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup I2S_Private_Macro I2S Private Macros + * @{ + */ + +/** @brief Check if I2S Direction Mode is valid. + * @param __MODE__ I2S Direction Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_I2S_DIRECTION(__MODE__) (((__MODE__) == I2S_DIRECTION_FULL_DUPLEX) || \ + ((__MODE__) == I2S_DIRECTION_SIMPLEX_TX) || \ + ((__MODE__) == I2S_DIRECTION_SIMPLEX_RX)) + +/** @brief Check if I2S Data Size is valid. + * @param __DATASIZE__ I2S Data Size. + * @retval SET (__DATASIZE__ is valid) or RESET (__DATASIZE__ is invalid) + */ +#define IS_I2S_DATASIZE(__DATASIZE__) (((__DATASIZE__) == I2S_DATASIZE_12BIT) || \ + ((__DATASIZE__) == I2S_DATASIZE_16BIT) || \ + ((__DATASIZE__) == I2S_DATASIZE_20BIT) || \ + ((__DATASIZE__) == I2S_DATASIZE_24BIT) || \ + ((__DATASIZE__) == I2S_DATASIZE_32BIT)) + +/** @brief Check if I2S Clock Polarity is valid. + * @param __CPOL__ I2S Clock Polarity. + * @retval SET (__CPOL__ is valid) or RESET (__CPOL__ is invalid) + */ +#define IS_I2S_CPOL(__CPOL__) (((__CPOL__) == I2S_POLARITY_LOW) || \ + ((__CPOL__) == I2S_POLARITY_HIGH)) + +/** @brief Check if I2S Audio Frequency is valid. + * @param __FREQUENCY__ I2S Audio Frequency. + * @retval SET (__FREQUENCY__ is valid) or RESET (__FREQUENCY__ is invalid) + */ +#define IS_I2S_AUDIO_FREQUENCY(__FREQUENCY__) (((__FREQUENCY__) > 0) && ((__FREQUENCY__) <= 1500000)) + +/** @brief Check if I2S FIFO Threshold is valid. + * @param __THR__ I2S FIFO Threshold. + * @retval SET (__THR__ is valid) or RESET (__THR__ is invalid) + */ +#define IS_I2S_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= I2S_TX_FIFO_LEVEL_MAX)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_I2S_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup I2S_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initializations functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the I2Sx peripheral: + + (+) User must implement hal_i2s_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_i2s_init() to configure the selected device with + the selected configuration: + (++) Data Size + (++) Clock Polarity + (++) Audio Frequency + + (+) Call the function hal_i2s_deinit() to restore the default configuration + of the selected I2Sx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the I2S according to the specified parameters + * in the i2s_init_t and initialize the associated handle. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_init(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief De-initialize the I2S peripheral. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_deinit(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Initialize the I2S MSP. + * @note This function should not be modified. When the callback is needed, + the hal_i2s_msp_deinit can be implemented in the user file. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_msp_init(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief De-initialize the I2S MSP. + * @note This function should not be modified. When the callback is needed, + the hal_i2s_msp_deinit can be implemented in the user file. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_msp_deinit(i2s_handle_t *p_i2s); + +/** @} */ + +/** @defgroup I2S_Exported_Functions_Group2 IO operation functions + * @brief Data transfers functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the I2S + data transfers. + + [..] The I2S supports master and slave mode: + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts + or DMA, These APIs return the HAL status. + The end of the data processing will be indicated through the + dedicated I2S IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_i2s_tx_cplt_callback(), hal_i2s_rx_cplt_callback() and hal_i2s_tx_rx_cplt_callback() user callbacks + will be executed respectively at the end of the transmit or Receive process + The hal_i2s_error_callback() user callback will be executed when a communication error is detected. + + (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) + exist for 1-Line (simplex) and 2-Line (full duplex) modes. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in halfword, data of a channel. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in halfword, data of a channel. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_receive(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in blocking mode. + * @param[in] p_i2s: Pointer to a I2S handle which contains the configuration information for the specified I2S module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit_receive(i2s_handle_t *p_i2s, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with Interrupt. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in halfword, data of a channel. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit_it(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in halfword, data of a channel. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_receive_it(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] p_i2s: Pointer to a I2S handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit_receive_it(i2s_handle_t *p_i2s, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with DMA. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in halfword, data of a channel, ranging between 1 and 4095. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit_dma(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode with DMA. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in halfword, data of a channel, ranging between 1 and 4095. + * For example, when 32 bytes of data need to be sent in each of the left and right channels, length = 16. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_receive_dma(i2s_handle_t *p_i2s, uint16_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with DMA. + * @param[in] p_i2s: Pointer to a I2S handle which contains the configuration information for the specified I2S module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_transmit_receive_dma(i2s_handle_t *p_i2s, uint16_t *p_tx_data, uint16_t *p_rx_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Start the I2S master clock. + * @note In case of SLAVE mode, this function will not take effect. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_start_clock(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Stop the I2S master clock. + * @note In case of SLAVE mode, this function will not take effect. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_stop_clock(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (blocking mode). + * @param[in] p_i2s: I2S handle. + * @note This procedure could be used for aborting any ongoing transfer (TX and RX), + * started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable I2S Interrupts (depending of transfer direction) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: When exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_abort(i2s_handle_t *p_i2s); + +/** @} */ + +/** @addtogroup I2S_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle I2S interrupt request. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_irq_handler(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief TX Transfer completed callback. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_tx_cplt_callback(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief RX Transfer completed callback. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_rx_cplt_callback(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief TX/RX Transfer completed callback. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_tx_rx_cplt_callback(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief I2S error callback. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + **************************************************************************************** + */ +void hal_i2s_error_callback(i2s_handle_t *p_i2s); + +/** @} */ + +/** @defgroup I2S_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief I2S control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the I2S. + (+) hal_i2s_get_state() API can be helpful to check in run-time the state of the I2S peripheral + (+) hal_i2s_get_error() check in run-time Errors occurring during communication + (+) hal_i2s_set_timeout() set the timeout during internal process + (+) hal_i2s_set_tx_fifo_threshold() set the TX FIFO Threshold + (+) hal_i2s_set_rx_fifo_threshold() set the RX FIFO Threshold + (+) hal_i2s_get_tx_fifo_threshold() get the TX FIFO Threshold + (+) hal_i2s_get_rx_fifo_threshold() get the RX FIFO Threshold +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the I2S handle state. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @retval ::HAL_I2S_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_I2S_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_I2S_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_I2S_STATE_BUSY_TX: Data Transmii2son process is ongoing. + * @retval ::HAL_I2S_STATE_BUSY_RX: Data Reception process is ongoing. + * @retval ::HAL_I2S_STATE_ABORT: Peripheral with abort request ongoing. + * @retval ::HAL_I2S_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_i2s_state_t hal_i2s_get_state(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Return the I2S error code. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @return I2S error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_i2s_get_error(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Set the TX FIFO threshold. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[in] threshold: TX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_set_tx_fifo_threshold(i2s_handle_t *p_i2s, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Set the RX FIFO threshold. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @param[in] threshold: RX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_set_rx_fifo_threshold(i2s_handle_t *p_i2s, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Get the TX FIFO threshold. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @return TX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_i2s_get_tx_fifo_threshold(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Get the RX FIFO threshold. + * @param[in] p_i2s: Pointer to an I2S handle which contains the configuration information for the specified I2S module. + * @return RX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_i2s_get_rx_fifo_threshold(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Suspend some registers related to I2S configuration before sleep. + * @param[in] p_i2s: Pointer to a I2S handle which contains the configuration + * information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_suspend_reg(i2s_handle_t *p_i2s); + +/** + **************************************************************************************** + * @brief Restore some registers related to I2S configuration after sleep. + * This function must be used in conjunction with the hal_i2s_suspend_reg(). + * @param[in] p_i2s: Pointer to a I2S handle which contains the configuration + * information for the specified I2S module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_i2s_resume_reg(i2s_handle_t *p_i2s); + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_I2S_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_iso7816.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_iso7816.h new file mode 100644 index 0000000..a34aef8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_iso7816.h @@ -0,0 +1,634 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_iso7816.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ISO7816 HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_ISO7816 ISO7816 + * @brief ISO7816 HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_ISO7816_H__ +#define __GR55xx_HAL_ISO7816_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_iso7816.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_ISO7816_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_ISO7816_state HAL ISO7816 State + * @{ + */ +/** + * @brief HAL ISO7816 State Enumerations definition + */ +typedef enum +{ + HAL_ISO7816_STATE_RESET = 0x00U, /**< Peripheral not initialized */ + HAL_ISO7816_STATE_READY = 0x20U, /**< Peripheral initialized and ready for use */ + HAL_ISO7816_STATE_BUSY = 0x24U, /**< An internal process is ongoing */ + HAL_ISO7816_STATE_BUSY_TX = 0x21U, /**< Data Transmission process is ongoing */ + HAL_ISO7816_STATE_BUSY_RX = 0x22U, /**< Data Reception process is ongoing */ + HAL_ISO7816_STATE_BUSY_TX_RX = 0x23U, /**< Data Transmission and Reception process is ongoing */ + HAL_ISO7816_STATE_ABORT = 0x08U, /**< Peripheral with abort request ongoing */ + HAL_ISO7816_STATE_TIMEOUT = 0xA0U, /*!< Timeout state */ + HAL_ISO7816_STATE_ERROR = 0xE0U /**< Peripheral in error */ +} hal_iso7816_state_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_ISO7816_STRUCTURES Structures + * @{ + */ + +/** @defgroup ISO7816_Configuration ISO7816 Configuration + * @{ + */ +/** + * @brief ISO7816_init_structure ISO7816 init structure definition + */ +typedef struct +{ + uint32_t clk_div; /*!< clk_div is used for dividing the system clock, + and ISO7816 output clock is equal to (system clock)/(clk_div+1).*/ + uint32_t wait_time; /*!< Specifies the guard time value in terms of number of baud clocks */ + uint16_t guard_time; /*!< Specifies the maximum card response time (leading edge to leading edge) */ + uint8_t detect_coding; /*!< Specifies whether automatically detect coding convention during ATR receiption. */ +} iso7816_init_t; +/** @} */ +/** @} */ + +/** @defgroup HAL_ISO7816_MACRO Defines + * @{ + */ +/** + * @brief ISO7816_default_config InitStruct default configuration + */ +#define ISO7816_DEFAULT_CONFIG \ +{ \ + .clk_div = 0x2F, \ + .wait_time = 0x6B, \ + .guard_time = 0x00, \ + .detect_coding = ENABLE, \ +} +/** @} */ + +/** @addtogroup HAL_ISO7816_STRUCTURES Structures + * @{ + */ +/** @defgroup ISO7816_handle Handle + * @{ + */ + +/** + * @brief ISO7816 handle Structure definition + */ +typedef struct _iso7816_handle_t +{ + iso7816_regs_t *p_instance; /**< ISO7816 registers base address */ + iso7816_init_t init; /**< ISO7816 configuration parameters */ + uint8_t *p_tx_rx_buffer; /**< Pointer to ISO7816 Tx&Rx transfer Buffer */ + uint16_t buffer_size; /**< ISO7816 Tx Transfer size */ + uint16_t tx_xfer_size; /**< ISO7816 Tx Transfer size */ + __IO uint16_t tx_xfer_count; /**< ISO7816 Tx Transfer Counter */ + uint16_t rx_xfer_size; /**< ISO7816 Rx Transfer size */ + __IO uint16_t rx_xfer_count; /**< ISO7816 Rx Transfer Counter */ + __IO hal_lock_t lock; /**< Locking object */ + __IO hal_iso7816_state_t state; /**< ISO7816 communication state */ + __IO hal_iso7816_state_t tx_state; /**< ISO7816 state information related to Tx operations. */ + __IO hal_iso7816_state_t rx_state; /**< ISO7816 state information related to Rx operations. */ + __IO uint32_t previous_action; /**< ISO7816 previous_action */ + __IO uint32_t error_code; /**< ISO7816 error code */ + uint32_t retention[6]; /**< ISO7816 important register information. */ +} iso7816_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_ISO7816_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup ISO7816_Callback ISO7816 Callback + * @{ + */ + + /** + * @brief HAL_ISO7816 Callback function definition + */ + +typedef struct _iso7816_callback +{ + void (*iso7816_msp_init)(iso7816_handle_t *p_iso7816); /**< ISO7816 init MSP callback */ + void (*iso7816_msp_deinit)(iso7816_handle_t *p_iso7816); /**< ISO7816 de-init MSP callback */ + void (*iso7816_error_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 error callback */ + void (*iso7816_abort_cplt_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 abort completed callback */ + void (*iso7816_presence_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 card presence state changed callback */ + void (*iso7816_atr_cplt_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 reseive atr completed callback */ + void (*iso7816_tx_cplt_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 rx transfer completed callback */ + void (*iso7816_rx_cplt_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 tx transfer completed callback */ + void (*iso7816_tx_rx_cplt_callback)(iso7816_handle_t *p_iso7816); /**< ISO7816 tx/rx transfer completed callback */ +} iso7816_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_ISO7816_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup ISO7816_Exported_Constants ISO7816 Exported Constants + * @{ + */ + +/** @defgroup ISO7816_ACTION Action state + * @{ + */ +#define HAL_ISO7816_ACTION_NONE LL_ISO7816_ACTION_NONE /**< Do Nothing. */ +#define HAL_ISO7816_ACTION_OFF LL_ISO7816_ACTION_OFF /**< Switch Off. */ +#define HAL_ISO7816_ACTION_STOPCLK LL_ISO7816_ACTION_STOPCLK /**< Stop the clock. */ +#define HAL_ISO7816_ACTION_ON LL_ISO7816_ACTION_ON /**< Switch on and receive ATR. */ +#define HAL_ISO7816_ACTION_WARMRST LL_ISO7816_ACTION_WARMRST /**< Trigger warm reset and receive ATR.*/ +#define HAL_ISO7816_ACTION_RX LL_ISO7816_ACTION_RX /**< Receive. */ +#define HAL_ISO7816_ACTION_TX LL_ISO7816_ACTION_TX /**< Transmit. */ +#define HAL_ISO7816_ACTION_TXRX LL_ISO7816_ACTION_TXRX /**< Transmit, followed by RX. */ +/** @} */ + +/** @defgroup ISO7816_Interrupt_definition ISO7816 Interrupt Definition + * @{ + */ +#define HAL_ISO7816_INTR_TEST LL_ISO7816_INTR_TEST /**< Test interrupt */ +#define HAL_ISO7816_INTR_PRESENCE LL_ISO7816_INTR_PRESENCE /**< Source presence interrupt */ +#define HAL_ISO7816_INTR_STATE_ERR LL_ISO7816_INTR_STATE_ERR /**< Source state error interrupt */ +#define HAL_ISO7816_INTR_DMA_ERR LL_ISO7816_INTR_DMA_ERR /**< Source dma error interrupt */ +#define HAL_ISO7816_INTR_RETRY_ERR LL_ISO7816_INTR_RETRY_ERR /**< Source retry error interrupt */ +#define HAL_ISO7816_INTR_RX_ERR LL_ISO7816_INTR_RX_ERR /**< Source rx error interrupt */ +#define HAL_ISO7816_INTR_DONE LL_ISO7816_INTR_DONE /**< Source done error interrupt */ +/** @} */ + + +/** @defgroup ISO7816_HAL_CARD_PRESENCE Card Presence Defines + * @{ + */ +#define HAL_ISO7816_CARD_ABSENT LL_ISO7816_CARD_ABSENT /**< SIM Card is absent. */ +#define HAL_ISO7816_CARD_PRESENT LL_ISO7816_CARD_PRESENT /**< SIM Card is present. */ +/** @} */ + +/** @defgroup ISO7816_HAL_IO_STATES IO States Defines + * @{ + */ +#define HAL_ISO7816_IO_STATE_OFF LL_ISO7816_IO_STATE_OFF /**< Off */ +#define HAL_ISO7816_IO_STATE_IDLE LL_ISO7816_IO_STATE_IDLE /**< Idle */ +#define HAL_ISO7816_IO_STATE_RX_WAIT LL_ISO7816_IO_STATE_RX_WAIT /**< Receive Wait */ +#define HAL_ISO7816_IO_STATE_RX LL_ISO7816_IO_STATE_RX /**< Receive */ +#define HAL_ISO7816_IO_STATE_TX LL_ISO7816_IO_STATE_TX /**< Transmit */ +#define HAL_ISO7816_IO_STATE_TX_GUARD LL_ISO7816_IO_STATE_TX_GUARD /**< Transmit Guard */ +/** @} */ + +/** @defgroup ISO7816_HAL_PWR_STATES Power States Defines + * @{ + */ +#define HAL_ISO7816_PWR_STATE_OFF LL_ISO7816_PWR_STATE_OFF /**< Off */ +#define HAL_ISO7816_PWR_STATE_PWRUP_VCC LL_ISO7816_PWR_STATE_PWRUP_VCC /**< Power up VCC */ +#define HAL_ISO7816_PWR_STATE_PWRUP_RST LL_ISO7816_PWR_STATE_PWRUP_RST /**< Power up reset */ +#define HAL_ISO7816_PWR_STATE_PWRDN_RST LL_ISO7816_PWR_STATE_PWRDN_RST /**< Power Down reset */ +#define HAL_ISO7816_PWR_STATE_PWRDN_VCC LL_ISO7816_PWR_STATE_PWRDN_VCC /**< Power Down VCC */ +#define HAL_ISO7816_PWR_STATE_STOP_PRE LL_ISO7816_PWR_STATE_STOP_PRE /**< Preparing Clock Stop */ +#define HAL_ISO7816_PWR_STATE_STOP LL_ISO7816_PWR_STATE_STOP /**< Clock Stopped */ +#define HAL_ISO7816_PWR_STATE_STOP_POST LL_ISO7816_PWR_STATE_STOP_POST /**< Exiting Clock Stop */ +#define HAL_ISO7816_PWR_STATE_IDLE LL_ISO7816_PWR_STATE_IDLE /**< Idle */ +#define HAL_ISO7816_PWR_STATE_RX_TS0 LL_ISO7816_PWR_STATE_RX_TS0 /**< RX TS Character */ +#define HAL_ISO7816_PWR_STATE_RX_TS1 LL_ISO7816_PWR_STATE_RX_TS1 /**< RX TS Character */ +#define HAL_ISO7816_PWR_STATE_RX LL_ISO7816_PWR_STATE_RX /**< Receive */ +#define HAL_ISO7816_PWR_STATE_TX LL_ISO7816_PWR_STATE_TX /**< Transmit */ +#define HAL_ISO7816_PWR_STATE_TX_RX LL_ISO7816_PWR_STATE_TX_RX /**< Transmit and Receive */ +/** @} */ + +/** @defgroup ISO7816_Error_Code ISO7816 Error Code + * @{ + */ +#define HAL_ISO7816_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_ISO7816_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_ISO7816_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_ISO7816_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup ISO7816_Exported_Macros ISO7816 Exported Macros + * @{ + */ + +/** @brief Enable the specified ISO7816 interrupts. + * @param __HANDLE__ Specifies the ISO7816 Handle. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref HAL_ISO7816_INTR_TEST Test interrupt + * @arg @ref HAL_ISO7816_INTR_PRESENCE Presence interrupt + * @arg @ref HAL_ISO7816_INTR_STATE_ERR State error interrupt + * @arg @ref HAL_ISO7816_INTR_DMA_ERR DMA error interrupt + * @arg @ref HAL_ISO7816_INTR_RETRY_ERR Retry error interrupt + * @arg @ref HAL_ISO7816_INTR_RX_ERR Rx error interrupt + * @arg @ref HAL_ISO7816_INTR_DONE Done error interrupt + * @retval None + */ +#define __HAL_ISO7816_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INT_MASK, (__INTERRUPT__)) + +/** @brief Disable the specified ISO7816 interrupts. + * @param __HANDLE__ Specifies the ISO7816 handle. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref HAL_ISO7816_INTR_TEST Test interrupt + * @arg @ref HAL_ISO7816_INTR_PRESENCE Presence interrupt + * @arg @ref HAL_ISO7816_INTR_STATE_ERR State error interrupt + * @arg @ref HAL_ISO7816_INTR_DMA_ERR DMA error interrupt + * @arg @ref HAL_ISO7816_INTR_RETRY_ERR Retry error interrupt + * @arg @ref HAL_ISO7816_INTR_RX_ERR Rx error interrupt + * @arg @ref HAL_ISO7816_INTR_DONE Done error interrupt + * @retval None + */ +#define __HAL_ISO7816_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INT_MASK, (__INTERRUPT__)) + +/** @brief Get the ISO7816 interrupt flags. + * @param __ISO7816_REGS ISO7816 Register. + * @retval ISO78116 Interrupt definitions. + */ +#define __HAL_ISO7816_IT_GET_IT_FLAG(__ISO7816_REGS) ll_iso7816_get_it_flag(__ISO7816_REGS) +/** @} */ +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_ISO7816_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + * @brief Transimit data in blocking mode + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param tx_size Bytes of data to transmit + * @param timeout Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_transmit(iso7816_handle_t *p_iso7816, uint16_t tx_size, uint32_t timeout); + +/** + * @brief Receive data in blocking mode + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param rx_size Bytes of data to receive + * @param timeout Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_receive(iso7816_handle_t *p_iso7816, uint16_t rx_size, uint32_t timeout); + +/** + * @brief Transimit and receive data in blocking mode + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param tx_size Bytes of data to transmit + * @param rx_size Bytes of data to receive + * @param timeout Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_transmit_receive(iso7816_handle_t *p_iso7816, uint16_t tx_size,uint16_t rx_size, uint32_t timeout); + +/** + * @brief Transimit data in non-blocking mode with Interrupt + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param tx_size Bytes of data to transmit + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_transmit_it(iso7816_handle_t *p_iso7816, uint16_t tx_size); + +/** + * @brief Receive data in non-blocking mode with Interrupt + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param rx_size Bytes of data to receive + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_receive_it(iso7816_handle_t *p_iso7816, uint16_t rx_size); + +/** + * @brief Transimit and receive data in non-blocking mode with Interrupt + * + * @param p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @param tx_size: Bytes of data to transfer. + * @param rx_size: Bytes of data to receive. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ + +hal_status_t hal_iso7816_transmit_receive_it(iso7816_handle_t *p_iso7816, uint16_t tx_size, uint16_t rx_size); + +/** + * @brief Transfer Abort functions + * + * @param p_iso7816 Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +hal_status_t hal_iso7816_abort(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Initializes the ISO7816 according to the specified parameters + * in the iso7816_init_t and initialize the associated handle. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration + * information for the specified ISO7816. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_iso7816_init(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief De-initializes the ISO7816 according to the specified parameters + * in the iso7816_init_t and initialize the associated handle. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration + * information for the specified ISO7816. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_iso7816_deinit(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Initialize the ISO7816 MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_iso7816_msp_init could be implemented in the user file. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + **************************************************************************************** + */ +void hal_iso7816_msp_init(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief De-initialize the ISO7816 MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_iso7816_msp_deinit could be implemented in the user file. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + **************************************************************************************** + */ +void hal_iso7816_msp_deinit(iso7816_handle_t *p_iso7816); +/** + **************************************************************************************** + * @brief Handle ISO7816 interrupt request. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816. + **************************************************************************************** + */ +void hal_iso7816_irq_handler(iso7816_handle_t *p_iso7816); + + +/** + **************************************************************************************** + * @brief Card presence state changed callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_presence_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Receive ART completed callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_atr_cplt_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Rx Transfer completed callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_rx_cplt_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Tx Transfer completed callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_tx_cplt_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Tx and Rx Transfer completed callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_tx_rx_cplt_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief ISO7816 error callback. + * @param[in] p_iso7816: Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module. + **************************************************************************************** + */ +void hal_iso7816_error_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief ISO7816 Abort Completed callback. + * @param[in] p_iso7816: ISO7816 handle. + **************************************************************************************** + */ +void hal_iso7816_abort_cplt_callback(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Return the ISO7816 handle state. + * @param[in] p_iso7816: ISO7816 handle. + * @retval ::HAL_ISO7816_STATE_RESET + * @retval ::HAL_ISO7816_STATE_READY + * @retval ::HAL_ISO7816_STATE_BUSY + * @retval ::HAL_ISO7816_STATE_BUSY_TX + * @retval ::HAL_ISO7816_STATE_BUSY_RX + * @retval ::HAL_ISO7816_STATE_BUSY_TX_RX + * @retval ::HAL_ISO7816_STATE_ABORT + * @retval ::HAL_ISO7816_STATE_TIMEOUT + * @retval ::HAL_ISO7816_STATE_ERROR + **************************************************************************************** + */ +hal_iso7816_state_t hal_iso7816_get_state(iso7816_handle_t *p_iso7816); + +/** + * @brief Request ISO7816 to go to the next action. + * @param p_iso7816: ISO7816 handle. + * @param action: This parameter can be one of the following values: + * @arg @ref HAL_ISO7816_ACTION_NONE + * @arg @ref HAL_ISO7816_ACTION_OFF + * @arg @ref HAL_ISO7816_ACTION_STOPCLK + * @arg @ref HAL_ISO7816_ACTION_ON + * @arg @ref HAL_ISO7816_ACTION_WARMRST + * @arg @ref HAL_ISO7816_ACTION_RX + * @arg @ref HAL_ISO7816_ACTION_TX + * @arg @ref HAL_ISO7816_ACTION_TXRX + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + */ +hal_status_t hal_iso7816_set_action(iso7816_handle_t *p_iso7816, uint32_t action); + +/** + * @brief Get ISO7816 Power States. + * @param p_iso7816: ISO7816 handle. + * @retval Returned value can be one of the following values: + * @arg @ref HAL_ISO7816_PWR_STATE_OFF + * @arg @ref HAL_ISO7816_PWR_STATE_PWRUP_VCC + * @arg @ref HAL_ISO7816_PWR_STATE_PWRUP_RST + * @arg @ref HAL_ISO7816_PWR_STATE_PWRDN_RST + * @arg @ref HAL_ISO7816_PWR_STATE_PWRDN_VCC + * @arg @ref HAL_ISO7816_PWR_STATE_STOP_PRE + * @arg @ref HAL_ISO7816_PWR_STATE_STOP + * @arg @ref HAL_ISO7816_PWR_STATE_STOP_POST + * @arg @ref HAL_ISO7816_PWR_STATE_IDLE + * @arg @ref HAL_ISO7816_PWR_STATE_RX_TS0 + * @arg @ref HAL_ISO7816_PWR_STATE_RX_TS1 + * @arg @ref HAL_ISO7816_PWR_STATE_RX + * @arg @ref HAL_ISO7816_PWR_STATE_TX + * @arg @ref HAL_ISO7816_PWR_STATE_TX_RX + */ +uint32_t hal_iso7816_get_power_states(iso7816_handle_t *p_iso7816); + +/** + * @brief Set divide ISO7816 clock. + * @note Divide SIM clock by this value+1 to define ETU length. The reset value + * is the one, needed for theATR. + * @param p_iso7816: ISO7816 handle. + * @param divide This parameter should range between 0x0 and 0x3FF. + * @retval None. + */ +hal_status_t hal_iso7816_set_etudiv(iso7816_handle_t *p_iso7816, uint32_t divide); + +/** + **************************************************************************************** + * @brief Return the ISO7816 error code. + * @param[in] p_iso7816: ISO7816 handle. + * @return ISO7816 Error Code + **************************************************************************************** + */ +uint32_t hal_iso7816_get_error(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Suspend some registers related to ISO7816 configuration before sleep. + * @param[in] p_iso7816: ISO7816 handle. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_iso7816_suspend_reg(iso7816_handle_t *p_iso7816); + +/** + **************************************************************************************** + * @brief Restore some registers related to ISO7816 configuration after sleep. + * This function must be used in conjunction with the hal_iso7816_suspend_reg(). + * @param[in] p_iso7816: ISO7816 handle. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_iso7816_resume_reg(iso7816_handle_t *p_iso7816); + + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_ISO7816_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio.h new file mode 100644 index 0000000..8d615f3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio.h @@ -0,0 +1,341 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_msio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of MSIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_MSIO MSIO + * @brief MSIO HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_MSIO_H__ +#define __GR55xx_HAL_MSIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_msio.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_MSIO_ENUMERATIONS Enumerations + * @{ + */ + +/** + * @brief MSIO Bit SET and Bit RESET enumerations + */ +typedef enum +{ + MSIO_PIN_RESET = 0U, /**< MSIO pin low level. */ + MSIO_PIN_SET /**< MSIO pin high level.*/ +} msio_pin_state_t; + +/** @} */ + +/** @addtogroup HAL_MSIO_STRUCTURES Structures + * @{ + */ + +/** + * @brief MSIO init structure definition + */ +typedef struct _msio_init +{ + uint32_t pin; /**< Specifies the MSIO pins to be configured. + This parameter can be any value of @ref MSIO_pins */ + + uint32_t direction; /**< Specifies the direction for the selected pins. + This parameter can be a value of @ref MSIO_direction */ + + uint32_t mode; /**< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref MSIO_mode */ + + uint32_t pull; /**< Specifies the Pull-up or Pull-Down activation for the selected pins. + This parameter can be a value of @ref MSIO_pull */ + + uint32_t mux; /**< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref GPIOEx_Mux_Function_Selection. */ +} msio_init_t; + +/** @} */ + +/** + * @defgroup HAL_MSIO_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup MSIO_Exported_Constants MSIO Exported Constants + * @{ + */ + +/** @defgroup MSIO_pins MSIO pins + * @{ + */ +#define MSIO_PIN_0 ((uint16_t)0x0001U) /**< Pin 0 selected */ +#define MSIO_PIN_1 ((uint16_t)0x0002U) /**< Pin 1 selected */ +#define MSIO_PIN_2 ((uint16_t)0x0004U) /**< Pin 2 selected */ +#define MSIO_PIN_3 ((uint16_t)0x0008U) /**< Pin 3 selected */ +#define MSIO_PIN_4 ((uint16_t)0x0010U) /**< Pin 4 selected */ + +#define MSIO_PIN_ALL ((uint16_t)0x001FU) /**< All pins selected */ + +#define MSIO_PIN_MASK (0x0000001FU) /**< PIN mask for assert test */ +/** @} */ + +/** @defgroup MSIO_direction MSIO direction + * @{ + */ +#define MSIO_DIRECTION_NONE LL_MSIO_DIRECTION_NONE /**< Disable input & output */ +#define MSIO_DIRECTION_INPUT LL_MSIO_DIRECTION_INPUT /**< Only Input */ +#define MSIO_DIRECTION_OUTPUT LL_MSIO_DIRECTION_OUTPUT /**< Only Output */ +#define MSIO_DIRECTION_INOUT LL_MSIO_DIRECTION_INOUT /**< Input & Output */ +/** @} */ + +/** @defgroup MSIO_mode MSIO mode + * @brief MSIO Analog or Digital mode + * @{ + */ +#define MSIO_MODE_ANALOG LL_MSIO_MODE_ANALOG /**< Analog IO */ +#define MSIO_MODE_DIGITAL LL_MSIO_MODE_DIGITAL /**< Digital IO */ +/** @} */ + +/** @defgroup MSIO_pull MSIO pull + * @brief MSIO Pull-Up or Pull-Down Activation + * @{ + */ +#define MSIO_NOPULL LL_MSIO_PULL_NO /**< No Pull-up or Pull-down activation */ +#define MSIO_PULLUP LL_MSIO_PULL_UP /**< Pull-up activation */ +#define MSIO_PULLDOWN LL_MSIO_PULL_DOWN /**< Pull-down activation */ +/** @} */ + +/** + * @brief MSIO_default_config initStruct default configuartion + */ +#define MSIO_DEFAULT_CONFIG \ +{ \ + .pin = MSIO_PIN_ALL, \ + .direction = MSIO_DIRECTION_INPUT, \ + .mode = MSIO_MODE_DIGITAL, \ + .pull = MSIO_PULLDOWN, \ + .mux = GPIO_MUX_7, \ +} +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup MSIO_Exported_Macros MSIO Exported Macros + * @{ + */ + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup MSIO_Private_Macros MSIO Private Macros + * @{ + */ + +/** + * @brief Check if MSIO pin action is valid. + * @param __ACTION__ MSIO pin action. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_MSIO_PIN_ACTION(__ACTION__) (((__ACTION__) == MSIO_PIN_RESET) || ((__ACTION__) == MSIO_PIN_SET)) + +/** + * @brief Check if MSIO pins are valid. + * @param __PIN__ MSIO pins. + * @retval SET (__PIN__ is valid) or RESET (__PIN__ is invalid) + */ +#define IS_MSIO_PIN(__PIN__) ((((__PIN__) & MSIO_PIN_MASK) != 0x00U) && \ + (((__PIN__) & ~MSIO_PIN_MASK) == 0x00U)) + +/** + * @brief Check if MSIO direction is valid. + * @param __DIR__ MSIO direction. + * @retval SET (__DIR__ is valid) or RESET (__DIR__ is invalid) + */ +#define IS_MSIO_DIRECTION(__DIR__) (((__DIR__) == MSIO_DIRECTION_NONE) || \ + ((__DIR__) == MSIO_DIRECTION_INPUT) || \ + ((__DIR__) == MSIO_DIRECTION_OUTPUT) || \ + ((__DIR__) == MSIO_DIRECTION_INOUT)) + +/** + * @brief Check if MSIO mode is valid. + * @param __MODE__ MSIO mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_MSIO_MODE(__MODE__) (((__MODE__) == MSIO_MODE_ANALOG) || \ + ((__MODE__) == MSIO_MODE_DIGITAL)) + +/** + * @brief Check if MSIO pull type is valid. + * @param __PULL__ MSIO pull type. + * @retval SET (__PULL__ is valid) or RESET (__PULL__ is invalid) + */ +#define IS_MSIO_PULL(__PULL__) (((__PULL__) == MSIO_NOPULL) || \ + ((__PULL__) == MSIO_PULLUP) || \ + ((__PULL__) == MSIO_PULLDOWN)) + +/** @} */ + +/** @} */ + +/* Include MSIO HAL Extended module */ +#include "gr55xx_hal_msio_ex.h" + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_MSIO_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup MSIO_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and Configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the MSIOx peripheral according to the specified parameters in the @ref msio_init_t. + * @param[in] MSIOx: MSIO peripheral port. + * @param[in] p_msio_init: Pointer to an @ref msio_init_t structure that contains + * the configuration information for the specified MSIO peripheral port. + **************************************************************************************** + */ +void hal_msio_init(msio_pad_t MSIOx, msio_init_t *p_msio_init); + +/** + **************************************************************************************** + * @brief De-initialize the MSIOx peripheral registers to their default reset values. + * @param[in] MSIOx: MSIO peripheral port. + * @param[in] msio_pin: Specifies the port bit to be written. + * This parameter can be a combination of the following values: + * @arg @ref MSIO_PIN_0 + * @arg @ref MSIO_PIN_1 + * @arg @ref MSIO_PIN_2 + * @arg @ref MSIO_PIN_3 + * @arg @ref MSIO_PIN_4 + * @arg @ref MSIO_PIN_ALL + **************************************************************************************** + */ +void hal_msio_deinit(msio_pad_t MSIOx, uint32_t msio_pin); + +/** @} */ + +/** @addtogroup MSIO_Exported_Functions_Group2 IO operation functions + * @brief MSIO Read, Write, and Toggle management functions. + * @{ + */ + +/** + **************************************************************************************** + * @brief Read the specified input port pin. + * @param[in] MSIOx: MSIO peripheral port. + * @param[in] msio_pin: Specifies the port bit to be read. + * This parameter can be one of the following values: + * @arg @ref MSIO_PIN_0 + * @arg @ref MSIO_PIN_1 + * @arg @ref MSIO_PIN_2 + * @arg @ref MSIO_PIN_3 + * @arg @ref MSIO_PIN_4 + * @retval ::MSIO_PIN_RESET: MSIO pin low level. + * @retval ::MSIO_PIN_SET: MSIO pin high level. + **************************************************************************************** + */ +msio_pin_state_t hal_msio_read_pin(msio_pad_t MSIOx, uint16_t msio_pin); + +/** + **************************************************************************************** + * @brief Set or clear the selected data port bit. + * @param[in] MSIOx: MSIO peripheral port. + * @param[in] msio_pin: Specifies the port bit to be written. + * This parameter can be a combination of the following values: + * @arg @ref MSIO_PIN_0 + * @arg @ref MSIO_PIN_1 + * @arg @ref MSIO_PIN_2 + * @arg @ref MSIO_PIN_3 + * @arg @ref MSIO_PIN_4 + * @arg @ref MSIO_PIN_ALL + * @param[in] pin_state: Specifies the value to be written to the selected bit. + * This parameter can be one of the MSIO_PinState enum values: + * @arg MSIO_PIN_RESET: to clear the port pin + * @arg MSIO_PIN_SET: to set the port pin + **************************************************************************************** + */ +void hal_msio_write_pin(msio_pad_t MSIOx, uint16_t msio_pin, msio_pin_state_t pin_state); + +/** + **************************************************************************************** + * @brief Toggle the specified MSIO pin. + * @param[in] MSIOx: MSIO peripheral port. + * @param[in] msio_pin: Specifies the pin to be toggled. + * This parameter can be a combination of the following values: + * @arg @ref MSIO_PIN_0 + * @arg @ref MSIO_PIN_1 + * @arg @ref MSIO_PIN_2 + * @arg @ref MSIO_PIN_3 + * @arg @ref MSIO_PIN_4 + * @arg @ref MSIO_PIN_ALL + **************************************************************************************** + */ +void hal_msio_toggle_pin(msio_pad_t MSIOx, uint16_t msio_pin); + +/** @} */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_MSIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio_ex.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio_ex.h new file mode 100644 index 0000000..4f89011 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_msio_ex.h @@ -0,0 +1,176 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_msio_ex.h + * @author BLE Driver Team + * @brief Header file containing extended macro of MSIO HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_MSIOEx MSIOEx + * @brief MSIOEx HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_MSIO_EX_H__ +#define __GR55xx_HAL_MSIO_EX_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_msio.h" + +/* Exported types ------------------------------------------------------------*/ + +/** + * @defgroup HAL_MSIOEX_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup MSIOEx_Exported_Constants MSIOEx Exported Constants + * @{ + */ + +/** @defgroup MSIOEx_Mux_Mode MSIOEx Mux Mode definition + * @{ + */ +#define MSIO_MUX_0 LL_MSIO_MUX_0 /**< MSIO mux mode 0 */ +#define MSIO_MUX_1 LL_MSIO_MUX_1 /**< MSIO mux mode 1 */ +#define MSIO_MUX_2 LL_MSIO_MUX_2 /**< MSIO mux mode 2 */ +#define MSIO_MUX_3 LL_MSIO_MUX_3 /**< MSIO mux mode 3 */ +#define MSIO_MUX_4 LL_MSIO_MUX_4 /**< MSIO mux mode 4 */ +#define MSIO_MUX_5 LL_MSIO_MUX_5 /**< MSIO mux mode 5 */ +#define MSIO_MUX_6 LL_MSIO_MUX_6 /**< MSIO mux mode 6 */ +#define MSIO_MUX_7 LL_MSIO_MUX_7 /**< MSIO mux mode 7 */ +/** @} */ + +/** @defgroup MSIOEx_Mux_Function_Selection MSIOEx Mux function selection + * @{ + */ + +#if defined (GR551xx) +/*---------------------------------- GR551xx ------------------------------*/ + +/** @defgroup MSIOEx_Common_Selection MSIO PIN common MUX selection(Available for all MSIO pins) + * @{ + */ + +#define MSIO_PIN_MUX_GPIO MSIO_MUX_7 /**< MSIO PIN x Mux Select GPIO */ + +/** @} */ + +/** @defgroup MSIOEx_PIN0_Mux_Selection MSIO_PIN0 MUX selection + * @{ + */ +#define MSIO_PIN0_MUX_PWM0_A MSIO_MUX_0 /**< MSIO_PIN0 Mux Select PWM0_A */ +#define MSIO_PIN0_MUX_UART0_TX MSIO_MUX_1 /**< MSIO_PIN0 Mux Select UART0_TX */ +#define MSIO_PIN0_MUX_UART1_TX MSIO_MUX_2 /**< MSIO_PIN0 Mux Select UART1_TX */ +#define MSIO_PIN0_MUX_I2C0_SCL MSIO_MUX_3 /**< MSIO_PIN0 Mux Select I2C0_SCL */ +#define MSIO_PIN0_MUX_I2C1_SCL MSIO_MUX_4 /**< MSIO_PIN0 Mux Select I2C1_SCL */ +/** @} */ + +/** @defgroup MSIOEx_PIN1_Mux_Selection MSIO_PIN1 MUX selection + * @{ + */ +#define MSIO_PIN1_MUX_PWM0_B MSIO_MUX_0 /**< MSIO_PIN1 Mux Select PWM0_B */ +#define MSIO_PIN1_MUX_UART0_RX MSIO_MUX_1 /**< MSIO_PIN1 Mux Select UART0_RX */ +#define MSIO_PIN1_MUX_UART1_RX MSIO_MUX_2 /**< MSIO_PIN1 Mux Select UART1_RX */ +#define MSIO_PIN1_MUX_I2C0_SDA MSIO_MUX_3 /**< MSIO_PIN1 Mux Select I2C0_SDA */ +#define MSIO_PIN1_MUX_I2C1_SDA MSIO_MUX_4 /**< MSIO_PIN1 Mux Select I2C1_SDA */ +/** @} */ + +/** @defgroup MSIOEx_PIN2_Mux_Selection MSIO_PIN2 MUX selection + * @{ + */ +#define MSIO_PIN2_MUX_PWM0_C MSIO_MUX_0 /**< MSIO_PIN2 Mux Select PWM0_C */ +/** @} */ + +/** @defgroup MSIOEx_PIN3_Mux_Selection MSIO_PIN3 MUX selection + * @{ + */ +#define MSIO_PIN3_MUX_PWM1_A MSIO_MUX_0 /**< MSIO_PIN3 Mux Select PWM1_A */ +#define MSIO_PIN3_MUX_UART0_RTS MSIO_MUX_1 /**< MSIO_PIN3 Mux Select UART0_RTS */ +#define MSIO_PIN3_MUX_UART1_RTS MSIO_MUX_2 /**< MSIO_PIN3 Mux Select UART1_RTS */ +#define MSIO_PIN3_MUX_I2C0_SCL MSIO_MUX_3 /**< MSIO_PIN3 Mux Select I2C0_SCL */ +#define MSIO_PIN3_MUX_I2C1_SCL MSIO_MUX_4 /**< MSIO_PIN3 Mux Select I2C1_SCL */ +/** @} */ + +/** @defgroup MSIOEx_PIN4_Mux_Selection MSIO_PIN4 MUX selection + * @{ + */ +#define MSIO_PIN4_MUX_PWM1_B MSIO_MUX_0 /**< MSIO_PIN4 Mux Select PWM1_B */ +#define MSIO_PIN4_MUX_UART0_CTS MSIO_MUX_1 /**< MSIO_PIN4 Mux Select UART0_CTS */ +#define MSIO_PIN4_MUX_UART1_CTS MSIO_MUX_2 /**< MSIO_PIN4 Mux Select UART1_CTS */ +#define MSIO_PIN4_MUX_I2C0_SDA MSIO_MUX_3 /**< MSIO_PIN4 Mux Select I2C0_SDA */ +#define MSIO_PIN4_MUX_I2C1_SDA MSIO_MUX_4 /**< MSIO_PIN4 Mux Select I2C1_SDA */ +/** @} */ + +/** + * @brief Check if MSIO mux mode is valid. + * @param __MUX__ MSIO mux mode. + * @retval SET (__ACTION__ is valid) or RESET (__ACTION__ is invalid) + */ +#define IS_MSIO_MUX(__MUX__) (((__MUX__) <= MSIO_MUX_7)) + +/*------------------------------------------------------------------------------------------*/ +#endif /* GR551xx */ + +/** @} */ + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_MSIO_EX_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pkc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pkc.h new file mode 100644 index 0000000..484355e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pkc.h @@ -0,0 +1,1044 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_pkc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PKC HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_PKC PKC + * @brief PKC HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_PKC_H__ +#define __GR55xx_HAL_PKC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_pkc.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_PKC_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_PKC_state HAL PKC state + * @{ + */ + +/** + * @brief HAL PKC State Enumerations definition + */ +typedef enum +{ + HAL_PKC_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_PKC_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_PKC_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_PKC_STATE_ERROR = 0x04, /**< Peripheral in error */ + HAL_PKC_STATE_TIMEOUT = 0x08, /**< Peripheral in timeout */ + +} hal_pkc_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_PKC_STRUCTURES Structures + * @{ + */ + +/** @defgroup PKC_Configuration PKC Configuration + * @{ + */ + +/** + * @brief PKC ECC Point Structure definition + */ +typedef struct _ll_ecc_point ecc_point_t; + +/** + * @brief PKC ECC P-256 Elliptic Curve Init Structure definition + */ +typedef struct _ll_ecc_curve_init ecc_curve_init_t; + +/** + * @brief PKC Init Structure definition + */ +typedef struct +{ + ecc_curve_init_t *p_ecc_curve; /**< Specifies the pointer to elliptic curve description */ + + uint32_t data_bits; /**< Specifies the Data size: 256 ~ 2048 bits */ + + uint32_t secure_mode; /**< Specifies the Secure Mode. It indicates that DPA-resistance software algorithm + and hardware measures are applied at a cost of about 35%- 50% performance loss. + This parameter can be a value of @ref PKC_Secure_Mode. */ + + uint32_t (*random_func)(void); /**< Specifies the function to generate random number. */ + +} pkc_init_t; + +/** @} */ + +/** @defgroup PKC_handle PKC handle + * @{ + */ + +/** + * @brief PKC handle Structure definition + */ +typedef struct _pkc_handle +{ + pkc_regs_t *p_instance; /**< PKC registers base address */ + + pkc_init_t init; /**< PKC operation parameters */ + + void *p_result; /**< Pointer to PKC result buffer */ + + uint32_t shift_count; /**< Count to left shift */ + + uint32_t *p_P; /**< Prime number */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_pkc_state_t state; /**< PKC operation state */ + + __IO uint32_t error_code; /**< PKC Error code */ + + uint32_t timeout; /**< Timeout for the PKC operation */ + + uint32_t retention[1]; /**< pkc important register information. */ +} pkc_handle_t; +/** @} */ + +/** @defgroup PKC_Expression_Input PKC expression input + * @{ + */ + +/** + * @brief PKC ECC Point Multiplication expression input + * @note Result = K * Point + */ +typedef struct _pkc_ecc_point_multi +{ + uint32_t *p_K; /**< Pointer to operand K */ + ecc_point_t *p_ecc_point; /**< Pointer to ECC Point. If set to NULL, it will be + modified to the G point of the current curve. */ +} pkc_ecc_point_multi_t; + +/** + * @brief PKC RSA Modular Exponentiation expression input + * @note Result = A^B mod P + */ +typedef struct _pkc_rsa_modular_exponent +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ + uint32_t *p_P; /**< Pointer to prime number P */ + uint32_t *p_P_R2; /**< P_R2 = R^2 mod P, where R = 2^DataBits */ + uint32_t ConstP; /**< Montgomery multiplication constant of P */ +} pkc_rsa_modular_exponent_t; + +/** + * @brief PKC Modular Addition expression input + * @note Result = (A + B) mod P + */ +typedef struct _pkc_modular_add +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ + uint32_t *p_P; /**< Pointer to prime number P */ +} pkc_modular_add_t; + +/** + * @brief PKC Modular Subtraction expression input + * @note Result = (A - B) mod P + */ +typedef struct _pkc_modular_sub +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ + uint32_t *p_P; /**< Pointer to prime number P */ +} pkc_modular_sub_t; + +/** + * @brief PKC Modular Left Shift expression input + * @note Result = (A << ShiftBits) mod P + */ +typedef struct _pkc_modular_shift +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t shift_bits; /**< Pointer to operand A */ + uint32_t *p_P; /**< Pointer to prime number P */ +} pkc_modular_shift_t; + +/** + * @brief PKC Modular Comparison expression input + * @note Result = A mod P + */ +typedef struct _pkc_modular_compare +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_P; /**< Pointer to prime number P */ +} pkc_modular_compare_t; + +/** + * @brief PKC Montgomery Modular Multiplication expression input + * @note Result = A * B * R^(-1) mod P, where R = 2^DataBits + */ +typedef struct _pkc_montgomery_multi +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ + uint32_t *p_P; /**< Pointer to prime number P */ + uint32_t ConstP; /**< Montgomery multiplication constant for P, + where constp = (-P[0])^(-1) mod 2^32 */ +} pkc_montgomery_multi_t; + +/** + * @brief PKC Montgomery Inversion expression input + * @note Result = A^(-1) * 2^(K) mod P + */ +typedef struct _pkc_montgomery_inversion +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_P; /**< Pointer to prime number P */ + uint32_t ConstP; /**< Montgomery multiplication constant for P, + where ConstP = (-P[0])^(-1) mod 2^32 */ +} pkc_montgomery_inversion_t; + +/** + * @brief PKC Big Number Multiplication expression input + * @note Result = A * B, up to 1024 bits + */ +typedef struct _pkc_big_number_multi +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ +} pkc_big_number_multi_t; + +/** + * @brief PKC Big Number Addition expression input + * @note Result = A + B, up to 2048 bits + */ +typedef struct _pkc_big_number_add +{ + uint32_t *p_A; /**< Pointer to operand A */ + uint32_t *p_B; /**< Pointer to operand B */ +} pkc_big_number_add_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_PKC_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_PKC_Callback Callback + * @{ + */ + +/** + * @brief HAL_PKC Callback function definition + */ + +typedef struct _hal_pkc_callback +{ + void (*pkc_msp_init)(pkc_handle_t *p_pkc); /**< PKC init MSP callback */ + void (*pkc_msp_deinit)(pkc_handle_t *p_pkc); /**< PKC de-init MSP callback */ + void (*pkc_done_callback)(pkc_handle_t *p_pkc); /**< PKC calculate done callback */ + void (*pkc_error_callback)(pkc_handle_t *p_pkc); /**< PKC error callback */ + void (*pkc_overflow_callback)(pkc_handle_t *p_pkc); /**< PKC over flow callback */ +} hal_pkc_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_PKC_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PKC_Exported_Constants PKC Exported Constants + * @{ + */ + +/** @defgroup PKC_Error_Code PKC Error Code + * @{ + */ +#define HAL_PKC_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_PKC_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_PKC_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_PKC_ERROR_OVERFLOW ((uint32_t)0x00000004) /**< Result overflow error */ +#define HAL_PKC_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +#define HAL_PKC_ERROR_INVERSE_K ((uint32_t)0x00000010) /**< Inverse K error */ +#define HAL_PKC_ERROR_IRREVERSIBLE ((uint32_t)0x00000020) /**< Irreversible error */ +/** @} */ + +/** @defgroup PKC_Secure_Mode PKC Secure Mode + * @{ + */ +#define PKC_SECURE_MODE_DISABLE ((uint32_t)0x00000000) /**< Secure mode disable */ +#define PKC_SECURE_MODE_ENABLE ((uint32_t)0x00000001) /**< Secure mode enable */ +/** @} */ + +/** @defgroup PKC_Operation_Mode PKC Operation Mode + * @{ + */ +#define PKC_OPERATION_MODE_MULTI LL_PKC_operation_mode_MULTIPLY /**< Multiplication operation mode */ +#define PKC_OPERATION_MODE_INVER LL_PKC_operation_mode_INVERTION /**< Inversion operation mode */ +#define PKC_OPERATION_MODE_ADD LL_PKC_operation_mode_ADD /**< Addition operation mode */ +#define PKC_OPERATION_MODE_SUB LL_PKC_operation_mode_SUB /**< Subtraction operation mode */ +#define PKC_OPERATION_MODE_CMP LL_PKC_operation_mode_COMPARE /**< Comparison operation mode */ +#define PKC_OPERATION_MODE_LSHIFT LL_PKC_operation_mode_LEFTSHIFT /**< Left Shift operation mode */ +#define PKC_OPERATION_MODE_BIGMULTI LL_PKC_operation_mode_BIGINTEGERMULTIPLY /**< Big Number Multiplication operation mode */ +#define PKC_OPERATION_MODE_BIGADD LL_PKC_operation_mode_BIGINTEGERADD /**< Big Number Addition operation mode */ +/** @} */ + +/** @defgroup PKC_Bits_Length PKC Bits Length + * @{ + */ +#define PKC_BITS_LENGTH_MIN LL_PKC_BITS_LENGTH_MIN /**< Min value of bits length */ +#define PKC_BITS_LENGTH_MAX LL_PKC_BITS_LENGTH_MAX /**< Max value of bits length */ +#define PKC_BIGMULTI_BITS_LENGTH_MAX LL_PKC_BIGMULTI_BITS_LENGTH_MAX /**< Max value of big number multiplication bits length */ +/** @} */ + +/** @defgroup PKC_Flags PKC Flags + * @{ + */ +#define PKC_FLAG_BUSY LL_PKC_WORKSTAT_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup PKC_Interrupt_definition PKC Interrupt_definition + * @{ + */ +#define PKC_IT_DONE LL_PKC_INTEN_DONE /**< Operation Done Interrupt source */ +#define PKC_IT_ERR LL_PKC_INTEN_ERR /**< Operation Error Interrupt source */ +#define PKC_IT_OVF LL_PKC_INTEN_BAOVF /**< Big Integer Result Overflow Interrupt source */ +/** @} */ + +/** @defgroup PKC_Timeout_definition PKC Timeout_definition + * @{ + */ +#define HAL_PKC_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< The default value of PKC timeout is 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PKC_Exported_Macros PKC Exported Macros + * @{ + */ + +/** @brief Reset PKC handle states. + * @param __HANDLE__ PKC handle. + * @retval None + */ +#define __HAL_PKC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PKC_STATE_RESET) + +/** @brief Reset the specified PKC peripheral. + * @param __HANDLE__ PKC handle. + * @retval None + */ +#define __HAL_PKC_RESET(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_SWRST); \ + SET_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_SWRST) + +/** @brief Enable the specified PKC peripheral. + * @param __HANDLE__ Specifies the PKC Handle. + * @retval None + */ +#define __HAL_PKC_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN) + +/** @brief Disable the specified PKC peripheral. + * @param __HANDLE__ Specifies the PKC Handle. + * @retval None + */ +#define __HAL_PKC_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, PKC_CTRL_EN) + +/** @brief Enable the specified PKC interrupts. + * @param __HANDLE__ Specifies the PKC Handle. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref PKC_IT_DONE Operation Done Interrupt source + * @arg @ref PKC_IT_ERR Operation Error Interrupt source + * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source + * @retval None + */ +#define __HAL_PKC_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTEN, (__INTERRUPT__)) + +/** @brief Disable the specified PKC interrupts. + * @param __HANDLE__ Specifies the PKC Handle. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref PKC_IT_DONE Operation Done Interrupt source + * @arg @ref PKC_IT_ERR Operation Error Interrupt source + * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source + * @retval None + */ +#define __HAL_PKC_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTEN, (__INTERRUPT__)) + +/** @brief Check whether the specified PKC interrupt flag is set or not. + * @param __HANDLE__ Specifies the PKC Handle. + * @param __FLAG__ Specifies the interrupt flag to check. + * This parameter can be one of the following values: + * @arg @ref PKC_IT_DONE Operation Done Interrupt source + * @arg @ref PKC_IT_ERR Operation Error Interrupt source + * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_PKC_GET_FLAG_IT(__HANDLE__, __FLAG__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__FLAG__)) == (__FLAG__)) + +/** @brief Clear the specified PKC interrupt flag. + * @param __HANDLE__ Specifies the PKC Handle. + * @param __FLAG__ Specifies the interrupt flag to clear. + * This parameter can be one of the following values: + * @arg @ref PKC_IT_DONE Operation Done Interrupt source + * @arg @ref PKC_IT_ERR Operation Error Interrupt source + * @arg @ref PKC_IT_OVF Big Integer Result Overflow Interrupt source + * @retval None + */ +#define __HAL_PKC_CLEAR_FLAG_IT(__HANDLE__, __FLAG__) SET_BITS((__HANDLE__)->p_instance->INTSTAT, (__FLAG__)) + +/** @brief Check whether the specified PKC flag is set or not. + * @param __HANDLE__ Specifies the PKC Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref PKC_FLAG_BUSY Busy flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_PKC_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->WORKSTAT, (__FLAG__)) != 0) ? SET : RESET) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PKC_Private_Macro PKC Private Macros + * @{ + */ + +/** @brief Check if PKC Bits Length is valid. + * @param __BITS__ PKC Bits Length. + * @retval SET (__BITS__ is valid) or RESET (__BITS__ is invalid) + */ +#define IS_PKC_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BITS_LENGTH_MAX)) + +/** @brief Check if PKC Big Number Multiplication Bits Length is valid. + * @param __BITS__ PKC Big Number Multiplication Bits Length. + * @retval SET (__BITS__ is valid) or RESET (__BITS__ is invalid) + */ +#define IS_PKC_BIGMULTI_BITS_LENGTH(__BITS__) (((__BITS__) >= PKC_BITS_LENGTH_MIN) && ((__BITS__) <= PKC_BIGMULTI_BITS_LENGTH_MAX)) + +/** @brief Check if PKC Secure Mode is valid. + * @param __MODE__ PKC Secure Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PKC_SECURE_MODE(__MODE__) (((__MODE__) == PKC_SECURE_MODE_DISABLE) || \ + ((__MODE__) == PKC_SECURE_MODE_ENABLE)) + +/** @brief Check if PKC Operation Mode is valid. + * @param __MODE__ PKC Operation Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PKC_OPERATION_MODE(__MODE__) (((__MODE__) == PKC_OPERATION_MODE_MULTI) || \ + ((__MODE__) == PKC_OPERATION_MODE_INVER) || \ + ((__MODE__) == PKC_OPERATION_MODE_ADD) || \ + ((__MODE__) == PKC_OPERATION_MODE_SUB) || \ + ((__MODE__) == PKC_OPERATION_MODE_CMP) || \ + ((__MODE__) == PKC_OPERATION_MODE_LSHIFT) || \ + ((__MODE__) == PKC_OPERATION_MODE_BIGMULTI) || \ + ((__MODE__) == PKC_OPERATION_MODE_BIGADD)) + +/** @} */ + +/** @} */ + + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_PKC_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup PKC_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the PKC peripheral: + + (+) User must implement hal_pkc_msp_init() function in which it configures + all related peripherals resources (IT and NVIC ). + + (+) Call the function hal_pkc_init() to configure the selected device with + the selected configuration: + (++) pECC_Curve + (++) DataBits + (++) SecureMode + (++) pRandomFunc + + (+) Call the function hal_pkc_deinit() to restore the default configuration + of the selected PKC peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the PKC according to the specified parameters + * in the pkc_init_t and initialize the associated handle. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_init(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief De-initialize the PKC peripheral. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_deinit(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief Initialize the PKC MSP. + * @note This function should not be modified. When the callback is needed, + the hal_pkc_msp_deinit can be implemented in the user file. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_msp_init(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief De-initialize the PKC MSP. + * @note This function should not be modified. When the callback is needed, + the hal_pkc_msp_deinit can be implemented in the user file. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_msp_deinit(pkc_handle_t *p_pkc); + +/** @} */ + +/** @defgroup PKC_Exported_Functions_Group2 IO Operation Functions + * @brief Data transfers functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the PKC + data transfers. + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts + , These APIs return the HAL status. + The end of the data processing will be indicated through the + dedicated PKC IRQ when using Interrupt mode. + The hal_pkc_done_callback() user callbacks will be executed respectively at the end of the calculate process + The hal_pkc_error_callback() user callback will be executed when a communication error is detected + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Execute RSA Modular Exponentiation in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_rsa_modular_exponent(pkc_handle_t *p_pkc, pkc_rsa_modular_exponent_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute ECC Point Multiplication in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_ecc_point_multi(pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute ECC Point Multiplication in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_ecc_point_multi_it(pkc_handle_t *p_pkc, pkc_ecc_point_multi_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Modular Addition in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_add(pkc_handle_t *p_pkc, pkc_modular_add_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Modular Addition in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_add_it(pkc_handle_t *p_pkc, pkc_modular_add_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Modular Subtraction in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_sub(pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Modular Subtraction in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_sub_it(pkc_handle_t *p_pkc, pkc_modular_sub_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Modular Left Shift in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_left_shift(pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Modular Left Shift in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_left_shift_it(pkc_handle_t *p_pkc, pkc_modular_shift_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Modular Comparison in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_compare(pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Modular Comparison in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_modular_compare_it(pkc_handle_t *p_pkc, pkc_modular_compare_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Montgomery Modular Multiplication in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_montgomery_multi(pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Montgomery Modular Multiplication in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_montgomery_multi_it(pkc_handle_t *p_pkc, pkc_montgomery_multi_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Montgomery Inversion in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_montgomery_inversion(pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Montgomery Inversion in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_montgomery_inversion_it(pkc_handle_t *p_pkc, pkc_montgomery_inversion_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Big Number Multiplication in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_big_number_multi(pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Big Number Multiplication in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_big_number_multi_it(pkc_handle_t *p_pkc, pkc_big_number_multi_t *p_input); + +/** + **************************************************************************************** + * @brief Execute Big Number Addition in blocking mode. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_big_number_add(pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Execute Big Number Addition in non-blocking mode with Interrupt. + * @note The computed result will be stored in the buffter pointed by p_pkc->pResult. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] p_input: Pointer to an expression structure which contains the input computing parameters. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pkc_big_number_add_it(pkc_handle_t *p_pkc, pkc_big_number_add_t *p_input); + +/** @} */ + +/** @addtogroup PKC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle PKC interrupt request. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_irq_handler(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief PKC calculate done callback. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_done_callback(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief PKC error callback. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_error_callback(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief PKC over flow callback. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + **************************************************************************************** + */ +void hal_pkc_overflow_callback(pkc_handle_t *p_pkc); + +/** @} */ + +/** @addtogroup PKC_Exported_Functions_Group3 Peripheral Control and State functions + * @brief PKC Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral Control and State functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) Return the PKC handle state. + (+) Return the PKC handle error code. + (+) Set the timeout during internal process. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the PKC handle state. + * @param[in] p_pkc: Pointer to a pkc_handle_t structure that contains + * the configuration information for the specified PKC. + * @retval ::HAL_PKC_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_PKC_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_PKC_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_PKC_STATE_ERROR: Peripheral in error. + * @retval ::HAL_PKC_STATE_TIMEOUT: Peripheral in timeout. + **************************************************************************************** + */ +hal_pkc_state_t hal_pkc_get_state(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief Return the PKC error code. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @return PKC error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_pkc_get_error(pkc_handle_t *p_pkc); + +/** + **************************************************************************************** + * @brief Set the PKC internal process timeout value. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @param[in] timeout: Internal process timeout value. + **************************************************************************************** + */ +void hal_pkc_set_timeout(pkc_handle_t *p_pkc, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Suspend some registers related to PKC configuration before sleep. + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ + +hal_status_t hal_pkc_suspend_reg(pkc_handle_t *p_pkc); +/** + **************************************************************************************** + * @brief Restore some registers related to PKC configuration after sleep. + * This function must be used in conjunction with the hal_hmac_suspend_reg(). + * @param[in] p_pkc: Pointer to a PKC handle which contains the configuration + * information for the specified PKC module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ + +hal_status_t hal_pkc_resume_reg(pkc_handle_t *p_pkc); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_PKC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwm.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwm.h new file mode 100644 index 0000000..768ffe3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwm.h @@ -0,0 +1,519 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_pwm.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWM HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_PWM PWM + * @brief PWM HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_PWM_H__ +#define __GR55xx_HAL_PWM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_pwm.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_PWM_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_PWM_state HAL PWM state + * @{ + */ + +/** + * @brief HAL PWM State Enumerations definition + */ +typedef enum +{ + HAL_PWM_STATE_RESET = 0x00, /**< Peripheral is not initialized or disabled */ + HAL_PWM_STATE_READY = 0x01, /**< Peripheral is initialized and ready for use */ + HAL_PWM_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_PWM_STATE_ERROR = 0x04 /**< Reception process is ongoing */ +} hal_pwm_state_t; +/** @} */ + +/** @defgroup HAL_PWM_active_channel HAL PWM active channel + * @{ + */ + +/** + * @brief HAL PWM active channel Enumerations definition + */ +typedef enum +{ + HAL_PWM_ACTIVE_CHANNEL_A = 0x01, /**< The active channel is A */ + HAL_PWM_ACTIVE_CHANNEL_B = 0x02, /**< The active channel is B */ + HAL_PWM_ACTIVE_CHANNEL_C = 0x04, /**< The active channel is C */ + HAL_PWM_ACTIVE_CHANNEL_ALL = 0x07, /**< The active channels are ALL */ + HAL_PWM_ACTIVE_CHANNEL_CLEARED = 0x00 /**< All active channels are cleared */ +} hal_pwm_active_channel_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_PWM_STRUCTURES Structures + * @{ + */ + +/** @defgroup PWM_Configuration PWM Configuration + * @{ + */ + +/** + * @brief PWM Channel init Structure definition + */ +typedef struct +{ + uint8_t duty; /**< Specifies the duty in PWM output mode. + This parameter must be a number between 0 ~ 100.*/ + + uint8_t drive_polarity; /**< Specifies the drive polarity in PWM output mode. + This parameter can be a value of @ref PWM_Drive_Polarity.*/ + +} pwm_channel_init_t; + +/** + * @brief PWM init Structure definition + */ +typedef struct +{ + uint32_t mode; /**< Specifies the PWM output mode state. + This parameter can be a value of @ref PWM_Mode */ + + uint32_t align; /**< Specifies the PWM alignment mode with three channels + This parameter can be a value of @ref PWM_Alignment_Mode */ + + uint32_t freq; /**< Specifies the PWM frequency. + This parameter must be a number between 0 ~ SystemFreq/2 (max = 32Mhz).*/ + + uint32_t bperiod; /**< Specifies the PWM breath period in breath mode. Unit: ms. + This parameter must be a number between 0 ~ 0xFFFFFFFF/SystemFreq*1000. */ + + uint32_t hperiod; /**< Specifies the PWM hold period in breath mode. Unit: ms. + This parameter must be a number between 0 ~ 0xFFFFFF/SystemFreq*1000. */ + + pwm_channel_init_t channel_a; /**< Specifies the configuration parameters of channel A. */ + + pwm_channel_init_t channel_b; /**< Specifies the configuration parameters of channel B. */ + + pwm_channel_init_t channel_c; /**< Specifies the configuration parameters of channel C. */ + +} pwm_init_t; +/** @} */ + +/** @defgroup PWM_handle PWM handle + * @{ + */ + +/** + * @brief PWM handle Structure definition + */ +typedef struct +{ + pwm_regs_t *p_instance; /**< Register base address */ + + pwm_init_t init; /**< Required parameters for PWM Base */ + + hal_pwm_active_channel_t active_channel; /**< Active channel */ + + __IO hal_lock_t lock; /**< Lock object */ + + __IO hal_pwm_state_t state; /**< PWM operation state */ + + uint32_t retention[11]; /**< PWM important register information. */ + +} pwm_handle_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_PWM_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_PWM_Callback Callback + * @{ + */ + +/** + * @brief HAL_PWM Callback function definition + */ + +typedef struct _hal_pwm_callback +{ + void (*pwm_msp_init)(pwm_handle_t *p_pwm); /**< PWM init MSP callback */ + void (*pwm_msp_deinit)(pwm_handle_t *p_pwm); /**< PWM de-init MSP callback */ +} hal_pwm_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_PWM_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWM_Exported_Constants PWM Exported Constants + * @{ + */ + +/** @defgroup PWM_Mode PWM Mode + * @{ + */ +#define PWM_MODE_FLICKER LL_PWM_FLICKER_MODE /**< PWM flicker mode */ +#define PWM_MODE_BREATH LL_PWM_BREATH_MODE /**< PWM breath mode */ +/** @} */ + +/** @defgroup PWM_Alignment_Mode PWM Pulses Aligned. + * @{ + */ +#define PWM_ALIGNED_EDGE LL_PWM_EDGE_ALIGNED /**< PWM edge-aligned */ +#define PWM_ALIGNED_CENTER LL_PWM_CENTER_ALIGNED /**< PWM center-aligned */ +/** @} */ + +/** @defgroup PWM_Drive_Polarity PWM Drive Polarity + * @{ + */ +#define PWM_DRIVEPOLARITY_NEGATIVE LL_PWM_DRIVEPOLARITY_NEGATIVE /**< PWM led-negative-drive mode */ +#define PWM_DRIVEPOLARITY_POSITIVE LL_PWM_DRIVEPOLARITY_POSITIVE /**< PWM led-positive-drive mode */ +/** @} */ +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWM_Exported_Macros PWM Exported Macros + * @{ + */ + +/** @brief Reset PWM handle states. + * @param __HANDLE__ PWM handle. + * @retval None + */ +#define __HAL_PWM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_PWM_STATE_RESET) + +/** @brief Enable the specified PWM peripheral. + * @param __HANDLE__ specifies the PWM Handle. + * @retval None + */ +#define __HAL_PWM_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN) + +/** @brief Disable the specified PWM peripheral. + * @param __HANDLE__ specifies the PWM Handle. + * @retval None + */ +#define __HAL_PWM_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_EN) + +/** @brief Enable PWM breath mode. + * @param __HANDLE__ specifies the PWM Handle. + * @retval None + */ +#define __HAL_PWM_ENABLE_BREATH(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN) + +/** @brief Disable PWM breath mode. + * @param __HANDLE__ specifies the PWM Handle. + * @retval None + */ +#define __HAL_PWM_DISABLE_BREATH(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->MODE, PWM_MODE_BREATHEN) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PWM_Private_Macro PWM Private Macros + * @{ + */ + +/** + * @brief Check if PWM mode is valid. + * @param __MODE__ PWM mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PWM_MODE(__MODE__) (((__MODE__) == PWM_MODE_FLICKER) || \ + ((__MODE__) == PWM_MODE_BREATH)) + +/** + * @brief Check if PWM Alignment mode is valid. + * @param __MODE__ PWM Alignment mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PWM_ALIGNMENT_MODE(__MODE__) (((__MODE__) == PWM_EDGE) || \ + ((__MODE__) == PWM_CENTER)) + +/** + * @brief Check if PWM drive polarity is valid. + * @param __POLARITY__ PWM drive polarity. + * @retval SET (__POLARITY__ is valid) or RESET (__POLARITY__ is invalid) + */ +#define IS_PWM_DRIVEPOLARITY(__POLARITY__) (((__POLARITY__) == PWM_DRIVEPOLARITY_NEGATIVE) || \ + ((__POLARITY__) == PWM_DRIVEPOLARITY_POSITIVE)) + +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_PWM_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup PWM_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * + * @verbatim +=============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to initialize the PWMx. + (+) The parameters below can only be configured in breath mode: + (++) BreathPeriod + (++) HoldPeriod + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the PWM mode according to the specified + * parameters in the pwm_init_t and initialize the associated handle. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_init(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief De-initialize the PWM peripheral. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_deinit(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief Initialize the PWM MSP. + * @note This function should not be modified. When the callback is needed, + the hal_pwm_msp_init can be implemented in the user file. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + **************************************************************************************** + */ +void hal_pwm_msp_init(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief De-initialize the PWM MSP. + * @note This function should not be modified. When the callback is needed, + the hal_pwm_msp_deinit can be implemented in the user file. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + **************************************************************************************** + */ +void hal_pwm_msp_deinit(pwm_handle_t *p_pwm); + +/** @} */ + +/** @addtogroup PWM_Exported_Functions_Group2 IO operation functions + * @brief IO operation functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Start the PWM. + (+) Stop the PWM. + (+) Configure the specified PWM channel. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Starts the PWM signal generation on the output. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_start(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief Stops the PWM signal generation on the output. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_stop(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief Update the PWM frequency on the output. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @param[in] freq: This parameter ranges between min = 0 and max = SystemFreq / 2. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_update_freq(pwm_handle_t *p_pwm, uint32_t freq); + +/** + **************************************************************************************** + * @brief Suspend some registers related to PWM configuration before sleep. + * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration + * information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_suspend_reg(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief Restore some registers related to PWM configuration after sleep. + * This function must be used in conjunction with the hal_pwm_suspend_reg(). + * @param[in] p_pwm: Pointer to a PWM handle which contains the configuration + * information for the specified PWM module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_resume_reg(pwm_handle_t *p_pwm); + +/** + **************************************************************************************** + * @brief Initialize the PWM channels according to the specified + * parameters in the pwm_init_t. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration information for the specified PWM module. + * @param[in] p_config: PWM Channels configuration structure. + * @param[in] channel: PWM Channels to be configured. + * This parameter can be one of the following values: + * @arg @ref HAL_PWM_ACTIVE_CHANNEL_A :PWM Channel A is active + * @arg @ref HAL_PWM_ACTIVE_CHANNEL_B :PWM Channel B is active + * @arg @ref HAL_PWM_ACTIVE_CHANNEL_C :PWM Channel C is active + * @arg @ref HAL_PWM_ACTIVE_CHANNEL_ALL :All Channels are active + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwm_config_channel(pwm_handle_t *p_pwm, pwm_channel_init_t *p_config, hal_pwm_active_channel_t channel); + +/** @} */ + +/** @addtogroup PWM_Exported_Functions_Group3 Peripheral Control and State functions + * @brief PWM Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral Control and State functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) Return the PWM handle state. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the PWM handle state. + * @param[in] p_pwm: Pointer to a PWM handle that contains the configuration + * information for the specified PWM module. + * @retval ::HAL_PWM_STATE_RESET: Peripheral is not initialized or disabled. + * @retval ::HAL_PWM_STATE_READY: Peripheral is initialized and ready for use. + * @retval ::HAL_PWM_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_PWM_STATE_ERROR: Reception process is ongoing. + **************************************************************************************** + */ +hal_pwm_state_t hal_pwm_get_state(pwm_handle_t *p_pwm); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_PWM_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwr.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwr.h new file mode 100644 index 0000000..3d52391 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_pwr.h @@ -0,0 +1,484 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_pwr.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWR HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_PWR PWR + * @brief PWR HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_PWR_H__ +#define __GR55xx_HAL_PWR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_pwr.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ + +/** @addtogroup HAL_PWR_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_PWR_SLEEP_ELAPSED_HANDLER HAL PWR sleep elapsed handler define + * @{ + */ + +/** + * @brief PWR Sleep Timer Elapsed callback + */ + +typedef void (*pwr_slp_elapsed_handler_t)(void); + +/** @} */ + + +/** @defgroup HAL_PWR_CALLBACK_HANDLER PWR callback handle + * @{ + */ + +/** + * @brief PWR callback handle Structure definition + */ +typedef struct _hal_pwr_handler +{ + pwr_slp_elapsed_handler_t pwr_slp_elapsed_hander; /**< PWR sleep timer elapsed callback */ +} hal_pwr_handler_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_PWR_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWR_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_WakeUp_Pins PWR WakeUp Pins + * @{ + */ +#define PWR_EXTWKUP_PIN0 LL_PWR_EXTWKUP_PIN0 /**< External wakeup pin 0 */ +#define PWR_EXTWKUP_PIN1 LL_PWR_EXTWKUP_PIN1 /**< External wakeup pin 1 */ +#define PWR_EXTWKUP_PIN2 LL_PWR_EXTWKUP_PIN2 /**< External wakeup pin 2 */ +#define PWR_EXTWKUP_PIN3 LL_PWR_EXTWKUP_PIN3 /**< External wakeup pin 3 */ +#define PWR_EXTWKUP_PIN4 LL_PWR_EXTWKUP_PIN4 /**< External wakeup pin 4 */ +#define PWR_EXTWKUP_PIN5 LL_PWR_EXTWKUP_PIN5 /**< External wakeup pin 5 */ +#define PWR_EXTWKUP_PIN6 LL_PWR_EXTWKUP_PIN6 /**< External wakeup pin 6 */ +#define PWR_EXTWKUP_PIN7 LL_PWR_EXTWKUP_PIN7 /**< External wakeup pin 7 */ +#define PWR_EXTWKUP_PIN_ALL LL_PWR_EXTWKUP_PIN_ALL /**< External wakeup pin 0 ~ 7 */ +/** @} */ + +/** @defgroup PWR_WakeUp_Conditions PWR Wakeup Condition + * @{ + */ +#define PWR_WKUP_COND_EXT LL_PWR_WKUP_COND_EXT /**< External wakeup: AON_GPIO */ +#define PWR_WKUP_COND_TIMER LL_PWR_WKUP_COND_TIMER /**< AON Timer wakeup */ +#define PWR_WKUP_COND_BLE LL_PWR_WKUP_COND_BLE /**< BLE wakeup */ +#define PWR_WKUP_COND_CALENDAR LL_PWR_WKUP_COND_CALENDAR /**< Calendar wakeup */ +#define PWR_WKUP_COND_BOD_FEDGE LL_PWR_WKUP_COND_BOD_FEDGE /**< PMU Bod falling edge wakeup */ +#define PWR_WKUP_COND_MSIO_COMP LL_PWR_WKUP_COND_MSIO_COMP /**< Msio comparator wakeup */ +#define PWR_WKUP_COND_ALL LL_PWR_WKUP_COND_ALL /**< All wakeup sources mask */ + +/** @} */ + +/** @defgroup PWR_External_WakeUp_Type PWR External Wakeup Type + * @{ + */ +#define PWR_EXTWKUP_TYPE_LOW LL_PWR_EXTWKUP_TYPE_LOW /**< Low level wakeup */ +#define PWR_EXTWKUP_TYPE_HIGH LL_PWR_EXTWKUP_TYPE_HIGH /**< High level wakeup */ +#define PWR_EXTWKUP_TYPE_RISING LL_PWR_EXTWKUP_TYPE_RISING /**< Rising edge wakeup */ +#define PWR_EXTWKUP_TYPE_FALLING LL_PWR_EXTWKUP_TYPE_FALLING /**< Falling edge wakeup */ +/** @} */ + +/** @defgroup PWR_Sleep_Timer_Mode PWR Sleep Timer Mode + * @{ + */ +#define PWR_SLP_TIMER_MODE_NORMAL 0x0U /**< Start counting after sleeping and disabled when waked up */ +#define PWR_SLP_TIMER_MODE_SINGLE 0x1U /**< Single mode(keep counting until finished) */ +#define PWR_SLP_TIMER_MODE_RELOAD 0x2U /**< Auto reload */ +#define PWR_SLP_TIMER_MODE_DISABLE 0x3U /**< Disabled (used for reset mode) */ +/** @} */ + +/** @defgroup PWR_Timer_Type PWR Timer Type + * @note Only available on GR5515_C and later versions. + * @{ + */ +#define PWR_TIMER_TYPE_CAL_TIMER LL_PWR_TIMER_READ_SEL_CAL_TIMER /**< Calendar timer */ +#define PWR_TIMER_TYPE_AON_WDT LL_PWR_TIMER_READ_SEL_AON_WDT /**< AON watchdog timer */ +#define PWR_TIMER_TYPE_SLP_TIMER LL_PWR_TIMER_READ_SEL_SLP_TIMER /**< Sleep timer */ +#define PWR_TIMER_TYPE_CAL_ALARM LL_PWR_TIMER_READ_SEL_CAL_ALARM /**< Calendar timer */ +/** @} */ + + +/** @defgroup PWR_Memory_Power_State Memory Power State + * @{ + */ +#define PWR_MEM_POWER_OFF LL_PWR_MEM_POWER_OFF /**< Power off */ +#define PWR_MEM_POWER_FULL LL_PWR_MEM_POWER_FULL /**< Full power */ +#define PWR_MEM_POWER_RETENTION LL_PWR_MEM_POWER_RETENTION /**< Power retention, low valtage mode */ +/** @} */ + +/** @defgroup PWR_Communication_Power_State Communication Power State + * @{ + */ +#define PWR_COMM_TIMER_POWER_DOWN 0x0U /**< Power down communication timer */ +#define PWR_COMM_TIMER_POWER_UP 0x1U /**< Power on communication timer */ +#define PWR_COMM_CORE_POWER_DOWN 0x0U /**< Power down communication core */ +#define PWR_COMM_CORE_POWER_UP 0x1U /**< Power on communication core */ +/** @} */ + +/** @defgroup PWR_Communication_Mode Communication Mode + * @{ + */ +#define PWR_COMM_TIMER_MODE_RESET 0x0U /**< Communication timer in reset mode */ +#define PWR_COMM_TIMER_MODE_RUNNING 0x1U /**< Communication timer in running mode */ +#define PWR_COMM_CORE_MODE_RESET 0x0U /**< Communication core in reset mode */ +#define PWR_COMM_CORE_MODE_RUNNING 0x1U /**< Communication core in running mode */ +/** @} */ + +/** @defgroup PWR_Timeout_definition PWR Timeout definition + * @{ + */ +#define HAL_PWR_TIMEOUT_DEFAULT_VALUE ((uint32_t)0x000FFFFF) /**< 0xFFFFF counts */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @addtogroup PWR_Private_Macros PWR Private Macros + * @{ + */ + +/** + * @brief Check if PWR wakeup condition is valid. + * @param __COND__ PWR wakeup condition. + * @retval SET (__COND__ is valid) or RESET (__COND__ is invalid) + */ +#define IS_PWR_WAKEUP_CONDITION(__COND__) ((((__COND__) & PWR_WKUP_COND_ALL) != 0x00U) &&\ + (((__COND__) & ~PWR_WKUP_COND_ALL) == 0x00U)) + +/** + * @brief Check if PWR external wakeup pin is valid. + * @param __PIN__ PWR external wakeup pin. + * @retval SET (__PIN__ is valid) or RESET (__PIN__ is invalid) + */ +#define IS_PWR_EXT_WAKEUP_PIN(__PIN__) ((((__PIN__) & PWR_EXTWKUP_PIN_ALL) != 0x00U) &&\ + (((__PIN__) & ~PWR_EXTWKUP_PIN_ALL) == 0x00U)) + +/** + * @brief Check if PWR sleep timer mode is valid. + * @param __MODE__ PWR sleep timer mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PWR_SLP_TIMER_MODE(__MODE__) (((__MODE__) == PWR_SLP_TIMER_MODE_NORMAL) || \ + ((__MODE__) == PWR_SLP_TIMER_MODE_SINGLE) || \ + ((__MODE__) == PWR_SLP_TIMER_MODE_RELOAD) || \ + ((__MODE__) == PWR_SLP_TIMER_MODE_DISABLE)) + +/** + * @brief Check if PWR external wakeup type is valid. + * @param __TYPE__ PWR external wakeup type. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_PWR_EXTWKUP_TYPE(__TYPE__) (((__TYPE__) == PWR_EXTWKUP_TYPE_LOW) || \ + ((__TYPE__) == PWR_EXTWKUP_TYPE_HIGH) || \ + ((__TYPE__) == PWR_EXTWKUP_TYPE_RISING) || \ + ((__TYPE__) == PWR_EXTWKUP_TYPE_FALLING)) + +/** + * @brief Check if PWR memory block is valid. + * @param __BLOCK__ PWR memory block. + * @retval SET (__BLOCK__ is valid) or RESET (__BLOCK__ is invalid) + */ +#define IS_PWR_MEM_BLOCK(__BLOCK__) ((((__BLOCK__) & PWR_MEM_ALL) != 0x00U) &&\ + (((__BLOCK__) & ~PWR_MEM_ALL) == 0x00U)) + +/** + * @brief Check if PWR memory power state is valid. + * @param __STATE__ PWR memory power state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) + */ +#define IS_PWR_MEM_POWER_STAT(__STATE__) (((__STATE__) == PWR_MEM_POWER_OFF) || \ + ((__STATE__) == PWR_MEM_POWER_FULL) || \ + ((__STATE__) == PWR_MEM_POWER_RETENTION)) + +/** + * @brief Check if PWR BLE communication timer power state is valid. + * @param __STATE__ PWR BLE communication timer power state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) + */ +#define IS_PWR_COMM_TIMER_POWER_STAT(__STATE__) (((__STATE__) == PWR_COMM_TIMER_POWER_DOWN) || \ + ((__STATE__) == PWR_COMM_TIMER_POWER_UP)) + +/** + * @brief Check if PWR BLE communication core power state is valid. + * @param __STATE__ PWR BLE communication core power state. + * @retval SET (__STATE__ is valid) or RESET (__STATE__ is invalid) + */ +#define IS_PWR_COMM_CORE_POWER_STAT(__STATE__) (((__STATE__) == PWR_COMM_CORE_POWER_DOWN) || \ + ((__STATE__) == PWR_COMM_CORE_POWER_UP)) + +/** + * @brief Check if PWR BLE communication timer mode is valid. + * @param __MODE__ PWR BLE communication timer mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PWR_COMM_TIMER_MODE(__MODE__) (((__MODE__) == PWR_COMM_TIMER_MODE_RESET) || \ + ((__MODE__) == PWR_COMM_TIMER_MODE_RUNNING)) + +/** + * @brief Check if PWR BLE communication core mode is valid. + * @param __MODE__ PWR BLE communication core mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_PWR_COMM_CORE_MODE(__MODE__) (((__MODE__) == PWR_COMM_CORE_MODE_RESET) || \ + ((__MODE__) == PWR_COMM_CORE_MODE_RUNNING)) + +/** + * @brief Check if PWR sleep timer type is valid. + * @param __TYPE__ PWR sleep timer type. + * @retval SET (__TYPE__ is valid) or RESET (__TYPE__ is invalid) + */ +#define IS_PWR_PWR_TIMER_TYPE(__TYPE__) (((__TYPE__) == PWR_TIMER_TYPE_CAL_TIMER) || \ + ((__TYPE__) == PWR_TIMER_TYPE_AON_WDT) || \ + ((__TYPE__) == PWR_TIMER_TYPE_SLP_TIMER) || \ + ((__TYPE__) == PWR_TIMER_TYPE_CAL_ALARM)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_PWR_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup PWR_Exported_Functions_Group1 Low Power mode configuration functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Set the DeepSleep WakeUp Condition + * @param[in] condition: This parameter can be a combination of the following values: + * @arg @ref PWR_WKUP_COND_EXT + * @arg @ref PWR_WKUP_COND_TIMER + * @arg @ref PWR_WKUP_COND_BLE + * @arg @ref PWR_WKUP_COND_CALENDAR + * @arg @ref PWR_WKUP_COND_BOD_FEDGE + * @arg @ref PWR_WKUP_COND_MSIO_COMP + * @arg @ref PWR_WKUP_COND_ALL + * @note When @ref PWR_WKUP_COND_EXT is set, use @ref hal_pwr_config_ext_wakeup() to configure wakeup pins and pin trigger type. + * When @ref PWR_WKUP_COND_TIMER is set, use @ref hal_pwr_config_timer_wakeup() to configure the time count to wakeup. + * When @ref PWR_WKUP_COND_ALL is set, use @ref hal_pwr_config_ext_wakeup() and @ref hal_pwr_config_timer_wakeup() to configure + * AON timer and External AON GPIO. + **************************************************************************************** + */ +void hal_pwr_set_wakeup_condition(uint32_t condition); + +/** + **************************************************************************************** + * @brief Configure the AON Sleep Timer mode and count used to wakeup MCU. + * @param[in] timer_mode: Specifies the sleep timer mode. + * This parameter can be a combination of the following values: + * @arg @ref PWR_SLP_TIMER_MODE_NORMAL + * @arg @ref PWR_SLP_TIMER_MODE_SINGLE + * @arg @ref PWR_SLP_TIMER_MODE_RELOAD + * @arg @ref PWR_SLP_TIMER_MODE_DISABLE + * @param[in] load_count: Count value of the AON Sleep Timer. + * @note The sleep clock of AON Timer is 32 KHz. + **************************************************************************************** + */ +void hal_pwr_config_timer_wakeup(uint8_t timer_mode, uint32_t load_count); + +/** + **************************************************************************************** + * @brief Configure the External AON GPIO pins and pin trigger type that is used to wakeup MCU. + * @param[in] ext_wakeup_pinx: This parameter can be a combination of the following values: + * @arg @ref PWR_EXTWKUP_PIN0 + * @arg @ref PWR_EXTWKUP_PIN1 + * @arg @ref PWR_EXTWKUP_PIN2 + * @arg @ref PWR_EXTWKUP_PIN3 + * @arg @ref PWR_EXTWKUP_PIN4 + * @arg @ref PWR_EXTWKUP_PIN5 + * @arg @ref PWR_EXTWKUP_PIN_ALL + * @param[in] ext_wakeup_type: This parameter can be a combination of the following values: + * @arg @ref PWR_EXTWKUP_TYPE_LOW + * @arg @ref PWR_EXTWKUP_TYPE_HIGH + * @arg @ref PWR_EXTWKUP_TYPE_RISING + * @arg @ref PWR_EXTWKUP_TYPE_FALLING + * @note When the level of any selected GPIO pin changes in accordance with the set + * trigger type, MCU will be waked up from DeepSleep mode. + **************************************************************************************** + */ +void hal_pwr_config_ext_wakeup(uint32_t ext_wakeup_pinx, uint32_t ext_wakeup_type); + +/** + **************************************************************************************** + * @brief Disable the interrupt wake-up function of the specified AON GPIO pin. + * @param[in] disable_wakeup_pinx: This parameter can be a combination of the following values: + * @arg @ref PWR_EXTWKUP_PIN0 + * @arg @ref PWR_EXTWKUP_PIN1 + * @arg @ref PWR_EXTWKUP_PIN2 + * @arg @ref PWR_EXTWKUP_PIN3 + * @arg @ref PWR_EXTWKUP_PIN4 + * @arg @ref PWR_EXTWKUP_PIN5 + * @arg @ref PWR_EXTWKUP_PIN_ALL + **************************************************************************************** + */ +void hal_pwr_disable_ext_wakeup(uint32_t disable_wakeup_pinx); + +/** + **************************************************************************************** + * @brief Enters DeepSleep mode. + * @note In DeepSleep mode, all I/O pins keep the same state as in Run mode. + **************************************************************************************** +*/ +void hal_pwr_enter_chip_deepsleep(void); + +/** @} */ + +/** @addtogroup PWR_Exported_Functions_Group2 BLE Communication timer and core configuration function + * @{ + */ + +/** + **************************************************************************************** + * @brief Set the power state of communication timer and communication core in running mode. + * @param[in] timer_power_state: This parameter can be one of the following values: + * @arg @ref PWR_COMM_TIMER_POWER_UP + * @arg @ref PWR_COMM_TIMER_POWER_DOWN + * @param[in] core_power_state: This parameter can be one of the following values: + * @arg @ref PWR_COMM_CORE_POWER_UP + * @arg @ref PWR_COMM_CORE_POWER_DOWN + **************************************************************************************** + */ +void hal_pwr_set_comm_power(uint32_t timer_power_state, uint32_t core_power_state); + +/** + **************************************************************************************** + * @brief Set the work mode of communication timer and communication core. + * @param[in] timer_mode: This parameter can be one of the following values: + * @arg @ref PWR_COMM_TIMER_MODE_RESET + * @arg @ref PWR_COMM_TIMER_MODE_RUNNING + * @param[in] core_mode: This parameter can be one of the following values: + * @arg @ref PWR_COMM_CORE_MODE_RESET + * @arg @ref PWR_COMM_CORE_MODE_RUNNING + **************************************************************************************** + */ +void hal_pwr_set_comm_mode(uint32_t timer_mode, uint32_t core_mode); + +/** + **************************************************************************************** + * @brief Get the current value of specified timer. + * @note Only available on GR5515_C and later versions. + * @param[in] timer_type: This parameter can be one of the following values: + * @arg @ref PWR_TIMER_TYPE_CAL_TIMER + * @arg @ref PWR_TIMER_TYPE_AON_WDT + * @arg @ref PWR_TIMER_TYPE_SLP_TIMER + * @arg @ref PWR_TIMER_TYPE_CAL_ALARM + * @param[out] p_value: Pointer to an integer storing current value + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_pwr_get_timer_current_value(uint32_t timer_type, uint32_t *p_value); + +/** @} */ + +/** @addtogroup PWR_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle PWR Sleep Timer interrupt request. + * @note Only available on GR5515_C and later versions. + **************************************************************************************** + */ +void hal_pwr_sleep_timer_irq_handler(void); + + +/** + **************************************************************************************** + * @brief PWR Sleep Timer Elapsed callback. + * @note Only available on GR5515_C and later versions. + * This function should not be modified. When the callback is needed, + * the hal_pwr_sleep_timer_elapsed_callback can be implemented in the user file. + **************************************************************************************** + */ +void hal_pwr_sleep_timer_elapsed_callback(void); + + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __GR55xx_HAL_PWR_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_qspi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_qspi.h new file mode 100644 index 0000000..603cd13 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_qspi.h @@ -0,0 +1,1123 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_qspi.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of QSPI HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_QSPI QSPI + * @brief QSPI HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_QSPI_H__ +#define __GR55xx_HAL_QSPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_spi.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_QSPI_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_QSPI_state HAL QSPI state + * @{ + */ + +/** + * @brief HAL QSPI State Enumerations definition + */ +typedef enum +{ + HAL_QSPI_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_QSPI_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_QSPI_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_QSPI_STATE_BUSY_INDIRECT_TX = 0x12, /**< Peripheral in indirect mode with transmission ongoing */ + HAL_QSPI_STATE_BUSY_INDIRECT_RX = 0x22, /**< Peripheral in indirect mode with reception ongoing */ + HAL_QSPI_STATE_ABORT = 0x08, /**< Peripheral with abort request ongoing */ + HAL_QSPI_STATE_ERROR = 0x04 /**< Peripheral in error */ + +} hal_qspi_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_QSPI_STRUCTURES Structures + * @{ + */ + +/** @defgroup QSPI_Configuration QSPI Configuration + * @{ + */ + +/** + * @brief QSPI init Structure definition + */ +typedef struct _qspi_init_t +{ + uint32_t clock_prescaler; /**< Specifies the prescaler factor for generating clock based on the AHB clock. + This parameter can be a number between 0 and 0xFFFF */ + + uint32_t clock_mode; /**< Specifies the Clock Mode. It indicates the level that clock takes between commands. + This parameter can be a value of @ref QSPI_Clock_Mode */ + + uint32_t rx_sample_delay; /**< Specifies the RX sample delay. It is used to delay the sample of the RX input port. + This parameter can be a number between 0 and 0x7 */ +} qspi_init_t; +/** @} */ + +/** @defgroup QSPI_handle QSPI handle + * @{ + */ + +/** + * @brief QSPI handle Structure definition + */ +typedef struct _qspi_handle +{ + ssi_regs_t *p_instance; /**< QSPI registers base address */ + + qspi_init_t init; /**< QSPI communication parameters */ + + uint8_t *p_tx_buffer; /**< Pointer to QSPI Tx transfer Buffer */ + + __IO uint32_t tx_xfer_size; /**< QSPI Tx Transfer size */ + + __IO uint32_t tx_xfer_count; /**< QSPI Tx Transfer Counter */ + + uint8_t *p_rx_buffer; /**< Pointer to QSPI Rx transfer Buffer */ + + __IO uint32_t rx_xfer_size; /**< QSPI Rx Transfer size */ + + __IO uint32_t rx_xfer_count; /**< QSPI Rx Transfer Counter */ + + void (*write_fifo)(struct _qspi_handle *p_qspi); /**< Pointer to QSPI Tx transfer FIFO write function */ + + void (*read_fifo)(struct _qspi_handle *p_qspi); /**< Pointer to QSPI Rx transfer FIFO read function */ + + dma_handle_t *p_dma; /**< QSPI Rx/Tx DMA Handle parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_qspi_state_t state; /**< QSPI communication state */ + + __IO uint32_t error_code; /**< QSPI Error code */ + + uint32_t timeout; /**< Timeout for the QSPI memory access */ + + uint32_t retention[9]; /**< DMA important register information. */ +} qspi_handle_t; +/** @} */ + +/** @defgroup QSPI_Command QSPI command + * @{ + */ + +/** + * @brief QSPI command Structure definition + */ +typedef struct _qspi_command_t +{ + uint32_t instruction; /**< Specifies the Instruction to be sent. + This parameter can be a value (8-bit) between 0x00 and 0xFF. */ + + uint32_t address; /**< Specifies the Address to be sent (Size from 1 to 4 bytes according AddressSize). + This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFF. */ + + uint32_t instruction_size; /**< Specifies the Instruction Size. + This parameter can be a value of @ref QSPI_Instruction_Size. */ + + uint32_t address_size; /**< Specifies the Address Size. + This parameter can be a value of @ref QSPI_Address_Size. */ + + uint32_t dummy_cycles; /**< Specifies the Number of Dummy Cycles. + This parameter can be a number between 0 and 31. */ + + uint32_t data_size; /**< Specifies the QSPI address width. + This parameter can be a value of @ref QSPI_Data_Size. */ + + uint32_t instruction_address_mode; /**< Specifies the Instruction and Address Mode. + This parameter can be a value of @ref QSPI_Inst_Addr_Mode. */ + + uint32_t data_mode; /**< Specifies the Data Mode (used for dummy cycles and data phases). + This parameter can be a value of @ref QSPI_Data_Mode. */ + + uint32_t length; /**< Specifies the number of data to transfer. (This is the number of bytes). + This parameter can be any value between 0 and 0xFFFFFFFF (0 means undefined length + until end of memory). */ + +} qspi_command_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_QSPI_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_QSPI_Callback Callback + * @{ + */ + +/** + * @brief HAL_QSPI Callback function definition + */ + +typedef struct _hal_qspi_callback +{ + void (*qspi_msp_init)(qspi_handle_t *p_qspi); /**< QSPI init MSP callback */ + void (*qspi_msp_deinit)(qspi_handle_t *p_qspi); /**< QSPI de-init MSP callback */ + void (*qspi_error_callback)(qspi_handle_t *p_qspi); /**< QSPI error callback */ + void (*qspi_abort_cplt_callback)(qspi_handle_t *p_qspi); /**< QSPI abort complete callback */ + void (*qspi_fifo_threshold_callback)(qspi_handle_t *p_qspi); /**< QSPI FIFO threshold callback */ + void (*qspi_rx_cplt_callback)(qspi_handle_t *p_qspi); /**< QSPI rx transfer completed callback */ + void (*qspi_tx_cplt_callback)(qspi_handle_t *p_qspi); /**< QSPI tx transfer completed callback */ +} hal_qspi_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_QSPI_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup QSPI_Exported_Constants QSPI Exported Constants + * @{ + */ + +/** @defgroup QSPI_Error_Code QSPI Error Code + * @{ + */ +#define HAL_QSPI_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_QSPI_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_QSPI_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_QSPI_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */ +#define HAL_QSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error */ +/** @} */ + +/** @defgroup QSPI_Clock_Mode QSPI Clock Mode + * @{ + */ +#define QSPI_CLOCK_MODE_0 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_1EDGE) /**< Inactive state of CLK is low; + CLK toggles at the start of the first data bit */ +#define QSPI_CLOCK_MODE_1 (LL_SSI_SCPOL_LOW | LL_SSI_SCPHA_2EDGE) /**< Inactive state of CLK is low; + CLK toggles in the middle of the first data bit */ +#define QSPI_CLOCK_MODE_2 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_1EDGE) /**< Inactive state of CLK is high; + CLK toggles at the start of the first data bit */ +#define QSPI_CLOCK_MODE_3 (LL_SSI_SCPOL_HIGH | LL_SSI_SCPHA_2EDGE) /**< Inactive state of CLK is high; + CLK toggles in the middle of the first data bit */ +/** @} */ + +/** @defgroup QSPI_Data_Mode QSPI Data Mode + * @{ + */ +#define QSPI_DATA_MODE_SPI LL_SSI_FRF_SPI /**< Standard SPI Frame Format */ +#define QSPI_DATA_MODE_DUALSPI LL_SSI_FRF_DUALSPI /**< Dual SPI Frame Format */ +#define QSPI_DATA_MODE_QUADSPI LL_SSI_FRF_QUADSPI /**< Quad SPI Frame Format */ +/** @} */ + +/** @defgroup QSPI_Instruction_Size QSPI Instruction Size + * @{ + */ +#define QSPI_INSTSIZE_00_BITS LL_SSI_INSTSIZE_0BIT /**< 0-bit (No Instruction) */ +#define QSPI_INSTSIZE_04_BITS LL_SSI_INSTSIZE_4BIT /**< 4-bit Instruction */ +#define QSPI_INSTSIZE_08_BITS LL_SSI_INSTSIZE_8BIT /**< 8-bit Instruction */ +#define QSPI_INSTSIZE_16_BITS LL_SSI_INSTSIZE_16BIT /**< 16-bit Instruction */ +/** @} */ + +/** @defgroup QSPI_Address_Size QSPI Address Size + * @{ + */ +#define QSPI_ADDRSIZE_00_BITS LL_SSI_ADDRSIZE_0BIT /**< 0-bit address */ +#define QSPI_ADDRSIZE_04_BITS LL_SSI_ADDRSIZE_4BIT /**< 4-bit address */ +#define QSPI_ADDRSIZE_08_BITS LL_SSI_ADDRSIZE_8BIT /**< 8-bit address */ +#define QSPI_ADDRSIZE_12_BITS LL_SSI_ADDRSIZE_12BIT /**< 12-bit address */ +#define QSPI_ADDRSIZE_16_BITS LL_SSI_ADDRSIZE_16BIT /**< 16-bit address */ +#define QSPI_ADDRSIZE_20_BITS LL_SSI_ADDRSIZE_20BIT /**< 20-bit address */ +#define QSPI_ADDRSIZE_24_BITS LL_SSI_ADDRSIZE_24BIT /**< 24-bit address */ +#define QSPI_ADDRSIZE_28_BITS LL_SSI_ADDRSIZE_28BIT /**< 28-bit address */ +#define QSPI_ADDRSIZE_32_BITS LL_SSI_ADDRSIZE_32BIT /**< 32-bit address */ +/** @} */ + +/** @defgroup QSPI_Data_Size Data Width + * @{ + */ +#define QSPI_DATASIZE_04_BITS LL_SSI_DATASIZE_4BIT /**< Data length for SPI transfer: 4 bits */ +#define QSPI_DATASIZE_05_BITS LL_SSI_DATASIZE_5BIT /**< Data length for SPI transfer: 5 bits */ +#define QSPI_DATASIZE_06_BITS LL_SSI_DATASIZE_6BIT /**< Data length for SPI transfer: 6 bits */ +#define QSPI_DATASIZE_07_BITS LL_SSI_DATASIZE_7BIT /**< Data length for SPI transfer: 7 bits */ +#define QSPI_DATASIZE_08_BITS LL_SSI_DATASIZE_8BIT /**< Data length for SPI transfer: 8 bits */ +#define QSPI_DATASIZE_09_BITS LL_SSI_DATASIZE_9BIT /**< Data length for SPI transfer: 9 bits */ +#define QSPI_DATASIZE_10_BITS LL_SSI_DATASIZE_10BIT /**< Data length for SPI transfer: 10 bits */ +#define QSPI_DATASIZE_11_BITS LL_SSI_DATASIZE_11BIT /**< Data length for SPI transfer: 11 bits */ +#define QSPI_DATASIZE_12_BITS LL_SSI_DATASIZE_12BIT /**< Data length for SPI transfer: 12 bits */ +#define QSPI_DATASIZE_13_BITS LL_SSI_DATASIZE_13BIT /**< Data length for SPI transfer: 13 bits */ +#define QSPI_DATASIZE_14_BITS LL_SSI_DATASIZE_14BIT /**< Data length for SPI transfer: 14 bits */ +#define QSPI_DATASIZE_15_BITS LL_SSI_DATASIZE_15BIT /**< Data length for SPI transfer: 15 bits */ +#define QSPI_DATASIZE_16_BITS LL_SSI_DATASIZE_16BIT /**< Data length for SPI transfer: 16 bits */ +#define QSPI_DATASIZE_17_BITS LL_SSI_DATASIZE_17BIT /**< Data length for SPI transfer: 17 bits */ +#define QSPI_DATASIZE_18_BITS LL_SSI_DATASIZE_18BIT /**< Data length for SPI transfer: 18 bits */ +#define QSPI_DATASIZE_19_BITS LL_SSI_DATASIZE_19BIT /**< Data length for SPI transfer: 19 bits */ +#define QSPI_DATASIZE_20_BITS LL_SSI_DATASIZE_20BIT /**< Data length for SPI transfer: 20 bits */ +#define QSPI_DATASIZE_21_BITS LL_SSI_DATASIZE_21BIT /**< Data length for SPI transfer: 21 bits */ +#define QSPI_DATASIZE_22_BITS LL_SSI_DATASIZE_22BIT /**< Data length for SPI transfer: 22 bits */ +#define QSPI_DATASIZE_23_BITS LL_SSI_DATASIZE_23BIT /**< Data length for SPI transfer: 23 bits */ +#define QSPI_DATASIZE_24_BITS LL_SSI_DATASIZE_24BIT /**< Data length for SPI transfer: 24 bits */ +#define QSPI_DATASIZE_25_BITS LL_SSI_DATASIZE_25BIT /**< Data length for SPI transfer: 25 bits */ +#define QSPI_DATASIZE_26_BITS LL_SSI_DATASIZE_26BIT /**< Data length for SPI transfer: 26 bits */ +#define QSPI_DATASIZE_27_BITS LL_SSI_DATASIZE_27BIT /**< Data length for SPI transfer: 27 bits */ +#define QSPI_DATASIZE_28_BITS LL_SSI_DATASIZE_28BIT /**< Data length for SPI transfer: 28 bits */ +#define QSPI_DATASIZE_29_BITS LL_SSI_DATASIZE_29BIT /**< Data length for SPI transfer: 29 bits */ +#define QSPI_DATASIZE_30_BITS LL_SSI_DATASIZE_30BIT /**< Data length for SPI transfer: 30 bits */ +#define QSPI_DATASIZE_31_BITS LL_SSI_DATASIZE_31BIT /**< Data length for SPI transfer: 31 bits */ +#define QSPI_DATASIZE_32_BITS LL_SSI_DATASIZE_32BIT /**< Data length for SPI transfer: 32 bits */ + +/** @} */ + + +/** @defgroup QSPI_Inst_Addr_Mode QSPI Instruction and Address Mode + * @{ + */ +#define QSPI_INST_ADDR_ALL_IN_SPI LL_SSI_INST_ADDR_ALL_IN_SPI /**< Instruction and address are sent in SPI mode */ +#define QSPI_INST_IN_SPI_ADDR_IN_SPIFRF LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF /**< Instruction is sent in SPI mode, and address is sent in Daul/Quad SPI mode */ +#define QSPI_INST_ADDR_ALL_IN_SPIFRF LL_SSI_INST_ADDR_ALL_IN_SPIFRF /**< Instruction and address are sent in Daul/Quad SPI mode */ +/** @} */ + +/** @defgroup QSPI_Flags QSPI Flags + * @{ + */ +#define QSPI_FLAG_DCOL LL_SSI_SR_DCOL /**< Data collision error flag */ +#define QSPI_FLAG_TXE LL_SSI_SR_TXE /**< Transmission error flag */ +#define QSPI_FLAG_RFF LL_SSI_SR_RFF /**< Rx FIFO full flag */ +#define QSPI_FLAG_RFNE LL_SSI_SR_RFNE /**< Rx FIFO not empty flag */ +#define QSPI_FLAG_TFE LL_SSI_SR_TFE /**< Tx FIFO empty flag */ +#define QSPI_FLAG_TFNF LL_SSI_SR_TFNF /**< Tx FIFO not full flag */ +#define QSPI_FLAG_BUSY LL_SSI_SR_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup QSPI_Interrupts QSPI Interrupts + * @{ + */ +#define QSPI_IT_MST LL_SSI_IS_MST /**< Multi-Master Contention Interrupt flag */ +#define QSPI_IT_RXF LL_SSI_IS_RXF /**< Receive FIFO Full Interrupt flag */ +#define QSPI_IT_RXO LL_SSI_IS_RXO /**< Receive FIFO Overflow Interrupt flag */ +#define QSPI_IT_RXU LL_SSI_IS_RXU /**< Receive FIFO Underflow Interrupt flag */ +#define QSPI_IT_TXO LL_SSI_IS_TXO /**< Transmit FIFO Overflow Interrupt flag */ +#define QSPI_IT_TXE LL_SSI_IS_TXE /**< Transmit FIFO Empty Interrupt flag */ +/** @} */ + +/** @defgroup QSPI_Timeout_definition QSPI Timeout_definition + * @{ + */ +#define HAL_QSPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup QSPI_Exported_Macros QSPI Exported Macros + * @{ + */ + +/** @brief Reset QSPI handle states. + * @param __HANDLE__ QSPI handle. + * @retval None + */ +#define __HAL_QSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_QSPI_STATE_RESET) + +/** @brief Enable the specified QSPI peripheral. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN) + +/** @brief Disable the specified QSPI peripheral. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN) + +/** @brief Enable the QSPI DMA TX Request. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_ENABLE_DMATX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE) + +/** @brief Enable the QSPI DMA RX Request. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_ENABLE_DMARX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE) + +/** @brief Disable the QSPI DMA TX Request. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_DISABLE_DMATX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE) + +/** @brief Disable the QSPI DMA RX Request. + * @param __HANDLE__ Specifies the QSPI Handle. + * @retval None + */ +#define __HAL_QSPI_DISABLE_DMARX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE) + +/** @brief Enable the specified QSPI interrupts. + * @param __HANDLE__ Specifies the QSPI Handle. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref QSPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref QSPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref QSPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref QSPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval None + */ +#define __HAL_QSPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__)) + +/** @brief Disable the specified QSPI interrupts. + * @param __HANDLE__ Specifies the QSPI handle. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref QSPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref QSPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref QSPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref QSPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval None + */ +#define __HAL_QSPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__)) + +/** @brief Check whether the specified QSPI interrupt source is enabled or not. + * @param __HANDLE__ Specifies the QSPI Handle. + * @param __INTERRUPT__ Specifies the interrupt source to check. + * This parameter can be one of the following values: + * @arg @ref QSPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref QSPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref QSPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref QSPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref QSPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval The new state of __IT__ (TRUE or FALSE). + */ +#define __HAL_QSPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__INTERRUPT__)) == (__INTERRUPT__)) + +/** @brief Check whether the specified QSPI flag is set or not. + * @param __HANDLE__ Specifies the QSPI Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref QSPI_FLAG_DCOL Data collision error flag + * @arg @ref QSPI_FLAG_TXE Transmission error flag + * @arg @ref QSPI_FLAG_RFF Rx FIFO full flag + * @arg @ref QSPI_FLAG_RFNE Rx FIFO not empty flag + * @arg @ref QSPI_FLAG_TFE Tx FIFO empty flag + * @arg @ref QSPI_FLAG_TFNF Tx FIFO not full flag + * @arg @ref QSPI_FLAG_BUSY Busy flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_QSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET) + +/** @brief Clear the specified QSPI flag. + * @param __HANDLE__ Specifies the QSPI Handle. + * @param __FLAG__ Specifies the flag to clear. + * This parameter can be one of the following values: + * @arg @ref QSPI_FLAG_DCOL Data collision error flag + * @arg @ref QSPI_FLAG_TXE Transmission error flag + * @arg @ref QSPI_FLAG_RFF Rx FIFO full flag + * @arg @ref QSPI_FLAG_RFNE Rx FIFO not empty flag + * @arg @ref QSPI_FLAG_TFE Tx FIFO empty flag + * @arg @ref QSPI_FLAG_TFNF Tx FIFO not full flag + * @arg @ref QSPI_FLAG_BUSY Busy flag + * @retval None + */ +#define __HAL_QSPI_CLEAR_FLAG(__HANDLE__, __FLAG__) READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup QSPI_Private_Macro QSPI Private Macros + * @{ + */ + +/** @brief Check if QSPI Clock Prescaler is valid. + * @param __PRESCALER__ QSPI Clock Prescaler. + * @retval SET (__PRESCALER__ is valid) or RESET (__PRESCALER__ is invalid) + */ +#define IS_QSPI_CLOCK_PRESCALER(__PRESCALER__) ((__PRESCALER__) <= 0xFFFF) + +/** @brief Check if QSPI FIFO Threshold is valid. + * @param __THR__ QSPI FIFO Threshold. + * @retval SET (__THR__ is valid) or RESET (__THR__ is invalid) + */ +#define IS_QSPI_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= 7)) + +/** @brief Check if QSPI Clock Mode is valid. + * @param __CLKMODE__ QSPI Clock Mode. + * @retval SET (__CLKMODE__ is valid) or RESET (__CLKMODE__ is invalid) + */ +#define IS_QSPI_CLOCK_MODE(__CLKMODE__) (((__CLKMODE__) == QSPI_CLOCK_MODE_0) || \ + ((__CLKMODE__) == QSPI_CLOCK_MODE_1) || \ + ((__CLKMODE__) == QSPI_CLOCK_MODE_2) || \ + ((__CLKMODE__) == QSPI_CLOCK_MODE_3)) + +/** @brief Check if QSPI Instruction Size is valid. + * @param __INST_SIZE__ QSPI Instruction Size. + * @retval SET (__INST_SIZE__ is valid) or RESET (__INST_SIZE__ is invalid) + */ +#define IS_QSPI_INSTRUCTION_SIZE(__INST_SIZE__) (((__INST_SIZE__) == QSPI_INSTSIZE_00_BITS) || \ + ((__INST_SIZE__) == QSPI_INSTSIZE_04_BITS) || \ + ((__INST_SIZE__) == QSPI_INSTSIZE_08_BITS) || \ + ((__INST_SIZE__) == QSPI_INSTSIZE_16_BITS)) + +/** @brief Check if QSPI Address Size is valid. + * @param __ADDR_SIZE__ QSPI Address Size . + * @retval SET (__ADDR_SIZE__ is valid) or RESET (__ADDR_SIZE__ is invalid) + */ +#define IS_QSPI_ADDRESS_SIZE(__ADDR_SIZE__) (((__ADDR_SIZE__) == QSPI_ADDRSIZE_00_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_04_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_08_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_12_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_16_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_20_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_24_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_28_BITS) || \ + ((__ADDR_SIZE__) == QSPI_ADDRSIZE_32_BITS)) + +/** @brief Check if QSPI Dummy Cycle is valid. + * @param __DCY__ QSPI Dummy Cycle. + * @retval SET (__DCY__ is valid) or RESET (__DCY__ is invalid) + */ +#define IS_QSPI_DUMMY_CYCLES(__DCY__) ((__DCY__) <= 31) + +/** @brief Check if QSPI Instruction and Address Mode is valid. + * @param __MODE__ QSPI Instruction and Address Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_QSPI_INSTADDR_MODE(__MODE__) (((__MODE__) == QSPI_INST_ADDR_ALL_IN_SPI) || \ + ((__MODE__) == QSPI_INST_IN_SPI_ADDR_IN_SPIFRF) || \ + ((__MODE__) == QSPI_INST_ADDR_ALL_IN_SPIFRF)) + +/** @brief Check if QSPI Data Mode is valid. + * @param __MODE__ QSPI Data Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_QSPI_DATA_MODE(__MODE__) (((__MODE__) == QSPI_DATA_MODE_SPI) || \ + ((__MODE__) == QSPI_DATA_MODE_DUALSPI) || \ + ((__MODE__) == QSPI_DATA_MODE_QUADSPI)) + +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_QSPI_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup QSPI_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the QSPIx peripheral: + + (+) User must implement hal_qspi_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_qspi_init() to configure the selected device with + the selected configuration: + (++) Clock Prescaler + (++) Clock Mode + + (+) Call the function hal_qspi_deinit() to restore the default configuration + of the selected QSPIx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the QSPI according to the specified parameters + * in the qspi_init_t and initialize the associated handle. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_init(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief De-initialize the QSPI peripheral. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_deinit(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Initialize the QSPI MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_qspi_msp_deinit can be implemented in the user file. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_msp_init(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief De-initialize the QSPI MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_qspi_msp_deinit can be implemented in the user file. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_msp_deinit(qspi_handle_t *p_qspi); + +/** @} */ + +/** @defgroup QSPI_Exported_Functions_Group2 IO operation functions + * @brief Data transfers functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the QSPI + data transfers. + + [..] The QSPI supports master and slave mode: + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts. + or DMA, These APIs return the HAL status. + The end of the data processing will be indicated through the + dedicated QSPI IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_qspi_tx_cplt_callback(), hal_qspi_rx_cplt_callback() and hal_qspi_txrx_cplt_callback() user callbacks + will be executed respectively at the end of the transmit or Receive process. + The hal_qspi_error_callback() user callback will be executed when a communication error is detected + + (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) + exist for 1 Line (simplex) and 2 Lines (full duplex) modes. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Transmit an amount of data with the specified instruction and address in blocking mode. + * @note This function is used only in Indirect Write Mode. Dummy cycles in command will be ignored. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[in] p_data: Pointer to data buffer + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_transmit(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data with the specified instruction, address and dummy cycles in blocking mode. + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_receive(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit only instruction in blocking mode. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode with standard SPI. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_transmit(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode with standard SPI. + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_receive(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data with the specified instruction and address in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Write Mode. Dummy cycles in command will be ignored. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[in] p_data: Pointer to data buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_transmit_it(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_receive_it(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Transmit instruction in non-blocking mode with Interrupt. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_it(qspi_handle_t *p_qspi, qspi_command_t *p_cmd); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode at standard SPI with Interrupt. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_transmit_it(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode at standard SPI with Interrupt. + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_receive_it(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit an amount of data with the specified instruction and address in non-blocking mode with DMA . + * @note This function is used only in Indirect Write Mode. Dummy cycles in command will be ignored. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[in] p_data: Pointer to data buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_transmit_dma(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Receive an amount of data with the specified instruction, address and dummy cycles in non-blocking mode with DMA . + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_receive_dma(qspi_handle_t *p_qspi, qspi_command_t *p_cmd, uint8_t *p_data); + +/** + **************************************************************************************** + * @brief Transmit instruction in non-blocking mode with DMA. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_cmd: Pointer to a qspi_command_t structure that contains the instruction and address for data transfer. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_command_dma(qspi_handle_t *p_qspi, qspi_command_t *p_cmd); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode at standard SPI with DMA. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_transmit_dma(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode at standard SPI with DMA. + * @note This function is used only in Indirect Read Mode. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_receive_dma(qspi_handle_t *p_qspi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Abort the current transmission. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_abort(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Abort the current transmission (non-blocking function) + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_abort_it(qspi_handle_t *p_qspi); + +/** @} */ + +/** @addtogroup QSPI_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle QSPI interrupt request. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_irq_handler(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Tx Transfer completed callback. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_tx_cplt_callback(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Rx Transfer completed callback. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_rx_cplt_callback(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief QSPI error callback. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_error_callback(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief QSPI Abort Complete callback. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_abort_cplt_callback(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief FIFO Threshold callback. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + **************************************************************************************** + */ +void hal_qspi_fifo_threshold_callback(qspi_handle_t *p_qspi); + +/** @} */ + +/** @defgroup QSPI_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief QSPI control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the QSPI. + (+) hal_qspi_get_state() API can be helpful to check in run-time the state of the QSPI peripheral. + (+) hal_qspi_get_error() check in run-time Errors occurring during communication. + (+) hal_qspi_set_timeout() set the timeout during internal process. + (+) hal_qspi_set_tx_fifo_threshold() set the TX FIFO Threshold. + (+) hal_qspi_set_rx_fifo_threshold() set the RX FIFO Threshold. + (+) hal_qspi_get_tx_fifo_threshold() get the TX FIFO Threshold. + (+) hal_qspi_get_rx_fifo_threshold() get the RX FIFO Threshold. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the QSPI handle state. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @retval ::HAL_QSPI_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_QSPI_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_QSPI_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_QSPI_STATE_BUSY_INDIRECT_TX: Peripheral in indirect mode with transmission ongoing. + * @retval ::HAL_QSPI_STATE_BUSY_INDIRECT_RX: Peripheral in indirect mode with reception ongoing. + * @retval ::HAL_QSPI_STATE_ABORT: Peripheral with abort request ongoing. + * @retval ::HAL_QSPI_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_qspi_state_t hal_qspi_get_state(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Return the QSPI error code. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @return QSPI error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_qspi_get_error(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Set the QSPI internal process timeout value. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] timeout: Internal process timeout value. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +void hal_qspi_set_timeout(qspi_handle_t *p_qspi, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Set the TX FIFO threshold. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] threshold: TX FIFO threshold value ranging between 0x0U and 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_set_tx_fifo_threshold(qspi_handle_t *p_qspi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Set the RX FIFO threshold. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @param[in] threshold: RX FIFO threshold value ranging between 0x0U and 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_set_rx_fifo_threshold(qspi_handle_t *p_qspi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Get the TX FIFO threshold. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @return TX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_qspi_get_tx_fifo_threshold(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Get the RX FIFO threshold. + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration information for the specified QSPI module. + * @return RX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_qspi_get_rx_fifo_threshold(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Suspend some registers related to QSPI configuration before sleep. + * @param[in] p_qspi: Pointer to a QSPIhandle which contains the configuration + * information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_suspend_reg(qspi_handle_t *p_qspi); + +/** + **************************************************************************************** + * @brief Restore some registers related to QSPI configuration after sleep. + * This function must be used in conjunction with the hal_qspi_suspend_reg(). + * @param[in] p_qspi: Pointer to a QSPI handle which contains the configuration + * information for the specified QSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_qspi_resume_reg(qspi_handle_t *p_qspi); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_QSPI_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_rng.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_rng.h new file mode 100644 index 0000000..b9b5cb5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_rng.h @@ -0,0 +1,449 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_rng.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of RNG HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_RNG RNG + * @brief RNG HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_RNG_H__ +#define __GR55xx_HAL_RNG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_rng.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_RNG_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_RNG_state HAL RNG state + * @{ + */ + +/** + * @brief HAL RNG State Enumerations definition + */ +typedef enum +{ + HAL_RNG_STATE_RESET = 0x00, /**< RNG not initialized or disabled yet */ + HAL_RNG_STATE_READY = 0x01, /**< RNG initialized and ready for use */ + HAL_RNG_STATE_BUSY = 0x02, /**< RNG internal process is ongoing */ + HAL_RNG_STATE_TIMEOUT = 0x03, /**< RNG timeout state */ + HAL_RNG_STATE_ERROR = 0x04 /**< RNG error state */ +} hal_rng_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_RNG_STRUCTURES Structures + * @{ + */ + +/** @defgroup RNG_Configuration RNG Configuration + * @{ + */ + +/** + * @brief RNG init structure definition + */ +typedef struct _rng_init +{ + uint32_t seed_mode; /**< Specifies the seed source for the LFSR. + This parameter can be a value of @ref RNG_SEED_SOURCE */ + + uint32_t lfsr_mode; /**< Specifies the configuration mode for the LFSR. + This parameter can be a value of @ref RNG_LFSR_MODE */ + + uint32_t out_mode; /**< Specifies the Output mode for the RNG. + This parameter can be a value of @ref RNG_OUTPUT_MODE */ + + uint32_t post_mode; /**< Specifies post-process configuration for the RNG. + This parameter can be a value of @ref RNG_POST_PRO */ + +} rng_init_t; + +/** @} */ + +/** @defgroup RNG_handle RNG handle + * @{ + */ + +/** + * @brief RNG handle Structure definition + */ +typedef struct _rng_handle +{ + rng_regs_t *p_instance; /**< Register base address */ + + rng_init_t init; /**< RNG required parameters */ + + hal_lock_t lock; /**< RNG locking object */ + + __IO hal_rng_state_t state; /*!< RNG communication state */ + + uint32_t random_number; /*!< Last-generated RNG Data */ + + uint32_t retention[1]; /**< RNG important register information. */ +} rng_handle_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_RNG_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_RNG_Callback Callback + * @{ + */ + +/** + * @brief HAL_RNG Callback function definition + */ + +typedef struct _hal_rng_callback +{ + void (*rng_msp_init)(rng_handle_t *p_rng); /**< RNG init MSP callback */ + void (*rng_msp_deinit)(rng_handle_t *p_rng); /**< RNG de-init MSP callback */ + void (*rng_ready_data_callback)(rng_handle_t *p_rng, uint32_t random32bit); /**< RNG data ready callback */ +} hal_rng_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_RNG_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RNG_Exported_Constants RNG Exported Constants + * @{ + */ + +/** @defgroup RNG_SEED_SOURCE LFSR seed source + * @{ + */ +#define RNG_SEED_FR0_S0 LL_RNG_SEED_FR0_S0 /**< LFSR seed is from the switching oscillator S0. */ +#define RNG_SEED_USER LL_RNG_SEED_USER /**< LFSR seed is configured by users. */ +/** @} */ + + +/** @defgroup RNG_LFSR_MODE LFSR configuration mode + * @{ + */ +#define RNG_LFSR_MODE_59BIT LL_RNG_LFSR_MODE_59BIT /**< 59-bit LFSR. */ +#define RNG_LFSR_MODE_128BIT LL_RNG_LFSR_MODE_128BIT /**< 128-bit LFSR. */ +/** @} */ + +/** @defgroup RNG_POST_PRO Post-process mode + * @{ + */ +#define RNG_POST_PRO_NOT LL_RNG_POST_PRO_NOT /**< No post process. */ +#define RNG_POST_PRO_SKIPPING LL_RNG_POST_PRO_SKIPPING /**< bit skipping. */ +#define RNG_POST_PRO_COUNTING LL_RNG_POST_PRO_COUNTING /**< bit counting. */ +#define RNG_POST_PRO_NEUMANN LL_RNG_POST_PRO_NEUMANN /**< Von-Neumann. */ +/** @} */ + +/** @defgroup RNG_OUTPUT_MODE RNG Output mode + * @{ + */ +#define RNG_OUTPUT_FR0_S0 LL_RNG_OUTPUT_FR0_S0 /**< Digital RNG direct output, for ring oscillator S0 LFSR seed. */ +#define RNG_OUTPUT_CYCLIC_PARITY LL_RNG_OUTPUT_CYCLIC_PARITY /**< LFSR and RNG cyclic sampling and parity generation. */ +#define RNG_OUTPUT_CYCLIC LL_RNG_OUTPUT_CYCLIC /**< LFSR and RNG cyclic sampling. */ +#define RNG_OUTPUT_LFSR_RNG LL_RNG_OUTPUT_LFSR_RNG /**< LFSR ⊕ RNG. */ +#define RNG_OUTPUT_LFSR LL_RNG_OUTPUT_LFSR /**< LFSR direct output. */ +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_RNG_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup RNG_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions. + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and start the RNG according to the specified parameters + in the rng_init_t of associated handle. + (+) Initialize the RNG MSP. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the RNG according to the specified + * parameters in the rng_init_t of associated handle. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_init(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief De-initialize the RNG peripheral. + * @param[in] p_rng: RNG handle. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_deinit(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief Initialize the RNG MSP. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @note When rewriting this function in user file, mechanism may be added + * to avoid multiple initialize when hal_rng_init function is called + * again to change parameters. + **************************************************************************************** + */ +void hal_rng_msp_init(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief De-initialize the RNG MSP. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @note When rewriting this function in user file, mechanism may be added + * to avoid multiple initialize when hal_rng_init function is called + * again to change parameters. + **************************************************************************************** + */ +void hal_rng_msp_deinit(rng_handle_t *p_rng); + +/** @} */ + + +/** @addtogroup RNG_Exported_Functions_Group2 Peripheral Control functions + * @brief Peripheral Control functions + * +@verbatim + ============================================================================== + ##### Peripheral Control functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Generate Random Number. + (+) Handle RNG interrupt request and associated function callback. + +@endverbatim + * @{ + */ + + +/** + **************************************************************************************** + * @brief Generate a 32-bit random number. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @param[in] p_seed: user configured seeds. the seed is valid when seed_mode member of + * rng_init_t is configured as RNG_SEED_USER. If 59-bit random number is + * selected, the seed need to provide [0~58] bit spaces. If 128-bit random + * number is selected, the seed need to provide [0~127] bit spaces. + * @param[out] p_random32bit: Pointer to generated random number variable if successful. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_generate_random_number(rng_handle_t *p_rng, uint16_t *p_seed, uint32_t *p_random32bit); + +/** + **************************************************************************************** + * @brief Generate a 32-bit random number in interrupt mode. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @param[in] p_seed: user configured seeds. the seed is valid when seed_mode member of + * rng_init_t is configured as RNG_SEED_USER. If 59-bit random number is + * selected, the seed need to provide [0~58] bit spaces. If 128-bit random + * number is selected, the seed need to provide [0~127] bit spaces. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_generate_random_number_it(rng_handle_t *p_rng, uint16_t *p_seed); + +/** + **************************************************************************************** + * @brief Read the latest generated random number. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @retval random value. + **************************************************************************************** + */ +uint32_t hal_rng_read_last_random_number(rng_handle_t *p_rng); + +/** @} */ + +/** @addtogroup RNG_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callback functions + * @{ + */ +/** + **************************************************************************************** + * @brief Handle RNG interrupt request. + * @param[in] p_rng: RNG handle. + **************************************************************************************** + */ +void hal_rng_irq_handler(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief Data Ready callback in non-blocking mode. + * @note This function should not be modified. When the callback is needed, + the hal_rng_ready_data_callback can be implemented in the user file. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @param random32bit: generated random value + * @retval None + **************************************************************************************** + */ +void hal_rng_ready_data_callback(rng_handle_t *p_rng, uint32_t random32bit); + +/** @} */ + +/** @defgroup RNG_Exported_Functions_Group3 Peripheral State functions + * @brief RNG State functions + * +@verbatim + =============================================================================== + ##### Peripheral State functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the RNG. + (+) hal_rng_get_state() API can be helpful to check in run-time the state of the RNG peripheral. +@endverbatim + * @{ + */ +/** + **************************************************************************************** + * @brief Return the RNG handle state. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration information for the specified HMAC module. + * @retval ::HAL_RNG_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_RNG_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_RNG_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_RNG_STATE_ERROR: Peripheral in error. + * @retval ::HAL_RNG_STATE_TIMEOUT: Peripheral in timeout. + **************************************************************************************** + */ +hal_rng_state_t hal_rng_get_state(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief Suspend some registers related to RNG configuration before sleep. + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_suspend_reg(rng_handle_t *p_rng); + +/** + **************************************************************************************** + * @brief Restore some registers related to RNG configuration after sleep. + * This function must be used in conjunction with the hal_rng_resume_reg(). + * @param[in] p_rng: Pointer to a RNG handle which contains the configuration + * information for the specified RNG module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_rng_resume_reg(rng_handle_t *p_rng); + + +/** @} */ + +/** @} */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_RNG_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_sleep_timer.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_sleep_timer.h new file mode 100644 index 0000000..b3efc9c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_sleep_timer.h @@ -0,0 +1,126 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_sleep_timer.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of sleep timer HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_SLEEP_TIMER SLEEP_TIMER + * @brief SLEEP TIMER HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_SLEEP_TIMER_H__ +#define __GR55xx_HAL_SLEEP_TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_SLEEP_TIMER_FUNCTIONS Functions + * @{ + */ + +/** +**************************************************************************************** +* @brief Configure the AON Sleep Timer mode, count and start used to wakeup MCU. +* @param[in] mode: Specifies the sleep timer mode. +* This parameter can be a combination of the following values: +* @arg @ref PWR_SLP_TIMER_MODE_NORMAL +* @arg @ref PWR_SLP_TIMER_MODE_SINGLE +* @arg @ref PWR_SLP_TIMER_MODE_RELOAD +* @param[in] value: Count value of the AON Sleep Timer. +* @retval ::HAL_OK: Operation is OK. +* @retval ::HAL_ERROR: Operation is ERROR. +**************************************************************************************** +*/ +hal_status_t hal_sleep_timer_config_and_start(uint8_t mode, uint32_t value); + +/** +**************************************************************************************** +* @brief stop Sleep Timer +**************************************************************************************** +*/ +void hal_sleep_timer_stop(void); + +/** +**************************************************************************************** +* @brief Get the current value of sleep timer +* @retval the current value of sleep timer +**************************************************************************************** +*/ +uint32_t hal_sleep_timer_get_current_value(void); + +/** +**************************************************************************************** +* @brief Get clock frequency of sleep timer +* @retval clock frequency of sleep timer +**************************************************************************************** +*/ +uint32_t hal_sleep_timer_get_clock_freq(void); + +/** +**************************************************************************************** +* @brief get sleep timer is running or not +* @retval runing state of sleep timer (1 or 0). +**************************************************************************************** +*/ +uint8_t hal_sleep_timer_status_get(void); +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_SLEEP_TIMER_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi.h new file mode 100644 index 0000000..22ed25a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi.h @@ -0,0 +1,1098 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_spi.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of SPI HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_SPI SPI + * @brief SPI HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_SPI_H__ +#define __GR55xx_HAL_SPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_spi.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_SPI_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_SPI_state HAL SPI state + * @{ + */ + +/** + * @brief HAL SPI State Enumerations definition + */ +typedef enum +{ + HAL_SPI_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_SPI_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_SPI_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_SPI_STATE_BUSY_TX = 0x12, /**< Data Transmission process is ongoing */ + HAL_SPI_STATE_BUSY_RX = 0x22, /**< Data Reception process is ongoing */ + HAL_SPI_STATE_BUSY_TX_RX = 0x32, /**< Data Transmission and Reception process is ongoing */ + HAL_SPI_STATE_ABORT = 0x08, /**< Peripheral with abort request ongoing */ + HAL_SPI_STATE_ERROR = 0x04 /**< Peripheral in error */ + +} hal_spi_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_SPI_STRUCTURES Structures + * @{ + */ + +/** @defgroup SPI_Configuration SPI Configuration + * @{ + */ + +/** + * @brief SPI init Structure definition + */ +typedef struct _spi_init +{ + uint32_t data_size; /**< Specifies the SPI data size. + This parameter can be a value of @ref SPI_Data_Size */ + + uint32_t clock_polarity; /**< Specifies the serial clock steady state. + This parameter can be a value of @ref SPI_Clock_Polarity */ + + uint32_t clock_phase; /**< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref SPI_Clock_Phase */ + + uint32_t baudrate_prescaler; /**< Specifies the BaudRate prescaler value which will be + used to configure the transmit and receive SCK clock. + @note The communication clock is derived from the master + clock. The slave clock does not need to be set. */ + + uint32_t ti_mode; /**< Specifies if the TI mode is enabled or not. + This parameter can be a value of @ref SPI_TI_Mode */ + + uint32_t slave_select; /**< Specifies the slaves to be selected. + This parameter can be a value of @ref SPI_Slave_Select */ +} spi_init_t; +/** @} */ + +/** @defgroup SPI_handle SPI handle + * @{ + */ + +/** + * @brief SPI handle Structure definition + */ +typedef struct _spi_handle +{ + ssi_regs_t *p_instance; /**< SPI registers base address */ + + spi_init_t init; /**< SPI communication parameters */ + + uint8_t *p_tx_buffer; /**< Pointer to SPI Tx transfer Buffer */ + + __IO uint32_t tx_xfer_size; /**< SPI Tx Transfer size */ + + __IO uint32_t tx_xfer_count; /**< SPI Tx Transfer Counter */ + + uint8_t *p_rx_buffer; /**< Pointer to SPI Rx transfer Buffer */ + + __IO uint32_t rx_xfer_size; /**< SPI Rx Transfer size */ + + __IO uint32_t rx_xfer_count; /**< SPI Rx Transfer Counter */ + + void (*write_fifo)(struct _spi_handle *p_spi); /**< Pointer to SPI Tx transfer FIFO write function */ + + void (*read_fifo)(struct _spi_handle *p_spi); /**< Pointer to SPI Rx transfer FIFO read function */ + + void (*read_write_fifo)(struct _spi_handle *p_spi); /**< Pointer to SPI transfer FIFO read and write function */ + + dma_handle_t *p_dmatx; /**< SPI Tx DMA Handle parameters */ + + dma_handle_t *p_dmarx; /**< SPI Rx DMA Handle parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_spi_state_t state; /**< SPI communication state */ + + __IO uint32_t error_code; /**< SPI Error code */ + + uint32_t timeout; /**< Timeout for the SPI memory access */ + +#if defined(HAL_SPI_V2_MODULE_ENABLED) + uint32_t retention[9]; /**< SPI important register information. */ +#else + uint32_t retention[8]; /**< SPI important register information. */ +#endif +} spi_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_SPI_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_SPI_Callback Callback + * @{ + */ + +/** + * @brief HAL_SPI Callback function definition + */ + +typedef struct _hal_spi_callback +{ + void (*spi_msp_init)(spi_handle_t *p_spi); /**< SPI init MSP callback */ + void (*spi_msp_deinit)(spi_handle_t *p_spi); /**< SPI de-init MSP callback */ + void (*spi_error_callback)(spi_handle_t *p_spi); /**< SPI error callback */ + void (*spi_abort_cplt_callback)(spi_handle_t *p_spi); /**< SPI abort completed callback */ + void (*spi_rx_cplt_callback)(spi_handle_t *p_spi); /**< SPI rx transfer completed callback */ + void (*spi_tx_cplt_callback)(spi_handle_t *p_spi); /**< SPI tx transfer completed callback */ + void (*spi_tx_rx_cplt_callback)(spi_handle_t *p_spi); /**< SPI tx/rx transfer completed callback */ +} hal_spi_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_SPI_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup SPI_Exported_Constants SPI Exported Constants + * @{ + */ + +/** @defgroup SPI_Direction SPI Direction + * @{ + */ +#define SPI_DIRECTION_FULL_DUPLEX LL_SSI_FULL_DUPLEX /**< Full Duplex: Transmit & Receive */ +#define SPI_DIRECTION_SIMPLEX_TX LL_SSI_SIMPLEX_TX /**< Simplex Tx: Transmit only */ +#define SPI_DIRECTION_SIMPLEX_RX LL_SSI_SIMPLEX_RX /**< Simplex Rx: Receive only */ +#define SPI_DIRECTION_READ_EEPROM LL_SSI_READ_EEPROM /**< Read EEPROM */ +/** @} */ + +/** @defgroup SPI_Error_Code SPI Error Code + * @{ + */ +#define HAL_SPI_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_SPI_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_SPI_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_SPI_ERROR_DMA ((uint32_t)0x00000004) /**< DMA transfer error */ +#define HAL_SPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameters error */ +/** @} */ + +/** @defgroup SPI_Data_Size SPI Data Size + * @{ + */ +#define SPI_DATASIZE_4BIT LL_SSI_DATASIZE_4BIT /**< 4-bit serial data transfer */ +#define SPI_DATASIZE_5BIT LL_SSI_DATASIZE_5BIT /**< 5-bit serial data transfer */ +#define SPI_DATASIZE_6BIT LL_SSI_DATASIZE_6BIT /**< 6-bit serial data transfer */ +#define SPI_DATASIZE_7BIT LL_SSI_DATASIZE_7BIT /**< 7-bit serial data transfer */ +#define SPI_DATASIZE_8BIT LL_SSI_DATASIZE_8BIT /**< 8-bit serial data transfer */ +#define SPI_DATASIZE_9BIT LL_SSI_DATASIZE_9BIT /**< 9-bit serial data transfer */ +#define SPI_DATASIZE_10BIT LL_SSI_DATASIZE_10BIT /**< 10-bit serial data transfer */ +#define SPI_DATASIZE_11BIT LL_SSI_DATASIZE_11BIT /**< 11-bit serial data transfer */ +#define SPI_DATASIZE_12BIT LL_SSI_DATASIZE_12BIT /**< 12-bit serial data transfer */ +#define SPI_DATASIZE_13BIT LL_SSI_DATASIZE_13BIT /**< 13-bit serial data transfer */ +#define SPI_DATASIZE_14BIT LL_SSI_DATASIZE_14BIT /**< 14-bit serial data transfer */ +#define SPI_DATASIZE_15BIT LL_SSI_DATASIZE_15BIT /**< 15-bit serial data transfer */ +#define SPI_DATASIZE_16BIT LL_SSI_DATASIZE_16BIT /**< 16-bit serial data transfer */ +#define SPI_DATASIZE_17BIT LL_SSI_DATASIZE_17BIT /**< 17-bit serial data transfer */ +#define SPI_DATASIZE_18BIT LL_SSI_DATASIZE_18BIT /**< 18-bit serial data transfer */ +#define SPI_DATASIZE_19BIT LL_SSI_DATASIZE_19BIT /**< 19-bit serial data transfer */ +#define SPI_DATASIZE_20BIT LL_SSI_DATASIZE_20BIT /**< 20-bit serial data transfer */ +#define SPI_DATASIZE_21BIT LL_SSI_DATASIZE_21BIT /**< 21-bit serial data transfer */ +#define SPI_DATASIZE_22BIT LL_SSI_DATASIZE_22BIT /**< 22-bit serial data transfer */ +#define SPI_DATASIZE_23BIT LL_SSI_DATASIZE_23BIT /**< 23-bit serial data transfer */ +#define SPI_DATASIZE_24BIT LL_SSI_DATASIZE_24BIT /**< 24-bit serial data transfer */ +#define SPI_DATASIZE_25BIT LL_SSI_DATASIZE_25BIT /**< 25-bit serial data transfer */ +#define SPI_DATASIZE_26BIT LL_SSI_DATASIZE_26BIT /**< 26-bit serial data transfer */ +#define SPI_DATASIZE_27BIT LL_SSI_DATASIZE_27BIT /**< 27-bit serial data transfer */ +#define SPI_DATASIZE_28BIT LL_SSI_DATASIZE_28BIT /**< 28-bit serial data transfer */ +#define SPI_DATASIZE_29BIT LL_SSI_DATASIZE_29BIT /**< 29-bit serial data transfer */ +#define SPI_DATASIZE_30BIT LL_SSI_DATASIZE_30BIT /**< 30-bit serial data transfer */ +#define SPI_DATASIZE_31BIT LL_SSI_DATASIZE_31BIT /**< 31-bit serial data transfer */ +#define SPI_DATASIZE_32BIT LL_SSI_DATASIZE_32BIT /**< 32-bit serial data transfer */ +/** @} */ + +/** @defgroup SPI_Clock_Polarity SPI Clock Polarity + * @{ + */ +#define SPI_POLARITY_LOW LL_SSI_SCPOL_LOW /**< Inactive state of CLK is low */ +#define SPI_POLARITY_HIGH LL_SSI_SCPOL_HIGH /**< Inactive state of CLK is high */ +/** @} */ + +/** @defgroup SPI_Clock_Phase SPI Clock Phase + * @{ + */ +#define SPI_PHASE_1EDGE LL_SSI_SCPHA_1EDGE /**< CLK toggles at start of first data bit */ +#define SPI_PHASE_2EDGE LL_SSI_SCPHA_2EDGE /**< CLK toggles in middle of first data bit */ +/** @} */ + +/** @defgroup SPI_TI_Mode SPI TI Mode + * @{ + */ +#define SPI_TIMODE_DISABLE ((uint32_t)0x00000000) /**< SPI TI mode disable */ +#define SPI_TIMODE_ENABLE LL_SSI_PROTOCOL_TI /**< SPI TI mode enable */ +/** @} */ + +/** @defgroup SPI_Slave_Select SPI Slave Select + * @{ + */ +#define SPI_SLAVE_SELECT_0 LL_SSI_SLAVE0 /**< SPIM Select Slave 0 */ +#define SPI_SLAVE_SELECT_1 LL_SSI_SLAVE1 /**< SPIM Select Slave 1 */ +#define SPI_SLAVE_SELECT_ALL (LL_SSI_SLAVE0 | LL_SSI_SLAVE1) /**< SPIM Select All Slave */ +/** @} */ + +/** @defgroup SPI_FIFO_LEVEL_MAX SPI FIFO Level Max + * @{ + */ +#define SPI_TX_FIFO_LEVEL_MAX 8 /**< SPI TX FIFO Level Max Value */ +#define SPI_RX_FIFO_LEVEL_MAX 8 /**< SPI RX FIFO Level Max Value */ +/** @} */ + +/** @defgroup SPI_Flags_definition SPI Flags Definition + * @{ + */ +#define SPI_FLAG_DCOL LL_SSI_SR_DCOL /**< Data collision error flag */ +#define SPI_FLAG_TXE LL_SSI_SR_TXE /**< Transmission error flag */ +#define SPI_FLAG_RFF LL_SSI_SR_RFF /**< Rx FIFO full flag */ +#define SPI_FLAG_RFNE LL_SSI_SR_RFNE /**< Rx FIFO not empty flag */ +#define SPI_FLAG_TFE LL_SSI_SR_TFE /**< Tx FIFO empty flag */ +#define SPI_FLAG_TFNF LL_SSI_SR_TFNF /**< Tx FIFO not full flag */ +#define SPI_FLAG_BUSY LL_SSI_SR_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup SPI_Interrupt_definition SPI Interrupt Definition + * @{ + */ +#define SPI_IT_MST LL_SSI_IS_MST /**< Multi-Master Contention Interrupt flag */ +#define SPI_IT_RXF LL_SSI_IS_RXF /**< Receive FIFO Full Interrupt flag */ +#define SPI_IT_RXO LL_SSI_IS_RXO /**< Receive FIFO Overflow Interrupt flag */ +#define SPI_IT_RXU LL_SSI_IS_RXU /**< Receive FIFO Underflow Interrupt flag */ +#define SPI_IT_TXO LL_SSI_IS_TXO /**< Transmit FIFO Overflow Interrupt flag */ +#define SPI_IT_TXE LL_SSI_IS_TXE /**< Transmit FIFO Empty Interrupt flag */ +/** @} */ + +/** @defgroup SPI_Timeout_definition SPI Timeout_definition + * @{ + */ +#define HAL_SPI_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup SPI_Exported_Macros SPI Exported Macros + * @{ + */ + +/** @brief Reset SPI handle states. + * @param __HANDLE__ SPI handle. + * @retval None + */ +#define __HAL_SPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_SPI_STATE_RESET) + +/** @brief Enable the specified SPI peripheral. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN) + +/** @brief Disable the specified SPI peripheral. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->SSI_EN, SSI_SSIEN_EN) + +/** @brief Enable the SPI DMA TX Request. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_ENABLE_DMATX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE) + +/** @brief Enable the SPI DMA RX Request. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_ENABLE_DMARX(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE) + +/** @brief Disable the SPI DMA TX Request. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_DISABLE_DMATX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_TDMAE) + +/** @brief Disable the SPI DMA RX Request. + * @param __HANDLE__ Specifies the SPI Handle. + * @retval None + */ +#define __HAL_SPI_DISABLE_DMARX(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->DMAC, SSI_DMAC_RDMAE) + +/** @brief Enable the specified SPI interrupts. + * @param __HANDLE__ Specifies the SPI Handle. + * @param __INTERRUPT__ Specifies the interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref SPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref SPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref SPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref SPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval None + */ +#define __HAL_SPI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__)) + +/** @brief Disable the specified SPI interrupts. + * @param __HANDLE__ Specifies the SPI handle. + * @param __INTERRUPT__ Specifies the interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref SPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref SPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref SPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref SPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval None + */ +#define __HAL_SPI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BITS((__HANDLE__)->p_instance->INTMASK, (__INTERRUPT__)) + +/** @brief Check whether the specified SPI interrupt source is enabled or not. + * @param __HANDLE__ Specifies the SPI Handle. + * @param __INTERRUPT__ Specifies the interrupt source to check. + * This parameter can be one of the following values: + * @arg @ref SPI_IT_MST Multi-Master Contention Interrupt enable + * @arg @ref SPI_IT_RXF Receive FIFO Full Interrupt enable + * @arg @ref SPI_IT_RXO Receive FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_RXU Receive FIFO Underflow Interrupt enable + * @arg @ref SPI_IT_TXO Transmit FIFO Overflow Interrupt enable + * @arg @ref SPI_IT_TXE Transmit FIFO Empty Interrupt enable + * @retval The new state of __IT__ (TRUE or FALSE). + */ +#define __HAL_SPI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (READ_BITS((__HANDLE__)->p_instance->INTSTAT, (__INTERRUPT__)) == (__INTERRUPT__)) + +/** @brief Check whether the specified SPI flag is set or not. + * @param __HANDLE__ Specifies the SPI Handle. + * @param __FLAG__ Specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref SPI_FLAG_DCOL Data collision error flag + * @arg @ref SPI_FLAG_TXE Transmission error flag + * @arg @ref SPI_FLAG_RFF Rx FIFO full flag + * @arg @ref SPI_FLAG_RFNE Rx FIFO not empty flag + * @arg @ref SPI_FLAG_TFE Tx FIFO empty flag + * @arg @ref SPI_FLAG_TFNF Tx FIFO not full flag + * @arg @ref SPI_FLAG_BUSY Busy flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_SPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) != 0) ? SET : RESET) + +/** @brief Clear the specified SPI flag. + * @param __HANDLE__ Specifies the SPI Handle. + * @param __FLAG__ Specifies the flag to clear. + * This parameter can be one of the following values: + * @arg @ref SPI_FLAG_DCOL Data collision error flag + * @arg @ref SPI_FLAG_TXE Transmission error flag + * @arg @ref SPI_FLAG_RFF Rx FIFO full flag + * @arg @ref SPI_FLAG_RFNE Rx FIFO not empty flag + * @arg @ref SPI_FLAG_TFE Tx FIFO empty flag + * @arg @ref SPI_FLAG_TFNF Tx FIFO not full flag + * @arg @ref SPI_FLAG_BUSY Busy flag + * @retval None + */ +#define __HAL_SPI_CLEAR_FLAG(__HANDLE__, __FLAG__) READ_BITS((__HANDLE__)->p_instance->STAT, (__FLAG__)) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup SPI_Private_Macro SPI Private Macros + * @{ + */ + +/** @brief Check if SPI Direction Mode is valid. + * @param __MODE__ SPI Direction Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_SPI_DIRECTION(__MODE__) (((__MODE__) == SPI_DIRECTION_FULL_DUPLEX) || \ + ((__MODE__) == SPI_DIRECTION_SIMPLEX_TX) || \ + ((__MODE__) == SPI_DIRECTION_SIMPLEX_RX) || \ + ((__MODE__) == SPI_DIRECTION_READ_EEPROM)) + +/** @brief Check if SPI Data Size is valid. + * @param __DATASIZE__ SPI Data Size. + * @retval SET (__DATASIZE__ is valid) or RESET (__DATASIZE__ is invalid) + */ +#define IS_SPI_DATASIZE(__DATASIZE__) (((__DATASIZE__) >= SPI_DATASIZE_4BIT) && \ + ((__DATASIZE__) <= SPI_DATASIZE_32BIT)) + +/** @brief Check if SPI Clock Polarity is valid. + * @param __CPOL__ SPI Clock Polarity. + * @retval SET (__CPOL__ is valid) or RESET (__CPOL__ is invalid) + */ +#define IS_SPI_CPOL(__CPOL__) (((__CPOL__) == SPI_POLARITY_LOW) || \ + ((__CPOL__) == SPI_POLARITY_HIGH)) + +/** @brief Check if SPI Clock Phase is valid. + * @param __CPHA__ SPI Clock Phase. + * @retval SET (__CPHA__ is valid) or RESET (__CPHA__ is invalid) + */ +#define IS_SPI_CPHA(__CPHA__) (((__CPHA__) == SPI_PHASE_1EDGE) || \ + ((__CPHA__) == SPI_PHASE_2EDGE)) + +/** @brief Check if SPI BaudRate Prescaler is valid. + * @param __PRESCALER__ SPI BaudRate Prescaler. + * @retval SET (__PRESCALER__ is valid) or RESET (__PRESCALER__ is invalid) + */ +#define IS_SPI_BAUDRATE_PRESCALER(__PRESCALER__) ((__PRESCALER__) <= 0xFFFF) + +/** @brief Check if SPI TI Mode is valid. + * @param __MODE__ SPI TI Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_SPI_TIMODE(__MODE__) (((__MODE__) == SPI_TIMODE_DISABLE) || \ + ((__MODE__) == SPI_TIMODE_ENABLE)) + +/** @brief Check if SPI Slave Select is valid. + * @param __SLAVE__ SPI Slave Select. + * @retval SET (__SLAVE__ is valid) or RESET (__SLAVE__ is invalid) + */ +#define IS_SPI_SLAVE(__SLAVE__) (((__SLAVE__) == SPI_SLAVE_SELECT_0) || \ + ((__SLAVE__) == SPI_SLAVE_SELECT_1) || \ + ((__SLAVE__) == SPI_SLAVE_SELECT_ALL)) + +/** @brief Check if SPI Receive Sample Delay Value is valid. + * @param __DLY__ SPI Receive Sample Delay Value + * @retval SET (__DLY__ is valid) or RESET (__DLY__ is invalid) + */ +#define IS_SPI_RX_SAMPLE_DLY(__DLY__) (((__DLY__) >= 0) && ((__DLY__) <= 7)) + + +/** @brief Check if SPI FIFO Threshold is valid. + * @param __THR__ SPI FIFO Threshold. + * @retval SET (__THR__ is valid) or RESET (__THR__ is invalid) + */ +#define IS_SPI_FIFO_THRESHOLD(__THR__) (((__THR__) >= 0) && ((__THR__) <= 7)) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_SPI_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup SPI_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the SPIx peripheral: + + (+) User must implement hal_spi_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_spi_init() to configure the selected device with + the selected configuration: + (++) Direction + (++) Data Size + (++) Clock Polarity and Phase + (++) BaudRate Prescaler + (++) TIMode + (++) Slave Select + + (+) Call the function hal_spi_deinit() to restore the default configuration + of the selected SPIx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the SPI according to the specified parameters + * in the spi_init_t and initialize the associated handle. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_init(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief De-initialize the SPI peripheral. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_deinit(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Initialize the SPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_spi_msp_deinit can be implemented in the user file. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_msp_init(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief De-initialize the SPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_spi_msp_deinit can be implemented in the user file. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_msp_deinit(spi_handle_t *p_spi); + +/** @} */ + +/** @defgroup SPI_Exported_Functions_Group2 IO operation functions + * @brief Data transfer functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the SPI + data transfer. + + [..] The SPI supports master and slave mode: + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts + or DMA, These APIs return the HAL status. + The end of the data processing will be indicated through the + dedicated SPI IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_spi_tx_cplt_callback(), hal_spi_rx_cplt_callback() and hal_spi_txrx_cplt_callback() user callbacks + will be executed respectively at the end of the transmit or Receive process + The hal_spi_error_callback() user callback will be executed when a communication error is detected. + + (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) + exist for 1-Line (simplex) and 2-Line (full duplex) modes. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_receive(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in blocking mode. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_receive(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in blocking mode. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_number_data: Amount of data to be sent in bytes + * @param[in] rx_number_data: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_read_eeprom(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with Interrupt. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_receive_it(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with Interrupt. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent and received in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_receive_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with Interrupt. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_number_data: Amount of data to be sent in bytes + * @param[in] rx_number_data: Amount of data to be received in bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_read_eeprom_it(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with DMA. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in non-blocking mode with DMA. + * @note In case of MASTER mode and SPI_DIRECTION_2LINES direction, p_dmatx shall be defined. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_receive_dma(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit and Receive an amount of data in non-blocking mode with DMA. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_receive_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Read an amount of data from EEPROM in non-blocking mode with DMA. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_tx_data: Pointer to transmission data buffer + * @param[out] p_rx_data: Pointer to reception data buffer + * @param[in] tx_number_data: Amount of data to be sent in bytes + * @param[in] rx_number_data: Amount of data to be received in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_read_eeprom_dma(spi_handle_t *p_spi, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_number_data, uint32_t rx_number_data); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (blocking mode). + * @param[in] p_spi: SPI handle. + * @note This procedure could be used for aborting any ongoing transfer (Tx and Rx), + * started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable SPI Interrupts (depending of transfer direction) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_abort(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (Interrupt mode). + * @param[in] p_spi: SPI handle. + * @note This procedure could be used for aborting any ongoing transfer (Tx and Rx), + * started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable SPI Interrupts (depending of transfer direction) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode) + * - Set handle State to READY + * - At abort completion, call user abort complete callback + * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be + * considered as completed only when user abort complete callback is executed (not when exiting function). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_abort_it(spi_handle_t *p_spi); + +/** @} */ + +/** @addtogroup SPI_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle SPI interrupt request. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_irq_handler(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Tx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_tx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Rx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_rx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Tx and Rx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_tx_rx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief SPI error callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_error_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief SPI Abort Completed callback. + * @param[in] p_spi: SPI handle. + **************************************************************************************** + */ +void hal_spi_abort_cplt_callback(spi_handle_t *p_spi); + +/** @} */ + +/** @defgroup SPI_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief SPI control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the SPI. + (+) hal_spi_get_state() API can be helpful to check in run-time the state of the SPI peripheral + (+) hal_spi_get_error() check in run-time Errors occurring during communication + (+) hal_spi_set_timeout() set the timeout during internal process + (+) hal_spi_set_tx_fifo_threshold() set the TX FIFO Threshold + (+) hal_spi_set_rx_fifo_threshold() set the RX FIFO Threshold + (+) hal_spi_get_tx_fifo_threshold() get the TX FIFO Threshold + (+) hal_spi_get_rx_fifo_threshold() get the RX FIFO Threshold +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the SPI handle state. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @retval ::HAL_SPI_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_SPI_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_SPI_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_TX: Data Transmission process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_RX: Data Reception process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_TX_RX: Data Transmission and Reception process is ongoing. + * @retval ::HAL_SPI_STATE_ABORT: Peripheral with abort request ongoing. + * @retval ::HAL_SPI_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_spi_state_t hal_spi_get_state(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Return the SPI error code. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return SPI error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_spi_get_error(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Set the SPI internal process timeout value. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] timeout: Internal process timeout value. + **************************************************************************************** + */ +void hal_spi_set_timeout(spi_handle_t *p_spi, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Set the TX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] threshold: TX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_set_tx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Set the RX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] threshold: RX FIFO threshold value ranging bwtween 0x0U ~ 0x7U. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_set_rx_fifo_threshold(spi_handle_t *p_spi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Get the TX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return TX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_spi_get_tx_fifo_threshold(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Get the RX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return RX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_spi_get_rx_fifo_threshold(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Suspend some registers related to SPI configuration before sleep. + * @param[in] p_spi: Pointer to a SPI handle which contains the configuration + * information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_suspend_reg(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Restore some registers related to SPI configuration after sleep. + * This function must be used in conjunction with the hal_spi_suspend_reg(). + * @param[in] p_spi: Pointer to a SPI handle which contains the configuration + * information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_resume_reg(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with polling. Support Setting C&A + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: 1 byte instruction + * @param[in] addr: 3 bytes address + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @param[in] timeout: Timeout duration + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_with_ia(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in non-blocking mode with DMA. Support Setting C&A + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: 1 byte instruction + * @param[in] addr: 3 bytes address + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes, ranging between 0 and 4095. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_transmit_dma_with_ia(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_SPI_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi_v2.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi_v2.h new file mode 100644 index 0000000..0e3b0fb --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_spi_v2.h @@ -0,0 +1,613 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_spi_v2.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of SPI HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2020 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_SPI SPI + * @brief SPI HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_SPI_V2_H__ +#define __GR55xx_HAL_SPI_V2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_spi.h" +#include "gr55xx_hal_def.h" +#include "gr55xx_hal_dma.h" +#include "gr55xx_hal_spi.h" + +/** + * @defgroup HAL_SPI_MACRO Defines + * @{ + */ +#define SPI_XFER_INST_NONE 0xFF /**< SPI XFER Instruction None. */ +#define SPI_XFER_ADDR_NONE 0xFFFFFF /**< SPI XFER Address None. */ +#define SPI_XFER_INST_ADDR_NONE 0xFFFFFFFF /**< SPI XFER Instruction Address None. */ +/** @} */ + + +/** @addtogroup HAL_SPI_DRIVER_FUNCTIONS Functions + * @{ + */ + /** @defgroup SPI_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the SPIx peripheral: + + (+) User must implement hal_spi_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_spi_init() to configure the selected device with + the selected configuration: + (++) Direction + (++) Data Size + (++) Clock Polarity and Phase + (++) BaudRate Prescaler + (++) TIMode + (++) Slave Select + + (+) Call the function hal_spi_deinit() to restore the default configuration + of the selected SPIx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the SPI according to the specified parameters + * in the spi_init_t and initialize the associated handle. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] rx_sample_delay: Receive sample delay [0, 7] + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_init(spi_handle_t *p_spi, uint32_t rx_sample_delay); + +/** + **************************************************************************************** + * @brief De-initialize the SPI peripheral. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_deinit(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Initialize the SPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_spi_msp_deinit can be implemented in the user file. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_msp_init(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief De-initialize the SPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_spi_msp_deinit can be implemented in the user file. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_msp_deinit(spi_handle_t *p_spi); +/** @} */ + +/** + **************************************************************************************** + * @brief set receive sample delay + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] rx_delay: 0 ~ 7. + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +void hal_spi_v2_set_rx_delay(spi_handle_t *p_spi, uint32_t rx_delay); + + +/** @defgroup SPI_Exported_Functions_Group2 IO operation functions + * @brief Data transfer functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the SPI + data transfer. + + [..] The SPI supports master and slave mode: + + (#) There are two modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) No-Blocking mode: The communication is performed using Interrupts + or DMA, These APIs return the HAL status. + The end of the data processing will be indicated through the + dedicated SPI IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_spi_tx_cplt_callback(), hal_spi_rx_cplt_callback() and hal_spi_txrx_cplt_callback() user callbacks + will be executed respectively at the end of the transmit or Receive process + The hal_spi_error_callback() user callback will be executed when a communication error is detected. + + (#) APIs provided for these 2 transfer modes (Blocking mode or Non blocking mode using either Interrupt or DMA) + exist for 1-Line (simplex) and 2-Line (full duplex) modes. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode with 8bit data width, and CS Signal will be assert/de-assert in every byte. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_8bit_toggle(spi_handle_t *p_spi, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode with 8bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_8bit(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode with 8bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_receive_8bit(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit Then Receive an amount of data in blocking mode with 8bit data width. + * This Function works at EEPROM Read Mode, not Full duplex Mode + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] tx_data: Pointer to transmit data buffer + * @param[in] tx_length: Amount of data to be transmited in bytes + * @param[in] rx_data: Pointer to received data buffer + * @param[in] rx_length: Amount of data to be received in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_receive_8bit(spi_handle_t *p_spi, uint8_t *tx_data, uint32_t tx_length, uint8_t *rx_data, uint32_t rx_length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode with 32bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_32bit(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout); + + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode with 32bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] timeout: Timeout duration + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_receive_32bit(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in DMA mode with 8bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_8bit_dma(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in DMA mode with 8bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_receive_8bit_dma(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Transmit an amount of data in DMA mode with 32bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_tx_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_32bit_dma(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_tx_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Receive an amount of data in DMA mode with 32bit data width. + * if set inst to SPI_XFER_INST_NONE or set addr to SPI_XFER_ADDR_NONE, inst & addr won't be used in transfer + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] inst: Instruction used in transfer + * @param[in] addr: Address used in transfer + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_receive_32bit_dma(spi_handle_t *p_spi, uint8_t inst, uint32_t addr, uint8_t *p_data, uint32_t length); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (blocking mode). + * @param[in] p_spi: SPI handle. + * @note This procedure could be used for aborting any ongoing transfer (Tx and Rx), + * started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable SPI Interrupts (depending of transfer direction) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_abort(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Abort ongoing transfer (Interrupt mode). + * @param[in] p_spi: SPI handle. + * @note This procedure could be used for aborting any ongoing transfer (Tx and Rx), + * started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable SPI Interrupts (depending of transfer direction) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode) + * - Set handle State to READY + * - At abort completion, call user abort complete callback + * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be + * considered as completed only when user abort complete callback is executed (not when exiting function). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_abort_it(spi_handle_t *p_spi); +/** @} */ + + +/** @addtogroup SPI_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle SPI interrupt request. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_irq_handler(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Tx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_tx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Rx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_rx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Tx and Rx Transfer completed callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_tx_rx_cplt_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief SPI error callback. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + **************************************************************************************** + */ +void hal_spi_v2_error_callback(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief SPI Abort Completed callback. + * @param[in] p_spi: SPI handle. + **************************************************************************************** + */ +void hal_spi_v2_abort_cplt_callback(spi_handle_t *p_spi); + +/** @} */ + +/** @defgroup SPI_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief SPI control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the SPI. + (+) hal_spi_get_state() API can be helpful to check in run-time the state of the SPI peripheral + (+) hal_spi_get_error() check in run-time Errors occurring during communication + (+) hal_spi_set_timeout() set the timeout during internal process + (+) hal_spi_get_tx_fifo_threshold() get the TX FIFO Threshold + (+) hal_spi_get_rx_fifo_threshold() get the RX FIFO Threshold +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the SPI handle state. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @retval ::HAL_SPI_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_SPI_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_SPI_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_TX: Data Transmission process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_RX: Data Reception process is ongoing. + * @retval ::HAL_SPI_STATE_BUSY_TX_RX: Data Transmission and Reception process is ongoing. + * @retval ::HAL_SPI_STATE_ABORT: Peripheral with abort request ongoing. + * @retval ::HAL_SPI_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_spi_state_t hal_spi_v2_get_state(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Return the SPI error code. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return SPI error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_spi_v2_get_error(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Set the SPI internal process timeout value. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @param[in] timeout: Internal process timeout value. + **************************************************************************************** + */ +void hal_spi_v2_set_timeout(spi_handle_t *p_spi, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Get the TX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return TX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_spi_v2_get_tx_fifo_threshold(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Get the RX FIFO threshold. + * @param[in] p_spi: Pointer to an SPI handle which contains the configuration information for the specified SPI module. + * @return RX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_spi_v2_get_rx_fifo_threshold(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Suspend some registers related to SPI configuration before sleep. + * @param[in] p_spi: Pointer to a SPI handle which contains the configuration + * information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_suspend_reg(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Restore some registers related to SPI configuration after sleep. + * This function must be used in conjunction with the hal_spi_suspend_reg(). + * @param[in] p_spi: Pointer to a SPI handle which contains the configuration + * information for the specified SPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_resume_reg(spi_handle_t *p_spi); + +/** + **************************************************************************************** + * @brief Using DMA to Transmit data by toggling CS in every data beat. + * + * @param[in] p_spi: Pointer to a SPI handle which contains the configuration + * information for the specified SPI module. + * @param[in] data_size: Optional value - @ref SPI_DATASIZE_8BIT @ref SPI_DATASIZE_16BIT @ref SPI_DATASIZE_32BIT + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Length of data to be sent + * + * @return Result of operation. + **************************************************************************************** + */ +hal_status_t hal_spi_v2_transmit_dma_with_toggle(spi_handle_t *p_spi, uint32_t data_size, uint8_t *p_data, uint32_t length); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_SPI_V2_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_tim.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_tim.h new file mode 100644 index 0000000..0b269a3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_tim.h @@ -0,0 +1,417 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_tim.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of TIMER HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_TIMER TIMER + * @brief TIM HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_TIMER_H__ +#define __GR55xx_HAL_TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal_def.h" +#include "gr55xx_ll_tim.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_TIMER_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_TIMER_state HAL TIMER state + * @{ + */ + +/** + * @brief HAL TIMER State Enumerations definition + */ +typedef enum +{ + HAL_TIMER_STATE_RESET = 0x00, /**< Peripheral not yet initialized or disabled */ + HAL_TIMER_STATE_READY = 0x01, /**< Peripheral Initialized and ready for use */ + HAL_TIMER_STATE_BUSY = 0x02, /**< An internal process is ongoing */ + HAL_TIMER_STATE_ERROR = 0x04 /**< Reception process is ongoing */ +} hal_timer_state_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_TIMER_STRUCTURES Structures + * @{ + */ + +/** @defgroup TIMER_Configuration TIMER Configuration + * @{ + */ + +/** + * @brief TIMER init Structure definition + */ +typedef struct _timer_init +{ + uint32_t auto_reload; /**< Specifies the auto-reload value. */ + +} timer_init_t; + +/** @} */ + +/** @defgroup TIMER_handle TIMER handle + * @{ + */ + +/** + * @brief TIMER handle Structure definition + */ +typedef struct _timer_handle +{ + timer_regs_t *p_instance; /**< Register base address */ + + timer_init_t init; /**< TIMER Base required parameters */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_timer_state_t state; /**< TIMER operation state */ + +} timer_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_TIMER_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_TIMER_Callback Callback + * @{ + */ + +/** + * @brief HAL_TIMER Callback function definition + */ + +typedef struct _hal_timer_callback +{ + void (*timer_msp_init)(timer_handle_t *p_timer); /**< TIMER init MSP callback */ + void (*timer_msp_deinit)(timer_handle_t *p_timer); /**< TIMER de-init MSP callback */ + void (*timer_period_elapsed_callback)(timer_handle_t *p_timer); /**< TIMER period elapsed callback */ +} hal_timer_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_TIMER_MACRO Defines + * @{ + */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup TIMER_Exported_Macros TIMER Exported Macros + * @{ + */ + +/** @brief Reset TIMER handle states. + * @param __HANDLE__ TIMER handle. + * @retval None + */ +#define __HAL_TIMER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_TIMER_STATE_RESET) + +/** @brief Enable the specified TIMER peripheral. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval None + */ +#define __HAL_TIMER_ENABLE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN) + +/** @brief Disable the specified TIMER peripheral. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval None + */ +#define __HAL_TIMER_DISABLE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_EN) + +/** @brief Enable the TIMER interrupt. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval None + */ +#define __HAL_TIMER_ENABLE_IT(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_INTEN) + +/** @brief Disable the TIMER interrupt. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval None + */ +#define __HAL_TIMER_DISABLE_IT(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CTRL, TIMER_CTRL_INTEN) + +/** @brief Check whether the TIMER interrupt has occurred or not. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval The new state of TIMER interrupt (SET or RESET). + */ +#define __HAL_TIMER_GET_FLAG_IT(__HANDLE__) ll_timer_is_active_flag_it(__HANDLE__->p_instance) + +/** @brief Clear the TIMER interrupt flag. + * @param __HANDLE__ Specifies the TIMER Handle. + * @retval None + */ +#define __HAL_TIMER_CLEAR_FLAG_IT(__HANDLE__) ll_timer_clear_flag_it(__HANDLE__->p_instance) + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_TIMER_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup TIMER_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * + * @verbatim +=============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and configure the TIMER. + (+) De-initialize the TIMER. + (+) Start the Timer. + (+) Stop the Timer. + (+) Start the Timer and enable interrupt. + (+) Stop the Timer and disable interrupt. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the TIMER according to the specified parameters + * in the timer_init_t and initialize the associated handle. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_init(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief De-initialize the TIMER peripheral. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_deinit(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Initialize the TIMER MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_timer_base_msp_init could be implemented in the user file. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + **************************************************************************************** + */ +void hal_timer_base_msp_init(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief De-initialize the TIMER MSP. + * @note This function should not be modified. When the callback is needed, + * the hal_timer_base_msp_deinit could be implemented in the user file. + * @param[in] p_timer: Pointer to a TIM handle which contains the configuration + * information for the specified TIMER module. + **************************************************************************************** + */ +void hal_timer_base_msp_deinit(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Starts the TIMER counter. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_start(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Stops the TIMER counter. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_stop(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Starts the TIMER counter in interrupt mode. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_start_it(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Stops the TIMER counter in interrupt mode. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_base_stop_it(timer_handle_t *p_timer); + +/** @} */ + +/** @addtogroup TIMER_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle TIMER interrupt request. + * @param[in] p_timer: TIMER handle. + **************************************************************************************** + */ +void hal_timer_irq_handler(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief Period elapsed callback in non-blocking mode. + * @note This function should not be modified. When the callback is needed, + the hal_timer_period_elapsed_callback can be implemented in the user file. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + **************************************************************************************** + */ +void hal_timer_period_elapsed_callback(timer_handle_t *p_timer); + +/** @} */ + +/** @addtogroup TIMER_Exported_Functions_Group2 Peripheral Control and State functions + * @brief TIMER Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral Control and State functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) Return the TIMER handle state. + (+) Configure the TIMER. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the TIMER handle state. + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @retval ::HAL_TIMER_STATE_RESET: Peripheral not yet initialized or disabled. + * @retval ::HAL_TIMER_STATE_READY: Peripheral Initialized and ready for use. + * @retval ::HAL_TIMER_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_TIMER_STATE_ERROR: Reception process is ongoing. + **************************************************************************************** + */ +hal_timer_state_t hal_timer_get_state(timer_handle_t *p_timer); + +/** + **************************************************************************************** + * @brief TIMER configuration + * @param[in] p_timer: Pointer to a TIMER handle which contains the configuration + * information for the specified TIMER module. + * @param[in] p_structure: The TIMER configuration structure + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_timer_set_config(timer_handle_t *p_timer, timer_init_t *p_structure); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_TIMER_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_uart.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_uart.h new file mode 100644 index 0000000..ce3188f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_uart.h @@ -0,0 +1,1045 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_uart.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of UART HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_UART UART + * @brief UART HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_UART_H__ +#define __GR55xx_HAL_UART_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_uart.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_UART_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_UART_state HAL UART state + * @{ + */ + +/** + * @brief HAL UART State enumerations definition + * @note HAL UART State value is a combination of 2 different substates: gState and RxState. + */ +typedef enum +{ + HAL_UART_STATE_RESET = 0x00U, /**< Peripheral is not initialized. + Value is allowed for gState and RxState */ + + HAL_UART_STATE_READY = 0x10U, /**< Peripheral initialized and ready for use. + Value is allowed for gState and RxState */ + + HAL_UART_STATE_BUSY = 0x14U, /**< An internal process is ongoing. + Value is allowed for gState only */ + + HAL_UART_STATE_BUSY_TX = 0x11U, /**< Data Transmission process is ongoing. + Value is allowed for gState only */ + + HAL_UART_STATE_BUSY_RX = 0x12U, /**< Data Reception process is ongoing. + Value is allowed for RxState only */ + + HAL_UART_STATE_BUSY_TXRX = 0x13U, /**< Data Transmission and Reception process is ongoing. + Value is allowed for gState only */ + + HAL_UART_STATE_TIMEOUT = 0x30U, /**< Timeout state. + Value is allowed for gState only */ + + HAL_UART_STATE_ERROR = 0x70U /**< Error. + Value is allowed for gState only */ + +} hal_uart_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_UART_STRUCTURES Structures + * @{ + */ + +/** @defgroup UART_Configuration UART Configuration + * @{ + */ + +/** + * @brief UART init structure definition + */ +typedef struct _uart_init +{ + uint32_t baud_rate; /**< This member configures the UART communication baud rate. */ + + uint32_t data_bits; /**< Specifies the number of data bits transmitted or received in a frame. + This parameter can be a value of @ref UART_Data_Bits. */ + + uint32_t stop_bits; /**< Specifies the number of stop bits transmitted. + This parameter can be a value of @ref UART_Stop_Bits. */ + + uint32_t parity; /**< Specifies the parity mode. + This parameter can be a value of @ref UART_Parity. */ + + uint32_t hw_flow_ctrl; /**< Specifies whether the hardware flow control mode is enabled or disabled. + This parameter can be a value of @ref UART_Hardware_Flow_Control. */ + + uint32_t rx_timeout_mode; /**< Specifies whether the receive timeout mode is enabled or disabled. + When rx_timeout_mode is enabled, character timeout interrupt will disable + current receive process after the data in RxFIFO is received, and call + hal_uart_rx_cplt_callback(). Note that the rx_timeout_mode only works + in interrupt mode. + This parameter can be a value of @ref UART_Receiver_TimeOut. */ + +} uart_init_t; +/** @} */ + +/** @defgroup UART_handle UART handle + * @{ + */ + +/** + * @brief UART handle Structure definition + */ +typedef struct _uart_handle +{ + uart_regs_t *p_instance; /**< UART registers base address */ + + uart_init_t init; /**< UART communication parameters */ + + uint8_t *p_tx_buffer; /**< Pointer to UART Tx transfer Buffer */ + + uint16_t tx_xfer_size; /**< UART Tx Transfer size */ + + __IO uint16_t tx_xfer_count; /**< UART Tx Transfer Counter */ + + uint8_t *p_rx_buffer; /**< Pointer to UART Rx transfer Buffer */ + + uint16_t rx_xfer_size; /**< UART Rx Transfer size */ + + __IO uint16_t rx_xfer_count; /**< UART Rx Transfer Counter */ + + dma_handle_t *p_dmatx; /**< UART Tx DMA Handle parameters */ + + dma_handle_t *p_dmarx; /**< UART Rx DMA Handle parameters */ + + functional_state_t dma_tx_mode; /**< UART Tx DMA mode state */ + + functional_state_t dma_rx_mode; /**< UART Rx DMA mode state */ + + hal_lock_t lock; /**< Locking object */ + + __IO hal_uart_state_t tx_state; /**< UART state information related to Tx operations. + This parameter can be a value of @ref hal_uart_state_t */ + + __IO hal_uart_state_t rx_state; /**< UART state information related to Rx operations. + This parameter can be a value of @ref hal_uart_state_t */ + + __IO uint32_t error_code; /**< UART Error code */ + + uint32_t retention[8]; /**< UART important register information. */ +} uart_handle_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_UART_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_UART_Callback Callback + * @{ + */ + +/** + * @brief HAL_UART Callback function definition + */ + +typedef struct _hal_uart_callback +{ + void (*uart_msp_init)(uart_handle_t *p_uart); /**< UART init MSP callback */ + void (*uart_msp_deinit)(uart_handle_t *p_uart); /**< UART de-init MSP callback */ + void (*uart_tx_cplt_callback)(uart_handle_t *p_uart); /**< UART tx transfer completed callback */ + void (*uart_rx_cplt_callback)(uart_handle_t *p_uart); /**< UART rx transfer completed callback */ + void (*uart_error_callback)(uart_handle_t *p_uart); /**< UART error callback */ + void (*uart_abort_cplt_callback)(uart_handle_t *p_uart); /**< UART abort completed callback */ + void (*uart_abort_tx_cplt_callback)(uart_handle_t *p_uart); /**< UART abort tansmit complete callback */ + void (*uart_abort_rx_cplt_callback)(uart_handle_t *p_uart); /**< UART abort receive complete callback */ +} hal_uart_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_UART_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup UART_Exported_Constants UART Exported Constants + * @{ + */ + +/** @defgroup UART_Error_Code UART Error Code + * @{ + */ +#define HAL_UART_ERROR_NONE (0x00000000U) /**< No error */ +#define HAL_UART_ERROR_PE LL_UART_LSR_PE /**< Parity error */ +#define HAL_UART_ERROR_FE LL_UART_LSR_FE /**< frame error */ +#define HAL_UART_ERROR_OE LL_UART_LSR_OE /**< Overrun error */ +#define HAL_UART_ERROR_BI LL_UART_LSR_BI /**< Break dection error */ +#define HAL_UART_ERROR_DMA (0x00000100U) /**< DMA transfer error */ +#define HAL_UART_ERROR_BUSY (0x00000200U) /**< Busy Error */ +/** @} */ + +/** @defgroup UART_Data_Bits UART Number of Data Bits + * @{ + */ +#define UART_DATABITS_5 LL_UART_DATABITS_5B /**< UART frame with 5 data bits */ +#define UART_DATABITS_6 LL_UART_DATABITS_6B /**< UART frame with 6 data bits */ +#define UART_DATABITS_7 LL_UART_DATABITS_7B /**< UART frame with 7 data bits */ +#define UART_DATABITS_8 LL_UART_DATABITS_8B /**< UART frame with 8 data bits */ +/** @} */ + +/** @defgroup UART_Stop_Bits UART Number of Stop Bits + * @{ + */ +#define UART_STOPBITS_1 LL_UART_STOPBITS_1 /**< UART frame with 1 stop bit */ +#define UART_STOPBITS_1_5 LL_UART_STOPBITS_1_5 /**< UART frame with 1.5 stop bits */ +#define UART_STOPBITS_2 LL_UART_STOPBITS_2 /**< UART frame with 2 stop bits */ +/** @} */ + +/** @defgroup UART_Parity UART Parity + * @{ + */ +#define UART_PARITY_NONE LL_UART_PARITY_NONE /**< No parity */ +#define UART_PARITY_ODD LL_UART_PARITY_ODD /**< Odd parity */ +#define UART_PARITY_EVEN LL_UART_PARITY_EVEN /**< Even parity */ +#define UART_PARITY_SP0 LL_UART_PARITY_SP0 /**< Stick Parity 0 */ +#define UART_PARITY_SP1 LL_UART_PARITY_SP1 /**< Stick Parity 1 */ +/** @} */ + +/** @defgroup UART_Hardware_Flow_Control UART Hardware Flow Control + * @{ + */ +#define UART_HWCONTROL_NONE LL_UART_HWCONTROL_NONE /**< No hardware control */ +#define UART_HWCONTROL_RTS_CTS LL_UART_HWCONTROL_RTS_CTS /**< Auto RTS and CTS hardware flow control */ +/** @} */ + +/** @defgroup UART_Receiver_TimeOut UART Receiver TimeOut + * @{ + */ +#define UART_RECEIVER_TIMEOUT_DISABLE (0x00000000U) /**< UART receiver timeout disable */ +#define UART_RECEIVER_TIMEOUT_ENABLE (0x00000001U) /**< UART receiver timeout enable */ +/** @} */ + +/** @defgroup UART_Interrupt_definition UART Interrupt_definition + * @{ + */ +#define UART_IT_MS LL_UART_IER_MS /**< Enable Modem Status Interrupt */ +#define UART_IT_RLS LL_UART_IER_RLS /**< Enable Receiver Line Status Interrupt */ +#define UART_IT_THRE LL_UART_IER_THRE /**< Enable Transmit Holding Register Empty Interrupt */ +#define UART_IT_RDA LL_UART_IER_RDA /**< Enable Received Data Available Interrupt and Character Timeout Interrupt */ +/** @} */ + +/** @defgroup UART_Request_Parameters UART Request Parameters + * @{ + */ +#define UART_RXDATA_FLUSH_REQUEST UART_SRR_RFR /**< RX FIFO flush Request */ +#define UART_TXDATA_FLUSH_REQUEST UART_SRR_XFR /**< TX FIFO flush Request */ +#define UART_TXRXDATA_FLUSH_REQUEST (UART_SRR_XFR | UART_SRR_RFR) /**< TX FIFO and RX FIFO flush Request */ +/** @} */ + +/** @defgroup UART_Interrupt_Mask UART Interrupt Flag Mask + * @{ + */ +#define UART_IT_MASK (0x008FU) /**< UART interruptions flags mask */ +/** @} */ + +/** @defgroup UART_Line_Error_Mask UART Line Error Flag Mask + * @{ + */ +#define UART_LINE_ERROR_MASK (LL_UART_LSR_PE | LL_UART_LSR_OE | LL_UART_LSR_FE | LL_UART_LSR_BI) /**< UART interruptions flags mask */ +/** @} */ + +/** @defgroup UART_Retention_Length UART Retention Register Length + * @{ + */ +#define UART_RETENTION_LENGTH ((uint32_t)8) /**< the number of retention registers */ +/** @} */ + +/** @defgroup UART_Timeout_definition UART Timeout_definition + * @{ + */ +#define HAL_UART_TIMEOUT_DEFAULT_VALUE ((uint32_t)5000) /**< 5s */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup UART_Exported_Macros UART Exported Macros + * @{ + */ + +/** @brief Reset UART handle states. + * @param __HANDLE__ UART handle. + * @retval None + */ +#define __HAL_UART_RESET_HANDLE_STATE(__HANDLE__) \ + do{ \ + (__HANDLE__)->g_state = HAL_UART_STATE_RESET; \ + (__HANDLE__)->rx_state = HAL_UART_STATE_RESET; \ + } while(0U) + +/** @brief Enable the specified UART interrupt. + * @param __HANDLE__ Specifies the UART Handle. + * @param __INTERRUPT__ Specifies the UART interrupt source to enable. + * This parameter can be one of the following values: + * @arg @ref UART_IT_RDA + * @arg @ref UART_IT_THRE + * @arg @ref UART_IT_RLS + * @arg @ref UART_IT_MS + * @retval None + */ +#define __HAL_UART_ENABLE_IT(__HANDLE__, __INTERRUPT__) \ + do { \ + GLOBAL_EXCEPTION_DISABLE(); \ + ll_uart_enable_it((__HANDLE__)->p_instance, (__INTERRUPT__)); \ + GLOBAL_EXCEPTION_ENABLE(); \ + } while(0U) + +/** @brief Disable the specified UART interrupt. + * @param __HANDLE__ Specifies the UART Handle. + * @param __INTERRUPT__ Specifies the UART interrupt source to disable. + * This parameter can be one of the following values: + * @arg @ref UART_IT_RDA + * @arg @ref UART_IT_THRE + * @arg @ref UART_IT_RLS + * @arg @ref UART_IT_MS + * @retval None + */ +#define __HAL_UART_DISABLE_IT(__HANDLE__, __INTERRUPT__) \ + do { \ + GLOBAL_EXCEPTION_DISABLE(); \ + ll_uart_disable_it((__HANDLE__)->p_instance, (__INTERRUPT__)); \ + GLOBAL_EXCEPTION_ENABLE(); \ + } while(0) + +/** @brief Flush the UART FIFO and treat FIFO as empty. + * @param __HANDLE__ Specifies the UART Handle. + * @param __REQ__ Specifies the request flag to set + * This parameter can be one of the following values: + * @arg @ref UART_RXDATA_FLUSH_REQUEST RX FIFO flush Request + * @arg @ref UART_TXDATA_FLUSH_REQUEST TX FIFO flush Request + * @arg @ref UART_TXRXDATA_FLUSH_REQUEST TX FIFO and RX FIFO flush + * @retval None + */ +#define __HAL_UART_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->p_instance->SRR = (__REQ__)) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup UART_Private_Macro UART Private Macros + * @{ + */ + +/** @brief Check if UART Baudrate is valid. + * @param __BAUDRATE__ UART Baudrate. + * @retval SET (__BAUDRATE__ is valid) or RESET (__BAUDRATE__ is invalid) + */ +#define IS_UART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 921600U) + +/** + * @brief Check if UART frame number of stop bits is valid. + * @param __STOPBITS__ UART frame number of stop bits. + * @retval SET (__STOPBITS__ is valid) or RESET (__STOPBITS__ is invalid) + */ +#define IS_UART_STOPBITS(__STOPBITS__) (((__STOPBITS__) == UART_STOPBITS_1) || \ + ((__STOPBITS__) == UART_STOPBITS_1_5) || \ + ((__STOPBITS__) == UART_STOPBITS_2)) + +/** + * @brief Check if UART frame number of data bits is valid. + * @param __DATABITS__ UART frame number of data bits. + * @retval SET (__DATABITS__ is valid) or RESET (__DATABITS__ is invalid) + */ +#define IS_UART_DATABITS(__DATABITS__) (((__DATABITS__) == UART_DATABITS_5) || \ + ((__DATABITS__) == UART_DATABITS_6) || \ + ((__DATABITS__) == UART_DATABITS_7) || \ + ((__DATABITS__) == UART_DATABITS_8)) + +/** + * @brief Check if UART frame parity is valid. + * @param __PARITY__ UART frame parity. + * @retval SET (__PARITY__ is valid) or RESET (__PARITY__ is invalid) + */ +#define IS_UART_PARITY(__PARITY__) (((__PARITY__) == UART_PARITY_NONE) || \ + ((__PARITY__) == UART_PARITY_EVEN) || \ + ((__PARITY__) == UART_PARITY_ODD) || \ + ((__PARITY__) == UART_PARITY_SP0) || \ + ((__PARITY__) == UART_PARITY_SP1)) + +/** + * @brief Check if UART hardware flow control is valid. + * @param __CONTROL__ UART hardware flow control. + * @retval SET (__CONTROL__ is valid) or RESET (__CONTROL__ is invalid) + */ +#define IS_UART_HARDWARE_FLOW_CONTROL(__CONTROL__)\ + (((__CONTROL__) == UART_HWCONTROL_NONE) || \ + ((__CONTROL__) == UART_HWCONTROL_RTS_CTS) +/** @} */ + +/** + * @brief Default configuartion for initializing structure + */ +#define UART_DEFAULT_CONFIG \ +{ \ + .baud_rate = 9600, \ + .data_bits = UART_DATABITS_8, \ + .stop_bits = UART_STOPBITS_1, \ + .parity = UART_PARITY_NONE, \ + .hw_flow_ctrl = UART_HWCONTROL_NONE, \ + .rx_timeout_mode = UART_RECEIVER_TIMEOUT_DISABLE, \ +} + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_UART_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup UART_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * + * @verbatim +=============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to initialize the UARTx. + (+) For the asynchronous mode the parameters below can be configured: + (++) Baud Rate + (++) Data Bit + (++) Stop Bit + (++) Parity + (++) Hardware flow control + [..] + The hal_uart_init() API follow the UART asynchronous configuration procedures. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the UART according to the specified + * parameters in the uart_init_t and initialize the associated handle. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_init(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief De-initialize the UART peripheral. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_deinit (uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Initialize the UART MSP. + * @note This function should not be modified. When the callback is needed, + the hal_uart_msp_init can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_msp_init(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief De-initialize the UART MSP. + * @note This function should not be modified. When the callback is needed, + the hal_uart_msp_deinit can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_msp_deinit(uart_handle_t *p_uart); + +/** @} */ + +/** @addtogroup UART_Exported_Functions_Group2 IO operation functions + * @brief UART Transmit/Receive functions + * +@verbatim + =============================================================================== + ##### IO operation functions ##### + =============================================================================== + This subsection provides a set of functions allowing to manage the UART asynchronous + and Half duplex data transfers. + + (#) There are two mode of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + (++) Non-Blocking mode: The communication is performed using Interrupts + or DMA, These API's return the HAL status. + The end of the data processing will be indicated through the + dedicated UART IRQ when using Interrupt mode or the DMA IRQ when + using DMA mode. + The hal_uart_tx_cplt_callback(), hal_uart_rx_cplt_callback() user callbacks + will be executed respectively at the end of the transmit or Receive process + The hal_uart_error_callback() user callback will be executed when a + communication error is detected + + (#) Blocking mode API's are : + (++) hal_uart_transmit() + (++) hal_uart_receive() + + (#) Non-Blocking mode API's with Interrupt are : + (++) hal_uart_transmit_it() + (++) hal_uart_receive_it() + (++) hal_uart_irq_handler() + + (#) Non-Blocking mode API's with DMA are : + (++) hal_uart_transmit_dma() + (++) hal_uart_receive_dma() + (++) hal_uart_dma_pause() + (++) hal_uart_dma_resume() + (++) hal_uart_dma_stop() + + (#) A set of Transfer Complete Callbacks are provided in Non_Blocking mode: + (++) hal_uart_tx_cplt_callback() + (++) hal_uart_rx_cplt_callback() + (++) hal_uart_error_callback() + + (#) Non-Blocking mode transfers could be aborted using Abort API's : + (++) hal_uart_abort() + (++) hal_uart_abort_transmit() + (++) hal_uart_abort_receive() + (++) hal_uart_abort_it() + (++) hal_uart_abort_transmit_it() + (++) hal_uart_abort_receive_it() + + (#) For Abort services based on interrupts (hal_uart_abort_xxx_it), a set + of Abort Complete Callbacks are provided: + (++) hal_uart_abort_cplt_callback() + (++) hal_uart_abort_tx_cplt_callback() + (++) hal_uart_abort_rx_cplt_callback() + + (#) In Non-Blocking mode transfers, possible errors are split into 2 categories. + Errors are handled as follows : + (++) Error is considered as Recoverable and non blocking. Transfer could go till end, but error severity is + to be evaluated by user : this concerns Frame Error, Parity Error or Noise Error in Interrupt mode reception . + Received character is then retrieved and stored in Rx buffer, Error code is set to allow user to identify error type, + and hal_uart_error_callback() user callback is executed. Transfer is kept ongoing on UART side. + If user wants to abort it, Abort services should be called by user. + (++) Error is considered as Blocking : Transfer could not be completed properly and is aborted. + This concerns Overrun Error In Interrupt mode reception and all errors in DMA mode. + Error code is set to allow user to identify error type, and hal_uart_error_callback() user callback is executed. + + -@- In the Half duplex communication, it is forbidden to run the transmit + and receive process in parallel, the UART state hal_uart_state_busy_tx_rx can't be useful. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Send an amount of data in blocking mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[in] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be sent. + * @param[in] timeout: Timeout duration. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_transmit(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[out] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be received. + * @param[in] timeout: Timeout duration. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_receive(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size, uint32_t timeout); + +/** + **************************************************************************************** + * @brief Send an amount of data in interrupt mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[in] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be sent. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_transmit_it(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive an amount of data in interrupt mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[out] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be received. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_receive_it(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Send an amount of data in DMA mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[in] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be sent, ranging between 0 ~ 4095. + * @note This function starts a DMA transfer in interrupt mode meaning that + * DMA half transfer complete, DMA transfer complete and DMA transfer + * error interrupts are enabled + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_transmit_dma(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Receive an amount of data in DMA mode. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @param[out] p_data: Pointer to data buffer. + * @param[in] size: Amount of data to be received, ranging between 0 and 4095. + * @note When the UART parity is enabled (PCE = 1), the received data contain + * the parity bit (MSB position). + * @note This function starts a DMA transfer in interrupt mode meaning that + * DMA half transfer complete, DMA transfer complete and DMA transfer + * error interrupts are enabled + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_receive_dma(uart_handle_t *p_uart, uint8_t *p_data, uint16_t size); + +/** + **************************************************************************************** + * @brief Pause the DMA Transfer. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_dma_pause(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Resume the DMA Transfer. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_dma_resume(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Stop the DMA Transfer. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_dma_stop(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing transfers (blocking mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Tx and Rx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing Transmit transfer (blocking mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Tx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort_transmit(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing Receive transfer (blocking mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Rx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort (in case of transfer in DMA mode) + * - Set handle State to READY + * @note This procedure is executed in blocking mode: when exiting function, Abort is considered as completed. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort_receive(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing transfers (Interrupt mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Tx and Rx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode) + * - Set handle State to READY + * - At abort completion, call user abort complete callback + * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be + * considered as completed only when user abort complete callback is executed (not when exiting function). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort_it(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing Transmit transfer (Interrupt mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing Tx transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Tx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode) + * - Set handle State to READY + * - At abort completion, call user abort complete callback + * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be + * considered as completed only when user abort complete callback is executed (not when exiting function). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort_transmit_it(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Abort ongoing Receive transfer (Interrupt mode). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @note This procedure could be used for aborting any ongoing Rx transfer started in Interrupt or DMA mode. + * This procedure performs following operations : + * - Disable UART Interrupts (Rx) + * - Disable the DMA transfer in the peripheral register (if enabled) + * - Abort DMA transfer by calling hal_dma_abort_it (in case of transfer in DMA mode) + * - Set handle State to READY + * - At abort completion, call user abort complete callback + * @note This procedure is executed in Interrupt mode, meaning that abort procedure could be + * considered as completed only when user abort complete callback is executed (not when exiting function). + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_abort_receive_it(uart_handle_t *p_uart); + +/** @} */ + +/** @addtogroup UART_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle UART interrupt request. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration information + * for the specified UART module. + **************************************************************************************** + */ +void hal_uart_irq_handler(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Tx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_tx_cplt_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_tx_cplt_callback(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Rx Transfer completed callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_rx_cplt_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_rx_cplt_callback(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief UART error callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_error_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_error_callback(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief UART Abort Complete callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_abort_cplt_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_abort_cplt_callback (uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief UART Abort Tansmit Complete callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_abort_tx_cplt_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_abort_tx_cplt_callback (uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief UART Abort Receive Complete callback. + * @note This function should not be modified. When the callback is needed, + * the hal_uart_abort_rx_cplt_callback can be implemented in the user file. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + **************************************************************************************** + */ +void hal_uart_abort_rx_cplt_callback (uart_handle_t *p_uart); + +/** @} */ + + +/** @addtogroup UART_Exported_Functions_Group3 Peripheral Control and State functions + * @brief UART Peripheral State functions + * +@verbatim + ============================================================================== + ##### Peripheral Control and State functions ##### + ============================================================================== + [..] + This subsection provides functions allowing to : + (+) Return the UART handle state. + (+) Return the UART handle error code + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the UART handle state. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_UART_STATE_RESET: Peripheral is not initialized. + * @retval ::HAL_UART_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_UART_STATE_BUSY: An internal process is ongoing. + * @retval ::HAL_UART_STATE_BUSY_TX: Data Transmission process is ongoing. + * @retval ::HAL_UART_STATE_BUSY_RX: Data Reception process is ongoing. + * @retval ::HAL_UART_STATE_TIMEOUT: Timeout state. + * @retval ::HAL_UART_STATE_ERROR: Error. + **************************************************************************************** + */ +hal_uart_state_t hal_uart_get_state(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Return the UART handle error code. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @return UART Error Code + **************************************************************************************** + */ +uint32_t hal_uart_get_error(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Suspend some registers related to UART configuration before sleep. + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_suspend_reg(uart_handle_t *p_uart); + +/** + **************************************************************************************** + * @brief Restore some registers related to UART configuration after sleep. + * This function must be used in conjunction with the hal_uart_suspend_reg(). + * @param[in] p_uart: Pointer to a UART handle which contains the configuration + * information for the specified UART module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_uart_resume_reg(uart_handle_t *p_uart); + + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_UART_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_wdt.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_wdt.h new file mode 100644 index 0000000..c327642 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_wdt.h @@ -0,0 +1,323 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_wdt.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of WDT HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_WDT WDT + * @brief WDT HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_WDT_H__ +#define __GR55xx_HAL_WDT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_wdt.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_WDT_STRUCTURES Structures + * @{ + */ + +/** @defgroup WDT_Configuration WDT Configuration + * @{ + */ + +/** + * @brief WDT init structure definition + */ +typedef struct _wdt_init +{ + uint32_t counter; /**< Specifies the WDT free-running downcounter value. + This parameter can be a number ranging between 0x0U and 0xFFFFFFFFU. */ + + uint32_t reset_mode ; /**< Specifies if WDT Reset output is enable or not. + When RESET Mode is enabled, WDT will generate an interrupt + on first timeout. If interrupt has not been cleared before the second + timeout, WDT will then request a SoC Reset. + + This parameter can be a value of @ref WDT_RESET_Mode. */ + +} wdt_init_t; + +/** @} */ + +/** @defgroup WDT_handle WDT handle + * @{ + */ + +/** + * @brief WDT handle Structure definition + */ +typedef struct _wdt_handle +{ + wdt_regs_t *p_instance; /**< Register base address */ + + wdt_init_t init; /**< WDT required parameters */ + + hal_lock_t lock; /**< WDT locking object */ + +} wdt_handle_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_WDT_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_WDT_Callback Callback + * @{ + */ + +/** + * @brief HAL_WDT Callback function definition + */ + +typedef struct _hal_wdt_callback +{ + void (*wdt_msp_init)(wdt_handle_t *p_wdt); /**< WDT init MSP callback */ + void (*wdt_msp_deinit)(wdt_handle_t *p_wdt); /**< WDT de-init MSP callback */ + void (*wdt_period_elapsed_callback)(wdt_handle_t *p_wdt); /**< WDT count complete callback */ +} hal_wdt_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_WDT_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup WDT_Exported_Constants WDT Exported Constants + * @{ + */ + +/** @defgroup WDT_RESET_Mode WDT Reset Mode + * @{ + */ +#define WDT_RESET_DISABLE (0x00000000U) /**< Reset ouput disable */ +#define WDT_RESET_ENABLE (0x00000001U) /**< Reset output enable */ +/** @} */ + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup WDT_Private_Macros WDT Private Macros + * @{ + */ + +/** + * @brief Check if the WDT reset mode is valid. + * @param __MODE__ WDT reset mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_WDT_RESET_MODE(__MODE__) (((__MODE__) == WDT_RESET_ENABLE) || \ + ((__MODE__) == WDT_RESET_DISABLE)) +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_WDT_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @addtogroup WDT_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions. + * +@verbatim + ============================================================================== + ##### Initialization and de-initialization functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Initialize and start the WDT according to the specified parameters + in the wdt_init_t of associated handle. + (+) Initialize the WDT MSP. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the WDT according to the specified + * parameters in the wdt_init_t of associated handle. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_wdt_init(wdt_handle_t *p_wdt); + +/** + **************************************************************************************** + * @brief De-initialize the WDT peripheral. + * @param[in] p_wdt: WDT handle. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_wdt_deinit(wdt_handle_t *p_wdt); + +/** + **************************************************************************************** + * @brief Initialize the WDT MSP. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + * @note When rewriting this function in a user file, this mechanism may be added + * to avoid multiple initialization when hal_wdt_init function is called + * again to change parameters. + **************************************************************************************** + */ +void hal_wdt_msp_init(wdt_handle_t *p_wdt); + +/** + **************************************************************************************** + * @brief De-initialize the WDT MSP. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + * @note When rewriting this function in a user file, this mechanism may be added + * to avoid multiple initialization when hal_wdt_init function is called + * again to change parameters. + **************************************************************************************** + */ +void hal_wdt_msp_deinit(wdt_handle_t *p_wdt); + +/** @} */ + +/** @addtogroup WDT_Exported_Functions_Group2 IO operation functions + * @brief IO operation functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + ============================================================================== + [..] + This section provides functions allowing to: + (+) Refresh the WDT. + (+) Handle WDT interrupt request and associated function callback. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Refresh the WDT. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_wdt_refresh(wdt_handle_t *p_wdt); + +/** @} */ + + +/** @addtogroup WDT_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks + * @brief IRQ Handler and Callbacks functions + * @{ + */ + +/** + **************************************************************************************** + * @brief Handle WDT interrupt request. + * @note The Count Complete can be used if specific safety operations + * or data logging must be performed before the actual reset is generated. + * When RESET Mode is enabled, WDT will generate an interrupt on first timeout. + * If interrupt has not been cleared before the second timeout, WDT will then + * request a SoC Reset. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + **************************************************************************************** + */ +void hal_wdt_irq_handler(wdt_handle_t *p_wdt); + +/** + **************************************************************************************** + * @brief WDT count complete(counter reaches to 0) callback. + * @note In RESET mode, NVIC interrupt of WDT can be disabled in + * hal_wdt_period_elapsed_callback() to make sure this callback + * be called once only. + * This function should not be modified. When the callback is needed, + * the hal_wdt_count_cplt_callback can be implemented in the user file. + * @param[in] p_wdt: Pointer to a WDT handle which contains the configuration + * information for the specified WDT module. + **************************************************************************************** + */ +void hal_wdt_period_elapsed_callback(wdt_handle_t *p_wdt); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_WDT_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_xqspi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_xqspi.h new file mode 100644 index 0000000..3cd20cc --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_hal_xqspi.h @@ -0,0 +1,826 @@ +/** + **************************************************************************************** + * + * @file gr55xx_hal_xqspi.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of XQSPI HAL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_XQSPI XQSPI + * @brief XQSPI HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_HAL_XQSPI_H__ +#define __GR55xx_HAL_XQSPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_ll_xqspi.h" +#include "gr55xx_hal_def.h" + +/* Exported types ------------------------------------------------------------*/ +/** @addtogroup HAL_XQSPI_ENUMERATIONS Enumerations + * @{ + */ + +/** @defgroup HAL_XQSPI_state HAL XQSPI state + * @{ + */ + +/** + * @brief HAL XQSPI State Enumerations definition + */ +typedef enum +{ + HAL_XQSPI_STATE_RESET = 0x00, /**< Peripheral not initialized */ + HAL_XQSPI_STATE_READY = 0x01, /**< Peripheral initialized and ready for use */ + HAL_XQSPI_STATE_BUSY = 0x02, /**< Peripheral in indirect mode and busy */ + HAL_XQSPI_STATE_BUSY_INDIRECT_TX = 0x12, /**< Peripheral in indirect mode with transmission ongoing */ + HAL_XQSPI_STATE_BUSY_INDIRECT_RX = 0x22, /**< Peripheral in indirect mode with reception ongoing */ + HAL_XQSPI_STATE_ABORT = 0x08, /**< Peripheral with abort request ongoing */ + HAL_XQSPI_STATE_ERROR = 0x04 /**< Peripheral in error */ + +} hal_xqspi_state_t; + +/** @} */ + +/** @} */ + +/** @addtogroup HAL_XQSPI_STRUCTURES Structures + * @{ + */ + +/** @defgroup XQSPI_Configuration XQSPI Configuration + * @{ + */ + +/** + * @brief XQSPI init Structure definition + */ +typedef struct _xqspi_init_t +{ + uint32_t work_mode; /**< Specifies the work mode for XQSPI. + This parameter can be a value of @ref XQSPI_Work_Mode */ + + uint32_t cache_mode; /**< Specifies the cache mode for XIP mode. + This parameter can be a value of @ref XQSPI_Cache_Mode */ + + uint32_t read_cmd; /**< Specifies the read command for transmit in XIP mode. + This parameter can be a value of @ref XQSPI_Read_CMD */ + + uint32_t baud_rate; /**< Specifies the serial clock speed for transmit in both XIP and QSPI mode. + This parameter can be a value of @ref XQSPI_Baud_Rate */ + + uint32_t clock_mode; /**< Specifies the Clock Mode. It indicates the level that clock takes between commands. + This parameter can be a value of @ref XQSPI_Clock_Mode */ + +} xqspi_init_t; +/** @} */ + +/** @defgroup XQSPI_handle XQSPI handle + * @{ + */ + +/** + * @brief XQSPI handle Structure definition + */ +typedef struct _xqspi_handle_t +{ + xqspi_regs_t *p_instance; /**< XQSPI registers base address */ + + xqspi_init_t init; /**< XQSPI communication parameters */ + + uint8_t *p_tx_buffer; /**< Pointer to XQSPI Tx transfer Buffer */ + + __IO uint32_t tx_xfer_size; /**< XQSPI Tx Transfer size */ + + __IO uint32_t tx_xfer_count; /**< XQSPI Tx Transfer Counter */ + + uint8_t *p_rx_buffer; /**< Pointer to XQSPI Rx transfer Buffer */ + + __IO uint32_t rx_xfer_size; /**< XQSPI Rx Transfer size */ + + __IO uint32_t rx_xfer_count; /**< XQSPI Rx Transfer Counter */ + + __IO hal_lock_t lock; /**< Locking object */ + + __IO hal_xqspi_state_t state; /**< XQSPI communication state */ + + __IO uint32_t error_code; /**< XQSPI Error code */ + + uint32_t retry; /**< Retry for the XQSPI flag access */ + +} xqspi_handle_t; +/** @} */ + +/** @defgroup XQSPI_Command XQSPI command + * @{ + */ + +/** + * @brief XQSPI command Structure definition + */ +typedef struct _xqspi_command_t +{ + uint32_t inst; /**< Specifies the Instruction to be sent. + This parameter can be a value (8-bit) between 0x00 and 0xFF */ + + uint32_t addr; /**< Specifies the Address to be sent (Size from 1 to 4 bytes according to AddressSize). + This parameter can be a value (32-bits) between 0x0 and 0xFFFFFFFF */ + + uint32_t inst_size; /**< Specifies the Instruction Size. + This parameter can be a value of @ref XQSPI_Instruction_Size */ + + uint32_t addr_size; /**< Specifies the Address Size. + This parameter can be a value of @ref XQSPI_Address_Size */ + + uint32_t dummy_cycles; /**< Specifies the Number of Dummy Cycles. + This parameter can be a number between 0 and 31 */ + + uint32_t inst_addr_mode; /**< Specifies the Instruction and Address Mode. + This parameter can be a value of @ref XQSPI_Inst_Addr_Mode */ + + uint32_t data_mode; /**< Specifies the Data Mode (used for dummy cycles and data phases). + This parameter can be a value of @ref XQSPI_Data_Mode */ + + uint32_t length; /**< Specifies the number of data to transfer. (This is the number of bytes). + This parameter can be any value between 0 and 0xFFFFFFFF (0 means undefined length + until end of memory) */ + +} xqspi_command_t; +/** @} */ + +/** @} */ + +/** @addtogroup HAL_XQSPI_CALLBACK_STRUCTURES Callback Structures + * @{ + */ + +/** @defgroup HAL_XQSPI_Callback Callback + * @{ + */ + +/** + * @brief HAL_XQSPI Callback function definition + */ + +typedef struct _hal_xqspi_callback +{ + void (*xqspi_msp_init)(xqspi_handle_t *p_xqspi); /**< XQSPI init MSP callback */ + void (*xqspi_msp_deinit)(xqspi_handle_t *p_xqspi); /**< XQSPI de-init MSP callback */ +} hal_xqspi_callback_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HAL_XQSPI_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup XQSPI_Exported_Constants XQSPI Exported Constants + * @{ + */ + +/** @defgroup XQSPI_Error_Code XQSPI Error Code + * @{ + */ +#define HAL_XQSPI_ERROR_NONE ((uint32_t)0x00000000) /**< No error */ +#define HAL_XQSPI_ERROR_TIMEOUT ((uint32_t)0x00000001) /**< Timeout error */ +#define HAL_XQSPI_ERROR_TRANSFER ((uint32_t)0x00000002) /**< Transfer error */ +#define HAL_XQSPI_ERROR_INVALID_PARAM ((uint32_t)0x00000008) /**< Invalid parameter error */ +/** @} */ + +/** @defgroup XQSPI_Work_Mode XQSPI Work Mode + * @{ + */ +#define XQSPI_WORK_MODE_QSPI LL_XQSPI_MODE_QSPI /**< Work in QSPI mode */ +#define XQSPI_WORK_MODE_XIP LL_XQSPI_MODE_XIP /**< Work in XIP mode */ +/** @} */ + +/** @defgroup XQSPI_Cache_Mode XQSPI Cache Mode in XIP mode + * @{ + */ +#define XQSPI_CACHE_MODE_DIS LL_XQSPI_CACHE_DIS /**< Cache off in XIP mode */ +#define XQSPI_CACHE_MODE_EN LL_XQSPI_CACHE_EN /**< Cache on in XIP mode */ +/** @} */ + +/** @defgroup XQSPI_Read_CMD XQSPI Read Command in XIP mode + * @{ + */ +#define XQSPI_READ_CMD_READ LL_XQSPI_XIP_CMD_READ /**< Read mode */ +#define XQSPI_READ_CMD_FAST_READ LL_XQSPI_XIP_CMD_FAST_READ /**< Fast Read mode */ +#define XQSPI_READ_CMD_DUAL_OUT_READ LL_XQSPI_XIP_CMD_DUAL_OUT_READ /**< Dual-Out Fast Read mode */ +#define XQSPI_READ_CMD_DUAL_IO_READ LL_XQSPI_XIP_CMD_DUAL_IO_READ /**< Dual-IO Fast Read mode */ +#define XQSPI_READ_CMD_QUAD_OUT_READ LL_XQSPI_XIP_CMD_QUAD_OUT_READ /**< Quad-Out Fast Read mode */ +#define XQSPI_READ_CMD_QUAD_IO_READ LL_XQSPI_XIP_CMD_QUAD_IO_READ /**< Quad-IO Fast Read mode */ +/** @} */ + +/** @defgroup XQSPI_Clock_Mode XQSPI Clock Mode + * @{ + */ +#define XQSPI_CLOCK_MODE_0 ((LL_XQSPI_SCPOL_LOW << 1) | LL_XQSPI_SCPHA_1EDGE) /**< Inactive state of CLK is low, + CLK toggles at the start of first data bit */ +#define XQSPI_CLOCK_MODE_1 ((LL_XQSPI_SCPOL_LOW << 1) | LL_XQSPI_SCPHA_2EDGE) /**< Inactive state of CLK is low, + CLK toggles in the middle of first data bit */ +#define XQSPI_CLOCK_MODE_2 ((LL_XQSPI_SCPOL_HIGH << 1) | LL_XQSPI_SCPHA_1EDGE) /**< Inactive state of CLK is high, + CLK toggles at the start of first data bit */ +#define XQSPI_CLOCK_MODE_3 ((LL_XQSPI_SCPOL_HIGH << 1) | LL_XQSPI_SCPHA_2EDGE) /**< Inactive state of CLK is high, + CLK toggles in the middle of first data bit */ +/** @} */ + +/** @defgroup XQSPI_Baud_Rate XQSPI Clock Speed + * @{ + */ +#define XQSPI_BAUD_RATE_64M LL_XQSPI_BAUD_RATE_64M /**< Serial clock speed is 64 MHz */ +#define XQSPI_BAUD_RATE_48M LL_XQSPI_BAUD_RATE_48M /**< Serial clock speed is 48 MHz */ +#define XQSPI_BAUD_RATE_32M LL_XQSPI_BAUD_RATE_32M /**< Serial clock speed is 32 MHz */ +#define XQSPI_BAUD_RATE_24M LL_XQSPI_BAUD_RATE_24M /**< Serial clock speed is 24 MHz */ +#define XQSPI_BAUD_RATE_16M LL_XQSPI_BAUD_RATE_16M /**< Serial clock speed is 16 MHz */ +/** @} */ + +/** @defgroup XQSPI_Data_Mode XQSPI Data Mode, only in QSPI mode + * @{ + */ +#define XQSPI_DATA_MODE_SPI LL_XQSPI_QSPI_FRF_SPI /**< Standard SPI Frame Format */ +#define XQSPI_DATA_MODE_DUALSPI LL_XQSPI_QSPI_FRF_DUALSPI /**< Dual-SPI Frame Format */ +#define XQSPI_DATA_MODE_QUADSPI LL_XQSPI_QSPI_FRF_QUADSPI /**< Quad-SPI Frame Format */ +/** @} */ + +/** @defgroup XQSPI_FIFO_Threshold XQSPI FIFO Threshold, FIFO depth is 64*4bytes, only in QSPI mode + * @{ + */ +#define XQSPI_FIFO_THRESHOLD_1_8 LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 /**< FIFO depth/8 */ +#define XQSPI_FIFO_THRESHOLD_1_4 LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 /**< FIFO depth/4 */ +#define XQSPI_FIFO_THRESHOLD_1_2 LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 /**< FIFO depth/2 */ +#define XQSPI_FIFO_THRESHOLD_3_4 LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 /**< FIFO depth*3/4 */ +#define XQSPI_FIFO_DEPTH LL_XQSPI_QSPI_FIFO_DEPTH /**< FIFO full depth */ +/** @} */ + +/** @defgroup XQSPI_Instruction_Size XQSPI Instruction Size, only in QSPI mode + * @{ + */ +#define XQSPI_INSTSIZE_00_BITS (0) /**< 0-bit (No Instruction) */ +#define XQSPI_INSTSIZE_08_BITS (1) /**< 8-bit Instruction */ +#define XQSPI_INSTSIZE_16_BITS (2) /**< 16-bit Instruction */ +/** @} */ + +/** @defgroup XQSPI_Address_Size XQSPI Address Size, only in QSPI mode + * @{ + */ +#define XQSPI_ADDRSIZE_00_BITS (0) /**< 0-bit (No Address) */ +#define XQSPI_ADDRSIZE_08_BITS (1) /**< 8-bit Address */ +#define XQSPI_ADDRSIZE_16_BITS (2) /**< 16-bit Address */ +#define XQSPI_ADDRSIZE_24_BITS (3) /**< 24-bit Address */ +#define XQSPI_ADDRSIZE_32_BITS (4) /**< 32-bit Address */ +/** @} */ + +/** @defgroup XQSPI_Inst_Addr_Mode XQSPI Instruction and Address Mode, only in QSPI mode + * @{ + */ +#define XQSPI_INST_ADDR_ALL_IN_SPI (0) /**< Instruction and address are sent in SPI mode */ +#define XQSPI_INST_IN_SPI_ADDR_IN_SPIFRF (1) /**< Instruction is sent in SPI mode, and address is sent in Daul/Quad SPI mode */ +#define XQSPI_INST_ADDR_ALL_IN_SPIFRF (2) /**< Instruction and address are sent in Daul/Quad SPI mode */ +/** @} */ + +/** @defgroup XQSPI_Flags XQSPI Flags, only in QSPI mode + * @{ + */ +#define XQSPI_FLAG_RFF LL_XQSPI_QSPI_STAT_RFF /**< Rx FIFO full flag */ +#define XQSPI_FLAG_RFTF LL_XQSPI_QSPI_STAT_RFTF /**< Rx FIFO threshold flag */ +#define XQSPI_FLAG_RFE LL_XQSPI_QSPI_STAT_RFE /**< Rx FIFO empty flag */ +#define XQSPI_FLAG_TFF LL_XQSPI_QSPI_STAT_TFF /**< Tx FIFO full flag */ +#define XQSPI_FLAG_TFTF LL_XQSPI_QSPI_STAT_TFTF /**< Tx FIFO threshold flag */ +#define XQSPI_FLAG_TFE LL_XQSPI_QSPI_STAT_TFE /**< Tx FIFO empty flag */ +#define XQSPI_FLAG_BUSY LL_XQSPI_QSPI_STAT_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup XQSPI_Ctrl_Present Control Present Status, only in XIP mode + * @{ + */ +#define XQSPI_DISABLE_PRESENT LL_XQSPI_DISABLE_PRESENT /**< Disable Present */ +#define XQSPI_ENABLE_PRESENT LL_XQSPI_ENABLE_PRESENT /**< Enable Present */ +/** @} */ + +/** + * @brief XQSPI_Retry_definition XQSPI Retry definition + */ +#define HAL_XQSPI_RETRY_DEFAULT_VALUE ((uint32_t)1000) /**< 1000 times */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup XQSPI_Exported_Macros XQSPI Exported Macros + * @{ + */ + +/** @brief Reset XQSPI handle states. + * @param __HANDLE__ XQSPI handle. + * @retval None + */ +#define __HAL_XQSPI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->state = HAL_XQSPI_STATE_RESET) + +/** @brief Enable the specified QSPI peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_ENABLE_QSPI(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->QSPI.SPIEN, SSI_SSIEN_EN) + +/** @brief Disable the specified QSPI peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_DISABLE_QSPI(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->QSPI.SPIEN, SSI_SSIEN_EN) + +/** @brief Enable the specified XIP peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_ENABLE_XIP(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->XIP.CTRL3, SSI_SSIEN_EN);\ + while(!ll_xqspi_get_xip_flag(__HANDLE__->p_instance)) + +/** @brief Disable the specified XIP peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_DISABLE_XIP(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->XIP.CTRL3, SSI_SSIEN_EN);\ + while(ll_xqspi_get_xip_flag(__HANDLE__->p_instance)) + +/** @brief Enable the specified CACHE peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_ENABLE_CACHE(__HANDLE__) CLEAR_BITS((__HANDLE__)->p_instance->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS) + +/** @brief Disable the specified CACHE peripheral in XQSPI. + * @param __HANDLE__ specifies the XQSPI Handle. + * @retval None + */ +#define __HAL_XQSPI_DISABLE_CACHE(__HANDLE__) SET_BITS((__HANDLE__)->p_instance->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS) + +/** @brief Check whether the specified XQSPI flag is set or not. + * @param __HANDLE__ specifies the XQSPI Handle. + * @param __FLAG__ specifies the flag to check. + * This parameter can be one of the following values: + * @arg @ref XQSPI_FLAG_RFF Rx FIFO full flag + * @arg @ref XQSPI_FLAG_RFTF Rx FIFO threshold flag + * @arg @ref XQSPI_FLAG_RFE Rx FIFO empty flag + * @arg @ref XQSPI_FLAG_TFF Tx FIFO full flag + * @arg @ref XQSPI_FLAG_TFTF Tx FIFO threshold flag + * @arg @ref XQSPI_FLAG_TFE Tx FIFO empty flag + * @arg @ref XQSPI_FLAG_BUSY Busy flag + * @retval The new state of __FLAG__ (TRUE or FALSE). + */ +#define __HAL_XQSPI_GET_FLAG(__HANDLE__, __FLAG__) ((READ_BITS((__HANDLE__)->p_instance->QSPI.STAT, (__FLAG__)) != 0) ? SET : RESET) + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup XQSPI_Private_Macro XQSPI Private Macros + * @{ + */ + +/** @brief Check if XQSPI Work Mode is valid. + * @param __MODE__ XQSPI Work Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_XQSPI_WORK_MODE(__MODE__) (((__MODE__) == XQSPI_WORK_MODE_QSPI) || \ + ((__MODE__) == XQSPI_WORK_MODE_XIP)) + +/** @brief Check if XQSPI Cache Mode is valid. + * @param __MODE__ XQSPI Cache Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_XQSPI_CACHE_MODE(__MODE__) (((__MODE__) == XQSPI_CACHE_MODE_DIS) || \ + ((__MODE__) == XQSPI_CACHE_MODE_EN)) + +/** @brief Check if XQSPI Read CMD is valid. + * @param __CMD__ XQSPI Cache Mode. + * @retval SET (__CMD__ is valid) or RESET (__CMD__ is invalid) + */ +#define IS_XQSPI_READ_CMD(__CMD__) (((__CMD__) == XQSPI_READ_CMD_READ ) || \ + ((__CMD__) == XQSPI_READ_CMD_FAST_READ ) || \ + ((__CMD__) == XQSPI_READ_CMD_DUAL_OUT_READ) || \ + ((__CMD__) == XQSPI_READ_CMD_DUAL_IO_READ ) || \ + ((__CMD__) == XQSPI_READ_CMD_QUAD_OUT_READ) || \ + ((__CMD__) == XQSPI_READ_CMD_QUAD_IO_READ )) + +/** @brief Check if XQSPI Clock Baud Rate is valid. + * @param __BAUD__ XQSPI Clock Baud Rate. + * @retval SET (__BAUD__ is valid) or RESET (__BAUD__ is invalid) + */ +#define IS_XQSPI_BAUD_RATE(__BAUD__) (((__BAUD__) == XQSPI_BAUD_RATE_64M) || \ + ((__BAUD__) == XQSPI_BAUD_RATE_48M) || \ + ((__BAUD__) == XQSPI_BAUD_RATE_32M) || \ + ((__BAUD__) == XQSPI_BAUD_RATE_24M) || \ + ((__BAUD__) == XQSPI_BAUD_RATE_16M)) + +/** @brief Check if XQSPI Clock Mode is valid. + * @param __CLKMODE__ XQSPI Clock Mode. + * @retval SET (__CLKMODE__ is valid) or RESET (__CLKMODE__ is invalid) + */ +#define IS_XQSPI_CLOCK_MODE(__CLKMODE__) (((__CLKMODE__) == XQSPI_CLOCK_MODE_0) || \ + ((__CLKMODE__) == XQSPI_CLOCK_MODE_1) || \ + ((__CLKMODE__) == XQSPI_CLOCK_MODE_2) || \ + ((__CLKMODE__) == XQSPI_CLOCK_MODE_3)) + +/** @brief Check if XQSPI FIFO Threshold is valid. + * @param __THR__ XQSPI FIFO Threshold. + * @retval SET (__THR__ is valid) or RESET (__THR__ is invalid) + */ +#define IS_XQSPI_FIFO_THRESHOLD(__THR__) (((__THR__) == XQSPI_FIFO_THRESHOLD_1_8) || \ + ((__THR__) == XQSPI_FIFO_THRESHOLD_1_4) || \ + ((__THR__) == XQSPI_FIFO_THRESHOLD_1_2) || \ + ((__THR__) == XQSPI_FIFO_THRESHOLD_3_4)) + +/** @brief Check if XQSPI Instruction Size is valid. + * @param __INST_SIZE__ XQSPI Instruction Size. + * @retval SET (__INST_SIZE__ is valid) or RESET (__INST_SIZE__ is invalid) + */ +#define IS_XQSPI_INSTRUCTION_SIZE(__INST_SIZE__) (((__INST_SIZE__) == XQSPI_INSTSIZE_00_BITS) || \ + ((__INST_SIZE__) == XQSPI_INSTSIZE_08_BITS) || \ + ((__INST_SIZE__) == XQSPI_INSTSIZE_16_BITS)) + +/** @brief Check if XQSPI Address Size is valid. + * @param __ADDR_SIZE__ XQSPI Address Size . + * @retval SET (__ADDR_SIZE__ is valid) or RESET (__ADDR_SIZE__ is invalid) + */ +#define IS_XQSPI_ADDRESS_SIZE(__ADDR_SIZE__) (((__ADDR_SIZE__) == XQSPI_ADDRSIZE_00_BITS) || \ + ((__ADDR_SIZE__) == XQSPI_ADDRSIZE_08_BITS) || \ + ((__ADDR_SIZE__) == XQSPI_ADDRSIZE_16_BITS) || \ + ((__ADDR_SIZE__) == XQSPI_ADDRSIZE_24_BITS) || \ + ((__ADDR_SIZE__) == XQSPI_ADDRSIZE_32_BITS)) + +/** @brief Check if XQSPI Instruction and Address Mode is valid. + * @param __MODE__ XQSPI Instruction and Address Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_XQSPI_INSTADDR_MODE(__MODE__) (((__MODE__) == XQSPI_INST_ADDR_ALL_IN_SPI) || \ + ((__MODE__) == XQSPI_INST_IN_SPI_ADDR_IN_SPIFRF) || \ + ((__MODE__) == XQSPI_INST_ADDR_ALL_IN_SPIFRF)) + +/** @brief Check if XQSPI Data Mode is valid. + * @param __MODE__ XQSPI Data Mode. + * @retval SET (__MODE__ is valid) or RESET (__MODE__ is invalid) + */ +#define IS_XQSPI_DATA_MODE(__MODE__) (((__MODE__) == XQSPI_DATA_MODE_SPI) || \ + ((__MODE__) == XQSPI_DATA_MODE_DUALSPI) || \ + ((__MODE__) == XQSPI_DATA_MODE_QUADSPI)) + +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @addtogroup HAL_XQSPI_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup XQSPI_Exported_Functions_Group1 Initialization and de-initialization functions + * @brief Initialization and de-initialization functions + * +@verbatim + =============================================================================== + ##### Initialization and de-initialization functions ##### + =============================================================================== + [..] This subsection provides a set of functions allowing to initialize and + de-initialize the XQSPIx peripheral: + + (+) User must implement hal_xqspi_msp_init() function in which he configures + all related peripherals resources (GPIO, DMA, IT and NVIC ). + + (+) Call the function hal_xqspi_init() to configure the selected device with + the selected configuration: + (++) work_mode + (++) cache_mode + (++) read_cmd + (++) baud_rate + (++) clock_mode + + (+) Call the function hal_xqspi_deinit() to restore the default configuration + of the selected XQSPIx peripheral. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Initialize the XQSPI according to the specified parameters + * in the xqspi_init_t and initialize the associated handle. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_init(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief De-initialize the XQSPI peripheral. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_deinit(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief Initialize the XQSPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_xqspi_msp_deinit can be implemented in the user file. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + **************************************************************************************** + */ +void hal_xqspi_msp_init(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief De-initialize the XQSPI MSP. + * @note This function should not be modified. When the callback is needed, + the hal_xqspi_msp_deinit can be implemented in the user file. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + **************************************************************************************** + */ +void hal_xqspi_msp_deinit(xqspi_handle_t *p_xqspi); + +/** @} */ + +/** @defgroup XQSPI_Exported_Functions_Group2 IO operation functions + * @brief Data transfers functions + * +@verbatim + ============================================================================== + ##### IO operation functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to manage the XQSPI + data transfers. + + [..] The XQSPI supports master and slave mode: + + (#) There are one modes of transfer: + (++) Blocking mode: The communication is performed in polling mode. + The HAL status of all data processing is returned by the same function + after finishing transfer. + + (#) APIs provided for only one transfer mode (Blocking mode) + exist for 1Line/2Line/4Line (simplex) modes. + +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Transmit an amount of data with specified instruction and address in blocking mode. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] p_cmd: Pointer to a xqspi_command_t structure that contains the instruction and address for data transfer. + * @param[in] p_data: Pointer to data buffer + * @param[in] retry: Repeat times + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_command_transmit(xqspi_handle_t *p_xqspi, xqspi_command_t *p_cmd, uint8_t *p_data, uint32_t retry); + +/** + **************************************************************************************** + * @brief Receive an amount of data with specified instruction and address in blocking mode. + * @note This function is used only in Indirect Write Mode. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] p_cmd: Pointer to a xqspi_command_t structure that contains the instruction and address for data transfer. + * @param[out] p_data: Pointer to data buffer + * @param[in] retry: Repeat times + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_command_receive(xqspi_handle_t *p_xqspi, xqspi_command_t *p_cmd, uint8_t *p_data, uint32_t retry); + +#if defined RTL_SIM +hal_status_t hal_xqspi_command_receive_rtl(xqspi_handle_t *p_xqspi, xqspi_command_t *p_cmd, uint8_t *p_data, uint32_t retry); +#endif + + +/** + **************************************************************************************** + * @brief Transmit an amount of data in blocking mode. + * @note This function is used only in Indirect Write Mode, only in standard SPI mode. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be sent in bytes + * @param[in] retry: Repeat times + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_transmit(xqspi_handle_t *p_xqspi, uint8_t *p_data, uint32_t length, uint32_t retry); + +/** + **************************************************************************************** + * @brief Receive an amount of data in blocking mode. + * @note This function is used only in Indirect Read Mode, only in standard SPI mode. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[out] p_data: Pointer to data buffer + * @param[in] length: Amount of data to be received in bytes + * @param[in] retry: Repeat times + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_receive(xqspi_handle_t *p_xqspi, uint8_t *p_data, uint32_t length, uint32_t retry); + +/** @} */ + +/** @defgroup XQSPI_Exported_Functions_Group3 Peripheral State and Errors functions + * @brief XQSPI control functions + * +@verbatim + =============================================================================== + ##### Peripheral State and Errors functions ##### + =============================================================================== + [..] + This subsection provides a set of functions allowing to control the XQSPI. + (+) hal_xqspi_get_state()API can be helpful to check in run-time the state of the XQSPI peripheral. + (+) hal_xqspi_get_error() check in run-time Errors occurring during communication. + (+) hal_xqspi_set_retry() set the repeat times during internal process. + (+) hal_xqspi_set_tx_fifo_threshold() set the TX FIFO Threshold. + (+) hal_xqspi_set_rx_fifo_threshold() set the RX FIFO Threshold. + (+) hal_xqspi_get_tx_fifo_threshold() get the TX FIFO Threshold. + (+) hal_xqspi_get_rx_fifo_threshold() get the RX FIFO Threshold. +@endverbatim + * @{ + */ + +/** + **************************************************************************************** + * @brief Return the XQSPI handle state. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @retval ::HAL_XQSPI_STATE_RESET: Peripheral not initialized. + * @retval ::HAL_XQSPI_STATE_READY: Peripheral initialized and ready for use. + * @retval ::HAL_XQSPI_STATE_BUSY: Peripheral in indirect mode and busy. + * @retval ::HAL_XQSPI_STATE_BUSY_INDIRECT_TX: Peripheral in indirect mode with transmission ongoing. + * @retval ::HAL_XQSPI_STATE_BUSY_INDIRECT_RX: Peripheral in indirect mode with reception ongoing. + * @retval ::HAL_XQSPI_STATE_ABORT: Peripheral with abort request ongoing. + * @retval ::HAL_XQSPI_STATE_ERROR: Peripheral in error. + **************************************************************************************** + */ +hal_xqspi_state_t hal_xqspi_get_state(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief Return the XQSPI error code. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @return XQSPI error code in bitmap format + **************************************************************************************** + */ +uint32_t hal_xqspi_get_error(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief Set the XQSPI internal process repeat times value. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] retry: Internal process repeat times value. + **************************************************************************************** + */ +void hal_xqspi_set_retry(xqspi_handle_t *p_xqspi, uint32_t retry); + +/** + **************************************************************************************** + * @brief Set the TXFIFO threshold. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] threshold: TX FIFO threshold can be one of the following values: + * @arg @ref XQSPI_FIFO_THRESHOLD_1_8 threshold is 8 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_1_4 threshold is 16 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_1_2 threshold is 32 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_3_4 threshold is 48 bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_set_tx_fifo_threshold(xqspi_handle_t *p_xqspi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Set the RXFIFO threshold. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] threshold: RX FIFO threshold can be one of the following values: + * @arg @ref XQSPI_FIFO_THRESHOLD_1_8 threshold is 8 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_1_4 threshold is 16 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_1_2 threshold is 32 bytes + * @arg @ref XQSPI_FIFO_THRESHOLD_3_4 threshold is 48 bytes + * @retval ::HAL_OK: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + **************************************************************************************** + */ +hal_status_t hal_xqspi_set_rx_fifo_threshold(xqspi_handle_t *p_xqspi, uint32_t threshold); + +/** + **************************************************************************************** + * @brief Get the TXFIFO threshold. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @return TX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_xqspi_get_tx_fifo_threshold(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief Get the RXFIFO threshold. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @return RX FIFO threshold + **************************************************************************************** + */ +uint32_t hal_xqspi_get_rx_fifo_threshold(xqspi_handle_t *p_xqspi); + +/** + **************************************************************************************** + * @brief Turn on/off present module, only in XIP mode. + * @param[in] p_xqspi: Pointer to an XQSPI handle which contains the configuration information for the specified XQSPI module. + * @param[in] status: Presen status can be one of the following values: + * @arg @ref XQSPI_DISABLE_PRESENT Disable Present + * @arg @ref XQSPI_ENABLE_PRESENT Enable Present + + **************************************************************************************** + */ +void hal_xqspi_set_xip_present_status(xqspi_handle_t *p_xqspi, uint32_t status); + +/** @} */ + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_HAL_XQSPI_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_adc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_adc.h new file mode 100644 index 0000000..30e300b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_adc.h @@ -0,0 +1,1084 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_adc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ADC LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_ADC ADC + * @brief ADC LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_ADC_H__ +#define __GR55XX_LL_ADC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** @defgroup LL_ADC_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup LL_ADC_ES_INIT ADC Exported init structures + * @{ + */ + +/** + * @brief LL ADC init Structure definition + */ +typedef struct _ll_adc_init +{ + uint32_t channel_p; /**< Specifies the input source to ADC channel P. + This parameter can be any value of @ref LL_ADC_EC_INPUT_SRC. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_channelp(). */ + + uint32_t channel_n; /**< Specifies the input source to ADC channel N. + This parameter can be any value of @ref LL_ADC_EC_INPUT_SRC. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_channeln(). */ + + uint32_t input_mode; /**< Specifies the operation mode for the ADC sample. + This parameter can be a value of @ref LL_ADC_EC_INPUT_MODE. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_input_mode(). */ + + uint32_t ref_source; /**< Specifies the source of the ADC reference. + This parameter can be a value of @ref LL_ADC_EC_REFERENCE_SRC. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_ref().*/ + + uint32_t ref_value; /*!< Specifies the value of the ADC buffered reference. + This parameter can be a value of @ref LL_ADC_EC_REFERENCE. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_ref_value().*/ + + uint32_t clock; /**< Specifies the clock of ADC. + This parameter can be a value of @ref LL_ADC_EC_CLK. + + This parament can be modified afterwards using unitary function @ref ll_adc_set_clock().*/ + +} ll_adc_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup LL_ADC_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup LL_ADC_Exported_Constants ADC Exported Constants + * @{ + */ + +/** @defgroup LL_ADC_EC_CLK ADC CLOCK + * @{ + */ +#define LL_ADC_CLK_16 (0x00000000UL) /**< 16 MHz */ +#define LL_ADC_CLK_8 (1UL << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) /**< 8 MHz */ +#define LL_ADC_CLK_4 (2UL << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) /**< 4 MHz */ +#define LL_ADC_CLK_2 (3UL << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) /**< 2 MHz */ +#define LL_ADC_CLK_1P6 (4UL << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) /**< 1.6 MHz */ +#define LL_ADC_CLK_1 (5UL << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) /**< 1 MHz */ +/** @} */ + +/** @defgroup LL_ADC_EC_REFERENCE ADC Buffered Internal Reference Value + * @{ + */ +#define LL_ADC_REF_VALUE_0P8 (0x3UL << AON_SNSADC_CFG_REF_VALUE_Pos) /**< Reference = 0.85 V */ +#define LL_ADC_REF_VALUE_1P2 (0x7UL << AON_SNSADC_CFG_REF_VALUE_Pos) /**< Reference = 1.28 V */ +#define LL_ADC_REF_VALUE_1P6 (0xAUL << AON_SNSADC_CFG_REF_VALUE_Pos) /**< Reference = 1.60 V */ +//#define LL_ADC_REF_VALUE_2P0 (0xFUL << AON_SNSADC_CFG_REF_VALUE_Pos) /**< Reference = 2.00 V */ +/** @} */ + +/** @defgroup LL_ADC_EC_INPUT_MODE ADC Input Mode + * @{ + */ +#define LL_ADC_INPUT_SINGLE (1UL << AON_SNSADC_CFG_SINGLE_EN_Pos) /**< Single ended mode */ +#define LL_ADC_INPUT_DIFFERENTIAL (0x00000000UL) /**< Differential mode */ +/** @} */ + +/** @defgroup LL_ADC_EC_INPUT_SRC ADC Input Source + * @{ + */ +#define LL_ADC_INPUT_SRC_IO0 (0UL) /**< Select MSIO0 as input */ +#define LL_ADC_INPUT_SRC_IO1 (1UL) /**< Select MSIO1 as input */ +#define LL_ADC_INPUT_SRC_IO2 (2UL) /**< Select MSIO2 as input */ +#define LL_ADC_INPUT_SRC_IO3 (3UL) /**< Select MSIO3 as input */ +#define LL_ADC_INPUT_SRC_IO4 (4UL) /**< Select MSIO4 as input */ +#define LL_ADC_INPUT_SRC_TMP (5UL) /**< Select temperature as input */ +#define LL_ADC_INPUT_SRC_BAT (6UL) /**< Select Vbattery as input */ +#define LL_ADC_INPUT_SRC_REF (7UL) /**< Select reference as input */ + +/** @} */ + +/** @defgroup LL_ADC_EC_REFERENCE_SRC ADC Reference Source + * @{ + */ +#define LL_ADC_REF_SRC_BUF_INT (0x00000000UL) /**< Select buffered internal reference as reference */ +#define LL_ADC_REF_SRC_IO0 (3UL << AON_SNSADC_CFG_REF_SEL_Pos) /**< Select MSIO0 as reference */ +#define LL_ADC_REF_SRC_IO1 (4UL << AON_SNSADC_CFG_REF_SEL_Pos) /**< Select MSIO1 as reference */ +#define LL_ADC_REF_SRC_IO2 (5UL << AON_SNSADC_CFG_REF_SEL_Pos) /**< Select MSIO2 as reference */ +#define LL_ADC_REF_SRC_IO3 (6UL << AON_SNSADC_CFG_REF_SEL_Pos) /**< Select MSIO3 as reference */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup LL_ADC_Exported_Macros ADC Exported Macros + * @{ + */ + +/** @defgroup LL_ADC_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in ADC register + * @param __instance__ ADC instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_ADC_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG((__instance__)->__REG__, (__VALUE__)) + +/** + * @brief Read a value in ADC register + * @param __instance__ ADC instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_ADC_ReadReg(__instance__, __REG__) READ_REG((__instance__)->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup LL_ADC_Private_Macros ADC Private Macros + * @{ + */ + +/** @defgroup LL_ADC_EC_DEFAULT_CONFIG InitStruct default configuartion + * @{ + */ + +/** + * @brief LL ADC InitStrcut default configuartion + */ +#define LL_ADC_DEFAULT_CONFIG \ +{ \ + .channel_p = LL_ADC_INPUT_SRC_IO0, \ + .channel_n = LL_ADC_INPUT_SRC_IO1, \ + .input_mode = LL_ADC_INPUT_DIFFERENTIAL, \ + .ref_source = LL_ADC_REF_SRC_BUF_INT, \ + .ref_value = LL_ADC_REF_VALUE_1P5, \ + .clock = LL_ADC_CLK_16 \ +} +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup LL_ADC_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup LL_ADC_EF_Configuration Basic Configuration + * @{ + */ + +/** + * @brief Enable ADC module. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable(void) +{ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_EN_Msk); +} + +/** + * @brief Disable ADC module. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable(void) +{ + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_EN_Msk); +} + +/** + * @brief Check if ADC module is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled(void) +{ + return (READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_EN_Msk) == (AON_SNSADC_CFG_EN_Msk)); +} + +/** + * @brief Enable ADC clock. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | MSIO_PAD_CFG_1 | ADC_CLK_EN | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable_clock(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_MSIO_PAD_CFG_1_ADC_CLK_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable ADC clock. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | MSIO_PAD_CFG_1 | ADC_CLK_EN | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable_clock(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, AON_MSIO_PAD_CFG_1_ADC_CLK_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if ADC clock is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | MSIO_PAD_CFG_1 | ADC_CLK_EN | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled_clock(void) +{ + return (READ_BITS(AON->MSIO_PAD_CFG_1, AON_MSIO_PAD_CFG_1_ADC_CLK_EN) == (AON_MSIO_PAD_CFG_1_ADC_CLK_EN)); +} + +/** + * @brief Set ADC clock source. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | MSIO_PAD_CFG_1 | ADC_CLK_SEL | + * +----------------------+-----------------------------+ + * \endrst + * + * @param clk This parameter can be one of the following values: + * @arg @ref LL_ADC_CLK_16 + * @arg @ref LL_ADC_CLK_8 + * @arg @ref LL_ADC_CLK_4 + * @arg @ref LL_ADC_CLK_2 + * @arg @ref LL_ADC_CLK_1P6 + * @arg @ref LL_ADC_CLK_1 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_clock(uint32_t clk) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->MSIO_PAD_CFG_1, AON_MSIO_PAD_CFG_1_ADC_CLK_SEL, clk); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return source for ADC clock. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | MSIO_PAD_CFG_1 | ADC_CLK_SEL | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_CLK_16 + * @arg @ref LL_ADC_CLK_8 + * @arg @ref LL_ADC_CLK_4 + * @arg @ref LL_ADC_CLK_2 + * @arg @ref LL_ADC_CLK_1P6 + * @arg @ref LL_ADC_CLK_1 + */ +__STATIC_INLINE uint32_t ll_adc_get_clock(void) +{ + return (uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_MSIO_PAD_CFG_1_ADC_CLK_SEL) >> AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos); +} + +/** + * @brief Set ADC bias reference. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG1 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param value This parameter can be one of the following values: + * @arg @ref LL_ADC_REF_VALUE_0P8 + * @arg @ref LL_ADC_REF_VALUE_1P2 + * @arg @ref LL_ADC_REF_VALUE_1P6 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_ref_value(uint32_t value) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_VALUE_Msk, value); +} + +/** + * @brief Return ADC bias reference. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG1 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_REF_VALUE_0P8 + * @arg @ref LL_ADC_REF_VALUE_1P2 + * @arg @ref LL_ADC_REF_VALUE_1P6 + */ +__STATIC_INLINE uint32_t ll_adc_get_ref_value(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_VALUE_Msk) >> AON_SNSADC_CFG_REF_VALUE_Pos); +} + +/** + * @brief Enable temperature sensor. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable_temp(void) +{ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_TEMP_EN_Msk); +} + +/** + * @brief Disable temperature sensor. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable_temp(void) +{ + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_TEMP_EN_Msk); +} + +/** + * @brief Check if temperature sensor is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled_temp(void) +{ + return (READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_TEMP_EN_Msk) == (AON_SNSADC_CFG_TEMP_EN_Msk)); +} + +/** + * @brief Enable Vbattery sensor. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable_vbat(void) +{ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_VBAT_EN_Msk); +} + +/** + * @brief Disable Vbattery sensor. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable_vbat(void) +{ + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_VBAT_EN_Msk); +} + +/** + * @brief Check if Vbattery sensor is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled_vbat(void) +{ + return (READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_VBAT_EN_Msk) == (AON_SNSADC_CFG_VBAT_EN_Msk)); +} + +/** + * @brief Set ADC input mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param mode This parameter can be one of the following values: + * @arg @ref LL_ADC_INPUT_SINGLE + * @arg @ref LL_ADC_INPUT_DIFFERENTIAL + * @retval None + */ +__STATIC_INLINE void ll_adc_set_input_mode(uint32_t mode) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_SINGLE_EN_Msk, mode); +} + +/** + * @brief Return ADC input mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_INPUT_SINGLE + * @arg @ref LL_ADC_INPUT_DIFFERENTIAL + */ +__STATIC_INLINE uint32_t ll_adc_get_input_mode(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_SINGLE_EN_Msk) >> AON_SNSADC_CFG_SINGLE_EN_Pos); +} + +/** + * @brief Enable offset calibration. + * @note Enable offset calibration, used to swap inputs of comparator for offset + * calibration. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable_ofs_cal(void) +{ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_OFS_CAL_EN_Msk); +} + +/** + * @brief Disable offset calibration. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable_ofs_cal(void) +{ + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_OFS_CAL_EN_Msk); +} + +/** + * @brief Check if offset calibration is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled_ofs_cal(void) +{ + return (READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_OFS_CAL_EN_Msk) == (AON_SNSADC_CFG_OFS_CAL_EN_Msk)); +} + +/** + * @brief Set dynamic rang of ADC. + * @note When higher input signal frequencies close to Nyquist rate, you should set 1. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param rang This parameter can be a value between: 1 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_dynamic_rang(uint32_t rang) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_DYMAMIC_Msk, (rang & 0x7) << AON_SNSADC_CFG_DYMAMIC_Pos); +} + +/** + * @brief Return ADC dynamic rang. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG2 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be a value between: 1 ~ 7 + */ +__STATIC_INLINE uint32_t ll_adc_get_dynamic_rang(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_DYMAMIC_Msk) >> AON_SNSADC_CFG_DYMAMIC_Pos); +} + +/** + * @brief Set source of ADC input channelP. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG3 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param source This parameter can be one of the following values: + * @arg @ref LL_ADC_INPUT_SRC_IO0 + * @arg @ref LL_ADC_INPUT_SRC_IO1 + * @arg @ref LL_ADC_INPUT_SRC_IO2 + * @arg @ref LL_ADC_INPUT_SRC_IO3 + * @arg @ref LL_ADC_INPUT_SRC_IO4 + * @arg @ref LL_ADC_INPUT_SRC_TMP + * @arg @ref LL_ADC_INPUT_SRC_BAT + * @retval None + */ +__STATIC_INLINE void ll_adc_set_channelp(uint32_t source) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_CHN_P_Msk, source << AON_SNSADC_CFG_CHN_P_Pos); +} + +/** + * @brief Return source of ADC input channelP. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG3 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_INPUT_SRC_IO0 + * @arg @ref LL_ADC_INPUT_SRC_IO1 + * @arg @ref LL_ADC_INPUT_SRC_IO2 + * @arg @ref LL_ADC_INPUT_SRC_IO3 + * @arg @ref LL_ADC_INPUT_SRC_IO4 + * @arg @ref LL_ADC_INPUT_SRC_TMP + * @arg @ref LL_ADC_INPUT_SRC_BAT + */ +__STATIC_INLINE uint32_t ll_adc_get_channelp(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_CHN_P_Msk) >> AON_SNSADC_CFG_CHN_P_Pos); +} + +/** + * @brief Set source of ADC input channelN. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG3 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param source This parameter can be one of the following values: + * @arg @ref LL_ADC_INPUT_SRC_IO0 + * @arg @ref LL_ADC_INPUT_SRC_IO1 + * @arg @ref LL_ADC_INPUT_SRC_IO2 + * @arg @ref LL_ADC_INPUT_SRC_IO3 + * @arg @ref LL_ADC_INPUT_SRC_IO4 + * @arg @ref LL_ADC_INPUT_SRC_TMP + * @arg @ref LL_ADC_INPUT_SRC_BAT + * @retval None + */ +__STATIC_INLINE void ll_adc_set_channeln(uint32_t source) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_CHN_N_Msk, source << AON_SNSADC_CFG_CHN_N_Pos); +} + +/** + * @brief Return source of ADC input channelN. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG3 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_INPUT_SRC_IO0 + * @arg @ref LL_ADC_INPUT_SRC_IO1 + * @arg @ref LL_ADC_INPUT_SRC_IO2 + * @arg @ref LL_ADC_INPUT_SRC_IO3 + * @arg @ref LL_ADC_INPUT_SRC_IO4 + * @arg @ref LL_ADC_INPUT_SRC_TMP + * @arg @ref LL_ADC_INPUT_SRC_BAT + */ +__STATIC_INLINE uint32_t ll_adc_get_channeln(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_CHN_N_Msk) >> AON_SNSADC_CFG_CHN_N_Pos); +} + +/** + * @brief Enable ADC MAS_RST. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_enable_mas_rst(void) +{ + SET_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_MAS_RST_Msk); +} + +/** + * @brief Disable ADC MAS_RST. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_adc_disable_mas_rst(void) +{ + CLEAR_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_MAS_RST_Msk); +} + +/** + * @brief Check if ADC MAS_RST is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_enabled_mas_rst(void) +{ + return (READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_MAS_RST_Msk) == (AON_SNSADC_CFG_MAS_RST_Msk)); +} + +/** + * @brief Set source of ADC reference. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param source This parameter can be one of the following values: + * @arg @ref LL_ADC_REF_SRC_BUF_INT + * @arg @ref LL_ADC_REF_SRC_IO0 + * @arg @ref LL_ADC_REF_SRC_IO1 + * @arg @ref LL_ADC_REF_SRC_IO2 + * @arg @ref LL_ADC_REF_SRC_IO3 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_ref(uint32_t source) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_SEL_Msk, source); +} + +/** + * @brief Return source of ADC reference. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_ADC_REF_SRC_BUF_INT + * @arg @ref LL_ADC_REF_SRC_IO0 + * @arg @ref LL_ADC_REF_SRC_IO1 + * @arg @ref LL_ADC_REF_SRC_IO2 + * @arg @ref LL_ADC_REF_SRC_IO3 + */ +__STATIC_INLINE uint32_t ll_adc_get_ref(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_SEL_Msk) >> AON_SNSADC_CFG_REF_SEL_Pos); +} + +/** + * @brief Set current of ADC reference circuit. + * @note When samples at 100kbps, you should set 0. + * When samples at 1mbps, you should set 7. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @param source This parameter can be a value between: 0 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_ref_current(uint32_t source) +{ + MODIFY_REG(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_HP_Msk, (source & 0x7) << AON_SNSADC_CFG_REF_HP_Pos); +} + +/** + * @brief Return current of ADC reference circuit. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SNSADC_CFG | REG4 | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be a value between: 0 ~ 7 + */ +__STATIC_INLINE uint32_t ll_adc_get_ref_current(void) +{ + return (uint32_t)(READ_BITS(AON->SNSADC_CFG, AON_SNSADC_CFG_REF_HP_Msk) >> AON_SNSADC_CFG_REF_HP_Pos); +} + +/** @} */ + +/** @defgroup LL_ADC_EF_FIFO_Access FIFO Access + * @{ + */ + +/** + * @brief Return samples value of ADC by reading FIFO. + * @note There are two value in the register, both of them is 16bits. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SENSE_ADC_FIFO | SENSE_ADC_FIFO | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Smaples value of input + */ +__STATIC_INLINE uint32_t ll_adc_read_fifo(void) +{ + return (uint32_t)(READ_REG(MCU_SUB->SENSE_ADC_FIFO)); +} + +/** + * @brief Set threshold of ADC FIFO. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SENSE_FF_THRESH | SENSE_FF_THRESH | + * +----------------------+-----------------------------+ + * \endrst + * + * @param thresh This parameter can be a value between: 0 ~ 64 + * @retval None + */ +__STATIC_INLINE void ll_adc_set_thresh(uint32_t thresh) +{ + MODIFY_REG(MCU_SUB->SENSE_FF_THRESH, MCU_SUB_SNSADC_FF_THRESH, (thresh & 0x3F) << MCU_SUB_SNSADC_FF_THRESH_Pos); +} + +/** + * @brief Return threshold of ADC FIFO. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SENSE_FF_THRESH | SENSE_FF_THRESH | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be a value between: 0 ~ 64 + */ +__STATIC_INLINE uint32_t ll_adc_get_thresh(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->SENSE_FF_THRESH, MCU_SUB_SNSADC_FF_THRESH) >> MCU_SUB_SNSADC_FF_THRESH_Pos); +} + +/** + * @brief Check if ADC FIFO is not empty. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SENSE_ADC_STAT | VAL | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_adc_is_fifo_notempty(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->SENSE_ADC_STAT, MCU_SUB_SNSADC_STAT_VAL) == MCU_SUB_SNSADC_STAT_VAL); +} + +/** + * @brief Return count of ADC FIFO. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SENSE_ADC_STAT | FF_COUNT | + * +----------------------+-----------------------------+ + * \endrst + * + * @retval Returned value can be a value between: 0 ~ 64 + */ +__STATIC_INLINE uint32_t ll_adc_get_fifo_count(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->SENSE_ADC_STAT, MCU_SUB_SNSADC_STAT_FF_COUNT) >> MCU_SUB_SNSADC_STAT_FF_COUNT_Pos); +} + +/** @} */ + +/** @defgroup LL_ADC_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize ADC registers (Registers restored to their default values). + * @retval An error_status_t enumeration value: + * - SUCCESS: ADC registers are de-initialized + * - ERROR: ADC registers are not de-initialized + */ +error_status_t ll_adc_deinit(void); + +/** + * @brief Initialize ADC registers according to the specified. + * parameters in p_adc_init. + * @param p_adc_init Pointer to a ll_adc_init_t structure that contains the configuration + * information for the specified ADC peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: ADC registers are initialized according to p_adc_init content + * - ERROR: Problem occurred during ADC Registers initialization + */ +error_status_t ll_adc_init(ll_adc_init_t *p_adc_init); + +/** + * @brief Set each field of a @ref ll_adc_init_t type structure to default value. + * @param p_adc_init Pointer to a @ref ll_adc_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_adc_struct_init(ll_adc_init_t *p_adc_init); + +/** @} */ + +/** @} */ + +#endif /* AON */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_ADC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aes.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aes.h new file mode 100644 index 0000000..afde7df --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aes.h @@ -0,0 +1,1693 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_aes.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AES LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_AES AES + * @brief AES LL module driver. + * @{ + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_AES_H__ +#define __GR55XX_LL_AES_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (AES) + +/** @defgroup AES_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup AES_LL_ES_INIT AES Exported Init structures + * @{ + */ + +/** + * @brief LL AES Init Structure definition + */ +typedef struct _ll_aes_init +{ + uint32_t key_size; /**< 128, 192 or 256-bit key length. + This parameter can be a value of @ref AES_LL_EC_KEY_SIZE */ + + uint32_t *p_key; /**< Encryption/Decryption Key */ + + uint32_t *p_init_vector; /**< Initialization Vector used for CBC modes */ + + uint32_t *p_seed; /**< Random seeds */ + +} ll_aes_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup AES_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup AES_LL_Exported_Constants AES Exported Constants + * @{ + */ + +/** @defgroup AES_LL_EC_GET_FLAG Get Flag Defines + * @brief Flag definitions which can be used with LL_AES_ReadReg function + * @{ + */ +#define LL_AES_FLAG_DATAREADY AES_STATUS_READY /**< AES result data out ready */ +#define LL_AES_FLAG_DMA_DONE AES_STATUS_TRANSDONE /**< AES dma transfer done */ +#define LL_AES_FLAG_DMA_ERR AES_STATUS_TRANSERR /**< AES dma transfer error */ +#define LL_AES_FLAG_KEY_VALID AES_STATUS_KEYVALID /**< AES has fetched key */ +/** @} */ + +/** @defgroup AES_LL_EC_KEY_SIZE Key Size + * @{ + */ +#define LL_AES_KEY_SIZE_128 0x00000000U /**< 128 bits */ +#define LL_AES_KEY_SIZE_192 (1UL << AES_CONFIG_KEYMODE_Pos) /**< 192 bits */ +#define LL_AES_KEY_SIZE_256 (2UL << AES_CONFIG_KEYMODE_Pos) /**< 256 bits */ +/** @} */ + +/** @defgroup AES_LL_EC_OPERATION_MODE Operation Mode + * @{ + */ +#define LL_AES_OPERATION_MODE_ECB 0x00000000U /**< Electronic codebook (ECB) mode */ +#define LL_AES_OPERATION_MODE_CBC (1UL << AES_CONFIG_OPMODE_Pos) /**< Cipher block chaining (CBC) mode */ +/** @} */ + +/** @defgroup AES_LL_EC_KEY_TYPE Key Type + * @{ + */ +#define LL_AES_KEYTYPE_MCU 0x00000000U /**< MCU */ +#define LL_AES_KEYTYPE_AHB (1UL << AES_CONFIG_KEYTYPE_Pos) /**< AHB master */ +#define LL_AES_KEYTYPE_KRAM (2UL << AES_CONFIG_KEYTYPE_Pos) /**< Key Port */ +/** @} */ + +/** @defgroup AES_LL_EC_TRANSFER_SIZE Transfer Size + * @{ + */ +#define LL_AES_DMA_TRANSIZE_MIN (1) /**< Min size = 1 block */ +#define LL_AES_DMA_TRANSIZE_MAX (2048) /**< Max size = 2048 blocks */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup AES_LL_Exported_Macros AES Exported Macros + * @{ + */ + +/** @defgroup AES_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in AES register + * @param __INSTANCE__ AES Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_AES_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in AES register + * @param __INSTANCE__ AES Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_AES_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup AES_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup AES_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable AES. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable(aes_regs_t *AESx) +{ + SET_BITS(AESx->CTRL, AES_CTRL_ENABLE); +} + +/** + * @brief Disable AES. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CTRL, AES_CTRL_ENABLE); +} + +/** + * @brief Indicate whether the AES is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CTRL, AES_CTRL_ENABLE) == (AES_CTRL_ENABLE)); +} + +/** + * @brief Enable AES start in MCU mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_NORMAL | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_start(aes_regs_t *AESx) +{ + SET_BITS(AESx->CTRL, AES_CTRL_START_NORMAL); +} + +/** + * @brief Disable AES start in MCU mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_NORMAL | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_start(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CTRL, AES_CTRL_START_NORMAL); +} + +/** + * @brief Indicate whether the AES start in MCU mode is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_NORMAL | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_start(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CTRL, AES_CTRL_START_NORMAL) == (AES_CTRL_START_NORMAL)); +} + +/** + * @brief Enable AES DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_dma_start(aes_regs_t *AESx) +{ + SET_BITS(AESx->CTRL, AES_CTRL_START_DMA); +} + +/** + * @brief Disable AES DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_dma_start(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CTRL, AES_CTRL_START_DMA); +} + +/** + * @brief Indicate whether the AES DMA mode is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_dma_start(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CTRL, AES_CTRL_START_DMA) == (AES_CTRL_START_DMA)); +} + +/** + * @brief Enable fetch key through AHB/key port. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CTRL | ENABLE_RKEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_read_key(aes_regs_t *AESx) +{ + SET_BITS(AESx->CTRL, AES_CTRL_ENABLE_RKEY); +} + +/** + * @brief Set AES key size. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | KEYMODE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param size This parameter can be one of the following values: + * @arg @ref LL_AES_KEY_SIZE_128 + * @arg @ref LL_AES_KEY_SIZE_192 + * @arg @ref LL_AES_KEY_SIZE_256 + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_size(aes_regs_t *AESx, uint32_t size) +{ + MODIFY_REG(AESx->CONFIG, AES_CONFIG_KEYMODE, size); +} + +/** + * @brief Get AES key size. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | KEYMODE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_AES_KEY_SIZE_128 + * @arg @ref LL_AES_KEY_SIZE_192 + * @arg @ref LL_AES_KEY_SIZE_256 + */ +__STATIC_INLINE uint32_t ll_aes_get_key_size(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_KEYMODE)); +} + +/** + * @brief Enable AES full mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_FULLMASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_full_mask(aes_regs_t *AESx) +{ + SET_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_FULLMASK); +} + +/** + * @brief Disable AES full mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_FULLMASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_full_mask(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_FULLMASK); +} + +/** + * @brief Indicate whether the AES full mask is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_FULLMASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_full_mask(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_FULLMASK) == (AES_CONFIG_ENABLE_FULLMASK)); +} + +/** + * @brief Enable AES encryption mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_ENCRYPTION | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_encryption(aes_regs_t *AESx) +{ + SET_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_ENCRYPTION); +} + +/** + * @brief Disable AES encryption mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_ENCRYPTION | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_encryption(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_ENCRYPTION); +} + +/** + * @brief Indicate whether the AES encryption mode is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENABLE_ENCRYPTION | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_encryption(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_ENABLE_ENCRYPTION) == (AES_CONFIG_ENABLE_ENCRYPTION)); +} + +/** + * @brief Set AES to load seed for LFSR. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | LOADSEED | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_set_load_seed(aes_regs_t *AESx) +{ + SET_BITS(AESx->CONFIG, AES_CONFIG_LOADSEED); +} + +/** + * @brief Set AES in first block before starting the first block in normal CBC and DMA CBC mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | FIRSTBLOCK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_set_first_block(aes_regs_t *AESx) +{ + SET_BITS(AESx->CONFIG, AES_CONFIG_FIRSTBLOCK); +} + +/** + * @brief Enable AES in little endian. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_little_endian(aes_regs_t *AESx) +{ + SET_BITS(AESx->CONFIG, AES_CONFIG_ENDIAN); +} + +/** + * @brief Disable AES in little endian. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_little_endian(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->CONFIG, AES_CONFIG_ENDIAN); +} + +/** + * @brief Indicate whether the AES is in little endian. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_little_endian(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_ENDIAN) == (AES_CONFIG_ENDIAN)); +} + +/** + * @brief Set AES operation mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | OPMODE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param mode This parameter can be one of the following values: + * @arg @ref LL_AES_OPERATION_MODE_ECB + * @arg @ref LL_AES_OPERATION_MODE_CBC + * @retval None + */ +__STATIC_INLINE void ll_aes_set_operation_mode(aes_regs_t *AESx, uint32_t mode) +{ + MODIFY_REG(AESx->CONFIG, AES_CONFIG_OPMODE, mode); +} + +/** + * @brief Get AES operation mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | OPMODE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_AES_OPERATION_MODE_ECB + * @arg @ref LL_AES_OPERATION_MODE_CBC + */ +__STATIC_INLINE uint32_t ll_aes_get_operation_mode(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_OPMODE)); +} + +/** + * @brief Set ways to obtain AES key. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | KEYTYPE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param Type This parameter can be one of the following values: + * @arg @ref LL_AES_KEYTYPE_MCU + * @arg @ref LL_AES_KEYTYPE_AHB + * @arg @ref LL_AES_KEYTYPE_KRAM + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_type(aes_regs_t *AESx, uint32_t Type) +{ + MODIFY_REG(AESx->CONFIG, AES_CONFIG_KEYTYPE, Type); +} + +/** + * @brief Get ways to obtain AES key. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | CONFIG | KEYTYPE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_AES_KEYTYPE_MCU + * @arg @ref LL_AES_KEYTYPE_AHB + * @arg @ref LL_AES_KEYTYPE_KRAM + */ +__STATIC_INLINE uint32_t ll_aes_get_key_type(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->CONFIG, AES_CONFIG_KEYTYPE)); +} + +/** @} */ + +/** @defgroup AES_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable AES the done interrupt. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_enable_it_done(aes_regs_t *AESx) +{ + SET_BITS(AESx->INTERRUPT, AES_INTERRUPT_ENABLE); +} + +/** + * @brief Disable AES the done interrupt. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_disable_it_done(aes_regs_t *AESx) +{ + CLEAR_BITS(AESx->INTERRUPT, AES_INTERRUPT_ENABLE); +} + +/** + * @brief Indicate whether the done interrupt is enabled. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_enabled_it_done(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->INTERRUPT, AES_INTERRUPT_ENABLE) == (AES_INTERRUPT_ENABLE)); +} + +/** @} */ + +/** @defgroup AES_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Indicate whether the ready flag is set. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | STATUS | READY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_action_flag_ready(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->STATUS, AES_STATUS_READY) == AES_STATUS_READY); +} + +/** + * @brief Indicate whether the DMA transfer done flag is set. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | STATUS | TRANSDONE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_action_flag_dma_done(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->STATUS, AES_STATUS_TRANSDONE) == AES_STATUS_TRANSDONE); +} + +/** + * @brief Indicate whether the DMA transfer error flag is set. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | STATUS | TRANSERR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_action_flag_dma_error(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->STATUS, AES_STATUS_TRANSERR) == AES_STATUS_TRANSERR); +} + +/** + * @brief Indicate whether the key valid flag is set. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | STATUS | KEYVALID | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_action_flag_key_valid(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->STATUS, AES_STATUS_KEYVALID) == AES_STATUS_KEYVALID); +} + +/** + * @brief Indicate whether the done interrupt flag is set. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | INTERRUPT | DONE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aes_is_action_flag_it_done(aes_regs_t *AESx) +{ + return (READ_BITS(AESx->INTERRUPT, AES_INTERRUPT_DONE) == AES_INTERRUPT_DONE); +} + +/** + * @brief Clear the done interrupt flag. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | INTERRUPT | DONE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval None + */ +__STATIC_INLINE void ll_aes_clear_flag_it_done(aes_regs_t *AESx) +{ + SET_BITS(AESx->INTERRUPT, AES_INTERRUPT_DONE); +} + +/** @} */ + +/** @defgroup AES_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Set AES transfer blocks in DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | TRAN_SIZE | TRAN_SIZE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param block This parameter can be one of the following values: 1 ~ 2048. + * @retval None + */ +__STATIC_INLINE void ll_aes_set_dma_transfer_block(aes_regs_t *AESx, uint32_t block) +{ + MODIFY_REG(AESx->TRAN_SIZE, AES_TRAN_SIZE, (block << 4) - 1); +} + +/** + * @brief Get AES transfer blocks in DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | TRAN_SIZE | TRAN_SIZE | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Return value between 1 and 2048. + */ +__STATIC_INLINE uint32_t ll_aes_get_dma_transfer_block(aes_regs_t *AESx) +{ + return ((READ_BITS(AESx->TRAN_SIZE, AES_TRAN_SIZE) + 1) >> 4); +} + +/** + * @brief Set AES read address of RAM in DMA mode. + * @note This read address of RAM requires 4 byte alignment. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | RSTART_ADDR | RSTART_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param address This parameter can be a address in RAM area (0x30000000 ~ 0x3003FFFF). + * @retval None + */ +__STATIC_INLINE void ll_aes_set_dma_read_address(aes_regs_t *AESx, uint32_t address) +{ + WRITE_REG(AESx->RSTART_ADDR, address); +} + +/** + * @brief Get AES read address of RAM in DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | RSTART_ADDR | RSTART_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the read address in RAM. + */ +__STATIC_INLINE uint32_t ll_aes_get_dma_read_address(aes_regs_t *AESx) +{ + return (READ_REG(AESx->RSTART_ADDR)); +} + +/** + * @brief Set AES write address of RAM in DMA mode. + * @note This write address of RAM requires 4 byte alignment. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | WSTART_ADDR | WSTART_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param address This parameter can be a address in RAM area (0x30000000 ~ 0x3003FFFF). + * @retval None + */ +__STATIC_INLINE void ll_aes_set_dma_write_address(aes_regs_t *AESx, uint32_t address) +{ + WRITE_REG(AESx->WSTART_ADDR, address); +} + +/** + * @brief Get AES write address of RAM in DMA mode. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | WSTART_ADDR | WSTART_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the wrute address in RAM + */ +__STATIC_INLINE uint32_t ll_aes_get_dma_write_address(aes_regs_t *AESx) +{ + return (READ_REG(AESx->WSTART_ADDR)); +} + +/** @} */ + +/** @defgroup AES_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Set AES key address in memory. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY_ADDR | KEY_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param address This parameter can be one of the address in RAM + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_address(aes_regs_t *AESx, uint32_t address) +{ + WRITE_REG(AESx->KEY_ADDR, address); +} + +/** + * @brief Get AES key address in memory. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY_ADDR | KEY_ADDR | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the key address in RAM. + */ +__STATIC_INLINE uint32_t ll_aes_get_key_address(aes_regs_t *AESx) +{ + return (READ_REG(AESx->KEY_ADDR)); +} + +/** + * @brief Get AES output data[127:96]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_OUT[0] | DATA_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Output Data[127:96] + */ +__STATIC_INLINE uint32_t ll_aes_get_data_127_96(aes_regs_t *AESx) +{ + return (READ_REG(AESx->DATA_OUT[0])); +} + +/** + * @brief Get AES output data[95:64]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_OUT[1] | DATA_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Output Data[95:64] + */ +__STATIC_INLINE uint32_t ll_aes_get_data_95_64(aes_regs_t *AESx) +{ + return (READ_REG(AESx->DATA_OUT[1])); +} + +/** + * @brief Get AES output data[63:32]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_OUT[2] | DATA_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Output Data[63:32] + */ +__STATIC_INLINE uint32_t ll_aes_get_data_63_32(aes_regs_t *AESx) +{ + return (READ_REG(AESx->DATA_OUT[2])); +} + +/** + * @brief Get AES output data[31:0]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_OUT[3] | DATA_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Output Data[31:0] + */ +__STATIC_INLINE uint32_t ll_aes_get_data_31_0(aes_regs_t *AESx) +{ + return (READ_REG(AESx->DATA_OUT[3])); +} + +/** + * @brief Set AES key[255:224]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[0] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_255_224(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[0], key); +} + +/** + * @brief Set AES key[223:192]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[1] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_223_192(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[1], key); +} + +/** + * @brief Set AES key[191:160]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[2] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_191_160(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[2], key); +} + +/** + * @brief Set AES key[159:128]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[3] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_159_128(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[3], key); +} + +/** + * @brief Set AES key[127:96]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[4] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_127_96(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[4], key); +} + +/** + * @brief Set AES key[95:64]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[5] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_95_64(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[5], key); +} + +/** + * @brief Set AES key[63:32]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[6] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_63_32(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[6], key); +} + +/** + * @brief Set AES key[31:0]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KEY[7] | KEY | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_31_0(aes_regs_t *AESx, uint32_t key) +{ + WRITE_REG(AESx->KEY[7], key); +} + +/** + * @brief Set AES input seed. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_IN | SEED_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param seed This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_seed_in(aes_regs_t *AESx, uint32_t seed) +{ + WRITE_REG(AESx->SEED_IN, seed); +} + +/** + * @brief Get AES input seed. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_IN | SEED_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the input seed. + */ +__STATIC_INLINE uint32_t ll_aes_get_seed_in(aes_regs_t *AESx) +{ + return (READ_REG(AESx->SEED_IN)); +} + +/** + * @brief Set AES output seed. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_OUT | SEED_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param seed This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_seed_out(aes_regs_t *AESx, uint32_t seed) +{ + WRITE_REG(AESx->SEED_OUT, seed); +} + +/** + * @brief Get AES output seed. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_OUT | SEED_OUT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the output seed. + */ +__STATIC_INLINE uint32_t ll_aes_get_seed_out(aes_regs_t *AESx) +{ + return (READ_REG(AESx->SEED_OUT)); +} + +/** + * @brief Set sbox input data's mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_IMASK | SEED_IMASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param mask This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_seed_Imask(aes_regs_t *AESx, uint32_t mask) +{ + WRITE_REG(AESx->SEED_IMASK, mask); +} + +/** + * @brief Get sbox input data's mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_IMASK | SEED_IMASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the input data's mask. + */ +__STATIC_INLINE uint32_t ll_aes_get_seed_Imask(aes_regs_t *AESx) +{ + return (READ_REG(AESx->SEED_IMASK)); +} + +/** + * @brief Set sbox output data's mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_OSBOX | SEED_OSBOX | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param mask This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_seed_Osbox(aes_regs_t *AESx, uint32_t mask) +{ + WRITE_REG(AESx->SEED_OSBOX, mask); +} + +/** + * @brief Get sbox output data's mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | SEED_OSBOX | SEED_OSBOX | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @retval Returned value is the output data's mask. + */ +__STATIC_INLINE uint32_t ll_aes_get_seed_Osbox(aes_regs_t *AESx) +{ + return (READ_REG(AESx->SEED_OSBOX)); +} + +/** + * @brief Set AES initialization vector[127:96]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | VECTOR_INIT[0] | VECTOR_INIT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param vector This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_vector_127_96(aes_regs_t *AESx, uint32_t vector) +{ + WRITE_REG(AESx->VECTOR_INIT[0], vector); +} + +/** + * @brief Set AES initialization vector[95:64]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | VECTOR_INIT[1] | VECTOR_INIT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param vector This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_vector_95_64(aes_regs_t *AESx, uint32_t vector) +{ + WRITE_REG(AESx->VECTOR_INIT[1], vector); +} + +/** + * @brief Set AES initialization vector[63:32]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | VECTOR_INIT[2] | VECTOR_INIT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param vector This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_vector_63_32(aes_regs_t *AESx, uint32_t vector) +{ + WRITE_REG(AESx->VECTOR_INIT[2], vector); +} + +/** + * @brief Set AES initialization vector[31:0]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | VECTOR_INIT[3] | VECTOR_INIT | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param vector This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_vector_31_0(aes_regs_t *AESx, uint32_t vector) +{ + WRITE_REG(AESx->VECTOR_INIT[3], vector); +} + +/** + * @brief Set AES input data[127:96]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_IN[0] | DATA_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param data This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_data_127_96(aes_regs_t *AESx, uint32_t data) +{ + WRITE_REG(AESx->DATA_IN[0], data); +} + +/** + * @brief Set AES input data[95:64]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_IN[1] | DATA_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param data This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_data_95_64(aes_regs_t *AESx, uint32_t data) +{ + WRITE_REG(AESx->DATA_IN[1], data); +} + +/** + * @brief Set AES input data[63:32]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_IN[2] | DATA_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param data This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_data_63_32(aes_regs_t *AESx, uint32_t data) +{ + WRITE_REG(AESx->DATA_IN[2], data); +} + +/** + * @brief Set AES input data[31:0]. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | DATA_IN[3] | DATA_IN | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param data This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_data_31_0(aes_regs_t *AESx, uint32_t data) +{ + WRITE_REG(AESx->DATA_IN[3], data); +} + +/** + * @brief Set AES fetch key port mask. + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | KPORT_MASK | KPORT_MASK | + * +----------------------+-----------------------------+ + * \endrst + * + * @param AESx AES instance + * @param mask This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_aes_set_key_port_mask(aes_regs_t *AESx, uint32_t mask) +{ + WRITE_REG(AESx->KPORT_MASK, mask); +} + +/** @} */ + +/** @defgroup AES_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize AES registers (Registers restored to their default values). + * @param AESx AES Instance + * @retval An error_status_t enumeration value: + * - SUCCESS: AES registers are de-initialized + * - ERROR: AES registers are not de-initialized + */ +error_status_t ll_aes_deinit(aes_regs_t *AESx); + +/** + * @brief Initialize AES registers according to the specified + * parameters in p_aes_init. + * @param AESx AES Instance + * @param p_aes_init Pointer to a ll_aes_init_t structure that contains the configuration + * information for the specified AES peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: AES registers are initialized according to p_aes_init content + * - ERROR: Problem occurred during AES Registers initialization + */ +error_status_t ll_aes_init(aes_regs_t *AESx, ll_aes_init_t *p_aes_init); + +/** + * @brief Set each field of a @ref ll_aes_init_t type structure to default value. + * @param p_aes_init Pointer to a @ref ll_aes_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_aes_struct_init(ll_aes_init_t *p_aes_init); + +/** @} */ + +/** @} */ + +#endif /* AES */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_AES_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_gpio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_gpio.h new file mode 100644 index 0000000..fd632a1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_gpio.h @@ -0,0 +1,1236 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_aon_gpio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AON GPIO LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_AON_GPIO AON_GPIO + * @brief AON_GPIO LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_AON_GPIO_H__ +#define __GR55XX_LL_AON_GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** @defgroup AON_GPIO_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup AON_GPIO_LL_ES_INIT AON_GPIO Exported init structures + * @{ + */ + +/** + * @brief LL AON_GPIO init Structure definition + */ +typedef struct _ll_aon_gpio_init +{ + uint32_t pin; /**< Specifies the AON_GPIO pins to be AON_GPIO_InitStructured. + This parameter can be any value of @ref AON_GPIO_LL_EC_PIN */ + + uint32_t mode; /**< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref AON_GPIO_LL_EC_MODE. + + AON_GPIO HW AON_GPIO_InitStructuration can be modified afterwards using unitary function @ref ll_aon_gpio_set_pin_mode(). */ + + uint32_t pull; /**< Specifies the operating Pull-up/Pull down for the selected pins. + This parameter can be a value of @ref AON_GPIO_LL_EC_PULL. + + AON_GPIO HW configuration can be modified afterwards using unitary function @ref ll_aon_gpio_set_pin_pull().*/ + + uint32_t mux; /*!< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref AON_GPIO_LL_EC_MUX. + + GPIO HW AON_GPIO_InitStructuration can be modified afterwards using unitary function + @ref ll_aon_gpio_set_mux_pin_0_7(). */ + + uint32_t trigger; /**< Specifies the trigger signal active edge. + This parameter can be a value of @ref AON_GPIO_LL_EC_TRIGGER. */ +} ll_aon_gpio_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup AON_GPIO_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup AON_GPIO_LL_Exported_Constants AON_GPIO Exported Constants + * @{ + */ + +/** @defgroup AON_GPIO_LL_EC_PIN PIN + * @{ + */ +#define LL_AON_GPIO_PIN_0 ((uint32_t)0x01U) /**< Select pin 0 */ +#define LL_AON_GPIO_PIN_1 ((uint32_t)0x02U) /**< Select pin 1 */ +#define LL_AON_GPIO_PIN_2 ((uint32_t)0x04U) /**< Select pin 2 */ +#define LL_AON_GPIO_PIN_3 ((uint32_t)0x08U) /**< Select pin 3 */ +#define LL_AON_GPIO_PIN_4 ((uint32_t)0x10U) /**< Select pin 4 */ +#define LL_AON_GPIO_PIN_5 ((uint32_t)0x20U) /**< Select pin 5 */ +#define LL_AON_GPIO_PIN_6 ((uint32_t)0x40U) /**< Select pin 6 */ +#define LL_AON_GPIO_PIN_7 ((uint32_t)0x80U) /**< Select pin 7 */ +#define LL_AON_GPIO_PIN_ALL ((uint32_t)0xFFU) /**< Select all pins */ +/** @} */ + +/** @defgroup AON_GPIO_LL_EC_MODE Mode + * @{ + */ +#define LL_AON_GPIO_MODE_INPUT ((uint32_t)0x0U) /**< Select input mode */ +#define LL_AON_GPIO_MODE_OUTPUT ((uint32_t)0x1U) /**< Select output mode */ +#define LL_AON_GPIO_MODE_MUX ((uint32_t)0x2U) /**< Select mux peripheral mode */ +/** @} */ + +/** @defgroup AON_GPIO_LL_EC_PULL Pull Up Pull Down + * @{ + */ +#define LL_AON_GPIO_PULL_NO LL_AON_GPIO_RE_N /**< Select I/O no pull */ +#define LL_AON_GPIO_PULL_UP LL_AON_GPIO_RTYP /**< Select I/O pull up */ +#define LL_AON_GPIO_PULL_DOWN ((uint32_t)0x0U) /**< Select I/O pull down */ +/** @} */ + +/** @defgroup AON_GPIO_LL_EC_MUX Alternate Function + * @{ + */ +#define LL_AON_GPIO_MUX_0 ((uint32_t)0x0U) /*!< Select alternate function 0 */ +#define LL_AON_GPIO_MUX_1 ((uint32_t)0x1U) /*!< Select alternate function 1 */ +#define LL_AON_GPIO_MUX_2 ((uint32_t)0x2U) /*!< Select alternate function 2 */ +#define LL_AON_GPIO_MUX_3 ((uint32_t)0x3U) /*!< Select alternate function 3 */ +#define LL_AON_GPIO_MUX_4 ((uint32_t)0x4U) /*!< Select alternate function 4 */ +#define LL_AON_GPIO_MUX_5 ((uint32_t)0x5U) /*!< Select alternate function 5 */ +#define LL_AON_GPIO_MUX_6 ((uint32_t)0x6U) /*!< Select alternate function 6 */ +#define LL_AON_GPIO_MUX_7 ((uint32_t)0x7U) /*!< Select alternate function 7 */ +#define LL_AON_GPIO_MUX_8 ((uint32_t)0x8U) /*!< Select alternate function 8 */ +/** @} */ + + +/** @defgroup AON_GPIO_LL_EC_TRIGGER Interrupt Trigger + * @{ + */ +#define LL_AON_GPIO_TRIGGER_NONE ((uint32_t)0x00U) /**< No Trigger Mode */ +#define LL_AON_GPIO_TRIGGER_RISING ((uint32_t)0x01U) /**< Trigger Rising Mode */ +#define LL_AON_GPIO_TRIGGER_FALLING ((uint32_t)0x02U) /**< Trigger Falling Mode */ +#define LL_AON_GPIO_TRIGGER_HIGH ((uint32_t)0x03U) /**< Trigger High Mode */ +#define LL_AON_GPIO_TRIGGER_LOW ((uint32_t)0x04U) /**< Trigger Low Mode */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup AON_GPIO_LL_Exported_Macros AON_GPIO Exported Macros + * @{ + */ + +/** @defgroup AON_GPIO_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in AON_GPIO register + * @param __instance__ AON_GPIO instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_AON_GPIO_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in AON_GPIO register + * @param __instance__ AON_GPIO instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_AON_GPIO_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup AON_GPIO_LL_Private_Macros AON_GPIO Private Macros + * @{ + */ + +/** @defgroup AON_GPIO_LL_PM_RESISTOR Resistor Enable + * @{ + */ +#define LL_AON_GPIO_RE_N_Pos AON_PAD_CTL0_GPO_RE_N_Pos /**< Resistor Enable bits position */ +#define LL_AON_GPIO_RE_N_Msk (0x1U << LL_AON_GPIO_RE_N_Pos) /**< Resistor Enable bits mask */ +#define LL_AON_GPIO_RE_N LL_AON_GPIO_RE_N_Msk /**< Resistor Enable bits */ +/** @} */ + +/** @defgroup AON_GPIO_LL_PM_RESISTOR_TYPE Resistor Type + * @{ + */ +#define LL_AON_GPIO_RTYP_Pos AON_PAD_CTL0_GPO_RTYPE_Pos /**< Resistor Type bits position */ +#define LL_AON_GPIO_RTYP_Msk (0x1U << LL_AON_GPIO_RTYP_Pos) /**< Resistor Type bits mask */ +#define LL_AON_GPIO_RTYP LL_AON_GPIO_RTYP_Msk /**< Resistor Type bits */ +/** @} */ + +/** @defgroup AON_GPIO_LL_EC_DEFAULT_CONFIG InitStruct default configuartion + * @{ + */ + +/** + * @brief LL AON_GPIO InitStrcut default configuartion + */ +#define LL_AON_GPIO_DEFAULT_CONFIG \ +{ \ + .pin = LL_AON_GPIO_PIN_ALL, \ + .mode = LL_AON_GPIO_MODE_INPUT, \ + .pull = LL_AON_GPIO_PULL_DOWN, \ + .mux = LL_AON_GPIO_MUX_7, \ + .trigger = LL_AON_GPIO_TRIGGER_NONE, \ +} +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup AON_GPIO_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup AON_GPIO_LL_EF_Port_Configuration Port Configuration + * @{ + */ + +/** + * @brief Set several AON_GPIO pins to input/output mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO_OE_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @param mode This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_MODE_INPUT + * @arg @ref LL_AON_GPIO_MODE_OUTPUT + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_set_pin_mode(uint32_t pin_mask, uint32_t mode) +{ + pin_mask = (pin_mask << AON_PAD_CTL1_AON_GPO_OE_N_Pos) & AON_PAD_CTL1_AON_GPO_OE_N; + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->AON_PAD_CTL1, pin_mask, (mode == LL_AON_GPIO_MODE_INPUT) ? pin_mask : 0); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return gpio mode for a AON_GPIO pin. + * @note I/O mode can be Input mode. General purpose output. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO_OE_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_AON_GPIO_MODE_INPUT + * @arg @ref LL_AON_GPIO_MODE_OUTPUT + */ +__STATIC_INLINE uint32_t ll_aon_gpio_get_pin_mode(uint32_t pin) +{ + pin = (pin << AON_PAD_CTL1_AON_GPO_OE_N_Pos) & AON_PAD_CTL1_AON_GPO_OE_N; + return ((uint32_t)(READ_BITS(AON->AON_PAD_CTL1, pin) != LL_AON_GPIO_MODE_INPUT) ? + LL_AON_GPIO_MODE_OUTPUT : LL_AON_GPIO_MODE_INPUT); +} + +/** + * @brief Configure gpio pull-up or pull-down for a dedicated AON_GPIO pin. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL0 | GPO_RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * AON_PAD_CTL0 | GPO_RTYPE + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @param pull This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_PULL_NO + * @arg @ref LL_AON_GPIO_PULL_UP + * @arg @ref LL_AON_GPIO_PULL_DOWN + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_set_pin_pull(uint32_t pin_mask, uint32_t pull) +{ + uint32_t RTypeMask = (pin_mask << AON_PAD_CTL0_GPO_RTYPE_Pos) & AON_PAD_CTL0_GPO_RTYPE; + uint32_t REnMask = (pin_mask << AON_PAD_CTL0_GPO_RE_N_Pos) & AON_PAD_CTL0_GPO_RE_N; + uint32_t RType = (pull == LL_AON_GPIO_PULL_UP) ? RTypeMask : 0x0000U; + uint32_t REn = (pull == LL_AON_GPIO_PULL_NO) ? REnMask : 0x0000U; + MODIFY_REG(AON->AON_PAD_CTL0, REnMask | RTypeMask, REn | RType); +} + +/** + * @brief Return gpio pull-up or pull-down for a dedicated AON_GPIO pin. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL0 | GPO_RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * AON_PAD_CTL0 | GPO_RTYPE + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_AON_GPIO_PULL_NO + * @arg @ref LL_AON_GPIO_PULL_UP + * @arg @ref LL_AON_GPIO_PULL_DOWN + */ +__STATIC_INLINE uint32_t ll_aon_gpio_get_pin_pull(uint32_t pin) +{ + uint32_t RTypeMask = (pin << AON_PAD_CTL0_GPO_RTYPE_Pos) & AON_PAD_CTL0_GPO_RTYPE; + uint32_t REnMask = (pin << AON_PAD_CTL0_GPO_RE_N_Pos) & AON_PAD_CTL0_GPO_RE_N; + //return (READ_BITS(AON->AON_PAD_CTL0, REnMask | RTypeMask) >> POSITION_VAL(Pin)); + return ((READ_BITS(AON->AON_PAD_CTL0, REnMask) != RESET) ? LL_AON_GPIO_PULL_NO : + ((READ_BITS(AON->AON_PAD_CTL0, RTypeMask) != RESET) ? LL_AON_GPIO_PULL_UP : LL_AON_GPIO_PULL_DOWN)); +} + +/** + * @brief Configure gpio pinmux number of a dedicated pin from 0 to 7 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_MUX_CTRL | CTRL0_7 | + * +----------------------+-----------------------------------+ + * \endrst + * AON_PAD_CTL_0 | MCU_OVR + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @param mux This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_MUX_0 + * @arg @ref LL_AON_GPIO_MUX_1 + * @arg @ref LL_AON_GPIO_MUX_2 + * @arg @ref LL_AON_GPIO_MUX_3 + * @arg @ref LL_AON_GPIO_MUX_4 + * @arg @ref LL_AON_GPIO_MUX_5 + * @arg @ref LL_AON_GPIO_MUX_6 + * @arg @ref LL_AON_GPIO_MUX_7 + * @arg @ref LL_AON_GPIO_MUX_8 + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_set_mux_pin_0_7(uint32_t pin, uint32_t mux) +{ + uint32_t pos = POSITION_VAL(pin) << 2; + MODIFY_REG(MCU_SUB->AON_PAD_MUX_CTL, 0xF << pos, mux << pos); + if(LL_AON_GPIO_MUX_7 == mux) + { + CLEAR_BITS(AON->AON_PAD_CTL0, pin << AON_PAD_CTL0_MCU_OVR_Pos); + } + else + { + SET_BITS(AON->AON_PAD_CTL0, pin << AON_PAD_CTL0_MCU_OVR_Pos); + } +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_MUX_CTRL | CTRL0_7 | + * +----------------------+-----------------------------------+ + * \endrst + * AON_PAD_CTL_0 | MCU_OVR + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_AON_GPIO_MUX_0 + * @arg @ref LL_AON_GPIO_MUX_1 + * @arg @ref LL_AON_GPIO_MUX_2 + * @arg @ref LL_AON_GPIO_MUX_3 + * @arg @ref LL_AON_GPIO_MUX_4 + * @arg @ref LL_AON_GPIO_MUX_5 + * @arg @ref LL_AON_GPIO_MUX_6 + * @arg @ref LL_AON_GPIO_MUX_7 + * @arg @ref LL_AON_GPIO_MUX_8 + */ +__STATIC_INLINE uint32_t ll_aon_gpio_get_mux_pin_0_7(uint32_t pin) +{ + if(READ_BITS(AON->AON_PAD_CTL0, pin << AON_PAD_CTL0_MCU_OVR_Pos)) + { + uint32_t pos = POSITION_VAL(pin) << 2; + return (READ_BITS(MCU_SUB->AON_PAD_MUX_CTL, 0xF << pos) >> pos); + } + else + { + return LL_AON_GPIO_MUX_7; + } +} + +/** + * @brief Enable Xo_2MHz output on AON_GPIO_PIN5. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XO_2MHZ_ENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_xo_2mhz_output(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_XO_2MHZ_ENA); +} + +/** + * @brief Disable Xo_2MHz output on AON_GPIO_PIN5. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XO_2MHZ_ENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_disable_xo_2mhz_output(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_XO_2MHZ_ENA); +} + +/** + * @brief Check if Xo_2MHz output on AON_GPIO_PIN5 is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XO_2MHZ_ENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_xo_2mhz_output(void) +{ + return (uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_XO_2MHZ_ENA) == AON_PWR_REG01_XO_2MHZ_ENA); +} + +/** @} */ + +/** @defgroup AON_GPIO_LL_EF_Data_Access Data Access + * @{ + */ + +/** + * @brief Return full input data register value of AON_GPIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | O_AON_GPI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Input data register value of port + */ +__STATIC_INLINE uint32_t ll_aon_gpio_read_input_port(void) +{ + return (uint32_t)(READ_BITS(GPIO2->DATA, GPIO_DATA)); +} + +/** + * @brief Return if input data level of several AON_GPIO pins is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | O_AON_GPI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_input_pin_set(uint32_t pin_mask) +{ + return (uint32_t)(READ_BITS(GPIO2->DATA, pin_mask) == pin_mask); +} + +/** + * @brief Write output data register of AON_GPIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param port_value Level value for each pin of the port + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_write_output_port(uint32_t port_value) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_AON_GPO, (port_value << AON_PAD_CTL1_AON_GPO_Pos) & AON_PAD_CTL1_AON_GPO); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return full output data register value of AON_GPIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Output data register value of port + */ +__STATIC_INLINE uint32_t ll_aon_gpio_read_output_port(void) +{ + return (uint32_t)(READ_BITS(AON->AON_PAD_CTL1, AON_PAD_CTL1_AON_GPO) >> AON_PAD_CTL1_AON_GPO_Pos); +} + +/** + * @brief Return if input data level of several AON_GPIO pins is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_output_pin_set(uint32_t pin_mask) +{ + pin_mask = (pin_mask << AON_PAD_CTL1_AON_GPO_Pos) & AON_PAD_CTL1_AON_GPO; + return (uint32_t)(READ_BITS(AON->AON_PAD_CTL1, pin_mask) == pin_mask); +} + +/** + * @brief Set specified AON_GPIO pins to high level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_set_output_pin(uint32_t pin_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->AON_PAD_CTL1, (pin_mask << AON_PAD_CTL1_AON_GPO_Pos) & AON_PAD_CTL1_AON_GPO); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Set specified AON_GPIO pins to low level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_reset_output_pin(uint32_t pin_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->AON_PAD_CTL1, (pin_mask << AON_PAD_CTL1_AON_GPO_Pos) & AON_PAD_CTL1_AON_GPO); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Toggle data value of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_GPO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_toggle_pin(uint32_t pin_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + WRITE_REG(AON->AON_PAD_CTL1, (READ_REG(AON->AON_PAD_CTL1) ^ ((pin_mask << AON_PAD_CTL1_AON_GPO_Pos) & AON_PAD_CTL1_AON_GPO))); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** @} */ + +/** @defgroup AON_GPIO_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable AON_GPIO Falling Edge Trigger of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_falling_trigger(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTPOLCLR, pin_mask); + WRITE_REG(GPIO2->INTTYPESET, pin_mask); +} + +/** + * @brief Check if falling edge trigger is enabled of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_falling_trigger(uint32_t pin_mask) +{ + return ((READ_BITS(GPIO2->INTPOLCLR, pin_mask) == (pin_mask)) & + (READ_BITS(GPIO2->INTTYPESET, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable AON_GPIO Rising Edge Trigger of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_rising_trigger(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTPOLSET, pin_mask); + WRITE_REG(GPIO2->INTTYPESET, pin_mask); +} + +/** + * @brief Check if rising edge trigger is enabled of specified AON_GPIO pins. + * @note Please check each device line mapping for AON_GPIO Line availability + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_rising_trigger(uint32_t pin_mask) +{ + return ((READ_BITS(GPIO2->INTPOLSET, pin_mask) == (pin_mask)) & + (READ_BITS(GPIO2->INTTYPESET, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable AON_GPIO High Level Trigger of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_high_trigger(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTPOLSET, pin_mask); + WRITE_REG(GPIO2->INTTYPECLR, pin_mask); +} + +/** + * @brief Check if high level trigger is enabled of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_high_trigger(uint32_t pin_mask) +{ + return ((READ_BITS(GPIO2->INTPOLSET, pin_mask) == (pin_mask)) & + (READ_BITS(GPIO2->INTTYPECLR, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable AON_GPIO Low Level Trigger of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_low_trigger(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTPOLCLR, pin_mask); + WRITE_REG(GPIO2->INTTYPECLR, pin_mask); +} + +/** + * @brief Check if low level trigger is enabled of specified AON_GPIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_low_trigger(uint32_t pin_mask) +{ + return ((READ_BITS(GPIO2->INTPOLCLR, pin_mask) == (pin_mask)) & + (READ_BITS(GPIO2->INTTYPECLR, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable AON_GPIO interrupts of specified AON_GPIO pins. + * @note @ref AON_GPIO_LL_EC_TRIGGER can be used to specify the interrupt trigger type + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENSET | INTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_enable_it(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTENSET, pin_mask); +} + +/** + * @brief Disable AON_GPIO interrupts of specified AON_GPIO pins. + * @note @ref AON_GPIO_LL_EC_TRIGGER can be used to specify the interrupt trigger type + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENCLR | INTENCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_disable_it(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTENCLR, pin_mask); +} + +/** + * @brief Check if the Interrupt of specified GPIO pins is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENSET | INTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_enabled_it(uint32_t pin_mask) +{ + return (READ_BITS(GPIO2->INTENSET, pin_mask) == (pin_mask)); +} + +/** @} */ + +/** @defgroup AON_GPIO_LL_EF_Flag_Management Flag_Management + * @{ + */ + +/** + * @brief Read AON_GPIO Interrupt Combination Flag of specified AON_GPIO pins. + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval Interrupt flag whose bits were set when the selected trigger event arrives on the interrupt + */ +__STATIC_INLINE uint32_t ll_aon_gpio_read_flag_it(uint32_t pin_mask) +{ + uint32_t ext2 = READ_BITS(GPIO2->INTSTAT, pin_mask); + uint32_t wkup = (READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_EXT_WKUP_STATUS) >> AON_SLP_EVENT_EXT_WKUP_STATUS_Pos) & \ + pin_mask & READ_BITS(AON->EXT_WKUP_CTL, LL_AON_GPIO_PIN_ALL); + return (uint32_t)(ext2 | wkup); +} + +/** + * @brief Indicate if the AON_GPIO Interrupt Flag is set or not of specified AON_GPIO pins. + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_gpio_is_active_flag_it(uint32_t pin_mask) +{ + return (READ_BITS(GPIO2->INTSTAT, pin_mask) == pin_mask); +} + +/** + * @brief Clear Interrupt Status flag of specified AON_GPIO pins. + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can be cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_AON_GPIO_PIN_0 + * @arg @ref LL_AON_GPIO_PIN_1 + * @arg @ref LL_AON_GPIO_PIN_2 + * @arg @ref LL_AON_GPIO_PIN_3 + * @arg @ref LL_AON_GPIO_PIN_4 + * @arg @ref LL_AON_GPIO_PIN_5 + * @arg @ref LL_AON_GPIO_PIN_6 + * @arg @ref LL_AON_GPIO_PIN_7 + * @arg @ref LL_AON_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_aon_gpio_clear_flag_it(uint32_t pin_mask) +{ + WRITE_REG(GPIO2->INTSTAT, pin_mask); +} + +/** @} */ + +/** @defgroup AON_GPIO_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize AON_GPIO registers (Registers restored to their default values). + * @retval An error_status_t enumeration value: + * - SUCCESS: AON_GPIO registers are de-initialized + * - ERROR: AON_GPIO registers are not de-initialized + */ +error_status_t ll_aon_gpio_deinit(void); + +/** + * @brief Initialize AON_GPIO registers according to the specified. + * parameters in p_aon_gpio_init. + * @param p_aon_gpio_init Pointer to a ll_aon_gpio_init_t structure that contains the configuration + * information for the specified AON_GPIO peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: AON_GPIO registers are initialized according to p_aon_gpio_init content + * - ERROR: Problem occurred during AON_GPIO Registers initialization + */ +error_status_t ll_aon_gpio_init(ll_aon_gpio_init_t *p_aon_gpio_init); + +/** + * @brief Set each field of a @ref ll_aon_gpio_init_t type structure to default value. + * @param p_aon_gpio_init Pointer to a @ref ll_aon_gpio_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_aon_gpio_struct_init(ll_aon_gpio_init_t *p_aon_gpio_init); + +/** @} */ + +/** @} */ + +#endif /* AON */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_AON_GPIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_wdt.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_wdt.h new file mode 100644 index 0000000..6f09128 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_aon_wdt.h @@ -0,0 +1,305 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_aon_wdt.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of AON WDT LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_AON_WDT AON_WDT + * @brief AON_WDT LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_AON_WDT_H__ +#define __GR55XX_LL_AON_WDT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (AON) + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup AON_WDT_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup AON_WDT_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable AON watchdog counter and interrupt event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_enable(void) +{ + SET_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN); +} + +/** + * @brief Disable AON watchdog counter and interrupt event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_disable(void) +{ + CLEAR_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN); +} + +/** + * @brief Check if the AON_WDT peripheral is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_wdt_is_enabled(void) +{ + return (READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_EN) == (AON_EXT_WKUP_CTL_WDT_EN)); +} + +/** + * @brief Specify the AON WDT down-counter reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMER_VALUE | TIMER_VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param counter Value for reload down-counter which should ranging between 0 ~ 0xFFFF_FFFF + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_set_reload_counter(uint32_t counter) +{ + WRITE_REG(AON->TIMER_VALUE, counter); +} + +/** + * @brief Reloads AON WDT counter. + * @note The value in TIMER_VALUE register will be reloaded into AON WDT down-counter + * after enable this bit, so ll_aon_wdt_set_reload_counter() should be called before + * every reload. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_RELOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_reload_counter(void) +{ + SET_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_RELOAD); +} + +/** + * @brief Read the AON WDT counter current value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | AON_WDT_TIMER | + * +----------------------+-----------------------------------+ + * \endrst + * TIMER_VAL | TIMER_VAL_READ + * + * @retval Value for current counter which should ranging between 0 ~ 0xFFFF_FFFF + */ +__STATIC_INLINE uint32_t ll_aon_wdt_get_counter(void) +{ + MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL, AON_PAD_CTL1_TIMER_READ_SEL_AON_WDT); + return (uint32_t)READ_REG(AON->TIMER_VAL); +} + +/** + * @brief Specify the AON_WDT down-counter alarm value + * @note AON watchdog will generate an interrupt when it counts down to the + * alarm value to alram that it is almost expired. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_ALARM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param counter Value between Min_Data=0 and Max_Data=0x1F + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_set_alarm_counter(uint32_t counter) +{ + MODIFY_REG(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_ALARM, (counter << AON_EXT_WKUP_CTL_WDT_ALARM_Pos) & AON_EXT_WKUP_CTL_WDT_ALARM); +} + +/** + * @brief Get the AON_WDT down-counter alarm value + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_ALARM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Value between Min_Data=0 and Max_Data=0x1F + */ +__STATIC_INLINE uint32_t ll_aon_wdt_get_alarm_counter(void) +{ + return (uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_ALARM) >> AON_EXT_WKUP_CTL_WDT_ALARM_Pos); +} + +/** @} */ + +/** @defgroup AON_WDT_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Indicate if the AON Watchdog Running Flag is set or not. + * @note This bit can be used to check if AON Watchdog is in running state. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WDT_RUNNING | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_running(void) +{ + return (uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_WDT_RUNNING) == (AON_EXT_WKUP_CTL_WDT_RUNNING)); +} + +/** + * @brief Indicate if the AON WDT Reboot Event Flag is set or not. + * @note This bit is set by hardware when the counter has reached alarm value. + * It can be cleared by writing 0 to this bit. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | SLP_EVENT_WDT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_aon_wdt_is_active_flag_reboot(void) +{ + return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_WDT_REBOOT) == AON_SLP_EVENT_WDT_REBOOT); +} + +/** + * @brief Clear Interrupt Status flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | SLP_EVENT_WDT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_aon_wdt_clear_flag_reboot(void) +{ + WRITE_REG(AON->SLP_EVENT, ~AON_SLP_EVENT_WDT_REBOOT); +} + +/** @} */ + +/** @} */ + +#endif /* AON_WDT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_AON_WDT_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_bod.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_bod.h new file mode 100644 index 0000000..91f2363 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_bod.h @@ -0,0 +1,331 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_bod.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of CALENDAR LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_BOD BOD + * @brief BOD LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_BOD_H_ +#define __GR55XX_LL_BOD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +/** @defgroup BOD_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup BOD_LL_ES_INIT BOD Exported init structures + * @{ + */ + +/** + * @brief LL BOD init Structure definition + */ +typedef struct _ll_bod_init +{ + uint8_t bod_en; /**< Specifies the bod enable. + + This parament can be modified afterwards using unitary function @ref ll_bod_enable() and ll_bod_disable(). */ + + uint8_t bod2_en; /**< Specifies the bod2 enable. + + This parament can be modified afterwards using unitary function @ref ll_bod2_enable() and ll_bod2_disable().. */ + + uint8_t bod2_lvl; /**< Specifies the bod2 level. + + This parament can be modified afterwards using unitary function @ref ll_bod2_lvl_ctrl_lv_set(). */ + + uint8_t bod_static_en; /**< Specifies the bod static enbale. + This parameter can be a value of @ref LL_BOD_STATIC_ENABLE. + This parament can be modified afterwards using unitary function @ref ll_bod_static_lv_enable() and ll_bod_static_lv_disable(). */ +} ll_bod_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup BOD_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup BOD_LL_Exported_Constants BOD Exported Constants + * @{ + */ + +/** @defgroup BOD_LL_ENABLE BOD ENABLE + * @{ + */ +#define LL_BOD_ENABLE 0x1 /**< BOD enable */ +#define LL_BOD_DISABLE 0x0 /**< BOD disable */ +/** @} */ + +/** @defgroup BOD2_LL_ENABLE BOD2 ENABLE + * @{ + */ +#define LL_BOD2_ENABLE 0x1 /**< BOD2 enable */ +#define LL_BOD2_DISABLE 0x0 /**< BOD2 disable */ +/** @} */ + +/** @defgroup BOD_LL_STATIC_ENABLE BOD STATIC ENABLE + * @{ + */ +#define LL_BOD_STATIC_ENABLE (0x1) /**< BOD STATIC enable */ +#define LL_BOD_STATIC_DISABLE (0x0) /**< BOD STATIC disable */ +/** @} */ + +/** @defgroup BOD2_LL_LEVEL BOD2 LVEVL + * @{ + */ +#define LL_BOD2_LEVEL_0 0x0 /**< BOD2 Level 0 */ +#define LL_BOD2_LEVEL_1 0x1 /**< BOD2 Level 1 */ +#define LL_BOD2_LEVEL_2 0x2 /**< BOD2 Level 2 */ +#define LL_BOD2_LEVEL_3 0x3 /**< BOD2 Level 3 */ +#define LL_BOD2_LEVEL_4 0x4 /**< BOD2 Level 4 */ +#define LL_BOD2_LEVEL_5 0x5 /**< BOD2 Level 5 */ +#define LL_BOD2_LEVEL_6 0x6 /**< BOD2 Level 6 */ +#define LL_BOD2_LEVEL_7 0x7 /**< BOD2 Level 7 */ +/** @} */ + +/** @} */ + +/** @} */ + +/** @defgroup BOD_LL_DRIVER_FUNCTIONS Functions + * @{ + */ +/** + * @brief Enable the bod + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod_en_lv + * + */ +__STATIC_INLINE void ll_bod_enable(void) +{ + SET_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD_EN); +} + +/** + * @brief Disable the bod + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod_en_lv + * + */ +__STATIC_INLINE void ll_bod_disable(void) +{ + CLEAR_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD_EN); +} + +/** + * @brief Enable the bod2 + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod2_en_lv + * + */ +__STATIC_INLINE void ll_bod2_enable(void) +{ + SET_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD2_EN); +} + +/** + * @brief Disable the bod2 + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod2_en_lv + * + */ +__STATIC_INLINE void ll_bod2_disable(void) +{ + CLEAR_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD2_EN); +} + +/** + * @brief Set bod control level + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod_lvl_ctrl_lv_3_0 + * @param lvl_ctrl_lv: 0x0 ~ 0x7 + */ +__STATIC_INLINE void ll_bod2_lvl_ctrl_lv_set(uint8_t lvl_ctrl_lv) +{ + MODIFY_REG(AON->RF_REG_3, AON_RF_REG_3_BOD_LVL_CTRL_LV, (lvl_ctrl_lv << AON_RF_REG_3_BOD_LVL_CTRL_LV_Pos)); +} + +/** + * @brief enable bod static lv + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod_static_lv + */ +__STATIC_INLINE void ll_bod_static_lv_enable(void) +{ + SET_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD_STATIC_LV_EN); +} + +/** + * @brief disable bod static lv + * + * Register|BitsName + * --------|-------- + * RF_REG_3 | bod_static_lv + */ +__STATIC_INLINE void ll_bod_static_lv_disable(void) +{ + CLEAR_BITS(AON->RF_REG_3, AON_RF_REG_3_BOD_STATIC_LV_EN); +} + +/** + * @brief enable BOD FEDGE Event. + * + * Register|BitsName + * --------|-------- + * AON_IRQ | PMU_BOD_FEDGE + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE void ll_bod_enable_fedge(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL_PMU_BOD_FEDGE); +} + +/** + * @brief disable BOD FEDGE Event. + * + * Register|BitsName + * --------|-------- + * AON_IRQ | PMU_BOD_FEDGE + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE void ll_bod_disable_fedge(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL_PMU_BOD_FEDGE); +} + +/** + * @brief Indicate if the BOD REDGE Event Flag is set or not. + * + * Register|BitsName + * --------|-------- + * AON_IRQ | PMU_BOD_REDGE + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_bod_is_active_flag_fedge(void) +{ + return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_PMU_BOD_FEDGE) == AON_SLP_EVENT_PMU_BOD_FEDGE); +} + +/** + * @brief Clear Interrupt Status flag. + * + * Register|BitsName + * --------|-------- + * AON_IRQ| PMU_BOD_REDGE + * + * @retval None + */ +__STATIC_INLINE void ll_bod_clear_flag_fedge(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + WRITE_REG(AON->SLP_EVENT, ~AON_SLP_EVENT_PMU_BOD_FEDGE); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief De-initialize the BOD registers to their default reset values. + * @retval An error_status_t enumeration value: + * - SUCCESS: PDM registers are de-initialized + * - ERROR: PDM registers are not de-initialized + */ +error_status_t ll_bod_deinit(void); + +/** + * @brief Initialize the BOD registers according to the specified parameters. + * @param p_bod_init pointer to a @ref ll_bod_init_t structure. + * @retval An error_status_t enumeration value: + * - SUCCESS: BOD registers are initialized + * - ERROR: Not applicable + */ +error_status_t ll_bod_init(ll_bod_init_t *p_bod_init); + +/** + * @brief Set BOD initial structure to default value. + * @param p_bod_init Pointer to a @ref ll_bod_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_bod_struct_init(ll_bod_init_t *p_bod_init); +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_calendar.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_calendar.h new file mode 100644 index 0000000..215cb22 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_calendar.h @@ -0,0 +1,488 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_calendar.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of CALENDAR LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_CALENDAR CALENDAR + * @brief CALENDAR LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_CALENDAR_H__ +#define __GR55XX_LL_CALENDAR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** + * @defgroup CALENDAR_LL_MACRO Defines + * @{ + */ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup CALENDAR_LL_Exported_Constants CALENDAR Exported Constants + * @{ + */ + +/** @defgroup CALENDAR_LL_EC_CLOCK_DIV Clock divider + * @{ + */ +#define LL_CALENDAR_DIV_NONE ((uint32_t)0x00U) /**< Select RTC clock */ +#define LL_CALENDAR_DIV_32 ((uint32_t)0x01U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) /**< Select 1/32 divider */ +#define LL_CALENDAR_DIV_64 ((uint32_t)0x02U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) /**< Select 1/64 divider */ +#define LL_CALENDAR_DIV_128 ((uint32_t)0x03U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) /**< Select 1/128 divider */ +#define LL_CALENDAR_DIV_256 ((uint32_t)0x04U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) /**< Select 1/256 divider */ +#define LL_CALENDAR_NO_CLOCK ((uint32_t)0x05U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) /**< Select no clock */ +/** @} */ + +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup CALENDAR_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup CALENDAR_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable calendar counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_enable(void) +{ + SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN); +} + +/** + * @brief Disable calendar counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_disable(void) +{ + CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN); +} + +/** + * @brief Check if the CALENDAR peripheral is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_calendar_is_enabled(void) +{ + return (READ_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_EN) == (AON_CALENDAR_TIMER_CTL_EN)); +} + +/** + * @brief Reloads CALENDAR counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | VAL_LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * TIMER_VALUE | TIMER_VALUE + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_reload_counter(uint32_t counter) +{ + WRITE_REG(AON->TIMER_VALUE, counter); + SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_VAL_LOAD); +} + +/** + * @brief Reloads CALENDAR alarm. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ALARM_VAL_LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * TIMER_VALUE | TIMER_VALUE + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_reload_alarm(uint32_t alarm) +{ + WRITE_REG(AON->TIMER_VALUE, alarm); + SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD); +} + +/** + * @brief Read the CALENDAR counter current value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | CAL_TIMER | + * +----------------------+-----------------------------------+ + * \endrst + * TIMER_VAL | TIMER_VAL_READ + * + * @retval Value for current counter which should ranging between 0 ~ 0xFFFF_FFFF + */ +__STATIC_INLINE uint32_t ll_calendar_get_counter(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL, AON_PAD_CTL1_TIMER_READ_SEL_CAL_TIMER); + GLOBAL_EXCEPTION_ENABLE(); + return (uint32_t)READ_REG(AON->TIMER_VAL); +} + +/** + * @brief Read the CALENDAR counter alarm value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AON_PAD_CTL1 | CAL_ALARM | + * +----------------------+-----------------------------------+ + * \endrst + * TIMER_VAL | TIMER_VAL_READ + * + * @retval Value for current alarm which should ranging between 0 ~ 0xFFFF_FFFF + */ +__STATIC_INLINE uint32_t ll_calendar_get_alarm(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL, AON_PAD_CTL1_TIMER_READ_SEL_CAL_ALARM); + GLOBAL_EXCEPTION_ENABLE(); + return (uint32_t)READ_REG(AON->TIMER_VAL); +} + +/** + * @brief Get the CALENDAR wrap-around value. + * @note The value should be read multiple times until get the same value in at least two reads. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | WRAP_CNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Value between Min_Data=0 and Max_Data=0xF + */ +__STATIC_INLINE uint32_t ll_calendar_get_wrapcnt(void) +{ + return (uint32_t)(READ_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_WRAP_CNT) >> AON_CALENDAR_TIMER_CTL_WRAP_CNT_Pos); +} + +/** + * @brief Select the CALENDAR clock divider. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | CLK_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param div This parameter can be one of the following values: + * @arg @ref LL_CALENDAR_DIV_NONE + * @arg @ref LL_CALENDAR_DIV_32 + * @arg @ref LL_CALENDAR_DIV_64 + * @arg @ref LL_CALENDAR_DIV_128 + * @arg @ref LL_CALENDAR_DIV_256 + * @arg @ref LL_CALENDAR_NO_CLOCK + * @retval None + */ +__STATIC_INLINE void ll_calendar_set_clock_div(uint32_t div) +{ + MODIFY_REG(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_CLK_SEL, div); +} + +/** + * @brief Enable calendar alarm interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ALARM_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_it_enable_alarm(void) +{ + SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_ALARM_INT_EN); +} + +/** + * @brief Disable calendar alarm interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ALARM_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_it_disable_alarm(void) +{ + CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_ALARM_INT_EN); +} + +/** + * @brief Check if the CALENDAR alarm interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ALARM_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_calendar_it_is_enabled_alarm(void) +{ + return (READ_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_ALARM_INT_EN) == (AON_CALENDAR_TIMER_CTL_ALARM_INT_EN)); +} + +/** + * @brief Enable calendar wrap interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | WRAP_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_it_enable_wrap(void) +{ + SET_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_WRAP_INT_EN); +} + +/** + * @brief Disable calendar warp interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | WRAP_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_it_disable_wrap(void) +{ + CLEAR_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_WRAP_INT_EN); +} + +/** + * @brief Check if the CALENDAR wrap interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | WRAP_INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_calendar_it_is_enabled_wrap(void) +{ + return (READ_BITS(AON->CALENDAR_TIMER_CTL, AON_CALENDAR_TIMER_CTL_WRAP_INT_EN) == (AON_CALENDAR_TIMER_CTL_WRAP_INT_EN)); +} + +/** @} */ + +/** @defgroup CALENDAR_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Indicate if the CALENDAR alarm event flag is set or not. + * @note This bit is set by hardware when the counter has reached alarm value. + * It can be cleared by writing 0 to this bit. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | CALENDAR_TIMER_ALARM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_calendar_is_active_flag_alarm(void) +{ + return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_CALENDAR_TIMER_ALARM) == AON_SLP_EVENT_CALENDAR_TIMER_ALARM); +} + +/** + * @brief Indicate if the CALENDAR wrap event flag is set or not. + * @note This bit is set by hardware when the counter has overflow. + * It can be cleared by writing 0 to this bit. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | CALENDAR_TIMER_WRAP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_calendar_is_active_flag_wrap(void) +{ + return (uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_CALENDAR_TIMER_WRAP) == AON_SLP_EVENT_CALENDAR_TIMER_WRAP); +} + +/** + * @brief Clear calendar alarm interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | CALENDAR_TIMER_ALARM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_clear_flag_alarm(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + WRITE_REG(AON->SLP_EVENT, ~AON_SLP_EVENT_CALENDAR_TIMER_ALARM); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Clear calendar wrap interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | CALENDAR_TIMER_WRAP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_calendar_clear_flag_wrap(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + WRITE_REG(AON->SLP_EVENT, ~AON_SLP_EVENT_CALENDAR_TIMER_WRAP); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** @} */ + +/** @} */ + +#endif /* CALENDAR */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_CALENDAR_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_cgc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_cgc.h new file mode 100644 index 0000000..6878ed6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_cgc.h @@ -0,0 +1,2711 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_cgc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of CGC LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_CGC CGC + * @brief CGC LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_CGC_H__ +#define __GR55XX_LL_CGC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(MCU_SUB) + +/** @defgroup CGC_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup CGC_LL_ES_INIT CGC Exported init structures + * @{ + */ + +/** + * @brief LL CGC init Structure definition + */ +typedef struct _ll_cgc_init_t +{ + uint32_t wfi_clk0; /**< Specifies the block that automatically closes the clock. + This parameter can be a combination of @ref CGC_LL_EC_WFI_CLK0. */ + + uint32_t wfi_clk1; /**< Specifies the block that automatically closes the clock. + This parameter can be a combination of @ref CGC_LL_EC_WFI_CLK1. */ + + uint32_t wfi_clk2; /**< Specifies the block that automatically closes the clock. + This parameter can be a combination of @ref CGC_LL_EC_WFI_CLK2. */ + + uint32_t force_clk0; /**< Specifies the blocks for forced turn off clock. + This parameter can be a combination of @ref CGC_LL_EC_FRC_CLK0. */ + + uint32_t force_clk1; /**< Specifies the blocks for forced turn off clock. + This parameter can be a combination of @ref CGC_LL_EC_FRC_CLK1. */ + + uint32_t force_clk2; /**< Specifies the blocks for forced turn off clock. + This parameter can be a combination of @ref CGC_LL_EC_FRC_CLK2. */ +} ll_cgc_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup CGC_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup CGC_LL_Exported_Constants CGC Exported Constants + * @{ + */ + +/** @defgroup CGC_LL_EC_WFI_CLK0 Block0 Clock During WFI + * @{ + */ +#define LL_CGC_WFI_SECU_HCLK MCU_SUB_WFI_SECU_HCLK /**< Hclk for all security blocks */ +#define LL_CGC_WFI_SIM_HCLK MCU_SUB_WFI_SIM_HCLK /**< Hclk for sim card interface */ +#define LL_CGC_WFI_HTB_HCLK MCU_SUB_WFI_HTB_HCLK /**< Hclk for hopping table */ +#define LL_CGC_WFI_PWM_HCLK MCU_SUB_WFI_PWM_HCLK /**< Hclk for PWM */ +#define LL_CGC_WFI_ROM_HCLK MCU_SUB_WFI_ROM_HCLK /**< Hclk for ROM */ +#define LL_CGC_WFI_SNSADC_HCLK MCU_SUB_WFI_SNSADC_HCLK /**< Hclk for sense ADC */ +#define LL_CGC_WFI_GPIO_HCLK MCU_SUB_WFI_GPIO_HCLK /**< Hclk for GPIOs */ +#define LL_CGC_WFI_DMA_HCLK MCU_SUB_WFI_DMA_HCLK /**< Hclk for DMA engine */ +#define LL_CGC_WFI_BLE_BRG_HCLK MCU_SUB_WFI_BLE_BRG_HCLK /**< Hclk for BLE MCU bridge */ +#define LL_CGC_WFI_APB_SUB_HCLK MCU_SUB_WFI_APB_SUB_HCLK /**< Hclk for APB subsystem */ +#define LL_CGC_WFI_SERIAL_HCLK MCU_SUB_WFI_SERIAL_HCLK /**< Hclk for serial blocks */ +#define LL_CGC_WFI_I2S_S_HCLK MCU_SUB_WFI_I2S_S_HCLK /**< Hclk for I2S slave */ + +#define LL_CGC_WFI_ALL_HCLK0 ((uint32_t)0x00000FFFU) /**< All clock group 0 */ +/** @} */ + +/** @defgroup CGC_LL_EC_WFI_CLK1 Block1 Clock During WFI + * @{ + */ +#define LL_CGC_WFI_AON_MCUSUB_HCLK MCU_SUB_WFI_AON_MCUSUB_HCLK /**< Hclk for Always-on register */ +#define LL_CGC_WFI_XF_XQSPI_HCLK MCU_SUB_WFI_XF_XQSPI_HCLK /**< Hclk for cache top */ +#define LL_CGC_WFI_SRAM_HCLK MCU_SUB_WFI_SRAM_HCLK /**< Hclk for SRAMs */ + +#define LL_CGC_WFI_ALL_HCLK1 ((uint32_t)0x00000007U) /**< All clock group 1 */ +/** @} */ + +/** @defgroup CGC_LL_EC_WFI_CLK2 Block2 Clock During WFI + * @{ + */ +#define LL_CGC_WFI_SECU_DIV4_PCLK MCU_SUB_WFI_SECU_DIV4_PCLK /**< Div4 clk for security blocks */ +#define LL_CGC_WFI_XQSPI_DIV4_PCLK MCU_SUB_WFI_XQSPI_DIV4_PCLK /**< Div4 clk for xf qspi */ + +#define LL_CGC_WFI_ALL_HCLK2 ((uint32_t)0x05000000U) /**< All clock group 2 */ +/** @} */ + + +/** @defgroup CGC_LL_EC_FRC_CLK0 Force Clock OFF + * @{ + */ +#define LL_CGC_FRC_SECU_HCLK MCU_SUB_FORCE_SECU_HCLK /**< Hclk for all security blocks */ +#define LL_CGC_FRC_SIM_HCLK MCU_SUB_FORCE_SIM_HCLK /**< Hclk for sim card interface */ +#define LL_CGC_FRC_HTB_HCLK MCU_SUB_FORCE_HTB_HCLK /**< Hclk for hopping table */ +#define LL_CGC_FRC_PWM_HCLK MCU_SUB_FORCE_PWM_HCLK /**< Hclk for PWM */ +#define LL_CGC_FRC_ROM_HCLK MCU_SUB_FORCE_ROM_HCLK /**< Hclk for ROM */ +#define LL_CGC_FRC_SNSADC_HCLK MCU_SUB_FORCE_SNSADC_HCLK /**< Hclk for sense ADC */ +#define LL_CGC_FRC_GPIO_HCLK MCU_SUB_FORCE_GPIO_HCLK /**< Hclk for GPIOs */ +#define LL_CGC_FRC_DMA_HCLK MCU_SUB_FORCE_DMA_HCLK /**< Hclk for DMA engine */ +#define LL_CGC_FRC_BLE_BRG_HCLK MCU_SUB_FORCE_BLE_BRG_HCLK /**< Hclk for BLE MCU bridge */ +#define LL_CGC_FRC_APB_SUB_HCLK MCU_SUB_FORCE_APB_SUB_HCLK /**< Hclk for APB subsystem */ +#define LL_CGC_FRC_SERIAL_HCLK MCU_SUB_FORCE_SERIAL_HCLK /**< Hclk for serial blocks */ +#define LL_CGC_FRC_I2S_S_HCLK MCU_SUB_FORCE_I2S_S_HCLK /**< Hclk for I2S slave */ + +#define LL_CGC_FRC_ALL_HCLK0 ((uint32_t)0x00000FFFU) /**< All clock group 0 */ +/** @} */ + +/** @defgroup CGC_LL_EC_FRC_CLK1 Force Clock OFF + * @{ + */ +#define LL_CGC_FRC_AON_MCUSUB_HCLK MCU_SUB_FORCE_AON_MCUSUB_HCLK /**< Hclk for Always-on register */ +#define LL_CGC_FRC_XF_XQSPI_HCLK MCU_SUB_FORCE_XF_XQSPI_HCLK /**< Hclk for cache top */ +#define LL_CGC_FRC_SRAM_HCLK MCU_SUB_FORCE_SRAM_HCLK /**< Hclk for SRAMs */ + +#define LL_CGC_FRC_ALL_HCLK1 ((uint32_t)0x00070000U) /**< All clock group 1 */ +/** @} */ + +/** @defgroup CGC_LL_EC_FRC_CLK2 Force Clock OFF + * @{ + */ +#define LL_CGC_FRC_UART0_HCLK MCU_SUB_FORCE_UART0_HCLK /**< Hclk for uart0 */ +#define LL_CGC_FRC_UART1_HCLK MCU_SUB_FORCE_UART1_HCLK /**< Hclk for uart1 */ +#define LL_CGC_FRC_I2C0_HCLK MCU_SUB_FORCE_I2C0_HCLK /**< Hclk for i2c0 */ +#define LL_CGC_FRC_I2C1_HCLK MCU_SUB_FORCE_I2C1_HCLK /**< Hclk for i2c1 */ +#define LL_CGC_FRC_SPIM_HCLK MCU_SUB_FORCE_SPIM_HCLK /**< Hclk for spim */ +#define LL_CGC_FRC_SPIS_HCLK MCU_SUB_FORCE_SPIS_HCLK /**< Hclk for spis */ +#define LL_CGC_FRC_QSPI0_HCLK MCU_SUB_FORCE_QSPI0_HCLK /**< Hclk for qspi0 */ +#define LL_CGC_FRC_QSPI1_HCLK MCU_SUB_FORCE_QSPI1_HCLK /**< Hclk for qspi1 */ +#define LL_CGC_FRC_I2S_HCLK MCU_SUB_FORCE_I2S_HCLK /**< Hclk for i2s */ +#define LL_CGC_FRC_SECU_DIV4_PCLK MCU_SUB_FORCE_SECU_DIV4_PCLK /**< Div4 clk for security blocks */ +#define LL_CGC_FRC_XQSPI_DIV4_PCLK MCU_SUB_FORCE_XQSPI_DIV4_PCLK /**< Div4 clk for xf qspi */ + +#define LL_CGC_FRC_SERIALS_HCLK2 ((uint32_t)0x0001FF00U) /**< Hclk for serial blocks */ +#define LL_CGC_FRC_ALL_HCLK2 ((uint32_t)0x0A01FF00U) /**< All clock group 2 */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup CGC_LL_Exported_Macros CGC Exported Macros + * @{ + */ + +/** @defgroup CGC_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in CGC register + * @param __instance__ CGC instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_CGC_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in CGC register + * @param __instance__ CGC instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_CGC_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup CGC_LL_Private_Macros CGC Private Macros + * @{ + */ + +/** @defgroup CGC_LL_EC_DEFAULT_CONFIG InitStruct default configuartion + * @{ + */ + +/** + * @brief LL CGC InitStrcut default configuartion + */ +#define LL_CGC_DEFAULT_CONFIG \ +{ \ + .wfi_clk0 = ~LL_CGC_WFI_ALL_HCLK0, \ + .wfi_clk1 = ~LL_CGC_WFI_ALL_HCLK1, \ + .wfi_clk2 = ~LL_CGC_WFI_ALL_HCLK2, \ + .force_clk0 = ~LL_CGC_FRC_ALL_HCLK0, \ + .force_clk1 = ~LL_CGC_FRC_ALL_HCLK1, \ + .force_clk2 = ~LL_CGC_FRC_ALL_HCLK2, \ +} +/** @} */ + +/** @} */ + +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup CGC_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup CGC_LL_EF_CLK_Configuration Clock Configuration + * @{ + */ + +/** + * @brief Some peripherals automatic turn off clock during WFI. (Include: Security/SIM/HTB/PWM/ + * ROM/SNSADC/GPIO/DMA/BLE_BRG/APB_SUB/SERIAL/I2S) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SECU_HCLK + * CG_CTRL_0 | SIM_HCLK + * CG_CTRL_0 | HTB_HCLK + * CG_CTRL_0 | PWM_HCLK + * CG_CTRL_0 | ROM_HCLK + * CG_CTRL_0 | SNSADC_HCLK + * CG_CTRL_0 | GPIO_HCLK + * CG_CTRL_0 | DMA_HCLK + * CG_CTRL_0 | BLE_BRG_HCLK + * CG_CTRL_0 | APB_SUB_HCLK + * CG_CTRL_0 | SERIAL_HCLK + * CG_CTRL_0 | I2S_S_HCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_WFI_SECU_HCLK + * @arg @ref LL_CGC_WFI_SIM_HCLK + * @arg @ref LL_CGC_WFI_HTB_HCLK + * @arg @ref LL_CGC_WFI_PWM_HCLK + * @arg @ref LL_CGC_WFI_ROM_HCLK + * @arg @ref LL_CGC_WFI_SNSADC_HCLK + * @arg @ref LL_CGC_WFI_GPIO_HCLK + * @arg @ref LL_CGC_WFI_DMA_HCLK + * @arg @ref LL_CGC_WFI_BLE_BRG_HCLK + * @arg @ref LL_CGC_WFI_APB_SUB_HCLK + * @arg @ref LL_CGC_WFI_SERIAL_HCLK + * @arg @ref LL_CGC_WFI_I2S_S_HCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_wfi_off_hclk_0(uint32_t clk_mask) +{ + WRITE_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], clk_mask); +} + +/** + * @brief Return to clock blocks that is turned off during WFI.(Include: Security/SIM/HTB/PWM/ + * ROM/SNSADC/GPIO/DMA/BLE_BRG/APB_SUB/SERIAL/I2S) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SECU_HCLK + * CG_CTRL_0 | SIM_HCLK + * CG_CTRL_0 | HTB_HCLK + * CG_CTRL_0 | PWM_HCLK + * CG_CTRL_0 | ROM_HCLK + * CG_CTRL_0 | SNSADC_HCLK + * CG_CTRL_0 | GPIO_HCLK + * CG_CTRL_0 | DMA_HCLK + * CG_CTRL_0 | BLE_BRG_HCLK + * CG_CTRL_0 | APB_SUB_HCLK + * CG_CTRL_0 | SERIAL_HCLK + * CG_CTRL_0 | I2S_S_HCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_WFI_SECU_HCLK + * @arg @ref LL_CGC_WFI_SIM_HCLK + * @arg @ref LL_CGC_WFI_HTB_HCLK + * @arg @ref LL_CGC_WFI_PWM_HCLK + * @arg @ref LL_CGC_WFI_ROM_HCLK + * @arg @ref LL_CGC_WFI_SNSADC_HCLK + * @arg @ref LL_CGC_WFI_GPIO_HCLK + * @arg @ref LL_CGC_WFI_DMA_HCLK + * @arg @ref LL_CGC_WFI_BLE_BRG_HCLK + * @arg @ref LL_CGC_WFI_APB_SUB_HCLK + * @arg @ref LL_CGC_WFI_SERIAL_HCLK + * @arg @ref LL_CGC_WFI_I2S_S_HCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_wfi_off_hclk_0(void) +{ + return READ_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[0]); +} + + +/** + * @brief Some peripherals automatic turn off clock during WFI. (Include: AON_MCUSUB/XF_XQSPI/SRAM) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * CG_CTRL_2 | XF_XQSPI_HCLK + * CG_CTRL_2 | SRAM_HCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_WFI_AON_MCUSUB_HCLK + * @arg @ref LL_CGC_WFI_XF_XQSPI_HCLK + * @arg @ref LL_CGC_WFI_SRAM_HCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_wfi_off_hclk_1(uint32_t clk_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_MSK_HCLK_1, clk_mask); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return to clock blocks that is turned off during WFI.(Include: AON_MCUSUB/XF_XQSPI/SRAM) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * CG_CTRL_2 | XF_XQSPI_HCLK + * CG_CTRL_2 | SRAM_HCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_WFI_AON_MCUSUB_HCLK + * @arg @ref LL_CGC_WFI_XF_XQSPI_HCLK + * @arg @ref LL_CGC_WFI_SRAM_HCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_wfi_off_hclk_1(void) +{ + return READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_MSK_HCLK_1); +} + +/** + * @brief Some peripherals automatic turn off clock during WFI. (Include: SECU_DIV4/XQSPI_DIV4) + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SECU_DIV4_PCLK + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_WFI_SECU_DIV4_PCLK + * @arg @ref LL_CGC_WFI_XQSPI_DIV4_PCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_wfi_off_hclk_2(uint32_t clk_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_MSK_HCLK_2, clk_mask); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return to clock blocks that is turned off during WFI.(Include: AON_MCUSUB/XF_XQSPI/SRAM) + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SECU_DIV4_PCLK + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_WFI_SECU_DIV4_PCLK + * @arg @ref LL_CGC_WFI_XQSPI_DIV4_PCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_wfi_off_hclk_2(void) +{ + return READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_MSK_HCLK_2); +} + +/** + * @brief Some peripherals force turn off clock. (Include: Security/SIM/HTB/PWM/ROM/SNSADC/GPIO/ + * DMA/BLE_BRG/APB_SUB/SERIAL/I2S) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SECU_HCLK + * CG_CTRL_1 | SIM_HCLK + * CG_CTRL_1 | HTB_HCLK + * CG_CTRL_1 | PWM_HCLK + * CG_CTRL_1 | ROM_HCLK + * CG_CTRL_1 | SNSADC_HCLK + * CG_CTRL_1 | GPIO_HCLK + * CG_CTRL_1 | DMA_HCLK + * CG_CTRL_1 | BLE_BRG_HCLK + * CG_CTRL_1 | APB_SUB_HCLK + * CG_CTRL_1 | SERIAL_HCLK + * CG_CTRL_1 | I2S_S_HCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_FRC_SECU_HCLK + * @arg @ref LL_CGC_FRC_SIM_HCLK + * @arg @ref LL_CGC_FRC_HTB_HCLK + * @arg @ref LL_CGC_FRC_PWM_HCLK + * @arg @ref LL_CGC_FRC_ROM_HCLK + * @arg @ref LL_CGC_FRC_SNSADC_HCLK + * @arg @ref LL_CGC_FRC_GPIO_HCLK + * @arg @ref LL_CGC_FRC_DMA_HCLK + * @arg @ref LL_CGC_FRC_BLE_BRG_HCLK + * @arg @ref LL_CGC_FRC_APB_SUB_HCLK + * @arg @ref LL_CGC_FRC_SERIAL_HCLK + * @arg @ref LL_CGC_FRC_I2S_S_HCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_force_off_hclk_0(uint32_t clk_mask) +{ + WRITE_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], clk_mask); +} + +/** + * @brief Return to clock blocks that was forcibly closed.(Include: Security/SIM/HTB/PWM/ + * ROM/SNSADC/GPIO/DMA/BLE_BRG/APB_SUB/SERIAL/I2S) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SECU_HCLK + * CG_CTRL_1 | SIM_HCLK + * CG_CTRL_1 | HTB_HCLK + * CG_CTRL_1 | PWM_HCLK + * CG_CTRL_1 | ROM_HCLK + * CG_CTRL_1 | SNSADC_HCLK + * CG_CTRL_1 | GPIO_HCLK + * CG_CTRL_1 | DMA_HCLK + * CG_CTRL_1 | BLE_BRG_HCLK + * CG_CTRL_1 | APB_SUB_HCLK + * CG_CTRL_1 | SERIAL_HCLK + * CG_CTRL_1 | I2S_S_HCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_FRC_SECU_HCLK + * @arg @ref LL_CGC_FRC_SIM_HCLK + * @arg @ref LL_CGC_FRC_HTB_HCLK + * @arg @ref LL_CGC_FRC_PWM_HCLK + * @arg @ref LL_CGC_FRC_ROM_HCLK + * @arg @ref LL_CGC_FRC_SNSADC_HCLK + * @arg @ref LL_CGC_FRC_GPIO_HCLK + * @arg @ref LL_CGC_FRC_DMA_HCLK + * @arg @ref LL_CGC_FRC_BLE_BRG_HCLK + * @arg @ref LL_CGC_FRC_APB_SUB_HCLK + * @arg @ref LL_CGC_FRC_SERIAL_HCLK + * @arg @ref LL_CGC_FRC_I2S_S_HCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_force_off_hclk_0(void) +{ + return READ_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[1]); +} + + +/** + * @brief Some peripherals force turn off clock. (Include: AON_MCUSUB/XF_XQSPI/SRAM) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * CG_CTRL_2 | XF_XQSPI_HCLK + * CG_CTRL_2 | SRAM_HCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_FRC_AON_MCUSUB_HCLK + * @arg @ref LL_CGC_FRC_XF_XQSPI_HCLK + * @arg @ref LL_CGC_FRC_SRAM_HCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_force_off_hclk_1(uint32_t clk_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_MSK_HCLK_1, clk_mask); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return to clock blocks that was forcibly closed.(Include: AON_MCUSUB/XF_XQSPI/SRAM) + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * CG_CTRL_2 | XF_XQSPI_HCLK + * CG_CTRL_2 | SRAM_HCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_FRC_AON_MCUSUB_HCLK + * @arg @ref LL_CGC_FRC_XF_XQSPI_HCLK + * @arg @ref LL_CGC_FRC_SRAM_HCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_force_off_hclk_1(void) +{ + return READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_MSK_HCLK_1); +} + +/** + * @brief Some peripherals force turn off clock. (Include: UART0_HCLK/UART1_HCLK/I2C0_HCLK/ + * I2C1_HCLK/SPIM_HCLK/SPIS_HCLK/QSPI0_HCLK/QSPI1_HCLK/I2S_HCLK/SECU_DIV4_PCLK/XQSPI_DIV4_PCLK) + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART0_HCLK + * PERIPH_GC | UART1_HCLK + * PERIPH_GC | I2C0_HCLK + * PERIPH_GC | I2C1_HCLK + * PERIPH_GC | SPIM_HCLK + * PERIPH_GC | SPIS_HCLK + * PERIPH_GC | QSPI0_HCLK + * PERIPH_GC | QSPI1_HCLK + * PERIPH_GC | I2S_HCLK + * PERIPH_GC | SECU_DIV4_PCLK + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @param clk_mask This parameter can be a combination of the following values: + * @arg @ref LL_CGC_FRC_UART0_HCLK + * @arg @ref LL_CGC_FRC_UART1_HCLK + * @arg @ref LL_CGC_FRC_I2C0_HCLK + * @arg @ref LL_CGC_FRC_I2C1_HCLK + * @arg @ref LL_CGC_FRC_SPIM_HCLK + * @arg @ref LL_CGC_FRC_SPIS_HCLK + * @arg @ref LL_CGC_FRC_QSPI0_HCLK + * @arg @ref LL_CGC_FRC_QSPI1_HCLK + * @arg @ref LL_CGC_FRC_I2S_HCLK + * @arg @ref LL_CGC_FRC_SECU_DIV4_PCLK + * @arg @ref LL_CGC_FRC_XQSPI_DIV4_PCLK + * @retval None + */ +__STATIC_INLINE void ll_cgc_set_force_off_hclk_2(uint32_t clk_mask) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_MSK_HCLK_2, clk_mask); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return to clock blocks that was forcibly closed.(Include: UART0_HCLK/UART1_HCLK/I2C0_HCLK/ + * I2C1_HCLK/SPIM_HCLK/SPIS_HCLK/QSPI0_HCLK/QSPI1_HCLK/I2S_HCLK/SECU_DIV4_PCLK/XQSPI_DIV4_PCLK) + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART0_HCLK + * PERIPH_GC | UART1_HCLK + * PERIPH_GC | I2C0_HCLK + * PERIPH_GC | I2C1_HCLK + * PERIPH_GC | SPIM_HCLK + * PERIPH_GC | SPIS_HCLK + * PERIPH_GC | QSPI0_HCLK + * PERIPH_GC | QSPI1_HCLK + * PERIPH_GC | I2S_HCLK + * PERIPH_GC | SECU_DIV4_PCLK + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_CGC_FRC_UART0_HCLK + * @arg @ref LL_CGC_FRC_UART1_HCLK + * @arg @ref LL_CGC_FRC_I2C0_HCLK + * @arg @ref LL_CGC_FRC_I2C1_HCLK + * @arg @ref LL_CGC_FRC_SPIM_HCLK + * @arg @ref LL_CGC_FRC_SPIS_HCLK + * @arg @ref LL_CGC_FRC_QSPI0_HCLK + * @arg @ref LL_CGC_FRC_QSPI1_HCLK + * @arg @ref LL_CGC_FRC_I2S_HCLK + * @arg @ref LL_CGC_FRC_SECU_DIV4_PCLK + * @arg @ref LL_CGC_FRC_XQSPI_DIV4_PCLK + */ +__STATIC_INLINE uint32_t ll_cgc_get_force_off_hclk_2(void) +{ + return READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_MSK_HCLK_2); +} + +/** + * @brief Enable security blocks(including AES, PKC, Present, HMAC) automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SECU_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_secu_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SECU_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable security blocks(including AES, PKC, Present, HMAC) automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SECU_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_secu_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SECU_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the security blocks(including AES, PKC, Present, HMAC) automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SECU_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_secu_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SECU_HCLK) == (MCU_SUB_WFI_SECU_HCLK)); +} + +/** + * @brief Enable SIM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_sim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SIM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable SIM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_sim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SIM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the SIM automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SIM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_sim_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SIM_HCLK) == (MCU_SUB_WFI_SIM_HCLK)); +} + +/** + * @brief Enable Hopping Table automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | HTB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_htb_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_HTB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable Hopping Table automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | HTB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_htb_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_HTB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the Hopping Table automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | HTB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_htb_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_HTB_HCLK) == (MCU_SUB_WFI_HTB_HCLK)); +} + +/** + * @brief Enable PWM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | PWM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_pwm_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_PWM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable PWM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | PWM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_pwm_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_PWM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the PWM automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | PWM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_pwm_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_PWM_HCLK) == (MCU_SUB_WFI_PWM_HCLK)); +} + +/** + * @brief Enable ROM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | ROM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_rom_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_ROM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable ROM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | ROM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_rom_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_ROM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the ROM automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | ROM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_rom_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_ROM_HCLK) == (MCU_SUB_WFI_ROM_HCLK)); +} + +/** + * @brief Enable SNSADC automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SNSADC_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_snsadc_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SNSADC_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable SNSADC automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SNSADC_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_snsadc_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SNSADC_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the SNSADC automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SNSADC_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_snsadc_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SNSADC_HCLK) == (MCU_SUB_WFI_SNSADC_HCLK)); +} + +/** + * @brief Enable GPIO automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | GPIO_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_gpio_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_GPIO_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable GPIO automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | GPIO_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_gpio_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_GPIO_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the GPIO automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | GPIO_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_gpio_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_GPIO_HCLK) == (MCU_SUB_WFI_GPIO_HCLK)); +} + +/** + * @brief Enable DMA automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | DMA_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_dma_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_DMA_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable DMA automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | DMA_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_dma_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_DMA_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the DMA automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | DMA_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_dma_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_DMA_HCLK) == (MCU_SUB_WFI_DMA_HCLK)); +} + +/** + * @brief Enable BLE Bridge automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | BLE_BRG_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_ble_brg_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_BLE_BRG_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable BLE Bridge automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | BLE_BRG_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_ble_brg_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_BLE_BRG_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the BLE Bridge automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | BLE_BRG_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_ble_brg_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_BLE_BRG_HCLK) == (MCU_SUB_WFI_BLE_BRG_HCLK)); +} + +/** + * @brief Enable APB Subsystem automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | APB_SUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_apb_sub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_APB_SUB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable APB Subsystem automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | APB_SUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_apb_sub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_APB_SUB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the APB Subsystem automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | APB_SUB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_apb_sub_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_APB_SUB_HCLK) == (MCU_SUB_WFI_APB_SUB_HCLK)); +} + +/** + * @brief Enable serial blocks(including I2C, UART, QSPI, I2S, SPI) automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SERIAL_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_serial_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SERIAL_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable serial blocks(including I2C, UART, QSPI, I2S, SPI) automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SERIAL_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_serial_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SERIAL_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the serial blocks(including I2C, UART, QSPI, I2S, SPI) automatic turn off + * clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | SERIAL_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_serial_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_SERIAL_HCLK) == (MCU_SUB_WFI_SERIAL_HCLK)); +} + +/** + * @brief Enable I2S slave automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | I2S_S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_i2s_s_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_I2S_S_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable I2S slave automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | I2S_S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_i2s_s_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_I2S_S_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the I2S slave automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_0 | I2S_S_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_i2s_s_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[0], MCU_SUB_WFI_I2S_S_HCLK) == (MCU_SUB_WFI_I2S_S_HCLK)); +} + +/** + * @brief Enable AON_MUCSUB automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_aon_mcusub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_AON_MCUSUB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable AON_MUCSUB automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_aon_mcusub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_AON_MCUSUB_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the AON_MUCSUB automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_aon_mcusub_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_AON_MCUSUB_HCLK) == (MCU_SUB_WFI_AON_MCUSUB_HCLK)); +} + +/** + * @brief Enable XQSPI automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_xqspi_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_XF_XQSPI_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable XQSPI automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_xqspi_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_XF_XQSPI_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the XQSPI automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_xqspi_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_XF_XQSPI_HCLK) == (MCU_SUB_WFI_XF_XQSPI_HCLK)); +} + +/** + * @brief Enable SRAM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_sram_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_SRAM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable SRAM automatic turn off clock during WFI + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_sram_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_SRAM_HCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the SRAM automatic turn off clock is enabled. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_sram_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_WFI_SRAM_HCLK) == (MCU_SUB_WFI_SRAM_HCLK)); +} + +/** + * @brief Enable security blocks automatic turn off div4 clock during WFI + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SECU_DIV4_PCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_secu_div4_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_SECU_DIV4_PCLK); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable security blocks automatic turn off div4 clock during WFI + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SECU_DIV4_PCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_secu_div4_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_SECU_DIV4_PCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the security blocks automatic turn off div4 + * clock is enabled. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SECU_DIV4_PCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_secu_div4_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_SECU_DIV4_PCLK) == (MCU_SUB_WFI_SECU_DIV4_PCLK)); +} + +/** + * @brief Enable XQSPI automatic turn off div4 clock during WFI + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_wfi_off_xqspi_div4_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_XQSPI_DIV4_PCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable XQSPI automatic turn off div4 clock during WFI + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_wfi_off_xqspi_div4_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_XQSPI_DIV4_PCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the XQSPI automatic turn off div4 clock is enabled. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | XQSPI_DIV4_PCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_wfi_off_xqspi_div4_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_WFI_XQSPI_DIV4_PCLK) == (MCU_SUB_WFI_XQSPI_DIV4_PCLK)); +} + +/** + * @brief Enabling force to turn off the clock for security blocks(including AES, PKC, Present, HMAC). + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SECU_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_secu_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SECU_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for security blocks(including AES, PKC, Present, HMAC). + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SECU_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_secu_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SECU_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for security blocks(including AES, PKC, Present, HMAC) is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SECU_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_secu_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SECU_HCLK) == (MCU_SUB_FORCE_SECU_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for SIM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_sim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SIM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for SIM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_sim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SIM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for SIM is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SIM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_sim_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SIM_HCLK) == (MCU_SUB_FORCE_SIM_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for Hopping Table. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | HTB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_htb_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_HTB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for Hopping Table. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | HTB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_htb_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_HTB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for Hopping Table is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | HTB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_htb_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_HTB_HCLK) == (MCU_SUB_FORCE_HTB_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for PWM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | PWM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_pwm_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_PWM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for PWM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | PWM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_pwm_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_PWM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for PWM is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | PWM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_pwm_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_PWM_HCLK) == (MCU_SUB_FORCE_PWM_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for ROM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | ROM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_rom_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_ROM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for ROM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | ROM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_rom_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_ROM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for ROM is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | ROM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_rom_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_ROM_HCLK) == (MCU_SUB_FORCE_ROM_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for SNSADC. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SNSADC_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_snsadc_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SNSADC_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for SNSADC. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SNSADC_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_snsadc_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SNSADC_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for SNSADC is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SNSADC_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_snsadc_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SNSADC_HCLK) == (MCU_SUB_FORCE_SNSADC_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for GPIO. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | GPIO_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_gpio_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_GPIO_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for GPIO. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | GPIO_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_gpio_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_GPIO_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for GPIO is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | GPIO_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_gpio_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_GPIO_HCLK) == (MCU_SUB_FORCE_GPIO_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for DMA. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | DMA_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_dma_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_DMA_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for DMA. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | DMA_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_dma_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_DMA_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for DMA is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | DMA_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_dma_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_DMA_HCLK) == (MCU_SUB_FORCE_DMA_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for BLE Bridge. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | BLE_BRG_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_ble_brg_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_BLE_BRG_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for BLE Bridge. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | BLE_BRG_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_ble_brg_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_BLE_BRG_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for BLE Bridge is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | BLE_BRG_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_ble_brg_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_BLE_BRG_HCLK) == (MCU_SUB_FORCE_BLE_BRG_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for APB Subsystem. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | APB_SUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_apb_sub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_APB_SUB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for APB Subsystem. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | APB_SUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_apb_sub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_APB_SUB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for APB Subsystem is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | APB_SUB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_apb_sub_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_APB_SUB_HCLK) == (MCU_SUB_FORCE_APB_SUB_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for serial blocks(including I2C, UART, QSPI, I2S, SPI). + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SERIAL_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_serial_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SERIAL_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for serial blocks(including I2C, UART, QSPI, I2S, SPI). + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SERIAL_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_serial_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SERIAL_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for serial blocks(including I2C, UART, QSPI, I2S, SPI) is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | SERIAL_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_serial_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_SERIAL_HCLK) == (MCU_SUB_FORCE_SERIAL_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for I2S slave. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | I2S_S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_i2s_s_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_I2S_S_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for I2S slave. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | I2S_S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_i2s_s_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_I2S_S_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for I2S slave is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_1 | I2S_S_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_i2s_s_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[1], MCU_SUB_FORCE_I2S_S_HCLK) == (MCU_SUB_FORCE_I2S_S_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for AON_MUCSUB. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_aon_mcusub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_AON_MCUSUB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for AON_MUCSUB. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_aon_mcusub_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_AON_MCUSUB_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for AON_MUCSUB is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | AON_MCUSUB_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_aon_mcusub_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_AON_MCUSUB_HCLK) == (MCU_SUB_FORCE_AON_MCUSUB_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for XQSPI. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_xqspi_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_XF_XQSPI_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for XQSPI. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_xqspi_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_XF_XQSPI_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for XQSPI is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | XF_XQSPI_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_xqspi_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_XF_XQSPI_HCLK) == (MCU_SUB_FORCE_XF_XQSPI_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for SRAM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_sram_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_SRAM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for SRAM. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_sram_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_SRAM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for SRAM is forced to close. + * + * Register | BitsName + * ----------|-------- + * CG_CTRL_2 | SRAM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_sram_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_SUBSYS_CG_CTRL[2], MCU_SUB_FORCE_SRAM_HCLK) == (MCU_SUB_FORCE_SRAM_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for UART0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_uart0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for UART0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_uart0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for UART0 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART0_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_uart0_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART0_HCLK) == (MCU_SUB_FORCE_UART0_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for UART1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_uart1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for UART1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_uart1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for UART1 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | UART1_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_uart1_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_UART1_HCLK) == (MCU_SUB_FORCE_UART1_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for I2C0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_i2c0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for I2C0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_i2c0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for I2C0 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C0_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_i2c0_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C0_HCLK) == (MCU_SUB_FORCE_I2C0_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for I2C1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_i2c1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for I2C1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_i2c1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for I2C1 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2C1_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_i2c1_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2C1_HCLK) == (MCU_SUB_FORCE_I2C1_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for SPIM. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_spim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for SPIM. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIM_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_spim_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIM_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for SPIM is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIM_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_spim_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIM_HCLK) == (MCU_SUB_FORCE_SPIM_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for SPIS. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIS_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_spis_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIS_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for SPIS. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIS_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_spis_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIS_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for SPIS is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | SPIS_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_spis_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SPIS_HCLK) == (MCU_SUB_FORCE_SPIS_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for QSPI0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_qspi0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for QSPI0. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI0_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_qspi0_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI0_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for QSPI0 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI0_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_qspi0_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI0_HCLK) == (MCU_SUB_FORCE_QSPI0_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for QSPI1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_qspi1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for QSPI1. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI1_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_qspi1_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI1_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for QSPI1 is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | QSPI1_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_qspi1_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_QSPI1_HCLK) == (MCU_SUB_FORCE_QSPI1_HCLK)); +} + +/** + * @brief Enabling force to turn off the clock for I2S master. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_i2s_m_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2S_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the clock for I2S master. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_i2s_m_hclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2S_HCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the clock for I2S master is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_i2s_m_hclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_I2S_HCLK) == (MCU_SUB_FORCE_I2S_HCLK)); +} + +/** + * @brief Enabling force to turn off the div4 clock for security blocks. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_enable_force_off_secu_div4_pclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + SET_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SECU_DIV4_PCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disabling force to turn off the div4 clock for security blocks. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval None + */ +__STATIC_INLINE void ll_cgc_disable_force_off_secu_div4_pclk(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + + CLEAR_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SECU_DIV4_PCLK); + + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Indicate whether the div4 clock for security blocks is forced to close. + * + * Register | BitsName + * ----------|-------- + * PERIPH_GC | I2S_HCLK + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_cgc_is_enabled_force_off_secu_div4_pclk(void) +{ + return (READ_BITS(MCU_SUB->MCU_PERIPH_CG, MCU_SUB_FORCE_SECU_DIV4_PCLK) == (MCU_SUB_FORCE_SECU_DIV4_PCLK)); +} + + +/** @} */ + +/** @defgroup CGC_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize CGC registers (Registers restored to their default values). + * @retval An error_status_t enumeration value: + * - SUCCESS: CGC registers are de-initialized + * - ERROR: CGC registers are not de-initialized + */ +error_status_t ll_cgc_deinit(void); + +/** + * @brief Initialize CGC registers according to the specified. + * parameters in p_cgc_init. + * @param p_cgc_init Pointer to a ll_cgc_init_t structure that contains the configuration + * information for the specified CGC register. + * @retval An error_status_t enumeration value: + * - SUCCESS: CGC registers are initialized according to p_cgc_init content + * - ERROR: Problem occurred during CGC Registers initialization + */ +error_status_t ll_cgc_init(ll_cgc_init_t *p_cgc_init); + +/** + * @brief Set each field of a @ref ll_cgc_init_t type structure to default value. + * @param p_cgc_init Pointer to a @ref ll_cgc_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_cgc_struct_init(ll_cgc_init_t *p_cgc_init); + +/** @} */ + +/** @} */ + + +#endif /* CGC */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_CGC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_comp.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_comp.h new file mode 100644 index 0000000..5d1dd21 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_comp.h @@ -0,0 +1,413 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_comp.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of COMP LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_COMP COMP + * @brief COMP LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_COMP_H__ +#define __GR55XX_LL_COMP_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** @defgroup COMP_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup COMP_LL_ES_INIT COMP Exported init structures + * @{ + */ + +/** + * @brief LL COMP init Structure definition + */ +typedef struct _ll_comp_init +{ + uint32_t input_source; /**< Specifies the input source for the comparator. + This parameter can be any value of @ref COMP_LL_EC_INPUT_SRC. + + This parameter can be modified afterwards using unitary function @ref ll_comp_set_input_src(). */ + + uint32_t ref_source; /**< Specifies the reference source for the comparator. + This parameter can be any value of @ref COMP_LL_EC_INPUT_SRC. + + This parameter can be modified afterwards using unitary function @ref ll_comp_set_ref_src(). */ + uint32_t ref_value; /*!< Specifies the value of the COMP buffered reference. + If ref_source select to LL_COMP_REF_SRC_VBAT, this parameter can be a value between: 0 ~ 7. + This parameter can be modified afterwards using unitary function @ref ll_comp_set_vbatt_lvl(). + + If ref_source select to LL_COMP_REF_SRC_VREF, this parameter can be a value between: 0 ~ 63. + This parameter can be modified afterwards using unitary function @ref ll_comp_set_vref_lvl(). */ +} ll_comp_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup COMP_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup COMP_LL_Exported_Constants COMP Exported Constants + * @{ + */ + +/** @defgroup COMP_LL_EC_INPUT_SRC COMP INPUT SOURCE + * @{ + */ +#define LL_COMP_INPUT_SRC_IO0 (0UL << AON_RF_REG_10_CHANNEL_SEL_P_Pos) /**< Set MSIO_0 as inputs for the comparator */ +#define LL_COMP_INPUT_SRC_IO1 (1UL << AON_RF_REG_10_CHANNEL_SEL_P_Pos) /**< Set MSIO_1 as inputs for the comparator */ +#define LL_COMP_INPUT_SRC_IO2 (2UL << AON_RF_REG_10_CHANNEL_SEL_P_Pos) /**< Set MSIO_2 as inputs for the comparator */ +#define LL_COMP_INPUT_SRC_IO3 (3UL << AON_RF_REG_10_CHANNEL_SEL_P_Pos) /**< Set MSIO_3 as inputs for the comparator */ +#define LL_COMP_INPUT_SRC_IO4 (4UL << AON_RF_REG_10_CHANNEL_SEL_P_Pos) /**< Set MSIO_4 as inputs for the comparator */ +/** @} */ + +/** @defgroup COMP_LL_EC_REF_SRC COMP REF SOURCE + * @{ + */ +#define LL_COMP_REF_SRC_IO0 (0UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set MSIO_0 as references for the comparator */ +#define LL_COMP_REF_SRC_IO1 (1UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set MSIO_1 as references for the comparator */ +#define LL_COMP_REF_SRC_IO2 (2UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set MSIO_2 as references for the comparator */ +#define LL_COMP_REF_SRC_IO3 (3UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set MSIO_3 as references for the comparator */ +#define LL_COMP_REF_SRC_IO4 (4UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set MSIO_4 as references for the comparator */ +#define LL_COMP_REF_SRC_VBAT (6UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set VBATT as references for the comparator */ +#define LL_COMP_REF_SRC_VREF (7UL << AON_RF_REG_10_CHANNEL_SEL_N_Pos) /**< Set VREF as references for the comparator */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup COMP_LL_Exported_Macros COMP Exported Macros + * @{ + */ + +/** @defgroup COMP_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in COMP register + * @param __instance__ COMP instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_COMP_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG((__instance__)->__REG__, (__VALUE__)) + +/** + * @brief Read a value in COMP register + * @param __instance__ COMP instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_COMP_ReadReg(__instance__, __REG__) READ_REG((__instance__)->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup COMP_LL_Private_Macros COMP Private Macros + * @{ + */ + +/** @defgroup COMP_LL_EC_DEFAULT_CONFIG InitStruct default configuartion + * @{ + */ + +/** + * @brief Default configuartion for initializing structure + */ +#define LL_COMP_DEFAULT_CONFIG \ +{ \ + .channel_p = LL_COMP_CHANNEL_IO0, \ + .channel_n = LL_COMP_CHANNEL_IO1, \ +} +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup COMP_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup COMP_LL_EF_Configuration Basic Configuration + * @{ + */ + +/** + * @brief Enable COMP module. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | COMP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_comp_enable(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL_MSIO_COMP); + SET_BITS(AON->RF_REG_10, AON_RF_REG_10_WAKE_COMP_EN_Msk); +} + +/** + * @brief Disable COMP module. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | COMP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_comp_disable(void) +{ + CLEAR_BITS(AON->RF_REG_10, AON_RF_REG_10_WAKE_COMP_EN_Msk); + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL_MSIO_COMP); +} + +/** + * @brief Set channel of COMP input source. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | AON_RF_REG_10_CHANNEL_SEL_P | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param source This parameter can be one of the following values: + * @arg @ref LL_COMP_INPUT_SRC_IO0 + * @arg @ref LL_COMP_INPUT_SRC_IO1 + * @arg @ref LL_COMP_INPUT_SRC_IO2 + * @arg @ref LL_COMP_INPUT_SRC_IO3 + * @arg @ref LL_COMP_INPUT_SRC_IO4 + * @retval None + */ +__STATIC_INLINE void ll_comp_set_input_src(uint32_t source) +{ + MODIFY_REG(AON->RF_REG_10, AON_RF_REG_10_CHANNEL_SEL_P_Msk, source); +} + +/** + * @brief Set channel of COMP reference source. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | AON_RF_REG_10_CHANNEL_SEL_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param source This parameter can be one of the following values: + * @arg @ref LL_COMP_REF_SRC_IO0 + * @arg @ref LL_COMP_REF_SRC_IO1 + * @arg @ref LL_COMP_REF_SRC_IO2 + * @arg @ref LL_COMP_REF_SRC_IO3 + * @arg @ref LL_COMP_REF_SRC_IO4 + * @arg @ref LL_COMP_REF_SRC_VBAT + * @arg @ref LL_COMP_REF_SRC_VREF + * @retval None + */ +__STATIC_INLINE void ll_comp_set_ref_src(uint32_t source) +{ + MODIFY_REG(AON->RF_REG_10, AON_RF_REG_10_CHANNEL_SEL_N_Msk, source); +} + +/** + * @brief Set VBATT control level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | BATT_LVL_CTRL_LV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param level This parameter can be a value between: 0 ~ 7 + * Vbatt_ref = ((level+1)/10) * VBATT + * @retval None + */ +__STATIC_INLINE void ll_comp_set_vbatt_lvl(uint32_t level) +{ + MODIFY_REG(AON->RF_REG_10, AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Msk, level << AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Pos); +} + +/** + * @brief Set VREF control level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RF_REG_10 | COMP_REF_CTRL_LV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param level This parameter can be a value between: 0 ~ 63 + * Vref = 30mv * level + * @retval None + */ +__STATIC_INLINE void ll_comp_set_vref_lvl(uint32_t level) +{ + MODIFY_REG(AON->RF_REG_10, AON_RF_REG_10_COMP_REF_CTRL_LV_Msk, level << AON_RF_REG_10_COMP_REF_CTRL_LV_Pos); +} + +/** + * @brief Indicate if the COMP Interrupt Flag is set or not. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | MSIO_COMP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or o). + */ +__STATIC_INLINE uint32_t ll_comp_is_active_flag_it(void) +{ + return (READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_PMU_MSIO_COMP) == AON_SLP_EVENT_PMU_MSIO_COMP); +} + +/** + * @brief Clear Interrupt Status flag for COMP. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | MSIO_COMP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None. + */ +__STATIC_INLINE void ll_comp_clear_flag_it(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->SLP_EVENT, AON_SLP_EVENT_PMU_MSIO_COMP); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** @} */ + +/** @defgroup COMP_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize COMP registers (Registers restored to their default values). + * @retval An error_status_t enumeration value: + * - SUCCESS: COMP registers are de-initialized + * - ERROR: COMP registers are not de-initialized + */ +error_status_t ll_comp_deinit(void); + +/** + * @brief Initialize COMP registers according to the specified. + * parameters in p_comp_init. + * @param p_comp_init Pointer to a ll_comp_init_t structure that contains the configuration + * information for the specified COMP peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: COMP registers are initialized according to p_comp_init content + * - ERROR: Problem occurred during COMP Registers initialization + */ +error_status_t ll_comp_init(ll_comp_init_t *p_comp_init); + +/** + * @brief Set each field of a @ref ll_comp_init_t type structure to default value. + * @param p_comp_init Pointer to a @ref ll_comp_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_comp_struct_init(ll_comp_init_t *p_comp_init); + +/** @} */ + +/** @} */ + +#endif /* AON */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_COMP_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dma.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dma.h new file mode 100644 index 0000000..5ea6cfc --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dma.h @@ -0,0 +1,4627 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_dma.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of DMA LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_DMA DMA + * @brief DMA LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_DMA_H__ +#define __GR55xx_LL_DMA_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (DMA) + +/** @defgroup DMA_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup DMA_LL_ES_INIT DMA Exported init structures + * @{ + */ + +/** + * @brief LL DMA init Structure definition + */ +typedef struct _ll_dma_init +{ + uint32_t src_address; /**< Specifies the Source base address for DMA transfer. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t dst_address; /**< Specifies the Destination base address for DMA transfer. + + This parameter must be a value between Min_Data = 0 and Max_Data = 0xFFFFFFFF. */ + + uint32_t direction; /**< Specifies if the data will be transferred from memory to peripheral, + from memory to memory or from peripheral to memory or form peripheral to peripheral. + This parameter can be a value of @ref DMA_LL_EC_DIRECTION + + This feature can be modified afterwards using unitary function @ref ll_dma_set_data_transfer_direction(). */ + + uint32_t mode; /**< Specifies the Single block or Multi-block operation mode. + This parameter can be a value of @ref DMA_LL_EC_MODE + @note: The circular buffer mode cannot be used if the memory to memory + data transfer direction is configured on the selected Channel + + This feature can be modified afterwards using unitary function @ref ll_dma_set_mode(). */ + + uint32_t src_increment_mode; /**< Specifies whether the Source address is incremented or decrement or not. + This parameter can be a value of @ref DMA_LL_EC_SOURCE + + This feature can be modified afterwards using unitary function @ref ll_dma_set_source_increment_mode(). */ + + uint32_t dst_increment_mode; /**< Specifies whether the Destination address is incremented or decrement or not. + This parameter can be a value of @ref DMA_LL_EC_DESTINATION + + This feature can be modified afterwards using unitary function @ref ll_dma_set_destination_increment_mode(). */ + + uint32_t src_data_width; /**< Specifies the Souce transfer width alignment(byte, half word, word). + This parameter can be a value of @ref DMA_LL_EC_SDATAALIGN + + This feature can be modified afterwards using unitary function @ref ll_dma_set_source_width(). */ + + uint32_t dst_data_width; /**< Specifies the Destination transfer width alignment(byte, half word, word). + This parameter can be a value of @ref DMA_LL_EC_DDATAALIGN + + This feature can be modified afterwards using unitary function @ref ll_dma_set_destination_width(). */ + + uint32_t block_size; /**< Specifies the number of data to transfer, in data unit. + The data unit is equal to the source buffer configuration set in src_data_width parameters. + This parameter must be a value between Min_Data = 0 and Max_Data = 0x1FF + + This feature can be modified afterwards using unitary function @ref ll_dma_set_block_size(). */ + + uint32_t src_peripheral; /**< Specifies the Source peripheral type. + This parameter can be a value of @ref DMA_LL_EC_PERIPH + + This feature can be modified afterwards using unitary function @ref ll_dma_set_source_peripheral(). */ + + uint32_t dst_peripheral; /**< Specifies the Destination peripheral type. + This parameter can be a value of @ref DMA_LL_EC_PERIPH + + This feature can be modified afterwards using unitary function @ref ll_dma_set_destination_peripheral(). */ + + uint32_t priority; /**< Specifies the channel priority level. + This parameter can be a value of @ref DMA_LL_EC_PRIORITY + + This feature can be modified afterwards using unitary function @ref ll_dma_set_channel_priority_level(). */ + +} ll_dma_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup DMA_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Constants DMA Exported Constants + * @{ + */ + +/** @defgroup DMA_LL_EC_CHANNEL CHANNEL + * @{ + */ +#define LL_DMA_CHANNEL_0 ((uint32_t)0x00000000U) /**< DMA Channel 0 */ +#define LL_DMA_CHANNEL_1 ((uint32_t)0x00000001U) /**< DMA Channel 1 */ +#define LL_DMA_CHANNEL_2 ((uint32_t)0x00000002U) /**< DMA Channel 2 */ +#define LL_DMA_CHANNEL_3 ((uint32_t)0x00000003U) /**< DMA Channel 3 */ +#define LL_DMA_CHANNEL_4 ((uint32_t)0x00000004U) /**< DMA Channel 4 */ +#define LL_DMA_CHANNEL_5 ((uint32_t)0x00000005U) /**< DMA Channel 5 */ +#define LL_DMA_CHANNEL_6 ((uint32_t)0x00000006U) /**< DMA Channel 6 */ +#define LL_DMA_CHANNEL_7 ((uint32_t)0x00000007U) /**< DMA Channel 7 */ +#define LL_DMA_CHANNEL_ALL ((uint32_t)0xFFFF0000U) /**< DMA Channel all (used only for function @ref ll_dma_deinit(). */ +/** @} */ + +/** @defgroup DMA_LL_EC_DIRECTION Transfer Direction + * @{ + */ +#define LL_DMA_DIRECTION_MEMORY_TO_MEMORY DMA_CTLL_TT_FC_M2M /**< Memory to memory direction */ +#define LL_DMA_DIRECTION_MEMORY_TO_PERIPH DMA_CTLL_TT_FC_M2P /**< Memory to peripheral direction */ +#define LL_DMA_DIRECTION_PERIPH_TO_MEMORY DMA_CTLL_TT_FC_P2M /**< Peripheral to memory direction */ +#define LL_DMA_DIRECTION_PERIPH_TO_PERIPH DMA_CTLL_TT_FC_P2P /**< Peripheral to Peripheral direction */ +/** @} */ + + +/** @defgroup DMA_LL_EC_MODE Transfer mode + * @{ + */ +#define LL_DMA_MODE_SINGLE_BLOCK ((uint32_t)0x00000000U) /**< Single block */ +#define LL_DMA_MODE_MULTI_BLOCK_SRC_RELOAD DMA_CFGL_RELOAD_SRC /**< Multi-block: src address reload, dst address contiguous */ +#define LL_DMA_MODE_MULTI_BLOCK_DST_RELOAD DMA_CFGL_RELOAD_DST /**< Multi-block: src address contiguous, dst address reload */ +#define LL_DMA_MODE_MULTI_BLOCK_ALL_RELOAD (DMA_CFGL_RELOAD_SRC | DMA_CFGL_RELOAD_DST) /**< Multi-block: src address reload, dst address reload */ +/** @} */ + +/** @defgroup DMA_LL_EC_SOURCE Source increment mode + * @{ + */ +#define LL_DMA_SRC_INCREMENT DMA_CTLL_SINC_INC /**< Source Address increment */ +#define LL_DMA_SRC_DECREMENT DMA_CTLL_SINC_DEC /**< Source Address decrement */ +#define LL_DMA_SRC_NO_CHANGE DMA_CTLL_SINC_NO /**< Source Address no change */ +/** @} */ + +/** @defgroup DMA_LL_EC_DESTINATION Destination increment mode + * @{ + */ +#define LL_DMA_DST_INCREMENT DMA_CTLL_DINC_INC /**< Destination Address increment */ +#define LL_DMA_DST_DECREMENT DMA_CTLL_DINC_DEC /**< Destination Address decrement */ +#define LL_DMA_DST_NO_CHANGE DMA_CTLL_DINC_NO /**< Destination Address no change */ +/** @} */ + +/** @defgroup DMA_LL_EC_SRC_BURST Source burst transaction length + * @{ + */ +#define LL_DMA_SRC_BURST_LENGTH_1 DMA_CTLL_SRC_MSIZE_1 /**< Source Burst length: 1 word */ +#define LL_DMA_SRC_BURST_LENGTH_4 DMA_CTLL_SRC_MSIZE_4 /**< Source Burst length: 4 words */ +#define LL_DMA_SRC_BURST_LENGTH_8 DMA_CTLL_SRC_MSIZE_8 /**< Source Burst length: 8 words */ +#define LL_DMA_SRC_BURST_LENGTH_16 DMA_CTLL_SRC_MSIZE_16 /**< Source Burst length: 16 words */ +#define LL_DMA_SRC_BURST_LENGTH_32 DMA_CTLL_SRC_MSIZE_32 /**< Source Burst length: 32 words */ +#define LL_DMA_SRC_BURST_LENGTH_64 DMA_CTLL_SRC_MSIZE_64 /**< Source Burst length: 64 words */ +/** @} */ + +/** @defgroup DMA_LL_EC_DST_BURST Destination burst transaction length + * @{ + */ +#define LL_DMA_DST_BURST_LENGTH_1 DMA_CTLL_DST_MSIZE_1 /**< Destination Burst length: 1 word */ +#define LL_DMA_DST_BURST_LENGTH_4 DMA_CTLL_DST_MSIZE_4 /**< Destination Burst length: 4 words */ +#define LL_DMA_DST_BURST_LENGTH_8 DMA_CTLL_DST_MSIZE_8 /**< Destination Burst length: 8 words */ +#define LL_DMA_DST_BURST_LENGTH_16 DMA_CTLL_DST_MSIZE_16 /**< Destination Burst length: 16 words */ +#define LL_DMA_DST_BURST_LENGTH_32 DMA_CTLL_DST_MSIZE_32 /**< Destination Burst length: 32 words */ +#define LL_DMA_DST_BURST_LENGTH_64 DMA_CTLL_DST_MSIZE_64 /**< Destination Burst length: 64 words */ +/** @} */ + +/** @defgroup DMA_LL_EC_SDATAALIGN Source data alignment + * @{ + */ +#define LL_DMA_SDATAALIGN_BYTE DMA_CTLL_SRC_TR_WIDTH_8 /**< Source data alignment : Byte */ +#define LL_DMA_SDATAALIGN_HALFWORD DMA_CTLL_SRC_TR_WIDTH_16 /**< Source data alignment : HalfWord */ +#define LL_DMA_SDATAALIGN_WORD DMA_CTLL_SRC_TR_WIDTH_32 /**< Source data alignment : Word */ +/** @} */ + +/** @defgroup DMA_LL_EC_DDATAALIGN Destination data alignment + * @{ + */ +#define LL_DMA_DDATAALIGN_BYTE DMA_CTLL_DST_TR_WIDTH_8 /**< Destination data alignment : Byte */ +#define LL_DMA_DDATAALIGN_HALFWORD DMA_CTLL_DST_TR_WIDTH_16 /**< Destination data alignment : HalfWord */ +#define LL_DMA_DDATAALIGN_WORD DMA_CTLL_DST_TR_WIDTH_32 /**< Destination data alignment : Word */ +/** @} */ + +/** @defgroup DMA_LL_EC_PRIORITY Transfer Priority level + * @{ + */ +#define LL_DMA_PRIORITY_0 DMA_CFGL_CH_PRIOR_0 /**< Priority level : 0 */ +#define LL_DMA_PRIORITY_1 DMA_CFGL_CH_PRIOR_1 /**< Priority level : 1 */ +#define LL_DMA_PRIORITY_2 DMA_CFGL_CH_PRIOR_2 /**< Priority level : 2 */ +#define LL_DMA_PRIORITY_3 DMA_CFGL_CH_PRIOR_3 /**< Priority level : 3 */ +#define LL_DMA_PRIORITY_4 DMA_CFGL_CH_PRIOR_4 /**< Priority level : 4 */ +#define LL_DMA_PRIORITY_5 DMA_CFGL_CH_PRIOR_5 /**< Priority level : 5 */ +#define LL_DMA_PRIORITY_6 DMA_CFGL_CH_PRIOR_6 /**< Priority level : 6 */ +#define LL_DMA_PRIORITY_7 DMA_CFGL_CH_PRIOR_7 /**< Priority level : 7 */ +/** @} */ + +/** @defgroup DMA_LL_EC_SHANDSHAKING Source handshake interface + * @{ + */ +#define LL_DMA_SHANDSHAKING_HW ((uint32_t)0x00000000U) /**< Source: hardware handshake */ +#define LL_DMA_SHANDSHAKING_SW DMA_CFGL_HS_SEL_SRC /**< Source: software handshake */ +/** @} */ + +/** @defgroup DMA_LL_EC_DHANDSHAKING Destination handshake interface + * @{ + */ +#define LL_DMA_DHANDSHAKING_HW ((uint32_t)0x00000000U) /**< Destination: hardware handshake */ +#define LL_DMA_DHANDSHAKING_SW DMA_CFGL_HS_SEL_DST /**< Destination: software handshake */ +/** @} */ + +/** @defgroup DMA_LL_EC_PERIPH DMA Peripheral type + * @{ + */ +#define LL_DMA_PERIPH_SPIM_TX ((uint32_t)0x00000000U) /**< DMA Peripheral type is SPIM TX */ +#define LL_DMA_PERIPH_SPIM_RX ((uint32_t)0x00000001U) /**< DMA Peripheral type is SPIM RX */ +#define LL_DMA_PERIPH_SPIS_TX ((uint32_t)0x00000002U) /**< DMA Peripheral type is SPIS TX */ +#define LL_DMA_PERIPH_SPIS_RX ((uint32_t)0x00000003U) /**< DMA Peripheral type is SPIS RX */ +#define LL_DMA_PERIPH_QSPI0_TX ((uint32_t)0x00000004U) /**< DMA Peripheral type is QSPI0 TX */ +#define LL_DMA_PERIPH_QSPI0_RX ((uint32_t)0x00000005U) /**< DMA Peripheral type is QSPI0 RX */ +#define LL_DMA_PERIPH_I2C0_TX ((uint32_t)0x00000006U) /**< DMA Peripheral type is I2C0 TX */ +#define LL_DMA_PERIPH_I2C0_RX ((uint32_t)0x00000007U) /**< DMA Peripheral type is I2C0 RX */ +#define LL_DMA_PERIPH_I2C1_TX ((uint32_t)0x00000008U) /**< DMA Peripheral type is I2C1 TX */ +#define LL_DMA_PERIPH_I2C1_RX ((uint32_t)0x00000009U) /**< DMA Peripheral type is I2C1 RX */ +#define LL_DMA_PERIPH_I2S_S_TX ((uint32_t)0x00000008U) /**< DMA Peripheral type is I2S_S TX */ +#define LL_DMA_PERIPH_I2S_S_RX ((uint32_t)0x00000009U) /**< DMA Peripheral type is I2S_S RX */ +#define LL_DMA_PERIPH_UART0_TX ((uint32_t)0x0000000AU) /**< DMA Peripheral type is UART0 TX */ +#define LL_DMA_PERIPH_UART0_RX ((uint32_t)0x0000000BU) /**< DMA Peripheral type is UART0 RX */ +#define LL_DMA_PERIPH_QSPI1_TX ((uint32_t)0x0000000CU) /**< DMA peripheral type is QSPI1 TX */ +#define LL_DMA_PERIPH_QSPI1_RX ((uint32_t)0x0000000DU) /**< DMA peripheral type is QSPI1 RX */ +#define LL_DMA_PERIPH_I2S_M_TX ((uint32_t)0x0000000CU) /**< DMA Peripheral type is I2S_M TX */ +#define LL_DMA_PERIPH_I2S_M_RX ((uint32_t)0x0000000DU) /**< DMA Peripheral type is I2S_M RX */ +#define LL_DMA_PERIPH_SNSADC ((uint32_t)0x0000000EU) /**< DMA peripheral type is SNSADC */ +#define LL_DMA_PERIPH_MEM ((uint32_t)0x0000000FU) /**< DMA peripheral type is Memory */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DMA_LL_Exported_Macros DMA Exported Macros + * @{ + */ + +/** @defgroup DMA_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in DMA register + * @param __instance__ DMA instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_DMA_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__.__REG__, (__VALUE__)) + +/** + * @brief Read a value in DMA register + * @param __instance__ DMA instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_DMA_ReadReg(__instance__, __REG__) READ_REG(__instance__.__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup DMA_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup DMA_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable DMA Module. + * @note This function is used to enable the DMA Module, which must be done before any + * channel activity can begin. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_REG | CFG_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @retval None + */ +__STATIC_INLINE void ll_dma_enable(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->MISCELLANEOU.CFG, DMA_MODULE_CFG_EN); +} + +/** + * @brief Disable DMA Module. + * @note If the ll_dma_disable() function is called while any dma channel is still active, + * the ll_dma_is_enable() function still return 1 to indicate that there are channels + * still active until hardware has terminated all cativity on all channels, at which + * point the ll_dma_is_enable() function returns 0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_REG | CFG_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @retval None + */ +__STATIC_INLINE void ll_dma_disable(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->MISCELLANEOU.CFG, 0); +} + +/** + * @brief Check if DMA Module is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_REG | CFG_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->MISCELLANEOU.CFG, DMA_MODULE_CFG_EN) == DMA_MODULE_CFG_EN); +} + +/** + * @brief Enable DMA channel. + * @note When the DMA Module is disabled, then call this function to DMA_CFG_REG register + * is ignored and call ll_dma_disable_channel() function will always returns 0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CH_EN_REG | CH_EN_WE&CH_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_channel(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->MISCELLANEOU.CH_EN, (1 << (channel + DMA_CH_WE_EN_Pos)) + (1 << channel)); +} + +/** + * @brief Disable DMA channel. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CH_EN_REG | CH_EN_WE&CH_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_channel(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->MISCELLANEOU.CH_EN, (1 << (channel + DMA_CH_WE_EN_Pos))); +} + +/** + * @brief Check if DMA channel is enabled or disabled. + * @note Software can therefore poll this function to determine when channel is free + * for a new DMA transfer. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CH_EN_REG | CH_EN_WE&CH_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enabled_channel(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->MISCELLANEOU.CH_EN, (1 << channel)) ? 1 : 0; +} + +/** + * @brief Suspend a DMA channel transfer. + * @note Suspends all DMA data transfers from the source until the ll_dma_resume_channel() + * function is called. The function may be called after enabling the DMA channel. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFGL | CH_SUSP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_suspend_channel(dma_regs_t *DMAx, uint32_t channel) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_CH_SUSP, DMA_CFGL_CH_SUSP); +} + +/** + * @brief Resume a DMA channel. + * @note The function may be called after enabling the DMA channel. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFGL | CH_SUSP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_resume_channel(dma_regs_t *DMAx, uint32_t channel) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_CH_SUSP, 0); +} + +/** + * @brief Check if DMA channel is suspended or resumed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFGL | CH_SUSP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_suspended(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_CH_SUSP) == DMA_CFGL_CH_SUSP); +} + +/** + * @brief Check if DMA channel FIFO is empty. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFGL | FIFO_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_empty_fifo(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_FIFO_EMPTY) == DMA_CFGL_FIFO_EMPTY); +} + +/** + * @brief Configure all parameters link to DMA transfer. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CCR | DIR | + * +----------------------+-----------------------------------+ + * \endrst + * CCR | MEM2MEM + * CCR | CIRC + * CCR | PINC + * CCR | MINC + * CCR | PSIZE + * CCR | MSIZE + * CCR | PL + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param configuration This parameter must be a combination of all the following values: + * @arg @ref LL_DMA_MODE_SINGLE_BLOCK or @ref LL_DMA_MODE_MULTI_BLOCK_SRC_RELOAD or @ref LL_DMA_MODE_MULTI_BLOCK_DST_RELOAD or @ref LL_DMA_MODE_MULTI_BLOCK_ALL_RELOAD + * @arg @ref LL_DMA_SRC_INCREMENT or @ref LL_DMA_SRC_DECREMENT or @ref LL_DMA_SRC_NO_CHANGE + * @arg @ref LL_DMA_DST_INCREMENT or @ref LL_DMA_DST_DECREMENT or @ref LL_DMA_DST_NO_CHANGE + * @arg @ref LL_DMA_SDATAALIGN_BYTE or @ref LL_DMA_SDATAALIGN_HALFWORD or @ref LL_DMA_SDATAALIGN_WORD + * @arg @ref LL_DMA_DDATAALIGN_BYTE or @ref LL_DMA_DDATAALIGN_HALFWORD or @ref LL_DMA_DDATAALIGN_WORD + * @arg @ref LL_DMA_SRC_BURST_LENGTH_1 or @ref LL_DMA_SRC_BURST_LENGTH_4 or @ref LL_DMA_SRC_BURST_LENGTH_8 + * @arg @ref LL_DMA_DST_BURST_LENGTH_1 or @ref LL_DMA_DST_BURST_LENGTH_4 or @ref LL_DMA_DST_BURST_LENGTH_8 + * @retval None + */ +__STATIC_INLINE void ll_dma_config_transfer(dma_regs_t *DMAx, uint32_t channel, uint32_t configuration) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DST_TR_WIDTH | DMA_CTLL_SRC_TR_WIDTH |\ + DMA_CTLL_DINC | DMA_CTLL_SINC | DMA_CTLL_DST_MSIZE | DMA_CTLL_SRC_MSIZE | DMA_CTLL_TT_FC, + configuration); +} + +/** + * @brief Set Data transfer direction (read from peripheral or from memory). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | TT_FC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_PERIPH + * @retval None + */ +__STATIC_INLINE void ll_dma_set_data_transfer_direction(dma_regs_t *DMAx, uint32_t channel, uint32_t direction) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_TT_FC, direction); +} + +/** + * @brief Get Data transfer direction (read from peripheral or from memory). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | TT_FC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_PERIPH + */ +__STATIC_INLINE uint32_t ll_dma_get_data_transfer_direction(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_TT_FC); +} + +/** + * @brief Set DMA mode Single block or Multi block. + * @note The circular buffer mode cannot be used if the memory-to-memory + * data transfer is configured on the selected Channel. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_LO | RELOAD_DST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param mode This parameter can be one of the following values: + * @arg @ref LL_DMA_MODE_SINGLE_BLOCK + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_SRC_RELOAD + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_DST_RELOAD + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_ALL_RELOAD + * @retval None + */ +__STATIC_INLINE void ll_dma_set_mode(dma_regs_t *DMAx, uint32_t channel, uint32_t mode) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_RELOAD_DST | DMA_CFGL_RELOAD_SRC, mode); +} + + +/** + * @brief Get DMA mode circular or normal. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_LO | RELOAD_DST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_MODE_SINGLE_BLOCK + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_SRC_RELOAD + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_DST_RELOAD + * @arg @ref LL_DMA_MODE_MULTI_BLOCK_ALL_RELOAD + */ +__STATIC_INLINE uint32_t ll_dma_get_mode(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_RELOAD_DST | DMA_CFGL_RELOAD_SRC); +} + +/** + * @brief Set Source increment mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SINC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param src_increment_mode This parameter can be one of the following values: + * @arg @ref LL_DMA_SRC_INCREMENT + * @arg @ref LL_DMA_SRC_DECREMENT + * @arg @ref LL_DMA_SRC_NO_CHANGE + * @retval None + */ +__STATIC_INLINE void ll_dma_set_source_increment_mode(dma_regs_t *DMAx, uint32_t channel, uint32_t src_increment_mode) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SINC, src_increment_mode); +} + +/** + * @brief Get Source increment mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SINC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_SRC_INCREMENT + * @arg @ref LL_DMA_SRC_DECREMENT + * @arg @ref LL_DMA_SRC_NO_CHANGE + */ +__STATIC_INLINE uint32_t ll_dma_get_source_increment_mode(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SINC); +} + +/** + * @brief Set Destination increment mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DINC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param dst_increment_mode This parameter can be one of the following values: + * @arg @ref LL_DMA_DST_INCREMENT + * @arg @ref LL_DMA_DST_DECREMENT + * @arg @ref LL_DMA_DST_NO_CHANGE + * @retval None + */ +__STATIC_INLINE void ll_dma_set_destination_increment_mode(dma_regs_t *DMAx, uint32_t channel, uint32_t dst_increment_mode) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DINC, dst_increment_mode); +} + +/** + * @brief Get Destination increment mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DINC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DST_INCREMENT + * @arg @ref LL_DMA_DST_DECREMENT + * @arg @ref LL_DMA_DST_NO_CHANGE + */ +__STATIC_INLINE uint32_t ll_dma_get_destination_increment_mode(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DINC); +} + +/** + * @brief Set Source transfer width. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SRC_TR_WIDTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param src_width This parameter can be one of the following values: + * @arg @ref LL_DMA_SDATAALIGN_BYTE + * @arg @ref LL_DMA_SDATAALIGN_HALFWORD + * @arg @ref LL_DMA_SDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void ll_dma_set_source_width(dma_regs_t *DMAx, uint32_t channel, uint32_t src_width) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SRC_TR_WIDTH, src_width); +} + +/** + * @brief Get Source transfer width. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SRC_TR_WIDTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_SDATAALIGN_BYTE + * @arg @ref LL_DMA_SDATAALIGN_HALFWORD + * @arg @ref LL_DMA_SDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t ll_dma_get_source_width(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SRC_TR_WIDTH); +} + +/** + * @brief Set Destination transfer width. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DST_TR_WIDTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param dst_width This parameter can be one of the following values: + * @arg @ref LL_DMA_DDATAALIGN_BYTE + * @arg @ref LL_DMA_DDATAALIGN_HALFWORD + * @arg @ref LL_DMA_DDATAALIGN_WORD + * @retval None + */ +__STATIC_INLINE void ll_dma_set_destination_width(dma_regs_t *DMAx, uint32_t channel, uint32_t dst_width) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DST_TR_WIDTH, dst_width); +} + +/** + * @brief Get Destination transfer width. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DST_TR_WIDTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DDATAALIGN_BYTE + * @arg @ref LL_DMA_DDATAALIGN_HALFWORD + * @arg @ref LL_DMA_DDATAALIGN_WORD + */ +__STATIC_INLINE uint32_t ll_dma_get_destination_width(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DST_TR_WIDTH); +} + +/** + * @brief Set Source Burst Transaction Length. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SRC_MSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param burst_length This parameter can be one of the following values: + * @arg @ref LL_DMA_SRC_BURST_LENGTH_1 + * @arg @ref LL_DMA_SRC_BURST_LENGTH_4 + * @arg @ref LL_DMA_SRC_BURST_LENGTH_8 + * @retval None + */ +__STATIC_INLINE void ll_dma_set_source_burst_length(dma_regs_t *DMAx, uint32_t channel, uint32_t burst_length) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SRC_MSIZE, burst_length); +} + +/** + * @brief Get Burst Transaction Length. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | SRC_MSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_SRC_BURST_LENGTH_1 + * @arg @ref LL_DMA_SRC_BURST_LENGTH_4 + * @arg @ref LL_DMA_SRC_BURST_LENGTH_8 + */ +__STATIC_INLINE uint32_t ll_dma_get_source_burst_length(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_SRC_MSIZE); +} + +/** + * @brief Set Destination Burst Transaction Length. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DST_MSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param burst_length This parameter can be one of the following values: + * @arg @ref LL_DMA_DST_BURST_LENGTH_1 + * @arg @ref LL_DMA_DST_BURST_LENGTH_4 + * @arg @ref LL_DMA_DST_BURST_LENGTH_8 + * @retval None + */ +__STATIC_INLINE void ll_dma_set_destination_burst_length(dma_regs_t *DMAx, uint32_t channel, uint32_t burst_length) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DST_MSIZE, burst_length); +} + +/** + * @brief Get Destination Burst Transaction Length. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_LO | DST_MSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_DST_BURST_LENGTH_1 + * @arg @ref LL_DMA_DST_BURST_LENGTH_4 + * @arg @ref LL_DMA_DST_BURST_LENGTH_8 + */ +__STATIC_INLINE uint32_t ll_dma_get_destination_burst_length(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_DST_MSIZE); +} + +/** + * @brief Set Channel priority level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_LO | CH_PRIOR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param priority This parameter can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_0 + * @arg @ref LL_DMA_PRIORITY_1 + * @arg @ref LL_DMA_PRIORITY_2 + * @arg @ref LL_DMA_PRIORITY_3 + * @arg @ref LL_DMA_PRIORITY_4 + * @arg @ref LL_DMA_PRIORITY_5 + * @arg @ref LL_DMA_PRIORITY_6 + * @arg @ref LL_DMA_PRIORITY_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_set_channel_priority_level(dma_regs_t *DMAx, uint32_t channel, uint32_t priority) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_CH_PRIOR, priority); +} + +/** + * @brief Get Channel priority level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_LO | CH_PRIOR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PRIORITY_0 + * @arg @ref LL_DMA_PRIORITY_1 + * @arg @ref LL_DMA_PRIORITY_2 + * @arg @ref LL_DMA_PRIORITY_3 + * @arg @ref LL_DMA_PRIORITY_4 + * @arg @ref LL_DMA_PRIORITY_5 + * @arg @ref LL_DMA_PRIORITY_6 + * @arg @ref LL_DMA_PRIORITY_7 + */ +__STATIC_INLINE uint32_t ll_dma_get_channel_priority_level(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_CH_PRIOR); +} + +/** + * @brief Set the block size of a transfer. + * @note This action has no effect if channel is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_HI | BLOCK_TS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param block_size Between Min_Data = 0 and Max_Data = 0xFFF + * @retval None + */ +__STATIC_INLINE void ll_dma_set_block_size(dma_regs_t *DMAx, uint32_t channel, uint32_t block_size) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_HI, DMA_CTLH_BLOCK_TS, block_size); +} + +/** + * @brief Get the block size of a transfer. + * @note Once the channel is enabled, the return value indicate the + * remaining bytes to be transmitted. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTL_HI | BLOCK_TS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFF + */ +__STATIC_INLINE uint32_t ll_dma_get_block_size(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_HI, DMA_CTLH_BLOCK_TS); +} + +/** + * @brief Configure the Source and Destination addresses. + * @note Each IP using DMA provides an API to get directly the register adress (LL_PPP_DMA_GetRegAddr) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SAR | SAR | + * +----------------------+-----------------------------------+ + * \endrst + * DAR | DAR + * CTL_LO | TT_FC + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param src_address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @param dst_address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @param direction This parameter can be one of the following values: + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_MEMORY_TO_PERIPH + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_MEMORY + * @arg @ref LL_DMA_DIRECTION_PERIPH_TO_PERIPH + * @retval None + */ +__STATIC_INLINE void ll_dma_config_address(dma_regs_t *DMAx, + uint32_t channel, + uint32_t src_address, + uint32_t dst_address, + uint32_t direction) +{ + WRITE_REG(DMAx->CHANNEL[channel].SAR, src_address); + WRITE_REG(DMAx->CHANNEL[channel].DAR, dst_address); + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_TT_FC, direction); +} + +/** + * @brief Set the Source address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SAR | SAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dma_set_source_address(dma_regs_t *DMAx, uint32_t channel, uint32_t address) +{ + WRITE_REG(DMAx->CHANNEL[channel].SAR, address); +} + +/** + * @brief Set the Destination address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DAR | DAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dma_set_destination_address(dma_regs_t *DMAx, uint32_t channel, uint32_t address) +{ + WRITE_REG(DMAx->CHANNEL[channel].DAR, address); +} + +/** + * @brief Get Source address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SAR | SAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_dma_get_source_address(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_REG(DMAx->CHANNEL[channel].SAR); +} + +/** + * @brief Get Destination address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DAR | DAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_dma_get_destination_address(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_REG(DMAx->CHANNEL[channel].DAR); +} + +/** + * @brief Set the Memory to Memory Source address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SAR | SAR | + * +----------------------+-----------------------------------+ + * \endrst + * CTL_LO | TT_FC + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dma_set_m2m_src_address(dma_regs_t *DMAx, uint32_t channel, uint32_t address) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_TT_FC, 0); + WRITE_REG(DMAx->CHANNEL[channel].SAR, address); +} + +/** + * @brief Set the Memory to Memory Destination address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DAR | DAR | + * +----------------------+-----------------------------------+ + * \endrst + * CTL_LO | TT_FC + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param address Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dma_set_m2m_dst_address(dma_regs_t *DMAx, uint32_t channel, uint32_t address) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_TT_FC, 0); + WRITE_REG(DMAx->CHANNEL[channel].DAR, address); +} + +/** + * @brief Get the Memory to Memory Source address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SAR | SAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_dma_get_m2m_src_address(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_REG(DMAx->CHANNEL[channel].SAR); +} + +/** + * @brief Get the Memory to Memory Destination address. + * @note Interface used for direction LL_DMA_DIRECTION_MEMORY_TO_MEMORY only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DAR | DAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Between Min_Data = 0 and Max_Data = 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_dma_get_m2m_dst_address(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_REG(DMAx->CHANNEL[channel].DAR); +} + +/** + * @brief Set source peripheral for DMA instance on Channel x. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_HI | SRC_PER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param peripheral This parameter can be one of the following values: + * @arg @ref LL_DMA_PERIPH_SPIM_TX + * @arg @ref LL_DMA_PERIPH_SPIM_RX + * @arg @ref LL_DMA_PERIPH_SPIS_TX + * @arg @ref LL_DMA_PERIPH_SPIS_RX + * @arg @ref LL_DMA_PERIPH_QSPI0_TX + * @arg @ref LL_DMA_PERIPH_QSPI0_RX + * @arg @ref LL_DMA_PERIPH_I2C0_TX + * @arg @ref LL_DMA_PERIPH_I2C0_RX + * @arg @ref LL_DMA_PERIPH_I2C1_TX + * @arg @ref LL_DMA_PERIPH_I2C1_RX + * @arg @ref LL_DMA_PERIPH_I2S_S_TX + * @arg @ref LL_DMA_PERIPH_I2S_S_RX + * @arg @ref LL_DMA_PERIPH_UART0_TX + * @arg @ref LL_DMA_PERIPH_UART0_RX + * @arg @ref LL_DMA_PERIPH_QSPI1_TX + * @arg @ref LL_DMA_PERIPH_QSPI1_RX + * @arg @ref LL_DMA_PERIPH_I2S_M_TX + * @arg @ref LL_DMA_PERIPH_I2S_M_RX + * @arg @ref LL_DMA_PERIPH_SNSADC + * @retval None + */ +__STATIC_INLINE void ll_dma_set_source_peripheral(dma_regs_t *DMAx, uint32_t channel, uint32_t peripheral) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_HI, DMA_CFGH_SRC_PER, (peripheral << DMA_CFGH_SRC_PER_Pos)); +} + +/** + * @brief Get source peripheral for DMA instance on Channel x. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_HI | SRC_PER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PERIPH_SPIM_TX + * @arg @ref LL_DMA_PERIPH_SPIM_RX + * @arg @ref LL_DMA_PERIPH_SPIS_TX + * @arg @ref LL_DMA_PERIPH_SPIS_RX + * @arg @ref LL_DMA_PERIPH_QSPI0_TX + * @arg @ref LL_DMA_PERIPH_QSPI0_RX + * @arg @ref LL_DMA_PERIPH_I2C0_TX + * @arg @ref LL_DMA_PERIPH_I2C0_RX + * @arg @ref LL_DMA_PERIPH_I2C1_TX + * @arg @ref LL_DMA_PERIPH_I2C1_RX + * @arg @ref LL_DMA_PERIPH_I2S_S_TX + * @arg @ref LL_DMA_PERIPH_I2S_S_RX + * @arg @ref LL_DMA_PERIPH_UART0_TX + * @arg @ref LL_DMA_PERIPH_UART0_RX + * @arg @ref LL_DMA_PERIPH_QSPI1_TX + * @arg @ref LL_DMA_PERIPH_QSPI1_RX + * @arg @ref LL_DMA_PERIPH_I2S_M_TX + * @arg @ref LL_DMA_PERIPH_I2S_M_RX + * @arg @ref LL_DMA_PERIPH_SNSADC + */ +__STATIC_INLINE uint32_t ll_dma_get_source_peripheral(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_HI, DMA_CFGH_SRC_PER) >> DMA_CFGH_SRC_PER_Pos; +} + +/** + * @brief Set destination peripheral for DMA instance on Channel x. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_HI | DST_PER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param peripheral This parameter can be one of the following values: + * @arg @ref LL_DMA_PERIPH_SPIM_TX + * @arg @ref LL_DMA_PERIPH_SPIM_RX + * @arg @ref LL_DMA_PERIPH_SPIS_TX + * @arg @ref LL_DMA_PERIPH_SPIS_RX + * @arg @ref LL_DMA_PERIPH_QSPI0_TX + * @arg @ref LL_DMA_PERIPH_QSPI0_RX + * @arg @ref LL_DMA_PERIPH_I2C0_TX + * @arg @ref LL_DMA_PERIPH_I2C0_RX + * @arg @ref LL_DMA_PERIPH_I2C1_TX + * @arg @ref LL_DMA_PERIPH_I2C1_RX + * @arg @ref LL_DMA_PERIPH_I2S_S_TX + * @arg @ref LL_DMA_PERIPH_I2S_S_RX + * @arg @ref LL_DMA_PERIPH_UART0_TX + * @arg @ref LL_DMA_PERIPH_UART0_RX + * @arg @ref LL_DMA_PERIPH_QSPI1_TX + * @arg @ref LL_DMA_PERIPH_QSPI1_RX + * @arg @ref LL_DMA_PERIPH_I2S_M_TX + * @arg @ref LL_DMA_PERIPH_I2S_M_RX + * @arg @ref LL_DMA_PERIPH_SNSADC + * @retval None + */ +__STATIC_INLINE void ll_dma_set_destination_peripheral(dma_regs_t *DMAx, uint32_t channel, uint32_t peripheral) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_HI, DMA_CFGH_DST_PER, (peripheral << DMA_CFGH_DST_PER_Pos)); +} + +/** + * @brief Get destination peripheral for DMA instance on Channel x. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_HI | DST_PER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_DMA_PERIPH_SPIM_TX + * @arg @ref LL_DMA_PERIPH_SPIM_RX + * @arg @ref LL_DMA_PERIPH_SPIS_TX + * @arg @ref LL_DMA_PERIPH_SPIS_RX + * @arg @ref LL_DMA_PERIPH_QSPI0_TX + * @arg @ref LL_DMA_PERIPH_QSPI0_RX + * @arg @ref LL_DMA_PERIPH_I2C0_TX + * @arg @ref LL_DMA_PERIPH_I2C0_RX + * @arg @ref LL_DMA_PERIPH_I2C1_TX + * @arg @ref LL_DMA_PERIPH_I2C1_RX + * @arg @ref LL_DMA_PERIPH_I2S_S_TX + * @arg @ref LL_DMA_PERIPH_I2S_S_RX + * @arg @ref LL_DMA_PERIPH_UART0_TX + * @arg @ref LL_DMA_PERIPH_UART0_RX + * @arg @ref LL_DMA_PERIPH_QSPI1_TX + * @arg @ref LL_DMA_PERIPH_QSPI1_RX + * @arg @ref LL_DMA_PERIPH_I2S_M_TX + * @arg @ref LL_DMA_PERIPH_I2S_M_RX + * @arg @ref LL_DMA_PERIPH_SNSADC + */ +__STATIC_INLINE uint32_t ll_dma_get_destination_peripheral(dma_regs_t *DMAx, uint32_t channel) +{ + return READ_BITS(DMAx->CHANNEL[channel].CTL_HI, DMA_CFGH_DST_PER) >> DMA_CFGH_DST_PER_Pos; +} + +/** + * @brief Set source and destination source handshaking interface. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CFG_HI | DST_PER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param src_handshaking This parameter can be one of the following values: + * @arg @ref LL_DMA_SHANDSHAKING_HW + * @arg @ref LL_DMA_SHANDSHAKING_HW + * @param dst_handshaking This parameter can be one of the following values: + * @arg @ref LL_DMA_DHANDSHAKING_HW + * @arg @ref LL_DMA_DHANDSHAKING_HW + * @retval None + */ +__STATIC_INLINE void ll_dma_select_handshaking(dma_regs_t *DMAx, uint32_t channel, uint32_t src_handshaking, uint32_t dst_handshaking) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CFG_LO, DMA_CFGL_HS_SEL_SRC | DMA_CFGL_HS_SEL_DST, + src_handshaking | dst_handshaking); +} + +/** + * @brief Source Single Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SGL_REQ_SRC | REQ_SRC_WE&REQ_SRC | + * +----------------------+-----------------------------------+ + * \endrst + * REQ_SRC | SRC_WE&SRC + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_src_single_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.SGL_RQ_SRC, (1 << (channel + DMA_SGL_REQ_SRC_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_SRC, (1 << (channel + DMA_REQ_SRC_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Source Burst Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | REQ_SRC | SRC_WE&SRC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_src_burst_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.REQ_SRC, (1 << (channel + DMA_REQ_SRC_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Source Last Single Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SGL_REQ_SRC | REQ_SRC_WE&REQ_SRC | + * +----------------------+-----------------------------------+ + * \endrst + * LST_SRC | LST_SRC_WE&LST_SRC + * REQ_SRC | SRC_WE&SRC + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_src_last_single_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.SGL_RQ_SRC, (1 << (channel + DMA_SGL_REQ_SRC_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.LST_SRC, (1 << (channel + DMA_LST_SRC_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_SRC, (1 << (channel + DMA_REQ_SRC_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Source Last Burst Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LST_SRC | LST_SRC_WE&LST_SRC | + * +----------------------+-----------------------------------+ + * \endrst + * REQ_SRC | SRC_WE&SRC + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_src_last_burst_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.LST_SRC, (1 << (channel + DMA_LST_SRC_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_SRC, (1 << (channel + DMA_REQ_SRC_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Destination Single Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SGL_REQ_DST | REQ_DST_WE&REQ_DST | + * +----------------------+-----------------------------------+ + * \endrst + * REQ_DST | DST_WE&DST + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_dst_single_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.SGL_RQ_DST, (1 << (channel + DMA_SGL_REQ_DST_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_DST, (1 << (channel + DMA_REQ_DST_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Destination Burst Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | REQ_DST | DST_WE&DST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_dst_burst_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.REQ_DST, (1 << (channel + DMA_REQ_DST_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Destination Last Single Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SGL_REQ_DST | REQ_DST_WE&REQ_DST | + * +----------------------+-----------------------------------+ + * \endrst + * LST_DST | LST_DST_WE&LST_DST + * REQ_DST | DST_WE&DST + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_dst_last_single_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.SGL_RQ_DST, (1 << (channel + DMA_SGL_REQ_DST_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.LST_DST, (1 << (channel + DMA_LST_DST_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_DST, (1 << (channel + DMA_REQ_DST_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Destination Last Burst Transaction Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LST_DST | LST_DST_WE&LST_DST | + * +----------------------+-----------------------------------+ + * \endrst + * REQ_DST | DST_WE&DST + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_req_dst_last_burst_transaction(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->HANDSHAKE.LST_DST, (1 << (channel + DMA_LST_DST_WE_Pos)) + (1 << channel)); + WRITE_REG(DMAx->HANDSHAKE.REQ_DST, (1 << (channel + DMA_REQ_DST_WE_Pos)) + (1 << channel)); +} + +/** @} */ + +/** @defgroup DMA_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get DMA Module global transfer complete interrupt status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS_INT | TFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_gtfr(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_EVT, DMA_STAT_INT_TFR) == DMA_STAT_INT_TFR); +} + +/** + * @brief Get DMA Module global block complete interrupt status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS_INT | BLOCK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_gblk(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_EVT, DMA_STAT_INT_BLK) == DMA_STAT_INT_BLK); +} + +/** + * @brief Get DMA Module global source transaction complete interrupt status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS_INT | SRCT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_gsrct(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_EVT, DMA_STAT_INT_SRC) == DMA_STAT_INT_SRC); +} + +/** + * @brief Get DMA Module global destination transaction complete interrupt status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS_INT | DSTT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_gdstt(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_EVT, DMA_STAT_INT_DST) == DMA_STAT_INT_DST); +} + +/** + * @brief Get DMA Module global error interrupt status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS_INT | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_gerr(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_EVT, DMA_STAT_INT_ERR) == DMA_STAT_INT_ERR); +} + +/** + * @brief Indicate the Raw Status of IntTfr Interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_TFR | RAW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_rtfr(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.RAW_CH_EVT[0], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the Raw Status of IntBlock Interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_BLK | RAW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_rblk(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.RAW_CH_EVT[2], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the Raw Status of IntSrcTran Interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_SRC_TRN | RAW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_rsrct(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.RAW_CH_EVT[4], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the Raw Status of IntDstTran Interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_DST_TRN | RAW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_rdstt(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.RAW_CH_EVT[6], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the Raw Status of IntErr Interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_ERR | RAW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_rerr(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.RAW_CH_EVT[8], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of DMA Channel transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of Channel 0 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr0(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 0)) == (1 << 0)); +} + +/** + * @brief Indicate the status of Channel 1 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr1(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 1)) == (1 << 1)); +} + +/** + * @brief Indicate the status of Channel 2 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr2(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 2)) == (1 << 2)); +} + +/** + * @brief Indicate the status of Channel 3 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr3(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 3)) == (1 << 3)); +} + +/** + * @brief Indicate the status of Channel 4 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr4(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 4)) == (1 << 4)); +} + +/** + * @brief Indicate the status of Channel 5 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr5(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 5)) == (1 << 5)); +} + +/** + * @brief Indicate the status of Channel 6 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr6(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 6)) == (1 << 6)); +} + +/** + * @brief Indicate the status of Channel 7 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_TFR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_tfr7(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[0], (1 << 7)) == (1 << 7)); +} + +/** + * @brief Indicate the status of DMA Channel block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of Channel 0 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk0(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 0)) == (1 << 0)); +} + +/** + * @brief Indicate the status of Channel 1 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk1(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 1)) == (1 << 1)); +} + +/** + * @brief Indicate the status of Channel 2 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk2(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 2)) == (1 << 2)); +} + +/** + * @brief Indicate the status of Channel 3 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk3(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 3)) == (1 << 3)); +} + +/** + * @brief Indicate the status of Channel 4 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk4(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 4)) == (1 << 4)); +} + +/** + * @brief Indicate the status of Channel 5 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk5(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 5)) == (1 << 5)); +} + +/** + * @brief Indicate the status of Channel 6 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk6(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 6)) == (1 << 6)); +} + +/** + * @brief Indicate the status of Channel 7 block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_BLK | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_blk7(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[2], (1 << 7)) == (1 << 7)); +} + +/** + * @brief Indicate the status of DMA Channel source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of Channel 0 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct0(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 0)) == (1 << 0)); +} + +/** + * @brief Indicate the status of Channel 1 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct1(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 1)) == (1 << 1)); +} + +/** + * @brief Indicate the status of Channel 2 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct2(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 2)) == (1 << 2)); +} + +/** + * @brief Indicate the status of Channel 3 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct3(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 3)) == (1 << 3)); +} + +/** + * @brief Indicate the status of Channel 4 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct4(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 4)) == (1 << 4)); +} + +/** + * @brief Indicate the status of Channel 5 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct5(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 5)) == (1 << 5)); +} + +/** + * @brief Indicate the status of Channel 6 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct6(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 6)) == (1 << 6)); +} + +/** + * @brief Indicate the status of Channel 7 source transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_SRC_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_srct7(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[4], (1 << 7)) == (1 << 7)); +} + +/** + * @brief Indicate the status of DMA Channel destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of Channel 0 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt0(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 0)) == (1 << 0)); +} + +/** + * @brief Indicate the status of Channel 1 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt1(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 1)) == (1 << 1)); +} + +/** + * @brief Indicate the status of Channel 2 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt2(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 2)) == (1 << 2)); +} + +/** + * @brief Indicate the status of Channel 3 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt3(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 3)) == (1 << 3)); +} + +/** + * @brief Indicate the status of Channel 4 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt4(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 4)) == (1 << 4)); +} + +/** + * @brief Indicate the status of Channel 5 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt5(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 5)) == (1 << 5)); +} + +/** + * @brief Indicate the status of Channel 6 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt6(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 6)) == (1 << 6)); +} + +/** + * @brief Indicate the status of Channel 7 destination transaction complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_DST_TRN | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_dstt7(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[6], (1 << 7)) == (1 << 7)); +} + +/** + * @brief Indicate the status of DMA Channel error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Indicate the status of Channel 0 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err0(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 0)) == (1 << 0)); +} + +/** + * @brief Indicate the status of Channel 1 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err1(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 1)) == (1 << 1)); +} + +/** + * @brief Indicate the status of Channel 2 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err2(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 2)) == (1 << 2)); +} + +/** + * @brief Indicate the status of Channel 3 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err3(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 3)) == (1 << 3)); +} + +/** + * @brief Indicate the status of Channel 4 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err4(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 4)) == (1 << 4)); +} + +/** + * @brief Indicate the status of Channel 5 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err5(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 5)) == (1 << 5)); +} + +/** + * @brief Indicate the status of Channel 6 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err6(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 6)) == (1 << 6)); +} + +/** + * @brief Indicate the status of Channel 7 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT_ERR | STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_active_flag_err7(dma_regs_t *DMAx) +{ + return (READ_BITS(DMAx->EVENT.STATUS_CH_EVT[8], (1 << 7)) == (1 << 7)); +} + +/** + * @brief Clear DMA Channel transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << channel)); +} + +/** + * @brief Clear Channel 0 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr0(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 0)); +} + +/** + * @brief Clear Channel 1 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr1(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 1)); +} + +/** + * @brief Clear Channel 2 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr2(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 2)); +} + +/** + * @brief Clear Channel 3 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr3(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 3)); +} + +/** + * @brief Clear Channel 4 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr4(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 4)); +} + +/** + * @brief Clear Channel 5 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr5(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 5)); +} + +/** + * @brief Clear Channel 6 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr6(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 6)); +} + +/** + * @brief Clear Channel 7 transfer complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_TFR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_tfr7(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[0], (1 << 7)); +} + +/** + * @brief Clear DMA Channel block complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << channel)); +} + +/** + * @brief Clear Channel 0 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk0(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 0)); +} + +/** + * @brief Clear Channel 1 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk1(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 1)); +} + +/** + * @brief Clear Channel 2 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk2(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 2)); +} + +/** + * @brief Clear Channel 3 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk3(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 3)); +} + +/** + * @brief Clear Channel 4 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk4(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 4)); +} + +/** + * @brief Clear Channel 5 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk5(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 5)); +} + +/** + * @brief Clear Channel 6 Block Cmplete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk6(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 6)); +} + +/** + * @brief Clear Channel 7 Block Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_BLK | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_blk7(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[2], (1 << 7)); +} + +/** + * @brief Clear DMA Channel source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << channel)); +} + +/** + * @brief Clear Channel 0 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct0(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 0)); +} + +/** + * @brief Clear Channel 1 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct1(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 1)); +} + +/** + * @brief Clear Channel 2 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct2(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 2)); +} + +/** + * @brief Clear Channel 3 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct3(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 3)); +} + +/** + * @brief Clear Channel 4 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct4(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 4)); +} + +/** + * @brief Clear Channel 5 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct5(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 5)); +} + +/** + * @brief Clear Channel 6 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct6(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 6)); +} + +/** + * @brief Clear Channel 7 source transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_SRC_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_srct7(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[4], (1 << 7)); +} + +/** + * @brief Clear DMA Channel destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << channel)); +} + +/** + * @brief Clear Channel 0 destination transaction Complete status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt0(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 0)); +} + +/** + * @brief Clear Channel 1 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt1(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 1)); +} + +/** + * @brief Clear Channel 2 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt2(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 2)); +} + +/** + * @brief Clear Channel 3 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt3(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 3)); +} + +/** + * @brief Clear Channel 4 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt4(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 4)); +} + +/** + * @brief Clear Channel 5 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt5(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 5)); +} + +/** + * @brief Clear Channel 6 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt6(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 6)); +} + +/** + * @brief Clear Channel 7 destination transaction Complete flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_DST_TRN | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_dstt7(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[6], (1 << 7)); +} + +/** + * @brief Clear DMA Channel error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << channel)); +} + +/** + * @brief Clear Channel 0 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err0(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 0)); +} + +/** + * @brief Clear Channel 1 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err1(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 1)); +} + +/** + * @brief Clear Channel 2 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err2(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 2)); +} + +/** + * @brief Clear Channel 3 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err3(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 3)); +} + +/** + * @brief Clear Channel 4 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err4(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 4)); +} + +/** + * @brief Clear Channel 5 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err5(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 5)); +} + +/** + * @brief Clear Channel 6 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err6(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 6)); +} + +/** + * @brief Clear Channel 7 error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLR_ERR | CLEAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @retval None. + */ +__STATIC_INLINE void ll_dma_clear_flag_err7(dma_regs_t *DMAx) +{ + WRITE_REG(DMAx->EVENT.CLEAR_CH_EVT[8], (1 << 7)); +} + +/** @} */ + +/** @defgroup DMA_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable Transfer Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_TFR | TFR_WE&TFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it_tfr(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[0], (1 << (channel + DMA_MASK_TFR_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Enable Block Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_BLK | BLK_WE&BLK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it_blk(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[2], (1 << (channel + DMA_MASK_BLK_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Enable source transaction Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_SRC_TRN | SRC_TRN_WE&SRC_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it_srct(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[4], (1 << (channel + DMA_MASK_SRC_TRN_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Enable destination transaction Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_DST_TRN | DST_TRN_WE&DST_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it_dstt(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[6], (1 << (channel + DMA_MASK_DST_TRN_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Enable error interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_ERR | ERR_WE&ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it_err(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[8], (1 << (channel + DMA_MASK_ERR_WE_Pos)) + (1 << channel)); +} + +/** + * @brief Disable Transfer Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_TFR | TFR_WE&TFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it_tfr(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[0], (1 << (channel + DMA_MASK_TFR_WE_Pos))); +} + +/** + * @brief Disable Block Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_BLK | BLK_WE&BLK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it_blk(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[2], (1 << (channel + DMA_MASK_BLK_WE_Pos))); +} + +/** + * @brief Disable source transaction Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_SRC_TRN | SRC_TRN_WE&SRC_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it_srct(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[4], (1 << (channel + DMA_MASK_SRC_TRN_WE_Pos))); +} + +/** + * @brief Disable destination transaction Complete interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_DST_TRN | DST_TRN_WE&DST_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it_dstt(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[6], (1 << (channel + DMA_MASK_DST_TRN_WE_Pos))); +} + +/** + * @brief Disable error interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_ERR | ERR_WE&ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it_err(dma_regs_t *DMAx, uint32_t channel) +{ + WRITE_REG(DMAx->EVENT.MASK_CH_EVT[8], (1 << (channel + DMA_MASK_ERR_WE_Pos))); +} + +/** + * @brief Check if DMA Transfer interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_TFR | TFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable_it_tfr(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.MASK_CH_EVT[0], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Check if DMA block interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_BLK | BLK_WE&BLK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable_it_blk(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.MASK_CH_EVT[2], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Check if DMA source transaction interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_SRC_TRN | SRC_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable_it_srct(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.MASK_CH_EVT[4], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Check if DMA destination transaction interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_DST_TRN | DST_TRN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable_it_dstt(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.MASK_CH_EVT[6], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Check if DMA error interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MASK_ERR | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dma_is_enable_it_err(dma_regs_t *DMAx, uint32_t channel) +{ + return (READ_BITS(DMAx->EVENT.MASK_CH_EVT[8], (1 << channel)) == (1 << channel)); +} + +/** + * @brief Enable DMA channel interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTLL | INI_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_enable_it(dma_regs_t *DMAx, uint32_t channel) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_INI_EN, DMA_CTLL_INI_EN); +} + +/** + * @brief Disable DMA channel interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTLL | INI_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DMAx DMA instance. + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval None + */ +__STATIC_INLINE void ll_dma_disable_it(dma_regs_t *DMAx, uint32_t channel) +{ + MODIFY_REG(DMAx->CHANNEL[channel].CTL_LO, DMA_CTLL_INI_EN, 0); +} + +/** @} */ + +/** @defgroup DMA_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize the DMA registers to their default reset values. + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @retval An error_status_t enumeration value: + * - SUCCESS: DMA registers are de-initialized + * - ERROR: DMA registers are not de-initialized + */ +error_status_t ll_dma_deinit(dma_regs_t *DMAx, uint32_t channel); + +/** + * @brief Initialize the DMA registers according to the specified parameters in p_dma_init. + * @param DMAx DMAx instance + * @param channel This parameter can be one of the following values: + * @arg @ref LL_DMA_CHANNEL_0 + * @arg @ref LL_DMA_CHANNEL_1 + * @arg @ref LL_DMA_CHANNEL_2 + * @arg @ref LL_DMA_CHANNEL_3 + * @arg @ref LL_DMA_CHANNEL_4 + * @arg @ref LL_DMA_CHANNEL_5 + * @arg @ref LL_DMA_CHANNEL_6 + * @arg @ref LL_DMA_CHANNEL_7 + * @param p_dma_init pointer to a @ref ll_dma_init_t structure. + * @retval An error_status_t enumeration value: + * - SUCCESS: DMA registers are initialized + * - ERROR: Not applicable + */ +error_status_t ll_dma_init(dma_regs_t *DMAx, uint32_t channel, ll_dma_init_t *p_dma_init); + +/** + * @brief Set each field of a @ref ll_dma_init_t type structure to default value. + * @param p_dma_init Pointer to a @ref ll_dma_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_dma_struct_init(ll_dma_init_t *p_dma_init); + +/** @} */ + +/** @} */ + +#endif /* DMA */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_DMA_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dual_tim.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dual_tim.h new file mode 100644 index 0000000..5208113 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_dual_tim.h @@ -0,0 +1,719 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_dual_tim.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of DUAL TIMER LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_DUAL_TIMER DUAL_TIMER + * @brief DUAL TIM LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_DUAL_TIMER_H__ +#define __GR55XX_LL_DUAL_TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (DUAL_TIMER0) || defined (DUAL_TIMER1) + +/** @defgroup DUAL_TIMER_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_LL_ES_INIT DUAL_TIM Exported init structures + * @{ + */ + +/** + * @brief LL DUAL TIMER init Structure definition + */ +typedef struct _ll_dual_timer_init +{ + uint32_t prescaler; /**< Specifies the prescaler value used to divide the TIMER clock. + This parameter can be a value of @ref DUAL_TIMER_EC_LL_PRESCALER. + + This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_prescaler().*/ + + uint32_t counter_size; /**< Specifies the prescaler value used to divide the DUAL_TIMER clock. + This parameter can be a value of @ref DUAL_TIMER_EC_LL_COUNTERSIZE. + + This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_counter_size().*/ + + uint32_t counter_mode; /**< Specifies the counter mode. + This parameter can be a value of @ref DUAL_TIMER_LL_EC_COUNTERMODE. + + This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_counter_mode().*/ + + uint32_t auto_reload; /**< Specifies the auto reload value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter must be a number between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF. + Some timer instances may support 16 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFF. + + This feature can be modified afterwards using unitary function @ref ll_dual_timer_set_auto_reload().*/ +} ll_dual_timer_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup DUAL_TIMER_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_LL_Exported_Constants DUAL_TIM Exported Constants + * @{ + */ + +/** @defgroup DUAL_TIMER_LL_EC_COUNTERMODE DUAL_TIM counter mode + * @{ + */ +#define LL_DUAL_TIMER_FREERUNNING_MODE 0x00000000U /**< Free running mode */ +#define LL_DUAL_TIMER_PERIODIC_MODE DUAL_TIMER_CTRL_MODE /**< Periodic mode */ +/** @} */ + +/** @defgroup DUAL_TIMER_EC_LL_PRESCALER DUAL_TIM prescaler + * @{ + */ +#define LL_DUAL_TIMER_PRESCALER_DIV0 0x00000000U /**< 0 stage of prescale, clock is divided by 1. */ +#define LL_DUAL_TIMER_PRESCALER_DIV16 (1UL << DUAL_TIMER_CTRL_PRE_Pos) /**< 4 stages of prescale, clock is divided by 16. */ +#define LL_DUAL_TIMER_PRESCALER_DIV256 (2UL << DUAL_TIMER_CTRL_PRE_Pos) /**< 8 stages of prescale, clock is divided by 256. */ +/** @} */ + +/** @defgroup DUAL_TIMER_EC_LL_COUNTERSIZE DUAL_TIM counter size + * @{ + */ +#define LL_DUAL_TIMER_COUNTERSIZE_16 0x00000000U /**< Counter size 16 bits */ +#define LL_DUAL_TIMER_COUNTERSIZE_32 DUAL_TIMER_CTRL_SIZE /**< Counter size 32 bits */ +/** @} */ + +/** @defgroup DUAL_TIMER_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL DUAL_TIMER InitStrcut default configuartion + */ +#define DUAL_TIMER_DEFAULT_CONFIG \ +{ \ + .prescaler = LL_DUAL_TIMER_PRESCALER_DIV0, \ + .counter_size = LL_DUAL_TIMER_COUNTERSIZE_32, \ + .counter_mode = LL_DUAL_TIMER_PERIODIC_MODE, \ + .auto_reload = SystemCoreClock - 1, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_LL_Exported_Macros DUAL_TIM Exported Macros + * @{ + */ + +/** @defgroup DUAL_TIMER_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in DUAL_TIMER register + * @param __instance__ DUAL_TIMER instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_DUAL_TIMER_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in DUAL_TIMER register + * @param __instance__ DUAL_TIMER instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_DUAL_TIMER_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup DUAL_TIMER_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup DUAL_TIMER_LL_EF_Configuration Configuration functions + * @{ + */ + + +/** + * @brief Enable dual_timer counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_enable_counter(dual_timer_regs_t *DUAL_TIMERx) +{ + SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN); +} + +/** + * @brief Disable dual_timer counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_disable_counter(dual_timer_regs_t *DUAL_TIMERx) +{ + CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN); +} + +/** + * @brief Indicate whether the dual_timer counter is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_counter(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_EN) == (DUAL_TIMER_CTRL_EN)); +} + +/** + * @brief Set the counter mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @param counter_mode This parameter can be one of the following values: + * @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE + * @arg @ref LL_DUAL_TIMER_PERIODIC_MODE + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_set_counter_mode(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_mode) +{ + MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE, counter_mode); +} + +/** + * @brief Get the counter mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Return value can be one of the following values: + * @arg @ref LL_DUAL_TIMER_FREERUNNING_MODE + * @arg @ref LL_DUAL_TIMER_PERIODIC_MODE + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_counter_mode(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_MODE)); +} + +/** + * @brief Set the prescaler. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | PRE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @param prescaler This parameter can be one of the following values: + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0 + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16 + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256 + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_set_prescaler(dual_timer_regs_t *DUAL_TIMERx, uint32_t prescaler) +{ + MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE, prescaler); +} + +/** + * @brief Get the prescaler. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | PRE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Return value can be one of the following values: + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV0 + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV16 + * @arg @ref LL_DUAL_TIMER_PRESCALER_DIV256 + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_prescaler(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_PRE)); +} + +/** + * @brief Set the counter size. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @param counter_size This parameter can be one of the following values: + * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16 + * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32 + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_set_counter_size(dual_timer_regs_t *DUAL_TIMERx, uint32_t counter_size) +{ + MODIFY_REG(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE, counter_size); +} + +/** + * @brief Get the counter size. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Return value can be one of the following values: + * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_16 + * @arg @ref LL_DUAL_TIMER_COUNTERSIZE_32 + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_counter_size(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_SIZE)); +} + +/** + * @brief Enable one-shot mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ONESHOT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_enable_oneshot(dual_timer_regs_t *DUAL_TIMERx) +{ + SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT); +} + +/** + * @brief Disable one-shot mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ONESHOT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_disable_oneshot(dual_timer_regs_t *DUAL_TIMERx) +{ + CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT); +} + +/** + * @brief Indicate whether the one-shot mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ONESHOT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_oneshot(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_ONESHOT) == (DUAL_TIMER_CTRL_ONESHOT)); +} + +/** + * @brief Get the counter value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | VALUE | VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFFFFFF) + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_counter(dual_timer_regs_t *DUAL_TIMERx) +{ + return (uint32_t)(READ_REG(DUAL_TIMERx->VALUE)); +} + +/** + * @brief Set the auto-reload value. + * @note The counter is blocked while the auto-reload value is null. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RELOAD | RELOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @param auto_reload between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_set_auto_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t auto_reload) +{ + WRITE_REG(DUAL_TIMERx->RELOAD, auto_reload); +} + +/** + * @brief Get the auto-reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RELOAD | RELOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Auto-reload value + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_auto_reload(dual_timer_regs_t *DUAL_TIMERx) +{ + return (uint32_t)(READ_REG(DUAL_TIMERx->RELOAD)); +} + +/** + * @brief Set the backgroud-reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BG_LOAD | BG_LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @param background_reload between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_set_background_reload(dual_timer_regs_t *DUAL_TIMERx, uint32_t background_reload) +{ + WRITE_REG(DUAL_TIMERx->BG_LOAD, background_reload); +} + +/** + * @brief Get the backgroud-reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BG_LOAD | BG_LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval Return value between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_background_reload(dual_timer_regs_t *DUAL_TIMERx) +{ + return (uint32_t)(READ_REG(DUAL_TIMERx->BG_LOAD)); +} + +/** @} */ + +/** @defgroup DUAL_TIM_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable dual_timer interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_enable_it(dual_timer_regs_t *DUAL_TIMERx) +{ + SET_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN); +} + +/** + * @brief Disable dual_timer interrput. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_disable_it(dual_timer_regs_t *DUAL_TIMERx) +{ + CLEAR_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN); +} + +/** + * @brief Indicate whether the dual_timer interrput is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dual_timer_is_enabled_it(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->CTRL, DUAL_TIMER_CTRL_INTEN) == (DUAL_TIMER_CTRL_INTEN)); +} + +/** @} */ + +/** @defgroup DUAL_TIMER_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Clear the interrupt flag (INTSTAT). + * + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INTCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_dual_timer_clear_flag_it(dual_timer_regs_t *DUAL_TIMERx) +{ + WRITE_REG(DUAL_TIMERx->INTCLR, DUAL_TIMER_INT_CLR); +} + +/** + * @brief Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dual_timer_is_active_flag_it(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_BITS(DUAL_TIMERx->INTSTAT, DUAL_TIMER_ISR_TI) == (DUAL_TIMER_ISR_TI)); +} + +/** + * @brief Get Dual_timer raw interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_INTSTAT | RAW_INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param DUAL_TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_dual_timer_get_raw_it_flag(dual_timer_regs_t *DUAL_TIMERx) +{ + return (READ_REG(DUAL_TIMERx->RAW_INTSTAT)); +} + +/** @} */ + +/** @defgroup DUAL_TIMER_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize DUAL_TIMER registers (Registers restored to their default values). + * @param DUAL_TIMERx DUAL_TIM instance + * @retval An error_status_t enumeration value: + * - SUCCESS: DUAL_TIMER registers are de-initialized + * - ERROR: DUAL_TIMER registers are not de-initialized + */ +error_status_t ll_dual_timer_deinit(dual_timer_regs_t *DUAL_TIMERx); + +/** + * @brief Initialize DUAL_TIMER registers according to the specified + * parameters in p_dual_timer_init. + * @param DUAL_TIMERx DUAL_TIMER instance + * @param p_dual_timer_init Pointer to a ll_dual_timer_init_t structure that contains the configuration + * information for the specified DUAL_TIMER peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: DUAL_TIMER registers are initialized according to p_dual_timer_init content + * - ERROR: Problem occurred during DUAL_TIM Registers initialization + */ +error_status_t ll_dual_timer_init(dual_timer_regs_t *DUAL_TIMERx, ll_dual_timer_init_t *p_dual_timer_init); + +/** + * @brief Set each field of a @ref ll_dual_timer_init_t type structure to default value. + * @param p_dual_timer_init Pointer to a @ref ll_dual_timer_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_dual_timer_struct_init(ll_dual_timer_init_t *p_dual_timer_init); + +/** @} */ + +/** @} */ + + +#endif /* DUAL_TIMER0 || DUAL_TIMER1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_DUAL_TIMER_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_efuse.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_efuse.h new file mode 100644 index 0000000..d998b90 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_efuse.h @@ -0,0 +1,802 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_efuse.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of eFuse LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_EFUSE EFUSE + * @brief eFuse LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_EFUSE_H__ +#define __GR55xx_LL_EFUSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (EFUSE) + +/** + * @defgroup EFUSE_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup EFUSE_LL_Exported_Constants EFUSE Exported Constants + * @{ + */ + +/** @defgroup EFUSE_LL_EC_OPERATION EFUSE Operation Defines + * @brief Operation defines which can be used with LL_EFUSE_WriteReg function + * @{ + */ +#define LL_EFUSE_WRITE_KEYRAM EFUSE_OPER_WRITE_KEYRAM /**< Read fwkay and rootkey from eFuse, and write to keyram */ +#define LL_EFUSE_READ_TRIM EFUSE_OPER_READ_TRIM /**< Read analog trim from eFuse */ +#define LL_EFUSE_CRC_CHECK EFUSE_OPER_CRC_CHECK /**< Read the special eFuse addr, and calculate CRC value */ +#define LL_EFUSE_INIT_CHECK EFUSE_OPER_INIT_CHECK /**< Read the whole eFuse value, and check this value with 0 */ +#define LL_EFUSE_TEST_READ EFUSE_OPER_RD_TEST_MODE /**< Read eFuse test mode from eFuse */ +/** @} */ + +/** @defgroup EFUSE_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_EFUSE_ReadReg function + * @{ + */ +#define LL_EFUSE_WRITE_KEYRAM_BUSY EFUSE_STATUS_WRITE_KEYRAM_BUSY /**< Write keyram operation is in processing */ +#define LL_EFUSE_READ_TRIM_DONE EFUSE_STATUS_READ_TRIM_DONE /**< Read trim from eFuse has done */ +#define LL_EFUSE_CRC_CHECK_DONE EFUSE_STATUS_CRC_CHECK_DONE /**< eFuse CRC check done */ +#define LL_EFUSE_CRC_CHECK_SUCCESS EFUSE_STATUS_TRIM_CRC_SUCCESS /**< CRC check success */ +#define LL_EFUSE_INIT_CHECK_DONE EFUSE_STATUS_INIT_DONE /**< eFuse initial value check done */ +#define LL_EFUSE_INIT_CHECK_SUCCESS EFUSE_STATUS_INIT_SUCCESS /**< eFuse initial value check success */ +#define LL_EFUSE_WRITE_DONE EFUSE_STATUS_WRITE_DONE /**< eFuse one word write done */ +#define LL_EFUSE_TEST_DONE EFUSE_STATUS_TEST_MODE_DONE /**< Read from eFuse has done in test mode */ +/** @} */ + +/** @defgroup EFUSE_LL_EC_GET_CTL_FLAG Get Power Controller Flags Defines + * @brief Flags defines which can be used with LL_EFUSE_ReadReg function + * @{ + */ +#define LL_EFUSE_PWR_CTL_EN_DONE MCU_SUB_EFUSE_PWR_CTL0_EN_DONE /**< eFuse power enable done */ +#define LL_EFUSE_PWR_CTL_DIS_DONE MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE /**< eFuse power disable done */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup EFUSE_LL_Exported_Macros EFUSE Exported Macros + * @{ + */ + +/** @defgroup EFUSE_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in eFuse register + * @param __instance__ eFuse instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_EFUSE_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in eFuse register + * @param __instance__ eFuse instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_EFUSE_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup EFUSE_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup EFUSE_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Set eFuse program time + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param time This parameter can be one of the following values: 0 ~ 0xFFF + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_tpro(efuse_regs_t *EFUSEx, uint32_t time) +{ + MODIFY_REG(EFUSEx->TPGM, EFUSE_TPGM_TIME, time << EFUSE_TPGM_TIME_Pos); +} + +/** + * @brief Get eFuse program time + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0 ~ 0xFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_tpro(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_BITS(EFUSEx->TPGM, EFUSE_TPGM_TIME) >> EFUSE_TPGM_TIME_Pos); +} + +/** + * @brief Enable read address through APB bus be a main address or backup address + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | MAIN_OR_BACKUP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval None + */ +__STATIC_INLINE void ll_efuse_enable_main_backup(efuse_regs_t *EFUSEx) +{ + SET_BITS(EFUSEx->TPGM, EFUSE_TPGM_MAIN_OR_BACKUP); +} + +/** + * @brief Disable read address through APB bus be a main address or backup address + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | MAIN_OR_BACKUP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval None + */ +__STATIC_INLINE void ll_efuse_disable_main_backup(efuse_regs_t *EFUSEx) +{ + CLEAR_BITS(EFUSEx->TPGM, EFUSE_TPGM_MAIN_OR_BACKUP); +} + +/** + * @brief Check if read address through APB bus be a main address or backup address is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | MAIN_OR_BACKUP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_efuse_is_enabled_main_backup(efuse_regs_t *EFUSEx) +{ + return (READ_BITS(EFUSEx->TPGM, EFUSE_TPGM_MAIN_OR_BACKUP) == (EFUSE_TPGM_MAIN_OR_BACKUP)); +} + +/** + * @brief Set CRC check length + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | CRC_CHECK_LEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param length This parameter can be one of the following values: 1 ~ 60 + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_crc_check_len(efuse_regs_t *EFUSEx, uint32_t length) +{ + MODIFY_REG(EFUSEx->TPGM, EFUSE_TPGM_CRC_CHECK_LEN, length << EFUSE_TPGM_CRC_CHECK_LEN_Pos); +} + +/** + * @brief Get CRC check length + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | CRC_CHECK_LEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 1 ~ 60 + */ +__STATIC_INLINE uint32_t ll_efuse_get_crc_check_len(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_BITS(EFUSEx->TPGM, EFUSE_TPGM_CRC_CHECK_LEN) >> EFUSE_TPGM_CRC_CHECK_LEN_Pos); +} + +/** + * @brief Set the interval number of clk cycles between two bit fuse + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | WRITE_INTERVAL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param interval This parameter can be one of the following values: 0 ~ 0xFF + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_interval(efuse_regs_t *EFUSEx, uint32_t interval) +{ + MODIFY_REG(EFUSEx->TPGM, EFUSE_TPGM_WRITE_INTERVAL, interval << EFUSE_TPGM_WRITE_INTERVAL_Pos); +} + +/** + * @brief Get the interval number of clk cycles between two bit fuse + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | WRITE_INTERVAL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0 ~ 0xFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_interval(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_BITS(EFUSEx->TPGM, EFUSE_TPGM_WRITE_INTERVAL) >> EFUSE_TPGM_WRITE_INTERVAL_Pos); +} + +/** + * @brief Enable eFuse PGENB sigal + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PGENB | PGENB_SIG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval None + */ +__STATIC_INLINE void ll_efuse_enable_pgenb(efuse_regs_t *EFUSEx) +{ + SET_BITS(EFUSEx->PGENB, EFUSE_PGENB_SIG); +} + +/** + * @brief Disable eFuse PGENB sigal + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PGENB | PGENB_SIG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval None + */ +__STATIC_INLINE void ll_efuse_disable_pgenb(efuse_regs_t *EFUSEx) +{ + CLEAR_BITS(EFUSEx->PGENB, EFUSE_PGENB_SIG); +} + +/** + * @brief Check if eFuse PGENB sigal is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PGENB | PGENB_SIG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_efuse_is_enabled_pgenb(efuse_regs_t *EFUSEx) +{ + return (READ_BITS(EFUSEx->PGENB, EFUSE_PGENB_SIG) == (EFUSE_PGENB_SIG)); +} + +/** + * @brief Get test mode + * @note This bit should be read only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TEST_MODE | TEST_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0xFFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_test_mode(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_BITS(EFUSEx->TEST_MODE, EFUSE_TEST_MODE)); +} + +/** + * @brief Set eFuse operation mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | OPERATION | WRITE_KEYRAM | + * +----------------------+-----------------------------------+ + * \endrst + * OPERATION | INIT_CHECK + * OPERATION | CRC_CHECK + * OPERATION | READ_TRIM + * OPERATION | RD_TEST_MODE + * + * @param EFUSEx eFuse instance + * @param mode This parameter can be one of the following values: + * @arg @ref LL_EFUSE_WRITE_KEYRAM + * @arg @ref LL_EFUSE_READ_TRIM + * @arg @ref LL_EFUSE_CRC_CHECK + * @arg @ref LL_EFUSE_INIT_CHECK + * @arg @ref LL_EFUSE_TEST_READ + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_operation(efuse_regs_t *EFUSEx, uint32_t mode) +{ + WRITE_REG(EFUSEx->OPERATION, mode); +} + +/** + * @brief Check active flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | WRITE_KEYRAM_BUSY | + * +----------------------+-----------------------------------+ + * \endrst + * STAT | READ_TRIM_DONE + * STAT | TRIM_CRC_SUCCESS + * STAT | INIT_DONE + * STAT | INIT_SUCCESS + * STAT | CRC_CHECK_DONE + * STAT | WRITE_DONE + * STAT | TEST_MODE_DONE + * + * @param EFUSEx eFuse instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_EFUSE_WRITE_KEYRAM_BUSY + * @arg @ref LL_EFUSE_READ_TRIM_DONE + * @arg @ref LL_EFUSE_CRC_CHECK_DONE + * @arg @ref LL_EFUSE_CRC_CHECK_SUCCESS + * @arg @ref LL_EFUSE_INIT_CHECK_DONE + * @arg @ref LL_EFUSE_INIT_CHECK_SUCCESS + * @arg @ref LL_EFUSE_WRITE_DONE + * @arg @ref LL_EFUSE_TEST_DONE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_efuse_is_active_flag(efuse_regs_t *EFUSEx, uint32_t flag) +{ + return (READ_BITS(EFUSEx->STAT, flag) == (flag)); +} + +/** + * @brief Set key mask + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY_MASK | KEY_MASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param mask Key mask + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_key_mask(efuse_regs_t *EFUSEx, uint32_t mask) +{ + WRITE_REG(EFUSEx->KEY_MASK, mask); +} + +/** + * @brief Get key mask + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY_MASK | KEY_MASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval None + */ +__STATIC_INLINE uint32_t ll_efuse_get_key_mask(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_REG(EFUSEx->KEY_MASK)); +} + +/** + * @brief Set CRC check start address + * @note The address must be a main info address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CRC_ADDR | START_CHECK_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param address This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_crc_check_addr(efuse_regs_t *EFUSEx, uint32_t address) +{ + WRITE_REG(EFUSEx->CRC_ADDR, address); +} + +/** + * @brief Get CRC check start address + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CRC_ADDR | START_CHECK_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_crc_check_addr(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_REG(EFUSEx->CRC_ADDR)); +} + +/** + * @brief Get CRC check results + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CRC_OUTPUT | OUTPUT_VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_crc_check_result(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_REG(EFUSEx->CRC_OUTPUT)); +} + +/** + * @brief Set read trim start address + * @note The address must be a main info address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRIM_ADDR | START_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param address This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_trim_addr(efuse_regs_t *EFUSEx, uint32_t address) +{ + WRITE_REG(EFUSEx->TRIM_ADDR, address); +} + +/** + * @brief Get read trim start address + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRIM_ADDR | START_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_trim_addr(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_REG(EFUSEx->TRIM_ADDR)); +} + +/** + * @brief Set read trim length + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRIM_LEN | LENGTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param length This parameter can be one of the following values: 1 ~ 14 + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_trim_length(efuse_regs_t *EFUSEx, uint32_t length) +{ + WRITE_REG(EFUSEx->TRIM_LEN, length & EFUSE_TRIM_LENGTH); +} + +/** + * @brief Get read trim length + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRIM_LEN | LENGTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @retval Returned value can be one of the following values: 1 ~ 14 + */ +__STATIC_INLINE uint32_t ll_efuse_get_trim_length(efuse_regs_t *EFUSEx) +{ + return (uint32_t)(READ_REG(EFUSEx->TRIM_LEN) & EFUSE_TRIM_LENGTH); +} + +/** + * @brief Get trim value + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRIM[n] | TRIM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param EFUSEx eFuse instance + * @param indx index of trim value registers: 0 ~ 13 + * @retval Returned value can be one of the following values: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_efuse_get_trim_value(efuse_regs_t *EFUSEx, uint32_t indx) +{ + return (uint32_t)(READ_REG(EFUSEx->TRIM[indx])); +} + +/** + * @brief eFuse v1.1 power on. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | CRC_CHECK_LEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_enable_power(efuse_regs_t *EFUSEx) +{ + SET_BITS(AON->RF_REG_2, AON_RF_REG_2_EFUSE_VDD_EN); +} + +/** + * @brief eFuse v1.1 power off. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TPGM | CRC_CHECK_LEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_disable_power(efuse_regs_t *EFUSEx) +{ + CLEAR_BITS(AON->RF_REG_2, AON_RF_REG_2_EFUSE_VDD_EN); +} + +/** + * @brief Set Efulse power controller timing pararmeter. + * + * Register |BitsName + * ----------|-------- + * PWR_DELTA| PWR_DELTA_0 + * PWR_DELTA| PWR_DELTA_1 + * PWR_DELTA| PWR_DELTA_2 + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_set_controller_power_timing(efuse_regs_t *EFUSEx, uint16_t vddq_0, uint16_t vddq_1, uint16_t vddq_2) +{ + WRITE_REG(MCU_SUB->EFUSE_PWR_DELTA[0], vddq_0 + (vddq_1 << 16)); + WRITE_REG(MCU_SUB->EFUSE_PWR_DELTA[1], vddq_2); +} + +/** + * @brief Power sequencer begin. + * + * Register |BitsName + * -----------|-------- + * PWR_CTRL0 | CTRL_ENABLE + * PWR_CTRL0 | SEQR_BEGIN + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_enable_controller_power_begin(efuse_regs_t *EFUSEx) +{ + WRITE_REG(MCU_SUB->EFUSE_PWR_CTRL[0], MCU_SUB_EFUSE_PWR_CTL0_BGN | MCU_SUB_EFUSE_PWR_CTL0_EN); +} + +/** + * @brief Power sequencer begin. + * + * Register |BitsName + * -----------|-------- + * PWR_CTRL0 | CTRL_ENABLE + * PWR_CTRL0 | SEQR_STOP + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_enable_controller_power_stop(efuse_regs_t *EFUSEx) +{ + WRITE_REG(MCU_SUB->EFUSE_PWR_CTRL[0], MCU_SUB_EFUSE_PWR_CTL0_STP | MCU_SUB_EFUSE_PWR_CTL0_EN); +} + +/** + * @brief Power sequencer begin. + * + * Register |BitsName + * --------- -|-------- + * PWR_CTRL0 | CTRL_ENABLE + * PWR_CTRL0 | SEQR_BEGIN + * PWR_CTRL0 | SEQR_STOP + * + * @retval None + */ +__STATIC_INLINE void ll_efuse_disable_controller_power(efuse_regs_t *EFUSEx) +{ + WRITE_REG(MCU_SUB->EFUSE_PWR_CTRL[0], 0); +} + +/** + * @brief Check power controller active flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_CTRL1 | EN_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * PWR_CTRL1 | DIS_DONE + * + * @param EFUSEx eFuse instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_EFUSE_PWR_CTL_EN_DONE + * @arg @ref LL_EFUSE_PWR_CTL_DIS_DONE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_efuse_is_controller_power_flag(efuse_regs_t *EFUSEx, uint32_t flag) +{ + return (READ_BITS(MCU_SUB->EFUSE_PWR_CTRL[1], flag) == (flag)); +} + + + +/** @} */ + +/** @} */ + +#endif /* EFUSE */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_EFUSE_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_gpio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_gpio.h new file mode 100644 index 0000000..204161d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_gpio.h @@ -0,0 +1,1507 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_gpio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of GPIO LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_GPIO GPIO + * @brief GPIO LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_GPIO_H__ +#define __GR55XX_LL_GPIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (GPIO0) || defined (GPIO1) + +/** @defgroup GPIO_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup GPIO_LL_ES_INIT GPIO Exported init structures + * @{ + */ + +/** + * @brief LL GPIO init configuration definition + */ +typedef struct _ll_gpio_init +{ + uint32_t pin; /*!< Specifies the GPIO pins to be GPIO_InitStructured. + This parameter can be any value of @ref GPIO_LL_EC_PIN */ + + uint32_t mode; /*!< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_MODE. + + GPIO HW GPIO_InitStructuration can be modified afterwards using unitary function @ref ll_gpio_set_pin_mode(). */ + + uint32_t pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_PULL. + + GPIO HW configuration can be modified afterwards using unitary function @ref ll_gpio_set_pin_pull().*/ + + uint32_t mux; /*!< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref GPIO_LL_EC_MUX. + + GPIO HW GPIO_InitStructuration can be modified afterwards using unitary function + @ref ll_gpio_set_mux_pin_0_7() and ll_gpio_set_mux_pin_8_15(). */ + + uint32_t trigger; /*!< Specifies the trigger signal active edge. + This parameter can be a value of @ref GPIO_LL_EC_TRIGGER. */ + +} ll_gpio_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup GPIO_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants + * @{ + */ + +/** @defgroup GPIO_LL_EC_PIN PIN + * @{ + */ +#define LL_GPIO_PIN_0 ((uint32_t)0x0001U) /*!< Select pin 0 */ +#define LL_GPIO_PIN_1 ((uint32_t)0x0002U) /*!< Select pin 1 */ +#define LL_GPIO_PIN_2 ((uint32_t)0x0004U) /*!< Select pin 2 */ +#define LL_GPIO_PIN_3 ((uint32_t)0x0008U) /*!< Select pin 3 */ +#define LL_GPIO_PIN_4 ((uint32_t)0x0010U) /*!< Select pin 4 */ +#define LL_GPIO_PIN_5 ((uint32_t)0x0020U) /*!< Select pin 5 */ +#define LL_GPIO_PIN_6 ((uint32_t)0x0040U) /*!< Select pin 6 */ +#define LL_GPIO_PIN_7 ((uint32_t)0x0080U) /*!< Select pin 7 */ +#define LL_GPIO_PIN_8 ((uint32_t)0x0100U) /*!< Select pin 8 */ +#define LL_GPIO_PIN_9 ((uint32_t)0x0200U) /*!< Select pin 9 */ +#define LL_GPIO_PIN_10 ((uint32_t)0x0400U) /*!< Select pin 10 */ +#define LL_GPIO_PIN_11 ((uint32_t)0x0800U) /*!< Select pin 11 */ +#define LL_GPIO_PIN_12 ((uint32_t)0x1000U) /*!< Select pin 12 */ +#define LL_GPIO_PIN_13 ((uint32_t)0x2000U) /*!< Select pin 13 */ +#define LL_GPIO_PIN_14 ((uint32_t)0x4000U) /*!< Select pin 14 */ +#define LL_GPIO_PIN_15 ((uint32_t)0x8000U) /*!< Select pin 15 */ +#define LL_GPIO_PIN_ALL ((uint32_t)0xFFFFU) /*!< Select all pins */ +/** @} */ + +/** @defgroup GPIO_LL_EC_MODE Mode + * @{ + */ +#define LL_GPIO_MODE_INPUT ((uint32_t)0x0U) /*!< Select input mode */ +#define LL_GPIO_MODE_OUTPUT ((uint32_t)0x1U) /*!< Select output mode */ +#define LL_GPIO_MODE_MUX ((uint32_t)0x2U) /*!< Select mux peripheral mode */ +/** @} */ + +/** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down + * @{ + */ +#define LL_GPIO_PULL_NO LL_GPIO_RE_N /*!< Select I/O no pull */ +#define LL_GPIO_PULL_UP LL_GPIO_RTYP /*!< Select I/O pull up */ +#define LL_GPIO_PULL_DOWN ((uint32_t)0x0U) /*!< Select I/O pull down */ +/** @} */ + +/** @defgroup GPIO_LL_EC_MUX Alternate Function + * @{ + */ +#define LL_GPIO_MUX_0 ((uint32_t)0x0U) /*!< Select alternate function 0 */ +#define LL_GPIO_MUX_1 ((uint32_t)0x1U) /*!< Select alternate function 1 */ +#define LL_GPIO_MUX_2 ((uint32_t)0x2U) /*!< Select alternate function 2 */ +#define LL_GPIO_MUX_3 ((uint32_t)0x3U) /*!< Select alternate function 3 */ +#define LL_GPIO_MUX_4 ((uint32_t)0x4U) /*!< Select alternate function 4 */ +#define LL_GPIO_MUX_5 ((uint32_t)0x5U) /*!< Select alternate function 5 */ +#define LL_GPIO_MUX_6 ((uint32_t)0x6U) /*!< Select alternate function 6 */ +#define LL_GPIO_MUX_7 ((uint32_t)0x7U) /*!< Select alternate function 7 */ +#define LL_GPIO_MUX_8 ((uint32_t)0x8U) /*!< Select alternate function 8 */ +/** @} */ + +/** @defgroup GPIO_LL_EC_TRIGGER Interrupt Trigger + * @{ + */ +#define LL_GPIO_TRIGGER_NONE ((uint32_t)0x00U) /*!< No Trigger Mode */ +#define LL_GPIO_TRIGGER_RISING ((uint32_t)0x01U) /*!< Trigger Rising Mode */ +#define LL_GPIO_TRIGGER_FALLING ((uint32_t)0x02U) /*!< Trigger Falling Mode */ +#define LL_GPIO_TRIGGER_HIGH ((uint32_t)0x03U) /*!< Trigger High Mode */ +#define LL_GPIO_TRIGGER_LOW ((uint32_t)0x04U) /*!< Trigger Low Mode */ +/** @} */ + +/** @defgroup GPIO_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL GPIO InitStrcut default configuartion + */ +#define LL_GPIO_DEFAULT_CONFIG \ +{ \ + .pin = LL_GPIO_PIN_ALL, \ + .mode = LL_GPIO_MODE_INPUT, \ + .pull = LL_GPIO_PULL_DOWN, \ + .mux = LL_GPIO_MUX_7, \ + .trigger = LL_GPIO_TRIGGER_NONE, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros + * @{ + */ + +/** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in GPIO register + * @param __instance__ GPIO instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_GPIO_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in GPIO register + * @param __instance__ GPIO instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_GPIO_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup GPIO_LL_Private_Macros GPIO Private Macros + * @{ + */ + +/** @brief Get the starting position of the specified GPIO instance in related pull-up/pull-down register. + * @param __GPIOx__ This parameter can be one of the following values: + * @arg GPIO0 + * @arg GPIO1 + * @retval none + */ +#define LL_GPIO_GET_RESISTOR_POS(__GPIOx__) (((__GPIOx__) == GPIO0) ? 0 : 16) + +/** @brief Get mux control register address of specified GPIO instance. + * @param __GPIOx__ This parameter can be one of the following values: + * @arg GPIO0 + * @arg GPIO1 + * @retval none + */ +#define LL_GPIO_GET_REG_MUX_CTRL_0_7( __GPIOx__) \ + (((__GPIOx__) == GPIO0) ? &(MCU_SUB->DPAD_MUX_CTL0_7) : &(MCU_SUB->DPAD_MUX_CTL16_23)) + +/** @brief Get mux control register address of specified GPIO instance. + * @param __GPIOx__ This parameter can be one of the following values: + * @arg GPIO0 + * @arg GPIO1 + * @retval none + */ +#define LL_GPIO_GET_REG_MUX_CTRL_8_15( __GPIOx__) \ + (((__GPIOx__) == GPIO0) ? &(MCU_SUB->DPAD_MUX_CTL8_15) : &(MCU_SUB->DPAD_MUX_CTL24_31)) + +/** @defgroup GPIO_LL_PM_RESISTOR Resistor Enable + * @{ + */ +#define LL_GPIO_RE_N_Pos 0 /**< Resistor Enable bits position */ +#define LL_GPIO_RE_N_Msk (0x1U << LL_GPIO_RE_N_Pos) /**< Resistor Enable bits mask */ +#define LL_GPIO_RE_N LL_GPIO_RE_N_Msk /**< Resistor Enable bits */ +/** @} */ + +/** @defgroup GPIO_LL_PM_RESISTOR_TYPE Resistor Type + * @{ + */ +#define LL_GPIO_RTYP_Pos 1 /**< Resistor Type bits position */ +#define LL_GPIO_RTYP_Msk (0x1U << LL_GPIO_RTYP_Pos) /**< Resistor Type bits mask */ +#define LL_GPIO_RTYP LL_GPIO_RTYP_Msk /**< Resistor Type bits */ +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup GPIO_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration + * @{ + */ + +/** + * @brief Set several pins to input/output mode on dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | OUTENSET | OUTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * OUTENCLR | OUTENCLR + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @param mode This parameter can be one of the following values: + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + * @retval None + */ +__STATIC_INLINE void ll_gpio_set_pin_mode(gpio_regs_t *GPIOx, uint32_t pin_mask, uint32_t mode) +{ + if (mode == LL_GPIO_MODE_OUTPUT) + { + WRITE_REG(GPIOx->OUTENSET, pin_mask); + } + else if(mode == LL_GPIO_MODE_INPUT) + { + WRITE_REG(GPIOx->OUTENCLR, pin_mask); + } +} + +/** + * @brief Return gpio mode for a dedicated pin on dedicated port. + * @note I/O mode can be Input mode, General purpose output. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | OUTENSET | OUTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_MODE_INPUT + * @arg @ref LL_GPIO_MODE_OUTPUT + */ +__STATIC_INLINE uint32_t ll_gpio_get_pin_mode(gpio_regs_t *GPIOx, uint32_t pin) +{ + return (uint32_t)(READ_BITS(GPIOx->OUTENSET, pin) != RESET); +} + +/** + * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_RE_N_BUS | RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_RTYP_BUS | RTYP + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param pull This parameter can be one of the following values: + * @arg @ref LL_GPIO_PULL_NO + * @arg @ref LL_GPIO_PULL_UP + * @arg @ref LL_GPIO_PULL_DOWN + * @retval None + */ +__STATIC_INLINE void ll_gpio_set_pin_pull(gpio_regs_t *GPIOx, uint32_t pin_mask, uint32_t pull) +{ + /* Get pin mask in resitor related registers, GPIO0:0~15, GPIO1:16~31 */ + pin_mask <<= LL_GPIO_GET_RESISTOR_POS(GPIOx); + MODIFY_REG(MCU_SUB->DPAD_RTYP_BUS, pin_mask, (pull == LL_GPIO_PULL_UP) ? pin_mask : 0x0000U); + MODIFY_REG(MCU_SUB->DPAD_RE_N_BUS, pin_mask, (pull == LL_GPIO_PULL_NO) ? pin_mask : 0x0000U); +} + +/** + * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_RE_N_BUS | RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_RTYP_BUS | RTYP + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_PULL_NO + * @arg @ref LL_GPIO_PULL_UP + * @arg @ref LL_GPIO_PULL_DOWN + */ +__STATIC_INLINE uint32_t ll_gpio_get_pin_pull(gpio_regs_t *GPIOx, uint32_t pin) +{ + /* Get pin position in resitor related registers, GPIO0:0~15, GPIO1:16~31 */ + pin <<= LL_GPIO_GET_RESISTOR_POS(GPIOx); + return ((READ_BITS(MCU_SUB->DPAD_RE_N_BUS, pin) != RESET) ? LL_GPIO_PULL_NO : + ((READ_BITS(MCU_SUB->DPAD_RTYP_BUS, pin) != RESET) ? LL_GPIO_PULL_UP : LL_GPIO_PULL_DOWN)); +} + +/** + * @brief Configure gpio pinmux number of a dedicated pin from 0 to 7 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_MUX_CTRL0_7 | CTRL0_7 | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_MUX_CTRL16_23 | CTRL16_23 + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @param mux This parameter can be one of the following values: + * @arg @ref LL_GPIO_MUX_0 + * @arg @ref LL_GPIO_MUX_1 + * @arg @ref LL_GPIO_MUX_2 + * @arg @ref LL_GPIO_MUX_3 + * @arg @ref LL_GPIO_MUX_4 + * @arg @ref LL_GPIO_MUX_5 + * @arg @ref LL_GPIO_MUX_6 + * @arg @ref LL_GPIO_MUX_7 + * @arg @ref LL_GPIO_MUX_8 + * @retval None + */ +__STATIC_INLINE void ll_gpio_set_mux_pin_0_7(gpio_regs_t *GPIOx, uint32_t pin, uint32_t mux) +{ + volatile uint32_t *pReg = LL_GPIO_GET_REG_MUX_CTRL_0_7(GPIOx); + uint32_t pos = POSITION_VAL(pin) << 2; + MODIFY_REG(*pReg, 0xF << pos, mux << pos); +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_MUX_CTRL0_7 | CTRL0_7 | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_MUX_CTRL16_23 | CTRL16_23 + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_MUX_0 + * @arg @ref LL_GPIO_MUX_1 + * @arg @ref LL_GPIO_MUX_2 + * @arg @ref LL_GPIO_MUX_3 + * @arg @ref LL_GPIO_MUX_4 + * @arg @ref LL_GPIO_MUX_5 + * @arg @ref LL_GPIO_MUX_6 + * @arg @ref LL_GPIO_MUX_7 + * @arg @ref LL_GPIO_MUX_8 + */ +__STATIC_INLINE uint32_t ll_gpio_get_mux_pin_0_7(gpio_regs_t *GPIOx, uint32_t pin) +{ + volatile uint32_t *pReg = LL_GPIO_GET_REG_MUX_CTRL_0_7(GPIOx); + uint32_t pos = POSITION_VAL(pin) << 2; + return (READ_BITS(*pReg, 0xF << pos) >> pos); +} + +/** + * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_MUX_CTRL8_15 | CTRL8_15 | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_MUX_CTRL24_31 | CTRL24_31 + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @param mux This parameter can be one of the following values: + * @arg @ref LL_GPIO_MUX_0 + * @arg @ref LL_GPIO_MUX_1 + * @arg @ref LL_GPIO_MUX_2 + * @arg @ref LL_GPIO_MUX_3 + * @arg @ref LL_GPIO_MUX_4 + * @arg @ref LL_GPIO_MUX_5 + * @arg @ref LL_GPIO_MUX_6 + * @arg @ref LL_GPIO_MUX_7 + * @arg @ref LL_GPIO_MUX_8 + * @retval None + */ +__STATIC_INLINE void ll_gpio_set_mux_pin_8_15(gpio_regs_t *GPIOx, uint32_t pin, uint32_t mux) +{ + volatile uint32_t *pReg = LL_GPIO_GET_REG_MUX_CTRL_8_15(GPIOx); + uint32_t pos = POSITION_VAL(pin >> 8) << 2; + MODIFY_REG(*pReg, 0xF << pos, mux << pos); +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. + * @note Possible values are from AF0 to AF15 depending on target. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DPAD_MUX_CTRL8_15 | CTRL8_15 | + * +----------------------+-----------------------------------+ + * \endrst + * DPAD_MUX_CTRL24_31 | CTRL24_31 + * + * @param GPIOx GPIO Port + * @param pin This parameter can be one of the following values: + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @retval Returned value can be one of the following values: + * @arg @ref LL_GPIO_MUX_0 + * @arg @ref LL_GPIO_MUX_1 + * @arg @ref LL_GPIO_MUX_2 + * @arg @ref LL_GPIO_MUX_3 + * @arg @ref LL_GPIO_MUX_4 + * @arg @ref LL_GPIO_MUX_5 + * @arg @ref LL_GPIO_MUX_6 + * @arg @ref LL_GPIO_MUX_7 + * @arg @ref LL_GPIO_MUX_8 + */ +__STATIC_INLINE uint32_t ll_gpio_get_mux_pin_8_15(gpio_regs_t *GPIOx, uint32_t pin) +{ + volatile uint32_t *pReg = LL_GPIO_GET_REG_MUX_CTRL_8_15(GPIOx); + uint32_t pos = POSITION_VAL(pin >> 8) << 2; + return (READ_BITS(*pReg, 0xF << pos) >> pos); +} + +/** @} */ + +/** @defgroup GPIO_LL_EF_Data_Access Data Access + * @{ + */ + +/** + * @brief Return full input data register value for a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @retval Input data register value of port + */ +__STATIC_INLINE uint32_t ll_gpio_read_input_port(gpio_regs_t *GPIOx) +{ + return (uint32_t)(READ_REG(GPIOx->DATA)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_input_pin_set(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return (READ_BITS(GPIOx->DATA, pin_mask) == (pin_mask)); +} + +/** + * @brief Write output data register for the port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param port_value Level value for each pin of the port + * @retval None + */ +__STATIC_INLINE void ll_gpio_write_output_port(gpio_regs_t *GPIOx, uint32_t port_value) +{ + WRITE_REG(GPIOx->DATAOUT, port_value); +} + +/** + * @brief Return full output data register value for a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @retval Output data register value of port + */ +__STATIC_INLINE uint32_t ll_gpio_read_output_port(gpio_regs_t *GPIOx) +{ + return (uint32_t)(READ_REG(GPIOx->DATAOUT)); +} + +/** + * @brief Return if input data level for several pins of dedicated port is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_output_pin_set(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return (READ_BITS(GPIOx->DATAOUT, pin_mask) == (pin_mask)); +} + +/** + * @brief Set several pins to high level on dedicated gpio port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_set_output_pin(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ +#ifdef USE_GPIO_MASK_REGISTER + WRITE_REG(GPIOx->MASKLOWBYTE[(uint8_t)pin_mask], pin_mask & GPIO_MASKLOWBYTE_DATA); + WRITE_REG(GPIOx->MASKHIGHBYTE[(uint8_t)(pin_mask >> GPIO_MASKHIGHBYTE_DATA_Pos)], + pin_mask & GPIO_MASKHIGHBYTE_DATA); +#else + SET_BITS(GPIOx->DATAOUT, pin_mask); +#endif +} + +/** + * @brief Set several pins to low level on dedicated gpio port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_reset_output_pin(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ +#ifdef USE_GPIO_MASK_REGISTER + WRITE_REG(GPIOx->MASKLOWBYTE[(uint8_t)pin_mask], 0x0000U); + WRITE_REG(GPIOx->MASKHIGHBYTE[(uint8_t)(pin_mask >> 8)], 0x0000U); +#else + CLEAR_BITS(GPIOx->DATAOUT, pin_mask); +#endif +} + +/** + * @brief Toggle data value for several pin of dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATAOUT | DATAOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO Port + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_toggle_pin(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->DATAOUT, READ_REG(GPIOx->DATAOUT) ^ pin_mask); +} + +/** @} */ + +/** @defgroup GPIO_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable GPIO Falling Edge Trigger for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_enable_falling_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTPOLCLR, pin_mask); + WRITE_REG(GPIOx->INTTYPESET, pin_mask); +} + +/** + * @brief Check if falling edge trigger is enabled for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_enabled_falling_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return ((READ_BITS(GPIOx->INTPOLCLR, pin_mask) == (pin_mask)) && + (READ_BITS(GPIOx->INTTYPESET, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable GPIO Rising Edge Trigger for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_enable_rising_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTPOLSET, pin_mask); + WRITE_REG(GPIOx->INTTYPESET, pin_mask); +} + +/** + * @brief Check if rising edge trigger is enabled for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPESET | INTTYPESET + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @note Please check each device line mapping for GPIO Line availability + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_enabled_rising_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return ((READ_BITS(GPIOx->INTPOLSET, pin_mask) == (pin_mask)) && + (READ_BITS(GPIOx->INTTYPESET, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable GPIO High Level Trigger for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_enable_high_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTPOLSET, pin_mask); + WRITE_REG(GPIOx->INTTYPECLR, pin_mask); +} + +/** + * @brief Check if high level trigger is enabled for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLSET | INTPOLSET | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_enabled_high_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return ((READ_BITS(GPIOx->INTPOLSET, pin_mask) == (pin_mask)) && + (READ_BITS(GPIOx->INTTYPECLR, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable GPIO Low Level Trigger for pins in the range of 0 to 15. + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_enable_low_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTPOLCLR, pin_mask); + WRITE_REG(GPIOx->INTTYPECLR, pin_mask); +} + +/** + * @brief Check if low level trigger is enabled for pins in the range of 0 to 15 + * @note + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTPOLCLR | INTPOLCLR | + * +----------------------+-----------------------------------+ + * \endrst + * INTTYPECLR | INTTYPECLR + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_enabled_low_trigger(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return ((READ_BITS(GPIOx->INTPOLCLR, pin_mask) == (pin_mask)) && + (READ_BITS(GPIOx->INTTYPECLR, pin_mask) == (pin_mask))); +} + +/** + * @brief Enable GPIO interrupts for pins in the range of 0 to 15. + * @note @ref GPIO_LL_EC_TRIGGER can be used to specify the interrupt trigger type + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENSET | INTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_enable_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTENSET, pin_mask); +} + +/** + * @brief Disable GPIO interrupts for pins in the range of 0 to 15. + * @note @ref GPIO_LL_EC_TRIGGER can be used to specify the interrupt trigger type + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENCLR | INTENCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_disable_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTENCLR, pin_mask); +} + +/** + * @brief Check if the Interrupt of specified GPIO pins is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTENSET | INTENSET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_enabled_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return (READ_BITS(GPIOx->INTENSET, pin_mask) == (pin_mask)); +} + +/** @} */ + +/** @defgroup GPIO_LL_EF_Flag_Management Flag_Management + * @{ + */ + +/** + * @brief Read GPIO Interrupt Combination Flag for pins in the range of 0 to 15 + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can be cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval Interrupt flag whose bits were set when the selected trigger event arrives on the interrupt + */ +__STATIC_INLINE uint32_t ll_gpio_read_flag_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return (uint32_t)(READ_BITS(GPIOx->INTSTAT, pin_mask)); +} + +/** + * @brief Indicates if the GPIO Interrupt Flag is set or not for pins in the range of 0 to 15. + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can be cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_gpio_is_active_flag_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + return (READ_BITS(GPIOx->INTSTAT, pin_mask) == pin_mask); +} + +/** + * @brief Clear Interrupt Status flag for pins in the range of 0 to 15. + * @note After an interrupt is triggered, the corresponding bit in the INTSTATUS Register is set. + * The interrupt status can be cleared by writing 1 to corresponding bit in INTCLEAR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTATUS | INTSTATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param GPIOx GPIO instance. + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_GPIO_PIN_0 + * @arg @ref LL_GPIO_PIN_1 + * @arg @ref LL_GPIO_PIN_2 + * @arg @ref LL_GPIO_PIN_3 + * @arg @ref LL_GPIO_PIN_4 + * @arg @ref LL_GPIO_PIN_5 + * @arg @ref LL_GPIO_PIN_6 + * @arg @ref LL_GPIO_PIN_7 + * @arg @ref LL_GPIO_PIN_8 + * @arg @ref LL_GPIO_PIN_9 + * @arg @ref LL_GPIO_PIN_10 + * @arg @ref LL_GPIO_PIN_11 + * @arg @ref LL_GPIO_PIN_12 + * @arg @ref LL_GPIO_PIN_13 + * @arg @ref LL_GPIO_PIN_14 + * @arg @ref LL_GPIO_PIN_15 + * @arg @ref LL_GPIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_gpio_clear_flag_it(gpio_regs_t *GPIOx, uint32_t pin_mask) +{ + WRITE_REG(GPIOx->INTSTAT, pin_mask); +} + +/** @} */ + +/** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize GPIO registers (Registers restored to their default values). + * @param GPIOx GPIO instance. + * @retval An error_status_t enumeration value: + * - SUCCESS: GPIO registers are de-initialized + * - ERROR: GPIO registers are not de-initialized + */ +error_status_t ll_gpio_deinit(gpio_regs_t *GPIOx); + +/** + * @brief Initialize GPIO registers according to the specified + * parameters in p_gpio_init. + * @param GPIOx GPIO instance. + * @param p_gpio_init Pointer to a ll_gpio_init_t structure that contains the configuration + * information for the specified GPIO peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: GPIO registers are initialized according to p_gpio_init content + * - ERROR: Problem occurred during GPIO Registers initialization + */ +error_status_t ll_gpio_init(gpio_regs_t *GPIOx, ll_gpio_init_t *p_gpio_init); + +/** + * @brief Set each field of a @ref ll_gpio_init_t type structure to default value. + * @param p_gpio_init Pointer to a @ref ll_gpio_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_gpio_struct_init(ll_gpio_init_t *p_gpio_init); + +/** @} */ + +/** @} */ + +#endif /* defined (GPIO0) || defined (GPIO1) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_GPIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_hmac.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_hmac.h new file mode 100644 index 0000000..22e74c1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_hmac.h @@ -0,0 +1,1425 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_hmac.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of HMAC LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_HMAC HMAC + * @brief HMAC LL module driver. + * @{ + */ +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_HMAC_H__ +#define __GR55XX_LL_HMAC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (HMAC) + +/** @defgroup HMAC_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup HMAC_LL_ES_INIT HMAC Exported Init structures + * @{ + */ + +/** + * @brief LL HMAC Init Structure definition + */ +typedef struct _ll_hmac_init_t +{ + uint32_t *p_key; /**< Key */ + + uint32_t *p_hash; /**< HASH value */ + +} ll_hmac_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup HMAC_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup HMAC_LL_Exported_Constants HMAC Exported Constants + * @{ + */ + +/** @defgroup HMAC_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags definitions which can be used with LL_HMAC_ReadReg function + * @{ + */ +#define LL_HMAC_FLAG_DATAREADY_SHA HMAC_STATUS_DATAREADY_SHA /**< HMAC data ready(SHA mode) */ +#define LL_HMAC_FLAG_DATAREADY_HMAC HMAC_STATUS_DATAREADY_HMAC /**< HMAC data ready(HAMC mode) */ +#define LL_HMAC_FLAG_DMA_MESSAGEDONE HMAC_STATUS_MESSAGEDONE_DMA /**< HMAC dma message done */ +#define LL_HMAC_FLAG_DMA_DONE HMAC_STATUS_TRANSDONE_DMA /**< HMAC dma transfer done */ +#define LL_HMAC_FLAG_DMA_ERR HMAC_STATUS_TRANSERR_DMA /**< HMAC dma transfer error */ +#define LL_HMAC_FLAG_KEY_VALID HMAC_STATUS_KEYVALID /**< HMAC has fetched key */ +/** @} */ + +/** @defgroup HMAC_LL_EC_HASH_MODE Hash Mode + * @{ + */ +#define LL_HMAC_HASH_STANDARD 0x00000000U /**< Standard Mode */ +#define LL_HMAC_HASH_USER (1UL << HMAC_CONFIG_ENABLE_USERHASH) /**< User Mode */ +/** @} */ + +/** @defgroup HMAC_LL_EC_CALCULATE_TYPE Calculate Type + * @{ + */ +#define LL_HMAC_CALCULATETYPE_HMAC 0x00000000U /**< HMAC mode */ +#define LL_HMAC_CALCULATETYPE_SHA (1UL << HMAC_CONFIG_CALCTYPE_Pos) /**< SHA moe */ +/** @} */ + +/** @defgroup HMAC_LL_EC_KEY_TYPE Key Type + * @{ + */ +#define LL_HMAC_KEYTYPE_MCU 0x00000000U /**< MCU */ +#define LL_HMAC_KEYTYPE_AHB (1UL << HMAC_CONFIG_KEYTYPE_Pos) /**< AHB master */ +#define LL_HMAC_KEYTYPE_KRAM (2UL << HMAC_CONFIG_KEYTYPE_Pos) /**< Key Port */ +/** @} */ + +/** @defgroup HMAC_LL_EC_TRANSFER_SIZE Transfer Size + * @{ + */ +#define LL_HMAC_DMA_TRANSIZE_MIN (1) /**< Min size = 1 block */ +#define LL_HMAC_DMA_TRANSIZE_MAX (512) /**< Min size = 512 blocks */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup HMAC_LL_Exported_Macros HMAC Exported Macros + * @{ + */ + +/** @defgroup HMAC_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in HMAC register + * @param __INSTANCE__ HMAC Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_HMAC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in HMAC register + * @param __INSTANCE__ HMAC Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_HMAC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup HMAC_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup HMAC_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable HMAC. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CTRL, HMAC_CTRL_ENABLE); +} + +/** + * @brief Disable HMAC. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CTRL, HMAC_CTRL_ENABLE); +} + +/** + * @brief Indicate whether the HMAC is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CTRL, HMAC_CTRL_ENABLE) == (HMAC_CTRL_ENABLE)); +} + +/** + * @brief Enable HMAC DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_dma_start(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CTRL, HMAC_CTRL_START_DMA); +} + +/** + * @brief Disable HMAC DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_dma_start(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CTRL, HMAC_CTRL_START_DMA); +} + +/** + * @brief Indicate whether the HMAC DMA mode is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_dma_start(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CTRL, HMAC_CTRL_START_DMA) == (HMAC_CTRL_START_DMA)); +} + +/** + * @brief Enable fetch key through AHB/key port. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ENABLE_RKEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_read_key(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CTRL, HMAC_CTRL_ENABLE_RKEY); +} + +/** + * @brief Enable last block transfer in MCU/DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | LASTTRANSFER | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_last_transfer(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CTRL, HMAC_CTRL_LASTTRANSFER); +} + +/** + * @brief Enable user HASH. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENABLE_USERHASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_user_hash(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CONFIG, HMAC_CONFIG_ENABLE_USERHASH); +} + +/** + * @brief Disable user HASH. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENABLE_USERHASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_user_hash(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CONFIG, HMAC_CONFIG_ENABLE_USERHASH); +} + +/** + * @brief Indicate whether the user HASH is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENABLE_USERHASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_user_hash(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CONFIG, HMAC_CONFIG_ENABLE_USERHASH) == (HMAC_CONFIG_ENABLE_USERHASH)); +} + +/** + * @brief Enable HMAC in little endian. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_little_endian(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CONFIG, HMAC_CONFIG_ENDIAN); +} + +/** + * @brief Disable HMAC in little endian. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_little_endian(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CONFIG, HMAC_CONFIG_ENDIAN); +} + +/** + * @brief Indicate whether the HMAC is in little endian. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | ENDIAN | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_little_endian(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CONFIG, HMAC_CONFIG_ENDIAN) == (HMAC_CONFIG_ENDIAN)); +} + +/** + * @brief Set ways to obtain HMAC key. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | KEYTYPE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param type This parameter can be one of the following values: + * @arg @ref LL_HMAC_KEYTYPE_MCU + * @arg @ref LL_HMAC_KEYTYPE_AHB + * @arg @ref LL_HMAC_KEYTYPE_KRAM + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key_type(hmac_regs_t *HMACx, uint32_t type) +{ + MODIFY_REG(HMACx->CONFIG, HMAC_CONFIG_KEYTYPE, type); +} + +/** + * @brief Get ways to obtain HMAC key. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | KEYTYPE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_HMAC_KEYTYPE_MCU + * @arg @ref LL_HMAC_KEYTYPE_AHB + * @arg @ref LL_HMAC_KEYTYPE_KRAM + */ +__STATIC_INLINE uint32_t ll_hmac_get_key_type(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CONFIG, HMAC_CONFIG_KEYTYPE)); +} + +/** + * @brief Enable SHA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | CALCTYPE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_sha(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CONFIG, HMAC_CONFIG_CALCTYPE); +} + +/** + * @brief Disable SHA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | CALCTYPE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_sha(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CONFIG, HMAC_CONFIG_CALCTYPE); +} + +/** + * @brief Indicate whether the SHA mode is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | CALCTYPE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_sha(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CONFIG, HMAC_CONFIG_CALCTYPE) == (HMAC_CONFIG_CALCTYPE)); +} + +/** + * @brief Enable private mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | PRIVATE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_private(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->CONFIG, HMAC_CONFIG_PRIVATE); +} + +/** + * @brief Disable private mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | PRIVATE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_private(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->CONFIG, HMAC_CONFIG_PRIVATE); +} + +/** + * @brief Indicate whether the private mode is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | PRIVATE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_private(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->CONFIG, HMAC_CONFIG_PRIVATE) == (HMAC_CONFIG_PRIVATE)); +} + +/** @} */ + +/** @defgroup HMAC_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable the done interrupt for HMAC. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_enable_it_done(hmac_regs_t *HMACx) +{ + SET_BITS(HMACx->INTERRUPT, HMAC_INTERRUPT_ENABLE); +} + +/** + * @brief Disable the done interrupt for HMAC. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_disable_it_done(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->INTERRUPT, HMAC_INTERRUPT_ENABLE); +} + +/** + * @brief Indicate whether Done Interrupt is enabled. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTERRUPT | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_enabled_it_done(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->INTERRUPT, HMAC_INTERRUPT_ENABLE) == (HMAC_INTERRUPT_ENABLE)); +} + +/** @} */ + +/** @defgroup HMAC_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Indicate whether SHA Ready flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | DATAREADY_SHA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_sha_ready(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_DATAREADY_SHA) == HMAC_STATUS_DATAREADY_SHA); +} + +/** + * @brief Indicate whether HMAC Ready flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | DATAREADY_HMAC | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_hmac_ready(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_DATAREADY_HMAC) == HMAC_STATUS_DATAREADY_HMAC); +} + +/** + * @brief Indicate whether DMA Transmit Message Done flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | MESSAGEDONE_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_dma_message_done(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_MESSAGEDONE_DMA) == HMAC_STATUS_MESSAGEDONE_DMA); +} + +/** + * @brief Indicate whether DMA Transfer Done flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | TRANSDONE_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_dma_done(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_TRANSDONE_DMA) == HMAC_STATUS_TRANSDONE_DMA); +} + +/** + * @brief Indicate whether DMA Transfer Error flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | TRANSERR_DMA | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_dma_error(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_TRANSERR_DMA) == HMAC_STATUS_TRANSERR_DMA); +} + +/** + * @brief Indicate whether Key Valid flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | KEYVALID | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_key_valid(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->STATUS, HMAC_STATUS_KEYVALID) == HMAC_STATUS_KEYVALID); +} + +/** + * @brief Indicate whether Done interrupt flag is set. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTERRUPT | DONE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_hmac_is_action_flag_it_done(hmac_regs_t *HMACx) +{ + return (READ_BITS(HMACx->INTERRUPT, HMAC_INTERRUPT_DONE) == HMAC_INTERRUPT_DONE); +} + +/** + * @brief Clear Done interrupt flag. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTERRUPT | DONE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval None + */ +__STATIC_INLINE void ll_hmac_clear_flag_it_done(hmac_regs_t *HMACx) +{ + CLEAR_BITS(HMACx->INTERRUPT, HMAC_INTERRUPT_DONE); +} + +/** @} */ + +/** @defgroup HMAC_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Set HMAC transfer blocks in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRANSIZE | TRANSIZE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param block This parameter can be one of the following values: 1 ~ 512 + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_dma_transfer_block(hmac_regs_t *HMACx, uint32_t block) +{ + MODIFY_REG(HMACx->TRAN_SIZE, HMAC_TRANSIZE, (block << 6) - 1); +} + +/** + * @brief Get HMAC transfer blocks in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TRANSIZE | TRANSIZE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Return value is between: 1 ~ 512 + */ +__STATIC_INLINE uint32_t ll_hmac_get_dma_transfer_block(hmac_regs_t *HMACx) +{ + return ((READ_BITS(HMACx->TRAN_SIZE, HMAC_TRANSIZE) + 1) >> 6); +} + +/** + * @brief Set HMAC read address of RAM in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RSTART_ADDR | RSTART_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param address This parameter can be one of the address in RAM + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_dma_read_address(hmac_regs_t *HMACx, uint32_t address) +{ + WRITE_REG(HMACx->RSTART_ADDR, address); +} + +/** + * @brief Get HMAC read address of RAM in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RSTART_ADDR | RSTART_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Return value is the address in RAM + */ +__STATIC_INLINE uint32_t ll_hmac_get_dma_read_address(hmac_regs_t *HMACx) +{ + return (READ_REG(HMACx->RSTART_ADDR)); +} + +/** + * @brief Set HMAC write address of RAM in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | WSTART_ADDR | WSTART_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param address This parameter can be one of the address in RAM + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_dma_write_address(hmac_regs_t *HMACx, uint32_t address) +{ + WRITE_REG(HMACx->WSTART_ADDR, address); +} + +/** + * @brief Get HMAC write address of RAM in DMA mode. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | WSTART_ADDR | WSTART_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Return value is the address in RAM + */ +__STATIC_INLINE uint32_t ll_hmac_get_dma_write_address(hmac_regs_t *HMACx) +{ + return (READ_REG(HMACx->WSTART_ADDR)); +} + +/** @} */ + +/** @defgroup HMAC_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Set user HASH[255:224]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[0] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_255_224(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[0], hash); +} + +/** + * @brief Set user HASH[223:192]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[1] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_223_192(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[1], hash); +} + +/** + * @brief Set user HASH[191:160]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[2] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_191_160(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[2], hash); +} + +/** + * @brief Set user HASH[159:128]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[3] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_159_128(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[3], hash); +} + +/** + * @brief Set user HASH[127:96]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[4] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_127_96(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[4], hash); +} + +/** + * @brief Set user HASH[95:64]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[5] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_95_64(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[5], hash); +} + +/** + * @brief Set user HASH[63:32]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[6] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_63_32(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[6], hash); +} + +/** + * @brief Set user HASH[31:0]. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER_HASH[7] | USER_HASH | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param hash This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_user_hash_31_0(hmac_regs_t *HMACx, uint32_t hash) +{ + WRITE_REG(HMACx->USER_HASH[7], hash); +} + +/** + * @brief Get abstract from HMAC. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | FIFO_OUT | FIFO_OUT | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Abstract + */ +__STATIC_INLINE uint32_t ll_hmac_get_data(hmac_regs_t *HMACx) +{ + return (READ_REG(HMACx->FIFO_OUT)); +} + +/** + * @brief Send data to calculate. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | FIFO_MESSAGE | FIFO_MESSAGE | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param data This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_data(hmac_regs_t *HMACx, uint32_t data) +{ + WRITE_REG(HMACx->MESSAGE_FIFO, data); +} + +/** + * @brief Set HMAC key0. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[0] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key0(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[0], key); +} + +/** + * @brief Set HMAC key1. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[1] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key1(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[1], key); +} + +/** + * @brief Set HMAC key2. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[2] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key2(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[2], key); +} + +/** + * @brief Set HMAC key3. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[3] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key3(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[3], key); +} + +/** + * @brief Set HMAC key4. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[4] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key4(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[4], key); +} + +/** + * @brief Set HMAC key5. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[5] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key5(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[5], key); +} + +/** + * @brief Set HMAC key6. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[6] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key6(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[6], key); +} + +/** + * @brief Set HMAC key7. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY[7] | KEY | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param key This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key7(hmac_regs_t *HMACx, uint32_t key) +{ + WRITE_REG(HMACx->KEY[7], key); +} + +/** + * @brief Set HMAC key address in memory. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY_ADDR | KEY_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param address This parameter can be one of the address in RAM + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key_address(hmac_regs_t *HMACx, uint32_t address) +{ + WRITE_REG(HMACx->KEY_ADDR, address); +} + +/** + * @brief Get HMAC key address in memory. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KEY_ADDR | KEY_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @retval Return value is the address in RAM + */ +__STATIC_INLINE uint32_t ll_hmac_get_key_address(hmac_regs_t *HMACx) +{ + return (READ_REG(HMACx->KEY_ADDR)); +} + +/** + * @brief Set HMAC fetch key port mask. + + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | KPORT_MASK | KPORT_MASK | + * +----------------------+-----------------------------------+ + * \endrst + + * @param HMACx HMAC instance + * @param mask This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_hmac_set_key_port_mask(hmac_regs_t *HMACx, uint32_t mask) +{ + WRITE_REG(HMACx->KPORT_MASK, mask); +} + +/** @} */ + +/** @defgroup HMAC_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize HMAC registers (Registers restored to their default values). + * @param HMACx HMAC Instance + * @retval An error_status_t enumeration value: + * - SUCCESS: HMAC registers are de-initialized + * - ERROR: HMAC registers are not de-initialized + */ +error_status_t ll_hmac_deinit(hmac_regs_t *HMACx); + +/** + * @brief Initialize HMAC registers according to the specified + * parameters in p_hmac_init. + * @param HMACx HMAC Instance + * @param p_hmac_init Pointer to a ll_hmac_init_t structure that contains the configuration + * information for the specified HMAC peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: HMAC registers are initialized according to p_hmac_init content + * - ERROR: Problem occurred during HMAC Registers initialization + */ +error_status_t ll_hmac_init(hmac_regs_t *HMACx, ll_hmac_init_t *p_hmac_init); + +/** + * @brief Set each field of a @ref ll_hmac_init_t type structure to default value. + * @param p_hmac_init Pointer to a @ref ll_hmac_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_hmac_struct_init(ll_hmac_init_t *p_hmac_init); + +/** @} */ + +/** @} */ + +#endif /* HMAC */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_HMAC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2c.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2c.h new file mode 100644 index 0000000..06cb55d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2c.h @@ -0,0 +1,3961 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_i2c.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2C LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_I2C I2C + * @brief I2C LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_I2C_H__ +#define __GR55xx_LL_I2C_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (I2C0) || defined (I2C1) + +/** @defgroup I2C_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup I2C_LL_ES_INIT I2C Exported init structure + * @{ + */ + +/** + * @brief LL I2C init Structure definition + */ +typedef struct _ll_i2c_init +{ + uint32_t speed; /**< Specifies the transfer speed. See @ref I2C_LL_EC_SPEED. */ + + uint32_t own_address; /**< Specifies the device own address. + This parameter must be a value between Min_Data = 0x00 and Max_Data = 0x3FF + + This feature can be modified afterwards using unitary function @ref ll_i2c_set_own_address(). */ + + uint32_t own_addr_size; /**< Specifies the device own address 1 size (7-bit or 10-bit). + This parameter can be a value of @ref I2C_LL_EC_OWNADDRESS + + This feature can be modified afterwards using unitary function @ref ll_i2c_set_own_address(). */ +} ll_i2c_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup I2C_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup I2C_LL_Exported_Constants I2C Exported Constants + * @{ + */ + +/** @defgroup I2C_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags definitions which can be used with LL_I2C_ReadReg function + * @{ + */ +#define LL_I2C_INTR_STAT_MST_ON_HOLD I2C_INTR_GEN_CALL /**< MST_ON_HOLD interrupt flag */ +#define LL_I2C_INTR_STAT_RESTART_DET I2C_INTR_RESTART_DET /**< RESTART_DET interrupt flag */ +#define LL_I2C_INTR_STAT_GEN_CALL I2C_INTR_GEN_CALL /**< GEN_CALL interrupt flag */ +#define LL_I2C_INTR_STAT_START_DET I2C_INTR_START_DET /**< START_DET interrupt flag */ +#define LL_I2C_INTR_STAT_STOP_DET I2C_INTR_STOP_DET /**< STOP_DET interrupt flag */ +#define LL_I2C_INTR_STAT_ACTIVITY I2C_INTR_ACTIVITY /**< ACTIVITY interrupt flag */ +#define LL_I2C_INTR_STAT_RX_DONE I2C_INTR_RX_DONE /**< RX_DONE interrupt flag */ +#define LL_I2C_INTR_STAT_TX_ABRT I2C_INTR_TX_ABRT /**< TX_ABRT interrupt flag */ +#define LL_I2C_INTR_STAT_RD_REQ I2C_INTR_RD_REQ /**< RD_REQ interrupt flag */ +#define LL_I2C_INTR_STAT_TX_EMPTY I2C_INTR_TX_EMPTY /**< TX_EMPTY interrupt flag */ +#define LL_I2C_INTR_STAT_TX_OVER I2C_INTR_TX_OVER /**< TX_OVER interrupt flag */ +#define LL_I2C_INTR_STAT_RX_FULL I2C_INTR_RX_FULL /**< RX_FULL interrupt flag */ +#define LL_I2C_INTR_STAT_RX_OVER I2C_INTR_RX_OVER /**< RX_OVER interrupt flag */ +#define LL_I2C_INTR_STAT_RX_UNDER I2C_INTR_RX_UNDER /**< RX_UNDER interrupt flag */ + +#define LL_I2C_ABRT_TX_FLUSH_CNT I2C_TX_ABRT_SRC_TX_FLUSH_CNT /**< Transfer abort detected by master */ +#define LL_I2C_ABRT_USER_ABRT I2C_TX_ABRT_SRC_USER_ABRT /**< Transfer abort detected by master */ +#define LL_I2C_ABRT_SLVRD_INTX I2C_TX_ABRT_SRC_SLVRD_INTX /**< Slave trying to transmit to remote master in read mode */ +#define LL_I2C_ABRT_SLV_ARBLOST I2C_TX_ABRT_SRC_SLV_ARBLOST /**< Slave lost arbitration to remote master */ +#define LL_I2C_ABRT_SLVFLUSH_TXFIFO I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO /**< Slave flushes existing data in TX-FIFO upon getting read command */ +#define LL_I2C_ABRT_ARB_LOST I2C_TX_ABRT_SRC_ARB_LOST /**< Master or Slave Transmitter lost arbitration */ +#define LL_I2C_ABRT_MST_DIS I2C_TX_ABRT_SRC_MST_DIS /**< User intitating master operation when MASTER disabled */ +#define LL_I2C_ABRT_10B_RD_NORSTRT I2C_TX_ABRT_SRC_10B_RD_NORSTRT /**< Master trying to read in 10-Bit addressing mode when RESTART disabled */ +#define LL_I2C_ABRT_SBYTE_NORSTRT I2C_TX_ABRT_SRC_SBYTE_NORSTRT /**< User trying to send START byte when RESTART disabled */ +#define LL_I2C_ABRT_HS_NORSTRT I2C_TX_ABRT_SRC_HS_NORSTRT /**< User trying to swidth Master to HS mode when RESTART disabled */ +#define LL_I2C_ABRT_SBYTE_ACKDET I2C_TX_ABRT_SRC_SBYTE_ACKDET /**< ACK detected for START byte */ +#define LL_I2C_ABRT_HS_ACKDET I2C_TX_ABRT_SRC_HS_ACKDET /**< HS Master code is ACKed in HS Mode */ +#define LL_I2C_ABRT_GCALL_READ I2C_TX_ABRT_SRC_GCALL_READ /**< GCALL is followed by read from bus */ +#define LL_I2C_ABRT_GCALL_NOACK I2C_TX_ABRT_SRC_GCALL_NOACK /**< GCALL is not ACKed by any slave */ +#define LL_I2C_ABRT_TXDATA_NOACK I2C_TX_ABRT_SRC_TXDATA_NOACK /**< Transmitted data is not ACKed by addressed slave */ +#define LL_I2C_ABRT_10ADDR2_NOACK I2C_TX_ABRT_SRC_10ADDR2_NOACK /**< Byte 2 of 10-Bit Address is not ACKed by any slave */ +#define LL_I2C_ABRT_10ADDR1_NOACK I2C_TX_ABRT_SRC_10ADDR1_NOACK /**< Byte 1 of 10-Bit Address is not ACKed by any slave */ +#define LL_I2C_ABRT_7B_ADDR_NOACK I2C_TX_ABRT_SRC_7B_ADDR_NOACK /**< 7Bit Address is not ACKed by any slave */ +/** @} */ + +/** @defgroup I2C_LL_EC_IT IT Defines + * @brief Interrupt definitions which can be used with LL_I2C_ReadReg and LL_I2C_WriteReg functions + * @{ + */ +#define LL_I2C_INTR_MASK_MST_ON_HOLD I2C_INTR_GEN_CALL /**< MST_ON_HOLD interrupt */ +#define LL_I2C_INTR_MASK_RESTART_DET I2C_INTR_RESTART_DET /**< RESTART_DET interrupt */ +#define LL_I2C_INTR_MASK_GEN_CALL I2C_INTR_GEN_CALL /**< GEN_CALL interrupt */ +#define LL_I2C_INTR_MASK_START_DET I2C_INTR_START_DET /**< START_DET interrupt */ +#define LL_I2C_INTR_MASK_STOP_DET I2C_INTR_STOP_DET /**< STOP_DET interrupt */ +#define LL_I2C_INTR_MASK_ACTIVITY I2C_INTR_ACTIVITY /**< ACTIVITY interrupt */ +#define LL_I2C_INTR_MASK_RX_DONE I2C_INTR_RX_DONE /**< RX_DONE interrupt */ +#define LL_I2C_INTR_MASK_TX_ABRT I2C_INTR_TX_ABRT /**< TX_ABRT interrupt */ +#define LL_I2C_INTR_MASK_RD_REQ I2C_INTR_RD_REQ /**< RD_REQ interrupt */ +#define LL_I2C_INTR_MASK_TX_EMPTY I2C_INTR_TX_EMPTY /**< TX_EMPTY interrupt */ +#define LL_I2C_INTR_MASK_TX_OVER I2C_INTR_TX_OVER /**< TX_OVER interrupt */ +#define LL_I2C_INTR_MASK_RX_FULL I2C_INTR_RX_FULL /**< RX_FULL interrupt */ +#define LL_I2C_INTR_MASK_RX_OVER I2C_INTR_RX_OVER /**< RX_OVER interrupt */ +#define LL_I2C_INTR_MASK_RX_UNDER I2C_INTR_RX_UNDER /**< RX_UNDER interrupt */ + +#define LL_I2C_INTR_MASK_ALL 0x00000FFFU /**< All interrupt */ +/** @} */ + +/** @defgroup I2C_LL_EC_ADDRESSING_MODE Master Addressing Mode + * @{ + */ +#define LL_I2C_ADDRESSING_MODE_7BIT 0x00000000U /**< Master operates in 7-bit addressing mode. */ +#define LL_I2C_ADDRESSING_MODE_10BIT I2C_CON_10BITADDR_MST /**< Master operates in 10-bit addressing mode.*/ +/** @} */ + +/** @defgroup I2C_LL_EC_OWNADDRESS Own Address Length + * @{ + */ +#define LL_I2C_OWNADDRESS_7BIT 0x00000000U /**< Own address 1 is a 7-bit address. */ +#define LL_I2C_OWNADDRESS_10BIT I2C_CON_10BITADDR_SLV /**< Own address 1 is a 10-bit address.*/ +/** @} */ + + +/** @defgroup I2C_LL_EC_GENERATE Start And Stop Generation + * @{ + */ +#define LL_I2C_CMD_SLV_NONE 0x00000000U /**< Slave No command. */ +#define LL_I2C_CMD_MST_WRITE 0x00000000U /**< Master write command. */ +#define LL_I2C_CMD_MST_READ I2C_DATA_CMD_CMD /**< Master read command. */ +#define LL_I2C_CMD_MST_GEN_STOP I2C_DATA_CMD_STOP /**< Master issue STOP after this command. */ +#define LL_I2C_CMD_MST_GEN_RESTART I2C_DATA_CMD_RESTART /**< Master issue RESTART before this command. */ +/** @} */ + +/** @defgroup I2C_LL_EC_SPEED_MODE Transfer Speed Mode + * @{ + */ +#define LL_I2C_SPEED_MODE_STANDARD I2C_CON_SPEED_STANDARD /**< Standard Speed mode(0 to 100 Kb/s) of operation. */ +#define LL_I2C_SPEED_MODE_FAST I2C_CON_SPEED_FAST /**< Fast (鈮?400 Kb/s) or Fast Plus mode (鈮?1000 螝b/s) of operation. */ +#define LL_I2C_SPEED_MODE_HIGH I2C_CON_SPEED_HIGH /**< High Speed mode (鈮?3.4 Mb/s) of operation. */ +/** @} */ + +/** @defgroup I2C_LL_EC_SPEED Transfer Speed + * @{ + */ +#define LL_I2C_SPEED_100K (100000ul) /**< Standard Speed. */ +#define LL_I2C_SPEED_400K (400000ul) /**< Fast Speed. */ +#define LL_I2C_SPEED_1000K (1000000ul) /**< Fast Plus Speed. */ +#define LL_I2C_SPEED_2000K (2000000ul) /**< High Speed. */ +/** @} */ + +/** @defgroup I2C_LL_EC_DIRECTION Read Write Direction + * @{ + */ +#define LL_I2C_DIRECTION_NONE 0x00000000U /**< No transfer request by master. */ +#define LL_I2C_DIRECTION_WRITE I2C_INTR_RX_FULL /**< Write transfer request by master, slave enters receiver mode. */ +#define LL_I2C_DIRECTION_READ I2C_INTR_RD_REQ /**< Read transfer request by master, slave enters transmitter mode.*/ +#define LL_I2C_DIRECTION_ERROR I2C_INTR_RX_FULL | I2C_INTR_RD_REQ /**< Transfer request error. */ +/** @} */ + + +/** @defgroup I2C_LL_EC_TX_FIFO_TH TX FIFO Threshold + * @{ + */ +#define LL_I2C_TX_FIFO_TH_EMPTY 0x00000000U /**< TX FIFO empty */ +#define LL_I2C_TX_FIFO_TH_CHAR_1 0x00000001U /**< 1 character in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_2 0x00000002U /**< 2 characters in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_3 0x00000003U /**< 3 characters in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_4 0x00000004U /**< 4 characters in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_5 0x00000005U /**< 5 characters in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_6 0x00000006U /**< 6 characters in TX FIFO */ +#define LL_I2C_TX_FIFO_TH_CHAR_7 0x00000007U /**< 7 characters in TX FIFO */ +/** @} */ + +/** @defgroup I2C_LL_EC_RX_FIFO_TH RX FIFO Threshold + * @{ + */ +#define LL_I2C_RX_FIFO_TH_CHAR_1 0x00000000U /**< 1 character in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_2 0x00000001U /**< 2 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_3 0x00000002U /**< 3 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_4 0x00000003U /**< 4 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_5 0x00000004U /**< 5 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_6 0x00000005U /**< 6 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_CHAR_7 0x00000006U /**< 7 characters in RX FIFO */ +#define LL_I2C_RX_FIFO_TH_FULL 0x00000007U /**< RX FIFO full */ +/** @} */ + +/** @defgroup I2C_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL I2C InitStrcut default configuartion + */ +#define LL_I2C_DEFAULT_CONFIG \ +{ \ + .speed = LL_I2C_SPEED_400K, \ + .own_address = 0x55U, \ + .own_addr_size = LL_I2C_OWNADDRESS_7BIT, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup I2C_LL_Exported_Macros I2C Exported Macros + * @{ + */ + +/** @defgroup I2C_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in I2C register + * @param __instance__ I2C instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None. + */ +#define LL_I2C_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in I2C register + * @param __instance__ I2C instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_I2C_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) +/** @} */ + +/** @defgroup I2C_LL_EM_Exported_Macros_Helper Exported_Macros_Helper + * @{ + */ + +/** + * @brief Compute CLK_SSL_CNT value according to Peripheral Clock and expected Speed. + * @param __PERIPHCLK__ Peripheral Clock frequency used for I2C instance + * @param __SPEED__ Speed value to achieve + * @retval CLK_SSL_CNT value to be used for XS_SCL_HCNT, XS_SCL_LCNT registers where X can be (S, F, H) + */ +#define __LL_I2C_CONVERT_CLK_SSL_CNT(__PERIPHCLK__, __SPEED__) ((__PERIPHCLK__) / 2 / (__SPEED__)) + +/** + * @brief Get Speed Mode according to expected Speed. + * @param __SPEED__ Speed value to achieve + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2C_SPEED_MODE_STANDARD + * @arg @ref LL_I2C_SPEED_MODE_FAST + * @arg @ref LL_I2C_SPEED_MODE_HIGH + */ +#define __LL_I2C_CONVERT_SPEED_MODE(__SPEED__) ((__SPEED__ <= LL_I2C_SPEED_100K) ? LL_I2C_SPEED_MODE_STANDARD : \ + ((__SPEED__ <= LL_I2C_SPEED_1000K) ? LL_I2C_SPEED_MODE_FAST : LL_I2C_SPEED_MODE_HIGH)) +/** @} */ + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup I2C_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup I2C_LL_EF_Configuration Configuration + * @{ + */ + +/** + * @brief Enable I2C peripheral (ENABLE = 1). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->ENABLE, I2C_ENABLE_ENABLE); +} + +/** + * @brief Disable I2C peripheral (ENABLE = 0). + * @note When ENABLE = 0, the TX FIFO and RX FIFO get flushed. + * Status bits in the IC_INTR_STAT register are still active until DW_apb_i2c goes into IDLE state. + * If the module is transmitting, it stops as well as deletes the contents of the transmit buffer + * after the current transfer is complete. If the module is receiving, the DW_apb_i2c stops + * the current transfer at the end of the current byte and does not acknowledge the transfer.. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE | ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->ENABLE, I2C_ENABLE_ENABLE); +} + +/** + * @brief Check if the I2C peripheral is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE_STATUS | IC_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->ENABLE_STATUS, I2C_ENABLE_STATUS_IC_EN) == (I2C_ENABLE_STATUS_IC_EN)); +} + +/** + * @brief Enable I2C master mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | MASTER_ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + * IC_CON | SLAVE_DISABLE + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_master_mode(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->CON, I2C_CON_MST_MODE | I2C_CON_SLV_DIS); +} + +/** + * @brief Disable I2C master mode and enable slave mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | MASTER_ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + * IC_CON | SLAVE_DISABLE + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_master_mode(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->CON, I2C_CON_MST_MODE | I2C_CON_SLV_DIS); +} + +/** + * @brief Check if I2C master mode is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | MASTER_ENABLE | + * +----------------------+-----------------------------------+ + * \endrst + * IC_CON | SLAVE_DISABLE + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_master_mode(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->CON, I2C_CON_MST_MODE | I2C_CON_SLV_DIS) == (I2C_CON_MST_MODE | I2C_CON_SLV_DIS)); +} + +/** + * @brief Enable General Call(slave mode). + * @note When enabled, the Address 0x00 is ACKed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ACK_GENERAL_CALL | ACK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_general_call(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->ACK_GENERAL_CALL, I2C_ACK_GENERAL_CALL_ACK_GC); +} + +/** + * @brief Disable General Call(slave mode). + * @note When disabled, the Address 0x00 is NACKed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ACK_GENERAL_CALL | ACK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_general_call(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->ACK_GENERAL_CALL, I2C_ACK_GENERAL_CALL_ACK_GC); +} + +/** + * @brief Check if General Call is enabled or disabled(slave mode). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ACK_GENERAL_CALL | ACK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_general_call(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->ACK_GENERAL_CALL, I2C_ACK_GENERAL_CALL_ACK_GC) == (I2C_ACK_GENERAL_CALL_ACK_GC)); +} + +/** + * @brief Enable Master Restart. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * This bit determines whether RESTART conditions may be sent when acting as a master. + * Some older slaves do not support handling RESTART conditions. + * When RESTART is disabled, the master is prohibited from performing the following functions: + * - Performing any high-speed mode operation. + * - Performing direction changes in combined format mode. + * - Performing a read operation with a 10-bit address. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_RESTART_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_master_restart(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->CON, I2C_CON_RESTART_EN); +} + +/** + * @brief Disable Master Restart. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_RESTART_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_master_restart(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->CON, I2C_CON_RESTART_EN); +} + +/** + * @brief Check if Master Restart is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_RESTART_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_master_restart(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->CON, I2C_CON_RESTART_EN) == (I2C_CON_RESTART_EN)); +} + +/** + * @brief Enable Slave issues STOP_DET interrupt only if addressed function. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * During a general call address, the slave does not issue the STOP_DET interrupt if + * STOP_DET_IF_ADDRESSED = 1'b1, even if the slave responds to the general call address + * by generating ACK. The STOP_DET interrupt is generated only when the transmitted + * address matches the slave address (SAR). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | STOP_DET_IF_ADDRESSED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_stop_det_if_addressed(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->CON, I2C_CON_STOP_DET_IF_ADDRESSED); +} + +/** + * @brief Disable Slave issues STOP_DET interrupt only if addressed function. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | STOP_DET_IF_ADDRESSED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_stop_det_if_addressed(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->CON, I2C_CON_STOP_DET_IF_ADDRESSED); +} + +/** + * @brief Check if Slave issues STOP_DET interrupt only if addressed function is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | STOP_DET_IF_ADDRESSED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_stop_det_if_addressed(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->CON, I2C_CON_STOP_DET_IF_ADDRESSED) == (I2C_CON_STOP_DET_IF_ADDRESSED)); +} + +/** + * @brief Configure the Master to transfers in 7-bit or 10-bit addressing mode. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_10BITADDR_MST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param addressing_mode This parameter can be one of the following values: + * @arg @ref LL_I2C_ADDRESSING_MODE_7BIT + * @arg @ref LL_I2C_ADDRESSING_MODE_10BIT + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_master_addressing_mode(i2c_regs_t *I2Cx, uint32_t addressing_mode) +{ + MODIFY_REG(I2Cx->CON, I2C_CON_10BITADDR_MST, addressing_mode); +} + +/** + * @brief Get the Master addressing mode. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_10BITADDR_MST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2C_ADDRESSING_MODE_7BIT + * @arg @ref LL_I2C_ADDRESSING_MODE_10BIT + */ +__STATIC_INLINE uint32_t ll_i2c_get_master_addressing_mode(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->CON, I2C_CON_10BITADDR_MST)); +} + +/** + * @brief Set the Own Address. + * @note The register IC_CON and IC_SAR can only be programmed when the I2C is disabled (IC_ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_10BITADDR_SLV | + * +----------------------+-----------------------------------+ + * \endrst + * IC_SAR | SAR + * + * @param I2Cx I2C instance. + * @param own_address This parameter must be a value range between 0 ~ 0x3FF(10-bit mode) or 0 ~ 0x7F(7-bit mode). + * Reserved address 0x00 to 0x07, or 0x78 to 0x7f should not be configured. + * @param own_addr_size This parameter can be one of the following values: + * @arg @ref LL_I2C_OWNADDRESS_7BIT + * @arg @ref LL_I2C_OWNADDRESS_10BIT + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_own_address(i2c_regs_t *I2Cx, uint32_t own_address, uint32_t own_addr_size) +{ + MODIFY_REG(I2Cx->CON, I2C_CON_10BITADDR_SLV, own_addr_size); + WRITE_REG(I2Cx->SAR, own_address); +} + +/** + * @brief Set the SCL clock high-period count for standard speed. + * @note The register IC_SS_SCL_HCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SS_SCL_HCNT | SS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count This parameter must be a value range between 6 ~ 0xFFF5. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_high_period_ss(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->SS_SCL_HCNT, count); +} + +/** + * @brief Get the SCL clock high-period count for standard speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SS_SCL_HCNT | SS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x6 and 0xFFF5. + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_high_period_ss(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->SS_SCL_HCNT, I2C_SS_SCL_HCNT)); +} + +/** + * @brief Set the SCL clock low-period count for standard speed. + * @note The register IC_SS_SCL_LCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SS_SCL_LCNT | SS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count This parameter must be a value range between 0x8 and 0xFFFF. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_low_period_ss(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->SS_SCL_LCNT, count); +} + +/** + * @brief Get the SCL clock low-period count for standard speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SS_SCL_LCNT | SS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x8 and 0xFFFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_low_period_ss(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->SS_SCL_LCNT, I2C_SS_SCL_LCNT)); +} + +/** + * @brief Set the SCL clock high-period count for fast speed. + * @note The register IC_FS_SCL_HCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SCL_HCNT | FS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count range between 0x6 and 0xFFFF. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_high_period_fs(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->FS_SCL_HCNT, count); +} + +/** + * @brief Get the SCL clock high-period count for fast speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SCL_HCNT | FS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x6 and 0xFFFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_high_period_fs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->FS_SCL_HCNT, I2C_FS_SCL_HCNT)); +} + +/** + * @brief Set the SCL clock low-period count for fast speed. + * @note The register IC_FS_SCL_LCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SCL_LCNT | FS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count range between 0x8 and 0xFFFF + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_low_period_fs(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->FS_SCL_LCNT, count); +} + +/** + * @brief Get the SCL clock low-period count for fast speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SCL_LCNT | FS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x8 and 0xFFFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_low_period_fs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->FS_SCL_LCNT, I2C_FS_SCL_LCNT)); +} + +/** + * @brief Get the SCL clock high-period count for high speed. + * @note The register IC_HS_SCL_HCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SCL_HCNT | HS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count range between 0x6 and 0xFFFF, should be larger than IC_HS_SPKLEN + 5. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_high_period_hs(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->HS_SCL_HCNT, count); +} + +/** + * @brief Get the SCL clock high-period count for high speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SCL_HCNT | HS_SCL_HCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval range between 0x6 and 0xFFFF, should be larger than IC_HS_SPKLEN + 7. + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_high_period_hs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->HS_SCL_HCNT, I2C_HS_SCL_HCNT)); +} + +/** + * @brief Get the SCL clock low-period count for high speed. + * @note The register IC_HS_SCL_LCNT can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SCL_LCNT | HS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param count range between 0x8 and 0xFFFF + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_clock_low_period_hs(i2c_regs_t *I2Cx, uint32_t count) +{ + WRITE_REG(I2Cx->HS_SCL_LCNT, count); +} + +/** + * @brief Get the SCL clock low-period count for high speed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SCL_LCNT | HS_SCL_LCNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x8 and 0xFFFF + */ +__STATIC_INLINE uint32_t ll_i2c_get_clock_low_period_hs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->HS_SCL_LCNT, I2C_HS_SCL_LCNT)); +} + +/** + * @brief Set the spike len in fast speed mode. + * @note The register FS_SPKLEN can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SPKLEN | FS_SPKLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param length Spike len. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_spike_len_fs(i2c_regs_t *I2Cx, uint32_t length) +{ + MODIFY_REG(I2Cx->FS_SPKLEN, I2C_FS_SPKLEN_FS_SPKLEN, length); +} + +/** + * @brief Get the spike len in fast speed mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_FS_SPKLEN | FS_SPKLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x2 and 0xFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_spike_len_fs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->FS_SPKLEN, I2C_FS_SPKLEN_FS_SPKLEN)); +} + +/** + * @brief Set the spike len in high speed mode. + * @note The register FS_SPKLEN can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SPKLEN | HS_SPKLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param length Spike len. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_spike_len_hs(i2c_regs_t *I2Cx, uint32_t length) +{ + MODIFY_REG(I2Cx->HS_SPKLEN, I2C_HS_SPKLEN_HS_SPKLEN, length); +} + +/** + * @brief Get the spike len in high speed mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_SPKLEN | HS_SPKLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x2 and 0xFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_spike_len_hs(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->HS_SPKLEN, I2C_HS_SPKLEN_HS_SPKLEN)); +} + +/** + * @brief Set I2C Speed mode. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | SPEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param speed_mode This parameter can be one of the following values: + * @arg @ref LL_I2C_SPEED_MODE_STANDARD + * @arg @ref LL_I2C_SPEED_MODE_FAST + * @arg @ref LL_I2C_SPEED_MODE_HIGH + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_speed_mode(i2c_regs_t *I2Cx, uint32_t speed_mode) +{ + MODIFY_REG(I2Cx->CON, I2C_CON_SPEED, speed_mode); +} + +/** + * @brief Get I2C Speed mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | SPEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value can be one of the following values: + * @arg @ref LL_I2C_SPEED_MODE_STANDARD + * @arg @ref LL_I2C_SPEED_MODE_FAST + * @arg @ref LL_I2C_SPEED_MODE_HIGH + */ +__STATIC_INLINE uint32_t ll_i2c_get_speed_mode(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->CON, I2C_CON_SPEED)); +} + +/** + * @brief Set I2C High Speed Master Code Address. + * @note The register IC_CON can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_MADDR | HS_MAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param code HS mode master code, range between 0x00 and 0x07. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_high_speed_master_code(i2c_regs_t *I2Cx, uint32_t code) +{ + WRITE_REG(I2Cx->HS_MADDR, code); +} + +/** + * @brief Get I2C Speed mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_HS_MADDR | HS_MAR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Returned value range between 0x00 and 0x07. + */ +__STATIC_INLINE uint32_t ll_i2c_get_high_speed_master_code(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->HS_MADDR, I2C_HS_MADDR_HS_MAR)); +} + +/** + * @brief Set the required transmit SDA hold time in units of ic_clk period. + * @note The register IC_SDA_HOLD can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_HOLD | TX_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param time SDA Tx hold time in units of ic_clk period. + * Time should range between 1 and (N_SCL_LOW - 2) in master mode or 7 and (N_SCL_LOW - 2) in slave mode. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_data_tx_hold_time(i2c_regs_t *I2Cx, uint32_t time) +{ + MODIFY_REG(I2Cx->SDA_HOLD, I2C_SDA_HOLD_TX_HOLD, time << I2C_SDA_HOLD_TX_HOLD_Pos); +} + +/** + * @brief Get the required transmit SDA hold time in units of ic_clk period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_HOLD | TX_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 1 and (N_SCL_LOW - 2) in master mode or 7 and (N_SCL_LOW - 2) in slave mode + */ +__STATIC_INLINE uint32_t ll_i2c_get_data_tx_hold_time(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->SDA_HOLD, I2C_SDA_HOLD_TX_HOLD) >> I2C_SDA_HOLD_TX_HOLD_Pos); +} + +/** + * @brief Set the required receive SDA hold time in units of ic_clk period. + * @note The register IC_SDA_HOLD can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_HOLD | RX_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param time SDA Tx hold time in units of ic_clk period. + * Time should range between 1 and (N_SCL_LOW - 2) in master mode or 7 and (N_SCL_LOW - 2) in slave mode. + * @retval Value between Min_Data=0x0 and Max_Data=0xF + */ +__STATIC_INLINE void ll_i2c_set_data_rx_hold_time(i2c_regs_t *I2Cx, uint32_t time) +{ + MODIFY_REG(I2Cx->SDA_HOLD, I2C_SDA_HOLD_RX_HOLD, time << I2C_SDA_HOLD_RX_HOLD_Pos); +} + +/** + * @brief Get the required receive SDA hold time in units of ic_clk period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_HOLD | RX_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 1 and (N_SCL_LOW - 2) in master mode or 7 and (N_SCL_LOW - 2) in slave mode + */ +__STATIC_INLINE uint32_t ll_i2c_get_data_rx_hold_time(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->SDA_HOLD, I2C_SDA_HOLD_RX_HOLD) >> I2C_SDA_HOLD_RX_HOLD_Pos); +} + +/** + * @brief Set the SDA setup time when operating as a slave transmitter. + * @note The register IC_SDA_SETUP can only be programmed when the I2C is disabled (ENABLE = 0). + * The length of setup time is calculated using [(IC_SDA_SETUP - 1) * (ic_clk_period)], so if the + * user requires 10 ic_clk periods of setup time, they should program a value of 11. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_SETUP | SDA_SETUP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param time SDA data setup time in units of ic_clk period, range between 2 ~ 0xFF. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_data_setup_time(i2c_regs_t *I2Cx, uint32_t time) +{ + MODIFY_REG(I2Cx->SDA_SETUP, I2C_SDA_SETUP_SDA_SETUP, time); +} + +/** + * @brief Get the SDA setup time when operating as a slave transmitter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_SDA_SETUP | SDA_SETUP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value range between 0x02 and 0xFF. + */ +__STATIC_INLINE uint32_t ll_i2c_get_data_setup_time(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->SDA_SETUP, I2C_SDA_SETUP_SDA_SETUP)); +} + +/** + * @brief Set threshold of entries (or below) that trigger the TX_EMPTY interrupt + * @note TX FIFO threshold only can be configured after FIFO was enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TX_TL | TX_TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_I2C_TX_FIFO_TH_EMPTY + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_1 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_2 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_3 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_4 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_5 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_6 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_7 + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_tx_fifo_threshold(i2c_regs_t *I2Cx, uint32_t threshold) +{ + WRITE_REG(I2Cx->TX_TL, threshold); +} + +/** + * @brief Get threshold of TX FIFO that triggers an THRE interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TX_TL | TX_TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2C_TX_FIFO_TH_EMPTY + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_1 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_2 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_3 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_4 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_5 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_6 + * @arg @ref LL_I2C_TX_FIFO_TH_CHAR_7 + */ +__STATIC_INLINE uint32_t ll_i2c_get_tx_fifo_threshold(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->TX_TL, I2C_TX_TL_TXTL)); +} + +/** + * @brief Set threshold of RX FIFO that triggers an RDA interrupt + * @note TX FIFO threshold only can be configured after FIFO was enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RX_TL | RX_TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_1 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_2 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_3 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_4 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_5 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_6 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_7 + * @arg @ref LL_I2C_RX_FIFO_TH_FULL + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_rx_fifo_threshold(i2c_regs_t *I2Cx, uint32_t threshold) +{ + WRITE_REG(I2Cx->RX_TL, threshold); +} + +/** + * @brief Get threshold of RX FIFO that triggers an RDA interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RX_TL | RX_TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_1 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_2 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_3 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_4 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_5 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_6 + * @arg @ref LL_I2C_RX_FIFO_TH_CHAR_7 + * @arg @ref LL_I2C_RX_FIFO_TH_FULL + */ +__STATIC_INLINE uint32_t ll_i2c_get_rx_fifo_threshold(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->RX_TL, I2C_RX_TL_RXTL)); +} + +/** + * @brief Get FIFO Transmission Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TXFLR | TXFLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Value range between 0x0 and 0x8. + */ +__STATIC_INLINE uint32_t ll_i2c_get_tx_fifo_level(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->TXFLR, I2C_TXFLR_TXFLR)); +} + +/** + * @brief Get FIFO reception Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RXFLR | RXFLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Value range between 0x0 and 0x8. + */ +__STATIC_INLINE uint32_t ll_i2c_get_rx_fifo_level(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->RXFLR, I2C_RXFLR_RXFLR)); +} + +/** + * @brief Enable DMA reception requests. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE | ABORT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_transfer_abort(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->ENABLE, I2C_ENABLE_ABORT); +} + +/** + * @brief Check if DMA reception requests are enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE | ABORT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_transfer_abort(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->ENABLE, I2C_ENABLE_ABORT) == (I2C_ENABLE_ABORT)); +} + +/** + * @brief Get the transmit abort source. + * @note This can be used to retrieve source of TX_ABRT interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TX_ABRT_SOURCE | ABRT_USER_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * IC_TX_ABRT_SOURCE | ABRT_SLVRD_INTX + * IC_TX_ABRT_SOURCE | ABRT_SLV_ARBLOST + * IC_TX_ABRT_SOURCE | ABRT_SLVFLUSH_TXFIFO + * IC_TX_ABRT_SOURCE | ABRT_ARB_LOST + * IC_TX_ABRT_SOURCE | ABRT_MST_DIS + * IC_TX_ABRT_SOURCE | ABRT_10B_RD_NORSTRT + * IC_TX_ABRT_SOURCE | ABRT_SBYTE_NORSTRT + * IC_TX_ABRT_SOURCE | ABRT_HS_NORSTRT + * IC_TX_ABRT_SOURCE | ABRT_SBYTE_ACKDET + * IC_TX_ABRT_SOURCE | ABRT_HS_ACKDET + * IC_TX_ABRT_SOURCE | ABRT_GCALL_READ + * IC_TX_ABRT_SOURCE | ABRT_GCALL_NOACK + * IC_TX_ABRT_SOURCE | ABRT_TXDATA_NOACK + * IC_TX_ABRT_SOURCE | ABRT_10ADDR2_NOACK + * IC_TX_ABRT_SOURCE | ABRT_10ADDR1_NOACK + * IC_TX_ABRT_SOURCE | ABRT_7B_ADDR_NOACK + * + * @param I2Cx I2C instance + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_I2C_ABRT_USER_ABRT + * @arg @ref LL_I2C_ABRT_SLVRD_INTX + * @arg @ref LL_I2C_ABRT_SLV_ARBLOST + * @arg @ref LL_I2C_ABRT_SLVFLUSH_TXFIFO + * @arg @ref LL_I2C_ABRT_ARB_LOST + * @arg @ref LL_I2C_ABRT_MST_DIS + * @arg @ref LL_I2C_ABRT_10B_RD_NORSTRT + * @arg @ref LL_I2C_ABRT_SBYTE_NORSTRT + * @arg @ref LL_I2C_ABRT_HS_NORSTRT + * @arg @ref LL_I2C_ABRT_SBYTE_ACKDET + * @arg @ref LL_I2C_ABRT_HS_ACKDET + * @arg @ref LL_I2C_ABRT_GCALL_READ + * @arg @ref LL_I2C_ABRT_GCALL_NOACK + * @arg @ref LL_I2C_ABRT_TXDATA_NOACK + * @arg @ref LL_I2C_ABRT_10ADDR2_NOACK + * @arg @ref LL_I2C_ABRT_10ADDR1_NOACK + * @arg @ref LL_I2C_ABRT_7B_ADDR_NOACK + * + * @note @arg @ref LL_I2C_ABRT_TX_FLUSH_CNT can be used as a mask to get the + * number of Tx FIFO Data Commands which are flushed due to TX_ABRT + * interrupt. + */ +__STATIC_INLINE uint32_t ll_i2c_get_abort_source(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_REG(I2Cx->TX_ABRT_SOURCE) & (~I2C_TX_ABRT_SRC_TX_FLUSH_CNT)); +} + +/** + * @brief Get the number of Tx FIFO Data Commands which are flushed due to TX_ABRT interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TX_ABRT_SOURCE | TX_FLUSH_CNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Tx flush count. + */ +__STATIC_INLINE uint32_t ll_i2c_get_tx_flush_count(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->TX_ABRT_SOURCE, I2C_TX_ABRT_SRC_TX_FLUSH_CNT) >> I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Pos); +} + +/** @} */ + +/** @defgroup I2C_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable specified interrupts. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | INTR_MASK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * INTR_MASK | INTR_MASK_START_DET + * INTR_MASK | INTR_MASK_STOP_DET + * INTR_MASK | INTR_MASK_ACTIVITY + * INTR_MASK | INTR_MASK_RX_DONE + * INTR_MASK | INTR_MASK_TX_ABRT + * INTR_MASK | INTR_MASK_RD_REQ + * INTR_MASK | INTR_MASK_TX_EMPTY + * INTR_MASK | INTR_MASK_TX_OVER + * INTR_MASK | INTR_MASK_RX_FULL + * INTR_MASK | INTR_MASK_RX_OVER + * INTR_MASK | INTR_MASK_RX_UNDER + * + * @param I2Cx I2C instance. + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_I2C_INTR_MASK_GEN_CALL + * @arg @ref LL_I2C_INTR_MASK_START_DET + * @arg @ref LL_I2C_INTR_MASK_STOP_DET + * @arg @ref LL_I2C_INTR_MASK_ACTIVITY + * @arg @ref LL_I2C_INTR_MASK_RX_DONE + * @arg @ref LL_I2C_INTR_MASK_TX_ABRT + * @arg @ref LL_I2C_INTR_MASK_RD_REQ + * @arg @ref LL_I2C_INTR_MASK_TX_EMPTY + * @arg @ref LL_I2C_INTR_MASK_TX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_FULL + * @arg @ref LL_I2C_INTR_MASK_RX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_UNDER + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it(i2c_regs_t *I2Cx, uint32_t mask) +{ + SET_BITS(I2Cx->INTR_MASK, mask); +} + +/** + * @brief Disable specified interrupts. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | INTR_MASK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * INTR_MASK | INTR_MASK_START_DET + * INTR_MASK | INTR_MASK_STOP_DET + * INTR_MASK | INTR_MASK_ACTIVITY + * INTR_MASK | INTR_MASK_RX_DONE + * INTR_MASK | INTR_MASK_TX_ABRT + * INTR_MASK | INTR_MASK_RD_REQ + * INTR_MASK | INTR_MASK_TX_EMPTY + * INTR_MASK | INTR_MASK_TX_OVER + * INTR_MASK | INTR_MASK_RX_FULL + * INTR_MASK | INTR_MASK_RX_OVER + * INTR_MASK | INTR_MASK_RX_UNDER + * + * @param I2Cx I2C instance. + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_I2C_INTR_MASK_GEN_CALL + * @arg @ref LL_I2C_INTR_MASK_START_DET + * @arg @ref LL_I2C_INTR_MASK_STOP_DET + * @arg @ref LL_I2C_INTR_MASK_ACTIVITY + * @arg @ref LL_I2C_INTR_MASK_RX_DONE + * @arg @ref LL_I2C_INTR_MASK_TX_ABRT + * @arg @ref LL_I2C_INTR_MASK_RD_REQ + * @arg @ref LL_I2C_INTR_MASK_TX_EMPTY + * @arg @ref LL_I2C_INTR_MASK_TX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_FULL + * @arg @ref LL_I2C_INTR_MASK_RX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_UNDER + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it(i2c_regs_t *I2Cx, uint32_t mask) +{ + CLEAR_BITS(I2Cx->INTR_MASK, mask); +} + +/** + * @brief Check if the specified interrupts are enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | INTR_MASK_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * INTR_MASK | INTR_MASK_START_DET + * INTR_MASK | INTR_MASK_STOP_DET + * INTR_MASK | INTR_MASK_ACTIVITY + * INTR_MASK | INTR_MASK_RX_DONE + * INTR_MASK | INTR_MASK_TX_ABRT + * INTR_MASK | INTR_MASK_RD_REQ + * INTR_MASK | INTR_MASK_TX_EMPTY + * INTR_MASK | INTR_MASK_TX_OVER + * INTR_MASK | INTR_MASK_RX_FULL + * INTR_MASK | INTR_MASK_RX_OVER + * INTR_MASK | INTR_MASK_RX_UNDER + * + * @param I2Cx I2C instance. + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_I2C_INTR_MASK_GEN_CALL + * @arg @ref LL_I2C_INTR_MASK_START_DET + * @arg @ref LL_I2C_INTR_MASK_STOP_DET + * @arg @ref LL_I2C_INTR_MASK_ACTIVITY + * @arg @ref LL_I2C_INTR_MASK_RX_DONE + * @arg @ref LL_I2C_INTR_MASK_TX_ABRT + * @arg @ref LL_I2C_INTR_MASK_RD_REQ + * @arg @ref LL_I2C_INTR_MASK_TX_EMPTY + * @arg @ref LL_I2C_INTR_MASK_TX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_FULL + * @arg @ref LL_I2C_INTR_MASK_RX_OVER + * @arg @ref LL_I2C_INTR_MASK_RX_UNDER + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it(i2c_regs_t *I2Cx, uint32_t mask) +{ + return (READ_BITS(I2Cx->INTR_MASK, mask) == (mask)); +} + +/** + * @brief Enable MASTER_ON_HOLD interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_master_on_hold(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_MST_ON_HOLD); +} + +/** + * @brief Disable MASTER_ON_HOLD interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_master_om_hold(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_MST_ON_HOLD); +} + +/** + * @brief Check if the MASTER_ON_HOLD Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_master_on_hold(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_MST_ON_HOLD) == (I2C_INTR_MST_ON_HOLD)); +} + +/** + * @brief Enable RESTART_DET interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RESTART_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_restart_det(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RESTART_DET); +} + +/** + * @brief Disable RESTART_DET interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RESTART_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_restart_det(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RESTART_DET); +} + +/** + * @brief Check if the RESTART_DET Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RESTART_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_restart_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RESTART_DET) == (I2C_INTR_RESTART_DET)); +} + +/** + * @brief Enable GEN_CALL interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_gen_call(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_GEN_CALL); +} + +/** + * @brief Disable GEN_CALL interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_gen_call(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_GEN_CALL); +} + +/** + * @brief Check if GEN_CALL interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_gen_call(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_GEN_CALL) == (I2C_INTR_GEN_CALL)); +} + +/** + * @brief Enable START_DET received interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_start_det(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_START_DET); +} + +/** + * @brief Disable START_DET received interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_start_det(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_START_DET); +} + +/** + * @brief Check if START_DET received interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_start_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_START_DET) == (I2C_INTR_START_DET)); +} + +/** + * @brief Enable STOP_DET interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_stop_det(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_STOP_DET); +} + +/** + * @brief Disable STOP_DET interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_stop_det(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_STOP_DET); +} + +/** + * @brief Check if STOP_DET interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_stop_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_STOP_DET) == (I2C_INTR_STOP_DET)); +} + +/** + * @brief Enable ACTIVITY interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_activity(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_ACTIVITY); +} + +/** + * @brief Disable ACTIVITY interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_activity(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_ACTIVITY); +} + +/** + * @brief Check if ACTIVITY interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_ACTIVITY) == (I2C_INTR_ACTIVITY)); +} + +/** + * @brief Enable RX_DONE interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE void ll_i2c_enable_it_rx_done(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_DONE); +} + +/** + * @brief Disable RX_DONE interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_rx_done(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_DONE); +} + +/** + * @brief Check if RX_DONE interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enable_it_rx_done(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_DONE) == (I2C_INTR_RX_DONE)); +} + +/** + * @brief Enable TX_ABRT interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_rx_abort(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_ABRT); +} + +/** + * @brief Disable TX_ABRT interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_tx_abort(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_ABRT); +} + +/** + * @brief Check if TX_ABRT interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_tx_abort(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_ABRT) == (I2C_INTR_TX_ABRT)); +} + +/** + * @brief Enable RD_REQ interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_read_req(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RD_REQ); +} + +/** + * @brief Disable RD_REQ interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_read_req(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RD_REQ); +} + +/** + * @brief Check if RD_REQ interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_read_req(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RD_REQ) == (I2C_INTR_RD_REQ)); +} + +/** + * @brief Enable TX_EMPTY interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_tx_empty(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_EMPTY); +} + +/** + * @brief Disable TX_EMPTY interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_tx_empty(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_EMPTY); +} + +/** + * @brief Check if TX_EMPTY interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_tx_empty(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_EMPTY) == (I2C_INTR_TX_EMPTY)); +} + +/** + * @brief Enable TX_OVER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_tx_over(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_OVER); +} + +/** + * @brief Disable TX_OVER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_tx_over(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_OVER); +} + +/** + * @brief Check if TX_OVER interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_tx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_TX_OVER) == (I2C_INTR_TX_OVER)); +} + +/** + * @brief Enable RX_FULL interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_FULL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_rx_full(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_FULL); +} + +/** + * @brief Disable RX_FULL interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_FULL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disbale_it_rx_full(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_FULL); +} + +/** + * @brief Check if RX_FULL interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_FULL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE uint32_t ll_i2c_ls_enabled_it_rx_full(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_FULL) == (I2C_INTR_RX_FULL)); +} + +/** + * @brief Enable RX_OVER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_rx_over(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_OVER); +} + +/** + * @brief Disable RX_OVER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_rx_over(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_OVER); +} + +/** + * @brief Check if RX_OVER interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_rx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_OVER) == (I2C_INTR_RX_OVER)); +} + +/** + * @brief Enable RX_UNDER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_it_rx_under(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_UNDER); +} + +/** + * @brief Disable RX_UNDER interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_it_rx_under(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_UNDER); +} + +/** + * @brief Check if RX_UNDER interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTR_MASK | RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_it_rx_under(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_MASK, I2C_INTR_RX_UNDER) == (I2C_INTR_RX_UNDER)); +} + +/** @} */ + +/** @defgroup I2C_LL_EF_FLAG_management FLAG_management + * @{ + */ + +/** + * @brief Get I2C interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * IC_INTR_STAT | RESTART_DET + * IC_INTR_STAT | GEN_CALL + * IC_INTR_STAT | START_DET + * IC_INTR_STAT | STOP_DET + * IC_INTR_STAT | ACTIVITY + * IC_INTR_STAT | RX_DONE + * IC_INTR_STAT | TX_ABRT + * IC_INTR_STAT | RD_REQ + * IC_INTR_STAT | TX_EMPTY + * IC_INTR_STAT | TX_OVER + * IC_INTR_STAT | RX_FULL + * IC_INTR_STAT | RX_OVER + * IC_INTR_STAT | RX_UNDER + * + * @param I2Cx I2C instance. + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_I2C_INTR_STAT_MST_ON_HOLD + * @arg @ref LL_I2C_INTR_STAT_RESTART_DET + * @arg @ref LL_I2C_INTR_STAT_GEN_CALL + * @arg @ref LL_I2C_INTR_STAT_START_DET + * @arg @ref LL_I2C_INTR_STAT_STOP_DET + * @arg @ref LL_I2C_INTR_STAT_ACTIVITY + * @arg @ref LL_I2C_INTR_STAT_RX_DONE + * @arg @ref LL_I2C_INTR_STAT_TX_ABRT + * @arg @ref LL_I2C_INTR_STAT_RD_REQ + * @arg @ref LL_I2C_INTR_STAT_TX_EMPTY + * @arg @ref LL_I2C_INTR_STAT_TX_OVER + * @arg @ref LL_I2C_INTR_STAT_RX_FULL + * @arg @ref LL_I2C_INTR_STAT_RX_OVER + * @arg @ref LL_I2C_INTR_STAT_RX_UNDER + */ +__STATIC_INLINE uint32_t ll_i2c_get_it_flag(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_REG(I2Cx->INTR_STAT)); +} + +/** + * @brief Get I2C RAW interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * IC_RAW_INTR_STAT | RAW_RESTART_DET + * IC_RAW_INTR_STAT | RAW_GEN_CALL + * IC_RAW_INTR_STAT | RAW_START_DET + * IC_RAW_INTR_STAT | RAW_STOP_DET + * IC_RAW_INTR_STAT | RAW_ACTIVITY + * IC_RAW_INTR_STAT | RAW_RX_DONE + * IC_RAW_INTR_STAT | RAW_TX_ABRT + * IC_RAW_INTR_STAT | RAW_RD_REQ + * IC_RAW_INTR_STAT | RAW_TX_EMPTY + * IC_RAW_INTR_STAT | RAW_TX_OVER + * IC_RAW_INTR_STAT | RAW_RX_FULL + * IC_RAW_INTR_STAT | RAW_RX_OVER + * IC_RAW_INTR_STAT | RAW_RX_UNDER + * + * @param I2Cx I2C instance. + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_I2C_INTR_STAT_MST_ON_HOLD + * @arg @ref LL_I2C_INTR_STAT_RESTART_DET + * @arg @ref LL_I2C_INTR_STAT_GEN_CALL + * @arg @ref LL_I2C_INTR_STAT_START_DET + * @arg @ref LL_I2C_INTR_STAT_STOP_DET + * @arg @ref LL_I2C_INTR_STAT_ACTIVITY + * @arg @ref LL_I2C_INTR_STAT_RX_DONE + * @arg @ref LL_I2C_INTR_STAT_TX_ABRT + * @arg @ref LL_I2C_INTR_STAT_RD_REQ + * @arg @ref LL_I2C_INTR_STAT_TX_EMPTY + * @arg @ref LL_I2C_INTR_STAT_TX_OVER + * @arg @ref LL_I2C_INTR_STAT_RX_FULL + * @arg @ref LL_I2C_INTR_STAT_RX_OVER + * @arg @ref LL_I2C_INTR_STAT_RX_UNDER + */ +__STATIC_INLINE uint32_t ll_i2c_get_raw_it_flag(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_REG(I2Cx->RAW_INTR_STAT)); +} + +/** + * @brief Indicate the status of MST_ON_HOLD flag. + * @note RESET: Clear default value. + * SET : When MST_ON_HOLD interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_INTR_STAT | MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_master_on_hold(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_MST_ON_HOLD) == (I2C_INTR_MST_ON_HOLD)); +} + +/** + * @brief Indicate the status of RAW_MST_ON_HOLD flag. + * @note RESET: Clear default value. + * SET : When unmasked MST_ON_HOLD interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_MST_ON_HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_master_on_hold(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_MST_ON_HOLD) == (I2C_INTR_MST_ON_HOLD)); +} + +/** + * @brief Indicate the status of RESTART_DET flag. + * @note RESET: Clear default value. + * SET : When masked RESTART_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RESTART_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_restart_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RESTART_DET) == (I2C_INTR_RESTART_DET)); +} + +/** + * @brief Indicate the status of RAW_RESTART_DET flag. + * @note RESET: Clear default value. + * SET : When unmasked RESTART_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RESTART_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_restart_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RESTART_DET) == (I2C_INTR_RESTART_DET)); +} + +/** + * @brief Indicate the status of GEN_CALL flag. + * @note RESET: Clear default value. + * SET : When masked GEN_CALL interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_gen_call(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_GEN_CALL) == (I2C_INTR_GEN_CALL)); +} + +/** + * @brief Indicate the status of RAW_GEN_CALL flag. + * @note RESET: Clear default value. + * SET : When unmasked GEN_CALL interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_gen_call(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_GEN_CALL) == (I2C_INTR_GEN_CALL)); +} + +/** + * @brief Indicate the status of START_DET flag. + * @note RESET: Clear default value. + * SET : When masked START_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_start_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_START_DET) == (I2C_INTR_START_DET)); +} + +/** + * @brief Indicate the status of RAW_START_DET flag. + * @note RESET: Clear default value. + * SET : When unmasked START_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_start_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_START_DET) == (I2C_INTR_START_DET)); +} + +/** + * @brief Indicate the status of STOP_DET flag. + * @note RESET: Clear default value. + * SET : When masked STOP_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_stop_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_STOP_DET) == (I2C_INTR_STOP_DET)); +} + +/** + * @brief Indicate the status of RAW_STOP_DET flag. + * @note RESET: Clear default value. + * SET : When unmasked STOP_DET interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_stop_det(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_STOP_DET) == (I2C_INTR_STOP_DET)); +} + +/** + * @brief Indicate the status of ACTIVITY flag. + * @note RESET: Clear default value. + * SET : When masked ACTIVITY interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_ACTIVITY) == (I2C_INTR_ACTIVITY)); +} + +/** + * @brief Indicate the status of RAW_ACTIVITY flag. + * @note RESET: Clear default value. + * SET : When unmasked ACTIVITY interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_ACTIVITY) == (I2C_INTR_ACTIVITY)); +} + +/** + * @brief Indicate the status of RX_DONE flag. + * @note RESET: Clear default value. + * SET : When masked RX_DONE interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_rx_done(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RX_DONE) == (I2C_INTR_RX_DONE)); +} + +/** + * @brief Indicate the status of RAW_RX_DONE flag. + * @note RESET: Clear default value. + * SET : When unmasked RX_DONE interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_rx_done(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RX_DONE) == (I2C_INTR_RX_DONE)); +} + +/** + * @brief Indicate the status of TX_ABRT flag. + * @note RESET: Clear default value. + * SET : When masked TX_ABRT interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_tx_abort(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_TX_ABRT) == (I2C_INTR_TX_ABRT)); +} + +/** + * @brief Indicate the status of RAW_TX_ABRT flag. + * @note RESET: Clear default value. + * SET : When unmasked TX_ABRT interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_tx_abort(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_TX_ABRT) == (I2C_INTR_TX_ABRT)); +} + +/** + * @brief Indicate the status of RD_REQ flag. + * @note RESET: Clear default value. + * SET : When masked RD_REQ interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_read_req(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RD_REQ) == (I2C_INTR_RD_REQ)); +} + +/** + * @brief Indicate the status of RAW_RD_REQ flag. + * @note RESET: Clear default value. + * SET : When unmasked RD_REQ interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_read_req(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RD_REQ) == (I2C_INTR_RD_REQ)); +} + +/** + * @brief Indicate the status of TX_EMPTY flag. + * @note RESET: Clear default value. + * SET : When masked TX_EMPTY interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | TX_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_tx_empty(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_TX_EMPTY) == (I2C_INTR_TX_EMPTY)); +} + +/** + * @brief Indicate the status of RAW_TX_EMPTY flag. + * @note RESET: Clear default value. + * SET : When unmasked TX_EMPTY interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_TX_EMPTY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_tx_empty(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_TX_EMPTY) == (I2C_INTR_TX_EMPTY)); +} + +/** + * @brief Indicate the status of TX_OVER flag. + * @note RESET: Clear default value. + * SET : When masked TX_OVER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_tx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_TX_OVER) == (I2C_INTR_TX_OVER)); +} + +/** + * @brief Indicate the status of RAW_TX_OVER flag. + * @note RESET: Clear default value. + * SET : When unmasked TX_OVER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_tx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_TX_OVER) == (I2C_INTR_TX_OVER)); +} + +/** + * @brief Indicate the status of RX_FULL flag. + * @note RESET: Clear default value. + * SET : When masked RX_FULL interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RX_FULL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_rx_full(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RX_FULL) == (I2C_INTR_RX_FULL)); +} + +/** + * @brief Indicate the status of RAW_RX_FULL flag. + * @note RESET: Clear default value. + * SET : When unmasked RX_FULL interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RX_FULL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_rx_full(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RX_FULL) == (I2C_INTR_RX_FULL)); +} + +/** + * @brief Indicate the status of RX_OVER flag. + * @note RESET: Clear default value. + * SET : When masked RX_OVER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_rx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RX_OVER) == (I2C_INTR_RX_OVER)); +} + +/** + * @brief Indicate the status of RAW_RX_OVER flag. + * @note RESET: Clear default value. + * SET : When unmasked RX_OVER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_rx_over(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RX_OVER) == (I2C_INTR_RX_OVER)); +} + +/** + * @brief Indicate the status of RX_UNDER flag. + * @note RESET: Clear default value. + * SET : When masked RX_UNDER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_INTR_STAT | RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_rx_under(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->INTR_STAT, I2C_INTR_RX_UNDER) == (I2C_INTR_RX_UNDER)); +} + +/** + * @brief Indicate the status of RAW_RX_UNDER flag. + * @note RESET: Clear default value. + * SET : When unmasked RX_UNDER interrupt is actived. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | RAW_RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_raw_rx_under(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RX_UNDER) == (I2C_INTR_RX_UNDER)); +} + +/** + * @brief Clear the combined interrupt, all individual interrupts, and the IC_TX_ABRT_SOURCE register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_INTR | CLR_INTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_intr(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_INTR); + (void) tmpreg; +} + +/** + * @brief Clear GEN_CALL flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_GEN_CALL | CLR_GEN_CALL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_gen_call(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_GEN_CALL); + (void) tmpreg; +} + +/** + * @brief Clear START_DET flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_START_DET | CLR_START_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_start_det(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_START_DET); + (void) tmpreg; +} + +/** + * @brief Clear STOP_DET flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_STOP_DET | CLR_STOP_DET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_stop_det(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_STOP_DET); + (void) tmpreg; +} + +/** + * @brief Clear ACTIVITY flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_ACTIVITY | CLR_ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_activity(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_ACTIVITY); + (void) tmpreg; +} + +/** + * @brief Clear RX_DONE flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_RX_DONE | CLR_RX_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_rx_done(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_RX_DONE); + (void) tmpreg; +} + +/** + * @brief Clear TX_ABRT flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_TX_ABRT | CLR_TX_ABRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_tx_abort(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_TX_ABRT); + (void) tmpreg; +} + +/** + * @brief Clear RD_REQ flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_RD_REQ | CLR_RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_read_req(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_RD_REQ); + (void) tmpreg; +} + +/** + * @brief Clear TX_OVER flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_TX_OVER | CLR_TX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_tx_over(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_TX_OVER); + (void) tmpreg; +} + +/** + * @brief Clear RX_OVER flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_RX_OVER | CLR_RX_OVER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_rx_over(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_RX_OVER); + (void) tmpreg; +} + +/** + * @brief Clear RX_UNDER flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CLR_RX_UNDER | CLR_RX_UNDER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_clear_flag_rx_under(i2c_regs_t *I2Cx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(I2Cx->CLR_RX_UNDER); + (void) tmpreg; +} + +/** + * @brief Indicate the status of IC_STATUS Slave FSM Activity Status flag. + * @note RESET: Slave FSM is in IDLE state. + * SET : When Slave FSM is not in IDLE state. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | SLV_ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_slave_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_SLV_ACTIVITY) == (I2C_STATUS_SLV_ACTIVITY)); +} + +/** + * @brief Indicate the status of IC_STATUS Master FSM Activity Status flag. + * @note RESET: Master FSM is in IDLE state. + * SET : When Master FSM is not in IDLE state. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | MST_ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_master_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_MST_ACTIVITY) == (I2C_STATUS_MST_ACTIVITY)); +} + +/** + * @brief Indicate the status of IC_STATUS Receive FIFO Completely Full flag. + * @note RESET: Receive FIFO is not full. + * SET : When Receive FIFO is full. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | RFF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_rff(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_RFF) == (I2C_STATUS_RFF)); +} + +/** + * @brief Indicate the status of IC_STATUS Receive FIFO Not Empty flag. + * @note RESET: Receive FIFO is empty. + * SET : When Receive FIFO is not empty. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | RFNE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_rfne(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_RFNE) == (I2C_STATUS_RFNE)); +} + +/** + * @brief Indicate the status of IC_STATUS Transmit FIFO Completely Empty flag. + * @note RESET: Transmit FIFO is not empty. + * SET : When Transmit FIFO is empty. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | TFE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_tfe(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_TFE) == (I2C_STATUS_TFE)); +} + +/** + * @brief Indicate the status of IC_STATUS Transmit FIFO Not Full flag. + * @note RESET: Transmit FIFO is full. + * SET : When Transmit FIFO is not full. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | TFNF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_tfnf(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_TFNF) == (I2C_STATUS_TFNF)); +} + +/** + * @brief Indicate the status of IC_STATUS ACTIVITY flag. + * @note RESET: I2C is idle. + * SET : When I2C is active. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_STATUS | ACTIVITY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_status_activity(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->STATUS, I2C_STATUS_ACTIVITY) == (I2C_STATUS_ACTIVITY)); +} + +/** + * @brief Indicate the status of Slave Received Data Lost flag. + * @note RESET: Slave RX Data is not lost. + * SET : Slave RX Data is lost. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE_STATUS | SLV_RX_LOST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_slave_rx_data_lost(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->ENABLE_STATUS, I2C_ENABLE_STATUS_SLV_RX_LOST) == (I2C_ENABLE_STATUS_SLV_RX_LOST)); +} + +/** + * @brief Indicate the status of Slave Disabled While Busy flag. + * @note RESET: Slave is disabled when it is idle. + * SET : Slave is disabled when it is active. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_ENABLE_STATUS | SLV_DIS_WHL_BUSY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_active_flag_slave_dis_whl_busy(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->ENABLE_STATUS, I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY) == (I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY)); +} +/** @} */ + +/** @defgroup I2C_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Enable DMA transmission requests. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Value range between 0 ~ 0x8. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_dma_req_tx(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->DMA_CR, I2C_DMA_CR_TDMAE); +} + +/** + * @brief Disable DMA transmission requests. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_dma_req_tx(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->DMA_CR, I2C_DMA_CR_TDMAE); +} + +/** + * @brief Check if DMA transmission requests are enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_dma_req_tx(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->DMA_CR, I2C_DMA_CR_TDMAE) == (I2C_DMA_CR_TDMAE)); +} + +/** + * @brief Enable DMA reception requests. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_enable_dma_req_rx(i2c_regs_t *I2Cx) +{ + SET_BITS(I2Cx->DMA_CR, I2C_DMA_CR_RDMAE); +} + +/** + * @brief Disable DMA reception requests. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_disable_dma_req_rx(i2c_regs_t *I2Cx) +{ + CLEAR_BITS(I2Cx->DMA_CR, I2C_DMA_CR_RDMAE); +} + +/** + * @brief Check if DMA reception requests are enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_CR | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2c_is_enabled_dma_req_rx(i2c_regs_t *I2Cx) +{ + return (READ_BITS(I2Cx->DMA_CR, I2C_DMA_CR_RDMAE) == (I2C_DMA_CR_RDMAE)); +} + +/** + * @brief Set level of TX FIFO that requests a DMA transmit. + * @note TX data level should equal to the watermark level, that is, the dma_tx_req + * signal is generated when the number of valid data entries in the transmit + * FIFO is equal to or below this field value, and TDMAE = 1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_TDLR | DMATDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @param level This parameter should range between 0x0 and 0x8. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_dma_tx_data_level(i2c_regs_t *I2Cx, uint32_t level) +{ + WRITE_REG(I2Cx->DMA_TDLR, level); +} + +/** + * @brief Get level of TX FIFO that request a DMA transmit. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_TDLR | DMATDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Returned value should range between 0x0 and 0x8. + */ +__STATIC_INLINE uint32_t ll_i2c_get_dma_tx_data_level(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->DMA_TDLR, I2C_DMA_TDLR_DMATDL)); +} + +/** + * @brief Set level of RX FIFO that requests a DMA receive. + * @note The watermark level = DMARDL + 1, that is, dma_rx_req is generated when + * the number of valid data entries in the receive FIFO is equal to or + * more than this field value + 1, and RDMAE = 1. For instance, when DMARDL + * is 0, then dma_rx_req is asserted when 1 or more data entries are present + * in the receive FIFO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_RDLR | DMARDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @param level This parameter should range between 0x0 and 0x8. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_dma_rx_data_level(i2c_regs_t *I2Cx, uint32_t level) +{ + WRITE_REG(I2Cx->DMA_RDLR, level); +} + +/** + * @brief Get level of RX FIFO that request a DMA receive. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DMA_RDLR | DMARDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Returned value should range between 0x0 and 0x8. + */ +__STATIC_INLINE uint32_t ll_i2c_get_dma_rx_data_level(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->DMA_RDLR, I2C_DMA_RDLR_DMARDL)); +} + +/** + * @brief Get the data register address used for DMA transfer + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DATA_CMD | DAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance + * @retval Address of data register + */ +__STATIC_INLINE uint32_t ll_i2c_dma_get_register_address(i2c_regs_t *I2Cx) +{ + return ((uint32_t) & (I2Cx->DATA_CMD)); +} + +/** @} */ + +/** @defgroup I2C_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Configure the slave address for transfer (master mode). + * @note The register IC_TAR can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TAR | TAR_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @param slave_addr This parameter must be a value between 0x00 and 0x3F. + * @retval None. + */ +__STATIC_INLINE void ll_i2c_set_slave_address(i2c_regs_t *I2Cx, uint32_t slave_addr) +{ + MODIFY_REG(I2Cx->TAR, I2C_TAR_ADDR, slave_addr << I2C_TAR_ADDR_Pos); +} + +/** + * @brief Get the slave address programmed for transfer (master mode). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_TAR | TAR_ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value between 0x0 and0x3F + */ +__STATIC_INLINE uint32_t ll_i2c_get_slave_address(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->TAR, I2C_TAR_ADDR) >> I2C_TAR_ADDR_Pos); +} + +/** + * @brief Handles I2Cx communication when starting transfer or during transfer (TC or TCR flag are set). + * @note The register IC_CON and IC_TAR can only be programmed when the I2C is disabled (ENABLE = 0). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_CON | CON_10BITADDR_MST | + * +----------------------+-----------------------------------+ + * \endrst + * IC_TAR | TAR_ADDR + * + * @param I2Cx I2C instance. + * @param slave_addr Specifies the slave address to be programmed. + * @param slave_addr_size This parameter can be one of the following values: + * @arg @ref LL_I2C_ADDRESSING_MODE_7BIT + * @arg @ref LL_I2C_ADDRESSING_MODE_10BIT + * @note SlaveAddrSize in IC_CON register can only be programmed when the I2C is disabled (IC_ENABLE = 0). + * @retval None. + */ +__STATIC_INLINE void ll_i2c_handle_transfer(i2c_regs_t *I2Cx, uint32_t slave_addr, uint32_t slave_addr_size) +{ + MODIFY_REG(I2Cx->TAR, I2C_TAR_ADDR, slave_addr << I2C_TAR_ADDR_Pos); + ll_i2c_set_master_addressing_mode(I2Cx, slave_addr_size); +} + +/** + * @brief Indicate the value of transfer direction (slave mode). + * @note RESET: Write transfer, Slave enters in receiver mode. + * SET: Read transfer, Slave enters in transmitter mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_RAW_INTR_STAT | INTR_RD_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * IC_RAW_INTR_STAT | INTR_RX_FULL + * + * @param I2Cx I2C instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_I2C_DIRECTION_WRITE + * @arg @ref LL_I2C_DIRECTION_READ + */ +__STATIC_INLINE uint32_t ll_i2c_get_transfer_direction(i2c_regs_t *I2Cx) +{ + return (uint32_t)(READ_BITS(I2Cx->RAW_INTR_STAT, I2C_INTR_RD_REQ | I2C_INTR_RX_FULL)); +} + +/** + * @brief Read Receive Data register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DATA_CMD | DAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Cx I2C instance. + * @retval Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t ll_i2c_receive_data8(i2c_regs_t *I2Cx) +{ + return (uint8_t)(READ_BITS(I2Cx->DATA_CMD, I2C_DATA_CMD_DAT)); +} + +/** + * @brief Write in Transmit Data Register . + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IC_DATA_CMD | STOP | + * +----------------------+-----------------------------------+ + * \endrst + * IC_DATA_CMD | CMD + * IC_DATA_CMD | DAT + * + * @param I2Cx I2C instance. + * @param data Value range between 0x00 and 0xFF. + * @param cmd This parameter can be one of the following values: + * @arg @ref LL_I2C_CMD_SLV_NONE + * @arg @ref LL_I2C_CMD_MST_WRITE + * @arg @ref LL_I2C_CMD_MST_READ + * @arg @ref LL_I2C_CMD_MST_GEN_STOP + * @arg @ref LL_I2C_CMD_MST_GEN_RESTART + * @retval None. + */ +__STATIC_INLINE void ll_i2c_transmit_data8(i2c_regs_t *I2Cx, uint8_t data, uint32_t cmd) +{ + WRITE_REG(I2Cx->DATA_CMD, data | cmd); +} + +/** @} */ + +/** @defgroup I2C_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize I2C registers (Registers restored to their default values). + * @param I2Cx I2C instance + * @retval An error_status_t enumeration value: + * - SUCCESS: I2C registers are de-initialized + * - ERROR: I2C registers are not de-initialized + */ +error_status_t ll_i2c_deinit(i2c_regs_t *I2Cx); + +/** + * @brief Initialize I2C registers according to the specified + * parameters in p_i2c_init. + * @param I2Cx I2C instance + * @param p_i2c_init Pointer to a ll_i2c_init_t structure that contains the configuration + * information for the specified I2C peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: I2C registers are initialized according to p_i2c_init content + * - ERROR: Problem occurred during I2C Registers initialization + */ +error_status_t ll_i2c_init(i2c_regs_t *I2Cx, ll_i2c_init_t *p_i2c_init); + +/** + * @brief Set each field of a @ref ll_i2c_init_t type structure to default value. + * @param p_i2c_init Pointer to a @ref ll_i2c_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_i2c_struct_init(ll_i2c_init_t *p_i2c_init); + +/** @} */ + +/** @} */ + +#endif /* I2C0 || I2C1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_I2C_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2s.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2s.h new file mode 100644 index 0000000..c076bd8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_i2s.h @@ -0,0 +1,1906 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_i2s.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of I2S LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_I2S I2S + * @brief I2S LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_I2S_H__ +#define __GR55xx_LL_I2S_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (I2S_M) || defined (I2S_S) + +/** @defgroup LL_I2S_DRIVER_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup I2S_LL_ES_INIT I2S Exported init structure + * @{ + */ + +/** + * @brief LL I2S init structures definition + */ +typedef struct _ll_i2s_init_t +{ + uint32_t rxdata_size; /**< Specifies the I2S receive data size. + This parameter can be a value of @ref I2S_LL_EC_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_rxsize().*/ + + uint32_t txdata_size; /**< Specifies the I2S transmit data size. + This parameter can be a value of @ref I2S_LL_EC_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_txsize().*/ + + uint32_t rx_threshold; /**< Specifies the I2S receive FIFO threshold. + This parameter can be a value of @ref I2S_LL_EC_FIFO_THRESHOLD. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_rx_fifo_threshold().*/ + + uint32_t tx_threshold; /**< Specifies the I2S transmit FIFO threshold. + This parameter can be a value of @ref I2S_LL_EC_FIFO_THRESHOLD. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_tx_fifo_threshold().*/ + + uint32_t clock_source; /**< Specifies the source of the I2S clock. + This parameter can be a value of @ref I2S_LL_EC_CLOCK_SOURCE. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_clock_src().*/ + + uint32_t audio_freq; /**< Specifies the frequency selected for the I2S communication. + + This feature can be modified afterwards using unitary function @ref ll_i2s_set_clock_div().*/ + +} ll_i2s_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup I2S_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup I2S_LL_Exported_Constants I2S Exported Constants + * @{ + */ + +/** @defgroup I2S_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags definitions which can be used with LL_I2S_ReadReg function + * @{ + */ +#define LL_I2S_STATUS_TXFO I2S_INTSTAT_TXFO /**< TX FIFO write overflow flag */ +#define LL_I2S_STATUS_TXFE I2S_INTSTAT_TXFE /**< TX FIFO threshold level is not reached flag */ +#define LL_I2S_STATUS_RXFO I2S_INTSTAT_RXFO /**< RX FIFO receive overflow flag */ +#define LL_I2S_STATUS_RXDA I2S_INTSTAT_RXDA /**< RX FIFO threshold level is reached flag */ +/** @} */ + +/** @defgroup I2S_LL_EC_INTERRUPT Interrupt Defines + * @brief Interrupt definitions which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions + * @{ + */ +#define LL_I2S_INT_TXFO I2S_INTMASK_TXFO /**< TX FIFO write overflow interrupt */ +#define LL_I2S_INT_TXFE I2S_INTMASK_TXFE /**< TX FIFO threshold level is not reached interrupt */ +#define LL_I2S_INT_RXFO I2S_INTMASK_RXFO /**< RX FIFO receive overflow interrupt */ +#define LL_I2S_INT_RXDA I2S_INTMASK_RXDA /**< RX FIFO threshold level is reached interrupt */ +/** @} */ + +/** @defgroup I2S_LL_EC_CLOCK_SOURCE I2S Clock Source + * @{ + */ +#define LL_I2S_CLOCK_SRC_96M (0x00000000UL) /**< I2S clock source select: 96M */ +#define LL_I2S_CLOCK_SRC_32M (1UL << 18) /**< I2S clock source select: 32M */ +/** @} */ + +/** @defgroup I2S_LL_EC_DATASIZE Transfer Data width + * @{ + */ +#define LL_I2S_DATASIZE_IGNORE (0x00000000UL) /**< Data size for I2S transfer: 32 bits */ +#define LL_I2S_DATASIZE_12BIT (1UL << I2S_RXSIZE_WLEN_Pos) /**< Data size for I2S transfer: 12 bits */ +#define LL_I2S_DATASIZE_16BIT (2UL << I2S_RXSIZE_WLEN_Pos) /**< Data size for I2S transfer: 16 bits */ +#define LL_I2S_DATASIZE_20BIT (3UL << I2S_RXSIZE_WLEN_Pos) /**< Data size for I2S transfer: 20 bits */ +#define LL_I2S_DATASIZE_24BIT (4UL << I2S_RXSIZE_WLEN_Pos) /**< Data size for I2S transfer: 24 bits */ +#define LL_I2S_DATASIZE_32BIT (5UL << I2S_RXSIZE_WLEN_Pos) /**< Data size for I2S transfer: 32 bits */ +/** @} */ + +/** @defgroup I2S_LL_EC_TRANSFER_MODE Transfer Mode + * @{ + */ +#define LL_I2S_SIMPLEX_TX (1UL) /**< Simplex TX mode. */ +#define LL_I2S_SIMPLEX_RX (2UL) /**< Simplex RX mode. */ +#define LL_I2S_FULL_DUPLEX (3UL) /**< Full-Duplex mode. */ +/** @} */ + +/** @defgroup I2S_LL_EC_FIFO_THRESHOLD FIFO Threshold + * @{ + */ +#define LL_I2S_THRESHOLD_1FIFO (0x00000000UL) /**< Trigger level for FIFO: 1 depth. */ +#define LL_I2S_THRESHOLD_2FIFO (1UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 2 depth. */ +#define LL_I2S_THRESHOLD_3FIFO (2UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 3 depth. */ +#define LL_I2S_THRESHOLD_4FIFO (3UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 4 depth. */ +#define LL_I2S_THRESHOLD_5FIFO (4UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 5 depth. */ +#define LL_I2S_THRESHOLD_6FIFO (5UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 6 depth. */ +#define LL_I2S_THRESHOLD_7FIFO (6UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 7 depth. */ +#define LL_I2S_THRESHOLD_8FIFO (7UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 8 depth. */ +#define LL_I2S_THRESHOLD_9FIFO (8UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 9 depth. */ +#define LL_I2S_THRESHOLD_10FIFO (9UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 10 depth. */ +#define LL_I2S_THRESHOLD_11FIFO (10UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 11 depth. */ +#define LL_I2S_THRESHOLD_12FIFO (11UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 12 depth. */ +#define LL_I2S_THRESHOLD_13FIFO (12UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 13 depth. */ +#define LL_I2S_THRESHOLD_14FIFO (13UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 14 depth. */ +#define LL_I2S_THRESHOLD_15FIFO (14UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 15 depth. */ +#define LL_I2S_THRESHOLD_16FIFO (15UL << I2S_RXFIFO_TL_Pos) /**< Trigger level for FIFO: 16 depth. */ +/** @} */ + +/** @defgroup I2S_LL_EC_WS_CYCLES Word Select Line Cycles + * @{ + */ +#define LL_I2S_WS_CYCLES_16 (0x00000000UL) /**< 16 SCLK cycles in word select line. */ +#define LL_I2S_WS_CYCLES_24 (0x1UL << I2S_CLKCONFIG_WSS_Pos) /**< 24 SCLK cycles in word select line. */ +#define LL_I2S_WS_CYCLES_32 (0x2UL << I2S_CLKCONFIG_WSS_Pos) /**< 32 SCLK cycles in word select line. */ +/** @} */ + +/** @defgroup I2S_LL_EC_SCLK_GATE SCLK Gate + * @{ + */ +#define LL_I2S_SCLKG_NONE (0x00000000UL) /**< Clock gating is disabled. */ +#define LL_I2S_SCLKG_CYCLES_12 (0x1UL << I2S_CLKCONFIG_SCLKG_Pos) /**< Gating after 12 sclk cycles. */ +#define LL_I2S_SCLKG_CYCLES_16 (0x2UL << I2S_CLKCONFIG_SCLKG_Pos) /**< Gating after 16 sclk cycles. */ +#define LL_I2S_SCLKG_CYCLES_20 (0x3UL << I2S_CLKCONFIG_SCLKG_Pos) /**< Gating after 20 sclk cycles. */ +#define LL_I2S_SCLKG_CYCLES_24 (0x4UL << I2S_CLKCONFIG_SCLKG_Pos) /**< Gating after 24 sclk cycles. */ +/** @} */ + +/** @defgroup I2S_LL_EC_RESOLUTION RX/TX resolution of one channel + * @{ + */ +#define LL_I2S_RESOLUTION_12BIT (0UL) /**< 12 bits resolution. */ +#define LL_I2S_RESOLUTION_16BIT (1UL) /**< 16 bits resolution. */ +#define LL_I2S_RESOLUTION_20BIT (2UL) /**< 20 bits resolution. */ +#define LL_I2S_RESOLUTION_24BIT (3UL) /**< 24 bits resolution. */ +#define LL_I2S_RESOLUTION_32BIT (4UL) /**< 32 bits resolution. */ +/** @} */ + +/** @defgroup I2S_LL_EC_CHANNELS the number of RX/TX channels + * @{ + */ +#define LL_I2S_CHANNEL_NUM_1 (0UL) /**< 1 channel. */ +#define LL_I2S_CHANNEL_NUM_2 (1UL) /**< 2 channels. */ +#define LL_I2S_CHANNEL_NUM_3 (2UL) /**< 3 channels. */ +#define LL_I2S_CHANNEL_NUM_4 (3UL) /**< 4 channels. */ +/** @} */ + +/** @defgroup I2S_LL_EC_FIFO_DEPTH RX/TX FIFO depth + * @{ + */ +#define LL_I2S_FIFO_DEPTH_2 (0UL) /**< FIFO depth is 2 . */ +#define LL_I2S_FIFO_DEPTH_4 (1UL) /**< FIFO depth is 4 . */ +#define LL_I2S_FIFO_DEPTH_8 (2UL) /**< FIFO depth is 8 . */ +#define LL_I2S_FIFO_DEPTH_16 (3UL) /**< FIFO depth is 16. */ +/** @} */ + +/** @defgroup I2S_LL_EC_APB_WIDTH APB data width + * @{ + */ +#define LL_I2S_APB_WIDTH_8BIT (0UL) /**< 8 bits APB data width. */ +#define LL_I2S_APB_WIDTH_16BIT (1UL) /**< 16 bits APB data width. */ +#define LL_I2S_APB_WIDTH_32BIT (2UL) /**< 32 bits APB data width. */ +/** @} */ + +/** @} */ + +/** @defgroup I2S_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL I2S InitStrcut default configuartion + */ +#define LL_I2S_DEFAULT_CONFIG \ +{ \ + .rxdata_size = LL_I2S_DATASIZE_16BIT, \ + .txdata_size = LL_I2S_DATASIZE_16BIT, \ + .rx_threshold = LL_I2S_THRESHOLD_1FIFO, \ + .tx_threshold = LL_I2S_THRESHOLD_9FIFO, \ + .clock_source = LL_I2S_CLOCK_SRC_32M, \ + .audio_freq = 48000 \ +} + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup I2S_LL_Exported_Macros I2S Exported Macros + * @{ + */ + +/** @defgroup I2S_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in I2S register + * @param __instance__ I2S instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_I2S_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in I2S register + * @param __instance__ I2S instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_I2S_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup I2S_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup I2S_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable I2S + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | ENABLE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable(i2s_regs_t *I2Sx) +{ + SET_BITS(I2Sx->ENABLE, I2S_ENABLE_EN); +} + +/** + * @brief Disable I2S + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | ENABLE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable(i2s_regs_t *I2Sx) +{ + CLEAR_BITS(I2Sx->ENABLE, I2S_ENABLE_EN); +} + +/** + * @brief Check if I2S is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | ENABLE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled(i2s_regs_t *I2Sx) +{ + return (READ_BITS(I2Sx->ENABLE, I2S_ENABLE_EN) == (I2S_ENABLE_EN)); +} + +/** + * @brief Enable I2S RX block + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_rxblock(i2s_regs_t *I2Sx) +{ + SET_BITS(I2Sx->RBEN, I2S_RBEN_EN); +} + +/** + * @brief Disable I2S RX block + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_rxblock(i2s_regs_t *I2Sx) +{ + CLEAR_BITS(I2Sx->RBEN, I2S_RBEN_EN); +} + +/** + * @brief Check if I2S RX block is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_rxblock(i2s_regs_t *I2Sx) +{ + return (READ_BITS(I2Sx->RBEN, I2S_RBEN_EN) == (I2S_RBEN_EN)); +} + +/** + * @brief Enable I2S TX block + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_txblock(i2s_regs_t *I2Sx) +{ + SET_BITS(I2Sx->TBEN, I2S_TBEN_EN); +} + +/** + * @brief Disable I2S TX block + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_txblock(i2s_regs_t *I2Sx) +{ + CLEAR_BITS(I2Sx->TBEN, I2S_TBEN_EN); +} + +/** + * @brief Check if I2S TX block is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TBEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_txblock(i2s_regs_t *I2Sx) +{ + return (READ_BITS(I2Sx->TBEN, I2S_TBEN_EN) == (I2S_TBEN_EN)); +} + +/** + * @brief Enable I2S clock + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_clock(i2s_regs_t *I2Sx) +{ + SET_BITS(I2Sx->CLKEN, I2S_CLKEN_EN); +} + +/** + * @brief Disable I2S clock + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_clock(i2s_regs_t *I2Sx) +{ + CLEAR_BITS(I2Sx->CLKEN, I2S_CLKEN_EN); +} + +/** + * @brief Check if I2S clock is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_clock(i2s_regs_t *I2Sx) +{ + return (READ_BITS(I2Sx->CLKEN, I2S_CLKEN_EN) == (I2S_CLKEN_EN)); +} + +/** + * @brief Set word select line cycles for left or right sample + * @note This bit should be written only when I2S is disabled (I2S_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKCONFIG | WSS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param cycles This parameter can be one of the following values: + * @arg @ref LL_I2S_WS_CYCLES_16 + * @arg @ref LL_I2S_WS_CYCLES_24 + * @arg @ref LL_I2S_WS_CYCLES_32 + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_wss(i2s_regs_t *I2Sx, uint32_t cycles) +{ + MODIFY_REG(I2Sx->CLKCONFIG, I2S_CLKCONFIG_WSS, cycles); +} + +/** + * @brief Get word select line cycles for left or right sample + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKCONFIG | WSS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_WS_CYCLES_16 + * @arg @ref LL_I2S_WS_CYCLES_24 + * @arg @ref LL_I2S_WS_CYCLES_32 + */ +__STATIC_INLINE uint32_t ll_i2s_get_wss(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->CLKCONFIG, I2S_CLKCONFIG_WSS)); +} + +/** + * @brief Set the gating of sclk + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKCONFIG | SCLKG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param cycles This parameter can be one of the following values: + * @arg @ref LL_I2S_SCLKG_NONE + * @arg @ref LL_I2S_SCLKG_CYCLES_12 + * @arg @ref LL_I2S_SCLKG_CYCLES_16 + * @arg @ref LL_I2S_SCLKG_CYCLES_20 + * @arg @ref LL_I2S_SCLKG_CYCLES_24 + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_sclkg(i2s_regs_t *I2Sx, uint32_t cycles) +{ + MODIFY_REG(I2Sx->CLKCONFIG, I2S_CLKCONFIG_SCLKG, cycles); +} + +/** + * @brief Get the gating of sclk + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLKCONFIG | SCLKG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_SCLKG_NONE + * @arg @ref LL_I2S_SCLKG_CYCLES_12 + * @arg @ref LL_I2S_SCLKG_CYCLES_16 + * @arg @ref LL_I2S_SCLKG_CYCLES_20 + * @arg @ref LL_I2S_SCLKG_CYCLES_24 + */ +__STATIC_INLINE uint32_t ll_i2s_get_sclkg(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->CLKCONFIG, I2S_CLKCONFIG_SCLKG)); +} + +/** + * @brief Clear I2S RX FIFO in all channels + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFIFO_RST | RST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_clr_rxfifo_all(i2s_regs_t *I2Sx) +{ + WRITE_REG(I2Sx->RXFIFO_RST, I2S_RXFIFO_RST); +} + +/** + * @brief Clear I2S TX FIFO in all channels + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFIFO_RST | RST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_clr_txfifo_all(i2s_regs_t *I2Sx) +{ + WRITE_REG(I2Sx->TXFIFO_RST, I2S_TXFIFO_RST); +} + +/** + * @brief Set I2S clock divider + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param div This parameter can between: 0 ~ 0xFFF + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_clock_div(uint32_t div) +{ + MODIFY_REG(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_DIV_CNT, div); +} + +/** + * @brief Get I2S clock divider + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned Value can between: 0 ~ 0xFFF + */ +__STATIC_INLINE uint32_t ll_i2s_get_clock_div(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_DIV_CNT)); +} + +/** + * @brief Enable I2S clock divider + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | DIV_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_clock_div(void) +{ + SET_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN); +} + +/** + * @brief Disable I2S clock divider + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | DIV_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_clock_div(void) +{ + CLEAR_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN); +} + +/** + * @brief Check if I2S clock divider is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | DIV_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_clock_div(void) +{ + return (READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN) == (MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN)); +} + +/** + * @brief Set I2S clock source + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | SRC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param src This parameter can be one of the following values: + * @arg @ref LL_I2S_CLOCK_SRC_96M + * @arg @ref LL_I2S_CLOCK_SRC_32M + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_clock_src(uint32_t src) +{ + MODIFY_REG(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL, src); +} + +/** + * @brief Get I2S clock source + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_CLK_CFG | SRC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_CLOCK_SRC_96M + * @arg @ref LL_I2S_CLOCK_SRC_32M + */ +__STATIC_INLINE uint32_t ll_i2s_get_clock_src(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->I2S_CLK_CFG, MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL)); +} + +/** @} */ + +/** @defgroup I2S_LL_EF_Channel Channel Configuration functions + * @{ + */ + +/** + * @brief Read one data from left RX FIFO in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_L | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE uint32_t ll_i2s_receive_ldata(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_REG(I2Sx->I2S_CHANNEL[channel].DATA_L)); +} + +/** + * @brief Read one data from right RX FIFO in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_R | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE uint32_t ll_i2s_receive_rdata(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_REG(I2Sx->I2S_CHANNEL[channel].DATA_R)); +} + +/** + * @brief Write one data to left TX FIFO in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_L | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param data The data to send + * @retval None + */ +__STATIC_INLINE void ll_i2s_transmit_ldata(i2s_regs_t *I2Sx, uint8_t channel, uint32_t data) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].DATA_L, data); +} + +/** + * @brief Write one data to right TX FIFO in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_R | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param data The data to send + * @retval None + */ +__STATIC_INLINE void ll_i2s_transmit_rdata(i2s_regs_t *I2Sx, uint8_t channel, uint32_t data) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].DATA_R, data); +} + +/** + * @brief Enable RX in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_rx(i2s_regs_t *I2Sx, uint8_t channel) +{ + SET_BITS(I2Sx->I2S_CHANNEL[channel].RXEN, I2S_RXEN_EN); +} + +/** + * @brief Disable RX in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_rx(i2s_regs_t *I2Sx, uint8_t channel) +{ + CLEAR_BITS(I2Sx->I2S_CHANNEL[channel].RXEN, I2S_RXEN_EN); +} + +/** + * @brief Check if RX in a channel is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_rx(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (READ_BITS(I2Sx->I2S_CHANNEL[channel].RXEN, I2S_RXEN_EN) != (I2S_RXEN_EN)); +} + +/** + * @brief Enable TX in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_tx(i2s_regs_t *I2Sx, uint8_t channel) +{ + SET_BITS(I2Sx->I2S_CHANNEL[channel].TXEN, I2S_TXEN_EN); +} + +/** + * @brief Disable TX in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_tx(i2s_regs_t *I2Sx, uint8_t channel) +{ + CLEAR_BITS(I2Sx->I2S_CHANNEL[channel].TXEN, I2S_TXEN_EN); +} + +/** + * @brief Check if TX in a channel is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_tx(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (READ_BITS(I2Sx->I2S_CHANNEL[channel].TXEN, I2S_TXEN_EN) != (I2S_TXEN_EN)); +} + +/** + * @brief Set receive data width in a channel + * @note These bits should not be changed when channel is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXSIZE | WLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param size This parameter can be one of the following values: + * @arg @ref LL_I2S_DATASIZE_IGNORE + * @arg @ref LL_I2S_DATASIZE_12BIT + * @arg @ref LL_I2S_DATASIZE_16BIT + * @arg @ref LL_I2S_DATASIZE_20BIT + * @arg @ref LL_I2S_DATASIZE_24BIT + * @arg @ref LL_I2S_DATASIZE_32BIT + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_rxsize(i2s_regs_t *I2Sx, uint8_t channel, uint32_t size) +{ + MODIFY_REG(I2Sx->I2S_CHANNEL[channel].RXSIZE, I2S_RXSIZE_WLEN, size); +} + +/** + * @brief Get receive data width in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXSIZE | WLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_DATASIZE_IGNORE + * @arg @ref LL_I2S_DATASIZE_12BIT + * @arg @ref LL_I2S_DATASIZE_16BIT + * @arg @ref LL_I2S_DATASIZE_20BIT + * @arg @ref LL_I2S_DATASIZE_24BIT + * @arg @ref LL_I2S_DATASIZE_32BIT + */ +__STATIC_INLINE uint32_t ll_i2s_get_rxsize(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].RXSIZE, I2S_RXSIZE_WLEN)); +} + +/** + * @brief Set transmit data width in a channel + * @note These bits should not be changed when channel is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXSIZE | WLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param size This parameter can be one of the following values: + * @arg @ref LL_I2S_DATASIZE_IGNORE + * @arg @ref LL_I2S_DATASIZE_12BIT + * @arg @ref LL_I2S_DATASIZE_16BIT + * @arg @ref LL_I2S_DATASIZE_20BIT + * @arg @ref LL_I2S_DATASIZE_24BIT + * @arg @ref LL_I2S_DATASIZE_32BIT + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_txsize(i2s_regs_t *I2Sx, uint8_t channel, uint32_t size) +{ + MODIFY_REG(I2Sx->I2S_CHANNEL[channel].TXSIZE, I2S_TXSIZE_WLEN, size); +} + +/** + * @brief Get transmit data width in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXSIZE | WLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_DATASIZE_IGNORE + * @arg @ref LL_I2S_DATASIZE_12BIT + * @arg @ref LL_I2S_DATASIZE_16BIT + * @arg @ref LL_I2S_DATASIZE_20BIT + * @arg @ref LL_I2S_DATASIZE_24BIT + * @arg @ref LL_I2S_DATASIZE_32BIT + */ +__STATIC_INLINE uint32_t ll_i2s_get_txsize(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].TXSIZE, I2S_TXSIZE_WLEN)); +} + +/** + * @brief Get interrupt flag in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | TXFO | + * +----------------------+-----------------------------------+ + * \endrst + * INTSTAT | TXFE + * INTSTAT | RXFO + * INTSTAT | RXDA + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one or more of the following values: + * @arg @ref LL_I2S_STATUS_TXFO + * @arg @ref LL_I2S_STATUS_TXFE + * @arg @ref LL_I2S_STATUS_RXFO + * @arg @ref LL_I2S_STATUS_RXDA + */ +__STATIC_INLINE uint32_t ll_i2s_get_it_flag(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].INTSTAT, I2S_INTSTAT_TXFO | I2S_INTSTAT_TXFE | \ + I2S_INTSTAT_RXFO | I2S_INTSTAT_RXDA)); +} + +/** + * @brief Check interrupt flag in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | TXFO | + * +----------------------+-----------------------------------+ + * \endrst + * INTSTAT | TXFE + * INTSTAT | RXFO + * INTSTAT | RXDA + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param flag This parameter can be one or more of the following values: + * @arg @ref LL_I2S_STATUS_TXFO + * @arg @ref LL_I2S_STATUS_TXFE + * @arg @ref LL_I2S_STATUS_RXFO + * @arg @ref LL_I2S_STATUS_RXDA + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_active_it_flag(i2s_regs_t *I2Sx, uint8_t channel, uint32_t flag) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].INTSTAT, flag) == flag); +} + +/** + * @brief Enable interrupt in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | TXFO | + * +----------------------+-----------------------------------+ + * \endrst + * INTMASK | TXFE + * INTMASK | RXFO + * INTMASK | RXDA + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param mask This parameter can be one or more of the following values: + * @arg @ref LL_I2S_INT_TXFO + * @arg @ref LL_I2S_INT_TXFE + * @arg @ref LL_I2S_INT_RXFO + * @arg @ref LL_I2S_INT_RXDA + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_it(i2s_regs_t *I2Sx, uint8_t channel, uint32_t mask) +{ + CLEAR_BITS(I2Sx->I2S_CHANNEL[channel].INTMASK, mask); +} + +/** + * @brief Disable interrupt in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | TXFO | + * +----------------------+-----------------------------------+ + * \endrst + * INTMASK | TXFE + * INTMASK | RXFO + * INTMASK | RXDA + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param mask This parameter can be one or more of the following values: + * @arg @ref LL_I2S_INT_TXFO + * @arg @ref LL_I2S_INT_TXFE + * @arg @ref LL_I2S_INT_RXFO + * @arg @ref LL_I2S_INT_RXDA + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_it(i2s_regs_t *I2Sx, uint8_t channel, uint32_t mask) +{ + SET_BITS(I2Sx->I2S_CHANNEL[channel].INTMASK, mask); +} + +/** + * @brief Check if interrupt in a channel is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | TXFO | + * +----------------------+-----------------------------------+ + * \endrst + * INTMASK | TXFE + * INTMASK | RXFO + * INTMASK | RXDA + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param mask This parameter can be one or more of the following values: + * @arg @ref LL_I2S_INT_TXFO + * @arg @ref LL_I2S_INT_TXFE + * @arg @ref LL_I2S_INT_RXFO + * @arg @ref LL_I2S_INT_RXDA + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_it(i2s_regs_t *I2Sx, uint8_t channel, uint32_t mask) +{ + return ((READ_BITS(I2Sx->I2S_CHANNEL[channel].INTMASK, mask) ^ (mask)) == (mask)); +} + +/** + * @brief Clear RX FIFO data overrun interrupt flag in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXOVR | RXCHO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_clear_it_rxovr(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (READ_BITS(I2Sx->I2S_CHANNEL[channel].RXOVR, I2S_RXOVR_RXCHO)); +} + +/** + * @brief Clear TX FIFO data overrun interrupt flag in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXOVR | TXCHO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_clear_it_txovr(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (READ_BITS(I2Sx->I2S_CHANNEL[channel].TXOVR, I2S_TXOVR_TXCHO)); +} + +/** + * @brief Set threshold of RXFIFO in a channel that triggers an RXDA event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFIFO_TL | TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_I2S_THRESHOLD_1FIFO + * @arg @ref LL_I2S_THRESHOLD_2FIFO + * @arg @ref LL_I2S_THRESHOLD_3FIFO + * @arg @ref LL_I2S_THRESHOLD_4FIFO + * @arg @ref LL_I2S_THRESHOLD_5FIFO + * @arg @ref LL_I2S_THRESHOLD_6FIFO + * @arg @ref LL_I2S_THRESHOLD_7FIFO + * @arg @ref LL_I2S_THRESHOLD_8FIFO + * @arg @ref LL_I2S_THRESHOLD_9FIFO + * @arg @ref LL_I2S_THRESHOLD_10FIFO + * @arg @ref LL_I2S_THRESHOLD_11FIFO + * @arg @ref LL_I2S_THRESHOLD_12FIFO + * @arg @ref LL_I2S_THRESHOLD_13FIFO + * @arg @ref LL_I2S_THRESHOLD_14FIFO + * @arg @ref LL_I2S_THRESHOLD_15FIFO + * @arg @ref LL_I2S_THRESHOLD_16FIFO + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_rx_fifo_threshold(i2s_regs_t *I2Sx, uint8_t channel, uint32_t threshold) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].RXFIFO_TL, threshold); +} + +/** + * @brief Get threshold of RXFIFO in a channel that triggers an RXDA event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFIFO_TL | TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_THRESHOLD_1FIFO + * @arg @ref LL_I2S_THRESHOLD_2FIFO + * @arg @ref LL_I2S_THRESHOLD_3FIFO + * @arg @ref LL_I2S_THRESHOLD_4FIFO + * @arg @ref LL_I2S_THRESHOLD_5FIFO + * @arg @ref LL_I2S_THRESHOLD_6FIFO + * @arg @ref LL_I2S_THRESHOLD_7FIFO + * @arg @ref LL_I2S_THRESHOLD_8FIFO + * @arg @ref LL_I2S_THRESHOLD_9FIFO + * @arg @ref LL_I2S_THRESHOLD_10FIFO + * @arg @ref LL_I2S_THRESHOLD_11FIFO + * @arg @ref LL_I2S_THRESHOLD_12FIFO + * @arg @ref LL_I2S_THRESHOLD_13FIFO + * @arg @ref LL_I2S_THRESHOLD_14FIFO + * @arg @ref LL_I2S_THRESHOLD_15FIFO + * @arg @ref LL_I2S_THRESHOLD_16FIFO + */ +__STATIC_INLINE uint32_t ll_i2s_get_rx_fifo_threshold(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].RXFIFO_TL, I2S_RXFIFO_TL)); +} + +/** + * @brief Set threshold of TXFIFO in a channel that triggers an TXFE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFIFO_TL | TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_I2S_THRESHOLD_1FIFO + * @arg @ref LL_I2S_THRESHOLD_2FIFO + * @arg @ref LL_I2S_THRESHOLD_3FIFO + * @arg @ref LL_I2S_THRESHOLD_4FIFO + * @arg @ref LL_I2S_THRESHOLD_5FIFO + * @arg @ref LL_I2S_THRESHOLD_6FIFO + * @arg @ref LL_I2S_THRESHOLD_7FIFO + * @arg @ref LL_I2S_THRESHOLD_8FIFO + * @arg @ref LL_I2S_THRESHOLD_9FIFO + * @arg @ref LL_I2S_THRESHOLD_10FIFO + * @arg @ref LL_I2S_THRESHOLD_11FIFO + * @arg @ref LL_I2S_THRESHOLD_12FIFO + * @arg @ref LL_I2S_THRESHOLD_13FIFO + * @arg @ref LL_I2S_THRESHOLD_14FIFO + * @arg @ref LL_I2S_THRESHOLD_15FIFO + * @arg @ref LL_I2S_THRESHOLD_16FIFO + * @retval None + */ +__STATIC_INLINE void ll_i2s_set_tx_fifo_threshold(i2s_regs_t *I2Sx, uint8_t channel, uint32_t threshold) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].TXFIFO_TL, threshold); +} + +/** + * @brief Get threshold of TXFIFO in a channel that triggers an TXFE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFIFO_TL | TL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_THRESHOLD_1FIFO + * @arg @ref LL_I2S_THRESHOLD_2FIFO + * @arg @ref LL_I2S_THRESHOLD_3FIFO + * @arg @ref LL_I2S_THRESHOLD_4FIFO + * @arg @ref LL_I2S_THRESHOLD_5FIFO + * @arg @ref LL_I2S_THRESHOLD_6FIFO + * @arg @ref LL_I2S_THRESHOLD_7FIFO + * @arg @ref LL_I2S_THRESHOLD_8FIFO + * @arg @ref LL_I2S_THRESHOLD_9FIFO + * @arg @ref LL_I2S_THRESHOLD_10FIFO + * @arg @ref LL_I2S_THRESHOLD_11FIFO + * @arg @ref LL_I2S_THRESHOLD_12FIFO + * @arg @ref LL_I2S_THRESHOLD_13FIFO + * @arg @ref LL_I2S_THRESHOLD_14FIFO + * @arg @ref LL_I2S_THRESHOLD_15FIFO + * @arg @ref LL_I2S_THRESHOLD_16FIFO + */ +__STATIC_INLINE uint32_t ll_i2s_get_tx_fifo_threshold(i2s_regs_t *I2Sx, uint8_t channel) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_CHANNEL[channel].TXFIFO_TL, I2S_TXFIFO_TL)); +} + +/** + * @brief Clear RX FIFO data in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFIFO_FLUSH | FLUSH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_clr_rxfifo_channel(i2s_regs_t *I2Sx, uint8_t channel) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].RXFIFO_FLUSH, I2S_RXFIFO_FLUSH); +} + +/** + * @brief Clear TX FIFO data in a channel + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFIFO_FLUSH | FLUSH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval None + */ +__STATIC_INLINE void ll_i2s_clr_txfifo_channel(i2s_regs_t *I2Sx, uint8_t channel) +{ + WRITE_REG(I2Sx->I2S_CHANNEL[channel].TXFIFO_FLUSH, I2S_TXFIFO_FLUSH); +} + +/** @} */ + +/** @defgroup I2S_LL_EF_DMA_Management DMA Management Functions + * @{ + */ + +/** + * @brief Reset RX block DMA + * @note The RX DMA can be reset to the lowest channel via this register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXDMA_RST | RST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_rst_rxdma(i2s_regs_t *I2Sx) +{ + WRITE_REG(I2Sx->RXDMA_RST, I2S_RXDMA_RST); +} + +/** + * @brief Reset TX block DMA + * @note The TX DMA can be reset to the lowest channel via this register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXDMA_RST | RST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_rst_txdma(i2s_regs_t *I2Sx) +{ + WRITE_REG(I2Sx->TXDMA_RST, I2S_TXDMA_RST); +} + + +/** + * @brief Enable I2S DMA + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMA_ACC_SEL | QSPI1_I2S_M_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * DMA_ACC_SEL | I2C1_I2S_S_SEL + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_enable_dma(i2s_regs_t *I2Sx) +{ + if (I2S_M == I2Sx) + SET_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM); + else + SET_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_I2C1_I2SS); +} + +/** + * @brief Disable I2S DMA + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMA_ACC_SEL | QSPI1_I2S_M_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * DMA_ACC_SEL | I2C1_I2S_S_SEL + * + * @param I2Sx I2S instance + * @retval None + */ +__STATIC_INLINE void ll_i2s_disable_dma(i2s_regs_t *I2Sx) +{ + if (I2S_M == I2Sx) + CLEAR_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM); + else + CLEAR_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_I2C1_I2SS); +} + +/** + * @brief Check if I2S DMA is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMA_ACC_SEL | QSPI1_I2S_M_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * DMA_ACC_SEL | I2C1_I2S_S_SEL + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_is_enabled_dma(i2s_regs_t *I2Sx) +{ + if (I2S_M == I2Sx) + return (READ_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM) == MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM); + else + return (READ_BITS(MCU_SUB->DMA_ACC_SEL, MCU_SUB_DMA_ACC_SEL_I2C1_I2SS) == MCU_SUB_DMA_ACC_SEL_I2C1_I2SS); +} + + +/** @} */ + +/** @defgroup I2S_LL_EF_Component Component Paraments Functions + * @{ + */ + +/** + * @brief Get I2S component paramenters: rx resolution + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM2 | RXSIZE_3 | + * +----------------------+-----------------------------------+ + * \endrst + * I2S_PARAM2 | RXSIZE_2 + * I2S_PARAM2 | RXSIZE_1 + * I2S_PARAM2 | RXSIZE_0 + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_RESOLUTION_12BIT + * @arg @ref LL_I2S_RESOLUTION_16BIT + * @arg @ref LL_I2S_RESOLUTION_20BIT + * @arg @ref LL_I2S_RESOLUTION_24BIT + * @arg @ref LL_I2S_RESOLUTION_32BIT + */ +__STATIC_INLINE uint32_t ll_i2s_get_rx_resolution(i2s_regs_t *I2Sx, uint8_t channel) +{ + uint32_t pos[4] = {I2S_PARAM2_RXSIZE_0_Pos, I2S_PARAM2_RXSIZE_1_Pos, \ + I2S_PARAM2_RXSIZE_2_Pos, I2S_PARAM2_RXSIZE_3_Pos + }; + uint32_t mask[4] = {I2S_PARAM2_RXSIZE_0, I2S_PARAM2_RXSIZE_1, I2S_PARAM2_RXSIZE_2, I2S_PARAM2_RXSIZE_3}; + + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM2, mask[channel]) >> pos[channel]); +} + +/** + * @brief Get I2S component paramenters: tx resolution + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | TXSIZE_3 | + * +----------------------+-----------------------------------+ + * \endrst + * I2S_PARAM1 | TXSIZE_2 + * I2S_PARAM1 | TXSIZE_1 + * I2S_PARAM1 | TXSIZE_0 + * + * @param I2Sx I2S instance + * @param channel The special channel: 0 ~ 3 + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_RESOLUTION_12BIT + * @arg @ref LL_I2S_RESOLUTION_16BIT + * @arg @ref LL_I2S_RESOLUTION_20BIT + * @arg @ref LL_I2S_RESOLUTION_24BIT + * @arg @ref LL_I2S_RESOLUTION_32BIT + */ +__STATIC_INLINE uint32_t ll_i2s_get_tx_resolution(i2s_regs_t *I2Sx, uint8_t channel) +{ + uint32_t pos[4] = {I2S_PARAM1_TXSIZE_0_Pos, I2S_PARAM1_TXSIZE_1_Pos, \ + I2S_PARAM1_TXSIZE_2_Pos, I2S_PARAM1_TXSIZE_3_Pos + }; + uint32_t mask[4] = {I2S_PARAM1_TXSIZE_0, I2S_PARAM1_TXSIZE_1, I2S_PARAM1_TXSIZE_2, I2S_PARAM1_TXSIZE_3}; + + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, mask[channel]) >> pos[channel]); +} + +/** + * @brief Get I2S component paramenters: the number of tx channels + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | TXCHN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_CHANNEL_NUM_1 + * @arg @ref LL_I2S_CHANNEL_NUM_2 + * @arg @ref LL_I2S_CHANNEL_NUM_3 + * @arg @ref LL_I2S_CHANNEL_NUM_4 + */ +__STATIC_INLINE uint32_t ll_i2s_get_tx_channels(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_TXCHN) >> I2S_PARAM1_TXCHN_Pos); +} + +/** + * @brief Get I2S component paramenters: the number of rx channels + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | RXCHN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_CHANNEL_NUM_1 + * @arg @ref LL_I2S_CHANNEL_NUM_2 + * @arg @ref LL_I2S_CHANNEL_NUM_3 + * @arg @ref LL_I2S_CHANNEL_NUM_4 + */ +__STATIC_INLINE uint32_t ll_i2s_get_rx_channels(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_RXCHN) >> I2S_PARAM1_RXCHN_Pos); +} + +/** + * @brief Get I2S component paramenters: whether the receiver block is enabled or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | RXBLOCK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_get_rx_block(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_RXBLOCK) == I2S_PARAM1_RXBLOCK); +} + +/** + * @brief Get I2S component paramenters: whether the transmitter block is enabled or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | TXBLOCK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_get_tx_block(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_TXBLOCK) == I2S_PARAM1_TXBLOCK); +} + +/** + * @brief Get I2S component paramenters: whether the master mode is enabled or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_i2s_get_master_mode(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_MODE) == I2S_PARAM1_MODE); +} + +/** + * @brief Get I2S component paramenters: FIOF depth + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | FIFO_DEPTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_FIFO_DEPTH_2 + * @arg @ref LL_I2S_FIFO_DEPTH_4 + * @arg @ref LL_I2S_FIFO_DEPTH_8 + * @arg @ref LL_I2S_FIFO_DEPTH_16 + */ +__STATIC_INLINE uint32_t ll_i2s_get_fifo_depth(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_FIFO_DEPTH) >> I2S_PARAM1_FIFO_DEPTH_Pos); +} + +/** + * @brief Get I2S component paramenters: APB data width + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_PARAM1 | APB_DATA_WIDTH | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_I2S_APB_WIDTH_8BIT + * @arg @ref LL_I2S_APB_WIDTH_16BIT + * @arg @ref LL_I2S_APB_WIDTH_32BIT + */ +__STATIC_INLINE uint32_t ll_i2s_get_apb_width(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_BITS(I2Sx->I2S_PARAM1, I2S_PARAM1_APB_DATA_WIDTH) >> I2S_PARAM1_APB_DATA_WIDTH_Pos); +} + +/** + * @brief Get I2S component version + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_VERSION | VERSION | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value is const. + */ +__STATIC_INLINE uint32_t ll_i2s_get_version(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_REG(I2Sx->I2S_VERSION)); +} + +/** + * @brief Get I2S component type + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | I2S_TYPE | TYPE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param I2Sx I2S instance + * @retval Returned Value is const. + */ +__STATIC_INLINE uint32_t ll_i2s_get_type(i2s_regs_t *I2Sx) +{ + return (uint32_t)(READ_REG(I2Sx->I2S_TYPE)); +} + +/** @} */ + +/** @defgroup I2S_LL_EF_Init I2S_M Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize I2S registers (Registers restored to their default values). + * @param I2Sx I2S instance + * @retval An error_status_t enumeration value: + * - SUCCESS: I2S registers are de-initialized + * - ERROR: I2S registers are not de-initialized + */ +error_status_t ll_i2s_deinit(i2s_regs_t *I2Sx); + +/** + * @brief Initialize I2S_M registers according to the specified + * parameters in p_i2s_init. + * @param I2Sx I2S instance + * @param p_i2s_init Pointer to a ll_i2s_init_t structure that contains the configuration + * information for the specified I2S_M peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: I2S registers are initialized according to p_i2s_init content + * - ERROR: Problem occurred during I2S Registers initialization + */ +error_status_t ll_i2s_init(i2s_regs_t *I2Sx, ll_i2s_init_t *p_i2s_init); + +/** + * @brief Set each field of a @ref ll_i2s_init_t type structure to default value. + * @param p_i2s_init Pointer to a @ref ll_i2s_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_i2s_struct_init(ll_i2s_init_t *p_i2s_init); + +/** @} */ + +/** @} */ + +#endif /* I2S_M || I2S_S */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_I2S_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_iso7816.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_iso7816.h new file mode 100644 index 0000000..00975e3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_iso7816.h @@ -0,0 +1,1435 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_iso7816.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of ISO7816 LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_ISO7816 ISO7816 + * @brief ISO7816 LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_ISO7816_H__ +#define __GR55xx_LL_ISO7816_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (ISO7816) +/** @defgroup ISO7816_LL_STRUCTURES Structures + * @{ + */ +/* Exported types ------------------------------------------------------------*/ +/** @defgroup ISO7816_LL_ES_INIT ISO7816 Exported init structure + * @{ + */ +/** + * @brief ISO7816_LL_init_structure LL ISO7816 init Structure definition + */ +typedef struct _ll_iso7816_init +{ + uint32_t clk_div; /*!< clk_div is used for dividing the system clock, + and ISO7816 output clock is equal to (system clock)/(clk_div+1).*/ + uint32_t wait_time; /*!< Specifies the guard time value in terms of number of baud clocks */ + uint16_t guard_time; /*!< Specifies the maximum card response time (leading edge to leading edge) */ + uint8_t detect_coding; /*!< Specifies whether automatically detect coding convention during ATR receiption. */ +} ll_iso7816_init_t; +/** @} */ +/** @} */ + +/** + * @defgroup ISO7816_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup ISO7816_LL_Exported_Constants ISO7816 Exported Constants + * @{ + */ + +/** @defgroup ISO7816_LL_EC_ACTION Action state. + * @{ + */ +#define LL_ISO7816_ACTION_NONE 0x00000000U /**< Do Nothing. */ +#define LL_ISO7816_ACTION_OFF 0x00000001U /**< Switch Off. */ +#define LL_ISO7816_ACTION_STOPCLK 0x00000002U /**< Stop the clock. */ +#define LL_ISO7816_ACTION_ON 0x00000003U /**< Switch on and receive ATR. */ +#define LL_ISO7816_ACTION_WARMRST 0x00000004U /**< Trigger warm reset and receive ATR.*/ +#define LL_ISO7816_ACTION_RX 0x00000005U /**< Receive. */ +#define LL_ISO7816_ACTION_TX 0x00000006U /**< Transmit. */ +#define LL_ISO7816_ACTION_TXRX 0x00000007U /**< Transmit, followed by RX. */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_IT IT Defines + * @brief Interrupt definitions which can be used with LL_ISO7816_ReadReg and LL_ISO7816_WriteReg functions + * @{ + */ +#define LL_ISO7816_INTR_TEST ISO7816_STAT_IRQ_TEST /**< Test interrupt */ +#define LL_ISO7816_INTR_PRESENCE ISO7816_STAT_IRQ_PRESENCE /**< Source presence interrupt */ +#define LL_ISO7816_INTR_STATE_ERR ISO7816_STAT_IRQ_STAT_ERR /**< Source state error interrupt */ +#define LL_ISO7816_INTR_DMA_ERR ISO7816_STAT_IRQ_DMA_ERR /**< Source dma error interrupt */ +#define LL_ISO7816_INTR_RETRY_ERR ISO7816_STAT_IRQ_RETRY_ERR /**< Source retry error interrupt */ +#define LL_ISO7816_INTR_RX_ERR ISO7816_STAT_IRQ_RX_ERR /**< Source rx error interrupt */ +#define LL_ISO7816_INTR_DONE ISO7816_STAT_IRQ_DONE /**< Source done error interrupt */ + +#define LL_ISO7816_INTR_MASK_ALL ISO7816_INTR_ALL /**< All interrupt */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_PRESENCE Card Presence Defines + * @{ + */ +#define LL_ISO7816_CARD_ABSENT 0x00000000U /**< SIM Card is absent. */ +#define LL_ISO7816_CARD_PRESENT 0x00000001U /**< SIM Card is present. */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_IO_STATES IO States Defines + * @{ + */ +#define LL_ISO7816_IO_STATE_OFF (0x0UL << ISO7816_STAT_IO_STAT_POS) /**< Off */ +#define LL_ISO7816_IO_STATE_IDLE (0x1UL << ISO7816_STAT_IO_STAT_POS) /**< Idle */ +#define LL_ISO7816_IO_STATE_RX_WAIT (0x4UL << ISO7816_STAT_IO_STAT_POS) /**< Receive Wait */ +#define LL_ISO7816_IO_STATE_RX (0x5UL << ISO7816_STAT_IO_STAT_POS) /**< Receive */ +#define LL_ISO7816_IO_STATE_TX (0x6UL << ISO7816_STAT_IO_STAT_POS) /**< Transmit */ +#define LL_ISO7816_IO_STATE_TX_GUARD (0x7UL << ISO7816_STAT_IO_STAT_POS) /**< Transmit Guard */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_PWR_STATES Power States Defines + * @{ + */ +#define LL_ISO7816_PWR_STATE_OFF (0x0UL << ISO7816_STAT_PWR_STAT_POS) /**< Off */ +#define LL_ISO7816_PWR_STATE_PWRUP_VCC (0x1UL << ISO7816_STAT_PWR_STAT_POS) /**< Power up VCC */ +#define LL_ISO7816_PWR_STATE_PWRUP_RST (0x2UL << ISO7816_STAT_PWR_STAT_POS) /**< Power up reset */ +#define LL_ISO7816_PWR_STATE_PWRDN_RST (0x3UL << ISO7816_STAT_PWR_STAT_POS) /**< Power Down reset */ +#define LL_ISO7816_PWR_STATE_PWRDN_VCC (0x4UL << ISO7816_STAT_PWR_STAT_POS) /**< Power Down VCC */ +#define LL_ISO7816_PWR_STATE_STOP_PRE (0x5UL << ISO7816_STAT_PWR_STAT_POS) /**< Preparing Clock Stop */ +#define LL_ISO7816_PWR_STATE_STOP (0x6UL << ISO7816_STAT_PWR_STAT_POS) /**< Clock Stopped */ +#define LL_ISO7816_PWR_STATE_STOP_POST (0x7UL << ISO7816_STAT_PWR_STAT_POS) /**< Exiting Clock Stop */ +#define LL_ISO7816_PWR_STATE_IDLE (0x8UL << ISO7816_STAT_PWR_STAT_POS) /**< Idle */ +#define LL_ISO7816_PWR_STATE_RX_TS0 (0x9UL << ISO7816_STAT_PWR_STAT_POS) /**< RX TS Character */ +#define LL_ISO7816_PWR_STATE_RX_TS1 (0xAUL << ISO7816_STAT_PWR_STAT_POS) /**< RX TS Character */ +#define LL_ISO7816_PWR_STATE_RX (0xBUL << ISO7816_STAT_PWR_STAT_POS) /**< Receive */ +#define LL_ISO7816_PWR_STATE_TX (0xCUL << ISO7816_STAT_PWR_STAT_POS) /**< Transmit */ +#define LL_ISO7816_PWR_STATE_TX_RX (0xDUL << ISO7816_STAT_PWR_STAT_POS) /**< Transmit and Receive */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_CLKSTOP Clock Stop Select Defines + * @{ + */ +#define LL_ISO7816_CLKSTOP_LOW (0x00000000UL) /**< Stop the clock at low level. */ +#define LL_ISO7816_CLKSTOP_HIGH (0x80000000UL) /**< Stop the clock at high level. */ +/** @} */ + +/** @defgroup ISO7816_LL_EC_CODING Coding Convention Defines + * @{ + */ +#define LL_ISO7816_CODING_DEFAULT (0x00000000UL) /**< High=1, LSB first. */ +#define LL_ISO7816_CODING_INVERSE (0x00000001UL) /**< High=0, MSB first. */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup ISO7816_LL_Exported_Macros ISO7816 Exported Macros + * @{ + */ + +/** @defgroup ISO7816_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in ISO7816 register + * @param __instance__ ISO7816 instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None. + */ +#define LL_ISO7816_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in ISO7816 register + * @param __instance__ ISO7816 instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_ISO7816_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/* Exported functions --------------------------------------------------------*/ +/** @defgroup ISO7816_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup ISO7816_LL_EF_Configuration Configuration + * @{ + */ +/** + * @brief Request ISO7816 to go to the next action. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ACTION | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @param action This parameter can be one of the following values: + * @arg @ref LL_ISO7816_ACTION_NONE + * @arg @ref LL_ISO7816_ACTION_OFF + * @arg @ref LL_ISO7816_ACTION_STOPCLK + * @arg @ref LL_ISO7816_ACTION_ON + * @arg @ref LL_ISO7816_ACTION_WARMRST + * @arg @ref LL_ISO7816_ACTION_RX + * @arg @ref LL_ISO7816_ACTION_TX + * @arg @ref LL_ISO7816_ACTION_TXRX + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_action(iso7816_regs_t *ISO7816x, uint32_t action) +{ + WRITE_REG(ISO7816x->CTRL, action); +} + + +/** + * @brief Get ISO7816 states. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | ACTION | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval ISO7816 states + */ +__STATIC_INLINE uint32_t ll_iso7816_is_busy(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_BUSY) == (ISO7816_STAT_BUSY)); +} + +/** + * @brief Clear Transmit Retries Maximum. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | TX_RETRY_MAX_CLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_tx_retry_max(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_TX_RETYR_MC); +} + +/** + * @brief Clear Receive Retries Maximum. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RX_RETRY_MAX_CLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_rx_retry_max(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_RX_RETYR_MC); +} + +/** + * @brief Check Card presence. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | PRESENCE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_ISO7816_CARD_ABSENT + * @arg @ref LL_ISO7816_CARD_PRESENT + */ +__STATIC_INLINE uint32_t ll_iso7816_check_card_presence(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->STAT, ISO7816_STAT_PRESENCE_STAT) >> ISO7816_STAT_PRESENCE_STAT_POS); +} + +/** + * @brief Get Maximum number of seen transmit retries after error signaling by ISO7816. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | TX_RETRY_MAX | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Value range between 0x1 and 0x7. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_tx_retry_max(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->STAT, ISO7816_STAT_TX_RETRY_MAX) >> ISO7816_STAT_RX_RETRY_MAX_POS); +} + +/** + * @brief Get Maximum number of seen receive retries after error signaling by ISO7816. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | RX_RETRY_MAX | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Value range between 0x1 and 0x7. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_rx_retry_max(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->STAT, ISO7816_STAT_RX_RETRY_MAX) >> ISO7816_STAT_RX_RETRY_MAX_POS); +} + +/** + * @brief Get ISO7816 IO States. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | IO_STATE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_ISO7816_IO_STATE_OFF + * @arg @ref LL_ISO7816_IO_STATE_IDLE + * @arg @ref LL_ISO7816_IO_STATE_RX_WAIT + * @arg @ref LL_ISO7816_IO_STATE_RX + * @arg @ref LL_ISO7816_IO_STATE_TX + * @arg @ref LL_ISO7816_IO_STATE_TX_GUARD + */ +__STATIC_INLINE uint32_t ll_iso7816_get_io_states(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->STAT, ISO7816_STAT_IO_STAT) >> ISO7816_STAT_IO_STAT_POS); +} + +/** + * @brief Get ISO7816 Power States. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | PWR_STATE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_ISO7816_PWR_STATE_OFF + * @arg @ref LL_ISO7816_PWR_STATE_PWRUP_VCC + * @arg @ref LL_ISO7816_PWR_STATE_PWRUP_RST + * @arg @ref LL_ISO7816_PWR_STATE_PWRDN_RST + * @arg @ref LL_ISO7816_PWR_STATE_PWRDN_VCC + * @arg @ref LL_ISO7816_PWR_STATE_STOP_PRE + * @arg @ref LL_ISO7816_PWR_STATE_STOP + * @arg @ref LL_ISO7816_PWR_STATE_STOP_POST + * @arg @ref LL_ISO7816_PWR_STATE_IDLE + * @arg @ref LL_ISO7816_PWR_STATE_RX_TS0 + * @arg @ref LL_ISO7816_PWR_STATE_RX_TS1 + * @arg @ref LL_ISO7816_PWR_STATE_RX + * @arg @ref LL_ISO7816_PWR_STATE_TX + * @arg @ref LL_ISO7816_PWR_STATE_TX_RX + */ +__STATIC_INLINE uint32_t ll_iso7816_get_power_states(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->STAT, ISO7816_STAT_PWR_STAT)); +} + +/** + * @brief Set value of the clock output during stopped Clock. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | CLK_STOP_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @param level This parameter can be one of the following values: + * @arg @ref LL_ISO7816_CLKSTOP_LOW + * @arg @ref LL_ISO7816_CLKSTOP_HIGH + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_clkstop_level(iso7816_regs_t *ISO7816x, uint32_t level) +{ + MODIFY_REG(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_CLK_STOP_SEL, level); +} + +/** + * @brief Get value of the clock output during stopped Clock. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | CLK_STOP_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_ISO7816_CLKSTOP_LOW + * @arg @ref LL_ISO7816_CLKSTOP_HIGH + */ +__STATIC_INLINE uint32_t ll_iso7816_get_clkstop_level(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_CLK_STOP_SEL)); +} + +/** + * @brief Set clock division. + * @note Divide system clock by this value+1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | CLK_DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @param value This parameter should range between 0x0 and 0xFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_clkdiv(iso7816_regs_t *ISO7816x, uint32_t value) +{ + MODIFY_REG(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_CLK_DIV, value << ISO7816_CLK_CFG_CLK_DIV_POS); +} + +/** + * @brief Get clock division. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | CLK_DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value should range between 0x0 and 0xFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_clkdiv(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_CLK_DIV) >> ISO7816_CLK_CFG_CLK_DIV_POS); +} + +/** + * @brief Set divide ISO7816 clock. + * @note Divide SIM clock by this value+1 to define ETU length. The reset value + * is the one, needed for theATR. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | ETU_DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @param divide This parameter should range between 0x0 and 0x3FF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_etudiv(iso7816_regs_t *ISO7816x, uint32_t divide) +{ + MODIFY_REG(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_ETU_DIV, divide); +} + +/** + * @brief Get divide ISO7816 clock. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CLK_CFG | ETU_DIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value should range between 0x0 and 0x3FF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_etudiv(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->CLK_CFG, ISO7816_CLK_CFG_ETU_DIV)); +} + +/** + * @brief Set ISO7816 wait_time in ETU. + + * @note Time between the leading edges of two consecutive characters + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMES | WAIT_TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @param wait_time This parameter should range between 0x0 and 0x3FFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_waittime(iso7816_regs_t *ISO7816x, uint32_t wait_time) +{ + MODIFY_REG(ISO7816x->TIMES_CFG, ISO7816_TIMES_CFG_WAIT_TIME, wait_time << ISO7816_TIMES_CFG_WAIT_TIME_POS); +} + +/** + * @brief Get maximum card response time(leading edge to leading edge) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMES | WAIT_TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value should range between 0x0 and 0x3FFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_waittime(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->TIMES_CFG, ISO7816_TIMES_CFG_WAIT_TIME) >> ISO7816_TIMES_CFG_WAIT_TIME_POS); +} + +/** + * @brief Set ISO7816 guard_time in ETU. + + * @note Set time between the leading edges of two consecutive characters + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMES | GUARD_TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @param guardtime Time between the leading edges of two consecutive characters + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_guardtime(iso7816_regs_t *ISO7816x, uint32_t guardtime) +{ + MODIFY_REG(ISO7816x->TIMES_CFG, ISO7816_TIMES_CFG_GUARD_TIME, guardtime); +} +/** + * @brief Get time between the leading edges of two consecutive characters. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMES | GUARDTIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value should range between 0x0 and 0x3FF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_guardtime(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->TIMES_CFG, ISO7816_TIMES_CFG_GUARD_TIME)); +} + +/** + * @brief Set maximum number of issued retries before giving up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | RETRY_LIMIT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @param number This parameter should range between 0x0 and 0x7. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_retry_limit(iso7816_regs_t *ISO7816x, uint32_t number) +{ + MODIFY_REG(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_RETRY_LIMIT, number << ISO7816_DATA_CFG_RETRY_LIMIT_POS); +} + +/** + * @brief Get maximum number of issued retries before giving up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | RETRY_LIMIT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value should range between 0x0 and 0x7. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_retry_limit(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_RETRY_LIMIT) >> ISO7816_DATA_CFG_RETRY_LIMIT_POS); +} + +/** + * @brief Enable coding detection. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | DETECT_CODING | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_enable_coding_detection(iso7816_regs_t *ISO7816x) +{ + SET_BITS(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_DETECT_CODING); +} + +/** + * @brief Disable coding detection. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | DETECT_CODING | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_disable_coding_detection(iso7816_regs_t *ISO7816x) +{ + CLEAR_BITS(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_DETECT_CODING); +} + +/** + * @brief Set coding convention. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | CODING | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @param convention This parameter can be one of the following values: + * @arg @ref LL_ISO7816_CODING_DEFAULT + * @arg @ref LL_ISO7816_CODING_INVERSE + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_coding_convention(iso7816_regs_t *ISO7816x, uint32_t convention) +{ + MODIFY_REG(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_CODING, convention); +} + +/** + * @brief Get coding convention. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA_CFG | CODING | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_ISO7816_CODING_DEFAULT + * @arg @ref LL_ISO7816_CODING_INVERSE + */ +__STATIC_INLINE uint32_t ll_iso7816_get_coding_convention(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->DATA_CFG, ISO7816_DATA_CFG_CODING)); +} + +/** + * @brief Get current address relative to base_addr. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | ADDR | ADDR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3FFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_current_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->ADDR, ISO7816_ADDR_ADDR) >> ISO7816_ADDR_ADDR_POS); +} + +/** + * @brief Get address fraction. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | ADDR | ADDR_FRAC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_current_addr_frac(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->ADDR, ISO7816_ADDR_ADDR_FRAC)); +} + +/** + * @brief Set start address for RX and TX buffer. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| BASE_ADDR+START_ADDR + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0xFFFFFFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_buffer_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + WRITE_REG(ISO7816x->START_ADDR, addr); +} + +/** + * @brief Get start address for RX and TX buffer. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| BASE_ADDR+START_ADDR + * + * @param ISO7816x ISO7816 instance + */ +__STATIC_INLINE uint32_t ll_iso7816_get_buffer_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_REG(ISO7816x->START_ADDR)); +} + +/** + * @brief Set base address for RX and TX buffer. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| BASE_ADDR + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0xFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_base_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + MODIFY_REG(ISO7816x->START_ADDR, ISO7816_START_ADDR_BASE_ADDR, addr << ISO7816_START_ADDR_BASE_ADDR_POS); +} + +/** + * @brief Get base address for RX and TX buffer. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| BASE_ADDR + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0xFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_base_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->START_ADDR, ISO7816_START_ADDR_BASE_ADDR) >> ISO7816_START_ADDR_BASE_ADDR_POS); +} + +/** + * @brief Set start address for RX and TX buffer, relative to base_addr. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| STRT_ADDR + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0x3FFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_start_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + MODIFY_REG(ISO7816x->START_ADDR, ISO7816_START_ADDR_START_ADDR, addr << ISO7816_START_ADDR_START_ADDR_POS); +} + +/** + * @brief Get start address for RX and TX buffer, relative to base_addr. + * + * Register |BitsName + * ---------|-------- + * STRT_ADDR| STRT_ADDR + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3FFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_start_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->START_ADDR, ISO7816_START_ADDR_START_ADDR) >> ISO7816_START_ADDR_START_ADDR_POS); +} + +/** + * @brief Set end address of receive buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * RX_END_ADDR| RX_END_ADDR+ + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0x3FFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_rx_end_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + MODIFY_REG(ISO7816x->RX_END_ADDR, ISO7816_RX_END_ADDR_RX_END_ADDR, addr << ISO7816_RX_END_ADDR_RX_END_ADDR_POS); +} + +/** + * @brief Set RX endbyte address of receive buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * RX_END_ADDR| RX_END_ADDR+RX_END_AF + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0x3FFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_rx_endbyte_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + WRITE_REG(ISO7816x->RX_END_ADDR, addr); +} + +/** + * @brief Get RX end address of receive buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * RX_END_ADDR| RX_END_ADDR + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3FFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_rx_end_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->RX_END_ADDR, ISO7816_RX_END_ADDR_RX_END_ADDR) >> ISO7816_RX_END_ADDR_RX_END_ADDR_POS); +} + +/** + * @brief Set RX end address fraction. + * + * Register | BitsName + * -----------|-------- + * RX_END_ADDR| RX_END_AF + * + * @param ISO7816x ISO7816 instance + * @param frac This parameter should range between 0x0 and 0x3. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_rx_end_addr_frac(iso7816_regs_t *ISO7816x, uint32_t frac) +{ + MODIFY_REG(ISO7816x->RX_END_ADDR, ISO7816_RX_END_ADDR_RX_END_AF, frac); +} + +/** + * @brief Set TX endbyte address of buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_ADDR+TX_END_AF + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0x3FFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_tx_endbyte_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + WRITE_REG(ISO7816x->TX_END_ADDR, addr); +} + +/** + * @brief Get TX endbyte address of buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_ADDR+TX_END_AF + * + * @param ISO7816x ISO7816 instance + * @retval TX endbyte address. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_tx_endbyte_addr(iso7816_regs_t *ISO7816x) +{ + return READ_REG(ISO7816x->TX_END_ADDR); +} + +/** + * @brief Get RX endbyte address of buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_ADDR+TX_END_AF + * + * @param ISO7816x ISO7816 instance + * @retval RX endbyte address. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_rx_endbyte_addr(iso7816_regs_t *ISO7816x) +{ + return READ_REG(ISO7816x->RX_END_ADDR); +} + +/** + * @brief Get RX end address fraction. + * + * Register | BitsName + * -----------|-------- + * RX_END_ADDR| RX_END_AF + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_rx_end_addr_frac(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->RX_END_ADDR, ISO7816_RX_END_ADDR_RX_END_AF)); +} + +/** + * @brief Set end address of transmit buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_ADDR + * + * @param ISO7816x ISO7816 instance + * @param addr This parameter should range between 0x0 and 0x3FFFF. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_tx_end_addr(iso7816_regs_t *ISO7816x, uint32_t addr) +{ + MODIFY_REG(ISO7816x->TX_END_ADDR, ISO7816_TX_END_ADDR_TX_END_ADDR, addr << ISO7816_TX_END_ADDR_TX_END_ADDR_POS); +} + +/** + * @brief Get end address of transmit buffer, relative to base_addr. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_ADDR + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3FFFF. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_tx_end_addr(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->TX_END_ADDR, ISO7816_TX_END_ADDR_TX_END_ADDR) >> ISO7816_TX_END_ADDR_TX_END_ADDR_POS); +} + +/** + * @brief Set TX end address fraction. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_AF + * + * @param ISO7816x ISO7816 instance + * @param frac This parameter should range between 0x0 and 0x3. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_set_tx_end_addr_frac(iso7816_regs_t *ISO7816x, uint32_t frac) +{ + MODIFY_REG(ISO7816x->TX_END_ADDR, ISO7816_TX_END_ADDR_TX_END_AF, frac); +} + +/** + * @brief Get TX end address fraction. + * + * Register | BitsName + * -----------|-------- + * TX_END_ADDR| TX_END_AF + * + * @param ISO7816x ISO7816 instance + * @retval Value between 0x0 and 0x3. + */ +__STATIC_INLINE uint32_t ll_iso7816_get_tx_end_addr_frac(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_BITS(ISO7816x->TX_END_ADDR, ISO7816_TX_END_ADDR_TX_END_AF)); +} + +/** @} */ + +/** @defgroup ISO7816_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Get ISO7816 interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_TEST | + * +----------------------+-----------------------------------+ + * \endrst + * STAT | STAT_PRESENCE + * STAT | STAT_STATE_ERR + * STAT | STAT_DMA_ERR + * STAT | STAT_RETRY_ERR + * STAT | STAT_RX_ERR + * STAT | STAT_DONE + * + * @param ISO7816x ISO7816 instance. + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_ISO7816_INTR_TEST + * @arg @ref LL_ISO7816_INTR_PRESENCE + * @arg @ref LL_ISO7816_INTR_STATE_ERR + * @arg @ref LL_ISO7816_INTR_DMA_ERR + * @arg @ref LL_ISO7816_INTR_RETRY_ERR + * @arg @ref LL_ISO7816_INTR_RX_ERR + * @arg @ref LL_ISO7816_INTR_DONE +*/ +__STATIC_INLINE uint32_t ll_iso7816_get_it_flag(iso7816_regs_t *ISO7816x) +{ + return (uint32_t)(READ_REG(ISO7816x->STAT) & ISO7816_INTR_ALL); +} + +/** + * @brief Indicate the status of STAT_TEST flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_TEST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_test(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_TEST) == (ISO7816_STAT_IRQ_TEST)); +} + +/** + * @brief Indicate the status of STAT_PRESENCE flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_PRESENCE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_presence(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_PRESENCE) == (ISO7816_STAT_IRQ_PRESENCE)); +} + +/** + * @brief Indicate the status of STAT_STATE_ERR flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_STATE_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_state_err(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_STAT_ERR) == (ISO7816_STAT_IRQ_STAT_ERR)); +} + +/** + * @brief Indicate the status of STAT_DMA_ERR flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_DMA_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_dma_err(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_DMA_ERR) == (ISO7816_STAT_IRQ_DMA_ERR)); +} + +/** + * @brief Indicate the status of STAT_RETRY_ERR flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_RETRY_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_retry_err(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_RETRY_ERR) == (ISO7816_STAT_IRQ_RETRY_ERR)); +} + +/** + * @brief Indicate the status of STAT_RX_ERR flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_RX_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_rx_err(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_RX_ERR) == (ISO7816_STAT_IRQ_RX_ERR)); +} + +/** + * @brief Indicate the status of STAT_DONE flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_iso7816_is_active_flag_done(iso7816_regs_t *ISO7816x) +{ + return (READ_BITS(ISO7816x->STAT, ISO7816_STAT_IRQ_DONE) == (ISO7816_STAT_IRQ_DONE)); +} + +/** + * @brief Clear the combined interrupt, all individual interrupts, and the STAT register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT_TEST | + * +----------------------+-----------------------------------+ + * \endrst + * STAT | STAT_PRESENCE + * STAT | STAT_STATE_ERR + * STAT | STAT_DMA_ERR + * STAT | STAT_RETRY_ERR + * STAT | STAT_RX_ERR + * STAT | STAT_DONE + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_all_intr(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_INTR_ALL); +} + +/** + * @brief Clear test flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_TEST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_test(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_TEST_CLR); +} + +/** + * @brief Clear presence flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_PRESENCE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_presence(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_PRESENCE_CLR); +} + +/** + * @brief Clear state error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_STATE_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_state_err(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_STAT_EC); +} + +/** + * @brief Clear dma error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_DMA_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_dma_err(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_DMA_EC); +} + +/** + * @brief Clear retry error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_RETRY_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_retry_err(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_RETYR_EC); +} + +/** + * @brief Clear RX error flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_RX_ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_rx_err(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_RX_EC); +} + +/** + * @brief Clear done flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CTRL_DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param ISO7816x ISO7816 instance. + * @retval None. + */ +__STATIC_INLINE void ll_iso7816_clear_flag_done(iso7816_regs_t *ISO7816x) +{ + WRITE_REG(ISO7816x->CTRL, ISO7816_CTRL_IRQ_DONE_CLR); +} + +/** @} */ + + +/** @defgroup ISO7816_LL_Init ISO7816 Initialization and de-initialization functions + * @{ + */ + +/** + * @brief Initialize the ISO7816 registers according to the specified parameters in p_iso7816_init. + * @param ISO7816x ISO7816 instance. + * @param p_iso7816_init pointer to a @ref ll_iso7816_init_t structure. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: ISO7816 registers are initialized + * - ERROR: Not applicable + */ +error_status_t ll_iso7816_init(iso7816_regs_t *ISO7816x, ll_iso7816_init_t *p_iso7816_init); + +/** + * @brief De-initialize the ISO7816 registers to their default reset values. + * @param ISO7816x ISO7816 instance. + * @retval An ErrorStatus enumeration value: + * - SUCCESS: ISO7816 registers are de-initialized + * - ERROR: ISO7816 registers are not de-initialized + */ +error_status_t ll_iso7816_deinit(iso7816_regs_t *ISO7816x); + +/** @} */ +/** @} */ + +#endif /* ISO7816 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_ISO7816_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_msio.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_msio.h new file mode 100644 index 0000000..07c7c7a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_msio.h @@ -0,0 +1,793 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_msio.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of MSIO LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_MSIO MSIO + * @brief MSIO LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_MSIO_H__ +#define __GR55XX_LL_MSIO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** @defgroup MSIO_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup MSIO_LL_ES_INIT MSIO Exported init structures + * @{ + */ + +/** + * @brief MSIO pad Enumerations definition + */ +typedef enum +{ + MSIOA = 0x00, /**< MSIO_A_PAD */ +} msio_pad_t; + +/** + * @brief LL MSIO init Structure definition + */ +typedef struct _ll_msio_init +{ + uint32_t pin; /**< Specifies the MSIO pins to be MSIO_InitStructured. + This parameter can be any value of @ref MSIO_LL_EC_PIN */ + + uint32_t direction; /**< Specifies the direction for the selected pins. + This parameter can be a value of @ref MSIO_LL_EC_DIRECTION. + + MSIO HW MSIO_InitStructuration can be modified afterwards using unitary function @ref ll_msio_set_pin_direction(). */ + + uint32_t mode; /**< Specifies the operating mode for the selected pins. + This parameter can be a value of @ref MSIO_LL_EC_MODE. + + MSIO HW MSIO_InitStructuration can be modified afterwards using unitary function @ref ll_msio_set_pin_mode(). */ + + uint32_t pull; /**< Specifies the operating Pull-up/Pull down for the selected pins. + This parameter can be a value of @ref MSIO_LL_EC_PULL. + + MSIO HW configuration can be modified afterwards using unitary function @ref ll_msio_set_pin_pull().*/ + + uint32_t mux; /*!< Specifies the Peripheral to be connected to the selected pins. + This parameter can be a value of @ref MSIO_LL_EC_MUX. + + GPIO HW MSIO_InitStructuration can be modified afterwards using unitary function + @ref ll_msio_set_pin_mux(). */ + +} ll_msio_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup MSIO_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup MSIO_LL_Exported_Constants MSIO Exported Constants + * @{ + */ + +/** @defgroup MSIO_LL_EC_PIN PIN + * @{ + */ +#define LL_MSIO_PIN_0 ((uint32_t)0x01U) /**< Select pin 0 */ +#define LL_MSIO_PIN_1 ((uint32_t)0x02U) /**< Select pin 1 */ +#define LL_MSIO_PIN_2 ((uint32_t)0x04U) /**< Select pin 2 */ +#define LL_MSIO_PIN_3 ((uint32_t)0x08U) /**< Select pin 3 */ +#define LL_MSIO_PIN_4 ((uint32_t)0x10U) /**< Select pin 4 */ +#define LL_MSIO_PIN_ALL ((uint32_t)0x1FU) /**< Select all pins */ +/** @} */ + +/** @defgroup MSIO_LL_EC_DIRECTION Direction + * @{ + */ +#define LL_MSIO_DIRECTION_NONE ((uint32_t)0x0U) /**< Disable input/output */ +#define LL_MSIO_DIRECTION_INPUT ((uint32_t)0x1U) /**< Enable input */ +#define LL_MSIO_DIRECTION_OUTPUT ((uint32_t)0x2U) /**< Enable output */ +#define LL_MSIO_DIRECTION_INOUT ((uint32_t)0x3U) /**< Enable input&output */ +/** @} */ + +/** @defgroup MSIO_LL_EC_MODE Mode + * @{ + */ +#define LL_MSIO_MODE_ANALOG ((uint32_t)0x0U) /**< Select analog mode */ +#define LL_MSIO_MODE_DIGITAL ((uint32_t)0x1U) /**< Enable digital mode */ +/** @} */ + +/** @defgroup MSIO_LL_EC_PULL Pull Up Pull Down + * @{ + */ +#define LL_MSIO_PULL_NO ((uint32_t)0x0U) /**< Select I/O no pull */ +#define LL_MSIO_PULL_UP ((uint32_t)0x1U) /**< Select I/O pull up */ +#define LL_MSIO_PULL_DOWN ((uint32_t)0x2U) /**< Select I/O pull down */ +/** @} */ + +/** @defgroup MSIO_LL_EC_MUX Alternate Function + * @{ + */ +#define LL_MSIO_MUX_0 ((uint32_t)0x0U) /*!< Select alternate function 0 */ +#define LL_MSIO_MUX_1 ((uint32_t)0x1U) /*!< Select alternate function 1 */ +#define LL_MSIO_MUX_2 ((uint32_t)0x2U) /*!< Select alternate function 2 */ +#define LL_MSIO_MUX_3 ((uint32_t)0x3U) /*!< Select alternate function 3 */ +#define LL_MSIO_MUX_4 ((uint32_t)0x4U) /*!< Select alternate function 4 */ +#define LL_MSIO_MUX_5 ((uint32_t)0x5U) /*!< Select alternate function 5 */ +#define LL_MSIO_MUX_6 ((uint32_t)0x6U) /*!< Select alternate function 6 */ +#define LL_MSIO_MUX_7 ((uint32_t)0x7U) /*!< Select alternate function 7 */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup MSIO_LL_Exported_Macros MSIO Exported Macros + * @{ + */ + +/** @defgroup MSIO_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in MSIO register + * @param __instance__ MSIO instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_MSIO_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in MSIO register + * @param __instance__ MSIO instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_MSIO_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/* Private macros ------------------------------------------------------------*/ +/** @defgroup MSIO_LL_Private_Macros MSIO Private Macros + * @{ + */ + +/** @defgroup MSIO_LL_EC_DEFAULT_CONFIG InitStruct default configuartion + * @{ + */ + +/** + * @brief LL MSIO InitStrcut default configuartion + */ +#define LL_MSIO_DEFAULT_CONFIG \ +{ \ + .pin = LL_MSIO_PIN_ALL, \ + .direction = LL_MSIO_DIRECTION_INPUT, \ + .mode = LL_MSIO_MODE_DIGITAL, \ + .pull = LL_MSIO_PULL_DOWN, \ + .mux = LL_MSIO_MUX_7, \ +} +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup MSIO_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup MSIO_LL_EF_Port_Configuration Port Configuration + * @{ + */ + +/** + * @brief Set several MSIO pins to input/output direction. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | OE_N | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_0 | IE_N + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @param direction This parameter can be one of the following values: + * @arg @ref LL_MSIO_DIRECTION_NONE + * @arg @ref LL_MSIO_DIRECTION_INPUT + * @arg @ref LL_MSIO_DIRECTION_OUTPUT + * @arg @ref LL_MSIO_DIRECTION_INOUT + * @retval None + */ +__STATIC_INLINE void ll_msio_set_pin_direction(uint32_t pin_mask, uint32_t direction) +{ + uint32_t oe_mask = (pin_mask << AON_MSIO_PAD_CFG_0_OE_N_Pos) & AON_MSIO_PAD_CFG_0_OE_N; + uint32_t ie_mask = (pin_mask << AON_MSIO_PAD_CFG_0_IE_N_Pos) & AON_MSIO_PAD_CFG_0_IE_N; + if (direction != LL_MSIO_DIRECTION_NONE) + { + if (direction != LL_MSIO_DIRECTION_INOUT) + MODIFY_REG(AON->MSIO_PAD_CFG_0, (ie_mask | oe_mask), (direction != LL_MSIO_DIRECTION_INPUT) ? ie_mask : oe_mask); + else + CLEAR_BITS(AON->MSIO_PAD_CFG_0, (ie_mask | oe_mask)); + } + else + SET_BITS(AON->MSIO_PAD_CFG_0, (ie_mask | oe_mask)); +} + +/** + * @brief Return gpio direction for a MSIO pin. + * @note I/O direction can be Input direction, General purpose output. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | OE_N | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_0 | IE_N + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_MSIO_DIRECTION_NONE + * @arg @ref LL_MSIO_DIRECTION_INPUT + * @arg @ref LL_MSIO_DIRECTION_OUTPUT + * @arg @ref LL_MSIO_DIRECTION_INOUT + */ +__STATIC_INLINE uint32_t ll_msio_get_pin_direction(uint32_t pin) +{ + uint32_t oe_mask = (pin << AON_MSIO_PAD_CFG_0_OE_N_Pos) & AON_MSIO_PAD_CFG_0_OE_N; + uint32_t ie_mask = (pin << AON_MSIO_PAD_CFG_0_IE_N_Pos) & AON_MSIO_PAD_CFG_0_IE_N; + uint32_t mask = READ_BITS(AON->MSIO_PAD_CFG_0, (ie_mask | oe_mask)); + if (mask == (ie_mask | oe_mask)) + return LL_MSIO_DIRECTION_NONE; + else + { + if (mask == 0) + return LL_MSIO_DIRECTION_INOUT; + else + return ((mask == ie_mask) ? LL_MSIO_DIRECTION_OUTPUT : LL_MSIO_DIRECTION_INPUT); + } +} + +/** + * @brief Set several MSIO pins to analog/digital mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | AE_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @param mode This parameter can be one of the following values: + * @arg @ref LL_MSIO_MODE_ANALOG + * @arg @ref LL_MSIO_MODE_DIGITAL + * @retval None + */ +__STATIC_INLINE void ll_msio_set_pin_mode(uint32_t pin_mask, uint32_t mode) +{ + uint32_t ae_mask = (pin_mask << AON_MSIO_PAD_CFG_1_AE_N_Pos) & AON_MSIO_PAD_CFG_1_AE_N; + uint32_t ae_n = (mode != LL_MSIO_MODE_DIGITAL) ? 0U : ae_mask; + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->MSIO_PAD_CFG_1, ae_mask, ae_n); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Return gpio mode for a MSIO pin. + * @note I/O mode can be analog or digital. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | AE_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_MSIO_MODE_ANALOG + * @arg @ref LL_MSIO_MODE_DIGITAL + */ +__STATIC_INLINE uint32_t ll_msio_get_pin_mode(uint32_t pin) +{ + uint32_t ae_mask = (pin << AON_MSIO_PAD_CFG_1_AE_N_Pos) & AON_MSIO_PAD_CFG_1_AE_N; + return ((READ_BITS(AON->MSIO_PAD_CFG_1, ae_mask) == ae_mask) ? LL_MSIO_MODE_DIGITAL : LL_MSIO_MODE_ANALOG); +} + +/** + * @brief Configure gpio pull-up or pull-down for a dedicated MSIO pin. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_1 | RTYPE + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @param pull This parameter can be one of the following values: + * @arg @ref LL_MSIO_PULL_NO + * @arg @ref LL_MSIO_PULL_UP + * @arg @ref LL_MSIO_PULL_DOWN + * @retval None + */ +__STATIC_INLINE void ll_msio_set_pin_pull(uint32_t pin_mask, uint32_t pull) +{ + if (pull != LL_MSIO_PULL_NO) + { + uint32_t rtype_mask = (pin_mask << AON_MSIO_PAD_CFG_1_RTYPE_Pos) & AON_MSIO_PAD_CFG_1_RTYPE; + uint32_t rtype = (pull != LL_MSIO_PULL_UP) ? 0U : rtype_mask; + CLEAR_BITS(AON->MSIO_PAD_CFG_0, (pin_mask << AON_MSIO_PAD_CFG_0_RE_N_Pos) & AON_MSIO_PAD_CFG_0_RE_N); + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->MSIO_PAD_CFG_1, rtype_mask, rtype); + GLOBAL_EXCEPTION_ENABLE(); + } + else + { + SET_BITS(AON->MSIO_PAD_CFG_0, (pin_mask << AON_MSIO_PAD_CFG_0_RE_N_Pos) & AON_MSIO_PAD_CFG_0_RE_N); + } +} + +/** + * @brief Return gpio pull-up or pull-down for a dedicated MSIO pin. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | RE_N | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_1 | RTYPE + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_MSIO_PULL_NO + * @arg @ref LL_MSIO_PULL_UP + * @arg @ref LL_MSIO_PULL_DOWN + */ +__STATIC_INLINE uint32_t ll_msio_get_pin_pull(uint32_t pin) +{ + if (READ_BITS(AON->MSIO_PAD_CFG_0, (pin << AON_MSIO_PAD_CFG_0_RE_N_Pos) & AON_MSIO_PAD_CFG_0_RE_N)) + { + return LL_MSIO_PULL_NO; + } + else + { + uint32_t rtype_mask = (pin << AON_MSIO_PAD_CFG_1_RTYPE_Pos) & AON_MSIO_PAD_CFG_1_RTYPE; + return ((READ_BITS(AON->MSIO_PAD_CFG_1, rtype_mask) != RESET) ? LL_MSIO_PULL_UP : LL_MSIO_PULL_DOWN); + } +} + +/** + * @brief Configure gpio pinmux number of a dedicated pin from 0 to 4 for a dedicated port. + * @note Possible values are from AF0 to AF7 depending on target. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_MUX_CTL | CTL_00_04 | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_1 | MCU_OVR + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @param mux This parameter can be one of the following values: + * @arg @ref LL_MSIO_MUX_0 + * @arg @ref LL_MSIO_MUX_1 + * @arg @ref LL_MSIO_MUX_2 + * @arg @ref LL_MSIO_MUX_3 + * @arg @ref LL_MSIO_MUX_4 + * @arg @ref LL_MSIO_MUX_5 + * @arg @ref LL_MSIO_MUX_6 + * @arg @ref LL_MSIO_MUX_7 + * @retval None + */ +__STATIC_INLINE void ll_msio_set_pin_mux(uint32_t pin, uint32_t mux) +{ + uint32_t pos = POSITION_VAL(pin) << 2; + MODIFY_REG(MCU_SUB->MSIO_PAD_MUX_CTL, 0xF << pos, mux << pos); + if(LL_MSIO_MUX_7 == mux) + { + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, pin << AON_MSIO_PAD_CFG_1_MCU_OVR_Pos); + GLOBAL_EXCEPTION_ENABLE(); + } + else + { + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, pin << AON_MSIO_PAD_CFG_1_MCU_OVR_Pos); + GLOBAL_EXCEPTION_ENABLE(); + } +} + +/** + * @brief Return gpio alternate function of a dedicated pin from 0 to 4 for a dedicated port. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_MUX_CTL | CTL_00_04 | + * +----------------------+-----------------------------------+ + * \endrst + * MSIO_PAD_CFG_1 | MCU_OVR + * + * @param pin This parameter can be one of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @retval Returned value can be one of the following values: + * @arg @ref LL_MSIO_MUX_0 + * @arg @ref LL_MSIO_MUX_1 + * @arg @ref LL_MSIO_MUX_2 + * @arg @ref LL_MSIO_MUX_3 + * @arg @ref LL_MSIO_MUX_4 + * @arg @ref LL_MSIO_MUX_5 + * @arg @ref LL_MSIO_MUX_6 + * @arg @ref LL_MSIO_MUX_7 + */ +__STATIC_INLINE uint32_t ll_msio_get_pin_mux(uint32_t pin) +{ + if(READ_BITS(AON->MSIO_PAD_CFG_1, pin << AON_MSIO_PAD_CFG_1_MCU_OVR_Pos)) + { + uint32_t pos = POSITION_VAL(pin) << 2; + return (READ_BITS(MCU_SUB->MSIO_PAD_MUX_CTL, 0xF << pos) >> pos); + } + else + { + return LL_MSIO_MUX_7; + } +} + +/** @} */ + +/** @defgroup MSIO_LL_EF_Data_Access Data Access + * @{ + */ + +/** + * @brief Return full input data register value of MSIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_REG0 | MSIO_C | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Input data register value of port + */ +__STATIC_INLINE uint32_t ll_msio_read_input_port(void) +{ + return (uint32_t)(READ_BITS(MCU_SUB->MSIO_REG0, MCU_SUB_MSIO_REG0_MSIO_C)); +} + +/** + * @brief Return if input data level of several MSIO pins is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_REG0 | MSIO_C | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_msio_is_input_pin_set(uint32_t pin_mask) +{ + return (uint32_t)(READ_BITS(MCU_SUB->MSIO_REG0, pin_mask) == pin_mask); +} + +/** + * @brief Write output data register of MSIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param port_value Level value for each pin of the port + * @retval None + */ +__STATIC_INLINE void ll_msio_write_output_port(uint32_t port_value) +{ + MODIFY_REG(AON->MSIO_PAD_CFG_0, AON_MSIO_PAD_CFG_0_IN, (port_value << AON_MSIO_PAD_CFG_0_IN_Pos) & AON_MSIO_PAD_CFG_0_IN); +} + +/** + * @brief Return full output data register value of MSIO. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Output data register value of port + */ +__STATIC_INLINE uint32_t ll_msio_read_output_port(void) +{ + return (uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_0, AON_MSIO_PAD_CFG_0_IN) >> AON_MSIO_PAD_CFG_0_IN_Pos); +} + +/** + * @brief Return if input data level of several MSIO pins is high or low. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_msio_is_output_pin_set(uint32_t pin_mask) +{ + pin_mask = (pin_mask << AON_MSIO_PAD_CFG_0_IN_Pos) & AON_MSIO_PAD_CFG_0_IN; + return (uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_0, pin_mask) == pin_mask); +} + +/** + * @brief Set specified MSIO pins to high level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_msio_set_output_pin(uint32_t pin_mask) +{ + SET_BITS(AON->MSIO_PAD_CFG_0, (pin_mask << AON_MSIO_PAD_CFG_0_IN_Pos) & AON_MSIO_PAD_CFG_0_IN); +} + +/** + * @brief Set specified MSIO pins to low level. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_msio_reset_output_pin(uint32_t pin_mask) +{ + CLEAR_BITS(AON->MSIO_PAD_CFG_0, (pin_mask << AON_MSIO_PAD_CFG_0_IN_Pos) & AON_MSIO_PAD_CFG_0_IN); +} + +/** + * @brief Toggle data value of specified MSIO pins. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_0 | IN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param pin_mask This parameter can be a combination of the following values: + * @arg @ref LL_MSIO_PIN_0 + * @arg @ref LL_MSIO_PIN_1 + * @arg @ref LL_MSIO_PIN_2 + * @arg @ref LL_MSIO_PIN_3 + * @arg @ref LL_MSIO_PIN_4 + * @arg @ref LL_MSIO_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_msio_toggle_pin(uint32_t pin_mask) +{ + WRITE_REG(AON->MSIO_PAD_CFG_0, (READ_REG(AON->MSIO_PAD_CFG_0) ^ ((pin_mask << AON_MSIO_PAD_CFG_0_IN_Pos) & AON_MSIO_PAD_CFG_0_IN))); +} + +/** @} */ + +/** @defgroup MSIO_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize MSIO registers (Registers restored to their default values). + * @retval An error_status_t enumeration value: + * - SUCCESS: MSIO registers are de-initialized + * - ERROR: MSIO registers are not de-initialized + */ +error_status_t ll_msio_deinit(void); + +/** + * @brief Initialize MSIO registers according to the specified. + * parameters in p_msio_init. + * @param p_msio_init Pointer to a ll_msio_init_t structure that contains the configuration + * information for the specified MSIO peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: MSIO registers are initialized according to p_msio_init content + * - ERROR: Problem occurred during MSIO Registers initialization + */ +error_status_t ll_msio_init(ll_msio_init_t *p_msio_init); + +/** + * @brief Set each field of a @ref ll_msio_init_t type structure to default value. + * @param p_msio_init Pointer to a @ref ll_msio_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_msio_struct_init(ll_msio_init_t *p_msio_init); + +/** @} */ + +/** @} */ + +#endif /* AON */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_MSIO_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pkc.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pkc.h new file mode 100644 index 0000000..a2eed55 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pkc.h @@ -0,0 +1,3024 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_pkc.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PKC LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_PKC PKC + * @brief PKC LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_PKC_H__ +#define __GR55XX_LL_PKC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (PKC) + +/** @addtogroup PKC_LL_MACRO + * @{ + */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PKC_LL_Private_Macro PKC Private Macros + * @{ + */ +#define ECC_U32_LENGTH (8) /**< ECC Array Length */ +#define RSA_U32_LENGTH (64) /**< RSA Array Length */ + +/** @} */ + +/** @} */ + +/** @defgroup PKC_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup PKC_LL_ES_INIT PKC Exported Init structures + * @{ + */ + +/** + * @brief LL PKC ECC Point Structure definition + */ +typedef struct _ll_ecc_point +{ + uint32_t X[ECC_U32_LENGTH]; /**< Specifies the point in x-axis */ + + uint32_t Y[ECC_U32_LENGTH]; /**< Specifies the point in y-axis */ + +} ll_ecc_point_t; + +/** + * @brief LL PKC ECC P-256 Elliptic Curve Init Structure definition + */ +typedef struct _ll_ecc_curve_init +{ + uint32_t A[ECC_U32_LENGTH]; /**< Operand A array */ + uint32_t B[ECC_U32_LENGTH]; /**< Operand B array */ + + uint32_t P[ECC_U32_LENGTH]; /**< Prime number P array */ + uint32_t PRSquare[ECC_U32_LENGTH]; /**< R^2 mod P, where R = 2^256 */ + uint32_t ConstP; /**< Montgomery multiplication constant in prime field P, ConstP = 1 */ + + uint32_t N[ECC_U32_LENGTH]; /**< Prime number N array */ + uint32_t NRSquare[ECC_U32_LENGTH]; /**< R^2 mod N, where R = 2^256 */ + uint32_t ConstN; /**< Montgomery multiplication constant in prime field N, ConstN = 0xee00bc4f */ + + uint32_t H; /**< H */ + + ll_ecc_point_t G; /**< ECC Point G */ + +} ll_ecc_curve_init_t; + +/** + * @brief LL PKC Init Structure definition + */ +typedef struct _ll_pkc_init +{ + ll_ecc_curve_init_t *p_ecc_curve; /**< Specifies the pointer to elliptic curve description */ + + uint32_t data_bits; /**< Specifies the Data size: 256 ~ 2048bits */ + +} ll_pkc_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup PKC_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PKC_LL_Exported_Constants PKC Exported Constants + * @{ + */ + +/** @defgroup PKC_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags defines which can be used with LL_PKC_ReadReg function + * @{ + */ +#define LL_PKC_WORKSTAT_BUSY PKC_WORKSTAT_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup PKC_LL_EC_IT IT Defines + * @brief Interrupt defines which can be used with LL_PKC_ReadReg and LL_PKC_WriteReg functions + * @{ + */ +#define LL_PKC_INTEN_DONE PKC_INTEN_DONE /**< Operation Done Interrupt source */ +#define LL_PKC_INTEN_ERR PKC_INTEN_ERR /**< Operation Error Interrupt source */ +#define LL_PKC_INTEN_BAOVF PKC_INTEN_BAOVF /**< Big Integer Result Overflow Interrupt source */ +/** @} */ + +/** @defgroup PKC_LL_EC_BITS_LENGTH Bits Length + * @{ + */ +#define LL_PKC_BITS_LENGTH_MIN (256U) /**< Bits length min value */ +#define LL_PKC_BITS_LENGTH_MAX (2048U) /**< Bits length max value */ +#define LL_PKC_BIGMULTI_BITS_LENGTH_MAX (1024U) /**< Big number multiplication bits Length max value */ +/** @} */ + +/** @defgroup PKC_LL_EC_OPERATION_MODE Operation Mode + * @{ + */ +#define LL_PKC_operation_mode_MULTIPLY (0x00000000U) /**< Multiplication operation mode */ +#define LL_PKC_operation_mode_INVERTION (1UL << PKC_SW_CTRL_OPMODE_Pos) /**< Inversion operation mode */ +#define LL_PKC_operation_mode_ADD (2UL << PKC_SW_CTRL_OPMODE_Pos) /**< Addition operation mode */ +#define LL_PKC_operation_mode_SUB (3UL << PKC_SW_CTRL_OPMODE_Pos) /**< Subtraction operation mode */ +#define LL_PKC_operation_mode_COMPARE (4UL << PKC_SW_CTRL_OPMODE_Pos) /**< Comparison operation mode */ +#define LL_PKC_operation_mode_LEFTSHIFT (5UL << PKC_SW_CTRL_OPMODE_Pos) /**< Left Shift operation mode */ +#define LL_PKC_operation_mode_BIGINTEGERMULTIPLY (6UL << PKC_SW_CTRL_OPMODE_Pos) /**< Big Number Multiplication operation mode */ +#define LL_PKC_operation_mode_BIGINTEGERADD (7UL << PKC_SW_CTRL_OPMODE_Pos) /**< Big Number Addition operation mode */ +/** @} */ + +/** @defgroup PKC_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL PKC ECC Curve default configuretion. + */ +#define LL_ECC_CURVE_DEFAULT_CONFIG LL_ECC_CURVE_SECP256R1_CONFIG + +/** + * @brief LL PKC ECC Curve SECP256R1 configuretion. + */ +#define LL_ECC_CURVE_SECP256R1_CONFIG \ +{ \ + .A = {0xFFFFFFFC, 0x00000004, 0x00000000, 0x00000000, 0x00000003, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFC}, \ + .B = {0xDC30061D, 0x04874834, 0xE5A220AB, 0xF7212ED6, 0xACF005CD, 0x78843090, 0xD89CDF62, 0x29C4BDDF}, \ + .P = {0xFFFFFFFF, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF}, \ + .PRSquare = {0x00000004, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFB, 0xFFFFFFFF, 0x00000000, 0x00000003}, \ + .ConstP = 1, \ + .N = {0xFFFFFFFF, 0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, 0xBCE6FAAD, 0xA7179E84, 0xF3B9CAC2, 0xFC632551}, \ + .NRSquare = {0x66E12D94, 0xF3D95620, 0x2845B239, 0x2B6BEC59, 0x4699799C, 0x49BD6FA6, 0x83244C95, 0xBE79EEA2}, \ + .ConstN = 0xEE00BC4F, \ + .H = 1, \ + .G.X = {0x6B17D1F2, 0xE12C4247, 0xF8BCE6E5, 0x63A440F2, 0x77037D81, 0x2DEB33A0, 0xF4A13945, 0xD898C296}, \ + .G.Y = {0x4FE342E2, 0xFE1A7F9B, 0x8EE7EB4A, 0x7C0F9E16, 0x2BCE3357, 0x6B315ECE, 0xCBB64068, 0x37BF51F5}, \ +} + +/** + * @brief LL PKC ECC Curve SECP256K1 configuretion. + */ +#define LL_ECC_CURVE_SECP256K1_CONFIG \ +{ \ + .A = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, \ + .B = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000007, 0x00001AB7}, \ + .P = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFC2F}, \ + .PRSquare = {0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x000007A2, 0x000E90A1}, \ + .ConstP = 0XD2253531, \ + .N = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFE, 0xBAAEDCE6, 0xAF48A03B, 0xBFD25E8C, 0xD0364141}, \ + .NRSquare = {0x9D671CD5, 0x81C69BC5, 0xE697F5E4, 0x5BCD07C6, 0x741496C2, 0x0E7CF878, 0x896CF214, 0x67D7D140}, \ + .ConstN = 0X5588B13F, \ + .H = 1, \ + .G.X = {0x79BE667E, 0xF9DCBBAC, 0x55A06295, 0xCE870B07, 0x029BFCDB, 0x2DCE28D9, 0x59F2815B, 0x16F81798}, \ + .G.Y = {0x483ADA77, 0x26A3C465, 0x5DA4FBFC, 0x0E1108A8, 0xFD17B448, 0xA6855419, 0x9C47D08F, 0xFB10D4B8}, \ +} + +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PKC_LL_Exported_Macros PKC Exported Macros + * @{ + */ + +/** @defgroup PKC_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in PKC register + * @param __INSTANCE__ PKC Instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_PKC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in PKC register + * @param __INSTANCE__ PKC Instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_PKC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PKC_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup PKC_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable pkc. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->CTRL, PKC_CTRL_EN); +} + +/** + * @brief Disable pkc. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->CTRL, PKC_CTRL_EN); +} + +/** + * @brief Indicate whether the pkc is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CTRL, PKC_CTRL_EN) == (PKC_CTRL_EN)); +} + +/** + * @brief Enable pkc start in hardware mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_hardware_start(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->CTRL, PKC_CTRL_START); +} + +/** + * @brief Disable pkc start in hardware mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_hardware_start(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->CTRL, PKC_CTRL_START); +} + +/** + * @brief Indicate whether the pkc start in hardware mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | START | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_hardware_start(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CTRL, PKC_CTRL_START) == (PKC_CTRL_START)); +} + +/** + * @brief Enable pkc software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_software(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->CTRL, PKC_CTRL_SWCTRL); +} + +/** + * @brief Disable pkc software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_software(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->CTRL, PKC_CTRL_SWCTRL); +} + +/** + * @brief Indicate whether the pkc software mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_software(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CTRL, PKC_CTRL_SWCTRL) == (PKC_CTRL_SWCTRL)); +} + +/** + * @brief Enable pkc reset. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWRST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_reset(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->CTRL, PKC_CTRL_SWRST); +} + +/** + * @brief Disable pkc reset. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWRST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_reset(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->CTRL, PKC_CTRL_SWRST); +} + +/** + * @brief Indicate whether the pkc reset is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | SWRST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_reset(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CTRL, PKC_CTRL_SWRST) == (PKC_CTRL_SWRST)); +} + +/** + * @brief Set PKC parameter k pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG0 | KPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_k_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG0, PKC_CONFIG0_KPTR, pointer << PKC_CONFIG0_KPTR_Pos); +} + +/** + * @brief Get PKC parameter k pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG0 | KPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_k_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG0, PKC_CONFIG0_KPTR) >> PKC_CONFIG0_KPTR_Pos); +} + +/** + * @brief Set PKC parameter r pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG0 | RPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG0, PKC_CONFIG0_RPTR, pointer << PKC_CONFIG0_RPTR_Pos); +} + +/** + * @brief Get PKC parameter r pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG0 | RPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG0, PKC_CONFIG0_RPTR) >> PKC_CONFIG0_RPTR_Pos); +} + +/** + * @brief Set PKC parameter p pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG1 | PPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_p_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG1, PKC_CONFIG1_PPTR, pointer << PKC_CONFIG1_PPTR_Pos); +} + +/** + * @brief Get PKC parameter p pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG1 | PPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_p_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG1, PKC_CONFIG1_PPTR) >> PKC_CONFIG1_PPTR_Pos); +} + +/** + * @brief Set PKC parameter R^2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG1 | RSQPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_rsq_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG1, PKC_CONFIG1_RSQPTR, pointer << PKC_CONFIG1_RSQPTR_Pos); +} + +/** + * @brief Get PKC parameter R^2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG1 | RSQPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_rsq_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG1, PKC_CONFIG1_RSQPTR) >> PKC_CONFIG1_RSQPTR_Pos); +} + +/** + * @brief Set PKC parameter Gx pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG2 | GXPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_gx_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG2, PKC_CONFIG2_GXPTR, pointer << PKC_CONFIG2_GXPTR_Pos); +} + +/** + * @brief Get PKC parameter Gx pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG2 | GXPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_gx_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG2, PKC_CONFIG2_GXPTR) >> PKC_CONFIG2_GXPTR_Pos); +} + +/** + * @brief Set PKC parameter Gy pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG2 | GYPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_gy_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG2, PKC_CONFIG2_GYPTR, pointer << PKC_CONFIG2_GYPTR_Pos); +} + +/** + * @brief Get PKC parameter Gy pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG2 | GYPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_gy_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG2, PKC_CONFIG2_GYPTR) >> PKC_CONFIG2_GYPTR_Pos); +} + +/** + * @brief Set PKC parameter Gz pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG3 | GZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_gz_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG3, PKC_CONFIG3_GZPTR, pointer << PKC_CONFIG3_GZPTR_Pos); +} + +/** + * @brief Get PKC parameter Gz pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG3 | GZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_gz_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG3, PKC_CONFIG3_GZPTR) >> PKC_CONFIG3_GZPTR_Pos); +} + +/** + * @brief Set PKC parameter R0x pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG3 | R0XPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r0x_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG3, PKC_CONFIG3_R0XPTR, pointer << PKC_CONFIG3_R0XPTR_Pos); +} + +/** + * @brief Get PKC parameter R0x pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG3 | R0XPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r0x_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG3, PKC_CONFIG3_R0XPTR) >> PKC_CONFIG3_R0XPTR_Pos); +} + +/** + * @brief Set PKC parameter R0y pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG4 | R0YPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r0y_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG4, PKC_CONFIG4_R0YPTR, pointer << PKC_CONFIG4_R0YPTR_Pos); +} + +/** + * @brief Get PKC parameter R0y pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG4 | R0YPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r0y_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG4, PKC_CONFIG4_R0YPTR) >> PKC_CONFIG4_R0YPTR_Pos); +} + +/** + * @brief Set PKC parameter R0z pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG4 | R0ZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r0z_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG4, PKC_CONFIG4_R0ZPTR, pointer << PKC_CONFIG4_R0ZPTR_Pos); +} + +/** + * @brief Get PKC parameter R0z pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG4 | R0ZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r0z_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG4, PKC_CONFIG4_R0ZPTR) >> PKC_CONFIG4_R0ZPTR_Pos); +} + +/** + * @brief Set PKC parameter R1x pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG5 | R1XPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r1x_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG5, PKC_CONFIG5_R1XPTR, pointer << PKC_CONFIG5_R1XPTR_Pos); +} + +/** + * @brief Get PKC parameter R1x pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG5 | R1XPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r1x_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG5, PKC_CONFIG5_R1XPTR) >> PKC_CONFIG5_R1XPTR_Pos); +} + +/** + * @brief Set PKC parameter R1y pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG5 | R1YPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r1y_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG5, PKC_CONFIG5_R1YPTR, pointer << PKC_CONFIG5_R1YPTR_Pos); +} + +/** + * @brief Get PKC parameter R1y pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG5 | R1YPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r1y_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG5, PKC_CONFIG5_R1YPTR) >> PKC_CONFIG5_R1YPTR_Pos); +} + +/** + * @brief Set PKC parameter R1z pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG6 | R1ZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_r1z_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG6, PKC_CONFIG6_R1ZPTR, pointer << PKC_CONFIG6_R1ZPTR_Pos); +} + +/** + * @brief Get PKC parameter R1z pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG6 | R1ZPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_r1z_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG6, PKC_CONFIG6_R1ZPTR) >> PKC_CONFIG6_R1ZPTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG6 | TMP1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp1_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG6, PKC_CONFIG6_TMP1PTR, pointer << PKC_CONFIG6_TMP1PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG6 | TMP1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp1_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG6, PKC_CONFIG6_TMP1PTR) >> PKC_CONFIG6_TMP1PTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG7 | TMP2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp2_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG7, PKC_CONFIG7_TMP2PTR, pointer << PKC_CONFIG7_TMP2PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG7 | TMP2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp2_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG7, PKC_CONFIG7_TMP2PTR) >> PKC_CONFIG7_TMP2PTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp3 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG7 | TMP3PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp3_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG7, PKC_CONFIG7_TMP3PTR, pointer << PKC_CONFIG7_TMP3PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp3 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG7 | TMP3PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp3_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG7, PKC_CONFIG7_TMP3PTR) >> PKC_CONFIG7_TMP3PTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp4 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG8 | TMP4PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp4_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG8, PKC_CONFIG8_TMP4PTR, pointer << PKC_CONFIG8_TMP4PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp4 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG8 | TMP4PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp4_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG8, PKC_CONFIG8_TMP4PTR) >> PKC_CONFIG8_TMP4PTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp5 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG8 | TMP5PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp5_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG8, PKC_CONFIG8_TMP5PTR, pointer << PKC_CONFIG8_TMP5PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp5 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG8 | TMP5PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp5_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG8, PKC_CONFIG8_TMP5PTR) >> PKC_CONFIG8_TMP5PTR_Pos); +} + +/** + * @brief Set PKC parameter Tmp6 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG9 | TMP6PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmp6_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG9, PKC_CONFIG9_TMP6PTR, pointer << PKC_CONFIG9_TMP6PTR_Pos); +} + +/** + * @brief Get PKC parameter Tmp6 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG9 | TMP6PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmp6_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG9, PKC_CONFIG9_TMP6PTR) >> PKC_CONFIG9_TMP6PTR_Pos); +} + +/** + * @brief Set PKC parameter Constant1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG9 | CONST1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_constant1_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG9, PKC_CONFIG9_CONST1PTR, pointer << PKC_CONFIG9_CONST1PTR_Pos); +} + +/** + * @brief Get PKC parameter Constant1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG9 | CONST1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_constant1_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG9, PKC_CONFIG9_CONST1PTR) >> PKC_CONFIG9_CONST1PTR_Pos); +} + +/** + * @brief Set PKC parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG10 | X1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_x1_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG10, PKC_CONFIG10_X1PTR, pointer << PKC_CONFIG10_X1PTR_Pos); +} + +/** + * @brief Get PKC parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG10 | X1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_x1_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG10, PKC_CONFIG10_X1PTR) >> PKC_CONFIG10_X1PTR_Pos); +} + +/** + * @brief Set PKC parameter X2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG10 | X2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_x2_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG10, PKC_CONFIG10_X2PTR, pointer << PKC_CONFIG10_X2PTR_Pos); +} + +/** + * @brief Get PKC parameter X2 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG10 | X2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_x2_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG10, PKC_CONFIG10_X2PTR) >> PKC_CONFIG10_X2PTR_Pos); +} + +/** + * @brief Set PKC parameter MITmp pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG11 | MITMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mitmp_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG11, PKC_CONFIG11_MITMPPTR, pointer << PKC_CONFIG11_MITMPPTR_Pos); +} + +/** + * @brief Get PKC parameter MITmp pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG11 | MITMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mitmp_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG11, PKC_CONFIG11_MITMPPTR) >> PKC_CONFIG11_MITMPPTR_Pos); +} + +/** + * @brief Set PKC parameter TmpK pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG11 | TMPKPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_tmpk_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG11, PKC_CONFIG11_TMPKPTR, pointer << PKC_CONFIG11_TMPKPTR_Pos); +} + +/** + * @brief Get PKC parameter TmpK pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG11 | TMPKPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_tmpk_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG11, PKC_CONFIG11_TMPKPTR) >> PKC_CONFIG11_TMPKPTR_Pos); +} + +/** + * @brief Set ECC parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG12 | APTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_ecc_a_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG12, PKC_CONFIG12_APTR, pointer << PKC_CONFIG12_APTR_Pos); +} + +/** + * @brief Get ECC parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG12 | APTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_ecc_a_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG12, PKC_CONFIG12_APTR) >> PKC_CONFIG12_APTR_Pos); +} + +/** + * @brief Set ECC parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG12 | BPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_ecc_b_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->CONFIG12, PKC_CONFIG12_BPTR, pointer << PKC_CONFIG12_BPTR_Pos); +} + +/** + * @brief Get ECC parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG12 | BPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_ecc_b_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->CONFIG12, PKC_CONFIG12_BPTR) >> PKC_CONFIG12_BPTR_Pos); +} + +/** + * @brief Set constant value for montgomery multiply in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG13 | CONSTP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param ConstP This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_constp(pkc_regs_t *PKCx, uint32_t ConstP) +{ + WRITE_REG(PKCx->CONFIG13, ConstP); +} + +/** + * @brief Get constant value for montgomery multiply in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG13 | CONSTP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_constp(pkc_regs_t *PKCx) +{ + return (READ_REG(PKCx->CONFIG13)); +} + +/** + * @brief Enable pkc start in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | OPSTART | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_software_start(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_OPSTART); +} + +/** + * @brief Disable pkc start in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | OPSTART | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_software_start(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_OPSTART); +} + +/** + * @brief Indicate whether the pkc start in software mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | OPSTART | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_software_start(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_OPSTART) == (PKC_SW_CTRL_OPSTART)); +} + +/** + * @brief Set operation mode in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | OPMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param operation_mode This parameter can be one of the following values: + * @arg @ref LL_PKC_operation_mode_MULTIPLY + * @arg @ref LL_PKC_operation_mode_INVERTION + * @arg @ref LL_PKC_operation_mode_ADD + * @arg @ref LL_PKC_operation_mode_SUB + * @arg @ref LL_PKC_operation_mode_COMPARE + * @arg @ref LL_PKC_operation_mode_LEFTSHIFT + * @arg @ref LL_PKC_operation_mode_BIGINTEGERMULTIPLY + * @arg @ref LL_PKC_operation_mode_BIGINTEGERADD + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_operation_mode(pkc_regs_t *PKCx, uint32_t operation_mode) +{ + MODIFY_REG(PKCx->SW_CTRL, PKC_SW_CTRL_OPMODE, operation_mode); +} + +/** + * @brief Get operation mode in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | OPMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PKC_operation_mode_MULTIPLY + * @arg @ref LL_PKC_operation_mode_INVERTION + * @arg @ref LL_PKC_operation_mode_ADD + * @arg @ref LL_PKC_operation_mode_SUB + * @arg @ref LL_PKC_operation_mode_COMPARE + * @arg @ref LL_PKC_operation_mode_LEFTSHIFT + * @arg @ref LL_PKC_operation_mode_BIGINTEGERMULTIPLY + * @arg @ref LL_PKC_operation_mode_BIGINTEGERADD + */ +__STATIC_INLINE uint32_t ll_pkc_get_operation_mode(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_OPMODE)); +} + +/** + * @brief Enable Dummy Multi in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | STARTDM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_dummy_multi(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_STARTDM); +} + +/** + * @brief Disable Dummy Multi in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | STARTDM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_dummy_multi(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_STARTDM); +} + +/** + * @brief Indicate whether the Dummy Multi in software mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | STARTDM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_dummy_multi(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_STARTDM) == (PKC_SW_CTRL_STARTDM)); +} + +/** + * @brief Enable Random Clock Gating in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | RANDEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_enable_random_clock_gating(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_RANDEN); +} + +/** + * @brief Disable Random Clock Gating in software mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | RANDEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval None + */ +__STATIC_INLINE void ll_pkc_disable_random_clock_gating(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_RANDEN); +} + +/** + * @brief Indicate whether the Random Clock Gating in software mode is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CTRL | RANDEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enabled_random_clock_gating(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CTRL, PKC_SW_CTRL_RANDEN) == (PKC_SW_CTRL_RANDEN)); +} + +/** + * @brief Set modular multiplication parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG0 | MMAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mm_a_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG0, PKC_SW_CONFIG0_MMAPTR, pointer << PKC_SW_CONFIG0_MMAPTR_Pos); +} + +/** + * @brief Get modular multiplication parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG0 | MMAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mm_a_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG0, PKC_SW_CONFIG0_MMAPTR) >> PKC_SW_CONFIG0_MMAPTR_Pos); +} + +/** + * @brief Set modular multiplication parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG0 | MMBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mm_b_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG0, PKC_SW_CONFIG0_MMBPTR, pointer << PKC_SW_CONFIG0_MMBPTR_Pos); +} + +/** + * @brief Get modular multiplication parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG0 | MMBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mm_b_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG0, PKC_SW_CONFIG0_MMBPTR) >> PKC_SW_CONFIG0_MMBPTR_Pos); +} + +/** + * @brief Set modular multiplication parameter P pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG1 | MMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mm_p_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG1, PKC_SW_CONFIG1_MMPPTR, pointer << PKC_SW_CONFIG1_MMPPTR_Pos); +} + +/** + * @brief Get modular multiplication parameter P pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG1 | MMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mm_p_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG1, PKC_SW_CONFIG1_MMPPTR) >> PKC_SW_CONFIG1_MMPPTR_Pos); +} + +/** + * @brief Set modular multiplication parameter C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG1 | MMCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mm_c_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG1, PKC_SW_CONFIG1_MMCPTR, pointer << PKC_SW_CONFIG1_MMCPTR_Pos); +} + +/** + * @brief Get modular multiplication parameter C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG1 | MMCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mm_c_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG1, PKC_SW_CONFIG1_MMCPTR) >> PKC_SW_CONFIG1_MMCPTR_Pos); +} + +/** + * @brief Set modular add/sub parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG2 | MASAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mas_a_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG2, PKC_SW_CONFIG2_MASAPTR, pointer << PKC_SW_CONFIG2_MASAPTR_Pos); +} + +/** + * @brief Get modular add/sub parameter A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG2 | MASAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mas_a_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG2, PKC_SW_CONFIG2_MASAPTR) >> PKC_SW_CONFIG2_MASAPTR_Pos); +} + +/** + * @brief Set modular add/sub parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG2 | MASBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mas_b_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG2, PKC_SW_CONFIG2_MASBPTR, pointer << PKC_SW_CONFIG2_MASBPTR_Pos); +} + +/** + * @brief Get modular add/sub parameter B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG2 | MASBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mas_b_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG2, PKC_SW_CONFIG2_MASBPTR) >> PKC_SW_CONFIG2_MASBPTR_Pos); +} + +/** + * @brief Set modular add/sub parameter P pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG3 | MASPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mas_p_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG3, PKC_SW_CONFIG3_MASPPTR, pointer << PKC_SW_CONFIG3_MASPPTR_Pos); +} + +/** + * @brief Get modular add/sub parameter P pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG3 | MASPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mas_p_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG3, PKC_SW_CONFIG3_MASPPTR) >> PKC_SW_CONFIG3_MASPPTR_Pos); +} + +/** + * @brief Set modular add/sub parameter C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG3 | MASCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mas_c_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG3, PKC_SW_CONFIG3_MASCPTR, pointer << PKC_SW_CONFIG3_MASCPTR_Pos); +} + +/** + * @brief Get modular add/sub parameter C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG3 | MASCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mas_c_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG3, PKC_SW_CONFIG3_MASCPTR) >> PKC_SW_CONFIG3_MASCPTR_Pos); +} + +/** + * @brief Set modular invertion parameter U pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG4 | MIUPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mi_u_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG4, PKC_SW_CONFIG4_MIUPTR, pointer << PKC_SW_CONFIG4_MIUPTR_Pos); +} + +/** + * @brief Get modular invertion parameter U pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG4 | MIUPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mi_u_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG4, PKC_SW_CONFIG4_MIUPTR) >> PKC_SW_CONFIG4_MIUPTR_Pos); +} + +/** + * @brief Set modular invertion parameter V pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG4 | MIVPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mi_v_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG4, PKC_SW_CONFIG4_MIVPTR, pointer << PKC_SW_CONFIG4_MIVPTR_Pos); +} + +/** + * @brief Get modular invertion parameter V pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG4 | MIVPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mi_v_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG4, PKC_SW_CONFIG4_MIVPTR) >> PKC_SW_CONFIG4_MIVPTR_Pos); +} + +/** + * @brief Set modular invertion parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG5 | MIX1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mi_x1_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG5, PKC_SW_CONFIG5_MIX1PTR, pointer << PKC_SW_CONFIG5_MIX1PTR_Pos); +} + +/** + * @brief Get modular invertion parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG5 | MIX1PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mi_x1_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG5, PKC_SW_CONFIG5_MIX1PTR) >> PKC_SW_CONFIG5_MIX1PTR_Pos); +} + +/** + * @brief Set modular invertion parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG5 | MIX2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_mi_x2_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG5, PKC_SW_CONFIG5_MIX2PTR, pointer << PKC_SW_CONFIG5_MIX2PTR_Pos); +} + +/** + * @brief Get modular invertion parameter X1 pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG5 | MIX2PTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_mi_x2_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG5, PKC_SW_CONFIG5_MIX2PTR) >> PKC_SW_CONFIG5_MIX2PTR_Pos); +} + +/** + * @brief Set modular invertion parameter Tmp pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG6 | MITMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter is the offset in pkc sram, and the value can between: 0 ~ 0x200 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_swmi_tmp_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG6, PKC_SW_CONFIG6_MITMPPTR, pointer << PKC_SW_CONFIG6_MITMPPTR_Pos); +} + +/** + * @brief Get modular invertion parameter Tmp pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG6 | MITMPPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x200 + */ +__STATIC_INLINE uint32_t ll_pkc_get_swmi_tmp_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG6, PKC_SW_CONFIG6_MITMPPTR) >> PKC_SW_CONFIG6_MITMPPTR_Pos); +} + +/** + * @brief Set operation word length-bits. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG7 | WORDLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param WordLength This parameter can be one of the following values: 256 ~ 2048 + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_operation_word_length(pkc_regs_t *PKCx, uint32_t WordLength) +{ + MODIFY_REG(PKCx->SW_CONFIG7, PKC_SW_CONFIG7_WORDLEN, (WordLength >> 5) - 1); +} + +/** + * @brief Get operation word length-bits. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG7 | WORDLEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 256 ~ 2048 + */ +__STATIC_INLINE uint32_t ll_pkc_get_operation_word_length(pkc_regs_t *PKCx) +{ + return ((READ_BITS(PKCx->SW_CONFIG7, PKC_SW_CONFIG7_WORDLEN) + 1) << 5); +} + +/** + * @brief Get K output in invertion operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG8 | MIKOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FFF + */ +__STATIC_INLINE uint32_t ll_pkc_get_mik_output(pkc_regs_t *PKCx) +{ + return (READ_REG(PKCx->SW_CONFIG8) & PKC_SW_CONFIG8_MIKOUT_Msk); +} + +/** + * @brief Set dummy multiply seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG9 | DMRNGSEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param seed This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_dummy_multiply_seed(pkc_regs_t *PKCx, uint32_t seed) +{ + WRITE_REG(PKCx->SW_CONFIG9, seed); +} + +/** + * @brief Get dummy multiply seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG9 | DMRNGSEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pkc_get_dummy_multiply_seed(pkc_regs_t *PKCx) +{ + return (READ_REG(PKCx->SW_CONFIG9)); +} + +/** + * @brief Set big integer operand A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG10 | BMAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_bm_a_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG10, PKC_SW_CONFIG10_BMAPTR, pointer << PKC_SW_CONFIG10_BMAPTR_Pos); +} + +/** + * @brief Get big integer operand A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG10 | BMAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_bm_a_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG10, PKC_SW_CONFIG10_BMAPTR) >> PKC_SW_CONFIG10_BMAPTR_Pos); +} + +/** + * @brief Set big integer operand B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG10 | BMBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_bm_b_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG10, PKC_SW_CONFIG10_BMBPTR, pointer << PKC_SW_CONFIG10_BMBPTR_Pos); +} + +/** + * @brief Get big integer operand B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG10 | BMBPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_bm_b_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG10, PKC_SW_CONFIG10_BMBPTR) >> PKC_SW_CONFIG10_BMBPTR_Pos); +} + +/** + * @brief Set big integer result C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG11 | BMCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_bm_c_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG11, PKC_SW_CONFIG11_BMCPTR, pointer << PKC_SW_CONFIG11_BMCPTR_Pos); +} + +/** + * @brief Get big integer result C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG11 | BMCPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_bm_c_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG11, PKC_SW_CONFIG11_BMCPTR) >> PKC_SW_CONFIG11_BMCPTR_Pos); +} + +/** + * @brief Set big integer operand A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG11 | BAAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_ba_a_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG11, PKC_SW_CONFIG11_BAAPTR, pointer << PKC_SW_CONFIG11_BAAPTR_Pos); +} + +/** + * @brief Get big integer operand A pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG11 | BAAPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_ba_a_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG11, PKC_SW_CONFIG11_BAAPTR) >> PKC_SW_CONFIG11_BAAPTR_Pos); +} + +/** + * @brief Set big integer operand B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG12 | BABPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_ba_b_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG12, PKC_SW_CONFIG12_BABPTR, pointer << PKC_SW_CONFIG12_BABPTR_Pos); +} + +/** + * @brief Get big integer operand B pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG12 | BABPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_ba_b_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG12, PKC_SW_CONFIG12_BABPTR) >> PKC_SW_CONFIG12_BABPTR_Pos); +} + +/** + * @brief Set big integer result C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG12 | BACPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param pointer This parameter can be one of the following values: 0 ~ 0x1FF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_ba_c_pointer(pkc_regs_t *PKCx, uint32_t pointer) +{ + MODIFY_REG(PKCx->SW_CONFIG12, PKC_SW_CONFIG12_BACPTR, pointer << PKC_SW_CONFIG12_BACPTR_Pos); +} + +/** + * @brief Get big integer result C pointer in pkc sram. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG12 | BACPTR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0x1FF + */ +__STATIC_INLINE uint32_t ll_pkc_get_ba_c_pointer(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->SW_CONFIG12, PKC_SW_CONFIG12_BACPTR) >> PKC_SW_CONFIG12_BACPTR_Pos); +} + +/** + * @brief Set random clock gating seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG13 | RANDSEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @param seed This parameter can be one of the following values: 0 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pkc_set_random_clock_gating_seed(pkc_regs_t *PKCx, uint32_t seed) +{ + WRITE_REG(PKCx->SW_CONFIG13, seed); +} + +/** + * @brief Get random clock gating seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SW_CONFIG13 | RANDSEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval Return value is between: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pkc_get_random_clock_gating_seed(pkc_regs_t *PKCx) +{ + return (READ_REG(PKCx->SW_CONFIG13)); +} + +/** @} */ + +/** @defgroup PKC_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable the operation done interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_enable_it_done(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTEN, PKC_INTEN_DONE); +} + +/** + * @brief Enable the operation error interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_enable_it_err(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTEN, PKC_INTEN_ERR); +} + +/** + * @brief Enable the big integer overflow interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | BAOVF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_enable_it_big_add_overflow(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTEN, PKC_INTEN_BAOVF); +} + +/** + * @brief Disable the operation done interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_disable_it_done(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->INTEN, PKC_INTEN_DONE); +} + +/** + * @brief Disable the operation error interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_disable_it_err(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->INTEN, PKC_INTEN_ERR); +} + +/** + * @brief Disable the big integer overflow interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | BAOVF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_disable_it_big_add_overflow(pkc_regs_t *PKCx) +{ + CLEAR_BITS(PKCx->INTEN, PKC_INTEN_BAOVF); +} + +/** + * @brief Indicate whether the operation done interrupt is enable. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enable_it_done(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTEN, PKC_INTEN_DONE) == PKC_INTEN_DONE); +} + +/** + * @brief Indicate whether the operation error interrupt is enable. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enable_it_err(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTEN, PKC_INTEN_ERR) == PKC_INTEN_ERR); +} + +/** + * @brief Indicate whether the big integer overflow interrupt is enable. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | BAOVF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_enable_it_big_add_overflow(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTEN, PKC_INTEN_BAOVF) == PKC_INTEN_BAOVF); +} + +/** @} */ + +/** @defgroup PKC_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Indicate whether the operation done interrupt is pending. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_action_flag_it_done(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTSTAT, PKC_INTSTAT_DONE) == PKC_INTSTAT_DONE); +} + +/** + * @brief Indicate whether the operation error interrupt is pending. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_action_flag_it_err(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTSTAT, PKC_INTSTAT_ERR) == PKC_INTSTAT_ERR); +} + +/** + * @brief Indicate whether the big integer overflow interrupt is pending. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | BAOVF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_action_flag_it_big_add_overflow(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->INTSTAT, PKC_INTSTAT_BAOVF) == PKC_INTSTAT_BAOVF); +} + +/** + * @brief Clear the operation done interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | DONE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_clear_flag_it_done(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTSTAT, PKC_INTSTAT_DONE); +} + +/** + * @brief Clear the operation error interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | ERR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_clear_flag_it_err(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTSTAT, PKC_INTSTAT_ERR); +} + +/** + * @brief Clear the big integer overflow interrupt flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | BAOVF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval none. + */ +__STATIC_INLINE void ll_pkc_clear_flag_it_big_add_overflow(pkc_regs_t *PKCx) +{ + SET_BITS(PKCx->INTSTAT, PKC_INTSTAT_BAOVF); +} + +/** + * @brief Indicate whether the busy flag is set. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | WORKSTAT | BUSY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PKCx PKC instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pkc_is_action_flag_busy(pkc_regs_t *PKCx) +{ + return (READ_BITS(PKCx->WORKSTAT, PKC_WORKSTAT_BUSY) == PKC_WORKSTAT_BUSY); +} + +/** @} */ + +/** @defgroup PKC_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize PKC registers (Registers restored to their default values). + * @param PKCx PKC Instance + * @retval An error_status_t enumeration value: + * - SUCCESS: PKC registers are de-initialized + * - ERROR: PKC registers are not de-initialized + */ +error_status_t ll_pkc_deinit(pkc_regs_t *PKCx); + +/** + * @brief Initialize PKC registers according to the specified + * parameters in p_pkc_init. + * @param PKCx PKC Instance + * @param p_pkc_init pointer to a ll_pkc_init_t structure that contains the configuration + * information for the specified PKC peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: PKC registers are initialized according to p_pkc_init content + * - ERROR: Problem occurred during PKC Registers initialization + */ +error_status_t ll_pkc_init(pkc_regs_t *PKCx, ll_pkc_init_t *p_pkc_init); + +/** + * @brief Set each field of a @ref ll_pkc_init_t type structure to default value. + * @param p_pkc_init pointer to a @ref ll_pkc_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_pkc_struct_init(ll_pkc_init_t *p_pkc_init); + +/** @} */ + +/** @} */ + +#endif /* PKC */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_PKC_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwm.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwm.h new file mode 100644 index 0000000..b8a1bd1 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwm.h @@ -0,0 +1,1971 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_pwm.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWM LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_PWM PWM + * @brief PWM LL module driver. + * @{ + */ + +#ifndef __GR55XX_LL_PWM_H__ +#define __GR55XX_LL_PWM_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "gr55xx.h" + +#if defined (PWM0) || defined (PWM1) + +/** @defgroup PWM_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup PWM_LL_ES_INIT PWM Exported init structures + * @{ + */ + +/** + * @brief LL PWM Output Channel init Structure definition. + */ +typedef struct _ll_pwm_channel_init_t +{ + uint8_t duty; /**< Specifies the duty in PWM output mode. + This parameter must be a number ranges between Min_Data=0 and Max_Data=100. + + This feature can be modified afterwards using unitary function ll_pwm_set_compare_xn() + where X can be (A, B, C) and n can be (0, 1).*/ + + uint8_t drive_polarity; /**< Specifies the drive polarity in PWM output mode. + This parameter can be a value of @ref PWM_LL_EC_DRIVEPOLARITY. + + This feature can be modified afterwards using unitary function ll_pwm_enable_positive_drive_channel_x() + and ll_pwm_disable_positive_drive_channel_x() where X can be (A, B, C).*/ + +} ll_pwm_channel_init_t; + +/** + * @brief LL PWM init Structure definition. + */ +typedef struct _ll_pwm_init_t +{ + uint32_t mode; /**< Specifies the PWM output mode. + This parameter can be a value of @ref PWM_LL_EC_MODE. + + This feature can be modified afterwards using unitary function @ref ll_pwm_set_mode().*/ + + uint32_t align; /**< Specifies the PWM alignment pulses. + This parameter can be a value of @ref PWM_LL_EC_ALIGN.*/ + + uint32_t prescaler; /**< Specifies the prescaler value which will be used configure PWM output frequency. + This parameter must be a number ranges between Min_Data = 0 and Max_Data = 0xFFFFFFFF. + This parameter should be larger than 128. + + This feature can be modified afterwards using unitary function @ref ll_pwm_set_prescaler().*/ + + uint32_t bprescaler; /**< Specifies the required prescaler that the duty changes from 0% to 100% in breath mode. + This parameter must be a number ranges between Min_Data=0 and Max_Data=0xFFFFFFFF. + This parameter is recommended to be larger than 128*prescaler to guarantee an ideal breath effect. + + This feature can be modified afterwards using unitary function @ref ll_pwm_set_breath_prescaler().*/ + + uint32_t hprescaler; /**< Specifies the required prescaler in breath hold state. + This parameter must be a number ranges between Min_Data=0 and Max_Data=0xFFFFFF. + + This feature can be modified afterwards using unitary function @ref ll_pwm_set_hold_prescaler().*/ + + ll_pwm_channel_init_t channel_a; /**< Specifies the configuration of channelA. + This parameter can be a value of @ref ll_pwm_channel_init_t.*/ + + ll_pwm_channel_init_t channel_b; /**< Specifies the configuration of channelB. + This parameter can be a value of @ref ll_pwm_channel_init_t.*/ + + ll_pwm_channel_init_t channel_c; /**< Specifies the configuration of channelC. + This parameter can be a value of @ref ll_pwm_channel_init_t.*/ + +} ll_pwm_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup PWM_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWM_LL_Exported_Constants PWM Exported Constants + * @{ + */ + +/** @defgroup PWM_LL_EC_MODE PWM mode + * @{ + */ +#define LL_PWM_FLICKER_MODE (0x00000000U) /**< PWM flicker mode */ +#define LL_PWM_BREATH_MODE PWM_MODE_BREATHEN /**< PWM breath mode */ +/** @} */ + +/** @defgroup PWM_LL_EC_ALIGN PWM alignment pulses + * @{ + */ +#define LL_PWM_EDGE_ALIGNED (0x00000000U) /**< PWM edge-aligned */ +#define LL_PWM_CENTER_ALIGNED (0x00000001U) /**< PWM center-aligned */ +/** @} */ + +/** @defgroup PWM_LL_EC_DRIVEPOLARITY PWM drive polarity + * @{ + */ +#define LL_PWM_DRIVEPOLARITY_NEGATIVE (0x00000000U) /**< PWM led-negative-drive mode */ +#define LL_PWM_DRIVEPOLARITY_POSITIVE (0x00000001U) /**< PWM led-positive-drive mode */ +/** @} */ + +/** @defgroup PWM_LL_EC_ACTIONEVENT PWM action event + * @{ + */ +#define LL_PWM_ACTIONEVENT_NONE (0x00000000U) /**< No action event */ +#define LL_PWM_ACTIONEVENT_CLEAR (0x00000001U) /**< Action event CLEAR */ +#define LL_PWM_ACTIONEVENT_SET (0x00000002U) /**< Action event SET */ +#define LL_PWM_ACTIONEVENT_TOGGLE (0x00000003U) /**< Action event TOGGLE */ +/** @} */ + +/** @defgroup PWM_LL_EC_PERIOD_UNIT PWM period unit default configuretion + * @{ + */ +#define LL_PWM_PRESCALER_UNIT (128) /**< The unit of prescaler is 128 */ +#define LL_PWM_BREATH_PRESCALER_UNIT (128) /**< The unit of breath prescaler is 128 */ +#define LL_PWM_HOLD_PRESCALER_UNIT (10) /**< The unit of hold prescaler is 10 */ +/** @} */ + +/** @defgroup PWM_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL PWM Channel InitStrcut default configuartion + */ +#define LL_PWM_CHANNEL_DEFAULT_CONFIG \ +{ \ + .duty = 50, \ + .drive_polarity = LL_PWM_DRIVEPOLARITY_POSITIVE, \ +} + +/** + * @brief LL PWM InitStrcut default configuartion + */ +#define LL_PWM_DEFAULT_CONFIG \ +{ \ + .mode = LL_PWM_FLICKER_MODE, \ + .align = LL_PWM_EDGE_ALIGNED, \ + .prescaler = 10 * LL_PWM_PRESCALER_UNIT, \ + .bprescaler = 10 * LL_PWM_BREATH_PRESCALER_UNIT * 10 * LL_PWM_PRESCALER_UNIT, \ + .hprescaler = 10 * LL_PWM_HOLD_PRESCALER_UNIT * 10 * LL_PWM_PRESCALER_UNIT, \ + .channel_a = LL_PWM_CHANNEL_DEFAULT_CONFIG, \ + .channel_b = LL_PWM_CHANNEL_DEFAULT_CONFIG, \ + .channel_c = LL_PWM_CHANNEL_DEFAULT_CONFIG, \ +} + +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWM_LL_Exported_Macros PWM Exported Macros + * @{ + */ + +/** @defgroup PWM_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in PWM register + * @param __instance__ PWM instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_PWM_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in PWM register + * @param __instance__ PWM instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_PWM_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PWM_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup PWM_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable PWM. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->MODE, PWM_MODE_EN); +} + +/** + * @brief Disable PWM. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->MODE, PWM_MODE_EN); +} + +/** + * @brief Indicate whether the PWM is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_EN) == (PWM_MODE_EN)); +} + +/** + * @brief Enable PWM pause. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | PAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_pause(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->MODE, PWM_MODE_PAUSE); +} + +/** + * @brief Disable PWM pause. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | PAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_pause(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->MODE, PWM_MODE_PAUSE); +} + +/** + * @brief Indicate whether the PWM pause is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | PAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_pause(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_PAUSE) == (PWM_MODE_PAUSE)); +} + +/** + * @brief Set PWM mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | BREATHEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param mode This parameter can be one of the following values: + * @arg @ref LL_PWM_FLICKER_MODE + * @arg @ref LL_PWM_BREATH_MODE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_mode(pwm_regs_t *PWMx, uint32_t mode) +{ + MODIFY_REG(PWMx->MODE, PWM_MODE_BREATHEN, mode); +} + +/** + * @brief Get PWM mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | BREATHEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_FLICKER_MODE + * @arg @ref LL_PWM_BREATH_MODE + */ +__STATIC_INLINE uint32_t ll_pwm_get_mode(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_BREATHEN)); +} + +/** + * @brief Enable positive drive mode in channelA. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_positive_drive_channel_a(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->MODE, PWM_MODE_DPENA); +} + +/** + * @brief Disable positive drive mode in channelA. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_positive_drive_channel_a(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->MODE, PWM_MODE_DPENA); +} + +/** + * @brief Indicate whether the positive drive mode in channelA is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_positive_drive_channel_a(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_DPENA) == (PWM_MODE_DPENA)); +} + +/** + * @brief Enable positive drive mode in channelB. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_positive_drive_channel_b(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->MODE, PWM_MODE_DPENB); +} + +/** + * @brief Disable positive drive mode in channelB. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_positive_drive_channel_b(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->MODE, PWM_MODE_DPENB); +} + +/** + * @brief Indicate whether the positive drive mode in channelB is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_positive_drive_channel_b(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_DPENB) == (PWM_MODE_DPENB)); +} + +/** + * @brief Enable positive drive mode in channelC. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_positive_drive_channel_c(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->MODE, PWM_MODE_DPENC); +} + +/** + * @brief Disable positive drive mode in channelC. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_positive_drive_channel_c(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->MODE, PWM_MODE_DPENC); +} + +/** + * @brief Indicate whether the positive drive mode in channelC is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MODE | DPENC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_positive_drive_channel_c(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->MODE, PWM_MODE_DPENC) == (PWM_MODE_DPENC)); +} + +/** + * @brief Check update active flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SAG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_active_flag_update_all(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SAG) == (PWM_UPDATE_SAG)); +} + +/** + * @brief Enable update all parameters. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_all(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SA); +} + +/** + * @brief Disable update all parameters. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_all(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SA); +} + +/** + * @brief Indicate whether the update all parameters is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_all(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SA) == (PWM_UPDATE_SA)); +} + +/** + * @brief Enable update period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_period(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSPRD); +} + +/** + * @brief Disable update period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_period(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSPRD); +} + +/** + * @brief Indicate whether the update period is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_period(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSPRD) == (PWM_UPDATE_SSPRD)); +} + +/** + * @brief Enable update compareA0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_a0(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA0); +} + +/** + * @brief Disable update compareA0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_a0(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA0); +} + +/** + * @brief Indicate whether the update compareA0 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_a0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA0) == (PWM_UPDATE_SSCMPA0)); +} + +/** + * @brief Enable update compareA1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_a1(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA1); +} + +/** + * @brief Disable update compareA1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_a1(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA1); +} + +/** + * @brief Indicate whether the update compareA1 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPA1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_a1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPA1) == (PWM_UPDATE_SSCMPA1)); +} + +/** + * @brief Enable update compareB0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_b0(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB0); +} + +/** + * @brief Disable update compareB0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_b0(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB0); +} + +/** + * @brief Indicate whether the update compareB0 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_b0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB0) == (PWM_UPDATE_SSCMPB0)); +} + +/** + * @brief Enable update compareB1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_b1(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB1); +} + +/** + * @brief Disable update compareB1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_b1(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB1); +} + +/** + * @brief Indicate whether the update compareB1 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPB1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_b1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPB1) == (PWM_UPDATE_SSCMPB1)); +} + +/** + * @brief Enable update compareC0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_c0(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC0); +} + +/** + * @brief Disable update compareC0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_c0(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC0); +} + +/** + * @brief Indicate whether the update compareC0 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_c0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC0) == (PWM_UPDATE_SSCMPC0)); +} + +/** + * @brief Enable update compareC1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_compare_c1(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC1); +} + +/** + * @brief Disable update compareC1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_compare_c1(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC1); +} + +/** + * @brief Indicate whether the update compareC1 is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSCMPC1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_compare_c1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSCMPC1) == (PWM_UPDATE_SSCMPC1)); +} + +/** + * @brief Enable update pause. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_pause(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSPAUSE); +} + +/** + * @brief Disable update pause. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_pause(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSPAUSE); +} + +/** + * @brief Indicate whether the update pause is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSPAUSE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_pause(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSPAUSE) == (PWM_UPDATE_SSPAUSE)); +} + +/** + * @brief Enable update breath period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSBRPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_breath_period(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSBRPRD); +} + +/** + * @brief Disable update breath period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSBRPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_breath_period(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSBRPRD); +} + +/** + * @brief Indicate whether the update breath period is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSBRPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_breath_period(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSBRPRD) == (PWM_UPDATE_SSBRPRD)); +} + +/** + * @brief Enable update hold period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSHOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_hold_period(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSHOLD); +} + +/** + * @brief Disable update hold period. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSHOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_hold_period(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSHOLD); +} + +/** + * @brief Indicate whether the update hold period is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSHOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_hold_period(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSHOLD) == (PWM_UPDATE_SSHOLD)); +} + +/** + * @brief Enable update active event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSAQCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_enable_update_active_event(pwm_regs_t *PWMx) +{ + SET_BITS(PWMx->UPDATE, PWM_UPDATE_SSAQCTRL); +} + +/** + * @brief Disable update active event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSAQCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval None + */ +__STATIC_INLINE void ll_pwm_disable_update_active_event(pwm_regs_t *PWMx) +{ + CLEAR_BITS(PWMx->UPDATE, PWM_UPDATE_SSAQCTRL); +} + +/** + * @brief Indicate whether the update active event is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | UPDATE | SSAQCTRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwm_is_enabled_update_active_event(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->UPDATE, PWM_UPDATE_SSAQCTRL) == (PWM_UPDATE_SSAQCTRL)); +} + +/** + * @brief Set the PWM prescaler. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PRD | PRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param prescaler This parameter ranges between Min_Data=1 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_prescaler(pwm_regs_t *PWMx, uint32_t prescaler) +{ + WRITE_REG(PWMx->PRD, prescaler); +} + +/** + * @brief Get the PWM prescaler. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PRD | PRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=1 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_prescaler(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->PRD)); +} + +/** + * @brief Set the PWM compare counter A0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPA0 | CMPA0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_a0(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPA0, compare); +} + +/** + * @brief Get the PWM compare counter A0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPA0 | CMPA0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_a0(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPA0)); +} + +/** + * @brief Set the PWM compare counter A1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPA1 | CMPA1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_a1(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPA1, compare); +} + +/** + * @brief Get the PWM compare counter A1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPA1 | CMPA1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_a1(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPA1)); +} + +/** + * @brief Set the PWM compare counter B0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPB0 | CMPB0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_b0(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPB0, compare); +} + +/** + * @brief Get the PWM compare counter B0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPB0 | CMPB0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_b0(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPB0)); +} + +/** + * @brief Set the PWM compare counter B1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPB1 | CMPB1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_b1(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPB1, compare); +} + +/** + * @brief Get the PWM compare counter B1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPB1 | CMPB1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_b1(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPB1)); +} + +/** + * @brief Set the PWM compare counter C0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPC0 | CMPC0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_c0(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPC0, compare); +} + +/** + * @brief Get the PWM compare counter C0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPC0 | CMPC0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_c0(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPC0)); +} + +/** + * @brief Set the PWM compare counter C1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPC1 | CMPC1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param compare This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_compare_c1(pwm_regs_t *PWMx, uint32_t compare) +{ + WRITE_REG(PWMx->CMPC1, compare); +} + +/** + * @brief Get the PWM compare counter C1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CMPC1 | CMPC1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_compare_c1(pwm_regs_t *PWMx) +{ + return (READ_REG(PWMx->CMPC1)); +} + +/** + * @brief Set the channel A0 action event when PWM counter value reaches compare counter A0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | A0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_a0(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_A0, action_event << PWM_AQCTRL_A0_Pos); +} + +/** + * @brief Get the channel A0 action event when PWM counter value reaches compare counter A0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | A0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_a0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_A0) >> PWM_AQCTRL_A0_Pos); +} + +/** + * @brief Set the channel A1 action event when PWM counter value reaches compare counter A1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | A1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_a1(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_A1, action_event << PWM_AQCTRL_A1_Pos); +} + +/** + * @brief Get the channel A1 action event when PWM counter value reaches compare counter A1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | A1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_a1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_A1) >> PWM_AQCTRL_A1_Pos); +} + +/** + * @brief Set the channel B0 action event when PWM counter value reaches compare counter B0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | B0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_b0(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_B0, action_event << PWM_AQCTRL_B0_Pos); +} + +/** + * @brief Get the channel B0 action event when PWM counter value reaches compare counter B0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | B0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_b0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_B0) >> PWM_AQCTRL_B0_Pos); +} + +/** + * @brief Set the channel B1 action event when PWM counter value reaches compare counter B1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | B1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_b1(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_B1, action_event << PWM_AQCTRL_B1_Pos); +} + +/** + * @brief Get the channel B1 action event when PWM counter value reaches compare counter B1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | B1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_b1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_B1) >> PWM_AQCTRL_B1_Pos); +} + +/** + * @brief Set the channel C0 action event when PWM counter value reaches compare counter C0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | C0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_c0(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_C0, action_event << PWM_AQCTRL_C0_Pos); +} + +/** + * @brief Get the channel C0 action event when PWM counter value reaches compare counter C0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | C0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_c0(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_C0) >> PWM_AQCTRL_C0_Pos); +} + +/** + * @brief Set the channel C1 action event when PWM counter value reaches compare counter C1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | C1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param action_event This parameter can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_action_event_cmp_c1(pwm_regs_t *PWMx, uint32_t action_event) +{ + MODIFY_REG(PWMx->AQCTRL, PWM_AQCTRL_C1, action_event << PWM_AQCTRL_C1_Pos); +} + +/** + * @brief Get the channel C1 action event when PWM counter value reaches compare counter C1. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AQCTRL | C1 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value can be one of the following values: + * @arg @ref LL_PWM_ACTIONEVENT_NONE + * @arg @ref LL_PWM_ACTIONEVENT_CLEAR + * @arg @ref LL_PWM_ACTIONEVENT_SET + * @arg @ref LL_PWM_ACTIONEVENT_TOGGLE + */ +__STATIC_INLINE uint32_t ll_pwm_get_action_event_cmp_c1(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->AQCTRL, PWM_AQCTRL_C1) >> PWM_AQCTRL_C1_Pos); +} + +/** + * @brief Set the breath prescaler in breath mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BRPRD | BRPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param bprescaler This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_breath_prescaler(pwm_regs_t *PWMx, uint32_t bprescaler) +{ + MODIFY_REG(PWMx->BRPRD, PWM_BRPRD_BRPRD, bprescaler); +} + +/** + * @brief Get the breath prescaler in breath mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BRPRD | BRPRD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_breath_prescaler(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->BRPRD, PWM_BRPRD_BRPRD)); +} + +/** + * @brief Set the hold prescaler in breath mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | HOLD | HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @param hprescaler This parameter ranges between Min_Data=0 and Max_Data=0xFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_pwm_set_hold_prescaler(pwm_regs_t *PWMx, uint32_t hprescaler) +{ + MODIFY_REG(PWMx->HOLD, PWM_HOLD_HOLD, hprescaler); +} + +/** + * @brief Get the hold prescaler in breath mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | HOLD | HOLD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param PWMx PWM instance + * @retval Return value ranges between Min_Data=0 and Max_Data=0xFFFFFF + */ +__STATIC_INLINE uint32_t ll_pwm_get_hold_prescaler(pwm_regs_t *PWMx) +{ + return (READ_BITS(PWMx->HOLD, PWM_HOLD_HOLD)); +} + +/** @} */ + +/** @defgroup PWM_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize PWM registers (Registers restored to their default values). + * @param PWMx PWM instance + * @retval An error_status_t enumeration value: + * - SUCCESS: PWM registers are de-initialized + * - ERROR: PWM registers are not de-initialized + */ +error_status_t ll_pwm_deinit(pwm_regs_t *PWMx); + +/** + * @brief Initialize PWM registers according to the specified + * parameters in PWM_InitStruct. + * @param PWMx PWM instance + * @param p_pwm_init Pointer to a ll_pwm_init_t structure that contains the configuration + * information for the specified PWM peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: PWM registers are initialized according to p_pwm_init content + * - ERROR: Problem occurred during PWM Registers initialization + */ +error_status_t ll_pwm_init(pwm_regs_t *PWMx, ll_pwm_init_t *p_pwm_init); + +/** + * @brief Set each field of a @ref ll_pwm_init_t type structure to default value. + * @param p_pwm_init Pointer to a @ref ll_pwm_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_pwm_struct_init(ll_pwm_init_t *p_pwm_init); + +/** @} */ + +/** @} */ + +#endif /* PWM0 || PWM1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_PWM_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwr.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwr.h new file mode 100644 index 0000000..3831c10 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_pwr.h @@ -0,0 +1,1531 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_pwr.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of PWR LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_PWR PWR + * @brief PWR LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_PWR_H__ +#define __GR55xx_LL_PWR_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined(AON) + +/** + * @defgroup PWR_LL_MACRO Defines + * @{ + */ + +/* Private types -------------------------------------------------------------*/ +/* Private variables ---------------------------------------------------------*/ +/* Private constants ---------------------------------------------------------*/ +/** @defgroup PWR_LL_Private_Constants PWR Private Constants + * @{ + */ + +/** @defgroup PWR_LL_PC_EXT_WAKEUP_CTL_LSB External Wakeup Control Low Significant Bit Defines + * @{ + */ +#define LL_PWR_EXTWKUP_TYPE_LSB (0x01U << AON_EXT_WKUP_CTL_TYPE_Pos) /**< External wakeup level type */ +#define LL_PWR_EXTWKUP_INVERT_LSB (0x01U << AON_EXT_WKUP_CTL_INVERT_Pos) /**< External wakeup level invert */ +#define LL_PWR_EXTWKUP_SRC_EN_LSB (0x01U << AON_EXT_WKUP_CTL_SRC_EN_Pos) /**< External wakeup source enable */ +/** @} */ + +/** @} */ + +/* Private macros ------------------------------------------------------------*/ +/** @defgroup PWR_LL_Private_Macro PWR Private Macros + * @{ + */ + +/** @defgroup PWR_LL_PM_EXT_WAKEUP_CTL_LSB External Wakeup Control Low Significant Bit Defines + * @{ + */ + +/** + * @brief PWR_LL_PM_GET_MEM_PWR_MSK PWR Get Memory Power Value Mask + */ +#define __LL_PWR_GET_MEM_PWR_MASK(__POWER__) (((__POWER__) == LL_PWR_MEM_POWER_OFF) ? 0x0U : \ + (((__POWER__) == LL_PWR_MEM_POWER_FULL) ? 0xAAAAAAAAU : 0xFFFFFFFFU)) + +/** @} */ + +/** @} */ + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Constants PWR Exported Constants + * @{ + */ + +/** @defgroup PWR_LL_EC_WAKEUP_COND Wakeup Condition + * @{ + */ +#define LL_PWR_WKUP_COND_EXT AON_PWR_REG01_WAKE_UP_SEL_EXTWKUP /**< External wakeup: AON_GPIO */ +#define LL_PWR_WKUP_COND_TIMER AON_PWR_REG01_WAKE_UP_SEL_TIMER /**< AON Timer wakeup */ +#define LL_PWR_WKUP_COND_BLE AON_PWR_REG01_WAKE_UP_SEL_BLE /**< BLE wakeup */ +#define LL_PWR_WKUP_COND_CALENDAR AON_PWR_REG01_WAKE_UP_SEL_CALENDAR /**< Calendar wakeup */ +#define LL_PWR_WKUP_COND_BOD_FEDGE AON_PWR_REG01_WAKE_UP_SEL_PMU_BOD_FEDGE /**< PMU Bod falling edge wakeup */ +#define LL_PWR_WKUP_COND_MSIO_COMP AON_PWR_REG01_WAKE_UP_SEL_MSIO_COMP /**< Msio comparator wakeup */ +#define LL_PWR_WKUP_COND_ALL AON_PWR_REG01_WAKE_UP_SEL /**< All wakeup sources mask */ +/** @} */ + + +/** @defgroup PWR_LL_EC_WAKEUP_EVT Wakeup Event + * @note Only available on GR5515_C and later version + * @{ + */ +#define LL_PWR_WKUP_EVENT_BLE AON_SLP_EVENT_SMCOSCEN /**< BLE Timer wakeup event */ +#define LL_PWR_WKUP_EVENT_TIMER AON_SLP_EVENT_TIMER /**< AON Timer wakeup event */ +#define LL_PWR_WKUP_EVENT_EXT AON_SLP_EVENT_EXTWKUP /**< External wakeup event: AON_GPIO */ +#define LL_PWR_WKUP_EVENT_BOD_FEDGE AON_SLP_EVENT_PMU_BOD_FEDGE /**< PMU Bod wakeup event */ +#define LL_PWR_WKUP_EVENT_MSIO_COMP AON_SLP_EVENT_PMU_MSIO_COMP /**< Msio comparator wakeup event */ +#define LL_PWR_WKUP_EVENT_WDT AON_SLP_EVENT_WDT_REBOOT /**< AON WDT wakeup event */ +#define LL_PWR_WKUP_EVENT_CALENDAR AON_SLP_EVENT_CALENDAR_TIMER_ALARM /**< Calendar wakeup event */ +#define LL_PWR_WKUP_EVENT_ALL (AON_SLP_EVENT_SMCOSCEN | \ + AON_SLP_EVENT_TIMER | \ + AON_SLP_EVENT_EXTWKUP | \ + AON_SLP_EVENT_PMU_BOD_FEDGE | \ + AON_SLP_EVENT_PMU_MSIO_COMP | \ + AON_SLP_EVENT_WDT_REBOOT | \ + AON_SLP_EVENT_CALENDAR_TIMER_ALARM) /**< All event mask */ +/** @} */ + +/** @defgroup PWR_LL_EC_EXTWAKEUP_PIN External Wakeup Pins + * @{ + */ +#define LL_PWR_EXTWKUP_PIN0 (0x00000001U) /**< WKUP pin 0 : AON_GPIO_PIN0 */ +#define LL_PWR_EXTWKUP_PIN1 (0x00000002U) /**< WKUP pin 1 : AON_GPIO_PIN1 */ +#define LL_PWR_EXTWKUP_PIN2 (0x00000004U) /**< WKUP pin 2 : AON_GPIO_PIN2 */ +#define LL_PWR_EXTWKUP_PIN3 (0x00000008U) /**< WKUP pin 3 : AON_GPIO_PIN3 */ +#define LL_PWR_EXTWKUP_PIN4 (0x00000010U) /**< WKUP pin 4 : AON_GPIO_PIN4 */ +#define LL_PWR_EXTWKUP_PIN5 (0x00000020U) /**< WKUP pin 5 : AON_GPIO_PIN5 */ +#define LL_PWR_EXTWKUP_PIN6 (0x00000040U) /**< WKUP pin 6 : AON_GPIO_PIN6 */ +#define LL_PWR_EXTWKUP_PIN7 (0x00000080U) /**< WKUP pin 7 : AON_GPIO_PIN7 */ +#define LL_PWR_EXTWKUP_PIN_ALL (0x000000FFU) /**< WKUP pin all : AON_GPIO_PIN0 ~ AON_GPIO_PIN7 */ +/** @} */ + +/** @defgroup PWR_LL_EC_EXTWAKEUP_TYPE External Wakeup Type + * @{ + */ +#define LL_PWR_EXTWKUP_TYPE_LOW (LL_PWR_EXTWKUP_INVERT_LSB | LL_PWR_EXTWKUP_TYPE_LSB | LL_PWR_EXTWKUP_SRC_EN_LSB) /**< Low level wakeup */ +#define LL_PWR_EXTWKUP_TYPE_HIGH (LL_PWR_EXTWKUP_TYPE_LSB | LL_PWR_EXTWKUP_SRC_EN_LSB) /**< High level wakeup */ +#define LL_PWR_EXTWKUP_TYPE_RISING (0x00000000U) /**< Rising edge wakeup */ +#define LL_PWR_EXTWKUP_TYPE_FALLING (LL_PWR_EXTWKUP_INVERT_LSB | LL_PWR_EXTWKUP_SRC_EN_LSB) /**< Falling edge wakeup */ +/** @} */ + +/** @defgroup PWR_LL_EC_PSC_CMD Power State Control Commands + * @{ + */ +#define LL_PWR_CMD_LOOPBACK AON_PSC_CMD_OPC_OPCODE_LOOPBACK /**< Reserved command 0 */ +#define LL_PWR_CMD_EF_DIR_ON AON_PSC_CMD_OPC_OPCODE_EF_DIR_ON /**< Reserved command 1 */ +#define LL_PWR_CMD_32_TIMER_LD AON_PSC_CMD_OPC_OPCODE_32_TIMER_LD /**< Load sleep timer command */ +#define LL_PWR_CMD_DEEP_SLEEP AON_PSC_CMD_OPC_OPCODE_DEEP_SLEEP /**< Enter Deep Sleep Mode command */ +#define LL_PWR_CMD_EF_DIR_OFF AON_PSC_CMD_OPC_OPCODE_EF_DIR_OFF /**< Reserved command 2 */ +#define LL_PWR_CMD_EXT_CLK AON_PSC_CMD_OPC_OPCODE_EXT_CLK /**< Select external clock (xo_32KHz) command */ +#define LL_PWR_CMD_RNG_CLK AON_PSC_CMD_OPC_OPCODE_RNG_CLK /**< Select RING OSC clock command */ +#define LL_PWR_CMD_RTC_CLK AON_PSC_CMD_OPC_OPCODE_RTC_CLK /**< Select RTC clock command */ +#define LL_PWR_CMD_RNG2_CLK AON_PSC_CMD_OPC_OPCODE_RNG2_CLK /**< Select RING OSC clock command */ +#define LL_PWR_CMD_LD_MEM_SLP_CFG AON_PSC_CMD_OPC_OPCODE_LD_MEM_SLP_CFG /**< Load memory sleep settings command */ +#define LL_PWR_CMD_LD_MEM_WKUP_CFG AON_PSC_CMD_OPC_OPCODE_LD_MEM_WKUP_CFG /**< Load memory wakeup settings command */ +#define LL_PWR_CMD_DPAD_LE_HI AON_PSC_CMD_OPC_OPCODE_DPAD_LE_HI /**< Force dpad_le high */ +#define LL_PWR_CMD_DPAD_LE_LO AON_PSC_CMD_OPC_OPCODE_DPAD_LE_LO /**< Force dpad_le low */ +#define LL_PWR_CMD_SLP_TIMER_MODE_NORMAL AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_0 /**< Enable sleep timer mode 0 command */ +#define LL_PWR_CMD_SLP_TIMER_MODE_SINGLE AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_1 /**< Enable sleep timer mode 1 command */ +#define LL_PWR_CMD_SLP_TIMER_MODE_RELOAD AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_2 /**< Enable sleep timer mode 2 command */ +#define LL_PWR_CMD_SLP_TIMER_MODE_DISABLE AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_3 /**< Enable sleep timer mode 3 command */ +/** @} */ + + +/** @} */ + +/** @defgroup PWR_LL_EC_DPAD_VALUE Dpad LE State + * @{ + */ +#define LL_PWR_DPAD_LE_OFF (0x00000000U) /**< Dpad LE LOW */ +#define LL_PWR_DPAD_LE_ON (0x00000001U) /**< Dpad LE High */ +/** @} */ + +/** @defgroup PWR_LL_EC_TIMER_READ_SEL Timer Read Select + * @note Only available on GR5515_C and later version + * @{ + */ +#define LL_PWR_TIMER_READ_SEL_CAL_TIMER AON_PAD_CTL1_TIMER_READ_SEL_CAL_TIMER /**< Calendar timer */ +#define LL_PWR_TIMER_READ_SEL_AON_WDT AON_PAD_CTL1_TIMER_READ_SEL_AON_WDT /**< AON watchdog timer */ +#define LL_PWR_TIMER_READ_SEL_SLP_TIMER AON_PAD_CTL1_TIMER_READ_SEL_SLP_TIMER /**< Sleep timer */ +#define LL_PWR_TIMER_READ_SEL_CAL_ALARM AON_PAD_CTL1_TIMER_READ_SEL_CAL_ALARM /**< Calendar alarm */ +/** @} */ + +/** @} */ + + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup PWR_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup PWR_LL_EM_WRITE_READ Common write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in PWR register + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_PWR_WriteReg(__REG__, __VALUE__) WRITE_REG(AON->__REG__, (__VALUE__)) + +/** + * @brief Read a value in PWR register + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_PWR_ReadReg(__REG__) READ_REG(AON->__REG__) +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup PWR_LL_Exported_Functions PWR Exported Functions + * @{ + */ + +/** @defgroup PWR_LL_EF_Low_Power_Mode_Configuration Low power mode configuration + * @{ + */ + +/** + * @brief Set the DeepSleep WakeUp Condition + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WAKE_UP_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param condition This parameter can be one of the following values: + * @arg @ref LL_PWR_WKUP_COND_EXT + * @arg @ref LL_PWR_WKUP_COND_TIMER + * @arg @ref LL_PWR_WKUP_COND_BLE + * @arg @ref LL_PWR_WKUP_COND_CALENDAR + * @arg @ref LL_PWR_WKUP_COND_BOD_FEDGE + * @arg @ref LL_PWR_WKUP_COND_MSIO_COMP + * @arg @ref LL_PWR_WKUP_COND_ALL + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_wakeup_condition(uint32_t condition) +{ + MODIFY_REG(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL, condition); +} + +/** + * @brief Get the Selected DeepSleep WakeUp Condition + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | WAKE_UP_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_WKUP_COND_EXT + * @arg @ref LL_PWR_WKUP_COND_TIMER + * @arg @ref LL_PWR_WKUP_COND_BLE + * @arg @ref LL_PWR_WKUP_COND_CALENDAR + * @arg @ref LL_PWR_WKUP_COND_BOD_FEDGE + * @arg @ref LL_PWR_WKUP_COND_MSIO_COMP + * @arg @ref LL_PWR_WKUP_COND_ALL + */ +__STATIC_INLINE uint32_t ll_pwr_get_wakeup_condition(void) +{ + return ((uint32_t)READ_BITS(AON->PWR_RET01, AON_PWR_REG01_WAKE_UP_SEL)); +} + +/** + * @brief Get the Event that triggered the DeepSleep WakeUp. + * @note Only available on GR5515_C and later version + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | SMCOSCEN_EVENT | + * +----------------------+-----------------------------------+ + * \endrst + * SLP_EVENT | TIMER_EVENT + * SLP_EVENT | EXT_WKUP_EVENT + * SLP_EVENT | WATCHDOG_EVENT + * + * @retval Returned value can be combination of the following values: + * @arg @ref LL_PWR_WKUP_EVENT_BLE + * @arg @ref LL_PWR_WKUP_EVENT_TIMER + * @arg @ref LL_PWR_WKUP_EVENT_EXT + * @arg @ref LL_PWR_WKUP_EVENT_BOD_FEDGE + * @arg @ref LL_PWR_WKUP_EVENT_MSIO_COMP + * @arg @ref LL_PWR_WKUP_EVENT_WDT + * @arg @ref LL_PWR_WKUP_EVENT_CALENDAR + */ +__STATIC_INLINE uint32_t ll_pwr_get_wakeup_event(void) +{ + return ((uint32_t)READ_BITS(AON->SLP_EVENT, LL_PWR_WKUP_EVENT_ALL)); +} + +/** + * @brief Enable the External WakeUp PINx functionality + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | MASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param wakeup_pin This parameter can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_ext_wakeup_pin(uint32_t wakeup_pin) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->EXT_WKUP_CTL, wakeup_pin); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable the External WakeUp PINx functionality + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | MASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param wakeup_pin This parameter can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_ext_wakeup_pin(uint32_t wakeup_pin) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->EXT_WKUP_CTL, wakeup_pin); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the External WakeUp PINx functionality is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | MASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param wakeup_pin This parameter can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_ext_wakeup_pin(uint32_t wakeup_pin) +{ + return (READ_BITS(AON->EXT_WKUP_CTL, wakeup_pin) == wakeup_pin); +} + +/** + * @brief Set the WakeUp Type of External WakeUp PINx. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | INVERT | + * +----------------------+-----------------------------------+ + * \endrst + * EXT_WKUP_CTL | TYPE + * + * @param wakeup_pin This parameter can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @param wakeup_type This parameter can be one of the following values: + * @arg @ref LL_PWR_EXTWKUP_TYPE_LOW + * @arg @ref LL_PWR_EXTWKUP_TYPE_HIGH + * @arg @ref LL_PWR_EXTWKUP_TYPE_RISING + * @arg @ref LL_PWR_EXTWKUP_TYPE_FALLING + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_ext_wakeup_type(uint32_t wakeup_pin, uint32_t wakeup_type) +{ + uint32_t invert = ((wakeup_type & LL_PWR_EXTWKUP_INVERT_LSB) == LL_PWR_EXTWKUP_INVERT_LSB) ? (wakeup_pin << AON_EXT_WKUP_CTL_INVERT_Pos) : 0; + uint32_t type = ((wakeup_type & LL_PWR_EXTWKUP_TYPE_LSB) == LL_PWR_EXTWKUP_TYPE_LSB) ? (wakeup_pin << AON_EXT_WKUP_CTL_TYPE_Pos) : 0; + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->EXT_WKUP_CTL, (wakeup_pin << AON_EXT_WKUP_CTL_INVERT_Pos) | (wakeup_pin << AON_EXT_WKUP_CTL_TYPE_Pos), invert | type); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Get the WakeUp Type of External WakeUp PINx. + * @note Warning: only one pin can be passed as parameter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | EXT_WKUP_CTL | INVERT | + * +----------------------+-----------------------------------+ + * \endrst + * EXT_WKUP_CTL | TYPE + * + * @param wakeup_pin This parameter can be one of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_EXTWKUP_TYPE_LOW + * @arg @ref LL_PWR_EXTWKUP_TYPE_HIGH + * @arg @ref LL_PWR_EXTWKUP_TYPE_RISING + * @arg @ref LL_PWR_EXTWKUP_TYPE_FALLING + */ +__STATIC_INLINE uint32_t ll_pwr_get_ext_wakeup_type(uint32_t wakeup_pin) +{ + return ((uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, AON_EXT_WKUP_CTL_INVERT | AON_EXT_WKUP_CTL_TYPE) >> POSITION_VAL(wakeup_pin))); +} + +/** + * @brief Set the 32 bits AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode. + * @note After the value was set, use @arg @ref LL_PWR_CMD_32_TIMER_LD command to + * load the configuration into Power State Controller. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMER_VALUE | PWR_CTL_TIMER_32B | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param value 32 bits count value loaded into the t32bit_timer + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_sleep_timer_value(uint32_t value) +{ + WRITE_REG(AON->TIMER_VALUE, value); +} + +/** + * @brief Get the 32 bit AON Sleep Timer Value to WakeUp the MCU from DeepSleep Mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TIMER_VALUE | PWR_CTL_TIMER_32B | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval 32 bit AON Timer Count Value + */ +__STATIC_INLINE uint32_t ll_pwr_get_sleep_timer_value(void) +{ + return READ_REG(AON->TIMER_VALUE); +} + +/** + * @brief Enable the SMC WakeUp Request. + * @note Once this is set up, MCU will wake up SMC, and this bit need to be cleared by MCU. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | SMC_WAKEUP_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_smc_wakeup_req(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_SMC_WAKEUP_REQ); +} + +/** + * @brief Disable the SMC WakeUp Request. + * @note This function is used to clear SMC WakeUp Request. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | SMC_WAKEUP_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_smc_wakeup_req(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_SMC_WAKEUP_REQ); +} + +/** + * @brief Check if the SMC WakeUp Request was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | SMC_WAKEUP_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_smc_wakeup_req(void) +{ + return (READ_BITS(AON->PWR_RET01, AON_PWR_REG01_SMC_WAKEUP_REQ) == AON_PWR_REG01_SMC_WAKEUP_REQ); +} + +/** + * @brief Set the DPAD LE value during sleep and after wake up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MEM_N_SLP_CTL | DPAD_LE_SLP_VAL | + * +----------------------+-----------------------------------+ + * | MEM_N_SLP_CTL | DPAD_LE_WKUP_VAL | + * +----------------------+-----------------------------------+ + * \endrst + * + * + * @param sleep This parameter can be one of the following values: + * @arg @ref LL_PWR_DPAD_LE_OFF + * @arg @ref LL_PWR_DPAD_LE_ON + * @param wakeup This parameter can be one of the following values: + * @arg @ref LL_PWR_DPAD_LE_OFF + * @arg @ref LL_PWR_DPAD_LE_ON + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_dpad_le_value(uint32_t sleep, uint32_t wakeup) +{ + MODIFY_REG(AON->MEM_N_SLP_CTL, AON_MEM_CTL_DPAD_LE_SLP_VAL, (sleep << AON_MEM_CTL_DPAD_LE_SLP_VAL_Pos)); + MODIFY_REG(AON->MEM_N_SLP_CTL, AON_MEM_CTL_DPAD_LE_WKUP_VAL, (wakeup << AON_MEM_CTL_DPAD_LE_WKUP_VAL_Pos)); +} + +/** + * @brief Request to excute the Power State Controller Command. + * @note The PSC command can only be excuted when Power State Controller is not in busy state. + * Use @ref ll_pwr_is_active_flag_psc_cmd_busy() to check the busy status, and make sure + * the last command has been finished. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PSC_CMD_OPC | OPCODE | + * +----------------------+-----------------------------------+ + * | PSC_CMD | MCU_PWR_REQ | + * +----------------------+-----------------------------------+ + * \endrst + + * + * @param command This parameter can be one of the following values: + * @arg @ref LL_PWR_CMD_LOOPBACK + * @arg @ref LL_PWR_CMD_EF_DIR_ON + * @arg @ref LL_PWR_CMD_32_TIMER_LD + * @arg @ref LL_PWR_CMD_DEEP_SLEEP + * @arg @ref LL_PWR_CMD_EF_DIR_OFF + * @arg @ref LL_PWR_CMD_EXT_CLK + * @arg @ref LL_PWR_CMD_RNG_CLK + * @arg @ref LL_PWR_CMD_RTC_CLK + * @arg @ref LL_PWR_CMD_LD_MEM_SLP_CFG + * @arg @ref LL_PWR_CMD_LD_MEM_WKUP_CFG + * @arg @ref LL_PWR_CMD_DPAD_LE_HI (*) + * @arg @ref LL_PWR_CMD_DPAD_LE_LO (*) + * @arg @ref LL_PWR_CMD_SLP_TIMER_MODE_NORMAL (*) + * @arg @ref LL_PWR_CMD_SLP_TIMER_MODE_SINGLE (*) + * @arg @ref LL_PWR_CMD_SLP_TIMER_MODE_RELOAD (*) + * @arg @ref LL_PWR_CMD_SLP_TIMER_MODE_DISABLE (*) + * + * (*) Not available in A0 and B0 + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_req_excute_psc_command(uint32_t command) +{ + WRITE_REG(AON->PSC_CMD_OPC, (uint8_t)command); + SET_BITS(AON->PSC_CMD, AON_PSC_CMD_MCU_PWR_REQ); +} + +/** @} */ + +/** @addtogroup PWR_LL_EF_Communication_Configuration BLE Communication timer and core configuration function + * @{ + */ + +/** + * @brief Enable the Communication Timer Reset. + * @note Comm timer can be reset when all ble connection were disconnected and + * MCU was ready to enter into deepsleep mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_TIMER_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_timer_reset(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_TIMER_RST_N); +} + +/** + * @brief Disable the Communication Timer Reset, and set Communication Timer to running state. + * @note After powered up, Comm Timer need to enter into running mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_TIMER_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_timer_reset(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_TIMER_RST_N); +} + +/** + * @brief Check if the Communication Timer Reset was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_TIMER_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_timer_reset(void) +{ + return ((uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_TIMER_RST_N) == 0x0U)); +} + +/** + * @brief Enable the Communication Core Reset. + * @note Comm Core can be reset when all ble connection were disconnected and + * MCU was ready to enter into deepsleep mode, and When COMM_CORE_RST_N + * is 0, the ble is held in reset. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_CORE_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_core_reset(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_CORE_RST_N); +} + +/** + * @brief Disable the Communication Core Reset, and set Communication Core to running state. + * @note After powered up, Comm Core need to enter into running mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_CORE_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_core_reset(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_CORE_RST_N); +} + +/** + * @brief Check if the Communication Core Reset was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | COMM_CORE_RST_N | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_core_reset(void) +{ + return ((uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_COMM_CORE_RST_N) == 0x0U)); +} + +/** + * @brief Enable the Communication Timer Power, the Communication Timer will be Powered Up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * \endrst + + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_timer_power(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_ISO_EN_PD_COMM_TIMER); + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_TIMER); + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_ISO_EN_PD_COMM_TIMER); +} + +/** + * @brief Disable the Communication Timer Power, the Communication Timer will be Powered Down. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * \endrst + + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_timer_power(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_TIMER); + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_ISO_EN_PD_COMM_TIMER); + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_TIMER); +} + +/** + * @brief Check if the Communication Timer Power was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_TIMER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_timer_power(void) +{ + return ((uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_TIMER) == AON_PWR_REG01_PWR_EN_PD_COMM_TIMER)); +} + +/** + * @brief Enable the Communication Core Power, the Communication Core will be Powered Up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_core_power(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_CORE); + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_ISO_EN_PD_COMM_CORE); +} + +/** + * @brief Disable the Communication Core Power, the Communication Core will be Powered Down. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_core_power(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_CORE); + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_ISO_EN_PD_COMM_CORE); + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_CORE); +} + +/** + * @brief Check if the Communication Core Power was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CALENDAR_TIMER_CTL | ISO_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * | CALENDAR_TIMER_CTL | PWR_EN_PD_COMM_CORE | + * +----------------------+-----------------------------------+ + * \endrst + * + * + * @retval None + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_core_power(void) +{ + return ((uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_PWR_EN_PD_COMM_CORE) == AON_PWR_REG01_PWR_EN_PD_COMM_CORE)); +} + +/** + * @brief Select which timer value to read + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PAD_CTL1 | TIMER_READ_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param select This parameter can be one of the following values: + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_AON_WDT + * @arg @ref LL_PWR_TIMER_READ_SEL_SLP_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_ALARM + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_timer_read_select(uint32_t select) +{ + GLOBAL_EXCEPTION_DISABLE(); + MODIFY_REG(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL, select); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Get which timer value was selected to read. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PAD_CTL1 | TIMER_READ_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_AON_WDT + * @arg @ref LL_PWR_TIMER_READ_SEL_SLP_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_ALARM + */ +__STATIC_INLINE uint32_t ll_pwr_get_timer_read_select(void) +{ + return ((uint32_t)READ_BITS(AON->AON_PAD_CTL1, AON_PAD_CTL1_TIMER_READ_SEL)); +} + +/** + * @brief Get current timer value based on the selection. + * @note Please read multiple times until get a stable value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PAD_CTL1 | TIMER_READ_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned value can be one of the following values: + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_AON_WDT + * @arg @ref LL_PWR_TIMER_READ_SEL_SLP_TIMER + * @arg @ref LL_PWR_TIMER_READ_SEL_CAL_ALARM + */ +__STATIC_INLINE uint32_t ll_pwr_get_timer_read_value(void) +{ + return ((uint32_t)READ_REG(AON->TIMER_VAL)); +} + +/** + * @brief Enable high frequency crystal oscillator sleep mode, and diable OSC. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_OSC_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_osc_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + + +/** + * @brief Disable high frequency crystal oscillator sleep mode. + * @note Switch OSC from sleep mode into normal active mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_OSC_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_osc_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the OSC sleep mode was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_OSC_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_osc_sleep(void) +{ + return ((uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN) == AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN)); +} + +/** + * @brief Enable Radio sleep mode, and disable Radio module. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_RADIO_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_radio_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable Radio sleep mode. + * @note Switch Radio from sleep mode into normal active mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_RADIO_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_radio_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the Radio sleep mode was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_RADIO_SLEEP_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_radio_sleep(void) +{ + return ((uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN) == AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN)); +} + +/** + * @brief Enable Communication Core Deep Sleep Mode. + * @note This bit is reset on DEEP_SLEEP_STAT falling edge. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_DEEP_SLEEP_ON | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_core_deep_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable Communication Core Deep Sleep Mode. + * @note Switch Communication Core from sleep mode into normal active mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_DEEP_SLEEP_ON | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_core_deep_sleep(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the Communication Core Deep Sleep Mode was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_DEEP_SLEEP_ON | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_core_deep_sleep(void) +{ + return ((uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON) == AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON)); +} + +/** + * @brief Enable Wake Up Request from Software. + * @note Applies when system is in Deep Sleep Mode. It wakes up the Communication Core + * when written with a 1. No action happens if it is written with 0. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_soft_wakeup_req(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the Wake Up Request was enabled or disabled. + * @note Resets at 0 means request action is performed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_soft_wakeup_req(void) +{ + return ((uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ) == AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ)); +} + +/** + * @brief Enable Communication Core external wakeup. + * @note After this configuration, Communication Core can be woken up by external wake-up + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_EXTWKUPDSB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_enable_comm_core_ext_wakeup(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + CLEAR_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_EXTWKUPDSB); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Disable Communication Core external wakeup. + * @note After this configuration, Communication Core cannot be woken up by external wake-up + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_EXTWKUPDSB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_comm_core_ext_wakeup(void) +{ + GLOBAL_EXCEPTION_DISABLE(); + SET_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_EXTWKUPDSB); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Check if the Communication Core external wakeup was enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_EXTWKUPDSB | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_enabled_comm_core_ext_wakeup(void) +{ + return ((uint32_t)(READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_EXTWKUPDSB) == 0x0U)); +} + +/** + * @brief Set the time in low_power_clk clock cycles to spend in Deep Sleep Mode before waking-up the device. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMM_TMR_DEEPSLWKUP | AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME| + * +----------------------+-----------------------------------+ + * \endrst + * + * @param time 32 bit clock cycles loaded into the AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_comm_core_wakeup_time(uint32_t time) +{ + WRITE_REG(AON->PWR_RET28, time); +} + +/** + * @brief Get the time in low_power_clk clock cycles to spend in Deep Sleep Mode before waking-up the device. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMM_TMR_DEEPSLWKUP | AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME| + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Clock cycles to spend in Deep Sleep Mode before waking-up the device + */ +__STATIC_INLINE uint32_t ll_pwr_get_comm_wakeup_time(void) +{ + return ((uint32_t)READ_REG(AON->PWR_RET28)); +} + + +/** + * @brief Get the actual duration of the last deep sleep phase measured in low_power_clk clock cycle. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMM_TMR_DEEPSLPSTAT | DEEPSLDUR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Sleep duration + */ +__STATIC_INLINE uint32_t ll_pwr_get_comm_sleep_duration(void) +{ + return ((uint32_t)READ_REG(MCU_SUB->COMM_TMR_DEEPSLPSTAT)); +} + +/** + * @brief Set the wakeup timing in low_power_clk clock cycles to spend when waking-up the device. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMM_TMR_ENBPRESET | TWEXT | + * +----------------------+-----------------------------------+ + * | COMM_TMR_ENBPRESET | TWOSC | + * +----------------------+-----------------------------------+ + * | COMM_TMR_ENBPRESET | TWRM | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param twext Time in low power oscillator cycles allowed for stabilization of the high frequency + * oscillator following an external wake–up request (signal wakeup_req). + * @param twosc Time in low power oscillator cycles allowed for stabilization of the high frequency + * oscillator when the deep–sleep mode has been left due to sleep–timer expiry. + * @param twrm Time in low power oscillator cycles allowed for the radio module to leave low–power mode. + * @retval None + */ +__STATIC_INLINE void ll_pwr_set_comm_wakeup_timing(uint32_t twext, uint32_t twosc, uint32_t twrm) +{ + WRITE_REG(AON->PWR_RET29, (twext << AON_COMM_TMR_ENBPRESET_TWEXT_Pos) | + (twosc << AON_COMM_TMR_ENBPRESET_TWOSC_Pos) | + (twrm << AON_COMM_TMR_ENBPRESET_TWRM_Pos)); +} + + +/** + * @brief Read the wakeup timing in low_power_clk clock cycles to spend when waking-up the device. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMM_TMR_ENBPRESET | TWEXT | + * +----------------------+-----------------------------------+ + * | COMM_TMR_ENBPRESET | TWOSC | + * +----------------------+-----------------------------------+ + * | COMM_TMR_ENBPRESET | TWRM | + * +----------------------+-----------------------------------+ + * \endrst + * + * + * @retval COMM_TMR_ENBPRESET Register value + */ +__STATIC_INLINE uint32_t ll_pwr_read_comm_wakeup_timing(void) +{ + return ((uint32_t)READ_REG(AON->PWR_RET29)); +} + +/** + * @brief Read the Twosc of the wakeup timing in low_power_clk clock cycles to spend when waking-up the device. + * + * @retval TWOSC value + */ +__STATIC_INLINE uint32_t ll_pwr_read_comm_wakeup_timing_twosc(void) +{ + return ((((uint32_t)READ_REG(AON->PWR_RET29) & AON_COMM_TMR_ENBPRESET_TWOSC_Msk)) >> AON_COMM_TMR_ENBPRESET_TWOSC_Pos); +} + + +/** @} */ + +/** @defgroup PWR_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get the External Wake Up Status. + * @note 0 means not waked up and 1 means waked up. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | EXT_WKUP_STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + */ +__STATIC_INLINE uint32_t ll_pwr_get_ext_wakeup_status(void) +{ + return ((uint32_t)(READ_BITS(AON->SLP_EVENT, AON_SLP_EVENT_EXT_WKUP_STATUS) >> AON_SLP_EVENT_EXT_WKUP_STATUS_Pos) & \ + (uint32_t)(READ_BITS(AON->EXT_WKUP_CTL, LL_PWR_EXTWKUP_PIN_ALL))); +} + +/** + * @brief Clear the External Wake Up Status. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | EXT_WKUP_STATUS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param wakeup_pin This parameter can be a combination of the following values: + * @arg @ref LL_PWR_EXTWKUP_PIN0 + * @arg @ref LL_PWR_EXTWKUP_PIN1 + * @arg @ref LL_PWR_EXTWKUP_PIN2 + * @arg @ref LL_PWR_EXTWKUP_PIN3 + * @arg @ref LL_PWR_EXTWKUP_PIN4 + * @arg @ref LL_PWR_EXTWKUP_PIN5 + * @arg @ref LL_PWR_EXTWKUP_PIN_ALL + * @retval None + */ +__STATIC_INLINE void ll_pwr_clear_ext_wakeup_status(uint32_t wakeup_pin) +{ + GLOBAL_EXCEPTION_DISABLE(); + WRITE_REG(AON->SLP_EVENT, ~(wakeup_pin << AON_SLP_EVENT_EXT_WKUP_STATUS_Pos)); + GLOBAL_EXCEPTION_ENABLE(); +} + +/** + * @brief Clear the Event that triggered the DeepSleep WakeUp. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLP_EVENT | SMCOSCEN_EVENT | + * +----------------------+-----------------------------------+ + * \endrst + * SLP_EVENT | TIMER_EVENT + * SLP_EVENT | EXT_WKUP_EVENT + * SLP_EVENT | WATCHDOG_EVENT + * + * @param event This parameter can be a combination of the following values: + * @arg @ref LL_PWR_WKUP_EVENT_BLE + * @arg @ref LL_PWR_WKUP_EVENT_TIMER + * @arg @ref LL_PWR_WKUP_EVENT_EXT + * @arg @ref LL_PWR_WKUP_EVENT_BOD_FEDGE + * @arg @ref LL_PWR_WKUP_EVENT_MSIO_COMP + * @arg @ref LL_PWR_WKUP_EVENT_WDT + * @arg @ref LL_PWR_WKUP_EVENT_CALENDAR + * @retval None + */ +__STATIC_INLINE void ll_pwr_clear_wakeup_event(uint32_t event) +{ + WRITE_REG(AON->SLP_EVENT, ~(event & LL_PWR_WKUP_EVENT_ALL)); +} + +/** + * @brief Indicate if the Power State Controller is in busy state. + * @note This is bit set 1 when the PSC_CMD_REQ[0] is set to 1, and will remain 1 until + * the PSC_CMD_OPC has been transferred to the PSC. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PSC_CMD | MCU_PWR_BUSY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_active_flag_psc_cmd_busy(void) +{ + return (READ_BITS(AON->PSC_CMD, AON_PSC_CMD_MCU_PWR_BUSY) == AON_PSC_CMD_MCU_PWR_BUSY); +} + +/** + * @brief Indicate if the Communication Core is in Deep Sleep Mode. + * @note When Communication Core is in Deep Sleep Mode, only low_power_clk is running. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSIO_PAD_CFG_1 | COMM_DEEPSLCNTL_DEEP_SLEEP_STAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_pwr_is_active_flag_comm_deep_sleep_stat(void) +{ + return (READ_BITS(AON->MSIO_PAD_CFG_1, AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT) == AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT); +} + +/** + * @brief Disable cache function + * @note The cache should be closed before chip go to deepsleep. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_pwr_disable_cache_module(void) +{ + SET_BITS(XQSPI->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +} + +/** @} */ + +/** @} */ +/** @} */ + +#endif /* defined(AON) */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_PWR_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_rng.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_rng.h new file mode 100644 index 0000000..5f4264b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_rng.h @@ -0,0 +1,759 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_rng.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of RNG LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + + /** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_RNG RNG + * @brief RNG LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_RNG_H__ +#define __GR55XX_LL_RNG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (RNG) + +/** @defgroup RNG_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup RNG_LL_ES_INIT RNG Exported Init structures + * @{ + */ + +/** + * @brief LL RNG Init Structure definition + */ +typedef struct _ll_rng_init +{ + uint32_t seed; /**< Specifies the seed source for the LFSR. + This parameter can be a value of @ref RNG_LL_EC_SEED_SOURCE */ + + uint32_t lfsr_mode; /**< Specifies the configuration mode for the LFSR. + This parameter can be a value of @ref RNG_LL_EC_LFSR_MODE */ + + uint32_t out_mode; /**< Specifies the Output mode for the RNG. + This parameter can be a value of @ref RNG_LL_EC_OUTPUT_MODE */ + + uint32_t post_mode; /**< Specifies post-process configuration for the RNG. + This parameter can be a value of @ref RNG_LL_EC_POST_PRO */ + + uint32_t interrupt; /**< Specifies interrupt configuration for the RNG. + This parameter can be a value of @ref RNG_LL_EC_IT */ + +} ll_rng_init_t; + +/** @} */ + +/** @} */ + +/** @defgroup RNG_LL_MACRO Defines + * @{ + */ +/* Exported constants --------------------------------------------------------*/ +/** @defgroup RNG_LL_Exported_Constants RNG Exported Constants + * @{ + */ + +/** @defgroup RNG_LL_EC_SEED_SOURCE LFSR seed source + * @{ + */ +#define LL_RNG_SEED_FR0_S0 (4UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is from the switching oscillator s0. */ +#define LL_RNG_SEED_USER (6UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is configured by users. */ +/** @} */ + + +/** @defgroup RNG_LL_EC_LFSR_MODE LFSR configuration mode + * @{ + */ +#define LL_RNG_LFSR_MODE_59BIT (0x00000000UL) /**< 59 bit LFSR. */ +#define LL_RNG_LFSR_MODE_128BIT (1UL << RNG_CONFIG_LFSR_MODE_Pos) /**< 128 bit LFSR. */ +/** @} */ + +/** @defgroup RNG_LL_EC_POST_PRO Post-process mode + * @{ + */ +#define LL_RNG_POST_PRO_NOT (0x00000000UL) /**< No post process. */ +#define LL_RNG_POST_PRO_SKIPPING (1UL << RNG_CONFIG_POST_MODE_Pos) /**< bit skipping. */ +#define LL_RNG_POST_PRO_COUNTING (2UL << RNG_CONFIG_POST_MODE_Pos) /**< bit counting. */ +#define LL_RNG_POST_PRO_NEUMANN (3UL << RNG_CONFIG_POST_MODE_Pos) /**< Von-Neumann. */ +/** @} */ + +/** @defgroup RNG_LL_EC_IT RNG hardware interrupt enable. + * @{ + */ +#define LL_RNG_IT_DISABLE (0x00000000UL) /**< Disable RNG interrupt. */ +#define LL_RNG_IT_ENABLE (1UL << RNG_CONFIG_IRQ_EN_Pos) /**< Enable RNG interrupt. */ +/** @} */ + +/** @defgroup RNG_LL_EC_OUTPUT_MODE RNG Output mode + * @{ + */ +#define LL_RNG_OUTPUT_FR0_S0 (4UL << RNG_CONFIG_OUT_MODE_Pos) /**< Digital RNG direct output, ring oscillator s0. */ +#define LL_RNG_OUTPUT_CYCLIC_PARITY (6UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling and parity generation. */ +#define LL_RNG_OUTPUT_CYCLIC (7UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling. */ +#define LL_RNG_OUTPUT_LFSR_RNG (8UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR ⊕ RNG. */ +#define LL_RNG_OUTPUT_LFSR (9UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR direct output. */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup RNG_LL_Exported_Macros RNG Exported Macros + * @{ + */ + +/** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in RNG register + * @param __instance__ RNG instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None. + */ +#define LL_RNG_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in RNG register + * @param __instance__ RNG instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_RNG_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) +/** @} */ + +/** @} */ +/** @} */ + + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup RNG_LL_Exported_Functions Functions + * @{ + */ + +/** @defgroup RNG_LL_EF_Configuration RNG Configuration functions + * @{ + */ + +/** + * @brief Enable Random Number Generation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RNG_RUN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_enable(rng_regs_t *RNGx) +{ + SET_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN); +} + +/** + * @brief Disable Random Number Generation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RNG_RUN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_disable(rng_regs_t *RNGx) +{ + CLEAR_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN); +} + +/** + * @brief Check if Random Number Generator is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RNG_RUN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_rng_is_enabled(rng_regs_t *RNGx) +{ + return (READ_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN) == (RNG_CTRL_RUN_EN)); +} + +/** + * @brief Enable Ring oscillator TRNG enabled signal. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_FRO_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_enable_fro(rng_regs_t *RNGx) +{ + SET_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN); +} + +/** + * @brief Disable Ring oscillator TRNG enabled signal. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RNG_RUN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_disable_fro(rng_regs_t *RNGx) +{ + CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN); +} + +/** + * @brief Check if Ring oscillator TRNG enabled signal is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RNG_RUN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_rng_fro_is_enabled(rng_regs_t *RNGx) +{ + return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN) == (RNG_CONFIG_FRO_EN)); +} + +/** + * @brief Set source of LFSR seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_LFSR_SEED_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param seed This parameter can be one of the following values: + * @arg @ref LL_RNG_SEED_FR0_S0 + * @arg @ref LL_RNG_SEED_USER + * @retval None + */ +__STATIC_INLINE void ll_rng_set_lfsr_seed(rng_regs_t *RNGx, uint32_t seed) +{ + MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL, seed); +} + +/** + * @brief Get source of LFSR seed. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_LFSR_SEED_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_RNG_SEED_FR0_S0 + * @arg @ref LL_RNG_SEED_USER + */ +__STATIC_INLINE uint32_t ll_rng_get_lfsr_seed(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL); +} + +/** + * @brief Set LFSR configuration mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_LFSR_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param mode This parameter can be one of the following values: + * @arg @ref LL_RNG_LFSR_MODE_59BIT + * @arg @ref LL_RNG_LFSR_MODE_128BIT + * @retval None + */ +__STATIC_INLINE void ll_rng_set_lfsr_mode(rng_regs_t *RNGx, uint32_t mode) +{ + MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE, mode); +} + +/** + * @brief Get LFSR configuration mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_LFSR_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_RNG_LFSR_MODE_59BIT + * @arg @ref LL_RNG_LFSR_MODE_128BIT + */ +__STATIC_INLINE uint32_t ll_rng_get_lfsr_mode(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE); +} + +/** + * @brief Set RNG post-process configuration. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_POST_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param post This parameter can be one of the following values: + * @arg @ref LL_RNG_POST_PRO_NOT + * @arg @ref LL_RNG_POST_PRO_SKIPPING + * @arg @ref LL_RNG_POST_PRO_COUNTING + * @arg @ref LL_RNG_POST_PRO_NEUMANN + * @retval None + */ +__STATIC_INLINE void ll_rng_set_post_mode(rng_regs_t *RNGx, uint32_t post) +{ + MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_POST_MODE, post); +} + +/** + * @brief Get RNG post-process configuration. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_POST_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_RNG_POST_PRO_NOT + * @arg @ref LL_RNG_POST_PRO_SKIPPING + * @arg @ref LL_RNG_POST_PRO_COUNTING + * @arg @ref LL_RNG_POST_PRO_NEUMANN + */ +__STATIC_INLINE uint32_t ll_rng_get_post_mode(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->CONFIG, RNG_CONFIG_POST_MODE); +} + +/** + * @brief set RNG output mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_OUT_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param mode This parameter can be one of the following values: + * @arg @ref LL_RNG_OUTPUT_FR0_S0 + * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY + * @arg @ref LL_RNG_OUTPUT_CYCLIC + * @arg @ref LL_RNG_OUTPUT_LFSR_RNG + * @arg @ref LL_RNG_OUTPUT_LFSR + * @retval None + */ +__STATIC_INLINE void ll_rng_set_output_mode(rng_regs_t *RNGx, uint32_t mode) +{ + MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_OUT_MODE, mode); +} + +/** + * @brief get RNG output mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_OUT_MODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Returned value can be one of the following values: + * @arg @ref LL_RNG_OUTPUT_FR0_S0 + * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY + * @arg @ref LL_RNG_OUTPUT_CYCLIC + * @arg @ref LL_RNG_OUTPUT_LFSR_RNG + * @arg @ref LL_RNG_OUTPUT_LFSR + */ +__STATIC_INLINE uint32_t ll_rng_get_output_mode(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->CONFIG, RNG_CONFIG_OUT_MODE); +} + +/** + * @brief set the waiting time that RNG input reaches stable. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TSCON | RNG_TRDY_TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param time range between 0x1 and 0xFF. + * @retval None + */ +__STATIC_INLINE void ll_rng_set_trdy_time(rng_regs_t *RNGx, uint32_t time) +{ + MODIFY_REG(RNGx->TSCON, RNG_TSCON_TRDY_TIME, time); +} + +/** + * @brief get the waiting time that RNG input reaches stable. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TSCON | RNG_TRDY_TIME | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Between Min_Time = 0 and Max_Time = 0xFF + */ +__STATIC_INLINE uint32_t ll_rng_get_trdy_time(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->TSCON, RNG_TSCON_TRDY_TIME); +} + + +/** + * @brief set RNG seed configured by user. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USER | RNG_USER_SEED | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @param seed range between 0x1 and 0xFFFF. + * @retval None + */ +__STATIC_INLINE void ll_rng_set_user_seed(rng_regs_t *RNGx, uint32_t seed) +{ + WRITE_REG(RNGx->USER_SEED, seed); +} + +/** @} */ + +/** @defgroup RNG_LL_EF_FLAG_Management FLAG Management + * @{ + */ + +/** + * @brief Indicate if the Flag of RNG long run test is set or not. + * + * Register |BitsName + * ---------|-------- + * LR_STATUS| RNG_LR_FLAG + * + * @param RNGx RNG instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_rng_is_active_flag_lr(rng_regs_t *RNGx) +{ + return (READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_FLAG) == (RNG_LR_STATUS_FLAG)); +} + +/** + * @brief Indicate if the RNG Status Flag is set or not. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | RNG_READY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_rng_is_active_flag_sts(rng_regs_t *RNGx) +{ + return (READ_BITS(RNGx->STATUS, RNG_STATUS_READY) == (RNG_STATUS_READY)); +} + +/** + * @brief Clear RNG Status flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STATUS | RNG_READY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_clear_flag_sts(rng_regs_t *RNGx) +{ + WRITE_REG(RNGx->STATUS, RNG_STATUS_READY); +} + +/** @} */ + +/** @defgroup RNG_LL_EF_IT_Management IT Management + * @{ + */ + +/** + * @brief Enable Random Number Generator Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_IRQ_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_enable_it(rng_regs_t *RNGx) +{ + SET_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN); +} + +/** + * @brief Disable Random Number Generator Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_IRQ_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval None + */ +__STATIC_INLINE void ll_rng_disable_it(rng_regs_t *RNGx) +{ + CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN); +} + +/** + * @brief Check if Random Number Generator Interrupt is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CONFIG | RNG_IRQ_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_rng_is_enabled_it(rng_regs_t *RNGx) +{ + return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN) == (RNG_CONFIG_IRQ_EN)); +} + +/** @} */ + +/** @defgroup RNG_LL_EF_Data_Management Data Management + * @{ + */ + +/** + * @brief Return32-bit Random Number value + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | RNG_DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param RNGx RNG instance. + * @retval Generated 32-bit random value + */ +__STATIC_INLINE uint32_t ll_rng_read_random_data32(rng_regs_t *RNGx) +{ + return (uint32_t)(READ_REG(RNGx->DATA)); +} + +/** + * @brief Return8-bit RNG Long Run Test counts. + * + * Register |BitsName + * ---------|-------- + * LR_STATUS| RNG_LR_CNT + * + * @param RNGx RNG instance. + * @retval Output Data[7:0] + */ +__STATIC_INLINE uint32_t ll_rng_read_lr_count(rng_regs_t *RNGx) +{ + return READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_CNT) >> RNG_LR_STATUS_CNT_Pos; +} + +/** @} */ + +/** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize the RNG registers to their default reset values. + * @param RNGx RNG instance. + * @retval An error_status_t enumeration value: + * - SUCCESS: RNG registers are de-initialized + * - ERROR: RNG registers are not de-initialized + */ +error_status_t ll_rng_deinit(rng_regs_t *RNGx); + +/** + * @brief Initialize RNG registers according to the specified + * parameters in p_rng_init. + * @param RNGx RNG Instance + * @param p_rng_init Pointer to a ll_rng_init_t structure that contains the configuration + * information for the specified RNG peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: RNG registers are initialized according to p_rng_init content + * - ERROR: Problem occurred during RNG Registers initialization + */ +error_status_t ll_rng_init(rng_regs_t *RNGx, ll_rng_init_t *p_rng_init); + +/** + * @brief Set each field of a @ref ll_rng_init_t type structure to default value. + * @param p_rng_init Pointer to a @ref ll_rng_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_rng_struct_init(ll_rng_init_t *p_rng_init); + +/** @} */ + +/** @} */ + +#endif /* RNG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_RNG_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_spi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_spi.h new file mode 100644 index 0000000..aa380c7 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_spi.h @@ -0,0 +1,2631 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_spi.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of SPI LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_SPI SPI + * @brief SPI LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_SPI_H__ +#define __GR55xx_LL_SPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (SPIM) || defined (SPIS) || defined (QSPI0) || defined (QSPI1) + +/** @defgroup LL_SPI_DRIVER_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup SPI_LL_ES_INIT SPI Exported init structure + * @{ + */ + +/** + * @brief LL SPIM init structures definition + */ +typedef struct _ll_spim_init_t +{ + uint32_t transfer_direction; /**< Specifies the SPI unidirectional or bidirectional data mode. + This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_transfer_direction().*/ + + uint32_t data_size; /**< Specifies the SPI data size. + This parameter can be a value of @ref SPI_LL_EC_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_data_size().*/ + + uint32_t clock_polarity; /**< Specifies the serial clock steady state. + This parameter can be a value of @ref SPI_LL_EC_POLARITY. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_polarity().*/ + + uint32_t clock_phase; /**< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref SPI_LL_EC_PHASE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_phase().*/ + + uint32_t slave_select; /**< Specifies the SPI slave select. + This parameter can be a value of @ref SPI_LL_EC_SLAVESELECT. + + This feature can be modified afterwards using unitary function @ref ll_spi_enable_ss().*/ + + uint32_t baud_rate; /**< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock. + This parameter can be one even value between 2 and 65534, if the value is 0, the SCLK is disable. + @note The communication clock is derived from the master clock. The slave clock does not need to be set. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_baud_rate_prescaler().*/ +} ll_spim_init_t; + +/** + * @brief SPIS init structures definition + */ +typedef struct _ll_spis_init_t +{ + uint32_t data_size; /**< Specifies the SPI data width. + This parameter can be a value of @ref SPI_LL_EC_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_data_size().*/ + + uint32_t clock_polarity; /**< Specifies the serial clock steady state. + This parameter can be a value of @ref SPI_LL_EC_POLARITY. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_polarity().*/ + + uint32_t clock_phase; /**< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref SPI_LL_EC_PHASE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_phase().*/ + +} ll_spis_init_t; + +/** + * @brief QSPI init structures definition + */ +typedef struct _ll_qspi_init_t +{ + uint32_t transfer_direction; /**< Specifies the QSPI transfer or receive mode. + This parameter can be a value of @ref SPI_LL_EC_TRANSFER_MODE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_transfer_direction().*/ + + uint32_t instruction_size; /**< Specifies the QSPI instruction width. + This parameter can be a value of @ref SPI_LL_EC_INSTRUCTIONSIZE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_instruction_size().*/ + + uint32_t address_size; /**< Specifies the QSPI address width. + This parameter can be a value of @ref SPI_LL_EC_ADDRESSSIZE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_address_size().*/ + + uint32_t inst_addr_transfer_format; /**< Specifies the QSPI instruction and address transfer format. + This parameter can be a value of @ref SPI_LL_EC_ADDRINSTTRNASFERFORMAT. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_add_inst_transfer_format().*/ + + uint32_t wait_cycles; /**< Specifies the QSPI dummy clock. + This parameter can be one of the following values: 0 ~ 31. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_wait_cycles().*/ + + uint32_t data_size; /**< Specifies the SPI data width. + This parameter can be a value of @ref SPI_LL_EC_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_data_size().*/ + + uint32_t clock_polarity; /**< Specifies the serial clock steady state. + This parameter can be a value of @ref SPI_LL_EC_POLARITY. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_polarity().*/ + + uint32_t clock_phase; /**< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref SPI_LL_EC_PHASE. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_clock_phase().*/ + + uint32_t baud_rate; /**< Specifies the BaudRate prescaler value which will be used to configure the transmit and receive SCK clock. + This parameter can be one even value between 2 and 65534, if the value is 0, the SCLK is disable. + @note The communication clock is derived from the master clock. The slave clock does not need to be set. + + This feature can be modified afterwards using unitary function @ref ll_spi_set_baud_rate_prescaler().*/ + + uint32_t rx_sample_delay; /**< Specifies the RX sample delay. It is used to delay the sample of the RX input port. + This parameter can be a number between 0 and 0x7 */ +} ll_qspi_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup SPI_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup SPI_LL_Exported_Constants SPI Exported Constants + * @{ + */ + +/** @defgroup SPI_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags definitions which can be used with LL_SPI_ReadReg function + * @{ + */ +#define LL_SSI_SR_DCOL SSI_STAT_DCOL /**< Data collision error flag */ +#define LL_SSI_SR_TXE SSI_STAT_TXE /**< Transmission error flag */ +#define LL_SSI_SR_RFF SSI_STAT_RFF /**< Rx FIFO full flag */ +#define LL_SSI_SR_RFNE SSI_STAT_RFNE /**< Rx FIFO not empty flag */ +#define LL_SSI_SR_TFE SSI_STAT_TFE /**< Tx FIFO empty flag */ +#define LL_SSI_SR_TFNF SSI_STAT_TFNF /**< Tx FIFO not full flag */ +#define LL_SSI_SR_BUSY SSI_STAT_BUSY /**< Busy flag */ +/** @} */ + +/** @defgroup SPI_LL_EC_IT IT Defines + * @brief Interrupt definitions which can be used with LL_SPI_ReadReg and LL_SPI_WriteReg functions + * @{ + */ +#define LL_SSI_IM_MST SSI_INTMASK_MSTIM /**< Multi-Master Contention Interrupt enable */ +#define LL_SSI_IM_RXF SSI_INTMASK_RXFIM /**< Receive FIFO Full Interrupt enable */ +#define LL_SSI_IM_RXO SSI_INTMASK_RXOIM /**< Receive FIFO Overflow Interrupt enable */ +#define LL_SSI_IM_RXU SSI_INTMASK_RXUIM /**< Receive FIFO Underflow Interrupt enable */ +#define LL_SSI_IM_TXO SSI_INTMASK_TXOIM /**< Transmit FIFO Overflow Interrupt enable */ +#define LL_SSI_IM_TXE SSI_INTMASK_TXEIM /**< Transmit FIFO Empty Interrupt enable */ + +#define LL_SSI_IS_MST SSI_INTSTAT_MSTIS /**< Multi-Master Contention Interrupt flag */ +#define LL_SSI_IS_RXF SSI_INTSTAT_RXFIS /**< Receive FIFO Full Interrupt flag */ +#define LL_SSI_IS_RXO SSI_INTSTAT_RXOIS /**< Receive FIFO Overflow Interrupt flag */ +#define LL_SSI_IS_RXU SSI_INTSTAT_RXUIS /**< Receive FIFO Underflow Interrupt flag */ +#define LL_SSI_IS_TXO SSI_INTSTAT_TXOIS /**< Transmit FIFO Overflow Interrupt flag */ +#define LL_SSI_IS_TXE SSI_INTSTAT_TXEIS /**< Transmit FIFO Empty Interrupt flag */ + +#define LL_SSI_RIS_MST SSI_RAW_INTSTAT_MSTIR /**< Multi-Master Contention RAW Interrupt flag */ +#define LL_SSI_RIS_RXF SSI_RAW_INTSTAT_RXFIR /**< Receive FIFO Full RAW Interrupt flag */ +#define LL_SSI_RIS_RXO SSI_RAW_INTSTAT_RXOIR /**< Receive FIFO Overflow RAW Interrupt flag */ +#define LL_SSI_RIS_RXU SSI_RAW_INTSTAT_RXUIR /**< Receive FIFO Underflow RAW Interrupt flag */ +#define LL_SSI_RIS_TXO SSI_RAW_INTSTAT_TXOIR /**< Transmit FIFO Overflow RAW Interrupt flag */ +#define LL_SSI_RIS_TXE SSI_RAW_INTSTAT_TXEIR /**< Transmit FIFO Empty RAW Interrupt flag */ +/** @} */ + +/** @defgroup SPI_LL_EC_SPIFRAMEFORMAT SPI Frame Format + * @{ + */ +#define LL_SSI_FRF_SPI 0x00000000UL /**< SPI frame format for transfer */ +#define LL_SSI_FRF_DUALSPI (1UL << SSI_CTRL0_SPIFRF_Pos) /**< Dual-SPI frame format for transfer */ +#define LL_SSI_FRF_QUADSPI (2UL << SSI_CTRL0_SPIFRF_Pos) /**< Quad-SPI frame format for transfer */ +/** @} */ + +/** @defgroup SPI_LL_EC_DATASIZE Datawidth + * @{ + */ +#define LL_SSI_DATASIZE_4BIT (3UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 4 bits */ +#define LL_SSI_DATASIZE_5BIT (4UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 5 bits */ +#define LL_SSI_DATASIZE_6BIT (5UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 6 bits */ +#define LL_SSI_DATASIZE_7BIT (6UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 7 bits */ +#define LL_SSI_DATASIZE_8BIT (7UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 8 bits */ +#define LL_SSI_DATASIZE_9BIT (8UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 9 bits */ +#define LL_SSI_DATASIZE_10BIT (9UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 10 bits */ +#define LL_SSI_DATASIZE_11BIT (10UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 11 bits */ +#define LL_SSI_DATASIZE_12BIT (11UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 12 bits */ +#define LL_SSI_DATASIZE_13BIT (12UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 13 bits */ +#define LL_SSI_DATASIZE_14BIT (13UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 14 bits */ +#define LL_SSI_DATASIZE_15BIT (14UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 15 bits */ +#define LL_SSI_DATASIZE_16BIT (15UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 16 bits */ +#define LL_SSI_DATASIZE_17BIT (16UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 17 bits */ +#define LL_SSI_DATASIZE_18BIT (17UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 18 bits */ +#define LL_SSI_DATASIZE_19BIT (18UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 19 bits */ +#define LL_SSI_DATASIZE_20BIT (19UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 20 bits */ +#define LL_SSI_DATASIZE_21BIT (20UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 21 bits */ +#define LL_SSI_DATASIZE_22BIT (21UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 22 bits */ +#define LL_SSI_DATASIZE_23BIT (22UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 23 bits */ +#define LL_SSI_DATASIZE_24BIT (23UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 24 bits */ +#define LL_SSI_DATASIZE_25BIT (24UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 25 bits */ +#define LL_SSI_DATASIZE_26BIT (25UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 26 bits */ +#define LL_SSI_DATASIZE_27BIT (26UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 27 bits */ +#define LL_SSI_DATASIZE_28BIT (27UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 28 bits */ +#define LL_SSI_DATASIZE_29BIT (28UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 29 bits */ +#define LL_SSI_DATASIZE_30BIT (29UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 30 bits */ +#define LL_SSI_DATASIZE_31BIT (30UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 31 bits */ +#define LL_SSI_DATASIZE_32BIT (31UL << SSI_CTRL0_DFS32_Pos) /**< Data length for SPI transfer: 32 bits */ +/** @} */ + +/** @defgroup SPI_LL_EC_MICROWIRECOMMANDSIZE MicroWire CommandSize + * @{ + */ +#define LL_SSI_MW_CMDSIZE_1BIT 0x00000000UL /**< CMD length for Microwire transfer: 1 bits */ +#define LL_SSI_MW_CMDSIZE_2BIT (1UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 2 bits */ +#define LL_SSI_MW_CMDSIZE_3BIT (2UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 3 bits */ +#define LL_SSI_MW_CMDSIZE_4BIT (3UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 4 bits */ +#define LL_SSI_MW_CMDSIZE_5BIT (4UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 5 bits */ +#define LL_SSI_MW_CMDSIZE_6BIT (5UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 6 bits */ +#define LL_SSI_MW_CMDSIZE_7BIT (6UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 7 bits */ +#define LL_SSI_MW_CMDSIZE_8BIT (7UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 8 bits */ +#define LL_SSI_MW_CMDSIZE_9BIT (8UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 9 bits */ +#define LL_SSI_MW_CMDSIZE_10BIT (9UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 10 bits */ +#define LL_SSI_MW_CMDSIZE_11BIT (10UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 11 bits */ +#define LL_SSI_MW_CMDSIZE_12BIT (11UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 12 bits */ +#define LL_SSI_MW_CMDSIZE_13BIT (12UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 13 bits */ +#define LL_SSI_MW_CMDSIZE_14BIT (13UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 14 bits */ +#define LL_SSI_MW_CMDSIZE_15BIT (14UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 15 bits */ +#define LL_SSI_MW_CMDSIZE_16BIT (15UL << SSI_CTRL0_CFS_Pos) /**< CMD length for Microwire transfer: 16 bits */ +/** @} */ + +/** @defgroup SPI_LL_EC_TEST_MODE Test Mode + * @{ + */ +#define LL_SSI_NORMAL_MODE 0x00000000UL /**< Normal mode for SPI transfer */ +#define LL_SSI_TEST_MODE (1UL << SSI_CTRL0_SRL_Pos) /**< Test mode for SPI transfer: Rx and Tx connected inside */ +/** @} */ + +/** @defgroup SPI_LL_EC_SLAVEOUT_ENABLE Slave Out Enable + * @{ + */ +#define LL_SSI_SLAVE_OUTDIS 0x00000000UL /**< Output enable for SPI transfer as slave */ +#define LL_SSI_SLAVE_OUTEN (1UL << SSI_CTRL0_SLVOE_Pos) /**< Output disable for SPI transfer as slave */ +/** @} */ + +/** @defgroup SPI_LL_EC_TRANSFER_MODE Transfer Mode + * @{ + */ +#define LL_SSI_FULL_DUPLEX 0x00000000UL /**< Full-Duplex mode. Rx and Tx transfer on 2 lines */ +#define LL_SSI_SIMPLEX_TX (1UL << SSI_CTRL0_TMOD_Pos) /**< Simplex Tx mode. Tx transfer only on 1 line */ +#define LL_SSI_SIMPLEX_RX (2UL << SSI_CTRL0_TMOD_Pos) /**< Simplex Rx mode. Rx transfer only on 1 line */ +#define LL_SSI_READ_EEPROM (3UL << SSI_CTRL0_TMOD_Pos) /**< Read EEPROM mode. Rx transfer only on 1 line */ +/** @} */ + +/** @defgroup SPI_LL_EC_PHASE Clock Phase + * @{ + */ +#define LL_SSI_SCPHA_1EDGE 0x00000000UL /**< First clock transition is the first data capture edge */ +#define LL_SSI_SCPHA_2EDGE (1UL << SSI_CTRL0_SCPHA_Pos) /**< Second clock transition is the first data capture edge */ +/** @} */ + +/** @defgroup SPI_LL_EC_POLARITY Clock Polarity + * @{ + */ +#define LL_SSI_SCPOL_LOW 0x00000000UL /**< Clock to 0 when idle */ +#define LL_SSI_SCPOL_HIGH (1UL << SSI_CTRL0_SCPOL_Pos) /**< Clock to 1 when idle */ +/** @} */ + +/** @defgroup SPI_LL_EC_PROTOCOL Serial Protocol + * @{ + */ +#define LL_SSI_PROTOCOL_MOTOROLA 0x00000000UL /**< Motorola mode. Used as default value */ +#define LL_SSI_PROTOCOL_TI (1UL << SSI_CTRL0_FRF_Pos) /**< TI mode */ +#define LL_SSI_PROTOCOL_MICROWIRE (2UL << SSI_CTRL0_FRF_Pos) /**< Microwire mode */ +/** @} */ + +/** @defgroup SPI_LL_EC_MICROWIRECONTROL MicroWire Control + * @{ + */ +#define LL_SSI_MICROWIRE_HANDSHAKE_DIS 0x00000000UL /**< Enable Handshake for Microwire transfer */ +#define LL_SSI_MICROWIRE_HANDSHAKE_EN (1UL << SSI_MWC_MHS_Pos) /**< Disable Handshake for Microwire transfer */ + +#define LL_SSI_MICROWIRE_RX 0x00000000UL /**< Rx mode. Rx transfer at Microwire mode */ +#define LL_SSI_MICROWIRE_TX (1UL << SSI_MWC_MDD_Pos) /**< Tx mode. Tx transfer at Microwire mode */ + +#define LL_SSI_MICROWIRE_NON_SEQUENTIAL 0x00000000UL /**< Non-sequential for Microwire transfer */ +#define LL_SSI_MICROWIRE_SEQUENTIAL (1UL << SSI_MWC_MWMOD_Pos) /**< Sequential for Microwire transfer */ +/** @} */ + +/** @defgroup SPI_LL_EC_SLAVESELECT Slave Select + * @{ + */ +#define LL_SSI_SLAVE1 SSI_SE_SLAVE1 /**< Enable slave1 select pin for SPI transfer */ +#define LL_SSI_SLAVE0 SSI_SE_SLAVE0 /**< Enable slave0 select pin for SPI transfer */ +/** @} */ + +/** @defgroup SPI_LL_EC_DMA DMA Defines + * @{ + */ +#define LL_SSI_DMA_TX_DIS 0x00000000UL /**< Disable the transmit FIFO DMA channel */ +#define LL_SSI_DMA_TX_EN SSI_DMAC_TDMAE /**< Enable the transmit FIFO DMA channel */ + +#define LL_SSI_DMA_RX_DIS 0x00000000UL /**< Disable the receive FIFO DMA channel */ +#define LL_SSI_DMA_RX_EN SSI_DMAC_RDMAE /**< Enable the receive FIFO DMA channel */ +/** @} */ + +/** @defgroup SPI_LL_EC_INSTRUCTIONSIZE QSPI Instruction Size + * @{ + */ +#define LL_SSI_INSTSIZE_0BIT 0x00000000UL /**< Instruction length for QSPI transfer: 0 bits */ +#define LL_SSI_INSTSIZE_4BIT (1UL << SSI_SCTRL0_INSTL_Pos) /**< Instructoin length for QSPI transfer: 4 bits */ +#define LL_SSI_INSTSIZE_8BIT (2UL << SSI_SCTRL0_INSTL_Pos) /**< Instructoin length for QSPI transfer: 8 bits */ +#define LL_SSI_INSTSIZE_16BIT (3UL << SSI_SCTRL0_INSTL_Pos) /**< Instructoin length for QSPI transfer: 16 bits */ +/** @} */ + +/** @defgroup SPI_LL_EC_ADDRESSSIZE QSPI Address Size + * @{ + */ +#define LL_SSI_ADDRSIZE_0BIT 0x00000000UL /**< Address length for QSPI transfer: 0 bits */ +#define LL_SSI_ADDRSIZE_4BIT (1UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 4 bits */ +#define LL_SSI_ADDRSIZE_8BIT (2UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 8 bits */ +#define LL_SSI_ADDRSIZE_12BIT (3UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 12 bits */ +#define LL_SSI_ADDRSIZE_16BIT (4UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 16 bits */ +#define LL_SSI_ADDRSIZE_20BIT (5UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 20 bits */ +#define LL_SSI_ADDRSIZE_24BIT (6UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 24 bits */ +#define LL_SSI_ADDRSIZE_28BIT (7UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 28 bits */ +#define LL_SSI_ADDRSIZE_32BIT (8UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 32 bits */ +#define LL_SSI_ADDRSIZE_36BIT (9UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 36 bits */ +#define LL_SSI_ADDRSIZE_40BIT (10UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 40 bits */ +#define LL_SSI_ADDRSIZE_44BIT (11UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 44 bits */ +#define LL_SSI_ADDRSIZE_48BIT (12UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 48 bits */ +#define LL_SSI_ADDRSIZE_52BIT (13UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 52 bits */ +#define LL_SSI_ADDRSIZE_56BIT (14UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 56 bits */ +#define LL_SSI_ADDRSIZE_60BIT (15UL << SSI_SCTRL0_ADDRL_Pos) /**< Address length for QSPI transfer: 60 bits */ +/** @} */ + +/** @defgroup SPI_LL_EC_ADDRINSTTRNASFERFORMAT QSPI Address and Instruction Transfer Format + * @{ + */ +#define LL_SSI_INST_ADDR_ALL_IN_SPI 0x00000000UL /**< Instruction and address are sent in SPI mode */ +#define LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF (1UL << SSI_SCTRL0_TRANSTYPE_Pos) /**< Instruction is in sent in SPI mode and address is sent in Daul/Quad SPI mode */ +#define LL_SSI_INST_ADDR_ALL_IN_SPIFRF (2UL << SSI_SCTRL0_TRANSTYPE_Pos) /**< Instruction and address are sent in Daul/Quad SPI mode */ +/** @} */ + +/** @defgroup SPI_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL SPIM InitStrcut default configuartion + */ +#define LL_SPIM_DEFAULT_CONFIG \ +{ \ + .transfer_direction = LL_SSI_FULL_DUPLEX, \ + .data_size = LL_SSI_DATASIZE_8BIT, \ + .clock_polarity = LL_SSI_SCPOL_LOW, \ + .clock_phase = LL_SSI_SCPHA_1EDGE, \ + .slave_select = LL_SSI_SLAVE0, \ + .baud_rate = SystemCoreClock / 2000000, \ +} + +/** + * @brief LL SPIS InitStrcut default configuartion + */ +#define LL_SPIS_DEFAULT_CONFIG \ +{ \ + .data_size = LL_SSI_DATASIZE_8BIT, \ + .clock_polarity = LL_SSI_SCPOL_LOW, \ + .clock_phase = LL_SSI_SCPHA_1EDGE, \ +} + +/** + * @brief LL QSPI InitStrcut default configuartion + */ +#define LL_QSPI_DEFAULT_CONFIG \ +{ \ + .transfer_direction = LL_SSI_SIMPLEX_TX, \ + .instruction_size = LL_SSI_INSTSIZE_8BIT, \ + .address_size = LL_SSI_ADDRSIZE_24BIT, \ + .inst_addr_transfer_format = LL_SSI_INST_ADDR_ALL_IN_SPI,\ + .wait_cycles = 0, \ + .data_size = LL_SSI_DATASIZE_8BIT, \ + .clock_polarity = LL_SSI_SCPOL_LOW, \ + .clock_phase = LL_SSI_SCPHA_1EDGE, \ + .baud_rate = SystemCoreClock / 1000000, \ + .rx_sample_delay = 0, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup SPI_LL_Exported_Macros SPI Exported Macros + * @{ + */ + +/** @defgroup SPI_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in SPI register + * @param __instance__ SPI instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_SPI_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in SPI register + * @param __instance__ SPI instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_SPI_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup SPI_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup SPI_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable slave select toggle + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_ss_toggle(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->CTRL0, SSI_CTRL0_SSTEN); +} + +/** + * @brief Disable slave select toggle + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_ss_toggle(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->CTRL0, SSI_CTRL0_SSTEN); +} + +/** + * @brief Check if slave select toggle is enabled + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_ss_toggle(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->CTRL0, SSI_CTRL0_SSTEN) == (SSI_CTRL0_SSTEN)); +} + +/** + * @brief Set data frame format for transmitting/receiving the data + * @note This bit should be written only when SPI is disabled (SSI_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SPIFRF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param frf This parameter can be one of the following values: + * @arg @ref LL_SSI_FRF_SPI + * @arg @ref LL_SSI_FRF_DUALSPI + * @arg @ref LL_SSI_FRF_QUADSPI + * @retval None + */ +__STATIC_INLINE void ll_spi_set_frame_format(ssi_regs_t *SPIx, uint32_t frf) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_SPIFRF, frf); +} + +/** + * @brief Get data frame format for transmitting/receiving the data + * @note This bit should be written only when SPI is disabled (SSI_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SPIFRF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_FRF_SPI + * @arg @ref LL_SSI_FRF_DUALSPI + * @arg @ref LL_SSI_FRF_QUADSPI + */ +__STATIC_INLINE uint32_t ll_spi_get_frame_format(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_SPIFRF)); +} + +/** + * @brief Set frame data size + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | DFS32 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param size This parameter can be one of the following values: + * @arg @ref LL_SSI_DATASIZE_4BIT + * @arg @ref LL_SSI_DATASIZE_5BIT + * @arg @ref LL_SSI_DATASIZE_6BIT + * @arg @ref LL_SSI_DATASIZE_7BIT + * @arg @ref LL_SSI_DATASIZE_8BIT + * @arg @ref LL_SSI_DATASIZE_9BIT + * @arg @ref LL_SSI_DATASIZE_10BIT + * @arg @ref LL_SSI_DATASIZE_11BIT + * @arg @ref LL_SSI_DATASIZE_12BIT + * @arg @ref LL_SSI_DATASIZE_13BIT + * @arg @ref LL_SSI_DATASIZE_14BIT + * @arg @ref LL_SSI_DATASIZE_15BIT + * @arg @ref LL_SSI_DATASIZE_16BIT + * @arg @ref LL_SSI_DATASIZE_17BIT + * @arg @ref LL_SSI_DATASIZE_18BIT + * @arg @ref LL_SSI_DATASIZE_19BIT + * @arg @ref LL_SSI_DATASIZE_20BIT + * @arg @ref LL_SSI_DATASIZE_21BIT + * @arg @ref LL_SSI_DATASIZE_22BIT + * @arg @ref LL_SSI_DATASIZE_23BIT + * @arg @ref LL_SSI_DATASIZE_24BIT + * @arg @ref LL_SSI_DATASIZE_25BIT + * @arg @ref LL_SSI_DATASIZE_26BIT + * @arg @ref LL_SSI_DATASIZE_27BIT + * @arg @ref LL_SSI_DATASIZE_28BIT + * @arg @ref LL_SSI_DATASIZE_29BIT + * @arg @ref LL_SSI_DATASIZE_30BIT + * @arg @ref LL_SSI_DATASIZE_31BIT + * @arg @ref LL_SSI_DATASIZE_32BIT + * @retval None + */ +__STATIC_INLINE void ll_spi_set_data_size(ssi_regs_t *SPIx, uint32_t size) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_DFS32, size); +} + +/** + * @brief Get frame data size + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | DFS32 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_DATASIZE_4BIT + * @arg @ref LL_SSI_DATASIZE_5BIT + * @arg @ref LL_SSI_DATASIZE_6BIT + * @arg @ref LL_SSI_DATASIZE_7BIT + * @arg @ref LL_SSI_DATASIZE_8BIT + * @arg @ref LL_SSI_DATASIZE_9BIT + * @arg @ref LL_SSI_DATASIZE_10BIT + * @arg @ref LL_SSI_DATASIZE_11BIT + * @arg @ref LL_SSI_DATASIZE_12BIT + * @arg @ref LL_SSI_DATASIZE_13BIT + * @arg @ref LL_SSI_DATASIZE_14BIT + * @arg @ref LL_SSI_DATASIZE_15BIT + * @arg @ref LL_SSI_DATASIZE_16BIT + * @arg @ref LL_SSI_DATASIZE_17BIT + * @arg @ref LL_SSI_DATASIZE_18BIT + * @arg @ref LL_SSI_DATASIZE_19BIT + * @arg @ref LL_SSI_DATASIZE_20BIT + * @arg @ref LL_SSI_DATASIZE_21BIT + * @arg @ref LL_SSI_DATASIZE_22BIT + * @arg @ref LL_SSI_DATASIZE_23BIT + * @arg @ref LL_SSI_DATASIZE_24BIT + * @arg @ref LL_SSI_DATASIZE_25BIT + * @arg @ref LL_SSI_DATASIZE_26BIT + * @arg @ref LL_SSI_DATASIZE_27BIT + * @arg @ref LL_SSI_DATASIZE_28BIT + * @arg @ref LL_SSI_DATASIZE_29BIT + * @arg @ref LL_SSI_DATASIZE_30BIT + * @arg @ref LL_SSI_DATASIZE_31BIT + * @arg @ref LL_SSI_DATASIZE_32BIT + */ +__STATIC_INLINE uint32_t ll_spi_get_data_size(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_DFS32)); +} + +/** + * @brief Set the length of the control word for the Microwire frame format + * @note This bit should be written only when SPI is disabled (SSI_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | CFS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param size This parameter can be one of the following values: + * @arg @ref LL_SSI_MW_CMDSIZE_1BIT + * @arg @ref LL_SSI_MW_CMDSIZE_2BIT + * @arg @ref LL_SSI_MW_CMDSIZE_3BIT + * @arg @ref LL_SSI_MW_CMDSIZE_4BIT + * @arg @ref LL_SSI_MW_CMDSIZE_5BIT + * @arg @ref LL_SSI_MW_CMDSIZE_6BIT + * @arg @ref LL_SSI_MW_CMDSIZE_7BIT + * @arg @ref LL_SSI_MW_CMDSIZE_8BIT + * @arg @ref LL_SSI_MW_CMDSIZE_9BIT + * @arg @ref LL_SSI_MW_CMDSIZE_10BIT + * @arg @ref LL_SSI_MW_CMDSIZE_11BIT + * @arg @ref LL_SSI_MW_CMDSIZE_12BIT + * @arg @ref LL_SSI_MW_CMDSIZE_13BIT + * @arg @ref LL_SSI_MW_CMDSIZE_14BIT + * @arg @ref LL_SSI_MW_CMDSIZE_15BIT + * @arg @ref LL_SSI_MW_CMDSIZE_16BIT + * @retval None + */ +__STATIC_INLINE void ll_spi_set_control_frame_size(ssi_regs_t *SPIx, uint32_t size) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_CFS, size); +} + +/** + * @brief Get the length of the control word for the Microwire frame format + * @note This bit should be written only when SPI is disabled (SSI_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | CFS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_MW_CMDSIZE_1BIT + * @arg @ref LL_SSI_MW_CMDSIZE_2BIT + * @arg @ref LL_SSI_MW_CMDSIZE_3BIT + * @arg @ref LL_SSI_MW_CMDSIZE_4BIT + * @arg @ref LL_SSI_MW_CMDSIZE_5BIT + * @arg @ref LL_SSI_MW_CMDSIZE_6BIT + * @arg @ref LL_SSI_MW_CMDSIZE_7BIT + * @arg @ref LL_SSI_MW_CMDSIZE_8BIT + * @arg @ref LL_SSI_MW_CMDSIZE_9BIT + * @arg @ref LL_SSI_MW_CMDSIZE_10BIT + * @arg @ref LL_SSI_MW_CMDSIZE_11BIT + * @arg @ref LL_SSI_MW_CMDSIZE_12BIT + * @arg @ref LL_SSI_MW_CMDSIZE_13BIT + * @arg @ref LL_SSI_MW_CMDSIZE_14BIT + * @arg @ref LL_SSI_MW_CMDSIZE_15BIT + * @arg @ref LL_SSI_MW_CMDSIZE_16BIT + */ +__STATIC_INLINE uint32_t ll_spi_get_control_frame_size(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_CFS)); +} + +/** + * @brief Enable SPI test mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_test_mode(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->CTRL0, SSI_CTRL0_SRL); +} + +/** + * @brief Disable SPI test mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_test_mode(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->CTRL0, SSI_CTRL0_SRL); +} + +/** + * @brief Check if SPI test mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_test_mode(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->CTRL0, SSI_CTRL0_SRL) == (SSI_CTRL0_SRL)); +} + +/** + * @brief Enable slave output + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SLVOE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_slave_out(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->CTRL0, SSI_CTRL0_SLVOE); +} + +/** + * @brief Disable slave output + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SLVOE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_salve_out(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->CTRL0, SSI_CTRL0_SLVOE); +} + +/** + * @brief Check if slave output is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SLVOE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_slave_out(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->CTRL0, SSI_CTRL0_SLVOE) != (SSI_CTRL0_SLVOE)); +} + +/** + * @brief Set transfer direction mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | TMOD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param transfer_direction This parameter can be one of the following values: + * @arg @ref LL_SSI_FULL_DUPLEX + * @arg @ref LL_SSI_SIMPLEX_TX + * @arg @ref LL_SSI_SIMPLEX_RX + * @arg @ref LL_SSI_READ_EEPROM + * @retval None + */ +__STATIC_INLINE void ll_spi_set_transfer_direction(ssi_regs_t *SPIx, uint32_t transfer_direction) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_TMOD, transfer_direction); +} + +/** + * @brief Get transfer direction mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | TMOD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_FULL_DUPLEX + * @arg @ref LL_SSI_SIMPLEX_TX + * @arg @ref LL_SSI_SIMPLEX_RX + * @arg @ref LL_SSI_READ_EEPROM + */ +__STATIC_INLINE uint32_t ll_spi_get_transfer_direction(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_TMOD)); +} + +/** + * @brief Set clock polarity + * @note This bit should not be changed when communication is ongoing. + * This bit is not used in SPI TI mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SCPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param clock_polarity This parameter can be one of the following values: + * @arg @ref LL_SSI_SCPOL_LOW + * @arg @ref LL_SSI_SCPOL_HIGH + * @retval None + */ +__STATIC_INLINE void ll_spi_set_clock_polarity(ssi_regs_t *SPIx, uint32_t clock_polarity) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_SCPOL, clock_polarity); +} + +/** + * @brief Get clock polarity + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SCPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_SCPOL_LOW + * @arg @ref LL_SSI_SCPOL_HIGH + */ +__STATIC_INLINE uint32_t ll_spi_get_clock_polarity(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_SCPOL)); +} + +/** + * @brief Set clock phase + * @note This bit should not be changed when communication is ongoing. + * This bit is not used in SPI TI mode. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SCPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param clock_phase This parameter can be one of the following values: + * @arg @ref LL_SSI_SCPHA_1EDGE + * @arg @ref LL_SSI_SCPHA_2EDGE + * @retval None + */ +__STATIC_INLINE void ll_spi_set_clock_phase(ssi_regs_t *SPIx, uint32_t clock_phase) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_SCPHA, clock_phase); +} + +/** + * @brief Get clock phase + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | SCPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_SCPHA_1EDGE + * @arg @ref LL_SSI_SCPHA_2EDGE + */ +__STATIC_INLINE uint32_t ll_spi_get_clock_phase(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_SCPHA)); +} + +/** + * @brief Set serial protocol used + * @note This bit should be written only when SPI is disabled (SSI_EN = 0) for correct operation. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | FRF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param standard This parameter can be one of the following values: + * @arg @ref LL_SSI_PROTOCOL_MOTOROLA + * @arg @ref LL_SSI_PROTOCOL_TI + * @arg @ref LL_SSI_PROTOCOL_MICROWIRE + * @retval None + */ +__STATIC_INLINE void ll_spi_set_standard(ssi_regs_t *SPIx, uint32_t standard) +{ + MODIFY_REG(SPIx->CTRL0, SSI_CTRL0_FRF, standard); +} + +/** + * @brief Get serial protocol used + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | FRF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_PROTOCOL_MOTOROLA + * @arg @ref LL_SSI_PROTOCOL_TI + * @arg @ref LL_SSI_PROTOCOL_MICROWIRE + */ +__STATIC_INLINE uint32_t ll_spi_get_standard(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL0, SSI_CTRL0_FRF)); +} + +/** + * @brief Set the number of data frames to be continuously received + * @note These bits should not be changed when communication is ongoing. + This bits are effect when TMOD = 2b10 or 2b11. + This bits are not effect in SPIS. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | NDF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param size This parameter can be one of the following values: 0 ~ 65535 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_receive_size(ssi_regs_t *SPIx, uint32_t size) +{ + MODIFY_REG(SPIx->CTRL1, SSI_CTRL1_NDF, size); +} + +/** + * @brief Get the number of data frames to be continuously received + * @note These bits should not be changed when communication is ongoing. + This bits are effect when TMOD = 2b10 or 2b11. + This bits are not effect in SPIS. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | NDF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 65535 + */ +__STATIC_INLINE uint32_t ll_spi_get_receive_size(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->CTRL1, SSI_CTRL1_NDF)); +} + +/** + * @brief Enable SPI peripheral + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SSI_EN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->SSI_EN, SSI_SSIEN_EN); +} + +/** + * @brief Disable SPI peripheral + * @note When disabling the SPI, follow the procedure described in the Reference Manual. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SSI_EN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->SSI_EN, SSI_SSIEN_EN); +} + +/** + * @brief Check if SPI peripheral is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SSI_EN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->SSI_EN, SSI_SSIEN_EN) == (SSI_SSIEN_EN)); +} + +/** + * @brief Enable Handshake in Microwire mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MHS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_micro_handshake(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->MWC, SSI_MWC_MHS); +} + +/** + * @brief Disable Handshake in Microwire mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MHS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_micro_handshake(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->MWC, SSI_MWC_MHS); +} + +/** + * @brief Check if Handshake in Microwire mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MHS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_micro_handshake(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->MWC, SSI_MWC_MHS) == (SSI_MWC_MHS)); +} + +/** + * @brief Set transfer direction mode in Microwire mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MDD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param transfer_direction This parameter can be one of the following values: + * @arg @ref LL_SSI_MICROWIRE_RX + * @arg @ref LL_SSI_MICROWIRE_TX + * @retval None + */ +__STATIC_INLINE void ll_spi_set_micro_transfer_direction(ssi_regs_t *SPIx, uint32_t transfer_direction) +{ + MODIFY_REG(SPIx->MWC, SSI_MWC_MDD, transfer_direction); +} + +/** + * @brief Get transfer direction mode in Microwire mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MDD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_MICROWIRE_RX + * @arg @ref LL_SSI_MICROWIRE_TX + */ +__STATIC_INLINE uint32_t ll_spi_get_micro_transfer_direction(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->MWC, SSI_MWC_MDD)); +} + +/** + * @brief Set transfer mode in Microwire mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MWMOD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param transfer_mode This parameter can be one of the following values: + * @arg @ref LL_SSI_MICROWIRE_NON_SEQUENTIAL + * @arg @ref LL_SSI_MICROWIRE_SEQUENTIAL + * @retval None + */ +__STATIC_INLINE void ll_spi_set_micro_transfer_mode(ssi_regs_t *SPIx, uint32_t transfer_mode) +{ + MODIFY_REG(SPIx->MWC, SSI_MWC_MWMOD, transfer_mode); +} + +/** + * @brief Get transfer mode in Microwire mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MWC | MWMOD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_MICROWIRE_NON_SEQUENTIAL + * @arg @ref LL_SSI_MICROWIRE_SEQUENTIAL + */ +__STATIC_INLINE uint32_t ll_spi_get_micro_transfer_mode(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->MWC, SSI_MWC_MWMOD)); +} + +/** + * @brief Enable slave select + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SE | SLAVE1 | + * +----------------------+-----------------------------------+ + * \endrst + * SE | SLAVE0 + * + * @param SPIx SPI instance + * @param ss This parameter can be one of the following values: + * @arg @ref LL_SSI_SLAVE1 + * @arg @ref LL_SSI_SLAVE0 + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_ss(ssi_regs_t *SPIx, uint32_t ss) +{ + SET_BITS(SPIx->SE, ss); +} + +/** + * @brief Disable slave select + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SE | SLAVE1 | + * +----------------------+-----------------------------------+ + * \endrst + * SE | SLAVE0 + * + * @param SPIx SPI instance + * @param ss This parameter can be one of the following values: + * @arg @ref LL_SSI_SLAVE1 + * @arg @ref LL_SSI_SLAVE0 + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_ss(ssi_regs_t *SPIx, uint32_t ss) +{ + CLEAR_BITS(SPIx->SE, ss); +} + +/** + * @brief Check if slave select is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SE | SLAVE1 | + * +----------------------+-----------------------------------+ + * \endrst + * SE | SLAVE0 + * + * @param SPIx SPI instance + * @param ss This parameter can be one of the following values: + * @arg @ref LL_SSI_SLAVE1 + * @arg @ref LL_SSI_SLAVE0 + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_ss(ssi_regs_t *SPIx, uint32_t ss) +{ + return (READ_BITS(SPIx->SE, ss) == ss); +} + +/** + * @brief Set baud rate prescaler + * @note These bits should not be changed when communication is ongoing. SPI BaudRate = fPCLK/Prescaler. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BAUD | SCKDIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param baud_rate This parameter can be one even value between 2 and 65534, if the value is 0, the SCLK is disable. + * @retval None + */ +__STATIC_INLINE void ll_spi_set_baud_rate_prescaler(ssi_regs_t *SPIx, uint32_t baud_rate) +{ + WRITE_REG(SPIx->BAUD, baud_rate); +} + +/** + * @brief Get baud rate prescaler + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BAUD | SCKDIV | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one even value between 2 and 65534. + */ +__STATIC_INLINE uint32_t ll_spi_get_baud_rate_prescaler(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->BAUD, SSI_BAUD_SCKDIV)); +} + +/** + * @brief Set threshold of TXFIFO that triggers an TXE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFTL | TFT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param threshold This parameter can be one of the following values: 0 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_tx_fifo_threshold(ssi_regs_t *SPIx, uint32_t threshold) +{ + WRITE_REG(SPIx->TX_FTL, threshold); +} + +/** + * @brief Get threshold of TXFIFO that triggers an TXE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFTL | TFT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 7 + */ +__STATIC_INLINE uint32_t ll_spi_get_tx_fifo_threshold(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->TX_FTL, SSI_TXFTL_TFT)); +} + +/** + * @brief Set threshold of RXFIFO that triggers an RXNE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFTL | RFT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param threshold This parameter can be one of the following values: 0 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_rx_fifo_threshold(ssi_regs_t *SPIx, uint32_t threshold) +{ + WRITE_REG(SPIx->RX_FTL, threshold); +} + +/** + * @brief Get threshold of RXFIFO that triggers an RXNE event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFTL | RFT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 7 + */ +__STATIC_INLINE uint32_t ll_spi_get_rx_fifo_threshold(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->RX_FTL, SSI_RXFTL_RFT)); +} + +/** + * @brief Get FIFO Transmission Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXFL | TXTFL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 8 + */ +__STATIC_INLINE uint32_t ll_spi_get_tx_fifo_level(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->TX_FL, SSI_TXFL_TXTFL)); +} + +/** + * @brief Get FIFO reception Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXFL | RXTFL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 8 + */ +__STATIC_INLINE uint32_t ll_spi_get_rx_fifo_level(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->RX_FL, SSI_RXFL_RXTFL)); +} + +/** + * @brief Get ID code + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IDCODE | ID | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value is const. + */ +__STATIC_INLINE uint32_t ll_spi_get_id_code(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->ID, SSI_IDCODE_ID)); +} + +/** + * @brief Get IP version + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | COMP | VERSION | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value is const. + */ +__STATIC_INLINE uint32_t ll_spi_get_version(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->VERSION_ID, SSI_COMP_VERSION)); +} + +/** @} */ + +/** @defgroup SPI_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable interrupt + * @note This bit controls the generation of an interrupt when an event occurs. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | INTMASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_SSI_IM_MST(not effect in SPIS) + * @arg @ref LL_SSI_IM_RXF + * @arg @ref LL_SSI_IM_RXO + * @arg @ref LL_SSI_IM_RXU + * @arg @ref LL_SSI_IM_TXO + * @arg @ref LL_SSI_IM_TXE + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_it(ssi_regs_t *SPIx, uint32_t mask) +{ + SET_BITS(SPIx->INTMASK, mask); +} + +/** + * @brief Disable interrupt + * @note This bit controls the generation of an interrupt when an event occurs. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | INTMASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_SSI_IM_MST(not effect in SPIS) + * @arg @ref LL_SSI_IM_RXF + * @arg @ref LL_SSI_IM_RXO + * @arg @ref LL_SSI_IM_RXU + * @arg @ref LL_SSI_IM_TXO + * @arg @ref LL_SSI_IM_TXE + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_it(ssi_regs_t *SPIx, uint32_t mask) +{ + CLEAR_BITS(SPIx->INTMASK, mask); +} + +/** + * @brief Check if interrupt is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTMASK | INTMASK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_SSI_IM_MST(not effect in SPIS) + * @arg @ref LL_SSI_IM_RXF + * @arg @ref LL_SSI_IM_RXO + * @arg @ref LL_SSI_IM_RXU + * @arg @ref LL_SSI_IM_TXO + * @arg @ref LL_SSI_IM_TXE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_it(ssi_regs_t *SPIx, uint32_t mask) +{ + return (READ_BITS(SPIx->INTMASK, mask) == mask); +} + +/** @} */ + +/** @defgroup SPI_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get SPI status + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_SSI_SR_DCOL(no effect in SPIS) + * @arg @ref LL_SSI_SR_TXE + * @arg @ref LL_SSI_SR_RFF + * @arg @ref LL_SSI_SR_RFNE + * @arg @ref LL_SSI_SR_TFE + * @arg @ref LL_SSI_SR_TFNF + * @arg @ref LL_SSI_SR_BUSY + */ +__STATIC_INLINE uint32_t ll_spi_get_status(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->STAT)); +} + +/** + * @brief Check active flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | DCOL | + * +----------------------+-----------------------------------+ + * | STAT | TXE | + * +----------------------+-----------------------------------+ + * | STAT | RFF | + * +----------------------+-----------------------------------+ + * | STAT | RFNE | + * +----------------------+-----------------------------------+ + * | STAT | TFE | + * +----------------------+-----------------------------------+ + * | STAT | TFNF | + * +----------------------+-----------------------------------+ + * | STAT | BUSY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_SSI_SR_DCOL(no effect in SPIS) + * @arg @ref LL_SSI_SR_TXE + * @arg @ref LL_SSI_SR_RFF + * @arg @ref LL_SSI_SR_RFNE + * @arg @ref LL_SSI_SR_TFE + * @arg @ref LL_SSI_SR_TFNF + * @arg @ref LL_SSI_SR_BUSY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_active_flag(ssi_regs_t *SPIx, uint32_t flag) +{ + return (READ_BITS(SPIx->STAT, flag) == (flag)); +} + +/** + * @brief Get SPI interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_SSI_IS_MST(no effect in SPIS) + * @arg @ref LL_SSI_IS_RXF + * @arg @ref LL_SSI_IS_RXO + * @arg @ref LL_SSI_IS_RXU + * @arg @ref LL_SSI_IS_TXO + * @arg @ref LL_SSI_IS_TXE + */ +__STATIC_INLINE uint32_t ll_spi_get_it_flag(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->INTSTAT)); +} + +/** + * @brief Check interrupt flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | MSTIS | + * +----------------------+-----------------------------------+ + * \endrst + * INTSTAT | RXFIS + * INTSTAT | RXOIS + * INTSTAT | RXUIS + * INTSTAT | TXOIS + * INTSTAT | TXEIS + * + * @param SPIx SPI instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_SSI_IS_MST(no effect in SPIS) + * @arg @ref LL_SSI_IS_RXF + * @arg @ref LL_SSI_IS_RXO + * @arg @ref LL_SSI_IS_RXU + * @arg @ref LL_SSI_IS_TXO + * @arg @ref LL_SSI_IS_TXE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_it_flag(ssi_regs_t *SPIx, uint32_t flag) +{ + return (READ_BITS(SPIx->INTSTAT, flag) == flag); +} + +/** + * @brief Get SPI raw interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RAW_INTSTAT | RAW_INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_SSI_RIS_MST(no effect in SPIS) + * @arg @ref LL_SSI_RIS_RXF + * @arg @ref LL_SSI_RIS_RXO + * @arg @ref LL_SSI_RIS_RXU + * @arg @ref LL_SSI_RIS_TXO + * @arg @ref LL_SSI_RIS_TXE + */ +__STATIC_INLINE uint32_t ll_spi_get_raw_if_flag(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->RAW_INTSTAT)); +} + +/** + * @brief Clear transmit FIFO overflow error flag + * @note Clearing this flag is done by reading TXOIC register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TXOIC | TXOIC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_clear_flag_txo(ssi_regs_t *SPIx) +{ + __IOM uint32_t tmpreg; + tmpreg = SPIx->TXOIC; + (void) tmpreg; +} + +/** + * @brief Clear receive FIFO overflow error flag + * @note Clearing this flag is done by reading RXOIC register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXOIC | RXOIC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_clear_flag_rxo(ssi_regs_t *SPIx) +{ + __IOM uint32_t tmpreg; + tmpreg = SPIx->RXOIC; + (void) tmpreg; +} + +/** + * @brief Clear receive FIFO underflow error flag + * @note Clearing this flag is done by reading RXUIC register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RXUIC | RXUIC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_clear_flag_rxu(ssi_regs_t *SPIx) +{ + __IOM uint32_t tmpreg; + tmpreg = SPIx->RXUIC; + (void) tmpreg; +} + +/** + * @brief Clear multi-master error flag + * @note Clearing this flag is done by reading MSTIC register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSTIC | MSTIC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_clear_flag_mst(ssi_regs_t *SPIx) +{ + __IOM uint32_t tmpreg; + tmpreg = SPIx->MSTIC; + (void) tmpreg; +} + +/** + * @brief Clear all error flag + * @note Clearing this flag is done by reading INTCLR register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INTCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_clear_flag_all(ssi_regs_t *SPIx) +{ + __IOM uint32_t tmpreg; + tmpreg = SPIx->INTCLR; + (void) tmpreg; +} + +/** @} */ + +/** @defgroup SPI_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Enable DMA Tx + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_dma_req_tx(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->DMAC, SSI_DMAC_TDMAE); +} + +/** + * @brief Disable DMA Tx + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_dma_req_tx(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->DMAC, SSI_DMAC_TDMAE); +} + +/** + * @brief Check if DMA Tx is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | TDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_dma_req_tx(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->DMAC, SSI_DMAC_TDMAE) == (SSI_DMAC_TDMAE)); +} + +/** + * @brief Enable DMA Rx + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_enable_dma_req_rx(ssi_regs_t *SPIx) +{ + SET_BITS(SPIx->DMAC, SSI_DMAC_RDMAE); +} + +/** + * @brief Disable DMA Rx + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval None + */ +__STATIC_INLINE void ll_spi_disable_dma_req_rx(ssi_regs_t *SPIx) +{ + CLEAR_BITS(SPIx->DMAC, SSI_DMAC_RDMAE); +} + +/** + * @brief Check if DMA Rx is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMAC | RDMAE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_spi_is_enabled_dma_req_rx(ssi_regs_t *SPIx) +{ + return (READ_BITS(SPIx->DMAC, SSI_DMAC_RDMAE) == (SSI_DMAC_RDMAE)); +} + +/** + * @brief Set threshold of TXFIFO that triggers an DMA Tx request event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMATDL | DMATDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param threshold This parameter can be one of the following values: 0 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_dma_tx_fifo_threshold(ssi_regs_t *SPIx, uint32_t threshold) +{ + WRITE_REG(SPIx->DMA_TDL, threshold); +} + +/** + * @brief Get threshold of TXFIFO that triggers an DMA Tx request event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMATDL | DMATDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 7 + */ +__STATIC_INLINE uint32_t ll_spi_get_dma_tx_fifo_threshold(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->DMA_TDL, SSI_DMATDL_DMATDL)); +} + +/** + * @brief Set threshold of RXFIFO that triggers an DMA Rx request event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMARDL | DMARDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param threshold This parameter can be one of the following values: 0 ~ 7 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_dma_rx_fifo_threshold(ssi_regs_t *SPIx, uint32_t threshold) +{ + WRITE_REG(SPIx->DMA_RDL, threshold); +} + +/** + * @brief Get threshold of RXFIFO that triggers an DMA Rx request event + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DMARDL | DMARDL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 7 + */ +__STATIC_INLINE uint32_t ll_spi_get_dma_rx_fifo_threshold(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->DMA_RDL, SSI_DMARDL_DMARDL)); +} + +/** @} */ + +/** @defgroup SPI_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Write 8-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param tx_data Value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void ll_spi_transmit_data8(ssi_regs_t *SPIx, uint8_t tx_data) +{ + *((__IOM uint8_t *)&SPIx->DATA) = tx_data; +} + +/** + * @brief Write 16-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param tx_data Value between Min_Data=0x0000 and Max_Data=0xFFFF + * @retval None + */ +__STATIC_INLINE void ll_spi_transmit_data16(ssi_regs_t *SPIx, uint16_t tx_data) +{ + *((__IOM uint16_t *)&SPIx->DATA) = tx_data; +} + +/** + * @brief Write 32-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param tx_data Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_spi_transmit_data32(ssi_regs_t *SPIx, uint32_t tx_data) +{ + *((__IOM uint32_t *)&SPIx->DATA) = tx_data; +} + +/** + * @brief Read 8-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Rerturned Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t ll_spi_receive_data8(ssi_regs_t *SPIx) +{ + return (uint8_t)(READ_REG(SPIx->DATA)); +} + +/** + * @brief Read 16-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned Value between Min_Data=0x0000 and Max_Data=0xFFFF + */ +__STATIC_INLINE uint16_t ll_spi_receive_data16(ssi_regs_t *SPIx) +{ + return (uint16_t)(READ_REG(SPIx->DATA)); +} + +/** + * @brief Read 32-Bits in the data register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DATA | DATA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned Value between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_spi_receive_data32(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->DATA)); +} + +/** + * @brief Set Rx sample delay + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RX_SAMPLEDLY | RX_SAMPLEDLY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param delay This parameter can be one of the following values: 0 ~ 256 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_rx_sample_delay(ssi_regs_t *SPIx, uint32_t delay) +{ + WRITE_REG(SPIx->RX_SAMPLE_DLY, delay); +} + +/** + * @brief Get Rx sample delay + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RX_SAMPLEDLY | RX_SAMPLEDLY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 256 + */ +__STATIC_INLINE uint32_t ll_spi_get_rx_sample_delay(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_REG(SPIx->RX_SAMPLE_DLY)); +} + +/** + * @brief Set number of wait cycles in Dual/Quad SPI mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | WAITCYCLES | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param wait_cycles This parameter can be one of the following values: 0 ~ 31 + * @retval None + */ +__STATIC_INLINE void ll_spi_set_wait_cycles(ssi_regs_t *SPIx, uint32_t wait_cycles) +{ + MODIFY_REG(SPIx->SPI_CTRL0, SSI_SCTRL0_WAITCYCLES, wait_cycles << SSI_SCTRL0_WAITCYCLES_Pos); +} + +/** + * @brief Get number of wait cycles in Dual/Quad SPI mode + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | WAITCYCLES | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: 0 ~ 31 + */ +__STATIC_INLINE uint32_t ll_spi_get_wait_cycles(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->SPI_CTRL0, SSI_SCTRL0_WAITCYCLES) >> SSI_SCTRL0_WAITCYCLES_Pos); +} + +/** + * @brief Set Dual/Quad SPI mode instruction length in bits + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | INSTL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param size This parameter can be one of the following values: + * @arg @ref LL_SSI_INSTSIZE_0BIT + * @arg @ref LL_SSI_INSTSIZE_4BIT + * @arg @ref LL_SSI_INSTSIZE_8BIT + * @arg @ref LL_SSI_INSTSIZE_16BIT + * @retval None + */ +__STATIC_INLINE void ll_spi_set_instruction_size(ssi_regs_t *SPIx, uint32_t size) +{ + MODIFY_REG(SPIx->SPI_CTRL0, SSI_SCTRL0_INSTL, size); +} + +/** + * @brief Get Dual/Quad SPI mode instruction length in bits + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | INSTL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_INSTSIZE_0BIT + * @arg @ref LL_SSI_INSTSIZE_4BIT + * @arg @ref LL_SSI_INSTSIZE_8BIT + * @arg @ref LL_SSI_INSTSIZE_16BIT + */ +__STATIC_INLINE uint32_t ll_spi_get_instruction_size(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->SPI_CTRL0, SSI_SCTRL0_INSTL)); +} + +/** + * @brief Set Dual/Quad SPI mode address length in bits + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | ADDRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param size This parameter can be one of the following values: + * @arg @ref LL_SSI_ADDRSIZE_0BIT + * @arg @ref LL_SSI_ADDRSIZE_4BIT + * @arg @ref LL_SSI_ADDRSIZE_8BIT + * @arg @ref LL_SSI_ADDRSIZE_12BIT + * @arg @ref LL_SSI_ADDRSIZE_16BIT + * @arg @ref LL_SSI_ADDRSIZE_20BIT + * @arg @ref LL_SSI_ADDRSIZE_24BIT + * @arg @ref LL_SSI_ADDRSIZE_28BIT + * @arg @ref LL_SSI_ADDRSIZE_32BIT + * @arg @ref LL_SSI_ADDRSIZE_36BIT + * @arg @ref LL_SSI_ADDRSIZE_40BIT + * @arg @ref LL_SSI_ADDRSIZE_44BIT + * @arg @ref LL_SSI_ADDRSIZE_48BIT + * @arg @ref LL_SSI_ADDRSIZE_52BIT + * @arg @ref LL_SSI_ADDRSIZE_56BIT + * @arg @ref LL_SSI_ADDRSIZE_60BIT + * @retval None + */ +__STATIC_INLINE void ll_spi_set_address_size(ssi_regs_t *SPIx, uint32_t size) +{ + MODIFY_REG(SPIx->SPI_CTRL0, SSI_SCTRL0_ADDRL, size); +} + +/** + * @brief Get Dual/Quad SPI mode address length in bits + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | ADDRL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_ADDRSIZE_0BIT + * @arg @ref LL_SSI_ADDRSIZE_4BIT + * @arg @ref LL_SSI_ADDRSIZE_8BIT + * @arg @ref LL_SSI_ADDRSIZE_12BIT + * @arg @ref LL_SSI_ADDRSIZE_16BIT + * @arg @ref LL_SSI_ADDRSIZE_20BIT + * @arg @ref LL_SSI_ADDRSIZE_24BIT + * @arg @ref LL_SSI_ADDRSIZE_28BIT + * @arg @ref LL_SSI_ADDRSIZE_32BIT + * @arg @ref LL_SSI_ADDRSIZE_36BIT + * @arg @ref LL_SSI_ADDRSIZE_40BIT + * @arg @ref LL_SSI_ADDRSIZE_44BIT + * @arg @ref LL_SSI_ADDRSIZE_48BIT + * @arg @ref LL_SSI_ADDRSIZE_52BIT + * @arg @ref LL_SSI_ADDRSIZE_56BIT + * @arg @ref LL_SSI_ADDRSIZE_60BIT + */ +__STATIC_INLINE uint32_t ll_spi_get_address_size(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->SPI_CTRL0, SSI_SCTRL0_ADDRL)); +} + +/** + * @brief Set Dual/Quad SPI mode address and instruction transfer format + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | TRANSTYPE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @param format This parameter can be one of the following values: + * @arg @ref LL_SSI_INST_ADDR_ALL_IN_SPI + * @arg @ref LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF + * @arg @ref LL_SSI_INST_ADDR_ALL_IN_SPIFRF + * @retval None + */ +__STATIC_INLINE void ll_spi_set_add_inst_transfer_format(ssi_regs_t *SPIx, uint32_t format) +{ + MODIFY_REG(SPIx->SPI_CTRL0, SSI_SCTRL0_TRANSTYPE, format); +} + +/** + * @brief Get Dual/Quad SPI mode address and instruction transfer format + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SCTRL0 | TRANSTYPE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param SPIx SPI instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_SSI_INST_ADDR_ALL_IN_SPI + * @arg @ref LL_SSI_INST_IN_SPI_ADDR_IN_SPIFRF + * @arg @ref LL_SSI_INST_ADDR_ALL_IN_SPIFRF + */ +__STATIC_INLINE uint32_t ll_spi_get_addr_inst_transfer_format(ssi_regs_t *SPIx) +{ + return (uint32_t)(READ_BITS(SPIx->SPI_CTRL0, SSI_SCTRL0_TRANSTYPE)); +} + +/** @} */ + +/** @defgroup SPI_LL_EF_Init SPIM Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize SSI registers (Registers restored to their default values). + * @param SPIx SSI instance + * @retval An error_status_t enumeration value: + * - SUCCESS: SSI registers are de-initialized + * - ERROR: SSI registers are not de-initialized + */ +error_status_t ll_spim_deinit(ssi_regs_t *SPIx); + +/** + * @brief Initialize SPIM registers according to the specified + * parameters in p_spi_init. + * @param SPIx SSI instance + * @param p_spi_init Pointer to a ll_spim_init_t structure that contains the configuration + * information for the specified SPIM peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: SSI registers are initialized according to p_spi_init content + * - ERROR: Problem occurred during SSI Registers initialization + */ +error_status_t ll_spim_init(ssi_regs_t *SPIx, ll_spim_init_t *p_spi_init); + +/** + * @brief Set each field of a @ref ll_spim_init_t type structure to default value. + * @param p_spi_init Pointer to a @ref ll_spim_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_spim_struct_init(ll_spim_init_t *p_spi_init); + +/** @} */ + +/** @defgroup SPIS_LL_Init SPIS Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize SSI registers (Registers restored to their default values). + * @param SPIx SSI instance + * @retval An error_status_t enumeration value: + * - SUCCESS: SSI registers are de-initialized + * - ERROR: SSI registers are not de-initialized + */ +error_status_t ll_spis_deinit(ssi_regs_t *SPIx); + +/** + * @brief Initialize SSI registers according to the specified + * parameters in p_spi_init. + * @param SPIx SSI instance + * @param p_spi_init Pointer to a ll_spis_init_t structure that contains the configuration + * information for the specified SPIS peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: SSI registers are initialized according to p_spi_init content + * - ERROR: Problem occurred during SPI Registers initialization + */ +error_status_t ll_spis_init(ssi_regs_t *SPIx, ll_spis_init_t *p_spi_init); + +/** + * @brief Set each field of a @ref ll_spis_init_t type structure to default value. + * @param p_spi_init Pointer to a @ref ll_spis_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_spis_struct_init(ll_spis_init_t *p_spi_init); +/** @} */ + +/** @defgroup QSPI_LL_Init QSPI Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize SSI registers (Registers restored to their default values). + * @param SPIx SSI instance + * @retval An error_status_t enumeration value: + * - SUCCESS: SSI registers are de-initialized + * - ERROR: SSI registers are not de-initialized + */ +error_status_t ll_qspi_deinit(ssi_regs_t *SPIx); + +/** + * @brief Initialize SSI registers according to the specified + * parameters in SPI_InitStruct. + * @param SPIx SSI instance + * @param p_spi_init Pointer to a ll_qspi_init_t structure that contains the configuration + * information for the specified QSPI peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: SPI registers are initialized according to p_spi_init content + * - ERROR: Problem occurred during SPI Registers initialization + */ +error_status_t ll_qspi_init(ssi_regs_t *SPIx, ll_qspi_init_t *p_spi_init); + +/** + * @brief Set each field of a @ref ll_qspi_init_t type structure to default value. + * @param p_spi_init Pointer to a @ref ll_qspi_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_qspi_struct_init(ll_qspi_init_t *p_spi_init); + +/** @} */ + +/** @} */ + +#endif /* SPIM || SPIS || QSPI0 || QSPI1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_SPI_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_tim.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_tim.h new file mode 100644 index 0000000..2ecffe5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_tim.h @@ -0,0 +1,448 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_tim.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of TIMER LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_TIMER TIMER + * @brief TIMER LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_TIMER_H__ +#define __GR55XX_LL_TIMER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (TIMER0) || defined (TIMER1) + +/** @defgroup TIMER_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup TIMER_LL_ES_INIT TIMER Exported init structures + * @{ + */ + +/** + * @brief LL TIMER init Structure definition + */ +typedef struct _ll_timer_init_t +{ + uint32_t auto_reload; /**< Specifies the auto reload value to be loaded into the active + Auto-Reload Register at the next update event. + This parameter must be a number between Min_Data=0x00000000 and Max_Data=0xFFFFFFFF. + Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF. + + This feature can be modified afterwards using unitary function @ref ll_timer_set_auto_reload().*/ +} ll_timer_init_t; +/** @} */ + +/** @} */ + +/** + * @defgroup TIMER_LL_TIMER_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup TIMER_LL_Exported_Constants TIMER Exported Constants + * @{ + */ + +/** @defgroup TIMER_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ +/** + * @brief LL TIMER InitStrcut default configuartion + */ +#define TIMER_DEFAULT_CONFIG \ +{ \ + .auto_reload = SystemCoreClock - 1, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup TIMER_LL_Exported_Macros TIMER Exported Macros + * @{ + */ + +/** @defgroup TIMER_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in TIMER register + * @param __instance__ TIMER instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_TIMER_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in TIMER register + * @param __instance__ TIMER instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_TIMER_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup TIMER_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup TIMER_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable timer counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_timer_enable_counter(timer_regs_t *TIMERx) +{ + SET_BITS(TIMERx->CTRL, TIMER_CTRL_EN); +} + +/** + * @brief Disable timer counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_timer_disable_counter(timer_regs_t *TIMERx) +{ + CLEAR_BITS(TIMERx->CTRL, TIMER_CTRL_EN); +} + +/** + * @brief Indicate whether the timer counter is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_timer_is_enabled_counter(timer_regs_t *TIMERx) +{ + return (READ_BITS(TIMERx->CTRL, TIMER_CTRL_EN) == (TIMER_CTRL_EN)); +} + +/** + * @brief Set the counter value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | VALUE | VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @param counter Counter value (between Min_Data=0 and Max_Data=0xFFFFFFFF) + * @retval None + */ +__STATIC_INLINE void ll_timer_set_counter(timer_regs_t *TIMERx, uint32_t counter) +{ + WRITE_REG(TIMERx->VALUE, counter); +} + +/** + * @brief Get the counter value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | VALUE | VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval Counter value (between Min_Data=0 and Max_Data=0xFFFFFFFF) + */ +__STATIC_INLINE uint32_t ll_timer_get_counter(timer_regs_t *TIMERx) +{ + return (uint32_t)(READ_REG(TIMERx->VALUE)); +} + +/** + * @brief Set the auto-reload value. + * @note The counter is blocked while the auto-reload value is null. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RELOAD | RELOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @param auto_reload between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_timer_set_auto_reload(timer_regs_t *TIMERx, uint32_t auto_reload) +{ + WRITE_REG(TIMERx->RELOAD, auto_reload); +} + +/** + * @brief Get the auto-reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RELOAD | RELOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval Auto-reload value + */ +__STATIC_INLINE uint32_t ll_timer_get_auto_reload(timer_regs_t *TIMERx) +{ + return (uint32_t)(READ_REG(TIMERx->RELOAD)); +} + +/** @} */ + +/** @defgroup TIM_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable timer interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_timer_enable_it(timer_regs_t *TIMERx) +{ + SET_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN); +} + +/** + * @brief Disable timer interrput. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_timer_disable_it(timer_regs_t *TIMERx) +{ + CLEAR_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN); +} + +/** + * @brief Indicate whether the timer interrput is enabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_timer_is_enabled_it(timer_regs_t *TIMERx) +{ + return (READ_BITS(TIMERx->CTRL, TIMER_CTRL_INTEN) == (TIMER_CTRL_INTEN)); +} + +/** @} */ + +/** @defgroup TIM_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Clear the interrupt flag (INTSTAT). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval None + */ +__STATIC_INLINE void ll_timer_clear_flag_it(timer_regs_t *TIMERx) +{ + WRITE_REG(TIMERx->INTSTAT, TIMER_INT_STAT); +} + +/** + * @brief Indicate whether interrupt flag (INTSTAT) is set (interrupt is pending). + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param TIMERx Timer instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_timer_is_active_flag_it(timer_regs_t *TIMERx) +{ + return (READ_BITS(TIMERx->INTSTAT, TIMER_INT_STAT) == (TIMER_INT_STAT)); +} + +/** @} */ + +/** @defgroup TIM_LL_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize TIMER registers (Registers restored to their default values). + * @param TIMERx TIMER instance + * @retval An error_status_t enumeration value: + * - SUCCESS: TIMER registers are de-initialized + * - ERROR: TIMER registers are not de-initialized + */ +error_status_t ll_timer_deinit(timer_regs_t *TIMERx); + +/** + * @brief Initialize TIMER registers according to the specified + * parameters in TIMER_InitStruct. + * @param TIMERx TIMER instance + * @param p_timer_init Pointer to a ll_timer_init_t structure that contains the configuration + * information for the specified TIM peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: TIMER registers are initialized according to p_timer_init content + * - ERROR: Problem occurred during TIMER Registers initialization + */ +error_status_t ll_timer_init(timer_regs_t *TIMERx, ll_timer_init_t *p_timer_init); + +/** + * @brief Set each field of a @ref ll_timer_init_t type structure to default value. + * @param p_timer_init Pointer to a @ref ll_timer_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_timer_struct_init(ll_timer_init_t *p_timer_init); + +/** @} */ + +/** @} */ + +#endif /* TIMER0 || TIMER1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_TIMER_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_uart.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_uart.h new file mode 100644 index 0000000..ca29095 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_uart.h @@ -0,0 +1,1621 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_uart.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of UART LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_UART UART + * @brief UART LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_UART_H__ +#define __GR55xx_LL_UART_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (UART0) || defined (UART1) + +/** @defgroup UART_LL_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup UART_LL_ES_INIT UART Exported init structures + * @{ + */ + +/** + * @brief LL UART init Structure definition + */ +typedef struct _ll_uart_init_t +{ + uint32_t baud_rate; /**< This field defines expected Usart communication baud rate. + + This feature can be modified afterwards using unitary function @ref ll_uart_set_baud_rate().*/ + + uint32_t data_bits; /**< Specifies the number of data bits transmitted or received in a frame. + This parameter can be a value of @ref UART_LL_EC_DATABITS. + + This feature can be modified afterwards using unitary function @ref ll_uart_set_data_bits_length().*/ + + uint32_t stop_bits; /**< Specifies the number of stop bits transmitted. + This parameter can be a value of @ref UART_LL_EC_STOPBITS. + + This feature can be modified afterwards using unitary function @ref ll_uart_set_stop_bits_length().*/ + + uint32_t parity; /**< Specifies the parity mode. + This parameter can be a value of @ref UART_LL_EC_PARITY. + + This feature can be modified afterwards using unitary function @ref ll_uart_set_parity().*/ + + uint32_t hw_flow_ctrl; /**< Specifies whether the hardware flow control mode is enabled or disabled. + This parameter can be a value of @ref UART_LL_EC_HWCONTROL. + + This feature can be modified afterwards using unitary function @ref ll_uart_set_hw_flow_ctrl().*/ +} ll_uart_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup UART_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup UART_LL_Exported_Constants UART Exported Constants + * @{ + */ + +/** @defgroup UART_LL_EC_GET_FLAG Get Flags Defines + * @brief Flags definitions which can be used with LL_UART_ReadReg function + * @{ + */ +#define LL_UART_LSR_OE UART_LSR_OE /**< Overrun error flag */ +#define LL_UART_LSR_PE UART_LSR_PE /**< Parity error flag */ +#define LL_UART_LSR_FE UART_LSR_FE /**< Framing error flag */ +#define LL_UART_LSR_BI UART_LSR_BI /**< Break detection flag */ +#define LL_UART_LSR_THRE UART_LSR_THRE /**< Transmit holding register empty flag */ +#define LL_UART_LSR_TEMT UART_LSR_TEMT /**< Transmitter empty flag */ +#define LL_UART_LSR_RFE UART_LSR_RFE /**< Rx FIFO error flag */ + +#define LL_UART_IIR_MS UART_IIR_IID_MS /**< Modem Status flag */ +#define LL_UART_IIR_NIP UART_IIR_IID_NIP /**< No Interrupt Pending flag */ +#define LL_UART_IIR_THRE UART_IIR_IID_THRE /**< THR Empty flag */ +#define LL_UART_IIR_RDA UART_IIR_IID_RDA /**< Received Data Available flag */ +#define LL_UART_IIR_RLS UART_IIR_IID_RLS /**< Receiver Line Status flag */ +#define LL_UART_IIR_CTO UART_IIR_IID_CTO /**< Character Timeout flag */ + +#define LL_UART_USR_RFF UART_USR_RFF /**< Rx FIFO Full flag */ +#define LL_UART_USR_RFNE UART_USR_RFNE /**< Rx FIFO Not Empty flag */ +#define LL_UART_USR_TFE UART_USR_TFE /**< Tx FIFO Empty flag */ +#define LL_UART_USR_TFNF UART_USR_TFNF /**< Tx FIFO Not Full flag */ +/** @} */ + +/** @defgroup UART_LL_EC_IT IT Defines + * @brief Interrupt definitions which can be used with LL_UART_ReadReg and LL_UART_WriteReg functions + * @{ + */ +#define LL_UART_IER_MS UART_IER_EDSSI /**< Enable Modem Status Interrupt */ +#define LL_UART_IER_RLS UART_IER_ERLS /**< Enable Receiver Line Status Interrupt */ +#define LL_UART_IER_THRE (UART_IER_ETBEI | UART_IER_PTIME) /**< Enable Transmit Holding Register Empty Interrupt */ +#define LL_UART_IER_RDA UART_IER_ERBFI /**< Enable Received Data Available Interrupt and Character Timeout Interrupt */ +/** @} */ + +/** @defgroup UART_LL_EC_PARITY Parity Control + * @{ + */ +#define LL_UART_PARITY_NONE UART_LCR_PARITY_NONE /**< Parity control disabled */ +#define LL_UART_PARITY_ODD UART_LCR_PARITY_ODD /**< Parity control enabled and Odd Parity is selected */ +#define LL_UART_PARITY_EVEN UART_LCR_PARITY_EVEN /**< Parity control enabled and Even Parity is selected */ +#define LL_UART_PARITY_SP0 UART_LCR_PARITY_SP0 /**< Parity control enabled and Stick Parity 0 is selected */ +#define LL_UART_PARITY_SP1 UART_LCR_PARITY_SP1 /**< Parity control enabled and Stick Parity 1 is selected */ +/** @} */ + +/** @defgroup UART_LL_EC_DATABITS Data Bits + * @{ + */ +#define LL_UART_DATABITS_5B UART_LCR_DLS_5 /**< 5 bits word length : Start bit, 5 data bits, n stop bits */ +#define LL_UART_DATABITS_6B UART_LCR_DLS_6 /**< 6 bits word length : Start bit, 6 data bits, n stop bits */ +#define LL_UART_DATABITS_7B UART_LCR_DLS_7 /**< 7 bits word length : Start bit, 7 data bits, n stop bits */ +#define LL_UART_DATABITS_8B UART_LCR_DLS_8 /**< 8 bits word length : Start bit, 8 data bits, n stop bits */ +/** @} */ + +/** @defgroup UART_LL_EC_STOPBITS Stop Bits + * @{ + */ +#define LL_UART_STOPBITS_1 UART_LCR_STOP_1 /**< 1 stop bit */ +#define LL_UART_STOPBITS_1_5 UART_LCR_STOP_1_5 /**< 1.5 stop bits */ +#define LL_UART_STOPBITS_2 UART_LCR_STOP_2 /**< 2 stop bits */ +/** @} */ + +/** @defgroup UART_LL_EC_HWCONTROL Hardware Flow Control + * @{ + */ +#define LL_UART_HWCONTROL_NONE 0x00000000U /**< CTS and RTS hardware flow control disabled */ +#define LL_UART_HWCONTROL_RTS_CTS (UART_MCR_AFCE | UART_MCR_RTS) /**< CTS and RTS hardware flow control enabled */ +/** @} */ + +/** @defgroup UART_LL_EC_TX_FIFO_TH TX FIFO Threshold + * @{ + */ +#define LL_UART_TX_FIFO_TH_EMPTY 0x00000000U /**< TX FIFO empty */ +#define LL_UART_TX_FIFO_TH_CHAR_2 0x00000001U /**< 2 characters in TX FIFO */ +#define LL_UART_TX_FIFO_TH_QUARTER_FULL 0x00000002U /**< TX FIFO 1/4 full */ +#define LL_UART_TX_FIFO_TH_HALF_FULL 0x00000003U /**< TX FIFO 1/2 full */ +/** @} */ + +/** @defgroup UART_LL_EC_RX_FIFO_TH RX FIFO Threshold + * @{ + */ +#define LL_UART_RX_FIFO_TH_CHAR_1 0x00000000U /**< 1 character in RX FIFO */ +#define LL_UART_RX_FIFO_TH_QUARTER_FULL 0x00000001U /**< RX FIFO 1/4 full */ +#define LL_UART_RX_FIFO_TH_HALF_FULL 0x00000002U /**< RX FIFO 1/2 full */ +#define LL_UART_RX_FIFO_TH_FULL_2 0x00000003U /**< RX FIFO 2 less than full */ +/** @} */ + +/** @defgroup UART_LL_EC_RTSPIN_STATE RTS Pin State + * @{ + */ +#define LL_UART_RTSPIN_STATE_ACTIVE 0x00000001U /**< RTS pin active(Logic 1) */ +#define LL_UART_RTSPIN_STATE_INACTIVE 0x00000000U /**< RTS pin inactive(Logic 0) */ +/** @} */ + +/** @defgroup UART_LL_EC_CTSPIN_STATE CTS Pin State + * @{ + */ +#define LL_UART_CTSPIN_STATE_ACTIVE 0x00000001U /**< CTS pin active(Logic 1) */ +#define LL_UART_CTSPIN_STATE_INACTIVE 0x00000000U /**< CTS pin pin inactive(Logic 0) */ +/** @} */ + +/** @defgroup UART_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL UART InitStrcut default configuartion + */ +#define LL_UART_DEFAULT_CONFIG \ +{ \ + .baud_rate = 9600U, \ + .data_bits = LL_UART_DATABITS_8B, \ + .stop_bits = LL_UART_STOPBITS_1, \ + .parity = LL_UART_PARITY_NONE, \ + .hw_flow_ctrl = LL_UART_HWCONTROL_NONE, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup UART_LL_Exported_Macros UART Exported Macros + * @{ + */ + +/** @defgroup UART_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in UART register + * @param __instance__ UART instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_UART_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in UART register + * @param __instance__ UART instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_UART_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @defgroup UART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper + * @{ + */ + +/** + * @brief Compute UARTDIV value according to Peripheral Clock and + * expected Baud Rate (32 bits value of UARTDIV is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for UART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval UARTDIV value to be used for DLL,DLH registers + */ +#define __LL_UART_DIV(__PERIPHCLK__, __BAUDRATE__) ((__PERIPHCLK__) / (__BAUDRATE__) / 16) + +/** + * @brief Compute UARTDLF value according to Peripheral Clock and + * expected Baud Rate (32 bits value of UARTDLF is returned) + * @param __PERIPHCLK__ Peripheral Clock frequency used for UART instance + * @param __BAUDRATE__ Baud rate value to achieve + * @retval UARTDLF value to be used for DLL,DLH registers + */ +#define __LL_UART_DLF(__PERIPHCLK__, __BAUDRATE__) ((__PERIPHCLK__) / (__BAUDRATE__) % 16) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup UART_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup UART_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Configure UART DLF and DLH register for achieving expected Baud Rate value. + * @note Peripheral clock and Baud rate values provided as function parameters should be valid + * (Baud rate value != 0) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DLL | DLL | + * +----------------------+-----------------------------------+ + * \endrst + * DLH | DLH + * + * @param UARTx UART instance + * @param peripheral_clock Peripheral Clock + * @param baud_rate Baud Rate + * @retval None + */ +__STATIC_INLINE void ll_uart_set_baud_rate(uart_regs_t *UARTx, uint32_t peripheral_clock, uint32_t baud_rate) +{ + register uint32_t uartdiv = __LL_UART_DIV(peripheral_clock, baud_rate); + + SET_BITS(UARTx->LCR, UART_LCR_DLAB); + WRITE_REG(UARTx->RBR_DLL_THR.DLL, uartdiv & UART_DLL_DLL); + WRITE_REG(UARTx->DLH_IER.DLH, (uartdiv >> 8) & UART_DLH_DLH); + CLEAR_BITS(UARTx->LCR, UART_LCR_DLAB); + WRITE_REG(UARTx->DLF, __LL_UART_DLF(peripheral_clock, baud_rate)); +} + +/** + * @brief Return current Baud Rate value + * @note In case of non-initialized or invalid value stored in DLL,DLH and DLF register, the value 0 will be returned.. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | DLL | DLL | + * +----------------------+-----------------------------------+ + * \endrst + * DLH | DLH + * + * @param UARTx UART instance + * @param peripheral_clock Peripheral Clock + * @retval Baud Rate + */ +__STATIC_INLINE uint32_t ll_uart_get_baud_rate(uart_regs_t *UARTx, uint32_t peripheral_clock) +{ + register uint32_t uartdiv = 0x0U; + register uint32_t baud = 0x0U; + + SET_BITS(UARTx->LCR, UART_LCR_DLAB); + uartdiv = UARTx->RBR_DLL_THR.DLL | (UARTx->DLH_IER.DLH << 8); + CLEAR_BITS(UARTx->LCR, UART_LCR_DLAB); + + if ((uartdiv != 0) && (UARTx->DLF != 0x0U)) + { + baud = peripheral_clock / (16 * uartdiv + UARTx->DLF); + } + + return baud; +} + +/** + * @brief Set the length of the data bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | DLS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @param data_bits This parameter can be one of the following values: + * @arg @ref LL_UART_DATABITS_5B + * @arg @ref LL_UART_DATABITS_6B + * @arg @ref LL_UART_DATABITS_7B + * @arg @ref LL_UART_DATABITS_8B + * + * @retval None + */ +__STATIC_INLINE void ll_uart_set_data_bits_length(uart_regs_t *UARTx, uint32_t data_bits) +{ + MODIFY_REG(UARTx->LCR, UART_LCR_DLS, data_bits); +} + +/** + * @brief Return the length of the data bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | DLS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_DATABITS_5B + * @arg @ref LL_UART_DATABITS_6B + * @arg @ref LL_UART_DATABITS_7B + * @arg @ref LL_UART_DATABITS_8B + */ +__STATIC_INLINE uint32_t ll_uart_get_data_bits_length(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->LCR, UART_LCR_DLS)); +} + +/** + * @brief Set the length of the stop bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | STOP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @param stop_bits This parameter can be one of the following values: + * @arg @ref LL_UART_STOPBITS_1 + * @arg @ref LL_UART_STOPBITS_1_5 (*) + * @arg @ref LL_UART_STOPBITS_2 (*) + * + * (*) STOPBITS_1_5 only valid when DataBits = 5 + * (*) STOPBITS_2 is invalid when DataBits = 5 + * @retval None + */ +__STATIC_INLINE void ll_uart_set_stop_bits_length(uart_regs_t *UARTx, uint32_t stop_bits) +{ + MODIFY_REG(UARTx->LCR, UART_LCR_STOP, stop_bits); +} + +/** + * @brief Retrieve the length of the stop bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | STOP | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_STOPBITS_1 + * @arg @ref LL_UART_STOPBITS_1_5 + * @arg @ref LL_UART_STOPBITS_2 + */ +__STATIC_INLINE uint32_t ll_uart_get_stop_bits_length(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->LCR, UART_LCR_STOP)); +} + +/** + * @brief Configure Parity. + * @note This function selects if hardware parity control (generation and detection) is enabled or disabled. + * When the parity control is enabled (Odd,Even,0,1), computed parity bit is inserted at the MSB position + * and parity is checked on the received data. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | SP | + * +----------------------+-----------------------------------+ + * \endrst + * LCR | EPS + * LCR | PEN + * + * @param UARTx UART instance + * @param parity This parameter can be one of the following values: + * @arg @ref LL_UART_PARITY_NONE + * @arg @ref LL_UART_PARITY_EVEN + * @arg @ref LL_UART_PARITY_ODD + * @arg @ref LL_UART_PARITY_SP0 + * @arg @ref LL_UART_PARITY_SP1 + * @retval None + */ +__STATIC_INLINE void ll_uart_set_parity(uart_regs_t *UARTx, uint32_t parity) +{ + MODIFY_REG(UARTx->LCR, UART_LCR_PARITY, parity); +} + +/** + * @brief Return Parity configuration + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | SP | + * +----------------------+-----------------------------------+ + * \endrst + * LCR | EPS + * LCR | PEN + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_PARITY_NONE + * @arg @ref LL_UART_PARITY_EVEN + * @arg @ref LL_UART_PARITY_ODD + * @arg @ref LL_UART_PARITY_SP0 + * @arg @ref LL_UART_PARITY_SP1 + */ +__STATIC_INLINE uint32_t ll_uart_get_parity(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->LCR, UART_LCR_PARITY)); +} + +/** + * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits) + * @note This function call is equivalent to the following function call sequence : + * - Data Width configuration using @ref ll_uart_set_data_bits_length() function + * - Parity Control and mode configuration using @ref ll_uart_set_parity() function + * - Stop bits configuration using @ref ll_uart_set_stop_bits_length() function + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | PS | + * +----------------------+-----------------------------------+ + * \endrst + * LCR | EPS + * LCR | PEN + * LCR | STOP + * LCR | DLS + * + * @param UARTx UART instance + * @param data_bits This parameter can be one of the following values: + * @arg @ref LL_UART_DATABITS_5B + * @arg @ref LL_UART_DATABITS_6B + * @arg @ref LL_UART_DATABITS_7B + * @arg @ref LL_UART_DATABITS_8B + * @param parity This parameter can be one of the following values: + * @arg @ref LL_UART_PARITY_NONE + * @arg @ref LL_UART_PARITY_EVEN + * @arg @ref LL_UART_PARITY_ODD + * @arg @ref LL_UART_PARITY_SP0 + * @arg @ref LL_UART_PARITY_SP1 + * @param stop_bits This parameter can be one of the following values: + * @arg @ref LL_UART_STOPBITS_1 + * @arg @ref LL_UART_STOPBITS_1_5 (*) + * @arg @ref LL_UART_STOPBITS_2 (*) + * + * (*) STOPBITS_1_5 only valid when DataBits = 5 + * (*) STOPBITS_2 is invalid when DataBits = 5 + * @retval None + */ +__STATIC_INLINE void ll_uart_config_character(uart_regs_t *UARTx, + uint32_t data_bits, + uint32_t parity, + uint32_t stop_bits) +{ + MODIFY_REG(UARTx->LCR, UART_LCR_PARITY | UART_LCR_STOP | UART_LCR_DLS, parity | stop_bits | data_bits); +} + +/** + * @brief Set UART RTS pin state to Active/Inactive + * @note The RTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRTS | SRTS | + * +----------------------+-----------------------------------+ + * \endrst + * MCR | RTS + * + * @param UARTx UART instance + * @param pin_state This parameter can be one of the following values: + * @arg @ref LL_UART_RTSPIN_STATE_ACTIVE + * @arg @ref LL_UART_RTSPIN_STATE_INACTIVE + * @retval None + */ +__STATIC_INLINE void ll_uart_set_rts_pin_state(uart_regs_t *UARTx, uint32_t pin_state) +{ + WRITE_REG(UARTx->SRTS, pin_state); +} + +/** + * @brief Get UART RTS pin state + * @note The RTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRTS | SRTS | + * +----------------------+-----------------------------------+ + * \endrst + * MCR | RTS + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_RTSPIN_STATE_ACTIVE + * @arg @ref LL_UART_RTSPIN_STATE_INACTIVE + */ +__STATIC_INLINE uint32_t ll_uart_get_rts_pin_state(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_REG(UARTx->SRTS)); +} + +/** + * @brief Get UART CTS pin state + * @note The CTS pin is ACTIVE when logic level is low, and INACTIVE when logic level is high. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSR | CTS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_CTSPIN_STATE_ACTIVE + * @arg @ref LL_UART_CTSPIN_STATE_INACTIVE + */ +__STATIC_INLINE uint32_t ll_uart_get_cts_pin_state(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->MSR, UART_MSR_CTS) >> UART_MSR_CTS_Pos); +} + +/** + * @brief Indicate if CTS is changed since the last time the MSR was read + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSR | DCTS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_changed_cts(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->MSR, UART_MSR_DCTS) >> UART_MSR_DCTS_Pos); +} + +/** + * @brief Configure HW Flow Control mode (None or Both CTS and RTS) + * @note This function is used to Enable/Disable UART Auto Flow Control. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MCR | AFCE | + * +----------------------+-----------------------------------+ + * \endrst + * MCR | RTS + * + * @param UARTx UART instance + * @param hw_flow_ctrl This parameter can be one of the following values: + * @arg @ref LL_UART_HWCONTROL_NONE + * @arg @ref LL_UART_HWCONTROL_RTS_CTS + * @retval None + */ +__STATIC_INLINE void ll_uart_set_hw_flow_ctrl(uart_regs_t *UARTx, uint32_t hw_flow_ctrl) +{ + MODIFY_REG(UARTx->MCR, UART_MCR_AFCE | UART_MCR_RTS, hw_flow_ctrl); +} + +/** + * @brief Return HW Flow Control configuration (None or Both CTS and RTS) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MCR | AFCE | + * +----------------------+-----------------------------------+ + * \endrst + * MCR | RTS + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_HWCONTROL_NONE + * @arg @ref LL_UART_HWCONTROL_RTS_CTS + */ +__STATIC_INLINE uint32_t ll_uart_get_hw_flow_ctrl(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->MCR, UART_MCR_AFCE | UART_MCR_RTS)); +} + +/** + * @brief Enable Break sending + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | BC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_break_sending(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SBCR, 0x1U); +} + +/** + * @brief Disable Break sending + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | BC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_break_sending(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SBCR, 0x0U); +} + +/** + * @brief Indicate if Break sending is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LCR | BC | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_break_sending(uart_regs_t *UARTx) +{ + return READ_REG(UARTx->SBCR); +} + +/** + * @brief Enable TX FIFO and RX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SFE | SFE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_fifo(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SFE, 0x1U); +} + +/** + * @brief Disable TX FIFO and RX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SFE | SFE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_fifo(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SFE, 0x0U); +} + +/** + * @brief Indicate if TX FIFO and RX FIFO is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SFE | SFE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_fifo(uart_regs_t *UARTx) +{ + return READ_REG(UARTx->SFE); +} + +/** + * @brief Set threshold of TX FIFO that triggers an THRE interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STET | STET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_UART_TX_FIFO_TH_EMPTY + * @arg @ref LL_UART_TX_FIFO_TH_CHAR_2 + * @arg @ref LL_UART_TX_FIFO_TH_QUARTER_FULL + * @arg @ref LL_UART_TX_FIFO_TH_HALF_FULL + * @retval None + */ +__STATIC_INLINE void ll_uart_set_tx_fifo_threshold(uart_regs_t *UARTx, uint32_t threshold) +{ + WRITE_REG(UARTx->STET, threshold); +} + +/** + * @brief Get threshold of TX FIFO that triggers an THRE interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STET | STET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_TX_FIFO_TH_EMPTY + * @arg @ref LL_UART_TX_FIFO_TH_CHAR_2 + * @arg @ref LL_UART_TX_FIFO_TH_QUARTER_FULL + * @arg @ref LL_UART_TX_FIFO_TH_HALF_FULL + */ +__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_threshold(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_REG(UARTx->STET)); +} + +/** + * @brief Set threshold of RX FIFO that triggers an RDA interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRT | SRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_UART_RX_FIFO_TH_CHAR_1 + * @arg @ref LL_UART_RX_FIFO_TH_QUARTER_FULL + * @arg @ref LL_UART_RX_FIFO_TH_HALF_FULL + * @arg @ref LL_UART_RX_FIFO_TH_FULL_2 + * @retval None + */ +__STATIC_INLINE void ll_uart_set_rx_fifo_threshold(uart_regs_t *UARTx, uint32_t threshold) +{ + WRITE_REG(UARTx->SRT, threshold); +} + +/** + * @brief Get threshold of RX FIFO that triggers an RDA interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRT | SRT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + * @arg @ref LL_UART_RX_FIFO_TH_CHAR_1 + * @arg @ref LL_UART_RX_FIFO_TH_QUARTER_FULL + * @arg @ref LL_UART_RX_FIFO_TH_HALF_FULL + * @arg @ref LL_UART_RX_FIFO_TH_FULL_2 + */ +__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_threshold(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_REG(UARTx->SRT)); +} + +/** + * @brief Get FIFO Transmission Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TFL | TFL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + */ +__STATIC_INLINE uint32_t ll_uart_get_tx_fifo_level(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_REG(UARTx->TFL)); +} + +/** + * @brief Get FIFO reception Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RFL | RFL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one of the following values: + */ +__STATIC_INLINE uint32_t ll_uart_get_rx_fifo_level(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_REG(UARTx->RFL)); +} + +/** + * @brief Flush Receive FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRR | RFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_flush_rx_fifo(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SRR, UART_SRR_RFR); +} + +/** + * @brief Flush Transmit FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRR | XFR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_flush_tx_fifo(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SRR, UART_SRR_XFR); +} + +/** + * @brief Reset UART + * @note This function asynchronously resets the DW_apb_uart and synchronously + * removes the reset assertion. For a two clock implementation, both pclk + * and sclk domains will be reset. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SRR | UR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_reset(uart_regs_t *UARTx) +{ + WRITE_REG(UARTx->SRR, UART_SRR_UR); +} + +/** @} */ + +/** @defgroup UART_LL_EF_IT_Management IT_Management + * @{ + */ + +/** + * @brief Enable Modem Status Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enabled_it_ms(uart_regs_t *UARTx) +{ + SET_BITS(UARTx->DLH_IER.IER, UART_IER_EDSSI); +} + +/** + * @brief Enable Receiver Line Status Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | RLS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_it_rls(uart_regs_t *UARTx) +{ + SET_BITS(UARTx->DLH_IER.IER, UART_IER_ERLS); +} + +/** + * @brief Enable Transmit Holding Register Empty Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | PTIME | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ETBEI + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_it_thre(uart_regs_t *UARTx) +{ + SET_BITS(UARTx->DLH_IER.IER, UART_IER_PTIME | UART_IER_ETBEI); +} + +/** + * @brief Enable Received Data Available Interrupt and Character Timeout Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | ERBFI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_it_rda(uart_regs_t *UARTx) +{ + SET_BITS(UARTx->DLH_IER.IER, UART_IER_ERBFI); +} + +/** + * @brief Disable Modem Status Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_it_ms(uart_regs_t *UARTx) +{ + CLEAR_BITS(UARTx->DLH_IER.IER, UART_IER_EDSSI); +} + +/** + * @brief Disable Receiver Line Status Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | RLS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_it_rls(uart_regs_t *UARTx) +{ + CLEAR_BITS(UARTx->DLH_IER.IER, UART_IER_ERLS); +} + +/** + * @brief Disable Transmit Holding Register Empty Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | PTIME | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ETBEI + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_it_thre(uart_regs_t *UARTx) +{ + CLEAR_BITS(UARTx->DLH_IER.IER, UART_IER_PTIME | UART_IER_ETBEI); +} + +/** + * @brief Disable Received Data Available Interrupt and Character Timeout Interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | ERBFI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_it_rda(uart_regs_t *UARTx) +{ + CLEAR_BITS(UARTx->DLH_IER.IER, UART_IER_ERBFI); +} + +/** + * @brief Check if the UART Modem Status Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_it_ms(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->DLH_IER.IER, UART_IER_EDSSI) == (UART_IER_EDSSI)); +} + +/** + * @brief Check if the UART Receiver Line Status Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | RLS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_it_rls(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->DLH_IER.IER, UART_IER_ERLS) == (UART_IER_ERLS)); +} + +/** + * @brief Check if the UART Transmit Holding Register Empty Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | PTIME | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ETBEI + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_it_thre(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->DLH_IER.IER, UART_IER_PTIME | UART_IER_ETBEI) == (UART_IER_PTIME | UART_IER_ETBEI)); +} + +/** + * @brief Check if the UART Received Data Available Interrupt and Character Timeout Interrupt + * is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | ERBFI | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_it_rda(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->DLH_IER.IER, UART_IER_ERBFI) == (UART_IER_ERBFI)); +} + +/** + * @brief Enable the specified UART Interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ERLS + * IER | PTIME + * IER | ETBEI + * IER | ERBFI + * + * @param UARTx UART instance + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_UART_IER_MS + * @arg @ref LL_UART_IER_RLS + * @arg @ref LL_UART_IER_THRE + * @arg @ref LL_UART_IER_RDA + * @retval None + */ +__STATIC_INLINE void ll_uart_enable_it(uart_regs_t *UARTx, uint32_t mask) +{ + SET_BITS(UARTx->DLH_IER.IER, mask); +} + +/** + * @brief Disable the specified UART Interrupt. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ERLS + * IER | PTIME + * IER | ETBEI + * IER | ERBFI + * + * @param UARTx UART instance + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_UART_IER_MS + * @arg @ref LL_UART_IER_RLS + * @arg @ref LL_UART_IER_THRE + * @arg @ref LL_UART_IER_RDA + * @retval None + */ +__STATIC_INLINE void ll_uart_disable_it(uart_regs_t *UARTx, uint32_t mask) +{ + CLEAR_BITS(UARTx->DLH_IER.IER, mask); +} + +/** + * @brief Check if the specified UART Interrupt is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IER | EDSSI | + * +----------------------+-----------------------------------+ + * \endrst + * IER | ERLS + * IER | PTIME + * IER | ETBEI + * IER | ERBFI + * + * @param UARTx UART instance + * @param mask This parameter can be a combination of the following values: + * @arg @ref LL_UART_IER_MS + * @arg @ref LL_UART_IER_RLS + * @arg @ref LL_UART_IER_THRE + * @arg @ref LL_UART_IER_RDA + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_enabled_it(uart_regs_t *UARTx, uint32_t mask) +{ + return (READ_BITS(UARTx->DLH_IER.IER, mask) == (mask)); +} + +/** @} */ + +/** @defgroup UART_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Get UART Receive Line Status Flag + * @note This function is used to get OE/PE/FE/BI/THRE/TEMT/RFE flags in LSR register. + * After LSR register was read, OE/PE/FE/BI/RFE flags will be cleared. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LSR | OE | + * +----------------------+-----------------------------------+ + * \endrst + * LSR | PE + * LSR | FE + * LSR | BI + * LSR | THRE + * LSR | TEMT + * LSR | RFE + * + * @param UARTx UART instance + * @retval Returned value can be a combination of the following values: + * @arg @ref LL_UART_LSR_OE + * @arg @ref LL_UART_LSR_PE + * @arg @ref LL_UART_LSR_FE + * @arg @ref LL_UART_LSR_BI + * @arg @ref LL_UART_LSR_THRE + * @arg @ref LL_UART_LSR_TEMT + * @arg @ref LL_UART_LSR_RFE + */ +__STATIC_INLINE uint32_t ll_uart_get_line_status_flag(uart_regs_t *UARTx) +{ + return ((uint32_t)READ_REG(UARTx->LSR)); +} + +/** + * @brief Clear UART Receive Line Status Flag + * @note OE/PE/FE/BI/RFE flags can be cleared by reading LSR register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LSR | OE | + * +----------------------+-----------------------------------+ + * \endrst + * LSR | PE + * LSR | FE + * LSR | BI + * LSR | RFE + * + * @param UARTx UART instance + * @retval None + */ +__STATIC_INLINE void ll_uart_clear_line_status_flag(uart_regs_t *UARTx) +{ + __IO uint32_t tmpreg; + tmpreg = READ_REG(UARTx->LSR); + (void) tmpreg; +} + +/** + * @brief Check if the UART Receive FIFO Full Flag is set or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USR | RFF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_active_flag_rff(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->USR, UART_USR_RFF) == UART_USR_RFF); +} + +/** + * @brief Check if the UART Receive FIFO Not Empty Flag is set or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USR | RFNE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_active_flag_rfne(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->USR, UART_USR_RFNE) == UART_USR_RFNE); +} + +/** + * @brief Check if the UART Transmit FIFO Empty Flag is set or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USR | TFE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_active_flag_tfe(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->USR, UART_USR_TFE) == UART_USR_TFE); +} + +/** + * @brief Check if the UART Transmit FIFO Not Full Flag is set or not + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | USR | TFNF | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_uart_is_active_flag_tfnf(uart_regs_t *UARTx) +{ + return (READ_BITS(UARTx->USR, UART_USR_TFNF) == UART_USR_TFNF); +} + +/** + * @brief Get UART interrupt flags + * @note The interrupt flags will be cleared after reading IIR. + * If interrupt was triggered when reading IIR register, the interrupt will be pended, + * and No Interrupt Pending Flag will be RESET, read IIR again can get the pended interrupt + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | IIR | IID | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Returned value can be one or combination of the following values: + * @arg @ref LL_UART_IIR_MS + * @arg @ref LL_UART_IIR_NIP + * @arg @ref LL_UART_IIR_THRE + * @arg @ref LL_UART_IIR_RDA + * @arg @ref LL_UART_IIR_RLS + * @arg @ref LL_UART_IIR_CTO + */ +__STATIC_INLINE uint32_t ll_uart_get_it_flag(uart_regs_t *UARTx) +{ + return (uint32_t)(READ_BITS(UARTx->FCR_IIR.IIR, UART_IIR_IID)); +} + +/** @} */ + +/** @defgroup UART_LL_EF_DMA_Management DMA_Management + * @{ + */ + +/** + * @brief Get the data register address used for DMA transfer + * @note The address of data register RBR is the same as the address of THR. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RBR | RBR | + * +----------------------+-----------------------------------+ + * \endrst + * THR | THR + * + * @param UARTx UART instance + * @retval Address of data register + */ +__STATIC_INLINE uint32_t ll_uart_dma_get_register_address(uart_regs_t *UARTx) +{ + return ((uint32_t) &(UARTx->RBR_DLL_THR)); +} + +/** @} */ + +/** @defgroup UART_LL_EF_Data_Management Data_Management + * @{ + */ + +/** + * @brief Read Receiver Data register (Receive Data value, 8 bits) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RBR | RBR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @retval Value between Min_Data=0x00 and Max_Data=0xFF + */ +__STATIC_INLINE uint8_t ll_uart_receive_data8(uart_regs_t *UARTx) +{ + return (uint8_t)(READ_REG(UARTx->RBR_DLL_THR.RBR)); +} + +/** + * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits) + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | THR | THR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param UARTx UART instance + * @param value between Min_Data=0x00 and Max_Data=0xFF + * @retval None + */ +__STATIC_INLINE void ll_uart_transmit_data8(uart_regs_t *UARTx, uint8_t value) +{ + WRITE_REG(UARTx->RBR_DLL_THR.THR, value); +} + +/** @} */ + +/** @defgroup UART_LL_EF_Init Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize UART registers (Registers restored to their default values). + * @param UARTx UART instance + * @retval An error_status_t enumeration value: + * - SUCCESS: UART registers are de-initialized + * - ERROR: UART registers are not de-initialized + */ +error_status_t ll_uart_deinit(uart_regs_t *UARTx); + +/** + * @brief Initialize UART registers according to the specified + * parameters in p_uart_init. + * @param UARTx UART instance + * @param p_uart_init Pointer to a ll_uart_init_t structure that contains the configuration + * information for the specified UART peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: UART registers are initialized according to p_uart_init content + * - ERROR: Problem occurred during UART Registers initialization + */ +error_status_t ll_uart_init(uart_regs_t *UARTx, ll_uart_init_t *p_uart_init); + +/** + * @brief Set each field of a @ref ll_uart_init_t type structure to default value. + * @param p_uart_init Pointer to a @ref ll_uart_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_uart_struct_init(ll_uart_init_t *p_uart_init); + +/** @} */ + +/** @} */ + +#endif /* UART0 || UART1 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_UART_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_wdt.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_wdt.h new file mode 100644 index 0000000..301731e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_wdt.h @@ -0,0 +1,415 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_wdt.h + * @author BLE Driver Team + * @brief Header file containing functions prototypes of WDT LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_WDT WDT + * @brief WDT LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55XX_LL_WDT_H__ +#define __GR55XX_LL_WDT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (WDT) + +/** + * @defgroup WDT_LL_MACRO Defines + * @{ + */ + +/* Private constants ---------------------------------------------------------*/ +/** @defgroup WDT_LL_Private_Constants WDT Private Constants + * @{ + */ + +/** @defgroup WDT_LL_PC_WR_ACCESS Write Access Defines + * @{ + */ +#define LL_WDT_LOCK_WR_ACCESS_ENABLE 0x1ACCE551 /**< WDT LOCK Write Access Enable */ +#define LL_WDT_LOCK_WR_ACCESS_DISABLE (~0x1ACCE551) /**< WDT LOCK Write Access Disable */ +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup WDT_LL_Exported_Macros WDT Exported Macros + * @{ + */ + +/** @defgroup WDT_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in WDT register + * @param __instance__ WDT instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_WDT_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in WDT register + * @param __instance__ WDT instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_WDT_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup WDT_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup WDT_LL_EF_Configuration Configuration functions + * @{ + */ + +/** + * @brief Enable write access to WDT_LOAD, WDT_CTRL and WDT_INTCLR registers. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LOCK | ENRW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @retval None + */ +__STATIC_INLINE void ll_wdt_enable_write_access(wdt_regs_t *WDTx) +{ + WRITE_REG(WDTx->LOCK, LL_WDT_LOCK_WR_ACCESS_ENABLE); +} + +/** + * @brief Disable write access to WDT_LOAD, WDT_CTRL and WDT_INTCLR registers. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LOCK | ENRW | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @retval None + */ +__STATIC_INLINE void ll_wdt_disable_write_access(wdt_regs_t *WDTx) +{ + WRITE_REG(WDTx->LOCK, LL_WDT_LOCK_WR_ACCESS_DISABLE); +} + +/** + * @brief Enable watchdog counter and interrupt event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval None + */ +__STATIC_INLINE void ll_wdt_enable(wdt_regs_t *WDTx) +{ + SET_BITS(WDTx->CTRL, WDT_CTRL_INTEN); +} + +/** + * @brief Disable watchdog counter and interrupt event. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval None + */ +__STATIC_INLINE void ll_wdt_disable(wdt_regs_t *WDTx) +{ + CLEAR_BITS(WDTx->CTRL, WDT_CTRL_INTEN); +} + +/** + * @brief Check if the WDT peripheral is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | INTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_wdt_is_enabled(wdt_regs_t *WDTx) +{ + return (READ_BITS(WDTx->CTRL, WDT_CTRL_INTEN) == (WDT_CTRL_INTEN)); +} + +/** + * @brief Enable reset output. + * @note RSTEN acts as a mask for the reset output. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval None + */ +__STATIC_INLINE void ll_wdt_enable_reset(wdt_regs_t *WDTx) +{ + SET_BITS(WDTx->CTRL, WDT_CTRL_RSTEN); +} + +/** + * @brief Disable reset output. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval None + */ +__STATIC_INLINE void ll_wdt_disable_reset(wdt_regs_t *WDTx) +{ + CLEAR_BITS(WDTx->CTRL, WDT_CTRL_RSTEN); +} + +/** + * @brief Check if the WDT reset is enabled or disabled. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RSTEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_wdt_is_enabled_reset(wdt_regs_t *WDTx) +{ + return (READ_BITS(WDTx->CTRL, WDT_CTRL_RSTEN) == (WDT_CTRL_RSTEN)); +} + +/** + * @brief Specify the WDT down-counter reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LOAD | LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @param counter Value range between Min_Data=0 and Max_Data=0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_wdt_set_counter_load(wdt_regs_t *WDTx, uint32_t counter) +{ + WRITE_REG(WDTx->LOAD, counter); +} + +/** + * @brief Get the specified WDT down-counter reload value. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | LOAD | LOAD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @retval Value range between Min_Data=0 and Max_Data=0x0FFF + */ +__STATIC_INLINE uint32_t ll_wdt_get_counter_load(wdt_regs_t *WDTx) +{ + return (uint32_t)(READ_REG(WDTx->LOAD)); +} + +/** + * @brief Get current value of the specified WDT decrementing down-counter. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | VALUE | VALUE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @retval Value range between Min_Data=0 and Max_Data=0x0FFF + */ +__STATIC_INLINE uint32_t ll_wdt_get_counter_value(wdt_regs_t *WDTx) +{ + return (uint32_t)(READ_REG(WDTx->VALUE)); +} + +/** + * @brief Reloads WDT counter with value defined in the reload register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INTCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance + * @retval None + */ +__STATIC_INLINE void ll_wdt_reload_counter(wdt_regs_t *WDTx) +{ + WRITE_REG(WDTx->INTCLR, WDT_INTCLR); +} + +/** @} */ + +/** @defgroup WDT_LL_EF_FLAG_Management FLAG_Management + * @{ + */ + +/** + * @brief Indicate if the WDT Interrupt Flag is set or not. + * @note This bit is set by hardware when the counter has reached 0. It can + * be cleared by software by writing any value to the INTCLR Register. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MIS | INTSTAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_wdt_is_active_flag_it(wdt_regs_t *WDTx) +{ + return (READ_BITS(WDTx->MIS, WDT_MIS_INTSTAT) == (WDT_MIS_INTSTAT)); +} + +/** + * @brief Clear Interrupt Status flag. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INTCLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param WDTx WDT instance. + * @retval None + */ +__STATIC_INLINE void ll_wdt_clear_flag_it(wdt_regs_t *WDTx) +{ + WRITE_REG(WDTx->INTCLR, WDT_INTCLR); +} + +/** @} */ + +/** @} */ + +#endif /* WDT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55XX_LL_WDT_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_xqspi.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_xqspi.h new file mode 100644 index 0000000..e0c0aab --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/gr55xx_ll_xqspi.h @@ -0,0 +1,2902 @@ +/** + **************************************************************************************** + * + * @file gr55xx_ll_xqspi.h + * @author BLE SDK Team + * @brief Header file containing functions prototypes of XQSPI LL library. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/** @addtogroup PERIPHERAL Peripheral Driver + * @{ + */ + +/** @addtogroup LL_DRIVER LL Driver + * @{ + */ + +/** @defgroup LL_XQSPI XQSPI + * @brief XQSPI LL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GR55xx_LL_XQSPI_H__ +#define __GR55xx_LL_XQSPI_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx.h" + +#if defined (XQSPI) + +/** @defgroup LL_XQSPI_DRIVER_STRUCTURES Structures + * @{ + */ + +/* Exported types ------------------------------------------------------------*/ +/** @defgroup XQSPI_LL_ES_INIT XQSPI Exported init structure + * @{ + */ + +/** + * @brief XQSPI init structures definition + */ +typedef struct _ll_xqspi_init_t +{ + uint32_t mode; /**< Specifies the work mode, XIP mode or QSPI mode. + This parameter can be a value of @ref XQSPI_LL_EC_MODE.*/ + + uint32_t cache_mode; /**< Specifies the cache mode in XIP mode. + This parameter can be a value of @ref XQSPI_LL_EC_CACHE_MODE. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_enable_cache().*/ + + uint32_t read_cmd; /**< Specifies the XQSPI read command in XIP mode. + This parameter can be a value of @ref XQSPI_LL_EC_XIP_READ_CMD. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_xip_cmd().*/ + + uint32_t data_size; /**< Specifies the XQSPI data width, only in QSPI mode. + This parameter can be a value of @ref XQSPI_LL_EC_QSPI_DATASIZE. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_qspi_datasize().*/ + + uint32_t data_order; /**< Specifies the XQSPI data order, MSB oe LSB, only in QSPI mode. + This parameter can be a value of @ref XQSPI_LL_EC_QSPI_DATAORDER. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_qspi_data_order().*/ + + uint32_t clock_polarity; /**< Specifies the serial clock steady state. + This parameter can be a value of @ref XQSPI_LL_EC_QSPI_POLARITY in XIP mode or @ref XQSPI_LL_EC_QSPI_POLARITY in QSPI mode. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_xip_cpol() or @ref ll_xqspi_set_qspi_cpol().*/ + + uint32_t clock_phase; /**< Specifies the clock active edge for the bit capture. + This parameter can be a value of @ref XQSPI_LL_EC_QSPI_PHASE in XIP mode or @ref XQSPI_LL_EC_QSPI_PHASE in QSPI mode. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_xip_cpha() or @ref ll_xqspi_set_qspi_cpha().*/ + + uint32_t baud_rate; /**< Specifies the BaudRate be used to configure the transmit and receive SCK clock. + This parameter can be a value of @ref XQSPI_LL_EC_QSPI_BAUD_REAT. + + This feature can be modified afterwards using unitary function @ref ll_xqspi_set_qspi_speed().*/ + +} ll_xqspi_init_t; + +/** @} */ + +/** @} */ + +/** + * @defgroup XQSPI_LL_MACRO Defines + * @{ + */ + +/* Exported constants --------------------------------------------------------*/ +/** @defgroup XQSPI_LL_Exported_Constants XQSPI Exported Constants + * @{ + */ + +/** @defgroup XQSPI_LL_EC_MODE XQSPI work mode + * @{ + */ +#define LL_XQSPI_MODE_XIP 0 /**< XIP mode */ +#define LL_XQSPI_MODE_QSPI 1 /**< QSPI mode */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_XIP_READ_CMD XIP read command + * @{ + */ +#define LL_XQSPI_XIP_CMD_READ 0x03 /**< Read mode */ +#define LL_XQSPI_XIP_CMD_FAST_READ 0x0B /**< Fast Read mode */ +#define LL_XQSPI_XIP_CMD_DUAL_OUT_READ 0x3B /**< Dual-Out Fast Read mode */ +#define LL_XQSPI_XIP_CMD_DUAL_IO_READ 0xBB /**< Dual-IO Fast Read mode */ +#define LL_XQSPI_XIP_CMD_QUAD_OUT_READ 0x6B /**< Quad-Out Fast Read mode */ +#define LL_XQSPI_XIP_CMD_QUAD_IO_READ 0xEB /**< Quad-IO Fast Read mode */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_XIP_SS Slave select + * @{ + */ +#define LL_XQSPI_XIP_SS0 (1UL << XQSPI_XIP_CFG_SS_Pos) /**< Slave select 0 */ +#define LL_XQSPI_XIP_SS1 (2UL << XQSPI_XIP_CFG_SS_Pos) /**< Slave select 1 */ +#define LL_XQSPI_XIP_SS2 (4UL << XQSPI_XIP_CFG_SS_Pos) /**< Slave select 2 */ +#define LL_XQSPI_XIP_SS3 (8UL << XQSPI_XIP_CFG_SS_Pos) /**< Slave select 3 */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_XIP_ADDR_MODE Address bytes in command + * @{ + */ +#define LL_XQSPI_XIP_ADDR_3BYTES 0x00000000UL /**< Address command is 3 bytes */ +#define LL_XQSPI_XIP_ADDR_4BYTES XQSPI_XIP_CFG_ADDR4 /**< Address command is 4 bytes */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_XIP_ENDIAN Read data endian mode + * @{ + */ +#define LL_XQSPI_XIP_ENDIAN_BIG 0x00000000UL /**< Read data in big endian */ +#define LL_XQSPI_XIP_ENDIAN_LITTLE XQSPI_XIP_CFG_LE32 /**< Read data in little endian */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_CACHE_MODE XIP cache mode + * @{ + */ +#define LL_XQSPI_CACHE_DIS 0 /**< Cache OFF */ +#define LL_XQSPI_CACHE_EN 1 /**< Cache ON */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_CACHE_FIFO_MODE Cache FIFO mode + * @{ + */ +#define LL_XQSPI_CACHE_FIFO_NORMAL 0x00000000UL /**< FIFO in normal mode */ +#define LL_XQSPI_CACHE_FIFO_CLEAR XQSPI_CACHE_CTRL0_FIFO /**< FIFO in clear mode */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_CACHE_HITMISS_COUNTER_MODE Cache hit/miss counters mode + * @{ + */ +#define LL_XQSPI_CACHE_HITMISS_NORMAL 0x00000000UL /**< Hit/Miss counters in normal mode */ +#define LL_XQSPI_CACHE_HITMISS_CLEAR XQSPI_CACHE_CTRL0_HITMISS /**< Hit/Miss counters in clear mode */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_FLAG QSPI Flags Defines + * @brief Flags defines which can be used with LL_XQSPI_ReadReg function + * @{ + */ +#define LL_XQSPI_QSPI_STAT_RFTF XQSPI_QSPI_STAT_RXWMARK /**< Rx FIFO watermark flag */ +#define LL_XQSPI_QSPI_STAT_RFF XQSPI_QSPI_STAT_RXFULL /**< Rx FIFO full flag */ +#define LL_XQSPI_QSPI_STAT_RFE XQSPI_QSPI_STAT_RXEMPTY /**< Rx FIFO empty flag */ +#define LL_XQSPI_QSPI_STAT_TFTF XQSPI_QSPI_STAT_TXWMARK /**< Tx FIFO watermark flag */ +#define LL_XQSPI_QSPI_STAT_TFF XQSPI_QSPI_STAT_TXFULL /**< Tx FIFO full flag */ +#define LL_XQSPI_QSPI_STAT_TFE XQSPI_QSPI_STAT_TXEMPTY /**< Tx FIFO empty flag */ +#define LL_XQSPI_QSPI_STAT_BUSY XQSPI_QSPI_STAT_XFERIP /**< Busy flag */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_IT QSPI interrupt Defines + * @brief Interrupt defines which can be used with LL_XQSPI_ReadReg and LL_XQSPI_WriteReg functions + * @{ + */ +#define LL_XQSPI_QSPI_IM_DONE XQSPI_QSPI_XFER_DPULSE_Msk /**< Transmite Done Interrupt enable */ +#define LL_XQSPI_QSPI_IM_RFF XQSPI_QSPI_RX_FPULSE_Msk /**< Receive FIFO Full Interrupt enable */ +#define LL_XQSPI_QSPI_IM_RFTF XQSPI_QSPI_RX_WPULSE_Msk /**< Receive FIFO Watermark Interrupt enable */ +#define LL_XQSPI_QSPI_IM_TFTF XQSPI_QSPI_TX_WPULSE_Msk /**< Transmit FIFO Watermark Interrupt enable */ +#define LL_XQSPI_QSPI_IM_TFE XQSPI_QSPI_TX_EPULSE_Msk /**< Transmit FIFO Empty Interrupt enable */ + +#define LL_XQSPI_QSPI_IS_DONE XQSPI_QSPI_XFER_DPULSE_Msk /**< Transmite Done Interrupt flag */ +#define LL_XQSPI_QSPI_IS_RFF XQSPI_QSPI_RX_FPULSE_Msk /**< Receive FIFO Full Interrupt flag */ +#define LL_XQSPI_QSPI_IS_RFTF XQSPI_QSPI_RX_WPULSE_Msk /**< Receive FIFO Watermark Interrupt flag */ +#define LL_XQSPI_QSPI_IS_TFTF XQSPI_QSPI_TX_WPULSE_Msk /**< Transmit FIFO Watermark Interrupt flag */ +#define LL_XQSPI_QSPI_IS_TFE XQSPI_QSPI_TX_EPULSE_Msk /**< Transmit FIFO Empty Interrupt flag */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_FIFO_WATERMARK QSPI FIFO Watermark + * @{ + */ +#define LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 0UL /**< FIFO depth/8 */ +#define LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 1UL /**< FIFO depth/4 */ +#define LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 2UL /**< FIFO depth/2 */ +#define LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 3UL /**< FIFO depth*3/4 */ +#define LL_XQSPI_QSPI_FIFO_DEPTH 16UL /**< FIFO full depth */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_FRAMEFORMAT QSPI Frame Format + * @{ + */ +#define LL_XQSPI_QSPI_FRF_SPI 0x00000000UL /**< SPI frame format for transfer */ +#define LL_XQSPI_QSPI_FRF_DUALSPI (2UL << XQSPI_QSPI_AUXCTRL_QMODE_Pos) /**< Dual-SPI frame format for transfer */ +#define LL_XQSPI_QSPI_FRF_QUADSPI (3UL << XQSPI_QSPI_AUXCTRL_QMODE_Pos) /**< Quad-SPI frame format for transfer */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_DATAORDER QSPI Data Order + * @{ + */ +#define LL_XQSPI_QSPI_LSB 0x00000000UL /**< LSB first for transfer */ +#define LL_XQSPI_QSPI_MSB XQSPI_QSPI_CTRL_MSB1ST /**< MSB first for transfer */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_DATASIZE QSPI Datawidth + * @{ + */ +#define LL_XQSPI_QSPI_DATASIZE_4BIT 0x00000000UL /**< Data length for XQSPI transfer: 4 bits */ +#define LL_XQSPI_QSPI_DATASIZE_8BIT (1UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 8 bits */ +#define LL_XQSPI_QSPI_DATASIZE_12BIT (2UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 12 bits */ +#define LL_XQSPI_QSPI_DATASIZE_16BIT (3UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 16 bits */ +#define LL_XQSPI_QSPI_DATASIZE_20BIT (4UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 20 bits */ +#define LL_XQSPI_QSPI_DATASIZE_24BIT (5UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 24 bits */ +#define LL_XQSPI_QSPI_DATASIZE_28BIT (6UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 28 bits */ +#define LL_XQSPI_QSPI_DATASIZE_32BIT (7UL << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) /**< Data length for XQSPI transfer: 32 bits */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_PHASE QSPI Clock Phase + * @{ + */ +#define LL_XQSPI_SCPHA_1EDGE 0 /**< First clock transition is the first data capture edge */ +#define LL_XQSPI_SCPHA_2EDGE 1 /**< Second clock transition is the first data capture edge */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_POLARITY QSPI Clock Polarity + * @{ + */ +#define LL_XQSPI_SCPOL_LOW 0 /**< Clock to 0 when idle */ +#define LL_XQSPI_SCPOL_HIGH 1 /**< Clock to 1 when idle */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_BAUD_REAT QSPI Buad Rate + * @{ + */ +#define LL_XQSPI_BAUD_RATE_64M 0x00000000UL /**< Clock to 64MHz */ +#define LL_XQSPI_BAUD_RATE_48M (1UL << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos) /**< Clock to 48MHz */ +#define LL_XQSPI_BAUD_RATE_32M (2UL << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos) /**< Clock to 32MHz */ +#define LL_XQSPI_BAUD_RATE_24M (3UL << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos) /**< Clock to 24MHz */ +#define LL_XQSPI_BAUD_RATE_16M (4UL << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos) /**< Clock to 16MHz */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_PRESENT QSPI Present Bypass + * @{ + */ +#define LL_XQSPI_ENABLE_PRESENT 0 /**< Enable Present Bypass */ +#define LL_XQSPI_DISABLE_PRESENT 1 /**< Disable Present Bypass */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_QSPI_FLASH_WRITE QSPI Flash write bits + * @{ + */ +#define LL_XQSPI_FLASH_WRITE_128BIT 0 /**< 128bits flash write */ +#define LL_XQSPI_FLASH_WRITE_32BIT 1 /**< 32bits flash write */ +/** @} */ + +/** @defgroup XQSPI_LL_EC_DEFAULT_CONFIG InitStrcut default configuartion + * @{ + */ + +/** + * @brief LL XQSPI InitStrcut default configuartion + */ +#define LL_XQSPI_DEFAULT_CONFIG \ +{ \ + .mode = LL_XQSPI_MODE_QSPI, \ + .cache_mode = LL_XQSPI_CACHE_EN, \ + .read_cmd = LL_XQSPI_XIP_CMD_READ, \ + .data_size = LL_XQSPI_QSPI_DATASIZE_8BIT, \ + .data_order = LL_XQSPI_QSPI_MSB, \ + .clock_polarity = LL_XQSPI_SCPOL_HIGH, \ + .clock_phase = LL_XQSPI_SCPHA_2EDGE, \ + .baud_rate = LL_XQSPI_BAUD_RATE_16M, \ +} +/** @} */ + +/** @} */ + +/* Exported macro ------------------------------------------------------------*/ +/** @defgroup XQSPI_LL_Exported_Macros XQSPI Exported Macros + * @{ + */ + +/** @defgroup XQSPI_LL_EM_WRITE_READ Common Write and read registers Macros + * @{ + */ + +/** + * @brief Write a value in XQSPI register + * @param __instance__ XQSPI instance + * @param __REG__ Register to be written + * @param __VALUE__ Value to be written in the register + * @retval None + */ +#define LL_XQSPI_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__)) + +/** + * @brief Read a value in XQSPI register + * @param __instance__ XQSPI instance + * @param __REG__ Register to be read + * @retval Register value + */ +#define LL_XQSPI_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__) + +/** @} */ + +/** @} */ + +/** @} */ + +/* Exported functions --------------------------------------------------------*/ +/** @defgroup XQSPI_LL_DRIVER_FUNCTIONS Functions + * @{ + */ + +/** @defgroup XQSPI_LL_XQSPI_Configuration Cache driver functions + * @{ + */ + +/** + * @brief Enable cache function + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_cache(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +} + +/** + * @brief Disable cache function + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_cache(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); + __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP(); +} + +/** + * @brief Check if cache function is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_cache(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_DIS) != (XQSPI_CACHE_CTRL0_DIS)); +} + +/** + * @brief Enable tag memory flush + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | TAG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_cache_flush(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_FLUSH); +} + +/** + * @brief Disable tag memory flush + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | TAG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_cache_flush(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_FLUSH); +} + +/** + * @brief Check if tag memory flush is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | TAG | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_cache_flush(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_FLUSH) == (XQSPI_CACHE_CTRL0_FLUSH)); +} + +/** + * @brief Set FIFO mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | FIFO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param mode This parameter can be one of the following values: + * @arg @ref LL_XQSPI_CACHE_FIFO_NORMAL + * @arg @ref LL_XQSPI_CACHE_FIFO_CLEAR + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_cache_fifo(xqspi_regs_t *XQSPIx, uint32_t mode) +{ + MODIFY_REG(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_FIFO, mode); +} + +/** + * @brief Get FIFO mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | FIFO | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_CACHE_FIFO_NORMAL + * @arg @ref LL_XQSPI_CACHE_FIFO_CLEAR + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_fifo(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_FIFO)); +} + +/** + * @brief Set HIT/MISS mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | HITMISS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param mode This parameter can be one of the following values: + * @arg @ref LL_XQSPI_CACHE_HITMISS_NORMAL + * @arg @ref LL_XQSPI_CACHE_HITMISS_CLEAR + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_cache_hitmiss(xqspi_regs_t *XQSPIx, uint32_t mode) +{ + MODIFY_REG(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_HITMISS, mode); +} + +/** + * @brief Get HIT/MISS mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | HITMISS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_CACHE_HITMISS_NORMAL + * @arg @ref LL_XQSPI_CACHE_HITMISS_CLEAR + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_hitmiss(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->CACHE.CTRL0, XQSPI_CACHE_CTRL0_HITMISS)); +} + +/** + * @brief Set debugbus configurations signals + * @note These bits should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | DBGBUS_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param sel This parameter can between: 0 ~ 0x7 + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_cache_dbgbus(xqspi_regs_t *XQSPIx, uint32_t sel) +{ + MODIFY_REG(XQSPIx->CACHE.CTRL1, XQSPI_CACHE_CTRL1_DBGBUS_SEL, sel << XQSPI_CACHE_CTRL1_DBGBUS_SEL_Pos); +} + +/** + * @brief Get debugbus configurations signals + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | DBGBUS_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0x7 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_dbgbus(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->CACHE.CTRL1, XQSPI_CACHE_CTRL1_DBGBUS_SEL) >> XQSPI_CACHE_CTRL1_DBGBUS_SEL_Pos); +} + +/** + * @brief Enable debug bus mux + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | DBGMUX_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_cache_dbgmux(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->CACHE.CTRL1, XQSPI_CACHE_CTRL1_DBGMUX_EN); +} + +/** + * @brief Disable debug bus mux + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | DBGMUX_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_cache_dbgmux(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->CACHE.CTRL1, XQSPI_CACHE_CTRL1_DBGMUX_EN); +} + +/** + * @brief Check if debug bus mux is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | DBGMUX_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_cache_dbgmux(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->CACHE.CTRL1, XQSPI_CACHE_CTRL1_DBGMUX_EN) != (XQSPI_CACHE_CTRL1_DBGMUX_EN)); +} + +/** + * @brief Get hit counter + * @note This bit only be read. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | HIT_COUNT | HITCOUNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_hitcount(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->CACHE.HIT_COUNT)); +} + +/** + * @brief Get miss counter + * @note This bit only be read. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MISS_COUNT | MISSCOUNT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_misscount(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->CACHE.MISS_COUNT)); +} + +/** + * @brief Get cache status + * @note This bit only be read. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | STAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 1 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_cache_flag(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->CACHE.STAT, XQSPI_CACHE_STAT)); +} + +/** @} */ + +/** @defgroup XQSPI_LL_XIP_Configuration XIP LL driver functions + * @{ + */ + +/** + * @brief Set read command + * @note These bits should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | CFG_CMD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cmd This parameter can be one of the following values: + * @arg @ref LL_XQSPI_XIP_CMD_READ + * @arg @ref LL_XQSPI_XIP_CMD_FAST_READ + * @arg @ref LL_XQSPI_XIP_CMD_DUAL_OUT_READ + * @arg @ref LL_XQSPI_XIP_CMD_DUAL_IO_READ + * @arg @ref LL_XQSPI_XIP_CMD_QUAD_OUT_READ + * @arg @ref LL_XQSPI_XIP_CMD_QUAD_IO_READ + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_cmd(xqspi_regs_t *XQSPIx, uint32_t cmd) +{ + MODIFY_REG(XQSPIx->XIP.CTRL0, XQSPI_XIP_CFG_CMD, cmd); +} + +/** + * @brief Get read command + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL0 | CFG_CMD | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_XIP_CMD_READ + * @arg @ref LL_XQSPI_XIP_CMD_FAST_READ + * @arg @ref LL_XQSPI_XIP_CMD_DUAL_OUT_READ + * @arg @ref LL_XQSPI_XIP_CMD_DUAL_IO_READ + * @arg @ref LL_XQSPI_XIP_CMD_QUAD_OUT_READ + * @arg @ref LL_XQSPI_XIP_CMD_QUAD_IO_READ + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_cmd(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL0, XQSPI_XIP_CFG_CMD)); +} + +/** + * @brief Enable high performance mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_HPEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_xip_hp(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_HPEN); +} + +/** + * @brief Disable high performance mode + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_HPEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_xip_hp(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_HPEN); +} + +/** + * @brief Check if high performance mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_HPEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_xip_hp(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_HPEN) == (XQSPI_XIP_CFG_HPEN)); +} + +/** + * @brief Set slave select + * @note These bits should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_SS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param ss This parameter can be one or more of the following values: + * @arg @ref LL_XQSPI_XIP_SS0 + * @arg @ref LL_XQSPI_XIP_SS1 + * @arg @ref LL_XQSPI_XIP_SS2 + * @arg @ref LL_XQSPI_XIP_SS3 + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_ss(xqspi_regs_t *XQSPIx, uint32_t ss) +{ + MODIFY_REG(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_SS, ss); +} + +/** + * @brief Get slave select + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_SS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_XIP_SS0 + * @arg @ref LL_XQSPI_XIP_SS1 + * @arg @ref LL_XQSPI_XIP_SS2 + * @arg @ref LL_XQSPI_XIP_SS3 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_ss(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_SS)); +} + +/** + * @brief Set clock phase + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_CPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cpha This parameter can be one or more of the following values: + * @arg @ref LL_XQSPI_SCPHA_1EDGE + * @arg @ref LL_XQSPI_SCPHA_2EDGE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_cpha(xqspi_regs_t *XQSPIx, uint32_t cpha) +{ + MODIFY_REG(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_CPHA, cpha << XQSPI_XIP_CFG_CPHA_Pos); +} + +/** + * @brief Get clock phase + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_CPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_SCPHA_1EDGE + * @arg @ref LL_XQSPI_SCPHA_2EDGE + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_cpha(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_CPHA) >> XQSPI_XIP_CFG_CPHA_Pos); +} + +/** + * @brief Set clock polarity + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_CPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cpol This parameter can be one or more of the following values: + * @arg @ref LL_XQSPI_SCPOL_LOW + * @arg @ref LL_XQSPI_SCPOL_HIGH + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_cpol(xqspi_regs_t *XQSPIx, uint32_t cpol) +{ + MODIFY_REG(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_CPOL, cpol << XQSPI_XIP_CFG_CPOL_Pos); +} + +/** + * @brief Get clock polarity + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_CPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_SCPOL_LOW + * @arg @ref LL_XQSPI_SCPOL_HIGH + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_cpol(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_CPOL) >> XQSPI_XIP_CFG_CPOL_Pos); +} + +/** + * @brief Set address bytes in command + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_ADDR4 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param size This parameter can be one or more of the following values: + * @arg @ref LL_XQSPI_XIP_ADDR_3BYTES + * @arg @ref LL_XQSPI_XIP_ADDR_4BYTES + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_addr_size(xqspi_regs_t *XQSPIx, uint32_t size) +{ + MODIFY_REG(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_ADDR4, size); +} + +/** + * @brief Get address bytes in command + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_ADDR4 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_XIP_ADDR_3BYTES + * @arg @ref LL_XQSPI_XIP_ADDR_4BYTES + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_addr_size(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_ADDR4)); +} + +/** + * @brief Set endian in reading data + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_LE32 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param endian This parameter can be one or more of the following values: + * @arg @ref LL_XQSPI_XIP_ENDIAN_BIG + * @arg @ref LL_XQSPI_XIP_ENDIAN_LITTLE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_endian(xqspi_regs_t *XQSPIx, uint32_t endian) +{ + MODIFY_REG(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_LE32, endian); +} + +/** + * @brief Get endian in reading data + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL1 | CFG_LE32 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_XIP_ENDIAN_BIG + * @arg @ref LL_XQSPI_XIP_ENDIAN_LITTLE + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_endian(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL1, XQSPI_XIP_CFG_LE32)); +} + +/** + * @brief Set high performance command + * @note These bits should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_HPMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cmd This value is specified by different QSPI FLASH memory vendor to enter into its status register + * to activate HP mode in dual I/O and Quad I/O access. This parameter can between: 0 ~ 0xFF. + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_hp_cmd(xqspi_regs_t *XQSPIx, uint32_t cmd) +{ + MODIFY_REG(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_HPMODE, cmd << XQSPI_XIP_CFG_HPMODE_Pos); +} + +/** + * @brief Get high performance command + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_HPMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0xFF. + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_hp_cmd(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_HPMODE) >> XQSPI_XIP_CFG_HPMODE_Pos); +} + +/** + * @brief Set dummy cycles in command + * @note These bits should not be changed when XIP is ongoing. + * - Fast Read Dual I/O: dummycycles = 4 * cycles + 4 + * - Fast Read Quad I/O: dummycycles = 2 * cycles + 2 + * - Fast Read Dual Out: dummycycles = 8 * cycles + * - Fast Read Quad Out: dummycycles = 8 * cycles + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_DUMMYCYCLES | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cycles This parameter can between: 0 ~ 0xF. + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_dummycycles(xqspi_regs_t *XQSPIx, uint32_t cycles) +{ + MODIFY_REG(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_DUMMYCYCLES, cycles << XQSPI_XIP_CFG_DUMMYCYCLES_Pos); +} + +/** + * @brief Get dummy cycles in command + * @note - Fast Read Dual I/O: dummycycles = 4 * cycles + 4 + * - Fast Read Quad I/O: dummycycles = 2 * cycles + 2 + * - Fast Read Dual Out: dummycycles = 8 * cycles + * - Fast Read Quad Out: dummycycles = 8 * cycles + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_DUMMYCYCLES | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0xF. + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_dummycycles(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_DUMMYCYCLES)); +} + +/** + * @brief Set dummy cycles in high performance end + * @note These bits should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_ENDDUMMY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cycles This parameter can between: 0 ~ 3. + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_xip_dummy_hp(xqspi_regs_t *XQSPIx, uint32_t cycles) +{ + MODIFY_REG(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_ENDDUMMY, cycles << XQSPI_XIP_CFG_ENDDUMMY_Pos); +} + +/** + * @brief Get dummy cycles in high performance end + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL2 | CFG_ENDDUMMY | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 3. + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_dummy_hp(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.CTRL2, XQSPI_XIP_CFG_ENDDUMMY) >> XQSPI_XIP_CFG_ENDDUMMY_Pos); +} + +/** + * @brief Enable XIP mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL3 | EN_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_xip(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->XIP.CTRL3, XQSPI_XIP_EN_REQ); +} + +/** + * @brief Disable XIP mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL3 | EN_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_xip(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->XIP.CTRL3, XQSPI_XIP_EN_REQ); +} + +/** + * @brief Check if XIP mode is enabled + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL3 | EN_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_xip(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->XIP.CTRL3, XQSPI_XIP_EN_REQ) == (XQSPI_XIP_EN_REQ)); +} + +/** + * @brief Get XIP status + * @note This bit is read-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | STAT | EN_OUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 1 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_xip_flag(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.STAT, XQSPI_XIP_EN_OUT)); +} + +/** + * @brief Check if XIP interrupt is enabled + * @note This bit is read-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 1 + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_xip_it(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.INTEN, XQSPI_XIP_INT_EN)); +} + +/** + * @brief Get XIP interrupt flag + * @note This bit is read-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INT_STAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 1 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_flag_xip_it(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.INTSTAT, XQSPI_XIP_INT_STAT)); +} + +/** + * @brief Get XIP interrupt request + * @note This bit is read-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTREQ | INT_REQ | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 1 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_req_xip_it(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->XIP.INTREQ, XQSPI_XIP_INT_REQ)); +} + +/** + * @brief Set XIP interrupt enable + * @note This bit is write-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSET | INT_SET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_xip_it(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->XIP.INTSET, XQSPI_XIP_INT_SET); +} + +/** + * @brief Set XIP interrupt disable + * @note This bit is write-only. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INT_CLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_xip_it(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->XIP.INTCLR, XQSPI_XIP_INT_CLR); +} + +/** @} */ + +/** @defgroup XQSPI_LL_QSPI_Configuration QSPI driver functions + * @{ + */ + +/** + * @brief Write 8-bit in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | TX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param tx_data This parameter can between: 0x00 ~ 0xFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_qspi_transmit_data8(xqspi_regs_t *XQSPIx, uint8_t tx_data) +{ + *((__IOM uint8_t *)&XQSPIx->QSPI.TX_DATA) = tx_data; +} + +/** + * @brief Write 16-bit in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | TX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param tx_data This parameter can between: 0x00 ~ 0xFFFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_qspi_transmit_data16(xqspi_regs_t *XQSPIx, uint16_t tx_data) +{ + *((__IOM uint16_t *)&XQSPIx->QSPI.TX_DATA) = tx_data; +} + +/** + * @brief Write 32-bit in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | TX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param tx_data This parameter can between: 0x00 ~ 0xFFFFFFFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_qspi_transmit_data32(xqspi_regs_t *XQSPIx, uint32_t tx_data) +{ + *((__IOM uint32_t *)&XQSPIx->QSPI.TX_DATA) = tx_data; +} + +/** + * @brief Read 8 bits in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | RX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value between: 0x00 ~ 0xFF + */ +__STATIC_INLINE uint8_t ll_xqspi_qspi_receive_data8(xqspi_regs_t *XQSPIx) +{ + return (uint8_t)(READ_REG(XQSPIx->QSPI.RX_DATA)); +} + +/** + * @brief Read 16 bits in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | RX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value between: 0x00 ~ 0xFFFF + */ +__STATIC_INLINE uint16_t ll_xqspi_qspi_receive_data16(xqspi_regs_t *XQSPIx) +{ + return (uint16_t)(READ_REG(XQSPIx->QSPI.RX_DATA)); +} + +/** + * @brief Read 32 bits in the data register + * + * \rst + * +----------------------+-----------------------------+ + * | Register | BitsName | + * +======================+=============================+ + * | RX_DATA | DATA | + * +----------------------+-----------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value between: 0x00 ~ 0xFFFFFFFF + */ +__STATIC_INLINE uint32_t ll_xqspi_qspi_receive_data32(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->QSPI.RX_DATA)); +} + +/** + * @brief Set TX FIFO threshold level + * @note FIFO maximum depth is 16 units. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | TXWMARK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_tft(xqspi_regs_t *XQSPIx, uint32_t threshold) +{ + MODIFY_REG(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_TXWMARK, threshold << XQSPI_QSPI_CTRL_TXWMARK_Pos); +} + +/** + * @brief Get TX FIFO threshold level + * @note FIFO maximum depth is 16 units. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | TXWMARK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_tft(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_TXWMARK) >> XQSPI_QSPI_CTRL_TXWMARK_Pos); +} + +/** + * @brief Set RX FIFO threshold level + * @note FIFO maximum depth is 16 units. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RXWMARK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param threshold This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_rft(xqspi_regs_t *XQSPIx, uint32_t threshold) +{ + MODIFY_REG(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_RXWMARK, threshold << XQSPI_QSPI_CTRL_RXWMARK_Pos); +} + +/** + * @brief Get RX FIFO threshold level + * @note FIFO maximum depth is 16 units. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | RXWMARK | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_8 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_4 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_1_2 + * @arg @ref LL_XQSPI_QSPI_FIFO_WATERMARK_3_4 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_rft(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_RXWMARK) >> XQSPI_QSPI_CTRL_RXWMARK_Pos); +} + +/** + * @brief Enable dummy cycles + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MWAITEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_dummy(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_MWAITEN); +} + +/** + * @brief Disable dummy cycles + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MWAITEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_dummy(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_MWAITEN); +} + +/** + * @brief Check if dummy cycles is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MWAITEN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi_dummy(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_MWAITEN) == (XQSPI_QSPI_CTRL_MWAITEN)); +} + +/** + * @brief Enable DMA mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | DMA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_dma(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_DMA); +} + +/** + * @brief Disable DMA mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | DMA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_dma(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_DMA); +} + +/** + * @brief Check if DMA mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | DMA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi_dma(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_DMA) == (XQSPI_QSPI_CTRL_DMA)); +} + +/** + * @brief Set clock polarity + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cpol This parameter can be one of the following values: + * @arg @ref LL_XQSPI_SCPOL_LOW + * @arg @ref LL_XQSPI_SCPOL_HIGH + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_cpol(xqspi_regs_t *XQSPIx, uint32_t cpol) +{ + MODIFY_REG(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CPOL, cpol << XQSPI_QSPI_CTRL_CPOL_Pos); +} + +/** + * @brief Get clock polarity + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CPOL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_SCPOL_LOW + * @arg @ref LL_XQSPI_SCPOL_HIGH + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_cpol(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CPOL) >> XQSPI_QSPI_CTRL_CPOL_Pos); +} + +/** + * @brief Set clock phase + * @note This bit should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param cpha This parameter can be one of the following values: + * @arg @ref LL_XQSPI_SCPHA_1EDGE + * @arg @ref LL_XQSPI_SCPHA_2EDGE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_cpha(xqspi_regs_t *XQSPIx, uint32_t cpha) +{ + MODIFY_REG(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CPHA, cpha << XQSPI_QSPI_CTRL_CPHA_Pos); +} + +/** + * @brief Get clock phase + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CPHA | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_SCPHA_1EDGE + * @arg @ref LL_XQSPI_SCPHA_2EDGE + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_cpha(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CPHA) >> XQSPI_QSPI_CTRL_CPHA_Pos); +} + +/** + * @brief Set serial data order + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MSB1ST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param order This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_LSB + * @arg @ref LL_XQSPI_QSPI_MSB + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_data_order(xqspi_regs_t *XQSPIx, uint32_t order) +{ + MODIFY_REG(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_MSB1ST, order); +} + +/** + * @brief Get serial data order + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | MSB1ST | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_LSB + * @arg @ref LL_XQSPI_QSPI_MSB + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_data_order(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_MSB1ST)); +} + +/** + * @brief Enable continuous transfer mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CONTXFER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_contxfer(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CONTXFER); +} + +/** + * @brief Disable continuous transfer mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CONTXFER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_contxfer(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CONTXFER); +} + +/** + * @brief Check if continuous transfer mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | CTRL | CONTXFER | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi_contxfer(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.CTRL, XQSPI_QSPI_CTRL_CONTXFER) == (XQSPI_QSPI_CTRL_CONTXFER)); +} + +/** + * @brief Enable continuous transfer extend mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | CONTXFERX | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_contxfer_extend(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_CONTXFERX); +} + +/** + * @brief Disable continuous transfer extend mode + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | CONTXFERX | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_contxfer_extend(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_CONTXFERX); +} + +/** + * @brief Check if continuous transfer extend mode is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | CONTXFERX | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi_contxfer_extend(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_CONTXFERX) == (XQSPI_QSPI_AUXCTRL_CONTXFERX)); +} + +/** + * @brief Set data size + * @note These bits should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | BITSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param szie This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_DATASIZE_4BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_8BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_12BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_16BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_20BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_24BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_28BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_32BIT + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_datasize(xqspi_regs_t *XQSPIx, uint32_t szie) +{ + MODIFY_REG(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_BITSIZE, szie); +} + +/** + * @brief Get data size + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | BITSIZE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_DATASIZE_4BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_8BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_12BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_16BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_20BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_24BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_28BIT + * @arg @ref LL_XQSPI_QSPI_DATASIZE_32BIT + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_datasize(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_BITSIZE)); +} + +/** + * @brief Enable inhibt data input to RX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDIN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_inhibt_rx(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDIN); +} + +/** + * @brief Disable inhibt data input to RX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDIN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_inhibt_rx(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDIN); +} + +/** + * @brief Check if inhibt data input to RX FIFO is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDIN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_inhibt_rx(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDIN) == XQSPI_QSPI_AUXCTRL_INHIBITDIN); +} + +/** + * @brief Enable inhibt data output to TX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_inhibt_tx(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDOUT); +} + +/** + * @brief Disable inhibt data output to TX FIFO + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_inhibt_tx(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDOUT); +} + +/** + * @brief Check if inhibt data input to TX FIFO is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | INHIBITDOUT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_inhibt_tx(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_INHIBITDOUT) == XQSPI_QSPI_AUXCTRL_INHIBITDOUT); +} + +/** + * @brief Set frame format + * @note These bits should not be changed when communication is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | QMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param format This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_FRF_SPI + * @arg @ref LL_XQSPI_QSPI_FRF_DUALSPI + * @arg @ref LL_XQSPI_QSPI_FRF_QUADSPI + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_frf(xqspi_regs_t *XQSPIx, uint32_t format) +{ + MODIFY_REG(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_QMODE, format); +} + +/** + * @brief Get frame format + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | AUX_CTRL | QMODE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one even value: + * @arg @ref LL_XQSPI_QSPI_FRF_SPI + * @arg @ref LL_XQSPI_QSPI_FRF_DUALSPI + * @arg @ref LL_XQSPI_QSPI_FRF_QUADSPI + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_frf(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.AUX_CTRL, XQSPI_QSPI_AUXCTRL_QMODE)); +} + +/** + * @brief Get QSPI status + * + * \rst + * +----------------------+------------------------------------------------------+ + * | Register | BitsName | + * +======================+======================================================+ + * | STATUS | RXFULL RXWMARK RXEMPTY TXFULL TXWMARK TXEMPTY XFERIP | + * +----------------------+------------------------------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one or combination of the following values: + * @arg @ref LL_XQSPI_QSPI_STAT_RFTF + * @arg @ref LL_XQSPI_QSPI_STAT_RFF + * @arg @ref LL_XQSPI_QSPI_STAT_RFE + * @arg @ref LL_XQSPI_QSPI_STAT_TFTF + * @arg @ref LL_XQSPI_QSPI_STAT_TFF + * @arg @ref LL_XQSPI_QSPI_STAT_TFE + * @arg @ref LL_XQSPI_QSPI_STAT_BUSY + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_status(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->QSPI.STAT)); +} + +/** + * @brief Check active flag + * + * \rst + * +----------------------+------------------------------------------------------+ + * | Register | BitsName | + * +======================+======================================================+ + * | STATUS | RXFULL RXWMARK RXEMPTY TXFULL TXWMARK TXEMPTY XFERIP | + * +----------------------+------------------------------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_STAT_RFTF + * @arg @ref LL_XQSPI_QSPI_STAT_RFF + * @arg @ref LL_XQSPI_QSPI_STAT_RFE + * @arg @ref LL_XQSPI_QSPI_STAT_TFTF + * @arg @ref LL_XQSPI_QSPI_STAT_TFF + * @arg @ref LL_XQSPI_QSPI_STAT_TFE + * @arg @ref LL_XQSPI_QSPI_STAT_BUSY + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_active_qspi_flag(xqspi_regs_t *XQSPIx, uint32_t flag) +{ + return (READ_BITS(XQSPIx->QSPI.STAT, flag) == (flag)); +} + +/** + * @brief Enable slave select output + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLAVE_SEL | OUT3 OUT2 OUT1 OUT0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param ssout This parameter can between: 0 ~ 0xFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_ssout(xqspi_regs_t *XQSPIx, uint32_t ssout) +{ + SET_BITS(XQSPIx->QSPI.SLAVE_SEL, ssout); +} + +/** + * @brief Disable slave select output + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLAVE_SEL | OUT3 OUT2 OUT1 OUT0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param ssout This parameter can between: 0 ~ 0xFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_ssout(xqspi_regs_t *XQSPIx, uint32_t ssout) +{ + CLEAR_BITS(XQSPIx->QSPI.SLAVE_SEL, ssout); +} + +/** + * @brief Set slave select output polarity + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLAVE_SEL_POL | POL3 POL2 POL1 POL0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param sspol This parameter can between: 0 ~ 0xFF + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_sspol(xqspi_regs_t *XQSPIx, uint32_t sspol) +{ + SET_BITS(XQSPIx->QSPI.SLAVE_SEL_POL, sspol); +} + +/** + * @brief Get slave select output polarity + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SLAVE_SEL_POL | POL3 POL2 POL1 POL0 | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 0xFF + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_sspol(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->QSPI.SLAVE_SEL_POL)); +} + +/** + * @brief Get FIFO Transmission Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | TX_FIFO_LVL | TXFIFOLVL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 16 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_tx_fifo_level(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.TX_FIFO_LVL, XQSPI_QSPI_TXFIFOLVL)); +} + +/** + * @brief Get FIFO reception Level + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | RX_FIFO_LVL | RXFIFOLVL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 16 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_rx_fifo_level(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.RX_FIFO_LVL, XQSPI_QSPI_RXFIFOLVL)); +} + +/** + * @brief Enable interrupt + * @note This bit controls the generation of an interrupt when an event occurs. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_IM_DONE + * @arg @ref LL_XQSPI_QSPI_IM_RFF + * @arg @ref LL_XQSPI_QSPI_IM_RFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi_it(xqspi_regs_t *XQSPIx, uint32_t mask) +{ + SET_BITS(XQSPIx->QSPI.INTEN, mask); +} + +/** + * @brief Disable interrupt + * @note This bit controls the generation of an interrupt when an event occurs. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_IM_DONE + * @arg @ref LL_XQSPI_QSPI_IM_RFF + * @arg @ref LL_XQSPI_QSPI_IM_RFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi_it(xqspi_regs_t *XQSPIx, uint32_t mask) +{ + CLEAR_BITS(XQSPIx->QSPI.INTEN, mask); +} + +/** + * @brief Check if interrupt is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTEN | INT_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param mask This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_IM_DONE + * @arg @ref LL_XQSPI_QSPI_IM_RFF + * @arg @ref LL_XQSPI_QSPI_IM_RFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi_it(xqspi_regs_t *XQSPIx, uint32_t mask) +{ + return (READ_BITS(XQSPIx->QSPI.INTEN, mask) == (mask)); +} + +/** + * @brief Get XQSPI interrupt flags + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | INT_STAT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one or combination of the following values: + * @arg @ref LL_XQSPI_QSPI_IS_DONE + * @arg @ref LL_XQSPI_QSPI_IS_RFF + * @arg @ref LL_XQSPI_QSPI_IS_RFTF + * @arg @ref LL_XQSPI_QSPI_IS_TFTF + * @arg @ref LL_XQSPI_QSPI_IS_TFE + */ +__STATIC_INLINE uint32_t ll_xqspi_get_it_flag(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_REG(XQSPIx->QSPI.INTSTAT)); +} + +/** + * @brief Check interrupt flag + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTSTAT | XFER_DPULSE | + * +----------------------+-----------------------------------+ + * \endrst + * INTSTAT | RX_FPULSE + * INTSTAT | RX_WPULSE + * INTSTAT | TX_WPULSE + * INTSTAT | TX_EPULSE + * + * @param XQSPIx XQSPI instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_IS_DONE + * @arg @ref LL_XQSPI_QSPI_IS_RFF + * @arg @ref LL_XQSPI_QSPI_IS_RFTF + * @arg @ref LL_XQSPI_QSPI_IS_TFTF + * @arg @ref LL_XQSPI_QSPI_IS_TFE + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_qspi_it_flag(xqspi_regs_t *XQSPIx, uint32_t flag) +{ + return (READ_BITS(XQSPIx->QSPI.INTSTAT, flag) == (flag)); +} + +/** + * @brief Clear interrupt flag + * @note Clearing interrupt flag is done by writting INTCLR register + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | INTCLR | INT_CLR | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param flag This parameter can be one of the following values: + * @arg @ref LL_XQSPI_QSPI_IM_DONE + * @arg @ref LL_XQSPI_QSPI_IM_RFF + * @arg @ref LL_XQSPI_QSPI_IM_RFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFTF + * @arg @ref LL_XQSPI_QSPI_IM_TFE + * @retval None + */ +__STATIC_INLINE void ll_xqspi_clear_qspi_flag(xqspi_regs_t *XQSPIx, uint32_t flag) +{ + WRITE_REG(XQSPIx->QSPI.INTCLR, flag); +} + +/** + * @brief Set master inter-transfer delay + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSTR_IT_DELAY | MWAIT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param wait This parameter can between: 0 ~ 255 + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_wait(xqspi_regs_t *XQSPIx, uint32_t wait) +{ + MODIFY_REG(XQSPIx->QSPI.MSTR_IT_DELAY, XQSPI_QSPI_MWAIT_MWAIT, wait << XQSPI_QSPI_MWAIT_MWAIT_Pos); +} + +/** + * @brief Get master inter-transfer delay + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | MSTR_IT_DELAY | MWAIT | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can between: 0 ~ 255 + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_wait(xqspi_regs_t *XQSPIx) +{ + return (uint32_t)(READ_BITS(XQSPIx->QSPI.MSTR_IT_DELAY, XQSPI_QSPI_MWAIT_MWAIT) >> XQSPI_QSPI_MWAIT_MWAIT_Pos); +} + +/** + * @brief Enable QSPI + * @note This bit should not be enable when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SPIEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_qspi(xqspi_regs_t *XQSPIx) +{ + SET_BITS(XQSPIx->QSPI.SPIEN, XQSPI_QSPI_EN_EN); +} + +/** + * @brief Disable QSPI + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SPIEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_qspi(xqspi_regs_t *XQSPIx) +{ + CLEAR_BITS(XQSPIx->QSPI.SPIEN, XQSPI_QSPI_EN_EN); +} + +/** + * @brief Check if QSPI is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | SPIEN | EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enabled_qspi(xqspi_regs_t *XQSPIx) +{ + return (READ_BITS(XQSPIx->QSPI.SPIEN, XQSPI_QSPI_EN_EN) == (XQSPI_QSPI_EN_EN)); +} + +/** + * @brief Set QSPI Flash write bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | FLASH_WRITE | FLASH_WRITE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param bits This parameter can be one of the following values: + * @arg @ref LL_XQSPI_FLASH_WRITE_128BIT + * @arg @ref LL_XQSPI_FLASH_WRITE_32BIT + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_flash_write(xqspi_regs_t *XQSPIx, uint32_t bits) +{ + WRITE_REG(XQSPIx->QSPI.FLASH_WRITE, bits); +} + +/** + * @brief Get QSPI Flash write bits + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | FLASH_WRITE | FLASH_WRITE | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_FLASH_WRITE_128BIT + * @arg @ref LL_XQSPI_FLASH_WRITE_32BIT + */ +__STATIC_INLINE uint32_t ll_xqspi_get_flash_write(xqspi_regs_t *XQSPIx) +{ + //GR5515_C and future version. + return READ_REG(XQSPIx->QSPI.FLASH_WRITE); +} + +/** + * @brief Set QSPI Present Bypass + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BYPASS | BYPASS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @param bypass This parameter can be one of the following values: + * @arg @ref LL_XQSPI_ENABLE_PRESENT + * @arg @ref LL_XQSPI_DISABLE_PRESENT + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_present_bypass(xqspi_regs_t *XQSPIx, uint32_t bypass) +{ + WRITE_REG(XQSPIx->QSPI.BYPASS, bypass); +} + +/** + * @brief Get QSPI Present Bypass + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | BYPASS | BYPASS | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param XQSPIx XQSPI instance + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_ENABLE_PRESENT + * @arg @ref LL_XQSPI_DISABLE_PRESENT + */ +__STATIC_INLINE uint32_t ll_xqspi_get_present_bypass(xqspi_regs_t *XQSPIx) +{ + return READ_REG(XQSPIx->QSPI.BYPASS); +} + +/** + * @brief Enable exflash power + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | EFLASH_PAD_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_exflash_power(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_EFLASH_PAD_EN); +} + +/** + * @brief Disable exflash power + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | EFLASH_PAD_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_exflash_power(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_EFLASH_PAD_EN); +} + +/** + * @brief Check if exflash power is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | EFLASH_PAD_EN | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enable_exflash_power(void) +{ + return (READ_BITS(AON->PWR_RET01, AON_PWR_REG01_EFLASH_PAD_EN) == (AON_PWR_REG01_EFLASH_PAD_EN)); +} + +/** + * @brief Set XQSPI serial clock + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XF_SCK_CLK_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @param speed This parameter can be one of the following values: + * @arg @ref LL_XQSPI_BAUD_RATE_64M + * @arg @ref LL_XQSPI_BAUD_RATE_48M + * @arg @ref LL_XQSPI_BAUD_RATE_32M + * @arg @ref LL_XQSPI_BAUD_RATE_24M + * @arg @ref LL_XQSPI_BAUD_RATE_16M + * @retval None + */ +__STATIC_INLINE void ll_xqspi_set_qspi_speed(uint32_t speed) +{ + MODIFY_REG(AON->PWR_RET01, AON_PWR_REG01_XF_SCK_CLK_SEL, speed); +} + +/** + * @brief Get XQSPI serial clock + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XF_SCK_CLK_SEL | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval Returned Value can be one of the following values: + * @arg @ref LL_XQSPI_BAUD_RATE_64M + * @arg @ref LL_XQSPI_BAUD_RATE_48M + * @arg @ref LL_XQSPI_BAUD_RATE_32M + * @arg @ref LL_XQSPI_BAUD_RATE_24M + * @arg @ref LL_XQSPI_BAUD_RATE_16M + */ +__STATIC_INLINE uint32_t ll_xqspi_get_qspi_speed(void) +{ + return (uint32_t)(READ_BITS(AON->PWR_RET01, AON_PWR_REG01_XF_SCK_CLK_SEL)); +} + +/** + * @brief Enable cache data retention. + * @note This bit should not be changed when XIP is ongoing.. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XF_TAG_RET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_xqspi_enable_cache_retention(void) +{ + SET_BITS(AON->PWR_RET01, AON_PWR_REG01_XF_TAG_RET); +} + +/** + * @brief Disable cache data retention. + * @note This bit should not be changed when XIP is ongoing. + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XF_TAG_RET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval None + */ +__STATIC_INLINE void ll_xqspi_disable_cache_retention(void) +{ + CLEAR_BITS(AON->PWR_RET01, AON_PWR_REG01_XF_TAG_RET); +} + +/** + * @brief Check if tag memory retention is enabled + * + * \rst + * +----------------------+-----------------------------------+ + * | Register | BitsName | + * +======================+===================================+ + * | PWR_RET01 | XF_TAG_RET | + * +----------------------+-----------------------------------+ + * \endrst + * + * @retval State of bit (1 or 0). + */ +__STATIC_INLINE uint32_t ll_xqspi_is_enable_cache_retention(void) +{ + return (READ_BITS(AON->PWR_RET01, AON_PWR_REG01_XF_TAG_RET) == (AON_PWR_REG01_XF_TAG_RET)); +} + + + +/** @} */ + +/** @defgroup XQSPI_LL_Init XQSPI Initialization and de-initialization functions + * @{ + */ + +/** + * @brief De-initialize XQSPI registers (Registers restored to their default values). + * @param XQSPIx XQSPI instance + * @retval An error_status_t enumeration value: + * - SUCCESS: XQSPI registers are de-initialized + * - ERROR: XQSPI registers are not de-initialized + */ +error_status_t ll_xqspi_deinit(xqspi_regs_t *XQSPIx); + +/** + * @brief Initialize XQSPI registers according to the specified + * parameters in default. + * @param XQSPIx XQSPI instance + * @param p_xqspi_init Pointer to a ll_xqspi_init_t structure that contains the configuration + * information for the specified XQPSI peripheral. + * @retval An error_status_t enumeration value: + * - SUCCESS: XQSPI registers are initialized according to default + * - ERROR: Problem occurred during XQSPI Registers initialization + */ +error_status_t ll_xqspi_init(xqspi_regs_t *XQSPIx, ll_xqspi_init_t *p_xqspi_init); + +/** + * @brief Set each field of a @ref ll_xqspi_init_t type structure to default value. + * @param p_xqspi_init Pointer to a @ref ll_xqspi_init_t structure + * whose fields will be set to default values. + * @retval None + */ +void ll_xqspi_struct_init(ll_xqspi_init_t *p_xqspi_init); + +/** @} */ + +/** @} */ + +#endif /* XQSPI */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_LL_XQSPI_H__ */ + +/** @} */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/grx_hal.h b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/grx_hal.h new file mode 100644 index 0000000..267342c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/inc/hal/grx_hal.h @@ -0,0 +1,71 @@ +/** + **************************************************************************************** + * + * @file grx_hal.h + * @author BLE Driver Team + * @brief This file contains all the functions prototypes for the HAL + * module driver. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + + + +/** @addtogroup HAL_DRIVER HAL Driver + * @{ + */ + +/** @defgroup HAL_HAL HAL + * @brief HAL module driver. + * @{ + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __GRX_HAL_H__ +#define __GRX_HAL_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Includes ------------------------------------------------------------------*/ +#include "gr55xx_hal.h" + + +#ifdef __cplusplus +} +#endif + +#endif /* __GRX_HAL_H__ */ + +/** @} */ + +/** @} */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc.c new file mode 100644 index 0000000..6066e5b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc.c @@ -0,0 +1,489 @@ +/** + **************************************************************************************** + * @file app_adc.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "grx_sys.h" +#include "app_adc.h" + +#ifdef HAL_ADC_MODULE_ENABLED + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +bool adc_prepare_for_sleep(void); +void adc_wake_up_ind(void); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +static const uint32_t s_io_to_input_src[ADC_INPUT_SRC_REF+1] = +{ + MSIO_PIN_0, MSIO_PIN_1, MSIO_PIN_2, MSIO_PIN_3, MSIO_PIN_4, NULL, NULL, NULL +}; +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +adc_env_t *p_adc_env = NULL; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_adc_pwr_id = -1; + +const static app_sleep_callbacks_t adc_sleep_cb = +{ + .app_prepare_for_sleep = adc_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = adc_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +bool adc_prepare_for_sleep(void) +{ + hal_adc_state_t state; + + if (p_adc_env->adc_state == APP_ADC_ACTIVITY) + { + state = hal_adc_get_state(&p_adc_env->handle); + if ((state != HAL_ADC_STATE_READY) && (state != HAL_ADC_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_adc_suspend_reg(&p_adc_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_adc_env.adc_state = APP_ADC_SLEEP; +#endif + } + + return true; +} + +SECTION_RAM_CODE void adc_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + if (p_adc_env->adc_state == APP_ADC_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_adc_resume_reg(&p_adc_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void adc_wake_up(void) +{ + if (p_adc_env->adc_state == APP_ADC_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_adc_resume_reg(&p_adc_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + + p_adc_env->adc_state = APP_ADC_ACTIVITY; + } + + if(p_adc_env->type == APP_ADC_TYPE_DMA) + { + dma_wake_up(p_adc_env->dma_id); + } +} +#endif + +static uint16_t adc_config_gpio(uint32_t input_mode, app_adc_pin_cfg_t pin_cfg, uint32_t ref_source) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.mode = APP_IO_MODE_ANALOG; + io_init.pull = APP_IO_NOPULL; + if (input_mode == LL_ADC_INPUT_DIFFERENTIAL) + { + io_init.pin = pin_cfg.channel_p.pin; + io_init.mux = pin_cfg.channel_p.mux; + err_code = app_io_init(pin_cfg.channel_p.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + io_init.pin = pin_cfg.channel_n.pin; + io_init.mux = pin_cfg.channel_n.mux; + err_code = app_io_init(pin_cfg.channel_n.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + if (ref_source >= LL_ADC_REF_SRC_IO0) + { + io_init.pin = pin_cfg.extern_ref.pin; + io_init.mux = pin_cfg.extern_ref.mux; + err_code = app_io_init(pin_cfg.extern_ref.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_adc_init(app_adc_params_t *p_params, app_adc_evt_handler_t evt_handler) +{ + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + p_adc_env = &(p_params->adc_env); + + app_err_code = adc_config_gpio(p_params->init.input_mode, p_params->pin_cfg, p_params->init.ref_source); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + p_adc_env->evt_handler = evt_handler; + memcpy(&p_adc_env->handle.init, &p_params->init, sizeof(adc_init_t)); + hal_err_code = hal_adc_deinit(&p_adc_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + hal_err_code = hal_adc_init(&p_adc_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if(!s_sleep_cb_registered_flag) // register sleep callback + { + s_sleep_cb_registered_flag = true; + s_adc_pwr_id = pwr_register_sleep_cb(&adc_sleep_cb, APP_DRIVER_ADC_WAPEUP_PRIORITY); + if (s_adc_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_adc_env->adc_state = APP_ADC_ACTIVITY; + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_deinit(void) +{ + hal_status_t hal_err_code; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + p_adc_env->adc_state = APP_ADC_INVALID; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_adc_env->p_current_sample_node = NULL; + p_adc_env->multi_channel = 0; +#endif + + GLOBAL_EXCEPTION_DISABLE(); + pwr_unregister_sleep_cb(s_adc_pwr_id); + s_adc_pwr_id = -1; + s_sleep_cb_registered_flag = false; + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_adc_deinit(&p_adc_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + if (p_adc_env->adc_dma_state == APP_ADC_DMA_INVALID) + { + p_adc_env = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_conversion_sync(uint16_t *p_data, uint32_t length, uint32_t timeout) +{ + hal_status_t err_code; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + err_code = hal_adc_poll_for_conversion(&p_adc_env->handle, p_data, length); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_conversion_async(uint16_t *p_data, uint32_t length) +{ + hal_status_t err_code; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_adc_env->adc_dma_state == APP_ADC_DMA_INVALID) + { + return APP_DRV_ERR_INVALID_MODE; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + err_code = hal_adc_start_dma(&p_adc_env->handle, p_data, length); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_adc_multi_channel_conversion_async(app_adc_sample_node_t *p_begin_node, uint32_t total_nodes) +{ + hal_status_t err_code; + uint32_t check_node_num; + app_adc_sample_node_t *p_check_node; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_begin_node == NULL || total_nodes == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_adc_env->adc_dma_state == APP_ADC_DMA_INVALID) + { + return APP_DRV_ERR_INVALID_MODE; + } + + check_node_num = total_nodes; + p_check_node = p_begin_node; + while (check_node_num)//check samle link node + { + if( (p_check_node->channel > ADC_INPUT_SRC_REF) || (p_check_node->p_buf == NULL) || ((check_node_num>1)&&(p_check_node->next == NULL))) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (--check_node_num) + { + p_check_node = p_check_node->next; + } + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + if(HAL_ADC_STATE_READY != hal_adc_get_state(&p_adc_env->handle)) + { + return APP_DRV_ERR_BUSY; + } + + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + io_init.mode = APP_IO_MODE_ANALOG; + io_init.mux = APP_IO_MUX_7; + check_node_num = total_nodes; + p_check_node = p_begin_node; + while (check_node_num)//config all msios + { + if (s_io_to_input_src[p_check_node->channel] != NULL) + { + io_init.pin = s_io_to_input_src[p_check_node->channel]; + app_io_init(APP_IO_TYPE_MSIO, &io_init); + } + + if (--check_node_num) + { + p_check_node = p_check_node->next; + } + } + + p_adc_env->handle.init.input_mode = ADC_INPUT_SINGLE;//multi sample must under single mode + p_adc_env->handle.init.channel_n = p_begin_node->channel; + err_code = hal_adc_init(&p_adc_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_adc_env->p_current_sample_node = p_begin_node; + p_adc_env->multi_channel = total_nodes; + err_code = hal_adc_start_dma(&p_adc_env->handle, p_begin_node->p_buf, p_begin_node->len); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} +#endif + +uint16_t app_adc_voltage_intern(uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (inbuf == NULL || outbuf == NULL || buflen == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_adc_voltage_intern(&p_adc_env->handle, inbuf, outbuf, buflen); + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_voltage_extern(double ref, uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (inbuf == NULL || outbuf == NULL || buflen == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_adc_voltage_extern(&p_adc_env->handle, ref, inbuf, outbuf, buflen); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +uint16_t app_adc_temperature_conv(uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (inbuf == NULL || outbuf == NULL || buflen == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_adc_temperature_conv(&p_adc_env->handle, inbuf, outbuf, buflen); + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_vbat_conv(uint16_t *inbuf, double *outbuf, uint32_t buflen) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (inbuf == NULL || outbuf == NULL || buflen == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + hal_adc_vbat_conv(&p_adc_env->handle, inbuf, outbuf, buflen); + + return APP_DRV_SUCCESS; +} +#endif + +adc_handle_t *app_adc_get_handle(void) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + return &p_adc_env->handle; +} + +void hal_adc_conv_cplt_callback(adc_handle_t *p_adc) +{ + app_adc_evt_t evt; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if(p_adc_env->multi_channel > 0) + { + p_adc_env->multi_channel--; + } + + if(p_adc_env->multi_channel == 0) + { +#endif + evt.type = APP_ADC_EVT_CONV_CPLT; + + if (p_adc_env->evt_handler != NULL) + { + p_adc_env->evt_handler(&evt); + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + } + else + { + p_adc_env->p_current_sample_node = p_adc_env->p_current_sample_node->next; + ll_adc_set_channeln(p_adc_env->p_current_sample_node->channel); + hal_adc_start_dma(&p_adc_env->handle, p_adc_env->p_current_sample_node->p_buf, p_adc_env->p_current_sample_node->len); + } +#endif +} + +uint16_t adc_get_trim_func(adc_trim_info_t *p_adc_trim) +{ + return sys_adc_trim_get(p_adc_trim); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc_dma.c new file mode 100644 index 0000000..bb626d3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_adc_dma.c @@ -0,0 +1,239 @@ +/** + **************************************************************************************** + * @file app_adc_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include + +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "grx_sys.h" +#include "app_adc.h" +#include "app_adc_dma.h" + +#ifdef HAL_ADC_MODULE_ENABLED + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +extern void adc_wake_up(void); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +static const uint32_t s_io_to_input_src[ADC_INPUT_SRC_REF + 1] = +{ + MSIO_PIN_0, MSIO_PIN_1, MSIO_PIN_2, MSIO_PIN_3, MSIO_PIN_4, NULL, NULL, NULL +}; +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern adc_env_t *p_adc_env; + +static uint16_t adc_config_dma(app_adc_params_t *p_params) +{ + app_dma_params_t dma_params = { 0 }; + + dma_params.p_instance = p_params->dma_cfg.dma_instance; + if (dma_params.p_instance != DMA0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + dma_params.channel_number = p_params->dma_cfg.dma_channel; + dma_params.init.src_request = DMA0_REQUEST_SNSADC; + dma_params.init.direction = DMA_PERIPH_TO_MEMORY; + dma_params.init.src_increment = DMA_SRC_NO_CHANGE; + dma_params.init.dst_increment = DMA_DST_INCREMENT; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + dma_params.init.mode = DMA_NORMAL; +#endif + dma_params.init.priority = DMA_PRIORITY_LOW; + + p_adc_env->dma_id = app_dma_init(&dma_params, NULL); + if (p_adc_env->dma_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + p_adc_env->handle.p_dma = app_dma_get_handle(p_adc_env->dma_id); + p_adc_env->handle.p_dma->p_parent = (void*)&p_adc_env->handle; + + return APP_DRV_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_adc_dma_init(app_adc_params_t *p_params) +{ + app_drv_err_t app_err_code; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + GLOBAL_EXCEPTION_DISABLE(); + p_adc_env->dma_id = -1; + app_err_code = adc_config_dma(p_params); + GLOBAL_EXCEPTION_ENABLE(); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + GLOBAL_EXCEPTION_DISABLE(); + p_adc_env->adc_dma_state = APP_ADC_DMA_ACTIVITY; + GLOBAL_EXCEPTION_ENABLE(); + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_dma_deinit(void) +{ + if ((p_adc_env == NULL) || (p_adc_env->adc_dma_state != APP_ADC_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_adc_env->dma_id); + + GLOBAL_EXCEPTION_DISABLE(); + p_adc_env->adc_dma_state = APP_ADC_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + if (p_adc_env->adc_state == APP_ADC_INVALID) + { + p_adc_env = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_adc_dma_conversion_async(uint16_t *p_data, uint32_t length) +{ + hal_status_t err_code; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + err_code = hal_adc_start_dma(&p_adc_env->handle, p_data, length); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_adc_dma_multi_channel_conversion_async(app_adc_sample_node_t *p_begin_node, uint32_t total_nodes) +{ + hal_status_t err_code; + uint32_t check_node_num; + app_adc_sample_node_t *p_check_node; + + if ((p_adc_env == NULL) || (p_adc_env->adc_state == APP_ADC_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_begin_node == NULL || total_nodes == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + check_node_num = total_nodes; + p_check_node = p_begin_node; + while (check_node_num) //check samle link node + { + if ((p_check_node->channel > ADC_INPUT_SRC_REF) || (p_check_node->p_buf == NULL) || ((check_node_num>1)&&(p_check_node->next == NULL))) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (--check_node_num) + { + p_check_node = p_check_node->next; + } + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + adc_wake_up(); +#endif + + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + io_init.mode = APP_IO_MODE_ANALOG; + io_init.mux = APP_IO_MUX_7; + check_node_num = total_nodes; + p_check_node = p_begin_node; + while (check_node_num)//config all msios + { + if (s_io_to_input_src[p_check_node->channel] != NULL) + { + io_init.pin = s_io_to_input_src[p_check_node->channel]; + app_io_init(APP_IO_TYPE_MSIO, &io_init); + } + + if (--check_node_num) + { + p_check_node = p_check_node->next; + } + } + + p_adc_env->handle.init.input_mode = ADC_INPUT_SINGLE;//multi sample must under single mode + p_adc_env->handle.init.channel_n = p_begin_node->channel; + err_code = hal_adc_init(&p_adc_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_adc_env->p_current_sample_node = p_begin_node; + p_adc_env->multi_channel = total_nodes; + err_code = hal_adc_start_dma(&p_adc_env->handle, p_begin_node->p_buf, p_begin_node->len); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_aon_wdt.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_aon_wdt.c new file mode 100644 index 0000000..a5bbb53 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_aon_wdt.c @@ -0,0 +1,166 @@ +/** + **************************************************************************************** + * @file app_aon_wdt.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_aon_wdt.h" +#include "app_drv.h" +#include "gr_soc.h" +#include + +#ifdef HAL_AON_WDT_MODULE_ENABLED + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * EXTERN VARIABLE + ***************************************************************************************** + */ + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +extern uint32_t SystemSlowClock; +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +aon_aon_wdt_env_t *p_aon_wdt_env = NULL; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ + +void AON_WDT_IRQHandler(void); + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_aon_wdt_event_call(aon_wdt_handle_t *p_aon_wdt) +{ + if(p_aon_wdt_env->evt_handler != NULL) + { + p_aon_wdt_env->evt_handler(); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_aon_wdt_init(app_aon_wdt_params_t *p_params, app_aon_wdt_evt_handler_t evt_handler) +{ + hal_status_t err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + p_aon_wdt_env = &p_params->aon_aon_wdt_env; + + memcpy(&p_aon_wdt_env->handle.init, &p_params->init, sizeof(aon_wdt_init_t)); + err_code = hal_aon_wdt_deinit(&p_aon_wdt_env->handle); + HAL_ERR_CODE_CHECK(err_code); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + p_aon_wdt_env->handle.SystemCoreLowClock = &SystemSlowClock; +#endif + + err_code = hal_aon_wdt_init(&p_aon_wdt_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_aon_wdt_env->evt_handler = evt_handler; + p_aon_wdt_env->aon_wdt_state = APP_AON_WDT_ACTIVITY; + + soc_register_nvic(AON_WDT_IRQn, (uint32_t)AON_WDT_IRQHandler); + NVIC_ClearPendingIRQ(AON_WDT_IRQn); + NVIC_EnableIRQ(AON_WDT_IRQn); + + return APP_DRV_SUCCESS; +} + +uint16_t app_aon_wdt_deinit(void) +{ + hal_status_t err_code; + + if ((p_aon_wdt_env == NULL) || (p_aon_wdt_env->aon_wdt_state == APP_AON_WDT_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_aon_wdt_deinit(&p_aon_wdt_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_aon_wdt_env = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_aon_wdt_refresh(void) +{ + hal_status_t err_code; + + if ((p_aon_wdt_env == NULL) || (p_aon_wdt_env->aon_wdt_state == APP_AON_WDT_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_aon_wdt_refresh(&p_aon_wdt_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +void hal_aon_wdt_alarm_callback(aon_wdt_handle_t *p_aon_wdt) +{ + app_aon_wdt_event_call(p_aon_wdt); +} + +SECTION_RAM_CODE void AON_WDT_IRQHandler(void) +{ + hal_aon_wdt_irq_handler(&p_aon_wdt_env->handle); +} + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_bod.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_bod.c new file mode 100644 index 0000000..7935764 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_bod.c @@ -0,0 +1,239 @@ +/** + **************************************************************************************** + * @file app_bod.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_bod.h" +#include "gr_soc.h" +#include + +#ifdef HAL_BOD_MODULE_ENABLED + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +bod_env_t *p_bod_env = NULL; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ + +void BOD_ASSERT_IRQHandler(void); +void BOD_DEASSERT_IRQHandler(void); + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_bod_event_call(bod_handle_t *p_calendar, app_bod_evt_type_t evt_type) +{ + app_bod_evt_t bod_evt; + + bod_evt.type = evt_type; + if(p_bod_env->evt_handler != NULL) + { + p_bod_env->evt_handler(&bod_evt); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_bod_init(app_bod_params_t *p_params, app_bod_evt_handler_t evt_handler) +{ + hal_status_t err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + p_bod_env = &p_params->bod_env; + + memcpy(&p_bod_env->handle.init, &p_params->init, sizeof(bod_init_t)); + err_code = hal_bod_deinit(&p_bod_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + err_code = hal_bod_init(&p_bod_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_bod_env->evt_handler = evt_handler; + p_bod_env->bod_state = APP_BOD_ACTIVITY; + + + soc_register_nvic(BOD_ASSERT_IRQn, (uint32_t)BOD_ASSERT_IRQHandler); + NVIC_ClearPendingIRQ(BOD_ASSERT_IRQn); + NVIC_EnableIRQ(BOD_ASSERT_IRQn); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) ||(APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + soc_register_nvic(BOD_DEASSERT_IRQn, (uint32_t)BOD_DEASSERT_IRQHandler); + NVIC_ClearPendingIRQ(BOD_DEASSERT_IRQn); + NVIC_EnableIRQ(BOD_DEASSERT_IRQn); +#endif + + return APP_DRV_SUCCESS; +} + +uint16_t app_bod_deinit(void) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod_deinit(&p_bod_env->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_bod_env->bod_state = APP_BOD_INVALID; + p_bod_env = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_bod_enable(uint8_t enable) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod_enable(&p_bod_env->handle, enable); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_bod_event_enable(uint8_t enable) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod2_enable(&p_bod_env->handle, enable); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_bod_event_set_level(uint8_t level) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod2_set_level(&p_bod_env->handle, level); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_bod_static_mode_enable(uint8_t enable) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod_static_mode_enable(&p_bod_env->handle, enable); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +uint16_t app_bod_event_auto_power_bypass_enable(uint8_t enable) +{ + hal_status_t err_code; + + if ((p_bod_env == NULL) || (p_bod_env->bod_state == APP_BOD_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_bod2_auto_power_bypass_enable(&p_bod_env->handle, enable); + + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#endif + +void hal_bod_fedge_callback(bod_handle_t *p_bod) +{ + app_bod_event_call(p_bod, APP_BOD_EVT_TRIGGERED); +} + +SECTION_RAM_CODE void BOD_ASSERT_IRQHandler(void) +{ + hal_bod_fedge_irq_handler(&p_bod_env->handle); +} + +/* BOD disappear event */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) ||(APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) +void hal_bod_redge_callback(bod_handle_t *p_bod) +{ + app_bod_event_call(p_bod, APP_BOD_EVT_REMOVED); +} + +SECTION_RAM_CODE void BOD_DEASSERT_IRQHandler(void) +{ + hal_bod_redge_irq_handler(&p_bod_env->handle); +} +#endif +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_comp.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_comp.c new file mode 100644 index 0000000..71c5861 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_comp.c @@ -0,0 +1,354 @@ +/** + **************************************************************************************** + * @file app_comp.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_comp.h" +#include "app_pwr_mgmt.h" +#include "string.h" +#include "gr_soc.h" + +#ifdef HAL_COMP_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool comp_prepare_for_sleep(void); +static void comp_wake_up_ind(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +comp_env_t *p_comp_env = NULL; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_comp_pwr_id = -1; + +const static app_sleep_callbacks_t comp_sleep_cb = +{ + .app_prepare_for_sleep = comp_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = comp_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool comp_prepare_for_sleep(void) +{ + if (p_comp_env->comp_state == APP_COMP_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_comp_suspend_reg(&p_comp_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_comp_env->comp_state = APP_COMP_SLEEP; +#endif + } + + return true; +} + +SECTION_RAM_CODE static void comp_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + if (p_comp_env->comp_state == APP_COMP_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_comp_resume_reg(&p_comp_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + hal_nvic_clear_pending_irq(COMP_IRQn); + hal_nvic_enable_irq(COMP_IRQn); +#endif + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +static void comp_wake_up(void) +{ + if (p_comp_env->comp_state == APP_COMP_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_comp_resume_reg(&p_comp_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + hal_nvic_clear_pending_irq(COMP_IRQn); + hal_nvic_enable_irq(COMP_IRQn); +#else + hal_nvic_clear_pending_irq(COMP_EXT_IRQn); + hal_nvic_enable_irq(COMP_EXT_IRQn); +#endif + p_comp_env->comp_state = APP_COMP_ACTIVITY; + } +} +#endif + +static uint16_t comp_config_gpio(uint32_t ref_source, app_comp_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.mode = APP_IO_MODE_ANALOG; + io_init.pull = APP_IO_NOPULL; + io_init.pin = pin_cfg.input.pin; + io_init.mux = pin_cfg.input.mux; + err_code = app_io_init(pin_cfg.input.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + if (ref_source != COMP_REF_SRC_VBAT && ref_source != COMP_REF_SRC_VREF) + { + io_init.pin = pin_cfg.vref.pin; + io_init.mux = pin_cfg.vref.mux; + err_code = app_io_init(pin_cfg.vref.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +void hal_comp_rising_trigger_callback(comp_handle_t *p_comp) +{ + app_comp_evt_t comp_evt = APP_COMP_EVT_RISING; + + if (p_comp_env->evt_handler != NULL) + { + p_comp_env->evt_handler(&comp_evt); + } +} + +void hal_comp_falling_trigger_callback(comp_handle_t *p_comp) +{ + app_comp_evt_t comp_evt = APP_COMP_EVT_FALLING; + + if (p_comp_env->evt_handler != NULL) + { + p_comp_env->evt_handler(&comp_evt); + } +} +#else +static void app_comp_event_call(comp_handle_t *p_comp, app_comp_evt_t evt_type) +{ + app_comp_evt_t comp_evt = APP_COMP_EVT_ERROR; + + if (evt_type == APP_COMP_EVT_DONE) + { + comp_evt = APP_COMP_EVT_DONE; + } + + if (p_comp_env->evt_handler != NULL) + { + p_comp_env->evt_handler(&comp_evt); + } +} +void hal_comp_trigger_callback(comp_handle_t *p_comp) +{ + app_comp_event_call(p_comp, APP_COMP_EVT_DONE); +} +#endif + +SECTION_RAM_CODE void COMP_IRQHandler(void) +{ + hal_comp_irq_handler(&p_comp_env->handle); +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_comp_init(app_comp_params_t *p_params, app_comp_evt_handler_t evt_handler) +{ + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + p_comp_env = &p_params->comp_env; + app_err_code = comp_config_gpio(p_params->init.ref_source, p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + soc_register_nvic(COMP_EXT_IRQn, (uint32_t)COMP_IRQHandler); + hal_nvic_clear_pending_irq(COMP_EXT_IRQn); + hal_nvic_enable_irq(COMP_EXT_IRQn); +#else + soc_register_nvic(COMP_IRQn, (uint32_t)COMP_IRQHandler); + hal_nvic_clear_pending_irq(COMP_IRQn); + hal_nvic_enable_irq(COMP_IRQn); +#endif + + p_comp_env->p_pin_cfg = &p_params->pin_cfg; + p_comp_env->evt_handler = evt_handler; + memcpy(&p_comp_env->handle.init, &p_params->init, sizeof(comp_init_t)); + hal_err_code = hal_comp_deinit(&p_comp_env->handle); + APP_DRV_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_comp_init(&p_comp_env->handle); + APP_DRV_ERR_CODE_CHECK(hal_err_code); + + if(s_sleep_cb_registered_flag == false) // register sleep callback + { + s_sleep_cb_registered_flag = true; + s_comp_pwr_id = pwr_register_sleep_cb(&comp_sleep_cb, APP_DRIVER_COMP_WAPEUP_PRIORITY); + if (s_comp_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_comp_env->comp_state = APP_COMP_ACTIVITY; + + return 0; +} + +uint16_t app_comp_deinit(void) +{ + hal_status_t hal_err_code; + + if ((p_comp_env == NULL) || (p_comp_env->comp_state == APP_COMP_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + app_drv_err_t app_err_code; + app_err_code = app_io_deinit(p_comp_env->p_pin_cfg->input.type, p_comp_env->p_pin_cfg->input.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + if (p_comp_env->handle.init.ref_source != COMP_REF_SRC_VBAT && + p_comp_env->handle.init.ref_source != COMP_REF_SRC_VREF) + { + app_err_code = app_io_deinit(p_comp_env->p_pin_cfg->vref.type, p_comp_env->p_pin_cfg->vref.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + hal_nvic_disable_irq(COMP_IRQn); +#else + hal_nvic_disable_irq(COMP_EXT_IRQn); +#endif + + p_comp_env->comp_state = APP_COMP_INVALID; + + GLOBAL_EXCEPTION_DISABLE(); + pwr_unregister_sleep_cb(s_comp_pwr_id); + s_comp_pwr_id = -1; + s_sleep_cb_registered_flag = false; + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_comp_deinit(&p_comp_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + p_comp_env = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_comp_start(void) +{ + hal_status_t hal_err_code = HAL_ERROR; + + if ((p_comp_env == NULL) || (p_comp_env->comp_state == APP_COMP_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + comp_wake_up(); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + pwr_mgmt_wakeup_source_setup(PWR_WKUP_COND_MSIO_COMP); +#endif + + hal_err_code = hal_comp_start(&p_comp_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_comp_stop(void) +{ + hal_status_t hal_err_code = HAL_ERROR; + + if ((p_comp_env == NULL) || (p_comp_env->comp_state == APP_COMP_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + comp_wake_up(); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + pwr_mgmt_wakeup_source_clear(PWR_WKUP_COND_MSIO_COMP); +#endif + + hal_err_code = hal_comp_stop(&p_comp_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} + +comp_handle_t *app_comp_get_handle(void) +{ + if ((p_comp_env == NULL) || (p_comp_env->comp_state == APP_COMP_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + comp_wake_up(); +#endif + + return &p_comp_env->handle; +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dma.c new file mode 100644 index 0000000..bbe9aa6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dma.c @@ -0,0 +1,561 @@ +/** + **************************************************************************************** + * @file app_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include +#include +#include "gr_soc.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +#define DMA_HANDLE_MAX 5 +#elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define DMA_HANDLE_MAX 8 +#elif (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#define DMA_HANDLE_MAX 12 +#endif + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool dma_prepare_for_sleep(void); +static void dma_wake_up_ind(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static bool s_sleep_cb_registered_flag = false; +dma_env_t s_dma_env[DMA_HANDLE_MAX]; +static pwr_id_t s_dma_pwr_id = -1; + +static const app_sleep_callbacks_t dma_sleep_cb = +{ + .app_prepare_for_sleep = dma_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = dma_wake_up_ind, +}; + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +SECTION_RAM_CODE void DMA0_IRQHandler(void) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if ((s_dma_env[i].dma_state == APP_DMA_ACTIVITY) && (s_dma_env[i].handle.p_instance == DMA0)) + { + hal_dma_irq_handler(&s_dma_env[i].handle); + } + } +} +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +SECTION_RAM_CODE void DMA1_IRQHandler(void) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if ((s_dma_env[i].dma_state == APP_DMA_ACTIVITY) && (s_dma_env[i].handle.p_instance == DMA1)) + { + hal_dma_irq_handler(&s_dma_env[i].handle); + } + } +} +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +SECTION_RAM_CODE void DMA_IRQHandler(void) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if (s_dma_env[i].dma_state == APP_DMA_ACTIVITY) + { + hal_dma_irq_handler(&s_dma_env[i].handle); + } + } +} +#endif + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool dma_prepare_for_sleep(void) +{ + hal_dma_state_t state; + + for (uint8_t i = 0; i < DMA_HANDLE_MAX; i++) + { + if (s_dma_env[i].dma_state == APP_DMA_ACTIVITY) + { + state = hal_dma_get_state(&s_dma_env[i].handle); + if ((state != HAL_DMA_STATE_RESET) && (state != HAL_DMA_STATE_READY)) + { + return false; + } + hal_dma_suspend_reg(&s_dma_env[i].handle); + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + s_dma_env[i].dma_state = APP_DMA_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE static void dma_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + bool find = false; +#endif + + for (uint8_t i = 0; i < DMA_HANDLE_MAX; i++) + { + if (s_dma_env[i].dma_state == APP_DMA_ACTIVITY) + { + hal_dma_resume_reg(&s_dma_env[i].handle); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + find = true; +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + if (DMA0 == s_dma_env[i].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA0_IRQn)) + { + hal_nvic_clear_pending_irq(DMA0_IRQn); + hal_nvic_enable_irq(DMA0_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (DMA1 == s_dma_env[i].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA1_IRQn)) + { + hal_nvic_clear_pending_irq(DMA1_IRQn); + hal_nvic_enable_irq(DMA1_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (find) + { + hal_nvic_clear_pending_irq(DMA_IRQn); + hal_nvic_enable_irq(DMA_IRQn); + } +#endif + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void dma_wake_up(dma_id_t id) +{ + if (id < 0 || id >= DMA_HANDLE_MAX) + return; + + if (s_dma_env[id].dma_state == APP_DMA_SLEEP) + { + hal_dma_resume_reg(&s_dma_env[id].handle); + s_dma_env[id].dma_state = APP_DMA_ACTIVITY; + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + if(DMA0 == s_dma_env[id].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA0_IRQn)) + { + hal_nvic_clear_pending_irq(DMA0_IRQn); + hal_nvic_enable_irq(DMA0_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if(DMA1 == s_dma_env[id].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA1_IRQn)) + { + hal_nvic_clear_pending_irq(DMA1_IRQn); + hal_nvic_enable_irq(DMA1_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (!NVIC_GetEnableIRQ(DMA_IRQn)) + { + hal_nvic_clear_pending_irq(DMA_IRQn); + hal_nvic_enable_irq(DMA_IRQn); + } +#endif + } +} +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +void dma_tfr_callback(struct _dma_handle *hdma) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if ((s_dma_env[i].dma_state == APP_DMA_ACTIVITY) && + (s_dma_env[i].handle.channel == hdma->channel) +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + && (s_dma_env[i].handle.p_instance == hdma->p_instance) +#endif + ) + { + if(NULL != s_dma_env[i].evt_handler) + { + s_dma_env[i].evt_handler(APP_DMA_EVT_TFR); + } + break; + } + } +} + +void dma_err_callback(struct _dma_handle * hdma) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if ((s_dma_env[i].dma_state == APP_DMA_ACTIVITY) && + (s_dma_env[i].handle.channel == hdma->channel) +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + && (s_dma_env[i].handle.p_instance == hdma->p_instance) +#endif + ) + + { + if(NULL != s_dma_env[i].evt_handler) + { + s_dma_env[i].evt_handler(APP_DMA_EVT_ERROR); + } + break; + } + } +} + +void dma_blk_callback(struct _dma_handle * hdma) +{ + uint8_t i; + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if ((s_dma_env[i].dma_state == APP_DMA_ACTIVITY) && + (s_dma_env[i].handle.channel == hdma->channel) +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + && (s_dma_env[i].handle.p_instance == hdma->p_instance) +#endif + ) + { + if(NULL != s_dma_env[i].evt_handler) + { + s_dma_env[i].evt_handler(APP_DMA_EVT_BLK); + } + break; + } + } +} + +dma_id_t app_dma_init(app_dma_params_t *p_params, app_dma_evt_handler_t evt_handler) +{ + uint8_t i = 0; + dma_id_t id = -1; + hal_status_t status = HAL_ERROR; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + soc_register_nvic(DMA_IRQn, (uint32_t)DMA_IRQHandler); +#else + soc_register_nvic(DMA0_IRQn, (uint32_t)DMA0_IRQHandler); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + soc_register_nvic(DMA1_IRQn, (uint32_t)DMA1_IRQHandler); +#endif + + if (NULL != p_params) + { + if(!IS_DMA_ALL_INSTANCE(p_params->channel_number)) + { + return -1; + } + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < DMA_HANDLE_MAX; i++) + { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (s_dma_env[i].dma_state == APP_DMA_INVALID || \ + s_dma_env[i].handle.channel == p_params->channel_number) +#else + if (s_dma_env[i].dma_state == APP_DMA_INVALID || \ + (s_dma_env[i].handle.p_instance == p_params->p_instance && \ + s_dma_env[i].handle.channel == p_params->channel_number)) +#endif + { + if(HAL_DMA_STATE_BUSY == s_dma_env[i].handle.state) + { + i = DMA_HANDLE_MAX; + break; + } + else + { + id = i; + s_dma_env[i].dma_state = APP_DMA_ACTIVITY; + break; + } + } + } + GLOBAL_EXCEPTION_ENABLE(); + + if (i < DMA_HANDLE_MAX) + { + if (s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_dma_pwr_id = pwr_register_sleep_cb(&dma_sleep_cb, APP_DRIVER_DMA_WAPEUP_PRIORITY); + } +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + s_dma_env[i].handle.p_instance = p_params->p_instance; +#endif + s_dma_env[i].handle.channel = p_params->channel_number; + memcpy(&s_dma_env[i].handle.init, &p_params->init, sizeof(dma_init_t)); + s_dma_env[i].handle.xfer_tfr_callback = dma_tfr_callback; + s_dma_env[i].handle.xfer_error_callback = dma_err_callback; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + s_dma_env[i].handle.xfer_blk_callback = dma_blk_callback; +#endif + s_dma_env[i].handle.xfer_abort_callback = NULL; + s_dma_env[i].evt_handler = evt_handler; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + if(DMA0 == s_dma_env[i].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA0_IRQn)) + { + hal_nvic_clear_pending_irq(DMA0_IRQn); + hal_nvic_enable_irq(DMA0_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (DMA1 == s_dma_env[i].handle.p_instance) + { + if (!NVIC_GetEnableIRQ(DMA1_IRQn)) + { + hal_nvic_clear_pending_irq(DMA1_IRQn); + hal_nvic_enable_irq(DMA1_IRQn); + } + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + hal_nvic_clear_pending_irq(DMA_IRQn); + hal_nvic_enable_irq(DMA_IRQn); +#endif + + status = hal_dma_init(&s_dma_env[i].handle); + } + } + + if (HAL_OK != status) + { + id = -1; + } + + return id; +} + +uint16_t app_dma_deinit(dma_id_t id) +{ + uint8_t i; + + if ((id < 0) || (id >= DMA_HANDLE_MAX)) + { + return APP_DRV_ERR_INVALID_ID; + } + + if (s_dma_env[id].dma_state == APP_DMA_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_dma_deinit(&s_dma_env[id].handle); + s_dma_env[id].dma_state = APP_DMA_INVALID; + s_dma_env[id].handle.channel = (dma_channel_t)(-1); + + for (i = 0; i < DMA_HANDLE_MAX; i++) + { + if (s_dma_env[i].dma_state == APP_DMA_ACTIVITY) + { + break; + } + } + + if (i == DMA_HANDLE_MAX) + { + pwr_unregister_sleep_cb(s_dma_pwr_id); + s_dma_pwr_id = -1; + s_sleep_cb_registered_flag = false; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + hal_nvic_disable_irq(DMA0_IRQn); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + hal_nvic_disable_irq(DMA1_IRQn); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + hal_nvic_disable_irq(DMA_IRQn); +#endif + } + GLOBAL_EXCEPTION_ENABLE(); + + return APP_DRV_SUCCESS; +} + +dma_handle_t *app_dma_get_handle(dma_id_t id) +{ + if ((id < 0) || (id >= DMA_HANDLE_MAX)) + { + return NULL; + } + + if (s_dma_env[id].dma_state == APP_DMA_INVALID) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dma_wake_up(id); +#endif + + return &s_dma_env[id].handle; +} + +uint16_t app_dma_start(dma_id_t id, uint32_t src_address, uint32_t dst_address, uint32_t data_length) +{ + hal_status_t status = HAL_ERROR; + + if ((id < 0) || (id >= DMA_HANDLE_MAX)) + { + return APP_DRV_ERR_INVALID_ID; + } + + if (s_dma_env[id].dma_state == APP_DMA_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((data_length < 1) || (data_length > 0xFFF)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dma_wake_up(id); +#endif + + status = hal_dma_start_it(&s_dma_env[id].handle, src_address, dst_address, data_length); + if (HAL_OK != status) + { + return (uint16_t)status; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +uint16_t app_dma_start_sg_llp(dma_id_t id, uint32_t src_address, uint32_t dst_address, uint32_t data_length, dma_sg_llp_config_t *sg_llp_config) +{ + hal_status_t status = HAL_ERROR; + + if ((id < 0) || (id >= DMA_HANDLE_MAX)) + { + return APP_DRV_ERR_INVALID_ID; + } + + if (s_dma_env[id].dma_state == APP_DMA_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((data_length < 1) || (data_length > 0xFFF)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dma_wake_up(id); +#endif + + status = hal_dma_start_sg_llp_it(&s_dma_env[id].handle, src_address, dst_address, data_length, sg_llp_config); + if (HAL_OK != status) + { + return (uint16_t)status; + } + + return APP_DRV_SUCCESS; +} +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dual_tim.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dual_tim.c new file mode 100644 index 0000000..7cee17a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_dual_tim.c @@ -0,0 +1,701 @@ +/** + **************************************************************************************** + * @file app_dual_tim.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_dual_tim.h" +#include "app_drv.h" +#include "string.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" + +#ifdef HAL_DUAL_TIMER_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool dual_tim_prepare_for_sleep(void); +static void dual_tim_wake_up_ind(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const IRQn_Type s_dual_tim_irq[APP_DUAL_TIM_ID_MAX] = { DUAL_TIMER_IRQn, DUAL_TIMER_IRQn }; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +static const uint32_t s_dual_tim_instance[APP_DUAL_TIM_ID_MAX] = { DUAL_TIMER0_BASE, DUAL_TIMER1_BASE }; +#else +static const uint32_t s_dual_tim_instance[APP_DUAL_TIM_ID_MAX] = { DUAL_TIM0_BASE, DUAL_TIM1_BASE }; +#endif + +static bool s_sleep_cb_registered_flag = false; +static dual_tim_env_t *p_dual_tim_env[APP_DUAL_TIM_ID_MAX]; +static pwr_id_t s_dual_tim_pwr_id; + +const static app_sleep_callbacks_t dual_tim_sleep_cb = +{ + .app_prepare_for_sleep = dual_tim_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = dual_tim_wake_up_ind, +}; + +SECTION_RAM_CODE void DUAL_TIMER_IRQHandler(void) +{ + if (p_dual_tim_env[0] != NULL) + { + if (p_dual_tim_env[0]->dual_tim_state != APP_DUAL_TIM_INVALID) + { + hal_dual_timer_irq_handler(&p_dual_tim_env[0]->handle); + } + } + + if (p_dual_tim_env[1] != NULL) + { + if (p_dual_tim_env[1]->dual_tim_state != APP_DUAL_TIM_INVALID) + { + hal_dual_timer_irq_handler(&p_dual_tim_env[1]->handle); + } + } +} + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool dual_tim_prepare_for_sleep(void) +{ +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + for (uint8_t i = 0; i < APP_DUAL_TIM_ID_MAX; i++) + { + if (p_dual_tim_env[i] == NULL) + { + continue; + } + if (p_dual_tim_env[i]->dual_tim_state == APP_DUAL_TIM_ACTIVITY) + { + p_dual_tim_env[i]->dual_tim_state = APP_DUAL_TIM_SLEEP; + } + } +#endif + + return true; +} + +SECTION_RAM_CODE static void dual_tim_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + for (uint8_t i = 0; i < APP_DUAL_TIM_ID_MAX; i++) + { + if (p_dual_tim_env[i] == NULL) + { + continue; + } + + if (p_dual_tim_env[i]->dual_tim_state == APP_DUAL_TIM_ACTIVITY) + { + hal_nvic_clear_pending_irq(s_dual_tim_irq[i]); + hal_nvic_enable_irq(s_dual_tim_irq[i]); + + hal_dual_timer_base_deinit(&p_dual_tim_env[i]->handle); + hal_dual_timer_base_init(&p_dual_tim_env[i]->handle); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +static void dual_tim_wake_up(app_dual_tim_id_t id) +{ + if (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_SLEEP) + { + hal_nvic_clear_pending_irq(s_dual_tim_irq[id]); + hal_nvic_enable_irq(s_dual_tim_irq[id]); + + hal_dual_timer_base_deinit(&p_dual_tim_env[id]->handle); + hal_dual_timer_base_init(&p_dual_tim_env[id]->handle); + p_dual_tim_env[id]->dual_tim_state = APP_DUAL_TIM_ACTIVITY; + } +} +#endif + +static void app_dual_tim_event_call(dual_timer_handle_t *p_dual_tim, app_dual_tim_evt_t evt_type) +{ + app_dual_tim_evt_t dual_tim_evt = APP_DUAL_TIM_EVT_ERROR; + app_dual_tim_id_t id = APP_DUAL_TIM_ID_0; + + if (p_dual_tim->p_instance == DUAL_TIMER0) + { + id = APP_DUAL_TIM_ID_0; + } + else if (p_dual_tim->p_instance == DUAL_TIMER1) + { + id = APP_DUAL_TIM_ID_1; + } + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + if (evt_type == APP_DUAL_TIM_EVT_DONE) + { + dual_tim_evt = APP_DUAL_TIM_EVT_DONE; + } + else if(evt_type == APP_DUAL_TIM_EVT_ACT_START) + { + dual_tim_evt = APP_DUAL_TIM_EVT_ACT_START; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOA_ACT_C1) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOA_ACT_C1; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOA_ACT_C2) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOA_ACT_C2; + } + else if(evt_type == APP_DUAL_TIM_EVT_ACT_PERIOD) + { + dual_tim_evt = APP_DUAL_TIM_EVT_ACT_PERIOD; + } + else if(evt_type == APP_DUAL_TIM_EVT_ACT_STOP) + { + dual_tim_evt = APP_DUAL_TIM_EVT_ACT_STOP; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOB_ACT_C1) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOB_ACT_C1; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOB_ACT_C2) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOB_ACT_C2; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOC_ACT_C1) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOC_ACT_C1; + } + else if(evt_type == APP_DUAL_TIM_EVT_IOC_ACT_C2) + { + dual_tim_evt = APP_DUAL_TIM_EVT_IOC_ACT_C2; + } +#else + if (evt_type == APP_DUAL_TIM_EVT_DONE) + { + dual_tim_evt = APP_DUAL_TIM_EVT_DONE; + } +#endif + + if (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID) + { + dual_tim_evt = APP_DUAL_TIM_EVT_ERROR; + } + + if (p_dual_tim_env[id]->evt_handler != NULL) + { + p_dual_tim_env[id]->evt_handler(&dual_tim_evt); + } +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +static uint16_t dual_timer_gpio_config(dual_timer_io_ctrl_cfg_t *io_crtl_cfg, app_dual_tim_id_t id, app_dual_tim_pin_t *pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (id == APP_DUAL_TIM_ID_0) + { + switch (io_crtl_cfg->channel) + { + case HAL_DUAL_TIMER_CHANNEL_A: + io_init.mux = APP_IO_MUX_49; + break; + case HAL_DUAL_TIMER_CHANNEL_B: + io_init.mux = APP_IO_MUX_50; + break; + case HAL_DUAL_TIMER_CHANNEL_C: + io_init.mux = APP_IO_MUX_51; + break; + default: + return APP_DRV_ERR_INVALID_PARAM; + } + } + else if (id == APP_DUAL_TIM_ID_1) + { + switch (io_crtl_cfg->channel) + { + case HAL_DUAL_TIMER_CHANNEL_A: + io_init.mux = APP_IO_MUX_52; + break; + case HAL_DUAL_TIMER_CHANNEL_B: + io_init.mux = APP_IO_MUX_53; + break; + case HAL_DUAL_TIMER_CHANNEL_C: + io_init.mux = APP_IO_MUX_54; + break; + default: + return APP_DRV_ERR_INVALID_PARAM; + } + } + else + { + return APP_DRV_ERR_INVALID_PARAM; + } + + io_init.pull = APP_IO_NOPULL; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg->pin; + err_code = app_io_init(pin_cfg->type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + return err_code; +} +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_dual_tim_init(app_dual_tim_params_t *p_params, app_dual_tim_evt_handler_t evt_handler) +{ + app_dual_tim_id_t id = p_params->id; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if (0x0 == p_params->init.auto_reload) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + p_dual_tim_env[id] = &(p_params->dual_tim_env); + + soc_register_nvic(DUAL_TIMER_IRQn, (uint32_t)DUAL_TIMER_IRQHandler); + hal_nvic_clear_pending_irq(s_dual_tim_irq[id]); + hal_nvic_enable_irq(s_dual_tim_irq[id]); + + p_dual_tim_env[id]->evt_handler = evt_handler; + + memcpy(&p_dual_tim_env[id]->handle.init, &p_params->init, sizeof(dual_timer_init_t)); + p_dual_tim_env[id]->handle.p_instance = (dual_timer_regs_t *)s_dual_tim_instance[id]; + hal_err_code = hal_dual_timer_base_deinit(&p_dual_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_dual_timer_base_init(&p_dual_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if(s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_dual_tim_pwr_id = pwr_register_sleep_cb(&dual_tim_sleep_cb, APP_DRIVER_DUAL_TIM_WAPEUP_PRIORITY); + + if (s_dual_tim_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_dual_tim_env[id]->dual_tim_state = APP_DUAL_TIM_ACTIVITY; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + p_dual_tim_env[id]->is_cha_enable = false; + p_dual_tim_env[id]->is_chb_enable = false; + p_dual_tim_env[id]->is_chc_enable = false; +#endif + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_deinit(app_dual_tim_id_t id) +{ + uint8_t i; + hal_status_t hal_err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ( (p_dual_tim_env[0]->dual_tim_state == APP_DUAL_TIM_INVALID) && + (p_dual_tim_env[1]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + hal_nvic_disable_irq(s_dual_tim_irq[id]); + } + + p_dual_tim_env[id]->dual_tim_state = APP_DUAL_TIM_INVALID; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + if (p_dual_tim_env[id]->is_cha_enable == true) + { + app_io_deinit(p_dual_tim_env[id]->cha_pin_cfg.type, p_dual_tim_env[id]->cha_pin_cfg.pin); + } + if (p_dual_tim_env[id]->is_chb_enable == true) + { + app_io_deinit(p_dual_tim_env[id]->chb_pin_cfg.type, p_dual_tim_env[id]->chb_pin_cfg.pin); + } + if (p_dual_tim_env[id]->is_chc_enable == true) + { + app_io_deinit(p_dual_tim_env[id]->chc_pin_cfg.type, p_dual_tim_env[id]->chc_pin_cfg.pin); + } + p_dual_tim_env[id]->is_cha_enable = false; + p_dual_tim_env[id]->is_chb_enable = false; + p_dual_tim_env[id]->is_chc_enable = false; +#endif + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_DUAL_TIM_ID_MAX; i++) + { + if (p_dual_tim_env[i] != NULL && (p_dual_tim_env[i]->dual_tim_state) != APP_DUAL_TIM_INVALID) + { + break; + } + } + if (APP_DUAL_TIM_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_dual_tim_pwr_id); + s_dual_tim_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_dual_timer_base_deinit(&p_dual_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + p_dual_tim_env[id] = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_start(app_dual_tim_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_base_start_it(&p_dual_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_stop(app_dual_tim_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_base_stop_it(&p_dual_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_set_params(app_dual_tim_params_t *p_params, app_dual_tim_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_set_config(&p_dual_tim_env[id]->handle, &p_params->init); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_set_background_reload(app_dual_tim_id_t id, uint32_t reload_value) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (reload_value == 0x0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_set_background_reload(&p_dual_tim_env[id]->handle, reload_value); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +uint16_t app_dual_tim_set_onetime_reload(app_dual_tim_id_t id, uint32_t reload_value) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (reload_value == 0x0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_set_onetime_reload(&p_dual_tim_env[id]->handle, reload_value); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_set_period_count(app_dual_tim_id_t id, uint32_t count_value) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_dual_tim_env[id]->is_cha_enable == false && + p_dual_tim_env[id]->is_chb_enable == false && + p_dual_tim_env[id]->is_chc_enable == false) || + count_value < 0x2 || + count_value > 0xFFFF) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + err_code = hal_dual_timer_set_period_count(&p_dual_tim_env[id]->handle, count_value); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_dual_tim_io_crtl_config(app_dual_tim_id_t id, app_dual_tim_io_crtl_params_t *io_crtl_params) +{ + hal_status_t err_code; + + if (id >= APP_DUAL_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (io_crtl_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + switch (io_crtl_params->io_crtl_cfg.channel) + { + case HAL_DUAL_TIMER_CHANNEL_A: + p_dual_tim_env[id]->is_cha_enable = true; + memcpy(&p_dual_tim_env[id]->cha_pin_cfg, &io_crtl_params->pin_cfg, sizeof(app_dual_tim_pin_t)); + break; + case HAL_DUAL_TIMER_CHANNEL_B: + p_dual_tim_env[id]->is_chb_enable = true; + memcpy(&p_dual_tim_env[id]->chb_pin_cfg, &io_crtl_params->pin_cfg, sizeof(app_dual_tim_pin_t)); + break; + case HAL_DUAL_TIMER_CHANNEL_C: + p_dual_tim_env[id]->is_chc_enable = true; + memcpy(&p_dual_tim_env[id]->chc_pin_cfg, &io_crtl_params->pin_cfg, sizeof(app_dual_tim_pin_t)); + break; + default: + return APP_DRV_ERR_INVALID_PARAM; + } + + err_code = (hal_status_t)dual_timer_gpio_config(&io_crtl_params->io_crtl_cfg, id, &io_crtl_params->pin_cfg); + HAL_ERR_CODE_CHECK(err_code); + + err_code = hal_dual_timer_io_crtl_config(&p_dual_tim_env[id]->handle, &io_crtl_params->io_crtl_cfg); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} +#endif + +dual_timer_handle_t *app_dual_tim_get_handle(app_dual_tim_id_t id) +{ + if (id >= APP_DUAL_TIM_ID_MAX) + { + return NULL; + } + + if ((p_dual_tim_env[id] == NULL) || (p_dual_tim_env[id]->dual_tim_state == APP_DUAL_TIM_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + dual_tim_wake_up(id); +#endif + + return &p_dual_tim_env[id]->handle; +} + +void hal_dual_timer_period_elapsed_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_DONE); +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +void hal_dual_timer_act_start_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_ACT_START); +} + +void hal_dual_timer_ioa_act_c1_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOA_ACT_C1); +} + +void hal_dual_timer_ioa_act_c2_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOA_ACT_C2); +} + +void hal_dual_timer_act_period_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_ACT_PERIOD); +} + +void hal_dual_timer_act_stop_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_ACT_STOP); +} + +void hal_dual_timer_iob_act_c1_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOB_ACT_C1); +} + +void hal_dual_timer_iob_act_c2_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOB_ACT_C2); +} + +void hal_dual_timer_ioc_act_c1_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOC_ACT_C1); +} + +void hal_dual_timer_ioc_act_c2_event_callback(dual_timer_handle_t *p_dual_timer) +{ + app_dual_tim_event_call(p_dual_timer, APP_DUAL_TIM_EVT_IOC_ACT_C2); +} + +#endif + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_gpiote.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_gpiote.c new file mode 100644 index 0000000..d146a45 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_gpiote.c @@ -0,0 +1,94 @@ +/** + **************************************************************************************** + * @file app_gpiote.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "app_gpiote.h" + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_gpiote_init(const app_gpiote_param_t *p_params, uint8_t table_cnt) +{ + app_io_init_t io_init; + app_drv_err_t err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + for (uint8_t idx = 0; idx < table_cnt; idx++) + { + io_init.pin = p_params[idx].pin; + io_init.mode = p_params[idx].mode; + io_init.pull = p_params[idx].pull; + io_init.mux = APP_IO_MUX; + err_code = app_io_event_register_cb(p_params[idx].type, &io_init, p_params[idx].io_evt_cb, NULL); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_gpiote_config(const app_gpiote_param_t *p_config) +{ + app_io_init_t io_init; + app_drv_err_t err_code; + + if (NULL == p_config) + { + return APP_DRV_ERR_POINTER_NULL; + } + + io_init.pin = p_config->pin; + io_init.mode = p_config->mode; + io_init.pull = p_config->pull; + io_init.mux = APP_IO_MUX; + + err_code = app_io_event_register_cb(p_config->type, &io_init, p_config->io_evt_cb, NULL); + APP_DRV_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_gpiote_deinit(app_io_type_t type, uint32_t pin) +{ + return app_io_event_unregister(type, pin); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_graphics_qspi.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_graphics_qspi.c new file mode 100644 index 0000000..212a176 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_graphics_qspi.c @@ -0,0 +1,1543 @@ +/** + **************************************************************************************** + * @file app_graphics_qspi.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_assert.h" +#include "app_qspi.h" +#include "app_qspi_dma.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include +#include "platform_sdk.h" +#include "app_drv.h" +#include "gr_soc.h" + +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) +#include "app_graphics_qspi.h" +#include "gr55xx_ll_qspi.h" + +#ifdef HAL_QSPI_MODULE_ENABLED +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_QSPI_EXCEPT_DEBUG_EN 1u +#define APP_QSPI_IN_DEBUG_MODE 0 +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) +static bool app_qspi_switch_dma_mode(app_qspi_id_t id, bool is_m2m_mode); +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) +static bool app_qspi_cmd_llp_transmit(app_qspi_id_t screen_id, app_qspi_command_t * p_cmd, dma_llp_config_t * p_llp_config, bool is_sync); +static bool app_qspi_llp_transmit(app_qspi_id_t screen_id, dma_llp_config_t * p_llp_config, uint32_t data_mode, uint32_t data_len, bool is_sync); +#endif +static void app_qspi_dma_evt_handler_0(app_dma_evt_type_t type); +static void app_qspi_dma_evt_handler_1(app_dma_evt_type_t type); +static void app_qspi_dma_evt_handler_2(app_dma_evt_type_t type); +extern bool app_qspi_mmap_set_prefetch(app_qspi_id_t id, bool prefetch_en); +extern void app_qspi_force_cs(app_qspi_id_t screen_id, bool low_level); +#endif +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const app_dma_evt_handler_t s_dma_evt_handler[APP_QSPI_ID_MAX] = {app_qspi_dma_evt_handler_0, app_qspi_dma_evt_handler_1, app_qspi_dma_evt_handler_2}; +extern const uint32_t s_qspi_instance[APP_QSPI_ID_MAX]; +extern qspi_env_t *p_qspi_env[APP_QSPI_ID_MAX]; + +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) + static dma_block_config_t s_dma_llp_block[DMA_LLP_BLOCKS_FOR_WRITE*2 + 1]; + app_qspi_async_draw_screen_info_t s_async_write_screen_info; +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ + +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) +bool app_qspi_dma_mmap_read_block(app_qspi_id_t id, uint32_t address, uint8_t * buffer, uint32_t length) { + hal_status_t status; + bool ret = true; + APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + + app_qspi_mmap_set_endian_mode(id, APP_QSPI_MMAP_ENDIAN_MODE_0); + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_mmap_set_prefetch(id, true); + ret = app_qspi_switch_dma_mode(id, true); + if(ret) { + p_qspi_env[id]->is_dma_done = 0; + p_qspi_env[id]->is_xfer_err = 0; + status = hal_dma_start_it(p_qspi_env[id]->handle.p_dma, ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]) + address, (uint32_t)buffer, length); + if(HAL_OK == status) { + while(!p_qspi_env[id]->is_dma_done && !p_qspi_env[id]->is_xfer_err); + if(p_qspi_env[id]->is_xfer_err) { + ret = false; + } + } else { + ret = false; + } + } + + app_qspi_mmap_set_prefetch(id, false); + return ret; +} + + +#if APP_QSPI_IN_DEBUG_MODE +bool app_qspi_sync_draw_screen(app_qspi_id_t screen_id, app_qspi_id_t storage_id, const app_qspi_screen_command_t * const p_screen_cmd, const app_qspi_screen_info_t * const p_screen_info, app_qspi_screen_scroll_t * p_scroll_config) { + +#if (QSPI_SYNC_SCROLL_DRAW_SCREEN_SUPPORT > 0u) + + app_qspi_command_t app_scrn_cmd; + dma_llp_config_t scrn_llp_config; + app_qspi_screen_scroll_t s_scroll_config; + uint32_t this_send_lines = 0; + uint32_t sent_lines = 0; + uint32_t image_start_address = 0; + uint32_t j = 0; + uint32_t llp_cfg_right_shift_bit = 0; + uint32_t llp_cfg_ctrl_low = 0; + uint32_t sent_line_order = 0; + bool ret = false; + bool is_lead_addr = true; + bool is_stored_in_qspi_storage = false; + + const uint32_t scrn_pixel_height = p_screen_info->scrn_pixel_height; + const uint32_t scrn_pixel_width = p_screen_info->scrn_pixel_width; + const uint32_t scrn_pixel_depth = p_screen_info->scrn_pixel_depth; + const uint32_t scrn_line_size = (scrn_pixel_width * scrn_pixel_depth); + const uint32_t scrn_refresh_lines_once = (QSPI_MAX_XFER_SIZE_ONCE/scrn_line_size); + const uint32_t send_lines_once = DMA_LLP_BLOCKS_FOR_WRITE < scrn_refresh_lines_once ? DMA_LLP_BLOCKS_FOR_WRITE : scrn_refresh_lines_once; + + if((p_screen_cmd == NULL) || (p_screen_info == NULL) || (p_scroll_config == NULL)) { + return false; + } + + if(storage_id <= APP_QSPI_ID_2) { + is_stored_in_qspi_storage = true; + } else if (storage_id == APP_STORAGE_RAM_ID) { + is_stored_in_qspi_storage = false; + } else { + return false; + } + + if(screen_id == storage_id) { + return false; + } + + if ((p_qspi_env[screen_id] == NULL) || (p_qspi_env[screen_id]->qspi_state == APP_QSPI_INVALID) || + (p_qspi_env[storage_id] == NULL) || (p_qspi_env[storage_id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + /* check screen height/width/depth */ + if((scrn_pixel_width % 2 != 0) || + (scrn_pixel_height % 2 != 0) || + (scrn_pixel_depth != 2)) { + return false; + } + + if (p_qspi_env[screen_id]->start_flag || (is_stored_in_qspi_storage && p_qspi_env[storage_id]->start_flag)) { + return false; + } + + p_qspi_env[screen_id]->start_flag = true; + if(is_stored_in_qspi_storage) p_qspi_env[storage_id]->start_flag = true; + + if(is_stored_in_qspi_storage) + { + app_qspi_mmap_set_prefetch(storage_id, true); + } + + APP_ASSERT_CHECK(p_qspi_env[screen_id]->is_used_dma); + app_qspi_switch_dma_mode(screen_id, false); + + if(QSPI_DATASIZE_08_BITS == p_screen_cmd->data_size) { + llp_cfg_right_shift_bit = 0; + llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_BYTE, DMA_DDATAALIGN_BYTE, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_0); + } else if (QSPI_DATASIZE_16_BITS == p_screen_cmd->data_size) { + llp_cfg_right_shift_bit = 1; + llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_HALFWORD, DMA_DDATAALIGN_HALFWORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_1); + } else if (QSPI_DATASIZE_32_BITS == p_screen_cmd->data_size) { + llp_cfg_right_shift_bit = 2; + llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_2); + } else { + p_qspi_env[screen_id]->start_flag = false; + if(is_stored_in_qspi_storage) p_qspi_env[storage_id]->start_flag = false; + + return false; + } + + memcpy(&s_scroll_config, p_scroll_config, sizeof(app_qspi_screen_scroll_t)); + + /* check and adjust start & end coordinate */ + if(s_scroll_config.is_horizontal_scroll) { + if(s_scroll_config.scroll_coordinate > scrn_pixel_width) { + s_scroll_config.scroll_coordinate = scrn_pixel_width; + } + + } else { + if(s_scroll_config.scroll_coordinate > scrn_pixel_height) { + s_scroll_config.scroll_coordinate = scrn_pixel_height; + } + } + + /* adjust scroll_coordinate to even number */ + s_scroll_config.scroll_coordinate = (s_scroll_config.scroll_coordinate >> 1) << 1; + + const uint32_t image_1_ahb_address = p_scroll_config->first_frame_start_address; + const uint32_t image_2_ahb_address = p_scroll_config->second_frame_start_address; + + APP_ASSERT_CHECK(p_qspi_env[screen_id]->is_used_dma); + app_qspi_mmap_set_prefetch(storage_id, true); + + /* prepare llp config */ + scrn_llp_config.llp_src_writeback = 1; + scrn_llp_config.llp_dst_writeback = 1; + scrn_llp_config.llp_src_en = DMA_LLP_SRC_ENABLE; + scrn_llp_config.llp_dst_en = DMA_LLP_DST_DISABLE; + scrn_llp_config.head_lli = &s_dma_llp_block[0]; + + app_scrn_cmd.instruction = p_screen_cmd->instruction; + app_scrn_cmd.instruction_size = p_screen_cmd->instruction_size; + app_scrn_cmd.address = p_screen_cmd->leading_address; + app_scrn_cmd.address_size = p_screen_cmd->address_size; + app_scrn_cmd.dummy_cycles = p_screen_cmd->dummy_cycles; + app_scrn_cmd.data_size = p_screen_cmd->data_size; + app_scrn_cmd.instruction_address_mode = p_screen_cmd->instruction_address_mode; + app_scrn_cmd.data_mode = p_screen_cmd->data_mode; + app_scrn_cmd.length = 0x00; + app_scrn_cmd.clock_stretch_en = 1; + + is_lead_addr = true; + + if(s_scroll_config.is_horizontal_scroll) { + + if((s_scroll_config.scroll_coordinate == 0) || /* Only left image */ + (s_scroll_config.scroll_coordinate == scrn_pixel_width)) { /* Only right image */ + this_send_lines = 0; + sent_lines = 0; + + if(0 == s_scroll_config.scroll_coordinate) { + image_start_address = image_1_ahb_address; + } else { + image_start_address = image_2_ahb_address; + } + + while(sent_lines < scrn_pixel_height) { + this_send_lines = (scrn_pixel_height - sent_lines) < send_lines_once ? (scrn_pixel_height - sent_lines) : send_lines_once; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (this_send_lines*2 + 1)); + + for(j = 0; j < this_send_lines; j++) { + s_dma_llp_block[j].src_address = image_start_address + (sent_lines + j) * scrn_line_size ; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j + 1]; + s_dma_llp_block[j].CTL_L = llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + if(is_lead_addr) { + app_scrn_cmd.address = p_screen_cmd->leading_address; + is_lead_addr = false; + } else { + app_scrn_cmd.address = p_screen_cmd->ongoing_address; + } + + app_scrn_cmd.length = this_send_lines * scrn_line_size; + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, true); + + if(!ret) { + goto __fail; + } + + sent_lines += this_send_lines; + } + } else { /* part of left image, part of right image */ + this_send_lines = 0; + sent_lines = 0; + + while(sent_lines < scrn_pixel_height) { + this_send_lines = (scrn_pixel_height - sent_lines) < send_lines_once ? (scrn_pixel_height - sent_lines) : send_lines_once; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (this_send_lines*2 + 1)); + + for(j = 0; j < this_send_lines; j++) { + /* first image */ + s_dma_llp_block[2*j].src_address = image_1_ahb_address + (sent_lines + j) * scrn_line_size + s_scroll_config.scroll_coordinate * scrn_pixel_depth; + s_dma_llp_block[2*j].dst_address = 0; + s_dma_llp_block[2*j].p_lli = &s_dma_llp_block[2*j + 1]; + s_dma_llp_block[2*j].CTL_L = llp_cfg_ctrl_low; + s_dma_llp_block[2*j].CTL_H = (uint32_t)(((scrn_pixel_width - s_scroll_config.scroll_coordinate)*scrn_pixel_depth) >> llp_cfg_right_shift_bit); + s_dma_llp_block[2*j].src_status = 0x0; + s_dma_llp_block[2*j].dst_status = 0x0; + + /* second image */ + s_dma_llp_block[2*j + 1].src_address = image_2_ahb_address + (sent_lines + j) * scrn_line_size ; + s_dma_llp_block[2*j + 1].dst_address = 0; + s_dma_llp_block[2*j + 1].p_lli = &s_dma_llp_block[2*j + 2]; + s_dma_llp_block[2*j + 1].CTL_L = llp_cfg_ctrl_low; + s_dma_llp_block[2*j + 1].CTL_H = (uint32_t)((s_scroll_config.scroll_coordinate * scrn_pixel_depth) >> llp_cfg_right_shift_bit); + s_dma_llp_block[2*j + 1].src_status = 0x0; + s_dma_llp_block[2*j + 1].dst_status = 0x0; + + } + s_dma_llp_block[2*j - 1].p_lli = NULL; + + if(is_lead_addr) { + app_scrn_cmd.address = p_screen_cmd->leading_address; + is_lead_addr = false; + } else { + app_scrn_cmd.address = p_screen_cmd->ongoing_address; + } + app_scrn_cmd.length = this_send_lines * scrn_line_size; + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, true); + + if(!ret) { + goto __fail; + } + + sent_lines += this_send_lines; + } + } + } else { /* Scroll vertically */ + sent_line_order = s_scroll_config.scroll_coordinate; + this_send_lines = 0; + sent_lines = 0; + + while(sent_lines < scrn_pixel_height) { + + this_send_lines = (scrn_pixel_height - sent_lines) < send_lines_once ? (scrn_pixel_height - sent_lines) : send_lines_once; + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (this_send_lines*2 + 1)); + + for(j = 0; j < this_send_lines; j++) { + + image_start_address = sent_line_order < scrn_pixel_height ? image_1_ahb_address : image_2_ahb_address; + + s_dma_llp_block[j].src_address = image_start_address + (sent_line_order % scrn_pixel_height) * scrn_line_size ; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j + 1]; + s_dma_llp_block[j].CTL_L = llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + + sent_line_order ++; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + if(is_lead_addr) { + app_scrn_cmd.address = p_screen_cmd->leading_address; + is_lead_addr = false; + } else { + app_scrn_cmd.address = p_screen_cmd->ongoing_address; + } + + app_scrn_cmd.length = this_send_lines * scrn_line_size; + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, true); + + if(!ret) { + goto __fail; + } + + sent_lines += this_send_lines; + } + } + + p_qspi_env[screen_id]->start_flag = false; + if(is_stored_in_qspi_storage) p_qspi_env[storage_id]->start_flag = false; + return true; + +__fail: + p_qspi_env[screen_id]->start_flag = false; + if(is_stored_in_qspi_storage) p_qspi_env[storage_id]->start_flag = false; + return false; + +#else + return false; +#endif +} +#endif + +bool app_qspi_async_draw_screen(app_qspi_id_t screen_id, app_qspi_id_t storage_id, const app_qspi_screen_command_t * const p_screen_cmd, const app_qspi_screen_info_t * const p_screen_info, app_qspi_screen_scroll_t * p_scroll_config, bool is_first_call) { + +#if (QSPI_ASYNC_SCROLL_DRAW_SCREEN_SUPPORT > 0u) + + app_qspi_command_t app_scrn_cmd; + dma_llp_config_t scrn_llp_config; + uint32_t image_start_address = 0; + uint32_t j = 0; + bool ret = false; + bool is_stored_in_qspi_storage = false; + + if((p_screen_cmd == NULL) || (p_screen_info == NULL) || (p_scroll_config == NULL)) { + return false; + } + + if(screen_id > APP_QSPI_ID_2) { + return false; + } + + if((storage_id > APP_QSPI_ID_2) && (storage_id != APP_STORAGE_RAM_ID)) { + return false; + } + + if(screen_id == storage_id) { + return false; + } + + if(storage_id <= APP_QSPI_ID_2) { + is_stored_in_qspi_storage = true; + } else if (storage_id == APP_STORAGE_RAM_ID) { + is_stored_in_qspi_storage = false; + } else { + return false; + } + + if ((p_qspi_env[screen_id] == NULL) || (p_qspi_env[screen_id]->qspi_state == APP_QSPI_INVALID) || + (p_qspi_env[storage_id] == NULL) || (p_qspi_env[storage_id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if(p_qspi_env[screen_id]->is_async_write_screen && is_first_call) { + printf("RE-CALLED !\r\n"); + return false; + } + + if(is_first_call) { + if (p_qspi_env[screen_id]->start_flag || (is_stored_in_qspi_storage && p_qspi_env[storage_id]->start_flag)) { + printf("BUSY... !\r\n"); + return false; + } + + p_qspi_env[screen_id]->start_flag = true; + if(is_stored_in_qspi_storage){ + p_qspi_env[storage_id]->start_flag = true; + } + + memset(&s_async_write_screen_info, 0, sizeof(app_qspi_async_draw_screen_info_t)); + + s_async_write_screen_info.if_type = DRAW_TYPE_IF_DUAL_SCREEN; + s_async_write_screen_info.screen_id = screen_id; + s_async_write_screen_info.storage_id = storage_id; + + memcpy(&s_async_write_screen_info.qspi_screen_command, p_screen_cmd, sizeof(app_qspi_screen_command_t)); + memcpy(&s_async_write_screen_info.screen_info, p_screen_info, sizeof(app_qspi_screen_info_t)); + memcpy(&s_async_write_screen_info.ss.dual_ss.scroll_config, p_scroll_config, sizeof(app_qspi_screen_scroll_t)); + + /* check and adjust start & end coordinate */ + if(s_async_write_screen_info.ss.dual_ss.scroll_config.is_horizontal_scroll) { + if(s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate > p_screen_info->scrn_pixel_width) { + s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate = p_screen_info->scrn_pixel_width; + } + } else { + if(s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate > p_screen_info->scrn_pixel_height) { + s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate = p_screen_info->scrn_pixel_height; + } + } + + /* adjust scroll_coordinate to even number */ + s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate = (s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate >> 1) << 1; + + if(is_stored_in_qspi_storage) { + app_qspi_mmap_set_prefetch(storage_id, true); + } + APP_ASSERT_CHECK(p_qspi_env[screen_id]->is_used_dma); + app_qspi_switch_dma_mode(screen_id, false); + + if(QSPI_DATASIZE_08_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 0; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_BYTE, DMA_DDATAALIGN_BYTE, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_0); + } else if (QSPI_DATASIZE_16_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 1; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_HALFWORD, DMA_DDATAALIGN_HALFWORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_1); + } else if (QSPI_DATASIZE_32_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 2; + if(is_stored_in_qspi_storage) + { + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_4, LL_DMA_DST_BURST_LENGTH_4, DMA_SRC_GATHER_DISABLE);//BALIPRO-226:LL_DMA_SRC_BURST_LENGTH_8 will cause exception for qspi-psram data + } + else + { + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + } + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_2); + } else { + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } + + s_async_write_screen_info.ss.dual_ss.image_1_ahb_address = p_scroll_config->first_frame_start_address; + s_async_write_screen_info.ss.dual_ss.image_2_ahb_address = p_scroll_config->second_frame_start_address; + s_async_write_screen_info.ss.dual_ss.total_sent_lines = 0; + s_async_write_screen_info.ss.dual_ss.this_send_lines = 0; + s_async_write_screen_info.ss.dual_ss.sent_line_order = s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate; + } + + const uint32_t scrn_pixel_height = s_async_write_screen_info.screen_info.scrn_pixel_height; + const uint32_t scrn_pixel_width = s_async_write_screen_info.screen_info.scrn_pixel_width; + const uint32_t scrn_pixel_depth = s_async_write_screen_info.screen_info.scrn_pixel_depth; + const uint32_t scrn_line_size = (scrn_pixel_width * scrn_pixel_depth); + const uint32_t scrn_refresh_lines_once = (QSPI_MAX_XFER_SIZE_ONCE/scrn_line_size); + const uint32_t send_lines_once = DMA_LLP_BLOCKS_FOR_WRITE < scrn_refresh_lines_once ? DMA_LLP_BLOCKS_FOR_WRITE : scrn_refresh_lines_once; + + /* check screen height/width/depth */ + if((scrn_pixel_width % 2 != 0) || + (scrn_pixel_height % 2 != 0) || + (scrn_pixel_depth != 2) ) { + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } + + /* prepare llp config */ + scrn_llp_config.llp_src_writeback = 1; + scrn_llp_config.llp_dst_writeback = 1; + scrn_llp_config.llp_src_en = DMA_LLP_SRC_ENABLE; + scrn_llp_config.llp_dst_en = DMA_LLP_DST_DISABLE; + scrn_llp_config.head_lli = &s_dma_llp_block[0]; + + app_scrn_cmd.instruction = s_async_write_screen_info.qspi_screen_command.instruction; + app_scrn_cmd.instruction_size = s_async_write_screen_info.qspi_screen_command.instruction_size; + app_scrn_cmd.address = is_first_call ? s_async_write_screen_info.qspi_screen_command.leading_address : s_async_write_screen_info.qspi_screen_command.ongoing_address; + app_scrn_cmd.address_size = s_async_write_screen_info.qspi_screen_command.address_size; + app_scrn_cmd.dummy_cycles = s_async_write_screen_info.qspi_screen_command.dummy_cycles; + app_scrn_cmd.data_size = s_async_write_screen_info.qspi_screen_command.data_size; + app_scrn_cmd.instruction_address_mode = s_async_write_screen_info.qspi_screen_command.instruction_address_mode; + app_scrn_cmd.data_mode = s_async_write_screen_info.qspi_screen_command.data_mode; + app_scrn_cmd.length = 0x00; + app_scrn_cmd.clock_stretch_en = 1; + + if(s_async_write_screen_info.ss.dual_ss.scroll_config.is_horizontal_scroll) { + + if((s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate == 0) || /* Only left image */ + (s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate == scrn_pixel_width)) { /* Only right image */ + + if(0 == s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate) { + image_start_address = s_async_write_screen_info.ss.dual_ss.image_1_ahb_address; + } else { + image_start_address = s_async_write_screen_info.ss.dual_ss.image_2_ahb_address; + } + + if(s_async_write_screen_info.ss.dual_ss.total_sent_lines < scrn_pixel_height) { + s_async_write_screen_info.ss.dual_ss.this_send_lines = (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) < send_lines_once ? (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) : send_lines_once; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (s_async_write_screen_info.ss.dual_ss.this_send_lines*2 + 1)); + + for(j = 0; j < s_async_write_screen_info.ss.dual_ss.this_send_lines; j++) { + s_dma_llp_block[j].src_address = image_start_address + (s_async_write_screen_info.ss.dual_ss.total_sent_lines + j) * scrn_line_size ; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j + 1]; + s_dma_llp_block[j].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + app_scrn_cmd.length = s_async_write_screen_info.ss.dual_ss.this_send_lines * scrn_line_size; + + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + if(is_first_call) { + app_qspi_force_cs(screen_id, true); + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } else { + ret = app_qspi_llp_transmit(screen_id, &scrn_llp_config, app_scrn_cmd.data_mode, app_scrn_cmd.length, false); + } + } else { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + + if(!ret) { + goto __fail; + } + } + } else { /* part of left image, part of right image */ + + if(s_async_write_screen_info.ss.dual_ss.total_sent_lines < scrn_pixel_height) { + s_async_write_screen_info.ss.dual_ss.this_send_lines = (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) < send_lines_once ? (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) : send_lines_once; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (s_async_write_screen_info.ss.dual_ss.this_send_lines*2 + 1)); + + for(j = 0; j < s_async_write_screen_info.ss.dual_ss.this_send_lines; j++) { + /* first image */ + s_dma_llp_block[2*j].src_address = s_async_write_screen_info.ss.dual_ss.image_1_ahb_address + (s_async_write_screen_info.ss.dual_ss.total_sent_lines + j) * scrn_line_size + s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate * scrn_pixel_depth; + s_dma_llp_block[2*j].dst_address = 0; + s_dma_llp_block[2*j].p_lli = &s_dma_llp_block[2*j + 1]; + s_dma_llp_block[2*j].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[2*j].CTL_H = (uint32_t)(((scrn_pixel_width - s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate)*scrn_pixel_depth) >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[2*j].src_status = 0x0; + s_dma_llp_block[2*j].dst_status = 0x0; + + /* second image */ + s_dma_llp_block[2*j + 1].src_address = s_async_write_screen_info.ss.dual_ss.image_2_ahb_address + (s_async_write_screen_info.ss.dual_ss.total_sent_lines + j) * scrn_line_size ; + s_dma_llp_block[2*j + 1].dst_address = 0; + s_dma_llp_block[2*j + 1].p_lli = &s_dma_llp_block[2*j + 2]; + s_dma_llp_block[2*j + 1].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[2*j + 1].CTL_H = (uint32_t)((s_async_write_screen_info.ss.dual_ss.scroll_config.scroll_coordinate * scrn_pixel_depth) >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[2*j + 1].src_status = 0x0; + s_dma_llp_block[2*j + 1].dst_status = 0x0; + + } + s_dma_llp_block[2*j - 1].p_lli = NULL; + + app_scrn_cmd.length = s_async_write_screen_info.ss.dual_ss.this_send_lines * scrn_line_size; + + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + if(is_first_call) { + app_qspi_force_cs(screen_id, true); + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } else { + ret = app_qspi_llp_transmit(screen_id, &scrn_llp_config, app_scrn_cmd.data_mode, app_scrn_cmd.length, false); + } + } else { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + + if(!ret) { + goto __fail; + } + } + } + } else { /* Scroll vertically */ + + if(s_async_write_screen_info.ss.dual_ss.total_sent_lines < scrn_pixel_height) { + + s_async_write_screen_info.ss.dual_ss.this_send_lines = (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) < send_lines_once ? (scrn_pixel_height - s_async_write_screen_info.ss.dual_ss.total_sent_lines) : send_lines_once; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (s_async_write_screen_info.ss.dual_ss.this_send_lines*2 + 1)); + + for(j = 0; j < s_async_write_screen_info.ss.dual_ss.this_send_lines; j++) { + + image_start_address = s_async_write_screen_info.ss.dual_ss.sent_line_order < scrn_pixel_height ? s_async_write_screen_info.ss.dual_ss.image_1_ahb_address : s_async_write_screen_info.ss.dual_ss.image_2_ahb_address; + + s_dma_llp_block[j].src_address = image_start_address + (s_async_write_screen_info.ss.dual_ss.sent_line_order % scrn_pixel_height) * scrn_line_size ; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j + 1]; + s_dma_llp_block[j].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + + s_async_write_screen_info.ss.dual_ss.sent_line_order ++; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + app_scrn_cmd.length = s_async_write_screen_info.ss.dual_ss.this_send_lines * scrn_line_size; + + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + if(is_first_call) { + app_qspi_force_cs(screen_id, true); + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } else { + ret = app_qspi_llp_transmit(screen_id, &scrn_llp_config, app_scrn_cmd.data_mode, app_scrn_cmd.length, false); + } + } else { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + + if(!ret) { + goto __fail; + } + } + } + return true; + +__fail: + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + app_qspi_force_cs(s_async_write_screen_info.screen_id, false); + } + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + +#else + return false; +#endif +} + +bool app_qspi_async_veri_draw_screen(app_qspi_id_t screen_id, + app_qspi_id_t storage_id, + const app_qspi_screen_command_t * const p_screen_cmd, + const app_qspi_screen_info_t * const p_screen_info, + app_qspi_screen_veri_link_scroll_t * p_link_scroll, + bool is_first_call) { + +#if (QSPI_ASYNC_VERI_LINK_DRAW_SCREEN_SUPPORT > 0u) + + app_qspi_command_t app_scrn_cmd; + dma_llp_config_t scrn_llp_config; + bool ret = false; + uint32_t j = 0; + bool is_stored_in_qspi_storage = false; + app_qspi_screen_veri_link_scroll_t * p_cur_scroll = NULL; + + if((p_screen_cmd == NULL) || (p_screen_info == NULL) || (p_link_scroll == NULL)) { + return false; + } + + if(screen_id > APP_QSPI_ID_2) { + return false; + } + + if((storage_id > APP_QSPI_ID_2) && (storage_id != APP_STORAGE_RAM_ID)) { + return false; + } + + if(screen_id == storage_id) { + return false; + } + + if ((p_qspi_env[screen_id] == NULL) || (p_qspi_env[screen_id]->qspi_state == APP_QSPI_INVALID) || + (p_qspi_env[storage_id] == NULL) || (p_qspi_env[storage_id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if(p_qspi_env[screen_id]->is_async_write_screen && is_first_call) { + printf("RE-CALLED !\r\n"); + return false; + } + + if(is_first_call) { + + if (p_qspi_env[screen_id]->start_flag) { + printf("BUSY... !\r\n"); + return false; + } + p_qspi_env[screen_id]->start_flag = true; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = true; + } + + memset(&s_async_write_screen_info, 0, sizeof(app_qspi_async_draw_screen_info_t)); + + is_stored_in_qspi_storage = (storage_id <= APP_QSPI_ID_2) ? true : false; + s_async_write_screen_info.if_type = DRAW_TYPE_IF_VERI_LINKED_SCREEN; + s_async_write_screen_info.screen_id = screen_id; + s_async_write_screen_info.storage_id = storage_id; + + memcpy(&s_async_write_screen_info.screen_info, p_screen_info, sizeof(app_qspi_screen_info_t)); + memcpy(&s_async_write_screen_info.qspi_screen_command, p_screen_cmd , sizeof(app_qspi_command_t)); + memcpy(&s_async_write_screen_info.ss.veri_linked_ss.vl_scroll, p_link_scroll, sizeof(app_qspi_screen_veri_link_scroll_t)); + + s_async_write_screen_info.ss.veri_linked_ss.total_sent_lines = 0; + s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll = p_link_scroll; + + if(is_stored_in_qspi_storage) { + app_qspi_mmap_set_prefetch(storage_id, true); + } + APP_ASSERT_CHECK(p_qspi_env[screen_id]->is_used_dma); + app_qspi_switch_dma_mode(screen_id, false); + + if(QSPI_DATASIZE_08_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 0; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_BYTE, DMA_DDATAALIGN_BYTE, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_0); + } else if (QSPI_DATASIZE_16_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 1; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_HALFWORD, DMA_DDATAALIGN_HALFWORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_1); + } else if (QSPI_DATASIZE_32_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 2; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if(is_stored_in_qspi_storage) app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_2); + } else { + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } + } + + const uint32_t scrn_pixel_height = s_async_write_screen_info.screen_info.scrn_pixel_height; + const uint32_t scrn_pixel_width = s_async_write_screen_info.screen_info.scrn_pixel_width; + const uint32_t scrn_pixel_depth = s_async_write_screen_info.screen_info.scrn_pixel_depth; + const uint32_t scrn_line_size = (scrn_pixel_width * scrn_pixel_depth); + const uint32_t scrn_refresh_lines_once = (QSPI_MAX_XFER_SIZE_ONCE/scrn_line_size); + const uint32_t max_lines = (sizeof(s_dma_llp_block)/sizeof(dma_block_config_t) - 2); + const uint32_t send_lines_once = max_lines < scrn_refresh_lines_once ? max_lines : scrn_refresh_lines_once; + + p_cur_scroll = s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll; + + /* check screen height/width/depth */ + if((p_cur_scroll == NULL) || + (scrn_pixel_width % 2 != 0) || + (scrn_pixel_height % 2 != 0) || + (scrn_pixel_depth != 2) ) { + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } + + if(p_cur_scroll->frame_draw_lines > send_lines_once) { + + if(APP_QSPI_EXCEPT_DEBUG_EN) printf("+++ ERR: Set psram(frame_draw_lines) <= %d in each Link Point\r\n", send_lines_once); + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } + + /* prepare llp config */ + scrn_llp_config.llp_src_writeback = 1; + scrn_llp_config.llp_dst_writeback = 1; + scrn_llp_config.llp_src_en = DMA_LLP_SRC_ENABLE; + scrn_llp_config.llp_dst_en = DMA_LLP_DST_DISABLE; + scrn_llp_config.head_lli = &s_dma_llp_block[0]; + + app_scrn_cmd.instruction = s_async_write_screen_info.qspi_screen_command.instruction; + app_scrn_cmd.instruction_size = s_async_write_screen_info.qspi_screen_command.instruction_size; + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.leading_address; + app_scrn_cmd.address_size = s_async_write_screen_info.qspi_screen_command.address_size; + app_scrn_cmd.dummy_cycles = s_async_write_screen_info.qspi_screen_command.dummy_cycles; + app_scrn_cmd.data_size = s_async_write_screen_info.qspi_screen_command.data_size; + app_scrn_cmd.instruction_address_mode = s_async_write_screen_info.qspi_screen_command.instruction_address_mode; + app_scrn_cmd.data_mode = s_async_write_screen_info.qspi_screen_command.data_mode; + app_scrn_cmd.length = 0x00; + app_scrn_cmd.clock_stretch_en = 1; + + memset(&s_dma_llp_block[0], 0, sizeof(dma_block_config_t) * (p_cur_scroll->frame_draw_lines + 1)); + + for(j = 0; j < p_cur_scroll->frame_draw_lines; j++) { + s_dma_llp_block[j].src_address = p_cur_scroll->frame_ahb_start_address + (p_cur_scroll->frame_offset_lines + j) * scrn_line_size ; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j + 1]; + s_dma_llp_block[j].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + if(is_first_call) { + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.leading_address; + } else { + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.ongoing_address; + } + + app_scrn_cmd.length = p_cur_scroll->frame_draw_lines * scrn_line_size; + + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + if(is_first_call) { + app_qspi_force_cs(screen_id, true); + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } else { + ret = app_qspi_llp_transmit(screen_id, &scrn_llp_config, app_scrn_cmd.data_mode, app_scrn_cmd.length, false); + } + } else { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + + if(ret) { + return true; + } else { + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + app_qspi_force_cs(s_async_write_screen_info.screen_id, false); + } + p_qspi_env[screen_id]->start_flag = false; + if(storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + return false; + } +#else + return false; +#endif +} + +bool app_qspi_async_llp_draw_block(app_qspi_id_t screen_id, + app_qspi_id_t storage_id, + const app_qspi_screen_command_t *const p_screen_cmd, + const app_qspi_screen_info_t *const p_screen_info, + app_qspi_screen_block_t *p_block_info, + bool is_first_call) { + +#if (QSPI_ASYNC_VERI_LINK_DRAW_SCREEN_SUPPORT > 0u) + + app_qspi_command_t app_scrn_cmd; + dma_llp_config_t scrn_llp_config; + bool ret = false; + uint32_t j = 0; + bool is_stored_in_qspi_storage = false; + app_qspi_screen_block_t *p_cur_block = NULL; + if ((p_screen_cmd == NULL) || (p_screen_info == NULL) || (p_block_info == NULL)) { + return false; + } + + if (screen_id > APP_QSPI_ID_2) { + return false; + } + + if ((storage_id > APP_QSPI_ID_2) && (storage_id != APP_STORAGE_RAM_ID)) { + return false; + } + + if (screen_id == storage_id) { + return false; + } + + if ((p_qspi_env[screen_id] == NULL) || (p_qspi_env[screen_id]->qspi_state == APP_QSPI_INVALID) || (p_qspi_env[storage_id] == NULL) || (p_qspi_env[storage_id]->qspi_state == APP_QSPI_INVALID)) { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_qspi_env[screen_id]->start_flag) { + printf("BUSY... !\r\n"); + return false; + } + + p_qspi_env[screen_id]->start_flag = true; + + if (storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = true; + } + + memset(&s_async_write_screen_info, 0, sizeof(app_qspi_async_draw_screen_info_t)); + + is_stored_in_qspi_storage = (storage_id <= APP_QSPI_ID_2) ? true : false; + + s_async_write_screen_info.screen_id = screen_id; + + s_async_write_screen_info.storage_id = storage_id; + + memcpy(&s_async_write_screen_info.screen_info, p_screen_info, sizeof(app_qspi_screen_info_t)); + + memcpy(&s_async_write_screen_info.qspi_screen_command, p_screen_cmd, sizeof(app_qspi_command_t)); + + memcpy(&s_async_write_screen_info.ss.veri_linked_ss.vl_scroll, p_block_info, sizeof(app_qspi_screen_block_t)); + + s_async_write_screen_info.ss.veri_linked_ss.total_sent_lines = 0; + + s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll = (app_qspi_screen_veri_link_scroll_t*)p_block_info; + + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + + if (is_stored_in_qspi_storage) { + app_qspi_mmap_set_prefetch(storage_id, true); + } + + APP_ASSERT_CHECK(p_qspi_env[screen_id]->is_used_dma); + app_qspi_switch_dma_mode(screen_id, false); + + if (QSPI_DATASIZE_08_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 0; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_BYTE, DMA_DDATAALIGN_BYTE, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if (is_stored_in_qspi_storage) + app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_0); + } + else if (QSPI_DATASIZE_16_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 1; + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_HALFWORD, DMA_DDATAALIGN_HALFWORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + if (is_stored_in_qspi_storage) + app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_1); + } + else if (QSPI_DATASIZE_32_BITS == p_screen_cmd->data_size) { + s_async_write_screen_info.llp_cfg_right_shift_bit = 2; + if(is_stored_in_qspi_storage) + { + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_4, LL_DMA_DST_BURST_LENGTH_4, DMA_SRC_GATHER_DISABLE);//BALIPRO-226:LL_DMA_SRC_BURST_LENGTH_8 will cause exception for qspi-psram data + } + else + { + s_async_write_screen_info.llp_cfg_ctrl_low = QSPI_DMA_CRTL_LOW_REGISTER_CFG(DMA_SRC_INCREMENT, DMA_SDATAALIGN_WORD, DMA_DDATAALIGN_WORD, LL_DMA_SRC_BURST_LENGTH_8, LL_DMA_DST_BURST_LENGTH_8, DMA_SRC_GATHER_DISABLE); + } + if (is_stored_in_qspi_storage) + app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_2); + } + else { + p_qspi_env[screen_id]->start_flag = false; + if (storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + return false; + } + + const uint32_t scrn_pixel_height = s_async_write_screen_info.screen_info.scrn_pixel_height; + const uint32_t scrn_pixel_width = s_async_write_screen_info.screen_info.scrn_pixel_width; + const uint32_t scrn_pixel_depth = s_async_write_screen_info.screen_info.scrn_pixel_depth; + const uint32_t scrn_line_size = (scrn_pixel_width * scrn_pixel_depth); + const uint32_t scrn_refresh_lines_once = (QSPI_MAX_XFER_SIZE_ONCE / scrn_line_size); + const uint32_t max_lines = (sizeof(s_dma_llp_block) / sizeof(dma_block_config_t) -2); + const uint32_t send_lines_once = max_lines < scrn_refresh_lines_once ? max_lines : scrn_refresh_lines_once; + p_cur_block = p_block_info; + + /* check screen height/width/depth */ + if ((p_cur_block == NULL) || (scrn_pixel_width % 2 != 0) || (scrn_pixel_height % 2 != 0) || (scrn_pixel_depth != 2)) { + p_qspi_env[screen_id]->start_flag = false; + if (storage_id <= APP_QSPI_ID_2) + { + p_qspi_env[storage_id]->start_flag = false; + } + return false; + } + + if (p_cur_block->frame_draw_lines > send_lines_once) { + if (APP_QSPI_EXCEPT_DEBUG_EN) + printf("+++ ERR: Set psram(frame_draw_lines) <= %d in each Link Point\r\n", send_lines_once); + + p_qspi_env[screen_id]->start_flag = false; + + if (storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + + return false; + } + + /* prepare llp config */ + scrn_llp_config.llp_src_writeback = 1; + scrn_llp_config.llp_dst_writeback = 1; + scrn_llp_config.llp_src_en = DMA_LLP_SRC_ENABLE; + scrn_llp_config.llp_dst_en = DMA_LLP_DST_DISABLE; + scrn_llp_config.head_lli = &s_dma_llp_block[0]; + + app_scrn_cmd.instruction = s_async_write_screen_info.qspi_screen_command.instruction; + app_scrn_cmd.instruction_size = s_async_write_screen_info.qspi_screen_command.instruction_size; + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.leading_address; + app_scrn_cmd.address_size = s_async_write_screen_info.qspi_screen_command.address_size; + app_scrn_cmd.dummy_cycles = s_async_write_screen_info.qspi_screen_command.dummy_cycles; + app_scrn_cmd.data_size = s_async_write_screen_info.qspi_screen_command.data_size; + app_scrn_cmd.instruction_address_mode = s_async_write_screen_info.qspi_screen_command.instruction_address_mode; + app_scrn_cmd.data_mode = s_async_write_screen_info.qspi_screen_command.data_mode; + app_scrn_cmd.length = 0x00; + app_scrn_cmd.clock_stretch_en = 1; + + memset(&s_dma_llp_block[0],0, sizeof(dma_block_config_t) * (p_cur_block->frame_draw_lines +1)); + + for (j = 0; j < p_cur_block->frame_draw_lines; j++) { + s_dma_llp_block[j].src_address = p_cur_block->frame_ahb_start_address + (p_cur_block->frame_offset_lines + j) * scrn_line_size; + s_dma_llp_block[j].dst_address = 0; + s_dma_llp_block[j].p_lli = &s_dma_llp_block[j +1]; + s_dma_llp_block[j].CTL_L = s_async_write_screen_info.llp_cfg_ctrl_low; + s_dma_llp_block[j].CTL_H = (uint32_t)(scrn_line_size >> s_async_write_screen_info.llp_cfg_right_shift_bit); + s_dma_llp_block[j].src_status = 0x0; + s_dma_llp_block[j].dst_status = 0x0; + } + s_dma_llp_block[j - 1].p_lli = NULL; + + if (is_first_call) { + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.leading_address; + } + else { + app_scrn_cmd.address = s_async_write_screen_info.qspi_screen_command.ongoing_address; + } + + app_scrn_cmd.length = p_cur_block->frame_draw_lines * scrn_line_size; + + if (s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + if (is_first_call) { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + else { + ret = app_qspi_llp_transmit(screen_id, &scrn_llp_config, app_scrn_cmd.data_mode, app_scrn_cmd.length, false); + } + } + else { + ret = app_qspi_cmd_llp_transmit(screen_id, &app_scrn_cmd, &scrn_llp_config, false); + } + + if (ret) { + return true; + } + else { + p_qspi_env[screen_id]->start_flag = false; + + if (storage_id <= APP_QSPI_ID_2) { + p_qspi_env[storage_id]->start_flag = false; + } + + return false; + } +#else + return false; +#endif +} + +bool app_qspi_mmap_blit_image(app_qspi_id_t storage_id, blit_image_config_t * p_blit_config, blit_xfer_type_e xfer_type) { +#if QSPI_BLIT_RECT_IMAGE_SUPPORT > 0u + bool ret = true; + bool is_dma_sg_xfer = false; + hal_status_t status = HAL_OK; + uint32_t sent_lines = 0; + uint32_t this_sent_lines = 0; + uint32_t src_addr = 0; + uint32_t dst_addr = 0; + dma_sg_llp_config_t sg_llp_config; + + if ((p_qspi_env[storage_id] == NULL) || (p_qspi_env[storage_id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if(p_blit_config == NULL) { + return false; + } + + if(p_blit_config->src_img_x + p_blit_config->src_img_x_delta > p_blit_config->src_img_w) { + return false; + } + + if(p_blit_config->src_img_y + p_blit_config->src_img_y_delta > p_blit_config->src_img_h) { + return false; + } + + const uint32_t src_image_address = ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[storage_id]) + p_blit_config->src_img_address; + const uint32_t src_start_address = src_image_address + (p_blit_config->src_img_y * p_blit_config->src_img_w + p_blit_config->src_img_x) * p_blit_config->pixel_depth; + const uint32_t dst_start_address = p_blit_config->dst_buff_address + (p_blit_config->dst_buff_y * p_blit_config->dst_buff_width + p_blit_config->dst_buff_x) * p_blit_config->pixel_depth; + const uint32_t line_length = p_blit_config->src_img_x_delta * p_blit_config->pixel_depth; + const uint32_t send_lines_once = DMA_MAX_XFER_SIZE_ONCE/(line_length); + const uint32_t total_lines = p_blit_config->src_img_y_delta; + + APP_ASSERT_CHECK(p_qspi_env[storage_id]->is_used_dma); + app_qspi_mmap_set_prefetch(storage_id, true); + app_qspi_switch_dma_mode(storage_id, true); + + if(BLIT_BY_DMA_SG == xfer_type) { + + is_dma_sg_xfer = true; + + if(is_dma_sg_xfer) { + /* source - gather */ + sg_llp_config.gather_config.src_sgc = p_blit_config->src_img_x_delta * p_blit_config->pixel_depth; + sg_llp_config.gather_config.src_sgi = (p_blit_config->src_img_w - p_blit_config->src_img_x_delta) * p_blit_config->pixel_depth; + sg_llp_config.gather_config.src_gather_en = DMA_SRC_GATHER_ENABLE; + + /* dest - scatter */ + sg_llp_config.scatter_config.dst_dsc = p_blit_config->src_img_x_delta * p_blit_config->pixel_depth; + sg_llp_config.scatter_config.dst_dsi = (p_blit_config->dst_buff_width - p_blit_config->src_img_x_delta) * p_blit_config->pixel_depth; + sg_llp_config.scatter_config.dst_scatter_en = DMA_DST_SCATTER_ENABLE; + + sg_llp_config.llp_config.head_lli = NULL; + sg_llp_config.llp_config.llp_src_en = DMA_LLP_SRC_DISABLE; + sg_llp_config.llp_config.llp_dst_en = DMA_LLP_DST_DISABLE; + sg_llp_config.llp_config.llp_src_writeback = 0; + sg_llp_config.llp_config.llp_dst_writeback = 0; + } + + ret = true; + sent_lines = 0; + src_addr = src_start_address; + dst_addr = dst_start_address; + while(sent_lines < total_lines) { + + this_sent_lines = (total_lines - sent_lines) < send_lines_once ? (total_lines - sent_lines) : send_lines_once; + + p_qspi_env[storage_id]->is_dma_done = 0; + p_qspi_env[storage_id]->is_xfer_err = 0; + + status = hal_dma_start_sg_llp_it(p_qspi_env[storage_id]->handle.p_dma, src_addr, dst_addr, this_sent_lines*line_length, &sg_llp_config); + + if(status == HAL_OK) { + while(!p_qspi_env[storage_id]->is_dma_done && !p_qspi_env[storage_id]->is_xfer_err); + if(p_qspi_env[storage_id]->is_xfer_err) { + ret = false; + } + } else { + ret = false; + } + + if(!ret) { + break; + } + + sent_lines += this_sent_lines; + src_addr += this_sent_lines*p_blit_config->src_img_w*p_blit_config->pixel_depth; + dst_addr += this_sent_lines*p_blit_config->dst_buff_width*p_blit_config->pixel_depth; + } + } else if(BLIT_BY_DMA_LLP == xfer_type) { + +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) + + static dma_block_config_t dma_llp_block[DMA_LLP_BLOCKS_FOR_BLIT + 1]; + + const uint32_t sent_blocks_once = DMA_LLP_BLOCKS_FOR_BLIT; + uint32_t i = 0; + + app_qspi_mmap_set_endian_mode(storage_id, APP_QSPI_MMAP_ENDIAN_MODE_0); + + sg_llp_config.gather_config.src_gather_en = DMA_SRC_GATHER_DISABLE; + sg_llp_config.scatter_config.dst_scatter_en = DMA_DST_SCATTER_DISABLE; + sg_llp_config.llp_config.llp_src_en = DMA_LLP_SRC_ENABLE; + sg_llp_config.llp_config.llp_dst_en = DMA_LLP_DST_ENABLE; + sg_llp_config.llp_config.llp_src_writeback = 1; + sg_llp_config.llp_config.llp_dst_writeback = 1; + sg_llp_config.llp_config.head_lli = &dma_llp_block[0]; + + sent_lines = 0; + while(sent_lines < total_lines) { + this_sent_lines = (total_lines - sent_lines) < sent_blocks_once ? (total_lines - sent_lines) : sent_blocks_once; + + memset(&dma_llp_block[0], 0, sizeof(dma_block_config_t) * (sent_blocks_once + 1)); + for(i = 0; i < this_sent_lines; i++) { + dma_llp_block[i].src_address = src_start_address + (sent_lines + i) * p_blit_config->src_img_w*p_blit_config->pixel_depth; + dma_llp_block[i].dst_address = dst_start_address + (sent_lines + i) * p_blit_config->dst_buff_width*p_blit_config->pixel_depth; + dma_llp_block[i].p_lli = &dma_llp_block[i + 1]; + dma_llp_block[i].CTL_L = DMA_CTLL_INI_EN | DMA_MEMORY_TO_MEMORY | DMA_LLP_SRC_ENABLE | \ + DMA_LLP_DST_ENABLE | DMA_SRC_GATHER_DISABLE | DMA_DST_SCATTER_DISABLE | \ + DMA_DST_INCREMENT | DMA_SRC_INCREMENT | DMA_SDATAALIGN_BYTE | \ + DMA_DDATAALIGN_BYTE | LL_DMA_SRC_BURST_LENGTH_8 | LL_DMA_DST_BURST_LENGTH_8 ; + dma_llp_block[i].CTL_H = (uint32_t)(line_length); + dma_llp_block[i].src_status = 0x0; + dma_llp_block[i].dst_status = 0x0; + } + + dma_llp_block[i - 1].p_lli = NULL; + + p_qspi_env[storage_id]->is_dma_done = 0; + p_qspi_env[storage_id]->is_xfer_err = 0; + + status = hal_dma_start_sg_llp_it(p_qspi_env[storage_id]->handle.p_dma, src_start_address, dst_start_address, this_sent_lines*line_length, &sg_llp_config); + + if(status == HAL_OK) { + while(!p_qspi_env[storage_id]->is_dma_done && !p_qspi_env[storage_id]->is_xfer_err); + if(p_qspi_env[storage_id]->is_xfer_err) { + ret = false; + } + } else { + ret = false; + } + + if(!ret) { + break; + } + + sent_lines += this_sent_lines; + } +#else + ret = false; +#endif + } + + return ret; + +#else /* QSPI_BLIT_RECT_IMAGE_SUPPORT */ + + return false; + +#endif /* QSPI_BLIT_RECT_IMAGE_SUPPORT */ +} + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ + +static bool app_qspi_switch_dma_mode(app_qspi_id_t id, bool is_m2m_mode) { + app_dma_params_t dma_params = {0}; + + if(p_qspi_env[id]->is_dma_mode_m2m == is_m2m_mode) { + return true; + } else { + if(is_m2m_mode) { + dma_params.p_instance = p_qspi_env[id]->dma_cfg.dma_instance; + dma_params.channel_number = p_qspi_env[id]->dma_cfg.dma_channel; + dma_params.init.direction = DMA_MEMORY_TO_MEMORY; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_INCREMENT; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + dma_params.init.mode = DMA_NORMAL; + dma_params.init.priority = DMA_PRIORITY_LOW; + } else { + dma_params.p_instance = p_qspi_env[id]->dma_cfg.dma_instance; + dma_params.channel_number = p_qspi_env[id]->dma_cfg.dma_channel; + dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + dma_params.init.mode = DMA_NORMAL; + dma_params.init.priority = DMA_PRIORITY_LOW; + } + + p_qspi_env[id]->dma_id = app_dma_init(&dma_params, s_dma_evt_handler[id]); + if (p_qspi_env[id]->dma_id < 0) + { + return false; + } + p_qspi_env[id]->handle.p_dma = app_dma_get_handle(p_qspi_env[id]->dma_id); + p_qspi_env[id]->handle.p_dma->p_parent = (void*)&p_qspi_env[id]->handle; + } + + p_qspi_env[id]->is_dma_mode_m2m = is_m2m_mode; + return true; +} + +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) + +static bool app_qspi_cmd_llp_transmit(app_qspi_id_t screen_id, app_qspi_command_t * p_cmd, dma_llp_config_t * p_llp_config, bool is_sync) { + hal_status_t status = HAL_OK; + + if(is_sync) { /* sync mode */ + p_qspi_env[screen_id]->is_async_write_screen = false; + p_qspi_env[screen_id]->is_tx_done = 0; + p_qspi_env[screen_id]->is_xfer_err = 0; + status = hal_qspi_command_transmit_dma_llp(&(p_qspi_env[screen_id]->handle), p_cmd, p_llp_config); + + if(HAL_OK == status) { + while(!p_qspi_env[screen_id]->is_tx_done && !p_qspi_env[screen_id]->is_xfer_err); + + if(p_qspi_env[screen_id]->is_xfer_err) { + return false; + } + return true; + } + } else { /* async mode */ + p_qspi_env[screen_id]->is_async_write_screen = true; + status = hal_qspi_command_transmit_dma_llp(&(p_qspi_env[screen_id]->handle), p_cmd, p_llp_config); + + if(HAL_OK == status) { + return true; + } else { + p_qspi_env[screen_id]->is_async_write_screen = false; + } + } + + return false; +} +static bool app_qspi_llp_transmit(app_qspi_id_t screen_id, dma_llp_config_t * p_llp_config, uint32_t data_mode, uint32_t data_len, bool is_sync) { + hal_status_t status = HAL_OK; + + if(is_sync) { /* sync mode */ + p_qspi_env[screen_id]->is_async_write_screen = false; + p_qspi_env[screen_id]->is_tx_done = 0; + p_qspi_env[screen_id]->is_xfer_err = 0; + status = hal_qspi_transmit_dma_llp(&(p_qspi_env[screen_id]->handle), p_llp_config, data_mode, data_len, true); + + if(HAL_OK == status) { + while(!p_qspi_env[screen_id]->is_tx_done && !p_qspi_env[screen_id]->is_xfer_err); + + if(p_qspi_env[screen_id]->is_xfer_err) { + return false; + } + return true; + } + } else { /* async mode */ + p_qspi_env[screen_id]->is_async_write_screen = true; + status = hal_qspi_transmit_dma_llp(&(p_qspi_env[screen_id]->handle), p_llp_config, data_mode, data_len, true); + + if(HAL_OK == status) { + return true; + } else { + p_qspi_env[screen_id]->is_async_write_screen = false; + } + } + + return false; +} + +bool app_graphics_qspi_draw_screen_continue(app_qspi_id_t id, app_qspi_evt_t qspi_evt) +//if return true, you immediately should return from app_qspi_event_call too. +{ + if(p_qspi_env[id]->is_async_write_screen) { + if(p_qspi_env[id]->is_tx_done && !p_qspi_env[id]->is_xfer_err) { + + if(DRAW_TYPE_IF_DUAL_SCREEN == s_async_write_screen_info.if_type) { + + s_async_write_screen_info.ss.dual_ss.total_sent_lines += s_async_write_screen_info.ss.dual_ss.this_send_lines; + + if(s_async_write_screen_info.ss.dual_ss.total_sent_lines >= s_async_write_screen_info.screen_info.scrn_pixel_height) { + p_qspi_env[id]->is_async_write_screen = false; + qspi_evt.type = APP_QSPI_EVT_ASYNC_WR_SCRN_CPLT; + goto Label_async_scrn_notify; + } else { + bool ret = app_qspi_async_draw_screen(s_async_write_screen_info.screen_id, + s_async_write_screen_info.storage_id, + &s_async_write_screen_info.qspi_screen_command, + &s_async_write_screen_info.screen_info, + &s_async_write_screen_info.ss.dual_ss.scroll_config, + false); + if(!ret) { + p_qspi_env[id]->is_async_write_screen = false; + qspi_evt.type = APP_QSPI_EVT_ASYNC_WR_SCRN_FAIL; + goto Label_async_scrn_notify; + } else { + return true; + } + } + } else if(DRAW_TYPE_IF_VERI_LINKED_SCREEN == s_async_write_screen_info.if_type) { + s_async_write_screen_info.ss.veri_linked_ss.total_sent_lines += s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll->frame_draw_lines; + if(s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll->next != NULL) { + s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll = s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll->next; + bool ret = app_qspi_async_veri_draw_screen(s_async_write_screen_info.screen_id, + s_async_write_screen_info.storage_id, + &s_async_write_screen_info.qspi_screen_command, + &s_async_write_screen_info.screen_info, + s_async_write_screen_info.ss.veri_linked_ss.p_cur_scroll, + false); + if(!ret) { + p_qspi_env[id]->is_async_write_screen = false; + qspi_evt.type = APP_QSPI_EVT_ASYNC_WR_SCRN_FAIL; + goto Label_async_scrn_notify; + } else { + return true; + } + } else { + p_qspi_env[id]->is_async_write_screen = false; + qspi_evt.type = APP_QSPI_EVT_ASYNC_WR_SCRN_CPLT; + goto Label_async_scrn_notify; + } + } else { + p_qspi_env[id]->is_async_write_screen = false; + p_qspi_env[id]->start_flag = false; + if(s_async_write_screen_info.storage_id <= APP_QSPI_ID_2) { + p_qspi_env[s_async_write_screen_info.storage_id]->start_flag = false; + } + return false; + } + } else { + p_qspi_env[id]->is_async_write_screen = false; + qspi_evt.type = APP_QSPI_EVT_ASYNC_WR_SCRN_FAIL; + } +Label_async_scrn_notify: + if(s_async_write_screen_info.qspi_screen_command.is_one_take_cs) { + app_qspi_force_cs(s_async_write_screen_info.screen_id, false); + } + p_qspi_env[id]->start_flag = false; + if(s_async_write_screen_info.storage_id <= APP_QSPI_ID_2) { + p_qspi_env[s_async_write_screen_info.storage_id]->start_flag = false; + } + s_async_write_screen_info.if_type = DRAW_TYPE_IF_NONE; + if(p_qspi_env[id]->evt_handler != NULL) + { + p_qspi_env[id]->evt_handler(&qspi_evt); + } + return true; + } + else { + return false; + } +} + +#endif + +static void app_qspi_dma_evt_handler_0(app_dma_evt_type_t type) { + switch(type) { + case APP_DMA_EVT_TFR: + case APP_DMA_EVT_BLK: + { + p_qspi_env[APP_QSPI_ID_0]->is_xfer_err = 0; + p_qspi_env[APP_QSPI_ID_0]->is_dma_done = 1; + } + break; + + default: + case APP_DMA_EVT_ERROR: + { + p_qspi_env[APP_QSPI_ID_0]->is_xfer_err = 1; + p_qspi_env[APP_QSPI_ID_0]->is_dma_done = 1; + } + break; + } +} + +static void app_qspi_dma_evt_handler_1(app_dma_evt_type_t type) { + switch(type) { + case APP_DMA_EVT_TFR: + case APP_DMA_EVT_BLK: + { + p_qspi_env[APP_QSPI_ID_1]->is_xfer_err = 0; + p_qspi_env[APP_QSPI_ID_1]->is_dma_done = 1; + } + break; + + default: + case APP_DMA_EVT_ERROR: + { + p_qspi_env[APP_QSPI_ID_1]->is_xfer_err = 1; + p_qspi_env[APP_QSPI_ID_1]->is_dma_done = 1; + } + break; + } +} + +static void app_qspi_dma_evt_handler_2(app_dma_evt_type_t type) { + switch(type) { + case APP_DMA_EVT_TFR: + case APP_DMA_EVT_BLK: + { + p_qspi_env[APP_QSPI_ID_2]->is_xfer_err = 0; + p_qspi_env[APP_QSPI_ID_2]->is_dma_done = 1; + } + break; + + default: + case APP_DMA_EVT_ERROR: + { + p_qspi_env[APP_QSPI_ID_2]->is_xfer_err = 1; + p_qspi_env[APP_QSPI_ID_2]->is_dma_done = 1; + } + break; + } +} + +#endif +#endif +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c.c new file mode 100644 index 0000000..6391af0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c.c @@ -0,0 +1,958 @@ +/** + **************************************************************************************** + * @file app_i2c.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_i2c.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include +#include "gr_soc.h" +#include "app_drv.h" + +#ifdef HAL_I2C_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +typedef struct { + app_i2c_id_t id; + IRQn_Type irq; + i2c_regs_t *instance; +} i2c_info_t; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool i2c_prepare_for_sleep(void); +static void i2c_wake_up_ind(void); +static uint16_t i2c_gpio_config(app_i2c_pin_cfg_t pin_cfg); +void I2C0_IRQHandler(void); +void I2C1_IRQHandler(void); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +void I2C2_IRQHandler(void); +void I2C3_IRQHandler(void); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) +void I2C4_IRQHandler(void); +void I2C5_IRQHandler(void); +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const i2c_info_t s_i2c_info[APP_I2C_ID_MAX] = +{ + { + .id = APP_I2C_ID_0, + .irq = I2C0_IRQn, + .instance = I2C0, + }, + { + .id = APP_I2C_ID_1, + .irq = I2C1_IRQn, + .instance = I2C1, + }, +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + { + .id = APP_I2C_ID_2, + .irq = I2C2_IRQn, + .instance = I2C2, + }, + { + .id = APP_I2C_ID_3, + .irq = I2C3_IRQn, + .instance = I2C3, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + { + .id = APP_I2C_ID_4, + .irq = I2C4_IRQn, + .instance = I2C4, + }, + { + .id = APP_I2C_ID_5, + .irq = I2C5_IRQn, + .instance = I2C5, + }, +#endif +}; + +i2c_env_t *p_i2c_env[APP_I2C_ID_MAX]; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_i2c_pwr_id = -1; +static const app_sleep_callbacks_t i2c_sleep_cb = +{ + .app_prepare_for_sleep = i2c_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = i2c_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool i2c_prepare_for_sleep(void) +{ + hal_i2c_state_t state; + for (uint8_t i = 0; i < APP_I2C_ID_MAX; i++) + { + if (p_i2c_env[i] == NULL) + { + continue; + } + + if (p_i2c_env[i]->i2c_state == APP_I2C_ACTIVITY) + { + state = hal_i2c_get_state(&(p_i2c_env[i]->handle)); + if ((state != HAL_I2C_STATE_READY) && (state != HAL_I2C_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_i2c_suspend_reg(&p_i2c_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_i2c_env[i]->i2c_state = APP_I2C_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE static void i2c_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + for (uint8_t i = 0; i < APP_I2C_ID_MAX; i++) + { + if (p_i2c_env[i] == NULL) + { + continue; + } + + if (p_i2c_env[i]->i2c_state == APP_I2C_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_i2c_resume_reg(&p_i2c_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_i2c_info[i].irq); + hal_nvic_enable_irq(s_i2c_info[i].irq); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void i2c_wake_up(app_i2c_id_t id) +{ + if (p_i2c_env[id]->i2c_state == APP_I2C_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_i2c_resume_reg(&p_i2c_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_i2c_irq[id]); + hal_nvic_enable_irq(s_i2c_irq[id]); + p_i2c_env[id]->i2c_state = APP_I2C_ACTIVITY; + + dma_wake_up(p_i2c_env[id]->dma_id[0]); + dma_wake_up(p_i2c_env[id]->dma_id[1]); + } +} +#endif + +static uint16_t i2c_gpio_config(app_i2c_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.pull = pin_cfg.scl.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.scl.pin; + io_init.mux = pin_cfg.scl.mux; + err_code = app_io_init(pin_cfg.scl.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.sda.pull; + io_init.pin = pin_cfg.sda.pin; + io_init.mux = pin_cfg.sda.mux; + err_code = app_io_init(pin_cfg.sda.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + return err_code; +} + +static app_i2c_id_t i2c_get_id(i2c_handle_t *p_i2c) +{ + int i = 0; + + for (i = 0; i < APP_I2C_ID_MAX; i++) + { + if (p_i2c->p_instance == s_i2c_info[i].instance) + { + return s_i2c_info[i].id; + } + } + + return APP_I2C_ID_MAX; +} + +static void app_i2c_event_call(i2c_handle_t *p_i2c, app_i2c_evt_type_t evt_type) +{ + app_i2c_evt_t i2c_evt; + app_i2c_id_t id = i2c_get_id(p_i2c); + + i2c_evt.type = evt_type; + if (evt_type == APP_I2C_EVT_ERROR) + { + i2c_evt.data.error_code = p_i2c->error_code; + } + else + { + i2c_evt.data.size = p_i2c->xfer_size - p_i2c->xfer_count; + } + + i2c_evt.slave_addr = p_i2c_env[id]->slv_dev_addr; + p_i2c_env[id]->start_flag = false; + if (p_i2c_env[id]->evt_handler != NULL) + { + p_i2c_env[id]->evt_handler(&i2c_evt); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_i2c_init(app_i2c_params_t *p_params, app_i2c_evt_handler_t evt_handler) +{ + + app_i2c_id_t id = p_params->id; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + p_i2c_env[id] = &(p_params->i2c_dev); + + soc_register_nvic(I2C0_IRQn, (uint32_t)I2C0_IRQHandler); + soc_register_nvic(I2C1_IRQn, (uint32_t)I2C1_IRQHandler); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + soc_register_nvic(I2C2_IRQn, (uint32_t)I2C2_IRQHandler); + soc_register_nvic(I2C3_IRQn, (uint32_t)I2C3_IRQHandler); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + soc_register_nvic(I2C4_IRQn, (uint32_t)I2C4_IRQHandler); + soc_register_nvic(I2C5_IRQn, (uint32_t)I2C5_IRQHandler); +#endif + + app_err_code = i2c_gpio_config(p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + hal_nvic_clear_pending_irq(s_i2c_info[p_params->id].irq); + hal_nvic_enable_irq(s_i2c_info[p_params->id].irq); + + p_params->i2c_dev.role = p_params->role; + p_params->i2c_dev.p_pin_cfg = &p_params->pin_cfg; + p_params->i2c_dev.evt_handler = evt_handler; + + memcpy(&p_params->i2c_dev.handle.init, &p_params->init, sizeof(i2c_init_t)); + p_params->i2c_dev.handle.p_instance = s_i2c_info[p_params->id].instance; + hal_err_code = hal_i2c_deinit(&p_params->i2c_dev.handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_i2c_init(&p_params->i2c_dev.handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if(s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_i2c_pwr_id = pwr_register_sleep_cb(&i2c_sleep_cb, APP_DRIVER_I2C_WAPEUP_PRIORITY); + + if (s_i2c_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + p_params->i2c_dev.i2c_state = APP_I2C_ACTIVITY; + p_params->i2c_dev.start_flag = false; + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_deinit(app_i2c_id_t id) +{ + uint8_t i; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + hal_nvic_disable_irq(s_i2c_info[id].irq); + + p_i2c_env[id]->i2c_state = APP_I2C_INVALID; + p_i2c_env[id]->start_flag = false; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_I2C_ID_MAX; i++) + { + if (p_i2c_env[i] != NULL && (p_i2c_env[i]->i2c_state) != APP_I2C_INVALID) + { + break; + } + } + if (APP_I2C_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_i2c_pwr_id); + s_i2c_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + app_err_code = app_io_deinit(p_i2c_env[id]->p_pin_cfg->scl.type, p_i2c_env[id]->p_pin_cfg->scl.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_i2c_env[id]->p_pin_cfg->sda.type, p_i2c_env[id]->p_pin_cfg->sda.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + hal_err_code = hal_i2c_deinit(&p_i2c_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if (p_i2c_env[id]->i2c_dma_state == APP_I2C_DMA_INVALID) + { + p_i2c_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) +uint16_t app_i2c_timing_adjust(app_i2c_id_t id, uint32_t timing_type, int32_t delta) +{ + hal_status_t hal_err_code; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + hal_err_code = hal_i2c_timing_adjust(&p_i2c_env[id]->handle, timing_type, delta); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_timing_get(app_i2c_id_t id, uint32_t timing_type, uint32_t *p_timing_value) +{ + hal_status_t hal_err_code; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + hal_err_code = hal_i2c_timing_get(&p_i2c_env[id]->handle, timing_type, p_timing_value); + HAL_ERR_CODE_CHECK(hal_err_code); + + return APP_DRV_SUCCESS; +} +#endif /* ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) */ + +uint16_t app_i2c_receive_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_receive(&p_i2c_env[id]->handle, target_address, p_data, size, timeout); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_receive(&p_i2c_env[id]->handle, p_data, size, timeout); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_receive_it(&p_i2c_env[id]->handle, target_address, p_data, size); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_receive_it(&p_i2c_env[id]->handle, p_data, size); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_transmit_sync(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_transmit(&p_i2c_env[id]->handle, target_address, p_data, size, timeout); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_transmit(&p_i2c_env[id]->handle, p_data, size, timeout); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + + if (p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_transmit_it(&p_i2c_env[id]->handle, target_address, p_data, size); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_transmit_it(&p_i2c_env[id]->handle, p_data, size); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + + +uint16_t app_i2c_mem_read_sync(app_i2c_id_t id, + uint16_t dev_address, + uint16_t mem_address, + uint16_t mem_addr_size, + uint8_t *p_data, + uint16_t size, + uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = dev_address; + + err_code = hal_i2c_mem_read(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size, timeout); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = dev_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + err_code = hal_i2c_mem_read_it(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size); + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_mem_write_sync(app_i2c_id_t id, + uint16_t dev_address, + uint16_t mem_address, + uint16_t mem_addr_size, + uint8_t *p_data, + uint16_t size, + uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = dev_address; + + err_code = hal_i2c_mem_write(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size, timeout); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = dev_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + err_code = hal_i2c_mem_write_it(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size); + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_i2c_transmit_receive_sync(app_i2c_id_t id, uint16_t dev_address, uint8_t *p_tdata, uint16_t tsize, uint8_t *p_rdata, uint16_t rsize, uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tdata == NULL || p_rdata == NULL || tsize == 0 || rsize == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = dev_address; + + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_transmit_receive(&p_i2c_env[id]->handle, dev_address, p_tdata, tsize, p_rdata, rsize, timeout); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_receive_transmit(&p_i2c_env[id]->handle, p_tdata, tsize, p_rdata, rsize, timeout); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} +#endif + +i2c_handle_t *app_i2c_get_handle(app_i2c_id_t id) +{ + if (id >= APP_I2C_ID_MAX) + { + return NULL; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + return &p_i2c_env[id]->handle; +} + +uint16_t app_i2c_master_abort_it(app_i2c_id_t id) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_i2c_master_abort_it(&(p_i2c_env[id]->handle)); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +void hal_i2c_master_tx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_TX_CPLT); +} + +void hal_i2c_master_rx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_RX_DATA); +} + +void hal_i2c_slave_tx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_TX_CPLT); +} + +void hal_i2c_slave_rx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_RX_DATA); +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +void hal_i2c_mem_tx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_TX_CPLT); +} + +void hal_i2c_mem_rx_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_RX_DATA); +} +#endif + +void hal_i2c_error_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_EVT_ERROR); +} + +void hal_i2c_abort_cplt_callback(i2c_handle_t *p_i2c) +{ + app_i2c_event_call(p_i2c, APP_I2C_ABORT); +} + +#define I2C_HANDLER(index, val) \ +SECTION_RAM_CODE void I2C##index##_IRQHandler(void)\ +{\ + hal_i2c_irq_handler(&p_i2c_env[val]->handle);\ +} + +I2C_HANDLER(0, APP_I2C_ID_0) +I2C_HANDLER(1, APP_I2C_ID_1) +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) | (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) +I2C_HANDLER(2, APP_I2C_ID_2) +I2C_HANDLER(3, APP_I2C_ID_3) +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) +I2C_HANDLER(4, APP_I2C_ID_4) +I2C_HANDLER(5, APP_I2C_ID_5) +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c_dma.c new file mode 100644 index 0000000..da63a19 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2c_dma.c @@ -0,0 +1,563 @@ +/** + **************************************************************************************** + * @file app_i2c_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_i2c_dma.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include + +#ifdef HAL_I2C_MODULE_ENABLED +/* + * DEFINES + ***************************************************************************************** + */ + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +struct dma_request { + uint32_t tx; + uint32_t rx; +}; + +typedef struct { + struct dma_request dma0_request; + struct dma_request dma1_request; +} i2c_dma_info_t; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const i2c_dma_info_t s_i2c_dma_info[APP_I2C_ID_MAX] = { + { /* I2C 0 */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + .dma0_request = { + .tx = DMA0_REQUEST_I2C0_TX, + .rx = DMA0_REQUEST_I2C0_RX, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + .dma1_request = { + .tx = DMA1_REQUEST_I2C0_TX, + .rx = DMA1_REQUEST_I2C0_RX, + }, +#endif + }, + { /* I2C 1 */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + .dma0_request = { + .tx = DMA0_REQUEST_I2C1_TX, + .rx = DMA0_REQUEST_I2C1_RX, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + .dma1_request = { + .tx = DMA1_REQUEST_I2C1_TX, + .rx = DMA1_REQUEST_I2C1_RX, + }, +#endif + }, +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + { /* I2C 2 */ + .dma0_request = { + .tx = DMA0_REQUEST_I2C2_TX, + .rx = DMA0_REQUEST_I2C2_RX, + }, + }, + { /* I2C 3 */ + .dma0_request = { + .tx = DMA0_REQUEST_I2C3_TX, + .rx = DMA0_REQUEST_I2C3_RX, + }, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + { /* I2C 4 */ + .dma0_request = { + .tx = DMA0_REQUEST_I2C4_TX, + .rx = DMA0_REQUEST_I2C4_RX, + }, + }, + { /* I2C 5 */ + .dma0_request = { + .tx = DMA0_REQUEST_I2C5_TX, + .rx = DMA0_REQUEST_I2C5_RX, + }, + }, +#endif +}; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +extern void i2c_wake_up(app_i2c_id_t id); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern i2c_env_t *p_i2c_env[APP_I2C_ID_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint16_t app_i2c_config_dma_tx(app_i2c_params_t *p_params) +{ + app_dma_params_t tx_dma_params = { 0 }; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (p_params->dma_cfg.tx_dma_instance == DMA0) + { + if (p_params->id < APP_I2C_ID_2) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + else if (p_params->dma_cfg.tx_dma_instance == DMA1) + { + if (p_params->id > APP_I2C_ID_1) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } +#endif + + tx_dma_params.p_instance = p_params->dma_cfg.tx_dma_instance; + tx_dma_params.channel_number = p_params->dma_cfg.tx_dma_channel; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + tx_dma_params.init.src_request = DMA0_REQUEST_MEM; + tx_dma_params.init.dst_request = s_i2c_dma_info[p_params->id].dma0_request.tx; +#else + if (tx_dma_params.p_instance == DMA0) + { + tx_dma_params.init.src_request = DMA0_REQUEST_MEM; + tx_dma_params.init.dst_request = s_i2c_dma_info[p_params->id].dma0_request.tx; + } + else if (tx_dma_params.p_instance == DMA1) + { + tx_dma_params.init.src_request = DMA1_REQUEST_MEM; + tx_dma_params.init.dst_request = s_i2c_dma_info[p_params->id].dma1_request.tx; + } +#endif + tx_dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + tx_dma_params.init.src_increment = DMA_SRC_INCREMENT; + tx_dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + tx_dma_params.init.mode = DMA_NORMAL; +#endif + tx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_i2c_env[p_params->id]->dma_id[0] = app_dma_init(&tx_dma_params, NULL); + if (p_i2c_env[p_params->id]->dma_id[0] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + p_i2c_env[p_params->id]->handle.p_dmatx = app_dma_get_handle(p_i2c_env[p_params->id]->dma_id[0]); + p_i2c_env[p_params->id]->handle.p_dmatx->p_parent = (void *)&p_i2c_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_i2c_config_dma_rx(app_i2c_params_t *p_params) +{ + app_dma_params_t rx_dma_params = { 0 }; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (p_params->dma_cfg.rx_dma_instance == DMA0) + { + if (p_params->id < APP_I2C_ID_2) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + else if (p_params->dma_cfg.rx_dma_instance == DMA1) + { + if (p_params->id > APP_I2C_ID_1) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } +#endif + + rx_dma_params.p_instance = p_params->dma_cfg.rx_dma_instance; + rx_dma_params.channel_number = p_params->dma_cfg.rx_dma_channel; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + rx_dma_params.init.src_request = s_i2c_dma_info[p_params->id].dma0_request.rx; + rx_dma_params.init.dst_request = DMA0_REQUEST_MEM; +#else + if (rx_dma_params.p_instance == DMA0) + { + rx_dma_params.init.src_request = s_i2c_dma_info[p_params->id].dma0_request.rx; + rx_dma_params.init.dst_request = DMA0_REQUEST_MEM; + } + else if (rx_dma_params.p_instance == DMA1) + { + rx_dma_params.init.src_request = s_i2c_dma_info[p_params->id].dma1_request.rx; + rx_dma_params.init.dst_request = DMA1_REQUEST_MEM; + } +#endif + rx_dma_params.init.direction = DMA_PERIPH_TO_MEMORY; + rx_dma_params.init.src_increment = DMA_SRC_NO_CHANGE; + rx_dma_params.init.dst_increment = DMA_DST_INCREMENT; + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + rx_dma_params.init.mode = DMA_NORMAL; +#endif + rx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_i2c_env[p_params->id]->dma_id[1] = app_dma_init(&rx_dma_params, NULL); + if (p_i2c_env[p_params->id]->dma_id[1] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + p_i2c_env[p_params->id]->handle.p_dmarx = app_dma_get_handle(p_i2c_env[p_params->id]->dma_id[1]); + p_i2c_env[p_params->id]->handle.p_dmarx->p_parent = (void *)&p_i2c_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_i2c_config_dma(app_i2c_params_t *p_params) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + + p_i2c_env[p_params->id]->dma_id[0] = -1; + p_i2c_env[p_params->id]->dma_id[1] = -1; + + if (p_params->dma_cfg.tx_dma_instance == NULL && + p_params->dma_cfg.rx_dma_instance == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_params->dma_cfg.tx_dma_instance != NULL) + { + app_err_code = app_i2c_config_dma_tx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + if (p_params->dma_cfg.rx_dma_instance != NULL) + { + app_err_code = app_i2c_config_dma_rx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + + return app_err_code; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_i2c_dma_init(app_i2c_params_t *p_params) +{ + app_i2c_id_t id = p_params->id; + app_drv_err_t app_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + GLOBAL_EXCEPTION_DISABLE(); + app_err_code = app_i2c_config_dma(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + goto __exit; + } + p_i2c_env[id]->i2c_dma_state = APP_I2C_DMA_ACTIVITY; + +__exit: + GLOBAL_EXCEPTION_ENABLE(); + + return app_err_code; +} + +uint16_t app_i2c_dma_deinit(app_i2c_id_t id) +{ + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || + (p_i2c_env[id]->i2c_dma_state != APP_I2C_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_i2c_env[id]->dma_id[0]); + app_dma_deinit(p_i2c_env[id]->dma_id[1]); + + GLOBAL_EXCEPTION_DISABLE(); + p_i2c_env[id]->i2c_dma_state = APP_I2C_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + if (p_i2c_env[id]->i2c_state == APP_I2C_INVALID) + { + p_i2c_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_dma_receive_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_receive_dma(&p_i2c_env[id]->handle, target_address, p_data, size); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_receive_dma(&p_i2c_env[id]->handle, p_data, size); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_dma_transmit_async(app_i2c_id_t id, uint16_t target_address, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = target_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + switch(p_i2c_env[id]->role) + { + case APP_I2C_ROLE_MASTER: + err_code = hal_i2c_master_transmit_dma(&p_i2c_env[id]->handle, target_address, p_data, size); + break; + + case APP_I2C_ROLE_SLAVE: + err_code = hal_i2c_slave_transmit_dma(&p_i2c_env[id]->handle, p_data, size); + break; + + default: + break; + } + + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_dma_mem_read_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = mem_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + err_code = hal_i2c_mem_read_dma(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size); + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2c_dma_mem_write_async(app_i2c_id_t id, uint16_t dev_address, uint16_t mem_address, uint16_t mem_addr_size, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2C_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2c_env[id] == NULL) || (p_i2c_env[id]->i2c_state == APP_I2C_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2c_wake_up(id); +#endif + + p_i2c_env[id]->slv_dev_addr = mem_address; + + if(p_i2c_env[id]->start_flag == false) + { + p_i2c_env[id]->start_flag = true; + + err_code = hal_i2c_mem_write_dma(&p_i2c_env[id]->handle, dev_address, mem_address, mem_addr_size, p_data, size); + if (err_code != HAL_OK) + { + p_i2c_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s.c new file mode 100644 index 0000000..9142a77 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s.c @@ -0,0 +1,819 @@ +/** + **************************************************************************************** + * @file app_i2s.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_i2s.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" +#include + +#ifdef HAL_I2S_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_I2S_CALLBACK(id, evt) \ + do \ + { \ + p_i2s_env[id]->start_flag = false; \ + if (p_i2s_env[id]->evt_handler != NULL) \ + { \ + p_i2s_env[id]->evt_handler(&evt); \ + } \ + } while(0) + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool i2s_prepare_for_sleep(void); +static void i2s_wake_up_ind(void); +static uint16_t i2s_gpio_config(app_i2s_id_t id, app_i2s_pin_cfg_t pin_cfg); +void I2S_M_IRQHandler(void); +void I2S_S_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const IRQn_Type s_i2s_irq[APP_I2S_ID_MAX] = {I2S_S_IRQn, I2S_M_IRQn}; +static const uint32_t s_i2s_instance[APP_I2S_ID_MAX] = {I2S_S_BASE, I2S_M_BASE}; + +i2s_env_t *p_i2s_env[APP_I2S_ID_MAX]; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_i2s_pwr_id; + +const static app_sleep_callbacks_t i2s_sleep_cb = +{ + .app_prepare_for_sleep = i2s_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = i2s_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool i2s_prepare_for_sleep(void) +{ + hal_i2s_state_t state; + uint8_t i; + + for (i = 0; i < APP_I2S_ID_MAX; i++) + { + if (p_i2s_env[i] == NULL) + { + continue; + } + + if (p_i2s_env[i]->i2s_state == APP_I2S_ACTIVITY) + { + state = hal_i2s_get_state(&p_i2s_env[i]->handle); + if ((state != HAL_I2S_STATE_READY) && (state != HAL_I2S_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_i2s_suspend_reg(&p_i2s_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_i2s_env[i]->i2s_state = APP_I2S_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE static void i2s_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_I2S_ID_MAX; i++) + { + if (p_i2s_env[i] == NULL) + { + continue; + } + + if (p_i2s_env[i]->i2s_state == APP_I2S_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_i2s_resume_reg(&p_i2s_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_i2s_irq[i]); + hal_nvic_enable_irq(s_i2s_irq[i]); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void i2s_wake_up(app_i2s_id_t id) +{ + if (p_i2s_env[id]->i2s_state == APP_I2S_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_i2s_resume_reg(&p_i2s_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_i2s_irq[id]); + hal_nvic_enable_irq(s_i2s_irq[id]); + + p_i2s_env[id]->i2s_state = APP_I2S_ACTIVITY; + dma_wake_up(p_i2s_env[id]->dma_id[0]); + dma_wake_up(p_i2s_env[id]->dma_id[1]); + } +} +#endif + +static uint16_t i2s_gpio_config(app_i2s_id_t id, app_i2s_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.pull = pin_cfg.ws.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.ws.pin; + io_init.mux = pin_cfg.ws.mux; + err_code = app_io_init(pin_cfg.ws.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.sdo.pull; + io_init.pin = pin_cfg.sdo.pin; + io_init.mux = pin_cfg.sdo.mux; + err_code = app_io_init(pin_cfg.sdo.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.sdi.pull; + io_init.pin = pin_cfg.sdi.pin; + io_init.mux = pin_cfg.sdi.mux; + err_code = app_io_init(pin_cfg.sdi.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.sclk.pull; + io_init.pin = pin_cfg.sclk.pin; + io_init.mux = pin_cfg.sclk.mux; + err_code = app_io_init(pin_cfg.sclk.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + return err_code; +} + +static app_i2s_id_t i2s_get_id(i2s_handle_t *p_i2s) +{ + app_i2s_id_t id = APP_I2S_ID_MAX; + + if (p_i2s->p_instance == I2S_S) + { + id = APP_I2S_ID_SLAVE; + } + else if (p_i2s->p_instance == I2S_M) + { + id = APP_I2S_ID_MASTER; + } + + return id; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_i2s_init(app_i2s_params_t *p_params, app_i2s_evt_handler_t evt_handler) +{ + app_i2s_id_t id = p_params->id; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + p_i2s_env[id] = &(p_params->i2s_env); + app_err_code = i2s_gpio_config(p_params->id, p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + soc_register_nvic(I2S_S_IRQn, (uint32_t)I2S_S_IRQHandler); + soc_register_nvic(I2S_M_IRQn, (uint32_t)I2S_M_IRQHandler); + + hal_nvic_clear_pending_irq(s_i2s_irq[id]); + hal_nvic_enable_irq(s_i2s_irq[id]); + p_i2s_env[id]->p_pin_cfg = &p_params->pin_cfg; + p_i2s_env[id]->evt_handler = evt_handler; + + memcpy(&p_i2s_env[id]->handle.init, &p_params->init, sizeof(i2s_init_t)); + p_i2s_env[id]->handle.p_instance = (i2s_regs_t *)s_i2s_instance[id]; + + hal_err_code = hal_i2s_deinit(&p_i2s_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + hal_err_code = hal_i2s_init(&p_i2s_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if (s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_i2s_pwr_id = pwr_register_sleep_cb(&i2s_sleep_cb, APP_DRIVER_I2S_WAPEUP_PRIORITY); + if (s_i2s_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_i2s_env[id]->i2s_state = APP_I2S_ACTIVITY; + p_i2s_env[id]->start_flag = false; + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_deinit(app_i2s_id_t id) +{ + uint8_t i; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_err_code = app_io_deinit(p_i2s_env[id]->p_pin_cfg->ws.type, p_i2s_env[id]->p_pin_cfg->ws.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_i2s_env[id]->p_pin_cfg->sdo.type, p_i2s_env[id]->p_pin_cfg->sdo.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_i2s_env[id]->p_pin_cfg->sdi.type, p_i2s_env[id]->p_pin_cfg->sdi.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_i2s_env[id]->p_pin_cfg->sclk.type, p_i2s_env[id]->p_pin_cfg->sclk.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + hal_nvic_disable_irq(s_i2s_irq[id]); + + p_i2s_env[id]->i2s_state = APP_I2S_INVALID; + p_i2s_env[id]->start_flag = false; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_I2S_ID_MAX; i++) + { + if (p_i2s_env[i] != NULL && (p_i2s_env[i]->i2s_state) != APP_I2S_INVALID) + { + break; + } + } + if (APP_I2S_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_i2s_pwr_id); + s_i2s_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_i2s_deinit(&p_i2s_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + if (p_i2s_env[id]->i2s_dma_state == APP_I2S_DMA_INVALID) + { + p_i2s_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (p_i2s_env[id]->start_flag == false) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_receive_it(&p_i2s_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_receive_sync(app_i2s_id_t id, uint16_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + err_code = hal_i2s_receive(&p_i2s_env[id]->handle, p_data, size, timeout); + + __HAL_I2S_DISABLE_RX_BLOCK(&p_i2s_env[id]->handle); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} +uint16_t app_i2s_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (p_i2s_env[id]->start_flag == false) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_transmit_it(&p_i2s_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_transmit_receive_sync(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length, + uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (p_i2s_env[id]->start_flag == false) + { + p_i2s_env[id]->start_flag = true; + + err_code = hal_i2s_transmit_receive(&p_i2s_env[id]->handle, p_tx_data, p_rx_data, length, timeout); + + __HAL_I2S_DISABLE_RX_BLOCK(&p_i2s_env[id]->handle); + + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + p_i2s_env[id]->start_flag = false; + + return APP_DRV_SUCCESS; +} + + +uint16_t app_i2s_transmit_receive_async(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (false == p_i2s_env[id]->start_flag) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_transmit_receive_it(&p_i2s_env[id]->handle, p_tx_data, p_rx_data, length); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + return APP_DRV_SUCCESS; +} + +/** + * @brief Abort ongoing transfer (blocking mode). + * @param id I2S ID + * @note This procedure is executed in blocking mode: When exiting + * function, Abort is considered as completed. + * @retval ::APP_DRV_SUCCESS: Operation is OK. + * @retval ::HAL_ERROR: Parameter error or operation not supported. + * @retval ::HAL_BUSY: Driver is busy. + * @retval ::HAL_TIMEOUT: Timeout occurred. + */ +uint16_t app_i2s_abort(app_i2s_id_t id) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + err_code = hal_i2s_abort(&p_i2s_env[id]->handle); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + p_i2s_env[id]->start_flag = false; + + return APP_DRV_SUCCESS; +} + + +uint16_t app_i2s_transmit_sync(app_i2s_id_t id, uint16_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + err_code = hal_i2s_transmit(&p_i2s_env[id]->handle, p_data, size, timeout); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_enable(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_ENABLE(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_disable(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_DISABLE(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_enable_clock(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_ENABLE_CLOCK(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_disable_clock(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_DISABLE_CLOCK(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_flush_tx_fifo(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_FLUSH_TX_FIFO(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_flush_rx_fifo(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + __HAL_I2S_FLUSH_RX_FIFO(&p_i2s_env[id]->handle); + + return APP_DRV_SUCCESS; +} + +i2s_handle_t *app_i2s_get_handle(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return NULL; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + return &p_i2s_env[id]->handle; +} + +void hal_i2s_tx_cplt_callback(i2s_handle_t *p_i2s) +{ + app_i2s_evt_t i2s_evt; + app_i2s_id_t id = i2s_get_id(p_i2s); + + i2s_evt.type = APP_I2S_EVT_TX_CPLT; + i2s_evt.data.size = p_i2s->tx_xfer_size - p_i2s->tx_xfer_count; + APP_I2S_CALLBACK(id, i2s_evt); +} + +void hal_i2s_rx_cplt_callback(i2s_handle_t *p_i2s) +{ + app_i2s_evt_t i2s_evt; + app_i2s_id_t id = i2s_get_id(p_i2s); + + i2s_evt.type = APP_I2S_EVT_RX_DATA; + i2s_evt.data.size = p_i2s->rx_xfer_size - p_i2s->rx_xfer_count; + __HAL_I2S_DISABLE_RX_BLOCK(p_i2s); + APP_I2S_CALLBACK(id, i2s_evt); +} + +void hal_i2s_tx_rx_cplt_callback(i2s_handle_t *p_i2s) +{ + app_i2s_evt_t i2s_evt; + app_i2s_id_t id = i2s_get_id(p_i2s); + + i2s_evt.type = APP_I2S_EVT_TX_RX; + i2s_evt.data.size = p_i2s->rx_xfer_size - p_i2s->rx_xfer_count; + __HAL_I2S_DISABLE_RX_BLOCK(p_i2s); + APP_I2S_CALLBACK(id, i2s_evt); +} + +void hal_i2s_error_callback(i2s_handle_t *p_i2s) +{ + app_i2s_evt_t i2s_evt; + app_i2s_id_t id = i2s_get_id(p_i2s); + + i2s_evt.type = APP_I2S_EVT_ERROR; + i2s_evt.data.error_code = p_i2s->error_code; + APP_I2S_CALLBACK(id, i2s_evt); +} + +SECTION_RAM_CODE void I2S_S_IRQHandler(void) +{ + hal_i2s_irq_handler(&p_i2s_env[APP_I2S_ID_SLAVE]->handle); +} + +SECTION_RAM_CODE void I2S_M_IRQHandler(void) +{ + hal_i2s_irq_handler(&p_i2s_env[APP_I2S_ID_MASTER]->handle); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s_dma.c new file mode 100644 index 0000000..1a5a820 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_i2s_dma.c @@ -0,0 +1,390 @@ +/** + **************************************************************************************** + * @file app_i2s_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_i2s_dma.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include + +#ifdef HAL_I2S_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +extern void i2s_wake_up(app_i2s_id_t id); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern i2s_env_t *p_i2s_env[APP_I2S_ID_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint16_t app_i2s_config_dma_tx(app_i2s_params_t *p_params) +{ + app_dma_params_t tx_dma_params = { 0 }; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (p_params->dma_cfg.tx_dma_instance == DMA0) + { + return APP_DRV_ERR_INVALID_PARAM; + } +#endif + + tx_dma_params.p_instance = p_params->dma_cfg.tx_dma_instance; + tx_dma_params.channel_number = p_params->dma_cfg.tx_dma_channel; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + tx_dma_params.init.src_request = DMA1_REQUEST_MEM; + tx_dma_params.init.dst_request = (p_params->id == APP_I2S_ID_SLAVE) ? DMA1_REQUEST_I2S_S_TX : DMA1_REQUEST_I2S_M_TX; +#else + tx_dma_params.init.src_request = DMA0_REQUEST_MEM; + tx_dma_params.init.dst_request = (p_params->id == APP_I2S_ID_SLAVE) ? DMA0_REQUEST_I2S_S_TX : DMA0_REQUEST_I2S_M_TX; +#endif + + tx_dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + tx_dma_params.init.src_increment = DMA_SRC_INCREMENT; + tx_dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + if (p_params->init.data_size <= I2S_DATASIZE_16BIT) + { + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_HALFWORD; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_HALFWORD; + } + else + { + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; + } + tx_dma_params.init.mode = DMA_NORMAL; + tx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_i2s_env[p_params->id]->dma_id[0] = app_dma_init(&tx_dma_params, NULL); + if (p_i2s_env[p_params->id]->dma_id[0] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + p_i2s_env[p_params->id]->handle.p_dmatx = app_dma_get_handle(p_i2s_env[p_params->id]->dma_id[0]); + p_i2s_env[p_params->id]->handle.p_dmatx->p_parent = (void*)&p_i2s_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_i2s_config_dma_rx(app_i2s_params_t *p_params) +{ + app_dma_params_t rx_dma_params = { 0 }; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (p_params->dma_cfg.rx_dma_instance == DMA0) + { + return APP_DRV_ERR_INVALID_PARAM; + } +#endif + + rx_dma_params.p_instance = p_params->dma_cfg.rx_dma_instance; + rx_dma_params.channel_number = p_params->dma_cfg.rx_dma_channel; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + rx_dma_params.init.src_request = (p_params->id == APP_I2S_ID_SLAVE) ? DMA1_REQUEST_I2S_S_RX : DMA1_REQUEST_I2S_M_RX; + rx_dma_params.init.dst_request = DMA1_REQUEST_MEM; +#else + rx_dma_params.init.src_request = (p_params->id == APP_I2S_ID_SLAVE) ? DMA0_REQUEST_I2S_S_RX : DMA0_REQUEST_I2S_M_RX; + rx_dma_params.init.dst_request = DMA0_REQUEST_MEM; +#endif + rx_dma_params.init.direction = DMA_PERIPH_TO_MEMORY; + rx_dma_params.init.src_increment = DMA_SRC_NO_CHANGE; + rx_dma_params.init.dst_increment = DMA_DST_INCREMENT; + if (p_params->init.data_size <= I2S_DATASIZE_16BIT) + { + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_HALFWORD; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_HALFWORD; + } + else + { + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; + } + rx_dma_params.init.mode = DMA_NORMAL; + rx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_i2s_env[p_params->id]->dma_id[1] = app_dma_init(&rx_dma_params, NULL); + if (p_i2s_env[p_params->id]->dma_id[1] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + p_i2s_env[p_params->id]->handle.p_dmarx = app_dma_get_handle(p_i2s_env[p_params->id]->dma_id[1]); + p_i2s_env[p_params->id]->handle.p_dmarx->p_parent = (void*)&p_i2s_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_i2s_config_dma(app_i2s_params_t *p_params) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + + p_i2s_env[p_params->id]->dma_id[0] = -1; + p_i2s_env[p_params->id]->dma_id[1] = -1; + + if (p_params->dma_cfg.tx_dma_instance == NULL && + p_params->dma_cfg.rx_dma_instance == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_params->dma_cfg.tx_dma_instance != NULL) + { + app_err_code = app_i2s_config_dma_tx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + if (p_params->dma_cfg.rx_dma_instance != NULL) + { + app_err_code = app_i2s_config_dma_rx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + + return APP_DRV_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_i2s_dma_init(app_i2s_params_t *p_params) +{ + app_i2s_id_t id = p_params->id; + app_drv_err_t app_err_code; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + GLOBAL_EXCEPTION_DISABLE(); + app_err_code = app_i2s_config_dma(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + goto __exit; + } + p_i2s_env[id]->i2s_dma_state = APP_I2S_DMA_ACTIVITY; +__exit: + GLOBAL_EXCEPTION_ENABLE(); + + return app_err_code; +} + +uint16_t app_i2s_dma_deinit(app_i2s_id_t id) +{ + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || + (p_i2s_env[id]->i2s_dma_state != APP_I2S_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_i2s_env[id]->dma_id[0]); + app_dma_deinit(p_i2s_env[id]->dma_id[1]); + + GLOBAL_EXCEPTION_DISABLE(); + p_i2s_env[id]->i2s_dma_state = APP_I2S_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + if (p_i2s_env[id]->i2s_state == APP_I2S_INVALID) + { + p_i2s_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_dma_receive_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (p_i2s_env[id]->start_flag == false) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_receive_dma(&p_i2s_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_dma_transmit_async(app_i2s_id_t id, uint16_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (p_i2s_env[id]->start_flag == false) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_transmit_dma(&p_i2s_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_i2s_dma_transmit_receive_async(app_i2s_id_t id, + uint16_t *p_tx_data, + uint16_t *p_rx_data, + uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_I2S_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_i2s_env[id] == NULL) || (p_i2s_env[id]->i2s_state == APP_I2S_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (NULL == p_tx_data || NULL == p_rx_data || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + i2s_wake_up(id); +#endif + + if (false == p_i2s_env[id]->start_flag) + { + p_i2s_env[id]->start_flag = true; + err_code = hal_i2s_transmit_receive_dma(&p_i2s_env[id]->handle, p_tx_data, p_rx_data, length); + if (err_code != HAL_OK) + { + p_i2s_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + return APP_DRV_SUCCESS; +} +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_io.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_io.c new file mode 100644 index 0000000..a2b9f6c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_io.c @@ -0,0 +1,845 @@ +/** + **************************************************************************************** + * @file app_io.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_drv.h" +#include "app_io.h" +#include "grx_hal.h" +#include "gr_soc.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define IO_MODE_NONE 0x0 +#define IO_GROUP_MAX (3) +#define IO_GROUP_MAX_PINS (16) +#define IO_GROUP_MAX_PINS_GR551X (32) +#define IO_GROUP_TYPE_MAX (3) +#define GPIO_INT_PIN_MAX (SOC_GPIO_PINS_MAX) +#define AON_INT_PIN_MAX (SOC_AON_PINS_MAX) +#define PIN_MASK (0x1) +#define PIN_SHIF (1) +#define IRQ_NUM_NONE (0) +#define GET_HANDLE(type) ((gpio_regs_t *)io_info[type].handle) +#define GET_PIN_IRQ(type) (io_info[type].irq) + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +typedef struct { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + uint8_t io_type; +#endif + app_io_callback_t callback_func; + void *arg; +} io_evt_info_t; + +typedef struct { + gpio_regs_t *handle; + IRQn_Type irq; +} io_dev_info_t; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const uint16_t s_io_pull[IO_GROUP_TYPE_MAX][APP_IO_PULL_MAX] = +{ + { GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN }, + { AON_GPIO_NOPULL, AON_GPIO_PULLUP, AON_GPIO_PULLDOWN }, + { MSIO_NOPULL, MSIO_PULLUP, MSIO_PULLDOWN }, +}; + +static io_evt_info_t gpio_evt_info[GPIO_INT_PIN_MAX]; +static io_evt_info_t aon_evt_info[AON_INT_PIN_MAX]; + +static const io_dev_info_t io_info[IO_GROUP_MAX] = +{ + { + .handle = GPIO0, + .irq = EXT0_IRQn, + }, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + { + .handle = GPIO1, + .irq = EXT1_IRQn, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + { + .handle = GPIO2, + .irq = EXT2_IRQn, + }, +#endif +}; + +static const uint16_t s_io_mode[IO_GROUP_TYPE_MAX][APP_IO_MODE_MAX] = +{ + { + IO_MODE_NONE, + GPIO_MODE_INPUT, + GPIO_MODE_OUTPUT, + GPIO_MODE_MUX, + GPIO_MODE_IT_RISING, + GPIO_MODE_IT_FALLING, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + GPIO_MODE_IT_BOTH_EDGE, +#endif + GPIO_MODE_IT_HIGH, + GPIO_MODE_IT_LOW, + IO_MODE_NONE + }, + { + IO_MODE_NONE, + AON_GPIO_MODE_INPUT, + AON_GPIO_MODE_OUTPUT, + AON_GPIO_MODE_MUX, + AON_GPIO_MODE_IT_RISING, + AON_GPIO_MODE_IT_FALLING, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + AON_GPIO_MODE_IT_BOTH_EDGE, +#endif + AON_GPIO_MODE_IT_HIGH, + AON_GPIO_MODE_IT_LOW, + IO_MODE_NONE + }, + { + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + MSIO_MODE_DIGITAL, +#endif + MSIO_MODE_DIGITAL, + MSIO_MODE_DIGITAL, + MSIO_MODE_ANALOG + }, +}; + +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) +static const uint16_t s_io_strength[IO_GROUP_TYPE_MAX][APP_IO_STRENGTH_MAX] = +{ + { + GPIO_STRENGTH_LOW, + GPIO_STRENGTH_MEDIUM, + GPIO_STRENGTH_HIGH, + GPIO_STRENGTH_ULTRA, + }, + { + AON_GPIO_STRENGTH_LOW, + AON_GPIO_STRENGTH_MEDIUM, + AON_GPIO_STRENGTH_HIGH, + AON_GPIO_STRENGTH_ULTRA, + }, + { + MSIO_STRENGTH_LOW, + MSIO_STRENGTH_MEDIUM, + MSIO_STRENGTH_HIGH, + MSIO_STRENGTH_ULTRA, + } +}; + +static const uint16_t s_io_speed[IO_GROUP_TYPE_MAX][APP_IO_SPPED_MAX] = +{ + {GPIO_SPEED_MEDIUM, GPIO_SPEED_HIGH}, + {AON_GPIO_SPEED_MEDIUM, AON_GPIO_SPEED_HIGH}, + {MSIO_SPEED_MEDIUM, MSIO_SPEED_HIGH}, +}; + +static const uint16_t s_io_input_type[IO_GROUP_TYPE_MAX][APP_IO_INPUT_TYPE_MAX] = +{ + {GPIO_INPUT_TYPE_CMOS, GPIO_INPUT_TYPE_SCHMITT}, + {AON_GPIO_INPUT_TYPE_CMOS, AON_GPIO_INPUT_TYPE_SCHMITT}, + {MSIO_INPUT_TYPE_CMOS, MSIO_INPUT_TYPE_SCHMITT}, +}; +#endif + +void EXT0_IRQHandler(void); +void EXT1_IRQHandler(void); +void EXT2_IRQHandler(void); +void AON_EXT_IRQHandler(void); + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +static int get_pin_index(uint32_t pin) +{ + int index = 0; + while ((pin & PIN_MASK) != PIN_MASK) + { + index++; + pin = pin >> PIN_SHIF; + } + return index; +} + +uint16_t app_io_init(app_io_type_t type, app_io_init_t *p_init) +{ + gpio_init_t io_config = GPIO_DEFAULT_CONFIG; + aon_gpio_init_t aon_io_config = AON_GPIO_DEFAULT_CONFIG; + msio_init_t msio_config = MSIO_DEFAULT_CONFIG; + gpio_regs_t *p_handle = NULL; + + if (NULL == p_init) + { + return APP_DRV_ERR_POINTER_NULL; + } + + soc_register_nvic(EXT0_IRQn, (uint32_t)EXT0_IRQHandler); +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + soc_register_nvic(EXT1_IRQn, (uint32_t)EXT1_IRQHandler); +#endif + soc_register_nvic(AON_EXT_IRQn, (uint32_t)AON_EXT_IRQHandler); +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) + soc_register_nvic(EXT2_IRQn, (uint32_t)EXT2_IRQHandler); +#endif + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + io_config.mode = s_io_mode[0][p_init->mode]; + io_config.pull = s_io_pull[0][p_init->pull]; + io_config.mux = p_init->mux; + io_config.pin = p_init->pin; + p_handle = GET_HANDLE(type); + if ((!(p_init->pin & APP_IO_PINS_0_15)) || (p_handle == NULL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_gpio_init(p_handle, &io_config); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + io_config.mode = s_io_mode[0][p_init->mode]; + io_config.pull = s_io_pull[0][p_init->pull]; + io_config.mux = p_init->mux; + io_config.pin = p_init->pin; + + if (APP_IO_PINS_0_15 & p_init->pin) + { + io_config.pin = (APP_IO_PINS_0_15 & p_init->pin); + hal_gpio_init(GPIO0, &io_config); + } + if (APP_IO_PINS_16_31 & p_init->pin) + { + io_config.pin = (APP_IO_PINS_16_31 & p_init->pin) >> 16; + hal_gpio_init(GPIO1, &io_config); + } + break; +#endif + case APP_IO_TYPE_AON: + aon_io_config.mode = s_io_mode[1][p_init->mode]; + aon_io_config.pull = s_io_pull[1][p_init->pull]; + aon_io_config.mux = p_init->mux; + aon_io_config.pin = p_init->pin; + if (!(p_init->pin & APP_AON_IO_PIN_ALL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_aon_gpio_init(&aon_io_config); + break; + + case APP_IO_TYPE_MSIO: + if (p_init->mode >= APP_IO_MODE_IT_RISING && p_init->mode <= APP_IO_MODE_IT_LOW) + { + return APP_DRV_ERR_INVALID_MODE; + } + if (APP_IO_MODE_OUTPUT == p_init->mode) + { + msio_config.direction = MSIO_DIRECTION_OUTPUT; + } + else + { + msio_config.direction = MSIO_DIRECTION_INPUT; + } + msio_config.mode = s_io_mode[2][p_init->mode]; + msio_config.pull = s_io_pull[2][p_init->pull]; + msio_config.mux = p_init->mux; + msio_config.pin = p_init->pin; + if (!(p_init->pin & APP_MSIO_IO_PIN_ALL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_msio_init(MSIOA, &msio_config); + break; + + default: + return APP_DRV_ERR_INVALID_TYPE; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_io_deinit(app_io_type_t type, uint32_t pin) +{ + gpio_regs_t *p_handle = NULL; + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if ((!(pin & APP_IO_PINS_0_15)) || (p_handle == NULL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_gpio_deinit(p_handle, pin); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + if (APP_IO_PINS_0_15 & pin) + { + hal_gpio_deinit(GPIO0, (APP_IO_PINS_0_15 & pin)); + } + if (APP_IO_PINS_16_31 & pin) + { + hal_gpio_deinit(GPIO1, (APP_IO_PINS_16_31 & pin) >> 16); + } + break; +#endif + case APP_IO_TYPE_AON: + if (!(pin & APP_AON_IO_PIN_ALL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_aon_gpio_deinit(pin); + break; + + case APP_IO_TYPE_MSIO: + if (!(pin & APP_MSIO_IO_PIN_ALL)) + return APP_DRV_ERR_INVALID_PARAM; + hal_msio_deinit(MSIOA, pin); + break; + + default: + return APP_DRV_ERR_INVALID_TYPE; + } + + return APP_DRV_SUCCESS; +} + +app_io_pin_state_t app_io_read_pin(app_io_type_t type, uint32_t pin) +{ + app_io_pin_state_t pin_state = APP_IO_PIN_RESET; + gpio_regs_t *p_handle = NULL; + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + pin_state = (app_io_pin_state_t)hal_gpio_read_pin(p_handle, pin); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + if (APP_IO_PINS_0_15 & pin) + { + pin_state = (app_io_pin_state_t)hal_gpio_read_pin(GPIO0, pin); + } + if (APP_IO_PINS_16_31 & pin) + { + pin_state = (app_io_pin_state_t)hal_gpio_read_pin(GPIO1, pin >> 16); + } + break; +#endif + case APP_IO_TYPE_AON: + pin_state = (app_io_pin_state_t)hal_aon_gpio_read_pin(pin); + break; + + case APP_IO_TYPE_MSIO: + pin_state = (app_io_pin_state_t)hal_msio_read_pin(MSIOA, pin); + break; + + default: + break; + } + + return pin_state; +} + +uint16_t app_io_write_pin(app_io_type_t type, uint32_t pin, app_io_pin_state_t pin_state) +{ + gpio_regs_t *p_handle = NULL; + + if (pin_state != APP_IO_PIN_RESET && pin_state != APP_IO_PIN_SET) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if (p_handle == NULL) + return APP_DRV_ERR_INVALID_PARAM; + hal_gpio_write_pin(p_handle, pin, (gpio_pin_state_t)pin_state); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + if (APP_IO_PINS_0_15 & pin) + { + hal_gpio_write_pin(GPIO0, (uint16_t)(APP_IO_PINS_0_15 & pin), (gpio_pin_state_t)pin_state); + } + if (APP_IO_PINS_16_31 & pin) + { + hal_gpio_write_pin(GPIO1, (uint16_t)((APP_IO_PINS_16_31 & pin) >> 16), (gpio_pin_state_t)pin_state); + } + break; +#endif + case APP_IO_TYPE_AON: + hal_aon_gpio_write_pin(pin, (aon_gpio_pin_state_t)pin_state); + break; + + case APP_IO_TYPE_MSIO: + hal_msio_write_pin(MSIOA, pin, (msio_pin_state_t)pin_state); + break; + + default: + return APP_DRV_ERR_INVALID_TYPE; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_io_toggle_pin(app_io_type_t type, uint32_t pin) +{ + gpio_regs_t *p_handle = NULL; + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if (p_handle == NULL) + return APP_DRV_ERR_INVALID_PARAM; + hal_gpio_toggle_pin(p_handle, pin); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + if (APP_IO_PINS_0_15 & pin) + { + hal_gpio_toggle_pin(GPIO0, (uint16_t)(APP_IO_PINS_0_15 & pin)); + } + if (APP_IO_PINS_16_31 & pin) + { + hal_gpio_toggle_pin(GPIO1, (uint16_t)((APP_IO_PINS_16_31 & pin) >> 16)); + } + break; +#endif + case APP_IO_TYPE_AON: + hal_aon_gpio_toggle_pin(pin); + break; + + case APP_IO_TYPE_MSIO: + hal_msio_toggle_pin(MSIOA, pin); + break; + default: + return APP_DRV_ERR_INVALID_TYPE; + } + + return APP_DRV_SUCCESS; +} + + +uint16_t app_io_set_speed(app_io_type_t type, uint32_t pin, app_io_speed_t speed) +{ +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) + gpio_regs_t *p_handle = NULL; + uint32_t io_speed; + + if (speed > APP_IO_SPPED_MAX) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if (p_handle == NULL) + return APP_DRV_ERR_INVALID_PARAM; + + io_speed = s_io_speed[0][speed]; + ll_gpio_set_pin_speed(p_handle, pin, io_speed); + break; + + case APP_IO_TYPE_AON: + io_speed = s_io_speed[1][speed]; + ll_aon_gpio_set_pin_speed(pin, io_speed); + break; + case APP_IO_TYPE_MSIO: + io_speed = s_io_speed[2][speed]; + ll_msio_set_pin_speed(MSIOA, pin, io_speed); + break; + default: + return APP_DRV_ERR_INVALID_TYPE; + } + return APP_DRV_SUCCESS; +#else + return APP_DRV_ERR_INVALID_MODE; +#endif +} + + +uint16_t app_io_set_strength(app_io_type_t type, uint32_t pin, app_io_strength_t strength) +{ +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) + gpio_regs_t *p_handle = NULL; + uint32_t io_strength; + + if (strength >= APP_IO_STRENGTH_MAX) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if (p_handle == NULL) + return APP_DRV_ERR_INVALID_PARAM; + + io_strength = s_io_strength[0][strength]; + ll_gpio_set_pin_strength(p_handle, pin, io_strength); + break; + + case APP_IO_TYPE_AON: + io_strength = s_io_strength[1][strength]; + ll_aon_gpio_set_pin_strength(pin, io_strength); + break; + case APP_IO_TYPE_MSIO: + io_strength = s_io_strength[2][strength]; + ll_msio_set_pin_strength(MSIOA, pin, io_strength); + break; + default: + return APP_DRV_ERR_INVALID_TYPE; + } + return APP_DRV_SUCCESS; +#else + return APP_DRV_ERR_INVALID_MODE; +#endif +} + +uint16_t app_io_set_intput_type(app_io_type_t type, uint32_t pin, app_io_input_type_t input_type) +{ +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X)) + gpio_regs_t *p_handle = NULL; + uint32_t io_input_type; + + if (input_type > APP_IO_INPUT_TYPE_MAX) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + p_handle = GET_HANDLE(type); + if (p_handle == NULL) + return APP_DRV_ERR_INVALID_PARAM; + + io_input_type = s_io_input_type[0][input_type]; + ll_gpio_set_pin_input_type(p_handle, pin, io_input_type); + break; + + case APP_IO_TYPE_AON: + io_input_type = s_io_input_type[1][input_type]; + ll_aon_gpio_set_pin_input_type(pin, io_input_type); + break; + case APP_IO_TYPE_MSIO: + io_input_type = s_io_input_type[2][input_type]; + ll_msio_set_pin_input_type(MSIOA, pin, io_input_type); + break; + default: + return APP_DRV_ERR_INVALID_TYPE; + } + return APP_DRV_SUCCESS; +#else + return APP_DRV_ERR_INVALID_MODE; +#endif +} + +uint16_t app_io_event_register_cb(app_io_type_t type, app_io_init_t *p_init, app_io_callback_t io_evt_cb, void *arg) +{ + uint16_t ret; + uint32_t pin = p_init->pin; + uint8_t pin_index; + uint8_t base_pins = 0; + uint16_t group_pins; + IRQn_Type irq; + + if (type == APP_IO_TYPE_MSIO) + { + return APP_DRV_ERR_INVALID_TYPE; + } + + app_io_deinit(type, pin); + ret = app_io_init(type, p_init); + APP_DRV_ERR_CODE_CHECK(ret); + + if (type == APP_IO_TYPE_AON) + { + group_pins = AON_INT_PIN_MAX; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + switch (p_init->mode) + { + case APP_IO_MODE_IT_RISING: + hal_pwr_config_ext_wakeup(pin, PWR_EXTWKUP_TYPE_RISING); + break; + + case APP_IO_MODE_IT_FALLING: + hal_pwr_config_ext_wakeup(pin, PWR_EXTWKUP_TYPE_FALLING); + break; + + case APP_IO_MODE_IT_HIGH: + hal_pwr_config_ext_wakeup(pin, PWR_EXTWKUP_TYPE_HIGH); + break; + + case APP_IO_MODE_IT_LOW: + hal_pwr_config_ext_wakeup(pin, PWR_EXTWKUP_TYPE_LOW); + break; + + default: break; + } + extern void pwr_mgmt_wakeup_source_setup(uint32_t wakeup_source); + pwr_mgmt_wakeup_source_setup(PWR_WKUP_COND_EXT); +#endif + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + else if (type == APP_IO_TYPE_NORMAL) + { + group_pins = IO_GROUP_MAX_PINS_GR551X; + base_pins = 0; + } +#endif + else + { + group_pins = IO_GROUP_MAX_PINS; + base_pins = IO_GROUP_MAX_PINS * type; + } + for (pin_index = 0; pin_index < group_pins; pin_index++) + { + if (pin & PIN_MASK) + { + switch(type) + { + case APP_IO_TYPE_GPIOA: + case APP_IO_TYPE_GPIOB: + case APP_IO_TYPE_GPIOC: + irq = GET_PIN_IRQ(type); + if (irq == IRQ_NUM_NONE) + return APP_DRV_ERR_INVALID_PARAM; + GLOBAL_EXCEPTION_DISABLE(); + gpio_evt_info[pin_index + base_pins].callback_func = io_evt_cb; + gpio_evt_info[pin_index + base_pins].arg = arg; + GLOBAL_EXCEPTION_ENABLE(); + hal_nvic_clear_pending_irq(irq); + hal_nvic_enable_irq(irq); + break; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + case APP_IO_TYPE_NORMAL: + GLOBAL_EXCEPTION_DISABLE(); + gpio_evt_info[pin_index + base_pins].callback_func = io_evt_cb; + gpio_evt_info[pin_index + base_pins].arg = arg; + gpio_evt_info[pin_index + base_pins].io_type = APP_IO_TYPE_NORMAL; + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(EXT0_IRQn); + hal_nvic_enable_irq(EXT0_IRQn); + hal_nvic_clear_pending_irq(EXT1_IRQn); + hal_nvic_enable_irq(EXT1_IRQn); + break; +#endif + case APP_IO_TYPE_AON: + GLOBAL_EXCEPTION_DISABLE(); + aon_evt_info[pin_index + base_pins].callback_func = io_evt_cb; + aon_evt_info[pin_index + base_pins].arg = arg; + GLOBAL_EXCEPTION_ENABLE(); + hal_nvic_clear_pending_irq(AON_EXT_IRQn); + hal_nvic_enable_irq(AON_EXT_IRQn); + break; + default: + return APP_DRV_ERR_INVALID_TYPE; + } + } + pin >>= PIN_SHIF; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_io_event_unregister(app_io_type_t type, uint32_t pin) +{ + uint16_t group_pins; + uint8_t pin_index; + uint8_t base_pins = 0; + uint32_t pin_tmp = pin; + io_evt_info_t *p_evt_cb = NULL; + + if (type == APP_IO_TYPE_MSIO) + { + return APP_DRV_ERR_INVALID_TYPE; + } + + if (type == APP_IO_TYPE_AON) + { + group_pins = AON_INT_PIN_MAX; + p_evt_cb = aon_evt_info; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + else if (type == APP_IO_TYPE_NORMAL) + { + group_pins = IO_GROUP_MAX_PINS_GR551X; + base_pins = 0; + p_evt_cb = gpio_evt_info; + } +#endif + else + { + group_pins = IO_GROUP_MAX_PINS; + base_pins = IO_GROUP_MAX_PINS * type; + p_evt_cb = gpio_evt_info; + } + + for (pin_index = 0; pin_index < group_pins; pin_index++) + { + if (pin_tmp & PIN_MASK) + { + GLOBAL_EXCEPTION_DISABLE(); + p_evt_cb[pin_index + base_pins].callback_func = NULL; + p_evt_cb[pin_index + base_pins].arg = NULL; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + gpio_evt_info[pin_index + base_pins].io_type = 0; +#endif + GLOBAL_EXCEPTION_ENABLE(); + } + pin_tmp >>= PIN_SHIF; + } + + return app_io_deinit(type, pin); +} + +void hal_gpio_exti_callback(gpio_regs_t *GPIOx, uint16_t gpio_pin) +{ + uint16_t pin_index = get_pin_index(gpio_pin); + app_io_evt_t io_evt; + int idx; + + for (idx = 0; idx < IO_GROUP_MAX; idx++) + { + if (GPIOx != io_info[idx].handle) + continue; + + pin_index += idx * IO_GROUP_MAX_PINS; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (gpio_evt_info[pin_index].io_type == APP_IO_TYPE_NORMAL) + { + io_evt.type = APP_IO_TYPE_NORMAL; + } + else + { + io_evt.type = (app_io_type_t)idx; + } + if (GPIO1 == GPIOx) + { + io_evt.pin = (uint32_t)(gpio_pin << 16); + } + else + { + io_evt.pin = gpio_pin; + } +#else + io_evt.type = (app_io_type_t)idx; + io_evt.pin = gpio_pin; +#endif + io_evt.arg = gpio_evt_info[pin_index].arg; + if (gpio_evt_info[pin_index].callback_func != NULL) + gpio_evt_info[pin_index].callback_func(&io_evt); + } +} + +void hal_aon_gpio_callback(uint16_t aon_gpio_pin) +{ + app_io_evt_t io_evt; + uint16_t pin_index = 0; + uint16_t aon_pin = aon_gpio_pin; + int i; + + io_evt.type = APP_IO_TYPE_AON; + for (i = 0; i < AON_INT_PIN_MAX; i++) + { + if (aon_pin & PIN_MASK) + { + io_evt.pin = 0x1U << pin_index; + io_evt.arg = aon_evt_info[pin_index].arg; + if (aon_evt_info[pin_index].callback_func != NULL) + aon_evt_info[pin_index].callback_func(&io_evt); + } + pin_index++; + aon_pin >>= PIN_SHIF; + } +} + +#define EXT_IQR_HANDLER(index) \ +SECTION_RAM_CODE void EXT##index##_IRQHandler(void)\ +{\ + hal_gpio_exti_irq_handler(io_info[index].handle);\ +} + +SECTION_RAM_CODE void AON_EXT_IRQHandler(void) +{ + hal_aon_gpio_irq_handler(); +} + +EXT_IQR_HANDLER(0) +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) +EXT_IQR_HANDLER(1) +EXT_IQR_HANDLER(2) +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_iso7816.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_iso7816.c new file mode 100644 index 0000000..eb30b85 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_iso7816.c @@ -0,0 +1,645 @@ +/** + **************************************************************************************** + * @file app_iso7816.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_iso7816.h" +#include "app_io.h" +#include "app_drv.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" +#include + +#ifdef HAL_ISO7816_MODULE_ENABLED + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool iso7816_prepare_for_sleep(void); +static void iso7816_wake_up_ind(void); +static uint16_t iso7816_gpio_config(app_iso7816_pin_cfg_t pin_cfg); +void ISO7816_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const uint32_t s_iso7816_instance = ISO7816_BASE; + +iso7816_env_t *p_iso7816_env = NULL; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_iso7816_pwr_id; + +/* sim card command and response data buffer */ +#define ISO7816_BUFFER_SIZE 33 +static __ALIGNED(4) uint8_t iso7816_buffer[ISO7816_BUFFER_SIZE]; +static const app_sleep_callbacks_t iso7816_sleep_cb = +{ + .app_prepare_for_sleep = iso7816_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = iso7816_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool iso7816_prepare_for_sleep(void) +{ + hal_iso7816_state_t state; + + if (p_iso7816_env->iso7816_state == APP_ISO7816_ACTIVITY) + { + state = hal_iso7816_get_state(&p_iso7816_env->handle); + if ((state != HAL_ISO7816_STATE_READY) && (state != HAL_ISO7816_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_iso7816_suspend_reg(&p_iso7816_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_iso7816_env->iso7816_state = APP_ISO7816_SLEEP; + #endif + } + return true; +} + +SECTION_RAM_CODE static void iso7816_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + if (p_iso7816_env->iso7816_state == APP_ISO7816_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_iso7816_resume_reg(&p_iso7816_env->handle); //TODO + GLOBAL_EXCEPTION_ENABLE(); + + if(p_iso7816_env->use_mode!= APP_ISO7816_TYPE_POLLING) + { + hal_nvic_clear_pending_irq(ISO7816_IRQn); + hal_nvic_enable_irq(ISO7816_IRQn); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +static void iso7816_wake_up(void) +{ + if (p_iso7816_env->iso7816_state == APP_ISO7816_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_iso7816_resume_reg(&p_iso7816_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + + if(p_iso7816_env->use_mode != APP_ISO7816_TYPE_POLLING) + { + hal_nvic_clear_pending_irq(ISO7816_IRQn); + hal_nvic_enable_irq(ISO7816_IRQn); + } + p_iso7816_env->iso7816_state = APP_ISO7816_ACTIVITY; + } +} +#endif + +static uint16_t iso7816_gpio_config(app_iso7816_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.pull = pin_cfg.clk.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.clk.pin; + io_init.mux = pin_cfg.clk.mux; + err_code = app_io_init(pin_cfg.clk.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.rst.pull; + io_init.pin = pin_cfg.rst.pin; + io_init.mux = pin_cfg.rst.mux; + err_code = app_io_init(pin_cfg.rst.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.io.pull; + io_init.pin = pin_cfg.io.pin; + io_init.mux = pin_cfg.io.mux; + err_code = app_io_init(pin_cfg.io.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.presence.pull; + io_init.pin = pin_cfg.presence.pin; + io_init.mux = pin_cfg.presence.mux; + err_code = app_io_init(pin_cfg.presence.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + return err_code; +} + +static void app_iso7816_event_call(iso7816_handle_t *p_iso7816, app_iso7816_evt_type_t evt_type) +{ + app_iso7816_evt_t iso7816_evt; + iso7816_evt.type = evt_type; + if(evt_type == APP_ISO7816_EVT_ERROR) + { + iso7816_evt.data.error_code = p_iso7816->error_code; + } + else if(evt_type == APP_ISO7816_EVT_TX_CPLT) + { + iso7816_evt.data.size = p_iso7816->tx_xfer_size - p_iso7816->rx_xfer_count; + } + else if(evt_type == APP_ISO7816_EVT_RX_CPLT) + { + iso7816_evt.data.size = p_iso7816->tx_xfer_size - p_iso7816->rx_xfer_count; + } + + p_iso7816_env->start_flag = false; + if (p_iso7816_env->evt_handler != NULL) + { + p_iso7816_env->evt_handler(&iso7816_evt); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_iso7816_init(app_iso7816_params_t *p_params, app_iso7816_evt_handler_t evt_handler) +{ + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + p_iso7816_env = &p_params->iso7816_env; + app_err_code = iso7816_gpio_config(p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + p_iso7816_env->use_mode = p_params->use_mode; + p_iso7816_env->p_pin_cfg = &p_params->pin_cfg; + p_iso7816_env->evt_handler = evt_handler; + + memcpy(&p_iso7816_env->handle.init, &p_params->init, sizeof(iso7816_init_t)); + p_iso7816_env->handle.p_instance = (iso7816_regs_t *)s_iso7816_instance; + p_iso7816_env->handle.buffer_size = ISO7816_BUFFER_SIZE; + p_iso7816_env->handle.tx_xfer_size = ISO7816_BUFFER_SIZE; + p_iso7816_env->handle.rx_xfer_size = ISO7816_BUFFER_SIZE; + p_iso7816_env->handle.p_tx_rx_buffer = iso7816_buffer; + + hal_err_code = hal_iso7816_init(&p_iso7816_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if(p_params->use_mode != APP_ISO7816_TYPE_POLLING) + { + soc_register_nvic(ISO7816_IRQn, (uint32_t)ISO7816_IRQHandler); + hal_nvic_clear_pending_irq(ISO7816_IRQn); + hal_nvic_enable_irq(ISO7816_IRQn); + } + + if (s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_iso7816_pwr_id = pwr_register_sleep_cb(&iso7816_sleep_cb, APP_DRIVER_ISO7816_WAPEUP_PRIORITY); + + if (s_iso7816_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + p_iso7816_env->iso7816_state = APP_ISO7816_ACTIVITY; + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_deinit(void) +{ + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_err_code = app_io_deinit(p_iso7816_env->p_pin_cfg->clk.type, p_iso7816_env->p_pin_cfg->clk.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_iso7816_env->p_pin_cfg->rst.type, p_iso7816_env->p_pin_cfg->rst.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_iso7816_env->p_pin_cfg->io.type, p_iso7816_env->p_pin_cfg->io.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + app_err_code = app_io_deinit(p_iso7816_env->p_pin_cfg->presence.type, p_iso7816_env->p_pin_cfg->presence.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + hal_nvic_disable_irq(ISO7816_IRQn); + + p_iso7816_env->iso7816_state = APP_ISO7816_INVALID; + p_iso7816_env->start_flag = false; + + GLOBAL_EXCEPTION_DISABLE(); + if(p_iso7816_env->iso7816_state == APP_ISO7816_INVALID) + { + pwr_unregister_sleep_cb(s_iso7816_pwr_id); + s_iso7816_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_iso7816_deinit(&p_iso7816_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + p_iso7816_env = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_receive_sync(uint16_t size, uint32_t timeout) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + err_code = hal_iso7816_receive(&p_iso7816_env->handle, size, timeout); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_receive_async(uint16_t size) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_iso7816_env->use_mode == APP_ISO7816_TYPE_POLLING) + { + return APP_DRV_ERR_INVALID_MODE; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + if(p_iso7816_env->start_flag == false) + { + p_iso7816_env->start_flag = true; + err_code = hal_iso7816_receive_it(&p_iso7816_env->handle, size); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_transmit_sync(uint16_t size, uint32_t timeout) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + err_code = hal_iso7816_transmit(&p_iso7816_env->handle, size, timeout); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_transmit_async(uint16_t size) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_iso7816_env->use_mode == APP_ISO7816_TYPE_POLLING) + { + return APP_DRV_ERR_INVALID_MODE; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + if(p_iso7816_env->start_flag == false) + { + p_iso7816_env->start_flag = true; + + switch(p_iso7816_env->use_mode) + { + case APP_ISO7816_TYPE_INTERRUPT: + err_code = hal_iso7816_transmit_it(&p_iso7816_env->handle, size); + break; + case APP_ISO7816_TYPE_POLLING: + err_code = hal_iso7816_transmit(&p_iso7816_env->handle, size,100); + break; + default: + break; + } + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_transmit_receive_async(uint16_t tx_size, uint16_t rx_size) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (tx_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_iso7816_env->use_mode == APP_ISO7816_TYPE_POLLING) + { + return APP_DRV_ERR_INVALID_MODE; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + if(p_iso7816_env->start_flag == false) + { + p_iso7816_env->start_flag = true; + + err_code = hal_iso7816_transmit_receive_it(&p_iso7816_env->handle, tx_size, rx_size); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_transmit_receive_sync(uint16_t tx_size, uint16_t rx_size, uint32_t timeout) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (tx_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + err_code = hal_iso7816_transmit_receive(&p_iso7816_env->handle, tx_size, rx_size, timeout); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint32_t app_iso7816_get_power_states(void) +{ + uint32_t power_states; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + power_states = hal_iso7816_get_power_states(&p_iso7816_env->handle); + + return power_states; +} + +uint16_t app_iso7816_set_action(uint32_t action) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (action > APP_ISO7816_ACTION_TXRX) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + err_code = hal_iso7816_set_action(&p_iso7816_env->handle, action); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_iso7816_set_etudiv(uint32_t devide) +{ + hal_status_t err_code = HAL_OK; + + if ((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + + if(p_iso7816_env->start_flag == false) + { + p_iso7816_env->start_flag = true; + + err_code = hal_iso7816_set_etudiv(&p_iso7816_env->handle, devide); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +iso7816_handle_t *app_iso7816_get_handle(void) +{ + if((p_iso7816_env == NULL) || (p_iso7816_env->iso7816_state == APP_ISO7816_INVALID)) + { + return NULL; + } +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + iso7816_wake_up(); +#endif + return &p_iso7816_env->handle; +} + +void hal_iso7816_error_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_ERROR); +} + +void hal_iso7816_abort_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_ABORT); +} + +void hal_iso7816_presence_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_PRESENCE); +} + +void hal_iso7816_atr_cplt_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_ATR_CPLT); +} + +void hal_iso7816_tx_cplt_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_TX_CPLT); +} + +void hal_iso7816_rx_cplt_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_RX_CPLT); +} + +void hal_iso7816_tx_rx_cplt_callback(iso7816_handle_t *p_iso7816) +{ + app_iso7816_event_call(p_iso7816, APP_ISO7816_EVT_TX_RX_CPLT); +} + +void ISO7816_IRQHandler(void) +{ + hal_iso7816_irq_handler(&p_iso7816_env->handle); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm.c new file mode 100644 index 0000000..488048d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm.c @@ -0,0 +1,695 @@ +/** + **************************************************************************************** + * @file app_pwm.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_pwm.h" +#include "app_io.h" +#include "app_pwr_mgmt.h" +#include +#include "gr_soc.h" + +#ifdef HAL_CALENDAR_MODULE_ENABLED + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool pwm_prepare_for_sleep(void); +static void pwm_wake_up_ind(void); +static uint16_t pwm_gpio_config(app_pwm_pin_cfg_t pin_cfg); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +pwm_env_t *p_pwm_env[APP_PWM_ID_MAX]; +static const uint32_t s_pwm_instance[APP_PWM_ID_MAX] = {PWM0_BASE, PWM1_BASE}; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_pwm_pwr_id; + +static const app_sleep_callbacks_t pwm_sleep_cb = +{ + .app_prepare_for_sleep = pwm_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = pwm_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +bool pwm_prepare_for_sleep(void) +{ + hal_pwm_state_t state; + uint8_t i; + + for (i = 0; i < APP_PWM_ID_MAX; i++) + { + if (p_pwm_env[i] == NULL) + { + continue; + } + + if (p_pwm_env[i] != NULL && p_pwm_env[i]->pwm_state == APP_PWM_ACTIVITY) + { + state = hal_pwm_get_state(&p_pwm_env[i]->handle); + if ((state != HAL_PWM_STATE_RESET) && (state != HAL_PWM_STATE_READY)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_pwm_suspend_reg(&p_pwm_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_pwm_env[i]->pwm_state = APP_PWM_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE void pwm_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_PWM_ID_MAX; i++) + { + if (p_pwm_env[i] == NULL) + { + continue; + } + + if (p_pwm_env[i] != NULL && p_pwm_env[i]->pwm_state == APP_PWM_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_pwm_resume_reg(&p_pwm_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + if (p_pwm_env[i]->pwm_module_state == APP_PWM_START) + { + hal_pwm_start(&p_pwm_env[i]->handle); + } + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void pwm_wake_up(app_pwm_id_t id) +{ + if (p_pwm_env[id] != NULL && p_pwm_env[id]->pwm_state == APP_PWM_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_pwm_resume_reg(&p_pwm_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + if (p_pwm_env[id]->pwm_module_state == APP_PWM_START) + { + hal_pwm_start(&p_pwm_env[id]->handle); + } + } +} +#endif + +static uint16_t pwm_gpio_config(app_pwm_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.pull = APP_IO_PULLUP; + io_init.mode = APP_IO_MODE_MUX; + + if (pin_cfg.channel_a.enable == APP_PWM_PIN_ENABLE) + { + io_init.pin = pin_cfg.channel_a.pin; + io_init.mux = pin_cfg.channel_a.mux; + err_code = app_io_init(pin_cfg.channel_a.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + if (pin_cfg.channel_b.enable == APP_PWM_PIN_ENABLE) + { + io_init.pin = pin_cfg.channel_b.pin; + io_init.mux = pin_cfg.channel_b.mux; + err_code = app_io_init(pin_cfg.channel_b.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + if (pin_cfg.channel_c.enable == APP_PWM_PIN_ENABLE) + { + io_init.pin = pin_cfg.channel_c.pin; + io_init.mux = pin_cfg.channel_c.mux; + err_code = app_io_init(pin_cfg.channel_c.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + +static void app_pwm_event_call(pwm_handle_t *p_pwm, app_pwm_evt_type_t evt_type) +{ + app_pwm_evt_t pwm_evt; + app_pwm_id_t id = APP_PWM_ID_0; + + pwm_evt.type = evt_type; + if(pwm_evt.type == APP_PWM_CHANNEL_A_ERROR) { + pwm_evt.error_code = HAL_PWM_CHANNEL_A_ERROR; + } else if (pwm_evt.type == APP_PWM_CHANNEL_B_ERROR) { + pwm_evt.error_code = HAL_PWM_CHANNEL_B_ERROR; + } else if (pwm_evt.type == APP_PWM_CHANNEL_C_ERROR) { + pwm_evt.error_code = HAL_PWM_CHANNEL_C_ERROR; + } else { + pwm_evt.error_code = HAL_PWM_ERROR_NONE; + } + + p_pwm_env[id]->evt_handler(&pwm_evt); +} + +void PWM0_IRQHandler(void) +{ + hal_pwm_irq_handler(&p_pwm_env[APP_PWM_ID_0]->handle); +} + +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +uint16_t app_pwm_init(app_pwm_params_t *p_params, app_pwm_evt_handler_t evt_handler) +#else +uint16_t app_pwm_init(app_pwm_params_t *p_params) +#endif +{ + app_pwm_id_t id = p_params->id; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + p_pwm_env[id] = &(p_params->pwm_env); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + soc_register_nvic(PWM0_IRQn, (uint32_t)PWM0_IRQHandler); + + NVIC_ClearPendingIRQ(PWM0_IRQn); + NVIC_EnableIRQ(PWM0_IRQn); +#endif + + app_err_code = pwm_gpio_config(p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + memcpy(&p_pwm_env[id]->handle.init, &p_params->init, sizeof(pwm_init_t)); + + p_pwm_env[id]->p_pin_cfg = &p_params->pin_cfg; + p_pwm_env[id]->handle.active_channel = (hal_pwm_active_channel_t)p_params->active_channel; + p_pwm_env[id]->handle.p_instance = (pwm_regs_t *)s_pwm_instance[id]; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + p_pwm_env[id]->evt_handler = evt_handler; +#endif + + hal_err_code = hal_pwm_deinit(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_pwm_init(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + if (!s_sleep_cb_registered_flag) + { + s_sleep_cb_registered_flag = true; + + s_pwm_pwr_id = pwr_register_sleep_cb(&pwm_sleep_cb, APP_DRIVER_PWM_WAPEUP_PRIORITY); + if (s_pwm_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_pwm_env[id]->pwm_state = APP_PWM_ACTIVITY; + p_pwm_env[id]->pwm_module_state = APP_PWM_STOP; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_deinit(app_pwm_id_t id) +{ + uint8_t i; + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + p_pwm_env[id]->pwm_state = APP_PWM_INVALID; + p_pwm_env[id]->pwm_module_state = APP_PWM_STOP; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_PWM_ID_MAX; i++) + { + if (p_pwm_env[i] != NULL && (p_pwm_env[i]->pwm_state) != APP_PWM_INVALID) + { + break; + } + } + if (APP_PWM_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_pwm_pwr_id); + s_pwm_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + if (p_pwm_env[id]->p_pin_cfg->channel_a.enable == APP_PWM_PIN_ENABLE) + { + app_io_deinit(p_pwm_env[id]->p_pin_cfg->channel_a.type, p_pwm_env[id]->p_pin_cfg->channel_a.pin); + } + if (p_pwm_env[id]->p_pin_cfg->channel_b.enable == APP_PWM_PIN_ENABLE) + { + app_io_deinit(p_pwm_env[id]->p_pin_cfg->channel_b.type, p_pwm_env[id]->p_pin_cfg->channel_b.pin); + } + if (p_pwm_env[id]->p_pin_cfg->channel_c.enable == APP_PWM_PIN_ENABLE) + { + app_io_deinit(p_pwm_env[id]->p_pin_cfg->channel_c.type, p_pwm_env[id]->p_pin_cfg->channel_c.pin); + } + + err_code = hal_pwm_deinit(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_start(app_pwm_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_start(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_START; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_stop(app_pwm_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_stop(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_STOP; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_update_freq(app_pwm_id_t id, uint32_t freq) +{ + hal_status_t err_code; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_update_freq(&p_pwm_env[id]->handle, freq); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_config_channel(app_pwm_id_t id, app_pwm_active_channel_t channel, app_pwm_channel_init_t *p_config) +{ + hal_status_t err_code; + + hal_pwm_active_channel_t active_channel; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + pwm_none_coding_channel_init_t channel_cfg; +#else + pwm_channel_init_t channel_cfg; +#endif + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + active_channel = (hal_pwm_active_channel_t)channel; + channel_cfg.duty = p_config->duty; + channel_cfg.drive_polarity = p_config->drive_polarity; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + channel_cfg.fstoplvl = p_config->fstoplvl; +#endif + + err_code = hal_pwm_config_channel(&p_pwm_env[id]->handle, &channel_cfg, active_channel); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + +uint16_t app_pwm_resume(app_pwm_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_resume(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_START; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_pause(app_pwm_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_pause(&p_pwm_env[id]->handle); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_STOP; + + return APP_DRV_SUCCESS; +} + +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + +uint16_t app_pwm_inactive_channel(app_pwm_id_t id, app_pwm_active_channel_t channel) +{ + hal_status_t err_code; + + hal_pwm_active_channel_t active_channel; + + if (id >= APP_PWM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + active_channel = (hal_pwm_active_channel_t)channel; + + err_code = hal_pwm_inactive_channel(&p_pwm_env[id]->handle, active_channel); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#endif + +pwm_handle_t *app_pwm_get_handle(app_pwm_id_t id) +{ + if (id >= APP_PWM_ID_MAX) + { + return NULL; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + return &p_pwm_env[id]->handle; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + +uint16_t app_pwm_set_coding_data_in_one_channel(app_pwm_id_t id, uint32_t coding_data) +{ + hal_status_t err_code; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_set_coding_data_in_one_channel(&p_pwm_env[id]->handle, coding_data); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_set_coding_data_in_three_channels(app_pwm_id_t id, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2) +{ + hal_status_t err_code; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_set_coding_data_in_three_channels(&p_pwm_env[id]->handle, coding_data0, coding_data1, coding_data2); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_start_coding_in_one_channel(app_pwm_id_t id, uint32_t coding_data) +{ + hal_status_t err_code; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_start_coding_in_one_channel(&p_pwm_env[id]->handle, coding_data); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_START; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_start_coding_in_three_channels(app_pwm_id_t id, uint32_t coding_data0, uint32_t coding_data1, uint32_t coding_data2) +{ + hal_status_t err_code; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_start_coding_in_three_channels(&p_pwm_env[id]->handle, coding_data0, coding_data1, coding_data2); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_START; + + return APP_DRV_SUCCESS; +} + +void hal_pwm_channel_a_error_callback(pwm_handle_t *p_pwm) +{ + app_pwm_event_call(p_pwm, APP_PWM_CHANNEL_A_ERROR); +} + +void hal_pwm_channel_b_error_callback(pwm_handle_t *p_pwm) +{ + app_pwm_event_call(p_pwm, APP_PWM_CHANNEL_B_ERROR); +} + +void hal_pwm_channel_c_error_callback(pwm_handle_t *p_pwm) +{ + app_pwm_event_call(p_pwm, APP_PWM_CHANNEL_C_ERROR); +} + +void hal_pwm_coding_done_callback(pwm_handle_t *p_pwm) +{ + app_pwm_event_call(p_pwm, APP_PWM_CODING_DONE); +} + +void hal_pwm_coding_load_callback(pwm_handle_t *p_pwm) +{ + app_pwm_event_call(p_pwm, APP_PWM_CODING_LOAD); +} + +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm_dma.c new file mode 100644 index 0000000..1e42847 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwm_dma.c @@ -0,0 +1,201 @@ +/** + **************************************************************************************** + * @file app_pwm_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_pwm_dma.h" +#include "app_dma.h" +#include "app_drv_config.h" +#include "app_pwr_mgmt.h" +#include +#include "gr_soc.h" + +#ifdef HAL_PWM_MODULE_ENABLED + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + +/* + * DEFINES + ***************************************************************************************** + */ + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +extern bool pwm_prepare_for_sleep(void); +extern void pwm_sleep_canceled(void); +extern void pwm_wake_up_ind(void); +extern void pwm_wake_up(app_pwm_id_t id); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern pwm_env_t *p_pwm_env[APP_PWM_ID_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint16_t app_pwm_config_dma(app_pwm_params_t *p_params) +{ + app_dma_params_t dma_params; + + dma_params.p_instance = p_params->use_mode.pwm_dma_instance; + dma_params.channel_number = p_params->use_mode.pwm_dma_channel; + + if(dma_params.p_instance != DMA0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if(p_params->id >= APP_PWM_ID_1) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + dma_params.init.src_request = DMA0_REQUEST_MEM; + dma_params.init.dst_request = DMA0_REQUEST_PWM0; + dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; + dma_params.init.priority = DMA_PRIORITY_LOW; + p_pwm_env[p_params->id]->dma_id[0] = app_dma_init(&dma_params, NULL); + + if (p_pwm_env[p_params->id]->dma_id[0] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + /* Associate the initialized DMA handle to the UART handle */ + p_pwm_env[p_params->id]->handle.p_dma = app_dma_get_handle(p_pwm_env[p_params->id]->dma_id[0]); + p_pwm_env[p_params->id]->handle.p_dma->p_parent = (void*)&p_pwm_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_pwm_dma_init(app_pwm_params_t *p_params) +{ + app_drv_err_t err_code = APP_DRV_SUCCESS; + uint8_t id = p_params->id; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || (p_pwm_env[id]->pwm_state == APP_PWM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + GLOBAL_EXCEPTION_DISABLE(); + p_pwm_env[p_params->id]->dma_id[0] = -1; + err_code = app_pwm_config_dma(p_params); + GLOBAL_EXCEPTION_ENABLE(); + APP_DRV_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->use_mode.pwm_dma_instance = p_params->use_mode.pwm_dma_instance; + p_pwm_env[id]->use_mode.pwm_dma_channel = p_params->use_mode.pwm_dma_channel; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_dma_deinit(app_pwm_id_t id) +{ + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if (p_pwm_env[id] == NULL) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_pwm_env[id]->dma_id[0]); + + p_pwm_env[id]->dma_id[0] = -1; + p_pwm_env[id]->handle.p_dma = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_pwm_start_coding_with_dma(app_pwm_id_t id, uint32_t *p_data, uint16_t size) +{ + hal_status_t err_code; + + if (id != APP_PWM_ID_0) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_pwm_env[id] == NULL) || + (p_pwm_env[id]->pwm_state == APP_PWM_INVALID) || + (p_pwm_env[id]->handle.p_dma == NULL)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + pwm_wake_up(id); +#endif + + err_code = hal_pwm_start_coding_with_dma(&p_pwm_env[id]->handle, p_data, size); + HAL_ERR_CODE_CHECK(err_code); + + p_pwm_env[id]->pwm_module_state = APP_PWM_START; + + return APP_DRV_SUCCESS; +} + +#endif + +#endif /* HAL_PWM_MODULE_ENABLED */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwr_mgmt.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwr_mgmt.c new file mode 100644 index 0000000..962b8db --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_pwr_mgmt.c @@ -0,0 +1,279 @@ +/** + **************************************************************************************** + * @file app_pwr_mgmt.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_pwr_mgmt.h" +#include "grx_hal.h" +#include "grx_sys.h" + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +struct pwr_env_t +{ + app_sleep_callbacks_t *pwr_sleep_cb[APP_SLEEP_CB_MAX]; + wakeup_priority_t wakeup_priority[APP_SLEEP_CB_MAX]; + bool is_pwr_callback_reg; +}; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +struct pwr_env_t s_pwr_env; + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) +pwr_mgmt_dev_state_t pwr_enter_sleep_check_new(void) +{ + uint32_t i; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + if (g_devices_state == 0x0) +#else + if((g_devices_state == 0x0) && (g_extra_devices_state == 0x0)) +#endif + { + if (g_devices_renew > 0) + { + for (i = 0x0; i < MAX_PERIPH_DEVICE_NUM; i++) + { + if (devices_suspend_cb[i] == NULL) + continue; + + if (devices_handle[i] == NULL) + continue; + + if (g_devices_renew & (1 << i)) + { + devices_suspend_cb[i](devices_handle[i]); + } + } + + g_devices_renew = ALL_DEVICES_BACKUP; + } + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + if (g_extra_devices_renew > 0) + { + for (i = 0x0; i < MAX_EXTRA_DEVICE_NUM; i++) + { + if (extra_devices_suspend_cb[i] == NULL) + continue; + + if (g_extra_devices_renew & (1 << i)) + { + extra_devices_suspend_cb[i](extra_devices_handle[i]); + } + } + + g_extra_devices_renew = ALL_DEVICES_BACKUP; + } +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + if (g_devices_state == 0x0) +#else + if((g_devices_state == 0x0) && (g_extra_devices_state == 0x0)) +#endif + { + #ifdef HAL_RECOVER_WHEN_USING + g_devices_sleep = ALL_DEVICES_SLEEP; + #endif + } + else + { + return DEVICE_BUSY; + } + + return DEVICE_IDLE; + } + + return DEVICE_BUSY; +} + +SECTION_RAM_CODE void pwr_wake_up_ind_new(void) +{ + uint32_t i; + +#ifndef HAL_RECOVER_WHEN_USING + for (i = 0x0; i < MAX_PERIPH_DEVICE_NUM; i++) + { + if (devices_resume_cb[i] == NULL) + continue; + + if (devices_handle[i] == NULL) + continue; + + devices_resume_cb[i](devices_handle[i]); + } +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + for (i = 0x0; i < MAX_EXTRA_DEVICE_NUM; i++) + { + if (extra_devices_resume_cb[i] == NULL) + continue; + + extra_devices_resume_cb[i](extra_devices_handle[i]); + } +#endif +} +#endif + +pwr_id_t pwr_register_sleep_cb(const app_sleep_callbacks_t *p_cb, wakeup_priority_t wakeup_priority) +{ + pwr_id_t id = -1; + uint8_t i = 0; + + GLOBAL_EXCEPTION_DISABLE(); + + if (!s_pwr_env.is_pwr_callback_reg) + { +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + pwr_mgmt_dev_init(pwr_wake_up_ind_new); + pwr_mgmt_set_callback(pwr_enter_sleep_check_new, NULL); +#else + pwr_mgmt_dev_init(pwr_wake_up_ind); + pwr_mgmt_set_callback(pwr_enter_sleep_check, NULL); +#endif + + s_pwr_env.is_pwr_callback_reg = true; + } + + if (p_cb == NULL || wakeup_priority > WAPEUP_PRIORITY_HIGH || wakeup_priority < WAPEUP_PRIORITY_LOW) + { + goto exit; + } + + while ((i < APP_SLEEP_CB_MAX) && (s_pwr_env.pwr_sleep_cb[i] != NULL)) + { + i++; + } + if (i < APP_SLEEP_CB_MAX) + { + s_pwr_env.pwr_sleep_cb[i] = (app_sleep_callbacks_t *)p_cb; + s_pwr_env.wakeup_priority[i] = wakeup_priority; + id = i; + } + +exit: + GLOBAL_EXCEPTION_ENABLE(); + + return id; +} + +void pwr_unregister_sleep_cb(pwr_id_t id) +{ + if((id >= 0) && (id < APP_SLEEP_CB_MAX))// Is id valid? + { + s_pwr_env.pwr_sleep_cb[id] = NULL; + } +} + +SECTION_RAM_CODE void pwr_wake_up_ind(void) +{ + uint8_t i; + app_sleep_callbacks_t *p_cb; + wakeup_priority_t priority; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + uint8_t hal_init_mark = 0; +#endif + + for (priority = WAPEUP_PRIORITY_HIGH; priority != 0; priority--) + { + for (i = 0; i < APP_SLEEP_CB_MAX; i++) + { + p_cb = s_pwr_env.pwr_sleep_cb[i]; + if ((p_cb != NULL) && (p_cb ->app_wake_up_ind != NULL) && (priority == s_pwr_env.wakeup_priority[i])) + { + p_cb ->app_wake_up_ind(); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if(hal_init_mark == 0) + { + hal_init_mark = 1; + hal_init(); + } +#endif + } + } + } +} + +pwr_mgmt_dev_state_t pwr_enter_sleep_check(void) +{ + int16_t i; + pwr_mgmt_dev_state_t allow_entering_sleep = DEVICE_IDLE; + app_sleep_callbacks_t *p_cb; + + // 1. Inquiry Adapters + for (i = APP_SLEEP_CB_MAX - 1; i >= 0; i--) + { + p_cb = s_pwr_env.pwr_sleep_cb[i]; + if (( p_cb != NULL) && (p_cb->app_prepare_for_sleep != NULL) ) + { + if (!p_cb->app_prepare_for_sleep()) + { + allow_entering_sleep = DEVICE_BUSY; + break; + } + } + } + + // 2. If an Adapter rejected sleep, resume any Adapters that have already accepted it. + if ( allow_entering_sleep == DEVICE_BUSY ) + { + i++; + while (i < APP_SLEEP_CB_MAX) + { + p_cb = s_pwr_env.pwr_sleep_cb[i]; + if ( (p_cb != NULL) && (p_cb->app_sleep_canceled != NULL) ) + { + p_cb->app_sleep_canceled(); + } + i++; + } + } + + return allow_entering_sleep; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi.c new file mode 100644 index 0000000..7cb0004 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi.c @@ -0,0 +1,1550 @@ +/** + **************************************************************************************** + * @file app_qspi.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ + +#include "app_assert.h" +#include "app_qspi.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "platform_sdk.h" +#include "app_drv.h" +#include "gr_soc.h" +#include + +#ifdef HAL_QSPI_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define QSPI_SMART_CS_LOW(id) \ + do { \ + if(p_qspi_env[id]->p_pin_cfg->cs.enable == APP_QSPI_PIN_ENABLE) \ + { \ + app_io_write_pin(p_qspi_env[id]->p_pin_cfg->cs.type, \ + p_qspi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_RESET); \ + } \ + } while(0) + +#define QSPI_SMART_CS_HIGH(id) \ + do { \ + if(p_qspi_env[id]->p_pin_cfg->cs.enable == APP_QSPI_PIN_ENABLE) \ + { \ + app_io_write_pin(p_qspi_env[id]->p_pin_cfg->cs.type, \ + p_qspi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_SET); \ + } \ + } while(0) +#else +#define QSPI_SMART_CS_LOW(id) +#define QSPI_SMART_CS_HIGH(id) +#endif + +#define APP_QSPI_EXCEPT_DEBUG_EN 1u + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/******************************************************************** + * QUAD_WRITE_32b_PATCH : just exist in QUAD/DATASIZE_32BITS/DMA scene + * if enable, MUST Control the CS By Software. + */ +#define QSPI_QUAD_WRITE_32b_PATCH_EN 0u + +/******************************************************************** + * DATA Endian Mode Optional Value : + * 0 : data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24) + * 1 : data[1] | (data[0] << 8) | (data[3] << 16) | (data[2] << 24) + * 2 : data[3] | (data[2] << 8) | (data[1] << 16) | (data[0] << 24) + * 3 : data[2] | (data[3] << 8) | (data[0] << 16) | (data[1] << 24) + */ +#define QSPI_QUAD_WRITE_DATA_ENDIAN_MODE 0u +#endif +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +bool qspi_prepare_for_sleep(void); +void qspi_wake_up_ind(void); +static uint16_t qspi_gpio_config(app_qspi_pin_cfg_t pin_cfg); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +void app_qspi_force_cs(app_qspi_id_t screen_id, bool low_level); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +extern volatile bool is_dma_access; +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +const qspi_memorymapped_t g_flash_typical_mmap_read_cmd[FLASH_MMAP_CMD_READ_MAX] = +{ + /************************************************************** + * FOLLOWING DEFINES ARE TYPICAL FLASH CMDs, + * SUPPORTED BY MANY FLASH DEVICES, + * IF DEFINES ARE NOT MATCHING WITH THE USED FLASH, + * PLEASE MODIFY CAREFULLY + **************************************************************/ + [FLASH_MMAP_CMD_DREAD_3BH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPI, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x00, + .x_dummy_cycles = 8, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_DUAL_SPI, + .x_instruction = 0x3B, + }, + [FLASH_MMAP_CMD_2READ_BBH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_IN_SPI_ADDR_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x00, + .x_dummy_cycles = 4, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_DUAL_SPI, + .x_instruction = 0xBB, + }, + [FLASH_MMAP_CMD_2READ_BBH_SIOO] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_IN_SPI_ADDR_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_ENABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x20, + .x_dummy_cycles = 0, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_ONLY_FIRST_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_DUAL_SPI, + .x_instruction = 0xBB, + }, + [FLASH_MMAP_CMD_QREAD_6BH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPI, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x20, + .x_dummy_cycles = 8, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + .x_instruction = 0x6B, + }, + [FLASH_MMAP_CMD_4READ_EBH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_IN_SPI_ADDR_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x00, + .x_dummy_cycles = 6, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + .x_instruction = 0xEB, + }, + [FLASH_MMAP_CMD_4READ_EBH_SIOO] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_IN_SPI_ADDR_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_ENABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x20, + .x_dummy_cycles = 4, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_ONLY_FIRST_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + .x_instruction = 0xEB, + } +}; + +const qspi_memorymapped_t g_psram_typical_mmap_qread_cmd[PSRAM_MMAP_CMD_READ_MAX] = +{ + /************************************************************** + * IF DEFINES ARE NOT MATCHING WITH THE USED PSRAM, + * PLEASE MODIFY CAREFULLY + **************************************************************/ + [PSRAM_MMAP_CMD_QREAD_0BH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x00, + .x_dummy_cycles = 4, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + .x_instruction = 0x0B, + }, + [PSRAM_MMAP_CMD_QREAD_EBH] = { + .x_endian_mode = QSPI_CONCURRENT_XIP_ENDIAN_MODE_0, + .x_prefetch_en = QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + .x_continous_xfer_en = QSPI_CONCURRENT_XIP_CONT_XFER_DISABLE, + .x_instruction_en = QSPI_CONCURRENT_XIP_INST_ENABLE, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPIFRF, + .x_mode_bits_en = QSPI_CONCURRENT_XIP_MODE_BITS_DISABLE, + .x_mode_bits_length = QSPI_CONCURRENT_XIP_MBL_8, + .x_mode_bits_data = 0x00, + .x_dummy_cycles = 6, + .x_continous_xfer_toc = 0, + .x_sioo_mode = QSPI_CONCURRENT_XIP_INST_SENT_EVERY_ACCESS, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + .x_instruction = 0xEB, + }, +}; + +const qspi_memorymapped_write_t g_psram_typical_mmap_qwrite_cmd[PSRAM_MMAP_CMD_WRITE_MAX] = +{ + /************************************************************** + * IF DEFINES ARE NOT MATCHING WITH THE USED PSRAM, + * PLEASE MODIFY CAREFULLY + **************************************************************/ + [PSRAM_MMAP_CMD_QWRITE_02H] = { + .x_instruction = 0x02, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPIFRF, + .x_dummy_cycles = 0, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + }, + [PSRAM_MMAP_CMD_QWRITE_38H] = { + .x_instruction = 0x38, + .x_instruction_size = QSPI_CONCURRENT_XIP_INSTSIZE_8BIT, + .x_address_size = QSPI_CONCURRENT_XIP_ADDRSIZE_24BIT, + .x_inst_addr_transfer_format = QSPI_CONCURRENT_XIP_INST_ADDR_ALL_IN_SPIFRF, + .x_dummy_cycles = 0, + .x_data_frame_format = QSPI_CONCURRENT_XIP_FRF_QUAD_SPI, + } +}; + +#define APP_QSPI_PIN_CONFIG(pin_type, pin_mux, pin_number, pin_mode, pin_pull, pin_enable) \ + { \ + .type = pin_type, \ + .mux = pin_mux, \ + .pin = pin_number, \ + .mode = pin_mode, \ + .pull = pin_pull, \ + .enable = pin_enable, \ + } +#define APP_QSPI_IO_PULL_DEFAULT APP_IO_NOPULL +const app_qspi_pin_cfg_t g_qspi_pin_groups[QSPIx_PIN_GROUP_MAX] = { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + /* DON'T MODIFY THE FOLLOWING CONFIGS FOR GR5526 */ + [QSPI0_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_10, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_5, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_6, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_7, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_8, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_9, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + }, + [QSPI1_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_10, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_15, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_14, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_13, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_12, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_11, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + }, + [QSPI2_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_11, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_0, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_1, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_2, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_3, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_4, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + } +#else + /* CAN MODIFY THE FOLLOWING CONFIGS FOR GR5525 */ + [QSPI0_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_15, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_2, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_0, APP_IO_PIN_3, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_14, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_13, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_0, APP_IO_PIN_12, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + }, + [QSPI1_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_7, APP_IO_PIN_5, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_7, APP_IO_PIN_6, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_7, APP_IO_PIN_4, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOB, APP_IO_MUX_7, APP_IO_PIN_7, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOC, APP_IO_MUX_7, APP_IO_PIN_0, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOC, APP_IO_MUX_7, APP_IO_PIN_1, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + }, + [QSPI2_PIN_GROUP_0] = { + .cs = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_6, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .clk = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_3, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_0 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_4, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_1 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_5, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_2 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_2, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + .io_3 = APP_QSPI_PIN_CONFIG(APP_IO_TYPE_GPIOA, APP_IO_MUX_7, APP_IO_PIN_7, APP_IO_MODE_MUX, APP_QSPI_IO_PULL_DEFAULT, APP_QSPI_PIN_ENABLE), + } +#endif +}; +#endif + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +static const IRQn_Type s_qspi_irq[APP_QSPI_ID_MAX] = { QSPI0_IRQn, QSPI1_IRQn, QSPI2_IRQn }; +const uint32_t s_qspi_instance[APP_QSPI_ID_MAX] = { QSPI0_BASE, QSPI1_BASE, QSPI2_BASE }; +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +static const IRQn_Type s_qspi_irq[APP_QSPI_ID_MAX] = { QSPI0_IRQn, QSPI1_IRQn }; +static const uint32_t s_qspi_instance[APP_QSPI_ID_MAX] = { QSPI0_BASE, QSPI1_BASE }; +#endif + +qspi_env_t *p_qspi_env[APP_QSPI_ID_MAX]; + +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_qspi_pwr_id = -1; + +static const app_sleep_callbacks_t qspi_sleep_cb = +{ + .app_prepare_for_sleep = qspi_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = qspi_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +bool qspi_prepare_for_sleep(void) +{ + hal_qspi_state_t state; + uint8_t i; + + for (i = 0; i < APP_QSPI_ID_MAX; i++) + { + if (p_qspi_env[i] == NULL) + { + continue; + } + + if (p_qspi_env[i]->qspi_state == APP_QSPI_ACTIVITY) + { + state = hal_qspi_get_state(&p_qspi_env[i]->handle); + if ((state != HAL_QSPI_STATE_RESET) && (state != HAL_QSPI_STATE_READY)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_qspi_suspend_reg(&p_qspi_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_qspi_env[i]->qspi_state = APP_QSPI_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE void qspi_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_QSPI_ID_MAX; i++) + { + if (p_qspi_env[i] == NULL) + { + continue; + } + + if (p_qspi_env[i]->qspi_state == APP_QSPI_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_qspi_resume_reg(&p_qspi_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_qspi_irq[i]); + hal_nvic_enable_irq(s_qspi_irq[i]); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void qspi_wake_up(app_qspi_id_t id) +{ + if (p_qspi_env[id]->qspi_state == APP_QSPI_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_qspi_resume_reg(&p_qspi_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_qspi_irq[id]); + hal_nvic_enable_irq(s_qspi_irq[id]); + p_qspi_env[id]->qspi_state = APP_QSPI_ACTIVITY; + } + + if(p_qspi_env[id]->use_mode.type == APP_QSPI_TYPE_DMA) + { + dma_wake_up(p_qspi_env[id]->dma_id); + } +} +#endif + + +#define QSPI_HANDLER(index, val) \ +SECTION_RAM_CODE void QSPI##index##_IRQHandler(void)\ +{\ + hal_qspi_irq_handler(&p_qspi_env[val]->handle);\ +} + +QSPI_HANDLER(0, APP_QSPI_ID_0) +QSPI_HANDLER(1, APP_QSPI_ID_1) +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +QSPI_HANDLER(2, APP_QSPI_ID_2) +#endif +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_qspi_init(app_qspi_params_t *p_params, app_qspi_evt_handler_t evt_handler) +{ + app_qspi_id_t id = p_params->id; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + p_qspi_env[id] = &p_params->qspi_env; + soc_register_nvic(QSPI0_IRQn, (uint32_t)QSPI0_IRQHandler); + soc_register_nvic(QSPI1_IRQn, (uint32_t)QSPI1_IRQHandler); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + soc_register_nvic(QSPI2_IRQn, (uint32_t)QSPI2_IRQHandler); +#endif + + app_err_code = qspi_gpio_config(p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(app_err_code); + + hal_nvic_clear_pending_irq(s_qspi_irq[id]); + hal_nvic_enable_irq(s_qspi_irq[id]); + + p_qspi_env[id]->p_pin_cfg = &p_params->pin_cfg; + p_qspi_env[id]->evt_handler = evt_handler; + + memcpy(&p_qspi_env[id]->handle.init, &p_params->init, sizeof(qspi_init_t)); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_qspi_env[id]->handle.p_instance = (ssi_regs_t *)s_qspi_instance[id]; +#else + p_qspi_env[id]->handle.p_instance = (qspi_regs_t *)s_qspi_instance[id]; +#endif + hal_err_code = hal_qspi_deinit(&p_qspi_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_qspi_init(&p_qspi_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + + p_qspi_env[id]->is_xfer_err = false; + p_qspi_env[id]->is_tx_done = false; + p_qspi_env[id]->is_rx_done = false; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + p_qspi_env[id]->is_mmap_inited = false; + p_qspi_env[id]->is_mmap_prefetch_en = false; +#endif + if(!s_sleep_cb_registered_flag)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_qspi_pwr_id = pwr_register_sleep_cb(&qspi_sleep_cb, APP_DRIVER_QSPI_WAPEUP_PRIORITY); + if (s_qspi_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_qspi_env[id]->qspi_state = APP_QSPI_ACTIVITY; + p_qspi_env[id]->start_flag = false; + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_deinit(app_qspi_id_t id) +{ + uint8_t i; + app_drv_err_t app_err_code; + hal_status_t hal_err_code; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_qspi_env[id]->p_pin_cfg->cs.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->cs.type, p_qspi_env[id]->p_pin_cfg->cs.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + if (p_qspi_env[id]->p_pin_cfg->clk.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->clk.type, p_qspi_env[id]->p_pin_cfg->clk.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + if (p_qspi_env[id]->p_pin_cfg->io_0.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->io_0.type, p_qspi_env[id]->p_pin_cfg->io_0.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + if (p_qspi_env[id]->p_pin_cfg->io_1.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->io_1.type, p_qspi_env[id]->p_pin_cfg->io_1.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + if (p_qspi_env[id]->p_pin_cfg->io_2.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->io_2.type, p_qspi_env[id]->p_pin_cfg->io_2.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + if (p_qspi_env[id]->p_pin_cfg->io_3.enable == APP_QSPI_PIN_ENABLE) + { + app_err_code = app_io_deinit(p_qspi_env[id]->p_pin_cfg->io_3.type, p_qspi_env[id]->p_pin_cfg->io_3.pin); + APP_DRV_ERR_CODE_CHECK(app_err_code); + } + + hal_nvic_disable_irq(s_qspi_irq[id]); + p_qspi_env[id]->qspi_state = APP_QSPI_INVALID; + p_qspi_env[id]->start_flag = false; + p_qspi_env[id]->is_xfer_err = false; + p_qspi_env[id]->is_tx_done = false; + p_qspi_env[id]->is_rx_done = false; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + p_qspi_env[id]->is_mmap_inited = false; + p_qspi_env[id]->is_mmap_prefetch_en = false; +#endif + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_QSPI_ID_MAX; i++) + { + if (p_qspi_env[i] != NULL && (p_qspi_env[i]->qspi_state) != APP_QSPI_INVALID) + { + break; + } + } + if (APP_QSPI_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_qspi_pwr_id); + s_qspi_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_qspi_deinit(&p_qspi_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + if (p_qspi_env[id]->qspi_dma_state == APP_QSPI_DMA_INVALID) + { + p_qspi_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_abort(app_qspi_id_t id) +{ + uint16_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (!p_qspi_env[id]->start_flag) + { + return APP_DRV_SUCCESS; + } + + err_code = hal_qspi_abort_it(&p_qspi_env[id]->handle); + if (err_code != HAL_OK) + { + return err_code; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +bool app_qspi_active_memory_mappped(app_qspi_id_t id, bool is_active) { + hal_status_t status = HAL_OK; + APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + + if(p_qspi_env[id]->start_flag) { + if(APP_QSPI_EXCEPT_DEBUG_EN) printf("+++ ERR : CAN NOT change(%d), Busy... \r\n", id); + return false; + } + if(is_active) { + if((p_qspi_env[id]->mounted_mmap_device.dev_type == APP_QSPI_DEVICE_FLASH) && + (g_flash_typical_mmap_read_cmd[p_qspi_env[id]->mounted_mmap_device.rd.flash_rd].x_sioo_mode == QSPI_CONCURRENT_XIP_INST_SENT_ONLY_FIRST_ACCESS)) { + status = hal_qspi_memorymapped_active(&p_qspi_env[id]->handle, true); + } else { + status = hal_qspi_memorymapped_active(&p_qspi_env[id]->handle, false); + } + } else { + status = hal_qspi_memorymapped_deactive(&p_qspi_env[id]->handle); + } + + return (status == HAL_OK) ? true : false; +} + +bool app_qspi_config_memory_mappped(app_qspi_id_t id, app_qspi_mmap_device_t dev) { + bool rRet = false; + hal_status_t status ; + const qspi_memorymapped_t * mmap_rd_cmd = NULL; + const qspi_memorymapped_write_t * mmap_wr_cmd = NULL; + + if ((id >= APP_QSPI_ID_MAX) || (p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return false; + } + + switch(dev.dev_type) { + case APP_QSPI_DEVICE_FLASH: + { + if(dev.rd.flash_rd < FLASH_MMAP_CMD_READ_MAX) { + mmap_rd_cmd = &g_flash_typical_mmap_read_cmd[dev.rd.flash_rd]; + } + } + break; + + case APP_QSPI_DEVICE_PSRAM: + { + if(dev.rd.psram_rd < PSRAM_MMAP_CMD_READ_MAX) { + mmap_rd_cmd = &g_psram_typical_mmap_qread_cmd[dev.rd.psram_rd]; + } + + if(dev.psram_wr < PSRAM_MMAP_CMD_WRITE_MAX) { + mmap_wr_cmd = &g_psram_typical_mmap_qwrite_cmd[dev.psram_wr]; + } + } + break; + + case APP_QSPI_DEVICE_UNSET: + default: + {} + break; + } + + if((mmap_rd_cmd != NULL) || (mmap_wr_cmd != NULL)) { + status = hal_qspi_memorymapped(&p_qspi_env[id]->handle, (qspi_memorymapped_t *)mmap_rd_cmd, (qspi_memorymapped_write_t *)mmap_wr_cmd); + if(HAL_OK == status) { + if(dev.dev_type == APP_QSPI_DEVICE_PSRAM) { + ll_qspi_enable_xip_dynamic_le(p_qspi_env[id]->handle.p_instance); /* active dynamicle mode for psram */ + } + rRet = true; + } + } + + if(rRet) { + memcpy(&p_qspi_env[id]->mounted_mmap_device, &dev, sizeof(app_qspi_mmap_device_t)); + p_qspi_env[id]->is_mmap_inited = true; + p_qspi_env[id]->mmap_endian_mode = (app_qspi_mmap_endian_mode_e) mmap_rd_cmd->x_endian_mode; + } + + return rRet; +} +#endif + +uint16_t app_qspi_command_receive_sync(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_receive(&p_qspi_env[id]->handle, p_cmd, p_data, timeout); + QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_command_receive_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_receive_it(&p_qspi_env[id]->handle, p_cmd, p_data); + if (HAL_OK != err_code) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_command_transmit_sync(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_transmit(&p_qspi_env[id]->handle, p_cmd, p_data, timeout); + QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_command_transmit_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_transmit_it(&p_qspi_env[id]->handle, p_cmd, p_data); + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + + +uint16_t app_qspi_command_sync(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command(&p_qspi_env[id]->handle, p_cmd, timeout); + QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_command_async(app_qspi_id_t id, app_qspi_command_t *p_cmd) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_it(&p_qspi_env[id]->handle, p_cmd); + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_transmit_sync(app_qspi_id_t id, uint8_t *p_data, uint32_t length, uint32_t timeout) +{ + return app_qspi_transmit_sync_ex(id, 0, 0, p_data, length, timeout); +} +#endif + +uint16_t app_qspi_transmit_sync_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length, uint32_t timeout) +{ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode);//mode and data_width were fixed when init + UNUSED(data_width); +#endif + hal_status_t err_code; + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_transmit(&p_qspi_env[id]->handle, p_data, length, timeout); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + err_code = hal_qspi_transmit(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length, timeout); +#endif + + QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return err_code; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_transmit_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length) +{ + return app_qspi_transmit_async_ex(id, 0, 0, p_data, length); +} +#endif + +uint16_t app_qspi_transmit_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode);//mode and data_width were fixed when init + UNUSED(data_width); +#endif + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_transmit_it(&p_qspi_env[id]->handle, p_data, length); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + err_code = hal_qspi_transmit_it(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length); +#endif + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_receive_sync(app_qspi_id_t id, uint8_t *p_data, uint32_t length, uint32_t timeout) +{ + return app_qspi_receive_sync_ex( id, 0, 0, p_data, length, timeout); +} +#endif + +uint16_t app_qspi_receive_sync_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length, uint32_t timeout) +{ + hal_status_t err_code; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode); + UNUSED(data_width); +#endif + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_receive(&p_qspi_env[id]->handle, p_data, length, timeout); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + err_code = hal_qspi_receive(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length, timeout); +#endif + QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_receive_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length) +{ + return app_qspi_receive_async_ex(id, 0, 0, p_data, length); +} +#endif + +uint16_t app_qspi_receive_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode); + UNUSED(data_width); +#endif + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_receive_it(&p_qspi_env[id]->handle, p_data, length); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + err_code = hal_qspi_receive_it(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length); +#endif + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +bool app_qspi_mmap_set_endian_mode(app_qspi_id_t id, app_qspi_mmap_endian_mode_e mode) { + hal_status_t status = HAL_ERROR; + + APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + + if(p_qspi_env[id]->mmap_endian_mode == mode) { + return true; + } + + qspi_memorymapped_set_t mmap_set = { + .mmap_key = QSPI_MMAPED_IDX_EDIAN_MODE, + .mmap_val = (mode == APP_QSPI_MMAP_ENDIAN_MODE_0) ? QSPI_CONCURRENT_XIP_ENDIAN_MODE_0 : ((mode == APP_QSPI_MMAP_ENDIAN_MODE_1) ? QSPI_CONCURRENT_XIP_ENDIAN_MODE_1 : QSPI_CONCURRENT_XIP_ENDIAN_MODE_2), + }; + + status = hal_qspi_memorymapped_update(&p_qspi_env[id]->handle, &mmap_set, 1); + + if(HAL_OK == status) { + p_qspi_env[id]->mmap_endian_mode = mode; + return true; + } + + return false; +} + +bool app_qspi_mmap_set_prefetch(app_qspi_id_t id, bool prefetch_en) { + hal_status_t status = HAL_ERROR; + + APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + + if(p_qspi_env[id]->is_mmap_prefetch_en == prefetch_en) { + return true; + } + + qspi_memorymapped_set_t mmap_set = { + .mmap_key = QSPI_MMAPED_IDX_PREFETCH_EN, + .mmap_val = prefetch_en ? QSPI_CONCURRENT_XIP_PREFETCH_ENABLE : QSPI_CONCURRENT_XIP_PREFETCH_DISABLE, + }; + + status = hal_qspi_memorymapped_update(&p_qspi_env[id]->handle, &mmap_set, 1); + + if(HAL_OK == status) { + p_qspi_env[id]->is_mmap_prefetch_en = prefetch_en; + return true; + } + + return false; +} + +uint8_t app_qspi_mmap_read_u8(app_qspi_id_t id, uint32_t address) { + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + //APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + app_qspi_mmap_set_endian_mode(id, APP_QSPI_MMAP_ENDIAN_MODE_0); + return *((volatile uint8_t *)(ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]) + address)); +} + +uint16_t app_qspi_mmap_read_u16(app_qspi_id_t id, uint32_t address) { + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + //APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + APP_ASSERT_CHECK(!(address & 0x01)); /* U16 aligned */ + app_qspi_mmap_set_endian_mode(id, APP_QSPI_MMAP_ENDIAN_MODE_1); + return *((volatile uint16_t *)(ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]) + address)); +} + +uint32_t app_qspi_mmap_read_u32(app_qspi_id_t id, uint32_t address) { + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + //APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + APP_ASSERT_CHECK(!(address & 0x03)); /* U32 aligned */ + app_qspi_mmap_set_endian_mode(id, APP_QSPI_MMAP_ENDIAN_MODE_2); + return *((volatile uint32_t *)(ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]) + address)); +} + +bool app_qspi_mmap_read_block(app_qspi_id_t id, uint32_t address, uint8_t * buffer, uint32_t length) { + bool ret = true; + + if ((id >= APP_QSPI_ID_MAX) || (p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return false; + } + //APP_ASSERT_CHECK(p_qspi_env[id]->is_mmap_inited); + + app_qspi_mmap_set_endian_mode(id, APP_QSPI_MMAP_ENDIAN_MODE_2); + app_qspi_mmap_set_prefetch(id, false); + memcpy(buffer, (void *)(ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]) + address), length); + return ret; +} + +uint32_t app_qspi_get_xip_base_address(app_qspi_id_t id) { + return ll_qspi_get_xip_base_address((qspi_regs_t*)s_qspi_instance[id]); +} + +#endif +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint16_t qspi_gpio_config(app_qspi_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (pin_cfg.cs.enable == APP_QSPI_PIN_ENABLE) + { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + io_init.pull = pin_cfg.cs.pull; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = pin_cfg.cs.mux; + io_init.mode = pin_cfg.cs.mode; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + io_init.pull = pin_cfg.cs.pull; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = APP_IO_MUX_7; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + app_io_write_pin(pin_cfg.cs.type, pin_cfg.cs.pin, APP_IO_PIN_SET); +#endif + } + if (pin_cfg.clk.enable == APP_QSPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.clk.pull; + io_init.pin = pin_cfg.clk.pin; + io_init.mux = pin_cfg.clk.mux; + io_init.mode = pin_cfg.clk.mode; + err_code = app_io_init(pin_cfg.clk.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.io_0.enable == APP_QSPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.io_0.pull; + io_init.pin = pin_cfg.io_0.pin; + io_init.mux = pin_cfg.io_0.mux; + io_init.mode = pin_cfg.io_0.mode; + err_code = app_io_init(pin_cfg.io_0.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.io_1.enable == APP_QSPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.io_1.pull; + io_init.pin = pin_cfg.io_1.pin; + io_init.mux = pin_cfg.io_1.mux; + io_init.mode = pin_cfg.io_1.mode; + err_code = app_io_init(pin_cfg.io_1.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.io_2.enable == APP_QSPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.io_2.pull; + io_init.pin = pin_cfg.io_2.pin; + io_init.mux = pin_cfg.io_2.mux; + io_init.mode = pin_cfg.io_2.mode; + err_code = app_io_init(pin_cfg.io_2.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.io_3.enable == APP_QSPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.io_3.pull; + io_init.pin = pin_cfg.io_3.pin; + io_init.mux = pin_cfg.io_3.mux; + io_init.mode = pin_cfg.io_3.mode; + err_code = app_io_init(pin_cfg.io_3.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +void app_qspi_force_cs(app_qspi_id_t screen_id, bool low_level) { + + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + + io_init.pull = p_qspi_env[screen_id]->p_pin_cfg->cs.pull; + io_init.pin = p_qspi_env[screen_id]->p_pin_cfg->cs.pin; + + if(low_level) { +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5525X) + io_init.mux = APP_IO_MUX_7; +#else + io_init.mux = APP_IO_MUX_8; +#endif + io_init.mode = APP_IO_MODE_OUTPUT; + app_io_init(p_qspi_env[screen_id]->p_pin_cfg->cs.type, &io_init); + app_io_write_pin(p_qspi_env[screen_id]->p_pin_cfg->cs.type, io_init.pin, APP_IO_PIN_SET); + delay_us(1); + app_io_write_pin(p_qspi_env[screen_id]->p_pin_cfg->cs.type, io_init.pin, APP_IO_PIN_RESET); + } else { + /* first : release cs */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5525X) + io_init.mux = APP_IO_MUX_7; +#else + io_init.mux = APP_IO_MUX_8; +#endif + io_init.mode = APP_IO_MODE_OUTPUT; + app_io_init(p_qspi_env[screen_id]->p_pin_cfg->cs.type, &io_init); + app_io_write_pin(p_qspi_env[screen_id]->p_pin_cfg->cs.type, io_init.pin, APP_IO_PIN_SET); + + /* then : restore hard-cs */ + io_init.mux = p_qspi_env[screen_id]->p_pin_cfg->cs.mux; + io_init.mode = p_qspi_env[screen_id]->p_pin_cfg->cs.mode; + app_io_init(p_qspi_env[screen_id]->p_pin_cfg->cs.type, &io_init); + } + + return; +} +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) + extern bool app_graphics_qspi_draw_screen_continue(app_qspi_id_t id, app_qspi_evt_t qspi_evt); +#endif +#endif + +static void app_qspi_event_call(qspi_handle_t *p_qspi, app_qspi_evt_type_t evt_type) +{ + app_qspi_evt_t qspi_evt; + app_qspi_id_t id = APP_QSPI_ID_MAX; + + if (p_qspi->p_instance == QSPI0) + { + id = APP_QSPI_ID_0; + } + else if (p_qspi->p_instance == QSPI1) + { + id = APP_QSPI_ID_1; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (p_qspi->p_instance == QSPI2) + { + id = APP_QSPI_ID_2; + } +#endif + qspi_evt.type = evt_type; + if (evt_type == APP_QSPI_EVT_ERROR) + { + qspi_evt.data.error_code = p_qspi->error_code; + p_qspi_env[id]->is_xfer_err = 1; + p_qspi_env[id]->is_rx_done = 1; + p_qspi_env[id]->is_tx_done = 1; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (is_dma_access) + { + ((qspi_regs_t *)s_qspi_instance[id])->DMAC = 0; + ll_dma_disable_channel(p_qspi_env[id]->dma_cfg.dma_instance, p_qspi_env[id]->dma_cfg.dma_channel); + } +#endif + if(APP_QSPI_EXCEPT_DEBUG_EN) printf("+++ ERR: QSPI%d xfer Err ...\r\n", id); + } + else if (evt_type == APP_QSPI_EVT_TX_CPLT) + { + qspi_evt.data.size = p_qspi->tx_xfer_size - p_qspi->tx_xfer_count; + p_qspi_env[id]->is_xfer_err = 0; + p_qspi_env[id]->is_tx_done = 1; + } + else if (evt_type == APP_QSPI_EVT_RX_DATA) + { + qspi_evt.data.size = p_qspi->rx_xfer_size - p_qspi->rx_xfer_count; + p_qspi_env[id]->is_xfer_err = 0; + p_qspi_env[id]->is_rx_done = 1; + } + else if (evt_type == APP_QSPI_EVT_ABORT) + { + p_qspi_env[id]->is_xfer_err = 1; + p_qspi_env[id]->is_rx_done = 1; + p_qspi_env[id]->is_tx_done = 1; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +#if (QSPI_DMA_LLP_FEATUTE_SUPPORT > 0u) + bool ret = app_graphics_qspi_draw_screen_continue(id, qspi_evt); + if(ret)return; +#endif +#endif + + p_qspi_env[id]->start_flag = false; + QSPI_SMART_CS_HIGH(id); + if (p_qspi_env[id]->evt_handler != NULL) + { + p_qspi_env[id]->evt_handler(&qspi_evt); + } +} + +qspi_handle_t *app_qspi_get_handle(app_qspi_id_t id) +{ + if (id >= APP_QSPI_ID_MAX) + { + return NULL; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + return &p_qspi_env[id]->handle; +} + +void hal_qspi_error_callback(qspi_handle_t *p_qspi) +{ + app_qspi_event_call(p_qspi, APP_QSPI_EVT_ERROR); +} + +void hal_qspi_rx_cplt_callback(qspi_handle_t *p_qspi) +{ + app_qspi_event_call(p_qspi, APP_QSPI_EVT_RX_DATA); +} + +void hal_qspi_tx_cplt_callback(qspi_handle_t *p_qspi) +{ + app_qspi_event_call(p_qspi, APP_QSPI_EVT_TX_CPLT); +} + +void hal_qspi_abort_cplt_callback(qspi_handle_t *p_qspi) +{ + app_qspi_event_call(p_qspi, APP_QSPI_EVT_ABORT); +} + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi_dma.c new file mode 100644 index 0000000..3539f15 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_qspi_dma.c @@ -0,0 +1,598 @@ +/** + **************************************************************************************** + * @file app_qspi_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_assert.h" +#include "app_qspi.h" +#include "app_qspi_dma.h" +#include "app_io.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include +#include "platform_sdk.h" +#include "app_drv.h" +#include "gr_soc.h" + +#ifdef HAL_QSPI_MODULE_ENABLED +/* + * DEFINES + ***************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define QSPI_SMART_CS_LOW(id) \ + do { \ + if(p_qspi_env[id]->p_pin_cfg->cs.enable == APP_QSPI_PIN_ENABLE) \ + { \ + app_io_write_pin(p_qspi_env[id]->p_pin_cfg->cs.type, \ + p_qspi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_RESET); \ + } \ + } while(0) + +#define QSPI_SMART_CS_HIGH(id) \ + do { \ + if(p_qspi_env[id]->p_pin_cfg->cs.enable == APP_QSPI_PIN_ENABLE) \ + { \ + app_io_write_pin(p_qspi_env[id]->p_pin_cfg->cs.type, \ + p_qspi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_SET); \ + } \ + } while(0) +#else +#define QSPI_SMART_CS_LOW(id) +#define QSPI_SMART_CS_HIGH(id) +#endif + +#define APP_QSPI_EXCEPT_DEBUG_EN 1u +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +/******************************************************************** + * QUAD_WRITE_32b_PATCH : just exist in QUAD/DATASIZE_32BITS/DMA scene + * if enable, MUST Control the CS By Software. + */ +#define QSPI_QUAD_WRITE_32b_PATCH_EN 0u + +/******************************************************************** + * DATA Endian Mode Optional Value : + * 0 : data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24) + * 1 : data[1] | (data[0] << 8) | (data[3] << 16) | (data[2] << 24) + * 2 : data[3] | (data[2] << 8) | (data[1] << 16) | (data[0] << 24) + * 3 : data[2] | (data[3] << 8) | (data[0] << 16) | (data[1] << 24) + */ +#define QSPI_QUAD_WRITE_DATA_ENDIAN_MODE 0u +#endif +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +extern void qspi_wake_up(app_qspi_id_t id); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +volatile bool is_dma_access = false; +static bool app_qspi_dma_match_check(app_qspi_params_t * p_params); +static bool app_qspi_switch_dma_mode(app_qspi_id_t id, bool is_m2m_mode); +#endif +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern qspi_env_t *p_qspi_env[APP_QSPI_ID_MAX]; + +static uint16_t app_qspi_config_dma(app_qspi_params_t *p_params) +{ + app_dma_params_t dma_params = { 0 }; + + dma_params.p_instance = p_params->dma_cfg.dma_instance; + dma_params.channel_number = p_params->dma_cfg.dma_channel; + dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + dma_params.init.mode = DMA_NORMAL; + dma_params.init.priority = DMA_PRIORITY_LOW; + + p_qspi_env[p_params->id]->dma_id = app_dma_init(&dma_params, NULL); + if (p_qspi_env[p_params->id]->dma_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + p_qspi_env[p_params->id]->handle.p_dma = app_dma_get_handle(p_qspi_env[p_params->id]->dma_id); + p_qspi_env[p_params->id]->handle.p_dma->p_parent = (void*)&p_qspi_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +static void app_qspi_config_dma_qwrite_32b_patch(app_qspi_id_t id, bool enable_patch, uint32_t endian_mode) { + extern void hal_qspi_config_dma_qwrite_32b_patch(qspi_handle_t *p_qspi, bool enable_patch, uint32_t endian_mode) ; + hal_qspi_config_dma_qwrite_32b_patch(&p_qspi_env[id]->handle, enable_patch, endian_mode); +} +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_qspi_dma_init(app_qspi_params_t *p_params) +{ + app_qspi_id_t id = p_params->id; + app_drv_err_t app_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + GLOBAL_EXCEPTION_DISABLE(); + p_qspi_env[p_params->id]->dma_id = -1; + app_err_code = app_qspi_config_dma(p_params); + GLOBAL_EXCEPTION_ENABLE(); + APP_DRV_ERR_CODE_CHECK(app_err_code); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + app_err_code = app_qspi_dma_match_check(p_params) ? APP_DRV_SUCCESS : APP_DRV_ERR_INVALID_PARAM; + APP_DRV_ERR_CODE_CHECK(app_err_code); + GLOBAL_EXCEPTION_DISABLE(); + p_qspi_env[p_params->id]->dma_id = -1; + app_err_code = app_qspi_config_dma(p_params); + GLOBAL_EXCEPTION_ENABLE(); + APP_DRV_ERR_CODE_CHECK(app_err_code); + p_qspi_env[id]->is_used_dma = true; + p_qspi_env[id]->is_dma_mode_m2m = false; +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + p_qspi_env[id]->dma_cfg.wait_timeout_ms = p_params->dma_cfg.wait_timeout_ms; + p_qspi_env[id]->dma_cfg.dma_instance = p_params->dma_cfg.dma_instance; + p_qspi_env[id]->dma_cfg.dma_channel = p_params->dma_cfg.dma_channel; + p_qspi_env[id]->qspi_dma_state = APP_QSPI_DMA_ACTIVITY; +#endif + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_dma_deinit(app_qspi_id_t id) +{ + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_dma_state != APP_QSPI_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_qspi_env[id]->dma_id); + + GLOBAL_EXCEPTION_DISABLE(); + p_qspi_env[id]->qspi_dma_state = APP_QSPI_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + if (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID) + { + p_qspi_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_dma_command_receive_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + is_dma_access = true; + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_switch_dma_mode(id, false); +#endif + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_command_receive_dma(&p_qspi_env[id]->handle, p_cmd, p_data); + if (HAL_OK != err_code) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_dma_command_transmit_async(app_qspi_id_t id, app_qspi_command_t *p_cmd, uint8_t *p_data) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL || p_data == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_switch_dma_mode(id, false); + err_code = hal_qspi_command_transmit_dma(&p_qspi_env[id]->handle, p_cmd, p_data); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + app_qspi_config_dma_qwrite_32b_patch(id, QSPI_QUAD_WRITE_32b_PATCH_EN, QSPI_QUAD_WRITE_DATA_ENDIAN_MODE); + err_code = hal_qspi_command_transmit_dma(&p_qspi_env[id]->handle, p_cmd, p_data); + app_qspi_config_dma_qwrite_32b_patch(id, 0, QSPI_QUAD_WRITE_DATA_ENDIAN_MODE); +#endif + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_qspi_dma_command_async(app_qspi_id_t id, app_qspi_command_t *p_cmd) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_switch_dma_mode(id, false); +#endif + err_code = hal_qspi_command_dma(&p_qspi_env[id]->handle, p_cmd); + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +extern hal_status_t hal_qspi_transmit_dma_in_qpi(qspi_handle_t *p_qspi, uint32_t data_size, uint8_t *p_data, uint32_t length); + +uint16_t app_qspi_dma_transmit_in_qpi_async(app_qspi_id_t id, uint32_t data_width, uint8_t *p_data, uint32_t length) +{ + hal_status_t err_code; + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + QSPI_SMART_CS_LOW(id); + err_code = hal_qspi_transmit_dma_in_qpi(&p_qspi_env[id]->handle, data_width, p_data, length); + //QSPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + return err_code; + } + + return APP_DRV_SUCCESS; +} +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_dma_transmit_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length) +{ + return app_qspi_dma_transmit_async_ex(id, QSPI_DATA_MODE_SPI, QSPI_DATASIZE_08_BITS, p_data, length); +} +#endif + +uint16_t app_qspi_dma_transmit_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode); + UNUSED(data_width); +#endif + + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_transmit_dma(&p_qspi_env[id]->handle, p_data, length); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_switch_dma_mode(id, false); + err_code = hal_qspi_transmit_dma(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length); +#endif + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_qspi_dma_receive_async(app_qspi_id_t id, uint8_t *p_data, uint32_t length) +{ + return app_qspi_dma_receive_async_ex(id, 0, 0, p_data, length); +} +#endif + +uint16_t app_qspi_dma_receive_async_ex(app_qspi_id_t id, uint32_t qspi_mode, uint32_t data_width, uint8_t *p_data, uint32_t length) +{ + hal_status_t err_code = HAL_ERROR; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + UNUSED(qspi_mode); + UNUSED(data_width); +#endif + if (id >= APP_QSPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_qspi_env[id] == NULL) || (p_qspi_env[id]->qspi_state == APP_QSPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || length == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + qspi_wake_up(id); +#endif + + if (p_qspi_env[id]->start_flag == false) + { + p_qspi_env[id]->start_flag = true; + QSPI_SMART_CS_LOW(id); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + err_code = hal_qspi_receive_dma(&p_qspi_env[id]->handle, p_data, length); +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + is_dma_access = true; + APP_ASSERT_CHECK(p_qspi_env[id]->is_used_dma); + app_qspi_switch_dma_mode(id, false); + err_code = hal_qspi_receive_dma(&p_qspi_env[id]->handle, qspi_mode, data_width, p_data, length); +#endif + if (err_code != HAL_OK) + { + QSPI_SMART_CS_HIGH(id); + p_qspi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ + +static bool app_qspi_dma_match_check(app_qspi_params_t * p_params) { + if(((p_params->id == APP_QSPI_ID_0) && (p_params->dma_cfg.dma_instance == DMA1)) || + ((p_params->id == APP_QSPI_ID_2) && (p_params->dma_cfg.dma_instance == DMA0)) + ) { + if(APP_QSPI_EXCEPT_DEBUG_EN) printf("+++ ERR: QSPI/DMA DOES NOT MATCH !\r\n"); + return false; + } + + if((p_params->dma_cfg.dma_channel != DMA_Channel0) && (p_params->dma_cfg.dma_channel != DMA_Channel1)) { + if(APP_QSPI_EXCEPT_DEBUG_EN) printf("+++ ERR: Please AGGIGN DMA CHANNEL0/1 TO QSPI !\r\n"); + return false; + } + + return true; +} + +static bool app_qspi_switch_dma_mode(app_qspi_id_t id, bool is_m2m_mode) { + app_dma_params_t dma_params = {0}; + + if(p_qspi_env[id]->is_dma_mode_m2m == is_m2m_mode) { + return true; + } else { + if(is_m2m_mode) { + dma_params.p_instance = p_qspi_env[id]->dma_cfg.dma_instance; + dma_params.channel_number = p_qspi_env[id]->dma_cfg.dma_channel; + dma_params.init.direction = DMA_MEMORY_TO_MEMORY; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_INCREMENT; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + dma_params.init.mode = DMA_NORMAL; + dma_params.init.priority = DMA_PRIORITY_LOW; + } else { + dma_params.p_instance = p_qspi_env[id]->dma_cfg.dma_instance; + dma_params.channel_number = p_qspi_env[id]->dma_cfg.dma_channel; + dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + dma_params.init.src_increment = DMA_SRC_INCREMENT; + dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + dma_params.init.mode = DMA_NORMAL; + dma_params.init.priority = DMA_PRIORITY_LOW; + } + + p_qspi_env[id]->dma_id = app_dma_init(&dma_params, NULL); + if (p_qspi_env[id]->dma_id < 0) + { + return false; + } + p_qspi_env[id]->handle.p_dma = app_dma_get_handle(p_qspi_env[id]->dma_id); + p_qspi_env[id]->handle.p_dma->p_parent = (void*)&p_qspi_env[id]->handle; + } + + p_qspi_env[id]->is_dma_mode_m2m = is_m2m_mode; + return true; +} + +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rng.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rng.c new file mode 100644 index 0000000..a6d288c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rng.c @@ -0,0 +1,294 @@ +/** + **************************************************************************************** + * @file app_rng.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_rng.h" +#include "app_pwr_mgmt.h" +#include "string.h" +#include "gr_soc.h" + +#ifdef HAL_RNG_MODULE_ENABLED + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool rng_prepare_for_sleep(void); +static void rng_wake_up_ind(void); +void RNG_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +rng_env_t *p_rng_env = NULL; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_rng_pwr_id; + +const static app_sleep_callbacks_t rng_sleep_cb = +{ + .app_prepare_for_sleep = rng_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = rng_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool rng_prepare_for_sleep(void) +{ + hal_rng_state_t state; + + if (p_rng_env->rng_state == APP_RNG_ACTIVITY) + { + state = hal_rng_get_state(&p_rng_env->handle); + if ((state != HAL_RNG_STATE_READY) && (state != HAL_RNG_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_rng_suspend_reg(&p_rng_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_rng_env->rng_state = APP_RNG_SLEEP; + #endif + } + + return true; +} + +SECTION_RAM_CODE static void rng_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + if (p_rng_env->rng_state == APP_RNG_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_rng_resume_reg(&p_rng_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + if (p_rng_env->use_type == APP_RNG_TYPE_INTERRUPT) + { + hal_nvic_clear_pending_irq(RNG_IRQn); + hal_nvic_enable_irq(RNG_IRQn); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +static void rng_wake_up(void) +{ + if (p_rng_env->rng_state == APP_RNG_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_rng_resume_reg(&p_rng_env->handle); + GLOBAL_EXCEPTION_ENABLE(); + if (p_rng_env->use_type == APP_RNG_TYPE_INTERRUPT) + { + hal_nvic_clear_pending_irq(RNG_IRQn); + hal_nvic_enable_irq(RNG_IRQn); + } + p_rng_env->rng_state = APP_RNG_ACTIVITY; + } +} +#endif + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_rng_init(app_rng_params_t *p_params, app_rng_evt_handler_t evt_handler) +{ + hal_status_t hal_err_code = HAL_OK; + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + p_rng_env = &p_params->rng_env; + if (p_params->use_type == APP_RNG_TYPE_INTERRUPT) + { + soc_register_nvic(RNG_IRQn, (uint32_t)RNG_IRQHandler); + hal_nvic_clear_pending_irq(RNG_IRQn); + hal_nvic_enable_irq(RNG_IRQn); + } + + p_rng_env->use_type = p_params->use_type; + p_rng_env->evt_handler = evt_handler; + + memcpy(&p_rng_env->handle.init, &p_params->init, sizeof(rng_init_t)); + p_rng_env->handle.p_instance = RNG; + hal_err_code = hal_rng_deinit(&p_rng_env->handle); + APP_DRV_ERR_CODE_CHECK(hal_err_code); + + hal_err_code = hal_rng_init(&p_rng_env->handle); + APP_DRV_ERR_CODE_CHECK(hal_err_code); + + if(s_sleep_cb_registered_flag == false) // register sleep callback + { + s_sleep_cb_registered_flag = true; + s_rng_pwr_id = pwr_register_sleep_cb(&rng_sleep_cb, APP_DRIVER_RNG_WAPEUP_PRIORITY); + if (s_rng_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_rng_env->rng_state = APP_RNG_ACTIVITY; + + return app_err_code; +} + +uint16_t app_rng_deinit(void) +{ + hal_status_t hal_err_code; + + if ((p_rng_env == NULL) || (p_rng_env->rng_state == APP_RNG_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + hal_nvic_disable_irq(RNG_IRQn); + p_rng_env->rng_state = APP_RNG_INVALID; + + GLOBAL_EXCEPTION_DISABLE(); + pwr_unregister_sleep_cb(s_rng_pwr_id); + s_rng_pwr_id = -1; + s_sleep_cb_registered_flag = false; + GLOBAL_EXCEPTION_ENABLE(); + + hal_err_code = hal_rng_deinit(&p_rng_env->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + p_rng_env = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_rng_gen_sync(uint16_t *p_seed, uint32_t *p_random32bit) +{ + hal_status_t err_code; + + if ((p_rng_env == NULL) || (p_rng_env->rng_state == APP_RNG_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_random32bit == NULL) || ((p_seed == NULL) && (p_rng_env->handle.init.seed_mode != RNG_SEED_FR0_S0))) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + rng_wake_up(); +#endif + + err_code = hal_rng_generate_random_number(&p_rng_env->handle, p_seed, p_random32bit); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_rng_gen_async(uint16_t *p_seed) +{ + hal_status_t err_code; + + if ((p_rng_env == NULL) || (p_rng_env->rng_state == APP_RNG_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_rng_env->use_type == APP_RNG_TYPE_POLLING) + { + return APP_DRV_ERR_INVALID_MODE; + } + + if ((p_seed == NULL) && (p_rng_env->handle.init.seed_mode != RNG_SEED_FR0_S0)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + rng_wake_up(); +#endif + + err_code = hal_rng_generate_random_number_it(&p_rng_env->handle, p_seed); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +rng_handle_t *app_rng_get_handle(void) +{ + if ((p_rng_env == NULL) || (p_rng_env->rng_state == APP_RNG_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + rng_wake_up(); +#endif + + return &p_rng_env->handle; +} + +void hal_rng_ready_data_callback(rng_handle_t *p_rng, uint32_t random32bit) +{ + app_rng_evt_t rng_evt; + rng_evt.type = APP_RNG_EVT_DONE; + rng_evt.random_data = random32bit; + + if (p_rng_env->evt_handler != NULL) + { + p_rng_env->evt_handler(&rng_evt); + } +} + +SECTION_RAM_CODE void RNG_IRQHandler(void) +{ + hal_rng_irq_handler(&p_rng_env->handle); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtc.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtc.c new file mode 100644 index 0000000..9fb3f62 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtc.c @@ -0,0 +1,560 @@ +/** + **************************************************************************************** + * @file app_rtc.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_rtc.h" +#include +#include "platform_sdk.h" +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#include "gr55xx_pwr.h" +#endif +#include "gr_soc.h" + +#ifdef HAL_CALENDAR_MODULE_ENABLED + +#if (CFG_LPCLK_INTERNAL_EN == 0) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ + +/**@brief App rtc state types. */ +typedef enum +{ + APP_RTC_INVALID = 0, + APP_RTC_ACTIVITY, +} app_rtc_state_t; + +struct rtc_env_t +{ + app_rtc_evt_handler_t evt_handler; + calendar_handle_t handle; + app_rtc_state_t rtc_state; +}; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ + +void CALENDAR_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ + +struct rtc_env_t s_rtc_env; + +/* +* NOTE: +* This defined value is only for SOC GR5332 +* 1.RTC is fully functional without FreeRTOS +* 2.In FreeRTOS, only init time and get time work. +*/ +#if defined(ENV_USE_FREERTOS) && defined(SOC_GR5332) + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_rtc_init(app_rtc_evt_handler_t evt_handler) +{ + s_rtc_env.evt_handler = evt_handler; + s_rtc_env.handle.clock_freq = SystemSlowClock; + + clock_calib_notify_register(app_rtc_time_sync); + + s_rtc_env.rtc_state = APP_RTC_ACTIVITY; + + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_deinit(void) +{ + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_INVALID_ID; + } + + clock_calib_notify_register(NULL); + + s_rtc_env.rtc_state = APP_RTC_INVALID; + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_init_time(app_rtc_time_t *p_time) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_time == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = hal_calendar_init_time(&s_rtc_env.handle, p_time); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_get_time(app_rtc_time_t *p_time) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_time == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = hal_calendar_get_time(&s_rtc_env.handle, p_time); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_alarm(app_rtc_alarm_t *p_alarm) +{ + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_alarm == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_tick(uint32_t interval) +{ + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (interval == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + return APP_DRV_SUCCESS; +} + +void app_rtc_time_sync(uint16_t SlowClockFreq) +{ + if (s_rtc_env.rtc_state == APP_RTC_INVALID || SlowClockFreq == 0) + { + return; + } + + hal_calendar_sync_time(&s_rtc_env.handle, SlowClockFreq); +} + +#else + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_rtc_event_call(calendar_handle_t *p_calendar, app_rtc_evt_type_t evt_type) +{ + app_rtc_evt_t rtc_evt; + + rtc_evt.type = evt_type; + if(s_rtc_env.evt_handler != NULL) + { + s_rtc_env.evt_handler(&rtc_evt); + } +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_rtc_init(app_rtc_evt_handler_t evt_handler) +{ + hal_status_t err_code; + + s_rtc_env.evt_handler = evt_handler; + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + s_rtc_env.handle.clock_freq = SystemSlowClock; +#endif + + soc_register_nvic(CALENDAR_IRQn, (uint32_t)CALENDAR_IRQHandler); + err_code = hal_calendar_deinit(&s_rtc_env.handle); + HAL_ERR_CODE_CHECK(err_code); + err_code = hal_calendar_init(&s_rtc_env.handle); + HAL_ERR_CODE_CHECK(err_code); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + clock_calib_notify_register(app_rtc_time_sync); +#endif + + s_rtc_env.rtc_state = APP_RTC_ACTIVITY; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + pwr_mgmt_wakeup_source_setup(PWR_WKUP_COND_CALENDAR); +#endif + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_deinit(void) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + hal_calendar_disable_event(&s_rtc_env.handle, CALENDAR_ALARM_DISABLE_ALL); + + err_code = hal_calendar_deinit(&s_rtc_env.handle); + HAL_ERR_CODE_CHECK(err_code); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + clock_calib_notify_register(NULL); +#endif + + s_rtc_env.rtc_state = APP_RTC_INVALID; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + pwr_mgmt_wakeup_source_clear(PWR_WKUP_COND_CALENDAR); +#endif + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_init_time(app_rtc_time_t *p_time) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_time == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = hal_calendar_init_time(&s_rtc_env.handle, p_time); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_get_time(app_rtc_time_t *p_time) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_time == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = hal_calendar_get_time(&s_rtc_env.handle, p_time); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_alarm(app_rtc_alarm_t *p_alarm) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_alarm == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = hal_calendar_set_alarm(&s_rtc_env.handle, p_alarm); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_tick(uint32_t interval) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (interval < 5) +#else + if (interval == 0) +#endif + { + return APP_DRV_ERR_INVALID_PARAM; + } + + err_code = hal_calendar_set_tick(&s_rtc_env.handle, interval); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_disable_event(uint32_t disable_mode) +{ + hal_status_t err_code; + + if (s_rtc_env.rtc_state == APP_RTC_INVALID) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_calendar_disable_event(&s_rtc_env.handle, disable_mode); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +void app_rtc_time_sync(uint16_t SlowClockFreq) +{ + if (s_rtc_env.rtc_state == APP_RTC_INVALID || SlowClockFreq == 0) + { + return; + } + + hal_calendar_sync_time(&s_rtc_env.handle, SlowClockFreq); +} +#endif + +void hal_calendar_alarm_callback(calendar_handle_t *p_calendar) +{ + app_rtc_event_call(p_calendar, APP_RTC_EVT_DATE_ALARM); +} + +void hal_calendar_tick_callback(calendar_handle_t *p_calendar) +{ + app_rtc_event_call(p_calendar, APP_RTC_EVT_TICK_ALARM); +} + +void hal_calendar_overflow_callback(calendar_handle_t *p_calendar) +{ + app_rtc_event_call(p_calendar, APP_RTC_EVT_OVERFLOW); +} + +SECTION_RAM_CODE void CALENDAR_IRQHandler(void) +{ + hal_calendar_irq_handler(&s_rtc_env.handle); +} + +#endif + +#else + +#include "ble_time.h" +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint64_t s_sys_sync_hus = 0; // Record the hus from 01.01.2000 00:00 to the time when time sync +static ble_time_t s_ble_sync_time = {0, 0}; // Record the ble time when time sync + +/* Caculate seconds from 01.01.2000 00:00 to the time */ +void calendar_time2seconds(calendar_time_t *p_time, uint32_t *p_seconds) +{ + uint16_t year; + uint32_t utc; + + // 10957 is the days between 1970/1/1 and 2000/1/1 + year = (p_time->year + 2000) % 100; + utc = 10957; + utc += (year * 365 + (year + 3) / 4); + utc += (367 * p_time->mon - 362) / 12 - (p_time->mon <= 2 ? 0 : ((year % 4 == 0) ? 1 : 2)); + utc += (p_time->date - 1); + utc *= 86400; + utc += (p_time->hour * 3600 + p_time->min * 60 + p_time->sec); + + *p_seconds = utc; +} + +/* Caculate time with seconds from 01.01.2000 00:00 to the p_time */ +void seconds2_calendar_time(calendar_time_t *p_time, uint32_t seconds) +{ + const uint16_t days0[] = { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }; + const uint16_t days1[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; + + calendar_time_t time; + uint32_t days, secs; + uint16_t year; + const uint16_t * dayp; + + // 10957 is the days between 1970/1/1 and 2000/1/1 + if (seconds >= 10957 * 86400) + { + days = seconds / 86400 - 10957; + secs = seconds % 86400; + } + else + { + days = 0; + secs = 0; + } + + time.sec = secs % 60; secs /= 60; + time.min = secs % 60; secs /= 60; + time.hour = secs; + + year = 2000; + time.week = (days + 6) % 7; + + year += (days / 1461) * 4; days %= 1461; + if (days >= 366) + dayp = days1; + else + dayp = days0; + if (days >= 366) + { + year += (days - 1) / 365; + days = (days - 1) % 365; + } + + time.mon = days / 31 + 1; + if (days >= dayp[time.mon]) + time.mon += 1; + + time.date = days - dayp[time.mon - 1] + 1; + time.year = year - 2000; + + memcpy(p_time, &time, sizeof(calendar_time_t)); +} + +/* The calendar_time_sync shall be called every 23 hours to keep counting continously*/ +void calendar_time_sync(void) +{ + // protect the calendar time sync operation + GLOBAL_EXCEPTION_DISABLE(); + + // calculate the sync diff + ble_time_t current_time = ble_time_get(); + uint64_t diff_hus = (uint64_t)CLK_SUB(current_time.hs, s_ble_sync_time.hs)*HALF_SLOT_SIZE; + diff_hus = diff_hus + current_time.hus - s_ble_sync_time.hus; + + // sync the calendar time + s_sys_sync_hus = s_sys_sync_hus + diff_hus; + s_ble_sync_time = current_time; + + GLOBAL_EXCEPTION_ENABLE(); +} + +uint16_t app_rtc_init_time(app_rtc_time_t *p_time) +{ + // calculate the calendar time in seconds + uint32_t seconds = 0; + calendar_time2seconds(p_time, &seconds); + + // initialize the calendar time in hus + s_sys_sync_hus = ((uint64_t)(seconds) * SECOND_IN_HUS) + (TICK_MS_IN_HUS * p_time->ms); + s_ble_sync_time = ble_time_get(); + + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_get_time(app_rtc_time_t *p_time) +{ + // sync the calendar time + calendar_time_sync(); + + // calculate the calendar time in seconds + uint32_t seconds = s_sys_sync_hus / SECOND_IN_HUS; + seconds2_calendar_time(p_time, seconds); + + // calculate the calendar time in ms + uint32_t ms = (s_sys_sync_hus % SECOND_IN_HUS) / TICK_MS_IN_HUS; + p_time->ms = ms; + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_init(app_rtc_evt_handler_t evt_handler) +{ + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_deinit(void) +{ + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_alarm(app_rtc_alarm_t *p_alarm) +{ + return APP_DRV_SUCCESS; +} + +uint16_t app_rtc_setup_tick(uint32_t interval) +{ + return APP_DRV_SUCCESS; +} + +#endif + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtos_cfg.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtos_cfg.c new file mode 100644 index 0000000..862b8c6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_rtos_cfg.c @@ -0,0 +1,248 @@ +/** + **************************************************************************************** + * @file app_rtos_cfg.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_rtos_cfg.h" +#include "app_drv_error.h" +#include +#include + + +#ifdef ENV_USE_FREERTOS + +#include "FreeRTOS.h" +#include "semphr.h" + +uint16_t app_driver_sem_init(sem_t *sem) +{ + SemaphoreHandle_t *xSemaphore = (SemaphoreHandle_t *)sem; + + if (NULL == sem) + { + return APP_DRV_ERR_INVALID_PARAM; + } + *xSemaphore = xSemaphoreCreateBinary(); + if (NULL == *xSemaphore) + { + return APP_DRV_ERR_POINTER_NULL; + } + return APP_DRV_SUCCESS; +} + +void app_driver_sem_deinit(sem_t sem) +{ + vSemaphoreDelete(sem); +} + +uint16_t app_driver_sem_pend(sem_t sem, uint32_t time_out) +{ + BaseType_t ret = pdTRUE; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + SemaphoreHandle_t xSemaphore = (SemaphoreHandle_t)sem; + TickType_t xTicks = portMAX_DELAY; + + if (NULL == sem) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (time_out != portMAX_DELAY) + { + xTicks = pdMS_TO_TICKS(time_out); + } + + if (__get_IPSR()) + { + ret = xSemaphoreTakeFromISR(xSemaphore, &xHigherPriorityTaskWoken); + if(xHigherPriorityTaskWoken != pdFALSE) + { + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + } + else + { + ret = xSemaphoreTake(xSemaphore, xTicks); + } + if (ret != pdTRUE) + { + return APP_DRV_ERR_TIMEOUT; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_driver_sem_post(sem_t sem) +{ + BaseType_t ret = pdTRUE; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + SemaphoreHandle_t xSemaphore = (SemaphoreHandle_t)sem; + + if (NULL == sem) + { + return APP_DRV_ERR_INVALID_PARAM; + } + if (__get_IPSR()) + { + ret = xSemaphoreGiveFromISR(xSemaphore, &xHigherPriorityTaskWoken); + if(xHigherPriorityTaskWoken != pdFALSE) + { + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + } + else + { + ret = xSemaphoreGive(xSemaphore); + } + if (ret != pdTRUE) + { + return APP_DRV_ERR_INVALID_PARAM; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_driver_sem_post_from_isr(sem_t sem) +{ + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t ret = pdTRUE; + SemaphoreHandle_t xSemaphore = (SemaphoreHandle_t)sem; + + if (NULL == sem) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + ret = xSemaphoreGiveFromISR(xSemaphore, &xHigherPriorityTaskWoken); + if(xHigherPriorityTaskWoken != pdFALSE) + { + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + if (ret != pdTRUE) + { + return APP_DRV_ERR_INVALID_PARAM; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_driver_mutex_init(mutex_t *mutex) +{ + SemaphoreHandle_t *xMutex = (SemaphoreHandle_t *)(mutex); + + if (NULL == mutex) + { + return APP_DRV_ERR_INVALID_PARAM; + } + *xMutex = xSemaphoreCreateMutex(); + if (NULL == *xMutex) + { + return APP_DRV_ERR_POINTER_NULL; + } + return APP_DRV_SUCCESS; +} + +void app_driver_mutex_deinit(mutex_t mutex) +{ + vSemaphoreDelete(mutex); +} + +uint16_t app_driver_mutex_pend(mutex_t mutex, uint32_t time_out) +{ + SemaphoreHandle_t xMutex = (SemaphoreHandle_t)mutex; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + BaseType_t ret = pdTRUE; + TickType_t xTicks = portMAX_DELAY; + + if (NULL == mutex) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (time_out != portMAX_DELAY) + { + xTicks = pdMS_TO_TICKS(time_out); + } + + if (__get_IPSR()) + { + ret = xSemaphoreTakeFromISR(xMutex, &xHigherPriorityTaskWoken); + if(xHigherPriorityTaskWoken != pdFALSE) + { + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + } + else + { + ret = xSemaphoreTake(xMutex, xTicks); + } + + if (ret != pdTRUE) + { + return APP_DRV_ERR_TIMEOUT; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_driver_mutex_post(mutex_t mutex) +{ + BaseType_t ret = pdTRUE; + SemaphoreHandle_t xMutex = (SemaphoreHandle_t)mutex; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + + if (NULL == mutex) + { + return APP_DRV_ERR_INVALID_PARAM; + } + if (__get_IPSR()) + { + ret = xSemaphoreGiveFromISR(xMutex, &xHigherPriorityTaskWoken); + if(xHigherPriorityTaskWoken != pdFALSE) + { + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + } + else + { + ret = xSemaphoreGive(xMutex); + } + + if (ret != pdTRUE) + { + return APP_DRV_ERR_INVALID_PARAM; + } + return APP_DRV_SUCCESS; +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_soft_encoder.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_soft_encoder.c new file mode 100644 index 0000000..04d0341 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_soft_encoder.c @@ -0,0 +1,177 @@ +/** + **************************************************************************************** + * @file app_soft_encoder.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_soft_encoder.h" +#include "string.h" +#include "app_pwr_mgmt.h" +#include "gr55xx_delay.h" +#include "app_timer.h" +#include "app_gpiote.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define SOFT_ENCODER_STOP_STATUS 0x00 + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static app_soft_encoder_direction_t s_cur_direction; /* */ +static int s_cur_distance; /**/ + +static app_gpiote_param_t s_gpiote_info[APP_SOFT_ENCODER_SINGAL_NUMBER]; + +static uint8_t s_singal_a_level; /* */ +static uint8_t s_singal_b_level; /* */ + +static app_soft_encoder_callback s_ext_callback;/**< the soft encoder current singal irq type A\B*/ + + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static void app_soft_encoder_analy_dir(uint8_t singal_a,uint8_t singal_b) +{ + if (singal_a == 1 && singal_b == 0) + { + s_cur_direction = APP_SOFT_ENCODER_POSITIVE; + s_cur_distance++; + } + else if (singal_a == 0 && singal_b == 1) + { + s_cur_direction = APP_SOFT_ENCODER_REVERSE; + s_cur_distance--; + } + else + { + return; + } + + s_ext_callback(s_cur_direction,s_cur_distance); +} + +static void app_soft_encoder_io_a_callback_t(app_io_evt_t *p_evt) +{ + uint8_t a_io_level = 0; + + delay_us(500); + + a_io_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].pin); + + if (APP_IO_PIN_SET == a_io_level && APP_IO_MODE_IT_RISING == s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].mode) + { + s_singal_a_level = a_io_level; + s_singal_b_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].pin); + app_soft_encoder_analy_dir(s_singal_a_level,s_singal_b_level); + } + else if (APP_IO_PIN_RESET == a_io_level && APP_IO_MODE_IT_FALLING == s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].mode) + { + s_singal_a_level = a_io_level; + s_singal_b_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].pin); + app_soft_encoder_analy_dir(s_singal_a_level,s_singal_b_level); + } +} + +static void app_soft_encoder_io_b_callback_t(app_io_evt_t *p_evt) +{ + uint8_t b_io_level = 0; + + delay_us(500); + + b_io_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].pin); + + if (APP_IO_PIN_SET == b_io_level && APP_IO_MODE_IT_RISING == s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].mode) + { + s_singal_b_level = b_io_level; + s_singal_a_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].pin); + app_soft_encoder_analy_dir(s_singal_a_level, s_singal_b_level); + } + else if (APP_IO_PIN_RESET == b_io_level && APP_IO_MODE_IT_FALLING == s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].mode) + { + s_singal_b_level = b_io_level; + s_singal_a_level = app_io_read_pin(s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].type,s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].pin); + app_soft_encoder_analy_dir(s_singal_a_level, s_singal_b_level); + } + +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_soft_encoder_init(app_soft_encoder_io_param_t *p_a_params, app_soft_encoder_io_param_t *p_b_params, app_soft_encoder_callback evt_handler) +{ + uint16_t error_code; + + if (evt_handler == NULL || p_a_params == NULL || p_b_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + s_ext_callback = evt_handler; + + + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].type = p_a_params->type; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].pin = p_a_params->pin; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].mode = p_a_params->mode; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].pull = p_a_params->pull; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_A].io_evt_cb = app_soft_encoder_io_a_callback_t; + + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].type = p_b_params->type; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].pin = p_b_params->pin; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].mode = p_b_params->mode; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].pull = p_b_params->pull; + s_gpiote_info[APP_SOFT_ENCODER_SIGNAL_B].io_evt_cb = app_soft_encoder_io_b_callback_t; + + error_code = app_gpiote_init(s_gpiote_info, APP_SOFT_ENCODER_SINGAL_NUMBER); + APP_DRV_ERR_CODE_CHECK(error_code); + + s_cur_direction = APP_SOFT_ENCODER_STOP; + s_cur_distance = 0; + + + s_singal_a_level = 0; + s_singal_b_level = 0; + + return APP_DRV_SUCCESS; +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi.c new file mode 100644 index 0000000..420ca55 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi.c @@ -0,0 +1,1201 @@ +/** + **************************************************************************************** + * @file app_spi.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_spi.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" +#include + +#ifdef HAL_SPI_MODULE_ENABLED + +/* + * DEFINES + ***************************************************************************************** + */ +#define DEFAULT_POLLING_WAIT_TIMEOUT_MS 1000u +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define BLE_INT_DISABLE() \ +do { \ + volatile uint32_t __ble_l_irq_rest = __get_PRIMASK(); \ + volatile bool __ble_int_status = NVIC_GetEnableIRQ(BLE_IRQn) || NVIC_GetEnableIRQ(BLESLP_IRQn); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_DisableIRQ(BLE_IRQn); \ + NVIC_DisableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); + +/** @brief Restore BLE_IRQn and BLESLP_IRQn. + * @sa BLE_INT_RESTORE + */ +#define BLE_INT_RESTORE() \ + __ble_l_irq_rest = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_EnableIRQ(BLE_IRQn); \ + NVIC_EnableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); \ +} while(0) +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define SPI_SMART_CS_LOW(id) \ + do { \ + if((APP_SPI_ID_SLAVE != id) && \ + (p_spi_env[id]->p_pin_cfg->cs.enable == APP_SPI_PIN_ENABLE)) \ + { \ + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, \ + p_spi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_RESET); \ + }\ + } while(0) + +#define SPI_SMART_CS_HIGH(id) \ + do { \ + if((APP_SPI_ID_SLAVE != id) && \ + (p_spi_env[id]->p_pin_cfg->cs.enable == APP_SPI_PIN_ENABLE)) \ + { \ + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, \ + p_spi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_SET); \ + } \ + } while(0) +#else +#define SPI_SMART_CS_LOW(id) +#define SPI_SMART_CS_HIGH(id) +#endif + +#define APP_SPI_CALLBACK(id, evt) \ + do \ + { \ + p_spi_env[id]->start_flag = false; \ + SPI_SMART_CS_HIGH(id); \ + if (p_spi_env[id]->evt_handler != NULL) \ + { \ + p_spi_env[id]->evt_handler(&evt); \ + } \ + } while(0) + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool spi_prepare_for_sleep(void); +static void spi_wake_up_ind(void); +static uint16_t spi_gpio_config(app_spi_id_t id, app_spi_pin_cfg_t pin_cfg); +void SPI_S_IRQHandler(void); +void SPI_M_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const IRQn_Type s_spi_irq[APP_SPI_ID_MAX] = {SPI_S_IRQn, SPI_M_IRQn}; +static const uint32_t s_spi_instance[APP_SPI_ID_MAX] = {SPIS_BASE, SPIM_BASE}; + +spi_env_t *p_spi_env[APP_SPI_ID_MAX]; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_spi_pwr_id = -1; + +static const app_sleep_callbacks_t spi_sleep_cb = +{ + .app_prepare_for_sleep = spi_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = spi_wake_up_ind +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool spi_prepare_for_sleep(void) +{ + hal_spi_state_t state; + uint8_t i; + + for (i = 0; i < APP_SPI_ID_MAX; i++) + { + if (p_spi_env[i] == NULL) + { + continue; + } + + if (p_spi_env[i]->spi_state == APP_SPI_ACTIVITY) + { + state = hal_spi_get_state(&p_spi_env[i]->handle); + if ((state != HAL_SPI_STATE_READY) && (state != HAL_SPI_STATE_RESET)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_spi_suspend_reg(&p_spi_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + #ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_spi_env[i]->spi_state = APP_SPI_SLEEP; + #endif + } + } + + return true; +} + +SECTION_RAM_CODE static void spi_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_SPI_ID_MAX; i++) + { + if (p_spi_env[i] == NULL) + { + continue; + } + + if (p_spi_env[i]->spi_state == APP_SPI_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_spi_resume_reg(&p_spi_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_spi_irq[i]); + hal_nvic_enable_irq(s_spi_irq[i]); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void spi_wake_up(app_spi_id_t id) +{ + if (p_spi_env[id]->spi_state == APP_SPI_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_spi_resume_reg(&p_spi_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + if(p_spi_env[id]->use_mode.type == APP_SPI_TYPE_INTERRUPT || + p_spi_env[id]->use_mode.type == APP_SPI_TYPE_DMA) + { + hal_nvic_clear_pending_irq(s_spi_irq[id]); + hal_nvic_enable_irq(s_spi_irq[id]); + } + p_spi_env[id]->spi_state = APP_SPI_ACTIVITY; + } + + dma_wake_up(p_spi_env[id]->dma_id[0]); + dma_wake_up(p_spi_env[id]->dma_id[1]); +} +#endif + +static uint16_t spi_gpio_config(app_spi_id_t id, app_spi_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (pin_cfg.cs.enable == APP_SPI_PIN_ENABLE) + { + if (id == APP_SPI_ID_SLAVE) + { + io_init.pull = pin_cfg.cs.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = pin_cfg.cs.mux; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + else + { +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + io_init.pull = pin_cfg.cs.pull; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = APP_IO_MUX_7; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + app_io_write_pin(pin_cfg.cs.type, pin_cfg.cs.pin, APP_IO_PIN_SET); + APP_DRV_ERR_CODE_CHECK(err_code); +#else + if(p_spi_env[id]->is_soft_cs) { + io_init.pull = pin_cfg.cs.pull; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = APP_IO_MUX; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + app_io_write_pin(pin_cfg.cs.type, pin_cfg.cs.pin, APP_IO_PIN_SET); + APP_DRV_ERR_CODE_CHECK(err_code); + } else { + io_init.pull = pin_cfg.cs.pull; + io_init.mode = pin_cfg.cs.mode; + io_init.pin = pin_cfg.cs.pin; + io_init.mux = pin_cfg.cs.mux; + err_code = app_io_init(pin_cfg.cs.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } +#endif + } + } + if (pin_cfg.clk.enable == APP_SPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.clk.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.clk.pin; + io_init.mux = pin_cfg.clk.mux; + err_code = app_io_init(pin_cfg.clk.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.mosi.enable == APP_SPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.mosi.pull; + io_init.pin = pin_cfg.mosi.pin; + io_init.mux = pin_cfg.mosi.mux; + err_code = app_io_init(pin_cfg.mosi.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + if (pin_cfg.miso.enable == APP_SPI_PIN_ENABLE) + { + io_init.pull = pin_cfg.miso.pull; + io_init.pin = pin_cfg.miso.pin; + io_init.mux = pin_cfg.miso.mux; + err_code = app_io_init(pin_cfg.miso.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +static inline app_spi_id_t spi_get_id(spi_handle_t *p_spi) +{ + app_spi_id_t id = APP_SPI_ID_MAX; + + if (p_spi->p_instance == SPIS) + { + id = APP_SPI_ID_SLAVE; + } + else if (p_spi->p_instance == SPIM) + { + id = APP_SPI_ID_MASTER; + } + + return id; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_spi_init(app_spi_params_t *p_params, app_spi_evt_handler_t evt_handler) +{ + app_spi_id_t id = p_params->id; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + p_spi_env[id] = &(p_params->spi_env); + soc_register_nvic(SPI_S_IRQn, (uint32_t)SPI_S_IRQHandler); + soc_register_nvic(SPI_M_IRQn, (uint32_t)SPI_M_IRQHandler); + + p_spi_env[id]->is_soft_cs = p_params->is_soft_cs; + + err_code = spi_gpio_config(p_params->id, p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(err_code); + + hal_nvic_clear_pending_irq(s_spi_irq[id]); + hal_nvic_enable_irq(s_spi_irq[id]); + + p_spi_env[id]->p_pin_cfg = &p_params->pin_cfg; + p_spi_env[id]->evt_handler = evt_handler; + + memcpy(&p_spi_env[id]->handle.init, &p_params->init, sizeof(spi_init_t)); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_spi_env[id]->handle.p_instance = (ssi_regs_t *)s_spi_instance[id]; +#else + p_spi_env[id]->handle.p_instance = (spi_regs_t *)s_spi_instance[id]; +#endif + +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + if(p_params->is_soft_cs) { + p_spi_env[id]->handle.soft_cs_magic = SPI_SOFT_CS_MAGIC_NUMBER; + } else { + p_spi_env[id]->handle.soft_cs_magic = 0x00; + } +#endif + + hal_spi_deinit(&p_spi_env[id]->handle); + hal_spi_init(&p_spi_env[id]->handle); + + if (s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_spi_pwr_id = pwr_register_sleep_cb(&spi_sleep_cb, APP_DRIVER_SPI_WAPEUP_PRIORITY); + + if (s_spi_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_spi_env[id]->spi_state = APP_SPI_ACTIVITY; + p_spi_env[id]->start_flag = false; + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_deinit(app_spi_id_t id) +{ + uint8_t i; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_spi_env[id]->p_pin_cfg->cs.enable == APP_SPI_PIN_ENABLE) + { + app_io_deinit(p_spi_env[id]->p_pin_cfg->cs.type, p_spi_env[id]->p_pin_cfg->cs.pin); + } + if (p_spi_env[id]->p_pin_cfg->clk.enable == APP_SPI_PIN_ENABLE) + { + app_io_deinit(p_spi_env[id]->p_pin_cfg->clk.type, p_spi_env[id]->p_pin_cfg->clk.pin); + } + if (p_spi_env[id]->p_pin_cfg->mosi.enable == APP_SPI_PIN_ENABLE) + { + app_io_deinit(p_spi_env[id]->p_pin_cfg->mosi.type, p_spi_env[id]->p_pin_cfg->mosi.pin); + } + if (p_spi_env[id]->p_pin_cfg->miso.enable == APP_SPI_PIN_ENABLE) + { + app_io_deinit(p_spi_env[id]->p_pin_cfg->miso.type, p_spi_env[id]->p_pin_cfg->miso.pin); + } + + hal_nvic_disable_irq(s_spi_irq[id]); + + p_spi_env[id]->spi_state = APP_SPI_INVALID; + p_spi_env[id]->start_flag = false; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_SPI_ID_MAX; i++) + { + if (p_spi_env[i] != NULL && (p_spi_env[i]->spi_state) != APP_SPI_INVALID) + { + break; + } + } + if (APP_SPI_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_spi_pwr_id); + s_spi_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_spi_deinit(&p_spi_env[id]->handle); + if (p_spi_env[id]->spi_dma_state == APP_SPI_DMA_INVALID) + { + p_spi_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spim_transmit_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t * p_data, uint16_t data_length) { + hal_status_t err_code = HAL_OK; + + if (id != APP_SPI_ID_MASTER) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_data == NULL) || (data_length == 0)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_with_ia(&p_spi_env[id]->handle, instruction, address, p_data, data_length, DEFAULT_POLLING_WAIT_TIMEOUT_MS); + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_spim_receive_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t dummy_bytes, uint8_t * p_data, uint16_t data_length) { + uint8_t ia_data[8]; + uint8_t sent_len = 0; + hal_status_t err_code = HAL_OK; + + if (id != APP_SPI_ID_MASTER) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_data == NULL) ||(data_length == 0)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + memset(&ia_data[0], 0, 8); + + ia_data[0] = instruction; + ia_data[1] = (address >> 16) & 0xff; + ia_data[2] = (address >> 8) & 0xff; + ia_data[3] = (address >> 0) & 0xff; + + if(dummy_bytes > 4) { + return APP_DRV_ERR_INVALID_PARAM; + } + + sent_len = 4 + dummy_bytes; + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_read_eeprom(&p_spi_env[id]->handle, ia_data, p_data, sent_len, data_length, DEFAULT_POLLING_WAIT_TIMEOUT_MS); + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_receive_async(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_receive_it(&p_spi_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_receive_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_receive(&p_spi_env[id]->handle, p_data, size, timeout); + SPI_SMART_CS_HIGH(id); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_spi_receive_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + hal_status_t hal_err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + BLE_INT_DISABLE(); + p_spi_env[id]->rx_done = 0; + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + hal_err_code = hal_spi_receive_it(&p_spi_env[id]->handle, p_data, size); + if (hal_err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + app_err_code = (uint16_t)hal_err_code; + goto exit; + } + } + else + { + app_err_code = APP_DRV_ERR_BUSY; + goto exit; + } + + while(p_spi_env[id]->rx_done == 0); + +exit: + BLE_INT_RESTORE(); + + return app_err_code; +} + +uint16_t app_spi_transmit_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + hal_status_t hal_err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + BLE_INT_DISABLE(); + p_spi_env[id]->tx_done = 0; + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + hal_err_code = hal_spi_transmit_it(&p_spi_env[id]->handle, p_data, size); + if (hal_err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + app_err_code = (uint16_t)hal_err_code; + + goto exit; + } + } + else + { + app_err_code = APP_DRV_ERR_BUSY; + goto exit; + } + + while(p_spi_env[id]->tx_done == 0); + +exit: + BLE_INT_RESTORE(); + + return app_err_code; +} +#endif + +uint16_t app_spi_transmit_async(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_it(&p_spi_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_transmit_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit(&p_spi_env[id]->handle, p_data, size, timeout); + SPI_SMART_CS_HIGH(id); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_transmit_receive_sync(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_receive(&p_spi_env[id]->handle, p_tx_data, p_rx_data, size, timeout); + SPI_SMART_CS_HIGH(id); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_transmit_receive_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_receive_it(&p_spi_env[id]->handle, p_tx_data, p_rx_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_read_eeprom_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL || tx_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_read_eeprom_it(&p_spi_env[id]->handle, p_tx_data, p_rx_data, tx_size, rx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_read_eeprom_sync(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL || tx_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_read_eeprom(&p_spi_env[id]->handle, p_tx_data, p_rx_data, tx_size, rx_size, timeout); + SPI_SMART_CS_HIGH(id); + + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_spi_read_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_rx_data, uint32_t cmd_size, uint32_t rx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd_data == NULL || p_rx_data == NULL || cmd_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit(&p_spi_env[id]->handle, p_cmd_data, cmd_size, 1000); + if (err_code != HAL_OK) + { + SPI_SMART_CS_HIGH(id); + p_spi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + err_code = hal_spi_receive_it(&p_spi_env[id]->handle, p_rx_data, rx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_write_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_tx_data, uint32_t cmd_size, uint32_t tx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd_data == NULL || p_tx_data == NULL || cmd_size == 0 || tx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit(&p_spi_env[id]->handle, p_cmd_data, cmd_size, 1000); + if (err_code != HAL_OK) + { + SPI_SMART_CS_HIGH(id); + p_spi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + err_code = hal_spi_transmit_it(&p_spi_env[id]->handle, p_tx_data, tx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} +#endif + +spi_handle_t *app_spi_get_handle(app_spi_id_t id) +{ + if (id >= APP_SPI_ID_MAX) + { + return NULL; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + return &p_spi_env[id]->handle; +} + +uint16_t app_spi_abort(app_spi_id_t id) +{ + uint16_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + err_code = hal_spi_abort_it(&p_spi_env[id]->handle); + if (err_code != HAL_OK) + return err_code; + + return APP_DRV_SUCCESS; +} + +void hal_spi_soft_cs_assert(spi_handle_t *p_spi, uint32_t state) +{ + app_spi_id_t id = spi_get_id(p_spi); + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, p_spi_env[id]->p_pin_cfg->cs.pin, APP_IO_PIN_RESET); +} + +void hal_spi_soft_cs_deassert(spi_handle_t *p_spi, uint32_t state) +{ + app_spi_id_t id = spi_get_id(p_spi); + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, p_spi_env[id]->p_pin_cfg->cs.pin, APP_IO_PIN_SET); +} + +void hal_spi_tx_cplt_callback(spi_handle_t *p_spi) +{ + app_spi_evt_t spi_evt; + app_spi_id_t id = spi_get_id(p_spi); + + spi_evt.type = APP_SPI_EVT_TX_CPLT; + spi_evt.data.size = p_spi->tx_xfer_size - p_spi->tx_xfer_count; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_spi_env[id]->tx_done = 1; +#endif + APP_SPI_CALLBACK(id, spi_evt); +} + +void hal_spi_rx_cplt_callback(spi_handle_t *p_spi) +{ + app_spi_evt_t spi_evt; + app_spi_id_t id = spi_get_id(p_spi); + + spi_evt.type = APP_SPI_EVT_RX_CPLT; + spi_evt.data.size = p_spi->rx_xfer_size - p_spi->rx_xfer_count; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_spi_env[id]->rx_done = 1; +#endif + APP_SPI_CALLBACK(id, spi_evt); +} + +void hal_spi_tx_rx_cplt_callback(spi_handle_t *p_spi) +{ + app_spi_evt_t spi_evt; + app_spi_id_t id = spi_get_id(p_spi); + + spi_evt.type = APP_SPI_EVT_TX_RX_CPLT; + spi_evt.data.size = p_spi->rx_xfer_size - p_spi->rx_xfer_count; + APP_SPI_CALLBACK(id, spi_evt); +} + +void hal_spi_error_callback(spi_handle_t *p_spi) +{ + app_spi_evt_t spi_evt; + app_spi_id_t id = spi_get_id(p_spi); + + spi_evt.type = APP_SPI_EVT_ERROR; + spi_evt.data.error_code = p_spi->error_code; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + p_spi_env[id]->rx_done = 1; + p_spi_env[id]->tx_done = 1; +#endif + APP_SPI_CALLBACK(id, spi_evt); +} + +void hal_spi_abort_cplt_callback(spi_handle_t *p_spi) +{ + app_spi_evt_t spi_evt; + app_spi_id_t id = spi_get_id(p_spi); + spi_evt.type = APP_SPI_EVT_ABORT; + APP_SPI_CALLBACK(id, spi_evt); +} + +SECTION_RAM_CODE void SPI_S_IRQHandler(void) +{ + hal_spi_irq_handler(&p_spi_env[APP_SPI_ID_SLAVE]->handle); +} + +SECTION_RAM_CODE void SPI_M_IRQHandler(void) +{ + hal_spi_irq_handler(&p_spi_env[APP_SPI_ID_MASTER]->handle); +} + +#endif /* HAL_SPI_MODULE_ENABLED */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi_dma.c new file mode 100644 index 0000000..9acff78 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_spi_dma.c @@ -0,0 +1,820 @@ +/** + **************************************************************************************** + * @file app_spi_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_spi_dma.h" +#include "app_dma.h" +#include "app_drv_config.h" +#include "app_pwr_mgmt.h" +#include +#include "gr_soc.h" + +#ifdef HAL_SPI_MODULE_ENABLED +/* + * DEFINES + ***************************************************************************************** + */ +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define BLE_INT_DISABLE() \ +do { \ + volatile uint32_t __ble_l_irq_rest = __get_PRIMASK(); \ + volatile bool __ble_int_status = NVIC_GetEnableIRQ(BLE_IRQn) || NVIC_GetEnableIRQ(BLESLP_IRQn); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_DisableIRQ(BLE_IRQn); \ + NVIC_DisableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); + +/** @brief Restore BLE_IRQn and BLESLP_IRQn. + * @sa BLE_INT_RESTORE + */ +#define BLE_INT_RESTORE() \ + __ble_l_irq_rest = __get_PRIMASK(); \ + __set_PRIMASK(1); \ + if (__ble_int_status) \ + { \ + NVIC_EnableIRQ(BLE_IRQn); \ + NVIC_EnableIRQ(BLESLP_IRQn); \ + } \ + __set_PRIMASK(__ble_l_irq_rest); \ +} while(0) +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +#define SPI_SMART_CS_LOW(id) \ + do { \ + if((APP_SPI_ID_SLAVE != id) && \ + (p_spi_env[id]->p_pin_cfg->cs.enable == APP_SPI_PIN_ENABLE)) \ + { \ + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, \ + p_spi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_RESET); \ + }\ + } while(0) + +#define SPI_SMART_CS_HIGH(id) \ + do { \ + if((APP_SPI_ID_SLAVE != id) && \ + (p_spi_env[id]->p_pin_cfg->cs.enable == APP_SPI_PIN_ENABLE)) \ + { \ + app_io_write_pin(p_spi_env[id]->p_pin_cfg->cs.type, \ + p_spi_env[id]->p_pin_cfg->cs.pin, \ + APP_IO_PIN_SET); \ + } \ + } while(0) +#else +#define SPI_SMART_CS_LOW(id) +#define SPI_SMART_CS_HIGH(id) +#endif + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +extern bool spi_prepare_for_sleep(void); +extern void spi_sleep_canceled(void); +extern void spi_wake_up_ind(void); +extern void spi_wake_up(app_spi_id_t id); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +extern spi_env_t *p_spi_env[APP_SPI_ID_MAX]; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static uint16_t app_spi_config_dma_tx(app_spi_params_t *p_params) +{ + app_dma_params_t tx_dma_params = { 0 }; + + tx_dma_params.p_instance = p_params->dma_cfg.tx_dma_instance; + tx_dma_params.channel_number = p_params->dma_cfg.tx_dma_channel; + tx_dma_params.init.src_request = DMA0_REQUEST_MEM; + tx_dma_params.init.dst_request = (p_params->id == APP_SPI_ID_SLAVE) ? DMA0_REQUEST_SPIS_TX : DMA0_REQUEST_SPIM_TX; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (tx_dma_params.p_instance == DMA1) + { + if (p_params->id == APP_SPI_ID_SLAVE) + { + return APP_DRV_ERR_INVALID_PARAM; + } + tx_dma_params.init.src_request = DMA1_REQUEST_MEM; + tx_dma_params.init.dst_request = DMA1_REQUEST_SPIM_TX; + } +#endif + tx_dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + tx_dma_params.init.src_increment = DMA_SRC_INCREMENT; + tx_dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + if (p_params->init.data_size <= SPI_DATASIZE_8BIT) + { + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + } + else if (p_params->init.data_size <= SPI_DATASIZE_16BIT) + { + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_HALFWORD; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_HALFWORD; + } + else + { + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; + } +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + tx_dma_params.init.mode = DMA_NORMAL; +#endif + tx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_spi_env[p_params->id]->dma_id[0] = app_dma_init(&tx_dma_params, NULL); + + if (p_spi_env[p_params->id]->dma_id[0] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + p_spi_env[p_params->id]->handle.p_dmatx = app_dma_get_handle(p_spi_env[p_params->id]->dma_id[0]); + p_spi_env[p_params->id]->handle.p_dmatx->p_parent = (void*)&p_spi_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_spi_config_dma_rx(app_spi_params_t *p_params) +{ + app_dma_params_t rx_dma_params = { 0 }; + + rx_dma_params.p_instance = p_params->dma_cfg.rx_dma_instance; + rx_dma_params.channel_number = p_params->dma_cfg.rx_dma_channel; + rx_dma_params.init.dst_request = DMA0_REQUEST_MEM; + rx_dma_params.init.src_request = (p_params->id == APP_SPI_ID_SLAVE) ? DMA0_REQUEST_SPIS_RX : DMA0_REQUEST_SPIM_RX; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + if (rx_dma_params.p_instance == DMA1) + { + if (p_params->id == APP_SPI_ID_SLAVE) + { + return APP_DRV_ERR_INVALID_PARAM; + } + rx_dma_params.init.dst_request = DMA1_REQUEST_MEM; + rx_dma_params.init.src_request = DMA1_REQUEST_SPIM_RX; + } +#endif + rx_dma_params.init.direction = DMA_PERIPH_TO_MEMORY; + rx_dma_params.init.src_increment = DMA_SRC_NO_CHANGE; + rx_dma_params.init.dst_increment = DMA_DST_INCREMENT; + if (p_params->init.data_size <= SPI_DATASIZE_8BIT) + { + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; + } + else if (p_params->init.data_size <= SPI_DATASIZE_16BIT) + { + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_HALFWORD; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_HALFWORD; + } + else + { + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_WORD; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_WORD; + } +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + rx_dma_params.init.mode = DMA_NORMAL; +#endif + rx_dma_params.init.priority = DMA_PRIORITY_LOW; + + p_spi_env[p_params->id]->dma_id[1] = app_dma_init(&rx_dma_params, NULL); + + if (p_spi_env[p_params->id]->dma_id[1] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + p_spi_env[p_params->id]->handle.p_dmarx = app_dma_get_handle(p_spi_env[p_params->id]->dma_id[1]); + p_spi_env[p_params->id]->handle.p_dmarx->p_parent = (void*)&p_spi_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_spi_config_dma(app_spi_params_t *p_params) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + + p_spi_env[p_params->id]->dma_id[0] = -1; + p_spi_env[p_params->id]->dma_id[1] = -1; + + if (p_params->dma_cfg.tx_dma_instance == NULL && + p_params->dma_cfg.rx_dma_instance == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_params->dma_cfg.tx_dma_instance != NULL) + { + app_err_code = app_spi_config_dma_tx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + if (p_params->dma_cfg.rx_dma_instance != NULL) + { + app_err_code = app_spi_config_dma_rx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + + return APP_DRV_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_spi_dma_init(app_spi_params_t *p_params) +{ + app_spi_id_t id = p_params->id; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + GLOBAL_EXCEPTION_DISABLE(); + err_code = app_spi_config_dma(p_params); + if (err_code != APP_DRV_SUCCESS) + { + goto __exit; + } + p_spi_env[id]->spi_dma_state = APP_SPI_DMA_ACTIVITY; +__exit: + GLOBAL_EXCEPTION_ENABLE(); + + return err_code; +} + +uint16_t app_spi_dma_deinit(app_spi_id_t id) +{ + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_dma_state != APP_SPI_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_spi_env[id]->dma_id[0]); + app_dma_deinit(p_spi_env[id]->dma_id[1]); + + GLOBAL_EXCEPTION_DISABLE(); + p_spi_env[id]->spi_dma_state = APP_SPI_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + if (p_spi_env[id]->spi_state == APP_SPI_INVALID) + { + p_spi_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spim_dma_transmit_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t * p_data, uint16_t data_length) { + hal_status_t err_code = HAL_OK; + + if (id != APP_SPI_ID_MASTER) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_data == NULL) || (data_length == 0)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_dma_with_ia(&p_spi_env[id]->handle, instruction, address, p_data, data_length); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + return APP_DRV_SUCCESS; +} + +uint16_t app_spim_dma_receive_with_ia(app_spi_id_t id, uint8_t instruction, uint32_t address, uint8_t dummy_bytes, uint8_t * p_data, uint16_t data_length) { + uint8_t ia_data[8]; + uint8_t sent_len = 0; + hal_status_t err_code = HAL_OK; + + if (id != APP_SPI_ID_MASTER) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if ((p_data == NULL) || (data_length == 0)) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + memset(&ia_data[0], 0, 8); + + ia_data[0] = instruction; + ia_data[1] = (address >> 16) & 0xff; + ia_data[2] = (address >> 8) & 0xff; + ia_data[3] = (address >> 0) & 0xff; + + if(dummy_bytes > 4) { + return APP_DRV_ERR_INVALID_PARAM; + } + + sent_len = 4 + dummy_bytes; + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_read_eeprom_dma(&p_spi_env[id]->handle, ia_data, p_data, sent_len, data_length); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_dma_receive_async(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_receive_dma(&p_spi_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_spi_dma_receive_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + hal_status_t hal_err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + BLE_INT_DISABLE(); + p_spi_env[id]->rx_done = 0; + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + hal_err_code = hal_spi_receive_dma(&p_spi_env[id]->handle, p_data, size); + if (hal_err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + app_err_code = (uint16_t)hal_err_code; + goto exit; + } + } + else + { + app_err_code = APP_DRV_ERR_BUSY; + goto exit; + } + + while(p_spi_env[id]->rx_done == 0); + +exit: + BLE_INT_RESTORE(); + + return app_err_code; +} + +uint16_t app_spi_dma_transmit_high_speed_sync(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + hal_status_t hal_err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + BLE_INT_DISABLE(); + p_spi_env[id]->tx_done = 0; + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + hal_err_code = hal_spi_transmit_dma(&p_spi_env[id]->handle, p_data, size); + if (hal_err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + app_err_code = (uint16_t)hal_err_code; + + goto exit; + } + } + else + { + app_err_code = APP_DRV_ERR_BUSY; + goto exit; + } + + while(p_spi_env[id]->tx_done == 0); + +exit: + BLE_INT_RESTORE(); + + return app_err_code; +} +#endif + +uint16_t app_spi_dma_transmit_async(app_spi_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_dma(&p_spi_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_dma_transmit_receive_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL ||size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit_receive_dma(&p_spi_env[id]->handle, p_tx_data, p_rx_data, size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_dma_read_eeprom_async(app_spi_id_t id, uint8_t *p_tx_data, uint8_t *p_rx_data, uint32_t tx_size, uint32_t rx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_tx_data == NULL || p_rx_data == NULL || tx_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + SPI_SMART_CS_LOW(id); + err_code = hal_spi_read_eeprom_dma(&p_spi_env[id]->handle, p_tx_data, p_rx_data, tx_size, rx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) +uint16_t app_spi_dma_read_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_rx_data, uint32_t cmd_size, uint32_t rx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd_data == NULL || p_rx_data == NULL || cmd_size == 0 || rx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit(&p_spi_env[id]->handle, p_cmd_data, cmd_size, 1000); + if (err_code != HAL_OK) + { + SPI_SMART_CS_HIGH(id); + p_spi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + err_code = hal_spi_receive_dma(&p_spi_env[id]->handle, p_rx_data, rx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_spi_dma_write_memory_async(app_spi_id_t id, uint8_t *p_cmd_data, uint8_t *p_tx_data, uint32_t cmd_size, uint32_t tx_size) +{ + hal_status_t err_code = HAL_ERROR; + + if (id >= APP_SPI_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_spi_env[id] == NULL) || (p_spi_env[id]->spi_state == APP_SPI_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + if (p_cmd_data == NULL || p_tx_data == NULL || cmd_size == 0 || tx_size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + spi_wake_up(id); +#endif + + if (p_spi_env[id]->start_flag == false) + { + p_spi_env[id]->start_flag = true; + + SPI_SMART_CS_LOW(id); + err_code = hal_spi_transmit(&p_spi_env[id]->handle, p_cmd_data, cmd_size, 1000); + if (err_code != HAL_OK) + { + SPI_SMART_CS_HIGH(id); + p_spi_env[id]->start_flag = false; + return (uint16_t)err_code; + } + + err_code = hal_spi_transmit_dma(&p_spi_env[id]->handle, p_tx_data, tx_size); + if (err_code != HAL_OK) + { + p_spi_env[id]->start_flag = false; + SPI_SMART_CS_HIGH(id); + return (uint16_t)err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} +#endif + +#endif /* HAL_SPI_MODULE_ENABLED */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_tim.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_tim.c new file mode 100644 index 0000000..f204c9c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_tim.c @@ -0,0 +1,426 @@ +/** + **************************************************************************************** + * @file app_tim.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "app_tim.h" +#include "app_drv.h" +#include "string.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" + +#ifdef HAL_TIMER_MODULE_ENABLED + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool tim_prepare_for_sleep(void); +static void tim_wake_up_ind(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const IRQn_Type s_tim_irq[APP_TIM_ID_MAX] = { TIMER0_IRQn, TIMER1_IRQn }; +static const uint32_t s_tim_instance[APP_TIM_ID_MAX] = { TIMER0_BASE, TIMER1_BASE }; + +tim_env_t *p_tim_env[APP_TIM_ID_MAX]; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_tim_pwr_id; + +const static app_sleep_callbacks_t tim_sleep_cb = +{ + .app_prepare_for_sleep = tim_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = tim_wake_up_ind, +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool tim_prepare_for_sleep(void) +{ + return false; +} + +SECTION_RAM_CODE static void tim_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_TIM_ID_MAX; i++) + { + if (p_tim_env[i] == NULL) + { + continue; + } + + if (p_tim_env[i]->tim_state == APP_TIM_ACTIVITY) + { + hal_nvic_clear_pending_irq(s_tim_irq[i]); + hal_nvic_enable_irq(s_tim_irq[i]); + + #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + hal_timer_deinit(&p_tim_env[i]->handle); + hal_timer_init(&p_tim_env[i]->handle); + #else + hal_timer_base_deinit(&p_tim_env[i]->handle); + hal_timer_base_init(&p_tim_env[i]->handle); + #endif + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +static void tim_wake_up(app_tim_id_t id) +{ + if (p_tim_env[id]->tim_state == APP_TIM_SLEEP) + { + hal_nvic_clear_pending_irq(s_tim_irq[id]); + hal_nvic_enable_irq(s_tim_irq[id]); + + hal_timer_base_deinit(&p_tim_env[id]->handle); + hal_timer_base_init(&p_tim_env[id]->handle); + p_tim_env[id]->tim_state = APP_TIM_ACTIVITY; + } +} +#endif + +static void app_tim_event_call(timer_handle_t *p_tim, app_tim_evt_t evt_type) +{ + app_tim_evt_t tim_evt = APP_TIM_EVT_ERROR; + app_tim_id_t id = APP_TIM_ID_0; + + if(p_tim->p_instance == TIMER0) + { + id = APP_TIM_ID_0; + } + else if(p_tim->p_instance == TIMER1) + { + id = APP_TIM_ID_1; + } + + if (evt_type == APP_TIM_EVT_DONE) + { + tim_evt = APP_TIM_EVT_DONE; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + else if(evt_type == APP_TIM_EVT_CHANNEL0) + { + tim_evt = APP_TIM_EVT_CHANNEL0; + } + else if(evt_type == APP_TIM_EVT_CHANNEL1) + { + tim_evt = APP_TIM_EVT_CHANNEL1; + } + else if(evt_type == APP_TIM_EVT_CHANNEL2) + { + tim_evt = APP_TIM_EVT_CHANNEL2; + } + else if(evt_type == APP_TIM_EVT_CHANNEL3) + { + tim_evt = APP_TIM_EVT_CHANNEL3; + } +#endif + + if (p_tim_env[id]->tim_state == APP_TIM_INVALID) + { + tim_evt = APP_TIM_EVT_ERROR; + } + + if (p_tim_env[id]->evt_handler != NULL) + { + p_tim_env[id]->evt_handler(&tim_evt); + } +} + +#define TIMER_HANDLER(index, val) \ +SECTION_RAM_CODE void TIMER##index##_IRQHandler(void)\ +{\ + hal_timer_irq_handler(&p_tim_env[val]->handle);\ +} + +TIMER_HANDLER(0, APP_TIM_ID_0) +TIMER_HANDLER(1, APP_TIM_ID_1) + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_tim_init(app_tim_params_t *p_params, app_tim_evt_handler_t evt_handler) +{ + app_tim_id_t id = p_params->id; + hal_status_t hal_err_code; + + if (NULL == p_params) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + p_tim_env[id] = &p_params->tim_env; + + soc_register_nvic(TIMER0_IRQn, (uint32_t)TIMER0_IRQHandler); + soc_register_nvic(TIMER1_IRQn, (uint32_t)TIMER1_IRQHandler); + hal_nvic_clear_pending_irq(s_tim_irq[id]); + hal_nvic_enable_irq(s_tim_irq[id]); + + p_tim_env[id]->evt_handler = evt_handler; + + memcpy(&p_tim_env[id]->handle.init, &p_params->init, sizeof(timer_init_t)); + p_tim_env[id]->handle.p_instance = (timer_regs_t *)s_tim_instance[id]; +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + hal_err_code = hal_timer_deinit(&p_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + hal_err_code = hal_timer_init(&p_tim_env[id]->handle); +#else + hal_err_code = hal_timer_base_deinit(&p_tim_env[id]->handle); + HAL_ERR_CODE_CHECK(hal_err_code); + hal_err_code = hal_timer_base_init(&p_tim_env[id]->handle); +#endif + HAL_ERR_CODE_CHECK(hal_err_code); + + if(s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_tim_pwr_id = pwr_register_sleep_cb(&tim_sleep_cb, APP_DRIVER_TIM_WAPEUP_PRIORITY); + + if (s_tim_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_tim_env[id]->tim_state = APP_TIM_ACTIVITY; + + return APP_DRV_SUCCESS; +} + +uint16_t app_tim_deinit(app_tim_id_t id) +{ + uint8_t i; + hal_status_t hal_err_code; + + if (id >= APP_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + + hal_nvic_disable_irq(s_tim_irq[id]); + p_tim_env[id]->tim_state = APP_TIM_INVALID; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_TIM_ID_MAX; i++) + { + if (p_tim_env[i] != NULL && (p_tim_env[i]->tim_state) != APP_TIM_INVALID) + { + break; + } + } + if (APP_TIM_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_tim_pwr_id); + s_tim_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + hal_err_code = hal_timer_deinit(&p_tim_env[id]->handle); +#else + hal_err_code = hal_timer_base_deinit(&p_tim_env[id]->handle); +#endif + HAL_ERR_CODE_CHECK(hal_err_code); + p_tim_env[id] = NULL; + + return APP_DRV_SUCCESS; +} + +uint16_t app_tim_start(app_tim_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + tim_wake_up(id); +#endif + + #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + err_code = hal_timer_start_it(&p_tim_env[id]->handle); + #else + err_code = hal_timer_base_start_it(&p_tim_env[id]->handle); + #endif + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_tim_stop(app_tim_id_t id) +{ + hal_status_t err_code; + + if (id >= APP_TIM_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + tim_wake_up(id); +#endif + + #if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) + err_code = hal_timer_stop_it(&p_tim_env[id]->handle); + #else + err_code = hal_timer_base_stop_it(&p_tim_env[id]->handle); + #endif + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +timer_handle_t *app_tim_get_handle(app_tim_id_t id) +{ + if (id >= APP_TIM_ID_MAX) + { + return NULL; + } + + if ((p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + tim_wake_up(id); +#endif + + return &p_tim_env[id]->handle; +} + +void hal_timer_period_elapsed_callback(timer_handle_t *p_timer) +{ + app_tim_event_call(p_timer, APP_TIM_EVT_DONE); +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5332X) +void hal_timer_channel0_event_callback(timer_handle_t *p_timer) +{ + app_tim_event_call(p_timer, APP_TIM_EVT_CHANNEL0); +} + +void hal_timer_channel1_event_callback(timer_handle_t *p_timer) +{ + app_tim_event_call(p_timer, APP_TIM_EVT_CHANNEL1); +} + +void hal_timer_channel2_event_callback(timer_handle_t *p_timer) +{ + app_tim_event_call(p_timer, APP_TIM_EVT_CHANNEL2); +} + +void hal_timer_channel3_event_callback(timer_handle_t *p_timer) +{ + app_tim_event_call(p_timer, APP_TIM_EVT_CHANNEL3); +} + +uint32_t app_tim_get_channel0_val(app_tim_id_t id) +{ + if ((id >= APP_TIM_ID_MAX) || (p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return 0; + } + + return hal_timer_get_channel0_val(&p_tim_env[id]->handle); +} + +uint32_t app_tim_get_channel1_val(app_tim_id_t id) +{ + if ((id >= APP_TIM_ID_MAX) || (p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return 0; + } + + return hal_timer_get_channel1_val(&p_tim_env[id]->handle); +} + +uint32_t app_tim_get_channel2_val(app_tim_id_t id) +{ + if ((id >= APP_TIM_ID_MAX) || (p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return 0; + } + + return hal_timer_get_channel2_val(&p_tim_env[id]->handle); +} + +uint32_t app_tim_get_channel3_val(app_tim_id_t id) +{ + if ((id >= APP_TIM_ID_MAX) || (p_tim_env[id] == NULL) || (p_tim_env[id]->tim_state == APP_TIM_INVALID)) + { + return 0; + } + + return hal_timer_get_channel3_val(&p_tim_env[id]->handle); +} +#endif + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart.c new file mode 100644 index 0000000..dfa3c22 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart.c @@ -0,0 +1,869 @@ +/** + **************************************************************************************** + * @file app_uart.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "app_uart.h" +#include "app_uart_dma.h" +#include "app_drv.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" +#include "gr_soc.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define APP_UART_CALLBACK(id, evt) \ + do \ + { \ + if (p_uart_env[id]->evt_handler != NULL) \ + { \ + p_uart_env[id]->evt_handler(&evt); \ + } \ + } while(0) + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +typedef struct { + app_uart_id_t id; + IRQn_Type irq; + uart_regs_t *instance; +} uart_info_t; + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ +static bool uart_prepare_for_sleep(void); +static void uart_wake_up_ind(void); +void UART0_IRQHandler(void); +void UART1_IRQHandler(void); +void UART2_IRQHandler(void); +void UART3_IRQHandler(void); +void UART4_IRQHandler(void); +void UART5_IRQHandler(void); + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const uart_info_t s_uart_info[APP_UART_ID_MAX] = { + { + .id = APP_UART_ID_0, + .irq = UART0_IRQn, + .instance = UART0, + }, + { + .id = APP_UART_ID_1, + .irq = UART1_IRQn, + .instance = UART1, + }, +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) | (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) + { + .id = APP_UART_ID_2, + .irq = UART2_IRQn, + .instance = UART2, + }, + { + .id = APP_UART_ID_3, + .irq = UART3_IRQn, + .instance = UART3, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + { + .id = APP_UART_ID_4, + .irq = UART4_IRQn, + .instance = UART4, + }, + { + .id = APP_UART_ID_5, + .irq = UART5_IRQn, + .instance = UART5, + }, +#endif +}; + +uart_env_t *p_uart_env[APP_UART_ID_MAX]; +static bool s_sleep_cb_registered_flag = false; +static pwr_id_t s_uart_pwr_id; +static const app_sleep_callbacks_t uart_sleep_cb = +{ + .app_prepare_for_sleep = uart_prepare_for_sleep, + .app_sleep_canceled = NULL, + .app_wake_up_ind = uart_wake_up_ind, +}; + +/* + * LOCAL FUNCTION DEFINITIONS + ***************************************************************************************** + */ +static bool uart_prepare_for_sleep(void) +{ + hal_uart_state_t state; + + for (uint8_t i = 0; i < APP_UART_ID_MAX; i++) + { + if (p_uart_env[i] == NULL) + { + continue; + } + + if (p_uart_env[i]->uart_state == APP_UART_ACTIVITY) + { + state = hal_uart_get_state(&p_uart_env[i]->handle); + if ((state != HAL_UART_STATE_RESET) && (state != HAL_UART_STATE_READY)) + { + return false; + } + + GLOBAL_EXCEPTION_DISABLE(); + hal_uart_suspend_reg(&p_uart_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + p_uart_env[i]->uart_state = APP_UART_SLEEP; +#endif + } + } + return true; +} + +SECTION_RAM_CODE static void uart_wake_up_ind(void) +{ +#ifndef APP_DRIVER_WAKEUP_CALL_FUN + uint8_t i; + + for (i = 0; i < APP_UART_ID_MAX; i++) + { + if (p_uart_env[i] == NULL) + { + continue; + } + + if (p_uart_env[i]->uart_state == APP_UART_ACTIVITY) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_uart_resume_reg(&p_uart_env[i]->handle); + GLOBAL_EXCEPTION_ENABLE(); + hal_nvic_clear_pending_irq(s_uart_info[i].irq); + hal_nvic_enable_irq(s_uart_info[i].irq); + } + } +#endif +} + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +void uart_wake_up(app_uart_id_t id) +{ + if (p_uart_env[id]->uart_state == APP_UART_SLEEP) + { + GLOBAL_EXCEPTION_DISABLE(); + hal_uart_resume_reg(&p_uart_env[id]->handle); + GLOBAL_EXCEPTION_ENABLE(); + + hal_nvic_clear_pending_irq(s_uart_info[id].irq); + hal_nvic_enable_irq(s_uart_info[id].irq); + + p_uart_env[id]->uart_state = APP_UART_ACTIVITY; + } + + dma_wake_up(p_uart_env[id]->dma_id[0]); + dma_wake_up(p_uart_env[id]->dma_id[1]); +} +#endif + +__WEAK uint16_t app_uart_dma_start_transmit_async(app_uart_id_t id) +{ + return 0; +}; + +static app_uart_id_t uart_get_id(uart_handle_t *p_uart) +{ + int i = 0; + + for (i = 0; i < APP_UART_ID_MAX; i++) + { + if (p_uart->p_instance == s_uart_info[i].instance) + { + return s_uart_info[i].id; + } + } + + return APP_UART_ID_MAX; +} + +static uint16_t uart_gpio_config(uint32_t hw_flow_ctrl, app_uart_pin_cfg_t pin_cfg) +{ + app_io_init_t io_init = APP_IO_DEFAULT_CONFIG; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + io_init.pull = pin_cfg.tx.pull; + io_init.mode = APP_IO_MODE_MUX; + io_init.pin = pin_cfg.tx.pin; + io_init.mux = pin_cfg.tx.mux; + err_code = app_io_init(pin_cfg.tx.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.rx.pull; + io_init.pin = pin_cfg.rx.pin; + io_init.mux = pin_cfg.rx.mux; + err_code = app_io_init(pin_cfg.rx.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + if (UART_HWCONTROL_RTS_CTS == hw_flow_ctrl) + { + io_init.pull = pin_cfg.cts.pull; + io_init.pin = pin_cfg.cts.pin; + io_init.mux = pin_cfg.cts.mux; + err_code = app_io_init(pin_cfg.cts.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + + io_init.pull = pin_cfg.rts.pull; + io_init.pin = pin_cfg.rts.pin; + io_init.mux = pin_cfg.rts.mux; + err_code = app_io_init(pin_cfg.rts.type, &io_init); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + return err_code; +} + +static uint16_t app_uart_start_transmit_async(app_uart_id_t id) +{ + uint16_t items_count = ring_buffer_items_count_get(&p_uart_env[id]->tx_ring_buffer); + uint16_t send_size = items_count; + hal_status_t err_code; + + if ((items_count == 0) || (p_uart_env[id]->start_flush_flag == true)) + { + p_uart_env[id]->start_tx_flag = false; + return APP_DRV_SUCCESS; + } + + if (items_count >= TX_ONCE_MAX_SIZE) + { + ring_buffer_read(&p_uart_env[id]->tx_ring_buffer, p_uart_env[id]->tx_send_buf, TX_ONCE_MAX_SIZE); + send_size = TX_ONCE_MAX_SIZE; + } + else + { + ring_buffer_read(&p_uart_env[id]->tx_ring_buffer, p_uart_env[id]->tx_send_buf, items_count); + } + + p_uart_env[id]->is_dma_tx_mode = false; + err_code = hal_uart_transmit_it(&p_uart_env[id]->handle, p_uart_env[id]->tx_send_buf, send_size); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +/* + * GLOBAL FUNCTION DEFINITIONS + **************************************************************************************** + */ +uint16_t app_uart_init(app_uart_params_t *p_params, app_uart_evt_handler_t evt_handler, app_uart_tx_buf_t *tx_buffer) +{ + app_uart_id_t id = p_params->id; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if ((p_params == NULL) || (tx_buffer == NULL)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + p_uart_env[id] = &(p_params->uart_dev); + ring_buffer_init(&p_uart_env[id]->tx_ring_buffer, tx_buffer->tx_buf, tx_buffer->tx_buf_size); + + err_code = uart_gpio_config(p_params->init.hw_flow_ctrl, p_params->pin_cfg); + APP_DRV_ERR_CODE_CHECK(err_code); + + soc_register_nvic(UART0_IRQn, (uint32_t)UART0_IRQHandler); + soc_register_nvic(UART1_IRQn, (uint32_t)UART1_IRQHandler); +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + soc_register_nvic(UART2_IRQn, (uint32_t)UART2_IRQHandler); + soc_register_nvic(UART3_IRQn, (uint32_t)UART3_IRQHandler); +#endif + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + soc_register_nvic(UART4_IRQn, (uint32_t)UART4_IRQHandler); + soc_register_nvic(UART5_IRQn, (uint32_t)UART5_IRQHandler); +#endif + hal_nvic_clear_pending_irq(s_uart_info[id].irq); + hal_nvic_enable_irq(s_uart_info[id].irq); + + p_uart_env[id]->p_pin_cfg = &p_params->pin_cfg; + p_uart_env[id]->evt_handler = evt_handler; + + memcpy(&p_uart_env[id]->handle.init, &p_params->init, sizeof(uart_init_t)); + p_uart_env[id]->handle.p_instance = s_uart_info[id].instance; + + hal_uart_deinit(&p_uart_env[id]->handle); + hal_uart_init(&p_uart_env[id]->handle); + + if (s_sleep_cb_registered_flag == false)// register sleep callback + { + s_sleep_cb_registered_flag = true; + s_uart_pwr_id = pwr_register_sleep_cb(&uart_sleep_cb, APP_DRIVER_UART_WAPEUP_PRIORITY); + + if (s_uart_pwr_id < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + } + + p_uart_env[id]->uart_state = APP_UART_ACTIVITY; + p_uart_env[id]->start_tx_flag = false; + p_uart_env[id]->start_flush_flag = false; + p_uart_env[id]->tx_abort_flag = false; + p_uart_env[id]->rx_abort_flag = false; + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_deinit(app_uart_id_t id) +{ + uint8_t i; + app_drv_err_t err_code = APP_DRV_SUCCESS; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + err_code = app_io_deinit(p_uart_env[id]->p_pin_cfg->tx.type, p_uart_env[id]->p_pin_cfg->tx.pin); + APP_DRV_ERR_CODE_CHECK(err_code); + + err_code = app_io_deinit(p_uart_env[id]->p_pin_cfg->rx.type, p_uart_env[id]->p_pin_cfg->rx.pin); + APP_DRV_ERR_CODE_CHECK(err_code); + + if (UART_HWCONTROL_RTS_CTS == p_uart_env[id]->handle.init.hw_flow_ctrl) + { + err_code = app_io_deinit(p_uart_env[id]->p_pin_cfg->rts.type, p_uart_env[id]->p_pin_cfg->rts.pin); + APP_DRV_ERR_CODE_CHECK(err_code); + + err_code = app_io_deinit(p_uart_env[id]->p_pin_cfg->cts.type, p_uart_env[id]->p_pin_cfg->cts.pin); + APP_DRV_ERR_CODE_CHECK(err_code); + } + + hal_nvic_disable_irq(s_uart_info[id].irq); + + p_uart_env[id]->uart_state = APP_UART_INVALID; + p_uart_env[id]->start_tx_flag = false; + p_uart_env[id]->start_flush_flag = false; + p_uart_env[id]->tx_abort_flag = false; + p_uart_env[id]->rx_abort_flag = false; + + GLOBAL_EXCEPTION_DISABLE(); + for (i = 0; i < APP_UART_ID_MAX; i++) + { + if (p_uart_env[i] != NULL && (p_uart_env[i]->uart_state) != APP_UART_INVALID) + { + break; + } + } + if (APP_UART_ID_MAX == i) + { + pwr_unregister_sleep_cb(s_uart_pwr_id); + s_uart_pwr_id = -1; + s_sleep_cb_registered_flag = false; + } + GLOBAL_EXCEPTION_ENABLE(); + + hal_uart_deinit(&p_uart_env[id]->handle); + if (p_uart_env[id]->uart_dma_state == APP_UART_DMA_INVALID) + { + p_uart_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_receive_async(app_uart_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 ) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + if (p_uart_env[id]->rx_abort_flag == true) + { + p_uart_env[id]->rx_abort_flag = false; + /* Clear rx_fifo */ + ll_uart_flush_rx_fifo(p_uart_env[id]->handle.p_instance); + /* Clear TIMEOUT interrupt flag bit */ + ll_uart_receive_data8(p_uart_env[id]->handle.p_instance); + } + + err_code = hal_uart_receive_it(&p_uart_env[id]->handle, p_data, size); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_receive_sync(app_uart_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 ) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + if (p_uart_env[id]->rx_abort_flag == true) + { + p_uart_env[id]->rx_abort_flag = false; + /* Clear rx_fifo */ + ll_uart_flush_rx_fifo(p_uart_env[id]->handle.p_instance); + /* Clear TIMEOUT interrupt flag bit */ + ll_uart_receive_data8(p_uart_env[id]->handle.p_instance); + } + err_code = hal_uart_receive(&p_uart_env[id]->handle, p_data, size, timeout); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_transmit_async(app_uart_id_t id, uint8_t *p_data, uint16_t size) +{ + uint16_t err_code; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 ) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + p_uart_env[id]->tx_abort_flag = false; + ring_buffer_write(&p_uart_env[id]->tx_ring_buffer, p_data, size); + + if ((p_uart_env[id]->start_tx_flag == false) && (p_uart_env[id]->start_flush_flag == false) && + (p_uart_env[id]->uart_state == APP_UART_ACTIVITY)) + { + p_uart_env[id]->start_tx_flag = true; + + err_code = app_uart_start_transmit_async(id); + if (err_code != APP_DRV_SUCCESS) + { + p_uart_env[id]->start_tx_flag = false; + return err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_transmit_sync(app_uart_id_t id, uint8_t *p_data, uint16_t size, uint32_t timeout) +{ + hal_status_t err_code; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 ) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + p_uart_env[id]->tx_abort_flag = false; + err_code = hal_uart_transmit(&p_uart_env[id]->handle, p_data, size, timeout); + if (err_code != HAL_OK) + { + return err_code; + } + + return APP_DRV_SUCCESS; +} + +uart_handle_t *app_uart_get_handle(app_uart_id_t id) +{ + if (id >= APP_UART_ID_MAX) + { + return NULL; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + return &p_uart_env[id]->handle; +} + +void app_uart_flush(app_uart_id_t id) +{ + uint16_t items_count; + uart_handle_t *p_uart = &p_uart_env[id]->handle; + + if (APP_UART_ID_MAX <= id || p_uart_env[id]->uart_state == APP_UART_INVALID) + { + return; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + if (p_uart_env[id]->uart_state == APP_UART_ACTIVITY) + { + p_uart_env[id]->start_flush_flag = true; + + uint16_t tx_xfer_size = 0; + uint16_t tx_xfer_count = 0; + uint32_t tx_wait_count = 0; + uint32_t data_width = 1 + p_uart_env[id]->handle.init.data_bits + 5 + + p_uart_env[id]->handle.init.stop_bits + 1 + + (p_uart_env[id]->handle.init.parity & 1); + + while(!ll_uart_is_active_flag_tfe(p_uart_env[id]->handle.p_instance)); + + if (p_uart_env[id]->is_dma_tx_mode == false) + { + tx_xfer_size = p_uart_env[id]->handle.tx_xfer_size; + tx_xfer_count = p_uart_env[id]->handle.tx_xfer_count; + hal_uart_abort_transmit_it(&p_uart_env[id]->handle); + hal_uart_transmit(&p_uart_env[id]->handle, + p_uart_env[id]->tx_send_buf + tx_xfer_size - tx_xfer_count, + tx_xfer_count, + 5000); + } + else + { + do + { + tx_wait_count++; + } + while ((HAL_UART_STATE_READY != p_uart_env[id]->handle.tx_state) && + (tx_wait_count <= data_width * TX_ONCE_MAX_SIZE * (SystemCoreClock/p_uart_env[id]->handle.init.baud_rate))); + } + + do{ + items_count = ring_buffer_items_count_get(&p_uart_env[id]->tx_ring_buffer); + while(items_count) + { + uint8_t send_char; + + ring_buffer_read(&p_uart_env[id]->tx_ring_buffer, &send_char, 1); + + while(!ll_uart_is_active_flag_tfnf(p_uart_env[id]->handle.p_instance)); + + ll_uart_transmit_data8(p_uart_env[id]->handle.p_instance, send_char); + + items_count--; + } + } while(ring_buffer_items_count_get(&p_uart_env[id]->tx_ring_buffer)); + + while((HAL_IS_BIT_SET(p_uart->p_instance->LSR, LL_UART_LSR_TEMT) ? SET : RESET) == RESET); + + GLOBAL_EXCEPTION_DISABLE(); + if(ring_buffer_items_count_get(&p_uart_env[id]->tx_ring_buffer)) + { + /* Enable the UART Transmit Data Register Empty Interrupt */ + __HAL_UART_ENABLE_IT(p_uart, UART_IT_THRE); + } + + p_uart_env[id]->start_flush_flag = false; + GLOBAL_EXCEPTION_ENABLE(); + } +} + +uint16_t app_uart_abort(app_uart_id_t id) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + ring_buffer_clean(&p_uart_env[id]->tx_ring_buffer); + + err_code = hal_uart_abort_it(&p_uart_env[id]->handle); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + p_uart_env[id]->tx_abort_flag = true; + p_uart_env[id]->rx_abort_flag = true; + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_abort_transmit(app_uart_id_t id) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + ring_buffer_clean(&p_uart_env[id]->tx_ring_buffer); + + err_code = hal_uart_abort_transmit_it(&p_uart_env[id]->handle); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + p_uart_env[id]->tx_abort_flag = true; + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_abort_receive(app_uart_id_t id) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + err_code = hal_uart_abort_receive_it(&p_uart_env[id]->handle); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + p_uart_env[id]->rx_abort_flag = true; + + return APP_DRV_SUCCESS; +} + +void hal_uart_tx_cplt_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_TX_CPLT; + uart_evt.data.size = p_uart->tx_xfer_size - p_uart->tx_xfer_count; + + if (p_uart_env[id]->is_dma_tx_mode) + { + app_uart_dma_start_transmit_async(id); + } + else + { + app_uart_start_transmit_async(id); + } + + if (p_uart_env[id]->start_tx_flag == false) + { + APP_UART_CALLBACK(id, uart_evt); + } +} + +void hal_uart_rx_cplt_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_RX_DATA; + uart_evt.data.size = p_uart->rx_xfer_size - p_uart->rx_xfer_count; + APP_UART_CALLBACK(id, uart_evt); +} + +void hal_uart_error_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_ERROR; + uart_evt.data.error_code = p_uart->error_code; + p_uart_env[id]->start_tx_flag = false; + APP_UART_CALLBACK(id, uart_evt); +} + +void hal_uart_abort_cplt_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_ABORT_TXRX; + p_uart_env[id]->start_tx_flag = false; + APP_UART_CALLBACK(id, uart_evt); +} + +void hal_uart_abort_tx_cplt_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_ABORT_TX; + p_uart_env[id]->start_tx_flag = false; + APP_UART_CALLBACK(id, uart_evt); +} + +void hal_uart_abort_rx_cplt_callback(uart_handle_t *p_uart) +{ + app_uart_evt_t uart_evt; + app_uart_id_t id = uart_get_id(p_uart); + + uart_evt.type = APP_UART_EVT_ABORT_RX; + p_uart_env[id]->start_tx_flag = false; + APP_UART_CALLBACK(id, uart_evt); +} + +#define UART_HANDLER(index, val) \ +void UART##index##_IRQHandler(void)\ +{\ + hal_uart_irq_handler(&p_uart_env[val]->handle);\ +} + +UART_HANDLER(0, APP_UART_ID_0) +UART_HANDLER(1, APP_UART_ID_1) +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) | (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) +UART_HANDLER(2, APP_UART_ID_2) +UART_HANDLER(3, APP_UART_ID_3) +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) +UART_HANDLER(4, APP_UART_ID_4) +UART_HANDLER(5, APP_UART_ID_5) +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart_dma.c b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart_dma.c new file mode 100644 index 0000000..d90e34c --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/drivers/src/app_uart_dma.c @@ -0,0 +1,564 @@ +/** + **************************************************************************************** + * @file app_uart_dma.c + * @author BLE Driver Team + * @brief HAL APP module driver. + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + **************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include +#include "app_uart.h" +#include "app_uart_dma.h" +#include "app_dma.h" +#include "app_pwr_mgmt.h" + +/* + * DEFINES + ***************************************************************************************** + */ +#define DMA_REQUEST_NULL (0x00) + +/* + * STRUCT DEFINE + ***************************************************************************************** + */ +struct dma_request { + uint32_t tx; + uint32_t rx; +}; + +typedef struct { + struct dma_request dma0_request; + struct dma_request dma1_request; +} uart_dma_info_t; + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static const uart_dma_info_t s_dma_info[APP_UART_ID_MAX] = { + { /* UART0 */ + .dma0_request = { + .tx = DMA0_REQUEST_UART0_TX, + .rx = DMA0_REQUEST_UART0_RX, + }, +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + .dma1_request = { + .tx = DMA1_REQUEST_UART0_TX, + .rx = DMA1_REQUEST_UART0_RX, + }, +#endif + }, + { /* UART1 */ +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR551X) + .dma0_request = { + .tx = DMA0_REQUEST_UART1_TX, + .rx = DMA0_REQUEST_UART1_RX, + }, +#else + .dma0_request = { + .tx = 0, + .rx = 0, + }, +#endif + }, +#if ((APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X)) + { /* UART2 */ + .dma0_request = { + .tx = DMA0_REQUEST_UART2_TX, + .rx = DMA0_REQUEST_UART2_RX, + }, + }, + { /* UART3 */ + .dma0_request = { + .tx = DMA0_REQUEST_UART3_TX, + .rx = DMA0_REQUEST_UART3_RX, + }, + .dma1_request = { + .tx = DMA1_REQUEST_UART3_TX, + .rx = DMA1_REQUEST_UART3_RX, + }, + }, +#endif +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) + { /* UART4 */ + .dma0_request = { + .tx = DMA0_REQUEST_UART4_TX, + .rx = DMA0_REQUEST_UART4_RX, + }, + .dma1_request = { + .tx = DMA1_REQUEST_UART4_TX, + .rx = DMA1_REQUEST_UART4_RX, + }, + }, + { /* UART5 */ + .dma1_request = { + .tx = DMA1_REQUEST_UART5_TX, + .rx = DMA1_REQUEST_UART5_RX, + }, + }, +#endif +}; + +extern uart_env_t *p_uart_env[APP_UART_ID_MAX]; +#ifdef APP_DRIVER_WAKEUP_CALL_FUN +extern void uart_wake_up(app_uart_id_t id); +#endif + +/* + * LOCAL FUNCTION DECLARATION + ***************************************************************************************** + */ + +static uint16_t app_uart_config_dma_tx(app_uart_params_t *p_params) +{ + app_dma_params_t tx_dma_params = { 0 }; + + tx_dma_params.p_instance = p_params->dma_cfg.tx_dma_instance; + tx_dma_params.channel_number = p_params->dma_cfg.tx_dma_channel; + if (tx_dma_params.p_instance == DMA0) + { + tx_dma_params.init.src_request = DMA0_REQUEST_MEM; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (tx_dma_params.p_instance == DMA1) + { + tx_dma_params.init.src_request = DMA1_REQUEST_MEM; + } +#endif + + if (tx_dma_params.p_instance == DMA0) + { + tx_dma_params.init.dst_request = s_dma_info[p_params->id].dma0_request.tx; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (tx_dma_params.p_instance == DMA1) + { + tx_dma_params.init.dst_request = s_dma_info[p_params->id].dma1_request.tx; + } +#endif + + if (tx_dma_params.init.dst_request == DMA_REQUEST_NULL) + { + return APP_DRV_ERR_INVALID_MODE; + } + + tx_dma_params.init.direction = DMA_MEMORY_TO_PERIPH; + tx_dma_params.init.src_increment = DMA_SRC_INCREMENT; + tx_dma_params.init.dst_increment = DMA_DST_NO_CHANGE; + tx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + tx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + tx_dma_params.init.mode = DMA_NORMAL; +#endif + tx_dma_params.init.priority = DMA_PRIORITY_LOW; + p_uart_env[p_params->id]->dma_id[0] = app_dma_init(&tx_dma_params, NULL); + + if (p_uart_env[p_params->id]->dma_id[0] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + /* Associate the initialized DMA handle to the UART handle */ + p_uart_env[p_params->id]->handle.p_dmatx = app_dma_get_handle(p_uart_env[p_params->id]->dma_id[0]); + p_uart_env[p_params->id]->handle.p_dmatx->p_parent = (void*)&p_uart_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_uart_config_dma_rx(app_uart_params_t *p_params) +{ + app_dma_params_t rx_dma_params = { 0 }; + + rx_dma_params.p_instance = p_params->dma_cfg.rx_dma_instance; + rx_dma_params.channel_number = p_params->dma_cfg.rx_dma_channel; + if (rx_dma_params.p_instance == DMA0) + { + rx_dma_params.init.src_request = s_dma_info[p_params->id].dma0_request.rx; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (rx_dma_params.p_instance == DMA1) + { + rx_dma_params.init.src_request = s_dma_info[p_params->id].dma1_request.rx; + } +#endif + + if (rx_dma_params.init.src_request == DMA_REQUEST_NULL) + { + return APP_DRV_ERR_INVALID_MODE; + } + + if (rx_dma_params.p_instance == DMA0) + { + rx_dma_params.init.dst_request = DMA0_REQUEST_MEM; + } +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) + else if (rx_dma_params.p_instance == DMA1) + { + rx_dma_params.init.dst_request = DMA1_REQUEST_MEM; + } +#endif + + rx_dma_params.init.direction = DMA_PERIPH_TO_MEMORY; + rx_dma_params.init.src_increment = DMA_SRC_NO_CHANGE; + rx_dma_params.init.dst_increment = DMA_DST_INCREMENT; + rx_dma_params.init.src_data_alignment = DMA_SDATAALIGN_BYTE; + rx_dma_params.init.dst_data_alignment = DMA_DDATAALIGN_BYTE; +#if (APP_DRIVER_CHIP_TYPE != APP_DRIVER_GR5332X) + rx_dma_params.init.mode = DMA_NORMAL; +#endif + rx_dma_params.init.priority = DMA_PRIORITY_HIGH; + p_uart_env[p_params->id]->dma_id[1] = app_dma_init(&rx_dma_params, NULL); + + if (p_uart_env[p_params->id]->dma_id[1] < 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + /* Associate the initialized DMA handle to the the UART handle */ + p_uart_env[p_params->id]->handle.p_dmarx = app_dma_get_handle(p_uart_env[p_params->id]->dma_id[1]); + p_uart_env[p_params->id]->handle.p_dmarx->p_parent = (void*)&p_uart_env[p_params->id]->handle; + + return APP_DRV_SUCCESS; +} + +static uint16_t app_uart_config_dma(app_uart_params_t *p_params) +{ + app_drv_err_t app_err_code = APP_DRV_SUCCESS; + + p_uart_env[p_params->id]->dma_id[0] = -1; + p_uart_env[p_params->id]->dma_id[1] = -1; + + if (p_params->dma_cfg.tx_dma_instance == NULL && + p_params->dma_cfg.rx_dma_instance == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + + if (p_params->dma_cfg.tx_dma_instance != NULL) + { + app_err_code = app_uart_config_dma_tx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + if (p_params->dma_cfg.rx_dma_instance != NULL) + { + app_err_code = app_uart_config_dma_rx(p_params); + if (app_err_code != APP_DRV_SUCCESS) + { + return app_err_code; + } + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_dma_init(app_uart_params_t *p_params) +{ + app_uart_id_t id = p_params->id; + app_drv_err_t err_code; + + if (p_params == NULL) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_NOT_INIT; + } + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR551X) + if (id == APP_UART_ID_1) + { + return APP_DRV_ERR_INVALID_ID; + } +#endif + + if (p_uart_env[id]->uart_dma_state == APP_UART_DMA_ACTIVITY) + { + app_uart_dma_deinit(id); + } + + GLOBAL_EXCEPTION_DISABLE(); + err_code = app_uart_config_dma(p_params); + if (err_code != APP_DRV_SUCCESS) + { + goto __exit; + } + p_uart_env[id]->uart_dma_state = APP_UART_DMA_ACTIVITY; + +__exit: + GLOBAL_EXCEPTION_ENABLE(); + + return err_code; +} + +uint16_t app_uart_dma_deinit(app_uart_id_t id) +{ + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || + (p_uart_env[id]->uart_dma_state != APP_UART_DMA_ACTIVITY)) + { + return APP_DRV_ERR_NOT_INIT; + } + + app_dma_deinit(p_uart_env[id]->dma_id[0]); + app_dma_deinit(p_uart_env[id]->dma_id[1]); + + GLOBAL_EXCEPTION_DISABLE(); + p_uart_env[id]->uart_dma_state = APP_UART_DMA_INVALID; + GLOBAL_EXCEPTION_ENABLE(); + + if (p_uart_env[id]->uart_state == APP_UART_INVALID) + { + p_uart_env[id] = NULL; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_dma_receive_async(app_uart_id_t id, uint8_t *p_data, uint16_t size) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + if (p_uart_env[id]->rx_abort_flag == true) + { + p_uart_env[id]->rx_abort_flag = false; + /* Clear rx_fifo */ + ll_uart_flush_rx_fifo(p_uart_env[id]->handle.p_instance); + /* Clear TIMEOUT interrupt flag bit */ + ll_uart_receive_data8(p_uart_env[id]->handle.p_instance); + } + + err_code = hal_uart_receive_dma(&p_uart_env[id]->handle, p_data, size); + APP_DRV_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_dma_start_transmit_async(app_uart_id_t id) +{ + uint16_t items_count = ring_buffer_items_count_get(&p_uart_env[id]->tx_ring_buffer); + uint16_t send_size = items_count; + hal_status_t err_code; + + if ((items_count == 0) || (p_uart_env[id]->start_flush_flag == true)) + { + p_uart_env[id]->start_tx_flag = false; + return APP_DRV_SUCCESS; + } + + p_uart_env[id]->is_dma_tx_mode = true; + if (items_count >= TX_ONCE_MAX_SIZE) + { + ring_buffer_read(&p_uart_env[id]->tx_ring_buffer, p_uart_env[id]->tx_send_buf, TX_ONCE_MAX_SIZE); + send_size = TX_ONCE_MAX_SIZE; + } + else + { + ring_buffer_read(&p_uart_env[id]->tx_ring_buffer, p_uart_env[id]->tx_send_buf, items_count); + } + + err_code = hal_uart_transmit_dma(&p_uart_env[id]->handle, p_uart_env[id]->tx_send_buf, send_size); + HAL_ERR_CODE_CHECK(err_code); + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_dma_transmit_async(app_uart_id_t id, uint8_t *p_data, uint16_t size) +{ + uint16_t err_code; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + p_uart_env[id]->tx_abort_flag = false; + ring_buffer_write(&p_uart_env[id]->tx_ring_buffer, p_data, size); + + if ((p_uart_env[id]->start_tx_flag == false) && (p_uart_env[id]->start_flush_flag == false) && + (p_uart_env[id]->uart_state == APP_UART_ACTIVITY)) + { + p_uart_env[id]->start_tx_flag = true; + + err_code = app_uart_dma_start_transmit_async(id); + if (err_code != APP_DRV_SUCCESS) + { + p_uart_env[id]->start_tx_flag = false; + return err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +#if (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5526X) || (APP_DRIVER_CHIP_TYPE == APP_DRIVER_GR5525X) +uint16_t app_uart_transmit_dma_sg_llp(app_uart_id_t id, uint8_t *p_data, uint16_t size, dma_sg_llp_config_t *sg_llp_config) +{ + uint16_t err_code; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 || sg_llp_config == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + p_uart_env[id]->tx_abort_flag = false; + app_uart_flush(id); + + if ((p_uart_env[id]->start_tx_flag == false) && (p_uart_env[id]->start_flush_flag == false) && + (p_uart_env[id]->uart_state == APP_UART_ACTIVITY)) + { + p_uart_env[id]->start_tx_flag = true; + + err_code = hal_uart_transmit_dma_sg_llp(&p_uart_env[id]->handle, p_data, size, sg_llp_config); + if (err_code != APP_DRV_SUCCESS) + { + return err_code; + } + } + else + { + return APP_DRV_ERR_BUSY; + } + + return APP_DRV_SUCCESS; +} + +uint16_t app_uart_receive_dma_sg_llp(app_uart_id_t id, uint8_t *p_data, uint16_t size, dma_sg_llp_config_t *sg_llp_config) +{ + hal_status_t err_code = HAL_OK; + + if (id >= APP_UART_ID_MAX) + { + return APP_DRV_ERR_INVALID_ID; + } + + if ((p_uart_env[id] == NULL) || (p_uart_env[id]->uart_state == APP_UART_INVALID)) + { + return APP_DRV_ERR_POINTER_NULL; + } + + if (p_data == NULL || size == 0 || sg_llp_config == NULL) + { + return APP_DRV_ERR_INVALID_PARAM; + } + +#ifdef APP_DRIVER_WAKEUP_CALL_FUN + uart_wake_up(id); +#endif + + if (p_uart_env[id]->rx_abort_flag == true) + { + p_uart_env[id]->rx_abort_flag = false; + /* Clear rx_fifo */ + ll_uart_flush_rx_fifo(p_uart_env[id]->handle.p_instance); + /* Clear TIMEOUT interrupt flag bit */ + ll_uart_receive_data8(p_uart_env[id]->handle.p_instance); + } + + err_code = hal_uart_receive_dma_sg_llp(&p_uart_env[id]->handle, p_data, size, sg_llp_config); + if (err_code != HAL_OK) + { + return (uint16_t)err_code; + } + + return APP_DRV_SUCCESS; +} + +#endif + diff --git a/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/BUILD.gn new file mode 100644 index 0000000..a1a9a5e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/BUILD.gn @@ -0,0 +1,22 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ "." ] +} + +kernel_module("segger_rtt") { + sources = [ "SEGGER_RTT.c" ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.c b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.c new file mode 100644 index 0000000..493043b --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.c @@ -0,0 +1,1459 @@ +/********************************************************************* +* SEGGER Microcontroller GmbH & Co. KG * +* The Embedded Experts * +********************************************************************** +* * +* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* SEGGER RTT * Real Time Transfer for embedded targets * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* SEGGER strongly recommends to not make any changes * +* to or modify the source code of this software in order to stay * +* compatible with the RTT protocol and J-Link. * +* * +* Redistribution and use in source and binary forms, with or * +* without modification, are permitted provided that the following * +* conditions are met: * +* * +* o Redistributions of source code must retain the above copyright * +* notice, this list of conditions and the following disclaimer. * +* * +* o Redistributions in binary form must reproduce the above * +* copyright notice, this list of conditions and the following * +* disclaimer in the documentation and/or other materials provided * +* with the distribution. * +* * +* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * +* nor the names of its contributors may be used to endorse or * +* promote products derived from this software without specific * +* prior written permission. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +* * +* RTT version: 6.12a * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT.c +Purpose : Implementation of SEGGER real-time transfer (RTT) which + allows real-time communication on targets which support + debugger memory accesses while the CPU is running. +Revision: $Rev: 4351 $ + +Additional information: + Type "int" is assumed to be 32-bits in size + H->T Host to target communication + T->H Target to host communication + + RTT channel 0 is always present and reserved for Terminal usage. + Name is fixed to "Terminal" + + Effective buffer size: SizeOfBuffer - 1 + + WrOff == RdOff: Buffer is empty + WrOff == (RdOff - 1): Buffer is full + WrOff > RdOff: Free space includes wrap-around + WrOff < RdOff: Used space includes wrap-around + (WrOff == (SizeOfBuffer - 1)) && (RdOff == 0): + Buffer full and wrap-around after next byte + + +---------------------------------------------------------------------- +*/ + +#include "SEGGER_RTT.h" + +#include // for memcpy + +/********************************************************************* +* +* Configuration, default values +* +********************************************************************** +*/ + +#ifndef BUFFER_SIZE_UP + #define BUFFER_SIZE_UP 1024 // Size of the buffer for terminal output of target, up to host +#endif + +#ifndef BUFFER_SIZE_DOWN + #define BUFFER_SIZE_DOWN 16 // Size of the buffer for terminal input to target from host (Usually keyboard input) +#endif + +#ifndef SEGGER_RTT_MAX_NUM_UP_BUFFERS + #define SEGGER_RTT_MAX_NUM_UP_BUFFERS 2 // Number of up-buffers (T->H) available on this target +#endif + +#ifndef SEGGER_RTT_MAX_NUM_DOWN_BUFFERS + #define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS 2 // Number of down-buffers (H->T) available on this target +#endif + +#ifndef SEGGER_RTT_BUFFER_SECTION + #if defined(SEGGER_RTT_SECTION) + #define SEGGER_RTT_BUFFER_SECTION SEGGER_RTT_SECTION + #endif +#endif + +#ifndef SEGGER_RTT_ALIGNMENT + #define SEGGER_RTT_ALIGNMENT 0 +#endif + +#ifndef SEGGER_RTT_BUFFER_ALIGNMENT + #define SEGGER_RTT_BUFFER_ALIGNMENT 0 +#endif + +#ifndef SEGGER_RTT_MODE_DEFAULT + #define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP +#endif + +#ifndef SEGGER_RTT_LOCK + #define SEGGER_RTT_LOCK() +#endif + +#ifndef SEGGER_RTT_UNLOCK + #define SEGGER_RTT_UNLOCK() +#endif + +#ifndef STRLEN + #define STRLEN(a) strlen((a)) +#endif + +#ifndef MEMCPY + #define MEMCPY(pDest, pSrc, NumBytes) memcpy((pDest), (pSrc), (NumBytes)) +#endif + +#ifndef MIN + #define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +#ifndef MAX + #define MAX(a, b) (((a) > (b)) ? (a) : (b)) +#endif +// +// For some environments, NULL may not be defined until certain headers are included +// +#ifndef NULL + #define NULL 0 +#endif + +/********************************************************************* +* +* Defines, fixed +* +********************************************************************** +*/ +#if (defined __ICCARM__) || (defined __ICCRX__) + #define RTT_PRAGMA(P) _Pragma(#P) +#endif + +#if SEGGER_RTT_ALIGNMENT || SEGGER_RTT_BUFFER_ALIGNMENT + #if (defined __GNUC__) + #define SEGGER_RTT_ALIGN(Var, Alignment) Var __attribute__ ((aligned (Alignment))) + #elif (defined __ICCARM__) || (defined __ICCRX__) + #define PRAGMA(A) _Pragma(#A) +#define SEGGER_RTT_ALIGN(Var, Alignment) RTT_PRAGMA(data_alignment=Alignment) \ + Var + #elif (defined __CC_ARM__) + #define SEGGER_RTT_ALIGN(Var, Alignment) Var __attribute__ ((aligned (Alignment))) + #else + #error "Alignment not supported for this compiler." + #endif +#else + #define SEGGER_RTT_ALIGN(Var, Alignment) Var +#endif + +#if defined(SEGGER_RTT_SECTION) || defined (SEGGER_RTT_BUFFER_SECTION) + #if (defined __GNUC__) + #define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section))) Var + #elif (defined __ICCARM__) || (defined __ICCRX__) +#define SEGGER_RTT_PUT_SECTION(Var, Section) RTT_PRAGMA(location=Section) \ + Var + #elif (defined __CC_ARM__) + #define SEGGER_RTT_PUT_SECTION(Var, Section) __attribute__ ((section (Section), zero_init)) Var + #else + #error "Section placement not supported for this compiler." + #endif +#else + #define SEGGER_RTT_PUT_SECTION(Var, Section) Var +#endif + + +#if SEGGER_RTT_ALIGNMENT + #define SEGGER_RTT_CB_ALIGN(Var) SEGGER_RTT_ALIGN(Var, SEGGER_RTT_ALIGNMENT) +#else + #define SEGGER_RTT_CB_ALIGN(Var) Var +#endif + +#if SEGGER_RTT_BUFFER_ALIGNMENT + #define SEGGER_RTT_BUFFER_ALIGN(Var) SEGGER_RTT_ALIGN(Var, SEGGER_RTT_BUFFER_ALIGNMENT) +#else + #define SEGGER_RTT_BUFFER_ALIGN(Var) Var +#endif + + +#if defined(SEGGER_RTT_SECTION) + #define SEGGER_RTT_PUT_CB_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_SECTION) +#else + #define SEGGER_RTT_PUT_CB_SECTION(Var) Var +#endif + +#if defined(SEGGER_RTT_BUFFER_SECTION) + #define SEGGER_RTT_PUT_BUFFER_SECTION(Var) SEGGER_RTT_PUT_SECTION(Var, SEGGER_RTT_BUFFER_SECTION) +#else + #define SEGGER_RTT_PUT_BUFFER_SECTION(Var) Var +#endif + +/********************************************************************* +* +* Static const data +* +********************************************************************** +*/ + +static unsigned char _aTerminalId[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + +/********************************************************************* +* +* Static data +* +********************************************************************** +*/ +// +// RTT Control Block and allocate buffers for channel 0 +// +SEGGER_RTT_PUT_CB_SECTION(SEGGER_RTT_CB_ALIGN(SEGGER_RTT_CB _SEGGER_RTT)); + +//SEGGER_RTT_CB _SEGGER_RTT __attribute__ ((at(0x2000a230))); + +SEGGER_RTT_PUT_BUFFER_SECTION(SEGGER_RTT_BUFFER_ALIGN(static char _acUpBuffer [BUFFER_SIZE_UP])); +SEGGER_RTT_PUT_BUFFER_SECTION(SEGGER_RTT_BUFFER_ALIGN(static char _acDownBuffer[BUFFER_SIZE_DOWN])); + +static char _ActiveTerminal; + +/********************************************************************* +* +* Static functions +* +********************************************************************** +*/ + +/********************************************************************* +* +* _DoInit() +* +* Function description +* Initializes the control block an buffers. +* May only be called via INIT() to avoid overriding settings. +* +*/ +#define INIT() do { \ + if (_SEGGER_RTT.acID[0] == '\0') { _DoInit(); } \ + } while (0) +static void _DoInit(void) { + SEGGER_RTT_CB* p; + // + // Initialize control block + // + p = &_SEGGER_RTT; + p->MaxNumUpBuffers = SEGGER_RTT_MAX_NUM_UP_BUFFERS; + p->MaxNumDownBuffers = SEGGER_RTT_MAX_NUM_DOWN_BUFFERS; + // + // Initialize up buffer 0 + // + p->aUp[0].sName = "Terminal"; + p->aUp[0].pBuffer = _acUpBuffer; + p->aUp[0].SizeOfBuffer = sizeof(_acUpBuffer); + p->aUp[0].RdOff = 0u; + p->aUp[0].WrOff = 0u; + p->aUp[0].Flags = SEGGER_RTT_MODE_DEFAULT; + // + // Initialize down buffer 0 + // + p->aDown[0].sName = "Terminal"; + p->aDown[0].pBuffer = _acDownBuffer; + p->aDown[0].SizeOfBuffer = sizeof(_acDownBuffer); + p->aDown[0].RdOff = 0u; + p->aDown[0].WrOff = 0u; + p->aDown[0].Flags = SEGGER_RTT_MODE_DEFAULT; + // + // Finish initialization of the control block. + // Copy Id string in three steps to make sure "SEGGER RTT" is not found + // in initializer memory (usually flash) by J-Link + // + strcpy(&p->acID[7], "RTT"); + strcpy(&p->acID[0], "SEGGER"); + p->acID[6] = ' '; +} + +/********************************************************************* +* +* _WriteBlocking() +* +* Function description +* Stores a specified number of characters in SEGGER RTT ring buffer +* and updates the associated write pointer which is periodically +* read by the host. +* The caller is responsible for managing the write chunk sizes as +* _WriteBlocking() will block until all data has been posted successfully. +* +* Parameters +* pRing Ring buffer to post to. +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* >= 0 - Number of bytes written into buffer. +*/ +static unsigned _WriteBlocking(SEGGER_RTT_BUFFER_UP* pRing, const char* pBuffer, unsigned NumBytes) { + unsigned NumBytesToWrite; + unsigned NumBytesWritten; + unsigned RdOff; + unsigned WrOff; + // + // Write data to buffer and handle wrap-around if necessary + // + NumBytesWritten = 0u; + WrOff = pRing->WrOff; + do { + RdOff = pRing->RdOff; // May be changed by host (debug probe) in the meantime + if (RdOff > WrOff) { + NumBytesToWrite = RdOff - WrOff - 1u; + } else { + NumBytesToWrite = pRing->SizeOfBuffer - (WrOff - RdOff + 1u); + } + NumBytesToWrite = MIN(NumBytesToWrite, (pRing->SizeOfBuffer - WrOff)); // Number of bytes that can be written until buffer wrap-around + NumBytesToWrite = MIN(NumBytesToWrite, NumBytes); + memcpy(pRing->pBuffer + WrOff, pBuffer, NumBytesToWrite); + NumBytesWritten += NumBytesToWrite; + pBuffer += NumBytesToWrite; + NumBytes -= NumBytesToWrite; + WrOff += NumBytesToWrite; + if (WrOff == pRing->SizeOfBuffer) { + WrOff = 0u; + } + pRing->WrOff = WrOff; + } while (NumBytes); + // + return NumBytesWritten; +} + +/********************************************************************* +* +* _WriteNoCheck() +* +* Function description +* Stores a specified number of characters in SEGGER RTT ring buffer +* and updates the associated write pointer which is periodically +* read by the host. +* It is callers responsibility to make sure data actually fits in buffer. +* +* Parameters +* pRing Ring buffer to post to. +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Notes +* (1) If there might not be enough space in the "Up"-buffer, call _WriteBlocking +*/ +static void _WriteNoCheck(SEGGER_RTT_BUFFER_UP* pRing, const char* pData, unsigned NumBytes) { + unsigned NumBytesAtOnce; + unsigned WrOff; + unsigned Rem; + + WrOff = pRing->WrOff; + Rem = pRing->SizeOfBuffer - WrOff; + if (Rem > NumBytes) { + // + // All data fits before wrap around + // + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + } else { + // + // We reach the end of the buffer, so need to wrap around + // + NumBytesAtOnce = Rem; + memcpy(pRing->pBuffer + WrOff, pData, NumBytesAtOnce); + NumBytesAtOnce = NumBytes - Rem; + memcpy(pRing->pBuffer, pData + Rem, NumBytesAtOnce); + pRing->WrOff = NumBytesAtOnce; + } +} + +/********************************************************************* +* +* _PostTerminalSwitch() +* +* Function description +* Switch terminal to the given terminal ID. It is the caller's +* responsibility to ensure the terminal ID is correct and there is +* enough space in the buffer for this to complete successfully. +* +* Parameters +* pRing Ring buffer to post to. +* TerminalId Terminal ID to switch to. +*/ +static void _PostTerminalSwitch(SEGGER_RTT_BUFFER_UP* pRing, unsigned char TerminalId) { + char ac[2]; + + ac[0] = 0xFFu; + ac[1] = _aTerminalId[TerminalId]; // Caller made already sure that TerminalId does not exceed our terminal limit + _WriteBlocking(pRing, ac, 2u); +} + +/********************************************************************* +* +* _GetAvailWriteSpace() +* +* Function description +* Returns the number of bytes that can be written to the ring +* buffer without blocking. +* +* Parameters +* pRing Ring buffer to check. +* +* Return value +* Number of bytes that are free in the buffer. +*/ +static unsigned _GetAvailWriteSpace(SEGGER_RTT_BUFFER_UP* pRing) { + unsigned RdOff; + unsigned WrOff; + unsigned r; + // + // Avoid warnings regarding volatile access order. It's not a problem + // in this case, but dampen compiler enthusiasm. + // + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + if (RdOff <= WrOff) { + r = pRing->SizeOfBuffer - 1u - WrOff + RdOff; + } else { + r = RdOff - WrOff - 1u; + } + return r; +} + +/********************************************************************* +* +* Public code +* +********************************************************************** +*/ +/********************************************************************* +* +* SEGGER_RTT_ReadNoLock() +* +* Function description +* Reads characters from SEGGER real-time-terminal control block +* which have been previously stored by the host. +* Do not lock against interrupts and multiple access. +* +* Parameters +* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. +* BufferSize Size of the target application buffer. +* +* Return value +* Number of bytes that have been read. +*/ +unsigned SEGGER_RTT_ReadNoLock(unsigned BufferIndex, void* pData, unsigned BufferSize) { + unsigned NumBytesRem; + unsigned NumBytesRead; + unsigned RdOff; + unsigned WrOff; + unsigned char* pBuffer; + SEGGER_RTT_BUFFER_DOWN* pRing; + // + INIT(); + pRing = &_SEGGER_RTT.aDown[BufferIndex]; + pBuffer = (unsigned char*)pData; + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + NumBytesRead = 0u; + // + // Read from current read position to wrap-around of buffer, first + // + if (RdOff > WrOff) { + NumBytesRem = pRing->SizeOfBuffer - RdOff; + NumBytesRem = MIN(NumBytesRem, BufferSize); + memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); + NumBytesRead += NumBytesRem; + pBuffer += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + // + // Handle wrap-around of buffer + // + if (RdOff == pRing->SizeOfBuffer) { + RdOff = 0u; + } + } + // + // Read remaining items of buffer + // + NumBytesRem = WrOff - RdOff; + NumBytesRem = MIN(NumBytesRem, BufferSize); + if (NumBytesRem > 0u) { + memcpy(pBuffer, pRing->pBuffer + RdOff, NumBytesRem); + NumBytesRead += NumBytesRem; + pBuffer += NumBytesRem; + BufferSize -= NumBytesRem; + RdOff += NumBytesRem; + } + if (NumBytesRead) { + pRing->RdOff = RdOff; + } + // + return NumBytesRead; +} + +/********************************************************************* +* +* SEGGER_RTT_Read +* +* Function description +* Reads characters from SEGGER real-time-terminal control block +* which have been previously stored by the host. +* +* Parameters +* BufferIndex Index of Down-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to buffer provided by target application, to copy characters from RTT-down-buffer to. +* BufferSize Size of the target application buffer. +* +* Return value +* Number of bytes that have been read. +*/ +unsigned SEGGER_RTT_Read(unsigned BufferIndex, void* pBuffer, unsigned BufferSize) { + unsigned NumBytesRead; + // + SEGGER_RTT_LOCK(); + // + // Call the non-locking read function + // + NumBytesRead = SEGGER_RTT_ReadNoLock(BufferIndex, pBuffer, BufferSize); + // + // Finish up. + // + SEGGER_RTT_UNLOCK(); + // + return NumBytesRead; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteWithOverwriteNoLock +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block. +* SEGGER_RTT_WriteWithOverwriteNoLock does not lock the application +* and overwrites data if the data does not fit into the buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, data is overwritten. +* (2) For performance reasons this function does not call Init() +* and may only be called after RTT has been initialized. +* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. +* (3) Do not use SEGGER_RTT_WriteWithOverwriteNoLock if a J-Link +* connection reads RTT data. +*/ +void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + const char* pData; + SEGGER_RTT_BUFFER_UP* pRing; + unsigned Avail; + + pData = (const char *)pBuffer; + // + // Get "to-host" ring buffer and copy some elements into local variables. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // Check if we will overwrite data and need to adjust the RdOff. + // + if (pRing->WrOff == pRing->RdOff) { + Avail = pRing->SizeOfBuffer - 1u; + } else if ( pRing->WrOff < pRing->RdOff) { + Avail = pRing->RdOff - pRing->WrOff - 1u; + } else { + Avail = pRing->RdOff - pRing->WrOff - 1u + pRing->SizeOfBuffer; + } + if (NumBytes > Avail) { + pRing->RdOff += (NumBytes - Avail); + while (pRing->RdOff >= pRing->SizeOfBuffer) { + pRing->RdOff -= pRing->SizeOfBuffer; + } + } + // + // Write all data, no need to check the RdOff, but possibly handle multiple wrap-arounds + // + Avail = pRing->SizeOfBuffer - pRing->WrOff; + do { + if (Avail > NumBytes) { + // + // Last round + // +#if 1 // memcpy() is good for large amounts of data, but the overhead is too big for small amounts. Use a simple byte loop instead. + char* pDst; + pDst = pRing->pBuffer + pRing->WrOff; + pRing->WrOff += NumBytes; + do { + *pDst++ = *pData++; + } while (--NumBytes); +#else + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff += NumBytes; +#endif + break; //Alternatively: NumBytes = 0; + } else { + // + // Wrap-around necessary, write until wrap-around and reset WrOff + // + memcpy(pRing->pBuffer + pRing->WrOff, pData, Avail); + pData += Avail; + pRing->WrOff = 0; + NumBytes -= Avail; + Avail = (pRing->SizeOfBuffer - 1); + } + } while (NumBytes); +} + +/********************************************************************* +* +* SEGGER_RTT_WriteSkipNoLock +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* SEGGER_RTT_WriteSkipNoLock does not lock the application and +* skips all data, if the data does not fit into the buffer. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, all data is dropped. +* (2) For performance reasons this function does not call Init() +* and may only be called after RTT has been initialized. +* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. +*/ +unsigned SEGGER_RTT_WriteSkipNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + const char* pData; + SEGGER_RTT_BUFFER_UP* pRing; + unsigned Avail; + unsigned RdOff; + unsigned WrOff; + unsigned Rem; + + pData = (const char *)pBuffer; + // + // Get "to-host" ring buffer and copy some elements into local variables. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + RdOff = pRing->RdOff; + WrOff = pRing->WrOff; + // + // Handle the most common cases fastest. + // Which is: + // RdOff <= WrOff -> Space until wrap around is free. + // AND + // WrOff + NumBytes < SizeOfBuffer -> No Wrap around necessary. + // + // OR + // + // RdOff > WrOff -> Space until RdOff - 1 is free. + // AND + // WrOff + NumBytes < RdOff -> Data fits into buffer + // + if (RdOff <= WrOff) { + // + // Get space until WrOff will be at wrap around. + // + Avail = pRing->SizeOfBuffer - 1u - WrOff ; + if (Avail >= NumBytes) { +#if 1 // memcpy() is good for large amounts of data, but the overhead is too big for small amounts. Use a simple byte loop instead. + char* pDst; + pDst = pRing->pBuffer + WrOff; + WrOff += NumBytes; + do { + *pDst++ = *pData++; + } while (--NumBytes); + pRing->WrOff = WrOff + NumBytes; +#else + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; +#endif + return 1; + } + // + // If data did not fit into space until wrap around calculate complete space in buffer. + // + Avail += RdOff; + // + // If there is still no space for the whole of this output, don't bother. + // + if (Avail >= NumBytes) { + // + // OK, we have enough space in buffer. Copy in one or 2 chunks + // + Rem = pRing->SizeOfBuffer - WrOff; // Space until end of buffer + if (Rem > NumBytes) { + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + } else { + // + // We reach the end of the buffer, so need to wrap around + // + memcpy(pRing->pBuffer + WrOff, pData, Rem); + memcpy(pRing->pBuffer, pData + Rem, NumBytes - Rem); + pRing->WrOff = NumBytes - Rem; + } + return 1; + } + } else { + Avail = RdOff - WrOff - 1u; + if (Avail >= NumBytes) { + memcpy(pRing->pBuffer + WrOff, pData, NumBytes); + pRing->WrOff = WrOff + NumBytes; + return 1; + } + } + // + // If we reach this point no data has been written + // + return 0; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteNoLock +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* SEGGER_RTT_WriteNoLock does not lock the application. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +* (2) For performance reasons this function does not call Init() +* and may only be called after RTT has been initialized. +* Either by calling SEGGER_RTT_Init() or calling another RTT API function first. +*/ +unsigned SEGGER_RTT_WriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + unsigned Status; + unsigned Avail; + const char* pData; + SEGGER_RTT_BUFFER_UP* pRing; + + pData = (const char *)pBuffer; + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[BufferIndex]; + // + // How we output depends upon the mode... + // + switch (pRing->Flags) { + case SEGGER_RTT_MODE_NO_BLOCK_SKIP: + // + // If we are in skip mode and there is no space for the whole + // of this output, don't bother. + // + Avail = _GetAvailWriteSpace(pRing); + if (Avail < NumBytes) { + Status = 0u; + } else { + Status = NumBytes; + _WriteNoCheck(pRing, pData, NumBytes); + } + break; + case SEGGER_RTT_MODE_NO_BLOCK_TRIM: + // + // If we are in trim mode, trim to what we can output without blocking. + // + Avail = _GetAvailWriteSpace(pRing); + Status = Avail < NumBytes ? Avail : NumBytes; + _WriteNoCheck(pRing, pData, Status); + break; + case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: + // + // If we are in blocking mode, output everything. + // + Status = _WriteBlocking(pRing, pData, NumBytes); + break; + default: + Status = 0u; + break; + } + // + // Finish up. + // + return Status; +} + +/********************************************************************* +* +* SEGGER_RTT_Write +* +* Function description +* Stores a specified number of characters in SEGGER RTT +* control block which is then read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* pBuffer Pointer to character array. Does not need to point to a \0 terminated string. +* NumBytes Number of bytes to be stored in the SEGGER RTT control block. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, remaining characters of pBuffer are dropped. +*/ +unsigned SEGGER_RTT_Write(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes) { + unsigned Status; + // + INIT(); + SEGGER_RTT_LOCK(); + // + // Call the non-locking write function + // + Status = SEGGER_RTT_WriteNoLock(BufferIndex, pBuffer, NumBytes); + // + // Finish up. + // + SEGGER_RTT_UNLOCK(); + // + return Status; +} + +/********************************************************************* +* +* SEGGER_RTT_WriteString +* +* Function description +* Stores string in SEGGER RTT control block. +* This data is read by the host. +* +* Parameters +* BufferIndex Index of "Up"-buffer to be used (e.g. 0 for "Terminal"). +* s Pointer to string. +* +* Return value +* Number of bytes which have been stored in the "Up"-buffer. +* +* Notes +* (1) If there is not enough space in the "Up"-buffer, depending on configuration, +* remaining characters may be dropped or RTT module waits until there is more space in the buffer. +* (2) String passed to this function has to be \0 terminated +* (3) \0 termination character is *not* stored in RTT buffer +*/ +unsigned SEGGER_RTT_WriteString(unsigned BufferIndex, const char* s) { + unsigned Len; + + Len = STRLEN(s); + return SEGGER_RTT_Write(BufferIndex, s, Len); +} + +/********************************************************************* +* +* SEGGER_RTT_GetKey +* +* Function description +* Reads one character from the SEGGER RTT buffer. +* Host has previously stored data there. +* +* Return value +* < 0 - No character available (buffer empty). +* >= 0 - Character which has been read. (Possible values: 0 - 255) +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0. +*/ +int SEGGER_RTT_GetKey(void) { + char c; + int r; + + r = (int)SEGGER_RTT_Read(0u, &c, 1u); + if (r == 1) { + r = (int)(unsigned char)c; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_WaitKey +* +* Function description +* Waits until at least one character is avaible in the SEGGER RTT buffer. +* Once a character is available, it is read and this function returns. +* +* Return value +* >=0 - Character which has been read. +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0 +* (2) This function is blocking if no character is present in RTT buffer +*/ +int SEGGER_RTT_WaitKey(void) { + int r; + + do { + r = SEGGER_RTT_GetKey(); + } while (r < 0); + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_HasKey +* +* Function description +* Checks if at least one character for reading is available in the SEGGER RTT buffer. +* +* Return value +* == 0 - No characters are available to read. +* == 1 - At least one character is available. +* +* Notes +* (1) This function is only specified for accesses to RTT buffer 0 +*/ +int SEGGER_RTT_HasKey(void) { + unsigned RdOff; + int r; + + INIT(); + RdOff = _SEGGER_RTT.aDown[0].RdOff; + if (RdOff != _SEGGER_RTT.aDown[0].WrOff) { + r = 1; + } else { + r = 0; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_HasData +* +* Function description +* Check if there is data from the host in the given buffer. +* +* Return value: +* ==0: No data +* !=0: Data in buffer +* +*/ +unsigned SEGGER_RTT_HasData(unsigned BufferIndex) { + SEGGER_RTT_BUFFER_DOWN* pRing; + unsigned v; + + pRing = &_SEGGER_RTT.aDown[BufferIndex]; + v = pRing->WrOff; + return v - pRing->RdOff; +} + +/********************************************************************* +* +* SEGGER_RTT_AllocDownBuffer +* +* Function description +* Run-time configuration of the next down-buffer (H->T). +* The next buffer, which is not used yet is configured. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 - O.K. Buffer Index +* < 0 - Error +*/ +int SEGGER_RTT_AllocDownBuffer(const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int BufferIndex; + + INIT(); + SEGGER_RTT_LOCK(); + BufferIndex = 0; + do { + if (_SEGGER_RTT.aDown[BufferIndex].pBuffer == NULL) { + break; + } + BufferIndex++; + } while (BufferIndex < _SEGGER_RTT.MaxNumDownBuffers); + if (BufferIndex < _SEGGER_RTT.MaxNumDownBuffers) { + _SEGGER_RTT.aDown[BufferIndex].sName = sName; + _SEGGER_RTT.aDown[BufferIndex].pBuffer = (char*)pBuffer; + _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aDown[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aDown[BufferIndex].WrOff = 0u; + _SEGGER_RTT.aDown[BufferIndex].Flags = Flags; + } else { + BufferIndex = -1; + } + SEGGER_RTT_UNLOCK(); + return BufferIndex; +} + +/********************************************************************* +* +* SEGGER_RTT_AllocUpBuffer +* +* Function description +* Run-time configuration of the next up-buffer (T->H). +* The next buffer, which is not used yet is configured. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 - O.K. Buffer Index +* < 0 - Error +*/ +int SEGGER_RTT_AllocUpBuffer(const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int BufferIndex; + + INIT(); + SEGGER_RTT_LOCK(); + BufferIndex = 0; + do { + if (_SEGGER_RTT.aUp[BufferIndex].pBuffer == NULL) { + break; + } + BufferIndex++; + } while (BufferIndex < _SEGGER_RTT.MaxNumUpBuffers); + if (BufferIndex < _SEGGER_RTT.MaxNumUpBuffers) { + _SEGGER_RTT.aUp[BufferIndex].sName = sName; + _SEGGER_RTT.aUp[BufferIndex].pBuffer = (char*)pBuffer; + _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aUp[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aUp[BufferIndex].WrOff = 0u; + _SEGGER_RTT.aUp[BufferIndex].Flags = Flags; + } else { + BufferIndex = -1; + } + SEGGER_RTT_UNLOCK(); + return BufferIndex; +} + +/********************************************************************* +* +* SEGGER_RTT_ConfigUpBuffer +* +* Function description +* Run-time configuration of a specific up-buffer (T->H). +* Buffer to be configured is specified by index. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* BufferIndex Index of the buffer to configure. +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 - O.K. +* < 0 - Error +* +* Additional information +* Buffer 0 is configured on compile-time. +* May only be called once per buffer. +* Buffer name and flags can be reconfigured using the appropriate functions. +*/ +int SEGGER_RTT_ConfigUpBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { + SEGGER_RTT_LOCK(); + if (BufferIndex > 0u) { + _SEGGER_RTT.aUp[BufferIndex].sName = sName; + _SEGGER_RTT.aUp[BufferIndex].pBuffer = (char*)pBuffer; + _SEGGER_RTT.aUp[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aUp[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aUp[BufferIndex].WrOff = 0u; + } + _SEGGER_RTT.aUp[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_ConfigDownBuffer +* +* Function description +* Run-time configuration of a specific down-buffer (H->T). +* Buffer to be configured is specified by index. +* This includes: Buffer address, size, name, flags, ... +* +* Parameters +* BufferIndex Index of the buffer to configure. +* sName Pointer to a constant name string. +* pBuffer Pointer to a buffer to be used. +* BufferSize Size of the buffer. +* Flags Operating modes. Define behavior if buffer is full (not enough space for entire message). +* +* Return value +* >= 0 O.K. +* < 0 Error +* +* Additional information +* Buffer 0 is configured on compile-time. +* May only be called once per buffer. +* Buffer name and flags can be reconfigured using the appropriate functions. +*/ +int SEGGER_RTT_ConfigDownBuffer(unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { + SEGGER_RTT_LOCK(); + if (BufferIndex > 0u) { + _SEGGER_RTT.aDown[BufferIndex].sName = sName; + _SEGGER_RTT.aDown[BufferIndex].pBuffer = (char*)pBuffer; + _SEGGER_RTT.aDown[BufferIndex].SizeOfBuffer = BufferSize; + _SEGGER_RTT.aDown[BufferIndex].RdOff = 0u; + _SEGGER_RTT.aDown[BufferIndex].WrOff = 0u; + } + _SEGGER_RTT.aDown[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetNameUpBuffer +* +* Function description +* Run-time configuration of a specific up-buffer name (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer to renamed. +* sName Pointer to a constant name string. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetNameUpBuffer(unsigned BufferIndex, const char* sName) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { + SEGGER_RTT_LOCK(); + _SEGGER_RTT.aUp[BufferIndex].sName = sName; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetNameDownBuffer +* +* Function description +* Run-time configuration of a specific Down-buffer name (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer to renamed. +* sName Pointer to a constant name string. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetNameDownBuffer(unsigned BufferIndex, const char* sName) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { + SEGGER_RTT_LOCK(); + _SEGGER_RTT.aDown[BufferIndex].sName = sName; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetFlagsUpBuffer +* +* Function description +* Run-time configuration of specific up-buffer flags (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer. +* Flags Flags to set for the buffer. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetFlagsUpBuffer(unsigned BufferIndex, unsigned Flags) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumUpBuffers) { + SEGGER_RTT_LOCK(); + _SEGGER_RTT.aUp[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_SetFlagsDownBuffer +* +* Function description +* Run-time configuration of specific Down-buffer flags (T->H). +* Buffer to be configured is specified by index. +* +* Parameters +* BufferIndex Index of the buffer to renamed. +* Flags Flags to set for the buffer. +* +* Return value +* >= 0 O.K. +* < 0 Error +*/ +int SEGGER_RTT_SetFlagsDownBuffer(unsigned BufferIndex, unsigned Flags) { + int r; + + INIT(); + if (BufferIndex < (unsigned)_SEGGER_RTT.MaxNumDownBuffers) { + SEGGER_RTT_LOCK(); + _SEGGER_RTT.aDown[BufferIndex].Flags = Flags; + SEGGER_RTT_UNLOCK(); + r = 0; + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_Init +* +* Function description +* Initializes the RTT Control Block. +* Should be used in RAM targets, at start of the application. +* +*/ +void SEGGER_RTT_Init (void) { + _DoInit(); +} + +/********************************************************************* +* +* SEGGER_RTT_SetTerminal +* +* Function description +* Sets the terminal to be used for output on channel 0. +* +* Parameters +* TerminalId Index of the terminal. +* +* Return value +* >= 0 O.K. +* < 0 Error (e.g. if RTT is configured for non-blocking mode and there was no space in the buffer to set the new terminal Id) +*/ +int SEGGER_RTT_SetTerminal (char TerminalId) { + char ac[2]; + SEGGER_RTT_BUFFER_UP* pRing; + unsigned Avail; + int r; + // + INIT(); + // + r = 0; + ac[0] = 0xFFU; + if ((unsigned char)TerminalId < (unsigned char)sizeof(_aTerminalId)) { // We only support a certain number of channels + ac[1] = _aTerminalId[(unsigned char)TerminalId]; + pRing = &_SEGGER_RTT.aUp[0]; // Buffer 0 is always reserved for terminal I/O, so we can use index 0 here, fixed + SEGGER_RTT_LOCK(); // Lock to make sure that no other task is writing into buffer, while we are and number of free bytes in buffer does not change downwards after checking and before writing + if ((pRing->Flags & SEGGER_RTT_MODE_MASK) == SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL) { + _ActiveTerminal = TerminalId; + _WriteBlocking(pRing, ac, 2u); + } else { // Skipping mode or trim mode? => We cannot trim this command so handling is the same for both modes + Avail = _GetAvailWriteSpace(pRing); + if (Avail >= 2) { + _ActiveTerminal = TerminalId; // Only change active terminal in case of success + _WriteNoCheck(pRing, ac, 2u); + } else { + r = -1; + } + } + SEGGER_RTT_UNLOCK(); + } else { + r = -1; + } + return r; +} + +/********************************************************************* +* +* SEGGER_RTT_TerminalOut +* +* Function description +* Writes a string to the given terminal +* without changing the terminal for channel 0. +* +* Parameters +* TerminalId Index of the terminal. +* s String to be printed on the terminal. +* +* Return value +* >= 0 - Number of bytes written. +* < 0 - Error. +* +*/ +int SEGGER_RTT_TerminalOut (char TerminalId, const char* s) { + int Status; + unsigned FragLen; + unsigned Avail; + SEGGER_RTT_BUFFER_UP* pRing; + // + INIT(); + // + // Validate terminal ID. + // + if (TerminalId < (char)sizeof(_aTerminalId)) { // We only support a certain number of channels + // + // Get "to-host" ring buffer. + // + pRing = &_SEGGER_RTT.aUp[0]; + // + // Need to be able to change terminal, write data, change back. + // Compute the fixed and variable sizes. + // + FragLen = strlen(s); + // + // How we output depends upon the mode... + // + SEGGER_RTT_LOCK(); + Avail = _GetAvailWriteSpace(pRing); + switch (pRing->Flags & SEGGER_RTT_MODE_MASK) { + case SEGGER_RTT_MODE_NO_BLOCK_SKIP: + // + // If we are in skip mode and there is no space for the whole + // of this output, don't bother switching terminals at all. + // + if (Avail < (FragLen + 4u)) { + Status = 0; + } else { + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, FragLen); + _PostTerminalSwitch(pRing, _ActiveTerminal); + } + break; + case SEGGER_RTT_MODE_NO_BLOCK_TRIM: + // + // If we are in trim mode and there is not enough space for everything, + // trim the output but always include the terminal switch. If no room + // for terminal switch, skip that totally. + // + if (Avail < 4u) { + Status = -1; + } else { + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, (FragLen < (Avail - 4u)) ? FragLen : (Avail - 4u)); + _PostTerminalSwitch(pRing, _ActiveTerminal); + } + break; + case SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL: + // + // If we are in blocking mode, output everything. + // + _PostTerminalSwitch(pRing, TerminalId); + Status = (int)_WriteBlocking(pRing, s, FragLen); + _PostTerminalSwitch(pRing, _ActiveTerminal); + break; + default: + Status = -1; + break; + } + // + // Finish up. + // + SEGGER_RTT_UNLOCK(); + } else { + Status = -1; + } + return Status; +} + + +/*************************** End of file ****************************/ diff --git a/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.h b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.h new file mode 100644 index 0000000..31ac1a4 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT.h @@ -0,0 +1,248 @@ +/********************************************************************* +* SEGGER Microcontroller GmbH & Co. KG * +* The Embedded Experts * +********************************************************************** +* * +* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* SEGGER RTT * Real Time Transfer for embedded targets * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* SEGGER strongly recommends to not make any changes * +* to or modify the source code of this software in order to stay * +* compatible with the RTT protocol and J-Link. * +* * +* Redistribution and use in source and binary forms, with or * +* without modification, are permitted provided that the following * +* conditions are met: * +* * +* o Redistributions of source code must retain the above copyright * +* notice, this list of conditions and the following disclaimer. * +* * +* o Redistributions in binary form must reproduce the above * +* copyright notice, this list of conditions and the following * +* disclaimer in the documentation and/or other materials provided * +* with the distribution. * +* * +* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * +* nor the names of its contributors may be used to endorse or * +* promote products derived from this software without specific * +* prior written permission. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +* * +* RTT version: 6.12a * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT.h +Purpose : Implementation of SEGGER real-time transfer which allows + real-time communication on targets which support debugger + memory accesses while the CPU is running. +Revision: $Rev: 4351 $ +---------------------------------------------------------------------- +*/ + +#ifndef SEGGER_RTT_H +#define SEGGER_RTT_H + +#include "SEGGER_RTT_Conf.h" + +/********************************************************************* +* +* Defines, fixed +* +********************************************************************** +*/ + +/********************************************************************* +* +* Types +* +********************************************************************** +*/ + +// +// Description for a circular buffer (also called "ring buffer") +// which is used as up-buffer (T->H) +// +typedef struct { + const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4" + char* pBuffer; // Pointer to start of buffer + unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty. + unsigned WrOff; // Position of next item to be written by either target. + volatile unsigned RdOff; // Position of next item to be read by host. Must be volatile since it may be modified by host. + unsigned Flags; // Contains configuration flags +} SEGGER_RTT_BUFFER_UP; + +// +// Description for a circular buffer (also called "ring buffer") +// which is used as down-buffer (H->T) +// +typedef struct { + const char* sName; // Optional name. Standard names so far are: "Terminal", "SysView", "J-Scope_t4i4" + char* pBuffer; // Pointer to start of buffer + unsigned SizeOfBuffer; // Buffer size in bytes. Note that one byte is lost, as this implementation does not fill up the buffer in order to avoid the problem of being unable to distinguish between full and empty. + volatile unsigned WrOff; // Position of next item to be written by host. Must be volatile since it may be modified by host. + unsigned RdOff; // Position of next item to be read by target (down-buffer). + unsigned Flags; // Contains configuration flags +} SEGGER_RTT_BUFFER_DOWN; + +// +// RTT control block which describes the number of buffers available +// as well as the configuration for each buffer +// +// +typedef struct { + char acID[16]; // Initialized to "SEGGER RTT" + int MaxNumUpBuffers; // Initialized to SEGGER_RTT_MAX_NUM_UP_BUFFERS (type. 2) + int MaxNumDownBuffers; // Initialized to SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (type. 2) + SEGGER_RTT_BUFFER_UP aUp[SEGGER_RTT_MAX_NUM_UP_BUFFERS]; // Up buffers, transferring information up from target via debug probe to host + SEGGER_RTT_BUFFER_DOWN aDown[SEGGER_RTT_MAX_NUM_DOWN_BUFFERS]; // Down buffers, transferring information down from host via debug probe to target +} SEGGER_RTT_CB; + +/********************************************************************* +* +* Global data +* +********************************************************************** +*/ +extern SEGGER_RTT_CB _SEGGER_RTT; + +/********************************************************************* +* +* RTT API functions +* +********************************************************************** +*/ +#ifdef __cplusplus + extern "C" { +#endif +int SEGGER_RTT_AllocDownBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_AllocUpBuffer (const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_ConfigUpBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_ConfigDownBuffer (unsigned BufferIndex, const char* sName, void* pBuffer, unsigned BufferSize, unsigned Flags); +int SEGGER_RTT_GetKey (void); +unsigned SEGGER_RTT_HasData (unsigned BufferIndex); +int SEGGER_RTT_HasKey (void); +void SEGGER_RTT_Init (void); +unsigned SEGGER_RTT_Read (unsigned BufferIndex, void* pBuffer, unsigned BufferSize); +unsigned SEGGER_RTT_ReadNoLock (unsigned BufferIndex, void* pData, unsigned BufferSize); +int SEGGER_RTT_SetNameDownBuffer (unsigned BufferIndex, const char* sName); +int SEGGER_RTT_SetNameUpBuffer (unsigned BufferIndex, const char* sName); +int SEGGER_RTT_SetFlagsDownBuffer (unsigned BufferIndex, unsigned Flags); +int SEGGER_RTT_SetFlagsUpBuffer (unsigned BufferIndex, unsigned Flags); +int SEGGER_RTT_WaitKey (void); +unsigned SEGGER_RTT_Write (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteSkipNoLock (unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +unsigned SEGGER_RTT_WriteString (unsigned BufferIndex, const char* s); +void SEGGER_RTT_WriteWithOverwriteNoLock(unsigned BufferIndex, const void* pBuffer, unsigned NumBytes); +// +// Function macro for performance optimization +// +#define SEGGER_RTT_HASDATA(n) (_SEGGER_RTT.aDown[n].WrOff - _SEGGER_RTT.aDown[n].RdOff) + +/********************************************************************* +* +* RTT "Terminal" API functions +* +********************************************************************** +*/ +int SEGGER_RTT_SetTerminal (char TerminalId); +int SEGGER_RTT_TerminalOut (char TerminalId, const char* s); + +/********************************************************************* +* +* RTT printf functions (require SEGGER_RTT_printf.c) +* +********************************************************************** +*/ +int SEGGER_RTT_printf(unsigned BufferIndex, const char * sFormat, ...); +#ifdef __cplusplus + } +#endif + +/********************************************************************* +* +* Defines +* +********************************************************************** +*/ + +// +// Operating modes. Define behavior if buffer is full (not enough space for entire message) +// +#define SEGGER_RTT_MODE_NO_BLOCK_SKIP (0U) // Skip. Do not block, output nothing. (Default) +#define SEGGER_RTT_MODE_NO_BLOCK_TRIM (1U) // Trim: Do not block, output as much as fits. +#define SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL (2U) // Block: Wait until there is space in the buffer. +#define SEGGER_RTT_MODE_MASK (3U) + +// +// Control sequences, based on ANSI. +// Can be used to control color, and clear the screen +// +#define RTT_CTRL_RESET "" // Reset to default colors +#define RTT_CTRL_CLEAR "" // Clear screen, reposition cursor to top left + +#define RTT_CTRL_TEXT_BLACK "" +#define RTT_CTRL_TEXT_RED "" +#define RTT_CTRL_TEXT_GREEN "" +#define RTT_CTRL_TEXT_YELLOW "" +#define RTT_CTRL_TEXT_BLUE "" +#define RTT_CTRL_TEXT_MAGENTA "" +#define RTT_CTRL_TEXT_CYAN "" +#define RTT_CTRL_TEXT_WHITE "" + +#define RTT_CTRL_TEXT_BRIGHT_BLACK "" +#define RTT_CTRL_TEXT_BRIGHT_RED "" +#define RTT_CTRL_TEXT_BRIGHT_GREEN "" +#define RTT_CTRL_TEXT_BRIGHT_YELLOW "" +#define RTT_CTRL_TEXT_BRIGHT_BLUE "" +#define RTT_CTRL_TEXT_BRIGHT_MAGENTA "" +#define RTT_CTRL_TEXT_BRIGHT_CYAN "" +#define RTT_CTRL_TEXT_BRIGHT_WHITE "" + +#define RTT_CTRL_BG_BLACK "" +#define RTT_CTRL_BG_RED "" +#define RTT_CTRL_BG_GREEN "" +#define RTT_CTRL_BG_YELLOW "" +#define RTT_CTRL_BG_BLUE "" +#define RTT_CTRL_BG_MAGENTA "" +#define RTT_CTRL_BG_CYAN "" +#define RTT_CTRL_BG_WHITE "" + +#define RTT_CTRL_BG_BRIGHT_BLACK "" +#define RTT_CTRL_BG_BRIGHT_RED "" +#define RTT_CTRL_BG_BRIGHT_GREEN "" +#define RTT_CTRL_BG_BRIGHT_YELLOW "" +#define RTT_CTRL_BG_BRIGHT_BLUE "" +#define RTT_CTRL_BG_BRIGHT_MAGENTA "" +#define RTT_CTRL_BG_BRIGHT_CYAN "" +#define RTT_CTRL_BG_BRIGHT_WHITE "" + + +#endif + +/*************************** End of file ****************************/ diff --git a/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT_Conf.h b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT_Conf.h new file mode 100644 index 0000000..be11a5d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/external/segger_rtt/SEGGER_RTT_Conf.h @@ -0,0 +1,269 @@ +/********************************************************************* +* SEGGER Microcontroller GmbH & Co. KG * +* The Embedded Experts * +********************************************************************** +* * +* (c) 2014 - 2016 SEGGER Microcontroller GmbH & Co. KG * +* * +* www.segger.com Support: support@segger.com * +* * +********************************************************************** +* * +* SEGGER RTT * Real Time Transfer for embedded targets * +* * +********************************************************************** +* * +* All rights reserved. * +* * +* SEGGER strongly recommends to not make any changes * +* to or modify the source code of this software in order to stay * +* compatible with the RTT protocol and J-Link. * +* * +* Redistribution and use in source and binary forms, with or * +* without modification, are permitted provided that the following * +* conditions are met: * +* * +* o Redistributions of source code must retain the above copyright * +* notice, this list of conditions and the following disclaimer. * +* * +* o Redistributions in binary form must reproduce the above * +* copyright notice, this list of conditions and the following * +* disclaimer in the documentation and/or other materials provided * +* with the distribution. * +* * +* o Neither the name of SEGGER Microcontroller GmbH & Co. KG * +* nor the names of its contributors may be used to endorse or * +* promote products derived from this software without specific * +* prior written permission. * +* * +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND * +* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * +* DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR * +* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * +* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * +* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * +* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * +* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * +* DAMAGE. * +* * +********************************************************************** +* * +* RTT version: 6.12a * +* * +********************************************************************** +---------------------------END-OF-HEADER------------------------------ +File : SEGGER_RTT_Conf.h +Purpose : Implementation of SEGGER real-time transfer (RTT) which + allows real-time communication on targets which support + debugger memory accesses while the CPU is running. +Revision: $Rev: 4351 $ +---------------------------------------------------------------------- +*/ + +#ifndef SEGGER_RTT_CONF_H +#define SEGGER_RTT_CONF_H + +#ifdef __IAR_SYSTEMS_ICC__ + #include +#endif + +/********************************************************************* +* +* Defines, configurable +* +********************************************************************** +*/ + +#define SEGGER_RTT_MAX_NUM_UP_BUFFERS (2) // Max. number of up-buffers (T->H) available on this target (Default: 3) +#define SEGGER_RTT_MAX_NUM_DOWN_BUFFERS (2) // Max. number of down-buffers (H->T) available on this target (Default: 3) + +#define BUFFER_SIZE_UP (1024) // Size of the buffer for terminal output of target, up to host (Default: 1k) +#define BUFFER_SIZE_DOWN (16) // Size of the buffer for terminal input to target from host (Usually keyboard input) (Default: 16) + +#define SEGGER_RTT_PRINTF_BUFFER_SIZE (64u) // Size of buffer for RTT printf to bulk-send chars via RTT (Default: 64) + +#define SEGGER_RTT_MODE_DEFAULT SEGGER_RTT_MODE_NO_BLOCK_SKIP // Mode for pre-initialized terminal channel (buffer 0) + +// +// Target is not allowed to perform other RTT operations while string still has not been stored completely. +// Otherwise we would probably end up with a mixed string in the buffer. +// If using RTT from within interrupts, multiple tasks or multi processors, define the SEGGER_RTT_LOCK() and SEGGER_RTT_UNLOCK() function here. +// +// SEGGER_RTT_MAX_INTERRUPT_PRIORITY can be used in the sample lock routines on Cortex-M3/4. +// Make sure to mask all interrupts which can send RTT data, i.e. generate SystemView events, or cause task switches. +// When high-priority interrupts must not be masked while sending RTT data, SEGGER_RTT_MAX_INTERRUPT_PRIORITY needs to be adjusted accordingly. +// (Higher priority = lower priority number) +// Default value for embOS: 128u +// Default configuration in FreeRTOS: configMAX_SYSCALL_INTERRUPT_PRIORITY: ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) ) +// In case of doubt mask all interrupts: 1 << (8 - BASEPRI_PRIO_BITS) i.e. 1 << 5 when 3 bits are implemented in NVIC +// or define SEGGER_RTT_LOCK() to completely disable interrupts. +// + +#define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) // Interrupt priority to lock on SEGGER_RTT_LOCK on Cortex-M3/4 (Default: 0x20) + +/********************************************************************* +* +* RTT lock configuration for SEGGER Embedded Studio, +* Rowley CrossStudio and GCC +*/ +#if (defined __SES_ARM) || (defined __CROSSWORKS_ARM) || (defined __GNUC__) + #ifdef __ARM_ARCH_6M__ + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + __asm volatile ("mrs %0, primask \n\t" \ + "mov r1, $1 \n\t" \ + "msr primask, r1 \n\t" \ + : "=r" (LockState) \ + : \ + : "r1" \ + ); + + #define SEGGER_RTT_UNLOCK() __asm volatile ("msr primask, %0 \n\t" \ + : \ + : "r" (LockState) \ + : \ + ); \ + } + + #elif (defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)) + #ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY + #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) + #endif + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + __asm volatile ("mrs %0, basepri \n\t" \ + "mov r1, %1 \n\t" \ + "msr basepri, r1 \n\t" \ + : "=r" (LockState) \ + : "i"(SEGGER_RTT_MAX_INTERRUPT_PRIORITY) \ + : "r1" \ + ); + + #define SEGGER_RTT_UNLOCK() __asm volatile ("msr basepri, %0 \n\t" \ + : \ + : "r" (LockState) \ + : \ + ); \ + } + + #elif defined(__ARM_ARCH_7A__) + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + __asm volatile ("mrs r1, CPSR \n\t" \ + "mov %0, r1 \n\t" \ + "orr r1, r1, #0xC0 \n\t" \ + "msr CPSR_c, r1 \n\t" \ + : "=r" (LockState) \ + : \ + : "r1" \ + ); + + #define SEGGER_RTT_UNLOCK() __asm volatile ("mov r0, %0 \n\t" \ + "mrs r1, CPSR \n\t" \ + "bic r1, r1, #0xC0 \n\t" \ + "and r0, r0, #0xC0 \n\t" \ + "orr r1, r1, r0 \n\t" \ + "msr CPSR_c, r1 \n\t" \ + : \ + : "r" (LockState) \ + : "r0", "r1" \ + ); \ + } +#else + #define SEGGER_RTT_LOCK() + #define SEGGER_RTT_UNLOCK() + #endif +#endif + +/********************************************************************* +* +* RTT lock configuration for IAR EWARM +*/ +#ifdef __ICCARM__ + #if (defined (__ARM6M__) && (__CORE__ == __ARM6M__)) + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + LockState = __get_PRIMASK(); \ + __set_PRIMASK(1); + + #define SEGGER_RTT_UNLOCK() __set_PRIMASK(LockState); \ + } + #elif ((defined (__ARM7EM__) && (__CORE__ == __ARM7EM__)) || (defined (__ARM7M__) && (__CORE__ == __ARM7M__))) + #ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY + #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) + #endif + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + LockState = __get_BASEPRI(); \ + __set_BASEPRI(SEGGER_RTT_MAX_INTERRUPT_PRIORITY); + + #define SEGGER_RTT_UNLOCK() __set_BASEPRI(LockState); \ + } + #endif +#endif + +/********************************************************************* +* +* RTT lock configuration for IAR RX +*/ +#ifdef __ICCRX__ + #define SEGGER_RTT_LOCK() { \ + unsigned long LockState; \ + LockState = __get_interrupt_state(); \ + __disable_interrupt(); + + #define SEGGER_RTT_UNLOCK() __set_interrupt_state(LockState); \ + } +#endif + +/********************************************************************* +* +* RTT lock configuration for KEIL ARM +*/ +#ifdef __CC_ARM + #if (defined __TARGET_ARCH_6S_M) + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + register unsigned char PRIMASK __asm( "primask"); \ + LockState = PRIMASK; \ + PRIMASK = 1u; \ + __schedule_barrier(); + + #define SEGGER_RTT_UNLOCK() PRIMASK = LockState; \ + __schedule_barrier(); \ + } + #elif (defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M)) + #ifndef SEGGER_RTT_MAX_INTERRUPT_PRIORITY + #define SEGGER_RTT_MAX_INTERRUPT_PRIORITY (0x20) + #endif + #define SEGGER_RTT_LOCK() { \ + unsigned int LockState; \ + register unsigned char BASEPRI __asm( "basepri"); \ + LockState = BASEPRI; \ + BASEPRI = SEGGER_RTT_MAX_INTERRUPT_PRIORITY; \ + __schedule_barrier(); + + #define SEGGER_RTT_UNLOCK() BASEPRI = LockState; \ + __schedule_barrier(); \ + } + #endif +#endif + +/********************************************************************* +* +* RTT lock configuration fallback +*/ +#ifndef SEGGER_RTT_LOCK + #define SEGGER_RTT_LOCK() // Lock RTT (nestable) (i.e. disable interrupts) +#endif + +#ifndef SEGGER_RTT_UNLOCK + #define SEGGER_RTT_UNLOCK() // Unlock RTT (nestable) (i.e. enable previous interrupt lock state) +#endif + +#endif +/*************************** End of file ****************************/ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/BUILD.gn b/gr551x/sdk_liteos/gr551x_sdk/platform/BUILD.gn new file mode 100644 index 0000000..f47be32 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/BUILD.gn @@ -0,0 +1,33 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//kernel/liteos_m/liteos.gni") + +config("public") { + include_dirs = [ + "arch/arm/cortex-m/cmsis/core/include", + "boards", + "include", + "soc/include", + ] +} + +kernel_module("platform") { + sources = [ + "arch/arm/cortex-m/gcc/startup_gr55xx.s", + "boards/board_SK.c", + "soc/common/gr_platform.c", + "soc/common/gr_system.c", + "soc/src/gr_soc.c", + ] +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_compiler.h b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_compiler.h new file mode 100644 index 0000000..adbf296 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_compiler.h @@ -0,0 +1,283 @@ +/**************************************************************************//** + * @file cmsis_compiler.h + * @brief CMSIS compiler generic header file + * @version V5.1.0 + * @date 09. October 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2018 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_COMPILER_H +#define __CMSIS_COMPILER_H + +#include + +/* + * Arm Compiler 4/5 + */ +#if defined ( __CC_ARM ) + #include "cmsis_armcc.h" + + +/* + * Arm Compiler 6.6 LTM (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100) + #include "cmsis_armclang_ltm.h" + + /* + * Arm Compiler above 6.10.1 (armclang) + */ +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100) + #include "cmsis_armclang.h" + + +/* + * GNU Compiler + */ +#elif defined ( __GNUC__ ) + #include "cmsis_gcc.h" + + +/* + * IAR Compiler + */ +#elif defined ( __ICCARM__ ) + #include + + +/* + * TI Arm Compiler + */ +#elif defined ( __TI_ARM__ ) + #include + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __attribute__((packed)) + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed)) + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed)) + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) + #endif + #ifndef __RESTRICT + #define __RESTRICT __restrict + #endif + #ifndef __COMPILER_BARRIER + #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. + #define __COMPILER_BARRIER() (void)0 + #endif + + +/* + * TASKING Compiler + */ +#elif defined ( __TASKING__ ) + /* + * The CMSIS functions have been implemented as intrinsics in the compiler. + * Please use "carm -?i" to get an up to date list of all intrinsics, + * Including the CMSIS ones. + */ + + #ifndef __ASM + #define __ASM __asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + #define __NO_RETURN __attribute__((noreturn)) + #endif + #ifndef __USED + #define __USED __attribute__((used)) + #endif + #ifndef __WEAK + #define __WEAK __attribute__((weak)) + #endif + #ifndef __PACKED + #define __PACKED __packed__ + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __packed__ + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION union __packed__ + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + struct __packed__ T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #define __ALIGNED(x) __align(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + #ifndef __COMPILER_BARRIER + #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. + #define __COMPILER_BARRIER() (void)0 + #endif + + +/* + * COSMIC Compiler + */ +#elif defined ( __CSMC__ ) + #include + + #ifndef __ASM + #define __ASM _asm + #endif + #ifndef __INLINE + #define __INLINE inline + #endif + #ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline + #endif + #ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __STATIC_INLINE + #endif + #ifndef __NO_RETURN + // NO RETURN is automatically detected hence no warning here + #define __NO_RETURN + #endif + #ifndef __USED + #warning No compiler specific solution for __USED. __USED is ignored. + #define __USED + #endif + #ifndef __WEAK + #define __WEAK __weak + #endif + #ifndef __PACKED + #define __PACKED @packed + #endif + #ifndef __PACKED_STRUCT + #define __PACKED_STRUCT @packed struct + #endif + #ifndef __PACKED_UNION + #define __PACKED_UNION @packed union + #endif + #ifndef __UNALIGNED_UINT32 /* deprecated */ + @packed struct T_UINT32 { uint32_t v; }; + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) + #endif + #ifndef __UNALIGNED_UINT16_WRITE + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT16_READ + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) + #endif + #ifndef __UNALIGNED_UINT32_WRITE + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) + #endif + #ifndef __UNALIGNED_UINT32_READ + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) + #endif + #ifndef __ALIGNED + #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. + #define __ALIGNED(x) + #endif + #ifndef __RESTRICT + #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. + #define __RESTRICT + #endif + #ifndef __COMPILER_BARRIER + #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored. + #define __COMPILER_BARRIER() (void)0 + #endif + + +#else + #error Unknown compiler. +#endif + + +#endif /* __CMSIS_COMPILER_H */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_gcc.h b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_gcc.h new file mode 100644 index 0000000..67bda4e --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_gcc.h @@ -0,0 +1,2211 @@ +/**************************************************************************//** + * @file cmsis_gcc.h + * @brief CMSIS compiler GCC header file + * @version V5.4.1 + * @date 27. May 2021 + ******************************************************************************/ +/* + * Copyright (c) 2009-2021 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CMSIS_GCC_H +#define __CMSIS_GCC_H + +/* ignore some GCC warnings */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wunused-parameter" + +/* Fallback for __has_builtin */ +#ifndef __has_builtin + #define __has_builtin(x) (0) +#endif + +/* CMSIS compiler specific defines */ +#ifndef __ASM + #define __ASM __asm +#endif +#ifndef __INLINE + #define __INLINE inline +#endif +#ifndef __STATIC_INLINE + #define __STATIC_INLINE static inline +#endif +#ifndef __STATIC_FORCEINLINE + #define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline +#endif +#ifndef __NO_RETURN + #define __NO_RETURN __attribute__((__noreturn__)) +#endif +#ifndef __USED + #define __USED __attribute__((used)) +#endif +#ifndef __WEAK + #define __WEAK __attribute__((weak)) +#endif +#ifndef __PACKED + #define __PACKED __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_STRUCT + #define __PACKED_STRUCT struct __attribute__((packed, aligned(1))) +#endif +#ifndef __PACKED_UNION + #define __PACKED_UNION union __attribute__((packed, aligned(1))) +#endif +#ifndef __UNALIGNED_UINT32 /* deprecated */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + struct __attribute__((packed)) T_UINT32 { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) +#endif +#ifndef __UNALIGNED_UINT16_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT16_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT16_READ { uint16_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) +#endif +#ifndef __UNALIGNED_UINT32_WRITE + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) +#endif +#ifndef __UNALIGNED_UINT32_READ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpacked" + #pragma GCC diagnostic ignored "-Wattributes" + __PACKED_STRUCT T_UINT32_READ { uint32_t v; }; + #pragma GCC diagnostic pop + #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) +#endif +#ifndef __ALIGNED + #define __ALIGNED(x) __attribute__((aligned(x))) +#endif +#ifndef __RESTRICT + #define __RESTRICT __restrict +#endif +#ifndef __COMPILER_BARRIER + #define __COMPILER_BARRIER() __ASM volatile("":::"memory") +#endif + +/* ######################### Startup and Lowlevel Init ######################## */ + +#ifndef __PROGRAM_START + +/** + \brief Initializes data and bss sections + \details This default implementations initialized all data and additional bss + sections relying on .copy.table and .zero.table specified properly + in the used linker script. + + */ +__STATIC_FORCEINLINE __NO_RETURN void __cmsis_start(void) +{ + extern void _start(void) __NO_RETURN; + + typedef struct { + uint32_t const* src; + uint32_t* dest; + uint32_t wlen; + } __copy_table_t; + + typedef struct { + uint32_t* dest; + uint32_t wlen; + } __zero_table_t; + + extern const __copy_table_t __copy_table_start__; + extern const __copy_table_t __copy_table_end__; + extern const __zero_table_t __zero_table_start__; + extern const __zero_table_t __zero_table_end__; + + for (__copy_table_t const* pTable = &__copy_table_start__; pTable < &__copy_table_end__; ++pTable) { + for(uint32_t i=0u; iwlen; ++i) { + pTable->dest[i] = pTable->src[i]; + } + } + + for (__zero_table_t const* pTable = &__zero_table_start__; pTable < &__zero_table_end__; ++pTable) { + for(uint32_t i=0u; iwlen; ++i) { + pTable->dest[i] = 0u; + } + } + + _start(); +} + +#define __PROGRAM_START __cmsis_start +#endif + +#ifndef __INITIAL_SP +#define __INITIAL_SP __StackTop +#endif + +#ifndef __STACK_LIMIT +#define __STACK_LIMIT __StackLimit +#endif + +#ifndef __VECTOR_TABLE +#define __VECTOR_TABLE __Vectors +#endif + +#ifndef __VECTOR_TABLE_ATTRIBUTE +#define __VECTOR_TABLE_ATTRIBUTE __attribute__((used, section(".vectors"))) +#endif + +#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U) +#ifndef __STACK_SEAL +#define __STACK_SEAL __StackSeal +#endif + +#ifndef __TZ_STACK_SEAL_SIZE +#define __TZ_STACK_SEAL_SIZE 8U +#endif + +#ifndef __TZ_STACK_SEAL_VALUE +#define __TZ_STACK_SEAL_VALUE 0xFEF5EDA5FEF5EDA5ULL +#endif + + +__STATIC_FORCEINLINE void __TZ_set_STACKSEAL_S (uint32_t* stackTop) { + *((uint64_t *)stackTop) = __TZ_STACK_SEAL_VALUE; +} +#endif + + +/* ########################## Core Instruction Access ######################### */ +/** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface + Access to dedicated instructions + @{ +*/ + +/* Define macros for porting to both thumb1 and thumb2. + * For thumb1, use low register (r0-r7), specified by constraint "l" + * Otherwise, use general registers, specified by constraint "r" */ +#if defined (__thumb__) && !defined (__thumb2__) +#define __CMSIS_GCC_OUT_REG(r) "=l" (r) +#define __CMSIS_GCC_RW_REG(r) "+l" (r) +#define __CMSIS_GCC_USE_REG(r) "l" (r) +#else +#define __CMSIS_GCC_OUT_REG(r) "=r" (r) +#define __CMSIS_GCC_RW_REG(r) "+r" (r) +#define __CMSIS_GCC_USE_REG(r) "r" (r) +#endif + +/** + \brief No Operation + \details No Operation does nothing. This instruction can be used for code alignment purposes. + */ +#define __NOP() __ASM volatile ("nop") + +/** + \brief Wait For Interrupt + \details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs. + */ +#define __WFI() __ASM volatile ("wfi":::"memory") + + +/** + \brief Wait For Event + \details Wait For Event is a hint instruction that permits the processor to enter + a low-power state until one of a number of events occurs. + */ +#define __WFE() __ASM volatile ("wfe":::"memory") + + +/** + \brief Send Event + \details Send Event is a hint instruction. It causes an event to be signaled to the CPU. + */ +#define __SEV() __ASM volatile ("sev") + + +/** + \brief Instruction Synchronization Barrier + \details Instruction Synchronization Barrier flushes the pipeline in the processor, + so that all instructions following the ISB are fetched from cache or memory, + after the instruction has been completed. + */ +__STATIC_FORCEINLINE void __ISB(void) +{ + __ASM volatile ("isb 0xF":::"memory"); +} + + +/** + \brief Data Synchronization Barrier + \details Acts as a special kind of Data Memory Barrier. + It completes when all explicit memory accesses before this instruction complete. + */ +__STATIC_FORCEINLINE void __DSB(void) +{ + __ASM volatile ("dsb 0xF":::"memory"); +} + + +/** + \brief Data Memory Barrier + \details Ensures the apparent order of the explicit memory operations before + and after the instruction, without ensuring their completion. + */ +__STATIC_FORCEINLINE void __DMB(void) +{ + __ASM volatile ("dmb 0xF":::"memory"); +} + + +/** + \brief Reverse byte order (32 bit) + \details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV(uint32_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + return __builtin_bswap32(value); +#else + uint32_t result; + + __ASM ("rev %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __REV16(uint32_t value) +{ + uint32_t result; + + __ASM ("rev16 %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +} + + +/** + \brief Reverse byte order (16 bit) + \details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE int16_t __REVSH(int16_t value) +{ +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + return (int16_t)__builtin_bswap16(value); +#else + int16_t result; + + __ASM ("revsh %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return result; +#endif +} + + +/** + \brief Rotate Right in unsigned value (32 bit) + \details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits. + \param [in] op1 Value to rotate + \param [in] op2 Number of Bits to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2) +{ + op2 %= 32U; + if (op2 == 0U) + { + return op1; + } + return (op1 >> op2) | (op1 << (32U - op2)); +} + + +/** + \brief Breakpoint + \details Causes the processor to enter Debug state. + Debug tools can use this to investigate system state when the instruction at a particular address is reached. + \param [in] value is ignored by the processor. + If required, a debugger can use it to store additional information about the breakpoint. + */ +#define __BKPT(value) __ASM volatile ("bkpt "#value) + + +/** + \brief Reverse bit order of value + \details Reverses the bit order of the given value. + \param [in] value Value to reverse + \return Reversed value + */ +__STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value) +{ + uint32_t result; + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) + __ASM ("rbit %0, %1" : "=r" (result) : "r" (value) ); +#else + uint32_t s = (4U /*sizeof(v)*/ * 8U) - 1U; /* extra shift needed at end */ + + result = value; /* r will be reversed bits of v; first get LSB of v */ + for (value >>= 1U; value != 0U; value >>= 1U) + { + result <<= 1U; + result |= value & 1U; + s--; + } + result <<= s; /* shift when v's highest bits are zero */ +#endif + return result; +} + + +/** + \brief Count leading zeros + \details Counts the number of leading zeros of a data value. + \param [in] value Value to count the leading zeros + \return number of leading zeros in value + */ +__STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value) +{ + /* Even though __builtin_clz produces a CLZ instruction on ARM, formally + __builtin_clz(0) is undefined behaviour, so handle this case specially. + This guarantees ARM-compatible results if happening to compile on a non-ARM + target, and ensures the compiler doesn't decide to activate any + optimisations using the logic "value was passed to __builtin_clz, so it + is non-zero". + ARM GCC 7.3 and possibly earlier will optimise this test away, leaving a + single CLZ instruction. + */ + if (value == 0U) + { + return 32U; + } + return __builtin_clz(value); +} + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief LDR Exclusive (8 bit) + \details Executes a exclusive LDR instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexb %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexb %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (16 bit) + \details Executes a exclusive LDR instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrexh %0, %1" : "=r" (result) : "Q" (*addr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrexh %0, [%1]" : "=r" (result) : "r" (addr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDR Exclusive (32 bit) + \details Executes a exclusive LDR instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("ldrex %0, %1" : "=r" (result) : "Q" (*addr) ); + return(result); +} + + +/** + \brief STR Exclusive (8 bit) + \details Executes a exclusive STR instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexb %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (16 bit) + \details Executes a exclusive STR instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t *addr) +{ + uint32_t result; + + __ASM volatile ("strexh %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" ((uint32_t)value) ); + return(result); +} + + +/** + \brief STR Exclusive (32 bit) + \details Executes a exclusive STR instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t *addr) +{ + uint32_t result; + + __ASM volatile ("strex %0, %2, %1" : "=&r" (result), "=Q" (*addr) : "r" (value) ); + return(result); +} + + +/** + \brief Remove the exclusive lock + \details Removes the exclusive lock which is created by LDREX. + */ +__STATIC_FORCEINLINE void __CLREX(void) +{ + __ASM volatile ("clrex" ::: "memory"); +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (1..32) + \return Saturated value + */ +#define __SSAT(ARG1, ARG2) \ +__extension__ \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM volatile ("ssat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) : "cc" ); \ + __RES; \ + }) + + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] ARG1 Value to be saturated + \param [in] ARG2 Bit position to saturate to (0..31) + \return Saturated value + */ +#define __USAT(ARG1, ARG2) \ +__extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM volatile ("usat %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) : "cc" ); \ + __RES; \ + }) + + +/** + \brief Rotate Right with Extend (32 bit) + \details Moves each bit of a bitstring right by one bit. + The carry input is shifted in at the left end of the bitstring. + \param [in] value Value to rotate + \return Rotated value + */ +__STATIC_FORCEINLINE uint32_t __RRX(uint32_t value) +{ + uint32_t result; + + __ASM volatile ("rrx %0, %1" : __CMSIS_GCC_OUT_REG (result) : __CMSIS_GCC_USE_REG (value) ); + return(result); +} + + +/** + \brief LDRT Unprivileged (8 bit) + \details Executes a Unprivileged LDRT instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrbt %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrbt %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint8_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (16 bit) + \details Executes a Unprivileged LDRT instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr) +{ + uint32_t result; + +#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) + __ASM volatile ("ldrht %0, %1" : "=r" (result) : "Q" (*ptr) ); +#else + /* Prior to GCC 4.8, "Q" will be expanded to [rx, #0] which is not + accepted by assembler. So has to use following less efficient pattern. + */ + __ASM volatile ("ldrht %0, [%1]" : "=r" (result) : "r" (ptr) : "memory" ); +#endif + return ((uint16_t) result); /* Add explicit type cast here */ +} + + +/** + \brief LDRT Unprivileged (32 bit) + \details Executes a Unprivileged LDRT instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldrt %0, %1" : "=r" (result) : "Q" (*ptr) ); + return(result); +} + + +/** + \brief STRT Unprivileged (8 bit) + \details Executes a Unprivileged STRT instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("strbt %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (16 bit) + \details Executes a Unprivileged STRT instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("strht %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) ); +} + + +/** + \brief STRT Unprivileged (32 bit) + \details Executes a Unprivileged STRT instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("strt %1, %0" : "=Q" (*ptr) : "r" (value) ); +} + +#else /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + +/** + \brief Signed Saturate + \details Saturates a signed value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (1..32) + \return Saturated value + */ +__STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat) +{ + if ((sat >= 1U) && (sat <= 32U)) + { + const int32_t max = (int32_t)((1U << (sat - 1U)) - 1U); + const int32_t min = -1 - max ; + if (val > max) + { + return max; + } + else if (val < min) + { + return min; + } + } + return val; +} + +/** + \brief Unsigned Saturate + \details Saturates an unsigned value. + \param [in] value Value to be saturated + \param [in] sat Bit position to saturate to (0..31) + \return Saturated value + */ +__STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat) +{ + if (sat <= 31U) + { + const uint32_t max = ((1U << sat) - 1U); + if (val > (int32_t)max) + { + return max; + } + else if (val < 0) + { + return 0U; + } + } + return (uint32_t)val; +} + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) +/** + \brief Load-Acquire (8 bit) + \details Executes a LDAB instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldab %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire (16 bit) + \details Executes a LDAH instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldah %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire (32 bit) + \details Executes a LDA instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("lda %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return(result); +} + + +/** + \brief Store-Release (8 bit) + \details Executes a STLB instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr) +{ + __ASM volatile ("stlb %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); +} + + +/** + \brief Store-Release (16 bit) + \details Executes a STLH instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr) +{ + __ASM volatile ("stlh %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); +} + + +/** + \brief Store-Release (32 bit) + \details Executes a STL instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + */ +__STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr) +{ + __ASM volatile ("stl %1, %0" : "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); +} + + +/** + \brief Load-Acquire Exclusive (8 bit) + \details Executes a LDAB exclusive instruction for 8 bit value. + \param [in] ptr Pointer to data + \return value of type uint8_t at (*ptr) + */ +__STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexb %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return ((uint8_t) result); +} + + +/** + \brief Load-Acquire Exclusive (16 bit) + \details Executes a LDAH exclusive instruction for 16 bit values. + \param [in] ptr Pointer to data + \return value of type uint16_t at (*ptr) + */ +__STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaexh %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return ((uint16_t) result); +} + + +/** + \brief Load-Acquire Exclusive (32 bit) + \details Executes a LDA exclusive instruction for 32 bit values. + \param [in] ptr Pointer to data + \return value of type uint32_t at (*ptr) + */ +__STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("ldaex %0, %1" : "=r" (result) : "Q" (*ptr) : "memory" ); + return(result); +} + + +/** + \brief Store-Release Exclusive (8 bit) + \details Executes a STLB exclusive instruction for 8 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexb %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); + return(result); +} + + +/** + \brief Store-Release Exclusive (16 bit) + \details Executes a STLH exclusive instruction for 16 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlexh %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); + return(result); +} + + +/** + \brief Store-Release Exclusive (32 bit) + \details Executes a STL exclusive instruction for 32 bit values. + \param [in] value Value to store + \param [in] ptr Pointer to location + \return 0 Function succeeded + \return 1 Function failed + */ +__STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr) +{ + uint32_t result; + + __ASM volatile ("stlex %0, %2, %1" : "=&r" (result), "=Q" (*ptr) : "r" ((uint32_t)value) : "memory" ); + return(result); +} + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + +/*@}*/ /* end of group CMSIS_Core_InstructionInterface */ + + +/* ########################### Core Function Access ########################### */ +/** \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions + @{ + */ + +/** + \brief Enable IRQ Interrupts + \details Enables IRQ interrupts by clearing special-purpose register PRIMASK. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_irq(void) +{ + __ASM volatile ("cpsie i" : : : "memory"); +} + + +/** + \brief Disable IRQ Interrupts + \details Disables IRQ interrupts by setting special-purpose register PRIMASK. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_irq(void) +{ + __ASM volatile ("cpsid i" : : : "memory"); +} + + +/** + \brief Get Control Register + \details Returns the content of the Control Register. + \return Control Register value + */ +__STATIC_FORCEINLINE uint32_t __get_CONTROL(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Control Register (non-secure) + \details Returns the content of the non-secure Control Register when in secure mode. + \return non-secure Control Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, control_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Control Register + \details Writes the given value to the Control Register. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __set_CONTROL(uint32_t control) +{ + __ASM volatile ("MSR control, %0" : : "r" (control) : "memory"); + __ISB(); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Control Register (non-secure) + \details Writes the given value to the non-secure Control Register when in secure state. + \param [in] control Control Register value to set + */ +__STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control) +{ + __ASM volatile ("MSR control_ns, %0" : : "r" (control) : "memory"); + __ISB(); +} +#endif + + +/** + \brief Get IPSR Register + \details Returns the content of the IPSR Register. + \return IPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_IPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, ipsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get APSR Register + \details Returns the content of the APSR Register. + \return APSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_APSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, apsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get xPSR Register + \details Returns the content of the xPSR Register. + \return xPSR Register value + */ +__STATIC_FORCEINLINE uint32_t __get_xPSR(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, xpsr" : "=r" (result) ); + return(result); +} + + +/** + \brief Get Process Stack Pointer + \details Returns the current value of the Process Stack Pointer (PSP). + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer (non-secure) + \details Returns the current value of the non-secure Process Stack Pointer (PSP) when in secure state. + \return PSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, psp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Process Stack Pointer + \details Assigns the given value to the Process Stack Pointer (PSP). + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp, %0" : : "r" (topOfProcStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Process Stack Pointer (PSP) when in secure state. + \param [in] topOfProcStack Process Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack) +{ + __ASM volatile ("MSR psp_ns, %0" : : "r" (topOfProcStack) : ); +} +#endif + + +/** + \brief Get Main Stack Pointer + \details Returns the current value of the Main Stack Pointer (MSP). + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSP(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer (non-secure) + \details Returns the current value of the non-secure Main Stack Pointer (MSP) when in secure state. + \return MSP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, msp_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Main Stack Pointer + \details Assigns the given value to the Main Stack Pointer (MSP). + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp, %0" : : "r" (topOfMainStack) : ); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Main Stack Pointer (MSP) when in secure state. + \param [in] topOfMainStack Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack) +{ + __ASM volatile ("MSR msp_ns, %0" : : "r" (topOfMainStack) : ); +} +#endif + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Stack Pointer (non-secure) + \details Returns the current value of the non-secure Stack Pointer (SP) when in secure state. + \return SP Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, sp_ns" : "=r" (result) ); + return(result); +} + + +/** + \brief Set Stack Pointer (non-secure) + \details Assigns the given value to the non-secure Stack Pointer (SP) when in secure state. + \param [in] topOfStack Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack) +{ + __ASM volatile ("MSR sp_ns, %0" : : "r" (topOfStack) : ); +} +#endif + + +/** + \brief Get Priority Mask + \details Returns the current state of the priority mask bit from the Priority Mask Register. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Priority Mask (non-secure) + \details Returns the current state of the non-secure priority mask bit from the Priority Mask Register when in secure state. + \return Priority Mask value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, primask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Priority Mask + \details Assigns the given value to the Priority Mask Register. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask) +{ + __ASM volatile ("MSR primask, %0" : : "r" (priMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Priority Mask (non-secure) + \details Assigns the given value to the non-secure Priority Mask Register when in secure state. + \param [in] priMask Priority Mask + */ +__STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask) +{ + __ASM volatile ("MSR primask_ns, %0" : : "r" (priMask) : "memory"); +} +#endif + + +#if ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) +/** + \brief Enable FIQ + \details Enables FIQ interrupts by clearing special-purpose register FAULTMASK. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __enable_fault_irq(void) +{ + __ASM volatile ("cpsie f" : : : "memory"); +} + + +/** + \brief Disable FIQ + \details Disables FIQ interrupts by setting special-purpose register FAULTMASK. + Can only be executed in Privileged modes. + */ +__STATIC_FORCEINLINE void __disable_fault_irq(void) +{ + __ASM volatile ("cpsid f" : : : "memory"); +} + + +/** + \brief Get Base Priority + \details Returns the current value of the Base Priority register. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __get_BASEPRI(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Base Priority (non-secure) + \details Returns the current value of the non-secure Base Priority register when in secure state. + \return Base Priority register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, basepri_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Base Priority + \details Assigns the given value to the Base Priority register. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri) +{ + __ASM volatile ("MSR basepri, %0" : : "r" (basePri) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Base Priority (non-secure) + \details Assigns the given value to the non-secure Base Priority register when in secure state. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_ns, %0" : : "r" (basePri) : "memory"); +} +#endif + + +/** + \brief Set Base Priority with condition + \details Assigns the given value to the Base Priority register only if BASEPRI masking is disabled, + or the new value increases the BASEPRI priority level. + \param [in] basePri Base Priority value to set + */ +__STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri) +{ + __ASM volatile ("MSR basepri_max, %0" : : "r" (basePri) : "memory"); +} + + +/** + \brief Get Fault Mask + \details Returns the current value of the Fault Mask register. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask" : "=r" (result) ); + return(result); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Fault Mask (non-secure) + \details Returns the current value of the non-secure Fault Mask register when in secure state. + \return Fault Mask register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void) +{ + uint32_t result; + + __ASM volatile ("MRS %0, faultmask_ns" : "=r" (result) ); + return(result); +} +#endif + + +/** + \brief Set Fault Mask + \details Assigns the given value to the Fault Mask register. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask, %0" : : "r" (faultMask) : "memory"); +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Fault Mask (non-secure) + \details Assigns the given value to the non-secure Fault Mask register when in secure state. + \param [in] faultMask Fault Mask value to set + */ +__STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask) +{ + __ASM volatile ("MSR faultmask_ns, %0" : : "r" (faultMask) : "memory"); +} +#endif + +#endif /* ((defined (__ARM_ARCH_7M__ ) && (__ARM_ARCH_7M__ == 1)) || \ + (defined (__ARM_ARCH_7EM__ ) && (__ARM_ARCH_7EM__ == 1)) || \ + (defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) ) */ + + +#if ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) + +/** + \brief Get Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Process Stack Pointer Limit (PSPLIM). + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_PSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim" : "=r" (result) ); + return result; +#endif +} + +#if (defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Process Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \return PSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, psplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Process Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM). + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim, %0" : : "r" (ProcStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Process Stack Pointer (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Process Stack Pointer Limit (PSPLIM) when in secure state. + \param [in] ProcStackPtrLimit Process Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure PSPLIM is RAZ/WI + (void)ProcStackPtrLimit; +#else + __ASM volatile ("MSR psplim_ns, %0\n" : : "r" (ProcStackPtrLimit)); +#endif +} +#endif + + +/** + \brief Get Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always in non-secure + mode. + + \details Returns the current value of the Main Stack Pointer Limit (MSPLIM). + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __get_MSPLIM(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim" : "=r" (result) ); + return result; +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Get Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence zero is returned always. + + \details Returns the current value of the non-secure Main Stack Pointer Limit(MSPLIM) when in secure state. + \return MSPLIM Register value + */ +__STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + return 0U; +#else + uint32_t result; + __ASM volatile ("MRS %0, msplim_ns" : "=r" (result) ); + return result; +#endif +} +#endif + + +/** + \brief Set Main Stack Pointer Limit + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored in non-secure + mode. + + \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM). + \param [in] MainStackPtrLimit Main Stack Pointer Limit value to set + */ +__STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) && \ + (!defined (__ARM_FEATURE_CMSE) || (__ARM_FEATURE_CMSE < 3))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim, %0" : : "r" (MainStackPtrLimit)); +#endif +} + + +#if (defined (__ARM_FEATURE_CMSE ) && (__ARM_FEATURE_CMSE == 3)) +/** + \brief Set Main Stack Pointer Limit (non-secure) + Devices without ARMv8-M Main Extensions (i.e. Cortex-M23) lack the non-secure + Stack Pointer Limit register hence the write is silently ignored. + + \details Assigns the given value to the non-secure Main Stack Pointer Limit (MSPLIM) when in secure state. + \param [in] MainStackPtrLimit Main Stack Pointer value to set + */ +__STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit) +{ +#if (!(defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1))) + // without main extensions, the non-secure MSPLIM is RAZ/WI + (void)MainStackPtrLimit; +#else + __ASM volatile ("MSR msplim_ns, %0" : : "r" (MainStackPtrLimit)); +#endif +} +#endif + +#endif /* ((defined (__ARM_ARCH_8M_MAIN__ ) && (__ARM_ARCH_8M_MAIN__ == 1)) || \ + (defined (__ARM_ARCH_8M_BASE__ ) && (__ARM_ARCH_8M_BASE__ == 1)) ) */ + + +/** + \brief Get FPSCR + \details Returns the current value of the Floating Point Status/Control register. + \return Floating Point Status/Control register value + */ +__STATIC_FORCEINLINE uint32_t __get_FPSCR(void) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_get_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + return __builtin_arm_get_fpscr(); +#else + uint32_t result; + + __ASM volatile ("VMRS %0, fpscr" : "=r" (result) ); + return(result); +#endif +#else + return(0U); +#endif +} + + +/** + \brief Set FPSCR + \details Assigns the given value to the Floating Point Status/Control register. + \param [in] fpscr Floating Point Status/Control value to set + */ +__STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr) +{ +#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \ + (defined (__FPU_USED ) && (__FPU_USED == 1U)) ) +#if __has_builtin(__builtin_arm_set_fpscr) +// Re-enable using built-in when GCC has been fixed +// || (__GNUC__ > 7) || (__GNUC__ == 7 && __GNUC_MINOR__ >= 2) + /* see https://gcc.gnu.org/ml/gcc-patches/2017-04/msg00443.html */ + __builtin_arm_set_fpscr(fpscr); +#else + __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory"); +#endif +#else + (void)fpscr; +#endif +} + + +/*@} end of CMSIS_Core_RegAccFunctions */ + + +/* ################### Compiler specific Intrinsics ########################### */ +/** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics + Access to dedicated SIMD instructions + @{ +*/ + +#if (defined (__ARM_FEATURE_DSP) && (__ARM_FEATURE_DSP == 1)) + +__STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhadd8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhsub8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +__STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhadd16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhsub16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("uasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhasx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("ssax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("qsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("shsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("usax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uqsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uhsax %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("usad8 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM ("usada8 %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#define __SSAT16(ARG1, ARG2) \ +__extension__ \ +({ \ + int32_t __RES, __ARG1 = (ARG1); \ + __ASM volatile ("ssat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) : "cc" ); \ + __RES; \ + }) + +#define __USAT16(ARG1, ARG2) \ +__extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1); \ + __ASM volatile ("usat16 %0, %1, %2" : "=r" (__RES) : "I" (ARG2), "r" (__ARG1) : "cc" ); \ + __RES; \ + }) + +__STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM ("uxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("uxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1) +{ + uint32_t result; + + __ASM ("sxtb16 %0, %1" : "=r" (result) : "r" (op1)); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTB16_RORn(uint32_t op1, uint32_t rotate) +{ + uint32_t result; + if (__builtin_constant_p(rotate) && ((rotate == 8U) || (rotate == 16U) || (rotate == 24U))) { + __ASM volatile ("sxtb16 %0, %1, ROR %2" : "=r" (result) : "r" (op1), "i" (rotate) ); + } else { + result = __SXTB16(__ROR(op1, rotate)) ; + } + return result; +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM ("sxtab16 %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SXTAB16_RORn(uint32_t op1, uint32_t op2, uint32_t rotate) +{ + uint32_t result; + if (__builtin_constant_p(rotate) && ((rotate == 8U) || (rotate == 16U) || (rotate == 24U))) { + __ASM volatile ("sxtab16 %0, %1, %2, ROR %3" : "=r" (result) : "r" (op1) , "r" (op2) , "i" (rotate)); + } else { + result = __SXTAB16(op1, __ROR(op2, rotate)); + } + return result; +} + + +__STATIC_FORCEINLINE uint32_t __SMUAD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuad %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smuadx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlad %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smladx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlald %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlaldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SMUSD (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("smusdx %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsd %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint32_t op3) +{ + uint32_t result; + + __ASM volatile ("smlsdx %0, %1, %2, %3" : "=r" (result) : "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsld %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uint64_t acc) +{ + union llreg_u{ + uint32_t w32[2]; + uint64_t w64; + } llr; + llr.w64 = acc; + +#ifndef __ARMEB__ /* Little endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[0]), "=r" (llr.w32[1]): "r" (op1), "r" (op2) , "0" (llr.w32[0]), "1" (llr.w32[1]) ); +#else /* Big endian */ + __ASM volatile ("smlsldx %0, %1, %2, %3" : "=r" (llr.w32[1]), "=r" (llr.w32[0]): "r" (op1), "r" (op2) , "0" (llr.w32[1]), "1" (llr.w32[0]) ); +#endif + + return(llr.w64); +} + +__STATIC_FORCEINLINE uint32_t __SEL (uint32_t op1, uint32_t op2) +{ + uint32_t result; + + __ASM volatile ("sel %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QADD( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qadd %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + +__STATIC_FORCEINLINE int32_t __QSUB( int32_t op1, int32_t op2) +{ + int32_t result; + + __ASM volatile ("qsub %0, %1, %2" : "=r" (result) : "r" (op1), "r" (op2) ); + return(result); +} + + +#define __PKHBT(ARG1,ARG2,ARG3) \ +__extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + __ASM ("pkhbt %0, %1, %2, lsl %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + +#define __PKHTB(ARG1,ARG2,ARG3) \ +__extension__ \ +({ \ + uint32_t __RES, __ARG1 = (ARG1), __ARG2 = (ARG2); \ + if (ARG3 == 0) \ + __ASM ("pkhtb %0, %1, %2" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2) ); \ + else \ + __ASM ("pkhtb %0, %1, %2, asr %3" : "=r" (__RES) : "r" (__ARG1), "r" (__ARG2), "I" (ARG3) ); \ + __RES; \ + }) + + +__STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t op3) +{ + int32_t result; + + __ASM ("smmla %0, %1, %2, %3" : "=r" (result): "r" (op1), "r" (op2), "r" (op3) ); + return(result); +} + +#endif /* (__ARM_FEATURE_DSP == 1) */ +/*@} end of group CMSIS_SIMD_intrinsics */ + + +#pragma GCC diagnostic pop + +#endif /* __CMSIS_GCC_H */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_version.h b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_version.h new file mode 100644 index 0000000..8b4765f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/cmsis_version.h @@ -0,0 +1,39 @@ +/**************************************************************************//** + * @file cmsis_version.h + * @brief CMSIS Core(M) Version definitions + * @version V5.0.5 + * @date 02. February 2022 + ******************************************************************************/ +/* + * Copyright (c) 2009-2022 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CMSIS_VERSION_H +#define __CMSIS_VERSION_H + +/* CMSIS Version definitions */ +#define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */ +#define __CM_CMSIS_VERSION_SUB ( 6U) /*!< [15:0] CMSIS Core(M) sub version */ +#define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \ + __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */ +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/core_cm4.h b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/core_cm4.h new file mode 100644 index 0000000..e21cd14 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/core_cm4.h @@ -0,0 +1,2129 @@ +/**************************************************************************//** + * @file core_cm4.h + * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Header File + * @version V5.1.2 + * @date 04. June 2021 + ******************************************************************************/ +/* + * Copyright (c) 2009-2020 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef __CORE_CM4_H_GENERIC +#define __CORE_CM4_H_GENERIC + +#include + +#ifdef __cplusplus + extern "C" { +#endif + +/** + \page CMSIS_MISRA_Exceptions MISRA-C:2004 Compliance Exceptions + CMSIS violates the following MISRA-C:2004 rules: + + \li Required Rule 8.5, object/function definition in header file.
+ Function definitions in header files are used to allow 'inlining'. + + \li Required Rule 18.4, declaration of union type or object of union type: '{...}'.
+ Unions are used for effective representation of core registers. + + \li Advisory Rule 19.7, Function-like macro defined.
+ Function-like macros are used to allow more efficient code. + */ + + +/******************************************************************************* + * CMSIS definitions + ******************************************************************************/ +/** + \ingroup Cortex_M4 + @{ + */ + +#include "cmsis_version.h" + +/* CMSIS CM4 definitions */ +#define __CM4_CMSIS_VERSION_MAIN (__CM_CMSIS_VERSION_MAIN) /*!< \deprecated [31:16] CMSIS HAL main version */ +#define __CM4_CMSIS_VERSION_SUB (__CM_CMSIS_VERSION_SUB) /*!< \deprecated [15:0] CMSIS HAL sub version */ +#define __CM4_CMSIS_VERSION ((__CM4_CMSIS_VERSION_MAIN << 16U) | \ + __CM4_CMSIS_VERSION_SUB ) /*!< \deprecated CMSIS HAL version number */ + +#define __CORTEX_M (4U) /*!< Cortex-M Core */ + +/** __FPU_USED indicates whether an FPU is used or not. + For this, __FPU_PRESENT has to be checked prior to making use of FPU specific registers and functions. +*/ +#if defined ( __CC_ARM ) + #if defined __TARGET_FPU_VFP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #if defined __ARM_FP + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #warning "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __GNUC__ ) + #if defined (__VFP_FP__) && !defined(__SOFTFP__) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __ICCARM__ ) + #if defined __ARMVFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TI_ARM__ ) + #if defined __TI_VFP_SUPPORT__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __TASKING__ ) + #if defined __FPU_VFP__ + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#elif defined ( __CSMC__ ) + #if ( __CSMC__ & 0x400U) + #if defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U) + #define __FPU_USED 1U + #else + #error "Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)" + #define __FPU_USED 0U + #endif + #else + #define __FPU_USED 0U + #endif + +#endif + +#include "cmsis_compiler.h" /* CMSIS compiler specific defines */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_GENERIC */ + +#ifndef __CMSIS_GENERIC + +#ifndef __CORE_CM4_H_DEPENDANT +#define __CORE_CM4_H_DEPENDANT + +#ifdef __cplusplus + extern "C" { +#endif + +/* check device defines and use defaults */ +#if defined __CHECK_DEVICE_DEFINES + #ifndef __CM4_REV + #define __CM4_REV 0x0000U + #warning "__CM4_REV not defined in device header file; using default!" + #endif + + #ifndef __FPU_PRESENT + #define __FPU_PRESENT 0U + #warning "__FPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __MPU_PRESENT + #define __MPU_PRESENT 0U + #warning "__MPU_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __VTOR_PRESENT + #define __VTOR_PRESENT 1U + #warning "__VTOR_PRESENT not defined in device header file; using default!" + #endif + + #ifndef __NVIC_PRIO_BITS + #define __NVIC_PRIO_BITS 3U + #warning "__NVIC_PRIO_BITS not defined in device header file; using default!" + #endif + + #ifndef __Vendor_SysTickConfig + #define __Vendor_SysTickConfig 0U + #warning "__Vendor_SysTickConfig not defined in device header file; using default!" + #endif +#endif + +/* IO definitions (access restrictions to peripheral registers) */ +/** + \defgroup CMSIS_glob_defs CMSIS Global Defines + + IO Type Qualifiers are used + \li to specify the access to peripheral variables. + \li for automatic generation of peripheral register debug information. +*/ +#ifdef __cplusplus + #define __I volatile /*!< Defines 'read only' permissions */ +#else + #define __I volatile const /*!< Defines 'read only' permissions */ +#endif +#define __O volatile /*!< Defines 'write only' permissions */ +#define __IO volatile /*!< Defines 'read / write' permissions */ + +/* following defines should be used for structure members */ +#define __IM volatile const /*! Defines 'read only' structure member permissions */ +#define __OM volatile /*! Defines 'write only' structure member permissions */ +#define __IOM volatile /*! Defines 'read / write' structure member permissions */ + +/*@} end of group Cortex_M4 */ + + + +/******************************************************************************* + * Register Abstraction + Core Register contain: + - Core Register + - Core NVIC Register + - Core SCB Register + - Core SysTick Register + - Core Debug Register + - Core MPU Register + - Core FPU Register + ******************************************************************************/ +/** + \defgroup CMSIS_core_register Defines and Type Definitions + \brief Type definitions and defines for Cortex-M processor based devices. +*/ + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CORE Status and Control Registers + \brief Core Register type definitions. + @{ + */ + +/** + \brief Union type to access the Application Program Status Register (APSR). + */ +typedef union +{ + struct + { + uint32_t _reserved0:16; /*!< bit: 0..15 Reserved */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:7; /*!< bit: 20..26 Reserved */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} APSR_Type; + +/* APSR Register Definitions */ +#define APSR_N_Pos 31U /*!< APSR: N Position */ +#define APSR_N_Msk (1UL << APSR_N_Pos) /*!< APSR: N Mask */ + +#define APSR_Z_Pos 30U /*!< APSR: Z Position */ +#define APSR_Z_Msk (1UL << APSR_Z_Pos) /*!< APSR: Z Mask */ + +#define APSR_C_Pos 29U /*!< APSR: C Position */ +#define APSR_C_Msk (1UL << APSR_C_Pos) /*!< APSR: C Mask */ + +#define APSR_V_Pos 28U /*!< APSR: V Position */ +#define APSR_V_Msk (1UL << APSR_V_Pos) /*!< APSR: V Mask */ + +#define APSR_Q_Pos 27U /*!< APSR: Q Position */ +#define APSR_Q_Msk (1UL << APSR_Q_Pos) /*!< APSR: Q Mask */ + +#define APSR_GE_Pos 16U /*!< APSR: GE Position */ +#define APSR_GE_Msk (0xFUL << APSR_GE_Pos) /*!< APSR: GE Mask */ + + +/** + \brief Union type to access the Interrupt Program Status Register (IPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:23; /*!< bit: 9..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} IPSR_Type; + +/* IPSR Register Definitions */ +#define IPSR_ISR_Pos 0U /*!< IPSR: ISR Position */ +#define IPSR_ISR_Msk (0x1FFUL /*<< IPSR_ISR_Pos*/) /*!< IPSR: ISR Mask */ + + +/** + \brief Union type to access the Special-Purpose Program Status Registers (xPSR). + */ +typedef union +{ + struct + { + uint32_t ISR:9; /*!< bit: 0.. 8 Exception number */ + uint32_t _reserved0:1; /*!< bit: 9 Reserved */ + uint32_t ICI_IT_1:6; /*!< bit: 10..15 ICI/IT part 1 */ + uint32_t GE:4; /*!< bit: 16..19 Greater than or Equal flags */ + uint32_t _reserved1:4; /*!< bit: 20..23 Reserved */ + uint32_t T:1; /*!< bit: 24 Thumb bit */ + uint32_t ICI_IT_2:2; /*!< bit: 25..26 ICI/IT part 2 */ + uint32_t Q:1; /*!< bit: 27 Saturation condition flag */ + uint32_t V:1; /*!< bit: 28 Overflow condition code flag */ + uint32_t C:1; /*!< bit: 29 Carry condition code flag */ + uint32_t Z:1; /*!< bit: 30 Zero condition code flag */ + uint32_t N:1; /*!< bit: 31 Negative condition code flag */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} xPSR_Type; + +/* xPSR Register Definitions */ +#define xPSR_N_Pos 31U /*!< xPSR: N Position */ +#define xPSR_N_Msk (1UL << xPSR_N_Pos) /*!< xPSR: N Mask */ + +#define xPSR_Z_Pos 30U /*!< xPSR: Z Position */ +#define xPSR_Z_Msk (1UL << xPSR_Z_Pos) /*!< xPSR: Z Mask */ + +#define xPSR_C_Pos 29U /*!< xPSR: C Position */ +#define xPSR_C_Msk (1UL << xPSR_C_Pos) /*!< xPSR: C Mask */ + +#define xPSR_V_Pos 28U /*!< xPSR: V Position */ +#define xPSR_V_Msk (1UL << xPSR_V_Pos) /*!< xPSR: V Mask */ + +#define xPSR_Q_Pos 27U /*!< xPSR: Q Position */ +#define xPSR_Q_Msk (1UL << xPSR_Q_Pos) /*!< xPSR: Q Mask */ + +#define xPSR_ICI_IT_2_Pos 25U /*!< xPSR: ICI/IT part 2 Position */ +#define xPSR_ICI_IT_2_Msk (3UL << xPSR_ICI_IT_2_Pos) /*!< xPSR: ICI/IT part 2 Mask */ + +#define xPSR_T_Pos 24U /*!< xPSR: T Position */ +#define xPSR_T_Msk (1UL << xPSR_T_Pos) /*!< xPSR: T Mask */ + +#define xPSR_GE_Pos 16U /*!< xPSR: GE Position */ +#define xPSR_GE_Msk (0xFUL << xPSR_GE_Pos) /*!< xPSR: GE Mask */ + +#define xPSR_ICI_IT_1_Pos 10U /*!< xPSR: ICI/IT part 1 Position */ +#define xPSR_ICI_IT_1_Msk (0x3FUL << xPSR_ICI_IT_1_Pos) /*!< xPSR: ICI/IT part 1 Mask */ + +#define xPSR_ISR_Pos 0U /*!< xPSR: ISR Position */ +#define xPSR_ISR_Msk (0x1FFUL /*<< xPSR_ISR_Pos*/) /*!< xPSR: ISR Mask */ + + +/** + \brief Union type to access the Control Registers (CONTROL). + */ +typedef union +{ + struct + { + uint32_t nPRIV:1; /*!< bit: 0 Execution privilege in Thread mode */ + uint32_t SPSEL:1; /*!< bit: 1 Stack to be used */ + uint32_t FPCA:1; /*!< bit: 2 FP extension active flag */ + uint32_t _reserved0:29; /*!< bit: 3..31 Reserved */ + } b; /*!< Structure used for bit access */ + uint32_t w; /*!< Type used for word access */ +} CONTROL_Type; + +/* CONTROL Register Definitions */ +#define CONTROL_FPCA_Pos 2U /*!< CONTROL: FPCA Position */ +#define CONTROL_FPCA_Msk (1UL << CONTROL_FPCA_Pos) /*!< CONTROL: FPCA Mask */ + +#define CONTROL_SPSEL_Pos 1U /*!< CONTROL: SPSEL Position */ +#define CONTROL_SPSEL_Msk (1UL << CONTROL_SPSEL_Pos) /*!< CONTROL: SPSEL Mask */ + +#define CONTROL_nPRIV_Pos 0U /*!< CONTROL: nPRIV Position */ +#define CONTROL_nPRIV_Msk (1UL /*<< CONTROL_nPRIV_Pos*/) /*!< CONTROL: nPRIV Mask */ + +/*@} end of group CMSIS_CORE */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_NVIC Nested Vectored Interrupt Controller (NVIC) + \brief Type definitions for the NVIC Registers + @{ + */ + +/** + \brief Structure type to access the Nested Vectored Interrupt Controller (NVIC). + */ +typedef struct +{ + __IOM uint32_t ISER[8U]; /*!< Offset: 0x000 (R/W) Interrupt Set Enable Register */ + uint32_t RESERVED0[24U]; + __IOM uint32_t ICER[8U]; /*!< Offset: 0x080 (R/W) Interrupt Clear Enable Register */ + uint32_t RESERVED1[24U]; + __IOM uint32_t ISPR[8U]; /*!< Offset: 0x100 (R/W) Interrupt Set Pending Register */ + uint32_t RESERVED2[24U]; + __IOM uint32_t ICPR[8U]; /*!< Offset: 0x180 (R/W) Interrupt Clear Pending Register */ + uint32_t RESERVED3[24U]; + __IOM uint32_t IABR[8U]; /*!< Offset: 0x200 (R/W) Interrupt Active bit Register */ + uint32_t RESERVED4[56U]; + __IOM uint8_t IP[240U]; /*!< Offset: 0x300 (R/W) Interrupt Priority Register (8Bit wide) */ + uint32_t RESERVED5[644U]; + __OM uint32_t STIR; /*!< Offset: 0xE00 ( /W) Software Trigger Interrupt Register */ +} NVIC_Type; + +/* Software Triggered Interrupt Register Definitions */ +#define NVIC_STIR_INTID_Pos 0U /*!< STIR: INTLINESNUM Position */ +#define NVIC_STIR_INTID_Msk (0x1FFUL /*<< NVIC_STIR_INTID_Pos*/) /*!< STIR: INTLINESNUM Mask */ + +/*@} end of group CMSIS_NVIC */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCB System Control Block (SCB) + \brief Type definitions for the System Control Block Registers + @{ + */ + +/** + \brief Structure type to access the System Control Block (SCB). + */ +typedef struct +{ + __IM uint32_t CPUID; /*!< Offset: 0x000 (R/ ) CPUID Base Register */ + __IOM uint32_t ICSR; /*!< Offset: 0x004 (R/W) Interrupt Control and State Register */ + __IOM uint32_t VTOR; /*!< Offset: 0x008 (R/W) Vector Table Offset Register */ + __IOM uint32_t AIRCR; /*!< Offset: 0x00C (R/W) Application Interrupt and Reset Control Register */ + __IOM uint32_t SCR; /*!< Offset: 0x010 (R/W) System Control Register */ + __IOM uint32_t CCR; /*!< Offset: 0x014 (R/W) Configuration Control Register */ + __IOM uint8_t SHP[12U]; /*!< Offset: 0x018 (R/W) System Handlers Priority Registers (4-7, 8-11, 12-15) */ + __IOM uint32_t SHCSR; /*!< Offset: 0x024 (R/W) System Handler Control and State Register */ + __IOM uint32_t CFSR; /*!< Offset: 0x028 (R/W) Configurable Fault Status Register */ + __IOM uint32_t HFSR; /*!< Offset: 0x02C (R/W) HardFault Status Register */ + __IOM uint32_t DFSR; /*!< Offset: 0x030 (R/W) Debug Fault Status Register */ + __IOM uint32_t MMFAR; /*!< Offset: 0x034 (R/W) MemManage Fault Address Register */ + __IOM uint32_t BFAR; /*!< Offset: 0x038 (R/W) BusFault Address Register */ + __IOM uint32_t AFSR; /*!< Offset: 0x03C (R/W) Auxiliary Fault Status Register */ + __IM uint32_t PFR[2U]; /*!< Offset: 0x040 (R/ ) Processor Feature Register */ + __IM uint32_t DFR; /*!< Offset: 0x048 (R/ ) Debug Feature Register */ + __IM uint32_t ADR; /*!< Offset: 0x04C (R/ ) Auxiliary Feature Register */ + __IM uint32_t MMFR[4U]; /*!< Offset: 0x050 (R/ ) Memory Model Feature Register */ + __IM uint32_t ISAR[5U]; /*!< Offset: 0x060 (R/ ) Instruction Set Attributes Register */ + uint32_t RESERVED0[5U]; + __IOM uint32_t CPACR; /*!< Offset: 0x088 (R/W) Coprocessor Access Control Register */ +} SCB_Type; + +/* SCB CPUID Register Definitions */ +#define SCB_CPUID_IMPLEMENTER_Pos 24U /*!< SCB CPUID: IMPLEMENTER Position */ +#define SCB_CPUID_IMPLEMENTER_Msk (0xFFUL << SCB_CPUID_IMPLEMENTER_Pos) /*!< SCB CPUID: IMPLEMENTER Mask */ + +#define SCB_CPUID_VARIANT_Pos 20U /*!< SCB CPUID: VARIANT Position */ +#define SCB_CPUID_VARIANT_Msk (0xFUL << SCB_CPUID_VARIANT_Pos) /*!< SCB CPUID: VARIANT Mask */ + +#define SCB_CPUID_ARCHITECTURE_Pos 16U /*!< SCB CPUID: ARCHITECTURE Position */ +#define SCB_CPUID_ARCHITECTURE_Msk (0xFUL << SCB_CPUID_ARCHITECTURE_Pos) /*!< SCB CPUID: ARCHITECTURE Mask */ + +#define SCB_CPUID_PARTNO_Pos 4U /*!< SCB CPUID: PARTNO Position */ +#define SCB_CPUID_PARTNO_Msk (0xFFFUL << SCB_CPUID_PARTNO_Pos) /*!< SCB CPUID: PARTNO Mask */ + +#define SCB_CPUID_REVISION_Pos 0U /*!< SCB CPUID: REVISION Position */ +#define SCB_CPUID_REVISION_Msk (0xFUL /*<< SCB_CPUID_REVISION_Pos*/) /*!< SCB CPUID: REVISION Mask */ + +/* SCB Interrupt Control State Register Definitions */ +#define SCB_ICSR_NMIPENDSET_Pos 31U /*!< SCB ICSR: NMIPENDSET Position */ +#define SCB_ICSR_NMIPENDSET_Msk (1UL << SCB_ICSR_NMIPENDSET_Pos) /*!< SCB ICSR: NMIPENDSET Mask */ + +#define SCB_ICSR_PENDSVSET_Pos 28U /*!< SCB ICSR: PENDSVSET Position */ +#define SCB_ICSR_PENDSVSET_Msk (1UL << SCB_ICSR_PENDSVSET_Pos) /*!< SCB ICSR: PENDSVSET Mask */ + +#define SCB_ICSR_PENDSVCLR_Pos 27U /*!< SCB ICSR: PENDSVCLR Position */ +#define SCB_ICSR_PENDSVCLR_Msk (1UL << SCB_ICSR_PENDSVCLR_Pos) /*!< SCB ICSR: PENDSVCLR Mask */ + +#define SCB_ICSR_PENDSTSET_Pos 26U /*!< SCB ICSR: PENDSTSET Position */ +#define SCB_ICSR_PENDSTSET_Msk (1UL << SCB_ICSR_PENDSTSET_Pos) /*!< SCB ICSR: PENDSTSET Mask */ + +#define SCB_ICSR_PENDSTCLR_Pos 25U /*!< SCB ICSR: PENDSTCLR Position */ +#define SCB_ICSR_PENDSTCLR_Msk (1UL << SCB_ICSR_PENDSTCLR_Pos) /*!< SCB ICSR: PENDSTCLR Mask */ + +#define SCB_ICSR_ISRPREEMPT_Pos 23U /*!< SCB ICSR: ISRPREEMPT Position */ +#define SCB_ICSR_ISRPREEMPT_Msk (1UL << SCB_ICSR_ISRPREEMPT_Pos) /*!< SCB ICSR: ISRPREEMPT Mask */ + +#define SCB_ICSR_ISRPENDING_Pos 22U /*!< SCB ICSR: ISRPENDING Position */ +#define SCB_ICSR_ISRPENDING_Msk (1UL << SCB_ICSR_ISRPENDING_Pos) /*!< SCB ICSR: ISRPENDING Mask */ + +#define SCB_ICSR_VECTPENDING_Pos 12U /*!< SCB ICSR: VECTPENDING Position */ +#define SCB_ICSR_VECTPENDING_Msk (0x1FFUL << SCB_ICSR_VECTPENDING_Pos) /*!< SCB ICSR: VECTPENDING Mask */ + +#define SCB_ICSR_RETTOBASE_Pos 11U /*!< SCB ICSR: RETTOBASE Position */ +#define SCB_ICSR_RETTOBASE_Msk (1UL << SCB_ICSR_RETTOBASE_Pos) /*!< SCB ICSR: RETTOBASE Mask */ + +#define SCB_ICSR_VECTACTIVE_Pos 0U /*!< SCB ICSR: VECTACTIVE Position */ +#define SCB_ICSR_VECTACTIVE_Msk (0x1FFUL /*<< SCB_ICSR_VECTACTIVE_Pos*/) /*!< SCB ICSR: VECTACTIVE Mask */ + +/* SCB Vector Table Offset Register Definitions */ +#define SCB_VTOR_TBLOFF_Pos 7U /*!< SCB VTOR: TBLOFF Position */ +#define SCB_VTOR_TBLOFF_Msk (0x1FFFFFFUL << SCB_VTOR_TBLOFF_Pos) /*!< SCB VTOR: TBLOFF Mask */ + +/* SCB Application Interrupt and Reset Control Register Definitions */ +#define SCB_AIRCR_VECTKEY_Pos 16U /*!< SCB AIRCR: VECTKEY Position */ +#define SCB_AIRCR_VECTKEY_Msk (0xFFFFUL << SCB_AIRCR_VECTKEY_Pos) /*!< SCB AIRCR: VECTKEY Mask */ + +#define SCB_AIRCR_VECTKEYSTAT_Pos 16U /*!< SCB AIRCR: VECTKEYSTAT Position */ +#define SCB_AIRCR_VECTKEYSTAT_Msk (0xFFFFUL << SCB_AIRCR_VECTKEYSTAT_Pos) /*!< SCB AIRCR: VECTKEYSTAT Mask */ + +#define SCB_AIRCR_ENDIANESS_Pos 15U /*!< SCB AIRCR: ENDIANESS Position */ +#define SCB_AIRCR_ENDIANESS_Msk (1UL << SCB_AIRCR_ENDIANESS_Pos) /*!< SCB AIRCR: ENDIANESS Mask */ + +#define SCB_AIRCR_PRIGROUP_Pos 8U /*!< SCB AIRCR: PRIGROUP Position */ +#define SCB_AIRCR_PRIGROUP_Msk (7UL << SCB_AIRCR_PRIGROUP_Pos) /*!< SCB AIRCR: PRIGROUP Mask */ + +#define SCB_AIRCR_SYSRESETREQ_Pos 2U /*!< SCB AIRCR: SYSRESETREQ Position */ +#define SCB_AIRCR_SYSRESETREQ_Msk (1UL << SCB_AIRCR_SYSRESETREQ_Pos) /*!< SCB AIRCR: SYSRESETREQ Mask */ + +#define SCB_AIRCR_VECTCLRACTIVE_Pos 1U /*!< SCB AIRCR: VECTCLRACTIVE Position */ +#define SCB_AIRCR_VECTCLRACTIVE_Msk (1UL << SCB_AIRCR_VECTCLRACTIVE_Pos) /*!< SCB AIRCR: VECTCLRACTIVE Mask */ + +#define SCB_AIRCR_VECTRESET_Pos 0U /*!< SCB AIRCR: VECTRESET Position */ +#define SCB_AIRCR_VECTRESET_Msk (1UL /*<< SCB_AIRCR_VECTRESET_Pos*/) /*!< SCB AIRCR: VECTRESET Mask */ + +/* SCB System Control Register Definitions */ +#define SCB_SCR_SEVONPEND_Pos 4U /*!< SCB SCR: SEVONPEND Position */ +#define SCB_SCR_SEVONPEND_Msk (1UL << SCB_SCR_SEVONPEND_Pos) /*!< SCB SCR: SEVONPEND Mask */ + +#define SCB_SCR_SLEEPDEEP_Pos 2U /*!< SCB SCR: SLEEPDEEP Position */ +#define SCB_SCR_SLEEPDEEP_Msk (1UL << SCB_SCR_SLEEPDEEP_Pos) /*!< SCB SCR: SLEEPDEEP Mask */ + +#define SCB_SCR_SLEEPONEXIT_Pos 1U /*!< SCB SCR: SLEEPONEXIT Position */ +#define SCB_SCR_SLEEPONEXIT_Msk (1UL << SCB_SCR_SLEEPONEXIT_Pos) /*!< SCB SCR: SLEEPONEXIT Mask */ + +/* SCB Configuration Control Register Definitions */ +#define SCB_CCR_STKALIGN_Pos 9U /*!< SCB CCR: STKALIGN Position */ +#define SCB_CCR_STKALIGN_Msk (1UL << SCB_CCR_STKALIGN_Pos) /*!< SCB CCR: STKALIGN Mask */ + +#define SCB_CCR_BFHFNMIGN_Pos 8U /*!< SCB CCR: BFHFNMIGN Position */ +#define SCB_CCR_BFHFNMIGN_Msk (1UL << SCB_CCR_BFHFNMIGN_Pos) /*!< SCB CCR: BFHFNMIGN Mask */ + +#define SCB_CCR_DIV_0_TRP_Pos 4U /*!< SCB CCR: DIV_0_TRP Position */ +#define SCB_CCR_DIV_0_TRP_Msk (1UL << SCB_CCR_DIV_0_TRP_Pos) /*!< SCB CCR: DIV_0_TRP Mask */ + +#define SCB_CCR_UNALIGN_TRP_Pos 3U /*!< SCB CCR: UNALIGN_TRP Position */ +#define SCB_CCR_UNALIGN_TRP_Msk (1UL << SCB_CCR_UNALIGN_TRP_Pos) /*!< SCB CCR: UNALIGN_TRP Mask */ + +#define SCB_CCR_USERSETMPEND_Pos 1U /*!< SCB CCR: USERSETMPEND Position */ +#define SCB_CCR_USERSETMPEND_Msk (1UL << SCB_CCR_USERSETMPEND_Pos) /*!< SCB CCR: USERSETMPEND Mask */ + +#define SCB_CCR_NONBASETHRDENA_Pos 0U /*!< SCB CCR: NONBASETHRDENA Position */ +#define SCB_CCR_NONBASETHRDENA_Msk (1UL /*<< SCB_CCR_NONBASETHRDENA_Pos*/) /*!< SCB CCR: NONBASETHRDENA Mask */ + +/* SCB System Handler Control and State Register Definitions */ +#define SCB_SHCSR_USGFAULTENA_Pos 18U /*!< SCB SHCSR: USGFAULTENA Position */ +#define SCB_SHCSR_USGFAULTENA_Msk (1UL << SCB_SHCSR_USGFAULTENA_Pos) /*!< SCB SHCSR: USGFAULTENA Mask */ + +#define SCB_SHCSR_BUSFAULTENA_Pos 17U /*!< SCB SHCSR: BUSFAULTENA Position */ +#define SCB_SHCSR_BUSFAULTENA_Msk (1UL << SCB_SHCSR_BUSFAULTENA_Pos) /*!< SCB SHCSR: BUSFAULTENA Mask */ + +#define SCB_SHCSR_MEMFAULTENA_Pos 16U /*!< SCB SHCSR: MEMFAULTENA Position */ +#define SCB_SHCSR_MEMFAULTENA_Msk (1UL << SCB_SHCSR_MEMFAULTENA_Pos) /*!< SCB SHCSR: MEMFAULTENA Mask */ + +#define SCB_SHCSR_SVCALLPENDED_Pos 15U /*!< SCB SHCSR: SVCALLPENDED Position */ +#define SCB_SHCSR_SVCALLPENDED_Msk (1UL << SCB_SHCSR_SVCALLPENDED_Pos) /*!< SCB SHCSR: SVCALLPENDED Mask */ + +#define SCB_SHCSR_BUSFAULTPENDED_Pos 14U /*!< SCB SHCSR: BUSFAULTPENDED Position */ +#define SCB_SHCSR_BUSFAULTPENDED_Msk (1UL << SCB_SHCSR_BUSFAULTPENDED_Pos) /*!< SCB SHCSR: BUSFAULTPENDED Mask */ + +#define SCB_SHCSR_MEMFAULTPENDED_Pos 13U /*!< SCB SHCSR: MEMFAULTPENDED Position */ +#define SCB_SHCSR_MEMFAULTPENDED_Msk (1UL << SCB_SHCSR_MEMFAULTPENDED_Pos) /*!< SCB SHCSR: MEMFAULTPENDED Mask */ + +#define SCB_SHCSR_USGFAULTPENDED_Pos 12U /*!< SCB SHCSR: USGFAULTPENDED Position */ +#define SCB_SHCSR_USGFAULTPENDED_Msk (1UL << SCB_SHCSR_USGFAULTPENDED_Pos) /*!< SCB SHCSR: USGFAULTPENDED Mask */ + +#define SCB_SHCSR_SYSTICKACT_Pos 11U /*!< SCB SHCSR: SYSTICKACT Position */ +#define SCB_SHCSR_SYSTICKACT_Msk (1UL << SCB_SHCSR_SYSTICKACT_Pos) /*!< SCB SHCSR: SYSTICKACT Mask */ + +#define SCB_SHCSR_PENDSVACT_Pos 10U /*!< SCB SHCSR: PENDSVACT Position */ +#define SCB_SHCSR_PENDSVACT_Msk (1UL << SCB_SHCSR_PENDSVACT_Pos) /*!< SCB SHCSR: PENDSVACT Mask */ + +#define SCB_SHCSR_MONITORACT_Pos 8U /*!< SCB SHCSR: MONITORACT Position */ +#define SCB_SHCSR_MONITORACT_Msk (1UL << SCB_SHCSR_MONITORACT_Pos) /*!< SCB SHCSR: MONITORACT Mask */ + +#define SCB_SHCSR_SVCALLACT_Pos 7U /*!< SCB SHCSR: SVCALLACT Position */ +#define SCB_SHCSR_SVCALLACT_Msk (1UL << SCB_SHCSR_SVCALLACT_Pos) /*!< SCB SHCSR: SVCALLACT Mask */ + +#define SCB_SHCSR_USGFAULTACT_Pos 3U /*!< SCB SHCSR: USGFAULTACT Position */ +#define SCB_SHCSR_USGFAULTACT_Msk (1UL << SCB_SHCSR_USGFAULTACT_Pos) /*!< SCB SHCSR: USGFAULTACT Mask */ + +#define SCB_SHCSR_BUSFAULTACT_Pos 1U /*!< SCB SHCSR: BUSFAULTACT Position */ +#define SCB_SHCSR_BUSFAULTACT_Msk (1UL << SCB_SHCSR_BUSFAULTACT_Pos) /*!< SCB SHCSR: BUSFAULTACT Mask */ + +#define SCB_SHCSR_MEMFAULTACT_Pos 0U /*!< SCB SHCSR: MEMFAULTACT Position */ +#define SCB_SHCSR_MEMFAULTACT_Msk (1UL /*<< SCB_SHCSR_MEMFAULTACT_Pos*/) /*!< SCB SHCSR: MEMFAULTACT Mask */ + +/* SCB Configurable Fault Status Register Definitions */ +#define SCB_CFSR_USGFAULTSR_Pos 16U /*!< SCB CFSR: Usage Fault Status Register Position */ +#define SCB_CFSR_USGFAULTSR_Msk (0xFFFFUL << SCB_CFSR_USGFAULTSR_Pos) /*!< SCB CFSR: Usage Fault Status Register Mask */ + +#define SCB_CFSR_BUSFAULTSR_Pos 8U /*!< SCB CFSR: Bus Fault Status Register Position */ +#define SCB_CFSR_BUSFAULTSR_Msk (0xFFUL << SCB_CFSR_BUSFAULTSR_Pos) /*!< SCB CFSR: Bus Fault Status Register Mask */ + +#define SCB_CFSR_MEMFAULTSR_Pos 0U /*!< SCB CFSR: Memory Manage Fault Status Register Position */ +#define SCB_CFSR_MEMFAULTSR_Msk (0xFFUL /*<< SCB_CFSR_MEMFAULTSR_Pos*/) /*!< SCB CFSR: Memory Manage Fault Status Register Mask */ + +/* MemManage Fault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_MMARVALID_Pos (SCB_CFSR_MEMFAULTSR_Pos + 7U) /*!< SCB CFSR (MMFSR): MMARVALID Position */ +#define SCB_CFSR_MMARVALID_Msk (1UL << SCB_CFSR_MMARVALID_Pos) /*!< SCB CFSR (MMFSR): MMARVALID Mask */ + +#define SCB_CFSR_MLSPERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 5U) /*!< SCB CFSR (MMFSR): MLSPERR Position */ +#define SCB_CFSR_MLSPERR_Msk (1UL << SCB_CFSR_MLSPERR_Pos) /*!< SCB CFSR (MMFSR): MLSPERR Mask */ + +#define SCB_CFSR_MSTKERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 4U) /*!< SCB CFSR (MMFSR): MSTKERR Position */ +#define SCB_CFSR_MSTKERR_Msk (1UL << SCB_CFSR_MSTKERR_Pos) /*!< SCB CFSR (MMFSR): MSTKERR Mask */ + +#define SCB_CFSR_MUNSTKERR_Pos (SCB_CFSR_MEMFAULTSR_Pos + 3U) /*!< SCB CFSR (MMFSR): MUNSTKERR Position */ +#define SCB_CFSR_MUNSTKERR_Msk (1UL << SCB_CFSR_MUNSTKERR_Pos) /*!< SCB CFSR (MMFSR): MUNSTKERR Mask */ + +#define SCB_CFSR_DACCVIOL_Pos (SCB_CFSR_MEMFAULTSR_Pos + 1U) /*!< SCB CFSR (MMFSR): DACCVIOL Position */ +#define SCB_CFSR_DACCVIOL_Msk (1UL << SCB_CFSR_DACCVIOL_Pos) /*!< SCB CFSR (MMFSR): DACCVIOL Mask */ + +#define SCB_CFSR_IACCVIOL_Pos (SCB_CFSR_MEMFAULTSR_Pos + 0U) /*!< SCB CFSR (MMFSR): IACCVIOL Position */ +#define SCB_CFSR_IACCVIOL_Msk (1UL /*<< SCB_CFSR_IACCVIOL_Pos*/) /*!< SCB CFSR (MMFSR): IACCVIOL Mask */ + +/* BusFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_BFARVALID_Pos (SCB_CFSR_BUSFAULTSR_Pos + 7U) /*!< SCB CFSR (BFSR): BFARVALID Position */ +#define SCB_CFSR_BFARVALID_Msk (1UL << SCB_CFSR_BFARVALID_Pos) /*!< SCB CFSR (BFSR): BFARVALID Mask */ + +#define SCB_CFSR_LSPERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 5U) /*!< SCB CFSR (BFSR): LSPERR Position */ +#define SCB_CFSR_LSPERR_Msk (1UL << SCB_CFSR_LSPERR_Pos) /*!< SCB CFSR (BFSR): LSPERR Mask */ + +#define SCB_CFSR_STKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 4U) /*!< SCB CFSR (BFSR): STKERR Position */ +#define SCB_CFSR_STKERR_Msk (1UL << SCB_CFSR_STKERR_Pos) /*!< SCB CFSR (BFSR): STKERR Mask */ + +#define SCB_CFSR_UNSTKERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 3U) /*!< SCB CFSR (BFSR): UNSTKERR Position */ +#define SCB_CFSR_UNSTKERR_Msk (1UL << SCB_CFSR_UNSTKERR_Pos) /*!< SCB CFSR (BFSR): UNSTKERR Mask */ + +#define SCB_CFSR_IMPRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 2U) /*!< SCB CFSR (BFSR): IMPRECISERR Position */ +#define SCB_CFSR_IMPRECISERR_Msk (1UL << SCB_CFSR_IMPRECISERR_Pos) /*!< SCB CFSR (BFSR): IMPRECISERR Mask */ + +#define SCB_CFSR_PRECISERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 1U) /*!< SCB CFSR (BFSR): PRECISERR Position */ +#define SCB_CFSR_PRECISERR_Msk (1UL << SCB_CFSR_PRECISERR_Pos) /*!< SCB CFSR (BFSR): PRECISERR Mask */ + +#define SCB_CFSR_IBUSERR_Pos (SCB_CFSR_BUSFAULTSR_Pos + 0U) /*!< SCB CFSR (BFSR): IBUSERR Position */ +#define SCB_CFSR_IBUSERR_Msk (1UL << SCB_CFSR_IBUSERR_Pos) /*!< SCB CFSR (BFSR): IBUSERR Mask */ + +/* UsageFault Status Register (part of SCB Configurable Fault Status Register) */ +#define SCB_CFSR_DIVBYZERO_Pos (SCB_CFSR_USGFAULTSR_Pos + 9U) /*!< SCB CFSR (UFSR): DIVBYZERO Position */ +#define SCB_CFSR_DIVBYZERO_Msk (1UL << SCB_CFSR_DIVBYZERO_Pos) /*!< SCB CFSR (UFSR): DIVBYZERO Mask */ + +#define SCB_CFSR_UNALIGNED_Pos (SCB_CFSR_USGFAULTSR_Pos + 8U) /*!< SCB CFSR (UFSR): UNALIGNED Position */ +#define SCB_CFSR_UNALIGNED_Msk (1UL << SCB_CFSR_UNALIGNED_Pos) /*!< SCB CFSR (UFSR): UNALIGNED Mask */ + +#define SCB_CFSR_NOCP_Pos (SCB_CFSR_USGFAULTSR_Pos + 3U) /*!< SCB CFSR (UFSR): NOCP Position */ +#define SCB_CFSR_NOCP_Msk (1UL << SCB_CFSR_NOCP_Pos) /*!< SCB CFSR (UFSR): NOCP Mask */ + +#define SCB_CFSR_INVPC_Pos (SCB_CFSR_USGFAULTSR_Pos + 2U) /*!< SCB CFSR (UFSR): INVPC Position */ +#define SCB_CFSR_INVPC_Msk (1UL << SCB_CFSR_INVPC_Pos) /*!< SCB CFSR (UFSR): INVPC Mask */ + +#define SCB_CFSR_INVSTATE_Pos (SCB_CFSR_USGFAULTSR_Pos + 1U) /*!< SCB CFSR (UFSR): INVSTATE Position */ +#define SCB_CFSR_INVSTATE_Msk (1UL << SCB_CFSR_INVSTATE_Pos) /*!< SCB CFSR (UFSR): INVSTATE Mask */ + +#define SCB_CFSR_UNDEFINSTR_Pos (SCB_CFSR_USGFAULTSR_Pos + 0U) /*!< SCB CFSR (UFSR): UNDEFINSTR Position */ +#define SCB_CFSR_UNDEFINSTR_Msk (1UL << SCB_CFSR_UNDEFINSTR_Pos) /*!< SCB CFSR (UFSR): UNDEFINSTR Mask */ + +/* SCB Hard Fault Status Register Definitions */ +#define SCB_HFSR_DEBUGEVT_Pos 31U /*!< SCB HFSR: DEBUGEVT Position */ +#define SCB_HFSR_DEBUGEVT_Msk (1UL << SCB_HFSR_DEBUGEVT_Pos) /*!< SCB HFSR: DEBUGEVT Mask */ + +#define SCB_HFSR_FORCED_Pos 30U /*!< SCB HFSR: FORCED Position */ +#define SCB_HFSR_FORCED_Msk (1UL << SCB_HFSR_FORCED_Pos) /*!< SCB HFSR: FORCED Mask */ + +#define SCB_HFSR_VECTTBL_Pos 1U /*!< SCB HFSR: VECTTBL Position */ +#define SCB_HFSR_VECTTBL_Msk (1UL << SCB_HFSR_VECTTBL_Pos) /*!< SCB HFSR: VECTTBL Mask */ + +/* SCB Debug Fault Status Register Definitions */ +#define SCB_DFSR_EXTERNAL_Pos 4U /*!< SCB DFSR: EXTERNAL Position */ +#define SCB_DFSR_EXTERNAL_Msk (1UL << SCB_DFSR_EXTERNAL_Pos) /*!< SCB DFSR: EXTERNAL Mask */ + +#define SCB_DFSR_VCATCH_Pos 3U /*!< SCB DFSR: VCATCH Position */ +#define SCB_DFSR_VCATCH_Msk (1UL << SCB_DFSR_VCATCH_Pos) /*!< SCB DFSR: VCATCH Mask */ + +#define SCB_DFSR_DWTTRAP_Pos 2U /*!< SCB DFSR: DWTTRAP Position */ +#define SCB_DFSR_DWTTRAP_Msk (1UL << SCB_DFSR_DWTTRAP_Pos) /*!< SCB DFSR: DWTTRAP Mask */ + +#define SCB_DFSR_BKPT_Pos 1U /*!< SCB DFSR: BKPT Position */ +#define SCB_DFSR_BKPT_Msk (1UL << SCB_DFSR_BKPT_Pos) /*!< SCB DFSR: BKPT Mask */ + +#define SCB_DFSR_HALTED_Pos 0U /*!< SCB DFSR: HALTED Position */ +#define SCB_DFSR_HALTED_Msk (1UL /*<< SCB_DFSR_HALTED_Pos*/) /*!< SCB DFSR: HALTED Mask */ + +/*@} end of group CMSIS_SCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SCnSCB System Controls not in SCB (SCnSCB) + \brief Type definitions for the System Control and ID Register not in the SCB + @{ + */ + +/** + \brief Structure type to access the System Control and ID Register not in the SCB. + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IM uint32_t ICTR; /*!< Offset: 0x004 (R/ ) Interrupt Controller Type Register */ + __IOM uint32_t ACTLR; /*!< Offset: 0x008 (R/W) Auxiliary Control Register */ +} SCnSCB_Type; + +/* Interrupt Controller Type Register Definitions */ +#define SCnSCB_ICTR_INTLINESNUM_Pos 0U /*!< ICTR: INTLINESNUM Position */ +#define SCnSCB_ICTR_INTLINESNUM_Msk (0xFUL /*<< SCnSCB_ICTR_INTLINESNUM_Pos*/) /*!< ICTR: INTLINESNUM Mask */ + +/* Auxiliary Control Register Definitions */ +#define SCnSCB_ACTLR_DISOOFP_Pos 9U /*!< ACTLR: DISOOFP Position */ +#define SCnSCB_ACTLR_DISOOFP_Msk (1UL << SCnSCB_ACTLR_DISOOFP_Pos) /*!< ACTLR: DISOOFP Mask */ + +#define SCnSCB_ACTLR_DISFPCA_Pos 8U /*!< ACTLR: DISFPCA Position */ +#define SCnSCB_ACTLR_DISFPCA_Msk (1UL << SCnSCB_ACTLR_DISFPCA_Pos) /*!< ACTLR: DISFPCA Mask */ + +#define SCnSCB_ACTLR_DISFOLD_Pos 2U /*!< ACTLR: DISFOLD Position */ +#define SCnSCB_ACTLR_DISFOLD_Msk (1UL << SCnSCB_ACTLR_DISFOLD_Pos) /*!< ACTLR: DISFOLD Mask */ + +#define SCnSCB_ACTLR_DISDEFWBUF_Pos 1U /*!< ACTLR: DISDEFWBUF Position */ +#define SCnSCB_ACTLR_DISDEFWBUF_Msk (1UL << SCnSCB_ACTLR_DISDEFWBUF_Pos) /*!< ACTLR: DISDEFWBUF Mask */ + +#define SCnSCB_ACTLR_DISMCYCINT_Pos 0U /*!< ACTLR: DISMCYCINT Position */ +#define SCnSCB_ACTLR_DISMCYCINT_Msk (1UL /*<< SCnSCB_ACTLR_DISMCYCINT_Pos*/) /*!< ACTLR: DISMCYCINT Mask */ + +/*@} end of group CMSIS_SCnotSCB */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_SysTick System Tick Timer (SysTick) + \brief Type definitions for the System Timer Registers. + @{ + */ + +/** + \brief Structure type to access the System Timer (SysTick). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) SysTick Control and Status Register */ + __IOM uint32_t LOAD; /*!< Offset: 0x004 (R/W) SysTick Reload Value Register */ + __IOM uint32_t VAL; /*!< Offset: 0x008 (R/W) SysTick Current Value Register */ + __IM uint32_t CALIB; /*!< Offset: 0x00C (R/ ) SysTick Calibration Register */ +} SysTick_Type; + +/* SysTick Control / Status Register Definitions */ +#define SysTick_CTRL_COUNTFLAG_Pos 16U /*!< SysTick CTRL: COUNTFLAG Position */ +#define SysTick_CTRL_COUNTFLAG_Msk (1UL << SysTick_CTRL_COUNTFLAG_Pos) /*!< SysTick CTRL: COUNTFLAG Mask */ + +#define SysTick_CTRL_CLKSOURCE_Pos 2U /*!< SysTick CTRL: CLKSOURCE Position */ +#define SysTick_CTRL_CLKSOURCE_Msk (1UL << SysTick_CTRL_CLKSOURCE_Pos) /*!< SysTick CTRL: CLKSOURCE Mask */ + +#define SysTick_CTRL_TICKINT_Pos 1U /*!< SysTick CTRL: TICKINT Position */ +#define SysTick_CTRL_TICKINT_Msk (1UL << SysTick_CTRL_TICKINT_Pos) /*!< SysTick CTRL: TICKINT Mask */ + +#define SysTick_CTRL_ENABLE_Pos 0U /*!< SysTick CTRL: ENABLE Position */ +#define SysTick_CTRL_ENABLE_Msk (1UL /*<< SysTick_CTRL_ENABLE_Pos*/) /*!< SysTick CTRL: ENABLE Mask */ + +/* SysTick Reload Register Definitions */ +#define SysTick_LOAD_RELOAD_Pos 0U /*!< SysTick LOAD: RELOAD Position */ +#define SysTick_LOAD_RELOAD_Msk (0xFFFFFFUL /*<< SysTick_LOAD_RELOAD_Pos*/) /*!< SysTick LOAD: RELOAD Mask */ + +/* SysTick Current Register Definitions */ +#define SysTick_VAL_CURRENT_Pos 0U /*!< SysTick VAL: CURRENT Position */ +#define SysTick_VAL_CURRENT_Msk (0xFFFFFFUL /*<< SysTick_VAL_CURRENT_Pos*/) /*!< SysTick VAL: CURRENT Mask */ + +/* SysTick Calibration Register Definitions */ +#define SysTick_CALIB_NOREF_Pos 31U /*!< SysTick CALIB: NOREF Position */ +#define SysTick_CALIB_NOREF_Msk (1UL << SysTick_CALIB_NOREF_Pos) /*!< SysTick CALIB: NOREF Mask */ + +#define SysTick_CALIB_SKEW_Pos 30U /*!< SysTick CALIB: SKEW Position */ +#define SysTick_CALIB_SKEW_Msk (1UL << SysTick_CALIB_SKEW_Pos) /*!< SysTick CALIB: SKEW Mask */ + +#define SysTick_CALIB_TENMS_Pos 0U /*!< SysTick CALIB: TENMS Position */ +#define SysTick_CALIB_TENMS_Msk (0xFFFFFFUL /*<< SysTick_CALIB_TENMS_Pos*/) /*!< SysTick CALIB: TENMS Mask */ + +/*@} end of group CMSIS_SysTick */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_ITM Instrumentation Trace Macrocell (ITM) + \brief Type definitions for the Instrumentation Trace Macrocell (ITM) + @{ + */ + +/** + \brief Structure type to access the Instrumentation Trace Macrocell Register (ITM). + */ +typedef struct +{ + __OM union + { + __OM uint8_t u8; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 8-bit */ + __OM uint16_t u16; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 16-bit */ + __OM uint32_t u32; /*!< Offset: 0x000 ( /W) ITM Stimulus Port 32-bit */ + } PORT [32U]; /*!< Offset: 0x000 ( /W) ITM Stimulus Port Registers */ + uint32_t RESERVED0[864U]; + __IOM uint32_t TER; /*!< Offset: 0xE00 (R/W) ITM Trace Enable Register */ + uint32_t RESERVED1[15U]; + __IOM uint32_t TPR; /*!< Offset: 0xE40 (R/W) ITM Trace Privilege Register */ + uint32_t RESERVED2[15U]; + __IOM uint32_t TCR; /*!< Offset: 0xE80 (R/W) ITM Trace Control Register */ + uint32_t RESERVED3[32U]; + uint32_t RESERVED4[43U]; + __OM uint32_t LAR; /*!< Offset: 0xFB0 ( /W) ITM Lock Access Register */ + __IM uint32_t LSR; /*!< Offset: 0xFB4 (R/ ) ITM Lock Status Register */ + uint32_t RESERVED5[6U]; + __IM uint32_t PID4; /*!< Offset: 0xFD0 (R/ ) ITM Peripheral Identification Register #4 */ + __IM uint32_t PID5; /*!< Offset: 0xFD4 (R/ ) ITM Peripheral Identification Register #5 */ + __IM uint32_t PID6; /*!< Offset: 0xFD8 (R/ ) ITM Peripheral Identification Register #6 */ + __IM uint32_t PID7; /*!< Offset: 0xFDC (R/ ) ITM Peripheral Identification Register #7 */ + __IM uint32_t PID0; /*!< Offset: 0xFE0 (R/ ) ITM Peripheral Identification Register #0 */ + __IM uint32_t PID1; /*!< Offset: 0xFE4 (R/ ) ITM Peripheral Identification Register #1 */ + __IM uint32_t PID2; /*!< Offset: 0xFE8 (R/ ) ITM Peripheral Identification Register #2 */ + __IM uint32_t PID3; /*!< Offset: 0xFEC (R/ ) ITM Peripheral Identification Register #3 */ + __IM uint32_t CID0; /*!< Offset: 0xFF0 (R/ ) ITM Component Identification Register #0 */ + __IM uint32_t CID1; /*!< Offset: 0xFF4 (R/ ) ITM Component Identification Register #1 */ + __IM uint32_t CID2; /*!< Offset: 0xFF8 (R/ ) ITM Component Identification Register #2 */ + __IM uint32_t CID3; /*!< Offset: 0xFFC (R/ ) ITM Component Identification Register #3 */ +} ITM_Type; + +/* ITM Trace Privilege Register Definitions */ +#define ITM_TPR_PRIVMASK_Pos 0U /*!< ITM TPR: PRIVMASK Position */ +#define ITM_TPR_PRIVMASK_Msk (0xFFFFFFFFUL /*<< ITM_TPR_PRIVMASK_Pos*/) /*!< ITM TPR: PRIVMASK Mask */ + +/* ITM Trace Control Register Definitions */ +#define ITM_TCR_BUSY_Pos 23U /*!< ITM TCR: BUSY Position */ +#define ITM_TCR_BUSY_Msk (1UL << ITM_TCR_BUSY_Pos) /*!< ITM TCR: BUSY Mask */ + +#define ITM_TCR_TraceBusID_Pos 16U /*!< ITM TCR: ATBID Position */ +#define ITM_TCR_TraceBusID_Msk (0x7FUL << ITM_TCR_TraceBusID_Pos) /*!< ITM TCR: ATBID Mask */ + +#define ITM_TCR_GTSFREQ_Pos 10U /*!< ITM TCR: Global timestamp frequency Position */ +#define ITM_TCR_GTSFREQ_Msk (3UL << ITM_TCR_GTSFREQ_Pos) /*!< ITM TCR: Global timestamp frequency Mask */ + +#define ITM_TCR_TSPrescale_Pos 8U /*!< ITM TCR: TSPrescale Position */ +#define ITM_TCR_TSPrescale_Msk (3UL << ITM_TCR_TSPrescale_Pos) /*!< ITM TCR: TSPrescale Mask */ + +#define ITM_TCR_SWOENA_Pos 4U /*!< ITM TCR: SWOENA Position */ +#define ITM_TCR_SWOENA_Msk (1UL << ITM_TCR_SWOENA_Pos) /*!< ITM TCR: SWOENA Mask */ + +#define ITM_TCR_DWTENA_Pos 3U /*!< ITM TCR: DWTENA Position */ +#define ITM_TCR_DWTENA_Msk (1UL << ITM_TCR_DWTENA_Pos) /*!< ITM TCR: DWTENA Mask */ + +#define ITM_TCR_SYNCENA_Pos 2U /*!< ITM TCR: SYNCENA Position */ +#define ITM_TCR_SYNCENA_Msk (1UL << ITM_TCR_SYNCENA_Pos) /*!< ITM TCR: SYNCENA Mask */ + +#define ITM_TCR_TSENA_Pos 1U /*!< ITM TCR: TSENA Position */ +#define ITM_TCR_TSENA_Msk (1UL << ITM_TCR_TSENA_Pos) /*!< ITM TCR: TSENA Mask */ + +#define ITM_TCR_ITMENA_Pos 0U /*!< ITM TCR: ITM Enable bit Position */ +#define ITM_TCR_ITMENA_Msk (1UL /*<< ITM_TCR_ITMENA_Pos*/) /*!< ITM TCR: ITM Enable bit Mask */ + +/* ITM Lock Status Register Definitions */ +#define ITM_LSR_ByteAcc_Pos 2U /*!< ITM LSR: ByteAcc Position */ +#define ITM_LSR_ByteAcc_Msk (1UL << ITM_LSR_ByteAcc_Pos) /*!< ITM LSR: ByteAcc Mask */ + +#define ITM_LSR_Access_Pos 1U /*!< ITM LSR: Access Position */ +#define ITM_LSR_Access_Msk (1UL << ITM_LSR_Access_Pos) /*!< ITM LSR: Access Mask */ + +#define ITM_LSR_Present_Pos 0U /*!< ITM LSR: Present Position */ +#define ITM_LSR_Present_Msk (1UL /*<< ITM_LSR_Present_Pos*/) /*!< ITM LSR: Present Mask */ + +/*@}*/ /* end of group CMSIS_ITM */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_DWT Data Watchpoint and Trace (DWT) + \brief Type definitions for the Data Watchpoint and Trace (DWT) + @{ + */ + +/** + \brief Structure type to access the Data Watchpoint and Trace Register (DWT). + */ +typedef struct +{ + __IOM uint32_t CTRL; /*!< Offset: 0x000 (R/W) Control Register */ + __IOM uint32_t CYCCNT; /*!< Offset: 0x004 (R/W) Cycle Count Register */ + __IOM uint32_t CPICNT; /*!< Offset: 0x008 (R/W) CPI Count Register */ + __IOM uint32_t EXCCNT; /*!< Offset: 0x00C (R/W) Exception Overhead Count Register */ + __IOM uint32_t SLEEPCNT; /*!< Offset: 0x010 (R/W) Sleep Count Register */ + __IOM uint32_t LSUCNT; /*!< Offset: 0x014 (R/W) LSU Count Register */ + __IOM uint32_t FOLDCNT; /*!< Offset: 0x018 (R/W) Folded-instruction Count Register */ + __IM uint32_t PCSR; /*!< Offset: 0x01C (R/ ) Program Counter Sample Register */ + __IOM uint32_t COMP0; /*!< Offset: 0x020 (R/W) Comparator Register 0 */ + __IOM uint32_t MASK0; /*!< Offset: 0x024 (R/W) Mask Register 0 */ + __IOM uint32_t FUNCTION0; /*!< Offset: 0x028 (R/W) Function Register 0 */ + uint32_t RESERVED0[1U]; + __IOM uint32_t COMP1; /*!< Offset: 0x030 (R/W) Comparator Register 1 */ + __IOM uint32_t MASK1; /*!< Offset: 0x034 (R/W) Mask Register 1 */ + __IOM uint32_t FUNCTION1; /*!< Offset: 0x038 (R/W) Function Register 1 */ + uint32_t RESERVED1[1U]; + __IOM uint32_t COMP2; /*!< Offset: 0x040 (R/W) Comparator Register 2 */ + __IOM uint32_t MASK2; /*!< Offset: 0x044 (R/W) Mask Register 2 */ + __IOM uint32_t FUNCTION2; /*!< Offset: 0x048 (R/W) Function Register 2 */ + uint32_t RESERVED2[1U]; + __IOM uint32_t COMP3; /*!< Offset: 0x050 (R/W) Comparator Register 3 */ + __IOM uint32_t MASK3; /*!< Offset: 0x054 (R/W) Mask Register 3 */ + __IOM uint32_t FUNCTION3; /*!< Offset: 0x058 (R/W) Function Register 3 */ +} DWT_Type; + +/* DWT Control Register Definitions */ +#define DWT_CTRL_NUMCOMP_Pos 28U /*!< DWT CTRL: NUMCOMP Position */ +#define DWT_CTRL_NUMCOMP_Msk (0xFUL << DWT_CTRL_NUMCOMP_Pos) /*!< DWT CTRL: NUMCOMP Mask */ + +#define DWT_CTRL_NOTRCPKT_Pos 27U /*!< DWT CTRL: NOTRCPKT Position */ +#define DWT_CTRL_NOTRCPKT_Msk (0x1UL << DWT_CTRL_NOTRCPKT_Pos) /*!< DWT CTRL: NOTRCPKT Mask */ + +#define DWT_CTRL_NOEXTTRIG_Pos 26U /*!< DWT CTRL: NOEXTTRIG Position */ +#define DWT_CTRL_NOEXTTRIG_Msk (0x1UL << DWT_CTRL_NOEXTTRIG_Pos) /*!< DWT CTRL: NOEXTTRIG Mask */ + +#define DWT_CTRL_NOCYCCNT_Pos 25U /*!< DWT CTRL: NOCYCCNT Position */ +#define DWT_CTRL_NOCYCCNT_Msk (0x1UL << DWT_CTRL_NOCYCCNT_Pos) /*!< DWT CTRL: NOCYCCNT Mask */ + +#define DWT_CTRL_NOPRFCNT_Pos 24U /*!< DWT CTRL: NOPRFCNT Position */ +#define DWT_CTRL_NOPRFCNT_Msk (0x1UL << DWT_CTRL_NOPRFCNT_Pos) /*!< DWT CTRL: NOPRFCNT Mask */ + +#define DWT_CTRL_CYCEVTENA_Pos 22U /*!< DWT CTRL: CYCEVTENA Position */ +#define DWT_CTRL_CYCEVTENA_Msk (0x1UL << DWT_CTRL_CYCEVTENA_Pos) /*!< DWT CTRL: CYCEVTENA Mask */ + +#define DWT_CTRL_FOLDEVTENA_Pos 21U /*!< DWT CTRL: FOLDEVTENA Position */ +#define DWT_CTRL_FOLDEVTENA_Msk (0x1UL << DWT_CTRL_FOLDEVTENA_Pos) /*!< DWT CTRL: FOLDEVTENA Mask */ + +#define DWT_CTRL_LSUEVTENA_Pos 20U /*!< DWT CTRL: LSUEVTENA Position */ +#define DWT_CTRL_LSUEVTENA_Msk (0x1UL << DWT_CTRL_LSUEVTENA_Pos) /*!< DWT CTRL: LSUEVTENA Mask */ + +#define DWT_CTRL_SLEEPEVTENA_Pos 19U /*!< DWT CTRL: SLEEPEVTENA Position */ +#define DWT_CTRL_SLEEPEVTENA_Msk (0x1UL << DWT_CTRL_SLEEPEVTENA_Pos) /*!< DWT CTRL: SLEEPEVTENA Mask */ + +#define DWT_CTRL_EXCEVTENA_Pos 18U /*!< DWT CTRL: EXCEVTENA Position */ +#define DWT_CTRL_EXCEVTENA_Msk (0x1UL << DWT_CTRL_EXCEVTENA_Pos) /*!< DWT CTRL: EXCEVTENA Mask */ + +#define DWT_CTRL_CPIEVTENA_Pos 17U /*!< DWT CTRL: CPIEVTENA Position */ +#define DWT_CTRL_CPIEVTENA_Msk (0x1UL << DWT_CTRL_CPIEVTENA_Pos) /*!< DWT CTRL: CPIEVTENA Mask */ + +#define DWT_CTRL_EXCTRCENA_Pos 16U /*!< DWT CTRL: EXCTRCENA Position */ +#define DWT_CTRL_EXCTRCENA_Msk (0x1UL << DWT_CTRL_EXCTRCENA_Pos) /*!< DWT CTRL: EXCTRCENA Mask */ + +#define DWT_CTRL_PCSAMPLENA_Pos 12U /*!< DWT CTRL: PCSAMPLENA Position */ +#define DWT_CTRL_PCSAMPLENA_Msk (0x1UL << DWT_CTRL_PCSAMPLENA_Pos) /*!< DWT CTRL: PCSAMPLENA Mask */ + +#define DWT_CTRL_SYNCTAP_Pos 10U /*!< DWT CTRL: SYNCTAP Position */ +#define DWT_CTRL_SYNCTAP_Msk (0x3UL << DWT_CTRL_SYNCTAP_Pos) /*!< DWT CTRL: SYNCTAP Mask */ + +#define DWT_CTRL_CYCTAP_Pos 9U /*!< DWT CTRL: CYCTAP Position */ +#define DWT_CTRL_CYCTAP_Msk (0x1UL << DWT_CTRL_CYCTAP_Pos) /*!< DWT CTRL: CYCTAP Mask */ + +#define DWT_CTRL_POSTINIT_Pos 5U /*!< DWT CTRL: POSTINIT Position */ +#define DWT_CTRL_POSTINIT_Msk (0xFUL << DWT_CTRL_POSTINIT_Pos) /*!< DWT CTRL: POSTINIT Mask */ + +#define DWT_CTRL_POSTPRESET_Pos 1U /*!< DWT CTRL: POSTPRESET Position */ +#define DWT_CTRL_POSTPRESET_Msk (0xFUL << DWT_CTRL_POSTPRESET_Pos) /*!< DWT CTRL: POSTPRESET Mask */ + +#define DWT_CTRL_CYCCNTENA_Pos 0U /*!< DWT CTRL: CYCCNTENA Position */ +#define DWT_CTRL_CYCCNTENA_Msk (0x1UL /*<< DWT_CTRL_CYCCNTENA_Pos*/) /*!< DWT CTRL: CYCCNTENA Mask */ + +/* DWT CPI Count Register Definitions */ +#define DWT_CPICNT_CPICNT_Pos 0U /*!< DWT CPICNT: CPICNT Position */ +#define DWT_CPICNT_CPICNT_Msk (0xFFUL /*<< DWT_CPICNT_CPICNT_Pos*/) /*!< DWT CPICNT: CPICNT Mask */ + +/* DWT Exception Overhead Count Register Definitions */ +#define DWT_EXCCNT_EXCCNT_Pos 0U /*!< DWT EXCCNT: EXCCNT Position */ +#define DWT_EXCCNT_EXCCNT_Msk (0xFFUL /*<< DWT_EXCCNT_EXCCNT_Pos*/) /*!< DWT EXCCNT: EXCCNT Mask */ + +/* DWT Sleep Count Register Definitions */ +#define DWT_SLEEPCNT_SLEEPCNT_Pos 0U /*!< DWT SLEEPCNT: SLEEPCNT Position */ +#define DWT_SLEEPCNT_SLEEPCNT_Msk (0xFFUL /*<< DWT_SLEEPCNT_SLEEPCNT_Pos*/) /*!< DWT SLEEPCNT: SLEEPCNT Mask */ + +/* DWT LSU Count Register Definitions */ +#define DWT_LSUCNT_LSUCNT_Pos 0U /*!< DWT LSUCNT: LSUCNT Position */ +#define DWT_LSUCNT_LSUCNT_Msk (0xFFUL /*<< DWT_LSUCNT_LSUCNT_Pos*/) /*!< DWT LSUCNT: LSUCNT Mask */ + +/* DWT Folded-instruction Count Register Definitions */ +#define DWT_FOLDCNT_FOLDCNT_Pos 0U /*!< DWT FOLDCNT: FOLDCNT Position */ +#define DWT_FOLDCNT_FOLDCNT_Msk (0xFFUL /*<< DWT_FOLDCNT_FOLDCNT_Pos*/) /*!< DWT FOLDCNT: FOLDCNT Mask */ + +/* DWT Comparator Mask Register Definitions */ +#define DWT_MASK_MASK_Pos 0U /*!< DWT MASK: MASK Position */ +#define DWT_MASK_MASK_Msk (0x1FUL /*<< DWT_MASK_MASK_Pos*/) /*!< DWT MASK: MASK Mask */ + +/* DWT Comparator Function Register Definitions */ +#define DWT_FUNCTION_MATCHED_Pos 24U /*!< DWT FUNCTION: MATCHED Position */ +#define DWT_FUNCTION_MATCHED_Msk (0x1UL << DWT_FUNCTION_MATCHED_Pos) /*!< DWT FUNCTION: MATCHED Mask */ + +#define DWT_FUNCTION_DATAVADDR1_Pos 16U /*!< DWT FUNCTION: DATAVADDR1 Position */ +#define DWT_FUNCTION_DATAVADDR1_Msk (0xFUL << DWT_FUNCTION_DATAVADDR1_Pos) /*!< DWT FUNCTION: DATAVADDR1 Mask */ + +#define DWT_FUNCTION_DATAVADDR0_Pos 12U /*!< DWT FUNCTION: DATAVADDR0 Position */ +#define DWT_FUNCTION_DATAVADDR0_Msk (0xFUL << DWT_FUNCTION_DATAVADDR0_Pos) /*!< DWT FUNCTION: DATAVADDR0 Mask */ + +#define DWT_FUNCTION_DATAVSIZE_Pos 10U /*!< DWT FUNCTION: DATAVSIZE Position */ +#define DWT_FUNCTION_DATAVSIZE_Msk (0x3UL << DWT_FUNCTION_DATAVSIZE_Pos) /*!< DWT FUNCTION: DATAVSIZE Mask */ + +#define DWT_FUNCTION_LNK1ENA_Pos 9U /*!< DWT FUNCTION: LNK1ENA Position */ +#define DWT_FUNCTION_LNK1ENA_Msk (0x1UL << DWT_FUNCTION_LNK1ENA_Pos) /*!< DWT FUNCTION: LNK1ENA Mask */ + +#define DWT_FUNCTION_DATAVMATCH_Pos 8U /*!< DWT FUNCTION: DATAVMATCH Position */ +#define DWT_FUNCTION_DATAVMATCH_Msk (0x1UL << DWT_FUNCTION_DATAVMATCH_Pos) /*!< DWT FUNCTION: DATAVMATCH Mask */ + +#define DWT_FUNCTION_CYCMATCH_Pos 7U /*!< DWT FUNCTION: CYCMATCH Position */ +#define DWT_FUNCTION_CYCMATCH_Msk (0x1UL << DWT_FUNCTION_CYCMATCH_Pos) /*!< DWT FUNCTION: CYCMATCH Mask */ + +#define DWT_FUNCTION_EMITRANGE_Pos 5U /*!< DWT FUNCTION: EMITRANGE Position */ +#define DWT_FUNCTION_EMITRANGE_Msk (0x1UL << DWT_FUNCTION_EMITRANGE_Pos) /*!< DWT FUNCTION: EMITRANGE Mask */ + +#define DWT_FUNCTION_FUNCTION_Pos 0U /*!< DWT FUNCTION: FUNCTION Position */ +#define DWT_FUNCTION_FUNCTION_Msk (0xFUL /*<< DWT_FUNCTION_FUNCTION_Pos*/) /*!< DWT FUNCTION: FUNCTION Mask */ + +/*@}*/ /* end of group CMSIS_DWT */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_TPI Trace Port Interface (TPI) + \brief Type definitions for the Trace Port Interface (TPI) + @{ + */ + +/** + \brief Structure type to access the Trace Port Interface Register (TPI). + */ +typedef struct +{ + __IM uint32_t SSPSR; /*!< Offset: 0x000 (R/ ) Supported Parallel Port Size Register */ + __IOM uint32_t CSPSR; /*!< Offset: 0x004 (R/W) Current Parallel Port Size Register */ + uint32_t RESERVED0[2U]; + __IOM uint32_t ACPR; /*!< Offset: 0x010 (R/W) Asynchronous Clock Prescaler Register */ + uint32_t RESERVED1[55U]; + __IOM uint32_t SPPR; /*!< Offset: 0x0F0 (R/W) Selected Pin Protocol Register */ + uint32_t RESERVED2[131U]; + __IM uint32_t FFSR; /*!< Offset: 0x300 (R/ ) Formatter and Flush Status Register */ + __IOM uint32_t FFCR; /*!< Offset: 0x304 (R/W) Formatter and Flush Control Register */ + __IM uint32_t FSCR; /*!< Offset: 0x308 (R/ ) Formatter Synchronization Counter Register */ + uint32_t RESERVED3[759U]; + __IM uint32_t TRIGGER; /*!< Offset: 0xEE8 (R/ ) TRIGGER Register */ + __IM uint32_t FIFO0; /*!< Offset: 0xEEC (R/ ) Integration ETM Data */ + __IM uint32_t ITATBCTR2; /*!< Offset: 0xEF0 (R/ ) ITATBCTR2 */ + uint32_t RESERVED4[1U]; + __IM uint32_t ITATBCTR0; /*!< Offset: 0xEF8 (R/ ) ITATBCTR0 */ + __IM uint32_t FIFO1; /*!< Offset: 0xEFC (R/ ) Integration ITM Data */ + __IOM uint32_t ITCTRL; /*!< Offset: 0xF00 (R/W) Integration Mode Control */ + uint32_t RESERVED5[39U]; + __IOM uint32_t CLAIMSET; /*!< Offset: 0xFA0 (R/W) Claim tag set */ + __IOM uint32_t CLAIMCLR; /*!< Offset: 0xFA4 (R/W) Claim tag clear */ + uint32_t RESERVED7[8U]; + __IM uint32_t DEVID; /*!< Offset: 0xFC8 (R/ ) TPIU_DEVID */ + __IM uint32_t DEVTYPE; /*!< Offset: 0xFCC (R/ ) TPIU_DEVTYPE */ +} TPI_Type; + +/* TPI Asynchronous Clock Prescaler Register Definitions */ +#define TPI_ACPR_PRESCALER_Pos 0U /*!< TPI ACPR: PRESCALER Position */ +#define TPI_ACPR_PRESCALER_Msk (0x1FFFUL /*<< TPI_ACPR_PRESCALER_Pos*/) /*!< TPI ACPR: PRESCALER Mask */ + +/* TPI Selected Pin Protocol Register Definitions */ +#define TPI_SPPR_TXMODE_Pos 0U /*!< TPI SPPR: TXMODE Position */ +#define TPI_SPPR_TXMODE_Msk (0x3UL /*<< TPI_SPPR_TXMODE_Pos*/) /*!< TPI SPPR: TXMODE Mask */ + +/* TPI Formatter and Flush Status Register Definitions */ +#define TPI_FFSR_FtNonStop_Pos 3U /*!< TPI FFSR: FtNonStop Position */ +#define TPI_FFSR_FtNonStop_Msk (0x1UL << TPI_FFSR_FtNonStop_Pos) /*!< TPI FFSR: FtNonStop Mask */ + +#define TPI_FFSR_TCPresent_Pos 2U /*!< TPI FFSR: TCPresent Position */ +#define TPI_FFSR_TCPresent_Msk (0x1UL << TPI_FFSR_TCPresent_Pos) /*!< TPI FFSR: TCPresent Mask */ + +#define TPI_FFSR_FtStopped_Pos 1U /*!< TPI FFSR: FtStopped Position */ +#define TPI_FFSR_FtStopped_Msk (0x1UL << TPI_FFSR_FtStopped_Pos) /*!< TPI FFSR: FtStopped Mask */ + +#define TPI_FFSR_FlInProg_Pos 0U /*!< TPI FFSR: FlInProg Position */ +#define TPI_FFSR_FlInProg_Msk (0x1UL /*<< TPI_FFSR_FlInProg_Pos*/) /*!< TPI FFSR: FlInProg Mask */ + +/* TPI Formatter and Flush Control Register Definitions */ +#define TPI_FFCR_TrigIn_Pos 8U /*!< TPI FFCR: TrigIn Position */ +#define TPI_FFCR_TrigIn_Msk (0x1UL << TPI_FFCR_TrigIn_Pos) /*!< TPI FFCR: TrigIn Mask */ + +#define TPI_FFCR_EnFCont_Pos 1U /*!< TPI FFCR: EnFCont Position */ +#define TPI_FFCR_EnFCont_Msk (0x1UL << TPI_FFCR_EnFCont_Pos) /*!< TPI FFCR: EnFCont Mask */ + +/* TPI TRIGGER Register Definitions */ +#define TPI_TRIGGER_TRIGGER_Pos 0U /*!< TPI TRIGGER: TRIGGER Position */ +#define TPI_TRIGGER_TRIGGER_Msk (0x1UL /*<< TPI_TRIGGER_TRIGGER_Pos*/) /*!< TPI TRIGGER: TRIGGER Mask */ + +/* TPI Integration ETM Data Register Definitions (FIFO0) */ +#define TPI_FIFO0_ITM_ATVALID_Pos 29U /*!< TPI FIFO0: ITM_ATVALID Position */ +#define TPI_FIFO0_ITM_ATVALID_Msk (0x1UL << TPI_FIFO0_ITM_ATVALID_Pos) /*!< TPI FIFO0: ITM_ATVALID Mask */ + +#define TPI_FIFO0_ITM_bytecount_Pos 27U /*!< TPI FIFO0: ITM_bytecount Position */ +#define TPI_FIFO0_ITM_bytecount_Msk (0x3UL << TPI_FIFO0_ITM_bytecount_Pos) /*!< TPI FIFO0: ITM_bytecount Mask */ + +#define TPI_FIFO0_ETM_ATVALID_Pos 26U /*!< TPI FIFO0: ETM_ATVALID Position */ +#define TPI_FIFO0_ETM_ATVALID_Msk (0x1UL << TPI_FIFO0_ETM_ATVALID_Pos) /*!< TPI FIFO0: ETM_ATVALID Mask */ + +#define TPI_FIFO0_ETM_bytecount_Pos 24U /*!< TPI FIFO0: ETM_bytecount Position */ +#define TPI_FIFO0_ETM_bytecount_Msk (0x3UL << TPI_FIFO0_ETM_bytecount_Pos) /*!< TPI FIFO0: ETM_bytecount Mask */ + +#define TPI_FIFO0_ETM2_Pos 16U /*!< TPI FIFO0: ETM2 Position */ +#define TPI_FIFO0_ETM2_Msk (0xFFUL << TPI_FIFO0_ETM2_Pos) /*!< TPI FIFO0: ETM2 Mask */ + +#define TPI_FIFO0_ETM1_Pos 8U /*!< TPI FIFO0: ETM1 Position */ +#define TPI_FIFO0_ETM1_Msk (0xFFUL << TPI_FIFO0_ETM1_Pos) /*!< TPI FIFO0: ETM1 Mask */ + +#define TPI_FIFO0_ETM0_Pos 0U /*!< TPI FIFO0: ETM0 Position */ +#define TPI_FIFO0_ETM0_Msk (0xFFUL /*<< TPI_FIFO0_ETM0_Pos*/) /*!< TPI FIFO0: ETM0 Mask */ + +/* TPI ITATBCTR2 Register Definitions */ +#define TPI_ITATBCTR2_ATREADY2_Pos 0U /*!< TPI ITATBCTR2: ATREADY2 Position */ +#define TPI_ITATBCTR2_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY2_Pos*/) /*!< TPI ITATBCTR2: ATREADY2 Mask */ + +#define TPI_ITATBCTR2_ATREADY1_Pos 0U /*!< TPI ITATBCTR2: ATREADY1 Position */ +#define TPI_ITATBCTR2_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR2_ATREADY1_Pos*/) /*!< TPI ITATBCTR2: ATREADY1 Mask */ + +/* TPI Integration ITM Data Register Definitions (FIFO1) */ +#define TPI_FIFO1_ITM_ATVALID_Pos 29U /*!< TPI FIFO1: ITM_ATVALID Position */ +#define TPI_FIFO1_ITM_ATVALID_Msk (0x1UL << TPI_FIFO1_ITM_ATVALID_Pos) /*!< TPI FIFO1: ITM_ATVALID Mask */ + +#define TPI_FIFO1_ITM_bytecount_Pos 27U /*!< TPI FIFO1: ITM_bytecount Position */ +#define TPI_FIFO1_ITM_bytecount_Msk (0x3UL << TPI_FIFO1_ITM_bytecount_Pos) /*!< TPI FIFO1: ITM_bytecount Mask */ + +#define TPI_FIFO1_ETM_ATVALID_Pos 26U /*!< TPI FIFO1: ETM_ATVALID Position */ +#define TPI_FIFO1_ETM_ATVALID_Msk (0x1UL << TPI_FIFO1_ETM_ATVALID_Pos) /*!< TPI FIFO1: ETM_ATVALID Mask */ + +#define TPI_FIFO1_ETM_bytecount_Pos 24U /*!< TPI FIFO1: ETM_bytecount Position */ +#define TPI_FIFO1_ETM_bytecount_Msk (0x3UL << TPI_FIFO1_ETM_bytecount_Pos) /*!< TPI FIFO1: ETM_bytecount Mask */ + +#define TPI_FIFO1_ITM2_Pos 16U /*!< TPI FIFO1: ITM2 Position */ +#define TPI_FIFO1_ITM2_Msk (0xFFUL << TPI_FIFO1_ITM2_Pos) /*!< TPI FIFO1: ITM2 Mask */ + +#define TPI_FIFO1_ITM1_Pos 8U /*!< TPI FIFO1: ITM1 Position */ +#define TPI_FIFO1_ITM1_Msk (0xFFUL << TPI_FIFO1_ITM1_Pos) /*!< TPI FIFO1: ITM1 Mask */ + +#define TPI_FIFO1_ITM0_Pos 0U /*!< TPI FIFO1: ITM0 Position */ +#define TPI_FIFO1_ITM0_Msk (0xFFUL /*<< TPI_FIFO1_ITM0_Pos*/) /*!< TPI FIFO1: ITM0 Mask */ + +/* TPI ITATBCTR0 Register Definitions */ +#define TPI_ITATBCTR0_ATREADY2_Pos 0U /*!< TPI ITATBCTR0: ATREADY2 Position */ +#define TPI_ITATBCTR0_ATREADY2_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY2_Pos*/) /*!< TPI ITATBCTR0: ATREADY2 Mask */ + +#define TPI_ITATBCTR0_ATREADY1_Pos 0U /*!< TPI ITATBCTR0: ATREADY1 Position */ +#define TPI_ITATBCTR0_ATREADY1_Msk (0x1UL /*<< TPI_ITATBCTR0_ATREADY1_Pos*/) /*!< TPI ITATBCTR0: ATREADY1 Mask */ + +/* TPI Integration Mode Control Register Definitions */ +#define TPI_ITCTRL_Mode_Pos 0U /*!< TPI ITCTRL: Mode Position */ +#define TPI_ITCTRL_Mode_Msk (0x3UL /*<< TPI_ITCTRL_Mode_Pos*/) /*!< TPI ITCTRL: Mode Mask */ + +/* TPI DEVID Register Definitions */ +#define TPI_DEVID_NRZVALID_Pos 11U /*!< TPI DEVID: NRZVALID Position */ +#define TPI_DEVID_NRZVALID_Msk (0x1UL << TPI_DEVID_NRZVALID_Pos) /*!< TPI DEVID: NRZVALID Mask */ + +#define TPI_DEVID_MANCVALID_Pos 10U /*!< TPI DEVID: MANCVALID Position */ +#define TPI_DEVID_MANCVALID_Msk (0x1UL << TPI_DEVID_MANCVALID_Pos) /*!< TPI DEVID: MANCVALID Mask */ + +#define TPI_DEVID_PTINVALID_Pos 9U /*!< TPI DEVID: PTINVALID Position */ +#define TPI_DEVID_PTINVALID_Msk (0x1UL << TPI_DEVID_PTINVALID_Pos) /*!< TPI DEVID: PTINVALID Mask */ + +#define TPI_DEVID_MinBufSz_Pos 6U /*!< TPI DEVID: MinBufSz Position */ +#define TPI_DEVID_MinBufSz_Msk (0x7UL << TPI_DEVID_MinBufSz_Pos) /*!< TPI DEVID: MinBufSz Mask */ + +#define TPI_DEVID_AsynClkIn_Pos 5U /*!< TPI DEVID: AsynClkIn Position */ +#define TPI_DEVID_AsynClkIn_Msk (0x1UL << TPI_DEVID_AsynClkIn_Pos) /*!< TPI DEVID: AsynClkIn Mask */ + +#define TPI_DEVID_NrTraceInput_Pos 0U /*!< TPI DEVID: NrTraceInput Position */ +#define TPI_DEVID_NrTraceInput_Msk (0x1FUL /*<< TPI_DEVID_NrTraceInput_Pos*/) /*!< TPI DEVID: NrTraceInput Mask */ + +/* TPI DEVTYPE Register Definitions */ +#define TPI_DEVTYPE_SubType_Pos 4U /*!< TPI DEVTYPE: SubType Position */ +#define TPI_DEVTYPE_SubType_Msk (0xFUL /*<< TPI_DEVTYPE_SubType_Pos*/) /*!< TPI DEVTYPE: SubType Mask */ + +#define TPI_DEVTYPE_MajorType_Pos 0U /*!< TPI DEVTYPE: MajorType Position */ +#define TPI_DEVTYPE_MajorType_Msk (0xFUL << TPI_DEVTYPE_MajorType_Pos) /*!< TPI DEVTYPE: MajorType Mask */ + +/*@}*/ /* end of group CMSIS_TPI */ + + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_MPU Memory Protection Unit (MPU) + \brief Type definitions for the Memory Protection Unit (MPU) + @{ + */ + +/** + \brief Structure type to access the Memory Protection Unit (MPU). + */ +typedef struct +{ + __IM uint32_t TYPE; /*!< Offset: 0x000 (R/ ) MPU Type Register */ + __IOM uint32_t CTRL; /*!< Offset: 0x004 (R/W) MPU Control Register */ + __IOM uint32_t RNR; /*!< Offset: 0x008 (R/W) MPU Region RNRber Register */ + __IOM uint32_t RBAR; /*!< Offset: 0x00C (R/W) MPU Region Base Address Register */ + __IOM uint32_t RASR; /*!< Offset: 0x010 (R/W) MPU Region Attribute and Size Register */ + __IOM uint32_t RBAR_A1; /*!< Offset: 0x014 (R/W) MPU Alias 1 Region Base Address Register */ + __IOM uint32_t RASR_A1; /*!< Offset: 0x018 (R/W) MPU Alias 1 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A2; /*!< Offset: 0x01C (R/W) MPU Alias 2 Region Base Address Register */ + __IOM uint32_t RASR_A2; /*!< Offset: 0x020 (R/W) MPU Alias 2 Region Attribute and Size Register */ + __IOM uint32_t RBAR_A3; /*!< Offset: 0x024 (R/W) MPU Alias 3 Region Base Address Register */ + __IOM uint32_t RASR_A3; /*!< Offset: 0x028 (R/W) MPU Alias 3 Region Attribute and Size Register */ +} MPU_Type; + +#define MPU_TYPE_RALIASES 4U + +/* MPU Type Register Definitions */ +#define MPU_TYPE_IREGION_Pos 16U /*!< MPU TYPE: IREGION Position */ +#define MPU_TYPE_IREGION_Msk (0xFFUL << MPU_TYPE_IREGION_Pos) /*!< MPU TYPE: IREGION Mask */ + +#define MPU_TYPE_DREGION_Pos 8U /*!< MPU TYPE: DREGION Position */ +#define MPU_TYPE_DREGION_Msk (0xFFUL << MPU_TYPE_DREGION_Pos) /*!< MPU TYPE: DREGION Mask */ + +#define MPU_TYPE_SEPARATE_Pos 0U /*!< MPU TYPE: SEPARATE Position */ +#define MPU_TYPE_SEPARATE_Msk (1UL /*<< MPU_TYPE_SEPARATE_Pos*/) /*!< MPU TYPE: SEPARATE Mask */ + +/* MPU Control Register Definitions */ +#define MPU_CTRL_PRIVDEFENA_Pos 2U /*!< MPU CTRL: PRIVDEFENA Position */ +#define MPU_CTRL_PRIVDEFENA_Msk (1UL << MPU_CTRL_PRIVDEFENA_Pos) /*!< MPU CTRL: PRIVDEFENA Mask */ + +#define MPU_CTRL_HFNMIENA_Pos 1U /*!< MPU CTRL: HFNMIENA Position */ +#define MPU_CTRL_HFNMIENA_Msk (1UL << MPU_CTRL_HFNMIENA_Pos) /*!< MPU CTRL: HFNMIENA Mask */ + +#define MPU_CTRL_ENABLE_Pos 0U /*!< MPU CTRL: ENABLE Position */ +#define MPU_CTRL_ENABLE_Msk (1UL /*<< MPU_CTRL_ENABLE_Pos*/) /*!< MPU CTRL: ENABLE Mask */ + +/* MPU Region Number Register Definitions */ +#define MPU_RNR_REGION_Pos 0U /*!< MPU RNR: REGION Position */ +#define MPU_RNR_REGION_Msk (0xFFUL /*<< MPU_RNR_REGION_Pos*/) /*!< MPU RNR: REGION Mask */ + +/* MPU Region Base Address Register Definitions */ +#define MPU_RBAR_ADDR_Pos 5U /*!< MPU RBAR: ADDR Position */ +#define MPU_RBAR_ADDR_Msk (0x7FFFFFFUL << MPU_RBAR_ADDR_Pos) /*!< MPU RBAR: ADDR Mask */ + +#define MPU_RBAR_VALID_Pos 4U /*!< MPU RBAR: VALID Position */ +#define MPU_RBAR_VALID_Msk (1UL << MPU_RBAR_VALID_Pos) /*!< MPU RBAR: VALID Mask */ + +#define MPU_RBAR_REGION_Pos 0U /*!< MPU RBAR: REGION Position */ +#define MPU_RBAR_REGION_Msk (0xFUL /*<< MPU_RBAR_REGION_Pos*/) /*!< MPU RBAR: REGION Mask */ + +/* MPU Region Attribute and Size Register Definitions */ +#define MPU_RASR_ATTRS_Pos 16U /*!< MPU RASR: MPU Region Attribute field Position */ +#define MPU_RASR_ATTRS_Msk (0xFFFFUL << MPU_RASR_ATTRS_Pos) /*!< MPU RASR: MPU Region Attribute field Mask */ + +#define MPU_RASR_XN_Pos 28U /*!< MPU RASR: ATTRS.XN Position */ +#define MPU_RASR_XN_Msk (1UL << MPU_RASR_XN_Pos) /*!< MPU RASR: ATTRS.XN Mask */ + +#define MPU_RASR_AP_Pos 24U /*!< MPU RASR: ATTRS.AP Position */ +#define MPU_RASR_AP_Msk (0x7UL << MPU_RASR_AP_Pos) /*!< MPU RASR: ATTRS.AP Mask */ + +#define MPU_RASR_TEX_Pos 19U /*!< MPU RASR: ATTRS.TEX Position */ +#define MPU_RASR_TEX_Msk (0x7UL << MPU_RASR_TEX_Pos) /*!< MPU RASR: ATTRS.TEX Mask */ + +#define MPU_RASR_S_Pos 18U /*!< MPU RASR: ATTRS.S Position */ +#define MPU_RASR_S_Msk (1UL << MPU_RASR_S_Pos) /*!< MPU RASR: ATTRS.S Mask */ + +#define MPU_RASR_C_Pos 17U /*!< MPU RASR: ATTRS.C Position */ +#define MPU_RASR_C_Msk (1UL << MPU_RASR_C_Pos) /*!< MPU RASR: ATTRS.C Mask */ + +#define MPU_RASR_B_Pos 16U /*!< MPU RASR: ATTRS.B Position */ +#define MPU_RASR_B_Msk (1UL << MPU_RASR_B_Pos) /*!< MPU RASR: ATTRS.B Mask */ + +#define MPU_RASR_SRD_Pos 8U /*!< MPU RASR: Sub-Region Disable Position */ +#define MPU_RASR_SRD_Msk (0xFFUL << MPU_RASR_SRD_Pos) /*!< MPU RASR: Sub-Region Disable Mask */ + +#define MPU_RASR_SIZE_Pos 1U /*!< MPU RASR: Region Size Field Position */ +#define MPU_RASR_SIZE_Msk (0x1FUL << MPU_RASR_SIZE_Pos) /*!< MPU RASR: Region Size Field Mask */ + +#define MPU_RASR_ENABLE_Pos 0U /*!< MPU RASR: Region enable bit Position */ +#define MPU_RASR_ENABLE_Msk (1UL /*<< MPU_RASR_ENABLE_Pos*/) /*!< MPU RASR: Region enable bit Disable Mask */ + +/*@} end of group CMSIS_MPU */ +#endif /* defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_FPU Floating Point Unit (FPU) + \brief Type definitions for the Floating Point Unit (FPU) + @{ + */ + +/** + \brief Structure type to access the Floating Point Unit (FPU). + */ +typedef struct +{ + uint32_t RESERVED0[1U]; + __IOM uint32_t FPCCR; /*!< Offset: 0x004 (R/W) Floating-Point Context Control Register */ + __IOM uint32_t FPCAR; /*!< Offset: 0x008 (R/W) Floating-Point Context Address Register */ + __IOM uint32_t FPDSCR; /*!< Offset: 0x00C (R/W) Floating-Point Default Status Control Register */ + __IM uint32_t MVFR0; /*!< Offset: 0x010 (R/ ) Media and FP Feature Register 0 */ + __IM uint32_t MVFR1; /*!< Offset: 0x014 (R/ ) Media and FP Feature Register 1 */ + __IM uint32_t MVFR2; /*!< Offset: 0x018 (R/ ) Media and FP Feature Register 2 */ +} FPU_Type; + +/* Floating-Point Context Control Register Definitions */ +#define FPU_FPCCR_ASPEN_Pos 31U /*!< FPCCR: ASPEN bit Position */ +#define FPU_FPCCR_ASPEN_Msk (1UL << FPU_FPCCR_ASPEN_Pos) /*!< FPCCR: ASPEN bit Mask */ + +#define FPU_FPCCR_LSPEN_Pos 30U /*!< FPCCR: LSPEN Position */ +#define FPU_FPCCR_LSPEN_Msk (1UL << FPU_FPCCR_LSPEN_Pos) /*!< FPCCR: LSPEN bit Mask */ + +#define FPU_FPCCR_MONRDY_Pos 8U /*!< FPCCR: MONRDY Position */ +#define FPU_FPCCR_MONRDY_Msk (1UL << FPU_FPCCR_MONRDY_Pos) /*!< FPCCR: MONRDY bit Mask */ + +#define FPU_FPCCR_BFRDY_Pos 6U /*!< FPCCR: BFRDY Position */ +#define FPU_FPCCR_BFRDY_Msk (1UL << FPU_FPCCR_BFRDY_Pos) /*!< FPCCR: BFRDY bit Mask */ + +#define FPU_FPCCR_MMRDY_Pos 5U /*!< FPCCR: MMRDY Position */ +#define FPU_FPCCR_MMRDY_Msk (1UL << FPU_FPCCR_MMRDY_Pos) /*!< FPCCR: MMRDY bit Mask */ + +#define FPU_FPCCR_HFRDY_Pos 4U /*!< FPCCR: HFRDY Position */ +#define FPU_FPCCR_HFRDY_Msk (1UL << FPU_FPCCR_HFRDY_Pos) /*!< FPCCR: HFRDY bit Mask */ + +#define FPU_FPCCR_THREAD_Pos 3U /*!< FPCCR: processor mode bit Position */ +#define FPU_FPCCR_THREAD_Msk (1UL << FPU_FPCCR_THREAD_Pos) /*!< FPCCR: processor mode active bit Mask */ + +#define FPU_FPCCR_USER_Pos 1U /*!< FPCCR: privilege level bit Position */ +#define FPU_FPCCR_USER_Msk (1UL << FPU_FPCCR_USER_Pos) /*!< FPCCR: privilege level bit Mask */ + +#define FPU_FPCCR_LSPACT_Pos 0U /*!< FPCCR: Lazy state preservation active bit Position */ +#define FPU_FPCCR_LSPACT_Msk (1UL /*<< FPU_FPCCR_LSPACT_Pos*/) /*!< FPCCR: Lazy state preservation active bit Mask */ + +/* Floating-Point Context Address Register Definitions */ +#define FPU_FPCAR_ADDRESS_Pos 3U /*!< FPCAR: ADDRESS bit Position */ +#define FPU_FPCAR_ADDRESS_Msk (0x1FFFFFFFUL << FPU_FPCAR_ADDRESS_Pos) /*!< FPCAR: ADDRESS bit Mask */ + +/* Floating-Point Default Status Control Register Definitions */ +#define FPU_FPDSCR_AHP_Pos 26U /*!< FPDSCR: AHP bit Position */ +#define FPU_FPDSCR_AHP_Msk (1UL << FPU_FPDSCR_AHP_Pos) /*!< FPDSCR: AHP bit Mask */ + +#define FPU_FPDSCR_DN_Pos 25U /*!< FPDSCR: DN bit Position */ +#define FPU_FPDSCR_DN_Msk (1UL << FPU_FPDSCR_DN_Pos) /*!< FPDSCR: DN bit Mask */ + +#define FPU_FPDSCR_FZ_Pos 24U /*!< FPDSCR: FZ bit Position */ +#define FPU_FPDSCR_FZ_Msk (1UL << FPU_FPDSCR_FZ_Pos) /*!< FPDSCR: FZ bit Mask */ + +#define FPU_FPDSCR_RMode_Pos 22U /*!< FPDSCR: RMode bit Position */ +#define FPU_FPDSCR_RMode_Msk (3UL << FPU_FPDSCR_RMode_Pos) /*!< FPDSCR: RMode bit Mask */ + +/* Media and FP Feature Register 0 Definitions */ +#define FPU_MVFR0_FP_rounding_modes_Pos 28U /*!< MVFR0: FP rounding modes bits Position */ +#define FPU_MVFR0_FP_rounding_modes_Msk (0xFUL << FPU_MVFR0_FP_rounding_modes_Pos) /*!< MVFR0: FP rounding modes bits Mask */ + +#define FPU_MVFR0_Short_vectors_Pos 24U /*!< MVFR0: Short vectors bits Position */ +#define FPU_MVFR0_Short_vectors_Msk (0xFUL << FPU_MVFR0_Short_vectors_Pos) /*!< MVFR0: Short vectors bits Mask */ + +#define FPU_MVFR0_Square_root_Pos 20U /*!< MVFR0: Square root bits Position */ +#define FPU_MVFR0_Square_root_Msk (0xFUL << FPU_MVFR0_Square_root_Pos) /*!< MVFR0: Square root bits Mask */ + +#define FPU_MVFR0_Divide_Pos 16U /*!< MVFR0: Divide bits Position */ +#define FPU_MVFR0_Divide_Msk (0xFUL << FPU_MVFR0_Divide_Pos) /*!< MVFR0: Divide bits Mask */ + +#define FPU_MVFR0_FP_excep_trapping_Pos 12U /*!< MVFR0: FP exception trapping bits Position */ +#define FPU_MVFR0_FP_excep_trapping_Msk (0xFUL << FPU_MVFR0_FP_excep_trapping_Pos) /*!< MVFR0: FP exception trapping bits Mask */ + +#define FPU_MVFR0_Double_precision_Pos 8U /*!< MVFR0: Double-precision bits Position */ +#define FPU_MVFR0_Double_precision_Msk (0xFUL << FPU_MVFR0_Double_precision_Pos) /*!< MVFR0: Double-precision bits Mask */ + +#define FPU_MVFR0_Single_precision_Pos 4U /*!< MVFR0: Single-precision bits Position */ +#define FPU_MVFR0_Single_precision_Msk (0xFUL << FPU_MVFR0_Single_precision_Pos) /*!< MVFR0: Single-precision bits Mask */ + +#define FPU_MVFR0_A_SIMD_registers_Pos 0U /*!< MVFR0: A_SIMD registers bits Position */ +#define FPU_MVFR0_A_SIMD_registers_Msk (0xFUL /*<< FPU_MVFR0_A_SIMD_registers_Pos*/) /*!< MVFR0: A_SIMD registers bits Mask */ + +/* Media and FP Feature Register 1 Definitions */ +#define FPU_MVFR1_FP_fused_MAC_Pos 28U /*!< MVFR1: FP fused MAC bits Position */ +#define FPU_MVFR1_FP_fused_MAC_Msk (0xFUL << FPU_MVFR1_FP_fused_MAC_Pos) /*!< MVFR1: FP fused MAC bits Mask */ + +#define FPU_MVFR1_FP_HPFP_Pos 24U /*!< MVFR1: FP HPFP bits Position */ +#define FPU_MVFR1_FP_HPFP_Msk (0xFUL << FPU_MVFR1_FP_HPFP_Pos) /*!< MVFR1: FP HPFP bits Mask */ + +#define FPU_MVFR1_D_NaN_mode_Pos 4U /*!< MVFR1: D_NaN mode bits Position */ +#define FPU_MVFR1_D_NaN_mode_Msk (0xFUL << FPU_MVFR1_D_NaN_mode_Pos) /*!< MVFR1: D_NaN mode bits Mask */ + +#define FPU_MVFR1_FtZ_mode_Pos 0U /*!< MVFR1: FtZ mode bits Position */ +#define FPU_MVFR1_FtZ_mode_Msk (0xFUL /*<< FPU_MVFR1_FtZ_mode_Pos*/) /*!< MVFR1: FtZ mode bits Mask */ + +/* Media and FP Feature Register 2 Definitions */ + +#define FPU_MVFR2_VFP_Misc_Pos 4U /*!< MVFR2: VFP Misc bits Position */ +#define FPU_MVFR2_VFP_Misc_Msk (0xFUL << FPU_MVFR2_VFP_Misc_Pos) /*!< MVFR2: VFP Misc bits Mask */ + +/*@} end of group CMSIS_FPU */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_CoreDebug Core Debug Registers (CoreDebug) + \brief Type definitions for the Core Debug Registers + @{ + */ + +/** + \brief Structure type to access the Core Debug Register (CoreDebug). + */ +typedef struct +{ + __IOM uint32_t DHCSR; /*!< Offset: 0x000 (R/W) Debug Halting Control and Status Register */ + __OM uint32_t DCRSR; /*!< Offset: 0x004 ( /W) Debug Core Register Selector Register */ + __IOM uint32_t DCRDR; /*!< Offset: 0x008 (R/W) Debug Core Register Data Register */ + __IOM uint32_t DEMCR; /*!< Offset: 0x00C (R/W) Debug Exception and Monitor Control Register */ +} CoreDebug_Type; + +/* Debug Halting Control and Status Register Definitions */ +#define CoreDebug_DHCSR_DBGKEY_Pos 16U /*!< CoreDebug DHCSR: DBGKEY Position */ +#define CoreDebug_DHCSR_DBGKEY_Msk (0xFFFFUL << CoreDebug_DHCSR_DBGKEY_Pos) /*!< CoreDebug DHCSR: DBGKEY Mask */ + +#define CoreDebug_DHCSR_S_RESET_ST_Pos 25U /*!< CoreDebug DHCSR: S_RESET_ST Position */ +#define CoreDebug_DHCSR_S_RESET_ST_Msk (1UL << CoreDebug_DHCSR_S_RESET_ST_Pos) /*!< CoreDebug DHCSR: S_RESET_ST Mask */ + +#define CoreDebug_DHCSR_S_RETIRE_ST_Pos 24U /*!< CoreDebug DHCSR: S_RETIRE_ST Position */ +#define CoreDebug_DHCSR_S_RETIRE_ST_Msk (1UL << CoreDebug_DHCSR_S_RETIRE_ST_Pos) /*!< CoreDebug DHCSR: S_RETIRE_ST Mask */ + +#define CoreDebug_DHCSR_S_LOCKUP_Pos 19U /*!< CoreDebug DHCSR: S_LOCKUP Position */ +#define CoreDebug_DHCSR_S_LOCKUP_Msk (1UL << CoreDebug_DHCSR_S_LOCKUP_Pos) /*!< CoreDebug DHCSR: S_LOCKUP Mask */ + +#define CoreDebug_DHCSR_S_SLEEP_Pos 18U /*!< CoreDebug DHCSR: S_SLEEP Position */ +#define CoreDebug_DHCSR_S_SLEEP_Msk (1UL << CoreDebug_DHCSR_S_SLEEP_Pos) /*!< CoreDebug DHCSR: S_SLEEP Mask */ + +#define CoreDebug_DHCSR_S_HALT_Pos 17U /*!< CoreDebug DHCSR: S_HALT Position */ +#define CoreDebug_DHCSR_S_HALT_Msk (1UL << CoreDebug_DHCSR_S_HALT_Pos) /*!< CoreDebug DHCSR: S_HALT Mask */ + +#define CoreDebug_DHCSR_S_REGRDY_Pos 16U /*!< CoreDebug DHCSR: S_REGRDY Position */ +#define CoreDebug_DHCSR_S_REGRDY_Msk (1UL << CoreDebug_DHCSR_S_REGRDY_Pos) /*!< CoreDebug DHCSR: S_REGRDY Mask */ + +#define CoreDebug_DHCSR_C_SNAPSTALL_Pos 5U /*!< CoreDebug DHCSR: C_SNAPSTALL Position */ +#define CoreDebug_DHCSR_C_SNAPSTALL_Msk (1UL << CoreDebug_DHCSR_C_SNAPSTALL_Pos) /*!< CoreDebug DHCSR: C_SNAPSTALL Mask */ + +#define CoreDebug_DHCSR_C_MASKINTS_Pos 3U /*!< CoreDebug DHCSR: C_MASKINTS Position */ +#define CoreDebug_DHCSR_C_MASKINTS_Msk (1UL << CoreDebug_DHCSR_C_MASKINTS_Pos) /*!< CoreDebug DHCSR: C_MASKINTS Mask */ + +#define CoreDebug_DHCSR_C_STEP_Pos 2U /*!< CoreDebug DHCSR: C_STEP Position */ +#define CoreDebug_DHCSR_C_STEP_Msk (1UL << CoreDebug_DHCSR_C_STEP_Pos) /*!< CoreDebug DHCSR: C_STEP Mask */ + +#define CoreDebug_DHCSR_C_HALT_Pos 1U /*!< CoreDebug DHCSR: C_HALT Position */ +#define CoreDebug_DHCSR_C_HALT_Msk (1UL << CoreDebug_DHCSR_C_HALT_Pos) /*!< CoreDebug DHCSR: C_HALT Mask */ + +#define CoreDebug_DHCSR_C_DEBUGEN_Pos 0U /*!< CoreDebug DHCSR: C_DEBUGEN Position */ +#define CoreDebug_DHCSR_C_DEBUGEN_Msk (1UL /*<< CoreDebug_DHCSR_C_DEBUGEN_Pos*/) /*!< CoreDebug DHCSR: C_DEBUGEN Mask */ + +/* Debug Core Register Selector Register Definitions */ +#define CoreDebug_DCRSR_REGWnR_Pos 16U /*!< CoreDebug DCRSR: REGWnR Position */ +#define CoreDebug_DCRSR_REGWnR_Msk (1UL << CoreDebug_DCRSR_REGWnR_Pos) /*!< CoreDebug DCRSR: REGWnR Mask */ + +#define CoreDebug_DCRSR_REGSEL_Pos 0U /*!< CoreDebug DCRSR: REGSEL Position */ +#define CoreDebug_DCRSR_REGSEL_Msk (0x1FUL /*<< CoreDebug_DCRSR_REGSEL_Pos*/) /*!< CoreDebug DCRSR: REGSEL Mask */ + +/* Debug Exception and Monitor Control Register Definitions */ +#define CoreDebug_DEMCR_TRCENA_Pos 24U /*!< CoreDebug DEMCR: TRCENA Position */ +#define CoreDebug_DEMCR_TRCENA_Msk (1UL << CoreDebug_DEMCR_TRCENA_Pos) /*!< CoreDebug DEMCR: TRCENA Mask */ + +#define CoreDebug_DEMCR_MON_REQ_Pos 19U /*!< CoreDebug DEMCR: MON_REQ Position */ +#define CoreDebug_DEMCR_MON_REQ_Msk (1UL << CoreDebug_DEMCR_MON_REQ_Pos) /*!< CoreDebug DEMCR: MON_REQ Mask */ + +#define CoreDebug_DEMCR_MON_STEP_Pos 18U /*!< CoreDebug DEMCR: MON_STEP Position */ +#define CoreDebug_DEMCR_MON_STEP_Msk (1UL << CoreDebug_DEMCR_MON_STEP_Pos) /*!< CoreDebug DEMCR: MON_STEP Mask */ + +#define CoreDebug_DEMCR_MON_PEND_Pos 17U /*!< CoreDebug DEMCR: MON_PEND Position */ +#define CoreDebug_DEMCR_MON_PEND_Msk (1UL << CoreDebug_DEMCR_MON_PEND_Pos) /*!< CoreDebug DEMCR: MON_PEND Mask */ + +#define CoreDebug_DEMCR_MON_EN_Pos 16U /*!< CoreDebug DEMCR: MON_EN Position */ +#define CoreDebug_DEMCR_MON_EN_Msk (1UL << CoreDebug_DEMCR_MON_EN_Pos) /*!< CoreDebug DEMCR: MON_EN Mask */ + +#define CoreDebug_DEMCR_VC_HARDERR_Pos 10U /*!< CoreDebug DEMCR: VC_HARDERR Position */ +#define CoreDebug_DEMCR_VC_HARDERR_Msk (1UL << CoreDebug_DEMCR_VC_HARDERR_Pos) /*!< CoreDebug DEMCR: VC_HARDERR Mask */ + +#define CoreDebug_DEMCR_VC_INTERR_Pos 9U /*!< CoreDebug DEMCR: VC_INTERR Position */ +#define CoreDebug_DEMCR_VC_INTERR_Msk (1UL << CoreDebug_DEMCR_VC_INTERR_Pos) /*!< CoreDebug DEMCR: VC_INTERR Mask */ + +#define CoreDebug_DEMCR_VC_BUSERR_Pos 8U /*!< CoreDebug DEMCR: VC_BUSERR Position */ +#define CoreDebug_DEMCR_VC_BUSERR_Msk (1UL << CoreDebug_DEMCR_VC_BUSERR_Pos) /*!< CoreDebug DEMCR: VC_BUSERR Mask */ + +#define CoreDebug_DEMCR_VC_STATERR_Pos 7U /*!< CoreDebug DEMCR: VC_STATERR Position */ +#define CoreDebug_DEMCR_VC_STATERR_Msk (1UL << CoreDebug_DEMCR_VC_STATERR_Pos) /*!< CoreDebug DEMCR: VC_STATERR Mask */ + +#define CoreDebug_DEMCR_VC_CHKERR_Pos 6U /*!< CoreDebug DEMCR: VC_CHKERR Position */ +#define CoreDebug_DEMCR_VC_CHKERR_Msk (1UL << CoreDebug_DEMCR_VC_CHKERR_Pos) /*!< CoreDebug DEMCR: VC_CHKERR Mask */ + +#define CoreDebug_DEMCR_VC_NOCPERR_Pos 5U /*!< CoreDebug DEMCR: VC_NOCPERR Position */ +#define CoreDebug_DEMCR_VC_NOCPERR_Msk (1UL << CoreDebug_DEMCR_VC_NOCPERR_Pos) /*!< CoreDebug DEMCR: VC_NOCPERR Mask */ + +#define CoreDebug_DEMCR_VC_MMERR_Pos 4U /*!< CoreDebug DEMCR: VC_MMERR Position */ +#define CoreDebug_DEMCR_VC_MMERR_Msk (1UL << CoreDebug_DEMCR_VC_MMERR_Pos) /*!< CoreDebug DEMCR: VC_MMERR Mask */ + +#define CoreDebug_DEMCR_VC_CORERESET_Pos 0U /*!< CoreDebug DEMCR: VC_CORERESET Position */ +#define CoreDebug_DEMCR_VC_CORERESET_Msk (1UL /*<< CoreDebug_DEMCR_VC_CORERESET_Pos*/) /*!< CoreDebug DEMCR: VC_CORERESET Mask */ + +/*@} end of group CMSIS_CoreDebug */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_bitfield Core register bit field macros + \brief Macros for use with bit field definitions (xxx_Pos, xxx_Msk). + @{ + */ + +/** + \brief Mask and shift a bit field value for use in a register bit range. + \param[in] field Name of the register bit field. + \param[in] value Value of the bit field. This parameter is interpreted as an uint32_t type. + \return Masked and shifted value. +*/ +#define _VAL2FLD(field, value) (((uint32_t)(value) << field ## _Pos) & field ## _Msk) + +/** + \brief Mask and shift a register value to extract a bit filed value. + \param[in] field Name of the register bit field. + \param[in] value Value of register. This parameter is interpreted as an uint32_t type. + \return Masked and shifted bit field value. +*/ +#define _FLD2VAL(field, value) (((uint32_t)(value) & field ## _Msk) >> field ## _Pos) + +/*@} end of group CMSIS_core_bitfield */ + + +/** + \ingroup CMSIS_core_register + \defgroup CMSIS_core_base Core Definitions + \brief Definitions for base addresses, unions, and structures. + @{ + */ + +/* Memory mapping of Core Hardware */ +#define SCS_BASE (0xE000E000UL) /*!< System Control Space Base Address */ +#define ITM_BASE (0xE0000000UL) /*!< ITM Base Address */ +#define DWT_BASE (0xE0001000UL) /*!< DWT Base Address */ +#define TPI_BASE (0xE0040000UL) /*!< TPI Base Address */ +#define CoreDebug_BASE (0xE000EDF0UL) /*!< Core Debug Base Address */ +#define SysTick_BASE (SCS_BASE + 0x0010UL) /*!< SysTick Base Address */ +#define NVIC_BASE (SCS_BASE + 0x0100UL) /*!< NVIC Base Address */ +#define SCB_BASE (SCS_BASE + 0x0D00UL) /*!< System Control Block Base Address */ + +#define SCnSCB ((SCnSCB_Type *) SCS_BASE ) /*!< System control Register not in SCB */ +#define SCB ((SCB_Type *) SCB_BASE ) /*!< SCB configuration struct */ +#define SysTick ((SysTick_Type *) SysTick_BASE ) /*!< SysTick configuration struct */ +#define NVIC ((NVIC_Type *) NVIC_BASE ) /*!< NVIC configuration struct */ +#define ITM ((ITM_Type *) ITM_BASE ) /*!< ITM configuration struct */ +#define DWT ((DWT_Type *) DWT_BASE ) /*!< DWT configuration struct */ +#define TPI ((TPI_Type *) TPI_BASE ) /*!< TPI configuration struct */ +#define CoreDebug ((CoreDebug_Type *) CoreDebug_BASE) /*!< Core Debug configuration struct */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + #define MPU_BASE (SCS_BASE + 0x0D90UL) /*!< Memory Protection Unit */ + #define MPU ((MPU_Type *) MPU_BASE ) /*!< Memory Protection Unit */ +#endif + +#define FPU_BASE (SCS_BASE + 0x0F30UL) /*!< Floating Point Unit */ +#define FPU ((FPU_Type *) FPU_BASE ) /*!< Floating Point Unit */ + +/*@} */ + + + +/******************************************************************************* + * Hardware Abstraction Layer + Core Function Interface contains: + - Core NVIC Functions + - Core SysTick Functions + - Core Debug Functions + - Core Register Access Functions + ******************************************************************************/ +/** + \defgroup CMSIS_Core_FunctionInterface Functions and Instructions Reference +*/ + + + +/* ########################## NVIC functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_NVICFunctions NVIC Functions + \brief Functions that manage interrupts and exceptions via the NVIC. + @{ + */ + +#ifdef CMSIS_NVIC_VIRTUAL + #ifndef CMSIS_NVIC_VIRTUAL_HEADER_FILE + #define CMSIS_NVIC_VIRTUAL_HEADER_FILE "cmsis_nvic_virtual.h" + #endif + #include CMSIS_NVIC_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping + #define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping + #define NVIC_EnableIRQ __NVIC_EnableIRQ + #define NVIC_GetEnableIRQ __NVIC_GetEnableIRQ + #define NVIC_DisableIRQ __NVIC_DisableIRQ + #define NVIC_GetPendingIRQ __NVIC_GetPendingIRQ + #define NVIC_SetPendingIRQ __NVIC_SetPendingIRQ + #define NVIC_ClearPendingIRQ __NVIC_ClearPendingIRQ + #define NVIC_GetActive __NVIC_GetActive + #define NVIC_SetPriority __NVIC_SetPriority + #define NVIC_GetPriority __NVIC_GetPriority + #define NVIC_SystemReset __NVIC_SystemReset +#endif /* CMSIS_NVIC_VIRTUAL */ + +#ifdef CMSIS_VECTAB_VIRTUAL + #ifndef CMSIS_VECTAB_VIRTUAL_HEADER_FILE + #define CMSIS_VECTAB_VIRTUAL_HEADER_FILE "cmsis_vectab_virtual.h" + #endif + #include CMSIS_VECTAB_VIRTUAL_HEADER_FILE +#else + #define NVIC_SetVector __NVIC_SetVector + #define NVIC_GetVector __NVIC_GetVector +#endif /* (CMSIS_VECTAB_VIRTUAL) */ + +#define NVIC_USER_IRQ_OFFSET 16 + + +/* The following EXC_RETURN values are saved the LR on exception entry */ +#define EXC_RETURN_HANDLER (0xFFFFFFF1UL) /* return to Handler mode, uses MSP after return */ +#define EXC_RETURN_THREAD_MSP (0xFFFFFFF9UL) /* return to Thread mode, uses MSP after return */ +#define EXC_RETURN_THREAD_PSP (0xFFFFFFFDUL) /* return to Thread mode, uses PSP after return */ +#define EXC_RETURN_HANDLER_FPU (0xFFFFFFE1UL) /* return to Handler mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_MSP_FPU (0xFFFFFFE9UL) /* return to Thread mode, uses MSP after return, restore floating-point state */ +#define EXC_RETURN_THREAD_PSP_FPU (0xFFFFFFEDUL) /* return to Thread mode, uses PSP after return, restore floating-point state */ + + +/** + \brief Set Priority Grouping + \details Sets the priority grouping field using the required unlock sequence. + The parameter PriorityGroup is assigned to the field SCB->AIRCR [10:8] PRIGROUP field. + Only values from 0..7 are used. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Priority grouping field. + */ +__STATIC_INLINE void __NVIC_SetPriorityGrouping(uint32_t PriorityGroup) +{ + uint32_t reg_value; + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + + reg_value = SCB->AIRCR; /* read old register configuration */ + reg_value &= ~((uint32_t)(SCB_AIRCR_VECTKEY_Msk | SCB_AIRCR_PRIGROUP_Msk)); /* clear bits to change */ + reg_value = (reg_value | + ((uint32_t)0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (PriorityGroupTmp << SCB_AIRCR_PRIGROUP_Pos) ); /* Insert write key and priority group */ + SCB->AIRCR = reg_value; +} + + +/** + \brief Get Priority Grouping + \details Reads the priority grouping field from the NVIC Interrupt Controller. + \return Priority grouping field (SCB->AIRCR [10:8] PRIGROUP field). + */ +__STATIC_INLINE uint32_t __NVIC_GetPriorityGrouping(void) +{ + return ((uint32_t)((SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) >> SCB_AIRCR_PRIGROUP_Pos)); +} + + +/** + \brief Enable Interrupt + \details Enables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + __COMPILER_BARRIER(); + NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __COMPILER_BARRIER(); + } +} + + +/** + \brief Get Interrupt Enable status + \details Returns a device specific interrupt enable status from the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt is not enabled. + \return 1 Interrupt is enabled. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISER[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Disable Interrupt + \details Disables a device specific interrupt in the NVIC interrupt controller. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICER[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + __DSB(); + __ISB(); + } +} + + +/** + \brief Get Pending Interrupt + \details Reads the NVIC pending register and returns the pending bit for the specified device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not pending. + \return 1 Interrupt status is pending. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Pending Interrupt + \details Sets the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ISPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Clear Pending Interrupt + \details Clears the pending bit of a device specific interrupt in the NVIC pending register. + \param [in] IRQn Device specific interrupt number. + \note IRQn must not be negative. + */ +__STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->ICPR[(((uint32_t)IRQn) >> 5UL)] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL)); + } +} + + +/** + \brief Get Active Interrupt + \details Reads the active register in the NVIC and returns the active bit for the device specific interrupt. + \param [in] IRQn Device specific interrupt number. + \return 0 Interrupt status is not active. + \return 1 Interrupt status is active. + \note IRQn must not be negative. + */ +__STATIC_INLINE uint32_t __NVIC_GetActive(IRQn_Type IRQn) +{ + if ((int32_t)(IRQn) >= 0) + { + return((uint32_t)(((NVIC->IABR[(((uint32_t)IRQn) >> 5UL)] & (1UL << (((uint32_t)IRQn) & 0x1FUL))) != 0UL) ? 1UL : 0UL)); + } + else + { + return(0U); + } +} + + +/** + \brief Set Interrupt Priority + \details Sets the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \param [in] priority Priority to set. + \note The priority cannot be set for every processor exception. + */ +__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority) +{ + if ((int32_t)(IRQn) >= 0) + { + NVIC->IP[((uint32_t)IRQn)] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } + else + { + SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] = (uint8_t)((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL); + } +} + + +/** + \brief Get Interrupt Priority + \details Reads the priority of a device specific interrupt or a processor exception. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Interrupt Priority. + Value is aligned automatically to the implemented priority bits of the microcontroller. + */ +__STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn) +{ + + if ((int32_t)(IRQn) >= 0) + { + return(((uint32_t)NVIC->IP[((uint32_t)IRQn)] >> (8U - __NVIC_PRIO_BITS))); + } + else + { + return(((uint32_t)SCB->SHP[(((uint32_t)IRQn) & 0xFUL)-4UL] >> (8U - __NVIC_PRIO_BITS))); + } +} + + +/** + \brief Encode Priority + \details Encodes the priority for an interrupt with the given priority group, + preemptive priority value, and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS), the smallest possible priority group is set. + \param [in] PriorityGroup Used priority group. + \param [in] PreemptPriority Preemptive priority value (starting from 0). + \param [in] SubPriority Subpriority value (starting from 0). + \return Encoded priority. Value can be used in the function \ref NVIC_SetPriority(). + */ +__STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + return ( + ((PreemptPriority & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL)) << SubPriorityBits) | + ((SubPriority & (uint32_t)((1UL << (SubPriorityBits )) - 1UL))) + ); +} + + +/** + \brief Decode Priority + \details Decodes an interrupt priority value with a given priority group to + preemptive priority value and subpriority value. + In case of a conflict between priority grouping and available + priority bits (__NVIC_PRIO_BITS) the smallest possible priority group is set. + \param [in] Priority Priority value, which can be retrieved with the function \ref NVIC_GetPriority(). + \param [in] PriorityGroup Used priority group. + \param [out] pPreemptPriority Preemptive priority value (starting from 0). + \param [out] pSubPriority Subpriority value (starting from 0). + */ +__STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t PriorityGroup, uint32_t* const pPreemptPriority, uint32_t* const pSubPriority) +{ + uint32_t PriorityGroupTmp = (PriorityGroup & (uint32_t)0x07UL); /* only values 0..7 are used */ + uint32_t PreemptPriorityBits; + uint32_t SubPriorityBits; + + PreemptPriorityBits = ((7UL - PriorityGroupTmp) > (uint32_t)(__NVIC_PRIO_BITS)) ? (uint32_t)(__NVIC_PRIO_BITS) : (uint32_t)(7UL - PriorityGroupTmp); + SubPriorityBits = ((PriorityGroupTmp + (uint32_t)(__NVIC_PRIO_BITS)) < (uint32_t)7UL) ? (uint32_t)0UL : (uint32_t)((PriorityGroupTmp - 7UL) + (uint32_t)(__NVIC_PRIO_BITS)); + + *pPreemptPriority = (Priority >> SubPriorityBits) & (uint32_t)((1UL << (PreemptPriorityBits)) - 1UL); + *pSubPriority = (Priority ) & (uint32_t)((1UL << (SubPriorityBits )) - 1UL); +} + + +/** + \brief Set Interrupt Vector + \details Sets an interrupt vector in SRAM based interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + VTOR must been relocated to SRAM before. + \param [in] IRQn Interrupt number + \param [in] vector Address of interrupt handler function + */ +__STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET] = vector; + /* ARM Application Note 321 states that the M4 does not require the architectural barrier */ +} + + +/** + \brief Get Interrupt Vector + \details Reads an interrupt vector from interrupt vector table. + The interrupt number can be positive to specify a device specific interrupt, + or negative to specify a processor exception. + \param [in] IRQn Interrupt number. + \return Address of interrupt handler function + */ +__STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn) +{ + uint32_t *vectors = (uint32_t *)SCB->VTOR; + return vectors[(int32_t)IRQn + NVIC_USER_IRQ_OFFSET]; +} + + +/** + \brief System Reset + \details Initiates a system reset request to reset the MCU. + */ +__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void) +{ + __DSB(); /* Ensure all outstanding memory accesses included + buffered write are completed before reset */ + SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) | + (SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) | + SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */ + __DSB(); /* Ensure completion of memory access */ + + for(;;) /* wait until reset */ + { + __NOP(); + } +} + +/*@} end of CMSIS_Core_NVICFunctions */ + + +/* ########################## MPU functions #################################### */ + +#if defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) + +#include "mpu_armv7.h" + +#endif + + +/* ########################## FPU functions #################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_FpuFunctions FPU Functions + \brief Function that provides FPU type. + @{ + */ + +/** + \brief get FPU type + \details returns the FPU type + \returns + - \b 0: No FPU + - \b 1: Single precision FPU + - \b 2: Double + Single precision FPU + */ +__STATIC_INLINE uint32_t SCB_GetFPUType(void) +{ + uint32_t mvfr0; + + mvfr0 = FPU->MVFR0; + if ((mvfr0 & (FPU_MVFR0_Single_precision_Msk | FPU_MVFR0_Double_precision_Msk)) == 0x020U) + { + return 1U; /* Single precision FPU */ + } + else + { + return 0U; /* No FPU */ + } +} + + +/*@} end of CMSIS_Core_FpuFunctions */ + + + +/* ################################## SysTick function ############################################ */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_Core_SysTickFunctions SysTick Functions + \brief Functions that configure the System. + @{ + */ + +#if defined (__Vendor_SysTickConfig) && (__Vendor_SysTickConfig == 0U) + +/** + \brief System Tick Configuration + \details Initializes the System Timer and its interrupt, and starts the System Tick Timer. + Counter is in free running mode to generate periodic interrupts. + \param [in] ticks Number of ticks between two interrupts. + \return 0 Function succeeded. + \return 1 Function failed. + \note When the variable __Vendor_SysTickConfig is set to 1, then the + function SysTick_Config is not included. In this case, the file device.h + must contain a vendor-specific implementation of this function. + */ +__STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks) +{ + if ((ticks - 1UL) > SysTick_LOAD_RELOAD_Msk) + { + return (1UL); /* Reload value impossible */ + } + + SysTick->LOAD = (uint32_t)(ticks - 1UL); /* set reload register */ + NVIC_SetPriority (SysTick_IRQn, (1UL << __NVIC_PRIO_BITS) - 1UL); /* set Priority for Systick Interrupt */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ + SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | + SysTick_CTRL_TICKINT_Msk | + SysTick_CTRL_ENABLE_Msk; /* Enable SysTick IRQ and SysTick Timer */ + return (0UL); /* Function successful */ +} + +#endif + +/*@} end of CMSIS_Core_SysTickFunctions */ + + + +/* ##################################### Debug In/Output function ########################################### */ +/** + \ingroup CMSIS_Core_FunctionInterface + \defgroup CMSIS_core_DebugFunctions ITM Functions + \brief Functions that access the ITM debug interface. + @{ + */ + +extern volatile int32_t ITM_RxBuffer; /*!< External variable to receive characters. */ +#define ITM_RXBUFFER_EMPTY ((int32_t)0x5AA55AA5U) /*!< Value identifying \ref ITM_RxBuffer is ready for next character. */ + + +/** + \brief ITM Send Character + \details Transmits a character via the ITM channel 0, and + \li Just returns when no debugger is connected that has booked the output. + \li Is blocking when a debugger is connected, but the previous character sent has not been transmitted. + \param [in] ch Character to transmit. + \returns Character to transmit. + */ +__STATIC_INLINE uint32_t ITM_SendChar (uint32_t ch) +{ + if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */ + ((ITM->TER & 1UL ) != 0UL) ) /* ITM Port #0 enabled */ + { + while (ITM->PORT[0U].u32 == 0UL) + { + __NOP(); + } + ITM->PORT[0U].u8 = (uint8_t)ch; + } + return (ch); +} + + +/** + \brief ITM Receive Character + \details Inputs a character via the external variable \ref ITM_RxBuffer. + \return Received character. + \return -1 No character pending. + */ +__STATIC_INLINE int32_t ITM_ReceiveChar (void) +{ + int32_t ch = -1; /* no character available */ + + if (ITM_RxBuffer != ITM_RXBUFFER_EMPTY) + { + ch = ITM_RxBuffer; + ITM_RxBuffer = ITM_RXBUFFER_EMPTY; /* ready for next character */ + } + + return (ch); +} + + +/** + \brief ITM Check Character + \details Checks whether a character is pending for reading in the variable \ref ITM_RxBuffer. + \return 0 No character available. + \return 1 Character available. + */ +__STATIC_INLINE int32_t ITM_CheckChar (void) +{ + + if (ITM_RxBuffer == ITM_RXBUFFER_EMPTY) + { + return (0); /* no character available */ + } + else + { + return (1); /* character available */ + } +} + +/*@} end of CMSIS_core_DebugFunctions */ + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __CORE_CM4_H_DEPENDANT */ + +#endif /* __CMSIS_GENERIC */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/mpu_armv7.h b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/mpu_armv7.h new file mode 100644 index 0000000..d9eedf8 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/cmsis/core/include/mpu_armv7.h @@ -0,0 +1,275 @@ +/****************************************************************************** + * @file mpu_armv7.h + * @brief CMSIS MPU API for Armv7-M MPU + * @version V5.1.2 + * @date 25. May 2020 + ******************************************************************************/ +/* + * Copyright (c) 2017-2020 Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if defined ( __ICCARM__ ) + #pragma system_include /* treat file as system include file for MISRA check */ +#elif defined (__clang__) + #pragma clang system_header /* treat file as system include file */ +#endif + +#ifndef ARM_MPU_ARMV7_H +#define ARM_MPU_ARMV7_H + +#define ARM_MPU_REGION_SIZE_32B ((uint8_t)0x04U) ///!< MPU Region Size 32 Bytes +#define ARM_MPU_REGION_SIZE_64B ((uint8_t)0x05U) ///!< MPU Region Size 64 Bytes +#define ARM_MPU_REGION_SIZE_128B ((uint8_t)0x06U) ///!< MPU Region Size 128 Bytes +#define ARM_MPU_REGION_SIZE_256B ((uint8_t)0x07U) ///!< MPU Region Size 256 Bytes +#define ARM_MPU_REGION_SIZE_512B ((uint8_t)0x08U) ///!< MPU Region Size 512 Bytes +#define ARM_MPU_REGION_SIZE_1KB ((uint8_t)0x09U) ///!< MPU Region Size 1 KByte +#define ARM_MPU_REGION_SIZE_2KB ((uint8_t)0x0AU) ///!< MPU Region Size 2 KBytes +#define ARM_MPU_REGION_SIZE_4KB ((uint8_t)0x0BU) ///!< MPU Region Size 4 KBytes +#define ARM_MPU_REGION_SIZE_8KB ((uint8_t)0x0CU) ///!< MPU Region Size 8 KBytes +#define ARM_MPU_REGION_SIZE_16KB ((uint8_t)0x0DU) ///!< MPU Region Size 16 KBytes +#define ARM_MPU_REGION_SIZE_32KB ((uint8_t)0x0EU) ///!< MPU Region Size 32 KBytes +#define ARM_MPU_REGION_SIZE_64KB ((uint8_t)0x0FU) ///!< MPU Region Size 64 KBytes +#define ARM_MPU_REGION_SIZE_128KB ((uint8_t)0x10U) ///!< MPU Region Size 128 KBytes +#define ARM_MPU_REGION_SIZE_256KB ((uint8_t)0x11U) ///!< MPU Region Size 256 KBytes +#define ARM_MPU_REGION_SIZE_512KB ((uint8_t)0x12U) ///!< MPU Region Size 512 KBytes +#define ARM_MPU_REGION_SIZE_1MB ((uint8_t)0x13U) ///!< MPU Region Size 1 MByte +#define ARM_MPU_REGION_SIZE_2MB ((uint8_t)0x14U) ///!< MPU Region Size 2 MBytes +#define ARM_MPU_REGION_SIZE_4MB ((uint8_t)0x15U) ///!< MPU Region Size 4 MBytes +#define ARM_MPU_REGION_SIZE_8MB ((uint8_t)0x16U) ///!< MPU Region Size 8 MBytes +#define ARM_MPU_REGION_SIZE_16MB ((uint8_t)0x17U) ///!< MPU Region Size 16 MBytes +#define ARM_MPU_REGION_SIZE_32MB ((uint8_t)0x18U) ///!< MPU Region Size 32 MBytes +#define ARM_MPU_REGION_SIZE_64MB ((uint8_t)0x19U) ///!< MPU Region Size 64 MBytes +#define ARM_MPU_REGION_SIZE_128MB ((uint8_t)0x1AU) ///!< MPU Region Size 128 MBytes +#define ARM_MPU_REGION_SIZE_256MB ((uint8_t)0x1BU) ///!< MPU Region Size 256 MBytes +#define ARM_MPU_REGION_SIZE_512MB ((uint8_t)0x1CU) ///!< MPU Region Size 512 MBytes +#define ARM_MPU_REGION_SIZE_1GB ((uint8_t)0x1DU) ///!< MPU Region Size 1 GByte +#define ARM_MPU_REGION_SIZE_2GB ((uint8_t)0x1EU) ///!< MPU Region Size 2 GBytes +#define ARM_MPU_REGION_SIZE_4GB ((uint8_t)0x1FU) ///!< MPU Region Size 4 GBytes + +#define ARM_MPU_AP_NONE 0U ///!< MPU Access Permission no access +#define ARM_MPU_AP_PRIV 1U ///!< MPU Access Permission privileged access only +#define ARM_MPU_AP_URO 2U ///!< MPU Access Permission unprivileged access read-only +#define ARM_MPU_AP_FULL 3U ///!< MPU Access Permission full access +#define ARM_MPU_AP_PRO 5U ///!< MPU Access Permission privileged access read-only +#define ARM_MPU_AP_RO 6U ///!< MPU Access Permission read-only access + +/** MPU Region Base Address Register Value +* +* \param Region The region to be configured, number 0 to 15. +* \param BaseAddress The base address for the region. +*/ +#define ARM_MPU_RBAR(Region, BaseAddress) \ + (((BaseAddress) & MPU_RBAR_ADDR_Msk) | \ + ((Region) & MPU_RBAR_REGION_Msk) | \ + (MPU_RBAR_VALID_Msk)) + +/** +* MPU Memory Access Attributes +* +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +*/ +#define ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable) \ + ((((TypeExtField) << MPU_RASR_TEX_Pos) & MPU_RASR_TEX_Msk) | \ + (((IsShareable) << MPU_RASR_S_Pos) & MPU_RASR_S_Msk) | \ + (((IsCacheable) << MPU_RASR_C_Pos) & MPU_RASR_C_Msk) | \ + (((IsBufferable) << MPU_RASR_B_Pos) & MPU_RASR_B_Msk)) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param AccessAttributes Memory access attribution, see \ref ARM_MPU_ACCESS_. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR_EX(DisableExec, AccessPermission, AccessAttributes, SubRegionDisable, Size) \ + ((((DisableExec) << MPU_RASR_XN_Pos) & MPU_RASR_XN_Msk) | \ + (((AccessPermission) << MPU_RASR_AP_Pos) & MPU_RASR_AP_Msk) | \ + (((AccessAttributes) & (MPU_RASR_TEX_Msk | MPU_RASR_S_Msk | MPU_RASR_C_Msk | MPU_RASR_B_Msk))) | \ + (((SubRegionDisable) << MPU_RASR_SRD_Pos) & MPU_RASR_SRD_Msk) | \ + (((Size) << MPU_RASR_SIZE_Pos) & MPU_RASR_SIZE_Msk) | \ + (((MPU_RASR_ENABLE_Msk)))) + +/** +* MPU Region Attribute and Size Register Value +* +* \param DisableExec Instruction access disable bit, 1= disable instruction fetches. +* \param AccessPermission Data access permissions, allows you to configure read/write access for User and Privileged mode. +* \param TypeExtField Type extension field, allows you to configure memory access type, for example strongly ordered, peripheral. +* \param IsShareable Region is shareable between multiple bus masters. +* \param IsCacheable Region is cacheable, i.e. its value may be kept in cache. +* \param IsBufferable Region is bufferable, i.e. using write-back caching. Cacheable but non-bufferable regions use write-through policy. +* \param SubRegionDisable Sub-region disable field. +* \param Size Region size of the region to be configured, for example 4K, 8K. +*/ +#define ARM_MPU_RASR(DisableExec, AccessPermission, TypeExtField, IsShareable, IsCacheable, IsBufferable, SubRegionDisable, Size) \ + ARM_MPU_RASR_EX(DisableExec, AccessPermission, ARM_MPU_ACCESS_(TypeExtField, IsShareable, IsCacheable, IsBufferable), SubRegionDisable, Size) + +/** +* MPU Memory Access Attribute for strongly ordered memory. +* - TEX: 000b +* - Shareable +* - Non-cacheable +* - Non-bufferable +*/ +#define ARM_MPU_ACCESS_ORDERED ARM_MPU_ACCESS_(0U, 1U, 0U, 0U) + +/** +* MPU Memory Access Attribute for device memory. +* - TEX: 000b (if shareable) or 010b (if non-shareable) +* - Shareable or non-shareable +* - Non-cacheable +* - Bufferable (if shareable) or non-bufferable (if non-shareable) +* +* \param IsShareable Configures the device memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_DEVICE(IsShareable) ((IsShareable) ? ARM_MPU_ACCESS_(0U, 1U, 0U, 1U) : ARM_MPU_ACCESS_(2U, 0U, 0U, 0U)) + +/** +* MPU Memory Access Attribute for normal memory. +* - TEX: 1BBb (reflecting outer cacheability rules) +* - Shareable or non-shareable +* - Cacheable or non-cacheable (reflecting inner cacheability rules) +* - Bufferable or non-bufferable (reflecting inner cacheability rules) +* +* \param OuterCp Configures the outer cache policy. +* \param InnerCp Configures the inner cache policy. +* \param IsShareable Configures the memory as shareable or non-shareable. +*/ +#define ARM_MPU_ACCESS_NORMAL(OuterCp, InnerCp, IsShareable) ARM_MPU_ACCESS_((4U | (OuterCp)), IsShareable, ((InnerCp) >> 1U), ((InnerCp) & 1U)) + +/** +* MPU Memory Access Attribute non-cacheable policy. +*/ +#define ARM_MPU_CACHEP_NOCACHE 0U + +/** +* MPU Memory Access Attribute write-back, write and read allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_WRA 1U + +/** +* MPU Memory Access Attribute write-through, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WT_NWA 2U + +/** +* MPU Memory Access Attribute write-back, no write allocate policy. +*/ +#define ARM_MPU_CACHEP_WB_NWA 3U + + +/** +* Struct for a single MPU Region +*/ +typedef struct { + uint32_t RBAR; //!< The region base address register value (RBAR) + uint32_t RASR; //!< The region attribute and size register value (RASR) \ref MPU_RASR +} ARM_MPU_Region_t; + +/** Enable the MPU. +* \param MPU_Control Default access permissions for unconfigured regions. +*/ +__STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control) +{ + __DMB(); + MPU->CTRL = MPU_Control | MPU_CTRL_ENABLE_Msk; +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk; +#endif + __DSB(); + __ISB(); +} + +/** Disable the MPU. +*/ +__STATIC_INLINE void ARM_MPU_Disable(void) +{ + __DMB(); +#ifdef SCB_SHCSR_MEMFAULTENA_Msk + SCB->SHCSR &= ~SCB_SHCSR_MEMFAULTENA_Msk; +#endif + MPU->CTRL &= ~MPU_CTRL_ENABLE_Msk; + __DSB(); + __ISB(); +} + +/** Clear and disable the given MPU region. +* \param rnr Region number to be cleared. +*/ +__STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr) +{ + MPU->RNR = rnr; + MPU->RASR = 0U; +} + +/** Configure an MPU region. +* \param rbar Value for RBAR register. +* \param rasr Value for RASR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr) +{ + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Configure the given MPU region. +* \param rnr Region number to be configured. +* \param rbar Value for RBAR register. +* \param rasr Value for RASR register. +*/ +__STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, uint32_t rasr) +{ + MPU->RNR = rnr; + MPU->RBAR = rbar; + MPU->RASR = rasr; +} + +/** Memcpy with strictly ordered memory access, e.g. used by code in ARM_MPU_Load(). +* \param dst Destination data is copied to. +* \param src Source data is copied from. +* \param len Amount of data words to be copied. +*/ +__STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const uint32_t* __RESTRICT src, uint32_t len) +{ + uint32_t i; + for (i = 0U; i < len; ++i) + { + dst[i] = src[i]; + } +} + +/** Load the given number of MPU regions from a table. +* \param table Pointer to the MPU configuration table. +* \param cnt Amount of regions to be configured. +*/ +__STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_t cnt) +{ + const uint32_t rowWordSize = sizeof(ARM_MPU_Region_t)/4U; + while (cnt > MPU_TYPE_RALIASES) { + ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), MPU_TYPE_RALIASES*rowWordSize); + table += MPU_TYPE_RALIASES; + cnt -= MPU_TYPE_RALIASES; + } + ARM_MPU_OrderedMemcpy(&(MPU->RBAR), &(table->RBAR), cnt*rowWordSize); +} + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/gcc/startup_gr55xx.s b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/gcc/startup_gr55xx.s new file mode 100644 index 0000000..2eec798 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/arch/arm/cortex-m/gcc/startup_gr55xx.s @@ -0,0 +1,218 @@ +/**************************************************************************//** + * @file startup_ARMCM4.s + * @brief CMSIS Core Device Startup File for + * ARMCM4 Device Series + * @version V5.00 + * @date 02. March 2016 + ******************************************************************************/ +/* + * Copyright (c) 2009-2016 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + .syntax unified + .arch armv7-m + + .section .stack + .align 3 +//#ifdef __STACK_SIZE +// .equ Stack_Size, __STACK_SIZE +//#else + .equ Stack_Size, 0x00008000 +//#endif + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 +#ifdef __HEAP_SIZE + .equ Heap_Size, __HEAP_SIZE +#else + .equ Heap_Size, 0x00000100 +#endif + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + .section .vectors + .align 2 + .globl __Vectors +__Vectors: + .long _estack /* Top of Stack */ + .long Reset_Handler /* Reset Handler */ + .long NMI_Handler /* NMI Handler */ + .long HardFault_Handler /* Hard Fault Handler */ + .long MemManage_Handler /* MPU Fault Handler */ + .long BusFault_Handler /* Bus Fault Handler */ + .long UsageFault_Handler /* Usage Fault Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long SVC_Handler /* SVCall Handler */ + .long DebugMon_Handler /* Debug Monitor Handler */ + .long 0 /* Reserved */ + .long PendSV_Handler /* PendSV Handler */ + .long SysTick_Handler /* SysTick Handler */ + + /* External interrupts */ + .long WDT_IRQHandler /* 0: Watchdog Timer */ + .long BLE_SDK_Handler /* 1: Reserved */ + .long BLE_IRQHandler /* 2: BLE */ + .long DMA0_IRQHandler /* 3: DMA0 */ + .long SPI_M_IRQHandler /* 4: SPI_M */ + .long SPI_S_IRQHandler /* 5: SPI_S */ + .long EXT0_IRQHandler /* 6: GPIO0 */ + .long EXT1_IRQHandler /* 7: GPIO1 */ + .long TIMER0_IRQHandler /* 8: TIMER0 */ + .long TIMER1_IRQHandler /* 9: TIMER1 */ + .long DUAL_TIMER_IRQHandler /* 10: DUAL_TIMER0/DUAL_TIMER1 */ + .long QSPI0_IRQHandler /* 11: QSPI0 */ + .long UART0_IRQHandler /* 12: UART0 */ + .long UART1_IRQHandler /* 13: UART1 */ + .long I2C0_IRQHandler /* 14: I2C0 */ + .long I2C1_IRQHandler /* 15: I2C1 */ + .long AES_IRQHandler /* 16: AES */ + .long HMAC_IRQHandler /* 17: HMAC */ + .long EXT2_IRQHandler /* 18: GPIO2 */ + .long RNG_IRQHandler /* 19: TRNG Interrupt */ + .long PMU_IRQHandler /* 20: PMU */ + .long PKC_IRQHandler /* 21: PKC */ + .long XQSPI_IRQHandler /* 22: XQSPI */ + .long QSPI1_IRQHandler /* 23: QSPI1 */ + .long PWR_CMD_IRQHandler /* 24: PWR_CMD */ + .long BLESLP_IRQHandler /* 25: BLE Sleep */ + .long SLPTIMER_IRQHandler /* 26: Sleep Timer */ + .long EXTWKUP_IRQHandler /* 27: EXT Wakeup */ + .long AON_WDT_IRQHandler /* 28: AON_WDT */ + .long I2S_M_IRQHandler /* 29: I2S_M */ + .long I2S_S_IRQHandler /* 30: I2S_S */ + .long ISO7816_IRQHandler /* 31: ISO7816 */ + .long PRESENT_IRQHandler /* 32: PRESENT */ + .long CALENDAR_IRQHandler /* 33: CALENDAR */ + .long COMM_CORE_IRQHandler /* 34: COMM_CORE */ + .long DMA1_IRQHandler /* 35: DMA1 */ + .long DMA2_IRQHandler /* 36: DMA2 */ + .long DSPI_IRQHandler /* 37: DSPI */ + .long AON_IRQHandler /* 38: AON */ + .long PDM_IRQHandler /* 39: PDM */ + .long VTTBL_IRQHandler /* 40: VTTBL */ + .long CTE_FULL_IRQHandler /* 41: CTE_FULL */ + .long USB_IRQHandler /* 42: USB */ + .long GPADC_IRQHandler /* 43: GPADC */ + .long AON_PMU_BOD_FEDGE_IRQHandler /* 44: AON_PMU_BOD_FEDGE */ + .long AON_PMU_MSIO_COMP_IRQHandler /* 45: AON_PMU_MSIO_COMP */ + .long AON_PMU_USB_WKUP_IRQHandler /* 46: AON_PMU_USB_WKUP */ + + .size __Vectors, . - __Vectors + + .text + .thumb + .thumb_func + .align 2 + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + + bl SystemInit + + bl main_init + + .pool + .size Reset_Handler, . - Reset_Handler + + .align 1 + .thumb_func + .weak Default_Handler + .type Default_Handler, %function +Default_Handler: + b . + .size Default_Handler, . - Default_Handler + +/* Macro to define default handlers. Default handler + * will be weak symbol and just dead loops. They can be + * overwritten by other handlers */ + .macro def_irq_handler handler_name + .weak \handler_name + .set \handler_name, Default_Handler + .endm + + def_irq_handler NMI_Handler + def_irq_handler HardFault_Handler + def_irq_handler MemManage_Handler + def_irq_handler BusFault_Handler + def_irq_handler UsageFault_Handler + def_irq_handler SVC_Handler + def_irq_handler DebugMon_Handler + def_irq_handler PendSV_Handler + def_irq_handler SysTick_Handler + + def_irq_handler WDT_IRQHandler + def_irq_handler DMA0_IRQHandler + def_irq_handler SPI_M_IRQHandler + def_irq_handler SPI_S_IRQHandler + def_irq_handler EXT0_IRQHandler + def_irq_handler EXT1_IRQHandler + def_irq_handler TIMER0_IRQHandler + def_irq_handler TIMER1_IRQHandler + def_irq_handler DUAL_TIMER_IRQHandler + def_irq_handler QSPI0_IRQHandler + def_irq_handler UART0_IRQHandler + def_irq_handler UART1_IRQHandler + def_irq_handler I2C0_IRQHandler + def_irq_handler I2C1_IRQHandler + def_irq_handler AES_IRQHandler + def_irq_handler HMAC_IRQHandler + def_irq_handler EXT2_IRQHandler + def_irq_handler RNG_IRQHandler + def_irq_handler PMU_IRQHandler + def_irq_handler PKC_IRQHandler + def_irq_handler XQSPI_IRQHandler + def_irq_handler QSPI1_IRQHandler + def_irq_handler PWR_CMD_IRQHandler + def_irq_handler SLPTIMER_IRQHandler + def_irq_handler EXTWKUP_IRQHandler + def_irq_handler AON_WDT_IRQHandler + def_irq_handler I2S_M_IRQHandler + def_irq_handler I2S_S_IRQHandler + def_irq_handler ISO7816_IRQHandler + def_irq_handler PRESENT_IRQHandler + def_irq_handler CALENDAR_IRQHandler + def_irq_handler COMM_CORE_IRQHandler + def_irq_handler DMA1_IRQHandler + def_irq_handler DMA2_IRQHandler + def_irq_handler DSPI_IRQHandler + def_irq_handler AON_IRQHandler + def_irq_handler PDM_IRQHandler + def_irq_handler VTTBL_IRQHandler + def_irq_handler CTE_FULL_IRQHandler + def_irq_handler USB_IRQHandler + def_irq_handler GPADC_IRQHandler + def_irq_handler AON_PMU_BOD_FEDGE_IRQHandler + def_irq_handler AON_PMU_MSIO_COMP_IRQHandler + def_irq_handler AON_PMU_USB_WKUP_IRQHandler + .end diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.c b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.c new file mode 100644 index 0000000..a585ac3 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.c @@ -0,0 +1,253 @@ + +/** + ***************************************************************************************** + * + * @file board.c + * + * @brief Board Support Package Implementation. + * + ***************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "grx_sys.h" +#include "app_log.h" +#include "app_assert.h" +#include "app_io.h" +#include "board_SK.h" +#if (APP_LOG_PORT == 1) +#include "SEGGER_RTT.h" +#endif + +#define UART_TX_BUFF_SIZE 0x400 /**< Size of app uart tx buffer. */ + +/* + * LOCAL VARIABLE DEFINITIONS + ***************************************************************************************** + */ +static uint8_t s_uart_tx_buffer[UART_TX_BUFF_SIZE]; +static app_uart_params_t uart_param; + +void bsp_uart_send(uint8_t *p_data, uint16_t length) +{ + app_uart_transmit_sync(APP_UART_ID, p_data, length, 1000); +} + +void bsp_uart_flush(void) +{ + app_uart_flush(APP_UART_ID); +} + +__WEAK void app_uart_evt_handler(app_uart_evt_t *p_evt) +{ + UNUSED(p_evt); +} + +void bsp_uart_init(void) +{ + app_uart_tx_buf_t uart_buffer; + + uart_buffer.tx_buf = s_uart_tx_buffer; + uart_buffer.tx_buf_size = UART_TX_BUFF_SIZE; + + uart_param.id = APP_UART_ID; + uart_param.init.baud_rate = APP_UART_BAUDRATE; + uart_param.init.data_bits = UART_DATABITS_8; + uart_param.init.stop_bits = UART_STOPBITS_1; + uart_param.init.parity = UART_PARITY_NONE; + uart_param.init.hw_flow_ctrl = UART_HWCONTROL_NONE; + uart_param.init.rx_timeout_mode = UART_RECEIVER_TIMEOUT_ENABLE; + uart_param.pin_cfg.rx.type = APP_UART_RX_IO_TYPE; + uart_param.pin_cfg.rx.pin = APP_UART_RX_PIN; + uart_param.pin_cfg.rx.mux = APP_UART_RX_PINMUX; + uart_param.pin_cfg.rx.pull = APP_UART_RX_PULL; + uart_param.pin_cfg.tx.type = APP_UART_TX_IO_TYPE; + uart_param.pin_cfg.tx.pin = APP_UART_TX_PIN; + uart_param.pin_cfg.tx.mux = APP_UART_TX_PINMUX; + uart_param.pin_cfg.tx.pull = APP_UART_TX_PULL; + + app_uart_init(&uart_param, app_uart_evt_handler, &uart_buffer); +} + +#if (APP_LOG_PORT == 1) +void bsp_segger_rtt_send(uint8_t *p_data, uint16_t length) +{ + SEGGER_RTT_Write(0, (void*)p_data, length); +} +#endif + +#if (APP_LOG_PORT == 2) +void bsp_itm_send(uint8_t *p_data, uint16_t length) +{ + for(uint16_t i = 0; i < length; i++) + { + ITM_SendChar(p_data[i]); + } +} +#endif + +void bsp_log_init(void) +{ +#if (APP_LOG_ENABLE == 1) + +#if (APP_LOG_PORT == 0) + bsp_uart_init(); +#elif (APP_LOG_PORT == 1) + SEGGER_RTT_ConfigUpBuffer(0, NULL, NULL, 0, SEGGER_RTT_MODE_BLOCK_IF_FIFO_FULL); +#endif + +#if (APP_LOG_PORT <= 2) + app_log_init_t log_init; + + log_init.filter.level = APP_LOG_LVL_DEBUG; + log_init.fmt_set[APP_LOG_LVL_ERROR] = APP_LOG_FMT_ALL & (~APP_LOG_FMT_TAG); + log_init.fmt_set[APP_LOG_LVL_WARNING] = APP_LOG_FMT_LVL; + log_init.fmt_set[APP_LOG_LVL_INFO] = APP_LOG_FMT_LVL; + log_init.fmt_set[APP_LOG_LVL_DEBUG] = APP_LOG_FMT_LVL; + +#if (APP_LOG_PORT == 0) + app_log_init(&log_init, bsp_uart_send, bsp_uart_flush); +#elif (APP_LOG_PORT == 1) + app_log_init(&log_init, bsp_segger_rtt_send, NULL); +#elif (APP_LOG_PORT == 2) + app_log_init(&log_init, bsp_itm_send, NULL); +#endif + + app_assert_init(); + +#endif + +#endif +} + +__WEAK void app_key_evt_handler(uint8_t key_id, app_key_click_type_t key_click_type) +{ + UNUSED(key_id); + UNUSED(key_click_type); +} + +void bsp_key_init(void) +{ + app_key_gpio_t app_key_inst[5]; + + app_key_inst[0].gpio_type = APP_IO_TYPE_NORMAL; + app_key_inst[0].gpio_pin = APP_KEY_UP_PIN; + app_key_inst[0].trigger_mode = APP_KEY_TRIGGER_MODE; + app_key_inst[0].pull = APP_KEY_PULL_MODE; + app_key_inst[0].key_id = BSP_KEY_UP_ID; + + app_key_inst[1].gpio_type = APP_IO_TYPE_NORMAL; + app_key_inst[1].gpio_pin = APP_KEY_DOWN_PIN; + app_key_inst[1].trigger_mode = APP_KEY_TRIGGER_MODE; + app_key_inst[1].pull = APP_KEY_PULL_MODE; + app_key_inst[1].key_id = BSP_KEY_DOWN_ID; + + app_key_inst[2].gpio_type = APP_IO_TYPE_NORMAL; + app_key_inst[2].gpio_pin = APP_KEY_RIGHT_PIN; + app_key_inst[2].trigger_mode = APP_KEY_TRIGGER_MODE; + app_key_inst[2].pull = APP_KEY_PULL_MODE; + app_key_inst[2].key_id = BSP_KEY_RIGHT_ID; + + app_key_inst[3].gpio_type = APP_IO_TYPE_NORMAL; + app_key_inst[3].gpio_pin = APP_KEY_LEFT_PIN; + app_key_inst[3].trigger_mode = APP_KEY_TRIGGER_MODE; + app_key_inst[3].pull = APP_KEY_PULL_MODE; + app_key_inst[3].key_id = BSP_KEY_LEFT_ID; + + app_key_inst[4].gpio_type = APP_IO_TYPE_AON; + app_key_inst[4].gpio_pin = APP_KEY_OK_PIN; + app_key_inst[4].trigger_mode = APP_KEY_TRIGGER_MODE; + app_key_inst[4].pull = APP_KEY_PULL_MODE; + app_key_inst[4].key_id = BSP_KEY_OK_ID; + + app_key_init(app_key_inst, 5, app_key_evt_handler); +} + +void bsp_led_init(void) +{ + app_io_init_t io_init; + + io_init.pin = APP_LED_NUM_0_IO; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pull = APP_IO_PULLDOWN; + io_init.mux = APP_IO_MUX; + app_io_init(APP_IO_TYPE_NORMAL, &io_init); + + io_init.pin = APP_LED_NUM_1_IO; + io_init.mode = APP_IO_MODE_OUTPUT; + io_init.pull = APP_IO_PULLDOWN; + io_init.mux = APP_IO_MUX; + app_io_init(APP_IO_TYPE_MSIO, &io_init); +} + + +void bsp_led_open(bsp_led_num_t led_num) +{ + switch (led_num) + { + case BSP_LED_NUM_0: + app_io_write_pin(APP_IO_TYPE_NORMAL, APP_LED_NUM_0_IO, APP_IO_PIN_RESET); + break; + + case BSP_LED_NUM_1: + app_io_write_pin(APP_IO_TYPE_MSIO, APP_LED_NUM_1_IO, APP_IO_PIN_RESET); + break; + + default: + break; + } +} + +void bsp_led_close(bsp_led_num_t led_num) +{ + switch (led_num) + { + case BSP_LED_NUM_0: + app_io_write_pin(APP_IO_TYPE_NORMAL, APP_LED_NUM_0_IO, APP_IO_PIN_SET); + break; + + case BSP_LED_NUM_1: + app_io_write_pin(APP_IO_TYPE_MSIO, APP_LED_NUM_1_IO, APP_IO_PIN_SET); + break; + + default: + break; + } +} + +void board_init(void) +{ + bsp_log_init(); + bsp_led_init(); + bsp_key_init(); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.h b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.h new file mode 100644 index 0000000..821af2f --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/board_SK.h @@ -0,0 +1,342 @@ +/** + **************************************************************************************** + * + * @file board_SK.h + * + * @brief Board Start Kit Macro. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef __BOARD_SK_H__ +#define __BOARD_SK_H__ + +#include "app_key.h" +#include "app_uart.h" + +/*******HCI UART IO CONFIG***********************/ +#define APP_HCI_UART_ID APP_UART_ID_0 +#define APP_HCI_UART_FLOW_ON 0 +#define APP_HCI_UART_BAUDRATE 115200 +#define APP_HCI_UART_TRN_PORT APP_IO_TYPE_NORMAL +#define APP_HCI_UART_FLOW_PORT APP_IO_TYPE_NORMAL +#define APP_HCI_UART_TX_PIN APP_IO_PIN_10 +#define APP_HCI_UART_RX_PIN APP_IO_PIN_11 +#define APP_HCI_UART_CTS_PIN APP_IO_PIN_2 +#define APP_HCI_UART_RTS_PIN APP_IO_PIN_5 +#define APP_HCI_UART_TX_PINMUX APP_IO_MUX_2 +#define APP_HCI_UART_RX_PINMUX APP_IO_MUX_2 +#define APP_HCI_UART_CTS_PINMUX APP_IO_MUX_0 +#define APP_HCI_UART_RTS_PINMUX APP_IO_MUX_0 + +/*******UART DRIVER IO CONFIG*******************/ +#define APP_UART_ID APP_UART_ID_0 +#define APP_UART_BAUDRATE 115200 +#define APP_UART_TX_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_UART_RX_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_UART_TX_PIN APP_IO_PIN_10 +#define APP_UART_RX_PIN APP_IO_PIN_11 +#define APP_UART_TX_PINMUX APP_IO_MUX_2 +#define APP_UART_RX_PINMUX APP_IO_MUX_2 +#define APP_UART_TX_PULL APP_IO_PULLUP +#define APP_UART_RX_PULL APP_IO_PULLUP + +#define APP_UART1_ID APP_UART_ID_1 +#define APP_UART1_BAUDRATE 115200 +#define APP_UART1_TX_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_UART1_RX_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_UART1_TX_PIN APP_IO_PIN_30 +#define APP_UART1_RX_PIN APP_IO_PIN_26 +#define APP_UART1_TX_PINMUX APP_IO_MUX_1 +#define APP_UART1_RX_PINMUX APP_IO_MUX_1 + +/*******KEY DRIVER IO CONFIG********************/ +#define APP_KEY_OK_IO_TYPE APP_IO_TYPE_AON +#define APP_KEY_UP_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_KEY_DOWN_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_KEY_LEFT_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_KEY_RIGHT_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_KEY_OK_PIN APP_IO_PIN_1 +#define APP_KEY_UP_PIN APP_IO_PIN_12 +#define APP_KEY_DOWN_PIN APP_IO_PIN_13 +#define APP_KEY_LEFT_PIN APP_IO_PIN_14 +#define APP_KEY_RIGHT_PIN APP_IO_PIN_15 +#define APP_KEY_OK_MUX APP_IO_MUX_7 +#define APP_KEY_UP_MUX APP_IO_MUX_7 +#define APP_KEY_DOWN_MUX APP_IO_MUX_7 +#define APP_KEY_LEFT_MUX APP_IO_MUX_7 +#define APP_KEY_RIGHT_MUX APP_IO_MUX_7 + +/*******KEY TRIGGER & PULL MODE CONFIG*******************/ +#define APP_KEY_TRIGGER_MODE APP_IO_MODE_IT_FALLING +#define APP_KEY_PULL_MODE APP_IO_PULLUP + +/*******LED IO CONFIG FOR SK*********************/ +#define APP_LED_NUM_0_IO APP_IO_PIN_4 +#define APP_LED_NUM_1_IO MSIO_PIN_4 + +/*******ADC IO CONFIG***************************/ +#define APP_ADC_P_INPUT_PIN MSIO_PIN_0 +#define APP_ADC_P_INPUT_PIN_MUX APP_IO_MUX_7 +#define APP_ADC_N_INPUT_PIN MSIO_PIN_1 +#define APP_ADC_N_INPUT_PIN_MUX APP_IO_MUX_7 + +/*******COMP IO CONFIG***************************/ +#define APP_COMP_INPUT_PIN APP_IO_PIN_0 +#define APP_COMP_INPUT_PIN_MUX APP_IO_MUX_7 +#define APP_COMP_VREF_PIN APP_IO_PIN_1 +#define APP_COMP_VREF_PIN_MUX APP_IO_MUX_7 + +/*******I2C IO CONFIG***************************/ +#define APP_I2C_MASTER_ID APP_I2C_ID_1 +#define APP_I2C_MASTER_SCL_PIN APP_IO_PIN_30 +#define APP_I2C_MASTER_SDA_PIN APP_IO_PIN_26 +#define APP_I2C_MASTER_SCL_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2C_MASTER_SDA_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2C_MASTER_SCL_PINMUX APP_IO_MUX_0 +#define APP_I2C_MASTER_SDA_PINMUX APP_IO_MUX_0 + +#define APP_I2C_SLAVE_ID APP_I2C_ID_1 +#define APP_I2C_SLAVE_SCL_PIN APP_IO_PIN_30 +#define APP_I2C_SLAVE_SDA_PIN APP_IO_PIN_26 +#define APP_I2C_SLAVE_SCL_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2C_SLAVE_SDA_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2C_SLAVE_SCL_PINMUX APP_IO_MUX_0 +#define APP_I2C_SLAVE_SDA_PINMUX APP_IO_MUX_0 + +/*******SPI IO CONFIG***************************/ +#define APP_SPIM_CS_PIN APP_IO_PIN_17 +#define APP_SPIM_CLK_PIN APP_IO_PIN_24 +#define APP_SPIM_MOSI_PIN APP_IO_PIN_25 +#define APP_SPIM_MISO_PIN APP_IO_PIN_16 +#define APP_SPIM_CS_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_SPIM_CLK_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_SPIM_MOSI_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_SPIM_MISO_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_SPIM_CS_PINMUX APP_IO_MUX_0 +#define APP_SPIM_CLK_PINMUX APP_IO_MUX_0 +#define APP_SPIM_MOSI_PINMUX APP_IO_MUX_0 +#define APP_SPIM_MISO_PINMUX APP_IO_MUX_0 + +/*******QSPI IO CONFIG***************************/ +#define APP_QSPI1_CS_PIN APP_IO_PIN_15 +#define APP_QSPI1_CLK_PIN APP_IO_PIN_9 +#define APP_QSPI1_IO0_PIN APP_IO_PIN_8 +#define APP_QSPI1_IO1_PIN APP_IO_PIN_14 +#define APP_QSPI1_IO2_PIN APP_IO_PIN_13 +#define APP_QSPI1_IO3_PIN APP_IO_PIN_12 +#define APP_QSPI1_CS_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_CLK_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_IO0_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_IO1_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_IO2_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_IO3_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_QSPI1_GPIO_MUX APP_IO_MUX_2 + +#define APP_FLASH_GPIO_MUX APP_QSPI1_GPIO_MUX +#define APP_FLASH_CS_IO_TYPE APP_QSPI1_CS_IO_TYPE +#define APP_FLASH_CLK_IO_TYPE APP_QSPI1_CLK_IO_TYPE +#define APP_FLASH_IO0_IO_TYPE APP_QSPI1_IO0_IO_TYPE +#define APP_FLASH_IO1_IO_TYPE APP_QSPI1_IO1_IO_TYPE +#define APP_FLASH_IO2_IO_TYPE APP_QSPI1_IO2_IO_TYPE +#define APP_FLASH_IO3_IO_TYPE APP_QSPI1_IO3_IO_TYPE +#define APP_FLASH_CS_PIN APP_QSPI1_CS_PIN +#define APP_FLASH_CLK_PIN APP_QSPI1_CLK_PIN +#define APP_FLASH_IO0_PIN APP_QSPI1_IO0_PIN +#define APP_FLASH_IO1_PIN APP_QSPI1_IO1_PIN +#define APP_FLASH_IO2_PIN APP_QSPI1_IO2_PIN +#define APP_FLASH_IO3_PIN APP_QSPI1_IO3_PIN +#define APP_FLASH_QSPI_ID APP_QSPI_ID_1 + +/*******I2S IO CONFIG***************************/ +#define APP_I2S_MASTER_WS_PIN APP_IO_PIN_24 +#define APP_I2S_MASTER_SDO_PIN APP_IO_PIN_25 +#define APP_I2S_MASTER_SDI_PIN APP_IO_PIN_16 +#define APP_I2S_MASTER_SCLK_PIN APP_IO_PIN_17 +#define APP_I2S_MASTER_WS_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2S_MASTER_SDO_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2S_MASTER_SDI_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2S_MASTER_SCLK_IO_TYPE APP_IO_TYPE_NORMAL +#define APP_I2S_MASTER_WS_PINMUX APP_IO_MUX_3 +#define APP_I2S_MASTER_SDO_PINMUX APP_IO_MUX_3 +#define APP_I2S_MASTER_SDI_PINMUX APP_IO_MUX_3 +#define APP_I2S_MASTER_SCLK_PINMUX APP_IO_MUX_3 + +#define APP_I2S_SLAVE_WS_PIN APP_IO_PIN_2 +#define APP_I2S_SLAVE_SDO_PIN APP_IO_PIN_3 +#define APP_I2S_SLAVE_SDI_PIN APP_IO_PIN_4 +#define APP_I2S_SLAVE_SCLK_PIN APP_IO_PIN_5 +#define APP_I2S_SLAVE_WS_IO_TYPE APP_IO_TYPE_AON +#define APP_I2S_SLAVE_SDO_IO_TYPE APP_IO_TYPE_AON +#define APP_I2S_SLAVE_SDI_IO_TYPE APP_IO_TYPE_AON +#define APP_I2S_SLAVE_SCLK_IO_TYPE APP_IO_TYPE_AON +#define APP_I2S_SLAVE_WS_PINMUX APP_IO_MUX_3 +#define APP_I2S_SLAVE_SDO_PINMUX APP_IO_MUX_3 +#define APP_I2S_SLAVE_SDI_PINMUX APP_IO_MUX_3 +#define APP_I2S_SLAVE_SCLK_PINMUX APP_IO_MUX_3 + +/*******UC1701 DRIVER IO CONFIG*****************/ +#define DISPLAY_DRIVER_TYPE_HW_SPI +#define DISPLAY_SPIM_CS0_PIN APP_IO_PIN_3 +#define DISPLAY_CMD_AND_DATA_PIN APP_IO_PIN_5 +#define DISPLAY_SPIM_CLK_PIN APP_IO_PIN_7 +#define DISPLAY_SPIM_MOSI_PIN APP_IO_PIN_6 +#define DISPLAY_BACK_LIGHT_PIN APP_IO_PIN_2 +#define DISPLAY_SPIM_GPIO_TYPE APP_IO_TYPE_NORMAL + +/*******PWM IO CONFIG***************************/ +#define APP_PWM0_MODULE APP_PWM_ID_0 +#define APP_PWM0_GPIO_MUX APP_IO_MUX_5 +#define APP_PWM0_CHANNEL_A APP_IO_PIN_2 +#define APP_PWM0_CHANNEL_B APP_IO_PIN_3 +#define APP_PWM0_CHANNEL_C APP_IO_PIN_4 +#define APP_PWM0_GPIO_TYPE APP_IO_TYPE_NORMAL + +#define APP_PWM1_MODULE APP_PWM_ID_1 +#define APP_PWM1_GPIO_MUX APP_IO_MUX_0 +#define APP_PWM1_CHANNEL_A APP_IO_PIN_3 +#define APP_PWM1_CHANNEL_B APP_IO_PIN_4 +#define APP_PWM1_GPIO_TYPE APP_IO_TYPE_MSIO + + + +/** + * @defgroup BSP_MAROC Defines + * @{ + */ +#if APP_DRIVER_USE_ENABLE + #define BSP_KEY_UP_ID 0x00 /**< ID for UP KEY. */ + #define BSP_KEY_DOWN_ID 0x01 /**< ID for DOWN KEY. */ + #define BSP_KEY_LEFT_ID 0x02 /**< ID for LEFT KEY. */ + #define BSP_KEY_RIGHT_ID 0x03 /**< ID for RIGHT KEY. */ + #define BSP_KEY_OK_ID 0x04 /**< ID for OK KEY. */ + + #define UART_TX_BUFF_SIZE 0x400 /**< Size of app uart tx buffer. */ +#endif +/** @} */ + +/** + * @defgroup BSP_ENUM Enumerations + * @{ + */ +typedef enum +{ + BSP_LED_NUM_0, + BSP_LED_NUM_1, +} bsp_led_num_t; +/** @} */ + +/** + * @defgroup BSP_FUNCTION Functions + * @{ + */ +/** + ***************************************************************************************** + * @brief Initialize boards key. + ***************************************************************************************** + */ +void bsp_key_init(void); + +/** + ***************************************************************************************** + * @brief App key event handler + ***************************************************************************************** + */ +void app_key_evt_handler(uint8_t key_id, app_key_click_type_t key_click_type); + +/** + ***************************************************************************************** + * @brief Initialize app uart. + ***************************************************************************************** + */ +void bsp_uart_init(void); + +/** + ***************************************************************************************** + * @brief Uart data send. + ***************************************************************************************** + */ +void bsp_uart_send(uint8_t *p_data, uint16_t length); + +/** + ***************************************************************************************** + * @brief Uart data flush. + ***************************************************************************************** + */ +void bsp_uart_flush(void); + +/** + ***************************************************************************************** + * @brief App uart event handler. + ***************************************************************************************** + */ +void app_uart_evt_handler(app_uart_evt_t *p_evt); + +/** + ***************************************************************************************** + * @brief Initialize boards led. + ***************************************************************************************** + */ +void bsp_led_init(void); + +/** + ***************************************************************************************** + * @brief Open boards led. + * + * @param[in] led_num: Number of led needed open. + ***************************************************************************************** + */ +void bsp_led_open(bsp_led_num_t led_num); + +/** + ***************************************************************************************** + * @brief Close boards led. + * + * @param[in] led_num: Number of led needed close. + ***************************************************************************************** + */ +void bsp_led_close(bsp_led_num_t led_num); + +/** + ***************************************************************************************** + * @brief BSP log init. + ***************************************************************************************** + */ +void bsp_log_init(void); + +/** + ***************************************************************************************** + * @brief Board init. + ***************************************************************************************** + */ +void board_init(void); + + +#endif /* __BOARD_SK_H__ */ + diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/boards/unity_test_config.h b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/unity_test_config.h new file mode 100644 index 0000000..8f187ed --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/boards/unity_test_config.h @@ -0,0 +1,40 @@ +/** + **************************************************************************************** + * + * @file board_SK.h + * + * @brief Start Kit Board Macro. + * + **************************************************************************************** + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ +#ifndef UNITY_TEST_CONFIG_H +#define UNITY_TEST_CONFIG_H + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_plat.h b/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_plat.h new file mode 100644 index 0000000..62cdc00 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_plat.h @@ -0,0 +1,33 @@ +#ifndef GR_PLAT_H +#define GR_PLAT_H + +#include + +#define MAX_COMMENTS_CNT 12 +#define MAX_RESERVED_1_CNT 6 +typedef struct __attribute((packed)) +{ + uint32_t app_pattern; + uint32_t app_info_version; + uint32_t chip_ver; + uint32_t load_addr; + uint32_t run_addr; + uint32_t app_info_sum; + uint8_t check_img; + uint8_t boot_delay; + uint8_t sec_cfg; + uint8_t reserved0; + uint8_t comments[MAX_COMMENTS_CNT]; + uint32_t reserved1[MAX_RESERVED_1_CNT]; +} APP_INFO_t; + +#define APP_INFO_ADDR (APP_CODE_RUN_ADDR+0x200) +#define APP_INFO_PATTERN_VALUE 0x47525858 +#define APP_INFO_VERSION 0x1 +#define CHECK_SUM (APP_INFO_PATTERN_VALUE+APP_INFO_VERSION+CHIP_VER+APP_CODE_LOAD_ADDR+APP_CODE_RUN_ADDR) + +extern void __main(void); + +extern void sdk_init(void); + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_soc.h b/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_soc.h new file mode 100644 index 0000000..8875959 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/include/gr_soc.h @@ -0,0 +1,53 @@ +#ifndef GR_SOC_H +#define GR_SOC_H + +#include "grx_sys.h" + +extern void Reset_Handler(void); +extern void NMI_Handler(void); +extern void HardFault_Handler(void); +extern void MemManage_Handler(void); +extern void BusFault_Handler(void); +extern void UsageFault_Handler(void); +extern void SVC_Handler(void); +extern void DebugMon_Handler(void); +extern void PendSV_Handler(void); +extern void SysTick_Handler(void); + +extern void vector_table_init(void); +extern void soc_init(void); +extern void warm_boot_process(void); +extern void platform_init(void); +extern void soc_register_nvic(IRQn_Type indx, uint32_t func); +extern uint32_t get_wakeup_flag(void); + +extern hal_status_t hal_exflash_read_rom(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size); +extern uint8_t nvds_put_patch(NvdsTag_t tag, uint16_t len, const uint8_t *p_buf); +extern uint8_t nvds_put_rom(NvdsTag_t tag, uint16_t len, const uint8_t *p_buf); +extern void dfu_cmd_handler_replace_for_encrypt(void); +extern void register_rwip_reset(void (*callback)(void)); +extern void rwip_reset_patch(void); +extern void register_rwip_init(void (*callback)(uint32_t)); +extern void rwip_init_patch(uint32_t error); +extern void ble_sup_mul_link_with_same_dev(void); + +#if defined (__CC_ARM) +extern void tiny_rw_section_init(void); +#endif + +typedef void (*FuncVector_t)(void); +typedef void (*FUNC_t)(void); + +#define SYS_RESET_REASON_NONE (0U) +#define SYS_RESET_REASON_AONWDT (1U << 2U) +/** + * @brief Get chip reset reason. + * + * @retval Returned value can be one of the following values: + * @arg @ref SYS_RESET_REASON_NONE + * @arg @ref SYS_RESET_REASON_AONWDT + */ +uint8_t sys_device_reset_reason(void); + + +#endif diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/include/scatter_common.h b/gr551x/sdk_liteos/gr551x_sdk/platform/include/scatter_common.h new file mode 100644 index 0000000..c08c921 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/include/scatter_common.h @@ -0,0 +1,18 @@ +/** + **************************************************************************************** + * + * @file scatter_common.h + * + * @brief decalare the symbols in scatter_common.sct. + * + * + **************************************************************************************** + */ + +#ifndef __SCATTER_COMMON_H__ +#define __SCATTER_COMMON_H__ + +#include +#include "ble_cfg.h" + +#endif // __SCATTER_COMMON_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_interrupt.c b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_interrupt.c new file mode 100644 index 0000000..90ba62a --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_interrupt.c @@ -0,0 +1,223 @@ +/** + ***************************************************************************************** + * + * @file gr_interrupt.c + * + * @brief Interrupt Service Routines. + * + ***************************************************************************************** + + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ***************************************************************************************** + */ + +/* + * INCLUDE FILES + ***************************************************************************************** + */ +#include "custom_config.h" +#include "grx_sys.h" + +/******************************************************************************/ +/* Cortex-M4F Processor Interruption and Exception Handlers */ +/* Add here the Interrupt Handler for the BLE peripheral(s) */ +/******************************************************************************/ + +/** + **************************************************************************************** + * @brief hardfault Interrupt Handler + * @retval void + **************************************************************************************** + */ +#if SYS_FAULT_TRACE_ENABLE + +__WEAK void app_log_flush(void) +{ +} + +#if defined ( __CC_ARM ) +uint32_t R4_R11_REG[8]; +SECTION_RAM_CODE __WEAK void hardfault_trace_handler(uint32_t sp) +{ + printf("HARDFAULT CALLSTACK INFO:\r\n"); + printf("================================\r\n"); + printf(" r0: %08x r1: %08x\r\n", ((uint32_t *)sp)[0], ((uint32_t *)sp)[1]); + printf(" r2: %08x r3: %08x\r\n", ((uint32_t *)sp)[2], ((uint32_t *)sp)[3]); + printf(" r4: %08x r5: %08x\r\n", R4_R11_REG[0], R4_R11_REG[1] ); + printf(" r6: %08x r7: %08x\r\n", R4_R11_REG[2], R4_R11_REG[3] ); + printf(" r8: %08x r9: %08x\r\n", R4_R11_REG[4], R4_R11_REG[5] ); + printf(" r10:%08x r11:%08x\r\n", R4_R11_REG[6], R4_R11_REG[7] ); + printf(" r12:%08x lr: %08x\r\n", ((uint32_t *)sp)[4], ((uint32_t *)sp)[5]); + printf(" pc: %08x xpsr: %08x\r\n", ((uint32_t *)sp)[6], ((uint32_t *)sp)[7]); + printf("================================\r\n"); + app_log_flush(); + while (1); +} + +SECTION_RAM_CODE __WEAK void cortex_backtrace_fault_handler(uint32_t fault_handler_lr, uint32_t fault_handler_sp) +{ +} + +SECTION_RAM_CODE __asm void HardFault_Handler (void) +{ +#if (ENABLE_BACKTRACE_FEA == 0)//use fault trace module + PRESERVE8 + IMPORT hardfault_trace_handler + IMPORT R4_R11_REG + LDR R0,=R4_R11_REG + STMIA R0!,{R4-R11} + MOV R0,SP + BL hardfault_trace_handler +#elif (ENABLE_BACKTRACE_FEA == 1)//use cortex_backtrace module + PRESERVE8 + IMPORT cortex_backtrace_fault_handler + MOV r0, lr + MOV r1, sp + BL cortex_backtrace_fault_handler +#endif + +Fault_Loop + BL Fault_Loop + ALIGN +} + +#elif defined ( __GNUC__ ) + +__WEAK void hardfault_trace_handler(unsigned int *hardfault_args) +{ + unsigned int stacked_r0; + unsigned int stacked_r1; + unsigned int stacked_r2; + unsigned int stacked_r3; + unsigned int stacked_r12; + unsigned int stacked_lr; + unsigned int stacked_pc; + unsigned int stacked_psr; + + stacked_r0 = ((unsigned long) hardfault_args[0]); + stacked_r1 = ((unsigned long) hardfault_args[1]); + stacked_r2 = ((unsigned long) hardfault_args[2]); + stacked_r3 = ((unsigned long) hardfault_args[3]); + + stacked_r12 = ((unsigned long) hardfault_args[4]); + stacked_lr = ((unsigned long) hardfault_args[5]); + stacked_pc = ((unsigned long) hardfault_args[6]); + stacked_psr = ((unsigned long) hardfault_args[7]); + printf("HARDFAULT CALLSTACK INFO:\r\n"); + printf("================================\r\n"); + printf("R0 = %x\r\n", stacked_r0); + printf("R1 = %x\r\n", stacked_r1); + printf("R2 = %x\r\n", stacked_r2); + printf("R3 = %x\r\n", stacked_r3); + printf("R12 = %x\r\n", stacked_r12); + printf("LR [R14] = %x subroutine call return address\r\n", stacked_lr); + printf("PC [R15] = %x program counter\r\n", stacked_pc); + printf("PSR = %x\r\n", stacked_psr); + printf("BFAR = %x\r\n", (*((volatile unsigned long *)(0xE000ED38)))); + printf("CFSR = %x\r\n", (*((volatile unsigned long *)(0xE000ED28)))); + printf("HFSR = %x\r\n", (*((volatile unsigned long *)(0xE000ED2C)))); + printf("DFSR = %x\r\n", (*((volatile unsigned long *)(0xE000ED30)))); + printf("AFSR = %x\r\n", (*((volatile unsigned long *)(0xE000ED3C)))); + printf("SCB_SHCSR = %x\r\n", SCB->SHCSR); + printf("================================\r\n"); + app_log_flush(); + + while (1); +} + +SECTION_RAM_CODE __WEAK void cortex_backtrace_fault_handler(uint32_t fault_handler_lr, uint32_t fault_handler_sp) +{ +} + +SECTION_RAM_CODE void HardFault_Handler (void) +{ +#if (ENABLE_BACKTRACE_FEA == 0)//use fault trace module + __asm("TST LR,#4\n"); + __asm("ITE EQ\n"); + __asm("MRSEQ R0,MSP\n"); + __asm("MRSNE R0,PSP\n"); + __asm("BL hardfault_trace_handler\n"); +#elif (ENABLE_BACKTRACE_FEA == 1)//use cortex_backtrace module + __asm("MOV r0, lr"); + __asm("MOV r1, sp"); + __asm("BL cortex_backtrace_fault_handler"); +#endif + + while (1); +} + +#else + +void HardFault_Handler (void) +{ + while (1); +} + +#endif + +#else /*SYS_FAULT_TRACE_ENABLE*/ + +SECTION_RAM_CODE void HardFault_Handler (void) +{ + while (1); +} + +#endif /*SYS_FAULT_TRACE_ENABLE*/ + +/** + **************************************************************************************** + * @brief MemManage fault Interrupt Handler + * @retval void + **************************************************************************************** + */ +void MemManage_Handler(void) +{ + while (1); +} + +/** + **************************************************************************************** + * @brief Bus Fault Interrupt Handler + * @retval void + **************************************************************************************** + */ +void BusFault_Handler(void) +{ + while (1); +} + +/** + **************************************************************************************** + * @brief UsageFault Interrupt Handler + * @retval void + **************************************************************************************** + */ +void UsageFault_Handler(void) +{ + while (1); +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_platform.c b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_platform.c new file mode 100644 index 0000000..f9db0e6 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_platform.c @@ -0,0 +1,138 @@ +/** + ******************************************************************************* + * + * @file gr_platform.c + * + * @brief Platform Initialization Routines. + * + ******************************************************************************* + + * @attention + #####Copyright (c) 2019 GOODIX + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of GOODIX nor the names of its contributors may be used + to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************* + */ + +/* + * INCLUDE FILES + ******************************************************************************* + */ +#include "grx_sys.h" +#include "gr_soc.h" +#include "gr_plat.h" + +#if defined (__CC_ARM ) +const APP_INFO_t BUILD_IN_APP_INFO __attribute__((at(APP_INFO_ADDR))) = +#elif defined (__ICCARM__) +__root const APP_INFO_t BUILD_IN_APP_INFO @ (APP_INFO_ADDR) = +#else +const APP_INFO_t BUILD_IN_APP_INFO __attribute__((section(".app_info"))) = +#endif +{ + .app_pattern = APP_INFO_PATTERN_VALUE, + .app_info_version = APP_INFO_VERSION, + .chip_ver = CHIP_VER, + .load_addr = APP_CODE_LOAD_ADDR, + .run_addr = APP_CODE_RUN_ADDR, + .app_info_sum = CHECK_SUM, + .check_img = BOOT_CHECK_IMAGE, + .boot_delay = BOOT_LONG_TIME, + .sec_cfg = SECURITY_CFG_VAL, +#ifdef APP_INFO_COMMENTS + .comments = APP_INFO_COMMENTS, +#endif +}; + +void C_CONSTRUCTOR system_platform_init(void) +{ + vector_table_init(); + sdk_init(); + soc_init(); + return; +} + +#if defined ( __ICCARM__ ) +extern void __iar_program_start(void); +void __main(void) +{ + __iar_program_start(); +} + +extern void __iar_data_init3(void); +int __low_level_init(void) +{ + __iar_data_init3(); + system_platform_init(); + return 0; +} +#elif defined ( __GNUC__ ) && !defined ( __CC_ARM ) +extern int main(void); +void __main(void) +{ + __asm("ldr r1, =__etext\n"); + __asm("ldr r2, =__data_start__\n"); + __asm("ldr r3, =__data_end__\n"); + __asm(".L_loop1:\n"); + __asm("cmp r2, r3\n"); + __asm("ittt lt\n"); + __asm("ldrlt r0, [r1], #4\n"); + __asm("strlt r0, [r2], #4\n"); + __asm("blt .L_loop1\n"); + __asm("ldr r1, =__bss_start__\n"); + __asm("ldr r2, =__bss_end__\n"); + __asm("movs r0, 0\n"); + __asm(".L_loop3:\n"); + __asm("cmp r1, r2\n"); + __asm("itt lt\n"); + __asm("strlt r0, [r1], #4\n"); + __asm("blt .L_loop3\n"); + system_platform_init(); + main(); +} +#endif + +void main_init(void) +{ +#if defined ( SOC_GR5332 ) + uint32_t boot_flag = pwr_mgmt_get_wakeup_flag(); +#else + uint32_t boot_flag = get_wakeup_flag(); + #endif + if(COLD_BOOT == boot_flag) + { + extern void __main(void); + __main(); + } + else + { + __DMB(); + SCB->VTOR = (uint32_t)(uintptr_t)ArchGetHwiFrom(); + __DSB(); + pwr_mgmt_warm_boot(); + while (1); + } +} + diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_system.c b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_system.c new file mode 100644 index 0000000..11b0da0 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/common/gr_system.c @@ -0,0 +1,46 @@ +/**************************************************************************//** + * @file gr_system.c + * @brief CMSIS Device System Source File for + * Device GR55xx + * @version V1.00 + * @date 12. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2009-2016 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "grx_sys.h" + +/*---------------------------------------------------------------------------- + Global Functions + *----------------------------------------------------------------------------*/ + + +void SystemInit(void) +{ + #if (__FPU_USED == 1) + SCB->CPACR |= ((3UL << 10*2) | /* set CP10 Full Access */ + (3UL << 11*2) ); /* set CP11 Full Access */ + #endif + + #ifdef UNALIGNED_SUPPORT_DISABLE + SCB->CCR |= SCB_CCR_UNALIGN_TRP_Msk; + #endif + + return; +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/ble_cfg.h b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/ble_cfg.h new file mode 100644 index 0000000..5ebf074 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/ble_cfg.h @@ -0,0 +1,212 @@ +/** + **************************************************************************************** + * + * @file scatter_common.h + * + * @brief decalare the symbols in scatter_common.sct. + * + * + **************************************************************************************** + */ + +#ifndef __BLE_CFG_H__ +#define __BLE_CFG_H__ + +#include +#include "custom_config.h" + +/* ************************************************************************ + * developer must define CFG_MAX_CONNECTIONS in custom_config.h . + * Max value for GR551X: 10 which must be same with CFG_CON + * in ROM's configs.opt + */ +#ifndef CFG_MAX_CONNECTIONS + #error "CFG_MAX_CONNECTIONS is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_CONNECTIONS <= 10) + #define USER_MAX_CONNECTIONS CFG_MAX_CONNECTIONS +#else + #define USER_MAX_CONNECTIONS (1) +#endif + +#ifndef CFG_MAX_ADVS + #error "CFG_MAX_ADVS is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_ADVS <= 5) + #define USER_MAX_ADVS CFG_MAX_ADVS +#else + #define USER_MAX_ADVS (1) +#endif + +#ifndef CFG_MAX_PER_ADVS + #error "CFG_MAX_PER_ADVS is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_PER_ADVS <= 5) + #define USER_MAX_PER_ADVS CFG_MAX_PER_ADVS +#else + #define USER_MAX_PER_ADVS (0) +#endif + +#if ((USER_MAX_ADVS+USER_MAX_PER_ADVS) > 5) + #error "The number of BLE Legacy/Extended/Periodic Advertising exceeds the limit." +#endif + +#ifndef CFG_MAX_SCAN + #error "CFG_MAX_SCAN is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_SCAN <= 1) + #define USER_MAX_SCAN CFG_MAX_SCAN +#else + #define USER_MAX_SCAN (1) +#endif + +#ifndef CFG_SCAN_DUP_FILT_LIST_NUM + #define USER_SCAN_DUP_FILT_NUM 0 +#else + #define USER_SCAN_DUP_FILT_NUM CFG_SCAN_DUP_FILT_LIST_NUM +#endif + +#ifndef CFG_MAX_SYNCS + #error "CFG_MAX_SYNCS is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_SYNCS <= 5) + #define USER_MAX_SYNCS CFG_MAX_SYNCS +#else + #define USER_MAX_SYNCS (0) +#endif + +#if ((USER_MAX_CONNECTIONS+USER_MAX_ADVS+2*USER_MAX_PER_ADVS+USER_MAX_SCAN+USER_MAX_SYNCS) > 12) + #error "The number of BLE Activities exceeds the limit." +#endif + +#ifndef CFG_MAX_BOND_DEVS + #error "CFG_MAX_BOND_DEVS is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_BOND_DEVS <= 10) + #define USER_MAX_BOND_DEVS CFG_MAX_BOND_DEVS +#else + #define USER_MAX_BOND_DEVS (1) +#endif + +#ifndef CFG_MAX_PRFS + #error "CFG_MAX_PRFS is not defined in app's custom_config.h ." +#endif + +#ifndef CFG_MESH_SUPPORT + #error "CFG_MESH_SUPPORT is not defined in app's custom_config.h ." +#endif + +#if (CFG_MAX_PRFS <= 64) + #define USER_MAX_PRFS CFG_MAX_PRFS +#else + #define USER_MAX_PRFS (1) +#endif + +/* The macro is used to compute size of the heap block in bytes. */ +#define MEM_HEAP_HEADER (12 / sizeof(uint32_t)) +#define MEM_CALC_HEAP_LEN(len) ((((len) + (sizeof(uint32_t) - 1)) / sizeof(uint32_t)) + MEM_HEAP_HEADER) +#define MEM_CALC_HEAP_LEN_IN_BYTES(len) (MEM_CALC_HEAP_LEN(len) * sizeof(uint32_t)) + +#define ENV_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(292 * USER_MAX_CONNECTIONS \ + + 426 * (USER_MAX_CONNECTIONS+USER_MAX_ADVS+2*USER_MAX_PER_ADVS+USER_MAX_SCAN+USER_MAX_SYNCS) \ + + 600) +/* The size of heap for ATT database depends on the number of attributes in + * profiles. The value can be tuned based on supported profiles. */ +#if (CFG_MESH_SUPPORT == 1) +#include "mesh_stack_config.h" +#define ATT_DB_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1000 + MESH_HEAP_SIZE_ADD) +#else +#define ATT_DB_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1024) +#endif + +#define KE_MSG_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(1650 * (USER_MAX_SCAN+USER_MAX_SYNCS) \ + + 112 *(USER_MAX_CONNECTIONS+USER_MAX_ADVS+2*USER_MAX_PER_ADVS) \ + + 408 *(USER_MAX_CONNECTIONS+USER_MAX_ADVS+2*USER_MAX_PER_ADVS+USER_MAX_SCAN+USER_MAX_SYNCS) \ + + 3072) +/* The size of non-retention heap is customized. This heap will used by BLE + * stack only when other three heaps are full. */ +#define NON_RET_HEAP_SIZE MEM_CALC_HEAP_LEN_IN_BYTES(328 * 2) + +#define PRF_BUF_SIZE (92*USER_MAX_PRFS + 4) +#define BOND_BUF_SIZE (8*USER_MAX_BOND_DEVS + 4) +#define CONN_BUF_SIZE (372*USER_MAX_CONNECTIONS + 4) +#define SCAN_DUP_FILT_BUF_SIZE (2 * USER_SCAN_DUP_FILT_NUM + 4) + +#if (CFG_MAX_CONNECTIONS < 3) && (CFG_MAX_ADVS < 2) && (CFG_MESH_SUPPORT < 1) +#define EM_BASE_ADDR (0xB0008000) +#define EM_BLE_ADVDATATXBUF_OFFSET (0x13A0) +#define EM_BLE_ADVDATATXBUF_END (0x4F28) +#define EM_NVDS_OFFSET (0x6690) + +// (EM_BASE_ADDR + EM_BLE_ADVDATATXBUF_OFFSET + 4 * 1270 + 16(reserved)) +#define ENV_HEAP_ADDR (0xB000A788) + +// (ENV_HEAP_ADDR + ENV_HEAP_SIZE:2900 bytes) +#define KE_MSG_HEAP_ADDR (0xB000B2DC) + +// (KE_MSG_HEAP_ADDR + MSG_HEAP_SIZE:6700 bytes) +#define KE_MSG_HEAP_END_ADDR (0xB000CD08) + +// (EM_BASE_ADDR + EM_NVDS_OFFSET + 4096 + 16(reserved)) +#define ATT_DB_HEAP_ADDR (0xB000F6A0) + +// (ATT_DB_HEAP_ADDR + ATT_DB_HEAP_SIZE:1024) +#define NON_RET_HEAP_ADDR (0xB000FAA0) + +// (NON_RET_HEAP_ADDR + ATT_DB_HEAP_SIZE:1024) +#define NON_RET_HEAP_END_ADDR (0xB000FEA0) + +#define STACK_HEAP_INIT(heaps_table) uint8_t prf_buf[PRF_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t bond_buf[BOND_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t conn_buf[CONN_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t scan_dup_filt_buf[SCAN_DUP_FILT_BUF_SIZE] __attribute__((aligned (32))) = {0};\ +stack_heaps_table_t heaps_table = { (uint32_t *)(ENV_HEAP_ADDR),\ + (uint32_t *)(ATT_DB_HEAP_ADDR),\ + (uint32_t *)(KE_MSG_HEAP_ADDR),\ + (uint32_t *)(NON_RET_HEAP_ADDR),\ + 2900,\ + 1024,\ + 6700,\ + 1024,\ + (uint8_t *)prf_buf,\ + PRF_BUF_SIZE,\ + (uint8_t *)bond_buf,\ + BOND_BUF_SIZE,\ + (uint8_t *)conn_buf,\ + CONN_BUF_SIZE,\ + scan_dup_filt_buf,\ + SCAN_DUP_FILT_BUF_SIZE} +#else +#define STACK_HEAP_INIT(heaps_table) uint8_t prf_buf[PRF_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t bond_buf[BOND_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t conn_buf[CONN_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t scan_dup_filt_buf[SCAN_DUP_FILT_BUF_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t env_heap_buf[ENV_HEAP_SIZE] __attribute__((aligned (32)))= {0};\ + uint8_t att_db_heap_buf[ATT_DB_HEAP_SIZE] __attribute__((aligned (32)))= {0};\ + uint8_t ke_msg_heap_buf[KE_MSG_HEAP_SIZE] __attribute__((aligned (32))) = {0};\ + uint8_t non_ret_heap_buf[NON_RET_HEAP_SIZE]__attribute__((aligned (32))) = {0};\ +stack_heaps_table_t heaps_table = { (uint32_t *)env_heap_buf,\ + (uint32_t *)att_db_heap_buf,\ + (uint32_t *)ke_msg_heap_buf,\ + (uint32_t *)non_ret_heap_buf,\ + ENV_HEAP_SIZE,\ + ATT_DB_HEAP_SIZE,\ + KE_MSG_HEAP_SIZE,\ + NON_RET_HEAP_SIZE,\ + (uint8_t *)prf_buf,\ + PRF_BUF_SIZE,\ + (uint8_t *)bond_buf,\ + BOND_BUF_SIZE,\ + (uint8_t *)conn_buf,\ + CONN_BUF_SIZE,\ + scan_dup_filt_buf,\ + SCAN_DUP_FILT_BUF_SIZE} +#endif + +#endif // __SCATTER_COMMON_H__ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr551xx.h b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr551xx.h new file mode 100644 index 0000000..ef5ec21 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr551xx.h @@ -0,0 +1,6550 @@ +/**************************************************************************//** + * @file gr551xx.h + * @brief CMSIS Cortex-M# Core Peripheral Access Layer Header File for + * Device gr551xx + * @version V1.00 + * @date 12. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2016-2018, Shenzhen Huiding Technology Co., Ltd + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** @addtogroup Device_Included + * @{ + */ + +/** @addtogroup GR551xx + * @{ + */ + +#ifndef __GR551xx_H__ +#define __GR551xx_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup Peripheral_interrupt_number_definition + * @{ + */ + +/** + * @brief GR55xx Interrupt Number Definition, according to the selected device + * in @ref Library_configuration_section + */ + +/* ================================================================================================================= */ +/* ================ Interrupt Number Definition ================ */ +/* ================================================================================================================= */ +typedef enum IRQn +{ +/* ================================== ARM Cortex-M# Specific Interrupt Numbers =================================== */ + + NonMaskableInt_IRQn = -14, /**< -14 Non maskable Interrupt, cannot be stopped or preempted */ + HardFault_IRQn = -13, /**< -13 Hard Fault, all classes of Fault */ + MemoryManagement_IRQn = -12, /**< -12 Memory Management, MPU mismatch, including Access Violation + and No Match */ + BusFault_IRQn = -11, /**< -11 Bus Fault, Pre-Fetch-, Memory Access Fault, other address/memory + related Fault */ + UsageFault_IRQn = -10, /**< -10 Usage Fault, i.e. Undef Instruction, Illegal State Transition */ + SVCall_IRQn = -5, /**< -5 System Service Call via SVC instruction */ + DebugMonitor_IRQn = -4, /**< -4 Debug Monitor */ + PendSV_IRQn = -2, /**< -2 Pendable request for system service */ + SysTick_IRQn = -1, /**< -1 System Tick Timer */ + +/* ====================================== Specific Interrupt Numbers ==================================== */ + WDT_IRQn = 0, /**< Watchdog Timer Interrupt */ + BLE_SDK_IRQn = 1, /**< BLE_SDK_SCHEDULE Interrupt */ + BLE_IRQn = 2, /**< BLE Interrupt */ + DMA_IRQn = 3, /**< DMA Interrupt */ + SPI_M_IRQn = 4, /**< SPI_M Interrupt */ + SPI_S_IRQn = 5, /**< SPI_S Interrupt */ + EXT0_IRQn = 6, /**< EXT0 Interrupt */ + EXT1_IRQn = 7, /**< EXT1 Interrupt */ + TIMER0_IRQn = 8, /**< Timer0 Interrupt */ + TIMER1_IRQn = 9, /**< Timer1 Interrupt */ + DUAL_TIMER_IRQn = 10, /**< Dual_Timer Interrupt */ + QSPI0_IRQn = 11, /**< QSPI0 Interrupt */ + UART0_IRQn = 12, /**< UART0 Interrupt */ + UART1_IRQn = 13, /**< UART1 Interrupt */ + I2C0_IRQn = 14, /**< I2C0 Interrupt */ + I2C1_IRQn = 15, /**< I2C1 Interrupt */ + AES_IRQn = 16, /**< AES Interrupt */ + HMAC_IRQn = 17, /**< HMAC Interrupt */ + EXT2_IRQn = 18, /**< EXT2 Interrupt */ + RNG_IRQn = 19, /**< RNG Interrupt */ + BOD_ASSERT_IRQn = 20, /**< BOD Interrupt */ + PKC_IRQn = 21, /**< PKC Interrupt */ + XQSPI_IRQn = 22, /**< XQSPI Interrupt */ + QSPI1_IRQn = 23, /**< QSPI1 Interrupt */ + PWR_CMD_IRQn = 24, /**< POWER CMD ACK Interrupt */ + BLESLP_IRQn = 25, /**< BLE Sleep Interrupt */ + SLPTIMER_IRQn = 26, /**< Sleep Timer Interrupt */ + COMP_EXT_IRQn = 27, /**< Comparator and External Wakeup Interrupt */ + AON_WDT_IRQn = 28, /**< Always on Watchdog Interrupt */ + I2S_M_IRQn = 29, /**< I2S_M Interrupt */ + I2S_S_IRQn = 30, /**< I2S_S Interrupt */ + ISO7816_IRQn = 31, /**< ISO7816 Interrupt */ + PRESENT_IRQn = 32, /**< Presnet Done Interrupt */ + CALENDAR_IRQn = 33, /**< AON Calendar Timer Interrupt */ + MAX_NUMS_IRQn = 34, /**< Last Interrupt */ +} IRQn_Type; + +#define AON_EXT_IRQn EXT2_IRQn + +/** @} */ /* End of group Peripheral _interrupt_number_definition */ + +/* ================================================================================================================= */ +/* ================ Processor and Core Peripheral Section ================ */ +/* ================================================================================================================= */ + +/* =================================== Start of section using anonymous unions =================================== */ + +/* ====================== Configuration of the ARM Cortex-M4 Processor and Core Peripherals ====================== */ +#define __CM4_REV 0x0001U /* Core revision r0p1 */ +#define __MPU_PRESENT 1 /* MPU present */ +#define __VTOR_PRESENT 1 /* VTOR present */ +#define __NVIC_PRIO_BITS 8 /* Number of Bits used for Priority Levels */ +#define __Vendor_SysTickConfig 0 /* Set to 1 if different SysTick Config is used */ +#define __FPU_PRESENT 1 /* FPU present */ + +#include "core_cm4.h" /* Cortex-M4 processor and core peripherals */ +#include "system_gr55xx.h" /* System Header */ +#include + +#if defined (__CC_ARM) + #pragma push + #pragma anon_unions +#elif defined (__ICCARM__) + #pragma language=extended +#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wc11-extensions" + #pragma clang diagnostic ignored "-Wreserved-id-macro" +#elif defined (__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined (__TMS470__) + /* anonymous unions are enabled by default */ +#elif defined (__TASKING__) + #pragma warning 586 +#elif defined (__CSMC__) + /* anonymous unions are enabled by default */ +#else + #warning Not supported compiler type +#endif + + +/* ================================================================================================================= */ +/* ================ Device Specific Peripheral Section ================ */ +/* ================================================================================================================= */ + +/** @addtogroup Peripheral_registers_structures + * @{ + */ + +/** + * @brief AES + */ +typedef struct _aes_regs +{ + __IOM uint32_t CTRL; /**< AES_REG_CTRL, Address offset: 0x00 */ + __IOM uint32_t CONFIG; /**< AES_REG_CONFIG, Address offset: 0x04 */ + __IM uint32_t STATUS; /**< AES_REG_STATUS, Address offset: 0x08 */ + __IOM uint32_t INTERRUPT; /**< AES_REG_INTERRUPT, Address offset: 0x0C */ + __IOM uint32_t TRAN_SIZE; /**< AES_REG_TRAN_SIZE, Address offset: 0x10 */ + __IOM uint32_t RSTART_ADDR; /**< AES_REG_RSTART_ADDR, Address offset: 0x14 */ + __IOM uint32_t WSTART_ADDR; /**< AES_REG_WSTART_ADDR, Address offset: 0x18 */ + __IOM uint32_t KEY_ADDR; /**< AES_REG_KEY_ADDR, Address offset: 0x1C */ + __IM uint32_t DATA_OUT[4]; /**< AES_REG_DATA_OUT, Address offset: 0x20 */ + __OM uint32_t KEY[8]; /**< AES_REG_KEY, Address offset: 0x30 */ + __IOM uint32_t SEED_IN; /**< AES_REG_SEED_IN, Address offset: 0x50 */ + __IOM uint32_t SEED_OUT; /**< AES_REG_SEED_OUT, Address offset: 0x54 */ + __IOM uint32_t SEED_IMASK; /**< AES_REG_SEED_IMASK, Address offset: 0x58 */ + __IOM uint32_t SEED_OSBOX; /**< AES_REG_SEED_OSBOX, Address offset: 0x5C */ + __OM uint32_t VECTOR_INIT[4]; /**< AES_REG_VECTOR_INIT, Address offset: 0x60 */ + __OM uint32_t DATA_IN[4]; /**< AES_REG_DATA_IN, Address offset: 0x70 */ + __OM uint32_t KPORT_MASK; /**< AES_REG_KPORT_MASK, Address offset: 0x80 */ +} aes_regs_t; + +/** + * @brief AON + */ +typedef struct _aon_regs +{ + __IOM uint32_t SOFTWARE_0; /**< AON_REG_SOFTWARE_0, Address offset: 0x00 */ + __IOM uint32_t PWR_RET01; /**< AON_REG_PWR_RET01, Address offset: 0x04 */ + __IOM uint32_t SNSADC_CFG; /**< AON_REG_SNSADC_CFG, Address offset: 0x08 */ + __IOM uint32_t RF_REG_0; /**< AON_REG_RF_REG_0, Address offset: 0x0C */ + __IOM uint32_t RF_REG_1; /**< AON_REG_RF_REG_1, Address offset: 0x10 */ + __IOM uint32_t RF_REG_2; /**< AON_REG_RF_REG_2, Address offset: 0x14 */ + __IOM uint32_t CALENDAR_TIMER_CTL; /**< AON_REG_CALENDAR_TIMER_CTL, Address offset: 0x18 */ + __IOM uint32_t MEM_STD_OVR; /**< AON_REG_MEM_STD_OVR, Address offset: 0x1C */ + __IOM uint32_t RF_REG_3; /**< AON_REG_RF_REG_3, Address offset: 0x20 */ + __IOM uint32_t RF_REG_4; /**< AON_REG_RF_REG_4, Address offset: 0x24 */ + __IOM uint32_t RF_REG_5; /**< AON_REG_RF_REG_5, Address offset: 0x28 */ + __IOM uint32_t RF_REG_6; /**< AON_REG_RF_REG_6, Address offset: 0x2C */ + __IOM uint32_t RF_REG_7; /**< AON_REG_RF_REG_7, Address offset: 0x30 */ + __IOM uint32_t RF_REG_8; /**< AON_REG_RF_REG_8, Address offset: 0x34 */ + __IOM uint32_t RF_REG_9; /**< AON_REG_RF_REG_9, Address offset: 0x38 */ + __IOM uint32_t MSIO_PAD_CFG_0; /**< AON_REG_MSIO_PAD_CFG_0, Address offset: 0x3C */ + __IOM uint32_t MSIO_PAD_CFG_1; /**< AON_REG_MSIO_PAD_CFG_1, Address offset: 0x40 */ + __IOM uint32_t SLP_EVENT; /**< AON_REG_SLP_EVENT, Address offset: 0x44 */ + __IOM uint32_t WARM_BOOT_TIME; /**< AON_REG_WARM_BOOT_TIME, Address offset: 0x48 */ + __IOM uint32_t RF_REG_10; /**< AON_REG_RF_REG_10, Address offset: 0x4C */ + __IOM uint32_t AON_PAD_CTL0; /**< AON_REG_AON_PAD_CTL0, Address offset: 0x50 */ + __IOM uint32_t MEM_N_SLP_CTL; /**< AON_REG_MEM_N_SLP_CTL, Address offset: 0x54 */ + __IOM uint32_t EXT_WKUP_CTL; /**< AON_REG_EXT_WKUP_CTL, Address offset: 0x58 */ + __IOM uint32_t AON_PAD_CTL1; /**< AON_REG_AON_PAD_CTL1, Address offset: 0x5C */ + __IOM uint32_t SOFTWARE_1; /**< AON_REG_SOFTWARE_1, Address offset: 0x60 */ + __IOM uint32_t MEM_PWR_SLP; /**< AON_REG_MEM_PWR_SLP, Address offset: 0x64 */ + __IOM uint32_t MEM_PWR_WKUP; /**< AON_REG_MEM_PWR_WKUP, Address offset: 0x68 */ + __IOM uint32_t PWR_RET27; /**< AON_REG_PWR_RET27, Address offset: 0x6C */ + __IOM uint32_t PWR_RET28; /**< AON_REG_PWR_RET28, Address offset: 0x70 */ + __IOM uint32_t PWR_RET29; /**< AON_REG_PWR_RET29, Address offset: 0x74 */ + __IOM uint32_t SOFTWARE_2; /**< AON_REG_SOFTWARE_2, Address offset: 0x78 */ + __IOM uint32_t PWR_RET31; /**< AON_REG_PWR_RET31, Address offset: 0x7C */ + __IOM uint32_t PSC_CMD; /**< AON_REG_PSC_CMD, Address offset: 0x80 */ + __IOM uint32_t PSC_CMD_OPC; /**< AON_REG_PSC_CMD_OPC, Address offset: 0x84 */ + __IM uint32_t MCU_RELEASE; /**< AON_REG_MCU_RELEASE, Address offset: 0x88 */ + __IM uint32_t RESERVED0; /**< Reserved, Address offset: 0x8C */ + __IOM uint32_t TIMER_VALUE; /**< AON_REG_TIMER_VALUE, Address offset: 0x90 */ + __IM uint32_t TIMER_VAL; /**< AON_REG_TIMER_VAL, Address offset: 0x94 */ + __IM uint32_t RESERVED1[13]; /**< Reserved, Address offset: 0x98 */ + __IOM uint32_t FPGA_CTRL; /**< AON_REG_FPGA_CTRL, Address offset: 0xCC */ + __IM uint32_t RESERVED2[5]; /**< Reserved, Address offset: 0xD0 */ + __IOM uint32_t ST_CALIB; /**< AON_REG_ST_CALIB_REG, Address offset: 0xE4 */ +} aon_regs_t; + +/** + * @brief DMA + */ +#define DMA_REG(name) __IOM uint32_t name; __IOM uint32_t __pad_##name +/* DMA/Channel_x_Registers Registers */ +typedef struct +{ + DMA_REG(SAR); /**< Source Address, Address offset: 0x00 */ + DMA_REG(DAR); /**< Destination Address, Address offset: 0x08 */ + DMA_REG(LLP); /**< Linked List Pointer, Address offset: 0x10 */ + __IOM uint32_t CTL_LO; /**< Control Register Low, Address offset: 0x18 */ + __IOM uint32_t CTL_HI; /**< Control Register High, Address offset: 0x1C */ + DMA_REG(SSTAT); /**< Source Status, Address offset: 0x20 */ + DMA_REG(DSTAT); /**< Destination Status, Address offset: 0x28 */ + DMA_REG(SSTATAR); /**< Source Status Address, Address offset: 0x30 */ + DMA_REG(DSTATAR); /**< Destination Status Address, Address offset: 0x38 */ + __IOM uint32_t CFG_LO; /**< Configuration Register Low, Address offset: 0x40 */ + __IOM uint32_t CFG_HI; /**< Configuration Register High, Address offset: 0x44 */ + DMA_REG(SGR); /**< Source Gather, Address offset: 0x48 */ + DMA_REG(DSR); /**< Destination Scatter, Address offset: 0x50 */ +} DMA_CH_REGS; + +/* DMA/Interrupt_Registers Registers */ +typedef struct +{ + __IO uint32_t RAW_CH_EVT[10]; /**< Raw channel event, Address offset: 0x00 */ + __I uint32_t STATUS_CH_EVT[10]; /**< Status channel event, Address offset: 0x28 */ + __IO uint32_t MASK_CH_EVT[10]; /**< Mask channel event, Address offset: 0x50 */ + __O uint32_t CLEAR_CH_EVT[10]; /**< Clear channel event, Address offset: 0x78 */ + DMA_REG(STATUS_EVT); /**< Status event, Address offset: 0xA0 */ +} DMA_INT_REGS; + +/* DMA/Software_Handshake_Registers Registers */ +typedef struct +{ + DMA_REG(REQ_SRC); /**< Source Transaction Request, Address offset: 0x00 */ + DMA_REG(REQ_DST); /**< Destination Transaction Request, Address offset: 0x08 */ + DMA_REG(SGL_RQ_SRC); /**< Source Single Transaction Request, Address offset: 0x20 */ + DMA_REG(SGL_RQ_DST); /**< Destination Single Transaction Request,Address offset: 0x28 */ + DMA_REG(LST_SRC); /**< Source Last Transaction Request, Address offset: 0x30 */ + DMA_REG(LST_DST); /**< Destination Last Transaction Request, Address offset: 0x38 */ +} DMA_HS_REGS; + +/* DMA/Miscellaneous_Registers Registers */ +typedef struct +{ + DMA_REG(CFG); /**< DMA Configuration, Address offset: 0x00 */ + DMA_REG(CH_EN); /**< DMA Channel Enable, Address offset: 0x08 */ + DMA_REG(ID); /**< DMA ID, Address offset: 0x20 */ + DMA_REG(TEST); /**< DMA Test, Address offset: 0x28 */ + DMA_REG(LP_TIMEOUT); /**< DMA Low Power Timeout, Address offset: 0x30 */ + DMA_REG(RESERVED); /**< Reserved, Address offset: 0x38 */ + DMA_REG(COMP_PARAMS_6); /**< DMA Component Parameters 6, Address offset: 0x40 */ + DMA_REG(COMP_PARAMS_5); /**< DMA Component Parameters 5, Address offset: 0x48 */ + DMA_REG(COMP_PARAMS_4); /**< DMA Component Parameters 4, Address offset: 0x50 */ + DMA_REG(COMP_PARAMS_3); /**< DMA Component Parameters 3, Address offset: 0x58 */ + DMA_REG(COMP_PARAMS_2); /**< DMA Component Parameters 2, Address offset: 0x60 */ + DMA_REG(COMP_PARAMS_1); /**< DMA Component Parameters 1, Address offset: 0x68 */ + DMA_REG(COMPS_ID); /**< DMA Component ID, Address offset: 0x70 */ +} DMA_MISC_REGS; + +typedef struct _dma_regs +{ + DMA_CH_REGS CHANNEL[8]; /**< DMA_REG_CH register, Address offset: 0x000 */ + DMA_INT_REGS EVENT; /**< DMA_REG_INT register, Address offset: 0x2C0 */ + DMA_HS_REGS HANDSHAKE; /**< DMA_REG_HS register, Address offset: 0x368 */ + DMA_MISC_REGS MISCELLANEOU; /**< DMA_REG_MISC register, Address offset: 0x3A8 */ +} dma_regs_t; + +/** + * @brief DUAL_TIM + */ +typedef struct _dual_timer_regs +{ + __IOM uint32_t RELOAD; /**< DUAL_TIMER auto-reload register, Address offset: 0x00 */ + __IM uint32_t VALUE; /**< DUAL_TIMER counter value register, Address offset: 0x04 */ + __IOM uint32_t CTRL; /**< DUAL_TIMER control register, Address offset: 0x08 */ + __OM uint32_t INTCLR; /**< DUAL_TIMER interrupt status clear register, Address offset: 0x0C */ + __IM uint32_t RAW_INTSTAT; /**< DUAL_TIMER raw interrupt status register, Address offset: 0x10 */ + __IM uint32_t INTSTAT; /**< DUAL_TIMER interrupt status register, Address offset: 0x14 */ + __IOM uint32_t BG_LOAD; /**< DUAL_TIMER background-reload register, Address offset: 0x18 */ +} dual_timer_regs_t; + +/** + * @brief GPIO + */ +typedef struct _gpio_regs +{ + __IOM uint32_t DATA; /**< GPIO_REG_DATA register, Address offset: 0x000 */ + __IOM uint32_t DATAOUT; /**< GPIO_REG_DATAOUT register, Address offset: 0x004 */ + __IM uint32_t RESERVED0[2]; /**< GPIO_REG_RESERVED register, Address offset: 0x008 */ + __IOM uint32_t OUTENSET; /**< GPIO_REG_OUTENSET register, Address offset: 0x010 */ + __IOM uint32_t OUTENCLR; /**< GPIO_REG_OUTENCLR register, Address offset: 0x014 */ + __IOM uint32_t ALTFUNCSET; /**< GPIO_REG_ALTFUNCSET register, Address offset: 0x018 */ + __IOM uint32_t ALTFUNCCLR; /**< GPIO_REG_ALTFUNCCLR register, Address offset: 0x01C */ + __IOM uint32_t INTENSET; /**< GPIO_REG_INTENSET register, Address offset: 0x020 */ + __IOM uint32_t INTENCLR; /**< GPIO_REG_INTENCLR register, Address offset: 0x024 */ + __IOM uint32_t INTTYPESET; /**< GPIO_REG_INTTYPESET register, Address offset: 0x028 */ + __IOM uint32_t INTTYPECLR; /**< GPIO_REG_INTTYPECLR register, Address offset: 0x02C */ + __IOM uint32_t INTPOLSET; /**< GPIO_REG_INTPOLSET register, Address offset: 0x030 */ + __IOM uint32_t INTPOLCLR; /**< GPIO_REG_INTPOLCLR register, Address offset: 0x034 */ + __IOM uint32_t INTSTAT; /**< GPIO_REG_INTSTAT register, Address offset: 0x038 */ + __IM uint32_t RESERVED1[241]; /**< GPIO_REG_RESERVED register, Address offset: 0x03C */ + __IOM uint32_t MASKLOWBYTE[256]; /**< GPIO_REG_MASKLOWBYTE register, Address offset: 0x400 */ + __IOM uint32_t MASKHIGHBYTE[256]; /**< GPIO_REG_MASKHIGHBYTE register, Address offset: 0x500 */ +} gpio_regs_t; + +/** + * @brief HMAC + */ +typedef struct _hmac_regs +{ + __IOM uint32_t CTRL; /**< HMAC_REG_CTRL register, Adderss offset: 0x00 */ + __IOM uint32_t CONFIG; /**< HMAC_REG_CONFIG register, Adderss offset: 0x04 */ + __IM uint32_t STATUS; /**< HMAC_REG_STATUS register, Adderss offset: 0x08 */ + __IOM uint32_t TRAN_SIZE; /**< HMAC_REG_TRAN_SIZE register, Adderss offset: 0x0C */ + __IOM uint32_t INTERRUPT; /**< HMAC_REG_INTERRUPT register, Adderss offset: 0x10 */ + __IOM uint32_t RSTART_ADDR; /**< HMAC_REG_RSTART_ADDR register, Adderss offset: 0x14 */ + __IOM uint32_t WSTART_ADDR; /**< HMAC_REG_WSTART_ADDR register, Adderss offset: 0x18 */ + __IM uint32_t REVERSED0; /**< HMAC_REG_REVERSED register, Adderss offset: 0x1C */ + __IOM uint32_t USER_HASH[8]; /**< HMAC_REG_USER_HASH register, Adderss offset: 0x20 */ + __IM uint32_t FIFO_OUT; /**< HMAC_REG_FIFO_OUT register, Adderss offset: 0x40 */ + __OM uint32_t MESSAGE_FIFO; /**< HMAC_REG_MESSAGE_FIFO register, Adderss offset: 0x44 */ + __OM uint32_t KEY[8]; /**< HMAC_REG_KEY register, Adderss offset: 0x48 */ + __IOM uint32_t KEY_ADDR; /**< HMAC_REG_KEY_ADDR register, Adderss offset: 0x68 */ + __OM uint32_t KPORT_MASK; /**< HMAC_REG_KPORT_MASK register, Adderss offset: 0x6C */ +} hmac_regs_t; + +/** + * @brief I2C + */ +typedef struct _i2c_regs +{ + __IOM uint32_t CON; /**< I2C control, Address offset: 0x00 */ + __IOM uint32_t TAR; /**< I2C target address, Address offset: 0x04 */ + __IOM uint32_t SAR; /**< I2C slave address, Address offset: 0x08 */ + __IOM uint32_t HS_MADDR; /**< I2C HS Master Mode Code address, Address offset: 0x0C */ + __IOM uint32_t DATA_CMD; /**< I2C Rx/Tx Data Buffer and Command, Address offset: 0x10 */ + __IOM uint32_t SS_SCL_HCNT; /**< Standard Speed I2C clock SCL High Count, Address offset: 0x14 */ + __IOM uint32_t SS_SCL_LCNT; /**< Standard Speed I2C clock SCL Low Count, Address offset: 0x18 */ + __IOM uint32_t FS_SCL_HCNT; /**< Fast Speed I2C clock SCL Low Count, Address offset: 0x1C */ + __IOM uint32_t FS_SCL_LCNT; /**< Fast Speed I2C clock SCL Low Count, Address offset: 0x20 */ + __IOM uint32_t HS_SCL_HCNT; /**< High Speed I2C clock SCL Low Count, Address offset: 0x24 */ + __IOM uint32_t HS_SCL_LCNT; /**< High Speed I2C clock SCL Low Count, Address offset: 0x28 */ + __IM uint32_t INTR_STAT; /**< I2C Interrupt Status, Address offset: 0x2C */ + __IOM uint32_t INTR_MASK; /**< I2C Interrupt Mask, Address offset: 0x30 */ + __IM uint32_t RAW_INTR_STAT; /**< I2C Raw Interrupt Status, Address offset: 0x34 */ + __IOM uint32_t RX_TL; /**< I2C Receive FIFO Threshold, Address offset: 0x38 */ + __IOM uint32_t TX_TL; /**< I2C Transmit FIFO Threshold, Address offset: 0x3C */ + __IM uint32_t CLR_INTR; /**< Clear combined and Individual Interrupts, Address offset: 0x40 */ + __IM uint32_t CLR_RX_UNDER; /**< Clear RX_UNDER Interrupt, Address offset: 0x44 */ + __IM uint32_t CLR_RX_OVER; /**< Clear RX_OVER Interrupt, Address offset: 0x48 */ + __IM uint32_t CLR_TX_OVER; /**< Clear TX_OVER Interrupt, Address offset: 0x4C */ + __IM uint32_t CLR_RD_REQ; /**< Clear RQ_REQ Interrupt, Address offset: 0x50 */ + __IM uint32_t CLR_TX_ABRT; /**< Clear TX_ABRT Interrupt, Address offset: 0x54 */ + __IM uint32_t CLR_RX_DONE; /**< Clear RX_DONE Interrupt, Address offset: 0x58 */ + __IM uint32_t CLR_ACTIVITY; /**< Clear ACTIVITY Interrupt, Address offset: 0x5C */ + __IM uint32_t CLR_STOP_DET; /**< Clear STOP_DET Interrupt, Address offset: 0x60 */ + __IM uint32_t CLR_START_DET; /**< Clear START_DET Interrupt, Address offset: 0x64 */ + __IM uint32_t CLR_GEN_CALL; /**< Clear GEN_CALL Interrupt, Address offset: 0x68 */ + __IOM uint32_t ENABLE; /**< I2C Enable, Address offset: 0x6C */ + __IM uint32_t STATUS; /**< I2C Status, Address offset: 0x70 */ + __IM uint32_t TXFLR; /**< Transmit FIFO Level Register, Address offset: 0x74 */ + __IM uint32_t RXFLR; /**< Receive FIFO Level Register, Address offset: 0x78 */ + __IOM uint32_t SDA_HOLD; /**< SDA Hold Time Length Reg, Address offset: 0x7C */ + __IM uint32_t TX_ABRT_SOURCE; /**< I2C Transmit Abort Status Reg, Address offset: 0x80 */ + __IOM uint32_t SLV_DATA_NACK_ONLY; /**< Generate SLV_DATA_NACK Register, Address offset: 0x84 */ + __IOM uint32_t DMA_CR; /**< DMA Control Register, Address offset: 0x88 */ + __IOM uint32_t DMA_TDLR; /**< DMA Transmit Data Level, Address offset: 0x8C */ + __IOM uint32_t DMA_RDLR; /**< DMA Receive Data Level, Address offset: 0x90 */ + __IOM uint32_t SDA_SETUP; /**< SDA Setup Register, Address offset: 0x94 */ + __IOM uint32_t ACK_GENERAL_CALL; /**< ACK General Call Register, Address offset: 0x98 */ + __IM uint32_t ENABLE_STATUS; /**< Enable Status Register, Address offset: 0x9C */ + __IOM uint32_t FS_SPKLEN; /**< ISS and FS spike suppression limit, Address offset: 0xA0 */ + __IOM uint32_t HS_SPKLEN; /**< HS spike suppression limit, Address offset: 0xA4 */ + __IM uint32_t CLR_RESTART_DET; /**< Clear RESTART_DET Interrupt Register, Address offset: 0xA8 */ + __IOM uint32_t SCL_STUCK_AT_LOW_TIMEOUT; /**< I2C SCL Stuck at Low Timeout, Address offset: 0xAC */ + __IOM uint32_t SDA_STUCK_AT_LOW_TIMEOUT; /**< I2C SDA Stuck at Low Timeout, Address offset: 0xB0 */ + __IM uint32_t CLR_SCL_STUCK_DET; /**< Clear SCL Stuck at Low Detect Interrupt Register, Address offset: 0xB4 */ + __IM uint32_t DEVICE_ID; /**< I2C Device-ID Register, Address offset: 0xB8 */ + __IOM uint32_t SMBUS_CLK_LOW_SEXT; /**< SMBus Slave Clock Extend Timeout Register, Address offset: 0xBC */ + __IOM uint32_t SMBUS_CLK_LOW_MEXT; /**< SMBus Master Clock Extend Timeout Register, Address offset: 0xC0 */ + __IOM uint32_t SMBUS_THIGH_MAX_IDLE_COUNT; /**< SMBus Master THigh MAX Bus-idle count Register, Address offset: 0xC4 */ + __IM uint32_t SMBUS_INTSTAT; /**< SMBUS Interrupt Status Register, Address offset: 0xC8 */ + __IOM uint32_t SMBUS_INTMASK; /**< SMBus Interrupt Mask Register, Address offset: 0xCC */ + __IM uint32_t SMBUS_RAW_INTSTAT; /**< SMBus Raw Interrupt Status Register, Address offset: 0xD0 */ + __OM uint32_t SMBUS_INTCLR; /**< SMBus Clear Interrupt Register, Address offset: 0xD4 */ + __IOM uint32_t OPTIONAL_SAR; /**< I2C Optional Slave Address Register, Address offset: 0xD8 */ + __IOM uint32_t SMBUS_UDID_LSB; /**< SMBUS ARP UDID LSB Register, Address offset: 0xDC */ + __IM uint32_t RESERVED[5]; /**< I2C RESERVED register, Address offset: 0xE0 */ + __IM uint32_t COMP_PARAM_1; /**< Component Parameter Register 1, Address offset: 0xF4 */ + __IM uint32_t COMP_VERSION; /**< Component Version Register, Address offset: 0xF8 */ + __IM uint32_t COMP_TYPE; /**< Component Type Register, Address offset: 0xFC */ +} i2c_regs_t; + +/** + * @brief I2S + */ +typedef struct +{ + __IOM uint32_t DATA_L; /**< Left TX/RX buffer register, Address offset: 0x000 */ + __IOM uint32_t DATA_R; /**< Right TX/RX buffer register, Address offset: 0x004 */ + __IOM uint32_t RXEN; /**< RX enable, Address offset: 0x008 */ + __IOM uint32_t TXEN; /**< TX enable, Address offset: 0x00C */ + __IOM uint32_t RXSIZE; /**< RX data size, Address offset: 0x010 */ + __IOM uint32_t TXSIZE; /**< TX data size, Address offset: 0x014 */ + __IM uint32_t INTSTAT; /**< Interrupt status, Address offset: 0x018 */ + __IOM uint32_t INTMASK; /**< Interrupt mask, Address offset: 0x01C */ + __IM uint32_t RXOVR; /**< RX FIFO overflow flag, read to clear, Address offset: 0x020 */ + __IM uint32_t TXOVR; /**< TX FIFO overflow flag, read to clear, Address offset: 0x024 */ + __IOM uint32_t RXFIFO_TL; /**< RX FIFO threshold level, Address offset: 0x028 */ + __IOM uint32_t TXFIFO_TL; /**< TX FIFO threshold level, Address offset: 0x02C */ + __OM uint32_t RXFIFO_FLUSH; /**< RX FIFO flush, Address offset: 0x030 */ + __OM uint32_t TXFIFO_FLUSH; /**< TX FIFO flush, Address offset: 0x034 */ + __IM uint32_t RESERVED[2]; /**< Reversed, Address offset: 0x038 */ +}I2S_CHANNEL_REGS; + +typedef struct _i2s_regs +{ + __IOM uint32_t ENABLE; /**< I2S enable, Address offset: 0x000 */ + __IOM uint32_t RBEN; /**< I2S receiver block enable, Address offset: 0x004 */ + __IOM uint32_t TBEN; /**< I2S transmitter block enable, Address offset: 0x008 */ + __IOM uint32_t CLKEN; /**< Clock enable, Address offset: 0x00C */ + __IOM uint32_t CLKCONFIG; /**< Clock configuration, Address offset: 0x010 */ + __OM uint32_t RXFIFO_RST; /**< Receiver block FIFO reset, Address offset: 0x014 */ + __OM uint32_t TXFIFO_RST; /**< Transmitter block FIFO reset, Address offset: 0x018 */ + __IM uint32_t RESERVED0; /**< Reversed, Address offset: 0x01C */ + I2S_CHANNEL_REGS I2S_CHANNEL[4]; /**< I2S channels registers, Address offset: 0x020 */ + __IM uint32_t RESERVED1[40]; /**< Reversed, Address offset: 0x120 */ + __IM uint32_t RXDMA; /**< Receiver block DMA register, Address offset: 0x1C0 */ + __OM uint32_t RXDMA_RST; /**< Receiver block DMA reset, Address offset: 0x1C4 */ + __OM uint32_t TXDMA; /**< Transmitter block DMA register, Address offset: 0x1C8 */ + __OM uint32_t TXDMA_RST; /**< Transmitter block DMA reset, Address offset: 0x1CC */ + __IM uint32_t RESERVED2[8]; /**< Reversed, Address offset: 0x1D0 */ + __IM uint32_t I2S_PARAM2; /**< I2S component parameter register 2, Address offset: 0x1F0 */ + __IM uint32_t I2S_PARAM1; /**< I2S component parameter register 1, Address offset: 0x1F4 */ + __IM uint32_t I2S_VERSION; /**< I2S component version, Address offset: 0x1F8 */ + __IM uint32_t I2S_TYPE; /**< I2S component type, Address offset: 0x1FC */ +} i2s_regs_t; + +/** + * @brief ISO7816 + */ +typedef struct _iso7816_regs +{ + __OM uint32_t CTRL; /**< Control Register, Address offset: 0x0000 */ + __IM uint32_t STAT; /**< Status Register, Address offset: 0x0004 */ + __IOM uint32_t CLK_CFG; /**< Clock Configuration Register , Address offset: 0x0008 */ + __IOM uint32_t RESERVED0[1]; /**< RESERVED, Address offset: 0x000C */ + __IOM uint32_t TIMES_CFG; /**< Times Configuration Register , Address offset: 0x0010 */ + __IOM uint32_t DATA_CFG; /**< Data Configuration Register , Address offset: 0x0014 */ + __IM uint32_t ADDR; /**< Address Register , Address offset: 0x0018 */ + __IOM uint32_t START_ADDR; /**< Start Address Register , Address offset: 0x001C */ + __IOM uint32_t RX_END_ADDR; /**< RX End Address Register , Address offset: 0x0020 */ + __IOM uint32_t TX_END_ADDR; /**< TX End Address Register , Address offset: 0x0024 */ +} iso7816_regs_t; + +/** + * @brief MCU_SUB + */ +typedef struct _mcu_sub_regs +{ + __IM uint32_t SENSE_ADC_FIFO; /**< MCU_SUB_REG_SENSE_ADC_FIFO, Address offset: 0x000 */ + __IM uint32_t RESERVED0[63]; /**< RESERVED, Address offset: 0x004 */ + __IOM uint32_t SENSE_FF_THRESH; /**< MCU_SUB_REG_SENSE_FF_THRESH, Address offset: 0x100 */ + __IM uint32_t SENSE_ADC_STAT; /**< MCU_SUB_REG_SENSE_ADC_STAT, Address offset: 0x104 */ + __IM uint32_t RESERVED1[62]; /**< RESERVED, Address offset: 0x108 */ + __IOM uint32_t COMM_TMR_DEEPSLPSTAT; /**< MCU_SUB_REG_COMM_TMR_DEEPSLPSTAT, Address offset: 0x200 */ + __IM uint32_t RESERVED2; /**< RESERVED, Address offset: 0x204 */ + __IOM uint32_t DPAD_RE_N_BUS; /**< MCU_SUB_REG_DPAD_RE_N_BUS, Address offset: 0x208 */ + __IM uint32_t RESERVED3; /**< RESERVED, Address offset: 0x20C */ + __IOM uint32_t DPAD_RTYP_BUS; /**< MCU_SUB_REG_DPAD_RTYP_BUS, Address offset: 0x210 */ + __IM uint32_t RESERVED4; /**< RESERVED, Address offset: 0x214 */ + __IOM uint32_t DPAD_IE_N_BUS; /**< MCU_SUB_REG_DPAD_IE_N_BUS, Address offset: 0x218 */ + __IM uint32_t RESERVED5; /**< RESERVED, Address offset: 0x21C */ + __IOM uint32_t MSIO_REG0; /**< MCU_SUB_REG_MSIO_REG, Address offset: 0x220 */ + __IOM uint32_t BLE_FERP_CTL; /**< MCU_SUB_REG_BLE_FERP_CTL, Address offset: 0x224 */ + __IOM uint32_t DMA_ACC_SEL; /**< MCU_SUB_REG_DMA_ACC_SEL, Address offset: 0x228 */ + __IOM uint32_t SECURITY_RESET; /**< MCU_SUB_REG_SECURITY_RESET, Address offset: 0x22C */ + __IOM uint32_t PMU_ID; /**< MCU_SUB_REG_PMU_ID, Address offset: 0x230 */ + __IOM uint32_t PWR_AVG_CTL; /**< MCU_SUB_REG_PWR_AVG_CTL_REG, Address offset: 0x234 */ + __IOM uint32_t CLK_CAL_CTL[2]; /**< MCU_SUB_REG_CLK_CAL_CTL_REG0~1, Address offset: 0x238 */ + __IOM uint32_t DPAD_MUX_CTL0_7; /**< MCU_SUB_REG_DPAD_MUX_CTL_00_07, Address offset: 0x240 */ + __IOM uint32_t DPAD_MUX_CTL8_15; /**< MCU_SUB_REG_DPAD_MUX_CTL_08_15, Address offset: 0x244 */ + __IOM uint32_t DPAD_MUX_CTL16_23; /**< MCU_SUB_REG_DPAD_MUX_CTL_16_23, Address offset: 0x248 */ + __IOM uint32_t DPAD_MUX_CTL24_31; /**< MCU_SUB_REG_DPAD_MUX_CTL_24_31, Address offset: 0x24C */ + __IM uint32_t RESERVED6; /**< RESERVED, Address offset: 0x250 */ + __IOM uint32_t EFUSE_PWR_DELTA[2]; /**< MCU_SUB_REG_EFUSE_PWR_DELTA0~1, Address offset: 0x254 */ + __IM uint32_t RESERVED7; /**< RESERVED, Address offset: 0x250 */ + __IOM uint32_t EFUSE_PWR_CTRL[2]; /**< MCU_SUB_REG_EFUSE_PWR_CTRL0~1, Address offset: 0x260 */ + __IOM uint32_t I2S_CLK_CFG; /**< MCU_SUB_REG_I2S_CLK_CFG, Address offset: 0x268 */ + __IM uint32_t RESERVED8[5]; /**< RESERVED, Address offset: 0x26C */ + __IOM uint32_t MCU_SUB_REG; /**< MCU_SUB_REG_MCU_SUB_REG, Address offset: 0x280 */ + __IM uint32_t RESERVED9[3]; /**< RESERVED, Address offset: 0x284 */ + __IOM uint32_t AON_PAD_MUX_CTL; /**< MCU_SUB_REG_AON_PAD_MUX_CTL, Address offset: 0x290 */ + __IOM uint32_t MSIO_PAD_MUX_CTL; /**< MCU_SUB_REG_MSIO_PAD_MUX_CTL, Address offset: 0x294 */ + __IM uint32_t RESERVED10[2]; /**< RESERVED, Address offset: 0x298 */ + __IOM uint32_t MCU_SUBSYS_CG_CTRL[3]; /**< MCU_SUB_REG_MCU_SUBSYS_CG_CTRL0~2, Address offset: 0x2A0 */ + __IOM uint32_t MCU_PERIPH_CG; /**< MCU_SUB_REG_MCU_PERIPH_CG, Address offset: 0x2AC */ + __IOM uint32_t MCU_SUBSYS_CLK_CTRL; /**< MCU_SUB_REG_MCU_SUBSYS_CLK_CTRL, Address offset: 0x2B0 */ + __IM uint32_t RESERVED11[3]; /**< RESERVED, Address offset: 0x2B4 */ + __IOM uint32_t BLE_DSLEEP_CORR_EN; /**< MCU_SUB_REG_BLE_DSLEEP_CORR_EN, Address offset: 0x2C0 */ + __IOM uint32_t BLE_DSLEEP_HW_TIM_CORR; /**< MCU_SUB_REG_BLE_DSLEEP_HW_TIM_CORR,Address offset: 0x2C4 */ +} mcu_sub_regs_t; + +/** + * @brief PKC + */ +typedef struct _pkc_regs +{ + __IOM uint32_t CTRL; /**< PKC_REG_CTRL, Address offset: 0x00 */ + __IOM uint32_t CONFIG0; /**< PKC_REG_CONFIG0, Address offset: 0x04 */ + __IOM uint32_t CONFIG1; /**< PKC_REG_CONFIG1, Address offset: 0x08 */ + __IOM uint32_t CONFIG2; /**< PKC_REG_CONFIG2, Address offset: 0x0C */ + __IOM uint32_t CONFIG3; /**< PKC_REG_CONFIG3, Address offset: 0x10 */ + __IOM uint32_t CONFIG4; /**< PKC_REG_CONFIG4, Address offset: 0x14 */ + __IOM uint32_t CONFIG5; /**< PKC_REG_CONFIG5, Address offset: 0x18 */ + __IOM uint32_t CONFIG6; /**< PKC_REG_CONFIG6, Address offset: 0x1C */ + __IOM uint32_t CONFIG7; /**< PKC_REG_CONFIG7, Address offset: 0x20 */ + __IOM uint32_t CONFIG8; /**< PKC_REG_CONFIG8, Address offset: 0x24 */ + __IOM uint32_t CONFIG9; /**< PKC_REG_CONFIG9, Address offset: 0x28 */ + __IOM uint32_t CONFIG10; /**< PKC_REG_CONFIG10, Address offset: 0x2C */ + __IOM uint32_t CONFIG11; /**< PKC_REG_CONFIG11, Address offset: 0x30 */ + __IOM uint32_t CONFIG12; /**< PKC_REG_CONFIG12, Address offset: 0x34 */ + __IOM uint32_t CONFIG13; /**< PKC_REG_CONFIG13, Address offset: 0x38 */ + __IM uint32_t REVERSED0; /**< PKC_REG_REVERSED, Address offset: 0x3C */ + __IOM uint32_t SW_CTRL; /**< PKC_REG_SW_CTRL, Address offset: 0x40 */ + __IOM uint32_t SW_CONFIG0; /**< PKC_REG_SW_CONFIG, Address offset: 0x44 */ + __IOM uint32_t SW_CONFIG1; /**< PKC_REG_SW_CONFIG, Address offset: 0x48 */ + __IOM uint32_t SW_CONFIG2; /**< PKC_REG_SW_CONFIG, Address offset: 0x4C */ + __IOM uint32_t SW_CONFIG3; /**< PKC_REG_SW_CONFIG, Address offset: 0x50 */ + __IOM uint32_t SW_CONFIG4; /**< PKC_REG_SW_CONFIG, Address offset: 0x54 */ + __IOM uint32_t SW_CONFIG5; /**< PKC_REG_SW_CONFIG, Address offset: 0x58 */ + __IOM uint32_t SW_CONFIG6; /**< PKC_REG_SW_CONFIG, Address offset: 0x5C */ + __IOM uint32_t SW_CONFIG7; /**< PKC_REG_SW_CONFIG, Address offset: 0x60 */ + __IM uint32_t SW_CONFIG8; /**< PKC_REG_SW_CONFIG, Address offset: 0x64 */ + __IOM uint32_t SW_CONFIG9; /**< PKC_REG_SW_CONFIG, Address offset: 0x68 */ + __IOM uint32_t SW_CONFIG10; /**< PKC_REG_SW_CONFIG, Address offset: 0x6C */ + __IOM uint32_t SW_CONFIG11; /**< PKC_REG_SW_CONFIG, Address offset: 0x70 */ + __IOM uint32_t SW_CONFIG12; /**< PKC_REG_SW_CONFIG, Address offset: 0x74 */ + __IOM uint32_t SW_CONFIG13; /**< PKC_REG_SW_CONFIG, Address offset: 0x78 */ + __IM uint32_t REVERSED1; /**< PKC_REG_REVERSED, Address offset: 0x7C */ + __IOM uint32_t INTSTAT; /**< PKC_REG_INT_STATUS, Address offset: 0x80 */ + __IOM uint32_t INTEN; /**< PKC_REG_INT_ENABLE, Address offset: 0x84 */ + __IM uint32_t WORKSTAT; /**< PKC_REG_WORK_STATUS, Address offset: 0x88 */ + __IM uint32_t REVERSED2; /**< PKC_REG_REVERSED, Address offset: 0x8C */ + __IOM uint32_t DUMMY0; /**< PKC_REG_DUMMY0, Address offset: 0x90 */ + __IOM uint32_t DUMMY1; /**< PKC_REG_DUMMY1, Address offset: 0x94 */ + __IOM uint32_t DUMMY2; /**< PKC_REG_DUMMY2, Address offset: 0x98 */ +} pkc_regs_t; + +/** + * @brief PWM + */ +typedef struct _pwm_regs +{ + __IOM uint32_t MODE; /**< PWM_REG_MODE, Address, offset: 0x00 */ + __IOM uint32_t UPDATE; /**< PWM_REG_UPDATE, Address, offset: 0x04 */ + __IOM uint32_t PRD; /**< PWM_REG_PRD, Address, offset: 0x08 */ + __IOM uint32_t CMPA0; /**< PWM_REG_CMPA0, Address, offset: 0x0C */ + __IOM uint32_t CMPA1; /**< PWM_REG_CMPA1, Address, offset: 0x10 */ + __IOM uint32_t CMPB0; /**< PWM_REG_CMPB0, Address, offset: 0x14 */ + __IOM uint32_t CMPB1; /**< PWM_REG_CMPB1, Address, offset: 0x18 */ + __IOM uint32_t CMPC0; /**< PWM_REG_CMPC0, Address, offset: 0x1C */ + __IOM uint32_t CMPC1; /**< PWM_REG_CMPC1, Address, offset: 0x20 */ + __IOM uint32_t AQCTRL; /**< PWM_REG_AQCTRL, Address, offset: 0x24 */ + __IOM uint32_t BRPRD; /**< PWM_REG_BRPRD, Address, offset: 0x28 */ + __IOM uint32_t HOLD; /**< PWM_REG_HOLD, Address, offset: 0x2C */ +} pwm_regs_t; + +/** + * @brief SSI + */ +typedef struct _ssi_regs +{ + __IOM uint32_t CTRL0; /**< SSI_REG_CTRL0, Address offset: 0x00 */ + __IOM uint32_t CTRL1; /**< SSI_REG_CTRL1, Address offset: 0x04 */ + __IOM uint32_t SSI_EN; /**< SSI_REG_SSI_EN, Address offset: 0x08 */ + __IOM uint32_t MWC; /**< SSI_REG_MWC, Address offset: 0x0C */ + __IOM uint32_t SE; /**< SSI_REG_SE, Address offset: 0x10 */ + __IOM uint32_t BAUD; /**< SSI_REG_BAUD, Address offset: 0x14 */ + __IOM uint32_t TX_FTL; /**< SSI_REG_TX_FTL, Address offset: 0x18 */ + __IOM uint32_t RX_FTL; /**< SSI_REG_RX_FTL, Address offset: 0x1C */ + __IM uint32_t TX_FL; /**< SSI_REG_TX_FL, Address offset: 0x20 */ + __IM uint32_t RX_FL; /**< SSI_REG_RX_FL, Address offset: 0x24 */ + __IM uint32_t STAT; /**< SSI_REG_STAT, Address offset: 0x28 */ + __IOM uint32_t INTMASK; /**< SSI_REG_INT_MASK, Address offset: 0x2C */ + __IM uint32_t INTSTAT; /**< SSI_REG_INT_STAT, Address offset: 0x30 */ + __IM uint32_t RAW_INTSTAT; /**< SSI_REG_RAW_INT_STAT, Address offset: 0x34 */ + __IM uint32_t TXOIC; /**< SSI_REG_TXOIC, Address offset: 0x38 */ + __IM uint32_t RXOIC; /**< SSI_REG_RXOIC, Address offset: 0x3C */ + __IM uint32_t RXUIC; /**< SSI_REG_RXUIC, Address offset: 0x40 */ + __IM uint32_t MSTIC; /**< SSI_REG_MSTIC, Address offset: 0x44 */ + __IM uint32_t INTCLR; /**< SSI_REG_INT_CLR, Address offset: 0x48 */ + __IOM uint32_t DMAC; /**< SSI_REG_DMAC, Address offset: 0x4C */ + __IOM uint32_t DMA_TDL; /**< SSI_REG_DMA_TDL, Address offset: 0x50 */ + __IOM uint32_t DMA_RDL; /**< SSI_REG_DMA_RDL, Address offset: 0x54 */ + __IM uint32_t ID; /**< SSI_REG_ID, Address offset: 0x58 */ + __IM uint32_t VERSION_ID; /**< SSI_REG_VERSION_ID, Address offset: 0x5C */ + __IOM uint32_t DATA; /**< SSI_REG_DATA, Address offset: 0x60 */ + __IM uint32_t REVERSED[35]; /**< SSI_REG_REVERSED, Address offset: 0x64 */ + __IOM uint32_t RX_SAMPLE_DLY; /**< SSI_REG_RX_SAMPLE_DLY, Address offset: 0xF0 */ + __IOM uint32_t SPI_CTRL0; /**< SSI_REG_SPI_CTRL0, Address offset: 0xF4 */ +} ssi_regs_t; + +/** + * @brief TIM + */ +typedef struct _timer_regs +{ + __IOM uint32_t CTRL; /**< TIMER control register, Address offset: 0x00 */ + __IOM uint32_t VALUE; /**< TIMER counter value register, Address offset: 0x04 */ + __IOM uint32_t RELOAD; /**< TIMER auto-reload register, Address offset: 0x08 */ + __IOM uint32_t INTSTAT; /**< TIMER interrupt status register, Address offset: 0x0C */ +} timer_regs_t; + +/** + * @brief UART + */ +typedef struct _uart_regs +{ + union + { + __IOM uint32_t RBR; + __IOM uint32_t DLL; + __IOM uint32_t THR; + } RBR_DLL_THR; /**< UART_REG_RBR_DLL_THR, Address offset: 0x00 */ + union + { + __IOM uint32_t DLH; + __IOM uint32_t IER; + } DLH_IER; /**< UART_REG_DLH_IER, Address offset: 0x04 */ + union + { + __IOM uint32_t FCR; + __IOM uint32_t IIR; + } FCR_IIR; /**< UART_REG_FCR_IIR, Address offset: 0x08 */ + __IOM uint32_t LCR; /**< UART_REG_LCR, Address offset: 0x0C */ + __IOM uint32_t MCR; /**< UART_REG_MCR, Address offset: 0x10 */ + __IOM uint32_t LSR; /**< UART_REG_LSR, Address offset: 0x14 */ + __IOM uint32_t MSR; /**< UART_REG_MSR, Address offset: 0x18 */ + __IOM uint32_t SCRATCHPAD; /**< UART_REG_SCRATCHPAD, Address offset: 0x1C */ + __IOM uint32_t LPDLL; /**< UART_REG_LPDLL, Address offset: 0x20 */ + __IOM uint32_t LPDLH; /**< UART_REG_LPDLH, Address offset: 0x24 */ + __IOM uint32_t REVERSED0[2]; /**< REVERSED, Address offset: 0x28 */ + union + { + __IOM uint32_t SRBR[16]; + __IOM uint32_t STHR[16]; + } SRBR_STHR; /**< UART_REG_SRBR_STHR, Address offset: 0x30 */ + __IOM uint32_t FAR; /**< UART_REG_FAR, Address offset: 0x70 */ + __IOM uint32_t TFR; /**< UART_REG_TFR, Address offset: 0x74 */ + __IOM uint32_t TFW; /**< UART_REG_TFW, Address offset: 0x78 */ + __IOM uint32_t USR; /**< UART_REG_USR, Address offset: 0x7C */ + __IOM uint32_t TFL; /**< UART_REG_TFL, Address offset: 0x80 */ + __IOM uint32_t RFL; /**< UART_REG_RFL, Address offset: 0x84 */ + __IOM uint32_t SRR; /**< UART_REG_SRR, Address offset: 0x88 */ + __IOM uint32_t SRTS; /**< UART_REG_SRTS, Address offset: 0x8C */ + __IOM uint32_t SBCR; /**< UART_REG_SBCR, Address offset: 0x90 */ + __IOM uint32_t SDMAM; /**< UART_REG_SDMAM, Address offset: 0x94 */ + __IOM uint32_t SFE; /**< UART_REG_SFE, Address offset: 0x98 */ + __IOM uint32_t SRT; /**< UART_REG_SRT, Address offset: 0x9C */ + __IOM uint32_t STET; /**< UART_REG_STET, Address offset: 0xA0 */ + __IOM uint32_t HTX; /**< UART_REG_HTX, Address offset: 0xA4 */ + __IOM uint32_t DMASA; /**< UART_REG_DMASA, Address offset: 0xA8 */ + __IOM uint32_t TCR; /**< UART_REG_TCR, Address offset: 0xAC */ + __IOM uint32_t DE_EN; /**< UART_REG_DE_EN, Address offset: 0xB0 */ + __IOM uint32_t RE_EN; /**< UART_REG_RE_EN, Address offset: 0xB4 */ + __IOM uint32_t DET; /**< UART_REG_DET, Address offset: 0xB8 */ + __IOM uint32_t TAT; /**< UART_REG_TAT, Address offset: 0xBC */ + __IOM uint32_t DLF; /**< UART_REG_DLF, Address offset: 0xC0 */ + __IOM uint32_t RAR; /**< UART_REG_RAR, Address offset: 0xC4 */ + __IOM uint32_t TAR; /**< UART_REG_TAR, Address offset: 0xC8 */ + __IOM uint32_t LCR_EXT; /**< UART_REG_LCR_EXT, Address offset: 0xCC */ + __IOM uint32_t REVERSED1[9]; /**< REVERSED, Address offset: 0xD0 */ + __IOM uint32_t CPR; /**< UART_REG_CPR, Address offset: 0xF4 */ + __IOM uint32_t UCV; /**< UART_REG_UCV, Address offset: 0xF8 */ + __IOM uint32_t CTR; /**< UART_REG_CTR, Address offset: 0xFC */ +} uart_regs_t; + +/** + * @brief WDT + */ +typedef struct _wdt_regs +{ + __IOM uint32_t LOAD; /**< WDT_REG_LOAD, Address offset: 0x000 */ + __IOM uint32_t VALUE; /**< WDT_REG_VALUE, Address offset: 0x004 */ + __IOM uint32_t CTRL; /**< WDT_REG_CONTROL, Address offset: 0x008 */ + __IOM uint32_t INTCLR; /**< WDT_REG_INTCLR, Address offset: 0x00C */ + __IOM uint32_t RIS; /**< WDT_REG_RIS, Address offset: 0x010 */ + __IOM uint32_t MIS; /**< WDT_REG_MIS, Address offset: 0x014 */ + __IOM uint32_t REVERSED[762]; /**< REVERSED, Address offset: 0x018 */ + __IOM uint32_t LOCK; /**< WDT_REG_LOCK, Address offset: 0xC00 */ +} wdt_regs_t; + +/** + * @brief XQSPI + */ +/* XQSPI/Cache Registers */ +typedef struct +{ + __IOM uint32_t CTRL0; /**< Cache Control 0 Register, Address offset: 0x00 */ + __IOM uint32_t CTRL1; /**< Cache Control 1 Register, Address offset: 0x04 */ + __IM uint32_t HIT_COUNT; /**< Cache hits count, Address offset: 0x08 */ + __IM uint32_t MISS_COUNT; /**< Cache miss count, Address offset: 0x0C */ + __IM uint32_t STAT; /**< Status Register, Address offset: 0x10 */ + __IOM uint32_t BUF_FIRST_ADDR; /**< Preload start address, Address offset: 0x14 */ + __IOM uint32_t BUF_LAST_ADDR; /**< Preload last address, Address offset: 0x18 */ +} CACHE_REGS; + +/* XQSPI/QSPI Registers */ +typedef struct +{ + __OM uint32_t TX_DATA; /**< Serial Data Transmit, Address offset: 0x00 */ + __IM uint32_t RX_DATA; /**< Serial Data Receive, Address offset: 0x04 */ + __IM uint32_t RESERVED0; /**< RESERVED, Address offset: 0x08 */ + __IOM uint32_t CTRL; /**< Control, Address offset: 0x0C */ + __IOM uint32_t AUX_CTRL; /**< Auxiliary Control, Address offset: 0x10 */ + __IM uint32_t STAT; /**< Status Control, Address offset: 0x14 */ + __IOM uint32_t SLAVE_SEL; /**< Slave Select, Address offset: 0x18 */ + __IOM uint32_t SLAVE_SEL_POL; /**< Slave Select Polarity, Address offset: 0x1C */ + __IOM uint32_t INTEN; /**< Interrupt Enable, Address offset: 0x20 */ + __IM uint32_t INTSTAT; /**< Interrupt Status, Address offset: 0x24 */ + __OM uint32_t INTCLR; /**< Interrupt Clear, Address offset: 0x28 */ + __IM uint32_t TX_FIFO_LVL; /**< TX FIFO Level, Address offset: 0x2C */ + __IM uint32_t RX_FIFO_LVL; /**< RX FIFO Level, Address offset: 0x30 */ + __IM uint32_t RESERVED1; /**< RESERVED, Address offset: 0x34 */ + __IOM uint32_t MSTR_IT_DELAY; /**< Master Inter-transfer Delay, Address offset: 0x38 */ + __IOM uint32_t SPIEN; /**< SPI Enable, Address offset: 0x3C */ + __IOM uint32_t SPI_GP_SET; /**< GPO Set / GPO State, Address offset: 0x40 */ + __IOM uint32_t SPI_GP_CLEAR; /**< GPO Clear / GPI State, Address offset: 0x44 */ + __IM uint32_t RX_DATA0_31; /**< 32-bit LSB word(0~31), Address offset: 0x48 */ + __IM uint32_t RX_DATA32_63; /**< 32-bit LSB word(32~63), Address offset: 0x4C */ + __IM uint32_t RX_DATA64_95; /**< 32-bit LSB word(64~95), Address offset: 0x50 */ + __IM uint32_t RX_DATA96_127; /**< 32-bit MSB word(96~127), Address offset: 0x54 */ + __OM uint32_t P_IV; /**< 32-BIT IV Key, Address offset: 0x58 */ + __IOM uint32_t FLASH_WRITE; /**< use for flash write, Address offset: 0x5C */ + __IOM uint32_t P_KEY_VALID_KPORT; /**< Status bit, Address offset: 0x60 */ + __IOM uint32_t P_RD_KEY_EN_KPORT; /**< Enable read key on keyport, Address offset: 0x64 */ + __IOM uint32_t P_KEY_ADDR; /**< Present key address, Address offset: 0x68 */ + __IOM uint32_t P_KEYPORT_MASK; /**< Present key mask, Address offset: 0x6C */ + __IOM uint32_t BYPASS; /**< Enable Bypass, Address offset: 0x70 */ +} QSPI_REGS; + +/* XQSPI/XIP Registers */ +typedef struct +{ + __IOM uint32_t CTRL0; /**< XIP Control 0 Register, Address offset: 0x00 */ + __IOM uint32_t CTRL1; /**< XIP Control 1 Register, Address offset: 0x04 */ + __IOM uint32_t CTRL2; /**< XIP Control 2 Register, Address offset: 0x08 */ + __IOM uint32_t CTRL3; /**< XIP Enable Request, Address offset: 0x0C */ + __IOM uint32_t STAT; /**< XIP Enable Output (Stat0), Address offset: 0x10 */ + __IM uint32_t INTEN; /**< Interrupt Enable (Intr0), Address offset: 0x14 */ + __IM uint32_t INTSTAT; /**< Interrupt Status (Intr1), Address offset: 0x18 */ + __IM uint32_t INTREQ; /**< Interrupt Status (Intr2), Address offset: 0x1C */ + __OM uint32_t INTSET; /**< Interrupt Set (Intr3), Address offset: 0x20 */ + __OM uint32_t INTCLR; /**< Interrupt Clear (Intr4), Address offset: 0x24 */ +} XIP_REGS; + +typedef struct _xqspi_regs +{ + CACHE_REGS CACHE; /**< CACHE Registers, Address offset: 0x000 */ + __IM uint32_t RESERVED0[249]; + QSPI_REGS QSPI; /**< QSPI Registers, Address offset: 0x400 */ + __IM uint32_t RESERVED1[483]; + XIP_REGS XIP; /**< XIP Registers, Address offset: 0xC00 */ +} xqspi_regs_t; + +/** + * @brief EFUSE + */ +typedef struct _efuse_regs +{ + __IOM uint32_t TPGM; /**< EFUSE_TPGM, Address offset: 0x000 */ + __IOM uint32_t PGENB; /**< EFUSE_PGENB, Address offset: 0x004 */ + __IM uint32_t TEST_MODE; /**< EFUSE_TEST_MODE, Address offset: 0x008 */ + __OM uint32_t OPERATION; /**< EFUSE_OPERATION, Address offset: 0x00C */ + __IM uint32_t STAT; /**< EFUSE_STATUS, Address offset: 0x010 */ + __IOM uint32_t KEY_MASK; /**< EFUSE_KEY_MASK, Address offset: 0x014 */ + __IOM uint32_t CRC_ADDR; /**< EFUSE_CRC_START_ADDR, Address offset: 0x018 */ + __IM uint32_t CRC_OUTPUT; /**< EFUSE_CRC_OUTPUT, Address offset: 0x01C */ + __IOM uint32_t TRIM_ADDR; /**< EFUSE_TRIM_ADDR, Address offset: 0x020 */ + __IOM uint32_t TRIM_LEN; /**< EFUSE_TRIM_LEN, Address offset: 0x024 */ + __IM uint32_t TRIM[14]; /**< EFUSE_TRIM, Address offset: 0x028 */ +} efuse_regs_t; + +/** + * @brief RNG + */ +typedef struct _rng_regs +{ + __IOM uint32_t CTRL; /**< RNG_CTRL, Address offset: 0x000 */ + __IOM uint32_t STATUS; /**< RNG_STATUS, Address offset: 0x004 */ + __IM uint32_t DATA; /**< RNG_DATA, Address offset: 0x008 */ + __IOM uint32_t RESERVED; /**< RESERVED, Address offset: 0x00C */ + __IM uint32_t LR_STATUS; /**< RNG_LR_STATUS, Address offset: 0x010 */ + __IOM uint32_t CONFIG; /**< RNG_CONFIG, Address offset: 0x014 */ + __IOM uint32_t TSCON; /**< RNG_TSCON, Address offset: 0x018 */ + __IOM uint32_t FROCFG; /**< RNG_FROCFG, Address offset: 0x01C */ + __OM uint32_t USER_SEED; /**< RNG_USER_SEED, Address offset: 0x020 */ + __IOM uint32_t LRCON; /**< RNG_LRCON, Address offset: 0x024 */ +} rng_regs_t; + +/** @} */ /* End of group Peripheral_registers_structures */ + + +/* ==================================== End of section using anonymous unions ==================================== */ +#if defined (__CC_ARM) + #pragma pop +#elif defined (__ICCARM__) + /* leave anonymous unions enabled */ +#elif (__ARMCC_VERSION >= 6010050) + #pragma clang diagnostic pop +#elif defined (__GNUC__) + /* anonymous unions are enabled by default */ +#elif defined (__TMS470__) + /* anonymous unions are enabled by default */ +#elif defined (__TASKING__) + #pragma warning restore +#elif defined (__CSMC__) + /* anonymous unions are enabled by default */ +#else + #warning Not supported compiler type +#endif + + +/* ================================================================================================================= */ +/* ================ Device Specific Peripheral Address Map ================ */ +/* ================================================================================================================= */ + +/** @addtogroup Peripheral_memory_map + * @{ + */ + +#define ROM_BASE ((uint32_t)0x00000000UL) +#define FLASH_BASE ((uint32_t)0x01000000UL) +#define SRAM_BASE ((uint32_t)0x30000000UL) +#define PERIPH_BASE ((uint32_t)0xA0000000UL) + +#define TIMER0_BASE (PERIPH_BASE + 0x00000000UL) +#define TIMER1_BASE (PERIPH_BASE + 0x00001000UL) +#define DUAL_TIMER0_BASE (PERIPH_BASE + 0x00002000UL) +#define DUAL_TIMER1_BASE (PERIPH_BASE + 0x00002020UL) +#define WDT_BASE (PERIPH_BASE + 0x00008000UL) +#define SPIM_BASE (PERIPH_BASE + 0x0000C000UL) +#define SPIS_BASE (PERIPH_BASE + 0x0000C100UL) +#define QSPI0_BASE (PERIPH_BASE + 0x0000C200UL) +#define I2C0_BASE (PERIPH_BASE + 0x0000C300UL) +#define I2C1_BASE (PERIPH_BASE + 0x0000C400UL) +#define AON_BASE (PERIPH_BASE + 0x0000C500UL) +#define UART0_BASE (PERIPH_BASE + 0x0000C600UL) +#define UART1_BASE (PERIPH_BASE + 0x0000C700UL) +#define QSPI1_BASE (PERIPH_BASE + 0x0000C800UL) +#define PWM0_BASE (PERIPH_BASE + 0x0000C900UL) +#define I2S_M_BASE (PERIPH_BASE + 0x0000CA00UL) +#define PWM1_BASE (PERIPH_BASE + 0x0000CC00UL) +#define XQSPI_BASE (PERIPH_BASE + 0x0000D000UL) +#define MCU_SUB_BASE (PERIPH_BASE + 0x0000E000UL) +#define I2S_S_BASE (PERIPH_BASE + 0x0000F000UL) +#define ISO7816_BASE (PERIPH_BASE + 0x0000F200UL) +#define GPIO0_BASE (PERIPH_BASE + 0x00010000UL) +#define GPIO1_BASE (PERIPH_BASE + 0x00011000UL) +#define GPIO2_BASE (PERIPH_BASE + 0x00012000UL) +#define DMA_BASE (PERIPH_BASE + 0x00013000UL) +#define PKC_BASE (PERIPH_BASE + 0x00014000UL) +#define AES_BASE (PERIPH_BASE + 0x00015400UL) +#define HMAC_BASE (PERIPH_BASE + 0x00015800UL) +#define EFUSE_BASE (PERIPH_BASE + 0x00016400UL) +#define RNG_BASE (PERIPH_BASE + 0x00017800UL) + +#define PKC_SPRAM_BASE (PKC_BASE + 0x00000800UL) +#define KRAM_BASE (PERIPH_BASE + 0x00017000UL) +#define EFUSE_STORAGE_BASE (PERIPH_BASE + 0x00016000UL) + +/** @} */ /* End of group Peripheral_memory_map */ + + +/* ================================================================================================================= */ +/* ================ Peripheral declaration ================ */ +/* ================================================================================================================= */ + +/** @addtogroup Peripheral_declaration + * @{ + */ + +#define TIMER0 ((timer_regs_t *)TIMER0_BASE) +#define TIMER1 ((timer_regs_t *)TIMER1_BASE) +#define DUAL_TIMER0 ((dual_timer_regs_t *)DUAL_TIMER0_BASE) +#define DUAL_TIMER1 ((dual_timer_regs_t *)DUAL_TIMER1_BASE) +#define WDT ((wdt_regs_t *)WDT_BASE) +#define SPIM ((ssi_regs_t *)SPIM_BASE) +#define SPIS ((ssi_regs_t *)SPIS_BASE) +#define QSPI0 ((ssi_regs_t *)QSPI0_BASE) +#define QSPI1 ((ssi_regs_t *)QSPI1_BASE) +#define I2C0 ((i2c_regs_t *)I2C0_BASE) +#define I2C1 ((i2c_regs_t *)I2C1_BASE) +#define AON ((aon_regs_t *)AON_BASE) +#define UART0 ((uart_regs_t *)UART0_BASE) +#define UART1 ((uart_regs_t *)UART1_BASE) +#define PWM0 ((pwm_regs_t *)PWM0_BASE) +#define PWM1 ((pwm_regs_t *)PWM1_BASE) +#define I2S_M ((i2s_regs_t *)I2S_M_BASE) +#define I2S_S ((i2s_regs_t *)I2S_S_BASE) +#define ISO7816 ((iso7816_regs_t *)ISO7816_BASE) +#define XQSPI ((xqspi_regs_t *)XQSPI_BASE) +#define MCU_SUB ((mcu_sub_regs_t *)MCU_SUB_BASE) +#define GPIO0 ((gpio_regs_t *)GPIO0_BASE) +#define GPIO1 ((gpio_regs_t *)GPIO1_BASE) +#define GPIO2 ((gpio_regs_t *)GPIO2_BASE) +#define DMA ((dma_regs_t *)DMA_BASE) +#define PKC ((pkc_regs_t *)PKC_BASE) +#define AES ((aes_regs_t *)AES_BASE) +#define HMAC ((hmac_regs_t *)HMAC_BASE) +#define EFUSE ((efuse_regs_t *)EFUSE_BASE) +#define RNG ((rng_regs_t *)RNG_BASE) +#define DMA0 DMA + +/** @} */ /* End of group Peripheral_declaration */ + +/** @addtogroup Peripheral_Registers_Bits_Definition + * @{ + */ + +/* ================================================================================================================= */ +/* ================ AES ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for AES_CTRL register *******************/ +#define AES_CTRL_ENABLE_Pos (0U) +#define AES_CTRL_ENABLE_Len (1U) +#define AES_CTRL_ENABLE_Msk (1U << AES_CTRL_ENABLE_Pos) +#define AES_CTRL_ENABLE AES_CTRL_ENABLE_Msk + +#define AES_CTRL_START_NORMAL_Pos (1U) +#define AES_CTRL_START_NORMAL_Len (1U) +#define AES_CTRL_START_NORMAL_Msk (1U << AES_CTRL_START_NORMAL_Pos) +#define AES_CTRL_START_NORMAL AES_CTRL_START_NORMAL_Msk + +#define AES_CTRL_START_DMA_Pos (2U) +#define AES_CTRL_START_DMA_Len (1U) +#define AES_CTRL_START_DMA_Msk (1U << AES_CTRL_START_DMA_Pos) +#define AES_CTRL_START_DMA AES_CTRL_START_DMA_Msk + +#define AES_CTRL_ENABLE_RKEY_Pos (3U) +#define AES_CTRL_ENABLE_RKEY_Len (1U) +#define AES_CTRL_ENABLE_RKEY_Msk (1U << AES_CTRL_ENABLE_RKEY_Pos) +#define AES_CTRL_ENABLE_RKEY AES_CTRL_ENABLE_RKEY_Msk + +/******************* Bit definition for AES_CONFIG register *******************/ +#define AES_CONFIG_KEYMODE_Pos (0U) +#define AES_CONFIG_KEYMODE_Len (2U) +#define AES_CONFIG_KEYMODE_Msk (3U << AES_CONFIG_KEYMODE_Pos) +#define AES_CONFIG_KEYMODE AES_CONFIG_KEYMODE_Msk + +#define AES_CONFIG_ENABLE_FULLMASK_Pos (3U) +#define AES_CONFIG_ENABLE_FULLMASK_Len (1U) +#define AES_CONFIG_ENABLE_FULLMASK_Msk (1U << AES_CONFIG_ENABLE_FULLMASK_Pos) +#define AES_CONFIG_ENABLE_FULLMASK AES_CONFIG_ENABLE_FULLMASK_Msk + +#define AES_CONFIG_ENABLE_ENCRYPTION_Pos (4U) +#define AES_CONFIG_ENABLE_ENCRYPTION_Len (1U) +#define AES_CONFIG_ENABLE_ENCRYPTION_Msk (1U << AES_CONFIG_ENABLE_ENCRYPTION_Pos) +#define AES_CONFIG_ENABLE_ENCRYPTION AES_CONFIG_ENABLE_ENCRYPTION_Msk + +#define AES_CONFIG_LOADSEED_Pos (5U) +#define AES_CONFIG_LOADSEED_Len (1U) +#define AES_CONFIG_LOADSEED_Msk (1U << AES_CONFIG_LOADSEED_Pos) +#define AES_CONFIG_LOADSEED AES_CONFIG_LOADSEED_Msk + +#define AES_CONFIG_FIRSTBLOCK_Pos (6U) +#define AES_CONFIG_FIRSTBLOCK_Len (1U) +#define AES_CONFIG_FIRSTBLOCK_Msk (1U << AES_CONFIG_FIRSTBLOCK_Pos) +#define AES_CONFIG_FIRSTBLOCK AES_CONFIG_FIRSTBLOCK_Msk + +#define AES_CONFIG_ENDIAN_Pos (7U) +#define AES_CONFIG_ENDIAN_Len (1U) +#define AES_CONFIG_ENDIAN_Msk (1U << AES_CONFIG_ENDIAN_Pos) +#define AES_CONFIG_ENDIAN AES_CONFIG_ENDIAN_Msk + +#define AES_CONFIG_OPMODE_Pos (8U) +#define AES_CONFIG_OPMODE_Len (3U) +#define AES_CONFIG_OPMODE_Msk (7U << AES_CONFIG_OPMODE_Pos) +#define AES_CONFIG_OPMODE AES_CONFIG_OPMODE_Msk + +#define AES_CONFIG_KEYTYPE_Pos (11U) +#define AES_CONFIG_KEYTYPE_Len (2U) +#define AES_CONFIG_KEYTYPE_Msk (3U << AES_CONFIG_KEYTYPE_Pos) +#define AES_CONFIG_KEYTYPE AES_CONFIG_KEYTYPE_Msk + +/******************* Bit definition for AES_STATUS register *******************/ +#define AES_STATUS_READY_Pos (0U) +#define AES_STATUS_READY_Len (1U) +#define AES_STATUS_READY_Msk (1U << AES_STATUS_READY_Pos) +#define AES_STATUS_READY AES_STATUS_READY_Msk + +#define AES_STATUS_TRANSDONE_Pos (1U) +#define AES_STATUS_TRANSDONE_Len (1U) +#define AES_STATUS_TRANSDONE_Msk (1U << AES_STATUS_TRANSDONE_Pos) +#define AES_STATUS_TRANSDONE AES_STATUS_TRANSDONE_Msk + +#define AES_STATUS_TRANSERR_Pos (2U) +#define AES_STATUS_TRANSERR_Len (1U) +#define AES_STATUS_TRANSERR_Msk (1U << AES_STATUS_TRANSERR_Pos) +#define AES_STATUS_TRANSERR AES_STATUS_TRANSERR_Msk + +#define AES_STATUS_KEYVALID_Pos (3U) +#define AES_STATUS_KEYVALID_Len (1U) +#define AES_STATUS_KEYVALID_Msk (1U << AES_STATUS_KEYVALID_Pos) +#define AES_STATUS_KEYVALID AES_STATUS_KEYVALID_Msk + +/******************* Bit definition for AES_INTERRUPT register *******************/ +#define AES_INTERRUPT_DONE_Pos (0U) +#define AES_INTERRUPT_DONE_Len (1U) +#define AES_INTERRUPT_DONE_Msk (1U << AES_INTERRUPT_DONE_Pos) +#define AES_INTERRUPT_DONE AES_INTERRUPT_DONE_Msk + +#define AES_INTERRUPT_ENABLE_Pos (1U) +#define AES_INTERRUPT_ENABLE_Len (1U) +#define AES_INTERRUPT_ENABLE_Msk (1U << AES_INTERRUPT_ENABLE_Pos) +#define AES_INTERRUPT_ENABLE AES_INTERRUPT_ENABLE_Msk + +/******************* Bit definition for AES_TRAN_SIZE register *******************/ +#define AES_TRAN_SIZE_Pos (0U) +#define AES_TRAN_SIZE_Len (15U) +#define AES_TRAN_SIZE_Msk (0x00007FFFU) +#define AES_TRAN_SIZE AES_TRAN_SIZE_Msk + +/******************* Bit definition for AES_RSTART_ADDR register *******************/ +#define AES_RSTART_ADDR_Pos (0U) +#define AES_RSTART_ADDR_Len (32U) +#define AES_RSTART_ADDR_Msk (0xFFFFFFFFU) +#define AES_RSTART_ADDR AES_RSTART_ADDR_Msk + +/******************* Bit definition for AES_WSTART_ADDR register *******************/ +#define AES_WSTART_ADDR_Pos (0U) +#define AES_WSTART_ADDR_Len (32U) +#define AES_WSTART_ADDR_Msk (0xFFFFFFFFU) +#define AES_WSTART_ADDR AES_WSTART_ADDR_Msk + +/******************* Bit definition for AES_KEY_ADDR register *******************/ +#define AES_KEY_ADDR_Pos (0U) +#define AES_KEY_ADDR_Len (32U) +#define AES_KEY_ADDR_Msk (0xFFFFFFFFU) +#define AES_KEY_ADDR AES_KEY_ADDR_Msk + +/******************* Bit definition for AES_DATA_OUT register *******************/ +#define AES_DATA_OUT_Pos (0U) +#define AES_DATA_OUT_Len (32U) +#define AES_DATA_OUT_Msk (0xFFFFFFFFU) +#define AES_DATA_OUT AES_DATA_OUT_Msk + +/******************* Bit definition for AES_KEY register *******************/ +#define AES_KEY_Pos (0U) +#define AES_KEY_Len (32U) +#define AES_KEY_Msk (0xFFFFFFFFU) +#define AES_KEY AES_KEY_Msk + +/******************* Bit definition for AES_SEED_IN register *******************/ +#define AES_SEED_IN_Pos (0U) +#define AES_SEED_IN_Len (32U) +#define AES_SEED_IN_Msk (0xFFFFFFFFU) +#define AES_SEED_IN AES_SEED_IN_Msk + +/******************* Bit definition for AES_SEED_OUT register *******************/ +#define AES_SEED_OUT_Pos (0U) +#define AES_SEED_OUT_Len (32U) +#define AES_SEED_OUT_Msk (0xFFFFFFFFU) +#define AES_SEED_OUT AES_SEED_OUT_Msk + +/******************* Bit definition for AES_SEED_IMASK register *******************/ +#define AES_SEED_IMASK_Pos (0U) +#define AES_SEED_IMASK_Len (32U) +#define AES_SEED_IMASK_Msk (0xFFFFFFFFU) +#define AES_SEED_IMASK AES_SEED_IMASK_Msk + +/******************* Bit definition for AES_SEED_OSBOX register *******************/ +#define AES_SEED_OSBOX_Pos (0U) +#define AES_SEED_OSBOX_Len (32U) +#define AES_SEED_OSBOX_Msk (0xFFFFFFFFU) +#define AES_SEED_OSBOX AES_SEED_OSBOX_Msk + +/******************* Bit definition for AES_VECTOR_INIT register *******************/ +#define AES_VECTOR_INIT_Pos (0U) +#define AES_VECTOR_INIT_Len (32U) +#define AES_VECTOR_INIT_Msk (0xFFFFFFFFU) +#define AES_VECTOR_INIT AES_VECTOR_INIT_Msk + +/******************* Bit definition for AES_DATA_IN register *******************/ +#define AES_DATA_IN_Pos (0U) +#define AES_DATA_IN_Len (32U) +#define AES_DATA_IN_Msk (0xFFFFFFFFU) +#define AES_DATA_IN AES_DATA_IN_Msk + + +/* ================================================================================================================= */ +/* ================ AON ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for AON_REG_PWR_RET01 register **********/ +#define AON_PWR_REG01_WAKE_UP_SEL_Pos (24U) +#define AON_PWR_REG01_WAKE_UP_SEL_Len (6U) +#define AON_PWR_REG01_WAKE_UP_SEL_Msk (0x3FU << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL AON_PWR_REG01_WAKE_UP_SEL_Msk +#define AON_PWR_REG01_WAKE_UP_SEL_TIMER (0x1U << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL_EXTWKUP (0x2U << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL_BLE (0x4U << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL_CALENDAR (0x8U << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL_PMU_BOD_FEDGE (0x10U << AON_PWR_REG01_WAKE_UP_SEL_Pos) +#define AON_PWR_REG01_WAKE_UP_SEL_MSIO_COMP (0x20U << AON_PWR_REG01_WAKE_UP_SEL_Pos) + +#define AON_PWR_REG01_SMC_WAKEUP_REQ_Pos (22U) +#define AON_PWR_REG01_SMC_WAKEUP_REQ_Len (1U) +#define AON_PWR_REG01_SMC_WAKEUP_REQ_Msk (0x1U << AON_PWR_REG01_SMC_WAKEUP_REQ_Pos) +#define AON_PWR_REG01_SMC_WAKEUP_REQ AON_PWR_REG01_SMC_WAKEUP_REQ_Msk + +#define AON_PWR_REG01_XF_TAG_RET_Pos (21U) +#define AON_PWR_REG01_XF_TAG_RET_Len (1U) +#define AON_PWR_REG01_XF_TAG_RET_Msk (0x1U << AON_PWR_REG01_XF_TAG_RET_Pos) +#define AON_PWR_REG01_XF_TAG_RET AON_PWR_REG01_XF_TAG_RET_Msk + +#define AON_PWR_REG01_XF_SCK_CLK_SEL_Pos (18U) +#define AON_PWR_REG01_XF_SCK_CLK_SEL_Len (3U) +#define AON_PWR_REG01_XF_SCK_CLK_SEL_Msk (0x7U << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos) +#define AON_PWR_REG01_XF_SCK_CLK_SEL AON_PWR_REG01_XF_SCK_CLK_SEL_Msk + +#define AON_PWR_REG01_SWD_ENABLE_Pos (17U) +#define AON_PWR_REG01_SWD_ENABLE_Len (1U) +#define AON_PWR_REG01_SWD_ENABLE_Msk (0x7U << AON_PWR_REG01_SWD_ENABLE_Pos) +#define AON_PWR_REG01_SWD_ENABLE AON_PWR_REG01_SWD_ENABLE_Msk + +#define AON_PWR_REG01_BM_REMAP_Pos (13U) +#define AON_PWR_REG01_BM_REMAP_Len (4U) +#define AON_PWR_REG01_BM_REMAP_Msk (0xFU << AON_PWR_REG01_BM_REMAP_Pos) +#define AON_PWR_REG01_BM_REMAP AON_PWR_REG01_BM_REMAP_Msk + +#define AON_PWR_REG01_COMM_CORE_RST_N_Pos (12U) +#define AON_PWR_REG01_COMM_CORE_RST_N_Len (1U) +#define AON_PWR_REG01_COMM_CORE_RST_N_Msk (0x1U << AON_PWR_REG01_COMM_CORE_RST_N_Pos) +#define AON_PWR_REG01_COMM_CORE_RST_N AON_PWR_REG01_COMM_CORE_RST_N_Msk + +#define AON_PWR_REG01_COMM_TIMER_RST_N_Pos (11U) +#define AON_PWR_REG01_COMM_TIMER_RST_N_Len (1U) +#define AON_PWR_REG01_COMM_TIMER_RST_N_Msk (0x1U << AON_PWR_REG01_COMM_TIMER_RST_N_Pos) +#define AON_PWR_REG01_COMM_TIMER_RST_N AON_PWR_REG01_COMM_TIMER_RST_N_Msk + +#define AON_PWR_REG01_ISO_EN_PD_COMM_TIMER_Pos (9U) +#define AON_PWR_REG01_ISO_EN_PD_COMM_TIMER_Len (1U) +#define AON_PWR_REG01_ISO_EN_PD_COMM_TIMER_Msk (0x1U << AON_PWR_REG01_ISO_EN_PD_COMM_TIMER_Pos) +#define AON_PWR_REG01_ISO_EN_PD_COMM_TIMER AON_PWR_REG01_ISO_EN_PD_COMM_TIMER_Msk + +#define AON_PWR_REG01_ISO_EN_PD_COMM_CORE_Pos (8U) +#define AON_PWR_REG01_ISO_EN_PD_COMM_CORE_Len (1U) +#define AON_PWR_REG01_ISO_EN_PD_COMM_CORE_Msk (0x1U << AON_PWR_REG01_ISO_EN_PD_COMM_CORE_Pos) +#define AON_PWR_REG01_ISO_EN_PD_COMM_CORE AON_PWR_REG01_ISO_EN_PD_COMM_CORE_Msk + +#define AON_PWR_REG01_PWR_EN_PD_COMM_TIMER_Pos (7U) +#define AON_PWR_REG01_PWR_EN_PD_COMM_TIMER_Len (1U) +#define AON_PWR_REG01_PWR_EN_PD_COMM_TIMER_Msk (0x1U << AON_PWR_REG01_PWR_EN_PD_COMM_TIMER_Pos) +#define AON_PWR_REG01_PWR_EN_PD_COMM_TIMER AON_PWR_REG01_PWR_EN_PD_COMM_TIMER_Msk + +#define AON_PWR_REG01_PWR_EN_PD_COMM_CORE_Pos (6U) +#define AON_PWR_REG01_PWR_EN_PD_COMM_CORE_Len (1U) +#define AON_PWR_REG01_PWR_EN_PD_COMM_CORE_Msk (0x1U << AON_PWR_REG01_PWR_EN_PD_COMM_CORE_Pos) +#define AON_PWR_REG01_PWR_EN_PD_COMM_CORE AON_PWR_REG01_PWR_EN_PD_COMM_CORE_Msk + +#define AON_PWR_REG01_EFLASH_PAD_EN_Pos (5U) +#define AON_PWR_REG01_EFLASH_PAD_EN_Len (1U) +#define AON_PWR_REG01_EFLASH_PAD_EN_Msk (0x1U << AON_PWR_REG01_EFLASH_PAD_EN_Pos) +#define AON_PWR_REG01_EFLASH_PAD_EN AON_PWR_REG01_EFLASH_PAD_EN_Msk + +#define AON_PWR_REG01_XO_2MHZ_ENA_Pos (4U) +#define AON_PWR_REG01_XO_2MHZ_ENA_Len (1U) +#define AON_PWR_REG01_XO_2MHZ_ENA_Msk (0x1U << AON_PWR_REG01_XO_2MHZ_ENA_Pos) +#define AON_PWR_REG01_XO_2MHZ_ENA AON_PWR_REG01_XO_2MHZ_ENA_Msk + +#define AON_PWR_REG01_XF_XO_DIV1_Pos (3U) +#define AON_PWR_REG01_XF_XO_DIV1_Len (1U) +#define AON_PWR_REG01_XF_XO_DIV1_Msk (0x1U << AON_PWR_REG01_XF_XO_DIV1_Pos) +#define AON_PWR_REG01_XF_XO_DIV1 AON_PWR_REG01_XF_XO_DIV1_Msk + +#define AON_PWR_REG01_SYS_CLK_SEL_Pos (0U) +#define AON_PWR_REG01_SYS_CLK_SEL_Len (3U) +#define AON_PWR_REG01_SYS_CLK_SEL_Msk (0x7U << AON_PWR_REG01_SYS_CLK_SEL_Pos) +#define AON_PWR_REG01_SYS_CLK_SEL AON_PWR_REG01_SYS_CLK_SEL_Msk + +/******************* Bit definition for AON_REG_SNSADC_CFG register **********/ +#define AON_SNSADC_CFG_SNSADC_REG4_Pos (24U) +#define AON_SNSADC_CFG_SNSADC_REG4_Len (8U) +#define AON_SNSADC_CFG_SNSADC_REG4_Msk (0xFFU << AON_SNSADC_CFG_SNSADC_REG4_Pos) +#define AON_SNSADC_CFG_SNSADC_REG4 AON_SNSADC_CFG_SNSADC_REG4_Msk +#define AON_SNSADC_CFG_MAS_RST_Pos (31U) +#define AON_SNSADC_CFG_MAS_RST_Msk (0x1U << AON_SNSADC_CFG_MAS_RST_Pos) +#define AON_SNSADC_CFG_EN_Pos (30U) +#define AON_SNSADC_CFG_EN_Msk (0x1U << AON_SNSADC_CFG_EN_Pos) +#define AON_SNSADC_CFG_REF_SEL_Pos (27U) +#define AON_SNSADC_CFG_REF_SEL_Msk (0x7U << AON_SNSADC_CFG_REF_SEL_Pos) +#define AON_SNSADC_CFG_REF_HP_Pos (24U) +#define AON_SNSADC_CFG_REF_HP_Msk (0x7U << AON_SNSADC_CFG_REF_HP_Pos) + +#define AON_SNSADC_CFG_SNSADC_REG3_Pos (16U) +#define AON_SNSADC_CFG_SNSADC_REG3_Len (8U) +#define AON_SNSADC_CFG_SNSADC_REG3_Msk (0xFFU << AON_SNSADC_CFG_SNSADC_REG3_Pos) +#define AON_SNSADC_CFG_SNSADC_REG3 AON_SNSADC_CFG_SNSADC_REG3_Msk +#define AON_SNSADC_CFG_CHN_P_Pos (19U) +#define AON_SNSADC_CFG_CHN_P_Msk (0x7U << AON_SNSADC_CFG_CHN_P_Pos) +#define AON_SNSADC_CFG_CHN_N_Pos (16U) +#define AON_SNSADC_CFG_CHN_N_Msk (0x7U << AON_SNSADC_CFG_CHN_N_Pos) + +#define AON_SNSADC_CFG_SNSADC_REG2_Pos (8U) +#define AON_SNSADC_CFG_SNSADC_REG2_Len (8U) +#define AON_SNSADC_CFG_SNSADC_REG2_Msk (0xFFU << AON_SNSADC_CFG_SNSADC_REG2_Pos) +#define AON_SNSADC_CFG_SNSADC_REG2 AON_SNSADC_CFG_SNSADC_REG2_Msk +#define AON_SNSADC_CFG_TEMP_EN_Pos (15U) +#define AON_SNSADC_CFG_TEMP_EN_Msk (0x1U << AON_SNSADC_CFG_TEMP_EN_Pos) +#define AON_SNSADC_CFG_VBAT_EN_Pos (14U) +#define AON_SNSADC_CFG_VBAT_EN_Msk (0x1U << AON_SNSADC_CFG_VBAT_EN_Pos) +#define AON_SNSADC_CFG_SINGLE_EN_Pos (13U) +#define AON_SNSADC_CFG_SINGLE_EN_Msk (0x1U << AON_SNSADC_CFG_SINGLE_EN_Pos) +#define AON_SNSADC_CFG_OFS_CAL_EN_Pos (12U) +#define AON_SNSADC_CFG_OFS_CAL_EN_Msk (0x1U << AON_SNSADC_CFG_OFS_CAL_EN_Pos) +#define AON_SNSADC_CFG_DYMAMIC_Pos (8U) +#define AON_SNSADC_CFG_DYMAMIC_Msk (0x7U << AON_SNSADC_CFG_DYMAMIC_Pos) + +#define AON_SNSADC_CFG_SNSADC_REG1_Pos (0U) +#define AON_SNSADC_CFG_SNSADC_REG1_Len (8U) +#define AON_SNSADC_CFG_SNSADC_REG1_Msk (0xFFU << AON_SNSADC_CFG_SNSADC_REG1_Pos) +#define AON_SNSADC_CFG_SNSADC_REG1 AON_SNSADC_CFG_SNSADC_REG1_Msk +#define AON_SNSADC_CFG_REF_VALUE_Pos (0U) +#define AON_SNSADC_CFG_REF_VALUE_Msk (0xFU << AON_SNSADC_CFG_REF_VALUE_Pos) + +/******************* Bit definition for AON_REG_RF_REG_0 register **********/ +#define AON_RF_REG_0_IO_LDO_REG1_Pos (24U) +#define AON_RF_REG_0_IO_LDO_REG1_Len (8U) +#define AON_RF_REG_0_IO_LDO_REG1_Msk (0xFFU << AON_RF_REG_0_IO_LDO_REG1_Pos) +#define AON_RF_REG_0_IO_LDO_REG1 AON_RF_REG_0_IO_LDO_REG1_Msk + +#define AON_RF_REG_0_LPD_REG2_Pos (16U) +#define AON_RF_REG_0_LPD_REG2_Len (8U) +#define AON_RF_REG_0_LPD_REG2_Msk (0xFFU << AON_RF_REG_0_LPD_REG2_Pos) +#define AON_RF_REG_0_LPD_REG2 AON_RF_REG_0_LPD_REG2_Msk + +#define AON_RF_REG_0_LPD_REG1_Pos (8U) +#define AON_RF_REG_0_LPD_REG1_Len (8U) +#define AON_RF_REG_0_LPD_REG1_Msk (0xFFU << AON_RF_REG_0_LPD_REG1_Pos) +#define AON_RF_REG_0_LPD_REG1 AON_RF_REG_0_LPD_REG1_Msk + +#define AON_RF_REG_0_RTC_REG1_Pos (0U) +#define AON_RF_REG_0_RTC_REG1_Len (8U) +#define AON_RF_REG_0_RTC_REG1_Msk (0xFFU << AON_RF_REG_0_RTC_REG1_Pos) +#define AON_RF_REG_0_RTC_REG1 AON_RF_REG_0_RTC_REG1_Msk + +#define AON_RF_REG_0_DYN_CLK_CTRL_Pos (16U) +#define AON_RF_REG_0_DYN_CLK_CTRL_Len (3U) +#define AON_RF_REG_0_DYN_CLK_CTRL_Msk (0x7U << AON_RF_REG_0_DYN_CLK_CTRL_Pos) +#define AON_RF_REG_0_DYN_CLK_CTRL AON_RF_REG_0_DYN_CLK_CTRL_Msk + +#define AON_RF_REG_0_BGAP_STATIC_EN_LV_Pos (19U) +#define AON_RF_REG_0_BGAP_STATIC_EN_LV_Len (1U) +#define AON_RF_REG_0_BGAP_STATIC_EN_LV_Msk (0x1U << AON_RF_REG_0_BGAP_STATIC_EN_LV_Pos) +#define AON_RF_REG_0_BGAP_STATIC_EN_LV_EN (0x1U << AON_RF_REG_0_BGAP_STATIC_EN_LV_Pos) +#define AON_RF_REG_0_BGAP_STATIC_EN_LV_DIS (0x0U << AON_RF_REG_0_BGAP_STATIC_EN_LV_Pos) + +#define AON_RF_REG_0_RCOSC_BIAS_CNTRL_Pos (22) +#define AON_RF_REG_0_RCOSC_BIAS_CNTRL_Len (2U) +#define AON_RF_REG_0_RCOSC_BIAS_CNTRL_Msk (0x03 << AON_RF_REG_0_RCOSC_BIAS_CNTRL_Pos) + + +#define AON_RF_REG_0_CTRL_TEMPCO_Pos (13U) +#define AON_RF_REG_0_CTRL_TEMPCO_Len (3U) +#define AON_RF_REG_0_CTRL_TEMPCO_Msk (0x7U << AON_RF_REG_0_CTRL_TEMPCO_Pos) +#define AON_RF_REG_0_CTRL_TEMPCO AON_RF_REG_0_CTRL_TEMPCO_Msk + +#define AON_RF_REG_0_CTRL_RET_Pos (11U) +#define AON_RF_REG_0_CTRL_RET_Len (2U) +#define AON_RF_REG_0_CTRL_RET_Msk (0x3U << AON_RF_REG_0_CTRL_RET_Pos) +#define AON_RF_REG_0_CTRL_RET AON_RF_REG_0_CTRL_RET_Msk + +#define AON_RF_REG_0_CTRL_BGAP_Pos (9U) +#define AON_RF_REG_0_CTRL_BGAP_Len (2U) +#define AON_RF_REG_0_CTRL_BGAP_Msk (0x3U << AON_RF_REG_0_CTRL_BGAP_Pos) +#define AON_RF_REG_0_CTRL_BGAP AON_RF_REG_0_CTRL_BGAP_Msk + +#define AON_RF_REG_0_BGAP_VOLTAGE_EN_Pos (8U) +#define AON_RF_REG_0_BGAP_VOLTAGE_EN_Len (1U) +#define AON_RF_REG_0_BGAP_VOLTAGE_ON (0x1U << AON_RF_REG_0_BGAP_VOLTAGE_EN_Pos) +#define AON_RF_REG_0_BGAP_VOLTAGE_OFF (0x0U << AON_RF_REG_0_BGAP_VOLTAGE_EN_Pos) + +#define AON_RF_REG_0_LPD_REG1_Pos (8U) +#define AON_RF_REG_0_LPD_REG1_Len (8U) +#define AON_RF_REG_0_LPD_REG1_Msk (0xFFU << AON_RF_REG_0_LPD_REG1_Pos) +#define AON_RF_REG_0_LPD_REG1 AON_RF_REG_0_LPD_REG1_Msk + +#define AON_RF_REG_0_RTC_REG1_Pos (0U) +#define AON_RF_REG_0_RTC_REG1_Len (8U) +#define AON_RF_REG_0_RTC_REG1_Msk (0xFFU << AON_RF_REG_0_RTC_REG1_Pos) +#define AON_RF_REG_0_RTC_REG1 AON_RF_REG_0_RTC_REG1_Msk + +/******************* Bit definition for AON_REG_RF_REG_1 register **********/ +#define AON_RF_REG_1_DCDC_REG4_Pos (24U) +#define AON_RF_REG_1_DCDC_REG4_Len (8U) +#define AON_RF_REG_1_DCDC_REG4_Msk (0xFFU << AON_RF_REG_1_DCDC_REG4_Pos) +#define AON_RF_REG_1_DCDC_REG4 AON_RF_REG_1_DCDC_REG4_Msk + +#define AON_RF_REG_1_DCDC_REG3_Pos (16U) +#define AON_RF_REG_1_DCDC_REG3_Len (8U) +#define AON_RF_REG_1_DCDC_REG3_Msk (0xFFU << AON_RF_REG_1_DCDC_REG3_Pos) +#define AON_RF_REG_1_DCDC_REG3 AON_RF_REG_1_DCDC_REG3_Msk + +#define AON_RF_REG_1_EN_INJ_Pos (14U) +#define AON_RF_REG_1_EN_INJ_Msk (0x1 << AON_RF_REG_1_EN_INJ_Pos) +#define AON_RF_REG_1_EN_INJ_ON (0x1 << AON_RF_REG_1_EN_INJ_Pos) +#define AON_RF_REG_1_EN_INJ_OFF (0x0 << AON_RF_REG_1_EN_INJ_Pos) + +#define AON_RF_REG_1_TON_Pos (11U) +#define AON_RF_REG_1_TON_Len (3U) +#define AON_RF_REG_1_TON_Msk (0x7U << AON_RF_REG_1_TON_Pos) +#define AON_RF_REG_1_TON AON_RF_REG_1_TON_Msk + +#define AON_RF_REG_1_DCDC_REG2_Pos (8U) +#define AON_RF_REG_1_DCDC_REG2_Len (8U) +#define AON_RF_REG_1_DCDC_REG2_Msk (0xFFU << AON_RF_REG_1_DCDC_REG2_Pos) +#define AON_RF_REG_1_DCDC_REG2 AON_RF_REG_1_DCDC_REG2_Msk + +#define AON_RF_REG_1_DCDC_REG1_Pos (0U) +#define AON_RF_REG_1_DCDC_REG1_Len (8U) +#define AON_RF_REG_1_DCDC_REG1_Msk (0xFFU << AON_RF_REG_1_DCDC_REG1_Pos) +#define AON_RF_REG_1_DCDC_REG1 AON_RF_REG_1_DCDC_REG1_Msk + +/******************* Bit definition for AON_REG_RF_REG_2 register **********/ +#define AON_RF_REG_2_TON_EN_Pos (17U) +#define AON_RF_REG_2_TON_EN_Msk (0x1U << AON_RF_REG_2_TON_EN_Pos) +#define AON_RF_REG_2_TON_EN_ON (0x1 << AON_RF_REG_2_TON_EN_Pos) +#define AON_RF_REG_2_TON_EN_OFF (0x0 << AON_RF_REG_2_TON_EN_Pos) + +#define AON_RF_REG_2_GP_REG2_Pos (16U) +#define AON_RF_REG_2_GP_REG2_Len (8U) +#define AON_RF_REG_2_GP_REG2_Msk (0xFFU << AON_RF_REG_2_GP_REG2_Pos) +#define AON_RF_REG_2_GP_REG2 AON_RF_REG_2_GP_REG2_Msk + +#define AON_RF_REG_2_GP_REG1_Pos (8U) +#define AON_RF_REG_2_GP_REG1_Len (8U) +#define AON_RF_REG_2_GP_REG1_Msk (0xFFU << AON_RF_REG_2_GP_REG1_Pos) +#define AON_RF_REG_2_GP_REG1 AON_RF_REG_2_GP_REG1_Msk +#define AON_RF_REG_2_EFUSE_VDD_EN (0x4U << AON_RF_REG_2_GP_REG1_Pos) + +#define AON_RF_REG_2_MUX1_REG1_Pos (0U) +#define AON_RF_REG_2_MUX1_REG1_Len (8U) +#define AON_RF_REG_2_MUX1_REG1_Msk (0xFFU << AON_RF_REG_2_MUX1_REG1_Pos) +#define AON_RF_REG_2_MUX1_REG1 AON_RF_REG_2_MUX1_REG1_Msk + +/******************* Bit definition for AON_REG_CALENDAR_TIMER_CTL register **********/ +#define AON_CALENDAR_TIMER_CTL_WRAP_INT_EN_Pos (13U) +#define AON_CALENDAR_TIMER_CTL_WRAP_INT_EN_Len (1U) +#define AON_CALENDAR_TIMER_CTL_WRAP_INT_EN_Msk (0x1U << AON_CALENDAR_TIMER_CTL_WRAP_INT_EN_Pos) +#define AON_CALENDAR_TIMER_CTL_WRAP_INT_EN AON_CALENDAR_TIMER_CTL_WRAP_INT_EN_Msk + +#define AON_CALENDAR_TIMER_CTL_ALARM_INT_EN_Pos (12U) +#define AON_CALENDAR_TIMER_CTL_ALARM_INT_EN_Len (1U) +#define AON_CALENDAR_TIMER_CTL_ALARM_INT_EN_Msk (0x1U << AON_CALENDAR_TIMER_CTL_ALARM_INT_EN_Pos) +#define AON_CALENDAR_TIMER_CTL_ALARM_INT_EN AON_CALENDAR_TIMER_CTL_ALARM_INT_EN_Msk + +#define AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos (8U) +#define AON_CALENDAR_TIMER_CTL_CLK_SEL_Len (3U) +#define AON_CALENDAR_TIMER_CTL_CLK_SEL_Msk (0x7U << AON_CALENDAR_TIMER_CTL_CLK_SEL_Pos) +#define AON_CALENDAR_TIMER_CTL_CLK_SEL AON_CALENDAR_TIMER_CTL_CLK_SEL_Msk + +#define AON_CALENDAR_TIMER_CTL_WRAP_CNT_Pos (4U) +#define AON_CALENDAR_TIMER_CTL_WRAP_CNT_Len (4U) +#define AON_CALENDAR_TIMER_CTL_WRAP_CNT_Msk (0xFU << AON_CALENDAR_TIMER_CTL_WRAP_CNT_Pos) +#define AON_CALENDAR_TIMER_CTL_WRAP_CNT AON_CALENDAR_TIMER_CTL_WRAP_CNT_Msk + +#define AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD_Pos (2U) +#define AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD_Len (1U) +#define AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD_Msk (0x1U << AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD_Pos) +#define AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD AON_CALENDAR_TIMER_CTL_ALARM_VAL_LOAD_Msk + +#define AON_CALENDAR_TIMER_CTL_VAL_LOAD_Pos (1U) +#define AON_CALENDAR_TIMER_CTL_VAL_LOAD_Len (1U) +#define AON_CALENDAR_TIMER_CTL_VAL_LOAD_Msk (0x1U << AON_CALENDAR_TIMER_CTL_VAL_LOAD_Pos) +#define AON_CALENDAR_TIMER_CTL_VAL_LOAD AON_CALENDAR_TIMER_CTL_VAL_LOAD_Msk + +#define AON_CALENDAR_TIMER_CTL_EN_Pos (0U) +#define AON_CALENDAR_TIMER_CTL_EN_Len (1U) +#define AON_CALENDAR_TIMER_CTL_EN_Msk (0x1U << AON_CALENDAR_TIMER_CTL_EN_Pos) +#define AON_CALENDAR_TIMER_CTL_EN AON_CALENDAR_TIMER_CTL_EN_Msk + +/******************* Bit definition for AON_REG_MEM_STD_OVR register **********/ +#define AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N_Pos (30U) +#define AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N_Len (1U) +#define AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N_Msk (0x1U << AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N_Pos) +#define AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N AON_MEM_STD_OVR_MCU_KEYRAM_STDBY_N_Msk + +#define AON_MEM_STD_OVR_PMEM_STDBY_N_Pos (29U) +#define AON_MEM_STD_OVR_PMEM_STDBY_N_Len (1U) +#define AON_MEM_STD_OVR_PMEM_STDBY_N_Msk (0x1U << AON_MEM_STD_OVR_PMEM_STDBY_N_Pos) +#define AON_MEM_STD_OVR_PMEM_STDBY_N AON_MEM_STD_OVR_PMEM_STDBY_N_Msk + +#define AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N_Pos (28U) +#define AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N_Len (1U) +#define AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N_Msk (1U << AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N_Pos) +#define AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N AON_MEM_STD_OVR_MCU_ICACHE_STDBY_N_Msk + +#define AON_MEM_STD_OVR_MCU_HTM_STDBY_N_Pos (27U) +#define AON_MEM_STD_OVR_MCU_HTM_STDBY_N_Len (1U) +#define AON_MEM_STD_OVR_MCU_HTM_STDBY_N_Msk (1U << AON_MEM_STD_OVR_MCU_HTM_STDBY_N_Pos) +#define AON_MEM_STD_OVR_MCU_HTM_STDBY_N AON_MEM_STD_OVR_MCU_HTM_STDBY_N_Msk + +#define AON_MEM_STD_OVR_MCU_MEM_STDBY_N_Pos (16U) +#define AON_MEM_STD_OVR_MCU_MEM_STDBY_N_Len (11U) +#define AON_MEM_STD_OVR_MCU_MEM_STDBY_N_Msk (0x7FFU << AON_MEM_STD_OVR_MCU_MEM_STDBY_N_Pos) +#define AON_MEM_STD_OVR_MCU_MEM_STDBY_N AON_MEM_STD_OVR_MCU_MEM_STDBY_N_Msk + +#define AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N_Pos (14U) +#define AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N_Len (1U) +#define AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N_Msk (0x1U << AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N_Pos) +#define AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N AON_MEM_STD_OVR_KEYRAM_ISO_VDD_N_Msk + +#define AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N_Pos (13U) +#define AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N_Len (1U) +#define AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N_Msk (0x1U << AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N_Pos) +#define AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N AON_MEM_STD_OVR_EF_CACHE_ISO_VDD_N_Msk + +#define AON_MEM_STD_OVR_HTABLE_ISO_VDD_N_Pos (12U) +#define AON_MEM_STD_OVR_HTABLE_ISO_VDD_N_Len (1U) +#define AON_MEM_STD_OVR_HTABLE_ISO_VDD_N_Msk (0x1U << AON_MEM_STD_OVR_HTABLE_ISO_VDD_N_Pos) +#define AON_MEM_STD_OVR_HTABLE_ISO_VDD_N AON_MEM_STD_OVR_HTABLE_ISO_VDD_N_Msk + +#define AON_MEM_STD_OVR_PMEM_ISO_VDD_N_Pos (11U) +#define AON_MEM_STD_OVR_PMEM_ISO_VDD_N_Len (1U) +#define AON_MEM_STD_OVR_PMEM_ISO_VDD_N_Msk (0x1U << AON_MEM_STD_OVR_PMEM_ISO_VDD_N_Pos) +#define AON_MEM_STD_OVR_PMEM_ISO_VDD_N AON_MEM_STD_OVR_PMEM_ISO_VDD_N_Msk + +#define AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N_Pos (0U) +#define AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N_Len (11U) +#define AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N_Msk (0x7FF << AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N_Pos) +#define AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N AON_MEM_STD_OVR_MCU_MEM_ISO_VDD_N_Msk + +/******************* Bit definition for AON_REG_RF_REG_3 register **********/ +#define AON_RF_REG_3_IO_LDO_REG2_Pos (24U) +#define AON_RF_REG_3_IO_LDO_REG2_Len (8U) +#define AON_RF_REG_3_IO_LDO_REG2_Msk (0xFFU << AON_RF_REG_3_IO_LDO_REG2_Pos) +#define AON_RF_REG_3_IO_LDO_REG2 AON_RF_REG_3_IO_LDO_REG2_Msk + +#define AON_RF_REG_3_LDO_5V_REG1_Pos (8U) +#define AON_RF_REG_3_LDO_5V_REG1_Len (8U) +#define AON_RF_REG_3_LDO_5V_REG1_Msk (0xFFU << AON_RF_REG_3_LDO_5V_REG1_Pos) +#define AON_RF_REG_3_LDO_5V_REG1 AON_RF_REG_3_LDO_5V_REG1_Msk + +#define AON_RF_REG_3_RTC_EN_Pos (7U) +#define AON_RF_REG_3_RTC_EN_Len (1U) +#define AON_RF_REG_3_RTC_EN_Msk (0x1U << AON_RF_REG_3_RTC_EN_Pos) +#define AON_RF_REG_3_RTC_EN AON_RF_REG_3_RTC_EN_Msk +#define AON_RF_REG_3_RTC_DIS (0x0U << AON_RF_REG_3_RTC_EN_Pos) + +#define AON_RF_REG_3_BOD_STATIC_LV_Pos (5U) +#define AON_RF_REG_3_BOD_STATIC_LV_Len (1U) +#define AON_RF_REG_3_BOD_STATIC_LV_Msk (0x1U << AON_RF_REG_3_BOD_STATIC_LV_Pos) +#define AON_RF_REG_3_BOD_STATIC_LV_EN (0x1U << AON_RF_REG_3_BOD_STATIC_LV_Pos) +#define AON_RF_REG_3_BOD_STATIC_LV_DIS (0x0U << AON_RF_REG_3_BOD_STATIC_LV_Pos) +#define AON_RF_REG_3_BOD_LVL_CTRL_LV_Pos (2U) +#define AON_RF_REG_3_BOD_LVL_CTRL_LV_Len (3U) +#define AON_RF_REG_3_BOD_LVL_CTRL_LV_Msk (0x7U << AON_RF_REG_3_BOD_LVL_CTRL_LV_Pos) +#define AON_RF_REG_3_BOD_LVL_CTRL_LV AON_RF_REG_3_BOD_LVL_CTRL_LV_Msk +#define AON_RF_REG_3_BOD2_EN_Pos (1U) +#define AON_RF_REG_3_BOD2_EN_Len (1U) +#define AON_RF_REG_3_BOD2_EN_Msk (0x1U << AON_RF_REG_3_BOD2_EN_Pos) +#define AON_RF_REG_3_BOD2_EN (0x1U << AON_RF_REG_3_BOD2_EN_Pos) +#define AON_RF_REG_3_BOD2_DIS (0x0U << AON_RF_REG_3_BOD2_EN_Pos) + +#define AON_RF_REG_3_BOD_EN_Pos (0U) +#define AON_RF_REG_3_BOD_EN_Len (1U) +#define AON_RF_REG_3_BOD_EN_Msk (0x1U << AON_RF_REG_3_BOD_EN_Pos) +#define AON_RF_REG_3_BOD_EN (0x1U << AON_RF_REG_3_BOD_EN_Pos) +#define AON_RF_REG_3_BOD_DIS (0x0U << AON_RF_REG_3_BOD_EN_Pos) + +#define AON_RF_REG_3_BOD_REG1_Pos (0U) +#define AON_RF_REG_3_BOD_REG1_Len (8U) +#define AON_RF_REG_3_BOD_REG1_Msk (0xFFU << AON_RF_REG_3_BOD_REG1_Pos) +#define AON_RF_REG_3_BOD_REG1 AON_RF_REG_3_BOD_REG1_Msk + +/******************* Bit definition for AON_REG_RF_REG_4 register **********/ +#define AON_RF_REG_4_DIG_LDO_REG1_Pos (16U) +#define AON_RF_REG_4_DIG_LDO_REG1_Len (8U) +#define AON_RF_REG_4_DIG_LDO_REG1_Msk (0xFFU << AON_RF_REG_4_DIG_LDO_REG1_Pos) +#define AON_RF_REG_4_DIG_LDO_REG1 AON_RF_REG_4_DIG_LDO_REG1_Msk + +#define AON_RF_REG_4_CLK_PERIOD_Pos (12U) +#define AON_RF_REG_4_CLK_PERIOD_Len (4U) +#define AON_RF_REG_4_CLK_PERIOD_Msk (0xF << AON_RF_REG_4_CLK_PERIOD_Pos) +#define AON_RF_REG_4_CLK_PERIOD AON_RF_REG_4_CLK_PERIOD_Msk + +#define AON_RF_REG_4_DCDC_REG6_Pos (8U) +#define AON_RF_REG_4_DCDC_REG6_Len (8U) +#define AON_RF_REG_4_DCDC_REG6_Msk (0xFFU << AON_RF_REG_4_DCDC_REG6_Pos) +#define AON_RF_REG_4_DCDC_REG6 AON_RF_REG_4_DCDC_REG6_Msk + +#define AON_RF_REG_4_DCDC_REG5_Pos (0U) +#define AON_RF_REG_4_DCDC_REG5_Len (8U) +#define AON_RF_REG_4_DCDC_REG5_Msk (0xFFU << AON_RF_REG_4_DCDC_REG5_Pos) +#define AON_RF_REG_4_DCDC_REG5 AON_RF_REG_4_DCDC_REG5_Msk + +/******************* Bit definition for AON_REG_RF_REG_5 register **********/ +#define AON_RF_REG_5_MUX_REG2_Pos (24U) +#define AON_RF_REG_5_MUX_REG2_Len (8U) +#define AON_RF_REG_5_MUX_REG2_Msk (0xFFU << AON_RF_REG_5_MUX_REG2_Pos) +#define AON_RF_REG_5_MUX_REG2 AON_RF_REG_5_MUX_REG2_Msk + +#define AON_RF_REG_5_MUX_REG1_Pos (16U) +#define AON_RF_REG_5_MUX_REG1_Len (8U) +#define AON_RF_REG_5_MUX_REG1_Msk (0xFFU << AON_RF_REG_5_MUX_REG1_Pos) +#define AON_RF_REG_5_MUX_REG1 AON_RF_REG_5_MUX_REG1_Msk + +#define AON_RF_REG_5_LPD_REG3_Pos (0U) +#define AON_RF_REG_5_LPD_REG3_Len (8U) +#define AON_RF_REG_5_LPD_REG3_Msk (0xFFU << AON_RF_REG_5_LPD_REG3_Pos) +#define AON_RF_REG_5_LPD_REG3 AON_RF_REG_5_LPD_REG3_Msk + +#define AON_RF_REG_5_RCOSC_EN_Pos (7) +#define AON_RF_REG_5_RCOSC_EN_Len (1U) +#define AON_RF_REG_5_RCOSC_EN_Msk (0x01 << AON_RF_REG_5_RCOSC_EN_Pos) +#define AON_RF_REG_5_RCOSC_EN (AON_RF_REG_5_RCOSC_EN_Msk) + +#define AON_RF_REG_5_RCOSC_DELAY_EN_Pos (6) +#define AON_RF_REG_5_RCOSC_DELAY_EN_Len (1U) +#define AON_RF_REG_5_RCOSC_DELAY_EN_Msk (0x01 << AON_RF_REG_5_RCOSC_DELAY_EN_Pos) +#define AON_RF_REG_5_RCOSC_DELAY_EN (0x01 << AON_RF_REG_5_RCOSC_DELAY_EN_Pos) + +#define AON_RF_REG_5_RCOSC_RDIV_DELAY_Pos (3) +#define AON_RF_REG_5_RCOSC_RDIV_DELAY_Len (3U) +#define AON_RF_REG_5_RCOSC_RDIV_DELAY_Msk (0x07 << AON_RF_REG_5_RCOSC_RDIV_DELAY_Pos) +#define AON_RF_REG_5_RCOSC_RDIV_DELAY (AON_RF_REG_5_RCOSC_RDIV_DELAY_Msk) + +#define AON_RF_REG_5_RCOSC_RESN_CNTRL_Pos (0) +#define AON_RF_REG_5_RCOSC_RESN_CNTRL_Len (3U) +#define AON_RF_REG_5_RCOSC_RESN_CNTRL_Msk (0x07 << AON_RF_REG_5_RCOSC_RESN_CNTRL_Pos) +#define AON_RF_REG_5_RCOSC_RESN_CNTRL (AON_RF_REG_5_RCOSC_RESN_CNTRL_Msk) + +/******************* Bit definition for AON_REG_RF_REG_6 register **********/ +#define AON_RF_REG_6_CPLL_REG1_Pos (0U) +#define AON_RF_REG_6_CPLL_REG1_Len (32U) +#define AON_RF_REG_6_CPLL_REG1_Msk (0xFFFFFFFFU) +#define AON_RF_REG_6_CPLL_REG1 AON_RF_REG_6_CPLL_REG1_Msk + +/******************* Bit definition for AON_REG_RF_REG_7 register **********/ +#define AON_RF_REG_7_CPLL_REG2_Pos (0U) +#define AON_RF_REG_7_CPLL_REG2_Len (32U) +#define AON_RF_REG_7_CPLL_REG2_Msk (0xFFFFFFFFU) +#define AON_RF_REG_7_CPLL_REG2 AON_RF_REG_7_CPLL_REG2_Msk + +/******************* Bit definition for AON_REG_RF_REG_8 register **********/ +#define AON_RF_REG_8_XO_REG1_Pos (0U) +#define AON_RF_REG_8_XO_REG1_Len (32U) +#define AON_RF_REG_8_XO_REG1_Msk (0xFFFFFFFFU) +#define AON_RF_REG_8_XO_REG1 AON_RF_REG_8_XO_REG1_Msk + +/******************* Bit definition for AON_REG_RF_REG_9 register **********/ +#define AON_RF_REG_9_XO_REG2_Pos (0U) +#define AON_RF_REG_9_XO_REG2_Len (32U) +#define AON_RF_REG_9_XO_REG2_Msk (0xFFFFFFFFU) +#define AON_RF_REG_9_XO_REG2 AON_RF_REG_9_XO_REG2_Msk + +/******************* Bit definition for AON_REG_MSIO_PAD_CFG_0 register **********/ +#define AON_MSIO_PAD_CFG_0_OE_N_Pos (24U) +#define AON_MSIO_PAD_CFG_0_OE_N_Len (5U) +#define AON_MSIO_PAD_CFG_0_OE_N_Msk (0x1FU << AON_MSIO_PAD_CFG_0_OE_N_Pos) +#define AON_MSIO_PAD_CFG_0_OE_N AON_MSIO_PAD_CFG_0_OE_N_Msk + +#define AON_MSIO_PAD_CFG_0_IE_N_Pos (16U) +#define AON_MSIO_PAD_CFG_0_IE_N_Len (5U) +#define AON_MSIO_PAD_CFG_0_IE_N_Msk (0x1FU << AON_MSIO_PAD_CFG_0_IE_N_Pos) +#define AON_MSIO_PAD_CFG_0_IE_N AON_MSIO_PAD_CFG_0_IE_N_Msk + +#define AON_MSIO_PAD_CFG_0_IN_Pos (8U) +#define AON_MSIO_PAD_CFG_0_IN_Len (5U) +#define AON_MSIO_PAD_CFG_0_IN_Msk (0x1FU << AON_MSIO_PAD_CFG_0_IN_Pos) +#define AON_MSIO_PAD_CFG_0_IN AON_MSIO_PAD_CFG_0_IN_Msk + +#define AON_MSIO_PAD_CFG_0_RE_N_Pos (0U) +#define AON_MSIO_PAD_CFG_0_RE_N_Len (5U) +#define AON_MSIO_PAD_CFG_0_RE_N_Msk (0x1FU << AON_MSIO_PAD_CFG_0_RE_N_Pos) +#define AON_MSIO_PAD_CFG_0_RE_N AON_MSIO_PAD_CFG_0_RE_N_Msk + +/******************* Bit definition for AON_REG_MSIO_PAD_CFG_1 register **********/ +#define AON_MSIO_PAD_CFG_1_ADC_CLK_EN_Pos (31U) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_EN_Len (1U) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_EN_Msk (0x1U << AON_MSIO_PAD_CFG_1_ADC_CLK_EN_Pos) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_EN AON_MSIO_PAD_CFG_1_ADC_CLK_EN_Msk + +#define AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos (28U) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Len (3U) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Msk (0x7U << AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Pos) +#define AON_MSIO_PAD_CFG_1_ADC_CLK_SEL AON_MSIO_PAD_CFG_1_ADC_CLK_SEL_Msk + +#define AON_MSIO_PAD_CFG_1_MCU_OVR_Pos (22U) +#define AON_MSIO_PAD_CFG_1_MCU_OVR_Len (5U) +#define AON_MSIO_PAD_CFG_1_MCU_OVR_Msk (0x1FU << AON_MSIO_PAD_CFG_1_MCU_OVR_Pos) +#define AON_MSIO_PAD_CFG_1_MCU_OVR AON_MSIO_PAD_CFG_1_MCU_OVR_Msk + +#define AON_COMM_DEEPSLCNTL_EXTWKUPDSB_Pos (21U) +#define AON_COMM_DEEPSLCNTL_EXTWKUPDSB_Len (1U) +#define AON_COMM_DEEPSLCNTL_EXTWKUPDSB_Msk (0x1U << AON_COMM_DEEPSLCNTL_EXTWKUPDSB_Pos) +#define AON_COMM_DEEPSLCNTL_EXTWKUPDSB AON_COMM_DEEPSLCNTL_EXTWKUPDSB_Msk + +#define AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ_Pos (20U) +#define AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ_Len (1U) +#define AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ_Msk (0x1U << AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ_Pos) +#define AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ AON_COMM_DEEPSLCNTL_SOFT_WAKEUP_REQ_Msk + +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON_Pos (18U) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON_Len (1U) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON_Msk (0x1U << AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON_Pos) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON AON_COMM_DEEPSLCNTL_DEEP_SLEEP_ON_Msk + +#define AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN_Pos (17U) +#define AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN_Len (1U) +#define AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN_Msk (0x1U << AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN_Pos) +#define AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN AON_COMM_DEEPSLCNTL_RADIO_SLEEP_EN_Msk + +#define AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN_Pos (16U) +#define AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN_Len (1U) +#define AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN_Msk (0x1U << AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN_Pos) +#define AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN AON_COMM_DEEPSLCNTL_OSC_SLEEP_EN_Msk + +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT_Pos (15U) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT_Len (1U) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT_Msk (0x1U << AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT_Pos) +#define AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT AON_COMM_DEEPSLCNTL_DEEP_SLEEP_STAT_Msk + +#define AON_MSIO_PAD_CFG_1_RTYPE_Pos (8U) +#define AON_MSIO_PAD_CFG_1_RTYPE_Len (5U) +#define AON_MSIO_PAD_CFG_1_RTYPE_Msk (0x1FU << AON_MSIO_PAD_CFG_1_RTYPE_Pos) +#define AON_MSIO_PAD_CFG_1_RTYPE AON_MSIO_PAD_CFG_1_RTYPE_Msk + +#define AON_MSIO_PAD_CFG_1_AE_N_Pos (0U) +#define AON_MSIO_PAD_CFG_1_AE_N_Len (5U) +#define AON_MSIO_PAD_CFG_1_AE_N_Msk (0x1FU << AON_MSIO_PAD_CFG_1_AE_N_Pos) +#define AON_MSIO_PAD_CFG_1_AE_N AON_MSIO_PAD_CFG_1_AE_N_Msk + +/******************* Bit definition for AON_REG_SLP_EVENT register **********/ +#define AON_SLP_EVENT_SLP_TIMER_MODE_Pos (30U) +#define AON_SLP_EVENT_SLP_TIMER_MODE_Len (2U) +#define AON_SLP_EVENT_SLP_TIMER_MODE_Msk (0x3U << AON_SLP_EVENT_SLP_TIMER_MODE_Pos) +#define AON_SLP_EVENT_SLP_TIMER_MODE AON_SLP_EVENT_SLP_TIMER_MODE_Msk +#define AON_SLP_EVENT_SLP_TIMER_MODE_NORMAL (0x0U << AON_SLP_EVENT_SLP_TIMER_MODE_Pos) +#define AON_SLP_EVENT_SLP_TIMER_MODE_SINGLE (0x1U << AON_SLP_EVENT_SLP_TIMER_MODE_Pos) +#define AON_SLP_EVENT_SLP_TIMER_MODE_RELOAD (0x2U << AON_SLP_EVENT_SLP_TIMER_MODE_Pos) +#define AON_SLP_EVENT_SLP_TIMER_MODE_DISABLE (0x3U << AON_SLP_EVENT_SLP_TIMER_MODE_Pos) + +#define AON_SLP_EVENT_EXT_WKUP_STATUS_Pos (16U) +#define AON_SLP_EVENT_EXT_WKUP_STATUS_Len (8U) +#define AON_SLP_EVENT_EXT_WKUP_STATUS_Msk (0xFFU << AON_SLP_EVENT_EXT_WKUP_STATUS_Pos) +#define AON_SLP_EVENT_EXT_WKUP_STATUS AON_SLP_EVENT_EXT_WKUP_STATUS_Msk + +#define AON_SLP_EVENT_CALENDAR_TIMER_WRAP_Pos (9U) +#define AON_SLP_EVENT_CALENDAR_TIMER_WRAP_Len (1U) +#define AON_SLP_EVENT_CALENDAR_TIMER_WRAP_Msk (0x1U << AON_SLP_EVENT_CALENDAR_TIMER_WRAP_Pos) +#define AON_SLP_EVENT_CALENDAR_TIMER_WRAP AON_SLP_EVENT_CALENDAR_TIMER_WRAP_Msk + +#define AON_SLP_EVENT_CALENDAR_TIMER_ALARM_Pos (8U) +#define AON_SLP_EVENT_CALENDAR_TIMER_ALARM_Len (1U) +#define AON_SLP_EVENT_CALENDAR_TIMER_ALARM_Msk (0x1U << AON_SLP_EVENT_CALENDAR_TIMER_ALARM_Pos) +#define AON_SLP_EVENT_CALENDAR_TIMER_ALARM AON_SLP_EVENT_CALENDAR_TIMER_ALARM_Msk + +#define AON_SLP_EVENT_WDT_REBOOT_Pos (6U) +#define AON_SLP_EVENT_WDT_REBOOT_Len (1U) +#define AON_SLP_EVENT_WDT_REBOOT_Msk (0x1U << AON_SLP_EVENT_WDT_REBOOT_Pos) +#define AON_SLP_EVENT_WDT_REBOOT AON_SLP_EVENT_WDT_REBOOT_Msk + +#define AON_SLP_EVENT_PMU_MSIO_COMP_Pos (4U) +#define AON_SLP_EVENT_PMU_MSIO_COMP_Len (1U) +#define AON_SLP_EVENT_PMU_MSIO_COMP_Msk (0x1U << AON_SLP_EVENT_PMU_MSIO_COMP_Pos) +#define AON_SLP_EVENT_PMU_MSIO_COMP AON_SLP_EVENT_PMU_MSIO_COMP_Msk + +#define AON_SLP_EVENT_PMU_BOD_FEDGE_Pos (3U) +#define AON_SLP_EVENT_PMU_BOD_FEDGE_Len (1U) +#define AON_SLP_EVENT_PMU_BOD_FEDGE_Msk (0x1U << AON_SLP_EVENT_PMU_BOD_FEDGE_Pos) +#define AON_SLP_EVENT_PMU_BOD_FEDGE AON_SLP_EVENT_PMU_BOD_FEDGE_Msk + +#define AON_SLP_EVENT_EXTWKUP_Pos (2U) +#define AON_SLP_EVENT_EXTWKUP_Len (1U) +#define AON_SLP_EVENT_EXTWKUP_Msk (0x1U << AON_SLP_EVENT_EXTWKUP_Pos) +#define AON_SLP_EVENT_EXTWKUP AON_SLP_EVENT_EXTWKUP_Msk + +#define AON_SLP_EVENT_TIMER_Pos (1U) +#define AON_SLP_EVENT_TIMER_Len (1U) +#define AON_SLP_EVENT_TIMER_Msk (0x1U << AON_SLP_EVENT_TIMER_Pos) +#define AON_SLP_EVENT_TIMER AON_SLP_EVENT_TIMER_Msk + +#define AON_SLP_EVENT_SMCOSCEN_Pos (0U) +#define AON_SLP_EVENT_SMCOSCEN_Len (1U) +#define AON_SLP_EVENT_SMCOSCEN_Msk (0x1U << AON_SLP_EVENT_SMCOSCEN_Pos) +#define AON_SLP_EVENT_SMCOSCEN AON_SLP_EVENT_SMCOSCEN_Msk + +/******************* Bit definition for AON_REG_WARM_BOOT_TIME register **********/ +#define AON_WARM_BOOT_TIME_TUNE_C_Pos (24U) +#define AON_WARM_BOOT_TIME_TUNE_C_Len (7U) +#define AON_WARM_BOOT_TIME_TUNE_C_Msk (0x7FU << AON_WARM_BOOT_TIME_TUNE_C_Pos) +#define AON_WARM_BOOT_TIME_TUNE_C AON_WARM_BOOT_TIME_TUNE_C_Msk + +#define AON_WARM_BOOT_TIME_DIG_LDO_D_Pos (16U) +#define AON_WARM_BOOT_TIME_DIG_LDO_D_Len (7U) +#define AON_WARM_BOOT_TIME_DIG_LDO_D_Msk (0x7FU << AON_WARM_BOOT_TIME_DIG_LDO_D_Pos) +#define AON_WARM_BOOT_TIME_DIG_LDO_D AON_WARM_BOOT_TIME_DIG_LDO_D_Msk + +#define AON_WARM_BOOT_TIME_COUNTER_B_Pos (8U) +#define AON_WARM_BOOT_TIME_COUNTER_B_Len (7U) +#define AON_WARM_BOOT_TIME_COUNTER_B_Msk (0x7FU << AON_WARM_BOOT_TIME_COUNTER_B_Pos) +#define AON_WARM_BOOT_TIME_COUNTER_B AON_WARM_BOOT_TIME_COUNTER_B_Msk + +#define AON_WARM_BOOT_TIME_COUNTER_A_Pos (0U) +#define AON_WARM_BOOT_TIME_COUNTER_A_Len (7U) +#define AON_WARM_BOOT_TIME_COUNTER_A_Msk (0x7FU << AON_WARM_BOOT_TIME_COUNTER_A_Pos) +#define AON_WARM_BOOT_TIME_COUNTER_A AON_WARM_BOOT_TIME_COUNTER_A_Msk + +/******************* Bit definition for AON_REG_RF_REG_10 register **********/ +#define AON_RF_REG_10_MSIO_0 (0U) +#define AON_RF_REG_10_MSIO_1 (1U) +#define AON_RF_REG_10_MSIO_2 (2U) +#define AON_RF_REG_10_MSIO_3 (3U) +#define AON_RF_REG_10_MSIO_4 (4U) +#define AON_RF_REG_10_VTEMP (5U) +#define AON_RF_REG_10_VBATT (6U) +#define AON_RF_REG_10_VREF (7U) + +#define AON_RF_REG_10_XO_BYP_Pos (24U) +#define AON_RF_REG_10_XO_BYP_Len (1U) +#define AON_RF_REG_10_XO_BYP_Msk (0x1U << AON_RF_REG_10_XO_BYP_Pos) +#define AON_RF_REG_10_XO_BYP AON_RF_REG_10_XO_BYP_Msk + +#define AON_RF_REG_10_COMP_REF_CTRL_LV_Pos (16U) +#define AON_RF_REG_10_COMP_REF_CTRL_LV_Len (6U) +#define AON_RF_REG_10_COMP_REF_CTRL_LV_Msk (0x3FU << AON_RF_REG_10_COMP_REF_CTRL_LV_Pos) +#define AON_RF_REG_10_COMP_REF_CTRL_LV AON_RF_REG_10_COMP_REF_CTRL_LV_Msk + +#define AON_RF_REG_10_LPD_REG6_Pos (16U) +#define AON_RF_REG_10_LPD_REG6_Len (8U) +#define AON_RF_REG_10_LPD_REG6_Msk (0xFFU << AON_RF_REG_10_LPD_REG6_Pos) +#define AON_RF_REG_10_LPD_REG6 AON_RF_REG_10_LPD_REG6_Msk + +#define AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Pos (12U) +#define AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Len (3U) +#define AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Msk (0x7U << AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Pos) +#define AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV AON_RF_REG_10_COMP_BATT_LVL_CTRL_LV_Msk + +#define AON_RF_REG_10_ICOMP_CTRL_LV_Pos (8U) +#define AON_RF_REG_10_ICOMP_CTRL_LV_Len (4U) +#define AON_RF_REG_10_ICOMP_CTRL_LV_Msk (0xFU << AON_RF_REG_10_ICOMP_CTRL_LV_Pos) +#define AON_RF_REG_10_ICOMP_CTRL_LV AON_RF_REG_10_ICOMP_CTRL_LV_Msk + +#define AON_RF_REG_10_LPD_REG5_Pos (8U) +#define AON_RF_REG_10_LPD_REG5_Len (8U) +#define AON_RF_REG_10_LPD_REG5_Msk (0xFFU << AON_RF_REG_10_LPD_REG5_Pos) +#define AON_RF_REG_10_LPD_REG5 AON_RF_REG_10_LPD_REG5_Msk + +#define AON_RF_REG_10_WAKE_COMP_EN_Pos (6U) +#define AON_RF_REG_10_WAKE_COMP_EN_Len (1U) +#define AON_RF_REG_10_WAKE_COMP_EN_Msk (0x1U << AON_RF_REG_10_WAKE_COMP_EN_Pos) +#define AON_RF_REG_10_WAKE_COMP_EN AON_RF_REG_10_WAKE_COMP_EN_Msk + +#define AON_RF_REG_10_CHANNEL_SEL_N_Pos (3U) +#define AON_RF_REG_10_CHANNEL_SEL_N_Len (3U) +#define AON_RF_REG_10_CHANNEL_SEL_N_Msk (0x7U << AON_RF_REG_10_CHANNEL_SEL_N_Pos) +#define AON_RF_REG_10_CHANNEL_SEL_N AON_RF_REG_10_CHANNEL_SEL_N_Msk + +#define AON_RF_REG_10_CHANNEL_SEL_P_Pos (0U) +#define AON_RF_REG_10_CHANNEL_SEL_P_Len (3U) +#define AON_RF_REG_10_CHANNEL_SEL_P_Msk (0x7U << AON_RF_REG_10_CHANNEL_SEL_P_Pos) +#define AON_RF_REG_10_CHANNEL_SEL_P AON_RF_REG_10_CHANNEL_SEL_P_Msk + +#define AON_RF_REG_10_LPD_REG4_Pos (0U) +#define AON_RF_REG_10_LPD_REG4_Len (8U) +#define AON_RF_REG_10_LPD_REG4_Msk (0xFFU << AON_RF_REG_10_LPD_REG4_Pos) +#define AON_RF_REG_10_LPD_REG4 AON_RF_REG_10_LPD_REG4_Msk + +/******************* Bit definition for AON_REG_AON_PAD_CTL0 register **************/ +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Pos (28U) +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Len (2U) +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Msk (0x3U << AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Pos) +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Msk +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_RNG (0x00 << AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Pos) +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_RTC (0x01 << AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Pos) +#define AON_PAD_CTL0_COMM_TIMER_CLK_SEL_RNG2 (0x03 << AON_PAD_CTL0_COMM_TIMER_CLK_SEL_Pos) + +#define AON_PAD_CTL0_MCU_OVR_Pos (16U) +#define AON_PAD_CTL0_MCU_OVR_Len (8U) +#define AON_PAD_CTL0_MCU_OVR_Msk (0xFFU << AON_PAD_CTL0_MCU_OVR_Pos) +#define AON_PAD_CTL0_MCU_OVR AON_PAD_CTL0_MCU_OVR_Msk + +#define AON_PAD_CTL0_GPO_RTYPE_Pos (8U) +#define AON_PAD_CTL0_GPO_RTYPE_Len (8U) +#define AON_PAD_CTL0_GPO_RTYPE_Msk (0xFFU << AON_PAD_CTL0_GPO_RTYPE_Pos) +#define AON_PAD_CTL0_GPO_RTYPE AON_PAD_CTL0_GPO_RTYPE_Msk + +#define AON_PAD_CTL0_GPO_RE_N_Pos (0U) +#define AON_PAD_CTL0_GPO_RE_N_Len (8U) +#define AON_PAD_CTL0_GPO_RE_N_Msk (0xFFU << AON_PAD_CTL0_GPO_RE_N_Pos) +#define AON_PAD_CTL0_GPO_RE_N AON_PAD_CTL0_GPO_RE_N_Msk + +/******************* Bit definition for AON_REG_MEM_N_SLP_CTL register ****************/ +#define AON_MEM_CTL_DPAD_LE_WKUP_VAL_Pos (25U) +#define AON_MEM_CTL_DPAD_LE_WKUP_VAL_Len (1U) +#define AON_MEM_CTL_DPAD_LE_WKUP_VAL_Msk (0x1U << AON_MEM_CTL_DPAD_LE_WKUP_VAL_Pos) +#define AON_MEM_CTL_DPAD_LE_WKUP_VAL AON_MEM_CTL_DPAD_LE_WKUP_VAL_Msk + +#define AON_MEM_CTL_DPAD_LE_SLP_VAL_Pos (24U) +#define AON_MEM_CTL_DPAD_LE_SLP_VAL_Len (1U) +#define AON_MEM_CTL_DPAD_LE_SLP_VAL_Msk (0x1U << AON_MEM_CTL_DPAD_LE_SLP_VAL_Pos) +#define AON_MEM_CTL_DPAD_LE_SLP_VAL AON_MEM_CTL_DPAD_LE_SLP_VAL_Msk + +#define AON_MEM_CTL_SLP_Pos (16U) +#define AON_MEM_CTL_SLP_Len (7U) +#define AON_MEM_CTL_SLP_Msk (0x7FU << AON_MEM_CTL_SLP_Pos) +#define AON_MEM_CTL_SLP_EN AON_MEM_CTL_SLP_Msk +#define AON_MEM_CTL_SLP_ALL (AON_MEM_CTL_SLP_TRN_OFF_DCDC | AON_MEM_CTL_SLP_TRN_OFF_XO |\ + AON_MEM_CTL_SLP_TRN_OFF_PLL_EN | AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE |\ + AON_MEM_CTL_SLP_TRN_OFF_LDO_EN | AON_MEM_CTL_SLP_TRN_OFF_PLL_RST |\ + AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN ) + +#define AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN_Pos (22U) +#define AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN AON_MEM_CTL_SLP_TRN_OFF_IO_LDO_EN_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_RST_Pos (21U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_RST_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_RST_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_PLL_RST_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_RST AON_MEM_CTL_SLP_TRN_OFF_PLL_RST_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_LDO_EN_Pos (20U) +#define AON_MEM_CTL_SLP_TRN_OFF_LDO_EN_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_LDO_EN_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_LDO_EN_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_LDO_EN AON_MEM_CTL_SLP_TRN_OFF_LDO_EN_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE_Pos (19U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE AON_MEM_CTL_SLP_TRN_OFF_PLL_TUNE_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_EN_Pos (18U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_EN_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_EN_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_PLL_EN_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_PLL_EN AON_MEM_CTL_SLP_TRN_OFF_PLL_EN_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_XO_Pos (17U) +#define AON_MEM_CTL_SLP_TRN_OFF_XO_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_XO_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_XO_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_XO AON_MEM_CTL_SLP_TRN_OFF_XO_Msk + +#define AON_MEM_CTL_SLP_TRN_OFF_DCDC_Pos (16U) +#define AON_MEM_CTL_SLP_TRN_OFF_DCDC_Len (1U) +#define AON_MEM_CTL_SLP_TRN_OFF_DCDC_Msk (0x1U << AON_MEM_CTL_SLP_TRN_OFF_DCDC_Pos) +#define AON_MEM_CTL_SLP_TRN_OFF_DCDC AON_MEM_CTL_SLP_TRN_OFF_DCDC_Msk + +#define AON_MEM_CTL_MEM_BTRM_Pos (8U) +#define AON_MEM_CTL_MEM_BTRM_Len (4U) +#define AON_MEM_CTL_MEM_BTRM_Msk (0xFU << AON_MEM_CTL_MEM_BTRM_Pos) +#define AON_MEM_CTL_MEM_BTRM AON_MEM_CTL_MEM_BTRM_Msk + +#define AON_MEM_CTL_NON_CRITICAL_MEM_RWM_Pos (6U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RWM_Len (2U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RWM_Msk (0x3U << AON_MEM_CTL_NON_CRITICAL_MEM_RWM_Pos) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RWM AON_MEM_CTL_NON_CRITICAL_MEM_RWM_Msk + +#define AON_MEM_CTL_NON_CRITICAL_MEM_WM_Pos (5U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_WM_Len (1U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_WM_Msk (0x1U << AON_MEM_CTL_NON_CRITICAL_MEM_WM_Pos) +#define AON_MEM_CTL_NON_CRITICAL_MEM_WM AON_MEM_CTL_NON_CRITICAL_MEM_WM_Msk + +#define AON_MEM_CTL_NON_CRITICAL_MEM_RM_Pos (4U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RM_Len (1U) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RM_Msk (0x1U << AON_MEM_CTL_NON_CRITICAL_MEM_RM_Pos) +#define AON_MEM_CTL_NON_CRITICAL_MEM_RM AON_MEM_CTL_NON_CRITICAL_MEM_RM_Msk + +#define AON_MEM_CTL_CRITICAL_MEM_RWM_Pos (2U) +#define AON_MEM_CTL_CRITICAL_MEM_RWM_Len (2U) +#define AON_MEM_CTL_CRITICAL_MEM_RWM_Msk (0x3U << AON_MEM_CTL_CRITICAL_MEM_RWM_Pos) +#define AON_MEM_CTL_CRITICAL_MEM_RWM AON_MEM_CTL_CRITICAL_MEM_RWM_Msk + +#define AON_MEM_CTL_CRITICAL_MEM_WM_Pos (1U) +#define AON_MEM_CTL_CRITICAL_MEM_WM_Len (1U) +#define AON_MEM_CTL_CRITICAL_MEM_WM_Msk (0x1U << AON_MEM_CTL_CRITICAL_MEM_WM_Pos) +#define AON_MEM_CTL_CRITICAL_MEM_WM AON_MEM_CTL_CRITICAL_MEM_WM_Msk + +#define AON_MEM_CTL_CRITICAL_MEM_RM_Pos (0U) +#define AON_MEM_CTL_CRITICAL_MEM_RM_Len (1U) +#define AON_MEM_CTL_CRITICAL_MEM_RM_Msk (0x1U << AON_MEM_CTL_CRITICAL_MEM_RM_Pos) +#define AON_MEM_CTL_CRITICAL_MEM_RM AON_MEM_CTL_CRITICAL_MEM_RM_Msk + +/********************* Bit definition for AON_REG_EXT_WKUP_CTL register ************************************/ +#define AON_EXT_WKUP_CTL_WDT_ALARM_Pos (27U) +#define AON_EXT_WKUP_CTL_WDT_ALARM_Len (5U) +#define AON_EXT_WKUP_CTL_WDT_ALARM_Msk (0x1FU << AON_EXT_WKUP_CTL_WDT_ALARM_Pos) +#define AON_EXT_WKUP_CTL_WDT_ALARM AON_EXT_WKUP_CTL_WDT_ALARM_Msk + +#define AON_EXT_WKUP_CTL_WDT_RUNNING_Pos (26U) +#define AON_EXT_WKUP_CTL_WDT_RUNNING_Len (1U) +#define AON_EXT_WKUP_CTL_WDT_RUNNING_Msk (0x1U << AON_EXT_WKUP_CTL_WDT_RUNNING_Pos) +#define AON_EXT_WKUP_CTL_WDT_RUNNING AON_EXT_WKUP_CTL_WDT_RUNNING_Msk + +#define AON_EXT_WKUP_CTL_WDT_RELOAD_Pos (25U) +#define AON_EXT_WKUP_CTL_WDT_RELOAD_Len (1U) +#define AON_EXT_WKUP_CTL_WDT_RELOAD_Msk (0x1U << AON_EXT_WKUP_CTL_WDT_RELOAD_Pos) +#define AON_EXT_WKUP_CTL_WDT_RELOAD AON_EXT_WKUP_CTL_WDT_RELOAD_Msk + +#define AON_EXT_WKUP_CTL_WDT_EN_Pos (24U) +#define AON_EXT_WKUP_CTL_WDT_EN_Len (1U) +#define AON_EXT_WKUP_CTL_WDT_EN_Msk (0x1U << AON_EXT_WKUP_CTL_WDT_EN_Pos) +#define AON_EXT_WKUP_CTL_WDT_EN AON_EXT_WKUP_CTL_WDT_EN_Msk + +#define AON_EXT_WKUP_CTL_TYPE_Pos (16U) +#define AON_EXT_WKUP_CTL_TYPE_Len (8U) +#define AON_EXT_WKUP_CTL_TYPE_Msk (0xFFU << AON_EXT_WKUP_CTL_TYPE_Pos) +#define AON_EXT_WKUP_CTL_TYPE AON_EXT_WKUP_CTL_TYPE_Msk + +#define AON_EXT_WKUP_CTL_INVERT_Pos (8U) +#define AON_EXT_WKUP_CTL_INVERT_Len (8U) +#define AON_EXT_WKUP_CTL_INVERT_Msk (0xFFU << AON_EXT_WKUP_CTL_INVERT_Pos) +#define AON_EXT_WKUP_CTL_INVERT AON_EXT_WKUP_CTL_INVERT_Msk + +#define AON_EXT_WKUP_CTL_SRC_EN_Pos (0U) +#define AON_EXT_WKUP_CTL_SRC_EN_Len (8U) +#define AON_EXT_WKUP_CTL_SRC_EN_Msk (0xFFU << AON_EXT_WKUP_CTL_SRC_EN_Pos) +#define AON_EXT_WKUP_CTL_SRC_EN AON_EXT_WKUP_CTL_SRC_EN_Msk + +/********************* Bit definition for AON_REG_AON_PAD_CTL1 register ***************************************/ +#define AON_PAD_CTL1_TIMER_READ_SEL_Pos (30U) +#define AON_PAD_CTL1_TIMER_READ_SEL_Len (2U) +#define AON_PAD_CTL1_TIMER_READ_SEL_Msk (0x3U << AON_PAD_CTL1_TIMER_READ_SEL_Pos) +#define AON_PAD_CTL1_TIMER_READ_SEL AON_PAD_CTL1_TIMER_READ_SEL_Msk +#define AON_PAD_CTL1_TIMER_READ_SEL_CAL_TIMER (0x0U << AON_PAD_CTL1_TIMER_READ_SEL_Pos) +#define AON_PAD_CTL1_TIMER_READ_SEL_AON_WDT (0x1U << AON_PAD_CTL1_TIMER_READ_SEL_Pos) +#define AON_PAD_CTL1_TIMER_READ_SEL_SLP_TIMER (0x2U << AON_PAD_CTL1_TIMER_READ_SEL_Pos) +#define AON_PAD_CTL1_TIMER_READ_SEL_CAL_ALARM (0x3U << AON_PAD_CTL1_TIMER_READ_SEL_Pos) + +#define AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN_Pos (25U) +#define AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN_Len (1U) +#define AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN_Msk (0x1U << AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN_Pos) +#define AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN AON_PAD_CTL1_MEM_STDBY_VDDISO_OVR_EN_Msk + +#define AON_PAD_CTL1_O_AON_GPI_Pos (16U) +#define AON_PAD_CTL1_O_AON_GPI_Len (6U) +#define AON_PAD_CTL1_O_AON_GPI_Msk (0x3FU << AON_PAD_CTL1_O_AON_GPI_Pos) +#define AON_PAD_CTL1_O_AON_GPI AON_PAD_CTL1_O_AON_GPI_Msk + +#define AON_PAD_CTL1_AON_GPO_Pos (8U) +#define AON_PAD_CTL1_AON_GPO_Len (8U) +#define AON_PAD_CTL1_AON_GPO_Msk (0xFFU << AON_PAD_CTL1_AON_GPO_Pos) +#define AON_PAD_CTL1_AON_GPO AON_PAD_CTL1_AON_GPO_Msk + +#define AON_PAD_CTL1_AON_GPO_OE_N_Pos (0U) +#define AON_PAD_CTL1_AON_GPO_OE_N_Len (8U) +#define AON_PAD_CTL1_AON_GPO_OE_N_Msk (0xFFU << AON_PAD_CTL1_AON_GPO_OE_N_Pos) +#define AON_PAD_CTL1_AON_GPO_OE_N AON_PAD_CTL1_AON_GPO_OE_N_Msk + +/********************* Bit definition for AON_REG_MEM_PWR_SLP register **************************************/ +#define AON_MEM_PWR_SLP_PD_MCU_KEYRAM_Pos (28U) +#define AON_MEM_PWR_SLP_PD_MCU_KEYRAM_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_KEYRAM_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_KEYRAM_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_KEYRAM AON_MEM_PWR_SLP_PD_MCU_KEYRAM_Msk + +#define AON_MEM_PWR_SLP_PD_PACKET_MEM_Pos (26U) +#define AON_MEM_PWR_SLP_PD_PACKET_MEM_Len (2U) +#define AON_MEM_PWR_SLP_PD_PACKET_MEM_Msk (0x3U << AON_MEM_PWR_SLP_PD_PACKET_MEM_Pos) +#define AON_MEM_PWR_SLP_PD_PACKET_MEM AON_MEM_PWR_SLP_PD_PACKET_MEM_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_ICACHE_Pos (24U) +#define AON_MEM_PWR_SLP_PD_MCU_ICACHE_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_ICACHE_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_ICACHE_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_ICACHE AON_MEM_PWR_SLP_PD_MCU_ICACHE_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_HTM_Pos (22U) +#define AON_MEM_PWR_SLP_PD_MCU_HTM_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_HTM_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_HTM_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_HTM AON_MEM_PWR_SLP_PD_MCU_HTM_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_10_Pos (20U) +#define AON_MEM_PWR_SLP_PD_MCU_10_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_10_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_10_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_10 AON_MEM_PWR_SLP_PD_MCU_10_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_09_Pos (18U) +#define AON_MEM_PWR_SLP_PD_MCU_09_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_09_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_09_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_09 AON_MEM_PWR_SLP_PD_MCU_09_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_08_Pos (16U) +#define AON_MEM_PWR_SLP_PD_MCU_08_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_08_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_08_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_08 AON_MEM_PWR_SLP_PD_MCU_08_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_07_Pos (14U) +#define AON_MEM_PWR_SLP_PD_MCU_07_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_07_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_07_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_07 AON_MEM_PWR_SLP_PD_MCU_07_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_06_Pos (12U) +#define AON_MEM_PWR_SLP_PD_MCU_06_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_06_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_06_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_06 AON_MEM_PWR_SLP_PD_MCU_06_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_05_Pos (10U) +#define AON_MEM_PWR_SLP_PD_MCU_05_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_05_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_05_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_05 AON_MEM_PWR_SLP_PD_MCU_05_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_04_Pos (8U) +#define AON_MEM_PWR_SLP_PD_MCU_04_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_04_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_04_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_04 AON_MEM_PWR_SLP_PD_MCU_04_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_03_Pos (6U) +#define AON_MEM_PWR_SLP_PD_MCU_03_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_03_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_03_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_03 AON_MEM_PWR_SLP_PD_MCU_03_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_02_Pos (4U) +#define AON_MEM_PWR_SLP_PD_MCU_02_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_02_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_02_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_02 AON_MEM_PWR_SLP_PD_MCU_02_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_01_Pos (2U) +#define AON_MEM_PWR_SLP_PD_MCU_01_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_01_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_01_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_01 AON_MEM_PWR_SLP_PD_MCU_01_Msk + +#define AON_MEM_PWR_SLP_PD_MCU_00_Pos (0U) +#define AON_MEM_PWR_SLP_PD_MCU_00_Len (2U) +#define AON_MEM_PWR_SLP_PD_MCU_00_Msk (0x3U << AON_MEM_PWR_SLP_PD_MCU_00_Pos) +#define AON_MEM_PWR_SLP_PD_MCU_00 AON_MEM_PWR_SLP_PD_MCU_00_Msk + +/**************************** Bit definition for AON_REG_MEM_PWR_WKUP register *****************************/ +#define AON_MEM_PWR_WKUP_PD_MCU_KEYRAM_Pos (28U) +#define AON_MEM_PWR_WKUP_PD_MCU_KEYRAM_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_KEYRAM_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_KEYRAM_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_KEYRAM AON_MEM_PWR_WKUP_PD_MCU_KEYRAM_Msk + +#define AON_MEM_PWR_WKUP_PD_PACKET_MEM_Pos (26U) +#define AON_MEM_PWR_WKUP_PD_PACKET_MEM_Len (2U) +#define AON_MEM_PWR_WKUP_PD_PACKET_MEM_Msk (0x3U << AON_MEM_PWR_WKUP_PD_PACKET_MEM_Pos) +#define AON_MEM_PWR_WKUP_PD_PACKET_MEM AON_MEM_PWR_WKUP_PD_PACKET_MEM_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_ICACHE_Pos (24U) +#define AON_MEM_PWR_WKUP_PD_MCU_ICACHE_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_ICACHE_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_ICACHE_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_ICACHE AON_MEM_PWR_WKUP_PD_MCU_ICACHE_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_HTM_Pos (22U) +#define AON_MEM_PWR_WKUP_PD_MCU_HTM_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_HTM_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_HTM_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_HTM AON_MEM_PWR_WKUP_PD_MCU_HTM_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_10_Pos (20U) +#define AON_MEM_PWR_WKUP_PD_MCU_10_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_10_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_10_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_10 AON_MEM_PWR_WKUP_PD_MCU_10_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_09_Pos (18U) +#define AON_MEM_PWR_WKUP_PD_MCU_09_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_09_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_09_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_09 AON_MEM_PWR_WKUP_PD_MCU_09_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_08_Pos (16U) +#define AON_MEM_PWR_WKUP_PD_MCU_08_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_08_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_08_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_08 AON_MEM_PWR_WKUP_PD_MCU_08_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_07_Pos (14U) +#define AON_MEM_PWR_WKUP_PD_MCU_07_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_07_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_07_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_07 AON_MEM_PWR_WKUP_PD_MCU_07_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_06_Pos (12U) +#define AON_MEM_PWR_WKUP_PD_MCU_06_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_06_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_06_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_06 AON_MEM_PWR_WKUP_PD_MCU_06_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_05_Pos (10U) +#define AON_MEM_PWR_WKUP_PD_MCU_05_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_05_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_05_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_05 AON_MEM_PWR_WKUP_PD_MCU_05_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_04_Pos (8U) +#define AON_MEM_PWR_WKUP_PD_MCU_04_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_04_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_04_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_04 AON_MEM_PWR_WKUP_PD_MCU_04_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_03_Pos (6U) +#define AON_MEM_PWR_WKUP_PD_MCU_03_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_03_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_03_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_03 AON_MEM_PWR_WKUP_PD_MCU_03_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_02_Pos (4U) +#define AON_MEM_PWR_WKUP_PD_MCU_02_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_02_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_02_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_02 AON_MEM_PWR_WKUP_PD_MCU_02_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_01_Pos (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_01_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_01_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_01_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_01 AON_MEM_PWR_WKUP_PD_MCU_01_Msk + +#define AON_MEM_PWR_WKUP_PD_MCU_00_Pos (0U) +#define AON_MEM_PWR_WKUP_PD_MCU_00_Len (2U) +#define AON_MEM_PWR_WKUP_PD_MCU_00_Msk (0x3U << AON_MEM_PWR_WKUP_PD_MCU_00_Pos) +#define AON_MEM_PWR_WKUP_PD_MCU_00 AON_MEM_PWR_WKUP_PD_MCU_00_Msk + +/*********************** Bit definition for AON_REG_PWR_RET28 register ***************************/ +#define AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME_Pos (0U) +#define AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME_Len (32U) +#define AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME_Msk (0xFFFFFFFFU) +#define AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME AON_COMM_TMR_DEEPSLWKUP_DEEPSLTIME_Msk + +/*********************** Bit definition for AON_REG_PWR_RET29 register ************************/ +#define AON_COMM_TMR_ENBPRESET_TWEXT_Pos (21U) +#define AON_COMM_TMR_ENBPRESET_TWEXT_Len (11U) +#define AON_COMM_TMR_ENBPRESET_TWEXT_Msk (0x07FFU << AON_COMM_TMR_ENBPRESET_TWEXT_Pos) +#define AON_COMM_TMR_ENBPRESET_TWEXT AON_COMM_TMR_ENBPRESET_TWEXT_Msk + +#define AON_COMM_TMR_ENBPRESET_TWOSC_Pos (10U) +#define AON_COMM_TMR_ENBPRESET_TWOSC_Len (11U) +#define AON_COMM_TMR_ENBPRESET_TWOSC_Msk (0x07FFU << AON_COMM_TMR_ENBPRESET_TWOSC_Pos) +#define AON_COMM_TMR_ENBPRESET_TWOSC AON_COMM_TMR_ENBPRESET_TWOSC_Msk + +#define AON_COMM_TMR_ENBPRESET_TWRM_Pos (0U) +#define AON_COMM_TMR_ENBPRESET_TWRM_Len (10U) +#define AON_COMM_TMR_ENBPRESET_TWRM_Msk (0x03FFU << AON_COMM_TMR_ENBPRESET_TWRM_Pos) +#define AON_COMM_TMR_ENBPRESET_TWRM AON_COMM_TMR_ENBPRESET_TWRM_Msk + +/*********************** Bit definition for AON_REG_PWR_RET31 register *********************************/ +#define AON_PWR_REG31_FPGA_DBG_MUX_SEL_Pos (0U) +#define AON_PWR_REG31_FPGA_DBG_MUX_SEL_Len (2U) +#define AON_PWR_REG31_FPGA_DBG_MUX_SEL_Msk (0x3U << AON_PWR_REG31_FPGA_DBG_MUX_SEL_Pos) +#define AON_PWR_REG31_FPGA_DBG_MUX_SEL AON_PWR_REG31_FPGA_DBG_MUX_SEL_Msk + +/*********************** Bit definition for AON_REG_PSC_CMD register ***************************************/ +#define AON_PSC_CMD_MCU_PWR_BUSY_Pos (1U) +#define AON_PSC_CMD_MCU_PWR_BUSY_Len (1U) +#define AON_PSC_CMD_MCU_PWR_BUSY_Msk (0x1U << AON_PSC_CMD_MCU_PWR_BUSY_Pos) +#define AON_PSC_CMD_MCU_PWR_BUSY AON_PSC_CMD_MCU_PWR_BUSY_Msk + +#define AON_PSC_CMD_MCU_PWR_REQ_Pos (0U) +#define AON_PSC_CMD_MCU_PWR_REQ_Len (1U) +#define AON_PSC_CMD_MCU_PWR_REQ_Msk (0x1U << AON_PSC_CMD_MCU_PWR_REQ_Pos) +#define AON_PSC_CMD_MCU_PWR_REQ AON_PSC_CMD_MCU_PWR_REQ_Msk + +/********************** Bit definition for AON_REG_PSC_CMD_OPC register ************************************/ +#define AON_PSC_CMD_OPC_OPCODE_Pos (0U) +#define AON_PSC_CMD_OPC_OPCODE_Len (8U) +#define AON_PSC_CMD_OPC_OPCODE_Msk (0xFFU << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE AON_PSC_CMD_OPC_OPCODE_Msk +#define AON_PSC_CMD_OPC_OPCODE_LOOPBACK (0x0U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_EF_DIR_ON (0x1U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_32_TIMER_LD (0x2U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_DEEP_SLEEP (0x3U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_EF_DIR_OFF (0x4U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_EXT_CLK (0x5U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_RNG_CLK (0x6U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_RTC_CLK (0x7U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_RNG2_CLK (0x8U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_LD_MEM_SLP_CFG (0x9U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_LD_MEM_WKUP_CFG (0xAU << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_DPAD_LE_HI (0xBU << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_DPAD_LE_LO (0xCU << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_0 (0x10U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_1 (0x11U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_2 (0x12U << AON_PSC_CMD_OPC_OPCODE_Pos) +#define AON_PSC_CMD_OPC_OPCODE_SLP_TIMER_MODE_3 (0x13U << AON_PSC_CMD_OPC_OPCODE_Pos) + +/******************* Bit definition for AON_REG_TIMER_VALUE register **********/ +#define AON_TIMER_VALUE_PWR_CTL_TIMER_32B_Pos (0U) +#define AON_TIMER_VALUE_PWR_CTL_TIMER_32B_Len (32U) +#define AON_TIMER_VALUE_PWR_CTL_TIMER_32B_Msk (0xFFFFFFFFU) +#define AON_TIMER_VALUE_PWR_CTL_TIMER_32B AON_TIMER_VALUE_PWR_CTL_TIMER_32B_Msk + +/********************* Bit definition for AON_REG_TIMER_VAL register **************************************/ +#define AON_TIMER_VAL_READ_Pos (0U) +#define AON_TIMER_VAL_READ_Len (32U) +#define AON_TIMER_VAL_READ_Msk (0xFFFFFFFFU) +#define AON_TIMER_VAL_READ AON_TIMER_VAL_READ_Msk + +/*********************** Bit definition for AON_REG_FPGA_CTRL register *********************************/ +#define AON_REG_FPGA_CTRL_MUX_SEL_Pos (0U) +#define AON_REG_FPGA_CTRL_MUX_SEL_Len (2U) +#define AON_REG_FPGA_CTRL_MUX_SEL_Msk (0x3U << AON_REG_FPGA_CTRL_MUX_SEL_Pos) +#define AON_REG_FPGA_CTRL_MUX_SEL AON_REG_FPGA_CTRL_MUX_SEL_Msk + +#define AON_REG_FPGA_CTRL_EXIST_Pos (4U) +#define AON_REG_FPGA_CTRL_EXIST_Len (1U) +#define AON_REG_FPGA_CTRL_EXIST_Msk (0x1U << AON_REG_FPGA_CTRL_EXIST_Pos) +#define AON_REG_FPGA_CTRL_EXIST AON_REG_FPGA_CTRL_EXIST_Msk + +/********************** Bit definition for AON_REG_ST_CALIB_REG register ***********************************/ +#define AON_ST_CALIB_REG_STCALIB_Pos (0U) +#define AON_ST_CALIB_REG_STCALIB_Len (27U) +#define AON_ST_CALIB_REG_STCALIB_Msk (0x7FFFFFFU << AON_ST_CALIB_REG_STCALIB_Pos) +#define AON_ST_CALIB_REG_STCALIB AON_ST_CALIB_REG_STCALIB_Msk + + +/* ================================================================================================================= */ +/* ================ DMA ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for DMA_SAR register ********************/ +#define DMA_SAR_CSA_Pos (0U) +#define DMA_SAR_CSA_Len (32U) +#define DMA_SAR_CSA_Msk (0xFFFFFFFFU) +#define DMA_SAR_CSA DMA_SAR_CSA_Msk + +/******************* Bit definition for DMA_DAR register ********************/ +#define DMA_DAR_CDA_Pos (0U) +#define DMA_DAR_CDA_Len (32U) +#define DMA_DAR_CDA_Msk (0xFFFFFFFFU) +#define DMA_DAR_CDA DMA_DAR_CDA_Msk + +/******************* Bit definition for DMA_CTLL register *******************/ +#define DMA_CTLL_TT_FC_Pos (20U) +#define DMA_CTLL_TT_FC_Len (2U) +#define DMA_CTLL_TT_FC_Msk (0x3U << DMA_CTLL_TT_FC_Pos) +#define DMA_CTLL_TT_FC DMA_CTLL_TT_FC_Msk +#define DMA_CTLL_TT_FC_M2M (0x0U << DMA_CTLL_TT_FC_Pos) +#define DMA_CTLL_TT_FC_M2P (0x1U << DMA_CTLL_TT_FC_Pos) +#define DMA_CTLL_TT_FC_P2M (0x2U << DMA_CTLL_TT_FC_Pos) +#define DMA_CTLL_TT_FC_P2P (0x3U << DMA_CTLL_TT_FC_Pos) + +#define DMA_CTLL_SRC_MSIZE_Pos (14U) +#define DMA_CTLL_SRC_MSIZE_Len (3U) +#define DMA_CTLL_SRC_MSIZE_Msk (0x7U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE DMA_CTLL_SRC_MSIZE_Msk +#define DMA_CTLL_SRC_MSIZE_1 (0x0U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_4 (0x1U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_8 (0x2U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_16 (0x3U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_32 (0x4U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_64 (0x5U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_128 (0x6U << DMA_CTLL_SRC_MSIZE_Pos) +#define DMA_CTLL_SRC_MSIZE_256 (0x7U << DMA_CTLL_SRC_MSIZE_Pos) + +#define DMA_CTLL_DST_MSIZE_Pos (11U) +#define DMA_CTLL_DST_MSIZE_Len (3U) +#define DMA_CTLL_DST_MSIZE_Msk (0x7U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE DMA_CTLL_DST_MSIZE_Msk +#define DMA_CTLL_DST_MSIZE_1 (0x0U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_4 (0x1U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_8 (0x2U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_16 (0x3U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_32 (0x4U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_64 (0x5U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_128 (0x6U << DMA_CTLL_DST_MSIZE_Pos) +#define DMA_CTLL_DST_MSIZE_256 (0x7U << DMA_CTLL_DST_MSIZE_Pos) + +#define DMA_CTLL_SINC_Pos (9U) +#define DMA_CTLL_SINC_Len (2U) +#define DMA_CTLL_SINC_Msk (0x3U << DMA_CTLL_SINC_Pos) +#define DMA_CTLL_SINC DMA_CTLL_SINC_Msk +#define DMA_CTLL_SINC_INC (0x0U << DMA_CTLL_SINC_Pos) +#define DMA_CTLL_SINC_DEC (0x1U << DMA_CTLL_SINC_Pos) +#define DMA_CTLL_SINC_NO (0x2U << DMA_CTLL_SINC_Pos) + +#define DMA_CTLL_DINC_Pos (7U) +#define DMA_CTLL_DINC_Len (2U) +#define DMA_CTLL_DINC_Msk (0x3U << DMA_CTLL_DINC_Pos) +#define DMA_CTLL_DINC DMA_CTLL_DINC_Msk +#define DMA_CTLL_DINC_INC (0x0U << DMA_CTLL_DINC_Pos) +#define DMA_CTLL_DINC_DEC (0x1U << DMA_CTLL_DINC_Pos) +#define DMA_CTLL_DINC_NO (0x2U << DMA_CTLL_DINC_Pos) + +#define DMA_CTLL_SRC_TR_WIDTH_Pos (4U) +#define DMA_CTLL_SRC_TR_WIDTH_Len (2U) +#define DMA_CTLL_SRC_TR_WIDTH_Msk (0x3U << DMA_CTLL_SRC_TR_WIDTH_Pos) +#define DMA_CTLL_SRC_TR_WIDTH DMA_CTLL_SRC_TR_WIDTH_Msk +#define DMA_CTLL_SRC_TR_WIDTH_8 (0x0U << DMA_CTLL_SRC_TR_WIDTH_Pos) +#define DMA_CTLL_SRC_TR_WIDTH_16 (0x1U << DMA_CTLL_SRC_TR_WIDTH_Pos) +#define DMA_CTLL_SRC_TR_WIDTH_32 (0x2U << DMA_CTLL_SRC_TR_WIDTH_Pos) + +#define DMA_CTLL_DST_TR_WIDTH_Pos (1U) +#define DMA_CTLL_DST_TR_WIDTH_Len (2U) +#define DMA_CTLL_DST_TR_WIDTH_Msk (0x3U << DMA_CTLL_DST_TR_WIDTH_Pos) +#define DMA_CTLL_DST_TR_WIDTH DMA_CTLL_DST_TR_WIDTH_Msk +#define DMA_CTLL_DST_TR_WIDTH_8 (0x0U << DMA_CTLL_DST_TR_WIDTH_Pos) +#define DMA_CTLL_DST_TR_WIDTH_16 (0x1U << DMA_CTLL_DST_TR_WIDTH_Pos) +#define DMA_CTLL_DST_TR_WIDTH_32 (0x2U << DMA_CTLL_DST_TR_WIDTH_Pos) + +#define DMA_CTLL_INT_EN_Pos (0U) +#define DMA_CTLL_INT_EN_Len (1U) +#define DMA_CTLL_INT_EN_Msk (0x1U << DMA_CTLL_INT_EN_Pos) +#define DMA_CTLL_INI_EN DMA_CTLL_INT_EN_Msk + +/******************* Bit definition for DMA_CTLH register *******************/ +#define DMA_CTLH_BLOCK_TS_Pos (0U) +#define DMA_CTLH_BLOCK_TS_Len (12U) +#define DMA_CTLH_BLOCK_TS_Msk (0xFFFU << DMA_CTLH_BLOCK_TS_Pos) +#define DMA_CTLH_BLOCK_TS DMA_CTLH_BLOCK_TS_Msk + +/******************* Bit definition for DMA_CFGL register *******************/ +#define DMA_CFGL_RELOAD_DST_Pos (31U) +#define DMA_CFGL_RELOAD_DST_Len (1U) +#define DMA_CFGL_RELOAD_DST_Msk (0x1U << DMA_CFGL_RELOAD_DST_Pos) +#define DMA_CFGL_RELOAD_DST DMA_CFGL_RELOAD_DST_Msk + +#define DMA_CFGL_RELOAD_SRC_Pos (30U) +#define DMA_CFGL_RELOAD_SRC_Len (1U) +#define DMA_CFGL_RELOAD_SRC_Msk (0x1U << DMA_CFGL_RELOAD_SRC_Pos) +#define DMA_CFGL_RELOAD_SRC DMA_CFGL_RELOAD_SRC_Msk + +#define DMA_CFGL_HS_SEL_SRC_Pos (11U) +#define DMA_CFGL_HS_SEL_SRC_Len (1U) +#define DMA_CFGL_HS_SEL_SRC_Msk (0x1U << DMA_CFGL_HS_SEL_SRC_Pos) +#define DMA_CFGL_HS_SEL_SRC DMA_CFGL_HS_SEL_SRC_Msk + +#define DMA_CFGL_HS_SEL_DST_Pos (10U) +#define DMA_CFGL_HS_SEL_DST_Len (1U) +#define DMA_CFGL_HS_SEL_DST_Msk (0x1U << DMA_CFGL_HS_SEL_DST_Pos) +#define DMA_CFGL_HS_SEL_DST DMA_CFGL_HS_SEL_DST_Msk + +#define DMA_CFGL_FIFO_EMPTY_Pos (9U) +#define DMA_CFGL_FIFO_EMPTY_Len (1U) +#define DMA_CFGL_FIFO_EMPTY_Msk (0x1U << DMA_CFGL_FIFO_EMPTY_Pos) +#define DMA_CFGL_FIFO_EMPTY DMA_CFGL_FIFO_EMPTY_Msk + +#define DMA_CFGL_CH_SUSP_Pos (8U) +#define DMA_CFGL_CH_SUSP_Len (1U) +#define DMA_CFGL_CH_SUSP_Msk (0x1U << DMA_CFGL_CH_SUSP_Pos) +#define DMA_CFGL_CH_SUSP DMA_CFGL_CH_SUSP_Msk + +#define DMA_CFGL_CH_PRIOR_Pos (5U) +#define DMA_CFGL_CH_PRIOR_Len (3U) +#define DMA_CFGL_CH_PRIOR_Msk (0x7U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR DMA_CFGL_CH_PRIOR_Msk +#define DMA_CFGL_CH_PRIOR_0 (0x0U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_1 (0x1U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_2 (0x2U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_3 (0x3U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_4 (0x4U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_5 (0x5U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_6 (0x6U << DMA_CFGL_CH_PRIOR_Pos) +#define DMA_CFGL_CH_PRIOR_7 (0x7U << DMA_CFGL_CH_PRIOR_Pos) + +/******************* Bit definition for DMA_CFGH register ********************/ +#define DMA_CFGH_DST_PER_Pos (11U) +#define DMA_CFGH_DST_PER_Len (4U) +#define DMA_CFGH_DST_PER_Msk (0xFU << DMA_CFGH_DST_PER_Pos) +#define DMA_CFGH_DST_PER DMA_CFGH_DST_PER_Msk + +#define DMA_CFGH_SRC_PER_Pos (7U) +#define DMA_CFGH_SRC_PER_Len (4U) +#define DMA_CFGH_SRC_PER_Msk (0xFU << DMA_CFGH_SRC_PER_Pos) +#define DMA_CFGH_SRC_PER DMA_CFGH_SRC_PER_Msk + +#define DMA_CFGH_PROTCTL_Pos (2U) +#define DMA_CFGH_PROTCTL_Len (3U) +#define DMA_CFGH_PROTCTL_Msk (0x7U << DMA_CFGH_PROTCTL_Pos) +#define DMA_CFGH_PROTCTL DMA_CFGH_PROTCTL_Msk + +#define DMA_CFGH_FIFO_MODE_Pos (2U) +#define DMA_CFGH_FIFO_MODE_Len (1U) +#define DMA_CFGH_FIFO_MODE_Msk (0x1U << DMA_CFGH_FIFO_MODE_Pos) +#define DMA_CFGH_FIFO_MODE DMA_CFGH_FIFO_MODE_Msk + +/******************* Bit definition for DMA_RAW_TFR register *****************/ +#define DMA_RAW_TFR_Pos (0U) +#define DMA_RAW_TFR_Len (8U) +#define DMA_RAW_TFR_Msk (0xFFU << DMA_RAW_TFR_Pos) +#define DMA_RAW_TFR DMA_RAW_TFR_Msk + +/******************* Bit definition for DMA_RAW_BLK register *****************/ +#define DMA_RAW_BLK_Pos (0U) +#define DMA_RAW_BLK_Len (8U) +#define DMA_RAW_BLK_Msk (0xFFU << DMA_RAW_BLK_Pos) +#define DMA_RAW_BLK DMA_RAW_BLK_Msk + +/******************* Bit definition for DMA_RAW_SRC_TRN register *************/ +#define DMA_RAW_SRC_TRN_Pos (0U) +#define DMA_RAW_SRC_TRN_Len (8U) +#define DMA_RAW_SRC_TRN_Msk (0xFFU << DMA_RAW_SRC_TRN_Pos) +#define DMA_RAW_SRC_TRN DMA_RAW_SRC_TRN_Msk + +/******************* Bit definition for DMA_RAW_DST_TRN register *************/ +#define DMA_RAW_DST_TRN_Pos (0U) +#define DMA_RAW_DST_TRN_Len (8U) +#define DMA_RAW_DST_TRN_Msk (0xFFU << DMA_RAW_DST_TRN_Pos) +#define DMA_RAW_DST_TRN DMA_RAW_DST_TRN_Msk + +/******************* Bit definition for DMA_RAW_ERR register *****************/ +#define DMA_RAW_ERR_Pos (0U) +#define DMA_RAW_ERR_Len (8U) +#define DMA_RAW_ERR_Msk (0xFFU << DMA_RAW_ERR_Pos) +#define DMA_RAW_ERR DMA_RAW_ERR_Msk + +/******************* Bit definition for DMA_STAT_TFR register ****************/ +#define DMA_STAT_TFR_Pos (0U) +#define DMA_STAT_TFR_Len (8U) +#define DMA_STAT_TFR_Msk (0xFFUL << DMA_STAT_TFR_Pos) +#define DMA_STAT_TFR DMA_STAT_TFR_Msk + +/******************* Bit definition for DMA_STAT_BLK register ****************/ +#define DMA_STAT_BLK_Pos (0U) +#define DMA_STAT_BLK_Len (8U) +#define DMA_STAT_BLK_Msk (0xFFU << DMA_STAT_BLK_Pos) +#define DMA_STAT_BLK DMA_STAT_BLK_Msk + +/******************* Bit definition for DMA_STAT_SRC_TRN register ************/ +#define DMA_STAT_SRC_TRN_Pos (0U) +#define DMA_STAT_SRC_TRN_Len (8U) +#define DMA_STAT_SRC_TRN_Msk (0xFFU << DMA_STAT_SRC_TRN_Pos) +#define DMA_STAT_SRC_TRN DMA_STAT_SRC_TRN_Msk + +/******************* Bit definition for DMA_STAT_DST_TRN register ************/ +#define DMA_STAT_DST_TRN_Pos (0U) +#define DMA_STAT_DST_TRN_Len (8U) +#define DMA_STAT_DST_TRN_Msk (0xFFU << DMA_STAT_DST_TRN_Pos) +#define DMA_STAT_DST_TRN DMA_STAT_DST_TRN_Msk + +/******************* Bit definition for DMA_STAT_ERR register ****************/ +#define DMA_STAT_ERR_Pos (0U) +#define DMA_STAT_ERR_Len (8U) +#define DMA_STAT_ERR_Msk (0xFFU << DMA_STAT_ERR_Pos) +#define DMA_STAT_ERR DMA_STAT_ERR_Msk + +/******************* Bit definition for DMA_MASK_TFR register ****************/ +#define DMA_MASK_TFR_WE_Pos (8U) +#define DMA_MASK_TFR_WE_Len (8U) +#define DMA_MASK_TFR_WE_Msk (0xFFU << DMA_MASK_TFR_WE_Pos) +#define DMA_MASK_TFR_WE DMA_MASK_TFR_WE_Msk + +#define DMA_MASK_TFR_Pos (0U) +#define DMA_MASK_TFR_Len (8U) +#define DMA_MASK_TFR_Msk (0xFFU << DMA_MASK_TFR_Pos) +#define DMA_MASK_TFR DMA_MASK_TFR_Msk + +/******************* Bit definition for DMA_MASK_BLK register ****************/ +#define DMA_MASK_BLK_WE_Pos (8U) +#define DMA_MASK_BLK_WE_Len (8U) +#define DMA_MASK_BLK_WE_Msk (0xFFU << DMA_MASK_BLK_WE_Pos) +#define DMA_MASK_BLK_WE DMA_MASK_BLK_WE_Msk + +#define DMA_MASK_BLK_Pos (0U) +#define DMA_MASK_BLK_Len (8U) +#define DMA_MASK_BLK_Msk (0xFFU << DMA_MASK_BLK_Pos) +#define DMA_MASK_BLK DMA_MASK_BLK_Msk + +/******************* Bit definition for DMA_MASK_SRC_TRN register ************/ +#define DMA_MASK_SRC_TRN_WE_Pos (8U) +#define DMA_MASK_SRC_TRN_WE_Len (8U) +#define DMA_MASK_SRC_TRN_WE_Msk (0x1U << DMA_MASK_SRC_TRN_WE_Pos) +#define DMA_MASK_SRC_TRN_WE DMA_MASK_SRC_TRN_WE_Msk + +#define DMA_MASK_SRC_TRN_Pos (0U) +#define DMA_MASK_SRC_TRN_Len (8U) +#define DMA_MASK_SRC_TRN_Msk (0xFFU << DMA_MASK_SRC_TRN_Pos) +#define DMA_MASK_SRC_TRN DMA_MASK_SRC_TRN_Msk + +/******************* Bit definition for DMA_MASK_DST_TRN register ************/ +#define DMA_MASK_DST_TRN_WE_Pos (8U) +#define DMA_MASK_DST_TRN_WE_Len (8U) +#define DMA_MASK_DST_TRN_WE_Msk (0xFFU << DMA_MASK_DST_TRN_WE_Pos) +#define DMA_MASK_DST_TRN_WE DMA_MASK_DST_TRN_WE_Msk + +#define DMA_MASK_DST_TRN_Pos (0U) +#define DMA_MASK_DST_TRN_Len (8U) +#define DMA_MASK_DST_TRN_Msk (0xFFU << DMA_MASK_DST_TRN_Pos) +#define DMA_MASK_DST_TRN DMA_MASK_DST_TRN_Msk + +/******************* Bit definition for DMA_MASK_ERR register ****************/ +#define DMA_MASK_ERR_WE_Pos (8U) +#define DMA_MASK_ERR_WE_Len (8U) +#define DMA_MASK_ERR_WE_Msk (0xFFU << DMA_MASK_ERR_WE_Pos) +#define DMA_MASK_ERR_WE DMA_MASK_ERR_WE_Msk + +#define DMA_MASK_ERR_Pos (0U) +#define DMA_MASK_ERR_Len (8U) +#define DMA_MASK_ERR_Msk (0xFFU << DMA_MASK_ERR_Pos) +#define DMA_MASK_ERR DMA_MASK_ERR_Msk + +/******************* Bit definition for DMA_CLR_TFR register *****************/ +#define DMA_CLR_TFR_Pos (0U) +#define DMA_CLR_TFR_Len (8U) +#define DMA_CLR_TFR_Msk (0xFFU << DMA_CLR_TFR_Pos) +#define DMA_CLR_TFR DMA_CLR_TFR_Msk + +/******************* Bit definition for DMA_CLR_BLK register *****************/ +#define DMA_CLR_BLK_Pos (0U) +#define DMA_CLR_BLK_Len (8U) +#define DMA_CLR_BLK_Msk (0xFFU << DMA_CLR_BLK_Pos) +#define DMA_CLR_BLK DMA_CLR_BLK_Msk + +/******************* Bit definition for DMA_CLR_SRC_TRN register *************/ +#define DMA_CLR_SRC_TRN_Pos (0U) +#define DMA_CLR_SRC_TRN_Len (8U) +#define DMA_CLR_SRC_TRN_Msk (0xFFU << DMA_CLR_SRC_TRN_Pos) +#define DMA_CLR_SRC_TRN DMA_CLR_SRC_TRN_Msk + +/******************* Bit definition for DMA_CLR_DST_TRN register *************/ +#define DMA_CLR_DST_TRN_Pos (0U) +#define DMA_CLR_DST_TRN_Len (8U) +#define DMA_CLR_DST_TRN_Msk (0xFFU << DMA_CLR_DST_TRN_Pos) +#define DMA_CLR_DST_TRN DMA_CLR_DST_TRN_Msk + +/******************* Bit definition for DMA_CLR_ERR register *****************/ +#define DMA_CLR_ERR_Pos (0U) +#define DMA_CLR_ERR_Len (8U) +#define DMA_CLR_ERR_Msk (0xFFU << DMA_CLR_ERR_Pos) +#define DMA_CLR_ERR DMA_CLR_ERR_Msk + +/******************* Bit definition for DMA_STATUS_INT register **************/ +#define DMA_STAT_INT_ERR_Pos (4U) +#define DMA_STAT_INT_ERR_Len (1U) +#define DMA_STAT_INT_ERR_Msk (0x1U << DMA_STAT_INT_ERR_Pos) +#define DMA_STAT_INT_ERR DMA_STAT_INT_ERR_Msk + +#define DMA_STAT_INT_DST_Pos (3U) +#define DMA_STAT_INT_DST_Len (1U) +#define DMA_STAT_INT_DST_Msk (0x1U << DMA_STAT_INT_DST_Pos) +#define DMA_STAT_INT_DST DMA_STAT_INT_DST_Msk + +#define DMA_STAT_INT_SRC_Pos (2U) +#define DMA_STAT_INT_SRC_Len (1U) +#define DMA_STAT_INT_SRC_Msk (0x1U << DMA_STAT_INT_SRC_Pos) +#define DMA_STAT_INT_SRC DMA_STAT_INT_SRC_Msk + +#define DMA_STAT_INT_BLK_Pos (1U) +#define DMA_STAT_INT_BLK_Len (1U) +#define DMA_STAT_INT_BLK_Msk (0x1U << DMA_STAT_INT_BLK_Pos) +#define DMA_STAT_INT_BLK DMA_STAT_INT_BLK_Msk + +#define DMA_STAT_INT_TFR_Pos (0U) +#define DMA_STAT_INT_TFR_Len (1U) +#define DMA_STAT_INT_TFR_Msk (0x1U << DMA_STAT_INT_TFR_Pos) +#define DMA_STAT_INT_TFR DMA_STAT_INT_TFR_Msk + +/******************* Bit definition for DMA_REQ_SRC_REG register *************/ +#define DMA_REQ_SRC_WE_Pos (8U) +#define DMA_REQ_SRC_WE_Len (8U) +#define DMA_REQ_SRC_WE_Msk (0xFFU << DMA_REQ_SRC_WE_Pos) +#define DMA_REQ_SRC_WE DMA_REQ_SRC_WE_Msk + +#define DMA_REQ_SRC_Pos (0U) +#define DMA_REQ_SRC_Len (8U) +#define DMA_REQ_SRC_Msk (0xFFU << DMA_REQ_SRC_Pos) +#define DMA_REQ_SRC DMA_REQ_SRC_Msk + +/******************* Bit definition for DMA_REQ_DST_REG register *************/ +#define DMA_REQ_DST_WE_Pos (8U) +#define DMA_REQ_DST_WE_Len (8U) +#define DMA_REQ_DST_WE_Msk (0xFFU << DMA_REQ_DST_WE_Pos) +#define DMA_REQ_DST_WE DMA_REQ_DST_WE_Msk + +#define DMA_REQ_DST_Pos (0U) +#define DMA_REQ_DST_Len (8U) +#define DMA_REQ_DST_Msk (0xFFU << DMA_REQ_DST_Pos) +#define DMA_REQ_DST DMA_REQ_DST_Msk + +/******************* Bit definition for DMA_SGL_REQ_SRC_REG register *********/ +#define DMA_SGL_REQ_SRC_WE_Pos (8U) +#define DMA_SGL_REQ_SRC_WE_Len (8U) +#define DMA_SGL_REQ_SRC_WE_Msk (0xFFU << DMA_SGL_REQ_SRC_WE_Pos) +#define DMA_SGL_REQ_SRC_WE DMA_SGL_REQ_SRC_WE_Msk + +#define DMA_SGL_REQ_SRC_Pos (0U) +#define DMA_SGL_REQ_SRC_Len (8U) +#define DMA_SGL_REQ_SRC_Msk (0xFFU << DMA_SGL_REQ_SRC_Pos) +#define DMA_SGL_REQ_SRC DMA_SGL_REQ_SRC_Msk + +/******************* Bit definition for DMA_SGL_REQ_DST_REG register *********/ +#define DMA_SGL_REQ_DST_WE_Pos (8U) +#define DMA_SGL_REQ_DST_WE_Len (8U) +#define DMA_SGL_REQ_DST_WE_Msk (0xFFU << DMA_SGL_REQ_DST_WE_Pos) +#define DMA_SGL_REQ_DST_WE DMA_SGL_REQ_DST_WE_Msk + +#define DMA_SGL_REQ_DST_Pos (0U) +#define DMA_SGL_REQ_DST_Len (8U) +#define DMA_SGL_REQ_DST_Msk (0xFFU << DMA_SGL_REQ_DST_Pos) +#define DMA_SGL_REQ_DST DMA_SGL_REQ_DST_Msk + +/******************* Bit definition for DMA_LST_SRC_REG register *********/ +#define DMA_LST_SRC_WE_Pos (8U) +#define DMA_LST_SRC_WE_Len (8U) +#define DMA_LST_SRC_WE_Msk (0xFFU << DMA_LST_SRC_WE_Pos) +#define DMA_LST_SRC_WE DMA_LST_SRC_WE_Msk + +#define DMA_LST_SRC_Pos (0U) +#define DMA_LST_SRC_Len (8U) +#define DMA_LST_SRC_Msk (0xFFU << DMA_LST_SRC_Pos) +#define DMA_LST_SRC DMA_LST_SRC_Msk + +/******************* Bit definition for DMA_LST_DST_REG register *********/ +#define DMA_LST_DST_WE_Pos (8U) +#define DMA_LST_DST_WE_Len (8U) +#define DMA_LST_DST_WE_Msk (0xFFU << DMA_LST_DST_WE_Pos) +#define DMA_LST_DST_WE DMA_LST_DST_WE_Msk + +#define DMA_LST_DST_Pos (0U) +#define DMA_LST_DST_Len (8U) +#define DMA_LST_DST_Msk (0xFFU << DMA_LST_DST_Pos) +#define DMA_LST_DST DMA_LST_DST_Msk + +/******************* Bit definition for DMA_CFG_REG register ****************/ +#define DMA_MODULE_CFG_EN_Pos (0U) +#define DMA_MODULE_CFG_EN_Len (1U) +#define DMA_MODULE_CFG_EN_Msk (0x1U << DMA_MODULE_CFG_EN_Pos) +#define DMA_MODULE_CFG_EN DMA_MODULE_CFG_EN_Msk + +/******************* Bit definition for DMA_CH_EN_REG register **************/ +#define DMA_CH_WE_EN_Pos (8U) +#define DMA_CH_WE_EN_Len (8U) +#define DMA_CH_WE_EN_Msk (0xFFU << DMA_CH_WE_EN_Pos) +#define DMA_CH_WE_EN DMA_CH_WE_EN_Msk + +#define DMA_CH_EN_Pos (0U) +#define DMA_CH_EN_Len (8U) +#define DMA_CH_EN_Msk (0xFFU << DMA_CH_EN_Pos) +#define DMA_CH_EN DMA_CH_EN_Msk + + +/* ================================================================================================================= */ +/* ================ DUAL_TIMER ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for DUAL_TIMER_RELOAD register ************/ +#define DUAL_TIMER_RELOAD_RELOAD_Pos (0U) +#define DUAL_TIMER_RELOAD_RELOAD_Len (32U) +#define DUAL_TIMER_RELOAD_RELOAD_Msk (0xFFFFFFFFU) +#define DUAL_TIMER_RELOAD_RELOAD DUAL_TIMER_RELOAD_RELOAD_Msk + +/******************* Bit definition for DUAL_TIMER_VALUE register *************/ +#define DUAL_TIMER_VALUE_VALUE_Pos (0U) +#define DUAL_TIMER_VALUE_VALUE_Len (32U) +#define DUAL_TIMER_VALUE_VALUE_Msk (0xFFFFFFFFU) +#define DUAL_TIMER_VALUE_VALUE DUAL_TIMER_VALUE_VALUE_Msk + +/******************* Bit definition for DUAL_TIMER_CTRL register **************/ +#define DUAL_TIMER_CTRL_EN_Pos (7U) +#define DUAL_TIMER_CTRL_EN_Len (1U) +#define DUAL_TIMER_CTRL_EN_Msk (0x1U << DUAL_TIMER_CTRL_EN_Pos) +#define DUAL_TIMER_CTRL_EN DUAL_TIMER_CTRL_EN_Msk + +#define DUAL_TIMER_CTRL_MODE_Pos (6U) +#define DUAL_TIMER_CTRL_MODE_Len (1U) +#define DUAL_TIMER_CTRL_MODE_Msk (0x1U << DUAL_TIMER_CTRL_MODE_Pos) +#define DUAL_TIMER_CTRL_MODE DUAL_TIMER_CTRL_MODE_Msk + +#define DUAL_TIMER_CTRL_INTEN_Pos (5U) +#define DUAL_TIMER_CTRL_INTEN_Len (1U) +#define DUAL_TIMER_CTRL_INTEN_Msk (0x1U << DUAL_TIMER_CTRL_INTEN_Pos) +#define DUAL_TIMER_CTRL_INTEN DUAL_TIMER_CTRL_INTEN_Msk + +#define DUAL_TIMER_CTRL_PRE_Pos (2U) +#define DUAL_TIMER_CTRL_PRE_Len (2U) +#define DUAL_TIMER_CTRL_PRE_Msk (0x3U << DUAL_TIMER_CTRL_PRE_Pos) +#define DUAL_TIMER_CTRL_PRE DUAL_TIMER_CTRL_PRE_Msk + +#define DUAL_TIMER_CTRL_SIZE_Pos (1U) +#define DUAL_TIMER_CTRL_SIZE_Len (1U) +#define DUAL_TIMER_CTRL_SIZE_Msk (0x1U << DUAL_TIMER_CTRL_SIZE_Pos) +#define DUAL_TIMER_CTRL_SIZE DUAL_TIMER_CTRL_SIZE_Msk + +#define DUAL_TIMER_CTRL_ONESHOT_Pos (0U) +#define DUAL_TIMER_CTRL_ONESHOT_Len (1U) +#define DUAL_TIMER_CTRL_ONESHOT_Msk (0x1U << DUAL_TIMER_CTRL_ONESHOT_Pos) +#define DUAL_TIMER_CTRL_ONESHOT DUAL_TIMER_CTRL_ONESHOT_Msk + +/******************* Bit definition for DUAL_TIMER_INT_CLR register ***********/ +#define DUAL_TIMER_INT_CLR_Pos (0U) +#define DUAL_TIMER_INT_CLR_Len (32U) +#define DUAL_TIMER_INT_CLR_Msk (0xFFFFFFFFU) +#define DUAL_TIMER_INT_CLR DUAL_TIMER_INT_CLR_Msk + +/******************* Bit definition for DUAL_TIMER_RAW_INT_STAT register ******/ +#define DUAL_TIMER_RIS_RTI_Pos (0U) +#define DUAL_TIMER_RIS_RTI_Len (1U) +#define DUAL_TIMER_RIS_RTI_Msk (0x1U << DUAL_TIMER_RIS_RTI_Pos) +#define DUAL_TIMER_RIS_RTI DUAL_TIMER_RIS_RTI_Msk + +/******************* Bit definition for DUAL_TIMER_INT_STAT register **********/ +#define DUAL_TIMER_ISR_TI_Pos (0U) +#define DUAL_TIMER_ISR_TI_Len (1U) +#define DUAL_TIMER_ISR_TI_Msk (0x1U << DUAL_TIMER_ISR_TI_Pos) +#define DUAL_TIMER_ISR_TI DUAL_TIMER_ISR_TI_Msk + +/******************* Bit definition for DUAL_TIMER_BGLOAD register ************/ +#define DUAL_TIMER_BLR_BL_Pos (0U) +#define DUAL_TIMER_BLR_BL_Len (32U) +#define DUAL_TIMER_BLR_BL_Msk (0xFFFFFFFFU) +#define DUAL_TIMER_BLR_BL DUAL_TIMER_BLR_BL_Msk + + +/* ================================================================================================================= */ +/* ================ GPIO ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for GPIO_DATA register ******************/ +#define GPIO_DATA_Pos (0U) +#define GPIO_DATA_Len (16U) +#define GPIO_DATA_Msk (0xFFFFU << GPIO_DATA_Pos) +#define GPIO_DATA GPIO_DATA_Msk /**< Data */ + +/******************* Bit definition for GPIO_DATAOUT register ***************/ +#define GPIO_DATAOUT_Pos (0U) +#define GPIO_DATAOUT_Len (16U) +#define GPIO_DATAOUT_Msk (0xFFFFU << GPIO_DATAOUT_Pos) +#define GPIO_DATAOUT GPIO_DATAOUT_Msk /**< Data Output */ + +/******************* Bit definition for GPIO_OUTENSET register ***************/ +#define GPIO_OUTENSET_Pos (0U) +#define GPIO_OUTENSET_Len (16U) +#define GPIO_OUTENSET_Msk (0xFFFFU << GPIO_OUTENSET_Pos) +#define GPIO_OUTENSET GPIO_OUTENSET_Msk /**< Data Output Enable Set*/ + +/******************* Bit definition for GPIO_OUTENCLR register ***************/ +#define GPIO_OUTENCLR_Pos (0U) +#define GPIO_OUTENCLR_Len (16U) +#define GPIO_OUTENCLR_Msk (0xFFFFU << GPIO_OUTENCLR_Pos) +#define GPIO_OUTENCLR GPIO_OUTENCLR_Msk /**< Data Output Enable Clear */ + +/******************* Bit definition for GPIO_INTENSET register ***************/ +#define GPIO_INTENSET_Pos (0U) +#define GPIO_INTENSET_Len (16U) +#define GPIO_INTENSET_Msk (0xFFFFU << GPIO_INTENSET_Pos) +#define GPIO_INTENSET GPIO_INTENSET_Msk /**< Interrupt Enable Set */ + +/******************* Bit definition for GPIO_INTENCLR register ***************/ +#define GPIO_INTENCLR_Pos (0U) +#define GPIO_INTENCLR_Len (16U) +#define GPIO_INTENCLR_Msk (0xFFFFU << GPIO_INTENCLR_Pos) +#define GPIO_INTENCLR GPIO_INTENCLR_Msk /**< Interrupt Enable clear */ + +/******************* Bit definition for GPIO_INTTYPESET register ***************/ +#define GPIO_INTTYPESET_Pos (0U) +#define GPIO_INTTYPESET_Len (16U) +#define GPIO_INTTYPESET_Msk (0xFFFFU << GPIO_INTTYPESET_Pos) +#define GPIO_INTTYPESET GPIO_INTTYPESET_Msk /**< Interrupt Type Set */ + +/******************* Bit definition for GPIO_INTTYPECLR register ***************/ +#define GPIO_INTTYPECLR_Pos (0U) +#define GPIO_INTTYPECLR_Len (16U) +#define GPIO_INTTYPECLR_Msk (0xFFFFU << GPIO_INTTYPECLR_Pos) +#define GPIO_INTTYPECLR GPIO_INTTYPECLR_Msk /**< Interrupt Type Clear */ + +/******************* Bit definition for GPIO_INTPOLSET register ***************/ +#define GPIO_INTPOLSET_Pos (0U) +#define GPIO_INTPOLSET_Len (16U) +#define GPIO_INTPOLSET_Msk (0xFFFFU << GPIO_INTPOLSET_Pos) +#define GPIO_INTPOLSET GPIO_INTPOLSET_Msk /**< Interrupt Polarity-level Set */ + +/******************* Bit definition for GPIO_INTPOLCLR register ***************/ +#define GPIO_INTPOLCLR_Pos (0U) +#define GPIO_INTPOLCLR_Len (16U) +#define GPIO_INTPOLCLR_Msk (0xFFFFU << GPIO_INTPOLCLR_Pos) +#define GPIO_INTPOLCLR GPIO_INTPOLCLR_Msk /**< Interrupt Polarity-level Clear */ + +/******************* Bit definition for GPIO_INTSTAT register ***************/ +#define GPIO_INTSTAT_Pos (0U) +#define GPIO_INTSTAT_Len (16U) +#define GPIO_INTSTAT_Msk (0xFFFFU << GPIO_INTSTAT_Pos) +#define GPIO_INTSTAT GPIO_INTSTAT_Msk /**< Interrupt Status */ + +/******************* Bit definition for GPIO_MASKLOWBYTE register ***********/ +#define GPIO_MASKLOWBYTE_DATA_Pos (0U) +#define GPIO_MASKLOWBYTE_DATA_Len (8U) +#define GPIO_MASKLOWBYTE_DATA_Msk (0xFFU << GPIO_MASKLOWBYTE_DATA_Pos) +#define GPIO_MASKLOWBYTE_DATA GPIO_MASKLOWBYTE_DATA_Msk /**< Lower eight bits masked access */ + +/******************* Bit definition for GPIO_MASKLOWBYTE register ***********/ +#define GPIO_MASKHIGHBYTE_DATA_Pos (8U) +#define GPIO_MASKHIGHBYTE_DATA_Len (8U) +#define GPIO_MASKHIGHBYTE_DATA_Msk (0xFFU << GPIO_MASKHIGHBYTE_DATA_Pos) +#define GPIO_MASKHIGHBYTE_DATA GPIO_MASKHIGHBYTE_DATA /**< Higher eight bits masked access */ + + +/* ================================================================================================================= */ +/* ================ HMAC ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for HMAC_CTRL register ******************/ +#define HMAC_CTRL_ENABLE_Pos (0U) +#define HMAC_CTRL_ENABLE_Len (1U) +#define HMAC_CTRL_ENABLE_Msk (1U << HMAC_CTRL_ENABLE_Pos) +#define HMAC_CTRL_ENABLE HMAC_CTRL_ENABLE_Msk + +#define HMAC_CTRL_START_DMA_Pos (1U) +#define HMAC_CTRL_START_DMA_Len (1U) +#define HMAC_CTRL_START_DMA_Msk (1U << HMAC_CTRL_START_DMA_Pos) +#define HMAC_CTRL_START_DMA HMAC_CTRL_START_DMA_Msk + +#define HMAC_CTRL_ENABLE_RKEY_Pos (2U) +#define HMAC_CTRL_ENABLE_RKEY_Len (1U) +#define HMAC_CTRL_ENABLE_RKEY_Msk (1U << HMAC_CTRL_ENABLE_RKEY_Pos) +#define HMAC_CTRL_ENABLE_RKEY HMAC_CTRL_ENABLE_RKEY_Msk + +#define HMAC_CTRL_LASTTRANSFER_Pos (3U) +#define HMAC_CTRL_LASTTRANSFER_Len (1U) +#define HMAC_CTRL_LASTTRANSFER_Msk (1U << HMAC_CTRL_LASTTRANSFER_Pos) +#define HMAC_CTRL_LASTTRANSFER HMAC_CTRL_LASTTRANSFER_Msk + +/******************* Bit definition for HMAC_CONFIG register ****************/ +#define HMAC_CONFIG_ENABLE_USERHASH_Pos (0U) +#define HMAC_CONFIG_ENABLE_USERHASH_Len (1U) +#define HMAC_CONFIG_ENABLE_USERHASH_Msk (1U << HMAC_CONFIG_ENABLE_USERHASH_Pos) +#define HMAC_CONFIG_ENABLE_USERHASH HMAC_CONFIG_ENABLE_USERHASH_Msk + +#define HMAC_CONFIG_ENDIAN_Pos (1U) +#define HMAC_CONFIG_ENDIAN_Len (1U) +#define HMAC_CONFIG_ENDIAN_Msk (1U << HMAC_CONFIG_ENDIAN_Pos) +#define HMAC_CONFIG_ENDIAN HMAC_CONFIG_ENDIAN_Msk + +#define HMAC_CONFIG_KEYTYPE_Pos (2U) +#define HMAC_CONFIG_KEYTYPE_Len (2U) +#define HMAC_CONFIG_KEYTYPE_Msk (3U << HMAC_CONFIG_KEYTYPE_Pos) +#define HMAC_CONFIG_KEYTYPE HMAC_CONFIG_KEYTYPE_Msk + +#define HMAC_CONFIG_CALCTYPE_Pos (4U) +#define HMAC_CONFIG_CALCTYPE_Len (1U) +#define HMAC_CONFIG_CALCTYPE_Msk (1U << HMAC_CONFIG_CALCTYPE_Pos) +#define HMAC_CONFIG_CALCTYPE HMAC_CONFIG_CALCTYPE_Msk + +#define HMAC_CONFIG_PRIVATE_Pos (5U) +#define HMAC_CONFIG_PRIVATE_Len (1U) +#define HMAC_CONFIG_PRIVATE_Msk (1U << HMAC_CONFIG_PRIVATE_Pos) +#define HMAC_CONFIG_PRIVATE HMAC_CONFIG_PRIVATE_Msk + +/******************* Bit definition for HMAC_STATUS register ****************/ +#define HMAC_STATUS_DATAREADY_SHA_Pos (0U) +#define HMAC_STATUS_DATAREADY_SHA_Len (1U) +#define HMAC_STATUS_DATAREADY_SHA_Msk (1U << HMAC_STATUS_DATAREADY_SHA_Pos) +#define HMAC_STATUS_DATAREADY_SHA HMAC_STATUS_DATAREADY_SHA_Msk + +#define HMAC_STATUS_MESSAGEDONE_DMA_Pos (1U) +#define HMAC_STATUS_MESSAGEDONE_DMA_Len (1U) +#define HMAC_STATUS_MESSAGEDONE_DMA_Msk (1U << HMAC_STATUS_MESSAGEDONE_DMA_Pos) +#define HMAC_STATUS_MESSAGEDONE_DMA HMAC_STATUS_MESSAGEDONE_DMA_Msk + +#define HMAC_STATUS_TRANSERR_DMA_Pos (2U) +#define HMAC_STATUS_TRANSERR_DMA_Len (1U) +#define HMAC_STATUS_TRANSERR_DMA_Msk (1U << HMAC_STATUS_TRANSERR_DMA_Pos) +#define HMAC_STATUS_TRANSERR_DMA HMAC_STATUS_TRANSERR_DMA_Msk + +#define HMAC_STATUS_KEYVALID_Pos (3U) +#define HMAC_STATUS_KEYVALID_Len (1U) +#define HMAC_STATUS_KEYVALID_Msk (1U << HMAC_STATUS_KEYVALID_Pos) +#define HMAC_STATUS_KEYVALID HMAC_STATUS_KEYVALID_Msk + +#define HMAC_STATUS_DATAREADY_HMAC_Pos (4U) +#define HMAC_STATUS_DATAREADY_HMAC_Len (1U) +#define HMAC_STATUS_DATAREADY_HMAC_Msk (1U << HMAC_STATUS_DATAREADY_HMAC_Pos) +#define HMAC_STATUS_DATAREADY_HMAC HMAC_STATUS_DATAREADY_HMAC_Msk + +#define HMAC_STATUS_TRANSDONE_DMA_Pos (5U) +#define HMAC_STATUS_TRANSDONE_DMA_Len (1U) +#define HMAC_STATUS_TRANSDONE_DMA_Msk (1U << HMAC_STATUS_TRANSDONE_DMA_Pos) +#define HMAC_STATUS_TRANSDONE_DMA HMAC_STATUS_TRANSDONE_DMA_Msk + +/******************* Bit definition for HMAC_TRAN_SIZE register *************/ +#define HMAC_TRANSIZE_Pos (0U) +#define HMAC_TRANSIZE_Len (15U) +#define HMAC_TRANSIZE_Msk (0x7FFFU << HMAC_TRANSIZE_Pos) +#define HMAC_TRANSIZE HMAC_TRANSIZE_Msk + +/******************* Bit definition for HMAC_INTERRUPT register *************/ +#define HMAC_INTERRUPT_DONE_Pos (0U) +#define HMAC_INTERRUPT_DONE_Len (1U) +#define HMAC_INTERRUPT_DONE_Msk (1U << HMAC_INTERRUPT_DONE_Pos) +#define HMAC_INTERRUPT_DONE HMAC_INTERRUPT_DONE_Msk + +#define HMAC_INTERRUPT_ENABLE_Pos (1U) +#define HMAC_INTERRUPT_ENABLE_Len (1U) +#define HMAC_INTERRUPT_ENABLE_Msk (1U << HMAC_INTERRUPT_ENABLE_Pos) +#define HMAC_INTERRUPT_ENABLE HMAC_INTERRUPT_ENABLE_Msk + +/******************* Bit definition for HMAC_RSTART_ADDR register ***********/ +#define HMAC_RSTART_ADDR_Pos (0U) +#define HMAC_RSTART_ADDR_Len (32U) +#define HMAC_RSTART_ADDR_Msk (0xFFFFFFFFU << HMAC_RSTART_ADDR_Pos) +#define HMAC_RSTART_ADDR HMAC_RSTART_ADDR_Msk + +/******************* Bit definition for HMAC_WSTART_ADDR register ***********/ +#define HMAC_WSTART_ADDR_Pos (0U) +#define HMAC_WSTART_ADDR_Len (32U) +#define HMAC_WSTART_ADDR_Msk (0xFFFFFFFFU << HMAC_WSTART_ADDR_Pos) +#define HMAC_WSTART_ADDR HMAC_WSTART_ADDR_Msk + +/******************* Bit definition for HMAC_USER_HASH register *************/ +#define HMAC_USERHASH_Pos (0U) +#define HMAC_USERHASH_Len (32U) +#define HMAC_USERHASH_Msk (0xFFFFFFFFU << HMAC_USERHASH_Pos) +#define HMAC_USERHASH HMAC_USERHASH_Msk + +/******************* Bit definition for HMAC_FIFO_OUT register **************/ +#define HMAC_FIFO_OUT_Pos (0U) +#define HMAC_FIFO_OUT_Len (32U) +#define HMAC_FIFO_OUT_Msk (0xFFFFFFFFU << HMAC_FIFO_OUT_Pos) +#define HMAC_FIFO_OUT HMAC_FIFO_OUT_Msk + +/******************* Bit definition for HMAC_MESSAGE_FIFO register **********/ +#define HMAC_FIFO_MESSAGE_Pos (0U) +#define HMAC_FIFO_MESSAGE_Len (32U) +#define HMAC_FIFO_MESSAGE_Msk (0xFFFFFFFFU << HMAC_FIFO_MESSAGE_Pos) +#define HMAC_FIFO_MESSAGE HMAC_FIFO_MESSAGE_Msk + +/******************* Bit definition for HMAC_KEY register *******************/ +#define HMAC_KEY_Pos (0U) +#define HMAC_KEY_Len (32U) +#define HMAC_KEY_Msk (0xFFFFFFFFU << HMAC_KEY_Pos) +#define HMAC_KEY HMAC_KEY_Msk + +/******************* Bit definition for HMAC_KEY_ADDR register **************/ +#define HMAC_KEY_ADDR_Pos (0U) +#define HMAC_KEY_ADDR_Len (32U) +#define HMAC_KEY_ADDR_Msk (0xFFFFFFFFU << HMAC_KEY_ADDR_Pos) +#define HMAC_KEY_ADDR HMAC_KEY_ADDR_Msk + +/******************* Bit definition for HMAC_KPORT_MASK register ************/ +#define HMAC_KPORT_MASK_Pos (0U) +#define HMAC_KPORT_MASK_Len (32U) +#define HMAC_KPORT_MASK_Msk (0xFFFFFFFFU << HMAC_KPORT_MASK_Pos) +#define HMAC_KPORT_MASK HMAC_KPORT_MASK_Msk + + +/* ================================================================================================================= */ +/* ================ I2C ================ */ +/* ================================================================================================================= */ +#define I2C_TXFIFO_SIZE (8U) +#define I2C_RXFIFO_SIZE (8U) + +/******************* Bit definition for IC_CON register *********************/ +#define I2C_CON_BUS_CLR_FEATURE_CTRL_Pos (11U) +#define I2C_CON_BUS_CLR_FEATURE_CTRL_Len (1U) +#define I2C_CON_BUS_CLR_FEATURE_CTRL_Msk (0x1U << I2C_CON_BUS_CLR_FEATURE_CTRL_Pos) +#define I2C_CON_BUS_CLR_FEATURE_CTRL I2C_CON_BUS_CLR_FEATURE_CTRL_Msk + +#define I2C_CON_STOP_DET_IF_MASTER_ACTIVE_Pos (10U) +#define I2C_CON_STOP_DET_IF_MASTER_ACTIVE_Len (1U) +#define I2C_CON_STOP_DET_IF_MASTER_ACTIVE_Msk (0x1U << I2C_CON_STOP_DET_IF_MASTER_ACTIVE_Pos) +#define I2C_CON_STOP_DET_IF_MASTER_ACTIVE I2C_CON_STOP_DET_IF_MASTER_ACTIVE_Msk + +#define I2C_CON_RX_FIFO_FULL_HLD_CTRL_Pos (9U) +#define I2C_CON_RX_FIFO_FULL_HLD_CTRL_Len (1U) +#define I2C_CON_RX_FIFO_FULL_HLD_CTRL_Msk (0x1U << I2C_CON_RX_FIFO_FULL_HLD_CTRL_Pos) +#define I2C_CON_RX_FIFO_FULL_HLD_CTRL I2C_CON_RX_FIFO_FULL_HLD_CTRL_Msk + +#define I2C_CON_TX_EMPTY_CTRL_Pos (8U) +#define I2C_CON_TX_EMPTY_CTRL_Len (1U) +#define I2C_CON_TX_EMPTY_CTRL_Msk (0x1U << I2C_CON_TX_EMPTY_CTRL_Pos) +#define I2C_CON_TX_EMPTY_CTRL I2C_CON_TX_EMPTY_CTRL_Msk + +#define I2C_CON_STOP_DET_IF_ADDRESSED_Pos (7U) +#define I2C_CON_STOP_DET_IF_ADDRESSED_Len (1U) +#define I2C_CON_STOP_DET_IF_ADDRESSED_Msk (0x1U << I2C_CON_STOP_DET_IF_ADDRESSED_Pos) +#define I2C_CON_STOP_DET_IF_ADDRESSED I2C_CON_STOP_DET_IF_ADDRESSED_Msk + +#define I2C_CON_SLV_DIS_Pos (6U) +#define I2C_CON_SLV_DIS_Len (1U) +#define I2C_CON_SLV_DIS_Msk (0x1U << I2C_CON_SLV_DIS_Pos) +#define I2C_CON_SLV_DIS I2C_CON_SLV_DIS_Msk + +#define I2C_CON_RESTART_EN_Pos (5U) +#define I2C_CON_RESTART_EN_Len (1U) +#define I2C_CON_RESTART_EN_Msk (0x1U << I2C_CON_RESTART_EN_Pos) +#define I2C_CON_RESTART_EN I2C_CON_RESTART_EN_Msk + +#define I2C_CON_10BITADDR_MST_Pos (4U) +#define I2C_CON_10BITADDR_MST_Len (1U) +#define I2C_CON_10BITADDR_MST_Msk (0x1U << I2C_CON_10BITADDR_MST_Pos) +#define I2C_CON_10BITADDR_MST I2C_CON_10BITADDR_MST_Msk + +#define I2C_CON_10BITADDR_SLV_Pos (3U) +#define I2C_CON_10BITADDR_SLV_Len (1U) +#define I2C_CON_10BITADDR_SLV_Msk (0x1U << I2C_CON_10BITADDR_SLV_Pos) +#define I2C_CON_10BITADDR_SLV I2C_CON_10BITADDR_SLV_Msk + +#define I2C_CON_SPEED_Pos (1U) +#define I2C_CON_SPEED_Len (2U) +#define I2C_CON_SPEED_Msk (0x3U << I2C_CON_SPEED_Pos) +#define I2C_CON_SPEED I2C_CON_SPEED_Msk +#define I2C_CON_SPEED_STANDARD (0x1U << I2C_CON_SPEED_Pos) +#define I2C_CON_SPEED_FAST (0x2U << I2C_CON_SPEED_Pos) +#define I2C_CON_SPEED_HIGH (0x3U << I2C_CON_SPEED_Pos) + +#define I2C_CON_MST_MODE_Pos (0U) +#define I2C_CON_MST_MODE_Len (1U) +#define I2C_CON_MST_MODE_Msk (0x1U << I2C_CON_MST_MODE_Pos) +#define I2C_CON_MST_MODE I2C_CON_MST_MODE_Msk + +/******************* Bit definition for IC_TAR register *********************/ +#define I2C_TAR_SPECIAL_Pos (11U) +#define I2C_TAR_SPECIAL_Len (1U) +#define I2C_TAR_SPECIAL_Msk (0x1U << I2C_TAR_SPECIAL_Pos) +#define I2C_TAR_SPECIAL I2C_TAR_SPECIAL_Msk + +#define I2C_TAR_GC_OR_START_Pos (10U) +#define I2C_TAR_GC_OR_START_Len (1U) +#define I2C_TAR_GC_OR_START_Msk (0x0U << I2C_TAR_GC_OR_START_Pos) +#define I2C_TAR_GC_OR_START I2C_TAR_GC_OR_START_Msk + +#define I2C_TAR_ADDR_Pos (0U) +#define I2C_TAR_ADDR_Len (10U) +#define I2C_TAR_ADDR_Msk (0x3FFU << I2C_TAR_ADDR_Pos) +#define I2C_TAR_ADDR I2C_TAR_ADDR_Msk +#define I2C_TAR_ADDR_7BIT (0x07FU << I2C_TAR_ADDR_Pos) +#define I2C_TAR_ADDR_10BIT (0x3FFU << I2C_TAR_ADDR_Pos) + +/******************* Bit definition for IC_SAR register *********************/ +#define I2C_SAR_ADDR_Pos (0U) +#define I2C_SAR_ADDR_Len (10U) +#define I2C_SAR_ADDR_Msk (0x3FFU << I2C_SAR_ADDR_Pos) +#define I2C_SAR_ADDR_7BIT (0x07FU << I2C_SAR_ADDR_Pos) +#define I2C_SAR_ADDR_10BIT (0x3FFU << I2C_SAR_ADDR_Pos) + +/******************* Bit definition for IC_HS_MADDR register ****************/ +#define I2C_HS_MADDR_HS_MAR_Pos (0U) +#define I2C_HS_MADDR_HS_MAR_Len (3U) +#define I2C_HS_MADDR_HS_MAR_Msk (0x7U << I2C_HS_MADDR_HS_MAR_Pos) +#define I2C_HS_MADDR_HS_MAR I2C_HS_MADDR_HS_MAR_Msk + +/******************* Bit definition for IC_DATA_CMD register ****************/ +#define I2C_DATA_CMD_RESTART_Pos (10U) +#define I2C_DATA_CMD_RESTART_Len (1U) +#define I2C_DATA_CMD_RESTART_Msk (0x1U << I2C_DATA_CMD_RESTART_Pos) +#define I2C_DATA_CMD_RESTART I2C_DATA_CMD_RESTART_Msk + +#define I2C_DATA_CMD_STOP_Pos (9U) +#define I2C_DATA_CMD_STOP_Len (1U) +#define I2C_DATA_CMD_STOP_Msk (0x1U << I2C_DATA_CMD_STOP_Pos) +#define I2C_DATA_CMD_STOP I2C_DATA_CMD_STOP_Msk + +#define I2C_DATA_CMD_CMD_Pos (8U) +#define I2C_DATA_CMD_CMD_Len (1U) +#define I2C_DATA_CMD_CMD_Msk (0x1U << I2C_DATA_CMD_CMD_Pos) +#define I2C_DATA_CMD_CMD I2C_DATA_CMD_CMD_Msk + +#define I2C_DATA_CMD_DAT_Pos (0U) +#define I2C_DATA_CMD_DAT_Len (8U) +#define I2C_DATA_CMD_DAT_Msk (0xFFU << I2C_DATA_CMD_DAT_Pos) +#define I2C_DATA_CMD_DAT I2C_DATA_CMD_DAT_Msk + +/******************* Bit definition for IC_SS_SCL_HCNT register *************/ +#define I2C_SS_SCL_HCNT_Pos (0U) +#define I2C_SS_SCL_HCNT_Len (16U) +#define I2C_SS_SCL_HCNT_Msk (0xFFFFU << I2C_SS_SCL_HCNT_Pos) +#define I2C_SS_SCL_HCNT I2C_SS_SCL_HCNT_Msk + +/******************* Bit definition for IC_SS_SCL_LCNT register *************/ +#define I2C_SS_SCL_LCNT_Pos (0U) +#define I2C_SS_SCL_LCNT_Len (16U) +#define I2C_SS_SCL_LCNT_Msk (0xFFFFU << I2C_SS_SCL_LCNT_Pos) +#define I2C_SS_SCL_LCNT I2C_SS_SCL_LCNT_Msk + +/******************* Bit definition for IC_FS_SCL_HCNT register *************/ +#define I2C_FS_SCL_HCNT_Pos (0U) +#define I2C_FS_SCL_HCNT_Len (16U) +#define I2C_FS_SCL_HCNT_Msk (0xFFFFU << I2C_FS_SCL_HCNT_Pos) +#define I2C_FS_SCL_HCNT I2C_FS_SCL_HCNT_Msk + +/******************* Bit definition for IC_FS_SCL_LCNT register *************/ +#define I2C_FS_SCL_LCNT_Pos (0U) +#define I2C_FS_SCL_LCNT_Len (16U) +#define I2C_FS_SCL_LCNT_Msk (0xFFFFU << I2C_FS_SCL_LCNT_Pos) +#define I2C_FS_SCL_LCNT I2C_FS_SCL_LCNT_Msk + +/******************* Bit definition for IC_HS_SCL_HCNT register *************/ +#define I2C_HS_SCL_HCNT_Pos (0U) +#define I2C_HS_SCL_HCNT_Len (16U) +#define I2C_HS_SCL_HCNT_Msk (0xFFFFU << I2C_HS_SCL_HCNT_Pos) +#define I2C_HS_SCL_HCNT I2C_HS_SCL_HCNT_Msk + +/******************* Bit definition for IC_HS_SCL_LCNT register *************/ +#define I2C_HS_SCL_LCNT_Pos (0U) +#define I2C_HS_SCL_LCNT_Len (16U) +#define I2C_HS_SCL_LCNT_Msk (0xFFFFU << I2C_HS_SCL_LCNT_Pos) +#define I2C_HS_SCL_LCNT I2C_HS_SCL_LCNT_Msk + +/** Bit definition for IC_INTR_STAT/IC_INTR_MASK/IC_RAW_INTR_STAT register **/ +#define I2C_INTR_ALL (0x3FFFU) + +#define I2C_INTR_MST_ON_HOLD_Pos (13U) +#define I2C_INTR_MST_ON_HOLD_Len (1U) +#define I2C_INTR_MST_ON_HOLD_Msk (0x1U << I2C_INTR_MST_ON_HOLD_Pos) +#define I2C_INTR_MST_ON_HOLD I2C_INTR_MST_ON_HOLD_Msk + +#define I2C_INTR_RESTART_DET_Pos (12U) +#define I2C_INTR_RESTART_DET_Len (1U) +#define I2C_INTR_RESTART_DET_Msk (0x1U << I2C_INTR_RESTART_DET_Pos) +#define I2C_INTR_RESTART_DET I2C_INTR_RESTART_DET_Msk + +#define I2C_INTR_GEN_CALL_Pos (11U) +#define I2C_INTR_GEN_CALL_Len (1U) +#define I2C_INTR_GEN_CALL_Msk (0x1U << I2C_INTR_GEN_CALL_Pos) +#define I2C_INTR_GEN_CALL I2C_INTR_GEN_CALL_Msk + +#define I2C_INTR_START_DET_Pos (10U) +#define I2C_INTR_START_DET_Len (1U) +#define I2C_INTR_START_DET_Msk (0x1U << I2C_INTR_START_DET_Pos) +#define I2C_INTR_START_DET I2C_INTR_START_DET_Msk + +#define I2C_INTR_STOP_DET_Pos (9U) +#define I2C_INTR_STOP_DET_Len (1U) +#define I2C_INTR_STOP_DET_Msk (0x1U << I2C_INTR_STOP_DET_Pos) +#define I2C_INTR_STOP_DET I2C_INTR_STOP_DET_Msk + +#define I2C_INTR_ACTIVITY_Pos (8U) +#define I2C_INTR_ACTIVITY_Len (1U) +#define I2C_INTR_ACTIVITY_Msk (0x1U << I2C_INTR_ACTIVITY_Pos) +#define I2C_INTR_ACTIVITY I2C_INTR_ACTIVITY_Msk + +#define I2C_INTR_RX_DONE_Pos (7U) +#define I2C_INTR_RX_DONE_Len (1U) +#define I2C_INTR_RX_DONE_Msk (0x1U << I2C_INTR_RX_DONE_Pos) +#define I2C_INTR_RX_DONE I2C_INTR_RX_DONE_Msk + +#define I2C_INTR_TX_ABRT_Pos (6U) +#define I2C_INTR_TX_ABRT_Len (1U) +#define I2C_INTR_TX_ABRT_Msk (0x1U << I2C_INTR_TX_ABRT_Pos) +#define I2C_INTR_TX_ABRT I2C_INTR_TX_ABRT_Msk + +#define I2C_INTR_RD_REQ_Pos (5U) +#define I2C_INTR_RD_REQ_Len (1U) +#define I2C_INTR_RD_REQ_Msk (0x1U << I2C_INTR_RD_REQ_Pos) +#define I2C_INTR_RD_REQ I2C_INTR_RD_REQ_Msk + +#define I2C_INTR_TX_EMPTY_Pos (4U) +#define I2C_INTR_TX_EMPTY_Len (1U) +#define I2C_INTR_TX_EMPTY_Msk (0x1U << I2C_INTR_TX_EMPTY_Pos) +#define I2C_INTR_TX_EMPTY I2C_INTR_TX_EMPTY_Msk + +#define I2C_INTR_TX_OVER_Pos (3U) +#define I2C_INTR_TX_OVER_Len (1U) +#define I2C_INTR_TX_OVER_Msk (0x1U << I2C_INTR_TX_OVER_Pos) +#define I2C_INTR_TX_OVER I2C_INTR_TX_OVER_Msk + +#define I2C_INTR_RX_FULL_Pos (2U) +#define I2C_INTR_RX_FULL_Len (1U) +#define I2C_INTR_RX_FULL_Msk (0x1U << I2C_INTR_RX_FULL_Pos) +#define I2C_INTR_RX_FULL I2C_INTR_RX_FULL_Msk + +#define I2C_INTR_RX_OVER_Pos (1U) +#define I2C_INTR_RX_OVER_Len (1U) +#define I2C_INTR_RX_OVER_Msk (0x1U << I2C_INTR_RX_OVER_Pos) +#define I2C_INTR_RX_OVER I2C_INTR_RX_OVER_Msk + +#define I2C_INTR_RX_UNDER_Pos (0U) +#define I2C_INTR_RX_UNDER_Len (1U) +#define I2C_INTR_RX_UNDER_Msk (0x1U << I2C_INTR_RX_UNDER_Pos) +#define I2C_INTR_RX_UNDER I2C_INTR_RX_UNDER_Msk + +/******************* Bit definition for IC_RX_TL register *******************/ +#define I2C_RX_TL_RXTL_Pos (0U) +#define I2C_RX_TL_RXTL_Len (8U) +#define I2C_RX_TL_RXTL_Msk (0xFFU << I2C_RX_TL_RXTL_Pos) +#define I2C_RX_TL_RXTL I2C_RX_TL_RXTL_Msk + +/******************* Bit definition for IC_TX_TL register *******************/ +#define I2C_TX_TL_TXTL_Pos (0U) +#define I2C_TX_TL_TXTL_Len (8U) +#define I2C_TX_TL_TXTL_Msk (0xFFU << I2C_TX_TL_TXTL_Pos) +#define I2C_TX_TL_TXTL I2C_TX_TL_TXTL_Msk + +/******************* Bit definition for IC_ENABLE register ******************/ +// #define I2C_ENABLE_TX_CMD_BLOCK_Pos (2U) +// #define I2C_ENABLE_TX_CMD_BLOCK_Len (1U) +// #define I2C_ENABLE_TX_CMD_BLOCK_Msk (0x1U << I2C_ENABLE_TX_CMD_BLOCK_Pos) +// #define I2C_ENABLE_TX_CMD_BLOCK I2C_ENABLE_TX_CMD_BLOCK_Msk +#define I2C_ENABLE_ABORT_Pos (1U) +#define I2C_ENABLE_ABORT_Len (1U) +#define I2C_ENABLE_ABORT_Msk (0x1U << I2C_ENABLE_ABORT_Pos) +#define I2C_ENABLE_ABORT I2C_ENABLE_ABORT_Msk + +#define I2C_ENABLE_ENABLE_Pos (0U) +#define I2C_ENABLE_ENABLE_Len (1U) +#define I2C_ENABLE_ENABLE_Msk (0x1U << I2C_ENABLE_ENABLE_Pos) +#define I2C_ENABLE_ENABLE I2C_ENABLE_ENABLE_Msk + +/******************* Bit definition for IC_STATUS register ******************/ +#define I2C_STATUS_SLV_ACTIVITY_Pos (6U) +#define I2C_STATUS_SLV_ACTIVITY_Len (1U) +#define I2C_STATUS_SLV_ACTIVITY_Msk (0x1U << I2C_STATUS_SLV_ACTIVITY_Pos) +#define I2C_STATUS_SLV_ACTIVITY I2C_STATUS_SLV_ACTIVITY_Msk + +#define I2C_STATUS_MST_ACTIVITY_Pos (5U) +#define I2C_STATUS_MST_ACTIVITY_Len (1U) +#define I2C_STATUS_MST_ACTIVITY_Msk (0x1U << I2C_STATUS_MST_ACTIVITY_Pos) +#define I2C_STATUS_MST_ACTIVITY I2C_STATUS_MST_ACTIVITY_Msk + +#define I2C_STATUS_RFF_Pos (4U) +#define I2C_STATUS_RFF_Len (1U) +#define I2C_STATUS_RFF_Msk (0x1U << I2C_STATUS_RFF_Pos) +#define I2C_STATUS_RFF I2C_STATUS_RFF_Msk + +#define I2C_STATUS_RFNE_Pos (3U) +#define I2C_STATUS_RFNE_Len (1U) +#define I2C_STATUS_RFNE_Msk (0x1U << I2C_STATUS_RFNE_Pos) +#define I2C_STATUS_RFNE I2C_STATUS_RFNE_Msk + +#define I2C_STATUS_TFE_Pos (2U) +#define I2C_STATUS_TFE_Len (1U) +#define I2C_STATUS_TFE_Msk (0x1U << I2C_STATUS_TFE_Pos) +#define I2C_STATUS_TFE I2C_STATUS_TFE_Msk + +#define I2C_STATUS_TFNF_Pos (1U) +#define I2C_STATUS_TFNF_Len (1U) +#define I2C_STATUS_TFNF_Msk (0x1U << I2C_STATUS_TFNF_Pos) +#define I2C_STATUS_TFNF I2C_STATUS_TFNF_Msk + +#define I2C_STATUS_ACTIVITY_Pos (0U) +#define I2C_STATUS_ACTIVITY_Len (1U) +#define I2C_STATUS_ACTIVITY_Msk (0x1U << I2C_STATUS_ACTIVITY_Pos) +#define I2C_STATUS_ACTIVITY I2C_STATUS_ACTIVITY_Msk + +/******************* Bit definition for IC_RXFLR register *******************/ +#define I2C_RXFLR_RXFLR_Pos (0U) +#define I2C_RXFLR_RXFLR_Len (8U) +#define I2C_RXFLR_RXFLR_Msk (0xFFU << I2C_RXFLR_RXFLR_Pos) +#define I2C_RXFLR_RXFLR I2C_RXFLR_RXFLR_Msk + +/******************* Bit definition for IC_TXFLR register *******************/ +#define I2C_TXFLR_TXFLR_Pos (0U) +#define I2C_TXFLR_TXFLR_Len (8U) +#define I2C_TXFLR_TXFLR_Msk (0xFFU << I2C_TXFLR_TXFLR_Pos) +#define I2C_TXFLR_TXFLR I2C_TXFLR_TXFLR_Msk + +/******************* Bit definition for IC_SDA_HOLD register *******************/ +#define I2C_SDA_HOLD_RX_HOLD_Pos (16U) +#define I2C_SDA_HOLD_RX_HOLD_Len (16U) +#define I2C_SDA_HOLD_RX_HOLD_Msk (0xFFFFU << I2C_SDA_HOLD_RX_HOLD_Pos) +#define I2C_SDA_HOLD_RX_HOLD I2C_SDA_HOLD_RX_HOLD_Msk + +#define I2C_SDA_HOLD_TX_HOLD_Pos (0U) +#define I2C_SDA_HOLD_TX_HOLD_Len (16U) +#define I2C_SDA_HOLD_TX_HOLD_Msk (0xFFFFU << I2C_SDA_HOLD_TX_HOLD_Pos) +#define I2C_SDA_HOLD_TX_HOLD I2C_SDA_HOLD_TX_HOLD_Msk + +/******************* Bit definition for IC_TX_ABRT_SOURCE register **********/ +#define I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Pos (23U) +#define I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Len (9U) +#define I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Msk (0x1FFU << I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Pos) +#define I2C_TX_ABRT_SRC_TX_FLUSH_CNT I2C_TX_ABRT_SRC_TX_FLUSH_CNT_Msk + +#define I2C_TX_ABRT_SRC_USER_ABRT_Pos (16U) +#define I2C_TX_ABRT_SRC_USER_ABRT_Len (1U) +#define I2C_TX_ABRT_SRC_USER_ABRT_Msk (0x1U << I2C_TX_ABRT_SRC_USER_ABRT_Pos) +#define I2C_TX_ABRT_SRC_USER_ABRT I2C_TX_ABRT_SRC_USER_ABRT_Msk + +#define I2C_TX_ABRT_SRC_SLVRD_INTX_Pos (15U) +#define I2C_TX_ABRT_SRC_SLVRD_INTX_Len (1U) +#define I2C_TX_ABRT_SRC_SLVRD_INTX_Msk (0x1U << I2C_TX_ABRT_SRC_SLVRD_INTX_Pos) +#define I2C_TX_ABRT_SRC_SLVRD_INTX I2C_TX_ABRT_SRC_SLVRD_INTX_Msk + +#define I2C_TX_ABRT_SRC_SLV_ARBLOST_Pos (14U) +#define I2C_TX_ABRT_SRC_SLV_ARBLOST_Len (1U) +#define I2C_TX_ABRT_SRC_SLV_ARBLOST_Msk (0x1U << I2C_TX_ABRT_SRC_SLV_ARBLOST_Pos) +#define I2C_TX_ABRT_SRC_SLV_ARBLOST I2C_TX_ABRT_SRC_SLV_ARBLOST_Msk + +#define I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO_Pos (13U) +#define I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO_Len (1U) +#define I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO_Msk (0x1U << I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO_Pos) +#define I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO I2C_TX_ABRT_SRC_SLVFLUSH_TXFIFO_Msk + +#define I2C_TX_ABRT_SRC_ARB_LOST_Pos (12U) +#define I2C_TX_ABRT_SRC_ARB_LOST_Len (1U) +#define I2C_TX_ABRT_SRC_ARB_LOST_Msk (0x1U << I2C_TX_ABRT_SRC_ARB_LOST_Pos) +#define I2C_TX_ABRT_SRC_ARB_LOST I2C_TX_ABRT_SRC_ARB_LOST_Msk + +#define I2C_TX_ABRT_SRC_MST_DIS_Pos (11U) +#define I2C_TX_ABRT_SRC_MST_DIS_Len (1U) +#define I2C_TX_ABRT_SRC_MST_DIS_Msk (0x1U << I2C_TX_ABRT_SRC_MST_DIS_Pos) +#define I2C_TX_ABRT_SRC_MST_DIS I2C_TX_ABRT_SRC_MST_DIS_Msk + +#define I2C_TX_ABRT_SRC_10B_RD_NORSTRT_Pos (10U) +#define I2C_TX_ABRT_SRC_10B_RD_NORSTRT_Len (1U) +#define I2C_TX_ABRT_SRC_10B_RD_NORSTRT_Msk (0x1U << I2C_TX_ABRT_SRC_10B_RD_NORSTRT_Pos) +#define I2C_TX_ABRT_SRC_10B_RD_NORSTRT I2C_TX_ABRT_SRC_10B_RD_NORSTRT_Msk + +#define I2C_TX_ABRT_SRC_SBYTE_NORSTRT_Pos (9U) +#define I2C_TX_ABRT_SRC_SBYTE_NORSTRT_Len (1U) +#define I2C_TX_ABRT_SRC_SBYTE_NORSTRT_Msk (0x1U << I2C_TX_ABRT_SRC_SBYTE_NORSTRT_Pos) +#define I2C_TX_ABRT_SRC_SBYTE_NORSTRT I2C_TX_ABRT_SRC_SBYTE_NORSTRT_Msk + +#define I2C_TX_ABRT_SRC_HS_NORSTRT_Pos (8U) +#define I2C_TX_ABRT_SRC_HS_NORSTRT_Len (1U) +#define I2C_TX_ABRT_SRC_HS_NORSTRT_Msk (0x1U << I2C_TX_ABRT_SRC_HS_NORSTRT_Pos) +#define I2C_TX_ABRT_SRC_HS_NORSTRT I2C_TX_ABRT_SRC_HS_NORSTRT_Msk + +#define I2C_TX_ABRT_SRC_SBYTE_ACKDET_Pos (7U) +#define I2C_TX_ABRT_SRC_SBYTE_ACKDET_Len (1U) +#define I2C_TX_ABRT_SRC_SBYTE_ACKDET_Msk (0x1U << I2C_TX_ABRT_SRC_SBYTE_ACKDET_Pos) +#define I2C_TX_ABRT_SRC_SBYTE_ACKDET I2C_TX_ABRT_SRC_SBYTE_ACKDET_Msk + +#define I2C_TX_ABRT_SRC_HS_ACKDET_Pos (6U) +#define I2C_TX_ABRT_SRC_HS_ACKDET_Len (1U) +#define I2C_TX_ABRT_SRC_HS_ACKDET_Msk (0x1U << I2C_TX_ABRT_SRC_HS_ACKDET_Pos) +#define I2C_TX_ABRT_SRC_HS_ACKDET I2C_TX_ABRT_SRC_HS_ACKDET_Msk + +#define I2C_TX_ABRT_SRC_GCALL_READ_Pos (5U) +#define I2C_TX_ABRT_SRC_GCALL_READ_Len (1U) +#define I2C_TX_ABRT_SRC_GCALL_READ_Msk (0x1U << I2C_TX_ABRT_SRC_GCALL_READ_Pos) +#define I2C_TX_ABRT_SRC_GCALL_READ I2C_TX_ABRT_SRC_GCALL_READ_Msk + +#define I2C_TX_ABRT_SRC_GCALL_NOACK_Pos (4U) +#define I2C_TX_ABRT_SRC_GCALL_NOACK_Len (1U) +#define I2C_TX_ABRT_SRC_GCALL_NOACK_Msk (0x1U << I2C_TX_ABRT_SRC_GCALL_NOACK_Pos) +#define I2C_TX_ABRT_SRC_GCALL_NOACK I2C_TX_ABRT_SRC_GCALL_NOACK_Msk + +#define I2C_TX_ABRT_SRC_TXDATA_NOACK_Pos (3U) +#define I2C_TX_ABRT_SRC_TXDATA_NOACK_Len (1U) +#define I2C_TX_ABRT_SRC_TXDATA_NOACK_Msk (0x1U << I2C_TX_ABRT_SRC_TXDATA_NOACK_Pos) +#define I2C_TX_ABRT_SRC_TXDATA_NOACK I2C_TX_ABRT_SRC_TXDATA_NOACK_Msk + +#define I2C_TX_ABRT_SRC_10ADDR2_NOACK_Pos (2U) +#define I2C_TX_ABRT_SRC_10ADDR2_NOACK_Len (1U) +#define I2C_TX_ABRT_SRC_10ADDR2_NOACK_Msk (0x1U << I2C_TX_ABRT_SRC_10ADDR2_NOACK_Pos) +#define I2C_TX_ABRT_SRC_10ADDR2_NOACK I2C_TX_ABRT_SRC_10ADDR2_NOACK_Msk + +#define I2C_TX_ABRT_SRC_10ADDR1_NOACK_Pos (1U) +#define I2C_TX_ABRT_SRC_10ADDR1_NOACK_Len (1U) +#define I2C_TX_ABRT_SRC_10ADDR1_NOACK_Msk (0x1U << I2C_TX_ABRT_SRC_10ADDR1_NOACK_Pos) +#define I2C_TX_ABRT_SRC_10ADDR1_NOACK I2C_TX_ABRT_SRC_10ADDR1_NOACK_Msk + +#define I2C_TX_ABRT_SRC_7B_ADDR_NOACK_Pos (0U) +#define I2C_TX_ABRT_SRC_7B_ADDR_NOACK_Len (1U) +#define I2C_TX_ABRT_SRC_7B_ADDR_NOACK_Msk (0x1U << I2C_TX_ABRT_SRC_7B_ADDR_NOACK_Pos) +#define I2C_TX_ABRT_SRC_7B_ADDR_NOACK I2C_TX_ABRT_SRC_7B_ADDR_NOACK_Msk + +/******************* Bit definition for IC_DMA_CR register *******************/ +#define I2C_DMA_CR_TDMAE_Pos (1U) +#define I2C_DMA_CR_TDMAE_Len (1U) +#define I2C_DMA_CR_TDMAE_Msk (0x1U << I2C_DMA_CR_TDMAE_Pos) +#define I2C_DMA_CR_TDMAE I2C_DMA_CR_TDMAE_Msk + +#define I2C_DMA_CR_RDMAE_Pos (0U) +#define I2C_DMA_CR_RDMAE_Len (1U) +#define I2C_DMA_CR_RDMAE_Msk (0x1U << I2C_DMA_CR_RDMAE_Pos) +#define I2C_DMA_CR_RDMAE I2C_DMA_CR_RDMAE_Msk + +/******************* Bit definition for IC_DMA_TDLR register ****************/ +#define I2C_DMA_TDLR_DMATDL_Pos (0U) +#define I2C_DMA_TDLR_DMATDL_Len (8U) +#define I2C_DMA_TDLR_DMATDL_Msk (0xFFU << I2C_DMA_TDLR_DMATDL_Pos) +#define I2C_DMA_TDLR_DMATDL I2C_DMA_TDLR_DMATDL_Msk + +/******************* Bit definition for IC_DMA_RDLR register ****************/ +#define I2C_DMA_RDLR_DMARDL_Pos (0U) +#define I2C_DMA_RDLR_DMARDL_Len (8U) +#define I2C_DMA_RDLR_DMARDL_Msk (0xFFU << I2C_DMA_RDLR_DMARDL_Pos) +#define I2C_DMA_RDLR_DMARDL I2C_DMA_RDLR_DMARDL_Msk + +/******************* Bit definition for IC_SDA_SETUP register ***************/ +#define I2C_SDA_SETUP_SDA_SETUP_Pos (0U) +#define I2C_SDA_SETUP_SDA_SETUP_Len (8U) +#define I2C_SDA_SETUP_SDA_SETUP_Msk (0xFFU << I2C_SDA_SETUP_SDA_SETUP_Pos) +#define I2C_SDA_SETUP_SDA_SETUP I2C_SDA_SETUP_SDA_SETUP_Msk + +/******************* Bit definition for IC_ACK_GENERAL_CALL register ********/ +#define I2C_ACK_GENERAL_CALL_ACK_GC_Pos (0U) +#define I2C_ACK_GENERAL_CALL_ACK_GC_Len (1U) +#define I2C_ACK_GENERAL_CALL_ACK_GC_Msk (0x1U << I2C_ACK_GENERAL_CALL_ACK_GC_Pos) +#define I2C_ACK_GENERAL_CALL_ACK_GC I2C_ACK_GENERAL_CALL_ACK_GC_Msk + +/******************* Bit definition for IC_ENABLE_STATUS register ***********/ +#define I2C_ENABLE_STATUS_SLV_RX_LOST_Pos (2U) +#define I2C_ENABLE_STATUS_SLV_RX_LOST_Len (1U) +#define I2C_ENABLE_STATUS_SLV_RX_LOST_Msk (0x1U << I2C_ENABLE_STATUS_SLV_RX_LOST_Pos) +#define I2C_ENABLE_STATUS_SLV_RX_LOST I2C_ENABLE_STATUS_SLV_RX_LOST_Msk + +#define I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY_Pos (1U) +#define I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY_Len (1U) +#define I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY_Msk (0x1U << I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY_Pos) +#define I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY I2C_ENABLE_STATUS_SLV_DIS_WHL_BUSY_Msk + +#define I2C_ENABLE_STATUS_IC_EN_Pos (0U) +#define I2C_ENABLE_STATUS_IC_EN_Len (1U) +#define I2C_ENABLE_STATUS_IC_EN_Msk (0x1U << I2C_ENABLE_STATUS_IC_EN_Pos) +#define I2C_ENABLE_STATUS_IC_EN I2C_ENABLE_STATUS_IC_EN_Msk + +/******************* Bit definition for IC_FS_SPKLEN register ***************/ +#define I2C_FS_SPKLEN_FS_SPKLEN_Pos (0U) +#define I2C_FS_SPKLEN_FS_SPKLEN_Len (8U) +#define I2C_FS_SPKLEN_FS_SPKLEN_Msk (0xFFU << I2C_FS_SPKLEN_FS_SPKLEN_Pos) +#define I2C_FS_SPKLEN_FS_SPKLEN I2C_FS_SPKLEN_FS_SPKLEN_Msk + +/******************* Bit definition for IC_HS_SPKLEN register ***************/ +#define I2C_HS_SPKLEN_HS_SPKLEN_Pos (0U) +#define I2C_HS_SPKLEN_HS_SPKLEN_Len (8U) +#define I2C_HS_SPKLEN_HS_SPKLEN_Msk (0xFFU << I2C_HS_SPKLEN_HS_SPKLEN_Pos) +#define I2C_HS_SPKLEN_HS_SPKLEN I2C_HS_SPKLEN_HS_SPKLEN_Msk + + +/* ================================================================================================================= */ +/* ================ I2S ================ */ +/* ================================================================================================================= */ +#define I2S_TXFIFO_SIZE (16U) +#define I2S_RXFIFO_SIZE (16U) + +/******************* Bit definition for ENABLE register *********************/ +#define I2S_ENABLE_EN_Pos (0U) +#define I2S_ENABLE_EN_Len (1U) +#define I2S_ENABLE_EN_Msk (0x1U << I2S_ENABLE_EN_Pos) +#define I2S_ENABLE_EN I2S_ENABLE_EN_Msk + +/******************* Bit definition for RBEN register ***********************/ +#define I2S_RBEN_EN_Pos (0U) +#define I2S_RBEN_EN_Len (1U) +#define I2S_RBEN_EN_Msk (0x1U << I2S_RBEN_EN_Pos) +#define I2S_RBEN_EN I2S_RBEN_EN_Msk + +/******************* Bit definition for TBEN register ***********************/ +#define I2S_TBEN_EN_Pos (0U) +#define I2S_TBEN_EN_Len (1U) +#define I2S_TBEN_EN_Msk (0x1U << I2S_TBEN_EN_Pos) +#define I2S_TBEN_EN I2S_TBEN_EN_Msk + +/******************* Bit definition for CLKEN register **********************/ +#define I2S_CLKEN_EN_Pos (0U) +#define I2S_CLKEN_EN_Len (1U) +#define I2S_CLKEN_EN_Msk (0x1U << I2S_CLKEN_EN_Pos) +#define I2S_CLKEN_EN I2S_CLKEN_EN_Msk + +/***************** Bit definition for CLKCONFIG register ********************/ +#define I2S_CLKCONFIG_WSS_Pos (3U) +#define I2S_CLKCONFIG_WSS_Len (2U) +#define I2S_CLKCONFIG_WSS_Msk (0x3U << I2S_CLKCONFIG_WSS_Pos) +#define I2S_CLKCONFIG_WSS I2S_CLKCONFIG_WSS_Msk + +#define I2S_CLKCONFIG_SCLKG_Pos (0U) +#define I2S_CLKCONFIG_SCLKG_Len (3U) +#define I2S_CLKCONFIG_SCLKG_Msk (0x7U << I2S_CLKCONFIG_SCLKG_Pos) +#define I2S_CLKCONFIG_SCLKG I2S_CLKCONFIG_SCLKG_Msk + +/***************** Bit definition for RXFIFO_RST register *******************/ +#define I2S_RXFIFO_RST_Pos (0U) +#define I2S_RXFIFO_RST_Len (1U) +#define I2S_RXFIFO_RST_Msk (0x1U << I2S_RXFIFO_RST_Pos) +#define I2S_RXFIFO_RST I2S_RXFIFO_RST_Msk + +/***************** Bit definition for TXFIFO_RST register *******************/ +#define I2S_TXFIFO_RST_Pos (0U) +#define I2S_TXFIFO_RST_Len (1U) +#define I2S_TXFIFO_RST_Msk (0x1U << I2S_TXFIFO_RST_Pos) +#define I2S_TXFIFO_RST I2S_TXFIFO_RST_Msk + +/******************* Bit definition for DATA_L register *********************/ +#define I2S_DATA_L_Pos (0U) +#define I2S_DATA_L_Len (32U) +#define I2S_DATA_L_Msk (0xFFFFFFFFU) +#define I2S_DATA_L I2S_DATA_L_Msk + +/******************* Bit definition for DATA_R register *********************/ +#define I2S_DATA_R_Pos (0U) +#define I2S_DATA_R_Len (32U) +#define I2S_DATA_R_Msk (0xFFFFFFFFU) +#define I2S_DATA_R I2S_DATA_R_Msk + +/******************** Bit definition for RXEN register **********************/ +#define I2S_RXEN_EN_Pos (0U) +#define I2S_RXEN_EN_Len (1U) +#define I2S_RXEN_EN_Msk (0x1U << I2S_RXEN_EN_Pos) +#define I2S_RXEN_EN I2S_RXEN_EN_Msk + +/******************** Bit definition for TXEN register **********************/ +#define I2S_TXEN_EN_Pos (0U) +#define I2S_TXEN_EN_Len (1U) +#define I2S_TXEN_EN_Msk (0x1U << I2S_TXEN_EN_Pos) +#define I2S_TXEN_EN I2S_TXEN_EN_Msk + +/******************* Bit definition for RXSIZE register *********************/ +#define I2S_RXSIZE_WLEN_Pos (0U) +#define I2S_RXSIZE_WLEN_Len (3U) +#define I2S_RXSIZE_WLEN_Msk (0x7U << I2S_RXSIZE_WLEN_Pos) +#define I2S_RXSIZE_WLEN I2S_RXSIZE_WLEN_Msk + +/******************* Bit definition for TXSIZE register *********************/ +#define I2S_TXSIZE_WLEN_Pos (0U) +#define I2S_TXSIZE_WLEN_Len (3U) +#define I2S_TXSIZE_WLEN_Msk (0x7U << I2S_TXSIZE_WLEN_Pos) +#define I2S_TXSIZE_WLEN I2S_TXSIZE_WLEN_Msk + +/******************* Bit definition for INTSTAT register ********************/ +#define I2S_INTSTAT_TXFO_Pos (5U) +#define I2S_INTSTAT_TXFO_Len (1U) +#define I2S_INTSTAT_TXFO_Msk (0x1U << I2S_INTSTAT_TXFO_Pos) +#define I2S_INTSTAT_TXFO I2S_INTSTAT_TXFO_Msk + +#define I2S_INTSTAT_TXFE_Pos (4U) +#define I2S_INTSTAT_TXFE_Len (1U) +#define I2S_INTSTAT_TXFE_Msk (0x1U << I2S_INTSTAT_TXFE_Pos) +#define I2S_INTSTAT_TXFE I2S_INTSTAT_TXFE_Msk + +#define I2S_INTSTAT_RXFO_Pos (1U) +#define I2S_INTSTAT_RXFO_Len (1U) +#define I2S_INTSTAT_RXFO_Msk (0x1U << I2S_INTSTAT_RXFO_Pos) +#define I2S_INTSTAT_RXFO I2S_INTSTAT_RXFO_Msk + +#define I2S_INTSTAT_RXDA_Pos (0U) +#define I2S_INTSTAT_RXDA_Len (1U) +#define I2S_INTSTAT_RXDA_Msk (0x1U << I2S_INTSTAT_RXDA_Pos) +#define I2S_INTSTAT_RXDA I2S_INTSTAT_RXDA_Msk + +/******************* Bit definition for INTMASK register ********************/ +#define I2S_INTMASK_TXFO_Pos (5U) +#define I2S_INTMASK_TXFO_Len (1U) +#define I2S_INTMASK_TXFO_Msk (0x1U << I2S_INTSTAT_TXFO_Pos) +#define I2S_INTMASK_TXFO I2S_INTSTAT_TXFO_Msk + +#define I2S_INTMASK_TXFE_Pos (4U) +#define I2S_INTMASK_TXFE_Len (1U) +#define I2S_INTMASK_TXFE_Msk (0x1U << I2S_INTSTAT_TXFE_Pos) +#define I2S_INTMASK_TXFE I2S_INTSTAT_TXFE_Msk + +#define I2S_INTMASK_RXFO_Pos (1U) +#define I2S_INTMASK_RXFO_Len (1U) +#define I2S_INTMASK_RXFO_Msk (0x1U << I2S_INTSTAT_RXFO_Pos) +#define I2S_INTMASK_RXFO I2S_INTSTAT_RXFO_Msk + +#define I2S_INTMASK_RXDA_Pos (0U) +#define I2S_INTMASK_RXDA_Len (1U) +#define I2S_INTMASK_RXDA_Msk (0x1U << I2S_INTSTAT_RXDA_Pos) +#define I2S_INTMASK_RXDA I2S_INTSTAT_RXDA_Msk + +/******************** Bit definition for RXOVR register *********************/ +#define I2S_RXOVR_RXCHO_Pos (0U) +#define I2S_RXOVR_RXCHO_Len (1U) +#define I2S_RXOVR_RXCHO_Msk (0x1U << I2S_RXOVR_RXCHO_Pos) +#define I2S_RXOVR_RXCHO I2S_RXOVR_RXCHO_Msk + +/******************** Bit definition for TXOVR register *********************/ +#define I2S_TXOVR_TXCHO_Pos (0U) +#define I2S_TXOVR_TXCHO_Len (1U) +#define I2S_TXOVR_TXCHO_Msk (0x1U << I2S_TXOVR_TXCHO_Pos) +#define I2S_TXOVR_TXCHO I2S_TXOVR_TXCHO_Msk + +/****************** Bit definition for RXFIFO_TL register *******************/ +#define I2S_RXFIFO_TL_Pos (0U) +#define I2S_RXFIFO_TL_Len (4U) +#define I2S_RXFIFO_TL_Msk (0xFU << I2S_RXFIFO_TL_Pos) +#define I2S_RXFIFO_TL I2S_RXFIFO_TL_Msk + +/****************** Bit definition for TXFIFO_TL register *******************/ +#define I2S_TXFIFO_TL_Pos (0U) +#define I2S_TXFIFO_TL_Len (4U) +#define I2S_TXFIFO_TL_Msk (0xFU << I2S_TXFIFO_TL_Pos) +#define I2S_TXFIFO_TL I2S_TXFIFO_TL_Msk + +/**************** Bit definition for RXFIFO_FLUSH register ******************/ +#define I2S_RXFIFO_FLUSH_Pos (0U) +#define I2S_RXFIFO_FLUSH_Len (1U) +#define I2S_RXFIFO_FLUSH_Msk (0x1U << I2S_RXFIFO_FLUSH_Pos) +#define I2S_RXFIFO_FLUSH I2S_RXFIFO_FLUSH_Msk + +/**************** Bit definition for TXFIFO_FLUSH register ******************/ +#define I2S_TXFIFO_FLUSH_Pos (0U) +#define I2S_TXFIFO_FLUSH_Len (1U) +#define I2S_TXFIFO_FLUSH_Msk (0x1U << I2S_TXFIFO_FLUSH_Pos) +#define I2S_TXFIFO_FLUSH I2S_TXFIFO_FLUSH_Msk + +/******************** Bit definition for RXDMA register *********************/ +#define I2S_RXDMA_Pos (0U) +#define I2S_RXDMA_Len (32U) +#define I2S_RXDMA_Msk (0xFFFFFFFFU) +#define I2S_RXDMA I2S_RXDMA_Msk + +/****************** Bit definition for RXDMA_RST register *******************/ +#define I2S_RXDMA_RST_Pos (0U) +#define I2S_RXDMA_RST_Len (1U) +#define I2S_RXDMA_RST_Msk (0x1U << I2S_RXDMA_RST_Pos) +#define I2S_RXDMA_RST I2S_RXDMA_RST_Msk + +/******************** Bit definition for TXDMA register *********************/ +#define I2S_TXDMA_Pos (0U) +#define I2S_TXDMA_Len (32U) +#define I2S_TXDMA_Msk (0xFFFFFFFFU) +#define I2S_TXDMA I2S_TXDMA_Msk + +/****************** Bit definition for TXDMA_RST register *******************/ +#define I2S_TXDMA_RST_Pos (0U) +#define I2S_TXDMA_RST_Len (1U) +#define I2S_TXDMA_RST_Msk (0x1U << I2S_TXDMA_RST_Pos) +#define I2S_TXDMA_RST I2S_TXDMA_RST_Msk + +/****************** Bit definition for I2S_PARAM2 register ******************/ +#define I2S_PARAM2_RXSIZE_3_Pos (10U) +#define I2S_PARAM2_RXSIZE_3_Len (3U) +#define I2S_PARAM2_RXSIZE_3_Msk (0x7U << I2S_PARAM2_RXSIZE_3_Pos) +#define I2S_PARAM2_RXSIZE_3 I2S_PARAM2_RXSIZE_3_Msk + +#define I2S_PARAM2_RXSIZE_2_Pos (7U) +#define I2S_PARAM2_RXSIZE_2_Len (3U) +#define I2S_PARAM2_RXSIZE_2_Msk (0x7U << I2S_PARAM2_RXSIZE_2_Pos) +#define I2S_PARAM2_RXSIZE_2 I2S_PARAM2_RXSIZE_2_Msk + +#define I2S_PARAM2_RXSIZE_1_Pos (3U) +#define I2S_PARAM2_RXSIZE_1_Len (3U) +#define I2S_PARAM2_RXSIZE_1_Msk (0x7U << I2S_PARAM2_RXSIZE_1_Pos) +#define I2S_PARAM2_RXSIZE_1 I2S_PARAM2_RXSIZE_1_Msk + +#define I2S_PARAM2_RXSIZE_0_Pos (0U) +#define I2S_PARAM2_RXSIZE_0_Len (3U) +#define I2S_PARAM2_RXSIZE_0_Msk (0x7U << I2S_PARAM2_RXSIZE_0_Pos) +#define I2S_PARAM2_RXSIZE_0 I2S_PARAM2_RXSIZE_0_Msk + +/****************** Bit definition for I2S_PARAM1 register ******************/ +#define I2S_PARAM1_TXSIZE_3_Pos (25U) +#define I2S_PARAM1_TXSIZE_3_Len (3U) +#define I2S_PARAM1_TXSIZE_3_Msk (0x7U << I2S_PARAM1_TXSIZE_3_Pos) +#define I2S_PARAM1_TXSIZE_3 I2S_PARAM1_TXSIZE_3_Msk + +#define I2S_PARAM1_TXSIZE_2_Pos (22U) +#define I2S_PARAM1_TXSIZE_2_Len (3U) +#define I2S_PARAM1_TXSIZE_2_Msk (0x7U << I2S_PARAM1_TXSIZE_2_Pos) +#define I2S_PARAM1_TXSIZE_2 I2S_PARAM1_TXSIZE_2_Msk + +#define I2S_PARAM1_TXSIZE_1_Pos (19U) +#define I2S_PARAM1_TXSIZE_1_Len (3U) +#define I2S_PARAM1_TXSIZE_1_Msk (0x7U << I2S_PARAM1_TXSIZE_1_Pos) +#define I2S_PARAM1_TXSIZE_1 I2S_PARAM1_TXSIZE_1_Msk + +#define I2S_PARAM1_TXSIZE_0_Pos (16U) +#define I2S_PARAM1_TXSIZE_0_Len (3U) +#define I2S_PARAM1_TXSIZE_0_Msk (0x7U << I2S_PARAM1_TXSIZE_0_Pos) +#define I2S_PARAM1_TXSIZE_0 I2S_PARAM1_TXSIZE_0_Msk + +#define I2S_PARAM1_TXCHN_Pos (9U) +#define I2S_PARAM1_TXCHN_Len (2U) +#define I2S_PARAM1_TXCHN_Msk (0x3U << I2S_PARAM1_TXCHN_Pos) +#define I2S_PARAM1_TXCHN I2S_PARAM1_TXCHN_Msk + +#define I2S_PARAM1_RXCHN_Pos (7U) +#define I2S_PARAM1_RXCHN_Len (2U) +#define I2S_PARAM1_RXCHN_Msk (0x3U << I2S_PARAM1_RXCHN_Pos) +#define I2S_PARAM1_RXCHN I2S_PARAM1_RXCHN_Msk + +#define I2S_PARAM1_RXBLOCK_Pos (6U) +#define I2S_PARAM1_RXBLOCK_Len (1U) +#define I2S_PARAM1_RXBLOCK_Msk (0x1U << I2S_PARAM1_RXBLOCK_Pos) +#define I2S_PARAM1_RXBLOCK I2S_PARAM1_RXBLOCK_Msk + +#define I2S_PARAM1_TXBLOCK_Pos (5U) +#define I2S_PARAM1_TXBLOCK_Len (1U) +#define I2S_PARAM1_TXBLOCK_Msk (0x1U << I2S_PARAM1_TXBLOCK_Pos) +#define I2S_PARAM1_TXBLOCK I2S_PARAM1_TXBLOCK_Msk + +#define I2S_PARAM1_MODE_Pos (4U) +#define I2S_PARAM1_MODE_Len (1U) +#define I2S_PARAM1_MODE_Msk (0x1U << I2S_PARAM1_MODE_Pos) +#define I2S_PARAM1_MODE I2S_PARAM1_MODE_Msk + +#define I2S_PARAM1_FIFO_DEPTH_Pos (2U) +#define I2S_PARAM1_FIFO_DEPTH_Len (2U) +#define I2S_PARAM1_FIFO_DEPTH_Msk (0x3U << I2S_PARAM1_FIFO_DEPTH_Pos) +#define I2S_PARAM1_FIFO_DEPTH I2S_PARAM1_FIFO_DEPTH_Msk + +#define I2S_PARAM1_APB_DATA_WIDTH_Pos (0U) +#define I2S_PARAM1_APB_DATA_WIDTH_Len (2U) +#define I2S_PARAM1_APB_DATA_WIDTH_Msk (0x3U << I2S_PARAM1_APB_DATA_WIDTH_Pos) +#define I2S_PARAM1_APB_DATA_WIDTH I2S_PARAM1_APB_DATA_WIDTH_Msk + +/****************** Bit definition for I2S_VERSION register *****************/ +#define I2S_COMP_VERSION_Pos (0U) +#define I2S_COMP_VERSION_Len (32U) +#define I2S_COMP_VERSION_Msk (0xFFFFFFFFU) +#define I2S_COMP_VERSION I2S_COMP_VERSION_Msk + +/******************* Bit definition for I2S_TYPE register *******************/ +#define I2S_COMP_TYPE_Pos (0U) +#define I2S_COMP_TYPE_Len (32U) +#define I2S_COMP_TYPE_Msk (0xFFFFFFFFU) +#define I2S_COMP_TYPE I2S_COMP_TYPE_Msk + + +/* ================================================================================================================= */ +/* ================ ISO7816 ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for ISO7816_CTRL register *******************/ +#define ISO7816_CTRL_ACTION_POS (0U) +#define ISO7816_CTRL_ACTION_Len (3U) +#define ISO7816_CTRL_ACTION_Msk (0x7UL << ISO7816_CTRL_ACTION_POS) +#define ISO7816_CTRL_ACTION ISO7816_CTRL_ACTION_Msk + +#define ISO7816_CTRL_RX_RETYR_MC_POS (8U) +#define ISO7816_CTRL_RX_RETYR_MC_Len (1U) +#define ISO7816_CTRL_RX_RETYR_MC_Msk (0x1UL << ISO7816_CTRL_RX_RETYR_MC_POS) +#define ISO7816_CTRL_RX_RETYR_MC ISO7816_CTRL_RX_RETYR_MC_Msk + +#define ISO7816_CTRL_TX_RETYR_MC_POS (12U) +#define ISO7816_CTRL_TX_RETYR_MC_Len (1U) +#define ISO7816_CTRL_TX_RETYR_MC_Msk (0x1UL << ISO7816_CTRL_TX_RETYR_MC_POS) +#define ISO7816_CTRL_TX_RETYR_MC ISO7816_CTRL_TX_RETYR_MC_Msk + +#define ISO7816_CTRL_IRQ_DONE_CLR_POS (20U) +#define ISO7816_CTRL_IRQ_DONE_CLR_Len (1U) +#define ISO7816_CTRL_IRQ_DONE_CLR_Msk (0x1UL << ISO7816_CTRL_IRQ_DONE_CLR_POS) +#define ISO7816_CTRL_IRQ_DONE_CLR ISO7816_CTRL_IRQ_DONE_CLR_Msk + +#define ISO7816_CTRL_IRQ_RX_EC_POS (21U) +#define ISO7816_CTRL_IRQ_RX_EC_Len (1U) +#define ISO7816_CTRL_IRQ_RX_EC_Msk (0x1UL << ISO7816_CTRL_IRQ_RX_EC_POS) +#define ISO7816_CTRL_IRQ_RX_EC ISO7816_CTRL_IRQ_RX_EC_Msk + +#define ISO7816_CTRL_IRQ_RETYR_EC_POS (22U) +#define ISO7816_CTRL_IRQ_RETYR_EC_Len (1U) +#define ISO7816_CTRL_IRQ_RETYR_EC_Msk (0x1UL << ISO7816_CTRL_IRQ_RETYR_EC_POS) +#define ISO7816_CTRL_IRQ_RETYR_EC ISO7816_CTRL_IRQ_RETYR_EC_Msk + +#define ISO7816_CTRL_IRQ_DMA_EC_POS (23U) +#define ISO7816_CTRL_IRQ_DMA_EC_Len (1U) +#define ISO7816_CTRL_IRQ_DMA_EC_Msk (0x1UL << ISO7816_CTRL_IRQ_DMA_EC_POS) +#define ISO7816_CTRL_IRQ_DMA_EC ISO7816_CTRL_IRQ_DMA_EC_Msk + +#define ISO7816_CTRL_IRQ_STAT_EC_POS (24U) +#define ISO7816_CTRL_IRQ_STAT_EC_Len (1U) +#define ISO7816_CTRL_IRQ_STAT_EC_Msk (0x1UL << ISO7816_CTRL_IRQ_STAT_EC_POS) +#define ISO7816_CTRL_IRQ_STAT_EC ISO7816_CTRL_IRQ_STAT_EC_Msk + +#define ISO7816_CTRL_IRQ_PRESENCE_CLR_POS (25U) +#define ISO7816_CTRL_IRQ_PRESENCE_CLR_Len (1U) +#define ISO7816_CTRL_IRQ_PRESENCE_CLR_Msk (0x1UL << ISO7816_CTRL_IRQ_PRESENCE_CLR_POS) +#define ISO7816_CTRL_IRQ_PRESENCE_CLR ISO7816_CTRL_IRQ_PRESENCE_CLR_Msk + +#define ISO7816_CTRL_IRQ_TEST_CLR_POS (30U) +#define ISO7816_CTRL_IRQ_TEST_CLR_Len (1U) +#define ISO7816_CTRL_IRQ_TEST_CLR_Msk (0x1UL << ISO7816_CTRL_IRQ_TEST_CLR_POS) +#define ISO7816_CTRL_IRQ_TEST_CLR ISO7816_CTRL_IRQ_TEST_CLR_Msk + +#define ISO7816_CTRL_IRQ_TEST_SET_POS (31U) +#define ISO7816_CTRL_IRQ_TEST_SET_Len (1U) +#define ISO7816_CTRL_IRQ_TEST_SET_Msk (0x1UL << ISO7816_CTRL_IRQ_TEST_SET_POS) +#define ISO7816_CTRL_IRQ_TEST_SET ISO7816_CTRL_IRQ_TEST_SET_Msk + +/******************* Bit definition for ISO7816_STAT register *******************/ +#define ISO7816_INTR_ALL (0x43F00000) + +#define ISO7816_STAT_PWR_STAT_POS (0U) +#define ISO7816_STAT_PWR_STAT_Len (4U) +#define ISO7816_STAT_PWR_STAT_Msk (0xFUL << ISO7816_STAT_PWR_STAT_POS) +#define ISO7816_STAT_PWR_STAT ISO7816_STAT_PWR_STAT_Msk + +#define ISO7816_STAT_IO_STAT_POS (4U) +#define ISO7816_STAT_IO_STAT_Len (3U) +#define ISO7816_STAT_IO_STAT_Msk (0x7UL << ISO7816_STAT_IO_STAT_POS) +#define ISO7816_STAT_IO_STAT ISO7816_STAT_IO_STAT_Msk + +#define ISO7816_STAT_RX_RETRY_MAX_POS (8U) +#define ISO7816_STAT_RX_RETRY_MAX_Len (3U) +#define ISO7816_STAT_RX_RETRY_MAX_Msk (0x7UL << ISO7816_STAT_RX_RETRY_MAX_POS) +#define ISO7816_STAT_RX_RETRY_MAX ISO7816_STAT_RX_RETRY_MAX_Msk + +#define ISO7816_STAT_TX_RETRY_MAX_POS (12U) +#define ISO7816_STAT_TX_RETRY_MAX_Len (3U) +#define ISO7816_STAT_TX_RETRY_MAX_Msk (0x7UL << ISO7816_STAT_TX_RETRY_MAX_POS) +#define ISO7816_STAT_TX_RETRY_MAX ISO7816_STAT_TX_RETRY_MAX_Msk + +#define ISO7816_STAT_BUSY_POS (16U) +#define ISO7816_STAT_BUSY_Len (1U) +#define ISO7816_STAT_BUSY_Msk (0x1UL << ISO7816_STAT_BUSY_POS) +#define ISO7816_STAT_BUSY ISO7816_STAT_BUSY_Msk + +#define ISO7816_STAT_PRESENCE_STAT_POS (17U) +#define ISO7816_STAT_PRESENCE_STAT_Len (1U) +#define ISO7816_STAT_PRESENCE_STAT_Msk (0x1UL << ISO7816_STAT_PRESENCE_STAT_POS) +#define ISO7816_STAT_PRESENCE_STAT ISO7816_STAT_PRESENCE_STAT_Msk + +#define ISO7816_STAT_IRQ_DONE_POS (20U) +#define ISO7816_STAT_IRQ_DONE_Len (1U) +#define ISO7816_STAT_IRQ_DONE_Msk (0x1UL << ISO7816_STAT_IRQ_DONE_POS) +#define ISO7816_STAT_IRQ_DONE ISO7816_STAT_IRQ_DONE_Msk + +#define ISO7816_STAT_IRQ_RX_ERR_POS (21U) +#define ISO7816_STAT_IRQ_RX_ERR_Len (1U) +#define ISO7816_STAT_IRQ_RX_ERR_Msk (0x1UL << ISO7816_STAT_IRQ_RX_ERR_POS) +#define ISO7816_STAT_IRQ_RX_ERR ISO7816_STAT_IRQ_RX_ERR_Msk + +#define ISO7816_STAT_IRQ_RETRY_ERR_POS (22U) +#define ISO7816_STAT_IRQ_RETRY_ERR_Len (1U) +#define ISO7816_STAT_IRQ_RETRY_ERR_Msk (0x1UL << ISO7816_STAT_IRQ_RETRY_ERR_POS) +#define ISO7816_STAT_IRQ_RETRY_ERR ISO7816_STAT_IRQ_RETRY_ERR_Msk + +#define ISO7816_STAT_IRQ_DMA_ERR_POS (23U) +#define ISO7816_STAT_IRQ_DMA_ERR_Len (1U) +#define ISO7816_STAT_IRQ_DMA_ERR_Msk (0x1UL << ISO7816_STAT_IRQ_DMA_ERR_POS) +#define ISO7816_STAT_IRQ_DMA_ERR ISO7816_STAT_IRQ_DMA_ERR_Msk + +#define ISO7816_STAT_IRQ_STAT_ERR_POS (24U) +#define ISO7816_STAT_IRQ_STAT_ERR_Len (1U) +#define ISO7816_STAT_IRQ_STAT_ERR_Msk (0x1UL << ISO7816_STAT_IRQ_STAT_ERR_POS) +#define ISO7816_STAT_IRQ_STAT_ERR ISO7816_STAT_IRQ_STAT_ERR_Msk + +#define ISO7816_STAT_IRQ_PRESENCE_POS (25U) +#define ISO7816_STAT_IRQ_PRESENCE_Len (1U) +#define ISO7816_STAT_IRQ_PRESENCE_Msk (0x1UL << ISO7816_STAT_IRQ_PRESENCE_POS) +#define ISO7816_STAT_IRQ_PRESENCE ISO7816_STAT_IRQ_PRESENCE_Msk + +#define ISO7816_STAT_IRQ_TEST_POS (30U) +#define ISO7816_STAT_IRQ_TEST_Len (1U) +#define ISO7816_STAT_IRQ_TEST_Msk (0x1UL << ISO7816_STAT_IRQ_TEST_POS) +#define ISO7816_STAT_IRQ_TEST ISO7816_STAT_IRQ_TEST_Msk + +/******************* Bit definition for ISO7816_CLK_CFG register *******************/ +#define ISO7816_CLK_CFG_ETU_DIV_POS (0U) +#define ISO7816_CLK_CFG_ETU_DIV_Len (10U) +#define ISO7816_CLK_CFG_ETU_DIV_Msk (0x3FFUL << ISO7816_CLK_CFG_ETU_DIV_POS) +#define ISO7816_CLK_CFG_ETU_DIV ISO7816_CLK_CFG_ETU_DIV_Msk + +#define ISO7816_CLK_CFG_CLK_DIV_POS (16U) +#define ISO7816_CLK_CFG_CLK_DIV_Len (8U) +#define ISO7816_CLK_CFG_CLK_DIV_Msk (0xFFUL << ISO7816_CLK_CFG_CLK_DIV_POS) +#define ISO7816_CLK_CFG_CLK_DIV ISO7816_CLK_CFG_CLK_DIV_Msk + +#define ISO7816_CLK_CFG_CLK_STOP_SEL_POS (31U) +#define ISO7816_CLK_CFG_CLK_STOP_SEL_Len (1U) +#define ISO7816_CLK_CFG_CLK_STOP_SEL_Msk (0x1UL << ISO7816_CLK_CFG_CLK_STOP_SEL_POS) +#define ISO7816_CLK_CFG_CLK_STOP_SEL ISO7816_CLK_CFG_CLK_STOP_SEL_Msk + +/******************* Bit definition for ISO7816_TIMES_CFG register *******************/ +#define ISO7816_TIMES_CFG_GUARD_TIME_POS (0U) +#define ISO7816_TIMES_CFG_GUARD_TIME_Len (10U) +#define ISO7816_TIMES_CFG_GUARD_TIME_Msk (0x3FFUL << ISO7816_TIMES_CFG_GUARD_TIME_POS) +#define ISO7816_TIMES_CFG_GUARD_TIME ISO7816_TIMES_CFG_GUARD_TIME_Msk + +#define ISO7816_TIMES_CFG_WAIT_TIME_POS (12U) +#define ISO7816_TIMES_CFG_WAIT_TIME_Len (18U) +#define ISO7816_TIMES_CFG_WAIT_TIME_Msk (0x3FFFFUL << ISO7816_TIMES_CFG_WAIT_TIME_POS) +#define ISO7816_TIMES_CFG_WAIT_TIME ISO7816_TIMES_CFG_WAIT_TIME_Msk + +/******************* Bit definition for ISO7816_DATA_CFG register *******************/ +#define ISO7816_DATA_CFG_CODING_POS (0U) +#define ISO7816_DATA_CFG_CODING_Len (1U) +#define ISO7816_DATA_CFG_CODING_Msk (0x1UL << ISO7816_DATA_CFG_CODING_POS) +#define ISO7816_DATA_CFG_CODING ISO7816_DATA_CFG_CODING_Msk + +#define ISO7816_DATA_CFG_DETECT_CODING_POS (1U) +#define ISO7816_DATA_CFG_DETECT_CODING_Len (1U) +#define ISO7816_DATA_CFG_DETECT_CODING_Msk (0x1UL << ISO7816_DATA_CFG_DETECT_CODING_POS) +#define ISO7816_DATA_CFG_DETECT_CODING ISO7816_DATA_CFG_DETECT_CODING_Msk + +#define ISO7816_DATA_CFG_RETRY_LIMIT_POS (4U) +#define ISO7816_DATA_CFG_RETRY_LIMIT_Len (3U) +#define ISO7816_DATA_CFG_RETRY_LIMIT_Msk (0x7UL << ISO7816_DATA_CFG_RETRY_LIMIT_POS) +#define ISO7816_DATA_CFG_RETRY_LIMIT ISO7816_DATA_CFG_RETRY_LIMIT_Msk + +/******************* Bit definition for ISO7816_ADDR register *******************/ +#define ISO7816_ADDR_ADDR_FRAC_POS (0U) +#define ISO7816_ADDR_ADDR_FRAC_Len (2U) +#define ISO7816_ADDR_ADDR_FRAC_Msk (0x3UL << ISO7816_ADDR_ADDR_FRAC_POS) +#define ISO7816_ADDR_ADDR_FRAC ISO7816_ADDR_ADDR_FRAC_Msk + +#define ISO7816_ADDR_ADDR_POS (2U) +#define ISO7816_ADDR_ADDR_Len (18U) +#define ISO7816_ADDR_ADDR_Msk (0x3FFFFUL << ISO7816_ADDR_ADDR_POS) +#define ISO7816_ADDR_ADDR ISO7816_ADDR_ADDR_Msk + +/******************* Bit definition for ISO7816_START_ADDR register *******************/ +#define ISO7816_START_ADDR_START_ADDR_POS (2U) +#define ISO7816_START_ADDR_START_ADDR_Len (18U) +#define ISO7816_START_ADDR_START_ADDR_Msk (0x3FFFFUL << ISO7816_START_ADDR_START_ADDR_POS) +#define ISO7816_START_ADDR_START_ADDR ISO7816_START_ADDR_START_ADDR_Msk + +#define ISO7816_START_ADDR_BASE_ADDR_POS (20U) +#define ISO7816_START_ADDR_BASE_ADDR_Len (12U) +#define ISO7816_START_ADDR_BASE_ADDR_Msk (0xFFFUL << ISO7816_START_ADDR_BASE_ADDR_POS) +#define ISO7816_START_ADDR_BASE_ADDR ISO7816_START_ADDR_BASE_ADDR_Msk + +/******************* Bit definition for ISO7816_RX_END_ADDR register *******************/ +#define ISO7816_RX_END_ADDR_RX_END_AF_POS (0U) +#define ISO7816_RX_END_ADDR_RX_END_AF_Len (2U) +#define ISO7816_RX_END_ADDR_RX_END_AF_Msk (0x3UL << ISO7816_RX_END_ADDR_RX_END_AF_POS) +#define ISO7816_RX_END_ADDR_RX_END_AF ISO7816_RX_END_ADDR_RX_END_AF_Msk + +#define ISO7816_RX_END_ADDR_RX_END_ADDR_POS (2U) +#define ISO7816_RX_END_ADDR_RX_END_ADDR_Len (18U) +#define ISO7816_RX_END_ADDR_RX_END_ADDR_Msk (0x3FFFFUL << ISO7816_RX_END_ADDR_RX_END_ADDR_POS) +#define ISO7816_RX_END_ADDR_RX_END_ADDR ISO7816_RX_END_ADDR_RX_END_ADDR_Msk + +/******************* Bit definition for ISO7816_TX_END_ADDR register *******************/ +#define ISO7816_TX_END_ADDR_TX_END_AF_POS (0U) +#define ISO7816_TX_END_ADDR_TX_END_AF_Len (2U) +#define ISO7816_TX_END_ADDR_TX_END_AF_Msk (0x3UL << ISO7816_TX_END_ADDR_TX_END_AF_POS) +#define ISO7816_TX_END_ADDR_TX_END_AF ISO7816_TX_END_ADDR_TX_END_AF_Msk + +#define ISO7816_TX_END_ADDR_TX_END_ADDR_POS (2U) +#define ISO7816_TX_END_ADDR_TX_END_ADDR_Len (18U) +#define ISO7816_TX_END_ADDR_TX_END_ADDR_Msk (0x3FFFFUL << ISO7816_TX_END_ADDR_TX_END_ADDR_POS) +#define ISO7816_TX_END_ADDR_TX_END_ADDR ISO7816_TX_END_ADDR_TX_END_ADDR_Msk + +/* ================================================================================================================= */ +/* ================ MCU_SUB ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for MCU_SUB_REG_SENSE_ADC_FIFO register ****************/ +#define MCU_SUB_SNSADC_FF_DATA_Pos (0U) +#define MCU_SUB_SNSADC_FF_DATA_Len (32U) +#define MCU_SUB_SNSADC_FF_DATA_Msk (0xFFFFFFFFU) +#define MCU_SUB_SNSADC_FF_DATA MCU_SUB_SNSADC_FF_DATA_Msk + +/******************* Bit definition for MCU_SUB_REG_SENSE_FF_THRESH register ****/ +#define MCU_SUB_SNSADC_FF_THRESH_Pos (0U) +#define MCU_SUB_SNSADC_FF_THRESH_Len (6U) +#define MCU_SUB_SNSADC_FF_THRESH_Msk (0x3FU << MCU_SUB_SNSADC_FF_THRESH_Pos) +#define MCU_SUB_SNSADC_FF_THRESH MCU_SUB_SNSADC_FF_THRESH_Msk + +/******************* Bit definition for MCU_SUB_REG_SENSE_ADC_STAT register *****/ +#define MCU_SUB_SNSADC_STAT_VAL_Pos (8U) +#define MCU_SUB_SNSADC_STAT_VAL_Len (1U) +#define MCU_SUB_SNSADC_STAT_VAL_Msk (0x1U << MCU_SUB_SNSADC_STAT_VAL_Pos) +#define MCU_SUB_SNSADC_STAT_VAL MCU_SUB_SNSADC_STAT_VAL_Msk + +#define MCU_SUB_SNSADC_STAT_FF_COUNT_Pos (0U) +#define MCU_SUB_SNSADC_STAT_FF_COUNT_Len (7U) +#define MCU_SUB_SNSADC_STAT_FF_COUNT_Msk (0x7FU << MCU_SUB_SNSADC_STAT_FF_COUNT_Pos) +#define MCU_SUB_SNSADC_STAT_FF_COUNT MCU_SUB_SNSADC_STAT_FF_COUNT_Msk + + +/******************* Bit definition for MCU_SUB_REG_COMM_TMR_DEEPSLPSTAT register ***********/ +#define MCU_SUB_COMM_TMR_DEEPSLPSTAT_DEEPSLDUR_Pos (0U) +#define MCU_SUB_COMM_TMR_DEEPSLPSTAT_DEEPSLDUR_Len (32U) +#define MCU_SUB_COMM_TMR_DEEPSLPSTAT_DEEPSLDUR_Msk (0xFFFFFFFFU) +#define MCU_SUB_COMM_TMR_DEEPSLPSTAT_DEEPSLDUR MCU_SUB_COMM_TMR_DEEPSLPSTAT_DEEPSLDUR_Msk + +/*************** Bit definition for MCU_SUB_REG_DPAD_RE_N_BUS register ********/ +#define MCU_SUB_DPAD_RE_N_BUS_Pos (0U) +#define MCU_SUB_DPAD_RE_N_BUS_Len (32U) +#define MCU_SUB_DPAD_RE_N_BUS_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_RE_N_BUS MCU_SUB_DPAD_RE_N_BUS_Msk + +/************* Bit definition for MCU_SUB_REG_DPAD_RTYP_BUS register **********/ +#define MCU_SUB_DPAD_RTYP_BUS_Pos (0U) +#define MCU_SUB_DPAD_RTYP_BUS_Len (32U) +#define MCU_SUB_DPAD_RTYP_BUS_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_RTYP_BUS MCU_SUB_DPAD_RTYP_BUS_Msk + +/********** Bit definition for MCU_SUB_REG_DPAD_IE_N_BUS register *************/ +#define MCU_SUB_DPAD_IE_N_BUS_Pos (0U) +#define MCU_SUB_DPAD_IE_N_BUS_Len (32U) +#define MCU_SUB_DPAD_IE_N_BUS_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_IE_N_BUS MCU_SUB_DPAD_IE_N_BUS_Msk + +/********** Bit definition for MCU_SUB_REG_MSIO_REG register ******************/ +#define MCU_SUB_MSIO_REG0_PFAST_CS_CTRL_Pos (8U) +#define MCU_SUB_MSIO_REG0_PFAST_CS_CTRL_Len (4U) +#define MCU_SUB_MSIO_REG0_PFAST_CS_CTRL_Msk (0xFU << MCU_SUB_MSIO_REG0_PFAST_CS_CTRL_Pos) +#define MCU_SUB_MSIO_REG0_PFAST_CS_CTRL MCU_SUB_MSIO_REG0_PFAST_CS_CTRL_Msk + +#define MCU_SUB_MSIO_REG0_MSIO_C_Pos (0U) +#define MCU_SUB_MSIO_REG0_MSIO_C_Len (5U) +#define MCU_SUB_MSIO_REG0_MSIO_C_Msk (0x1FU << MCU_SUB_MSIO_REG0_MSIO_C_Pos) +#define MCU_SUB_MSIO_REG0_MSIO_C MCU_SUB_MSIO_REG0_MSIO_C_Msk + +/********** Bit definition for MCU_SUB_REG_BLE_FERP_CTL register ****************/ +#define MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL_Pos (4U) +#define MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL_Len (3U) +#define MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL_Msk (0x7U << MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL_Pos) +#define MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL MUC_SUB_BLE_FERP_CTL_TESTBUS_SEL_Msk + +#define MCU_SUB_BLE_FERP_CTL_FERP_EN_Pos (0U) +#define MCU_SUB_BLE_FERP_CTL_FERP_EN_Len (1U) +#define MCU_SUB_BLE_FERP_CTL_FERP_EN_Msk (0x1U << MCU_SUB_BLE_FERP_CTL_FERP_EN_Pos) +#define MCU_SUB_BLE_FERP_CTL_FERP_EN MCU_SUB_BLE_FERP_CTL_FERP_EN_Msk + +/********** Bit definition for MCU_SUB_REG_DMA_ACC_SEL register ****************/ +#define MCU_SUB_DMA_ACC_SEL_I2C1_I2SS_Pos (1U) +#define MCU_SUB_DMA_ACC_SEL_I2C1_I2SS_Len (1U) +#define MCU_SUB_DMA_ACC_SEL_I2C1_I2SS_Msk (0x1U << MCU_SUB_DMA_ACC_SEL_I2C1_I2SS_Pos) +#define MCU_SUB_DMA_ACC_SEL_I2C1_I2SS MCU_SUB_DMA_ACC_SEL_I2C1_I2SS_Msk + +#define MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM_Pos (0U) +#define MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM_Len (1U) +#define MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM_Msk (0x1U << MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM_Pos) +#define MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM MCU_SUB_DMA_ACC_SEL_QSPI1_I2SM_Msk + +/********** Bit definition for MCU_SUB_REG_SECURITY_RESET register ****************/ +#define MCU_SUB_SECURITY_RESET_PRESENT_Pos (6U) +#define MCU_SUB_SECURITY_RESET_PRESENT_Len (1U) +#define MCU_SUB_SECURITY_RESET_PRESENT_Msk (0x1U << MCU_SUB_SECURITY_RESET_PRESENT_Pos) +#define MCU_SUB_SECURITY_RESET_PRESENT MCU_SUB_SECURITY_RESET_PRESENT_Msk + +#define MCU_SUB_SECURITY_RESET_TRNG_Pos (5U) +#define MCU_SUB_SECURITY_RESET_TRNG_Len (1U) +#define MCU_SUB_SECURITY_RESET_TRNG_Msk (0x1U << MCU_SUB_SECURITY_RESET_TRNG_Pos) +#define MCU_SUB_SECURITY_RESET_TRNG MCU_SUB_SECURITY_RESET_TRNG_Msk + +#define MCU_SUB_SECURITY_RESET_RAMKEY_Pos (4U) +#define MCU_SUB_SECURITY_RESET_RAMKEY_Len (1U) +#define MCU_SUB_SECURITY_RESET_RAMKEY_Msk (0x1U << MCU_SUB_SECURITY_RESET_RAMKEY_Pos) +#define MCU_SUB_SECURITY_RESET_RAMKEY MCU_SUB_SECURITY_RESET_RAMKEY_Msk + +#define MCU_SUB_SECURITY_RESET_EFUSE_Pos (3U) +#define MCU_SUB_SECURITY_RESET_EFUSE_Len (1U) +#define MCU_SUB_SECURITY_RESET_EFUSE_Msk (0x1U << MCU_SUB_SECURITY_RESET_EFUSE_Pos) +#define MCU_SUB_SECURITY_RESET_EFUSE MCU_SUB_SECURITY_RESET_EFUSE_Msk + +#define MCU_SUB_SECURITY_RESET_PKC_Pos (2U) +#define MCU_SUB_SECURITY_RESET_PKC_Len (1U) +#define MCU_SUB_SECURITY_RESET_PKC_Msk (0x1U << MCU_SUB_SECURITY_RESET_PKC_Pos) +#define MCU_SUB_SECURITY_RESET_PKC MCU_SUB_SECURITY_RESET_PKC_Msk + +#define MCU_SUB_SECURITY_RESET_HMAC_Pos (1U) +#define MCU_SUB_SECURITY_RESET_HMAC_Len (1U) +#define MCU_SUB_SECURITY_RESET_HMAC_Msk (0x1U << MCU_SUB_SECURITY_RESET_HMAC_Pos) +#define MCU_SUB_SECURITY_RESET_HMAC MCU_SUB_SECURITY_RESET_HMAC_Msk + +#define MCU_SUB_SECURITY_RESET_AES_Pos (0U) +#define MCU_SUB_SECURITY_RESET_AES_Len (1U) +#define MCU_SUB_SECURITY_RESET_AES_Msk (0x1U << MCU_SUB_SECURITY_RESET_AES_Pos) +#define MCU_SUB_SECURITY_RESET_AES MCU_SUB_SECURITY_RESET_AES_Msk + +/********** Bit definition for MCU_SUB_REG_PMU_ID_REG register *****************/ +#define MCU_SUB_PMU_ID_Pos (0U) +#define MCU_SUB_PMU_ID_Len (8U) +#define MCU_SUB_PMU_ID_Msk (0xFFU << MCU_SUB_PMU_ID_Pos) +#define MCU_SUB_PMU_ID MCU_SUB_PMU_ID_Msk + +/********** Bit definition for MCU_SUB_REG_PWR_AVG_CTL_REG register ************/ +#define MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT_Pos (24U) +#define MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT_Len (8U) +#define MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT_Msk (0xFFU << MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT_Pos) +#define MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT MCU_SUB_PWR_AVG_CTL0_TPA_ADC_OUT_Msk + +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR_Pos (18U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR_Len (1U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR_Msk (0x1U << MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR_Pos) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR MCU_SUB_PWR_AVG_CTL0_AVG_PWR_ERR_Msk + +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY_Pos (16U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY_Len (1U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY_Msk (0x1U << MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY_Pos) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY MCU_SUB_PWR_AVG_CTL0_AVG_PWR_RDY_Msk + +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_Pos (8U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_Len (8U) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR_Msk (0xFFU << MCU_SUB_PWR_AVG_CTL0_AVG_PWR_Pos) +#define MCU_SUB_PWR_AVG_CTL0_AVG_PWR MCU_SUB_PWR_AVG_CTL0_AVG_PWR_Msk + +#define MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR_Pos (4U) +#define MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR_Len (4U) +#define MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR_Msk (0xFU << MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR_Pos) +#define MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR MCU_SUB_PWR_AVG_CTL0_SAMPL_PWR_Msk + +#define MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN_Pos (3U) +#define MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN_Len (1U) +#define MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN_Msk (0x1 << MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN_Pos) +#define MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN MCU_SUB_PWR_AVG_CTL0_BLE_F_TX_EN_Msk + +#define MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN_Pos (2U) +#define MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN_Len (1U) +#define MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN_Msk (0x1 << MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN_Pos) +#define MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN MCU_SUB_PWR_AVG_CTL0_ONESHOT_EN_Msk + +#define MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN_Pos (0U) +#define MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN_Len (1U) +#define MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN_Msk (0x1 << MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN_Pos) +#define MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN MCU_SUB_PWR_AVG_CTL0_PWR_AVG_EN_Msk + +/********** Bit definition for MCU_SUB_REG_CLK_CAL_CTL_REG0 register ************/ +#define MCU_SUB_CLK_CAL_CTL0_EN_Pos (0U) +#define MCU_SUB_CLK_CAL_CTL0_EN_Len (1U) +#define MCU_SUB_CLK_CAL_CTL0_EN_Msk (0x1U << MCU_SUB_CLK_CAL_CTL0_EN_Pos) +#define MCU_SUB_CLK_CAL_CTL0_EN MCU_SUB_CLK_CAL_CTL0_EN_Msk + +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN_Pos (1U) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN_Len (1U) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN_Msk (0x1U << MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN_Pos) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_EN_Msk + +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL_Pos (4U) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL_Len (12U) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL_Msk (0xFFFU << MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL_Pos) +#define MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL MCU_SUB_CLK_CAL_CTL0_CNT_LOAD_VAL_Msk + +#define MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY_Pos (16U) +#define MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY_Len (1U) +#define MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY_Msk (0x1U << MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY_Pos) +#define MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY MCU_SUB_CLK_CAL_CTL0_STS_CNT_RDY_Msk + +/********** Bit definition for MCU_SUB_REG_CLK_CAL_CTL_REG1 register ************/ +#define MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL_Pos (0U) +#define MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL_Len (24U) +#define MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL_Msk (0xFFFFFFU << MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL_Pos) +#define MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL MCU_SUB_CLK_CAL_CTL1_STS_CNT_VAL_Msk + +/********** Bit definition for MCU_SUB_REG_DPAD_MUX_CTL_00_07 register **********/ +#define MCU_SUB_DPAD_MUX_CTL_00_07_Pos (0U) +#define MCU_SUB_DPAD_MUX_CTL_00_07_Len (32U) +#define MCU_SUB_DPAD_MUX_CTL_00_07_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_MUX_CTL_00_07 MCU_SUB_DPAD_MUX_CTL_00_07_Msk + +#define MCU_SUB_DPAD_MUX_CTL_SEL_Msk (0xFU) +#define MCU_SUB_DPAD_MUX_CTL_SEL_00 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 0) +#define MCU_SUB_DPAD_MUX_CTL_SEL_01 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_DPAD_MUX_CTL_SEL_02 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_DPAD_MUX_CTL_SEL_03 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_DPAD_MUX_CTL_SEL_04 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 16) +#define MCU_SUB_DPAD_MUX_CTL_SEL_05 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 20) +#define MCU_SUB_DPAD_MUX_CTL_SEL_06 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 24) +#define MCU_SUB_DPAD_MUX_CTL_SEL_07 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 28) + +/********** Bit definition for MCU_SUB_REG_DPAD_MUX_CTL_08_15 register **********/ +#define MCU_SUB_DPAD_MUX_CTL_08_15_Pos (0U) +#define MCU_SUB_DPAD_MUX_CTL_08_15_Len (32U) +#define MCU_SUB_DPAD_MUX_CTL_08_15_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_MUX_CTL_08_15 MCU_SUB_DPAD_MUX_CTL_08_15_Msk + +#define MCU_SUB_DPAD_MUX_CTL_SEL_08 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 0) +#define MCU_SUB_DPAD_MUX_CTL_SEL_09 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_DPAD_MUX_CTL_SEL_10 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_DPAD_MUX_CTL_SEL_11 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_DPAD_MUX_CTL_SEL_12 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 16) +#define MCU_SUB_DPAD_MUX_CTL_SEL_13 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 20) +#define MCU_SUB_DPAD_MUX_CTL_SEL_14 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 24) +#define MCU_SUB_DPAD_MUX_CTL_SEL_15 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 28) + +/********** Bit definition for MCU_SUB_REG_DPAD_MUX_CTL_16_23 register **********/ +#define MCU_SUB_DPAD_MUX_CTL_16_23_Pos (0U) +#define MCU_SUB_DPAD_MUX_CTL_16_23_Len (32U) +#define MCU_SUB_DPAD_MUX_CTL_16_23_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_MUX_CTL_16_23 MCU_SUB_DPAD_MUX_CTL_16_23_Msk + +#define MCU_SUB_DPAD_MUX_CTL_SEL_16 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 0) +#define MCU_SUB_DPAD_MUX_CTL_SEL_17 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_DPAD_MUX_CTL_SEL_18 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_DPAD_MUX_CTL_SEL_19 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_DPAD_MUX_CTL_SEL_20 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 16) +#define MCU_SUB_DPAD_MUX_CTL_SEL_21 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 20) +#define MCU_SUB_DPAD_MUX_CTL_SEL_22 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 24) +#define MCU_SUB_DPAD_MUX_CTL_SEL_23 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 28) + +/********** Bit definition for MCU_SUB_REG_DPAD_MUX_CTL_24_31 register ***********/ +#define MCU_SUB_DPAD_MUX_CTL_24_31_Pos (0U) +#define MCU_SUB_DPAD_MUX_CTL_24_31_Len (32U) +#define MCU_SUB_DPAD_MUX_CTL_24_31_Msk (0xFFFFFFFFU) +#define MCU_SUB_DPAD_MUX_CTL_24_31 MCU_SUB_DPAD_MUX_CTL_24_31_Msk + +#define MCU_SUB_DPAD_MUX_CTL_SEL_24 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 0) +#define MCU_SUB_DPAD_MUX_CTL_SEL_25 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_DPAD_MUX_CTL_SEL_26 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_DPAD_MUX_CTL_SEL_27 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_DPAD_MUX_CTL_SEL_28 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 16) +#define MCU_SUB_DPAD_MUX_CTL_SEL_29 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 20) +#define MCU_SUB_DPAD_MUX_CTL_SEL_30 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 24) +#define MCU_SUB_DPAD_MUX_CTL_SEL_31 (MCU_SUB_DPAD_MUX_CTL_SEL_Msk << 28) + +/********** Bit definition for MCU_SUB_REG_EFUSE_PWR_DELTA0 register ***********/ +#define MCU_SUB_EFUSE_PWR_DELTA0_Pos (0U) +#define MCU_SUB_EFUSE_PWR_DELTA0_Len (16U) +#define MCU_SUB_EFUSE_PWR_DELTA0_Msk (0xFFFFU << MCU_SUB_EFUSE_PWR_DELTA0_Pos) +#define MCU_SUB_EFUSE_PWR_DELTA0 MCU_SUB_EFUSE_PWR_DELTA0_Msk + +#define MCU_SUB_EFUSE_PWR_DELTA1_Pos (16U) +#define MCU_SUB_EFUSE_PWR_DELTA1_Len (16U) +#define MCU_SUB_EFUSE_PWR_DELTA1_Msk (0xFFFFU << MCU_SUB_EFUSE_PWR_DELTA1_Pos) +#define MCU_SUB_EFUSE_PWR_DELTA1 MCU_SUB_EFUSE_PWR_DELTA1_Msk + +/********** Bit definition for MCU_SUB_REG_EFUSE_PWR_DELTA0 register ***********/ +#define MCU_SUB_EFUSE_PWR_DELTA2_Pos (0U) +#define MCU_SUB_EFUSE_PWR_DELTA2_Len (16U) +#define MCU_SUB_EFUSE_PWR_DELTA2_Msk (0xFFFFU << MCU_SUB_EFUSE_PWR_DELTA2_Pos) +#define MCU_SUB_EFUSE_PWR_DELTA2 MCU_SUB_EFUSE_PWR_DELTA2_Msk + +/********** Bit definition for MCU_SUB_REG_EFUSE_PWR_CTRL0 register ***********/ +#define MCU_SUB_EFUSE_PWR_CTL0_EN_Pos (0U) +#define MCU_SUB_EFUSE_PWR_CTL0_EN_Len (1U) +#define MCU_SUB_EFUSE_PWR_CTL0_EN_Msk (0x1U << MCU_SUB_EFUSE_PWR_CTL0_EN_Pos) +#define MCU_SUB_EFUSE_PWR_CTL0_EN MCU_SUB_EFUSE_PWR_CTL0_EN_Msk + +#define MCU_SUB_EFUSE_PWR_CTL0_BGN_Pos (2U) +#define MCU_SUB_EFUSE_PWR_CTL0_BGN_Len (1U) +#define MCU_SUB_EFUSE_PWR_CTL0_BGN_Msk (0x1U << MCU_SUB_EFUSE_PWR_CTL0_BGN_Pos) +#define MCU_SUB_EFUSE_PWR_CTL0_BGN MCU_SUB_EFUSE_PWR_CTL0_BGN_Msk + +#define MCU_SUB_EFUSE_PWR_CTL0_STP_Pos (4U) +#define MCU_SUB_EFUSE_PWR_CTL0_STP_Len (1U) +#define MCU_SUB_EFUSE_PWR_CTL0_STP_Msk (0x1U << MCU_SUB_EFUSE_PWR_CTL0_STP_Pos) +#define MCU_SUB_EFUSE_PWR_CTL0_STP MCU_SUB_EFUSE_PWR_CTL0_STP_Msk + +/********** Bit definition for MCU_SUB_REG_EFUSE_PWR_CTRL1 register ***********/ +#define MCU_SUB_EFUSE_PWR_CTL0_EN_DONE_Pos (0U) +#define MCU_SUB_EFUSE_PWR_CTL0_EN_DONE_Len (1U) +#define MCU_SUB_EFUSE_PWR_CTL0_EN_DONE_Msk (0x1U << MCU_SUB_EFUSE_PWR_CTL0_EN_DONE_Pos) +#define MCU_SUB_EFUSE_PWR_CTL0_EN_DONE MCU_SUB_EFUSE_PWR_CTL0_EN_DONE_Msk + +#define MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE_Pos (4U) +#define MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE_Len (1U) +#define MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE_Msk (0x1U << MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE_Pos) +#define MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE MCU_SUB_EFUSE_PWR_CTL0_DIS_DONE_Msk + +/********** Bit definition for MCU_SUB_REG_I2S_CLK_CFG register ***********/ +#define MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL_Pos (18U) +#define MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL_Len (1U) +#define MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL_Msk (0x1U << MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL_Pos) +#define MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL MCU_SUB_I2S_CLK_CFG_SRC_CLK_SEL_Msk + +#define MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN_Pos (16U) +#define MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN_Len (1U) +#define MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN_Msk (0x1U << MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN_Pos) +#define MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN MCU_SUB_I2S_CLK_CFG_CLK_DIV_EN_Msk + +#define MCU_SUB_I2S_CLK_CFG_DIV_CNT_Pos (0U) +#define MCU_SUB_I2S_CLK_CFG_DIV_CNT_Len (12U) +#define MCU_SUB_I2S_CLK_CFG_DIV_CNT_Msk (0xFFFU << MCU_SUB_I2S_CLK_CFG_DIV_CNT_Pos) +#define MCU_SUB_I2S_CLK_CFG_DIV_CNT MCU_SUB_I2S_CLK_CFG_DIV_CNT_Msk + +/********** Bit definition for MCU_SUB_REG_AON_PAD_MUX_CTL register ***********/ +#define MCU_SUB_AON_MUX_CTL_00_07_Pos (0U) +#define MCU_SUB_AON_MUX_CTL_00_07_Len (32U) +#define MCU_SUB_AON_MUX_CTL_00_07_Msk (0x00777770U) +#define MCU_SUB_AON_MUX_CTL_00_07 MCU_SUB_AON_MUX_CTL_00_07_Msk + +#define MCU_SUB_AON_MUX_CTL_SEL_Msk (0x7U) +#define MCU_SUB_AON_MUX_CTL_SEL_01 (MCU_SUB_AON_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_AON_MUX_CTL_SEL_02 (MCU_SUB_AON_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_AON_MUX_CTL_SEL_03 (MCU_SUB_AON_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_AON_MUX_CTL_SEL_04 (MCU_SUB_AON_MUX_CTL_SEL_Msk << 16) +#define MCU_SUB_AON_MUX_CTL_SEL_05 (MCU_SUB_AON_MUX_CTL_SEL_Msk << 20) + +/********** Bit definition for MCU_SUB_REG_MSIO_PAD_MUX_CTL register ***********/ +#define MCU_SUB_MSIO_MUX_CTL_00_04_Pos (0U) +#define MCU_SUB_MSIO_MUX_CTL_00_04_Len (32U) +#define MCU_SUB_MSIO_MUX_CTL_00_04_Msk (0x77777U) +#define MCU_SUB_MSIO_MUX_CTL_00_04 MCU_SUB_MSIO_MUX_CTL_00_04_Msk + +#define MCU_SUB_MSIO_MUX_CTL_SEL_Msk (0x7U) +#define MCU_SUB_MSIO_MUX_CTL_SEL_00 (MCU_SUB_MSIO_MUX_CTL_SEL_Msk << 0) +#define MCU_SUB_MSIO_MUX_CTL_SEL_01 (MCU_SUB_MSIO_MUX_CTL_SEL_Msk << 4) +#define MCU_SUB_MSIO_MUX_CTL_SEL_02 (MCU_SUB_MSIO_MUX_CTL_SEL_Msk << 8) +#define MCU_SUB_MSIO_MUX_CTL_SEL_03 (MCU_SUB_MSIO_MUX_CTL_SEL_Msk << 12) +#define MCU_SUB_MSIO_MUX_CTL_SEL_04 (MCU_SUB_MSIO_MUX_CTL_SEL_Msk << 16) + +/********** Bit definition for MCU_SUB_REG_MCU_SUBSYS_CG_CTRL_0 register ***********/ +#define MCU_SUB_WFI_MSK_HCLK_0 (0xFFFU) + +#define MCU_SUB_WFI_I2S_S_HCLK_Pos (11U) +#define MCU_SUB_WFI_I2S_S_HCLK_Len (1U) +#define MCU_SUB_WFI_I2S_S_HCLK_Msk (0x01 << MCU_SUB_WFI_I2S_S_HCLK_Pos) +#define MCU_SUB_WFI_I2S_S_HCLK MCU_SUB_WFI_I2S_S_HCLK_Msk + +#define MCU_SUB_WFI_SERIAL_HCLK_Pos (10U) +#define MCU_SUB_WFI_SERIAL_HCLK_Len (1U) +#define MCU_SUB_WFI_SERIAL_HCLK_Msk (0x01 << MCU_SUB_WFI_SERIAL_HCLK_Pos) +#define MCU_SUB_WFI_SERIAL_HCLK MCU_SUB_WFI_SERIAL_HCLK_Msk + +#define MCU_SUB_WFI_APB_SUB_HCLK_Pos (9U) +#define MCU_SUB_WFI_APB_SUB_HCLK_Len (1U) +#define MCU_SUB_WFI_APB_SUB_HCLK_Msk (0x01 << MCU_SUB_WFI_APB_SUB_HCLK_Pos) +#define MCU_SUB_WFI_APB_SUB_HCLK MCU_SUB_WFI_APB_SUB_HCLK_Msk + +#define MCU_SUB_WFI_BLE_BRG_HCLK_Pos (8U) +#define MCU_SUB_WFI_BLE_BRG_HCLK_Len (1U) +#define MCU_SUB_WFI_BLE_BRG_HCLK_Msk (0x01 << MCU_SUB_WFI_BLE_BRG_HCLK_Pos) +#define MCU_SUB_WFI_BLE_BRG_HCLK MCU_SUB_WFI_BLE_BRG_HCLK_Msk + +#define MCU_SUB_WFI_DMA_HCLK_Pos (7U) +#define MCU_SUB_WFI_DMA_HCLK_Len (1U) +#define MCU_SUB_WFI_DMA_HCLK_Msk (0x01 << MCU_SUB_WFI_DMA_HCLK_Pos) +#define MCU_SUB_WFI_DMA_HCLK MCU_SUB_WFI_DMA_HCLK_Msk + +#define MCU_SUB_WFI_GPIO_HCLK_Pos (6U) +#define MCU_SUB_WFI_GPIO_HCLK_Len (1U) +#define MCU_SUB_WFI_GPIO_HCLK_Msk (0x01 << MCU_SUB_WFI_GPIO_HCLK_Pos) +#define MCU_SUB_WFI_GPIO_HCLK MCU_SUB_WFI_GPIO_HCLK_Msk + +#define MCU_SUB_WFI_SNSADC_HCLK_Pos (5U) +#define MCU_SUB_WFI_SNSADC_HCLK_Len (1U) +#define MCU_SUB_WFI_SNSADC_HCLK_Msk (0x01 << MCU_SUB_WFI_SNSADC_HCLK_Pos) +#define MCU_SUB_WFI_SNSADC_HCLK MCU_SUB_WFI_SNSADC_HCLK_Msk + +#define MCU_SUB_WFI_ROM_HCLK_Pos (4U) +#define MCU_SUB_WFI_ROM_HCLK_Len (1U) +#define MCU_SUB_WFI_ROM_HCLK_Msk (0x01 << MCU_SUB_WFI_ROM_HCLK_Pos) +#define MCU_SUB_WFI_ROM_HCLK MCU_SUB_WFI_ROM_HCLK_Msk + +#define MCU_SUB_WFI_PWM_HCLK_Pos (3U) +#define MCU_SUB_WFI_PWM_HCLK_Len (1U) +#define MCU_SUB_WFI_PWM_HCLK_Msk (0x01 << MCU_SUB_WFI_PWM_HCLK_Pos) +#define MCU_SUB_WFI_PWM_HCLK MCU_SUB_WFI_PWM_HCLK_Msk + +#define MCU_SUB_WFI_HTB_HCLK_Pos (2U) +#define MCU_SUB_WFI_HTB_HCLK_Len (1U) +#define MCU_SUB_WFI_HTB_HCLK_Msk (0x01 << MCU_SUB_WFI_HTB_HCLK_Pos) +#define MCU_SUB_WFI_HTB_HCLK MCU_SUB_WFI_HTB_HCLK_Msk + +#define MCU_SUB_WFI_SIM_HCLK_Pos (1U) +#define MCU_SUB_WFI_SIM_HCLK_Len (1U) +#define MCU_SUB_WFI_SIM_HCLK_Msk (0x01 << MCU_SUB_WFI_SIM_HCLK_Pos) +#define MCU_SUB_WFI_SIM_HCLK MCU_SUB_WFI_SIM_HCLK_Msk + +#define MCU_SUB_WFI_SECU_HCLK_Pos (0U) +#define MCU_SUB_WFI_SECU_HCLK_Len (1U) +#define MCU_SUB_WFI_SECU_HCLK_Msk (0x01 << MCU_SUB_WFI_SECU_HCLK_Pos) +#define MCU_SUB_WFI_SECU_HCLK MCU_SUB_WFI_SECU_HCLK_Msk + +/********** Bit definition for MCU_SUB_REG_MCU_SUBSYS_CG_CTRL_1 register ***********/ +#define MCU_SUB_FORCE_MSK_HCLK_0 (0xFFFU) + +#define MCU_SUB_FORCE_I2S_S_HCLK_Pos (11U) +#define MCU_SUB_FORCE_I2S_S_HCLK_Len (1U) +#define MCU_SUB_FORCE_I2S_S_HCLK_Msk (0x01 << MCU_SUB_FORCE_I2S_S_HCLK_Pos) +#define MCU_SUB_FORCE_I2S_S_HCLK MCU_SUB_FORCE_I2S_S_HCLK_Msk + +#define MCU_SUB_FORCE_SERIAL_HCLK_Pos (10U) +#define MCU_SUB_FORCE_SERIAL_HCLK_Len (1U) +#define MCU_SUB_FORCE_SERIAL_HCLK_Msk (0x01 << MCU_SUB_FORCE_SERIAL_HCLK_Pos) +#define MCU_SUB_FORCE_SERIAL_HCLK MCU_SUB_FORCE_SERIAL_HCLK_Msk + +#define MCU_SUB_FORCE_APB_SUB_HCLK_Pos (9U) +#define MCU_SUB_FORCE_APB_SUB_HCLK_Len (1U) +#define MCU_SUB_FORCE_APB_SUB_HCLK_Msk (0x01 << MCU_SUB_FORCE_APB_SUB_HCLK_Pos) +#define MCU_SUB_FORCE_APB_SUB_HCLK MCU_SUB_FORCE_APB_SUB_HCLK_Msk + +#define MCU_SUB_FORCE_BLE_BRG_HCLK_Pos (8U) +#define MCU_SUB_FORCE_BLE_BRG_HCLK_Len (1U) +#define MCU_SUB_FORCE_BLE_BRG_HCLK_Msk (0x01 << MCU_SUB_FORCE_BLE_BRG_HCLK_Pos) +#define MCU_SUB_FORCE_BLE_BRG_HCLK MCU_SUB_FORCE_BLE_BRG_HCLK_Msk + +#define MCU_SUB_FORCE_DMA_HCLK_Pos (7U) +#define MCU_SUB_FORCE_DMA_HCLK_Len (1U) +#define MCU_SUB_FORCE_DMA_HCLK_Msk (0x01 << MCU_SUB_FORCE_DMA_HCLK_Pos) +#define MCU_SUB_FORCE_DMA_HCLK MCU_SUB_FORCE_DMA_HCLK_Msk + +#define MCU_SUB_FORCE_GPIO_HCLK_Pos (6U) +#define MCU_SUB_FORCE_GPIO_HCLK_Len (1U) +#define MCU_SUB_FORCE_GPIO_HCLK_Msk (0x01 << MCU_SUB_FORCE_GPIO_HCLK_Pos) +#define MCU_SUB_FORCE_GPIO_HCLK MCU_SUB_FORCE_GPIO_HCLK_Msk + +#define MCU_SUB_FORCE_SNSADC_HCLK_Pos (5U) +#define MCU_SUB_FORCE_SNSADC_HCLK_Len (1U) +#define MCU_SUB_FORCE_SNSADC_HCLK_Msk (0x01 << MCU_SUB_FORCE_SNSADC_HCLK_Pos) +#define MCU_SUB_FORCE_SNSADC_HCLK MCU_SUB_FORCE_SNSADC_HCLK_Msk + +#define MCU_SUB_FORCE_ROM_HCLK_Pos (4U) +#define MCU_SUB_FORCE_ROM_HCLK_Len (1U) +#define MCU_SUB_FORCE_ROM_HCLK_Msk (0x01 << MCU_SUB_FORCE_ROM_HCLK_Pos) +#define MCU_SUB_FORCE_ROM_HCLK MCU_SUB_FORCE_ROM_HCLK_Msk + +#define MCU_SUB_FORCE_PWM_HCLK_Pos (3U) +#define MCU_SUB_FORCE_PWM_HCLK_Len (1U) +#define MCU_SUB_FORCE_PWM_HCLK_Msk (0x01 << MCU_SUB_FORCE_PWM_HCLK_Pos) +#define MCU_SUB_FORCE_PWM_HCLK MCU_SUB_FORCE_PWM_HCLK_Msk + +#define MCU_SUB_FORCE_HTB_HCLK_Pos (2U) +#define MCU_SUB_FORCE_HTB_HCLK_Len (1U) +#define MCU_SUB_FORCE_HTB_HCLK_Msk (0x01 << MCU_SUB_FORCE_HTB_HCLK_Pos) +#define MCU_SUB_FORCE_HTB_HCLK MCU_SUB_FORCE_HTB_HCLK_Msk + +#define MCU_SUB_FORCE_SIM_HCLK_Pos (1U) +#define MCU_SUB_FORCE_SIM_HCLK_Len (1U) +#define MCU_SUB_FORCE_SIM_HCLK_Msk (0x01 << MCU_SUB_FORCE_SIM_HCLK_Pos) +#define MCU_SUB_FORCE_SIM_HCLK MCU_SUB_FORCE_SIM_HCLK_Msk + +#define MCU_SUB_FORCE_SECU_HCLK_Pos (0U) +#define MCU_SUB_FORCE_SECU_HCLK_Len (1U) +#define MCU_SUB_FORCE_SECU_HCLK_Msk (0x01 << MCU_SUB_FORCE_SECU_HCLK_Pos) +#define MCU_SUB_FORCE_SECU_HCLK MCU_SUB_FORCE_SECU_HCLK_Msk + +/********** Bit definition for MCU_SUB_REG_MCU_SUBSYS_CG_CTRL_2 register ***********/ +#define MCU_SUB_FORCE_MSK_HCLK_1 (0x00070000U) + +#define MCU_SUB_FORCE_SRAM_HCLK_Pos (18U) +#define MCU_SUB_FORCE_SRAM_HCLK_Len (1U) +#define MCU_SUB_FORCE_SRAM_HCLK_Msk (0x1UL << MCU_SUB_FORCE_SRAM_HCLK_Pos) +#define MCU_SUB_FORCE_SRAM_HCLK MCU_SUB_FORCE_SRAM_HCLK_Msk + +#define MCU_SUB_FORCE_XF_XQSPI_HCLK_Pos (17U) +#define MCU_SUB_FORCE_XF_XQSPI_HCLK_Len (1U) +#define MCU_SUB_FORCE_XF_XQSPI_HCLK_Msk (0x1UL << MCU_SUB_FORCE_XF_XQSPI_HCLK_Pos) +#define MCU_SUB_FORCE_XF_XQSPI_HCLK MCU_SUB_FORCE_XF_XQSPI_HCLK_Msk + +#define MCU_SUB_FORCE_AON_MCUSUB_HCLK_Pos (16U) +#define MCU_SUB_FORCE_AON_MCUSUB_HCLK_Len (1U) +#define MCU_SUB_FORCE_AON_MCUSUB_HCLK_Msk (0x1UL << MCU_SUB_FORCE_AON_MCUSUB_HCLK_Pos) +#define MCU_SUB_FORCE_AON_MCUSUB_HCLK MCU_SUB_FORCE_AON_MCUSUB_HCLK_Msk + +#define MCU_SUB_WFI_MSK_HCLK_1 (0x00000007U) + +#define MCU_SUB_WFI_SRAM_HCLK_Pos (2U) +#define MCU_SUB_WFI_SRAM_HCLK_Len (1U) +#define MCU_SUB_WFI_SRAM_HCLK_Msk (0x1UL << MCU_SUB_WFI_SRAM_HCLK_Pos) +#define MCU_SUB_WFI_SRAM_HCLK MCU_SUB_WFI_SRAM_HCLK_Msk + +#define MCU_SUB_WFI_XF_XQSPI_HCLK_Pos (1U) +#define MCU_SUB_WFI_XF_XQSPI_HCLK_Len (1U) +#define MCU_SUB_WFI_XF_XQSPI_HCLK_Msk (0x1UL << MCU_SUB_WFI_XF_XQSPI_HCLK_Pos) +#define MCU_SUB_WFI_XF_XQSPI_HCLK MCU_SUB_WFI_XF_XQSPI_HCLK_Msk + +#define MCU_SUB_WFI_AON_MCUSUB_HCLK_Pos (0U) +#define MCU_SUB_WFI_AON_MCUSUB_HCLK_Len (1U) +#define MCU_SUB_WFI_AON_MCUSUB_HCLK_Msk (0x1UL << MCU_SUB_WFI_AON_MCUSUB_HCLK_Pos) +#define MCU_SUB_WFI_AON_MCUSUB_HCLK MCU_SUB_WFI_AON_MCUSUB_HCLK_Msk + +/********** Bit definition for MCU_SUB_REG_MCU_PERIPH_GC register ***********/ +#define MCU_SUB_FORCE_MSK_HCLK_2 (0x0A01FF00U) +#define MCU_SUB_WFI_MSK_HCLK_2 (0x05000000U) +#define MCU_SUB_FORCE_XQSPI_DIV4_PCLK_Pos (27U) +#define MCU_SUB_FORCE_XQSPI_DIV4_PCLK_Len (1U) +#define MCU_SUB_FORCE_XQSPI_DIV4_PCLK_Msk (0x1UL << MCU_SUB_FORCE_XQSPI_DIV4_PCLK_Pos) +#define MCU_SUB_FORCE_XQSPI_DIV4_PCLK MCU_SUB_FORCE_XQSPI_DIV4_PCLK_Msk + +#define MCU_SUB_WFI_XQSPI_DIV4_PCLK_Pos (26U) +#define MCU_SUB_WFI_XQSPI_DIV4_PCLK_Len (1U) +#define MCU_SUB_WFI_XQSPI_DIV4_PCLK_Msk (0x1UL << MCU_SUB_WFI_XQSPI_DIV4_PCLK_Pos) +#define MCU_SUB_WFI_XQSPI_DIV4_PCLK MCU_SUB_WFI_XQSPI_DIV4_PCLK_Msk + +#define MCU_SUB_FORCE_SECU_DIV4_PCLK_Pos (25U) +#define MCU_SUB_FORCE_SECU_DIV4_PCLK_Len (1U) +#define MCU_SUB_FORCE_SECU_DIV4_PCLK_Msk (0x1UL << MCU_SUB_FORCE_SECU_DIV4_PCLK_Pos) +#define MCU_SUB_FORCE_SECU_DIV4_PCLK MCU_SUB_FORCE_SECU_DIV4_PCLK_Msk + +#define MCU_SUB_WFI_SECU_DIV4_PCLK_Pos (24U) +#define MCU_SUB_WFI_SECU_DIV4_PCLK_Len (1U) +#define MCU_SUB_WFI_SECU_DIV4_PCLK_Msk (0x1UL << MCU_SUB_WFI_SECU_DIV4_PCLK_Pos) +#define MCU_SUB_WFI_SECU_DIV4_PCLK MCU_SUB_WFI_SECU_DIV4_PCLK_Msk + +#define MCU_SUB_FORCE_I2S_HCLK_Pos (16U) +#define MCU_SUB_FORCE_I2S_HCLK_Len (1U) +#define MCU_SUB_FORCE_I2S_HCLK_Msk (0x1UL << MCU_SUB_FORCE_I2S_HCLK_Pos) +#define MCU_SUB_FORCE_I2S_HCLK MCU_SUB_FORCE_I2S_HCLK_Msk + +#define MCU_SUB_FORCE_QSPI1_HCLK_Pos (15U) +#define MCU_SUB_FORCE_QSPI1_HCLK_Len (1U) +#define MCU_SUB_FORCE_QSPI1_HCLK_Msk (0x1UL << MCU_SUB_FORCE_QSPI1_HCLK_Pos) +#define MCU_SUB_FORCE_QSPI1_HCLK MCU_SUB_FORCE_QSPI1_HCLK_Msk + +#define MCU_SUB_FORCE_QSPI0_HCLK_Pos (14U) +#define MCU_SUB_FORCE_QSPI0_HCLK_Len (1U) +#define MCU_SUB_FORCE_QSPI0_HCLK_Msk (0x1UL << MCU_SUB_FORCE_QSPI0_HCLK_Pos) +#define MCU_SUB_FORCE_QSPI0_HCLK MCU_SUB_FORCE_QSPI0_HCLK_Msk + +#define MCU_SUB_FORCE_SPIS_HCLK_Pos (13U) +#define MCU_SUB_FORCE_SPIS_HCLK_Len (1U) +#define MCU_SUB_FORCE_SPIS_HCLK_Msk (0x1UL << MCU_SUB_FORCE_SPIS_HCLK_Pos) +#define MCU_SUB_FORCE_SPIS_HCLK MCU_SUB_FORCE_SPIS_HCLK_Msk + +#define MCU_SUB_FORCE_SPIM_HCLK_Pos (12U) +#define MCU_SUB_FORCE_SPIM_HCLK_Len (1U) +#define MCU_SUB_FORCE_SPIM_HCLK_Msk (0x1UL << MCU_SUB_FORCE_SPIM_HCLK_Pos) +#define MCU_SUB_FORCE_SPIM_HCLK MCU_SUB_FORCE_SPIM_HCLK_Msk + +#define MCU_SUB_FORCE_I2C1_HCLK_Pos (11U) +#define MCU_SUB_FORCE_I2C1_HCLK_Len (1U) +#define MCU_SUB_FORCE_I2C1_HCLK_Msk (0x1UL << MCU_SUB_FORCE_I2C1_HCLK_Pos) +#define MCU_SUB_FORCE_I2C1_HCLK MCU_SUB_FORCE_I2C1_HCLK_Msk + +#define MCU_SUB_FORCE_I2C0_HCLK_Pos (10U) +#define MCU_SUB_FORCE_I2C0_HCLK_Len (1U) +#define MCU_SUB_FORCE_I2C0_HCLK_Msk (0x1UL << MCU_SUB_FORCE_I2C0_HCLK_Pos) +#define MCU_SUB_FORCE_I2C0_HCLK MCU_SUB_FORCE_I2C0_HCLK_Msk + +#define MCU_SUB_FORCE_UART1_HCLK_Pos (9U) +#define MCU_SUB_FORCE_UART1_HCLK_Len (1U) +#define MCU_SUB_FORCE_UART1_HCLK_Msk (0x1UL << MCU_SUB_FORCE_UART1_HCLK_Pos) +#define MCU_SUB_FORCE_UART1_HCLK MCU_SUB_FORCE_UART1_HCLK_Msk + +#define MCU_SUB_FORCE_UART0_HCLK_Pos (8U) +#define MCU_SUB_FORCE_UART0_HCLK_Len (1U) +#define MCU_SUB_FORCE_UART0_HCLK_Msk (0x1UL << MCU_SUB_FORCE_UART0_HCLK_Pos) +#define MCU_SUB_FORCE_UART0_HCLK MCU_SUB_FORCE_UART0_HCLK_Msk + +#define MCU_SUB_I2S_LP_EN_Pos (2U) +#define MCU_SUB_I2S_LP_EN_Len (1U) +#define MCU_SUB_I2S_LP_EN_Msk (0x1UL << MCU_SUB_I2S_LP_EN_Pos) +#define MCU_SUB_I2S_LP_EN MCU_SUB_I2S_LP_EN_Msk + +#define MCU_SUB_UART_LP_PCLK_EN_Pos (1U) +#define MCU_SUB_UART_LP_PCLK_EN_Len (1U) +#define MCU_SUB_UART_LP_PCLK_EN_Msk (0x1UL << MCU_SUB_UART_LP_PCLK_EN_Pos) +#define MCU_SUB_UART_LP_PCLK_EN MCU_SUB_UART_LP_PCLK_EN_Msk + +#define MCU_SUB_UART_LP_SCLK_EN_Pos (0U) +#define MCU_SUB_UART_LP_SCLK_EN_Len (1U) +#define MCU_SUB_UART_LP_SCLK_EN_Msk (0x1UL << MCU_SUB_UART_LP_SCLK_EN_Pos) +#define MCU_SUB_UART_LP_SCLK_EN MCU_SUB_UART_LP_SCLK_EN_Msk + +/********** Bit definition for MCU_SUB_REG_BLE_DSLEEP_CORR_EN register ***********/ +#define MCU_SUB_BLE_DSLEEP_CORR_EN_Pos (0U) +#define MCU_SUB_BLE_DSLEEP_CORR_EN_Len (2U) +#define MCU_SUB_BLE_DSLEEP_CORR_EN_Msk (0x3U << MCU_SUB_BLE_DSLEEP_CORR_EN_Pos) +#define MCU_SUB_BLE_DSLEEP_CORR_HW_EN (0x02 << MCU_SUB_BLE_DSLEEP_CORR_EN_Pos) +#define MCU_SUB_BLE_DSLEEP_CORR_SW_EN (0x01 << MCU_SUB_BLE_DSLEEP_CORR_EN_Pos) + +/********** Bit definition for MCU_SUB_REG_BLE_DSLEEP_HW_TIM_CORR register ***********/ +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD_Pos (12U) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD_Len (18U) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD_Msk (0x3FFFFU << MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD_Pos) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_CLK_PERIOD_Msk + +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY_Pos (0U) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY_Len (9U) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY_Msk (0x1FFU << MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY_Pos) +#define MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY MCU_SUB_BLE_DSLEEP_HW_TIM_CORR_DELAY_Msk + + + +/* ================================================================================================================= */ +/* ================ PKC ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for PKC_CTRL register *******************/ +#define PKC_CTRL_EN_Pos (0U) +#define PKC_CTRL_EN_Len (1U) +#define PKC_CTRL_EN_Msk (0x1U << PKC_CTRL_EN_Pos) +#define PKC_CTRL_EN PKC_CTRL_EN_Msk + +#define PKC_CTRL_START_Pos (1U) +#define PKC_CTRL_START_Len (1U) +#define PKC_CTRL_START_Msk (0x1U << PKC_CTRL_START_Pos) +#define PKC_CTRL_START PKC_CTRL_START_Msk + +#define PKC_CTRL_SWCTRL_Pos (4U) +#define PKC_CTRL_SWCTRL_Len (1U) +#define PKC_CTRL_SWCTRL_Msk (0x1U << PKC_CTRL_SWCTRL_Pos) +#define PKC_CTRL_SWCTRL PKC_CTRL_SWCTRL_Msk + +#define PKC_CTRL_SWRST_Pos (8U) +#define PKC_CTRL_SWRST_Len (1U) +#define PKC_CTRL_SWRST_Msk (0x1U << PKC_CTRL_SWRST_Pos) +#define PKC_CTRL_SWRST PKC_CTRL_SWRST_Msk + +/******************* Bit definition for PKC_CONFIG0 register ****************/ +#define PKC_CONFIG0_KPTR_Pos (0U) +#define PKC_CONFIG0_KPTR_Len (9U) +#define PKC_CONFIG0_KPTR_Msk (0x000001FFU) +#define PKC_CONFIG0_KPTR PKC_CONFIG0_KPTR_Msk + +#define PKC_CONFIG0_RPTR_Pos (16U) +#define PKC_CONFIG0_RPTR_Len (9U) +#define PKC_CONFIG0_RPTR_Msk (0x01FF0000U) +#define PKC_CONFIG0_RPTR PKC_CONFIG0_RPTR_Msk + +/******************* Bit definition for PKC_CONFIG1 register ****************/ +#define PKC_CONFIG1_PPTR_Pos (0U) +#define PKC_CONFIG1_PPTR_Len (9U) +#define PKC_CONFIG1_PPTR_Msk (0x000001FFU) +#define PKC_CONFIG1_PPTR PKC_CONFIG1_PPTR_Msk + +#define PKC_CONFIG1_RSQPTR_Pos (16U) +#define PKC_CONFIG1_RSQPTR_Len (9U) +#define PKC_CONFIG1_RSQPTR_Msk (0x01FF0000U) +#define PKC_CONFIG1_RSQPTR PKC_CONFIG1_RSQPTR_Msk + +/******************* Bit definition for PKC_CONFIG2 register ****************/ +#define PKC_CONFIG2_GXPTR_Pos (0U) +#define PKC_CONFIG2_GXPTR_Len (9U) +#define PKC_CONFIG2_GXPTR_Msk (0x000001FFU) +#define PKC_CONFIG2_GXPTR PKC_CONFIG2_GXPTR_Msk + +#define PKC_CONFIG2_GYPTR_Pos (16U) +#define PKC_CONFIG2_GYPTR_Len (9U) +#define PKC_CONFIG2_GYPTR_Msk (0x01FF0000U) +#define PKC_CONFIG2_GYPTR PKC_CONFIG2_GYPTR_Msk + +/******************* Bit definition for PKC_CONFIG3 register ****************/ +#define PKC_CONFIG3_GZPTR_Pos (0U) +#define PKC_CONFIG3_GZPTR_Len (9U) +#define PKC_CONFIG3_GZPTR_Msk (0x000001FFU) +#define PKC_CONFIG3_GZPTR PKC_CONFIG3_GZPTR_Msk + +#define PKC_CONFIG3_R0XPTR_Pos (16U) +#define PKC_CONFIG3_R0XPTR_Len (9U) +#define PKC_CONFIG3_R0XPTR_Msk (0x01FF0000U) +#define PKC_CONFIG3_R0XPTR PKC_CONFIG3_R0XPTR_Msk + +/******************* Bit definition for PKC_CONFIG4 register ****************/ +#define PKC_CONFIG4_R0YPTR_Pos (0U) +#define PKC_CONFIG4_R0YPTR_Len (9U) +#define PKC_CONFIG4_R0YPTR_Msk (0x000001FFU) +#define PKC_CONFIG4_R0YPTR PKC_CONFIG4_R0YPTR_Msk + +#define PKC_CONFIG4_R0ZPTR_Pos (16U) +#define PKC_CONFIG4_R0ZPTR_Len (9U) +#define PKC_CONFIG4_R0ZPTR_Msk (0x01FF0000U) +#define PKC_CONFIG4_R0ZPTR PKC_CONFIG4_R0ZPTR_Msk + +/******************* Bit definition for PKC_CONFIG5 register ****************/ +#define PKC_CONFIG5_R1XPTR_Pos (0U) +#define PKC_CONFIG5_R1XPTR_Len (9U) +#define PKC_CONFIG5_R1XPTR_Msk (0x000001FFU) +#define PKC_CONFIG5_R1XPTR PKC_CONFIG5_R1XPTR_Msk + +#define PKC_CONFIG5_R1YPTR_Pos (16U) +#define PKC_CONFIG5_R1YPTR_Len (9U) +#define PKC_CONFIG5_R1YPTR_Msk (0x01FF0000U) +#define PKC_CONFIG5_R1YPTR PKC_CONFIG5_R1YPTR_Msk + +/******************* Bit definition for PKC_CONFIG6 register ****************/ +#define PKC_CONFIG6_R1ZPTR_Pos (0U) +#define PKC_CONFIG6_R1ZPTR_Len (9U) +#define PKC_CONFIG6_R1ZPTR_Msk (0x000001FFU) +#define PKC_CONFIG6_R1ZPTR PKC_CONFIG6_R1ZPTR_Msk + +#define PKC_CONFIG6_TMP1PTR_Pos (16U) +#define PKC_CONFIG6_TMP1PTR_Len (9U) +#define PKC_CONFIG6_TMP1PTR_Msk (0x01FF0000U) +#define PKC_CONFIG6_TMP1PTR PKC_CONFIG6_TMP1PTR_Msk + +/******************* Bit definition for PKC_CONFIG7 register ****************/ +#define PKC_CONFIG7_TMP2PTR_Pos (0U) +#define PKC_CONFIG7_TMP2PTR_Len (9U) +#define PKC_CONFIG7_TMP2PTR_Msk (0x000001FFU) +#define PKC_CONFIG7_TMP2PTR PKC_CONFIG7_TMP2PTR_Msk + +#define PKC_CONFIG7_TMP3PTR_Pos (16U) +#define PKC_CONFIG7_TMP3PTR_Len (9U) +#define PKC_CONFIG7_TMP3PTR_Msk (0x01FF0000U) +#define PKC_CONFIG7_TMP3PTR PKC_CONFIG7_TMP3PTR_Msk + +/******************* Bit definition for PKC_CONFIG8 register ****************/ +#define PKC_CONFIG8_TMP4PTR_Pos (0U) +#define PKC_CONFIG8_TMP4PTR_Len (9U) +#define PKC_CONFIG8_TMP4PTR_Msk (0x000001FFU) +#define PKC_CONFIG8_TMP4PTR PKC_CONFIG8_TMP4PTR_Msk + +#define PKC_CONFIG8_TMP5PTR_Pos (16U) +#define PKC_CONFIG8_TMP5PTR_Len (9U) +#define PKC_CONFIG8_TMP5PTR_Msk (0x01FF0000U) +#define PKC_CONFIG8_TMP5PTR PKC_CONFIG8_TMP5PTR_Msk + +/******************* Bit definition for PKC_CONFIG9 register ****************/ +#define PKC_CONFIG9_TMP6PTR_Pos (0U) +#define PKC_CONFIG9_TMP6PTR_Len (9U) +#define PKC_CONFIG9_TMP6PTR_Msk (0x000001FFU) +#define PKC_CONFIG9_TMP6PTR PKC_CONFIG9_TMP6PTR_Msk + +#define PKC_CONFIG9_CONST1PTR_Pos (16U) +#define PKC_CONFIG9_CONST1PTR_Len (9U) +#define PKC_CONFIG9_CONST1PTR_Msk (0x01FF0000U) +#define PKC_CONFIG9_CONST1PTR PKC_CONFIG9_CONST1PTR_Msk + +/******************* Bit definition for PKC_CONFIG10 register ****************/ +#define PKC_CONFIG10_X1PTR_Pos (0U) +#define PKC_CONFIG10_X1PTR_Len (9U) +#define PKC_CONFIG10_X1PTR_Msk (0x000001FFU) +#define PKC_CONFIG10_X1PTR PKC_CONFIG10_X1PTR_Msk + +#define PKC_CONFIG10_X2PTR_Pos (16U) +#define PKC_CONFIG10_X2PTR_Len (9U) +#define PKC_CONFIG10_X2PTR_Msk (0x01FF0000U) +#define PKC_CONFIG10_X2PTR PKC_CONFIG10_X2PTR_Msk + +/******************* Bit definition for PKC_CONFIG11 register ****************/ +#define PKC_CONFIG11_MITMPPTR_Pos (0U) +#define PKC_CONFIG11_MITMPPTR_Len (9U) +#define PKC_CONFIG11_MITMPPTR_Msk (0x000001FFU) +#define PKC_CONFIG11_MITMPPTR PKC_CONFIG11_MITMPPTR_Msk + +#define PKC_CONFIG11_TMPKPTR_Pos (16U) +#define PKC_CONFIG11_TMPKPTR_Len (9U) +#define PKC_CONFIG11_TMPKPTR_Msk (0x01FF0000U) +#define PKC_CONFIG11_TMPKPTR PKC_CONFIG11_TMPKPTR_Msk + +/******************* Bit definition for PKC_CONFIG12 register ****************/ +#define PKC_CONFIG12_APTR_Pos (0U) +#define PKC_CONFIG12_APTR_Len (9U) +#define PKC_CONFIG12_APTR_Msk (0x000001FFU) +#define PKC_CONFIG12_APTR PKC_CONFIG12_APTR_Msk + +#define PKC_CONFIG12_BPTR_Pos (16U) +#define PKC_CONFIG12_BPTR_Len (9U) +#define PKC_CONFIG12_BPTR_Msk (0x01FF0000U) +#define PKC_CONFIG12_BPTR PKC_CONFIG12_BPTR_Msk + +/******************* Bit definition for PKC_CONFIG13 register ****************/ +#define PKC_CONFIG13_CONSTQ_Pos (0U) +#define PKC_CONFIG13_CONSTQ_Len (32U) +#define PKC_CONFIG13_CONSTQ_Msk (0xFFFFFFFFU) +#define PKC_CONFIG13_CONSTQ PKC_CONFIG13_CONSTQ_Msk + +/******************* Bit definition for PKC_SW_CTRL register *****************/ +#define PKC_SW_CTRL_OPSTART_Pos (0U) +#define PKC_SW_CTRL_OPSTART_Len (1U) +#define PKC_SW_CTRL_OPSTART_Msk (0x1U << PKC_SW_CTRL_OPSTART_Pos) +#define PKC_SW_CTRL_OPSTART PKC_SW_CTRL_OPSTART_Msk + +#define PKC_SW_CTRL_OPMODE_Pos (4U) +#define PKC_SW_CTRL_OPMODE_Len (3U) +#define PKC_SW_CTRL_OPMODE_Msk (0x7U << PKC_SW_CTRL_OPMODE_Pos) +#define PKC_SW_CTRL_OPMODE PKC_SW_CTRL_OPMODE_Msk + +#define PKC_SW_CTRL_STARTDM_Pos (8U) +#define PKC_SW_CTRL_STARTDM_Len (1U) +#define PKC_SW_CTRL_STARTDM_Msk (0x1U << PKC_SW_CTRL_STARTDM_Pos) +#define PKC_SW_CTRL_STARTDM PKC_SW_CTRL_STARTDM_Msk + +#define PKC_SW_CTRL_RANDEN_Pos (9U) +#define PKC_SW_CTRL_RANDEN_Len (1U) +#define PKC_SW_CTRL_RANDEN_Msk (0x1U << PKC_SW_CTRL_RANDEN_Pos) +#define PKC_SW_CTRL_RANDEN PKC_SW_CTRL_RANDEN_Msk + +/******************* Bit definition for PKC_SW_CONFIG0 register ************/ +#define PKC_SW_CONFIG0_MMAPTR_Pos (0U) +#define PKC_SW_CONFIG0_MMAPTR_Len (9U) +#define PKC_SW_CONFIG0_MMAPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG0_MMAPTR PKC_SW_CONFIG0_MMAPTR_Msk + +#define PKC_SW_CONFIG0_MMBPTR_Pos (16U) +#define PKC_SW_CONFIG0_MMBPTR_Len (9U) +#define PKC_SW_CONFIG0_MMBPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG0_MMBPTR PKC_SW_CONFIG0_MMBPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG1 register ************/ +#define PKC_SW_CONFIG1_MMPPTR_Pos (0U) +#define PKC_SW_CONFIG1_MMPPTR_Len (9U) +#define PKC_SW_CONFIG1_MMPPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG1_MMPPTR PKC_SW_CONFIG1_MMPPTR_Msk + +#define PKC_SW_CONFIG1_MMCPTR_Pos (16U) +#define PKC_SW_CONFIG1_MMCPTR_Len (9U) +#define PKC_SW_CONFIG1_MMCPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG1_MMCPTR PKC_SW_CONFIG1_MMCPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG2 register ************/ +#define PKC_SW_CONFIG2_MASAPTR_Pos (0U) +#define PKC_SW_CONFIG2_MASAPTR_Len (9U) +#define PKC_SW_CONFIG2_MASAPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG2_MASAPTR PKC_SW_CONFIG2_MASAPTR_Msk + +#define PKC_SW_CONFIG2_MASBPTR_Pos (16U) +#define PKC_SW_CONFIG2_MASBPTR_Len (9U) +#define PKC_SW_CONFIG2_MASBPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG2_MASBPTR PKC_SW_CONFIG2_MASBPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG3 register ************/ +#define PKC_SW_CONFIG3_MASPPTR_Pos (0U) +#define PKC_SW_CONFIG3_MASPPTR_Len (9U) +#define PKC_SW_CONFIG3_MASPPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG3_MASPPTR PKC_SW_CONFIG3_MASPPTR_Msk + +#define PKC_SW_CONFIG3_MASCPTR_Pos (16U) +#define PKC_SW_CONFIG3_MASCPTR_Len (9U) +#define PKC_SW_CONFIG3_MASCPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG3_MASCPTR PKC_SW_CONFIG3_MASCPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG4 register ************/ +#define PKC_SW_CONFIG4_MIUPTR_Pos (0U) +#define PKC_SW_CONFIG4_MIUPTR_Len (9U) +#define PKC_SW_CONFIG4_MIUPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG4_MIUPTR PKC_SW_CONFIG4_MIUPTR_Msk + +#define PKC_SW_CONFIG4_MIVPTR_Pos (16U) +#define PKC_SW_CONFIG4_MIVPTR_Len (9U) +#define PKC_SW_CONFIG4_MIVPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG4_MIVPTR PKC_SW_CONFIG4_MIVPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG5 register ************/ +#define PKC_SW_CONFIG5_MIX1PTR_Pos (0U) +#define PKC_SW_CONFIG5_MIX1PTR_Len (9U) +#define PKC_SW_CONFIG5_MIX1PTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG5_MIX1PTR PKC_SW_CONFIG5_MIX1PTR_Msk + +#define PKC_SW_CONFIG5_MIX2PTR_Pos (16U) +#define PKC_SW_CONFIG5_MIX2PTR_Len (9U) +#define PKC_SW_CONFIG5_MIX2PTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG5_MIX2PTR PKC_SW_CONFIG5_MIX2PTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG6 register ************/ +#define PKC_SW_CONFIG6_MITMPPTR_Pos (0U) +#define PKC_SW_CONFIG6_MITMPPTR_Len (9U) +#define PKC_SW_CONFIG6_MITMPPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG6_MITMPPTR PKC_SW_CONFIG6_MITMPPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG7 register ************/ +#define PKC_SW_CONFIG7_WORDLEN_Pos (0U) +#define PKC_SW_CONFIG7_WORDLEN_Len (6U) +#define PKC_SW_CONFIG7_WORDLEN_Msk (0x0000003FU) +#define PKC_SW_CONFIG7_WORDLEN PKC_SW_CONFIG7_WORDLEN_Msk + +/******************* Bit definition for PKC_SW_CONFIG8 register ************/ +#define PKC_SW_CONFIG8_MIKOUT_Pos (0U) +#define PKC_SW_CONFIG8_MIKOUT_Len (13U) +#define PKC_SW_CONFIG8_MIKOUT_Msk (0x00001FFFU) +#define PKC_SW_CONFIG8_MIKOUT PKC_SW_CONFIG8_MIKOUT_Msk + +/******************* Bit definition for PKC_SW_CONFIG9 register ************/ +#define PKC_SW_CONFIG9_DMRNGSEED_Pos (0U) +#define PKC_SW_CONFIG9_DMRNGSEED_Len (32U) +#define PKC_SW_CONFIG9_DMRNGSEED_Msk (0xFFFFFFFFU) +#define PKC_SW_CONFIG9_DMRNGSEED PKC_SW_CONFIG9_DMRNGSEED_Msk + +/******************* Bit definition for PKC_SW_CONFIG10 register ************/ +#define PKC_SW_CONFIG10_BMAPTR_Pos (0U) +#define PKC_SW_CONFIG10_BMAPTR_Len (9U) +#define PKC_SW_CONFIG10_BMAPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG10_BMAPTR PKC_SW_CONFIG10_BMAPTR_Msk + +#define PKC_SW_CONFIG10_BMBPTR_Pos (16U) +#define PKC_SW_CONFIG10_BMBPTR_Len (9U) +#define PKC_SW_CONFIG10_BMBPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG10_BMBPTR PKC_SW_CONFIG10_BMBPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG11 register ************/ +#define PKC_SW_CONFIG11_BMCPTR_Pos (0U) +#define PKC_SW_CONFIG11_BMCPTR_Len (9U) +#define PKC_SW_CONFIG11_BMCPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG11_BMCPTR PKC_SW_CONFIG11_BMCPTR_Msk + +#define PKC_SW_CONFIG11_BAAPTR_Pos (16U) +#define PKC_SW_CONFIG11_BAAPTR_Len (9U) +#define PKC_SW_CONFIG11_BAAPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG11_BAAPTR PKC_SW_CONFIG11_BAAPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG12 register ************/ +#define PKC_SW_CONFIG12_BABPTR_Pos (0U) +#define PKC_SW_CONFIG12_BABPTR_Len (9U) +#define PKC_SW_CONFIG12_BABPTR_Msk (0x000001FFU) +#define PKC_SW_CONFIG12_BABPTR PKC_SW_CONFIG12_BABPTR_Msk + +#define PKC_SW_CONFIG12_BACPTR_Pos (16U) +#define PKC_SW_CONFIG12_BACPTR_Len (9U) +#define PKC_SW_CONFIG12_BACPTR_Msk (0x01FF0000U) +#define PKC_SW_CONFIG12_BACPTR PKC_SW_CONFIG12_BACPTR_Msk + +/******************* Bit definition for PKC_SW_CONFIG13 register ************/ +#define PKC_SW_CONFIG13_RANDSEED_Pos (0U) +#define PKC_SW_CONFIG13_RANDSEED_Len (32U) +#define PKC_SW_CONFIG13_RANDSEED_Msk (0xFFFFFFFFU) +#define PKC_SW_CONFIG13_RANDSEED PKC_SW_CONFIG13_RANDSEED_Msk + +/******************* Bit definition for PKC_INT_STATUS register ************/ +#define PKC_INTSTAT_DONE_Pos (0U) +#define PKC_INTSTAT_DONE_Len (1U) +#define PKC_INTSTAT_DONE_Msk (0x1U << PKC_INTSTAT_DONE_Pos) +#define PKC_INTSTAT_DONE PKC_INTSTAT_DONE_Msk + +#define PKC_INTSTAT_ERR_Pos (1U) +#define PKC_INTSTAT_ERR_Len (1U) +#define PKC_INTSTAT_ERR_Msk (0x1U << PKC_INTSTAT_ERR_Pos) +#define PKC_INTSTAT_ERR PKC_INTSTAT_ERR_Msk + +#define PKC_INTSTAT_BAOVF_Pos (2U) +#define PKC_INTSTAT_BAOVF_Len (1U) +#define PKC_INTSTAT_BAOVF_Msk (0x1U << PKC_INTSTAT_BAOVF_Pos) +#define PKC_INTSTAT_BAOVF PKC_INTSTAT_BAOVF_Msk + +/******************* Bit definition for PKC_INT_ENABLE register ************/ +#define PKC_INTEN_DONE_Pos (0U) +#define PKC_INTEN_DONE_Len (1U) +#define PKC_INTEN_DONE_Msk (0x1U << PKC_INTEN_DONE_Pos) +#define PKC_INTEN_DONE PKC_INTEN_DONE_Msk + +#define PKC_INTEN_ERR_Pos (1U) +#define PKC_INTEN_ERR_Len (1U) +#define PKC_INTEN_ERR_Msk (0x1U << PKC_INTEN_ERR_Pos) +#define PKC_INTEN_ERR PKC_INTEN_ERR_Msk + +#define PKC_INTEN_BAOVF_Pos (2U) +#define PKC_INTEN_BAOVF_Len (1U) +#define PKC_INTEN_BAOVF_Msk (0x1U << PKC_INTEN_BAOVF_Pos) +#define PKC_INTEN_BAOVF PKC_INTEN_BAOVF_Msk + +/******************* Bit definition for PKC_WORK_STATUS register ***********/ +#define PKC_WORKSTAT_BUSY_Pos (0U) +#define PKC_WORKSTAT_BUSY_Len (1U) +#define PKC_WORKSTAT_BUSY_Msk (0x1U << PKC_WORKSTAT_BUSY_Pos) +#define PKC_WORKSTAT_BUSY PKC_WORKSTAT_BUSY_Msk + +/******************* Bit definition for PKC_DUMMY0 register ****************/ +#define PKC_DUMMY0_DUMMY0_Pos (0U) +#define PKC_DUMMY0_DUMMY0_Len (32U) +#define PKC_DUMMY0_DUMMY0_Msk (0xFFFFFFFFU) +#define PKC_DUMMY0_DUMMY0 PKC_DUMMY0_DUMMY0_Msk + +/******************* Bit definition for PKC_DUMMY1 register ****************/ +#define PKC_DUMMY1_DUMMY1_Pos (0U) +#define PKC_DUMMY1_DUMMY1_Len (32U) +#define PKC_DUMMY1_DUMMY1_Msk (0xFFFFFFFFU) +#define PKC_DUMMY1_DUMMY1 PKC_DUMMY1_DUMMY1_Msk + +/******************* Bit definition for PKC_DUMMY2 register ****************/ +#define PKC_DUMMY2_DUMMY2_Pos (0U) +#define PKC_DUMMY2_DUMMY2_Len (32U) +#define PKC_DUMMY2_DUMMY2_Msk (0xFFFFFFFFU) +#define PKC_DUMMY2_DUMMY2 PKC_DUMMY2_DUMMY2_Msk + + +/* ================================================================================================================= */ +/* ================ PWM ================ */ +/* ================================================================================================================= */ + +/******************* Bit definition for PWM_MODE register *******************/ +#define PWM_MODE_EN_Pos (0U) +#define PWM_MODE_EN_Len (1U) +#define PWM_MODE_EN_Msk (0x1U << PWM_MODE_EN_Pos) +#define PWM_MODE_EN PWM_MODE_EN_Msk + +#define PWM_MODE_PAUSE_Pos (1U) +#define PWM_MODE_PAUSE_Len (1U) +#define PWM_MODE_PAUSE_Msk (0x1U << PWM_MODE_PAUSE_Pos) +#define PWM_MODE_PAUSE PWM_MODE_PAUSE_Msk + +#define PWM_MODE_BREATHEN_Pos (2U) +#define PWM_MODE_BREATHEN_Len (1U) +#define PWM_MODE_BREATHEN_Msk (0x1U << PWM_MODE_BREATHEN_Pos) +#define PWM_MODE_BREATHEN PWM_MODE_BREATHEN_Msk + +#define PWM_MODE_DPENA_Pos (3U) +#define PWM_MODE_DPENA_Len (1U) +#define PWM_MODE_DPENA_Msk (0x1U << PWM_MODE_DPENA_Pos) +#define PWM_MODE_DPENA PWM_MODE_DPENA_Msk + +#define PWM_MODE_DPENB_Pos (4U) +#define PWM_MODE_DPENB_Len (1U) +#define PWM_MODE_DPENB_Msk (0x1U << PWM_MODE_DPENB_Pos) +#define PWM_MODE_DPENB PWM_MODE_DPENB_Msk + +#define PWM_MODE_DPENC_Pos (5U) +#define PWM_MODE_DPENC_Len (1U) +#define PWM_MODE_DPENC_Msk (0x1U << PWM_MODE_DPENC_Pos) +#define PWM_MODE_DPENC PWM_MODE_DPENC_Msk + +/******************* Bit definition for PWM_UPDATE register *****************/ +#define PWM_UPDATE_SAG_Pos (0U) +#define PWM_UPDATE_SAG_Len (1U) +#define PWM_UPDATE_SAG_Msk (0x1U << PWM_UPDATE_SAG_Pos) +#define PWM_UPDATE_SAG PWM_UPDATE_SAG_Msk + +#define PWM_UPDATE_SA_Pos (1U) +#define PWM_UPDATE_SA_Len (1U) +#define PWM_UPDATE_SA_Msk (0x1U << PWM_UPDATE_SA_Pos) +#define PWM_UPDATE_SA PWM_UPDATE_SA_Msk + +#define PWM_UPDATE_SSPRD_Pos (8U) +#define PWM_UPDATE_SSPRD_Len (1U) +#define PWM_UPDATE_SSPRD_Msk (0x1U << PWM_UPDATE_SSPRD_Pos) +#define PWM_UPDATE_SSPRD PWM_UPDATE_SSPRD_Msk + +#define PWM_UPDATE_SSCMPA0_Pos (9U) +#define PWM_UPDATE_SSCMPA0_Len (1U) +#define PWM_UPDATE_SSCMPA0_Msk (0x1U << PWM_UPDATE_SSCMPA0_Pos) +#define PWM_UPDATE_SSCMPA0 PWM_UPDATE_SSCMPA0_Msk + +#define PWM_UPDATE_SSCMPA1_Pos (10U) +#define PWM_UPDATE_SSCMPA1_Len (1U) +#define PWM_UPDATE_SSCMPA1_Msk (0x1U << PWM_UPDATE_SSCMPA1_Pos) +#define PWM_UPDATE_SSCMPA1 PWM_UPDATE_SSCMPA1_Msk + +#define PWM_UPDATE_SSCMPB0_Pos (11U) +#define PWM_UPDATE_SSCMPB0_Len (1U) +#define PWM_UPDATE_SSCMPB0_Msk (0x1U << PWM_UPDATE_SSCMPB0_Pos) +#define PWM_UPDATE_SSCMPB0 PWM_UPDATE_SSCMPB0_Msk + +#define PWM_UPDATE_SSCMPB1_Pos (12U) +#define PWM_UPDATE_SSCMPB1_Len (1U) +#define PWM_UPDATE_SSCMPB1_Msk (0x1U << PWM_UPDATE_SSCMPB1_Pos) +#define PWM_UPDATE_SSCMPB1 PWM_UPDATE_SSCMPB1_Msk + +#define PWM_UPDATE_SSCMPC0_Pos (13U) +#define PWM_UPDATE_SSCMPC0_Len (1U) +#define PWM_UPDATE_SSCMPC0_Msk (0x1U << PWM_UPDATE_SSCMPC0_Pos) +#define PWM_UPDATE_SSCMPC0 PWM_UPDATE_SSCMPC0_Msk + +#define PWM_UPDATE_SSCMPC1_Pos (14U) +#define PWM_UPDATE_SSCMPC1_Len (1U) +#define PWM_UPDATE_SSCMPC1_Msk (0x1U << PWM_UPDATE_SSCMPC1_Pos) +#define PWM_UPDATE_SSCMPC1 PWM_UPDATE_SSCMPC1_Msk + +#define PWM_UPDATE_SSPAUSE_Pos (15U) +#define PWM_UPDATE_SSPAUSE_Len (1U) +#define PWM_UPDATE_SSPAUSE_Msk (0x1U << PWM_UPDATE_SSPAUSE_Pos) +#define PWM_UPDATE_SSPAUSE PWM_UPDATE_SSPAUSE_Msk + +#define PWM_UPDATE_SSBRPRD_Pos (16U) +#define PWM_UPDATE_SSBRPRD_Len (1U) +#define PWM_UPDATE_SSBRPRD_Msk (0x1U << PWM_UPDATE_SSBRPRD_Pos) +#define PWM_UPDATE_SSBRPRD PWM_UPDATE_SSBRPRD_Msk + +#define PWM_UPDATE_SSHOLD_Pos (17U) +#define PWM_UPDATE_SSHOLD_Len (1U) +#define PWM_UPDATE_SSHOLD_Msk (0x1U << PWM_UPDATE_SSHOLD_Pos) +#define PWM_UPDATE_SSHOLD PWM_UPDATE_SSHOLD_Msk + +#define PWM_UPDATE_SSAQCTRL_Pos (18U) +#define PWM_UPDATE_SSAQCTRL_Len (1U) +#define PWM_UPDATE_SSAQCTRL_Msk (0x1U << PWM_UPDATE_SSAQCTRL_Pos) +#define PWM_UPDATE_SSAQCTRL PWM_UPDATE_SSAQCTRL_Msk + +/******************* Bit definition for PWM_PRD register ********************/ +#define PWM_PRD_PRD_Pos (0U) +#define PWM_PRD_PRD_Len (32U) +#define PWM_PRD_PRD_Msk (0xFFFFFFFFU) +#define PWM_PRD_PRD PWM_PRD_PRD_Msk + +/******************* Bit definition for PWM_CMPA0 register ******************/ +#define PWM_CMPA0_CMPA0_Pos (0U) +#define PWM_CMPA0_CMPA0_Len (32U) +#define PWM_CMPA0_CMPA0_Msk (0xFFFFFFFFU) +#define PWM_CMPA0_CMPA0 PWM_CMPA0_CMPA0_Msk + +/******************* Bit definition for PWM_CMPA1 register ******************/ +#define PWM_CMPA1_CMPA1_Pos (0U) +#define PWM_CMPA1_CMPA1_Len (32U) +#define PWM_CMPA1_CMPA1_Msk (0xFFFFFFFFU) +#define PWM_CMPA1_CMPA1 PWM_CMPA1_CMPA1_Msk + +/******************* Bit definition for PWM_CMPB0 register ******************/ +#define PWM_CMPB0_CMPB0_Pos (0U) +#define PWM_CMPB0_CMPB0_Len (32U) +#define PWM_CMPB0_CMPB0_Msk (0xFFFFFFFFU) +#define PWM_CMPB0_CMPB0 PWM_CMPB0_CMPB0_Msk + +/******************* Bit definition for PWM_CMPB1 register ******************/ +#define PWM_CMPB1_CMPB1_Pos (0U) +#define PWM_CMPB1_CMPB1_Len (32U) +#define PWM_CMPB1_CMPB1_Msk (0xFFFFFFFFU) +#define PWM_CMPB1_CMPB1 PWM_CMPB1_CMPB1_Msk + +/******************* Bit definition for PWM_CMPC0 register ******************/ +#define PWM_CMPC0_CMPC0_Pos (0U) +#define PWM_CMPC0_CMPC0_Len (32U) +#define PWM_CMPC0_CMPC0_Msk (0xFFFFFFFFU) +#define PWM_CMPC0_CMPC0 PWM_CMPC0_CMPC0_Msk + +/******************* Bit definition for PWM_CMPC1 register ******************/ +#define PWM_CMPC1_CMPC1_Pos (0U) +#define PWM_CMPC1_CMPC1_Len (32U) +#define PWM_CMPC1_CMPC1_Msk (0xFFFFFFFFU) +#define PWM_CMPC1_CMPC1 PWM_CMPC1_CMPC1_Msk + +/******************* Bit definition for PWM_AQCTRL register *****************/ +#define PWM_AQCTRL_A0_Pos (0U) +#define PWM_AQCTRL_A0_Len (2U) +#define PWM_AQCTRL_A0_Msk (0x3U << PWM_AQCTRL_A0_Pos) +#define PWM_AQCTRL_A0 PWM_AQCTRL_A0_Msk + +#define PWM_AQCTRL_A1_Pos (2U) +#define PWM_AQCTRL_A1_Len (2U) +#define PWM_AQCTRL_A1_Msk (0x3U << PWM_AQCTRL_A1_Pos) +#define PWM_AQCTRL_A1 PWM_AQCTRL_A1_Msk + +#define PWM_AQCTRL_B0_Pos (4U) +#define PWM_AQCTRL_B0_Len (2U) +#define PWM_AQCTRL_B0_Msk (0x3U << PWM_AQCTRL_B0_Pos) +#define PWM_AQCTRL_B0 PWM_AQCTRL_B0_Msk + +#define PWM_AQCTRL_B1_Pos (6U) +#define PWM_AQCTRL_B1_Len (2U) +#define PWM_AQCTRL_B1_Msk (0x3U << PWM_AQCTRL_B1_Pos) +#define PWM_AQCTRL_B1 PWM_AQCTRL_B1_Msk + +#define PWM_AQCTRL_C0_Pos (8U) +#define PWM_AQCTRL_C0_Len (2U) +#define PWM_AQCTRL_C0_Msk (0x3U << PWM_AQCTRL_C0_Pos) +#define PWM_AQCTRL_C0 PWM_AQCTRL_C0_Msk + +#define PWM_AQCTRL_C1_Pos (10U) +#define PWM_AQCTRL_C1_Len (2U) +#define PWM_AQCTRL_C1_Msk (0x3U << PWM_AQCTRL_C1_Pos) +#define PWM_AQCTRL_C1 PWM_AQCTRL_C1_Msk + +/******************* Bit definition for PWM_BRPRD register ******************/ +#define PWM_BRPRD_BRPRD_Pos (0U) +#define PWM_BRPRD_BRPRD_Len (32U) +#define PWM_BRPRD_BRPRD_Msk (0xFFFFFFFFU) +#define PWM_BRPRD_BRPRD PWM_BRPRD_BRPRD_Msk + +/******************* Bit definition for PWM_HOLD register *******************/ +#define PWM_HOLD_HOLD_Pos (0U) +#define PWM_HOLD_HOLD_Len (24U) +#define PWM_HOLD_HOLD_Msk (0x00FFFFFFU) +#define PWM_HOLD_HOLD PWM_HOLD_HOLD_Msk + + +/* ================================================================================================================= */ +/* ================ SSI ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for SSI_CTRL0 register ******************/ +#define SSI_CTRL0_SSTEN_Pos (24U) +#define SSI_CTRL0_SSTEN_Len (1U) +#define SSI_CTRL0_SSTEN_Msk (0x1U << SSI_CTRL0_SSTEN_Pos) +#define SSI_CTRL0_SSTEN SSI_CTRL0_SSTEN_Msk + +#define SSI_CTRL0_SPIFRF_Pos (21U) +#define SSI_CTRL0_SPIFRF_Len (2U) +#define SSI_CTRL0_SPIFRF_Msk (0x3U << SSI_CTRL0_SPIFRF_Pos) +#define SSI_CTRL0_SPIFRF SSI_CTRL0_SPIFRF_Msk + +#define SSI_CTRL0_DFS32_Pos (16U) +#define SSI_CTRL0_DFS32_Len (5U) +#define SSI_CTRL0_DFS32_Msk (0x1FU << SSI_CTRL0_DFS32_Pos) +#define SSI_CTRL0_DFS32 SSI_CTRL0_DFS32_Msk + +#define SSI_CTRL0_CFS_Pos (12U) +#define SSI_CTRL0_CFS_Len (4U) +#define SSI_CTRL0_CFS_Msk (0xFU << SSI_CTRL0_CFS_Pos) +#define SSI_CTRL0_CFS SSI_CTRL0_CFS_Msk + +#define SSI_CTRL0_SRL_Pos (11U) +#define SSI_CTRL0_SRL_Len (1U) +#define SSI_CTRL0_SRL_Msk (0x1U << SSI_CTRL0_SRL_Pos) +#define SSI_CTRL0_SRL SSI_CTRL0_SRL_Msk + +#define SSI_CTRL0_SLVOE_Pos (10U) +#define SSI_CTRL0_SLVOE_Len (1U) +#define SSI_CTRL0_SLVOE_Msk (0x1U << SSI_CTRL0_SLVOE_Pos) +#define SSI_CTRL0_SLVOE SSI_CTRL0_SLVOE_Msk + +#define SSI_CTRL0_TMOD_Pos (8U) +#define SSI_CTRL0_TMOD_Len (2U) +#define SSI_CTRL0_TMOD_Msk (0x3U << SSI_CTRL0_TMOD_Pos) +#define SSI_CTRL0_TMOD SSI_CTRL0_TMOD_Msk + +#define SSI_CTRL0_SCPOL_Pos (7U) +#define SSI_CTRL0_SCPOL_Len (1U) +#define SSI_CTRL0_SCPOL_Msk (0x1U << SSI_CTRL0_SCPOL_Pos) +#define SSI_CTRL0_SCPOL SSI_CTRL0_SCPOL_Msk + +#define SSI_CTRL0_SCPHA_Pos (6U) +#define SSI_CTRL0_SCPHA_Len (1U) +#define SSI_CTRL0_SCPHA_Msk (0x1U << SSI_CTRL0_SCPHA_Pos) +#define SSI_CTRL0_SCPHA SSI_CTRL0_SCPHA_Msk + +#define SSI_CTRL0_FRF_Pos (4U) +#define SSI_CTRL0_FRF_Len (2U) +#define SSI_CTRL0_FRF_Msk (0x3U << SSI_CTRL0_FRF_Pos) +#define SSI_CTRL0_FRF SSI_CTRL0_FRF_Msk + +#define SSI_CTRL1_NDF_Pos (0U) +#define SSI_CTRL1_NDF_Len (16U) +#define SSI_CTRL1_NDF_Msk (0xFFFFU << SSI_CTRL1_NDF_Pos) +#define SSI_CTRL1_NDF SSI_CTRL1_NDF_Msk + +/******************* Bit definition for SSI_SSIEN register ******************/ +#define SSI_SSIEN_EN_Pos (0U) +#define SSI_SSIEN_EN_Len (1U) +#define SSI_SSIEN_EN_Msk (0x1U << SSI_SSIEN_EN_Pos) +#define SSI_SSIEN_EN SSI_SSIEN_EN_Msk + +/******************* Bit definition for SSI_MWC register ********************/ +#define SSI_MWC_MHS_Pos (2U) +#define SSI_MWC_MHS_Len (1U) +#define SSI_MWC_MHS_Msk (0x1U << SSI_MWC_MHS_Pos) +#define SSI_MWC_MHS SSI_MWC_MHS_Msk + +#define SSI_MWC_MDD_Pos (1U) +#define SSI_MWC_MDD_Len (1U) +#define SSI_MWC_MDD_Msk (0x1U << SSI_MWC_MDD_Pos) +#define SSI_MWC_MDD SSI_MWC_MDD_Msk + +#define SSI_MWC_MWMOD_Pos (0U) +#define SSI_MWC_MWMOD_Len (1U) +#define SSI_MWC_MWMOD_Msk (0x1U << SSI_MWC_MWMOD_Pos) +#define SSI_MWC_MWMOD SSI_MWC_MWMOD_Msk + +/******************* Bit definition for SSI_SE register *********************/ +#define SSI_SE_SLAVE1_Pos (1U) +#define SSI_SE_SLAVE1_Len (1U) +#define SSI_SE_SLAVE1_Msk (0x1U << SSI_SE_SLAVE1_Pos) +#define SSI_SE_SLAVE1 SSI_SE_SLAVE1_Msk + +#define SSI_SE_SLAVE0_Pos (0U) +#define SSI_SE_SLAVE0_Len (1U) +#define SSI_SE_SLAVE0_Msk (0x1U << SSI_SE_SLAVE0_Pos) +#define SSI_SE_SLAVE0 SSI_SE_SLAVE0_Msk + +/******************* Bit definition for SSI_BAUD register *******************/ +#define SSI_BAUD_SCKDIV_Pos (0U) +#define SSI_BAUD_SCKDIV_Len (16U) +#define SSI_BAUD_SCKDIV_Msk (0xFFFFUL << SSI_BAUD_SCKDIV_Pos) +#define SSI_BAUD_SCKDIV SSI_BAUD_SCKDIV_Msk + +/******************* Bit definition for SSI_TXFTL register ******************/ +#define SSI_TXFTL_TFT_Pos (0U) +#define SSI_TXFTL_TFT_Len (3U) +#define SSI_TXFTL_TFT_Msk (0x7U << SSI_TXFTL_TFT_Pos) +#define SSI_TXFTL_TFT SSI_TXFTL_TFT_Msk + +/******************* Bit definition for SSI_RXFTL register ******************/ +#define SSI_RXFTL_RFT_Pos (0U) +#define SSI_RXFTL_RFT_Len (3U) +#define SSI_RXFTL_RFT_Msk (0x7U << SSI_RXFTL_RFT_Pos) +#define SSI_RXFTL_RFT SSI_RXFTL_RFT_Msk + +/******************* Bit definition for SSI_TXFL register *******************/ +#define SSI_TXFL_TXTFL_Pos (0U) +#define SSI_TXFL_TXTFL_Len (4U) +#define SSI_TXFL_TXTFL_Msk (0xFU << SSI_TXFL_TXTFL_Pos) +#define SSI_TXFL_TXTFL SSI_TXFL_TXTFL_Msk + +/******************* Bit definition for SSI_RXFL register *******************/ +#define SSI_RXFL_RXTFL_Pos (0U) +#define SSI_RXFL_RXTFL_Len (4U) +#define SSI_RXFL_RXTFL_Msk (0xFU << SSI_RXFL_RXTFL_Pos) +#define SSI_RXFL_RXTFL SSI_RXFL_RXTFL_Msk + +/******************* Bit definition for SSI_STAT register *******************/ +#define SSI_STAT_DCOL_Pos (6U) +#define SSI_STAT_DCOL_Len (1U) +#define SSI_STAT_DCOL_Msk (0x1U << SSI_STAT_DCOL_Pos) +#define SSI_STAT_DCOL SSI_STAT_DCOL_Msk + +#define SSI_STAT_TXE_Pos (5U) +#define SSI_STAT_TXE_Len (1U) +#define SSI_STAT_TXE_Msk (0x1U << SSI_STAT_TXE_Pos) +#define SSI_STAT_TXE SSI_STAT_TXE_Msk + +#define SSI_STAT_RFF_Pos (4U) +#define SSI_STAT_RFF_Len (1U) +#define SSI_STAT_RFF_Msk (0x1U << SSI_STAT_RFF_Pos) +#define SSI_STAT_RFF SSI_STAT_RFF_Msk + +#define SSI_STAT_RFNE_Pos (3U) +#define SSI_STAT_RFNE_Len (1U) +#define SSI_STAT_RFNE_Msk (0x1U << SSI_STAT_RFNE_Pos) +#define SSI_STAT_RFNE SSI_STAT_RFNE_Msk + +#define SSI_STAT_TFE_Pos (2U) +#define SSI_STAT_TFE_Len (1U) +#define SSI_STAT_TFE_Msk (0x1U << SSI_STAT_TFE_Pos) +#define SSI_STAT_TFE SSI_STAT_TFE_Msk + +#define SSI_STAT_TFNF_Pos (1U) +#define SSI_STAT_TFNF_Len (1U) +#define SSI_STAT_TFNF_Msk (0x1U << SSI_STAT_TFNF_Pos) +#define SSI_STAT_TFNF SSI_STAT_TFNF_Msk + +#define SSI_STAT_BUSY_Pos (0U) +#define SSI_STAT_BUSY_Len (1U) +#define SSI_STAT_BUSY_Msk (0x1U << SSI_STAT_BUSY_Pos) +#define SSI_STAT_BUSY SSI_STAT_BUSY_Msk + +/******************* Bit definition for SSI_INTMASK register ****************/ +#define SSI_INTMASK_MSTIM_Pos (5U) +#define SSI_INTMASK_MSTIM_Len (1U) +#define SSI_INTMASK_MSTIM_Msk (0x1U << SSI_INTMASK_MSTIM_Pos) +#define SSI_INTMASK_MSTIM SSI_INTMASK_MSTIM_Msk + +#define SSI_INTMASK_RXFIM_Pos (4U) +#define SSI_INTMASK_RXFIM_Len (1U) +#define SSI_INTMASK_RXFIM_Msk (0x1U << SSI_INTMASK_RXFIM_Pos) +#define SSI_INTMASK_RXFIM SSI_INTMASK_RXFIM_Msk + +#define SSI_INTMASK_RXOIM_Pos (3U) +#define SSI_INTMASK_RXOIM_Len (1U) +#define SSI_INTMASK_RXOIM_Msk (0x1U << SSI_INTMASK_RXOIM_Pos) +#define SSI_INTMASK_RXOIM SSI_INTMASK_RXOIM_Msk + +#define SSI_INTMASK_RXUIM_Pos (2U) +#define SSI_INTMASK_RXUIM_Len (1U) +#define SSI_INTMASK_RXUIM_Msk (0x1U << SSI_INTMASK_RXUIM_Pos) +#define SSI_INTMASK_RXUIM SSI_INTMASK_RXUIM_Msk + +#define SSI_INTMASK_TXOIM_Pos (1U) +#define SSI_INTMASK_TXOIM_Len (1U) +#define SSI_INTMASK_TXOIM_Msk (0x1U << SSI_INTMASK_TXOIM_Pos) +#define SSI_INTMASK_TXOIM SSI_INTMASK_TXOIM_Msk + +#define SSI_INTMASK_TXEIM_Pos (0U) +#define SSI_INTMASK_TXEIM_Len (1U) +#define SSI_INTMASK_TXEIM_Msk (0x1U << SSI_INTMASK_TXEIM_Pos) +#define SSI_INTMASK_TXEIM SSI_INTMASK_TXEIM_Msk + +/******************* Bit definition for SSI_INTSTAT register ****************/ +#define SSI_INTSTAT_MSTIS_Pos (5U) +#define SSI_INTSTAT_MSTIS_Len (1U) +#define SSI_INTSTAT_MSTIS_Msk (0x1U << SSI_INTSTAT_MSTIS_Pos) +#define SSI_INTSTAT_MSTIS SSI_INTSTAT_MSTIS_Msk + +#define SSI_INTSTAT_RXFIS_Pos (4U) +#define SSI_INTSTAT_RXFIS_Len (1U) +#define SSI_INTSTAT_RXFIS_Msk (0x1U << SSI_INTSTAT_RXFIS_Pos) +#define SSI_INTSTAT_RXFIS SSI_INTSTAT_RXFIS_Msk + +#define SSI_INTSTAT_RXOIS_Pos (3U) +#define SSI_INTSTAT_RXOIS_Len (1U) +#define SSI_INTSTAT_RXOIS_Msk (0x1U << SSI_INTSTAT_RXOIS_Pos) +#define SSI_INTSTAT_RXOIS SSI_INTSTAT_RXOIS_Msk + +#define SSI_INTSTAT_RXUIS_Pos (2U) +#define SSI_INTSTAT_RXUIS_Len (1U) +#define SSI_INTSTAT_RXUIS_Msk (0x1U << SSI_INTSTAT_RXUIS_Pos) +#define SSI_INTSTAT_RXUIS SSI_INTSTAT_RXUIS_Msk + +#define SSI_INTSTAT_TXOIS_Pos (1U) +#define SSI_INTSTAT_TXOIS_Len (1U) +#define SSI_INTSTAT_TXOIS_Msk (0x1U << SSI_INTSTAT_TXOIS_Pos) +#define SSI_INTSTAT_TXOIS SSI_INTSTAT_TXOIS_Msk + +#define SSI_INTSTAT_TXEIS_Pos (0U) +#define SSI_INTSTAT_TXEIS_Len (1U) +#define SSI_INTSTAT_TXEIS_Msk (0x1U << SSI_INTSTAT_TXEIS_Pos) +#define SSI_INTSTAT_TXEIS SSI_INTSTAT_TXEIS_Msk + +/******************* Bit definition for SSI_RAW_INTSTAT register ************/ +#define SSI_RAW_INTSTAT_MSTIR_Pos (5U) +#define SSI_RAW_INTSTAT_MSTIR_Len (1U) +#define SSI_RAW_INTSTAT_MSTIR_Msk (0x1U << SSI_RAW_INTSTAT_MSTIR_Pos) +#define SSI_RAW_INTSTAT_MSTIR SSI_RAW_INTSTAT_MSTIR_Msk + +#define SSI_RAW_INTSTAT_RXFIR_Pos (4U) +#define SSI_RAW_INTSTAT_RXFIR_Len (1U) +#define SSI_RAW_INTSTAT_RXFIR_Msk (0x1U << SSI_RAW_INTSTAT_RXFIR_Pos) +#define SSI_RAW_INTSTAT_RXFIR SSI_RAW_INTSTAT_RXFIR_Msk + +#define SSI_RAW_INTSTAT_RXOIR_Pos (3U) +#define SSI_RAW_INTSTAT_RXOIR_Len (1U) +#define SSI_RAW_INTSTAT_RXOIR_Msk (0x1U << SSI_RAW_INTSTAT_RXOIR_Pos) +#define SSI_RAW_INTSTAT_RXOIR SSI_RAW_INTSTAT_RXOIR_Msk + +#define SSI_RAW_INTSTAT_RXUIR_Pos (2U) +#define SSI_RAW_INTSTAT_RXUIR_Len (1U) +#define SSI_RAW_INTSTAT_RXUIR_Msk (0x1U << SSI_RAW_INTSTAT_RXUIR_Pos) +#define SSI_RAW_INTSTAT_RXUIR SSI_RAW_INTSTAT_RXUIR_Msk + +#define SSI_RAW_INTSTAT_TXOIR_Pos (1U) +#define SSI_RAW_INTSTAT_TXOIR_Len (1U) +#define SSI_RAW_INTSTAT_TXOIR_Msk (0x1U << SSI_RAW_INTSTAT_TXOIR_Pos) +#define SSI_RAW_INTSTAT_TXOIR SSI_RAW_INTSTAT_TXOIR_Msk + +#define SSI_RAW_INTSTAT_TXEIR_Pos (0U) +#define SSI_RAW_INTSTAT_TXEIR_Len (1U) +#define SSI_RAW_INTSTAT_TXEIR_Msk (0x1U << SSI_RAW_INTSTAT_TXEIR_Pos) +#define SSI_RAW_INTSTAT_TXEIR SSI_RAW_INTSTAT_TXEIR_Msk + +/******************* Bit definition for SSI_TXOIC register ******************/ +#define SSI_TXOIC_TXOIC_Pos (0U) +#define SSI_TXOIC_TXOIC_Len (1U) +#define SSI_TXOIC_TXOIC_Msk (0x1U << SSI_TXOIC_TXOIC_Pos) +#define SSI_TXOIC_TXOIC SSI_TXOIC_TXOIC_Msk + +/******************* Bit definition for SSI_RXOIC register ******************/ +#define SSI_RXOIC_RXOIC_Pos (0U) +#define SSI_RXOIC_RXOIC_Len (1U) +#define SSI_RXOIC_RXOIC_Msk (0x1U << SSI_RXOIC_RXOIC_Pos) +#define SSI_RXOIC_RXOIC SSI_RXOIC_RXOIC_Msk + +#define SSI_RXUIC_RXUIC_Pos (0U) +#define SSI_RXUIC_RXUIC_Len (1U) +#define SSI_RXUIC_RXUIC_Msk (0x1U << SSI_RXUIC_RXUIC_Pos) +#define SSI_RXUIC_RXUIC SSI_RXUIC_RXUIC_Msk + +/******************* Bit definition for SSI_MSTIC register ******************/ +#define SSI_MSTIC_MSTIC_Pos (0U) +#define SSI_MSTIC_MSTIC_Len (1U) +#define SSI_MSTIC_MSTIC_Msk (0x1U << SSI_MSTIC_MSTIC_Pos) +#define SSI_MSTIC_MSTIC SSI_MSTIC_MSTIC_Msk + +/******************* Bit definition for SSI_INTCLR register ******************/ +#define SSI_INTCLR_INTCLR_Pos (0U) +#define SSI_INTCLR_INTCLR_Len (1U) +#define SSI_INTCLR_INTCLR_Msk (0x1U << SSI_INTCLR_INTCLR_Pos) +#define SSI_INTCLR_INTCLR SSI_INTCLR_INTCLR_Msk + +/******************* Bit definition for SSI_DMAC register *******************/ +#define SSI_DMAC_TDMAE_Pos (1U) +#define SSI_DMAC_TDMAE_Len (1U) +#define SSI_DMAC_TDMAE_Msk (0x1U << SSI_DMAC_TDMAE_Pos) +#define SSI_DMAC_TDMAE SSI_DMAC_TDMAE_Msk + +#define SSI_DMAC_RDMAE_Pos (0U) +#define SSI_DMAC_RDMAE_Len (1U) +#define SSI_DMAC_RDMAE_Msk (0x1U << SSI_DMAC_RDMAE_Pos) +#define SSI_DMAC_RDMAE SSI_DMAC_RDMAE_Msk + +/******************* Bit definition for SSI_DMATDL register *****************/ +#define SSI_DMATDL_DMATDL_Pos (0U) +#define SSI_DMATDL_DMATDL_Len (4U) +#define SSI_DMATDL_DMATDL_Msk (0xFU << SSI_DMATDL_DMATDL_Pos) +#define SSI_DMATDL_DMATDL SSI_DMATDL_DMATDL_Msk + +#define SSI_DMARDL_DMARDL_Pos (0U) +#define SSI_DMARDL_DMARDL_Len (4U) +#define SSI_DMARDL_DMARDL_Msk (0xFU << SSI_DMARDL_DMARDL_Pos) +#define SSI_DMARDL_DMARDL SSI_DMARDL_DMARDL_Msk + +/******************* Bit definition for SSI_IDCODE register *****************/ +#define SSI_IDCODE_ID_Pos (0U) +#define SSI_IDCODE_ID_Len (32U) +#define SSI_IDCODE_ID_Msk (0xFFFFFFFFU) +#define SSI_IDCODE_ID SSI_IDCODE_ID_Msk + +/******************* Bit definition for SSI_COMP register *******************/ +#define SSI_COMP_VERSION_Pos (0U) +#define SSI_COMP_VERSION_Len (32U) +#define SSI_COMP_VERSION_Msk (0xFFFFFFFFU) +#define SSI_COMP_VERSION SSI_COMP_VERSION_Msk + +/******************* Bit definition for SSI_DATA register *******************/ +#define SSI_DATA_REG_Pos (0U) +#define SSI_DATA_REG_Len (32U) +#define SSI_DATA_REG_Msk (0xFFFFFFFFU) +#define SSI_DATA_REG SSI_DATA_REG_Msk + +/******************* Bit definition for SSI_RX register *********************/ +#define SSI_RX_SAMPLEDLY_Pos (0U) +#define SSI_RX_SAMPLEDLY_Len (8U) +#define SSI_RX_SAMPLEDLY_Msk (0xFFU << SSI_RX_SAMPLEDLY_Pos) +#define SSI_RX_SAMPLEDLY SSI_RX_SAMPLEDLY_Msk + +/******************* Bit definition for SSI_SCTRL0 register *****************/ +#define SSI_SCTRL0_WAITCYCLES_Pos (11U) +#define SSI_SCTRL0_WAITCYCLES_Len (5U) +#define SSI_SCTRL0_WAITCYCLES_Msk (0x1FU << SSI_SCTRL0_WAITCYCLES_Pos) +#define SSI_SCTRL0_WAITCYCLES SSI_SCTRL0_WAITCYCLES_Msk + +#define SSI_SCTRL0_INSTL_Pos (8U) +#define SSI_SCTRL0_INSTL_Len (2U) +#define SSI_SCTRL0_INSTL_Msk (0x03U << SSI_SCTRL0_INSTL_Pos) +#define SSI_SCTRL0_INSTL SSI_SCTRL0_INSTL_Msk + +#define SSI_SCTRL0_ADDRL_Pos (2U) +#define SSI_SCTRL0_ADDRL_Len (4U) +#define SSI_SCTRL0_ADDRL_Msk (0x0FU << SSI_SCTRL0_ADDRL_Pos) +#define SSI_SCTRL0_ADDRL SSI_SCTRL0_ADDRL_Msk + +#define SSI_SCTRL0_TRANSTYPE_Pos (0U) +#define SSI_SCTRL0_TRANSTYPE_Len (2U) +#define SSI_SCTRL0_TRANSTYPE_Msk (0x03U << SSI_SCTRL0_TRANSTYPE_Pos) +#define SSI_SCTRL0_TRANSTYPE SSI_SCTRL0_TRANSTYPE_Msk + + +/* ================================================================================================================= */ +/* ================ TIMER ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for TIMER_CTRL register *******************/ +#define TIMER_CTRL_INTEN_Pos (3U) +#define TIMER_CTRL_INTEN_Len (1U) +#define TIMER_CTRL_INTEN_Msk (0x1U << TIMER_CTRL_INTEN_Pos) +#define TIMER_CTRL_INTEN TIMER_CTRL_INTEN_Msk + +#define TIMER_CTRL_EN_Pos (0U) +#define TIMER_CTRL_EN_Len (1U) +#define TIMER_CTRL_EN_Msk (0x1U << TIMER_CTRL_EN_Pos) +#define TIMER_CTRL_EN TIMER_CTRL_EN_Msk + +/******************* Bit definition for TIMER_VALUE register ******************/ +#define TIMER_VALUE_VALUE_Pos (0U) +#define TIMER_VALUE_VALUE_Len (32U) +#define TIMER_VALUE_VALUE_Msk (0xFFFFFFFFU) +#define TIMER_VALUE_VALUE TIMER_VALUE_VALUE_Msk + +/******************* Bit definition for TIMER_RELOAD register *****************/ +#define TIMER_RELOAD_RELOAD_Pos (0U) +#define TIMER_RELOAD_RELOAD_Len (32U) +#define TIMER_RELOAD_RELOAD_Msk (0xFFFFFFFFU) +#define TIMER_RELOAD_RELOAD TIMER_RELOAD_RELOAD_Msk + +/******************* Bit definition for TIMER_RELOAD register *****************/ +#define TIMER_INT_STAT_Pos (0U) +#define TIMER_INT_STAT_Len (1U) +#define TIMER_INT_STAT_Msk (0x1U << TIMER_INT_STAT_Pos) +#define TIMER_INT_STAT TIMER_INT_STAT_Msk + + +/* ================================================================================================================= */ +/* ================ UART ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for UART_RBR register *******************/ +#define UART_RBR_RBR_Pos (0U) +#define UART_RBR_RBR_Len (8U) +#define UART_RBR_RBR_Msk (0xFFU << UART_RBR_RBR_Pos) +#define UART_RBR_RBR UART_RBR_RBR_Msk /**< Receive Buffer Register */ + +/******************* Bit definition for UART_DLL register *******************/ +#define UART_DLL_DLL_Pos (0U) +#define UART_DLL_DLL_Len (8U) +#define UART_DLL_DLL_Msk (0xFFU << UART_DLL_DLL_Pos) +#define UART_DLL_DLL UART_DLL_DLL_Msk /**< Divisor Latch (Low) */ + +/******************* Bit definition for UART_THR register *******************/ +#define UART_THR_THR_Pos (0U) +#define UART_THR_THR_Len (8U) +#define UART_THR_THR_Msk (0xFFU << UART_THR_THR_Pos) +#define UART_THR_THR UART_THR_THR_Msk /**< Transmit Holding Register */ + +/******************* Bit definition for UART_DLH register *******************/ +#define UART_DLH_DLH_Pos (0U) +#define UART_DLH_DLH_Len (8U) +#define UART_DLH_DLH_Msk (0xFFU << UART_DLH_DLH_Pos) +#define UART_DLH_DLH UART_DLH_DLH_Msk /**< Divisor Latch (High) */ + +/******************* Bit definition for UART_IER register *******************/ +#define UART_IER_PTIME_Pos (7U) +#define UART_IER_PTIME_Len (1U) +#define UART_IER_PTIME_Msk (0x1U << UART_IER_PTIME_Pos) +#define UART_IER_PTIME UART_IER_PTIME_Msk /**< Programmable THRE Interrupt Mode Enable */ + +#define UART_IER_ELCOLR_Pos (4U) +#define UART_IER_ELCOLR_Len (1U) +#define UART_IER_ELCOLR_Msk (0x1U << UART_IER_ELCOLR_Pos) +#define UART_IER_ELCOLR UART_IER_ELCOLR_Msk /**< Enable Auto Clear LSR Register by read RBR/LSR, read only */ + +#define UART_IER_EDSSI_Pos (3U) +#define UART_IER_EDSSI_Len (1U) +#define UART_IER_EDSSI_Msk (0x1U << UART_IER_EDSSI_Pos) +#define UART_IER_EDSSI UART_IER_EDSSI_Msk /**< Enable Modem Status Interrupt */ + +#define UART_IER_ERLS_Pos (2U) +#define UART_IER_ERLS_Len (1U) +#define UART_IER_ERLS_Msk (0x1U << UART_IER_ERLS_Pos) +#define UART_IER_ERLS UART_IER_ERLS_Msk /**< Enable Receiver Line Status Interrupt */ + +#define UART_IER_ETBEI_Pos (1U) +#define UART_IER_ETBEI_Len (1U) +#define UART_IER_ETBEI_Msk (0x1U << UART_IER_ETBEI_Pos) +#define UART_IER_ETBEI UART_IER_ETBEI_Msk /**< Enable Transmit Holding Register Empty Interrupt */ + +#define UART_IER_ERBFI_Pos (0U) +#define UART_IER_ERBFI_Len (1U) +#define UART_IER_ERBFI_Msk (0x1U << UART_IER_ERBFI_Pos) +#define UART_IER_ERBFI UART_IER_ERBFI_Msk /**< Enable Received Data Available Interrupt */ + +/******************* Bit definition for UART_FCR register *******************/ +#define UART_TXFIFO_SIZE 128 +#define UART_RXFIFO_SIZE 128 + +#define UART_FCR_RT_Pos (6U) +#define UART_FCR_RT_Len (2U) +#define UART_FCR_RT_Msk (0x3U << UART_FCR_RT_Pos) +#define UART_FCR_RT UART_FCR_RT_Msk /**< RCVR Trigger */ +#define UART_FCR_RT_CHAR_1 (0x0U << UART_FCR_RT_Pos) /**< RX FIFO 1 Char */ +#define UART_FCR_RT_QUARTER_FULL (0x1U << UART_FCR_RT_Pos) /**< RX FIFO Quater Full*/ +#define UART_FCR_RT_HALF_FULL (0x2U << UART_FCR_RT_Pos) /**< RX FIFO Half Full */ +#define UART_FCR_RT_FULL_2 (0x3U << UART_FCR_RT_Pos) /**< RX FIFO 2 less than Full */ + +#define UART_FCR_TET_Pos (4U) +#define UART_FCR_TET_Len (2U) +#define UART_FCR_TET_Msk (0x3U << UART_FCR_TET_Pos) +#define UART_FCR_TET UART_FCR_TET_Msk /**< TX Empty Trigger */ +#define UART_FCR_TET_EMPTY (0x0U << UART_FCR_TET_Pos) /**< TX FIFO Empty */ +#define UART_FCR_TET_CHAR_2 (0x1U << UART_FCR_TET_Pos) /**< TX FIFO 2 chars */ +#define UART_FCR_TET_QUARTER_FULL (0x2U << UART_FCR_TET_Pos) /**< TX FIFO Quater Full */ +#define UART_FCR_TET_HALF_FULL (0x3U << UART_FCR_TET_Pos) /**< TX FIFO Half Full */ + +#define UART_FCR_XFIFOR_Pos (2U) +#define UART_FCR_XFIFOR_Len (1U) +#define UART_FCR_XFIFOR_Msk (0x1U << UART_FCR_XFIFOR_Pos) +#define UART_FCR_XFIFOR UART_FCR_XFIFOR_Msk /**< XMIT FIFO Reset */ + +#define UART_FCR_RFIFOR_Pos (1U) +#define UART_FCR_RFIFOR_Len (1U) +#define UART_FCR_RFIFOR_Msk (0x1U << UART_FCR_RFIFOR_Pos) +#define UART_FCR_RFIFOR UART_FCR_RFIFOR_Msk /**< RCVR FIFO Reset */ + +#define UART_FCR_FIFOE_Pos (0U) +#define UART_FCR_FIFOE_Len (1U) +#define UART_FCR_FIFOE_Msk (0x1U << UART_FCR_FIFOE_Pos) +#define UART_FCR_FIFOE UART_FCR_FIFOE_Msk /**< FIFO Enable */ + +/******************* Bit definition for UART_IIR register *******************/ +#define UART_IIR_IID_Pos (0U) +#define UART_IIR_IID_Len (4U) +#define UART_IIR_IID_Msk (0xFU << UART_IIR_IID_Pos) +#define UART_IIR_IID UART_IIR_IID_Msk /**< Interrupt ID */ +#define UART_IIR_IID_MS (0x0U << UART_IIR_IID_Pos) /**< Modem Status */ +#define UART_IIR_IID_NIP (0x1U << UART_IIR_IID_Pos) /**< No Interrupt Pending */ +#define UART_IIR_IID_THRE (0x2U << UART_IIR_IID_Pos) /**< THR Empty */ +#define UART_IIR_IID_RDA (0x4U << UART_IIR_IID_Pos) /**< Received Data Available */ +#define UART_IIR_IID_RLS (0x6U << UART_IIR_IID_Pos) /**< Receiver Line Status */ +#define UART_IIR_IID_CTO (0xCU << UART_IIR_IID_Pos) /**< Character Timeout */ + +/******************* Bit definition for UART_LCR register *******************/ +#define UART_LCR_DLAB_Pos (7U) +#define UART_LCR_DLAB_Len (1U) +#define UART_LCR_DLAB_Msk (0x1U << UART_LCR_DLAB_Pos) +#define UART_LCR_DLAB UART_LCR_DLAB_Msk /**< Divisor Latch Access */ + +#define UART_LCR_BC_Pos (6U) +#define UART_LCR_BC_Len (1U) +#define UART_LCR_BC_Msk (0x1U << UART_LCR_BC_Pos) +#define UART_LCR_BC UART_LCR_BC_Msk /**< Break Control */ + +#define UART_LCR_PARITY_Pos (3U) +#define UART_LCR_PARITY_Len (3U) +#define UART_LCR_PARITY_Msk (0x7U << UART_LCR_PARITY_Pos) +#define UART_LCR_PARITY UART_LCR_PARITY_Msk /**< Parity, SP,EPS,PEN bits */ +#define UART_LCR_PARITY_NONE (0x0U << UART_LCR_PARITY_Pos) /**< Parity none */ +#define UART_LCR_PARITY_ODD (0x1U << UART_LCR_PARITY_Pos) /**< Parity odd */ +#define UART_LCR_PARITY_EVEN (0x3U << UART_LCR_PARITY_Pos) /**< Parity even */ +#define UART_LCR_PARITY_SP0 (0x5U << UART_LCR_PARITY_Pos) /**< Parity stick 0 */ +#define UART_LCR_PARITY_SP1 (0x7U << UART_LCR_PARITY_Pos) /**< Parity stick 1 */ + +#define UART_LCR_STOP_Pos (2U) +#define UART_LCR_STOP_Msk (0x1U << UART_LCR_STOP_Pos) +#define UART_LCR_STOP UART_LCR_STOP_Msk /**< Stop bit */ +#define UART_LCR_STOP_1 (0x0U << UART_LCR_STOP_Pos) /**< Stop bit 1 */ +#define UART_LCR_STOP_1_5 (0x1U << UART_LCR_STOP_Pos) /**< Stop bit 1.5 (DLS = 0) */ +#define UART_LCR_STOP_2 (0x1U << UART_LCR_STOP_Pos) /**< Stop bit 2 (DLS != 0) */ + +#define UART_LCR_DLS_Pos (0U) +#define UART_LCR_DLS_Msk (0x3U << UART_LCR_DLS_Pos) +#define UART_LCR_DLS UART_LCR_DLS_Msk /**< Data Length Select */ +#define UART_LCR_DLS_5 (0x0U << UART_LCR_DLS_Pos) /**< Data bits 5 */ +#define UART_LCR_DLS_6 (0x1U << UART_LCR_DLS_Pos) /**< Data bits 6 */ +#define UART_LCR_DLS_7 (0x2U << UART_LCR_DLS_Pos) /**< Data bits 7 */ +#define UART_LCR_DLS_8 (0x3U << UART_LCR_DLS_Pos) /**< Data bits 8 */ + +/******************* Bit definition for UART_MCR register *******************/ +#define UART_MCR_AFCE_Pos (5U) +#define UART_MCR_AFCE_Len (1U) +#define UART_MCR_AFCE_Msk (0x1U << UART_MCR_AFCE_Pos) +#define UART_MCR_AFCE UART_MCR_AFCE_Msk /**< Auto flow contrl enable */ + +#define UART_MCR_LOOPBACK_Pos (4U) +#define UART_MCR_LOOPBACK_Len (1U) +#define UART_MCR_LOOPBACK_Msk (0x1U << UART_MCR_LOOPBACK_Pos) +#define UART_MCR_LOOPBACK UART_MCR_LOOPBACK_Msk /**< LoopBack */ + +#define UART_MCR_RTS_Pos (1U) +#define UART_MCR_RTS_Len (1U) +#define UART_MCR_RTS_Msk (0x1U << UART_MCR_RTS_Pos) +#define UART_MCR_RTS UART_MCR_RTS_Msk /**< Request To Send */ + +/******************* Bit definition for UART_LSR register *******************/ +#define UART_LSR_RFE_Pos (7U) +#define UART_LSR_RFE_Len (1U) +#define UART_LSR_RFE_Msk (0x1U << UART_LSR_RFE_Pos) +#define UART_LSR_RFE UART_LSR_RFE_Msk /**< Receiver FIFO Error */ + +#define UART_LSR_TEMT_Pos (6U) +#define UART_LSR_TEMT_Len (1U) +#define UART_LSR_TEMT_Msk (0x1U << UART_LSR_TEMT_Pos) +#define UART_LSR_TEMT UART_LSR_TEMT_Msk /**< Transmitter Empty */ + +#define UART_LSR_THRE_Pos (5U) +#define UART_LSR_THRE_Len (1U) +#define UART_LSR_THRE_Msk (0x1U << UART_LSR_THRE_Pos) +#define UART_LSR_THRE UART_LSR_THRE_Msk /**< Transmit Holding Register Empty */ + +#define UART_LSR_BI_Pos (4U) +#define UART_LSR_BI_Len (1U) +#define UART_LSR_BI_Msk (0x1U << UART_LSR_BI_Pos) +#define UART_LSR_BI UART_LSR_BI_Msk /**< Break Interrupt */ + +#define UART_LSR_FE_Pos (3U) +#define UART_LSR_FE_Len (1U) +#define UART_LSR_FE_Msk (0x1U << UART_LSR_FE_Pos) +#define UART_LSR_FE UART_LSR_FE_Msk /**< Framing Error */ + +#define UART_LSR_PE_Pos (2U) +#define UART_LSR_PE_Len (1U) +#define UART_LSR_PE_Msk (0x1U << UART_LSR_PE_Pos) +#define UART_LSR_PE UART_LSR_PE_Msk /**< Parity Error */ + +#define UART_LSR_OE_Pos (1U) +#define UART_LSR_OE_Len (1U) +#define UART_LSR_OE_Msk (0x1U << UART_LSR_OE_Pos) +#define UART_LSR_OE UART_LSR_OE_Msk /**< Overrun error */ + +#define UART_LSR_DR_Pos (0U) +#define UART_LSR_DR_Msk (0x1U << UART_LSR_DR_Pos) +#define UART_LSR_DR UART_LSR_DR_Msk /**< Data Ready */ + +/******************* Bit definition for UART_MSR register *******************/ +#define UART_MSR_CTS_Pos (4U) +#define UART_MSR_CTS_Len (1U) +#define UART_MSR_CTS_Msk (0x1U << UART_MSR_CTS_Pos) +#define UART_MSR_CTS UART_MSR_CTS_Msk /**< Clear To Send */ + +#define UART_MSR_DCTS_Pos (0U) +#define UART_MSR_DCTS_Len (1U) +#define UART_MSR_DCTS_Msk (0x1U << UART_MSR_DCTS_Pos) +#define UART_MSR_DCTS UART_MSR_DCTS_Msk /**< Delta Clear To Send */ + +/******************* Bit definition for UART_USR register *******************/ +#define UART_USR_RFF_Pos (4U) +#define UART_USR_RFF_Len (1U) +#define UART_USR_RFF_Msk (0x1U << UART_USR_RFF_Pos) +#define UART_USR_RFF UART_USR_RFF_Msk /**< Receive FIFO Full */ + +#define UART_USR_RFNE_Pos (3U) +#define UART_USR_RFNE_Len (1U) +#define UART_USR_RFNE_Msk (0x1U << UART_USR_RFNE_Pos) +#define UART_USR_RFNE UART_USR_RFNE_Msk /**< Receive FIFO Not Empty */ + +#define UART_USR_TFE_Pos (2U) +#define UART_USR_TFE_Len (1U) +#define UART_USR_TFE_Msk (0x1U << UART_USR_TFE_Pos) +#define UART_USR_TFE UART_USR_TFE_Msk /**< Transmit FIFO Empty */ + +#define UART_USR_TFNF_Pos (1U) +#define UART_USR_TFNF_Len (1U) +#define UART_USR_TFNF_Msk (0x1U << UART_USR_TFNF_Pos) +#define UART_USR_TFNF UART_USR_TFNF_Msk /**< Transmit FIFO Not Full */ + +/******************* Bit definition for UART_TFL register *******************/ +/* Transmit FIFO Level bits */ +#define UART_TFL_TFL_Pos (0U) +#define UART_TFL_TFL_Len (7U) +#define UART_TFL_TFL_Msk (0x7FU << UART_TFL_TFL_Pos) +#define UART_TFL_TFL UART_TFL_TFL_Msk /**< Transmit FIFO Level */ + +/******************* Bit definition for UART_RFL register *******************/ +/* Receive FIFO Level bits */ +#define UART_RFL_RFL_Pos (0U) +#define UART_RFL_RFL_Len (7U) +#define UART_RFL_RFL_Msk (0x7FU << UART_RFL_RFL_Pos) +#define UART_RFL_RFL UART_RFL_RFL_Msk /**< Receive FIFO Level */ + +/******************* Bit definition for UART_SRR register *******************/ +/* XMIT FIFO Reset bit */ +#define UART_SRR_XFR_Pos (2U) +#define UART_SRR_XFR_Len (1U) +#define UART_SRR_XFR_Msk (0x1U << UART_SRR_XFR_Pos) +#define UART_SRR_XFR UART_SRR_XFR_Msk /**< XMIT FIFO Reset */ + +/* RCVR FIFO Reset bit */ +#define UART_SRR_RFR_Pos (1U) +#define UART_SRR_RFR_Len (1U) +#define UART_SRR_RFR_Msk (0x1U << UART_SRR_RFR_Pos) +#define UART_SRR_RFR UART_SRR_RFR_Msk /**< RCVR FIFO Reset */ + +/* UART Reset Enable bit */ +#define UART_SRR_UR_Pos (0U) +#define UART_SRR_UR_Len (1U) +#define UART_SRR_UR_Msk (0x1U << UART_SRR_UR_Pos) +#define UART_SRR_UR UART_SRR_UR_Msk /**< UART Reset */ + +/******************* Bit definition for UART_SRTS register *******************/ +#define UART_SRTS_SRTS_Pos (0U) +#define UART_SRTS_SRTS_Len (1U) +#define UART_SRTS_SRTS_Msk (0x1U << UART_SRTS_SRTS_Pos) +#define UART_SRTS_SRTS UART_SRTS_SRTS_Msk /**< Shadow Request to Send */ + +/******************* Bit definition for UART_SBCR register *******************/ +#define UART_SBCR_SBCR_Pos (0U) +#define UART_SBCR_SBCR_Len (1U) +#define UART_SBCR_SBCR_Msk (0x1U << UART_SBCR_SBCR_Pos) +#define UART_SBCR_SBCR UART_SBCR_SBCR_Msk /**< Shadow Break Control */ + +/******************* Bit definition for UART_SFE register *******************/ +#define UART_SFE_SFE_Pos (0U) +#define UART_SFE_SFE_Len (1U) +#define UART_SFE_SFE_Msk (0x1U << UART_SFE_SFE_Pos) +#define UART_SFE_SFE UART_SFE_SFE_Msk /**< Shadow FIFO Enable */ + +/******************* Bit definition for UART_SRT register *******************/ +#define UART_SRT_SRT_Pos (0U) +#define UART_SRT_SRT_Len (2U) +#define UART_SRT_SRT_Msk (0x3U << UART_SRT_SRT_Pos) +#define UART_SRT_SRT UART_SRT_SRT_Msk +#define UART_SRT_SRT_CHAR_1 (0x0U << UART_SRT_SRT_Pos) /**< RX FIFO 1 Char */ +#define UART_SRT_SRT_QUARTER_FULL (0x1U << UART_SRT_SRT_Pos) /**< RX FIFO Quater Full*/ +#define UART_SRT_SRT_HALF_FULL (0x2U << UART_SRT_SRT_Pos) /**< RX FIFO Half Full */ +#define UART_SRT_SRT_FULL_2 (0x3U << UART_SRT_SRT_Pos) /**< RX FIFO 2 less than Full */ + +/******************* Bit definition for UART_STET register *******************/ +#define UART_STET_STET_Pos (0U) +#define UART_STET_STET_Len (2U) +#define UART_STET_STET_Msk (0x3U << UART_STET_STET_Pos) +#define UART_STET_STET UART_STET_STET_Msk +#define UART_STET_STET_EMPTY (0x0U << UART_STET_STET_Pos) /**< TX FIFO Empty */ +#define UART_STET_STET_CHAR_2 (0x1U << UART_STET_STET_Pos) /**< TX FIFO 2 chars */ +#define UART_STET_STET_QUARTER_FULL (0x2U << UART_STET_STET_Pos) /**< TX FIFO Quater Full */ +#define UART_STET_STET_HALF_FULL (0x3U << UART_STET_STET_Pos) /**< TX FIFO Half Full */ + +/******************* Bit definition for UART_HTX register *******************/ +#define UART_HTX_HTX_Pos (0U) +#define UART_HTX_HTX_Len (1U) +#define UART_HTX_HTX_Msk (0x1U << UART_HTX_HTX_Pos) +#define UART_HTX_HTX UART_HTX_HTX_Msk /**< Halt TX */ + +/******************* Bit definition for UART_DLF register *******************/ +#define UART_DLF_DLF_Pos (0U) +#define UART_DLF_DLF_Len (1U) +#define UART_DLF_DLF_Msk (0x1U << UART_DLF_DLF_Pos) +#define UART_DLF_DLF UART_DLF_DLF_Msk /**< Fractional part of divisor */ + + +/* ================================================================================================================= */ +/* ================ WDT ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for WDT_CTRL register ********************/ +#define WDT_CTRL_INTEN_Pos (0U) +#define WDT_CTRL_INTEN_Len (1U) +#define WDT_CTRL_INTEN_Msk (0x1U << WDT_CTRL_INTEN_Pos) +#define WDT_CTRL_INTEN WDT_CTRL_INTEN_Msk /**< Interrupt Enable */ + +#define WDT_CTRL_RSTEN_Pos (1U) +#define WDT_CTRL_RSTEN_Len (1U) +#define WDT_CTRL_RSTEN_Msk (0x1U << WDT_CTRL_RSTEN_Pos) +#define WDT_CTRL_RSTEN WDT_CTRL_RSTEN_Msk /**< Reset Enable */ + +/******************* Bit definition for WDT_INTCLR register ********************/ +#define WDT_INTCLR_Pos (0U) +#define WDT_INTCLR_Len (1U) +#define WDT_INTCLR_Msk (0x1U << WDT_INTCLR_Pos) +#define WDT_INTCLR WDT_INTCLR_Msk /**< Interrupt status clear */ + +/******************* Bit definition for WDT_MIS register ********************/ +#define WDT_MIS_INTSTAT_Pos (0U) +#define WDT_MIS_INTSTAT_Len (1U) +#define WDT_MIS_INTSTAT_Msk (0x1U << WDT_MIS_INTSTAT_Pos) +#define WDT_MIS_INTSTAT WDT_MIS_INTSTAT_Msk /**< Interrupt status */ + + +/* ================================================================================================================= */ +/* ================ XQSPI ================ */ +/* ================================================================================================================= */ +/******************* Bit definition for XQSPI_CACHE_CTRL0 register **********/ +#define XQSPI_CACHE_CTRL0_CLK_FORCE_EN_Pos (7U) +#define XQSPI_CACHE_CTRL0_CLK_FORCE_EN_Len (4U) +#define XQSPI_CACHE_CTRL0_CLK_FORCE_EN_Msk (0xFU << XQSPI_CACHE_CTRL0_CLK_FORCE_EN_Pos) +#define XQSPI_CACHE_CTRL0_CLK_FORCE_EN XQSPI_CACHE_CTRL0_CLK_FORCE_EN_Msk + +#define XQSPI_CACHE_CTRL0_BUF_DIS_Pos (6U) +#define XQSPI_CACHE_CTRL0_BUF_DIS_Len (1U) +#define XQSPI_CACHE_CTRL0_BUF_DIS_Msk (0x1U << XQSPI_CACHE_CTRL0_BUF_DIS_Pos) +#define XQSPI_CACHE_CTRL0_BUF_DIS XQSPI_CACHE_CTRL0_BUF_DIS_Msk + +#define XQSPI_CACHE_CTRL0_DIS_SEQ_Pos (5U) +#define XQSPI_CACHE_CTRL0_DIS_SEQ_Len (1U) +#define XQSPI_CACHE_CTRL0_DIS_SEQ_Msk (0x1U << XQSPI_CACHE_CTRL0_DIS_SEQ_Pos) +#define XQSPI_CACHE_CTRL0_DIS_SEQ XQSPI_CACHE_CTRL0_DIS_SEQ_Msk + +#define XQSPI_CACHE_CTRL0_HITMISS_Pos (4U) +#define XQSPI_CACHE_CTRL0_HITMISS_Len (1U) +#define XQSPI_CACHE_CTRL0_HITMISS_Msk (0x1U << XQSPI_CACHE_CTRL0_HITMISS_Pos) +#define XQSPI_CACHE_CTRL0_HITMISS XQSPI_CACHE_CTRL0_HITMISS_Msk + +#define XQSPI_CACHE_CTRL0_FIFO_Pos (3U) +#define XQSPI_CACHE_CTRL0_FIFO_Len (1U) +#define XQSPI_CACHE_CTRL0_FIFO_Msk (0x1U << XQSPI_CACHE_CTRL0_FIFO_Pos) +#define XQSPI_CACHE_CTRL0_FIFO XQSPI_CACHE_CTRL0_FIFO_Msk + +#define XQSPI_CACHE_CTRL0_FLUSH_Pos (1U) +#define XQSPI_CACHE_CTRL0_FLUSH_Len (1U) +#define XQSPI_CACHE_CTRL0_FLUSH_Msk (0x1U << XQSPI_CACHE_CTRL0_FLUSH_Pos) +#define XQSPI_CACHE_CTRL0_FLUSH XQSPI_CACHE_CTRL0_FLUSH_Msk + +#define XQSPI_CACHE_CTRL0_DIS_Pos (0U) +#define XQSPI_CACHE_CTRL0_DIS_Len (1U) +#define XQSPI_CACHE_CTRL0_DIS_Msk (0x1U << XQSPI_CACHE_CTRL0_DIS_Pos) +#define XQSPI_CACHE_CTRL0_DIS XQSPI_CACHE_CTRL0_DIS_Msk + +/******************* Bit definition for XQSPI_CACHE_CTRL1 register **********/ +#define XQSPI_CACHE_CTRL1_DBGMUX_EN_Pos (4U) +#define XQSPI_CACHE_CTRL1_DBGMUX_EN_Len (1U) +#define XQSPI_CACHE_CTRL1_DBGMUX_EN_Msk (0x1U << XQSPI_CACHE_CTRL1_DBGMUX_EN_Pos) +#define XQSPI_CACHE_CTRL1_DBGMUX_EN XQSPI_CACHE_CTRL1_DBGMUX_EN_Msk + +#define XQSPI_CACHE_CTRL1_DBGBUS_SEL_Pos (0U) +#define XQSPI_CACHE_CTRL1_DBGBUS_SEL_Len (4U) +#define XQSPI_CACHE_CTRL1_DBGBUS_SEL_Msk (0xFU << XQSPI_CACHE_CTRL1_DBGBUS_SEL_Pos) +#define XQSPI_CACHE_CTRL1_DBGBUS_SEL XQSPI_CACHE_CTRL1_DBGBUS_SEL_Msk + +/******************* Bit definition for XQSPI_CACHE_HITCOUNT register *******/ +#define XQSPI_CACHE_HITCOUNT_Pos (0U) +#define XQSPI_CACHE_HITCOUNT_Len (32U) +#define XQSPI_CACHE_HITCOUNT_Msk (0xFFFFFFFFU) +#define XQSPI_CACHE_HITCOUNT XQSPI_CACHE_HITCOUNT_Msk + +/******************* Bit definition for XQSPI_CACHE_MISSCOUNT register ******/ +#define XQSPI_CACHE_MISSCOUNT_Pos (0U) +#define XQSPI_CACHE_MISSCOUNT_Len (32U) +#define XQSPI_CACHE_MISSCOUNT_Msk (0xFFFFFFFFU) +#define XQSPI_CACHE_MISSCOUNT XQSPI_CACHE_MISSCOUNT_Msk + +/******************* Bit definition for XQSPI_CACHE_STAT register ***********/ +#define XQSPI_CACHE_BUF_BUSY_Pos (2U) +#define XQSPI_CACHE_BUF_BUSY_Len (1U) +#define XQSPI_CACHE_BUF_BUSY_Msk (0x1U << XQSPI_CACHE_BUF_BUSY_Pos) +#define XQSPI_CACHE_BUF_BUSY XQSPI_CACHE_BUF_BUSY_Msk + +#define XQSPI_CACHE_BUF_ADDR_REACHED_Pos (1U) +#define XQSPI_CACHE_BUF_ADDR_REACHED_Len (1U) +#define XQSPI_CACHE_BUF_ADDR_REACHED_Msk (0x1U << XQSPI_CACHE_BUF_ADDR_REACHED_Pos) +#define XQSPI_CACHE_BUF_ADDR_REACHED XQSPI_CACHE_BUF_ADDR_REACHED_Msk + +#define XQSPI_CACHE_STAT_Pos (0U) +#define XQSPI_CACHE_STAT_Len (1U) +#define XQSPI_CACHE_STAT_Msk (0x1U << XQSPI_CACHE_STAT_Pos) +#define XQSPI_CACHE_STAT XQSPI_CACHE_STAT_Msk + +/******************* Bit definition for XQSPI_CACHE_BUF_FIRST_ADDR register ***********/ +#define XQSPI_CACHE_BUF_FISRT_ADDR_Pos (0U) +#define XQSPI_CACHE_BUF_FISRT_ADDR_Len (32U) +#define XQSPI_CACHE_BUF_FISRT_ADDR_Msk (0xFFFFFFFFU) +#define XQSPI_CACHE_BUF_FISRT_ADDR XQSPI_CACHE_BUF_FISRT_ADDR_Msk + +/******************* Bit definition for XQSPI_CACHE_BUF_LAST_ADDR register ***********/ +#define XQSPI_CACHE_BUF_LAST_ADDR_Pos (0U) +#define XQSPI_CACHE_BUF_LAST_ADDR_Len (32U) +#define XQSPI_CACHE_BUF_LAST_ADDR_Msk (0xFFFFFFFFU) +#define XQSPI_CACHE_BUF_LAST_ADDR XQSPI_CACHE_BUF_LAST_ADDR_Msk + +/******************* Bit definition for XQSPI_XIP_CFG register **************/ +#define XQSPI_XIP_CFG_CMD_Pos (0U) +#define XQSPI_XIP_CFG_CMD_Len (8U) +#define XQSPI_XIP_CFG_CMD_Msk (0xFFU << XQSPI_XIP_CFG_CMD_Pos) +#define XQSPI_XIP_CFG_CMD XQSPI_XIP_CFG_CMD_Msk + +#define XQSPI_XIP_CFG_LE32_Pos (8U) +#define XQSPI_XIP_CFG_LE32_Len (1U) +#define XQSPI_XIP_CFG_LE32_Msk (0x1U << XQSPI_XIP_CFG_LE32_Pos) +#define XQSPI_XIP_CFG_LE32 XQSPI_XIP_CFG_LE32_Msk + +#define XQSPI_XIP_CFG_ADDR4_Pos (7U) +#define XQSPI_XIP_CFG_ADDR4_Len (1U) +#define XQSPI_XIP_CFG_ADDR4_Msk (0x1U << XQSPI_XIP_CFG_ADDR4_Pos) +#define XQSPI_XIP_CFG_ADDR4 XQSPI_XIP_CFG_ADDR4_Msk + +#define XQSPI_XIP_CFG_CPOL_Pos (6U) +#define XQSPI_XIP_CFG_CPOL_Len (1U) +#define XQSPI_XIP_CFG_CPOL_Msk (0x1U << XQSPI_XIP_CFG_CPOL_Pos) +#define XQSPI_XIP_CFG_CPOL XQSPI_XIP_CFG_CPOL_Msk + +#define XQSPI_XIP_CFG_CPHA_Pos (5U) +#define XQSPI_XIP_CFG_CPHA_Len (1U) +#define XQSPI_XIP_CFG_CPHA_Msk (0x1U << XQSPI_XIP_CFG_CPHA_Pos) +#define XQSPI_XIP_CFG_CPHA XQSPI_XIP_CFG_CPHA_Msk + +#define XQSPI_XIP_CFG_SS_Pos (1U) +#define XQSPI_XIP_CFG_SS_Len (4U) +#define XQSPI_XIP_CFG_SS_Msk (0xFU << XQSPI_XIP_CFG_SS_Pos) +#define XQSPI_XIP_CFG_SS XQSPI_XIP_CFG_SS_Msk + +#define XQSPI_XIP_CFG_HPEN_Pos (0U) +#define XQSPI_XIP_CFG_HPEN_Len (1U) +#define XQSPI_XIP_CFG_HPEN_Msk (0x1U << XQSPI_XIP_CFG_HPEN_Pos) +#define XQSPI_XIP_CFG_HPEN XQSPI_XIP_CFG_HPEN_Msk + +#define XQSPI_XIP_CFG_ENDDUMMY_Pos (12U) +#define XQSPI_XIP_CFG_ENDDUMMY_Len (2U) +#define XQSPI_XIP_CFG_ENDDUMMY_Msk (0x3U << XQSPI_XIP_CFG_ENDDUMMY_Pos) +#define XQSPI_XIP_CFG_ENDDUMMY XQSPI_XIP_CFG_ENDDUMMY_Msk + +#define XQSPI_XIP_CFG_DUMMYCYCLES_Pos (8U) +#define XQSPI_XIP_CFG_DUMMYCYCLES_Len (4U) +#define XQSPI_XIP_CFG_DUMMYCYCLES_Msk (0xFU << XQSPI_XIP_CFG_DUMMYCYCLES_Pos) +#define XQSPI_XIP_CFG_DUMMYCYCLES XQSPI_XIP_CFG_DUMMYCYCLES_Msk + +#define XQSPI_XIP_CFG_HPMODE_Pos (0U) +#define XQSPI_XIP_CFG_HPMODE_Len (8U) +#define XQSPI_XIP_CFG_HPMODE_Msk (0xFFUL << XQSPI_XIP_CFG_HPMODE_Pos) +#define XQSPI_XIP_CFG_HPMODE XQSPI_XIP_CFG_HPMODE_Msk + +/******************* Bit definition for XQSPI_XIP_EN register ***************/ +#define XQSPI_XIP_EN_REQ_Pos (0U) +#define XQSPI_XIP_EN_REQ_Len (1U) +#define XQSPI_XIP_EN_REQ_Msk (0x1U << XQSPI_XIP_EN_REQ_Pos) +#define XQSPI_XIP_EN_REQ XQSPI_XIP_EN_REQ_Msk + +#define XQSPI_XIP_EN_OUT_Pos (0U) +#define XQSPI_XIP_EN_OUT_Len (1U) +#define XQSPI_XIP_EN_OUT_Msk (0x1U << XQSPI_XIP_EN_OUT_Pos) +#define XQSPI_XIP_EN_OUT XQSPI_XIP_EN_OUT_Msk + +/******************* Bit definition for XQSPI_XIP_INT0 register *************/ +#define XQSPI_XIP_INT_EN_Pos (0U) +#define XQSPI_XIP_INT_EN_Len (1U) +#define XQSPI_XIP_INT_EN_Msk (0x1U << XQSPI_XIP_INT_EN_Pos) +#define XQSPI_XIP_INT_EN XQSPI_XIP_INT_EN_Msk + +/******************* Bit definition for XQSPI_XIP_INT1 register *************/ +#define XQSPI_XIP_INT_STAT_Pos (0U) +#define XQSPI_XIP_INT_STAT_Len (1U) +#define XQSPI_XIP_INT_STAT_Msk (0x1U << XQSPI_XIP_INT_STAT_Pos) +#define XQSPI_XIP_INT_STAT XQSPI_XIP_INT_STAT_Msk + +/******************* Bit definition for XQSPI_XIP_INT2 register *************/ +#define XQSPI_XIP_INT_REQ_Pos (0U) +#define XQSPI_XIP_INT_REQ_Len (1U) +#define XQSPI_XIP_INT_REQ_Msk (0x1U << XQSPI_XIP_INT_REQ_Pos) +#define XQSPI_XIP_INT_REQ XQSPI_XIP_INT_REQ_Msk + +/******************* Bit definition for XQSPI_XIP_INT3 register *************/ +#define XQSPI_XIP_INT_SET_Pos (0U) +#define XQSPI_XIP_INT_SET_Len (1U) +#define XQSPI_XIP_INT_SET_Msk (0x1U << XQSPI_XIP_INT_SET_Pos) +#define XQSPI_XIP_INT_SET XQSPI_XIP_INT_SET_Msk + +/******************* Bit definition for XQSPI_XIP_INT4 register *************/ +#define XQSPI_XIP_INT_CLR_Pos (0U) +#define XQSPI_XIP_INT_CLR_Len (1U) +#define XQSPI_XIP_INT_CLR_Msk (0x1U << XQSPI_XIP_INT_CLR_Pos) +#define XQSPI_XIP_INT_CLR XQSPI_XIP_INT_CLR_Msk + +/******************* Bit definition for XQSPI_QSPI_STAT register ************/ +#define XQSPI_QSPI_STAT_RXFULL_Pos (7U) +#define XQSPI_QSPI_STAT_RXFULL_Len (1U) +#define XQSPI_QSPI_STAT_RXFULL_Msk (0x1U << XQSPI_QSPI_STAT_RXFULL_Pos) +#define XQSPI_QSPI_STAT_RXFULL XQSPI_QSPI_STAT_RXFULL_Msk + +#define XQSPI_QSPI_STAT_RXWMARK_Pos (6U) +#define XQSPI_QSPI_STAT_RXWMARK_Len (1U) +#define XQSPI_QSPI_STAT_RXWMARK_Msk (0x1U << XQSPI_QSPI_STAT_RXWMARK_Pos) +#define XQSPI_QSPI_STAT_RXWMARK XQSPI_QSPI_STAT_RXWMARK_Msk + +#define XQSPI_QSPI_STAT_RXEMPTY_Pos (5U) +#define XQSPI_QSPI_STAT_RXEMPTY_Len (1U) +#define XQSPI_QSPI_STAT_RXEMPTY_Msk (0x1U << XQSPI_QSPI_STAT_RXEMPTY_Pos) +#define XQSPI_QSPI_STAT_RXEMPTY XQSPI_QSPI_STAT_RXEMPTY_Msk + +#define XQSPI_QSPI_STAT_TXFULL_Pos (4U) +#define XQSPI_QSPI_STAT_TXFULL_Len (1U) +#define XQSPI_QSPI_STAT_TXFULL_Msk (0x1U << XQSPI_QSPI_STAT_TXFULL_Pos) +#define XQSPI_QSPI_STAT_TXFULL XQSPI_QSPI_STAT_TXFULL_Msk + +#define XQSPI_QSPI_STAT_TXWMARK_Pos (3U) +#define XQSPI_QSPI_STAT_TXWMARK_Len (1U) +#define XQSPI_QSPI_STAT_TXWMARK_Msk (0x1U << XQSPI_QSPI_STAT_TXWMARK_Pos) +#define XQSPI_QSPI_STAT_TXWMARK XQSPI_QSPI_STAT_TXWMARK_Msk + +#define XQSPI_QSPI_STAT_TXEMPTY_Pos (2U) +#define XQSPI_QSPI_STAT_TXEMPTY_Len (1U) +#define XQSPI_QSPI_STAT_TXEMPTY_Msk (0x1U << XQSPI_QSPI_STAT_TXEMPTY_Pos) +#define XQSPI_QSPI_STAT_TXEMPTY XQSPI_QSPI_STAT_TXEMPTY_Msk + +#define XQSPI_QSPI_STAT_XFERIP_Pos (0U) +#define XQSPI_QSPI_STAT_XFERIP_Len (1U) +#define XQSPI_QSPI_STAT_XFERIP_Msk (0x1U << XQSPI_QSPI_STAT_XFERIP_Pos) +#define XQSPI_QSPI_STAT_XFERIP XQSPI_QSPI_STAT_XFERIP_Msk + +/******************* Bit definition for XQSPI_QSPI_FIFO register ************/ +#define XQSPI_QSPI_FIFO_TX_Pos (0U) +#define XQSPI_QSPI_FIFO_TX_Len (32U) +#define XQSPI_QSPI_FIFO_TX_Msk (0xFFFFFFFFU) +#define XQSPI_QSPI_FIFO_TX XQSPI_QSPI_FIFO_TX_Msk + +#define XQSPI_QSPI_FIFO_RX_Pos (0U) +#define XQSPI_QSPI_FIFO_RX_Len (32U) +#define XQSPI_QSPI_FIFO_RX_Msk (0xFFFFFFFFU) +#define XQSPI_QSPI_FIFO_RX XQSPI_QSPI_FIFO_RX_Msk + +/******************* Bit definition for XQSPI_QSPI_CTRL register ************/ +#define XQSPI_QSPI_CTRL_TXWMARK_Pos (14U) +#define XQSPI_QSPI_CTRL_TXWMARK_Len (2U) +#define XQSPI_QSPI_CTRL_TXWMARK_Msk (0x3U << XQSPI_QSPI_CTRL_TXWMARK_Pos) +#define XQSPI_QSPI_CTRL_TXWMARK XQSPI_QSPI_CTRL_TXWMARK_Msk + +#define XQSPI_QSPI_CTRL_RXWMARK_Pos (12U) +#define XQSPI_QSPI_CTRL_RXWMARK_Len (2U) +#define XQSPI_QSPI_CTRL_RXWMARK_Msk (0x3U << XQSPI_QSPI_CTRL_RXWMARK_Pos) +#define XQSPI_QSPI_CTRL_RXWMARK XQSPI_QSPI_CTRL_RXWMARK_Msk + +#define XQSPI_QSPI_CTRL_MWAITEN_Pos (11U) +#define XQSPI_QSPI_CTRL_MWAITEN_Len (1U) +#define XQSPI_QSPI_CTRL_MWAITEN_Msk (0x1U << XQSPI_QSPI_CTRL_MWAITEN_Pos) +#define XQSPI_QSPI_CTRL_MWAITEN XQSPI_QSPI_CTRL_MWAITEN_Msk + +#define XQSPI_QSPI_CTRL_DMA_Pos (10U) +#define XQSPI_QSPI_CTRL_DMA_Len (1U) +#define XQSPI_QSPI_CTRL_DMA_Msk (0x1U << XQSPI_QSPI_CTRL_DMA_Pos) +#define XQSPI_QSPI_CTRL_DMA XQSPI_QSPI_CTRL_DMA_Msk + +#define XQSPI_QSPI_CTRL_MASTER_Pos (5U) +#define XQSPI_QSPI_CTRL_MASTER_Len (1U) +#define XQSPI_QSPI_CTRL_MASTER_Msk (0x1U << XQSPI_QSPI_CTRL_MASTER_Pos) +#define XQSPI_QSPI_CTRL_MASTER XQSPI_QSPI_CTRL_MASTER_Msk + +#define XQSPI_QSPI_CTRL_CPOL_Pos (4U) +#define XQSPI_QSPI_CTRL_CPOL_Len (1U) +#define XQSPI_QSPI_CTRL_CPOL_Msk (0x1U << XQSPI_QSPI_CTRL_CPOL_Pos) +#define XQSPI_QSPI_CTRL_CPOL XQSPI_QSPI_CTRL_CPOL_Msk + +#define XQSPI_QSPI_CTRL_CPHA_Pos (3U) +#define XQSPI_QSPI_CTRL_CPHA_Len (1U) +#define XQSPI_QSPI_CTRL_CPHA_Msk (0x1U << XQSPI_QSPI_CTRL_CPHA_Pos) +#define XQSPI_QSPI_CTRL_CPHA XQSPI_QSPI_CTRL_CPHA_Msk + +#define XQSPI_QSPI_CTRL_MSB1ST_Pos (2U) +#define XQSPI_QSPI_CTRL_MSB1ST_Len (1U) +#define XQSPI_QSPI_CTRL_MSB1ST_Msk (0x1U << XQSPI_QSPI_CTRL_MSB1ST_Pos) +#define XQSPI_QSPI_CTRL_MSB1ST XQSPI_QSPI_CTRL_MSB1ST_Msk + +#define XQSPI_QSPI_CTRL_CONTXFER_Pos (0U) +#define XQSPI_QSPI_CTRL_CONTXFER_Len (1U) +#define XQSPI_QSPI_CTRL_CONTXFER_Msk (0x1U << XQSPI_QSPI_CTRL_CONTXFER_Pos) +#define XQSPI_QSPI_CTRL_CONTXFER XQSPI_QSPI_CTRL_CONTXFER_Msk + +/******************* Bit definition for XQSPI_QSPI_AUXCTRL register *********/ +#define XQSPI_QSPI_AUXCTRL_CONTXFERX_Pos (7U) +#define XQSPI_QSPI_AUXCTRL_CONTXFERX_Len (1U) +#define XQSPI_QSPI_AUXCTRL_CONTXFERX_Msk (0x1U << XQSPI_QSPI_AUXCTRL_CONTXFERX_Pos) +#define XQSPI_QSPI_AUXCTRL_CONTXFERX XQSPI_QSPI_AUXCTRL_CONTXFERX_Msk + +#define XQSPI_QSPI_AUXCTRL_BITSIZE_Pos (4U) +#define XQSPI_QSPI_AUXCTRL_BITSIZE_Len (3U) +#define XQSPI_QSPI_AUXCTRL_BITSIZE_Msk (0x7U << XQSPI_QSPI_AUXCTRL_BITSIZE_Pos) +#define XQSPI_QSPI_AUXCTRL_BITSIZE XQSPI_QSPI_AUXCTRL_BITSIZE_Msk + +#define XQSPI_QSPI_AUXCTRL_INHIBITDIN_Pos (3U) +#define XQSPI_QSPI_AUXCTRL_INHIBITDIN_Len (1U) +#define XQSPI_QSPI_AUXCTRL_INHIBITDIN_Msk (0x1U << XQSPI_QSPI_AUXCTRL_INHIBITDIN_Pos) +#define XQSPI_QSPI_AUXCTRL_INHIBITDIN XQSPI_QSPI_AUXCTRL_INHIBITDIN_Msk + +#define XQSPI_QSPI_AUXCTRL_INHIBITDOUT_Pos (2U) +#define XQSPI_QSPI_AUXCTRL_INHIBITDOUT_Len (1U) +#define XQSPI_QSPI_AUXCTRL_INHIBITDOUT_Msk (0x1U << XQSPI_QSPI_AUXCTRL_INHIBITDOUT_Pos) +#define XQSPI_QSPI_AUXCTRL_INHIBITDOUT XQSPI_QSPI_AUXCTRL_INHIBITDOUT_Msk + +#define XQSPI_QSPI_AUXCTRL_QMODE_Pos (0U) +#define XQSPI_QSPI_AUXCTRL_QMODE_Len (2U) +#define XQSPI_QSPI_AUXCTRL_QMODE_Msk (0x3U << XQSPI_QSPI_AUXCTRL_QMODE_Pos) +#define XQSPI_QSPI_AUXCTRL_QMODE XQSPI_QSPI_AUXCTRL_QMODE_Msk + +/******************* Bit definition for XQSPI_QSPI_SS register **************/ +#define XQSPI_QSPI_SS_OUT3_Pos (3U) +#define XQSPI_QSPI_SS_OUT3_Len (1U) +#define XQSPI_QSPI_SS_OUT3_Msk (0x1U << XQSPI_QSPI_SS_OUT3_Pos) +#define XQSPI_QSPI_SS_OUT3 XQSPI_QSPI_SS_OUT3_Msk + +#define XQSPI_QSPI_SS_OUT2_Pos (2U) +#define XQSPI_QSPI_SS_OUT2_Len (1U) +#define XQSPI_QSPI_SS_OUT2_Msk (0x1U << XQSPI_QSPI_SS_OUT2_Pos) +#define XQSPI_QSPI_SS_OUT2 XQSPI_QSPI_SS_OUT2_Msk + +#define XQSPI_QSPI_SS_OUT1_Pos (1U) +#define XQSPI_QSPI_SS_OUT1_Len (1U) +#define XQSPI_QSPI_SS_OUT1_Msk (0x1U << XQSPI_QSPI_SS_OUT1_Pos) +#define XQSPI_QSPI_SS_OUT1 XQSPI_QSPI_SS_OUT1_Msk + +#define XQSPI_QSPI_SS_OUT0_Pos (0U) +#define XQSPI_QSPI_SS_OUT0_Len (1U) +#define XQSPI_QSPI_SS_OUT0_Msk (0x1U << XQSPI_QSPI_SS_OUT0_Pos) +#define XQSPI_QSPI_SS_OUT0 XQSPI_QSPI_SS_OUT0_Msk + +/******************* Bit definition for XQSPI_QSPI_SS_POL register **********/ +#define XQSPI_QSPI_SS_POL3_Pos (3U) +#define XQSPI_QSPI_SS_POL3_Len (1U) +#define XQSPI_QSPI_SS_POL3_Msk (0x1U << XQSPI_QSPI_SS_POL3_Pos) +#define XQSPI_QSPI_SS_POL3 XQSPI_QSPI_SS_POL3_Msk + +#define XQSPI_QSPI_SS_POL2_Pos (2U) +#define XQSPI_QSPI_SS_POL2_Len (1U) +#define XQSPI_QSPI_SS_POL2_Msk (0x1U << XQSPI_QSPI_SS_POL2_Pos) +#define XQSPI_QSPI_SS_POL2 XQSPI_QSPI_SS_POL2_Msk + +#define XQSPI_QSPI_SS_POL1_Pos (1U) +#define XQSPI_QSPI_SS_POL1_Len (1U) +#define XQSPI_QSPI_SS_POL1_Msk (0x1U << XQSPI_QSPI_SS_POL1_Pos) +#define XQSPI_QSPI_SS_POL1 XQSPI_QSPI_SS_POL1_Msk + +#define XQSPI_QSPI_SS_POL0_Pos (0U) +#define XQSPI_QSPI_SS_POL0_Len (1U) +#define XQSPI_QSPI_SS_POL0_Msk (0x1U << XQSPI_QSPI_SS_POL0_Pos) +#define XQSPI_QSPI_SS_POL0 XQSPI_QSPI_SS_POL0_Msk + +/******************* Bit definition for XQSPI_QSPI_INT_EN register **********/ +#define XQSPI_QSPI_INT_EN_Pos (0U) +#define XQSPI_QSPI_INT_EN_Len (7U) +#define XQSPI_QSPI_INT_EN_Msk (0x7FUL << XQSPI_QSPI_INT_EN_Pos) +#define XQSPI_QSPI_INT_EN XQSPI_QSPI_INT_EN_Msk + +/******************* Bit definition for XQSPI_QSPI_INT_STAT register ********/ +#define XQSPI_QSPI_INT_STAT_Pos (0U) +#define XQSPI_QSPI_INT_STAT_Len (7U) +#define XQSPI_QSPI_INT_STAT_Msk (0x7FUL << XQSPI_QSPI_INT_STAT_Pos) +#define XQSPI_QSPI_INT_STAT XQSPI_QSPI_INT_STAT_Msk + +/******************* Bit definition for XQSPI_QSPI_INT_CLR register *********/ +#define XQSPI_QSPI_INT_CLR_Pos (0U) +#define XQSPI_QSPI_INT_CLR_Len (7U) +#define XQSPI_QSPI_INT_CLR_Msk (0x7FUL << XQSPI_QSPI_INT_CLR_Pos) +#define XQSPI_QSPI_INT_CLR XQSPI_QSPI_INT_CLR_Msk + +/******************* Bit definition for XQSPI Interrupt Bit Mapping *********/ +#define XQSPI_QSPI_GPI_HI_PULSE1_Pos (6U) +#define XQSPI_QSPI_GPI_HI_PULSE1_Len (1U) +#define XQSPI_QSPI_GPI_HI_PULSE1_Msk (0x1U << XQSPI_QSPI_GPI_HI_PULSE1_Pos) +#define XQSPI_QSPI_GPI_HI_PULSE0_Pos (5U) +#define XQSPI_QSPI_GPI_HI_PULSE0_Len (1U) +#define XQSPI_QSPI_GPI_HI_PULSE0_Msk (0x1U << XQSPI_QSPI_GPI_HI_PULSE0_Pos) +#define XQSPI_QSPI_XFER_DPULSE_Pos (4U) +#define XQSPI_QSPI_XFER_DPULSE_Len (1U) +#define XQSPI_QSPI_XFER_DPULSE_Msk (0x1U << XQSPI_QSPI_XFER_DPULSE_Pos) +#define XQSPI_QSPI_RX_FPULSE_Pos (3U) +#define XQSPI_QSPI_RX_FPULSE_Len (1U) +#define XQSPI_QSPI_RX_FPULSE_Msk (0x1U << XQSPI_QSPI_RX_FPULSE_Pos) +#define XQSPI_QSPI_RX_WPULSE_Pos (2U) +#define XQSPI_QSPI_RX_WPULSE_Len (1U) +#define XQSPI_QSPI_RX_WPULSE_Msk (0x1U << XQSPI_QSPI_RX_WPULSE_Pos) +#define XQSPI_QSPI_TX_WPULSE_Pos (1U) +#define XQSPI_QSPI_TX_WPULSE_Len (1U) +#define XQSPI_QSPI_TX_WPULSE_Msk (0x1U << XQSPI_QSPI_TX_WPULSE_Pos) +#define XQSPI_QSPI_TX_EPULSE_Pos (0U) +#define XQSPI_QSPI_TX_EPULSE_Len (1U) +#define XQSPI_QSPI_TX_EPULSE_Msk (0x1U << XQSPI_QSPI_TX_EPULSE_Pos) + +/******************* Bit definition for XQSPI_QSPI_TXFIFOLVL register *******/ +#define XQSPI_QSPI_TXFIFOLVL_Pos (0U) +#define XQSPI_QSPI_TXFIFOLVL_Len (7U) +#define XQSPI_QSPI_TXFIFOLVL_Msk (0x7FUL << XQSPI_QSPI_TXFIFOLVL_Pos) +#define XQSPI_QSPI_TXFIFOLVL XQSPI_QSPI_TXFIFOLVL_Msk + +/******************* Bit definition for XQSPI_QSPI_RXFIFOLVL register *******/ +#define XQSPI_QSPI_RXFIFOLVL_Pos (0U) +#define XQSPI_QSPI_RXFIFOLVL_Len (7U) +#define XQSPI_QSPI_RXFIFOLVL_Msk (0x7FUL << XQSPI_QSPI_RXFIFOLVL_Pos) +#define XQSPI_QSPI_RXFIFOLVL XQSPI_QSPI_RXFIFOLVL_Msk + +/******************* Bit definition for XQSPI_QSPI_MWAIT register ***********/ +#define XQSPI_QSPI_MWAIT_MWAIT_Pos (0U) +#define XQSPI_QSPI_MWAIT_MWAIT_Len (8U) +#define XQSPI_QSPI_MWAIT_MWAIT_Msk (0xFFUL << XQSPI_QSPI_MWAIT_MWAIT_Pos) +#define XQSPI_QSPI_MWAIT_MWAIT XQSPI_QSPI_MWAIT_MWAIT_Msk + +/******************* Bit definition for XQSPI_QSPI_EN register **************/ +#define XQSPI_QSPI_EN_EN_Pos (0U) +#define XQSPI_QSPI_EN_EN_Len (1U) +#define XQSPI_QSPI_EN_EN_Msk (0x1U << XQSPI_QSPI_EN_EN_Pos) +#define XQSPI_QSPI_EN_EN XQSPI_QSPI_EN_EN_Msk + +/******************* Bit definition for XQSPI_QSPI_GPOSET_GPOSET register ***/ +#define XQSPI_QSPI_GPOSET_GPOSET_Pos (0U) +#define XQSPI_QSPI_GPOSET_GPOSET_Len (8U) +#define XQSPI_QSPI_GPOSET_GPOSET_Msk (0xFFUL << XQSPI_QSPI_GPOSET_GPOSET_Pos) +#define XQSPI_QSPI_GPOSET_GPOSET XQSPI_QSPI_GPOSET_GPOSET_Msk + +/******************* Bit definition for XQSPI_QSPI_GPOCLR_GPOCLR register ***/ +#define XQSPI_QSPI_GPOCLR_GPOCLR_Pos (0U) +#define XQSPI_QSPI_GPOCLR_GPOCLR_Len (8U) +#define XQSPI_QSPI_GPOCLR_GPOCLR_Msk (0xFFUL << XQSPI_QSPI_GPOCLR_GPOCLR_Pos) +#define XQSPI_QSPI_GPOCLR_GPOCLR XQSPI_QSPI_GPOCLR_GPOCLR_Msk + +/******************* Bit definition for XQSPI_QSPI_FLASH_WRITE register ***/ +#define XQSPI_QSPI_FLASH_WRITE_Pos (0U) +#define XQSPI_QSPI_FLASH_WRITE_Len (1U) +#define XQSPI_QSPI_FLASH_WRITE_Msk (0xFFUL << XQSPI_QSPI_FLASH_WRITE_Pos) +#define XQSPI_QSPI_FLASH_WRITE XQSPI_QSPI_FLASH_WRITE_Msk + +/******************* Bit definition for XQSPI_QSPI_PRESENT_BYPASS register ***/ +#define XQSPI_QSPI_PRESENT_BYPASS_Pos (0U) +#define XQSPI_QSPI_PRESENT_BYPASS_Len (1U) +#define XQSPI_QSPI_PRESENT_BYPASS_Msk (0xFFUL << XQSPI_QSPI_PRESENT_BYPASS_Pos) +#define XQSPI_QSPI_PRESENT_BYPASS XQSPI_QSPI_PRESENT_BYPASS_Msk + +/* =============================================================================================================== */ +/* ================ EFUSE ================ */ +/* =============================================================================================================== */ +/******************* Bit definition for EFUSE_TPGM register **********/ +#define EFUSE_TPGM_TIME_Pos (0U) +#define EFUSE_TPGM_TIME_Len (12U) +#define EFUSE_TPGM_TIME_Msk (0xFFFUL << EFUSE_TPGM_TIME_Pos) +#define EFUSE_TPGM_TIME EFUSE_TPGM_TIME_Msk + +#define EFUSE_TPGM_MAIN_OR_BACKUP_Pos (12U) +#define EFUSE_TPGM_MAIN_OR_BACKUP_Len (1U) +#define EFUSE_TPGM_MAIN_OR_BACKUP_Msk (0x1UL << EFUSE_TPGM_MAIN_OR_BACKUP_Pos) +#define EFUSE_TPGM_MAIN_OR_BACKUP EFUSE_TPGM_MAIN_OR_BACKUP_Msk + +#define EFUSE_TPGM_CRC_CHECK_LEN_Pos (16U) +#define EFUSE_TPGM_CRC_CHECK_LEN_Len (6U) +#define EFUSE_TPGM_CRC_CHECK_LEN_Msk (0x3FUL << EFUSE_TPGM_CRC_CHECK_LEN_Pos) +#define EFUSE_TPGM_CRC_CHECK_LEN EFUSE_TPGM_CRC_CHECK_LEN_Msk + +#define EFUSE_TPGM_WRITE_INTERVAL_Pos (24U) +#define EFUSE_TPGM_WRITE_INTERVAL_Len (8U) +#define EFUSE_TPGM_WRITE_INTERVAL_Msk (0xFFUL << EFUSE_TPGM_WRITE_INTERVAL_Pos) +#define EFUSE_TPGM_WRITE_INTERVAL EFUSE_TPGM_WRITE_INTERVAL_Msk + +/******************* Bit definition for EFUSE_PGENB register **********/ +#define EFUSE_PGENB_SIG_Pos (0U) +#define EFUSE_PGENB_SIG_Len (1U) +#define EFUSE_PGENB_SIG_Msk (0x1UL << EFUSE_PGENB_SIG_Pos) +#define EFUSE_PGENB_SIG EFUSE_PGENB_SIG_Msk + +/******************* Bit definition for EFUSE_TEST_MODE register **********/ +#define EFUSE_TEST_MODE_Pos (0U) +#define EFUSE_TEST_MODE_Len (16U) +#define EFUSE_TEST_MODE_Msk (0xFFFFUL << EFUSE_TEST_MODE_Pos) +#define EFUSE_TEST_MODE EFUSE_TEST_MODE_Msk + +/******************* Bit definition for EFUSE_OPERATION register **********/ +#define EFUSE_OPER_WRITE_KEYRAM_Pos (0U) +#define EFUSE_OPER_WRITE_KEYRAM_Len (1U) +#define EFUSE_OPER_WRITE_KEYRAM_Msk (0x1UL << EFUSE_OPER_WRITE_KEYRAM_Pos) +#define EFUSE_OPER_WRITE_KEYRAM EFUSE_OPER_WRITE_KEYRAM_Msk + +#define EFUSE_OPER_INIT_CHECK_Pos (1U) +#define EFUSE_OPER_INIT_CHECK_Len (1U) +#define EFUSE_OPER_INIT_CHECK_Msk (0x1UL << EFUSE_OPER_INIT_CHECK_Pos) +#define EFUSE_OPER_INIT_CHECK EFUSE_OPER_INIT_CHECK_Msk + +#define EFUSE_OPER_CRC_CHECK_Pos (2U) +#define EFUSE_OPER_CRC_CHECK_Len (1U) +#define EFUSE_OPER_CRC_CHECK_Msk (0x1UL << EFUSE_OPER_CRC_CHECK_Pos) +#define EFUSE_OPER_CRC_CHECK EFUSE_OPER_CRC_CHECK_Msk + +#define EFUSE_OPER_READ_TRIM_Pos (3U) +#define EFUSE_OPER_READ_TRIM_Len (1U) +#define EFUSE_OPER_READ_TRIM_Msk (0x1UL << EFUSE_OPER_READ_TRIM_Pos) +#define EFUSE_OPER_READ_TRIM EFUSE_OPER_READ_TRIM_Msk + +#define EFUSE_OPER_RD_TEST_MODE_Pos (4U) +#define EFUSE_OPER_RD_TEST_MODE_Len (1U) +#define EFUSE_OPER_RD_TEST_MODE_Msk (0x1UL << EFUSE_OPER_RD_TEST_MODE_Pos) +#define EFUSE_OPER_RD_TEST_MODE EFUSE_OPER_RD_TEST_MODE_Msk + +/******************* Bit definition for EFUSE_STATUS register **********/ +#define EFUSE_STATUS_WRITE_KEYRAM_BUSY_Pos (0U) +#define EFUSE_STATUS_WRITE_KEYRAM_BUSY_Len (1U) +#define EFUSE_STATUS_WRITE_KEYRAM_BUSY_Msk (0x1UL << EFUSE_STATUS_WRITE_KEYRAM_BUSY_Pos) +#define EFUSE_STATUS_WRITE_KEYRAM_BUSY EFUSE_STATUS_WRITE_KEYRAM_BUSY_Msk + +#define EFUSE_STATUS_READ_TRIM_DONE_Pos (1U) +#define EFUSE_STATUS_READ_TRIM_DONE_Len (1U) +#define EFUSE_STATUS_READ_TRIM_DONE_Msk (0x1UL << EFUSE_STATUS_READ_TRIM_DONE_Pos) +#define EFUSE_STATUS_READ_TRIM_DONE EFUSE_STATUS_READ_TRIM_DONE_Msk + +#define EFUSE_STATUS_TRIM_CRC_SUCCESS_Pos (2U) +#define EFUSE_STATUS_TRIM_CRC_SUCCESS_Len (1U) +#define EFUSE_STATUS_TRIM_CRC_SUCCESS_Msk (0x1UL << EFUSE_STATUS_TRIM_CRC_SUCCESS_Pos) +#define EFUSE_STATUS_TRIM_CRC_SUCCESS EFUSE_STATUS_TRIM_CRC_SUCCESS_Msk + +#define EFUSE_STATUS_INIT_DONE_Pos (3U) +#define EFUSE_STATUS_INIT_DONE_Len (1U) +#define EFUSE_STATUS_INIT_DONE_Msk (0x1UL << EFUSE_STATUS_INIT_DONE_Pos) +#define EFUSE_STATUS_INIT_DONE EFUSE_STATUS_INIT_DONE_Msk + +#define EFUSE_STATUS_INIT_SUCCESS_Pos (4U) +#define EFUSE_STATUS_INIT_SUCCESS_Len (1U) +#define EFUSE_STATUS_INIT_SUCCESS_Msk (0x1UL << EFUSE_STATUS_INIT_SUCCESS_Pos) +#define EFUSE_STATUS_INIT_SUCCESS EFUSE_STATUS_INIT_SUCCESS_Msk + +#define EFUSE_STATUS_CRC_CHECK_DONE_Pos (5U) +#define EFUSE_STATUS_CRC_CHECK_DONE_Len (1U) +#define EFUSE_STATUS_CRC_CHECK_DONE_Msk (0x1UL << EFUSE_STATUS_CRC_CHECK_DONE_Pos) +#define EFUSE_STATUS_CRC_CHECK_DONE EFUSE_STATUS_CRC_CHECK_DONE_Msk + +#define EFUSE_STATUS_WRITE_DONE_Pos (6U) +#define EFUSE_STATUS_WRITE_DONE_Len (1U) +#define EFUSE_STATUS_WRITE_DONE_Msk (0x1UL << EFUSE_STATUS_WRITE_DONE_Pos) +#define EFUSE_STATUS_WRITE_DONE EFUSE_STATUS_WRITE_DONE_Msk + +#define EFUSE_STATUS_TEST_MODE_DONE_Pos (7U) +#define EFUSE_STATUS_TEST_MODE_DONE_Len (1U) +#define EFUSE_STATUS_TEST_MODE_DONE_Msk (0x1UL << EFUSE_STATUS_TEST_MODE_DONE_Pos) +#define EFUSE_STATUS_TEST_MODE_DONE EFUSE_STATUS_TEST_MODE_DONE_Msk + +/******************* Bit definition for EFUSE_KEY_MASK register **********/ +#define EFUSE_KEY_MASK_Pos (0U) +#define EFUSE_KEY_MASK_Len (32U) +#define EFUSE_KEY_MASK_Msk (0x1UL << EFUSE_KEY_MASK_Pos) +#define EFUSE_KEY_MASK EFUSE_KEY_MASK_Msk + +/******************* Bit definition for EFUSE_CRC_START_ADDR register **********/ +#define EFUSE_CRC_START_CHECK_ADDR_Pos (0U) +#define EFUSE_CRC_START_CHECK_ADDR_Len (32U) +#define EFUSE_CRC_START_CHECK_ADDR_Msk (0xFFFFFFFFU) +#define EFUSE_CRC_START_CHECK_ADDR EFUSE_CRC_START_CHECK_ADDR_Msk + +/******************* Bit definition for EFUSE_CRC_OUTPUT register **********/ +#define EFUSE_CRC_OUTPUT_VALUE_Pos (0U) +#define EFUSE_CRC_OUTPUT_VALUE_Len (32U) +#define EFUSE_CRC_OUTPUT_VALUE_Msk (0xFFFFFFFFU) +#define EFUSE_CRC_OUTPUT_VALUE EFUSE_CRC_OUTPUT_VALUE_Msk + +/******************* Bit definition for EFUSE_TRIM_ADDR register **********/ +#define EFUSE_TRIM_START_ADDR_Pos (0U) +#define EFUSE_TRIM_START_ADDR_Len (32U) +#define EFUSE_TRIM_START_ADDR_Msk (0xFFFFFFFFU) +#define EFUSE_TRIM_START_ADDR EFUSE_TRIM_START_ADDR_Msk + +/******************* Bit definition for EFUSE_TRIM_LEN register **********/ +#define EFUSE_TRIM_LENGTH_Pos (0U) +#define EFUSE_TRIM_LENGTH_Len (5U) +#define EFUSE_TRIM_LENGTH_Msk (0x1FU << EFUSE_TRIM_LENGTH_Pos) +#define EFUSE_TRIM_LENGTH EFUSE_TRIM_LENGTH_Msk + +/******************* Bit definition for EFUSE_TRIM register **************/ +#define EFUSE_TRIM_Pos (0U) +#define EFUSE_TRIM_Len (32U) +#define EFUSE_TRIM_Msk (0xFFFFFFFFU) +#define EFUSE_TRIM EFUSE_TRIM_Msk + +/* =============================================================================================================== */ +/* ================ RNG ================ */ +/* =============================================================================================================== */ +/******************* Bit definition for RNG_CTRL register **********/ +#define RNG_CTRL_RUN_EN_Pos (0U) +#define RNG_CTRL_RUN_EN_Len (1U) +#define RNG_CTRL_RUN_EN_Msk (0x1UL << RNG_CTRL_RUN_EN_Pos) +#define RNG_CTRL_RUN_EN RNG_CTRL_RUN_EN_Msk + +/******************* Bit definition for RNG_STATUS register **********/ +#define RNG_STATUS_READY_Pos (0U) +#define RNG_STATUS_READY_Len (1U) +#define RNG_STATUS_READY_Msk (0x1UL << RNG_STATUS_READY_Pos) +#define RNG_STATUS_READY RNG_STATUS_READY_Msk + +/******************* Bit definition for RNG_DATA register **********/ +#define RNG_DATA_VALUE_Pos (0U) +#define RNG_DATA_VALUE_Len (32U) +#define RNG_DATA_VALUE_Msk (0xFFFFFFFF) +#define RNG_DATA_VALUE RNG_DATA_VALUE_Msk + +/******************* Bit definition for RNG_LR_STATUS register *********/ +#define RNG_LR_STATUS_FLAG_Pos (0U) +#define RNG_LR_STATUS_FLAG_Len (1U) +#define RNG_LR_STATUS_FLAG_Msk (0x1UL << RNG_LR_STATUS_FLAG_Pos) +#define RNG_LR_STATUS_FLAG RNG_LR_STATUS_FLAG_Msk +#define RNG_LR_STATUS_CNT_Pos (1U) +#define RNG_LR_STATUS_CNT_Len (8U) +#define RNG_LR_STATUS_CNT_Msk (0xFFUL << RNG_LR_STATUS_CNT_Pos) +#define RNG_LR_STATUS_CNT RNG_LR_STATUS_CNT_Msk + +/******************* Bit definition for RNG_CONFIG register ************/ +#define RNG_CONFIG_OUT_MODE_Pos (0U) +#define RNG_CONFIG_OUT_MODE_Len (4U) +#define RNG_CONFIG_OUT_MODE_Msk (0xFUL << RNG_CONFIG_OUT_MODE_Pos) +#define RNG_CONFIG_OUT_MODE RNG_CONFIG_OUT_MODE_Msk +#define RNG_CONFIG_LFSR_XOR_SEL_Pos (4U) +#define RNG_CONFIG_LFSR_XOR_SEL_Len (3U) +#define RNG_CONFIG_LFSR_XOR_SEL_Msk (0x7UL << RNG_CONFIG_LFSR_XOR_SEL_Pos) +#define RNG_CONFIG_LFSR_XOR_SEL RNG_CONFIG_LFSR_XOR_SEL_Msk +#define RNG_CONFIG_POST_MODE_Pos (7U) +#define RNG_CONFIG_POST_MODE_Len (2U) +#define RNG_CONFIG_POST_MODE_Msk (0x3UL << RNG_CONFIG_POST_MODE_Pos) +#define RNG_CONFIG_POST_MODE RNG_CONFIG_POST_MODE_Msk +#define RNG_CONFIG_LFSR_MODE_Pos (9U) +#define RNG_CONFIG_LFSR_MODE_Len (1U) +#define RNG_CONFIG_LFSR_MODE_Msk (0x1UL << RNG_CONFIG_LFSR_MODE_Pos) +#define RNG_CONFIG_LFSR_MODE RNG_CONFIG_LFSR_MODE_Msk +#define RNG_CONFIG_LFSR_SEED_SEL_Pos (10U) +#define RNG_CONFIG_LFSR_SEED_SEL_Len (3U) +#define RNG_CONFIG_LFSR_SEED_SEL_Msk (0x7UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) +#define RNG_CONFIG_LFSR_SEED_SEL RNG_CONFIG_LFSR_SEED_SEL_Msk +#define RNG_CONFIG_IRQ_EN_Pos (13U) +#define RNG_CONFIG_IRQ_EN_Len (1U) +#define RNG_CONFIG_IRQ_EN_Msk (0x1UL << RNG_CONFIG_IRQ_EN_Pos) +#define RNG_CONFIG_IRQ_EN RNG_CONFIG_IRQ_EN_Msk +#define RNG_CONFIG_FRO_EN_Pos (15U) +#define RNG_CONFIG_FRO_EN_Len (1U) +#define RNG_CONFIG_FRO_EN_Msk (0x1UL << RNG_CONFIG_FRO_EN_Pos) +#define RNG_CONFIG_FRO_EN RNG_CONFIG_FRO_EN_Msk + +/******************* Bit definition for RNG_TSCON register *************/ +#define RNG_TSCON_TRDY_TIME_Pos (0U) +#define RNG_TSCON_TRDY_TIME_Len (8U) +#define RNG_TSCON_TRDY_TIME_Msk (0xFUL << RNG_TSCON_TRDY_TIME_Pos) +#define RNG_TSCON_TRDY_TIME RNG_TSCON_TRDY_TIME_Msk +#define RNG_TSCON_FRO_CHAIN_Pos (11U) +#define RNG_TSCON_FRO_CHAIN_Len (4U) +#define RNG_TSCON_FRO_CHAIN_Msk (0xFUL << RNG_TSCON_FRO_CHAIN_Pos) +#define RNG_TSCON_FRO_CHAIN RNG_TSCON_FRO_CHAIN_Msk + +/******************* Bit definition for RNG_FROCFG register *************/ +#define RNG_FROCFG_CHAINE_EN_Pos (0U) +#define RNG_FROCFG_CHAINE_EN_Len (8U) +#define RNG_FROCFG_CHAINE_EN_Msk (0xFFUL << RNG_FROCFG_CHAINE_EN_Pos) +#define RNG_FROCFG_CHAINE_EN RNG_FROCFG_CHAINE_EN_Msk +#define RNG_FROCFG_TEST_IN_Pos (8U) +#define RNG_FROCFG_TEST_IN_Len (8U) +#define RNG_FROCFG_TEST_IN_Msk (0xFFUL << RNG_FROCFG_TEST_IN_Pos) +#define RNG_FROCFG_TEST_IN RNG_FROCFG_TEST_IN_Msk + +/******************* Bit definition for RNG_USER_SEED register *************/ +#define RNG_USER_SEED_Pos (0U) +#define RNG_USER_SEED_Len (16U) +#define RNG_USER_SEED_Msk (0xFFUL << RNG_USER_SEED_Pos) +#define RNG_USER_SEED RNG_USER_SEED_Msk + +/******************* Bit definition for RNG_LRCON register *****************/ +#define RNG_LRCON_TEST_EN_Pos (0U) +#define RNG_LRCON_TEST_EN_Len (1U) +#define RNG_LRCON_TEST_EN_Msk (0x1UL << RNG_LRCON_TEST_EN_Pos) +#define RNG_LRCON_TEST_EN RNG_LRCON_TEST_EN_Msk +#define RNG_LRCON_TEST_LIMIT_Pos (1U) +#define RNG_LRCON_TEST_LIMIT_Len (5U) +#define RNG_LRCON_TEST_LIMIT_Msk (0x1FUL << RNG_LRCON_TEST_LIMIT_Pos) +#define RNG_LRCON_TEST_LIMIT RNG_LRCON_TEST_LIMIT_Msk + +/** @} */ /* End of group Peripheral_Registers_Bits_Definition */ + +/** @addtogroup Exported_macros + * @{ + */ +/****************************** GPIO instances ********************************/ +#define IS_GPIO_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == GPIO0) || \ + ((__INSTANCE__) == GPIO1)) + +/****************************** I2C instances *********************************/ +#define IS_I2C_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == I2C0) || \ + ((__INSTANCE__) == I2C1)) + +/****************************** I2S instances *********************************/ +#define IS_I2S_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == I2S_M) || \ + ((__INSTANCE__) == I2S_S)) + +/****************************** UART instances ********************************/ +#define IS_UART_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == UART0) || \ + ((__INSTANCE__) == UART1)) + +/******************** UART instances : Support of DMA *************************/ +#define IS_UART_DMA_INSTANCE(__INSTANCE__) (((__INSTANCE__) == UART0)) + +/****************************** TIM instances *********************************/ +#define IS_TIMER_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == TIMER0) || \ + ((__INSTANCE__) == TIMER1)) + +/****************************** DUAL TIM instances ****************************/ +#define IS_DUAL_TIM_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == DUAL_TIMER0) || \ + ((__INSTANCE__) == DUAL_TIMER1)) + +/****************************** PWM instances *********************************/ +#define IS_PWM_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == PWM0) || \ + ((__INSTANCE__) == PWM1)) + +/****************************** WDT instances *********************************/ +#define IS_WDT_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == WDT)) + +/****************************** SPI instances *********************************/ +#define IS_SPI_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == SPIM) || \ + ((__INSTANCE__) == SPIS)) + +/****************************** QSPI instances ********************************/ +#define IS_QSPI_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == QSPI0) || \ + ((__INSTANCE__) == QSPI1)) + +/****************************** PKC instances *********************************/ +#define IS_PKC_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == PKC)) + +/****************************** AES Instances *********************************/ +#define IS_AES_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == AES)) + +/****************************** HMAC Instances ********************************/ +#define IS_HMAC_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == HMAC)) + +/****************************** XQSPI Instances *******************************/ +#define IS_XQSPI_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == XQSPI)) + +/****************************** EFUSE Instances *******************************/ +#define IS_EFUSE_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == EFUSE)) + +/****************************** RNG Instances *******************************/ +#define IS_RNG_ALL_INSTANCE(__INSTANCE__) (((__INSTANCE__) == RNG)) + + +/** @} */ /* End of group Exported_macros */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __GR551xx_H__ */ + +/** @} */ /* End of group GR551xx */ + +/** @} */ /* End of group CMSIS_Device */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr55xx.h b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr55xx.h new file mode 100644 index 0000000..c35bde9 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/gr55xx.h @@ -0,0 +1,207 @@ +/**************************************************************************//** + * @file gr55xx.h + * @brief CMSIS Cortex-M# Core Peripheral Access Layer Header File for + * Device GR55xx + * @version V1.00 + * @date 12. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2016-2018, Shenzhen Huiding Technology Co., Ltd + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** @addtogroup CMSIS_Device + * @{ + */ + +/** @addtogroup GR55xx + * @{ + */ + +#ifndef __GR55xx_H__ +#define __GR55xx_H__ +#ifndef CFG_LAYER_TAG_SDK +#ifndef CFG_LAYER_TAG_ROM +#include "custom_config.h" +#endif +#endif + +#if defined (__GNUC__) +#define __ramfunc __attribute__((noinline)) \ + __attribute__((long_call, section(".ramfunc"))) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup Library_configuration_section + * @{ + */ + +/** + * @brief GR55 Family + */ +#if !defined (GR55) +#define GR55 +#endif /* GR55 */ + +/* Uncomment the line below according to the target GR55 device used in your + application + */ +#if !defined (GR551xx) + #define GR551xx +#endif + +/** @} */ + +/** @addtogroup Device_Included + * @{ + */ +#if defined(GR551xx) + #include "gr551xx.h" + + #define GR55XX_RAM_ADDRESS 0x30000000 + #define GR55XX_FLASH_ADDRESS 0x01000000 + #define GR55XX_ALIAS_ADDRESS 0x00800000 +#else + #error "Please select first the target GR55xx device used in your application (in gr551xx.h file)" +#endif + +/** @} */ + +/** @addtogroup Exported_types + * @{ + */ + +typedef enum +{ + RESET = 0, + SET = !RESET +} flag_status_t, it_status_t; + +typedef enum +{ + DISABLE = 0, + ENABLE = !DISABLE +} functional_state_t; +#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) + +typedef enum +{ + ERROR = 0, + SUCCESS = !ERROR +} error_status_t; + +/** @} */ + +/** @addtogroup Exported_macros + * @{ + */ +#ifndef SET_BITS +#define SET_BITS(REG, BIT) ((REG) |= (BIT)) +#endif + +#ifndef CLEAR_BITS +#define CLEAR_BITS(REG, BIT) ((REG) &= ~(BIT)) +#endif + +#ifndef READ_BITS +#define READ_BITS(REG, BIT) ((REG) & (BIT)) +#endif + +#ifndef CLEAR_REG +#define CLEAR_REG(REG) ((REG) = (0x0)) +#endif + +#ifndef WRITE_REG +#define WRITE_REG(REG, VAL) ((REG) = (VAL)) +#endif + +#ifndef READ_REG +#define READ_REG(REG) ((REG)) +#endif + +#ifndef MODIFY_REG +#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) +#endif + +#ifndef POSITION_VAL +#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) +#endif + +#ifndef UNUSED +#define UNUSED(x) ((void)(x)) +#endif + +#ifndef SECTION_RAM_CODE +#if defined(CFG_LAYER_TAG_ROM) + #define SECTION_RAM_CODE +#else +#if defined ( __ICCARM__ ) || defined (__GNUC__) + #define SECTION_RAM_CODE __ramfunc +#else + #define SECTION_RAM_CODE __attribute__((section("RAM_CODE"))) /**< To prevent doxygen from misidentifying the function name */ +#endif +#endif +#endif + +#ifndef C_CONSTRUCTOR +#if defined ( __ICCARM__ ) +#define C_CONSTRUCTOR +#else +#define C_CONSTRUCTOR __attribute__((constructor)) +#endif +#endif + +#ifndef TINY_RAM_SECTION + #define TINY_RAM_SECTION SECTION_RAM_CODE +#endif + +#ifndef RESERVE_RAM_SECTION +#if defined ( __CC_ARM ) +#define RESERVE_RAM_SECTION __attribute__((section("RAM_RESERVE"),zero_init)) /**< To prevent doxygen from misidentifying the function name */ +#endif +#endif + +/** @brief Disable interrupts globally in the system(apart from the NMI). + * This macro must be used in conjunction with the @ref GLOBAL_EXCEPTION_ENABLE macro + * since this last one will close the brace that the current macro opens. This means + * that both macros must be located at the same scope level. + */ +#define GLOBAL_EXCEPTION_DISABLE() \ +do { \ + uint32_t __l_irq_rest = __get_PRIMASK(); \ + __set_PRIMASK(1) + + +/** @brief Restore interrupts from the previous global disable(apart from the NMI). + * @sa GLOBAL_EXCEPTION_ENABLE + */ +#define GLOBAL_EXCEPTION_ENABLE() \ + __set_PRIMASK(__l_irq_rest); \ +} while(0) +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* __GR55xx_H__ */ + +/** @} */ + +/** @} */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/grx_soc_reg.h b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/grx_soc_reg.h new file mode 100644 index 0000000..ba8e3d5 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/grx_soc_reg.h @@ -0,0 +1,39 @@ +/**************************************************************************//** + * @file grx_soc_reg.h + * @brief The SOC chip register header file contains. + * + * @version V1.00 + * @date 12. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2016-2018, Shenzhen Huiding Technology Co., Ltd + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __GRX_SOC_REG_H__ +#define __GRX_SOC_REG_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "gr55xx.h" + +#ifdef __cplusplus +} +#endif + +#endif /* __SYSTEM_GR55xx_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/system_gr55xx.h b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/system_gr55xx.h new file mode 100644 index 0000000..e84ebbe --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/include/system_gr55xx.h @@ -0,0 +1,92 @@ +/**************************************************************************//** + * @file system_gr55xx.h + * @brief CMSIS Cortex-M# Device Peripheral Access Layer Header File for + * Device GR55xx + * @version V1.00 + * @date 12. June 2018 + ******************************************************************************/ +/* + * Copyright (c) 2016-2018, Shenzhen Huiding Technology Co., Ltd + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __SYSTEM_GR55xx_H__ +#define __SYSTEM_GR55xx_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#define CLK_64M 64000000 +#define CLK_48M 48000000 +#define CLK_32M 32000000 +#define CLK_24M 24000000 +#define CLK_16M 16000000 + +typedef enum +{ + XO_S16M_CLK = 2, + CPLL_S16M_CLK = 4, + CPLL_T24M_CLK = 3, + CPLL_T32M_CLK = 5, + CPLL_F48M_CLK = 1, + CPLL_S64M_CLK = 0, + CLK_TYPE_NUM = 6, +} mcu_clock_type_t; + +typedef enum +{ + QSPI_64M_CLK = 0, + QSPI_48M_CLK = 1, + QSPI_32M_CLK = 2, + QSPI_24M_CLK = 3, + QSPI_16M_CLK = 4, + QSPI_CLK_TYPE_NUM = 5, +} qspi_clock_type_t; + +extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ + +/** @brief Setup the microcontroller system. + + Initialize the System and update the SystemCoreClock variable. + */ +extern void SystemInit(void); + +/** \brief Update SystemCoreClock variable. + + Updates the SystemCoreClock with current core Clock + retrieved from cpu registers. + */ +extern void SystemCoreSetClock(mcu_clock_type_t clock); + +/** \brief Get SystemCoreClock variable. + + Get the SystemCoreClock with current core Clock + retrieved from cpu registers. + */ +extern void SystemCoreGetClock(mcu_clock_type_t *clock); + + +extern void SystemCoreUpdateClock(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* __SYSTEM_GR55xx_H__ */ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5513.lds b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5513.lds new file mode 100644 index 0000000..d981917 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5513.lds @@ -0,0 +1,116 @@ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x01002000, LENGTH = (0x00800000 -0x00002000) + RAM (rwx) : ORIGIN = 0x30000000 +0x4000, LENGTH = (0x00020000 -0x4000) +} + +GROUP(libgcc.a libc.a libm.a libnosys.a) +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.vectors)) + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __end__ = .; + . = ALIGN(0x200); + KEEP(*(.app_info)) + *( .text*) + KEEP(*(.init)) + KEEP(*(.fini)) + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + *(.rodata*) + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + + __exidx_end = .; + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + *(.ramfunc) + *(RAM_CODE) + *(TINY_RAM_SPACE) + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + KEEP(*(.jcr*)) + . = ALIGN(4); + __data_end__ = .; + } > RAM + + .my_section : + { + . = ALIGN(32); + *(FPB*) + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + end = __end__; + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + + __sstack = __StackLimit; + __estack = __StackTop; + + PROVIDE(__stack = __StackTop); + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5515.lds b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5515.lds new file mode 100644 index 0000000..60a2a07 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/gcc_linker_gr5515.lds @@ -0,0 +1,116 @@ +MEMORY +{ + FLASH (rx) : ORIGIN = 0x01002000, LENGTH = (0x00800000 -0x00002000) + RAM (rwx) : ORIGIN = 0x30000000 +0x4000, LENGTH = (0x00040000 -0x4000) +} + +GROUP(libgcc.a libc.a libm.a libnosys.a) +ENTRY(Reset_Handler) + +SECTIONS +{ + .text : + { + KEEP(*(.vectors)) + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __end__ = .; + . = ALIGN(0x200); + KEEP(*(.app_info)) + *( .text*) + KEEP(*(.init)) + KEEP(*(.fini)) + *crtbegin.o(.ctors) + *crtbegin?.o(.ctors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors) + *(SORT(.ctors.*)) + *(.ctors) + *crtbegin.o(.dtors) + *crtbegin?.o(.dtors) + *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors) + *(SORT(.dtors.*)) + *(.dtors) + *(.rodata*) + KEEP(*(.eh_frame*)) + } > FLASH + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > FLASH + + __exidx_start = .; + .ARM.exidx : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + } > FLASH + + __exidx_end = .; + __etext = .; + + .data : AT (__etext) + { + __data_start__ = .; + *(vtable) + *(.data*) + *(.ramfunc) + *(RAM_CODE) + *(TINY_RAM_SPACE) + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP(*(.preinit_array)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP(*(SORT(.init_array.*))) + KEEP(*(.init_array)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP(*(SORT(.fini_array.*))) + KEEP(*(.fini_array)) + PROVIDE_HIDDEN (__fini_array_end = .); + KEEP(*(.jcr*)) + . = ALIGN(4); + __data_end__ = .; + } > RAM + + .my_section : + { + . = ALIGN(32); + *(FPB*) + } > RAM + + .bss : + { + . = ALIGN(4); + __bss_start__ = .; + *(.bss*) + *(COMMON) + . = ALIGN(4); + __bss_end__ = .; + } > RAM + + .heap (COPY): + { + __HeapBase = .; + __end__ = .; + end = __end__; + KEEP(*(.heap*)) + __HeapLimit = .; + } > RAM + + .stack_dummy (COPY): + { + KEEP(*(.stack*)) + } > RAM + + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __StackLimit = __StackTop - SIZEOF(.stack_dummy); + + __sstack = __StackLimit; + __estack = __StackTop; + + PROVIDE(__stack = __StackTop); + ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") +} diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/hardfloat_lib/libble_sdk.a b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/hardfloat_lib/libble_sdk.a new file mode 100644 index 0000000..4f2eca1 Binary files /dev/null and b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/hardfloat_lib/libble_sdk.a differ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/libble_sdk.a b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/libble_sdk.a new file mode 100644 index 0000000..d62dc35 Binary files /dev/null and b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/libble_sdk.a differ diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/rom_symbol_gcc.txt b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/rom_symbol_gcc.txt new file mode 100644 index 0000000..4b7ef77 --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/rom_symbol_gcc.txt @@ -0,0 +1,1414 @@ +boot_info = 0x00801f10; +drv_modular_exponet_65537 = 0x00001235; +gm_drv_present_encrypt = 0x00001b75; +gm_drv_sha_encrypt = 0x00001bc1; +bl1_srand = 0x00004bb9; +adc_dma_error = 0x00005edd; +adc_wait_notempty_until_timeout = 0x00005ef1; +aes_init = 0x0000684d; +ahi_init = 0x00006e0d; +assert_err = 0x00006f01; +assert_param = 0x00006f2d; +assert_warn = 0x00006f5d; +attc_l2cc_pdu_recv_handler = 0x000072c5; +attm_att_set_value = 0x00007b79; +attm_att_update_perm = 0x00007c2f; +attm_uuid_comp = 0x0000821b; +attmdb_destroy = 0x00008429; +attmdb_get_attribute = 0x00008449; +attmdb_get_uuid = 0x0000863d; +attmdb_uuid16_comp = 0x00008bed; +atts_clear_read_cache = 0x00008c95; +atts_execute_write_req = 0x00008ce9; +atts_find_by_type_req = 0x00008ef9; +atts_find_end = 0x000090f5; +atts_find_info_req = 0x0000917d; +atts_get_att_chk_perm = 0x000093fd; +atts_get_value = 0x000094f5; +atts_hdl_value_cfm = 0x000095c1; +atts_mtu_exc_req = 0x000096d1; +atts_prepare_write_req = 0x0000976d; +atts_process_pdu = 0x000098c9; +atts_read_blob_req = 0x00009991; +atts_read_by_grp_type_req = 0x00009ac5; +atts_read_by_type_req = 0x00009cf5; +atts_read_req = 0x0000a0b1; +atts_send_error = 0x0000a1b9; +atts_send_pdu = 0x0000a273; +atts_write_cmd = 0x0000a369; +atts_write_req = 0x0000a3f9; +atts_write_signed = 0x0000a4d9; +bb_watch_timer_cbk_func = 0x0000a5fd; +bb_watch_timer_start_func = 0x0000a601; +ble_get_role_and_cs_idx_from_et = 0x0000a9dd; +ble_sdk_default_prf_config_set = 0x0000aa4d; +ble_util_buf_acl_tx_alloc = 0x0000aab1; +ble_util_buf_acl_tx_free = 0x0000ab09; +ble_util_buf_adv_tx_free = 0x0000ab69; +ble_util_buf_rx_alloc = 0x0000add9; +ble_util_buf_rx_free = 0x0000ae15; +ble_util_isodesc_init = 0x0000af6d; +check_boot_info = 0x0000bdf5; +check_image_crc = 0x0000be3d; +co_bdaddr_compare = 0x0000be99; +co_list_extract = 0x0000bf45; +co_list_extract_sublist = 0x0000c125; +co_list_find = 0x0000c1bd; +co_list_insert_after = 0x0000c231; +co_list_pool_init = 0x0000c431; +co_list_pop_front = 0x0000c47b; +co_list_push_back = 0x0000c4c5; +co_list_push_back_sublist = 0x0000c54d; +co_list_push_front = 0x0000c60d; +co_list_size = 0x0000c68d; +co_nb_good_le_channels = 0x0000c6c9; +connect_req_is_consistent_spec = 0x0000cbf9; +dbg_init = 0x0000ccbd; +dbg_log_printf = 0x0000cd9d; +ecc_init = 0x0000da81; +exflash_check_id = 0x0000e3fd; +exflash_deepsleep = 0x0000e479; +exflash_enable_quad = 0x0000e495; +exflash_enable_write = 0x0000e4f9; +exflash_erase_chip = 0x0000e515; +exflash_erase_sector = 0x0000e571; +exflash_page_program = 0x0000e5d9; +exflash_resume = 0x0000e6a5; +exflash_suspend = 0x0000e6c1; +exflash_wait_busy = 0x0000e715; +exflash_wakeup = 0x0000e78d; +exflash_write_status = 0x0000e7a9; +force_dpad_le_high = 0x0000e8ad; +gapc_get_conidx = 0x0000f2a9; +gapc_get_dest_task = 0x0000f2f5; +gapc_get_operation = 0x0000f591; +gapc_get_role = 0x0000f6f5; +gapc_link_encrypted = 0x0000f8e1; +gapc_send_complete_evt = 0x0000fe49; +gapc_send_disconect_ind = 0x0000fead; +gapc_send_error_evt = 0x0000fed3; +gapm_get_bdaddr = 0x0000ffed; +gapc_set_local_addr = 0x00010025; +gapc_update_state = 0x000104c5; +gapm_actv_alloc = 0x00010f7d; +gapm_actv_check_create_param = 0x00010fad; +gapm_actv_created = 0x00010fbd; +gapm_actv_get_free_idx = 0x000110c5; +gapm_actv_retrieve_cmd_cmp_evt = 0x000111d5; +gapm_actv_started = 0x000112b9; +gapm_actv_stopped = 0x000112ed; +gapm_adv_can_set_data = 0x00011671; +gapm_adv_create = 0x00011a19; +gapm_adv_is_advtype_unique = 0x00011b11; +gapm_adv_send_hci_le_set_per_adv_data_cmd = 0x00011dfd; +gapm_con_cleanup = 0x00012171; +gapm_dle_val_check = 0x000122d1; +gapm_get_address_type = 0x000123b9; +gapm_get_att_handle = 0x000123c9; +gapm_get_irk = 0x000125e9; +gapm_get_requester = 0x000126b1; +gapm_init_attr = 0x00012845; +gapm_init_check_param = 0x0001287d; +gapm_init_delete = 0x00012a1d; +gapm_init_send_hci_le_create_con_cancel_cmd = 0x00012a21; +gapm_init_send_hci_le_ext_create_con_cmd = 0x00012a33; +gapm_init_stopped = 0x00012bbd; +gapm_is_addr_type_valid = 0x00012c0d; +gapm_le_psm_cleanup = 0x00012c71; +gapm_per_sync_create = 0x000133fd; +gapm_process_op = 0x00013649; +gapm_scan_create = 0x000139bd; +gattc_get_mtu = 0x0001501d; +gattc_get_operation_ptr = 0x0001511d; +gattc_get_requester = 0x0001518d; +gattc_send_complete_evt = 0x000159ed; +gattm_init_attr = 0x00016431; +get_time_before_instant_by_hus = 0x000166b1; +h4tl_init = 0x0001680d; +h4tl_read_start = 0x000169a5; +hal_adc_get_dma_threshold = 0x00016e71; +hal_adc_get_error = 0x00016e81; +hal_adc_get_state = 0x00016e85; +hal_adc_register_callback = 0x00017021; +hal_adc_set_dma_threshold = 0x00017055; +hal_aes_abort = 0x000171d9; +hal_aes_abort_it = 0x000171f9; +hal_aes_get_error = 0x0001769d; +hal_aes_get_state = 0x000176a1; +hal_aes_irq_handler = 0x0001772d; +hal_aes_register_callback = 0x00017831; +hal_aes_resume_reg = 0x0001783d; +hal_aes_set_timeout = 0x000178d9; +hal_aes_suspend_reg = 0x000178dd; +hal_aon_gpio_br_callback = 0x0001797c; +hal_aon_gpio_read_pin = 0x00017a75; +hal_aon_gpio_register_callback = 0x00017a8d; +hal_aon_wdt_deinit_ext = 0x00017b39; +hal_aon_wdt_irq_handler = 0x00017ba9; +hal_aon_wdt_register_callback = 0x00017c19; +hal_calendar_register_callback = 0x00017e95; +hal_comp_get_error = 0x000180a7; +hal_comp_get_state = 0x000180ab; +hal_comp_register_callback = 0x0001815d; +hal_comp_resume_reg = 0x00018169; +hal_comp_start = 0x00018179; +hal_comp_stop = 0x000181bd; +hal_comp_suspend_reg = 0x00018205; +hal_deinit_ext = 0x00018249; +hal_delay = 0x0001824d; +hal_dma_abort = 0x00018265; +hal_dma_abort_it = 0x00018345; +hal_dma_get_error = 0x00018459; +hal_dma_get_state = 0x0001845d; +hal_dma_irq_handler = 0x000184f1; +hal_dma_poll_for_transfer = 0x00018639; +hal_dma_register_callback = 0x00018729; +hal_dma_resume_reg = 0x00018775; +hal_dma_start = 0x000187bd; +hal_dma_start_it = 0x00018839; +hal_dma_suspend_reg = 0x00018911; +hal_dma_unregister_callback = 0x0001893d; +hal_dual_timer_base_start = 0x00018a7d; +hal_dual_timer_base_start_it = 0x00018ab7; +hal_dual_timer_base_stop = 0x00018af1; +hal_dual_timer_base_stop_it = 0x00018b2b; +hal_dual_timer_deinit_ext = 0x00018b6f; +hal_dual_timer_get_state = 0x00018b73; +hal_dual_timer_init_ext = 0x00018b77; +hal_dual_timer_register_callback = 0x00018bcd; +hal_efuse_crc_calculate = 0x00018c2d; +hal_efuse_initial_value_check = 0x00018d75; +hal_efuse_read = 0x00018e01; +hal_efuse_read_trim = 0x00018e79; +hal_efuse_register_callback = 0x00018f05; +hal_efuse_set_main_backup = 0x00018f11; +hal_efuse_write = 0x00018f2d; +hal_efuse_write_keyram = 0x0001902d; +hal_exflash_deepsleep = 0x0001907d; +hal_exflash_deinit_ext = 0x000190f3; +hal_exflash_get_error = 0x00019245; +hal_exflash_get_state = 0x00019249; +hal_exflash_init_ext = 0x0001935d; +hal_exflash_lock = 0x00019361; +hal_exflash_msp_init = 0x0001941d; +hal_exflash_read_rom = 0x00019435; +hal_exflash_register_callback = 0x0001958d; +hal_exflash_reset = 0x00019599; +hal_exflash_set_retry = 0x0001962d; +hal_exflash_unlock = 0x00019683; +hal_exflash_wakeup = 0x00019723; +hal_get_tick = 0x000199c1; +hal_gpio_deinit_ext = 0x00019a71; +hal_gpio_exti_irq_handler = 0x00019a91; +hal_gpio_init_ext = 0x00019acb; +hal_gpio_read_pin = 0x00019acf; +hal_gpio_register_callback = 0x00019ae1; +hal_gpio_toggle_pin = 0x00019aed; +hal_gpio_write_pin = 0x00019af5; +hal_hmac_register_callback = 0x00019dbd; +hal_i2c_register_callback = 0x0001ae51; +hal_i2s_deinit_ext = 0x0001b3e1; +hal_i2s_get_error = 0x0001b401; +hal_i2s_get_rx_fifo_threshold = 0x0001b405; +hal_i2s_get_state = 0x0001b40f; +hal_i2s_get_tx_fifo_threshold = 0x0001b415; +hal_i2s_init_ext = 0x0001b515; +hal_i2s_receive = 0x0001b661; +hal_i2s_receive_dma = 0x0001b6f9; +hal_i2s_receive_it = 0x0001b825; +hal_i2s_register_callback = 0x0001b8fd; +hal_i2s_resume_reg = 0x0001b909; +hal_i2s_set_rx_fifo_threshold = 0x0001b969; +hal_i2s_set_tx_fifo_threshold = 0x0001b9b7; +hal_i2s_start_clock = 0x0001ba05; +hal_i2s_stop_clock = 0x0001ba2d; +hal_i2s_suspend_reg = 0x0001ba55; +hal_i2s_transmit_dma = 0x0001bb19; +hal_i2s_transmit_it = 0x0001bc59; +hal_i2s_transmit_receive = 0x0001bd31; +hal_i2s_transmit_receive_dma = 0x0001bdc9; +hal_i2s_transmit_receive_it = 0x0001bf3d; +hal_increment_tick = 0x0001c051; +hal_init_ext = 0x0001c071; +hal_init_tick = 0x0001c075; +hal_mpu_config_region = 0x0001c095; +hal_mpu_disable = 0x0001c0ed; +hal_mpu_enable = 0x0001c105; +hal_msio_read_pin_sym = 0x0001c18d; +hal_msio_toggle_pin_sym = 0x0001c1a5; +hal_msio_write_pin_sym = 0x0001c1bd; +hal_nvic_clear_pending_irq = 0x0001c219; +hal_nvic_disable_irq = 0x0001c233; +hal_nvic_enable_irq = 0x0001c255; +hal_nvic_get_active = 0x0001c26f; +hal_nvic_get_pending_irq = 0x0001c297; +hal_nvic_get_priority = 0x0001c2bf; +hal_nvic_set_pending_irq = 0x0001c325; +hal_nvic_set_priority = 0x0001c341; +hal_nvic_set_priority_grouping = 0x0001c399; +hal_pkc_register_callback = 0x0001d971; +hal_pwr_config_timer_wakeup_ext = 0x0001df01; +hal_pwr_enter_chip_deepsleep = 0x0001df05; +hal_pwr_register_timer_elaspsed_handler = 0x0001df81; +hal_pwr_set_comm_mode = 0x0001df8d; +hal_pwr_set_comm_power = 0x0001dfc1; +hal_pwr_set_mem_current_power = 0x0001e035; +hal_pwr_set_mem_deepsleep_power = 0x0001e071; +hal_pwr_set_mem_wakeup_power = 0x0001e091; +hal_pwr_set_wakeup_condition = 0x0001e0b1; +hal_pwr_sleep_timer_irq_handler = 0x0001e0d9; +hal_qspi_register_callback = 0x0001f4c5; +hal_register_callback = 0x0001f921; +hal_resume_tick = 0x0001f92d; +hal_rng_get_state = 0x0001fb23; +hal_rng_irq_handler = 0x0001fb95; +hal_rng_read_last_random_number = 0x0001fc01; +hal_rng_register_callback = 0x0001fc21; +hal_rng_suspend_reg = 0x0001fc47; +hal_sha256_digest = 0x0001fc51; +hal_sha256_digest_dma = 0x0001fcb3; +hal_sha256_digest_it = 0x0001fd09; +hal_spi_abort = 0x0001fd5f; +hal_spi_abort_it = 0x0001fe0d; +hal_spi_deinit_ext = 0x0001ff4d; +hal_spi_get_error = 0x0001ff6d; +hal_spi_get_rx_fifo_threshold = 0x0001ff71; +hal_spi_get_state = 0x0001ff7b; +hal_spi_get_tx_fifo_threshold = 0x0001ff81; +hal_spi_init_ext = 0x0002013d; +hal_spi_irq_handler = 0x00020141; +hal_spi_read_eeprom = 0x000202d5; +hal_spi_receive = 0x000205e1; +hal_spi_register_callback = 0x00020829; +hal_spi_resume_reg = 0x00020835; +hal_spi_set_rx_fifo_threshold = 0x00020891; +hal_spi_set_timeout = 0x000208bf; +hal_spi_set_tx_fifo_threshold = 0x000208c3; +hal_spi_suspend_reg = 0x000208f1; +hal_spi_transmit = 0x00020917; +hal_spi_transmit_dma = 0x0002098d; +hal_spi_transmit_receive = 0x00020b3b; +hal_suspend_tick = 0x00020e21; +hal_systick_callback = 0x00020e2f; +hal_systick_clk_source_config = 0x00020e31; +hal_systick_config = 0x00020e4d; +hal_systick_irq_handler = 0x00020e75; +hal_timer_base_start = 0x00020f25; +hal_timer_base_start_it = 0x00020f5f; +hal_timer_base_stop = 0x00020f99; +hal_timer_base_stop_it = 0x00020fd3; +hal_timer_base_deinit_ext = 0x00021017; +hal_timer_get_state = 0x0002101b; +hal_timer_base_init_ext = 0x0002101f; +hal_timer_irq_handler = 0x00021023; +hal_timer_register_callback = 0x0002104d; +hal_timer_set_config = 0x00021059; +hal_uart_abort = 0x00021081; +hal_uart_abort_it = 0x00021119; +hal_uart_abort_receive = 0x000211c5; +hal_uart_abort_receive_it = 0x00021225; +hal_uart_abort_transmit = 0x000212c9; +hal_uart_abort_transmit_it = 0x00021325; +hal_uart_deinit_ext = 0x00021479; +hal_uart_dma_stop = 0x00021545; +hal_uart_get_error = 0x00021595; +hal_uart_init_ext = 0x00021655; +hal_uart_irq_handler = 0x00021659; +hal_uart_receive = 0x00021749; +hal_uart_register_callback = 0x00021911; +hal_uart_resume_reg = 0x0002191d; +hal_uart_suspend_reg = 0x00021981; +hal_uart_transmit = 0x000219bf; +hal_uart_transmit_dma = 0x00021a35; +hal_uart_transmit_it = 0x00021ac1; +hal_wdt_deinit_ext = 0x00021b79; +hal_wdt_init_ext = 0x00021be1; +hal_wdt_irq_handler = 0x00021be5; +hal_wdt_refresh = 0x00021c7d; +hal_wdt_register_callback = 0x00021cb9; +hal_xqspi_command_receive = 0x00021cc5; +hal_xqspi_command_transmit = 0x00021d53; +hal_xqspi_deinit_ext = 0x00021e17; +hal_xqspi_get_error = 0x00021e1b; +hal_xqspi_get_rx_fifo_threshold = 0x00021e1f; +hal_xqspi_get_state = 0x00021e2b; +hal_xqspi_get_tx_fifo_threshold = 0x00021e31; +hal_xqspi_msp_init = 0x00021f19; +hal_xqspi_receive = 0x00021f31; +hal_xqspi_register_callback = 0x00021fbd; +hal_xqspi_set_retry = 0x00021fc9; +hal_xqspi_set_rx_fifo_threshold = 0x00021fcd; +hal_xqspi_set_tx_fifo_threshold = 0x0002200b; +hal_xqspi_transmit = 0x00022139; +hci_ble_conhdl_register = 0x000229f5; +hci_init = 0x00024479; +adv_hci_le_cmd_cmp_evt_creating_handler = 0x000250a5; +adv_hci_le_cmd_cmp_evt_deleting_handler = 0x00025111; +hci_le_cmd_cmp_evt_scan_handler = 0x00025229; +init_hci_le_cmd_cmp_evt_started_handler = 0x00025295; +adv_hci_le_cmd_cmp_evt_starting_handler = 0x000252c5; +scan_hci_le_cmd_cmp_evt_starting_handler = 0x000253cd; +adv_hci_le_cmd_cmp_evt_stopping_handler = 0x0002540d; +init_hci_le_cmd_cmp_evt_stopping_handler = 0x00025481; +scan_hci_le_cmd_cmp_evt_stopping_handler = 0x00025491; +hci_le_con_upd_cmd_handler = 0x000254a5; +hci_look_for_cmd_desc = 0x0002b1b5; +hci_send_2_controller = 0x0002b9a1; +hci_send_2_host = 0x0002bac1; +i2s_dma_abort_cplt = 0x0002d4f5; +jump_app = 0x0002f831; +ke_check_malloc = 0x0002f849; +ke_event_callback_set = 0x0002f989; +ke_event_clear = 0x0002f9c5; +ke_event_get_all = 0x0002faa5; +ke_event_set = 0x0002fb11; +ke_flush = 0x0002fb85; +ke_free = 0x0002fbc9; +ke_init = 0x0002fe7d; +ke_is_free = 0x0002feb5; +ke_malloc = 0x0002fec9; +ke_msg_alloc = 0x000301a1; +ke_msg_free = 0x00030225; +ke_msg_send = 0x00030239; +ke_msg_send_basic = 0x00030275; +ke_sleep_check = 0x00030363; +ke_state_get = 0x00030375; +ke_task_handler_get = 0x0003058d; +ke_timer_clear = 0x00030891; +ke_timer_set = 0x000309b1; +l2cc_pdu_send = 0x0003108b; +ll_clock_accuracy_req_handler = 0x00031095; +l2cc_pdu_alloc = 0x00032629; +l2cm_get_nb_buffer_available = 0x00033d85; +ll_adc_struct_init = 0x00033f3d; +ll_aes_deinit = 0x00033f55; +ll_aes_init = 0x00033f63; +ll_aes_struct_init = 0x00033f77; +ll_aon_gpio_struct_init = 0x000340bd; +ll_cgc_deinit = 0x0003413d; +ll_cgc_init = 0x00034151; +ll_cgc_struct_init = 0x00034199; +ll_channel_map_ind_handler = 0x000341a9; +ll_cis_ind_handler = 0x0003426d; +ll_cis_req_handler = 0x000342e1; +ll_cis_rsp_handler = 0x00034535; +ll_cis_terminate_ind_handler = 0x0003460d; +ll_clock_accuracy_rsp_handler = 0x00034625; +ll_comp_deinit = 0x00034651; +ll_comp_init = 0x00034661; +ll_comp_struct_init = 0x000346ad; +ll_connection_param_req_handler = 0x000346b9; +ll_connection_param_rsp_handler = 0x00034795; +ll_connection_update_ind_handler = 0x0003482d; +ll_dbg_is_opcode_supported = 0x00034955; +ll_dma_struct_init = 0x00034e49; +ll_dual_timer_deinit = 0x00034e99; +ll_dual_timer_init = 0x00034ea9; +ll_dual_timer_struct_init = 0x00034ed5; +ll_enc_req_handler = 0x00034efd; +ll_enc_rsp_handler = 0x00034fc5; +ll_feature_req_handler = 0x00035039; +ll_feature_rsp_handler = 0x00035051; +ll_get_event_cnt = 0x000350a1; +ll_gpio_deinit = 0x000350b1; +ll_gpio_init = 0x0003516d; +ll_gpio_struct_init = 0x00035381; +ll_hmac_deinit = 0x00035395; +ll_hmac_init = 0x000353a3; +ll_hmac_struct_init = 0x000353cb; +ll_i2c_init = 0x0003543d; +ll_i2c_struct_init = 0x00035501; +ll_i2s_deinit = 0x00035515; +ll_i2s_init = 0x0003561d; +ll_i2s_struct_init = 0x00035769; +ll_length_req_handler = 0x00035783; +ll_length_rsp_handler = 0x000357d9; +ll_min_used_channels_ind_handler = 0x00035859; +ll_msio_struct_init = 0x00035a0d; +ll_pause_enc_req_handler = 0x00035a21; +ll_pause_enc_rsp_handler = 0x00035a95; +ll_phy_req_handler = 0x00035af9; +ll_phy_rsp_handler = 0x00035bad; +ll_phy_update_ind_handler = 0x00035c2d; +ll_ping_req_handler = 0x00035cc5; +ll_ping_rsp_handler = 0x00035ccf; +ll_pkc_deinit = 0x00035ced; +ll_pkc_init = 0x00035d13; +ll_pkc_struct_init = 0x00035d49; +ll_qspi_deinit = 0x00035f2d; +ll_qspi_init = 0x00035f4d; +ll_qspi_struct_init = 0x00035ff5; +ll_rng_deinit = 0x00036075; +ll_rng_init = 0x0003609b; +ll_rng_struct_init = 0x000360e3; +ll_slave_feature_req_handler = 0x000360f9; +ll_spim_deinit = 0x0003612d; +ll_spim_init = 0x00036149; +ll_spim_struct_init = 0x000361a9; +ll_spis_deinit = 0x000361d9; +ll_spis_init = 0x000361ef; +ll_spis_struct_init = 0x0003623d; +ll_start_enc_req_handler = 0x0003624d; +ll_start_enc_rsp_handler = 0x000362a5; +ll_terminate_ind_handler = 0x000362fd; +ll_timer_deinit = 0x00036339; +ll_timer_init = 0x00036347; +ll_timer_struct_init = 0x0003634f; +ll_uart_deinit = 0x00036357; +ll_uart_init = 0x00036361; +ll_uart_struct_init = 0x000363e5; +ll_version_ind_handler = 0x00036409; +ll_xqspi_deinit = 0x00036461; +ll_xqspi_init = 0x000364dd; +ll_xqspi_struct_init = 0x00036749; +llc_auth_payl_nearly_to_handler = 0x0003679d; +llc_auth_payl_real_to_handler = 0x00036801; +llc_ch_map_up_proc_err_cb = 0x00036855; +llc_cmd_stat_send = 0x00037295; +llc_con_move_cbk = 0x000372b5; +llc_con_upd_param_in_range = 0x00037491; +llc_disconnect = 0x000374dd; +llc_hci_con_param_req_evt_send = 0x00037905; +llc_hci_con_upd_info_send = 0x0003793d; +llc_hci_enc_evt_send = 0x00037a99; +llc_hci_ltk_request_evt_send = 0x00037ba9; +llc_init = 0x00037c49; +llc_iv_skd_rand_gen = 0x00037cd5; +llc_le_ping_restart = 0x00037e29; +llc_ll_connection_param_rsp_pdu_send = 0x00037f95; +llc_ll_enc_rsp_ack_handler = 0x00038079; +llc_ll_enc_rsp_pdu_send = 0x000380a1; +llc_ll_pause_enc_rsp_pdu_send = 0x00038209; +llc_ll_reject_ind_ack_handler = 0x00038291; +llc_ll_reject_ind_pdu_send = 0x000382b9; +llc_ll_start_enc_req_pdu_send = 0x00038315; +llc_ll_start_enc_rsp_ack_handler = 0x0003832d; +llc_ll_start_enc_rsp_pdu_send = 0x00038355; +llc_llcp_send_func = 0x0003846d; +llc_llcp_state_set = 0x0003852d; +llc_llcp_tx_check = 0x00038679; +llc_loc_con_upd_proc_err_cb = 0x00038bb5; +llc_loc_encrypt_proc_continue_func = 0x00038dcd; +llc_op_dl_upd_ind_handler = 0x000398a1; +llc_proc_collision_check = 0x00039cb5; +llc_proc_get = 0x00039d31; +llc_proc_id_get = 0x00039d65; +llc_proc_reg = 0x00039d99; +llc_proc_state_get = 0x00039e19; +llc_proc_state_set = 0x00039e1d; +llc_proc_timer_pause_set = 0x00039e21; +llc_proc_timer_set = 0x00039ed5; +llc_proc_unreg = 0x00039f89; +llc_rem_ch_map_proc_continue_func = 0x0003a00d; +llc_rem_con_upd_proc_err_cb = 0x0003a2b1; +llc_rem_encrypt_proc_continue_func = 0x0003a3e5; +llc_rem_phy_upd_proc_err_cb = 0x0003a9c5; +llc_sk_gen = 0x0003aaf9; +llc_start = 0x0003ab11; +lld_aa_gen = 0x0003ae59; +lld_acl_rx_ind_handler = 0x0003aed9; +lld_addr_is_in_ral_list = 0x0003afe7; +lld_adv_adv_data_set = 0x0003aff9; +lld_adv_aux_ch_idx_set = 0x0003b11d; +lld_adv_end = 0x0003b5b1; +lld_adv_ext_chain_construct = 0x0003bdc5; +lld_adv_frm_skip_isr = 0x0003cd81; +lld_adv_pkt_rx = 0x0003cf49; +lld_adv_restart = 0x0003da29; +lld_adv_scan_rsp_data_set = 0x0003daa1; +lld_adv_start_func = 0x0003dc09; +lld_adv_stop = 0x0003e50d; +lld_adv_sync_info_update = 0x0003e7c1; +lld_bi_frm_cbk = 0x0003f1a1; +lld_ch_assess_data_get = 0x0003ff81; +lld_calc_aux_rx = 0x000416a9; +lld_ch_map_set = 0x00041869; +lld_ch_map_upd_cfm_handler = 0x000418c9; +lld_ci_frm_cbk = 0x000421e5; +lld_con_activity_offset_compute = 0x0004474d; +lld_con_cleanup = 0x000448bd; +lld_con_clear_ccmcnt_rx = 0x000449f5; +lld_con_clear_ccmcnt_tx = 0x00044a11; +lld_con_data_flow_set = 0x00044aa5; +lld_con_enc_key_load = 0x00044e01; +lld_con_event_counter_get = 0x00044ec1; +lld_con_rx_qual_asses_get = 0x00044fb1; +lld_con_frm_cbk_func = 0x00045021; +lld_con_evt_time_update_func = 0x000455cd; +lld_con_max_lat_calc = 0x00045c29; +lld_con_offset_get = 0x00045d11; +lld_con_offset_upd_ind_handler = 0x00045da1; +lld_con_param_upd_cfm_handler = 0x00045e6d; +lld_con_param_update = 0x00045f2d; +lld_con_rssi_get = 0x00046141; +lld_con_rx_enc = 0x00046605; +lld_con_start_func = 0x00046add; +lld_con_tx_enc = 0x00047239; +lld_con_tx_len_update_for_intv = 0x0004739d; +lld_get_tx_power_level = 0x00047b0d; +lld_init_compute_winoffset = 0x00047b21; +lld_init_connect_req_pack = 0x00047b6d; +lld_init_end_ind_handler = 0x00047ca1; +lld_init_evt_canceled_cbk = 0x0004800d; +lld_init_evt_start_cbk = 0x00048105; +lld_init_func = 0x0004851d; +lld_instant_proc_end = 0x00049805; +lld_iso_hop_accel_isr = 0x00049915; +lld_llcp_rx_ind_handler = 0x00049a6d; +lld_llcp_tx_cfm_handler = 0x00049c95; +lld_per_adv_ch_map_update = 0x00049d59; +lld_phy_upd_cfm_handler = 0x0004b67d; +lld_ral_search = 0x0004b6bd; +lld_read_clock = 0x0004b71d; +lld_res_list_add = 0x0004b735; +lld_res_list_clear = 0x0004b8dd; +lld_res_list_is_empty = 0x0004b901; +lld_res_list_peer_update = 0x0004b9bd; +lld_res_list_priv_mode_update = 0x0004ba0d; +lld_rpa_renew = 0x0004ba99; +lld_rxdesc_check = 0x0004bcd1; +lld_rxdesc_free = 0x0004bd05; +lld_scan_end = 0x0004bddd; +lld_scan_evt_start_cbk = 0x0004c07d; +lld_scan_frm_eof_isr = 0x0004c205; +lld_scan_frm_rx_isr = 0x0004c339; +lld_scan_frm_skip_isr = 0x0004c3a5; +lld_scan_get_adv_data_len = 0x0004c4d5; +lld_scan_params_update = 0x0004c561; +lld_scan_sched_func = 0x0004d165; +lld_scan_start_func = 0x0004d561; +lld_scan_stop = 0x0004dab1; +lld_scan_sync_accept = 0x0004db35; +lld_scan_sync_info_unpack = 0x0004dc49; +lld_scan_trunc_ind = 0x0004dcd5; +lld_supervision_to_cb = 0x0004dd49; +lld_sync_cleanup = 0x0004dddd; +lld_sync_frm_eof_isr = 0x0004e00d; +lld_sync_frm_rx_isr = 0x0004e10d; +lld_sync_frm_skip_isr = 0x0004e175; +lld_sync_trunc_ind = 0x0004ef79; +lld_test_cleanup = 0x0004efa5; +lld_test_frm_cbk = 0x0004f1b1; +lld_test_frm_isr = 0x0004f1f5; +lld_test_rx_isr = 0x0004f2d9; +lld_test_start = 0x0004f319; +lld_white_list_add = 0x0004f795; +lld_white_list_rem = 0x0004f831; +lli_init = 0x000511b1; +llm_activity_free_get = 0x00051569; +llm_adv_con_len_check = 0x00051665; +llm_adv_hdl_to_id = 0x00051731; +llm_ch_map_to_handler = 0x0005199f; +llm_cmd_cmp_send = 0x00051ba9; +llm_cmd_stat_send = 0x00051bc5; +llm_dev_list_empty_entry = 0x00051be1; +llm_dev_list_search = 0x00051c05; +llm_init = 0x00051d41; +llm_is_dev_connected = 0x00051f25; +llm_is_wl_empty = 0x0005204d; +llm_le_evt_mask_check = 0x00052189; +llm_master_ch_map_get = 0x00052221; +llm_per_adv_slot_dur = 0x00052261; +llm_rx_path_comp_get = 0x00052391; +llm_scan_start = 0x000523e5; +llm_update_dbg_act_state_info = 0x00052575; +prevent_sleep_get = 0x00052a65; +prf_init = 0x00052da1; +qspi_config = 0x000531b5; +qspi_send_inst_addr = 0x00053475; +qspi_wait_flag_state_until_timeout = 0x00053545; +register_config_1M_tx_gain_value = 0x00053601; +register_config_2M_tx_gain_value = 0x0005360d; +register_config_coded_tx_gain_value = 0x00053619; +register_rwip_init = 0x00053659; +register_rwip_reset = 0x00053671; +register_rwip_us_2_lpcycles = 0x00053695; +register_rwip_wakeup = 0x000536a1; +register_rwip_wakeup_end = 0x000536ad; +rwble_hl_init = 0x00053799; +rwble_init = 0x000537c5; +rwble_recovery = 0x00053879; +rwip_active_check = 0x000538f9; +rwip_crypt_isr_handler = 0x000539dd; +rwip_driver_init = 0x000539fd; +rwip_eif_get = 0x00053a69; +rwip_init_heaps = 0x00053b2d; +rwip_isr = 0x00053b61; +rwip_prevent_sleep_clear = 0x00053dad; +rwip_prevent_sleep_set = 0x00053ddd; +rwip_set_nvds_api = 0x00053ecd; +rwip_sleep_init = 0x0005416d; +rwip_sw_int_handler = 0x00054309; +rwip_sw_int_req = 0x00054319; +rwip_time_get = 0x00054335; +rwip_timer_10ms_handler = 0x00054395; +rwip_timer_hs_handler = 0x00054435; +rwip_timer_hus_handler = 0x00054499; +rwip_timer_hus_set = 0x000544bd; +rwip_wakeup = 0x000545b9; +rwip_wakeup_end = 0x000546b1; +sch_alarm_clear = 0x00054771; +sch_alarm_init = 0x000547c9; +sch_alarm_set = 0x00054861; +sch_arb_allow_activity_notify = 0x00054995; +sch_arb_conflict_check = 0x000549b1; +sch_arb_elt_cancel = 0x00054aa5; +sch_arb_event_start_isr_func = 0x00054bc9; +sch_arb_idle_time_notify = 0x00054dd1; +sch_arb_init = 0x00054e19; +sch_arb_insert_func = 0x00054e41; +sch_arb_prog_timer = 0x0005516d; +sch_arb_remove = 0x00055269; +sch_arb_sched_act_margin = 0x00055321; +sch_plan_chk = 0x0005546d; +sch_plan_init = 0x000554ad; +sch_plan_req = 0x0005592d; +sch_plan_set = 0x00055961; +sch_prog_convert_cs_idx_to_handle = 0x00055ba9; +sch_prog_end_isr = 0x00055bb9; +sch_prog_init = 0x00055d75; +sch_prog_push_func = 0x00055ddd; +sch_prog_rx_iso_isr = 0x00056295; +sch_prog_rx_isr = 0x00056309; +sch_prog_skip_isr = 0x000563dd; +sch_prog_tx_iso_isr = 0x00056561; +sch_prog_tx_isr = 0x000565d5; +sch_slice_bg_add = 0x000566a9; +sch_slice_init = 0x00056839; +set_master_gclk = 0x00056931; +smpc_ShiftLeft1Bit16ByteNum = 0x0005694d; +smpc_XOR_16_Byte_Array = 0x00056971; +smpc_aes_cmac_complete = 0x00056989; +smpc_aes_cmac_init = 0x00056b9d; +smpc_calc_confirm_cont_func = 0x00056c39; +smpc_generate_stk = 0x000586a9; +smpc_pairing_csrk_exch = 0x000590bd; +smpc_pairing_enc_code_exch = 0x00059159; +smpc_pairing_end = 0x00059205; +smpc_pairing_irk_exch = 0x000592d5; +smpc_pairing_ltk_exch = 0x00059369; +smpc_pairing_nc_exch = 0x00059461; +smpc_pairing_oob_exch = 0x000594b9; +smpc_pairing_tk_exch = 0x0005997d; +smpc_pdu_send = 0x00059b61; +smpc_process_aes_cmac = 0x00059bf1; +smpc_secure_connections_enabled = 0x0005aaf9; +smpc_send_ltk_req_rsp = 0x0005abbd; +smpc_send_pairing_ind = 0x0005ac39; +smpc_send_pairing_req_ind = 0x0005ad41; +smpc_send_use_enc_block_cmd = 0x0005af65; +smpc_tkdp_rcp_start = 0x0005b5b5; +smpc_tkdp_send_start = 0x0005b78d; +svc_get_nvds_api_entry = 0x0005be59; +svc_rwip_init = 0x0005be71; +svc_set_heaps_table_entry = 0x0005bead; +sys_signal_handler_register = 0x0005bf05; +uart_dma_error = 0x0005c075; +uart_dma_receive_cplt = 0x0005c0bd; +xqspi_send_inst_addr = 0x0005c697; +xqspi_wait_flag_state_until_retry = 0x0005c801; +rom_init = 0x0005c889; +one_bits = 0x0005d0b4; +co_null_bdaddr = 0x0005d0d4; +rwip_priority = 0x0005db83; +hci_le_event_handler_tab = 0x0005dc70; +rom_gapc_msg_handler_tab = 0x0005dcf0; +gapm_hci_cmd_cmp_event_handler_tab = 0x0005de90; +gapm_hci_cmd_stat_event_handler_tab = 0x0005e010; +gapm_msg_handler_tab = 0x0005e080; +gattc_msg_handler_tab = 0x0005e424; +lld_scan_map_legacy_pdu_to_evt_type = 0x0005eba8; +pwr_mgmt_save_context = 0x00062d69; +pwr_mgmt_load_context = 0x00062d99; +pwr_mgmt_save_ctx_lvl_two = 0x00062dc9; +sdk_srand = 0x00063339; +BLESLEEP_IRQHandler_func = 0x000636c9; +BLESLP_IRQHandler = 0x000637d1; +BLE_IRQHandler = 0x000637dd; +BLE_IRQHandler_func = 0x000637e9; +BLE_SDK_Handler = 0x00063839; +SVC_handler_proc = 0x000638b5; +ble_activity_end_notify_cb_register = 0x00064dbd; +ble_activity_start_notify_cb_register = 0x00064dfd; +ble_aes_ccm = 0x00064e19; +ble_aes_cmac = 0x00064e49; +ble_aes_encrypt = 0x00064e55; +ble_aes_k1 = 0x00064e65; +ble_aes_k2 = 0x00064e79; +ble_aes_k3 = 0x00064e85; +ble_aes_k4 = 0x00064e89; +ble_aes_rand = 0x00064e8d; +ble_aes_result_handler = 0x00064e91; +ble_aes_s1 = 0x00064e95; +ble_attm_reserve_handle_range = 0x00064ea5; +ble_attm_svc_create_db = 0x00064ea9; +ble_attmdb_get_attribute = 0x00064f05; +ble_attmdb_svc_visibility_set = 0x00064f0d; +ble_attmdb_uuid16_comp = 0x00064f11; +ble_audio_callback_register = 0x00064f15; +ble_audio_event_count_read = 0x00064f25; +ble_audio_role_switch = 0x00065015; +ble_audio_sniffer_create = 0x00065131; +ble_audio_sync_info_send = 0x00065225; +ble_audio_time_sync = 0x000652b9; +ble_bm_clear_bond_devs = 0x00065501; +ble_bm_del_bond_dev = 0x000655f1; +ble_bm_get_bond_devs = 0x00065749; +ble_bm_get_gatt_info = 0x000657a5; +ble_bm_get_ral_dev_list = 0x00065825; +ble_bm_get_sec_info = 0x000658b9; +ble_bm_get_sec_info_by_peer_irk = 0x000658ed; +ble_bm_init = 0x0006596d; +ble_bm_set_all_upgrade_flags = 0x000659ed; +ble_bm_set_gatt_info = 0x00065a49; +ble_client_prf_add = 0x00065b29; +ble_co_list_extract = 0x00065c29; +ble_co_list_init = 0x00065c2d; +ble_co_list_insert_before = 0x00065c31; +ble_co_list_pop_front = 0x00065c35; +ble_co_list_push_back = 0x00065c39; +ble_co_list_push_back_sublist = 0x00065c3d; +ble_co_list_push_front = 0x00065c41; +ble_co_util_pack = 0x00065c45; +ble_co_util_unpack = 0x00065c51; +ble_core_is_powered_on = 0x00065c5d; +ble_core_sleep_func = 0x00065cd1; +ble_env_get = 0x00065f97; +ble_gap_active_link_set = 0x00065f9d; +ble_gap_addr_get = 0x00065fb1; +ble_gap_adv_data_set = 0x00066121; +ble_gap_adv_param_set = 0x00066231; +ble_gap_adv_stop = 0x00066695; +ble_gap_appearance_get = 0x00066729; +ble_gap_appearance_set = 0x00066779; +ble_gap_bond_devs_get = 0x0006689d; +ble_gap_callback_register = 0x000668f1; +ble_gap_chnl_map_set = 0x00066909; +ble_gap_con_plan_consult = 0x000669ad; +ble_gap_conn_info_get = 0x00066a05; +ble_gap_conn_param_update = 0x00066ac5; +ble_gap_conn_param_update_reply = 0x00066ba9; +ble_gap_connect_cancel = 0x00066d51; +ble_gap_data_length_set = 0x00066dad; +ble_gap_data_length_update = 0x00066e21; +ble_gap_default_tx_power_get = 0x00066ec1; +ble_gap_default_tx_power_set = 0x00066ec5; +ble_gap_dev_info_get = 0x00066ec9; +ble_gap_device_name_get = 0x00066f91; +ble_gap_device_name_set = 0x00067021; +ble_gap_disconnect = 0x000670c5; +ble_gap_ext_adv_param_set = 0x00067149; +ble_gap_ext_connect = 0x00067429; +ble_gap_ext_scan_param_set = 0x00067561; +ble_gap_irk_set = 0x00067621; +ble_gap_l2cap_params_set = 0x00067689; +ble_gap_latency_set = 0x00067709; +ble_gap_lepsm_unregister = 0x000678a1; +ble_gap_pair_enable = 0x00067941; +ble_gap_path_compensation_set = 0x00067999; +ble_gap_peer_info_get = 0x000679ed; +ble_gap_per_adv_list_add = 0x00067aa1; +ble_gap_per_adv_list_clear = 0x00067bc1; +ble_gap_per_adv_list_del = 0x00067c25; +ble_gap_per_adv_list_get = 0x00067d09; +ble_gap_per_sync_param_set = 0x00067d8d; +ble_gap_per_sync_start = 0x00067e85; +ble_gap_per_sync_stop = 0x00067f51; +ble_gap_phy_update = 0x00067ff5; +ble_gap_ppcp_get = 0x00068099; +ble_gap_ppcp_present_set = 0x000680f5; +ble_gap_pref_phy_set = 0x000681b5; +ble_gap_privacy_mode_set = 0x00068209; +ble_gap_role_set = 0x00068375; +ble_gap_rpa_list_get = 0x000683c1; +ble_gap_rslv_addr_read = 0x00068415; +ble_gap_scan_param_set = 0x000684b5; +ble_gap_scan_start = 0x0006859d; +ble_gap_scan_stop = 0x00068629; +ble_gap_set_ral_list = 0x000686ad; +ble_gap_static_random_addr_set = 0x00068789; +ble_gap_tx_power_get = 0x00068841; +ble_gap_tx_power_set = 0x00068919; +ble_gap_update_adv_data = 0x00068a01; +ble_gap_whitelist_add = 0x00068abd; +ble_gap_whitelist_clear = 0x00068bf1; +ble_gap_whitelist_del = 0x00068c55; +ble_gap_whitelist_get = 0x00068d3d; +ble_gapc_auth_get = 0x00068dc1; +ble_gapc_enc_keysize_get = 0x00068dd1; +ble_gapc_role_get = 0x00068dd5; +ble_gapc_svc_chg_ccc_set = 0x00068dd9; +ble_gapm_bdaddr_get = 0x00068ddd; +ble_gapm_irk_get = 0x00068de1; +ble_gatt_common_callback_register = 0x00068e2d; +ble_gatt_init = 0x00068e7d; +ble_gatt_mtu_get_rom = 0x00068ec5; +ble_gatt_mtu_set = 0x00068f25; +ble_gattc_callback_register = 0x00068f7d; +ble_gattc_char_desc_discover_rom = 0x00068f91; +ble_gattc_char_discover_rom = 0x00068f9b; +ble_gattc_get_mtu = 0x00068fa7; +ble_gattc_included_services_discover_rom = 0x00068fab; +ble_gattc_indicate_cfm_rom = 0x00068fb5; +ble_gattc_mtu_exchange_rom = 0x00069029; +ble_gattc_prf_char_desc_discover_rom = 0x0006909d; +ble_gattc_prf_char_discover_rom = 0x0006913d; +ble_gattc_prf_evt_handle_register_rom = 0x00069215; +ble_gattc_prf_evt_handle_unregister_rom = 0x0006921b; +ble_gattc_prf_included_services_discover_rom = 0x00069221; +ble_gattc_prf_indicate_cfm_rom = 0x000692c1; +ble_gattc_prf_primary_services_discover_rom = 0x00069349; +ble_gattc_prf_read_rom = 0x0006940d; +ble_gattc_prf_read_by_uuid_rom = 0x000694a9; +ble_gattc_prf_read_multiple_rom = 0x00069581; +ble_gattc_prf_services_browse_rom = 0x00069625; +ble_gattc_prf_write_rom = 0x000696e9; +ble_gattc_prf_write_execute_rom = 0x000697cd; +ble_gattc_prf_write_no_resp_rom = 0x00069859; +ble_gattc_prf_write_prepare_rom = 0x000698f9; +ble_gattc_primary_services_discover_rom = 0x000699b9; +ble_gattc_read_rom = 0x00069a6d; +ble_gattc_read_by_uuid_rom = 0x00069af5; +ble_gattc_read_multiple_rom = 0x00069bb1; +ble_gattc_services_browse_rom = 0x00069c49; +ble_gattc_write_rom = 0x00069d05; +ble_gattc_write_execute_rom = 0x00069ddd; +ble_gattc_write_no_resp_rom = 0x00069e55; +ble_gattc_write_prepare_rom = 0x00069edd; +ble_gattm_svc_start_hdl_get = 0x00069f8d; +ble_gatts_attr_permission_get = 0x00069f91; +ble_gatts_attr_permission_set = 0x0006a09d; +ble_gatts_noti_ind_rom = 0x0006a10d; +ble_gatts_prepare_write_cfm_rom = 0x0006a271; +ble_gatts_read_cfm_rom = 0x0006a399; +ble_gatts_srvc_db_create = 0x0006a555; +ble_gatts_srvc_permission_get = 0x0006a815; +ble_gatts_srvc_permission_set = 0x0006a825; +ble_gatts_value_get = 0x0006a861; +ble_gatts_value_set = 0x0006a90d; +ble_gatts_write_cfm_rom = 0x0006a971; +ble_h4tl_stop = 0x0006aa8d; +bl1_hci_uart_register = 0x0006aaa9; +ble_idle_time_notify_cb_register = 0x0006aab1; +ble_init_cmp_callback_register = 0x0006aad1; +ble_iso_accept_cis_req = 0x0006ab01; +ble_iso_create_big = 0x0006abdd; +ble_iso_create_big_sync = 0x0006acd5; +ble_iso_create_cis = 0x0006ade1; +ble_iso_disc_cis = 0x0006af01; +ble_iso_discover_ann = 0x0006af5d; +ble_iso_get_core_bts = 0x0006afe9; +ble_iso_read_tx_sync = 0x0006afed; +ble_iso_reg_rcv_data_cb = 0x0006aff1; +ble_iso_register_ascp_gap_callback = 0x0006b007; +ble_iso_register_callback = 0x0006b00d; +ble_iso_reject_cis_req = 0x0006b021; +ble_iso_req_peer_sca = 0x0006b089; +ble_iso_rm_cig = 0x0006b105; +ble_iso_rm_data_path = 0x0006b171; +ble_iso_send_data = 0x0006b1ed; +ble_iso_set_cig_param = 0x0006b231; +ble_iso_set_data_path = 0x0006b41d; +ble_iso_start_bd_ann = 0x0006b49d; +ble_iso_start_gen_ann = 0x0006b569; +ble_iso_start_target_ann = 0x0006b619; +ble_iso_stop_ann = 0x0006b6fd; +ble_iso_stop_discover_ann = 0x0006b709; +ble_iso_stop_sync_bd_ann = 0x0006b70d; +ble_iso_sync_bd_ann = 0x0006b711; +ble_iso_terminate_big = 0x0006b7e1; +ble_iso_terminate_big_sync = 0x0006b851; +ble_ke_event_callback_set = 0x0006b8d9; +ble_ke_event_clear = 0x0006b8dd; +ble_ke_event_set = 0x0006b8e1; +ble_ke_free = 0x0006b8e5; +ble_ke_malloc = 0x0006b8e9; +ble_ke_msg_alloc = 0x0006b935; +ble_ke_msg_forward = 0x0006b9b9; +ble_ke_msg_free = 0x0006b9bd; +ble_ke_msg_send = 0x0006b9c1; +ble_ke_state_set = 0x0006b9c5; +ble_ke_task_create = 0x0006b9c9; +ble_ke_time = 0x0006b9cd; +ble_l2cap_lecb_cb_register = 0x0006b9d1; +ble_l2cap_lecb_conn_cfm = 0x0006bb3d; +ble_l2cap_lecb_conn_create = 0x0006bc8d; +ble_l2cap_lecb_credits_add = 0x0006be85; +ble_l2cap_lecb_disconnect = 0x0006bf9d; +ble_mesh_prf_cbs_register = 0x0006c205; +ble_nvds_get = 0x0006c215; +ble_nvds_initialized = 0x0006c241; +ble_prf_env_get = 0x0006c27d; +ble_prf_get_id_from_task = 0x0006c341; +ble_prf_src_task_get = 0x0006c34d; +ble_prf_task_env_get = 0x0006c351; +ble_rf_calibration_func_cb_register = 0x0006c355; +ble_rf_match_circuit_get = 0x0006c371; +ble_rf_match_circuit_set = 0x0006c375; +ble_rf_tx_mode_get = 0x0006c379; +ble_rf_tx_mode_set = 0x0006c37d; +ble_rom_prf_init = 0x0006c3ad; +ble_rwip_reset = 0x0006c3b1; +ble_rwip_time_get = 0x0006c3b5; +ble_rwip_wakeup = 0x0006c3b9; +ble_rwip_wakeup_end = 0x0006c465; +ble_sch_alarm_clear = 0x0006c511; +ble_sch_alarm_prog = 0x0006c515; +ble_sch_alarm_set = 0x0006c519; +ble_schedule_start = 0x0006c51d; +ble_sdk_adap_config_get = 0x0006c529; +ble_sdk_common_timeout_handler = 0x0006c6ad; +ble_sdk_core_reinit = 0x0006c6e5; +ble_sdk_gattc_prf_cmp_evt_handler = 0x0006d129; +ble_sdk_gattc_prf_event_ind_handler = 0x0006da2d; +ble_sdk_gattc_prf_sdp_srvc_ind_handler = 0x0006da81; +ble_sdk_init_func = 0x0006dbe5; +ble_sdk_iso_init = 0x0006dfcd; +ble_sdk_l2cap_init = 0x0006e09d; +ble_sdk_prf_init = 0x0006e0b9; +ble_sdk_rf_init = 0x0006e101; +ble_sdk_rf_wakeup_init = 0x0006e121; +ble_sdk_schedule = 0x0006e1a1; +ble_sdk_sec_init = 0x0006e1a5; +ble_sec_callback_register = 0x0006e235; +ble_sec_enc_cfm = 0x0006e249; +ble_sec_keypress_notify_send = 0x0006e429; +ble_server_prf_add = 0x0006e569; +ble_stack_debug_setup = 0x0006e67d; +ble_task_force_schedule = 0x0006e80d; +ble_wait_for_bleslpstat_signal = 0x0006e831; +calc_checksum = 0x0006e8a9; +calculate_hmac = 0x0006e8c0; +config_1M_tx_gain_value = 0x0006ed25; +config_2M_tx_gain_value = 0x0006ed45; +config_coded_tx_gain_value = 0x0006ed65; +cp_hdr_incr = 0x0006ed9d; +dec_flash_read = 0x0006edbd; +dec_flash_write = 0x0006edf1; +dfu_ble_receive_data_process = 0x0006ef31; +dfu_ble_send_data_cmpl_process = 0x0006ef59; +dfu_ble_set_mtu_size = 0x0006ef95; +dfu_cmd_disable_config = 0x0006f011; +dfu_cmd_parse_state_reset = 0x0006f15d; +dfu_copy_flash_process = 0x0006f235; +dfu_flash_erase = 0x0006f42d; +dfu_flash_get_security = 0x0006f4b5; +dfu_flash_read = 0x0006f535; +dfu_flash_set_security = 0x0006f569; +dfu_flash_type_set = 0x0006f581; +dfu_flash_update = 0x0006f5a5; +dfu_flash_write = 0x0006f675; +dfu_init = 0x0006f6a9; +dfu_port_flash_init = 0x0006f71d; +dfu_program_end = 0x0006f919; +dfu_program_start = 0x0006f931; +dfu_programing = 0x0006f94d; +dfu_reset_device = 0x0006fa2d; +normal_dfu_schedule = 0x0006fa3d; +dfu_security_check_enable = 0x0006fa4d; +dfu_send_frame = 0x0006faed; +dfu_set_cmd_handler = 0x0006fb69; +dfu_spi_flash_func_config = 0x0006fbf1; +dfu_start_jump = 0x0006fc5d; +dfu_uart_receive_data_process = 0x0006fe75; +find_item = 0x000700bd; +find_peer_addr = 0x00070141; +find_unused_bond_idx = 0x000701c9; +fpb_init = 0x00070229; +fpb_load_state = 0x00070281; +fpb_register_patch_init_func = 0x000702e1; +fpb_save_state = 0x000702ed; +gap_activity_opera_end = 0x00070479; +gap_activity_opera_start = 0x000705a5; +gap_bm_error_to_sdk_error = 0x00071049; +gap_cache_data_get = 0x0007106d; +gap_cache_data_init = 0x00071079; +gap_cache_data_save = 0x00071095; +gap_check_modify_bondlist = 0x00071159; +gap_create_initiating = 0x000719c5; +gap_delete_initiating = 0x00071da1; +gap_get_actv_type_by_actv_idx = 0x0007265d; +gap_get_adv_idx_by_actv_idx = 0x0007269d; +gap_get_per_sync_idx_by_actv_idx = 0x00072761; +gap_reset = 0x00073079; +gap_reslv_addr = 0x00073105; +gap_set_device_config = 0x000736d5; +gap_start_initiating = 0x00073b45; +gap_stop_initiating = 0x00073de9; +gapm_cmp_evt_handler = 0x00074235; +gatt_add_bond_cccd = 0x0007475d; +gatt_bond_cccd_check = 0x0007488d; +gatt_clear_cccd = 0x000748e5; +gatt_on_connection = 0x00074ccf; +gatt_on_disconnection = 0x00074dd9; +gatt_recovery_cccd = 0x00074e95; +gattc_on_connection = 0x000754d9; +gattc_on_disconnection = 0x00075509; +get_F_value = 0x00075745; +get_align_bytes = 0x000757b9; +get_conn_idx_by_hdl = 0x00075825; +get_msg_handler_func = 0x00075aa5; +get_rf_api = 0x00075bc9; +get_system_config_info = 0x00075c51; +hal_efuse_deinit = 0x00075d4d; +hal_efuse_init = 0x00075d65; +hal_flash_get_info = 0x00075ded; +hal_flash_get_security = 0x00075e05; +hal_flash_sector_size = 0x00075e99; +hal_flash_set_security = 0x00075ea1; +l2cap_lecb_find_coc_by_local_cid = 0x00076dd1; +l2cap_lecb_is_created_by_local_cid = 0x00076e69; +mesh_init_callback_register = 0x00077569; +mesh_prf_config = 0x000775c1; +nvds_get_avail_size = 0x0007782d; +nvds_get_start_addr = 0x00077839; +operate_system_info = 0x00077d35; +prf_get_prf_cb_by_prf_id = 0x000781fd; +prf_get_prf_cb_by_task_id = 0x00078221; +pwr_mgmt_baseband_state_get = 0x00078739; +pwr_mgmt_check_ble_event = 0x00078791; +pwr_mgmt_check_ble_timer = 0x000787ad; +pwr_mgmt_check_pend_irq = 0x000788e1; +pwr_mgmt_dev_init = 0x00078905; +pwr_mgmt_dev_resume = 0x00078915; +pwr_mgmt_dev_suspend = 0x00078925; +pwr_mgmt_force_wakeup_ble_done = 0x00078971; +pwr_mgmt_get_counter_A_B = 0x00078985; +pwr_mgmt_get_sleep_mode = 0x000789b9; +pwr_mgmt_get_wakeup_flag = 0x00078af1; +pwr_mgmt_init = 0x00078b05; +pwr_mgmt_locker = 0x00078c41; +pwr_mgmt_mem_check_process_reg = 0x00078c4d; +pwr_mgmt_mode_get = 0x00078c59; +pwr_mgmt_mode_set = 0x00078c65; +pwr_mgmt_notify_timer_event = 0x00078c7d; +pwr_mgmt_rtc_timer_thrd_set = 0x00078c95; +pwr_mgmt_set_callback = 0x00078dc9; +pwr_mgmt_set_wakeup_flag = 0x00078dd5; +pwr_mgmt_shutdown = 0x00078ded; +pwr_mgmt_sleep_param_get = 0x00078e85; +pwr_mgmt_unlocker = 0x00078fed; +pwr_mgmt_update_wkup_param = 0x00078ff5; +pwr_mgmt_wakeup_source_clear = 0x000790dd; +pwr_mgmt_wakeup_source_setup = 0x000790f1; +pwr_mgmt_wfe_sleep = 0x00079105; +read_incr = 0x00079395; +restore_sys_context = 0x000794f5; +rf_SX_Enable = 0x00079559; +rf_SX_Tune = 0x000795a5; +rf_SX_reset = 0x00079601; +rf_agc_init = 0x0007963d; +rf_api_init = 0x00079659; +rf_communication_core_init = 0x000796f5; +rf_em_init = 0x000797f1; +rf_freq_table_init = 0x00079809; +rf_get_recalibration_flag = 0x00079939; +rf_init = 0x00079945; +rf_mat_cir_get = 0x00079979; +rf_misc_init = 0x00079991; +rf_modulation_accuracy_calibration = 0x00079a05; +rf_recalibrate = 0x00079b79; +rf_recalibration_handler_register = 0x00079ba1; +rf_set_recalibration_flag = 0x00079bed; +rf_trim_calibration = 0x00079c1d; +rf_tx_mode_get = 0x00079c59; +rf_wakeup_init = 0x00079df5; +rom_simu = 0x00079e1d; +rwip_lpcycles_2_hus = 0x00079ec5; +rwip_prevent_sleep_get = 0x00079efd; +rwip_us_2_lpcycles = 0x00079f11; +save_context_and_enter_sleep = 0x00079f35; +sdk_blecore_postsleep_task = 0x00079f57; +sdk_blecore_presleep_task = 0x00079f71; +sdk_register_assert_cb = 0x0007a02d; +sdk_timer_init = 0x0007a1f1; +sec_build_rand16 = 0x0007a251; +sec_clear_bond_info_env = 0x0007a2f9; +sec_enc_link = 0x0007a341; +sec_get_bond_dev_addr = 0x0007a37d; +sec_on_conn_complete = 0x0007a3b9; +sec_on_disconn = 0x0007a4e9; +sec_send_pair_req = 0x0007ae21; +sec_send_security_req = 0x0007ae51; +sec_update_bond_info = 0x0007ae81; +set_comm_wkup_time = 0x0007af95; +set_sdk_schedule_event = 0x0007afed; +svc_func_register = 0x0007b759; +svc_table_register = 0x0007b79d; +sys_assert_cb_register = 0x0007b879; +sys_ble_heartbeat_period_set = 0x0007b94d; +sys_ble_timer_10ms_handler = 0x0007b95d; +sys_ble_timer_hs_handler = 0x0007b961; +sys_ble_timer_hus_handler = 0x0007b965; +sys_context_save = 0x0007b985; +sys_context_save_register = 0x0007bb65; +sys_delay_ms = 0x0007bbf5; +sys_delay_us = 0x0007bbff; +sys_first_regs_save = 0x0007bd5d; +sys_free = 0x0007bd79; +sys_get_heap_info = 0x0007bd9b; +sys_ke_sleep_check = 0x0007bdab; +sys_ke_timer_clear = 0x0007bdb7; +sys_ke_timer_set = 0x0007bdbb; +sys_link_quality_clear = 0x0007bdc1; +sys_link_quality_get = 0x0007bde1; +sys_lpclk_get = 0x0007be15; +sys_lpclk_set = 0x0007be21; +sys_lpclk_update_func_register = 0x0007be3d; +sys_lpcycles_2_hus = 0x0007be49; +sys_lpper_get = 0x0007be51; +sys_malloc = 0x0007be5d; +sys_max_msg_usage_ratio_set = 0x0007be69; +sys_prevent_sleep_clear = 0x0007bf1d; +sys_prevent_sleep_set = 0x0007bf21; +sys_security_data_use_present = 0x0007bf5d; +sys_security_enable_status_check = 0x0007bf6d; +sys_sleep_enter = 0x0007bf79; +sys_sleep_env_get = 0x0007bf7d; +sys_sleep_wakeup_end = 0x0007bf81; +sys_swd_disable = 0x0007bf85; +sys_swd_enable = 0x0007bf95; +sys_timer_clear = 0x0007bfa5; +sys_timer_set = 0x0007bfd5; +sys_us_2_lpcycles = 0x0007c059; +tags_cache_clean = 0x0007c0b5; +tags_cache_rec_del = 0x0007c109; +ultra_wfe = 0x0007c2c9; +ultra_wfi = 0x0007c345; +update_lru_bond_list = 0x0007c469; +verify_hdr_checksum = 0x0007c631; +write_compacted_items = 0x0007c671; +write_item = 0x0007c845; +default_device_name = 0x0007d388; +rom_prf_unint = 0x0007d529; +sdk_prf_unint = 0x0007d52a; +prf_client_default_msg_handler_tab = 0x0007d55c; +NVDS_MAGIC = 0x0007d5ac; +HT_LUT_RX_1M_LSB = 0x0007d7f4; +HT_LUT_RX_1M_MSB = 0x0007d894; +HT_LUT_RX_2M_LSB = 0x0007d934; +HT_LUT_RX_2M_MSB = 0x0007d9d4; +RF_25OHM_ULP_TX_PW_CONV_TBL = 0x0007dae8; +RF_100OHM_LP_TX_PW_CONV_TBL = 0x0007db28; +RF_100OHM_ULP_TX_PW_CONV_TBL = 0x0007db7c; +bl0_boot_info = 0x00800000; +hci_cmd_handler_tab_info = 0x00800270; +llc_hci_cmd_handler_tab_info = 0x00800290; +llm_hci_cmd_handler_tab_info = 0x00800298; +TASK_DESC_GAPC = 0x008002c0; +TASK_DESC_GAPM = 0x008002cc; +TASK_DESC_GATTC = 0x008002d8; +TASK_DESC_L2CC = 0x008002f0; +TASK_DESC_LLC = 0x008002fc; +llcp_pdu_handler = 0x00800320; +diag_shutdown_func = 0x0080035c; +p_adc_callback = 0x00800364; +p_aes_callback = 0x00800368; +p_efuse_callback = 0x00800384; +p_rng_callback = 0x008003ac; +rwip_prog_delay = 0x008003d2; +rwip_rst_state = 0x008003d3; +gapc_auth_get = 0x008003e0; +gapm_send_complete_evt = 0x008003ec; +gapm_adv_check_param = 0x008003f4; +default_prf_exist = 0x008003f8; +gapm_op_setup_continue = 0x008003fc; +gapm_init_connection_ind = 0x008004c8; +gapm_scan_filter_packet = 0x008004cc; +gapm_scan_send_adv_report_ind = 0x008004d0; +gapm_hci_le_event_handler_tab_info = 0x008004d8; +gapm_hci_cmd_stat_event_handler_tab_info = 0x008004e0; +gapm_hci_cmd_cmp_event_handler_tab_info = 0x008004e8; +rom_callback = 0x00800500; +smpc_tkdp_send_continue = 0x00800504; +smpc_tkdp_rcp_continue = 0x00800508; +smpc_handle_enc_change_evt = 0x00800514; +smpc_pairing_rsp = 0x00800518; +smpc_calc_confirm_cont = 0x0080051c; +atts_pdu_handler_info = 0x0080057c; +l2cc_data_send = 0x00800598; +llc_loc_con_upd_proc_continue = 0x008005d0; +llc_rem_con_upd_proc_continue = 0x008005d4; +llc_pref_param_compute = 0x008005d8; +llc_rem_encrypt_proc_continue = 0x008005e0; +g_bqb_test_en = 0x008005e4; +llc_llcp_send = 0x008005e8; +llc_rem_phy_upd_proc_continue = 0x008005ec; +llc_loc_phy_upd_proc_continue = 0x008005f0; +lld_exp_sync_pos_tab = 0x00800604; +lld_init = 0x0080060c; +g_slave_chsel_2_supported = 0x00800610; +lld_adv_frm_cbk = 0x00800614; +lld_adv_start = 0x00800618; +g_lld_con_heap_used_ratio_limit = 0x0080061e; +lld_con_frm_cbk = 0x00800624; +lld_con_tx_prog = 0x00800628; +lld_con_evt_time_update = 0x0080062c; +lld_con_sched = 0x00800630; +lld_con_start = 0x00800634; +g_master_chsel_2_supported = 0x00800638; +lld_init_frm_cbk = 0x0080063c; +lld_init_env = 0x00800644; +lld_init_start = 0x00800648; +lld_per_adv_start = 0x00800650; +g_scan_watch_period_hs = 0x00800654; +lld_scan_frm_cbk = 0x00800658; +lld_scan_sched = 0x0080065c; +lld_scan_env = 0x00800660; +__lld_sync_env = 0x00800664; +lld_scan_start = 0x00800668; +lld_sync_sched = 0x0080066c; +lld_sync_frm_cbk = 0x00800670; +lld_test_env = 0x0080067c; +g_max_con_intv = 0x00800680; +g_max_con_sup_to = 0x00800682; +scan_host_params = 0x00800692; +hci_ext_host = 0x008006a3; +g_sch_arb_pick_limit = 0x008006ac; +g_sch_arb_insert_run_hus = 0x008006ae; +g_sch_arb_prog_delay_hus = 0x008006b0; +g_rsvd_before_abort_hus = 0x008006b2; +g_evt_start_cbk_run_hus = 0x008006b4; +g_max_evt_start_cbk_run_hus = 0x008006b6; +g_min_evt_start_cbk_run_hus = 0x008006b8; +g_max_evt_start_rsvd_hus = 0x008006ba; +g_min_evt_start_rsvd_hus = 0x008006bc; +diag_evt_start_cbk_start_func = 0x008006c0; +diag_evt_start_cbk_done_func = 0x008006c4; +ble_activity_start_notify_func = 0x008006cc; +sch_arb_insert = 0x008006d4; +sch_arb_event_start_isr = 0x008006d8; +g_bb_watch_period_times = 0x008006e4; +g_et_correct_cnt = 0x008006e6; +g_bb_crush_wa_cnt = 0x008006e8; +g_prefetch_wa_cnt = 0x008006ea; +g_debug_push_cnt = 0x008006ec; +g_bb_watch_period_hs = 0x008006f0; +ble_activity_end_notify_func = 0x008006f8; +ble_rf_calibration_func = 0x008006fc; +bb_watch_timer_cbk = 0x00800700; +bb_watch_timer_start = 0x00800704; +sch_prog_push = 0x00800708; +sch_prog_activity_isr = 0x0080070c; +sch_slice_params = 0x00800710; +restore_sys_env_callback = 0x0080076c; +sw_to_hw = 0x00800808; +g_dbg_le_param_info = 0x00800840; +h4tl_env = 0x0080095c; +ke_env = 0x00800990; +rwip_rf = 0x00800bbc; +g_dbg_rwip_info = 0x00800c40; +gapc_env = 0x00800dcc; +gapm_env = 0x00800e00; +gattc_env = 0x00800ec4; +gattm_env = 0x00800ef8; +l2cc_env = 0x00800f18; +l2cm_env = 0x00800f4c; +ble_util_buf_env = 0x00800f58; +llc_env = 0x00801238; +lld_env = 0x00801274; +lld_adv_env = 0x00801384; +lld_con_env = 0x008013b4; +lld_sync_rx_info = 0x00801414; +lld_sync_env = 0x00801474; +llm_env = 0x008014a4; +hci_env = 0x00801950; +sch_arb_env = 0x008019b4; +g_bb_watch_alarm = 0x00801ab4; +sch_prog_env = 0x00801ac0; +sch_alarm_env = 0x00801c34; +bl1_boot_info = 0x00801f10; +g_xqspi_handle = 0x00801f28; +g_exflash_handle = 0x00801f64; +func_env = 0x00801f84; +g_gap_cb_fun = 0x00802198; +gapc_msg_handler_desc = 0x00802200; +set_privacy_mode_flag = 0x00802208; +add_whitelist_bong_flag = 0x00802209; +gap_device_config_params_init = 0x0080220c; +gap_adv_fsm_next = 0x00802210; +gap_scan_fsm_next = 0x00802214; +gap_init_fsm_next = 0x00802218; +gap_per_sync_fsm_next = 0x0080221c; +actv_state_str = 0x00802228; +gap_actv_type_str = 0x00802268; +gapm_msg_handler_desc = 0x00802298; +l2cap_lecb_msg_handler_desc = 0x008022a8; +ble_sdk_gattc_cb_env = 0x008022b4; +ble_sdk_gatt_co_cb_env = 0x008022b8; +gatt_msg_handler_desc = 0x008022bc; +gatt_on_disconnection_fp = 0x008022d8; +gatt_items = 0x008022dc; +srvc_list = 0x008022e0; +gatt_on_connection_fp = 0x008022e4; +prf_default_msg_handler_tab = 0x00802308; +g_bond_num = 0x00802338; +bonds = 0x0080233c; +default_sdk_adapt_present = 0x00802344; +ble_sdk_init = 0x00802348; +TASK_DESC_SDK = 0x00802354; +diag_ble_isr_start_func = 0x00802364; +diag_ble_isr_done_func = 0x00802368; +rf_init_callback = 0x00802378; +rf_wakeup_init_callback = 0x0080237c; +ble_irq_handler = 0x00802380; +efuse_config = 0x00802384; +ble_sdk_handler = 0x0080239c; +m_nvds_initialized = 0x008023c8; +m_encryption_enabled = 0x008023c9; +m_nvds_start_addr = 0x008023cc; +m_nvds_end_addr = 0x008023d0; +g_connection_num = 0x008023e4; +g_bond_list = 0x008023e8; +g_sec_cb_fun = 0x008023ec; +g_sec_param = 0x008023f0; +g_rf_tx_power_level_max = 0x008023f8; +g_rf_tx_power_dbm_default = 0x008023fa; +g_b_rf_bqb_test_enable = 0x008023fb; +tx_power_offset = 0x00802400; +VCO_BIAS = 0x00802404; +g_b_merge_slp_wakeup = 0x00802444; +g_sleep_complement_us = 0x00802446; +g_merge_threshold_us = 0x00802448; +update_lpclk = 0x0080244c; +g_lpclkper = 0x00802454; +diag_ble_core_sleep_status_func = 0x00802458; +diag_ble_core_sleep_break_func = 0x0080245c; +diag_no25_isr_start_func = 0x00802460; +diag_no25_isr_done_func = 0x00802464; +ble_sleep_irq_handler = 0x00802468; +g_sleep_param_cfg = 0x0080246c; +g_lpcalibcyclecount = 0x0080247c; +ble_core_sleep = 0x00802480; +xip_copy_flag = 0x00802485; +file_size = 0x00802488; +page_start_addr = 0x0080248c; +all_check_sum = 0x00802490; +cmd_receive_flag = 0x00802548; +all_program_size = 0x00802564; +FLASH_OP_START_ADDR = 0x0080256c; +s_is_need_to_care_about_app_timer = 0x00802674; +s_sys_clk = 0x00802675; +s_pwr_mgmt_table = 0x0080267c; +local_mem_pwr_mgmt_check_proc = 0x00802680; +pwr_mgmt_status_chk_func = 0x00802684; +pwr_mgmt_sched_ret_func = 0x00802688; +pwr_mgmt_before_enter_sleep_fun = 0x0080268c; +pwr_mgmt_device_state_check = 0x00802690; +p_func_shutdown = 0x008026a0; +ultra_wfe_is_allowed = 0x008026a4; +ultra_wfi_or_wfe = 0x008026a8; +g_msp_context_bl = 0x008026ac; +pwr_mgmt_var_box = 0x008026b0; +g_sleep_env = 0x008026bc; +g_conn_cmp_info = 0x00802718; +sdk_gapc_env = 0x0080272a; +sdk_gap_env = 0x0080277c; +gatt_env = 0x00802ed4; +efuse_trim = 0x00803212; +m_nvds_mgr = 0x008032d8; +HP_Gain_1M = 0x00803414; +HP_Gain_2M = 0x0080343c; +g_ble_slp_reg = 0x00803528; +now_img_info = 0x00803588; +patch_func_table = 0x00803d64; diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/startup_gr55xx.s b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/startup_gr55xx.s new file mode 100644 index 0000000..b32864d --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/linker/gcc/startup_gr55xx.s @@ -0,0 +1,193 @@ +/**************************************************************************//** + * @file startup_ARMCM4.s + * @brief CMSIS Core Device Startup File for + * ARMCM4 Device Series + * @version V5.00 + * @date 02. March 2016 + ******************************************************************************/ +/* + * Copyright (c) 2009-2016 ARM Limited. All rights reserved. + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the License); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + .syntax unified + .arch armv7-m + + .section .stack + .align 3 +//#ifdef __STACK_SIZE +// .equ Stack_Size, __STACK_SIZE +//#else + .equ Stack_Size, 0x00004000 +//#endif + .globl __StackTop + .globl __StackLimit +__StackLimit: + .space Stack_Size + .size __StackLimit, . - __StackLimit +__StackTop: + .size __StackTop, . - __StackTop + + .section .heap + .align 3 +#ifdef __HEAP_SIZE + .equ Heap_Size, __HEAP_SIZE +#else + .equ Heap_Size, 0x00000100 +#endif + .globl __HeapBase + .globl __HeapLimit +__HeapBase: + .if Heap_Size + .space Heap_Size + .endif + .size __HeapBase, . - __HeapBase +__HeapLimit: + .size __HeapLimit, . - __HeapLimit + + .section .vectors + .align 2 + .globl __Vectors +__Vectors: + .long __StackTop /* Top of Stack */ + .long Reset_Handler /* Reset Handler */ + .long NMI_Handler /* NMI Handler */ + .long HardFault_Handler /* Hard Fault Handler */ + .long MemManage_Handler /* MPU Fault Handler */ + .long BusFault_Handler /* Bus Fault Handler */ + .long UsageFault_Handler /* Usage Fault Handler */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long 0 /* Reserved */ + .long SVC_Handler /* SVCall Handler */ + .long DebugMon_Handler /* Debug Monitor Handler */ + .long 0 /* Reserved */ + .long PendSV_Handler /* PendSV Handler */ + .long SysTick_Handler /* SysTick Handler */ + + /* External interrupts */ + .long WDT_IRQHandler /* 0: Watchdog Timer */ + .long BLE_SDK_Handler /* 1: Reserved */ + .long BLE_IRQHandler /* 2: BLE */ + .long DMA_IRQHandler /* 3: DMA */ + .long SPI_M_IRQHandler /* 4: SPI_M */ + .long SPI_S_IRQHandler /* 5: SPI_S */ + .long EXT0_IRQHandler /* 6: GPIO0 */ + .long EXT1_IRQHandler /* 7: GPIO1 */ + .long TIMER0_IRQHandler /* 8: TIMER0 */ + .long TIMER1_IRQHandler /* 9: TIMER1 */ + .long DUAL_TIMER_IRQHandler /* 10: DUAL_TIMER0/DUAL_TIMER1 */ + .long QSPI0_IRQHandler /* 11: QSPI0 */ + .long UART0_IRQHandler /* 12: UART0 */ + .long UART1_IRQHandler /* 13: UART1 */ + .long I2C0_IRQHandler /* 14: I2C0 */ + .long I2C1_IRQHandler /* 15: I2C1 */ + .long AES_IRQHandler /* 16: AES */ + .long HMAC_IRQHandler /* 17: HMAC */ + .long EXT2_IRQHandler /* 18: GPIO2 */ + .long RNG_IRQHandler /* 19: TRNG Interrupt */ + .long PMU_IRQHandler /* 20: PMU */ + .long PKC_IRQHandler /* 21: PKC */ + .long XQSPI_IRQHandler /* 22: XQSPI */ + .long QSPI1_IRQHandler /* 23: QSPI1 */ + .long PWR_CMD_IRQHandler /* 24: PWR_CMD */ + .long BLESLP_IRQHandler /* 25: BLE Sleep */ + .long SLPTIMER_IRQHandler /* 26: Sleep Timer */ + .long COMP_IRQHandler /* 27: COMP Wakeup */ + .long AON_WDT_IRQHandler /* 28: AON_WDT */ + .long I2S_M_IRQHandler /* 29: I2S_M */ + .long I2S_S_IRQHandler /* 30: I2S_S */ + .long ISO7816_IRQHandler /* 31: ISO7816 */ + .long PRESENT_IRQHandler /* 32: PRESENT */ + .long CALENDAR_IRQHandler /* 33: CALENDAR */ + + .size __Vectors, . - __Vectors + + .text + .thumb + .thumb_func + .align 2 + .globl Reset_Handler + .type Reset_Handler, %function +Reset_Handler: + + bl SystemInit + + bl main_init + + .pool + .size Reset_Handler, . - Reset_Handler + + .align 1 + .thumb_func + .weak Default_Handler + .type Default_Handler, %function +Default_Handler: + b . + .size Default_Handler, . - Default_Handler + +/* Macro to define default handlers. Default handler + * will be weak symbol and just dead loops. They can be + * overwritten by other handlers */ + .macro def_irq_handler handler_name + .weak \handler_name + .set \handler_name, Default_Handler + .endm + + def_irq_handler NMI_Handler + def_irq_handler HardFault_Handler + def_irq_handler MemManage_Handler + def_irq_handler BusFault_Handler + def_irq_handler UsageFault_Handler + def_irq_handler SVC_Handler + def_irq_handler DebugMon_Handler + def_irq_handler PendSV_Handler + def_irq_handler SysTick_Handler + + def_irq_handler WDT_IRQHandler + def_irq_handler DMA_IRQHandler + def_irq_handler SPI_M_IRQHandler + def_irq_handler SPI_S_IRQHandler + def_irq_handler EXT0_IRQHandler + def_irq_handler EXT1_IRQHandler + def_irq_handler TIMER0_IRQHandler + def_irq_handler TIMER1_IRQHandler + def_irq_handler DUAL_TIMER_IRQHandler + def_irq_handler QSPI0_IRQHandler + def_irq_handler UART0_IRQHandler + def_irq_handler UART1_IRQHandler + def_irq_handler I2C0_IRQHandler + def_irq_handler I2C1_IRQHandler + def_irq_handler AES_IRQHandler + def_irq_handler HMAC_IRQHandler + def_irq_handler EXT2_IRQHandler + def_irq_handler RNG_IRQHandler + def_irq_handler PMU_IRQHandler + def_irq_handler PKC_IRQHandler + def_irq_handler XQSPI_IRQHandler + def_irq_handler QSPI1_IRQHandler + def_irq_handler PWR_CMD_IRQHandler + def_irq_handler SLPTIMER_IRQHandler + def_irq_handler COMP_IRQHandler + def_irq_handler AON_WDT_IRQHandler + def_irq_handler I2S_M_IRQHandler + def_irq_handler I2S_S_IRQHandler + def_irq_handler ISO7816_IRQHandler + def_irq_handler PRESENT_IRQHandler + def_irq_handler CALENDAR_IRQHandler + + .end diff --git a/gr551x/sdk_liteos/gr551x_sdk/platform/soc/src/gr_soc.c b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/src/gr_soc.c new file mode 100644 index 0000000..81cf3db --- /dev/null +++ b/gr551x/sdk_liteos/gr551x_sdk/platform/soc/src/gr_soc.c @@ -0,0 +1,497 @@ +#include "gr_soc.h" +#ifndef DRIVER_TEST +#include "gr_includes.h" +#endif +#include "hal_flash.h" +#include "platform_sdk.h" + +#include "grx_hal.h" +#include "hal_flash.h" +#include "pmu_calibration.h" +#include "platform_sdk.h" +#include "patch.h" +#include "patch_tab.h" + +// NOTE: SVC #0 is reserved for freertos, DO NOT USE IT! +#define SVC_TABLE_NUM_MAX 4 + +#define FLASH_CS (LL_GPIO_PIN_2) /* XQSPI flash CS */ +#define FLASH_CLK (LL_GPIO_PIN_4) /* XQSPI flash CLK */ +#define FLASH_IO_0 (LL_GPIO_PIN_7) /* XQSPI flash IO0 */ +#define FLASH_IO_1 (LL_GPIO_PIN_6) /* XQSPI flash IO1 */ +#define FLASH_IO_2 (LL_GPIO_PIN_5) /* XQSPI flash IO2 (WP) */ +#define FLASH_IO_3 (LL_GPIO_PIN_3) /* XQSPI flash IO3 (HOLD)*/ +#define HAL_EXFLASH_IO_PULL_SET(_PIN_, _PULL_) ll_gpio_set_pin_pull(GPIO1, _PIN_, _PULL_) + +#define REG_PL_WR(addr, value) (*(volatile uint32_t *)(addr)) = (value) +#define REG_PL_RD(addr) (*(volatile uint32_t *)(addr)) + +#define SDK_VER_MAJOR 2 +#define SDK_VER_MINOR 0 +#define SDK_VER_BUILD 2 +#define COMMIT_ID 0x502d20d5 + +static const sdk_version_t sdk_version = {SDK_VER_MAJOR, + SDK_VER_MINOR, + SDK_VER_BUILD, + COMMIT_ID,};//sdk version + +void sys_sdk_verison_get(sdk_version_t *p_version) +{ + memcpy(p_version, &sdk_version, sizeof(sdk_version_t)); +} + +volatile uint32_t g_app_msp_addr; /* record app msp address */ +static uint32_t SVC_TABLE_USER_SPACE[SVC_TABLE_NUM_MAX] __attribute__((section("SVC_TABLE"))); +uint8_t g_device_reset_reason = SYS_RESET_REASON_NONE; + +#if (CFG_LCP_SUPPORT && (CHIP_TYPE <= 5)) +extern uint16_t gdx_lcp_buf_init(uint32_t buf_addr); +static uint8_t lcp_buf[280] __attribute__((section (".ARM.__at_0x00820000"), zero_init)); +#endif + +#if defined ( __CC_ARM ) + +SECTION_RAM_CODE __asm void SVC_Handler(void) +{ + PRESERVE8 + IMPORT SVC_handler_proc + + TST LR,#4 ; Called from Handler Mode? + MRSNE R12,PSP ; Yes, use PSP + MOVEQ R12,SP ; No, use MSP + PUSH {R0-R3,LR} + MOV R0, R12 + BL SVC_handler_proc + MOV R12, R0 + POP {R0-R3,LR} + CMP R12,#0 //make sure current point isn't null + BLXNE R12 + BX LR ; RETI +SVC_Dead + B SVC_Dead ; None Existing SVC + ALIGN +} + +#elif defined ( __GNUC__ ) + +SECTION_RAM_CODE void __attribute__((naked))SVC_Handler(void) +{ + __asm("TST R14,$4\n"); + __asm("IT NE\n"); + __asm("MRSNE R12,PSP\n"); + __asm("IT EQ\n"); + __asm("MOVEQ R12,SP\n"); + __asm("PUSH {R0-R3,LR}\n"); + __asm("MOV R0, R12\n"); + __asm("BL SVC_handler_proc\n"); + __asm("MOV R12, R0\n"); + __asm("POP {R0-R3,LR}\n"); + __asm("CMP R12,$0\n"); + __asm("IT NE\n"); + __asm("BLXNE R12\n"); + __asm("BX LR\n"); +} + +#elif defined (__ICCARM__) + +extern uint32_t *SVC_Table; +extern uint32_t get_patch_rep_addr(uint32_t ori_func); +SECTION_RAM_CODE uint32_t SVC_handler_proc(uint32_t *svc_args) +{ + uint16_t svc_cmd; + uint32_t svc_func_addr; + uint32_t func_addr=0; + svc_func_addr =svc_args[6]; + svc_cmd = *((uint16_t*)svc_func_addr-1); + if((svc_cmd<=0xDFFF)&&(svc_cmd>=0xDF00)) + { + func_addr =(uint32_t)SVC_Table[svc_cmd&(0xFF)]; + return func_addr ; + } + else + { + func_addr=get_patch_rep_addr(svc_func_addr); + svc_args[6]=func_addr; + return 0; + } +} + +SECTION_RAM_CODE void __attribute__((naked))SVC_Handler (void) +{ + asm volatile ( + "TST R14,#4\n\t" + "IT NE\n\t" + "MRSNE R12,PSP\n\t" + "IT EQ\n" + "MOVEQ R12,SP \n\t" + "PUSH {R0-R3,LR} \n\t" + "MOV R0, R12 \n\t" + "BL SVC_handler_proc \n\t" + "MOV R12, R0 \n\t" + "POP {R0-R3,LR} \n\t" + "CMP R12,#0\n\t" + "IT NE\n\t" + "BLXNE R12\n\t" + "BX LR\n\t"); +} + +#endif + +__ALIGNED(0x100) FuncVector_t FuncVector_table[MAX_NUMS_IRQn + NVIC_USER_IRQ_OFFSET] = { + 0, + Reset_Handler, + NMI_Handler, + HardFault_Handler, + MemManage_Handler, + BusFault_Handler, + UsageFault_Handler, + 0, + 0, + 0, + 0, + SVC_Handler, + DebugMon_Handler, + 0, + PendSV_Handler, + SysTick_Handler, +}; + +void soc_register_nvic(IRQn_Type indx, uint32_t func) +{ + FuncVector_table[indx + 16] = (FuncVector_t)func; +} + +#if (PLAT_SUPPORT_SLEEP == 1) + +__WEAK void nvds_init_error_handler(uint8_t err_code) +{ + /* nvds_deinit will erase the flash area and old data will be lost */ +#ifdef NVDS_START_ADDR + uint32_t start_addr = NVDS_START_ADDR; +#else + uint32_t start_addr = 0U; +#endif + nvds_deinit(start_addr, NVDS_NUM_SECTOR); + nvds_init(start_addr, NVDS_NUM_SECTOR); +} + +static void nvds_setup(void) +{ + +#ifdef NVDS_START_ADDR + uint8_t err_code = nvds_init(NVDS_START_ADDR, NVDS_NUM_SECTOR); +#else + uint8_t err_code = nvds_init(0, NVDS_NUM_SECTOR); +#endif + + switch(err_code) + { + case NVDS_SUCCESS: + break; + default: + /* Nvds initialization other errors. + * For more information, please see NVDS_INIT_ERR_CODE. */ + nvds_init_error_handler(err_code); + break; + } +} +#endif + + +void ble_sdk_env_init(void) +{ +#if (PLAT_SUPPORT_BLE == 1) +#if (CFG_MAX_CONNECTIONS || CFG_MAX_SCAN || CFG_MAX_ADVS) + #if (CFG_MAX_CONNECTIONS < 3) && (CFG_MAX_ADVS < 2) && (CFG_MESH_SUPPORT < 1) + register_rwip_reset(rwip_reset_patch); + register_rwip_init(rwip_init_patch); + #endif + + // register the msg handler for patch + uint16_t msg_cnt = sizeof(msg_tab) / sizeof(msg_tab_item_t); + reg_msg_patch_tab(msg_tab, msg_cnt); + + // register the hci cmd handler for patch + uint16_t hci_cmd_cnt = sizeof(hci_cmd_tab) / sizeof(hci_cmd_tab_item_t); + reg_hci_cmd_patch_tab(hci_cmd_tab, hci_cmd_cnt); + + // register the gapm hci evt handler for patch + uint16_t hci_evt_cnt = sizeof(gapm_hci_evt_tab) / sizeof(gapm_hci_evt_tab_item_t); + reg_gapm_hci_evt_patch_tab(gapm_hci_evt_tab, hci_evt_cnt); + + #if CFG_MAX_CONNECTIONS + ble_con_env_init(); + ble_adv_param_init(CFG_MAX_CONNECTIONS); + #endif + + #if CFG_MAX_SCAN + ble_scan_env_init(); + #endif + + #if CFG_MAX_ADVS + ble_adv_env_init(); + #endif + + #if CFG_MUL_LINK_WITH_SAME_DEV + ble_sup_mul_link_with_same_dev(); + #endif + + #if CFG_BT_BREDR + ble_enable_bt_bredr(); + #endif +#endif +#endif +} + +static void exflash_io_pull_config(void) +{ + /* XQSPI IO configuration needs to match Flash. + The default configuration can match most Flash */ + HAL_EXFLASH_IO_PULL_SET(FLASH_CS, LL_GPIO_PULL_UP); + HAL_EXFLASH_IO_PULL_SET(FLASH_CLK, LL_GPIO_PULL_NO); + HAL_EXFLASH_IO_PULL_SET(FLASH_IO_0, LL_GPIO_PULL_UP); /* MOSI */ + HAL_EXFLASH_IO_PULL_SET(FLASH_IO_1, LL_GPIO_PULL_UP); /* MISO */ + HAL_EXFLASH_IO_PULL_SET(FLASH_IO_2, LL_GPIO_PULL_UP); /* WP */ + HAL_EXFLASH_IO_PULL_SET(FLASH_IO_3, LL_GPIO_PULL_UP); /* HOLD */ +} + +hal_status_t hal_exflash_read(exflash_handle_t *p_exflash, uint32_t addr, uint8_t *p_data, uint32_t size) +{ +#if (ENCRYPT_ENABLE || (CHIP_TYPE == 1) || (EXT_EXFLASH_ENABLE == 1)) + return hal_exflash_read_patch(p_exflash, addr, p_data, size); +#else + return hal_exflash_read_rom(p_exflash, addr, p_data, size); +#endif +} + +uint8_t sys_device_reset_reason(void) +{ + return g_device_reset_reason; +} + +void platform_init(void) +{ + /* if BLE not fully power off, reset and power off it manually */ + if((AON->PWR_RET01 & AON_PWR_REG01_PWR_EN_PD_COMM_TIMER) || \ + (AON->PWR_RET01 & AON_PWR_REG01_PWR_EN_PD_COMM_CORE)) + { + ll_pwr_enable_comm_core_reset(); + ll_pwr_enable_comm_timer_reset(); + ll_pwr_disable_comm_core_power(); + ll_pwr_disable_comm_timer_power(); + /* TODO: Reserve System Cold Fully Reset Method. */ + // hal_nvic_system_reset(); + } + + /* record AON_WDT reset reason */ + if(ll_aon_wdt_is_active_flag_reboot()) + { + g_device_reset_reason |= SYS_RESET_REASON_AONWDT; + } + /* Clear All Wakeup Event When Cold Boot */ + ll_pwr_clear_wakeup_event(LL_PWR_WKUP_EVENT_ALL); + for(uint8_t i = 0; i < MAX_NUMS_IRQn; i++) + { + NVIC_ClearPendingIRQ((IRQn_Type)(i)); + } + + #ifdef EXFLASH_WAKEUP_DELAY + warm_boot_set_exflash_readid_delay(EXFLASH_WAKEUP_DELAY * 5); + run_mode_t run_mode = (run_mode_t)(SYSTEM_CLOCK); + uint16_t osc_time = ble_wakeup_osc_time_get(run_mode) + (EXFLASH_WAKEUP_DELAY * 5); + ble_wakeup_osc_time_set(run_mode, osc_time); + #endif + + /* enable protection. */ + platform_init_push(); + +#if (PLAT_SUPPORT_SLEEP == 1) + /* set sram power state. */ + mem_pwr_mgmt_init(); + + /* nvds module init process. */ + nvds_setup(); + + /* To choose the System clock source and set the accuracy of OSC. */ + #if CFG_LPCLK_INTERNAL_EN + platform_clock_init_rng((mcu_clock_type_t)SYSTEM_CLOCK, RNG_OSC_CLK2, 500, 0); + #else + #if CFG_CRYSTAL_DELAY + platform_set_rtc_crystal_delay(CFG_CRYSTAL_DELAY); + #endif + platform_clock_init((mcu_clock_type_t)SYSTEM_CLOCK, RTC_OSC_CLK, CFG_LF_ACCURACY_PPM, 0); + #endif +#endif + + /* Register the SVC Table. */ + svc_table_register(SVC_TABLE_USER_SPACE); + +#if (PLAT_SUPPORT_SLEEP == 1) +#if ENCRYPT_ENABLE + fpb_register_patch_init_func(fpb_encrypt_mode_patch_enable); +#else + fpb_register_patch_init_func(fpb_patch_enable); +#endif + + /* platform init process. */ + platform_sdk_init(); + +#if ENCRYPT_ENABLE + dfu_cmd_handler_replace_for_encrypt(); +#endif + + #ifndef DRIVER_TEST + /* Enable auto pmu calibration function period =3s on default. */ + system_pmu_calibration_init(30000); + #endif + + system_pmu_deinit(); +#endif + SystemCoreSetClock((mcu_clock_type_t)SYSTEM_CLOCK); +#if (PLAT_SUPPORT_SLEEP == 1) + system_pmu_init((mcu_clock_type_t)SYSTEM_CLOCK); + + // recover the default setting by temperature, should be called in the end + pmu_calibration_handler(NULL); + + /* RTC calibration function */ + #if !CFG_LPCLK_INTERNAL_EN + /* Delayed for a while, because the GM of RTC has changed */ + #if CFG_CRYSTAL_DELAY + delay_ms(CFG_CRYSTAL_DELAY); + #endif + rtc_calibration(); + #endif + + /* rng calibration */ + rng_calibration(); +#endif + + #if (CFG_LCP_SUPPORT && (CHIP_TYPE <= 5)) + gdx_lcp_buf_init((uint32_t)lcp_buf); + #endif + + exflash_io_pull_config(); + + /* disable protection. */ + platform_init_pop(); + + return; +} + +void vector_table_init(void) +{ + __DMB(); // Data Memory Barrier + FuncVector_table[0] = *(FuncVector_t *)(SCB->VTOR); + SCB->VTOR = (uint32_t)FuncVector_table; // Set VTOR to the new vector table location + __DSB(); // Data Synchronization Barrier to ensure all +} + +void warm_boot_process(void) +{ + vector_table_init(); + pwr_mgmt_warm_boot(); +} + +#define SOFTWARE_REG_WAKEUP_FLAG_POS (8) +uint32_t get_wakeup_flag(void) +{ + return (AON->SOFTWARE_2 & (1 << SOFTWARE_REG_WAKEUP_FLAG_POS)); +} + +void soc_init(void) +{ +#if defined (__CC_ARM) + tiny_rw_section_init(); +#endif + + if (!hal_flash_init()) + { + /* Flash fault, cannot startup. + * TODO: Output log via UART or Dump an error code to flash. */ + while(1); + } + + platform_flash_enable_quad(); + platform_flash_protection(FLASH_PROTECT_PRIORITY); + + platform_init(); + hal_init(); + + /* record app msp */ + g_app_msp_addr = REG_PL_RD(APP_CODE_RUN_ADDR); + +} + +/*---------------------------------------------------------------------------- + System Core Clock Variable + *----------------------------------------------------------------------------*/ +static const uint32_t systemClock[CLK_TYPE_NUM] = { + CLK_64M, /*CPLL_S64M_CLK*/ + CLK_48M, /*CPLL_F48M_CLK*/ + CLK_16M, /*XO_S16M_CLK*/ + CLK_24M, /*CPLL_T24M_CLK*/ + CLK_16M, /*CPLL_S16M_CLK*/ + CLK_32M, /*CPLL_T32M_CLK*/ + }; + +// xqspi clock table by sys_clk_type +const uint32_t mcu_clk_2_qspi_clk[CLK_TYPE_NUM] = { + [CPLL_S64M_CLK] = QSPI_64M_CLK, + [CPLL_F48M_CLK] = QSPI_48M_CLK, + [CPLL_T32M_CLK] = QSPI_32M_CLK, + [CPLL_T24M_CLK] = QSPI_24M_CLK, + [CPLL_S16M_CLK] = QSPI_16M_CLK, + [XO_S16M_CLK] = QSPI_16M_CLK, + }; + +uint32_t SystemCoreClock = CLK_64M; /* System Core Clock Frequency as 64Mhz */ + +//lint -e{2,10,48,63} +//The previous line of comment is to inhibit PC-Lint errors for next code block. +void SystemCoreSetClock(mcu_clock_type_t clock_type) +{ + if (clock_type >= CLK_TYPE_NUM) + return; // input parameter is out of range + + if ((AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL) != clock_type) + { + uint32_t temp = AON->PWR_RET01 & (~(AON_PWR_REG01_SYS_CLK_SEL | AON_PWR_REG01_XF_SCK_CLK_SEL)); + //When a 16M or 64M clock is switched to another clock, it needs to be switched to 32M first. + AON->PWR_RET01 = (temp | (CPLL_T32M_CLK << AON_PWR_REG01_SYS_CLK_SEL_Pos) | (QSPI_32M_CLK << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos)); + + __asm ("nop;nop;nop;nop;"); + temp = AON->PWR_RET01 & (~(AON_PWR_REG01_SYS_CLK_SEL | AON_PWR_REG01_XF_SCK_CLK_SEL)); + AON->PWR_RET01 = (temp | (clock_type << AON_PWR_REG01_SYS_CLK_SEL_Pos) | (mcu_clk_2_qspi_clk[clock_type] << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos)); + } + + SystemCoreClock = systemClock[clock_type]; + + //update sleep parameters by system clock. + pwr_mgmt_update_wkup_param(); + + return; +} + +void SystemCoreGetClock(mcu_clock_type_t *clock_type) +{ + *clock_type = (mcu_clock_type_t)(AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL); +} + +void SystemCoreUpdateClock(void) +{ + SystemCoreClock = systemClock[AON->PWR_RET01 & AON_PWR_REG01_SYS_CLK_SEL]; +} + +void set_msp() +{ + #ifndef DRIVER_TEST + #ifdef APP_CODE_RUN_ADDR + __DMB(); + __set_MSP(REG_PL_RD(APP_CODE_RUN_ADDR)); + __DSB(); + #endif + #endif +} + diff --git a/gr551x/sdk_liteos/liteos_m/BUILD.gn b/gr551x/sdk_liteos/liteos_m/BUILD.gn index f9c371a..7250235 100755 --- a/gr551x/sdk_liteos/liteos_m/BUILD.gn +++ b/gr551x/sdk_liteos/liteos_m/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -17,7 +17,6 @@ config("public") { include_dirs = [ "." ] } -module_name = get_path_info(rebase_path("."), "name") -kernel_module(module_name) { +kernel_module("liteos_m") { sources = [ "los_port_pm.c" ] } diff --git a/gr551x/sdk_liteos/liteos_m/los_port_pm.c b/gr551x/sdk_liteos/liteos_m/los_port_pm.c index be334e8..0b597a0 100644 --- a/gr551x/sdk_liteos/liteos_m/los_port_pm.c +++ b/gr551x/sdk_liteos/liteos_m/los_port_pm.c @@ -1,148 +1,294 @@ -/* - * Copyright (c) 2021 GOODIX. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "gr55xx.h" -#include "gr55xx_pwr.h" +#include "los_pm.h" +#include "los_sched.h" +#include "gr55xx_hal.h" #include "gr55xx_sys.h" -#include "gr55xx_ll_pwr.h" +#include -#include "los_pm.h" -#include "los_timer.h" -#include "los_tick.h" -#include "los_task.h" -#include "los_sched.h" +#define SYSTICK_LOAD_VALUE ((OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND)) +#define TICK_PERIOD_US (1000000 / LOSCFG_BASE_CORE_TICK_PER_SECOND) +#define TICK_MS_IN_HUS (TICK_PERIOD_US << 1) +#define HALF_SLOT_SIZE (625) +#define RWIP_MAX_CLOCK_TIME (0xFFFFFFF) +#define CLK_SUB(clock_a, clock_b) ((uint32_t)(((clock_a) - (clock_b)) & RWIP_MAX_CLOCK_TIME)) +#define RW_BB_FRAME_ONGOING (0x0200) +#define WFI_16MHZ_CFG ((CPLL_S16M_CLK << AON_PWR_REG01_SYS_CLK_SEL_Pos) | \ + (QSPI_16M_CLK << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos)) +#define WFI_32MHZ_CFG ((CPLL_T32M_CLK << AON_PWR_REG01_SYS_CLK_SEL_Pos) | \ + (QSPI_32M_CLK << AON_PWR_REG01_XF_SCK_CLK_SEL_Pos)) +#define U32(a) ((uint32_t)(a)) +#define CO_MIN_U32(a,b) (U32(a) < U32(b) ? U32(a) : U32(b)) +#define MAX_BLE_SLEEP_TICKS (100000) // limit for sys_lpcycles_2_hus overflow +#define TICK_MISS_COUNT_VAL (2600) +#define LP_CLOCK_PERIOD_HUS (60) +#define TICK_ERR_CALI_STEP (LP_CLOCK_PERIOD_HUS) -#include "los_port_pm.h" - -#define TICK_MS_IN_HUS (2000) -#define SYS_BLE_SLEEP_ALGO_HUS (580) -#define SLP_WAKUP_ALGO_LP_CNT (32) -#define DEEPSLEEP_TIME_MIN_MS (5) - -static uint64_t g_tickTimerBaseBeforeSleep = 0; -static uint32_t g_lpCntWhenTickStop = 0; -static uint32_t g_lpCntWhenTickReload = 0; - -TINY_RAM_SECTION uint32_t os_sleep_ms_get(void) +typedef struct { - g_tickTimerBaseBeforeSleep = OsGetCurrSchedTimeCycle(); - return ((uint32_t)(OsSchedGetNextExpireTime(g_tickTimerBaseBeforeSleep) - g_tickTimerBaseBeforeSleep)) / - OS_CYCLE_PER_TICK; + uint32_t hs; + uint32_t hus; +} ble_time_t; + +static uint32_t s_tick_stop_lp_cnt = 0; +static uint32_t s_tick_reload_lp_cnt = 0; +static uint32_t s_lp_cnt_2_hus_err = 0; +static ble_time_t s_tick_stop_time = {0, 0}; +static ble_time_t s_tick_reload_time = {0, 0}; +static uint32_t s_rtos_idle_ticks = 0; +static int s_tick_err_us = 0; +static int s_ble_compensate_flag = 0; +static ble_time_t s_last_tick_time = {0, 0}; +static uint32_t s_last_tick_cnt = 0; +static uint64_t s_tick_timer_base_before_sleep = 0; + +int g_compensate_ticks = 0; +uint32_t g_miss_count_hus = TICK_MISS_COUNT_VAL; + +volatile uint8_t __debug_flag = 0; + +extern void ultra_wfi(void); +extern uint32_t get_remain_sleep_dur(void); +extern ble_time_t rwip_time_get(void); +extern uint16_t prevent_sleep_get(void); +extern bool ble_is_ready(void); +extern void warm_boot_second(void); + +TINY_RAM_SECTION void ble_compensate_calculate(uint32_t xEstimateCnt) +{ + static ble_time_t s_cur_tick_time = {0, 0}; + static uint32_t s_cur_tick_cnt = 0; + static uint32_t s_ble_compensate_cnt = 0; + if(!ble_is_ready()) + { + return; + } + s_cur_tick_time = rwip_time_get(); + s_cur_tick_cnt = xEstimateCnt; + if ((0 == s_ble_compensate_cnt++) && (0 == g_compensate_ticks)) + { + /* For ble time and systick pairs initialize */ + s_tick_err_us = 0; + s_last_tick_time = s_cur_tick_time; + s_last_tick_cnt = s_cur_tick_cnt; + return; + } + int tick_diff_cnt = (s_cur_tick_cnt - s_last_tick_cnt); + int ble_time_diff_hus = HALF_SLOT_SIZE * CLK_SUB(s_cur_tick_time.hs, s_last_tick_time.hs); + int ble_time_diff_us = (ble_time_diff_hus + s_cur_tick_time.hus - s_last_tick_time.hus) >> 1; + int systick_diff_us = tick_diff_cnt * TICK_PERIOD_US; + if( ((int)ble_time_diff_us) > ((int)systick_diff_us) ) + { + /* Systick is slower than real time */ + s_tick_err_us += (ble_time_diff_us - systick_diff_us); + } + else + { + /* Systick is faster than real time */ + s_tick_err_us -= (systick_diff_us - ble_time_diff_us); + } + s_ble_compensate_flag = 1; } -TINY_RAM_SECTION void sys_tick_reload(void) +TINY_RAM_SECTION void ble_compensate_execute(uint32_t* step_ticks) +{ + while( ((int)s_tick_err_us) > ((int)TICK_PERIOD_US) ) + { + if( ((int)((*step_ticks) + 1)) <= ((int)s_rtos_idle_ticks) ) + { + *step_ticks = *step_ticks + 1; + s_tick_err_us = s_tick_err_us - TICK_PERIOD_US; + g_compensate_ticks++; + g_miss_count_hus += TICK_ERR_CALI_STEP; + } + else + { + //if error happend, reset s_tick_err_us + s_tick_err_us = 0; + break; + } + } + while( ((int)s_tick_err_us) < ((int)(0 - TICK_PERIOD_US)) ) + { + if( ((int)((*step_ticks) - 1)) > ((int)1) ) + { + *step_ticks = *step_ticks - 1; + s_tick_err_us = s_tick_err_us + TICK_PERIOD_US; + g_compensate_ticks--; + g_miss_count_hus = (g_miss_count_hus > TICK_ERR_CALI_STEP) ? \ + (g_miss_count_hus - TICK_ERR_CALI_STEP) : (g_miss_count_hus); + } + else + { + //if error happend, reset s_tick_err_us + s_tick_err_us = 0; + break; + } + } +} + +TINY_RAM_SECTION void SysTickReload(void) { SysTick->CTRL &= ~SysTick_CTRL_ENABLE_Msk; - SysTick->LOAD = (UINT32)((OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND) - 1UL); - SysTick->VAL = 0UL; + SysTick->LOAD = (uint32_t)(SYSTICK_LOAD_VALUE - 1UL); /* set reload register */ + SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ SysTick->CTRL |= (SysTick_CTRL_ENABLE_Msk | SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk); } -TINY_RAM_SECTION static void pwr_mgmt_sleep_dur_limit(uint32_t sleepMs) +TINY_RAM_SECTION void pwr_mgmt_tick_compensate(uint32_t step_ticks) { - uint32_t sleepHus = sleepMs * TICK_MS_IN_HUS - SYS_BLE_SLEEP_ALGO_HUS; - if (get_remain_sleep_dur() > sleepHus) { - pwr_mgmt_ble_wakeup(); + if( 0 == step_ticks ) + { + return; + } + + ble_compensate_calculate((uint32_t)(OS_SYS_CYCLE_TO_TICK(s_tick_timer_base_before_sleep)) + step_ticks); + ble_compensate_execute(&step_ticks); + step_ticks = CO_MIN_U32(s_rtos_idle_ticks, step_ticks); + + OsTickTimerBaseReset(s_tick_timer_base_before_sleep + step_ticks * OS_CYCLE_PER_TICK); + //after ble compensate the tick, record the systick and ble pair + if(s_ble_compensate_flag == 1) + { + s_ble_compensate_flag = 0; + s_last_tick_time = rwip_time_get(); + s_last_tick_cnt = OS_SYS_CYCLE_TO_TICK(OsGetCurrSchedTimeCycle()); } - sys_ble_heartbeat_period_set(sleepHus); } -TINY_RAM_SECTION static void pwr_mgmt_enter_sleep_with_cond(uint32_t sleepMs) +TINY_RAM_SECTION void SysFreqSet(uint32_t clock_cfg) { - pwr_mgmt_sleep_dur_limit(sleepMs); + uint32_t temp = AON->PWR_RET01 & (~(AON_PWR_REG01_SYS_CLK_SEL | AON_PWR_REG01_XF_SCK_CLK_SEL)); + /* When switch 16M or 64M clock to another clock, clock needs to be switched to 32M first. */ + AON->PWR_RET01 = (temp | WFI_32MHZ_CFG); + __asm ("nop;nop;nop;nop;"); + + AON->PWR_RET01 = (temp | clock_cfg); +} + +TINY_RAM_SECTION uint32_t SysFreqGet(void) +{ + return ((AON->PWR_RET01 & (AON_PWR_REG01_SYS_CLK_SEL | AON_PWR_REG01_XF_SCK_CLK_SEL))); +} + +TINY_RAM_SECTION void pwr_mgmt_sleep_dur_limit(int rtos_idle_ticks) +{ + uint32_t expect_idle_ticks = CO_MIN_U32(rtos_idle_ticks, MAX_BLE_SLEEP_TICKS); + /* The rtos_idle_ticks >= 5ms and rtos_idle_ticks <= 100second is ensured in this context. */ + uint32_t rtos_idle_hus = (expect_idle_ticks - 1) * TICK_MS_IN_HUS; + if( get_remain_sleep_dur() > rtos_idle_hus) + { + pwr_mgmt_ble_wakeup(); + } + sys_ble_heartbeat_period_set(rtos_idle_hus); +} + +TINY_RAM_SECTION void pwr_mgmt_enter_sleep_with_cond(int rtos_idle_ticks) +{ + /* Limit maximum sleep duration. */ + pwr_mgmt_sleep_dur_limit(rtos_idle_ticks); + + /* To disbale global IRQ. */ uint32_t intSave = LOS_IntLock(); - if (DEVICE_BUSY == pwr_mgmt_dev_suspend()) { + /* Check Whether Device is busy. */ + if (DEVICE_BUSY == pwr_mgmt_dev_suspend()) + { ultra_wfi(); LOS_IntRestore(intSave); return; } - if (PMR_MGMT_SLEEP_MODE != pwr_mgmt_mode_get()) { + /* Before the lock, if the sleep mode is changed in a interrupt, take it effect immediately. */ + if (PMR_MGMT_SLEEP_MODE != pwr_mgmt_mode_get()) + { LOS_IntRestore(intSave); return; } - pwr_mgmt_mode_t bleState = pwr_mgmt_baseband_state_get(); - switch (bleState) { - case PMR_MGMT_IDLE_MODE: + /* Check BLE Sleep Status. Notice: ensure there is no other checks before baseband state check. */ + pwr_mgmt_mode_t ble_state = pwr_mgmt_baseband_state_get(); + if (PMR_MGMT_SLEEP_MODE != ble_state) + { + if (PMR_MGMT_IDLE_MODE == ble_state) + { ultra_wfi(); - case PMR_MGMT_ACTIVE_MODE: - LOS_IntRestore(intSave); - return; + } + LOS_IntRestore(intSave); + return; } - g_lpCntWhenTickStop = ll_pwr_get_comm_sleep_duration(); + /* Record Systick Stop Time. */ + s_tick_stop_lp_cnt = ll_pwr_get_comm_sleep_duration(); + /* Save the context of RTOS. */ pwr_mgmt_save_context(); - if (pwr_mgmt_get_wakeup_flag() == COLD_BOOT) { - if (PMR_MGMT_IDLE_MODE == pwr_mgmt_shutdown()) { + /* Judge the current startup mode mark. */ + if (pwr_mgmt_get_wakeup_flag() == COLD_BOOT) + { + /* Shutdown all system power and wait some event to wake up. */ + if (PMR_MGMT_IDLE_MODE == pwr_mgmt_shutdown()) + { ultra_wfi(); LOS_IntRestore(intSave); return; } LOS_IntRestore(intSave); - } else { + } + else // Wakeup from deep sleep state + { + /* Clear wakeup mark, prepare next enter-sleep action. */ pwr_mgmt_set_wakeup_flag(COLD_BOOT); + /* To disbale global IRQ. */ uint32_t intSaveLocal = LOS_IntLock(); - g_lpCntWhenTickReload = ll_pwr_get_comm_sleep_duration(); - sys_tick_reload(); + /* Reload SysTick and Record Tick Reload Time. */ + SysTickReload(); + s_tick_reload_lp_cnt = ll_pwr_get_comm_sleep_duration(); - uint32_t sleepLpCycles = g_lpCntWhenTickReload - g_lpCntWhenTickStop + SLP_WAKUP_ALGO_LP_CNT; - uint32_t lpCycles2HusErr = 0; - uint32_t sleepHus = sys_lpcycles_2_hus(sleepLpCycles, &lpCycles2HusErr); - uint32_t sleepSystick = sleepHus * (OS_CYCLE_PER_TICK / TICK_MS_IN_HUS); + /* Calculate Step Ticks With Low Power Counter. */ + uint32_t sleep_lp_cnt = s_tick_reload_lp_cnt - s_tick_stop_lp_cnt; + uint32_t ticks_hus = sys_lpcycles_2_hus(sleep_lp_cnt, &s_lp_cnt_2_hus_err) + g_miss_count_hus; + uint32_t step_ticks = ticks_hus / TICK_MS_IN_HUS; - OsTickTimerBaseReset(g_tickTimerBaseBeforeSleep + sleepSystick); + /* Compensate Systick Increment. */ + pwr_mgmt_tick_compensate(step_ticks); LOS_SchedTickHandler(); + /* To enable global IRQ. */ LOS_IntRestore(intSaveLocal); + warm_boot_second(); } } +TINY_RAM_SECTION uint32_t os_sleep_ms_get(void) +{ + s_tick_timer_base_before_sleep = OsGetCurrSchedTimeCycle(); + return ((uint32_t)(OsSchedGetNextExpireTime(s_tick_timer_base_before_sleep) - s_tick_timer_base_before_sleep)) / + OS_CYCLE_PER_TICK; +} + TINY_RAM_SECTION static void os_pm_enter_handler(void) { - uint32_t intSave = LOS_IntLock(); + uint32_t expected_idle_time = os_sleep_ms_get(); + s_rtos_idle_ticks = expected_idle_time; - if ((SCB->ICSR & SCB_ICSR_PENDSTSET_Msk)) { - LOS_IntRestore(intSave); - return; - } - - uint32_t sleepMs = os_sleep_ms_get(); - LOS_IntRestore(intSave); - - if (sleepMs < DEEPSLEEP_TIME_MIN_MS) { + if (expected_idle_time < 5) + { ultra_wfi(); return; } - if (PMR_MGMT_SLEEP_MODE != pwr_mgmt_mode_get()) { + if (PMR_MGMT_SLEEP_MODE != pwr_mgmt_mode_get()) + { ultra_wfi(); return; } - LOS_TaskLock(); - pwr_mgmt_enter_sleep_with_cond(sleepMs); - LOS_TaskUnlock(); + pwr_mgmt_enter_sleep_with_cond(expected_idle_time); } void GR551xPwrMgmtInit(void) diff --git a/gr551x/sdk_liteos/liteos_m/target_config.h b/gr551x/sdk_liteos/liteos_m/target_config.h old mode 100755 new mode 100644 diff --git a/gr551x/sdk_liteos/platform/linker/gr5515.ld.tmpl b/gr551x/sdk_liteos/platform/linker/gr5515.ld.tmpl new file mode 100644 index 0000000..b3963e9 --- /dev/null +++ b/gr551x/sdk_liteos/platform/linker/gr5515.ld.tmpl @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2024 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Entry Point */ +ENTRY(Reset_Handler) + +_Min_Heap_Size = 0x800; /* required amount of heap */ +_Min_Stack_Size = SYSTEM_STACK_SIZE; /* required amount of stack */ + +/* Highest address of the user mode stack */ +_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */ +_sstack = _estack - _Min_Stack_Size; + +#if CHIP_TYPE == 0 || CHIP_TYPE == 4 || CHIP_TYPE == 5// 1MB +#define FLASH_END_ADDR (0x01100000 - APP_CODE_LOAD_ADDR) +#elif CHIP_TYPE == 1 +#define FLASH_END_ADDR (0x0x080000 - APP_CODE_LOAD_ADDR) +#endif + +/* Memories definition */ +MEMORY +{ + FLASH (rx) : ORIGIN = APP_CODE_LOAD_ADDR, LENGTH = (FLASH_END_ADDR - APP_CODE_LOAD_ADDR) + RAM (rwx) : ORIGIN = 0x30000000 + 0x4000, LENGTH = (0x00040000 - 0x4000) +} + +/* Sections */ +SECTIONS +{ + /* The program code and other data goes into FLASH */ + .text : + { + KEEP(*(.vectors)) + __Vectors_End = .; + __Vectors_Size = __Vectors_End - __Vectors; + __end__ = .; + . = ALIGN(0x200); + KEEP(*(.app_info)) + . = ALIGN(4); + _stext = .; + *(.text) /* .text sections (code) */ + *(.text*) /* .text* sections (code) */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + *(.eh_frame) + + __zinitcall_bsp_start = .; + KEEP (*(.zinitcall.bsp0.init)) + KEEP (*(.zinitcall.bsp1.init)) + KEEP (*(.zinitcall.bsp2.init)) + KEEP (*(.zinitcall.bsp3.init)) + KEEP (*(.zinitcall.bsp4.init)) + __zinitcall_bsp_end = .; + __zinitcall_device_start = .; + KEEP (*(.zinitcall.device0.init)) + KEEP (*(.zinitcall.device1.init)) + KEEP (*(.zinitcall.device2.init)) + KEEP (*(.zinitcall.device3.init)) + KEEP (*(.zinitcall.device4.init)) + __zinitcall_device_end = .; + __zinitcall_core_start = .; + KEEP (*(.zinitcall.core0.init)) + KEEP (*(.zinitcall.core1.init)) + KEEP (*(.zinitcall.core2.init)) + KEEP (*(.zinitcall.core3.init)) + KEEP (*(.zinitcall.core4.init)) + __zinitcall_core_end = .; + __zinitcall_sys_service_start = .; + KEEP (*(.zinitcall.sys.service0.init)) + KEEP (*(.zinitcall.sys.service1.init)) + KEEP (*(.zinitcall.sys.service2.init)) + KEEP (*(.zinitcall.sys.service3.init)) + KEEP (*(.zinitcall.sys.service4.init)) + __zinitcall_sys_service_end = .; + __zinitcall_sys_feature_start = .; + KEEP (*(.zinitcall.sys.feature0.init)) + KEEP (*(.zinitcall.sys.feature1.init)) + KEEP (*(.zinitcall.sys.feature2.init)) + KEEP (*(.zinitcall.sys.feature3.init)) + KEEP (*(.zinitcall.sys.feature4.init)) + __zinitcall_sys_feature_end = .; + __zinitcall_run_start = .; + KEEP (*(.zinitcall.run0.init)) + KEEP (*(.zinitcall.run1.init)) + KEEP (*(.zinitcall.run2.init)) + KEEP (*(.zinitcall.run3.init)) + KEEP (*(.zinitcall.run4.init)) + __zinitcall_run_end = .; + __zinitcall_app_service_start = .; + KEEP (*(.zinitcall.app.service0.init)) + KEEP (*(.zinitcall.app.service1.init)) + KEEP (*(.zinitcall.app.service2.init)) + KEEP (*(.zinitcall.app.service3.init)) + KEEP (*(.zinitcall.app.service4.init)) + __zinitcall_app_service_end = .; + __zinitcall_app_feature_start = .; + KEEP (*(.zinitcall.app.feature0.init)) + KEEP (*(.zinitcall.app.feature1.init)) + KEEP (*(.zinitcall.app.feature2.init)) + KEEP (*(.zinitcall.app.feature3.init)) + KEEP (*(.zinitcall.app.feature4.init)) + __zinitcall_app_feature_end = .; + __zinitcall_test_start = .; + KEEP (*(.zinitcall.test0.init)) + KEEP (*(.zinitcall.test1.init)) + KEEP (*(.zinitcall.test2.init)) + KEEP (*(.zinitcall.test3.init)) + KEEP (*(.zinitcall.test4.init)) + __zinitcall_test_end = .; + __zinitcall_exit_start = .; + KEEP (*(.zinitcall.exit0.init)) + KEEP (*(.zinitcall.exit1.init)) + KEEP (*(.zinitcall.exit2.init)) + KEEP (*(.zinitcall.exit3.init)) + KEEP (*(.zinitcall.exit4.init)) + __zinitcall_exit_end = .; + + KEEP (*(.init)) + KEEP (*(.fini)) + + . = ALIGN(4); + _etext = .; /* define a global symbols at end of code */ + } >FLASH + + /* Constant data into "FLASH" Rom type memory */ + .rodata : + { + . = ALIGN(4); + *(.rodata) /* .rodata sections (constants, strings, etc.) */ + *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ + . = ALIGN(4); + } >FLASH + + .ARM.extab : { + . = ALIGN(4); + *(.ARM.extab* .gnu.linkonce.armextab.*) + . = ALIGN(4); + } >FLASH + + .ARM : { + . = ALIGN(4); + __exidx_start = .; + *(.ARM.exidx*) + __exidx_end = .; + . = ALIGN(4); + } >FLASH + + .preinit_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__preinit_array_start = .); + KEEP (*(.preinit_array*)) + PROVIDE_HIDDEN (__preinit_array_end = .); + . = ALIGN(4); + } >FLASH + + .init_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__init_array_start = .); + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array*)) + PROVIDE_HIDDEN (__init_array_end = .); + . = ALIGN(4); + } >FLASH + + .fini_array : + { + . = ALIGN(4); + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array*)) + PROVIDE_HIDDEN (__fini_array_end = .); + . = ALIGN(4); + } >FLASH + + .hdf_drivers_entry : + { + _hdf_drivers_start = .; + KEEP(*(.hdf.driver)) + _hdf_drivers_end = .; + } >FLASH + + /* Used by the startup to initialize data */ + _sidata = LOADADDR(.data); + __etext = .; + + /* Initialized data sections into "RAM" Ram type memory */ + .data : + { + . = ALIGN(4); + __data_start__ = . ; /* create a global symbol at data start */ + KEEP (*(.vector)) /* make the vector at the data begining, and it will meet the needs of VTOR */ + . = ALIGN(4); + *(.data) /* .data sections */ + *(.data*) /* .data* sections */ + *(.RamFunc) /* .RamFunc sections */ + *(.RamFunc*) /* .RamFunc* sections */ + *(RAM_CODE) /* .RamFunc sections */ + *(.ramfunc) /* .RamFunc sections */ + *(TINY_RAM_SPACE) + . = ALIGN(4); + __data_end__ = . ;/* define a global symbol at data end */ + } >RAM AT> FLASH + + .fpb_section : + { + . = ALIGN(32); + *(FPB*) + } > RAM + + /* Uninitialized data section into "RAM" Ram type memory */ + . = ALIGN(4); + .bss : + { + /* This is used by the startup in order to initialize the .bss section */ + __bss_start__ = .; /* define a global symbol at bss start */ + *(.bss) + *(.bss*) + *(COMMON) + + . = ALIGN(4); + __bss_end__ = .; /* define a global symbol at bss end */ + } >RAM + + . = ALIGN(16); + __los_heap_addr_start__ = .; + __los_heap_addr_end__ = ORIGIN(RAM) + LENGTH(RAM) - _Min_Stack_Size - _Min_Heap_Size - 1; + + .ARM.attributes 0 : { *(.ARM.attributes) } +} diff --git a/gr551x/sdk_liteos/platform/main/BUILD.gn b/gr551x/sdk_liteos/platform/main/BUILD.gn old mode 100755 new mode 100644 index e1d4f3f..bc2944b --- a/gr551x/sdk_liteos/platform/main/BUILD.gn +++ b/gr551x/sdk_liteos/platform/main/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -17,6 +17,6 @@ config("public") { include_dirs = [ "." ] } -kernel_module("platform_main") { +kernel_module("main") { sources = [ "main.c" ] } diff --git a/gr551x/sdk_liteos/platform/main/main.c b/gr551x/sdk_liteos/platform/main/main.c index a12ff8d..5da8609 100755 --- a/gr551x/sdk_liteos/platform/main/main.c +++ b/gr551x/sdk_liteos/platform/main/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,41 +18,54 @@ #include "stdint.h" #include "gr55xx_sys.h" #include "custom_config.h" -#include "uart.h" #include "app_rng.h" #include "app_log.h" #include "los_task.h" +#include "los_event.h" #include "cmsis_os2.h" +#include "board_SK.h" -#define CN_MINISECONDS_IN_SECOND 1000 -#define CN_MAINBOOT_TASK_STACKSIZE 0X1000 -#define CN_MAINBOOT_TASK_PRIOR 2 -#define CN_MAINBOOT_TASK_NAME "MainBoot" +#define CN_MINISECONDS_IN_SECOND 1000 +#define CN_MAINBOOT_TASK_STACKSIZE 0X1000 +#define CN_MAINBOOT_TASK_PRIOR 2 +#define CN_MAINBOOT_TASK_NAME "MainBoot" -#define RNG_PARAM {APP_RNG_TYPE_POLLING, {RNG_SEED_FR0_S0, RNG_LFSR_MODE_59BIT, RNG_OUTPUT_LFSR, RNG_POST_PRO_NOT}} - -static const uint8_t s_bd_addr[SYS_BD_ADDR_LEN] = {0x08, 0x08, 0x08, 0xea, 0xea, 0xea}; +static const uint8_t s_bd_addr[SYS_BD_ADDR_LEN] = {0x08, 0x08, 0x08, 0xea, 0xea, 0xea}; static uint16_t g_random_seed[8] = {0x1234, 0x5678, 0x90AB, 0xCDEF, 0x1468, 0x2345, 0x5329, 0x2411}; +int DeviceManagerStart(); + /* Initialize system peripherals. */ void SystemPeripheralsInit(void) { - uint8_t addr[6]; - uint16_t lenght = 6; + uint8_t addr[6]; + uint16_t lenght = 6; - if (NVDS_TAG_NOT_EXISTED == nvds_get(0xC001, &lenght, (uint8_t*)addr)) { + if (NVDS_TAG_NOT_EXISTED == nvds_get(0xC001, &lenght, (uint8_t *)addr)) { SYS_SET_BD_ADDR(s_bd_addr); } bsp_log_init(); APP_LOG_INFO("GR551x system start!!!"); +#if LOSCFG_USE_SHELL + extern EVENT_CB_S g_shellInputEvent; + LOS_EventWrite(&g_shellInputEvent, 0x1); +#endif // LOSCFG_USE_SHELL } /* Initialize Hardware RNG peripherals. */ void HardwareRandomInit(void) { - app_rng_params_t params_t = RNG_PARAM; - app_rng_init(¶ms_t, NULL); + static app_rng_params_t rng_params = { + .use_type = APP_RNG_TYPE_POLLING, + .init = { + .seed_mode = RNG_SEED_FR0_S0, + .lfsr_mode = RNG_LFSR_MODE_59BIT, + .out_mode = RNG_OUTPUT_LFSR, + .post_mode = RNG_POST_PRO_NOT, + }, + }; + app_rng_init(&rng_params, NULL); } int HardwareRandomGet(uint32_t *p_random) @@ -70,7 +83,7 @@ int HardwareRandomGet(uint32_t *p_random) void OSVectorInit(void) { uint32_t *p_vector = (uint32_t *)SCB->VTOR; - p_vector[SVCall_IRQn + OS_SYS_VECTOR_CNT] = SVC_Handler; + p_vector[SVCall_IRQn + OS_SYS_VECTOR_CNT] = (uint32_t)SVC_Handler; OsSetVector(WDT_IRQn, (HWI_PROC_FUNC)WDT_IRQHandler); OsSetVector(BLE_SDK_IRQn, (HWI_PROC_FUNC)BLE_SDK_Handler); @@ -92,7 +105,7 @@ void OSVectorInit(void) OsSetVector(HMAC_IRQn, (HWI_PROC_FUNC)HMAC_IRQHandler); OsSetVector(EXT2_IRQn, (HWI_PROC_FUNC)EXT2_IRQHandler); OsSetVector(RNG_IRQn, (HWI_PROC_FUNC)RNG_IRQHandler); - OsSetVector(PMU_IRQn, (HWI_PROC_FUNC)PMU_IRQHandler); + OsSetVector(BOD_ASSERT_IRQn, (HWI_PROC_FUNC)BOD_ASSERT_IRQHandler); OsSetVector(PKC_IRQn, (HWI_PROC_FUNC)PKC_IRQHandler); OsSetVector(XQSPI_IRQn, (HWI_PROC_FUNC)XQSPI_IRQHandler); OsSetVector(QSPI1_IRQn, (HWI_PROC_FUNC)QSPI1_IRQHandler); @@ -110,12 +123,12 @@ void OSVectorInit(void) NVIC_SetPriorityGrouping(0x3); } -static void OHOS_SystemInitWrapper(void *parg) +static void *OHOS_SystemInitWrapper(void *parg) { UNUSED(parg); + LiteParamService(); OHOS_SystemInit(); - LOS_TaskDelete(LOS_CurTaskIDGet()); - LOS_ASSERT_COND(0); + return NULL; } static void MainBoot(void) @@ -135,16 +148,19 @@ static void MainBoot(void) } /** - * @brief The application entry point. - * @retval int - */ + * @brief The application entry point. + * @retval int + */ int main(void) { UINT32 ret; + // Disable interrupt before IRQHandlers are properly initialized + uint32_t intSave = LOS_IntLock(); ret = LOS_KernelInit(); if (ret == LOS_OK) { OSVectorInit(); + LOS_IntRestore(intSave); #if (LOSCFG_USE_SHELL == 1) LosShellInit(); OsShellInit(); @@ -158,4 +174,3 @@ int main(void) } return 0; } - diff --git a/gr551x/sdk_liteos/platform/main/main.h b/gr551x/sdk_liteos/platform/main/main.h index a268eb2..c6206cc 100755 --- a/gr551x/sdk_liteos/platform/main/main.h +++ b/gr551x/sdk_liteos/platform/main/main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef __MAIN_H #define __MAIN_H @@ -44,7 +45,7 @@ void AES_IRQHandler(void); void HMAC_IRQHandler(void); void EXT2_IRQHandler(void); void RNG_IRQHandler(void); -void PMU_IRQHandler(void); +void BOD_ASSERT_IRQHandler(void); void PKC_IRQHandler(void); void XQSPI_IRQHandler(void); void QSPI1_IRQHandler(void); diff --git a/gr551x/sdk_liteos/platform/system/BUILD.gn b/gr551x/sdk_liteos/platform/system/BUILD.gn index 354fb22..1257ef9 100755 --- a/gr551x/sdk_liteos/platform/system/BUILD.gn +++ b/gr551x/sdk_liteos/platform/system/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 GOODIX. +# Copyright (c) 2024 GOODIX. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -21,5 +21,6 @@ kernel_module("platform_system") { sources = [ "dprintf.c", "system.c", + "uart.c", ] } diff --git a/gr551x/sdk_liteos/platform/system/dprintf.c b/gr551x/sdk_liteos/platform/system/dprintf.c index e268aef..15b496a 100755 --- a/gr551x/sdk_liteos/platform/system/dprintf.c +++ b/gr551x/sdk_liteos/platform/system/dprintf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,10 +33,7 @@ int printf(const char *__restrict __format, ...) va_end(ap); if (len > 0) { - char const *s = buf; - while (*s) { - _putchar(*s++); - } + _write(stdout, buf, len); } return len; } @@ -53,3 +50,9 @@ int sprintf(char *__restrict __s, const char *__restrict __format, ...) return val; } +int HiLogWriteInternal(const char *buffer, size_t bufLen) +{ + printf(buffer); + printf("\n"); + return 0; +} diff --git a/gr551x/sdk_liteos/platform/system/system.c b/gr551x/sdk_liteos/platform/system/system.c index 07159f5..dd09b7f 100755 --- a/gr551x/sdk_liteos/platform/system/system.c +++ b/gr551x/sdk_liteos/platform/system/system.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 GOODIX. + * Copyright (c) 2024 GOODIX. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #include #include #include diff --git a/gr551x/sdk_liteos/platform/system/uart.c b/gr551x/sdk_liteos/platform/system/uart.c new file mode 100644 index 0000000..fd81228 --- /dev/null +++ b/gr551x/sdk_liteos/platform/system/uart.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "uart.h" +#include "board_SK.h" +#include "los_sem.h" +#include "custom_config.h" + +#if LOSCFG_USE_SHELL + +#define SHELL_UART_ID APP_UART_ID + +static UINT32 s_rx_sem = 0xFFFFFFFFUL; + +void app_uart_evt_handler(app_uart_evt_t *p_evt) +{ + if (p_evt->type == APP_UART_EVT_RX_DATA || p_evt->type == APP_UART_EVT_ERROR) + { + LOS_SemPost(s_rx_sem); + LOS_EventWrite(&g_shellInputEvent, 0x1); + } +} + +uint8_t UartGetc(void) +{ + if (s_rx_sem == 0xFFFFFFFFUL) + { + LOS_BinarySemCreate(0, &s_rx_sem); + } + + uint8_t ch = 0; + + app_uart_receive_async(SHELL_UART_ID, &ch, 1); + LOS_SemPend(s_rx_sem, LOS_WAIT_FOREVER); + + return ch; +} + +#endif // LOSCFG_USE_SHELL \ No newline at end of file diff --git a/gr551x/sdk_liteos/platform/system/uart.h b/gr551x/sdk_liteos/platform/system/uart.h new file mode 100644 index 0000000..1c35a65 --- /dev/null +++ b/gr551x/sdk_liteos/platform/system/uart.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024 GOODIX. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __UART_H__ +#define __UART_H__ + +#include +#include "los_event.h" + +extern EVENT_CB_S g_shellInputEvent; + +uint8_t UartGetc(void); + +#endif // __UART_H__ \ No newline at end of file diff --git a/gr551x/sdk_liteos/third_party_adapter/mbedtls/BUILD.gn b/gr551x/sdk_liteos/third_party_adapter/mbedtls/BUILD.gn new file mode 100644 index 0000000..3999324 --- /dev/null +++ b/gr551x/sdk_liteos/third_party_adapter/mbedtls/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2024 GOODIX. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/ndk/ndk.gni") +import("//third_party/mbedtls/mbedtls.gni") + +config("mbedtls_config") { + include_dirs = [ "." ] + MBEDTLS_INLCUDE_DIRS + + defines += [ + "__unix__", + "MBEDTLS_CONFIG_FILE=", + "FUCKYOUUUUUUUU", + ] +} + +lite_library("mbedtls_static") { + target_type = "static_library" + public_configs = [ ":mbedtls_config" ] + sources = MBEDTLS_SOURCES +} + +group("mbedtls") { + public_deps = [ ":mbedtls_static" ] + public_configs = [ ":mbedtls_config" ] +} + +ndk_lib("mbedtls_ndk") { + lib_extension = ".a" + deps = [ ":mbedtls" ] + head_files = [ "include" ] +} diff --git a/gr551x/sdk_liteos/third_party_adapter/mbedtls/config/mbedtls_config_gr551x.h b/gr551x/sdk_liteos/third_party_adapter/mbedtls/config/mbedtls_config_gr551x.h new file mode 100644 index 0000000..7fece1b --- /dev/null +++ b/gr551x/sdk_liteos/third_party_adapter/mbedtls/config/mbedtls_config_gr551x.h @@ -0,0 +1,3354 @@ +/** + * \file mbedtls_config.h + * + * \brief Configuration options (set of defines) + * + * This set of compile-time options may be used to enable + * or disable features selectively, and reduce the global + * memory footprint. + */ +/* + * Copyright The Mbed TLS Contributors + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is an optional version symbol that enables comatibility handling of + * config files. + * + * It is equal to the #MBEDTLS_VERSION_NUMBER of the Mbed TLS version that + * introduced the config format we want to be compatible with. + */ +//#define MBEDTLS_CONFIG_VERSION 0x03000000 + +/** + * \name SECTION: System support + * + * This section sets system specific settings. + * \{ + */ + + #include + #include + + #define MBEDTLS_ECP_RESTARTABLE 1 +/** + * \def MBEDTLS_HAVE_ASM + * + * The compiler has support for asm(). + * + * Requires support for asm() in compiler. + * + * Used in: + * library/aria.c + * library/bn_mul.h + * + * Required by: + * MBEDTLS_AESNI_C + * MBEDTLS_PADLOCK_C + * + * Comment to disable the use of assembly code. + */ +#define MBEDTLS_HAVE_ASM + +/** + * \def MBEDTLS_NO_UDBL_DIVISION + * + * The platform lacks support for double-width integer division (64-bit + * division on a 32-bit platform, 128-bit division on a 64-bit platform). + * + * Used in: + * include/mbedtls/bignum.h + * library/bignum.c + * + * The bignum code uses double-width division to speed up some operations. + * Double-width division is often implemented in software that needs to + * be linked with the program. The presence of a double-width integer + * type is usually detected automatically through preprocessor macros, + * but the automatic detection cannot know whether the code needs to + * and can be linked with an implementation of division for that type. + * By default division is assumed to be usable if the type is present. + * Uncomment this option to prevent the use of double-width division. + * + * Note that division for the native integer type is always required. + * Furthermore, a 64-bit type is always required even on a 32-bit + * platform, but it need not support multiplication or division. In some + * cases it is also desirable to disable some double-width operations. For + * example, if double-width division is implemented in software, disabling + * it can reduce code size in some embedded targets. + */ +//#define MBEDTLS_NO_UDBL_DIVISION + +/** + * \def MBEDTLS_NO_64BIT_MULTIPLICATION + * + * The platform lacks support for 32x32 -> 64-bit multiplication. + * + * Used in: + * library/poly1305.c + * + * Some parts of the library may use multiplication of two unsigned 32-bit + * operands with a 64-bit result in order to speed up computations. On some + * platforms, this is not available in hardware and has to be implemented in + * software, usually in a library provided by the toolchain. + * + * Sometimes it is not desirable to have to link to that library. This option + * removes the dependency of that library on platforms that lack a hardware + * 64-bit multiplier by embedding a software implementation in Mbed TLS. + * + * Note that depending on the compiler, this may decrease performance compared + * to using the library function provided by the toolchain. + */ +//#define MBEDTLS_NO_64BIT_MULTIPLICATION + +/** + * \def MBEDTLS_HAVE_SSE2 + * + * CPU supports SSE2 instruction set. + * + * Uncomment if the CPU supports SSE2 (IA-32 specific). + */ +//#define MBEDTLS_HAVE_SSE2 + +/** + * \def MBEDTLS_HAVE_TIME + * + * System has time.h and time(). + * The time does not need to be correct, only time differences are used, + * by contrast with MBEDTLS_HAVE_TIME_DATE + * + * Defining MBEDTLS_HAVE_TIME allows you to specify MBEDTLS_PLATFORM_TIME_ALT, + * MBEDTLS_PLATFORM_TIME_MACRO, MBEDTLS_PLATFORM_TIME_TYPE_MACRO and + * MBEDTLS_PLATFORM_STD_TIME. + * + * Comment if your system does not support time functions + */ +#define MBEDTLS_HAVE_TIME + +/** + * \def MBEDTLS_HAVE_TIME_DATE + * + * System has time.h, time(), and an implementation for + * mbedtls_platform_gmtime_r() (see below). + * The time needs to be correct (not necessarily very accurate, but at least + * the date should be correct). This is used to verify the validity period of + * X.509 certificates. + * + * Comment if your system does not have a correct clock. + * + * \note mbedtls_platform_gmtime_r() is an abstraction in platform_util.h that + * behaves similarly to the gmtime_r() function from the C standard. Refer to + * the documentation for mbedtls_platform_gmtime_r() for more information. + * + * \note It is possible to configure an implementation for + * mbedtls_platform_gmtime_r() at compile-time by using the macro + * MBEDTLS_PLATFORM_GMTIME_R_ALT. + */ +// #define MBEDTLS_HAVE_TIME_DATE + +/** + * \def MBEDTLS_PLATFORM_MEMORY + * + * Enable the memory allocation layer. + * + * By default mbed TLS uses the system-provided calloc() and free(). + * This allows different allocators (self-implemented or provided) to be + * provided to the platform abstraction layer. + * + * Enabling MBEDTLS_PLATFORM_MEMORY without the + * MBEDTLS_PLATFORM_{FREE,CALLOC}_MACROs will provide + * "mbedtls_platform_set_calloc_free()" allowing you to set an alternative calloc() and + * free() function pointer at runtime. + * + * Enabling MBEDTLS_PLATFORM_MEMORY and specifying + * MBEDTLS_PLATFORM_{CALLOC,FREE}_MACROs will allow you to specify the + * alternate function at compile time. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Enable this layer to allow use of alternative memory allocators. + */ +#define MBEDTLS_PLATFORM_MEMORY + +/** + * \def MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + * + * Do not assign standard functions in the platform layer (e.g. calloc() to + * MBEDTLS_PLATFORM_STD_CALLOC and printf() to MBEDTLS_PLATFORM_STD_PRINTF) + * + * This makes sure there are no linking errors on platforms that do not support + * these functions. You will HAVE to provide alternatives, either at runtime + * via the platform_set_xxx() functions or at compile time by setting + * the MBEDTLS_PLATFORM_STD_XXX defines, or enabling a + * MBEDTLS_PLATFORM_XXX_MACRO. + * + * Requires: MBEDTLS_PLATFORM_C + * + * Uncomment to prevent default assignment of standard functions in the + * platform layer. + */ +#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS + +/** + * \def MBEDTLS_PLATFORM_EXIT_ALT + * + * MBEDTLS_PLATFORM_XXX_ALT: Uncomment a macro to let mbed TLS support the + * function in the platform abstraction layer. + * + * Example: In case you uncomment MBEDTLS_PLATFORM_PRINTF_ALT, mbed TLS will + * provide a function "mbedtls_platform_set_printf()" that allows you to set an + * alternative printf function pointer. + * + * All these define require MBEDTLS_PLATFORM_C to be defined! + * + * \note MBEDTLS_PLATFORM_SNPRINTF_ALT is required on Windows; + * it will be enabled automatically by check_config.h + * + * \warning MBEDTLS_PLATFORM_XXX_ALT cannot be defined at the same time as + * MBEDTLS_PLATFORM_XXX_MACRO! + * + * Requires: MBEDTLS_PLATFORM_TIME_ALT requires MBEDTLS_HAVE_TIME + * + * Uncomment a macro to enable alternate implementation of specific base + * platform function + */ +//#define MBEDTLS_PLATFORM_EXIT_ALT +#define MBEDTLS_PLATFORM_TIME_ALT +//#define MBEDTLS_PLATFORM_FPRINTF_ALT +//#define MBEDTLS_PLATFORM_PRINTF_ALT +#define MBEDTLS_PLATFORM_SNPRINTF_ALT +//#define MBEDTLS_PLATFORM_VSNPRINTF_ALT +//#define MBEDTLS_PLATFORM_NV_SEED_ALT +//#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT + +/** + * \def MBEDTLS_DEPRECATED_WARNING + * + * Mark deprecated functions and features so that they generate a warning if + * used. Functionality deprecated in one version will usually be removed in the + * next version. You can enable this to help you prepare the transition to a + * new major version by making sure your code is not using this functionality. + * + * This only works with GCC and Clang. With other compilers, you may want to + * use MBEDTLS_DEPRECATED_REMOVED + * + * Uncomment to get warnings on using deprecated functions and features. + */ +//#define MBEDTLS_DEPRECATED_WARNING + +/** + * \def MBEDTLS_DEPRECATED_REMOVED + * + * Remove deprecated functions and features so that they generate an error if + * used. Functionality deprecated in one version will usually be removed in the + * next version. You can enable this to help you prepare the transition to a + * new major version by making sure your code is not using this functionality. + * + * Uncomment to get errors on using deprecated functions and features. + */ +//#define MBEDTLS_DEPRECATED_REMOVED + +/* \} name SECTION: System support */ + +/** + * \name SECTION: mbed TLS feature support + * + * This section sets support for features that are or are not needed + * within the modules that are enabled. + * \{ + */ + +/** + * \def MBEDTLS_TIMING_ALT + * + * Uncomment to provide your own alternate implementation for + * mbedtls_timing_get_timer(), mbedtls_set_alarm(), mbedtls_set/get_delay() + * + * Only works if you have MBEDTLS_TIMING_C enabled. + * + * You will need to provide a header "timing_alt.h" and an implementation at + * compile time. + */ +//#define MBEDTLS_TIMING_ALT + +/** + * \def MBEDTLS_AES_ALT + * + * MBEDTLS__MODULE_NAME__ALT: Uncomment a macro to let mbed TLS use your + * alternate core implementation of a symmetric crypto, an arithmetic or hash + * module (e.g. platform specific assembly optimized implementations). Keep + * in mind that the function prototypes should remain the same. + * + * This replaces the whole module. If you only want to replace one of the + * functions, use one of the MBEDTLS__FUNCTION_NAME__ALT flags. + * + * Example: In case you uncomment MBEDTLS_AES_ALT, mbed TLS will no longer + * provide the "struct mbedtls_aes_context" definition and omit the base + * function declarations and implementations. "aes_alt.h" will be included from + * "aes.h" to include the new function definitions. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * module. + * + * \warning MD5, DES and SHA-1 are considered weak and their + * use constitutes a security risk. If possible, we recommend + * avoiding dependencies on them, and considering stronger message + * digests and ciphers instead. + * + */ +//#define MBEDTLS_AES_ALT +//#define MBEDTLS_ARIA_ALT +//#define MBEDTLS_CAMELLIA_ALT +//#define MBEDTLS_CCM_ALT +//#define MBEDTLS_CHACHA20_ALT +//#define MBEDTLS_CHACHAPOLY_ALT +//#define MBEDTLS_CMAC_ALT +//#define MBEDTLS_DES_ALT +//#define MBEDTLS_DHM_ALT +//#define MBEDTLS_ECJPAKE_ALT +//#define MBEDTLS_GCM_ALT +//#define MBEDTLS_NIST_KW_ALT +//#define MBEDTLS_MD5_ALT +//#define MBEDTLS_POLY1305_ALT +//#define MBEDTLS_RIPEMD160_ALT +//#define MBEDTLS_RSA_ALT +//#define MBEDTLS_SHA1_ALT +//#define MBEDTLS_SHA256_ALT +//#define MBEDTLS_SHA512_ALT + +/* + * When replacing the elliptic curve module, pleace consider, that it is + * implemented with two .c files: + * - ecp.c + * - ecp_curves.c + * You can replace them very much like all the other MBEDTLS__MODULE_NAME__ALT + * macros as described above. The only difference is that you have to make sure + * that you provide functionality for both .c files. + */ +//#define MBEDTLS_ECP_ALT + +/** + * \def MBEDTLS_SHA256_PROCESS_ALT + * + * MBEDTLS__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use you + * alternate core implementation of symmetric crypto or hash function. Keep in + * mind that function prototypes should remain the same. + * + * This replaces only one function. The header file from mbed TLS is still + * used, in contrast to the MBEDTLS__MODULE_NAME__ALT flags. + * + * Example: In case you uncomment MBEDTLS_SHA256_PROCESS_ALT, mbed TLS will + * no longer provide the mbedtls_sha1_process() function, but it will still provide + * the other function (using your mbedtls_sha1_process() function) and the definition + * of mbedtls_sha1_context, so your implementation of mbedtls_sha1_process must be compatible + * with this definition. + * + * \note If you use the AES_xxx_ALT macros, then it is recommended to also set + * MBEDTLS_AES_ROM_TABLES in order to help the linker garbage-collect the AES + * tables. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * function. + * + * \warning MD5, DES and SHA-1 are considered weak and their use + * constitutes a security risk. If possible, we recommend avoiding + * dependencies on them, and considering stronger message digests + * and ciphers instead. + * + * \warning If both MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_DETERMINISTIC are + * enabled, then the deterministic ECDH signature functions pass the + * the static HMAC-DRBG as RNG to mbedtls_ecdsa_sign(). Therefore + * alternative implementations should use the RNG only for generating + * the ephemeral key and nothing else. If this is not possible, then + * MBEDTLS_ECDSA_DETERMINISTIC should be disabled and an alternative + * implementation should be provided for mbedtls_ecdsa_sign_det_ext(). + * + */ +//#define MBEDTLS_MD5_PROCESS_ALT +//#define MBEDTLS_RIPEMD160_PROCESS_ALT +//#define MBEDTLS_SHA1_PROCESS_ALT +//#define MBEDTLS_SHA256_PROCESS_ALT +//#define MBEDTLS_SHA512_PROCESS_ALT +//#define MBEDTLS_DES_SETKEY_ALT +//#define MBEDTLS_DES_CRYPT_ECB_ALT +//#define MBEDTLS_DES3_CRYPT_ECB_ALT +//#define MBEDTLS_AES_SETKEY_ENC_ALT +//#define MBEDTLS_AES_SETKEY_DEC_ALT +//#define MBEDTLS_AES_ENCRYPT_ALT +//#define MBEDTLS_AES_DECRYPT_ALT +//#define MBEDTLS_ECDH_GEN_PUBLIC_ALT +//#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT +//#define MBEDTLS_ECDSA_VERIFY_ALT +//#define MBEDTLS_ECDSA_SIGN_ALT +//#define MBEDTLS_ECDSA_GENKEY_ALT + +/** + * \def MBEDTLS_ECP_INTERNAL_ALT + * + * Expose a part of the internal interface of the Elliptic Curve Point module. + * + * MBEDTLS_ECP__FUNCTION_NAME__ALT: Uncomment a macro to let mbed TLS use your + * alternative core implementation of elliptic curve arithmetic. Keep in mind + * that function prototypes should remain the same. + * + * This partially replaces one function. The header file from mbed TLS is still + * used, in contrast to the MBEDTLS_ECP_ALT flag. The original implementation + * is still present and it is used for group structures not supported by the + * alternative. + * + * The original implementation can in addition be removed by setting the + * MBEDTLS_ECP_NO_FALLBACK option, in which case any function for which the + * corresponding MBEDTLS_ECP__FUNCTION_NAME__ALT macro is defined will not be + * able to fallback to curves not supported by the alternative implementation. + * + * Any of these options become available by defining MBEDTLS_ECP_INTERNAL_ALT + * and implementing the following functions: + * unsigned char mbedtls_internal_ecp_grp_capable( + * const mbedtls_ecp_group *grp ) + * int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp ) + * void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp ) + * The mbedtls_internal_ecp_grp_capable function should return 1 if the + * replacement functions implement arithmetic for the given group and 0 + * otherwise. + * The functions mbedtls_internal_ecp_init and mbedtls_internal_ecp_free are + * called before and after each point operation and provide an opportunity to + * implement optimized set up and tear down instructions. + * + * Example: In case you set MBEDTLS_ECP_INTERNAL_ALT and + * MBEDTLS_ECP_DOUBLE_JAC_ALT, mbed TLS will still provide the ecp_double_jac() + * function, but will use your mbedtls_internal_ecp_double_jac() if the group + * for the operation is supported by your implementation (i.e. your + * mbedtls_internal_ecp_grp_capable() function returns 1 for this group). If the + * group is not supported by your implementation, then the original mbed TLS + * implementation of ecp_double_jac() is used instead, unless this fallback + * behaviour is disabled by setting MBEDTLS_ECP_NO_FALLBACK (in which case + * ecp_double_jac() will return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE). + * + * The function prototypes and the definition of mbedtls_ecp_group and + * mbedtls_ecp_point will not change based on MBEDTLS_ECP_INTERNAL_ALT, so your + * implementation of mbedtls_internal_ecp__function_name__ must be compatible + * with their definitions. + * + * Uncomment a macro to enable alternate implementation of the corresponding + * function. + */ +/* Required for all the functions in this section */ +//#define MBEDTLS_ECP_INTERNAL_ALT +/* Turn off software fallback for curves not supported in hardware */ +//#define MBEDTLS_ECP_NO_FALLBACK +/* Support for Weierstrass curves with Jacobi representation */ +//#define MBEDTLS_ECP_RANDOMIZE_JAC_ALT +//#define MBEDTLS_ECP_ADD_MIXED_ALT +//#define MBEDTLS_ECP_DOUBLE_JAC_ALT +//#define MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT +//#define MBEDTLS_ECP_NORMALIZE_JAC_ALT +/* Support for curves with Montgomery arithmetic */ +//#define MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT +//#define MBEDTLS_ECP_RANDOMIZE_MXZ_ALT +//#define MBEDTLS_ECP_NORMALIZE_MXZ_ALT + +/** + * \def MBEDTLS_ENTROPY_HARDWARE_ALT + * + * Uncomment this macro to let mbed TLS use your own implementation of a + * hardware entropy collector. + * + * Your function must be called \c mbedtls_hardware_poll(), have the same + * prototype as declared in library/entropy_poll.h, and accept NULL as first + * argument. + * + * Uncomment to use your own hardware entropy collector. + */ +//#define MBEDTLS_ENTROPY_HARDWARE_ALT + +/** + * \def MBEDTLS_AES_ROM_TABLES + * + * Use precomputed AES tables stored in ROM. + * + * Uncomment this macro to use precomputed AES tables stored in ROM. + * Comment this macro to generate AES tables in RAM at runtime. + * + * Tradeoff: Using precomputed ROM tables reduces RAM usage by ~8kb + * (or ~2kb if \c MBEDTLS_AES_FEWER_TABLES is used) and reduces the + * initialization time before the first AES operation can be performed. + * It comes at the cost of additional ~8kb ROM use (resp. ~2kb if \c + * MBEDTLS_AES_FEWER_TABLES below is used), and potentially degraded + * performance if ROM access is slower than RAM access. + * + * This option is independent of \c MBEDTLS_AES_FEWER_TABLES. + * + */ +#define MBEDTLS_AES_ROM_TABLES + +/** + * \def MBEDTLS_AES_FEWER_TABLES + * + * Use less ROM/RAM for AES tables. + * + * Uncommenting this macro omits 75% of the AES tables from + * ROM / RAM (depending on the value of \c MBEDTLS_AES_ROM_TABLES) + * by computing their values on the fly during operations + * (the tables are entry-wise rotations of one another). + * + * Tradeoff: Uncommenting this reduces the RAM / ROM footprint + * by ~6kb but at the cost of more arithmetic operations during + * runtime. Specifically, one has to compare 4 accesses within + * different tables to 4 accesses with additional arithmetic + * operations within the same table. The performance gain/loss + * depends on the system and memory details. + * + * This option is independent of \c MBEDTLS_AES_ROM_TABLES. + * + */ +//#define MBEDTLS_AES_FEWER_TABLES + +/** + * \def MBEDTLS_CAMELLIA_SMALL_MEMORY + * + * Use less ROM for the Camellia implementation (saves about 768 bytes). + * + * Uncomment this macro to use less memory for Camellia. + */ +//#define MBEDTLS_CAMELLIA_SMALL_MEMORY + +/** + * \def MBEDTLS_CHECK_RETURN_WARNING + * + * If this macro is defined, emit a compile-time warning if application code + * calls a function without checking its return value, but the return value + * should generally be checked in portable applications. + * + * This is only supported on platforms where #MBEDTLS_CHECK_RETURN is + * implemented. Otherwise this option has no effect. + * + * Uncomment to get warnings on using fallible functions without checking + * their return value. + * + * \note This feature is a work in progress. + * Warnings will be added to more functions in the future. + * + * \note A few functions are considered critical, and ignoring the return + * value of these functions will trigger a warning even if this + * macro is not defined. To completely disable return value check + * warnings, define #MBEDTLS_CHECK_RETURN with an empty expansion. + */ +//#define MBEDTLS_CHECK_RETURN_WARNING + +/** + * \def MBEDTLS_CIPHER_MODE_CBC + * + * Enable Cipher Block Chaining mode (CBC) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CBC + +/** + * \def MBEDTLS_CIPHER_MODE_CFB + * + * Enable Cipher Feedback mode (CFB) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CFB + +/** + * \def MBEDTLS_CIPHER_MODE_CTR + * + * Enable Counter Block Cipher mode (CTR) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_CTR + +/** + * \def MBEDTLS_CIPHER_MODE_OFB + * + * Enable Output Feedback mode (OFB) for symmetric ciphers. + */ +#define MBEDTLS_CIPHER_MODE_OFB + +/** + * \def MBEDTLS_CIPHER_MODE_XTS + * + * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES. + */ +#define MBEDTLS_CIPHER_MODE_XTS + +/** + * \def MBEDTLS_CIPHER_NULL_CIPHER + * + * Enable NULL cipher. + * Warning: Only do so when you know what you are doing. This allows for + * encryption or channels without any security! + * + * To enable the following ciphersuites: + * MBEDTLS_TLS_ECDH_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_WITH_NULL_SHA + * MBEDTLS_TLS_RSA_WITH_NULL_MD5 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_NULL_SHA + * MBEDTLS_TLS_PSK_WITH_NULL_SHA384 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA256 + * MBEDTLS_TLS_PSK_WITH_NULL_SHA + * + * Uncomment this macro to enable the NULL cipher and ciphersuites + */ +//#define MBEDTLS_CIPHER_NULL_CIPHER + +/** + * \def MBEDTLS_CIPHER_PADDING_PKCS7 + * + * MBEDTLS_CIPHER_PADDING_XXX: Uncomment or comment macros to add support for + * specific padding modes in the cipher layer with cipher modes that support + * padding (e.g. CBC) + * + * If you disable all padding modes, only full blocks can be used with CBC. + * + * Enable padding modes in the cipher layer. + */ +#define MBEDTLS_CIPHER_PADDING_PKCS7 +#define MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS +#define MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN +#define MBEDTLS_CIPHER_PADDING_ZEROS + +/** \def MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + * + * Uncomment this macro to use a 128-bit key in the CTR_DRBG module. + * By default, CTR_DRBG uses a 256-bit key. + */ +//#define MBEDTLS_CTR_DRBG_USE_128_BIT_KEY + +/** + * \def MBEDTLS_ECP_DP_SECP192R1_ENABLED + * + * MBEDTLS_ECP_XXXX_ENABLED: Enables specific curves within the Elliptic Curve + * module. By default all supported curves are enabled. + * + * Comment macros to disable the curve and functions for it + */ +/* Short Weierstrass curves (supporting ECP, ECDH, ECDSA) */ +#define MBEDTLS_ECP_DP_SECP192R1_ENABLED +#define MBEDTLS_ECP_DP_SECP224R1_ENABLED +#define MBEDTLS_ECP_DP_SECP256R1_ENABLED +#define MBEDTLS_ECP_DP_SECP384R1_ENABLED +#define MBEDTLS_ECP_DP_SECP521R1_ENABLED +#define MBEDTLS_ECP_DP_SECP192K1_ENABLED +#define MBEDTLS_ECP_DP_SECP224K1_ENABLED +#define MBEDTLS_ECP_DP_SECP256K1_ENABLED +#define MBEDTLS_ECP_DP_BP256R1_ENABLED +#define MBEDTLS_ECP_DP_BP384R1_ENABLED +#define MBEDTLS_ECP_DP_BP512R1_ENABLED +/* Montgomery curves (supporting ECP) */ +#define MBEDTLS_ECP_DP_CURVE25519_ENABLED +#define MBEDTLS_ECP_DP_CURVE448_ENABLED + +/** + * \def MBEDTLS_ECP_NIST_OPTIM + * + * Enable specific 'modulo p' routines for each NIST prime. + * Depending on the prime and architecture, makes operations 4 to 8 times + * faster on the corresponding curve. + * + * Comment this macro to disable NIST curves optimisation. + */ +#define MBEDTLS_ECP_NIST_OPTIM + +/** + * \def MBEDTLS_ECP_RESTARTABLE + * + * Enable "non-blocking" ECC operations that can return early and be resumed. + * + * This allows various functions to pause by returning + * #MBEDTLS_ERR_ECP_IN_PROGRESS (or, for functions in the SSL module, + * #MBEDTLS_ERR_SSL_CRYPTO_IN_PROGRESS) and then be called later again in + * order to further progress and eventually complete their operation. This is + * controlled through mbedtls_ecp_set_max_ops() which limits the maximum + * number of ECC operations a function may perform before pausing; see + * mbedtls_ecp_set_max_ops() for more information. + * + * This is useful in non-threaded environments if you want to avoid blocking + * for too long on ECC (and, hence, X.509 or SSL/TLS) operations. + * + * Uncomment this macro to enable restartable ECC computations. + * + * \note This option only works with the default software implementation of + * elliptic curve functionality. It is incompatible with + * MBEDTLS_ECP_ALT, MBEDTLS_ECDH_XXX_ALT, MBEDTLS_ECDSA_XXX_ALT. + */ +//#define MBEDTLS_ECP_RESTARTABLE + +/** + * \def MBEDTLS_ECDSA_DETERMINISTIC + * + * Enable deterministic ECDSA (RFC 6979). + * Standard ECDSA is "fragile" in the sense that lack of entropy when signing + * may result in a compromise of the long-term signing key. This is avoided by + * the deterministic variant. + * + * Requires: MBEDTLS_HMAC_DRBG_C, MBEDTLS_ECDSA_C + * + * Comment this macro to disable deterministic ECDSA. + */ +//#define MBEDTLS_ECDSA_DETERMINISTIC + +/** + * \def MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + * + * Enable the PSK based ciphersuite modes in SSL / TLS. + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_KEY_EXCHANGE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + * + * Enable the DHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +//#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + * + * Enable the ECDHE-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + * + * Enable the RSA-PSK based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + * + * Enable the RSA-only based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + */ +//#define MBEDTLS_KEY_EXCHANGE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + * + * Enable the DHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_DHM_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +//#define MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + * + * Enable the ECDHE-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_PKCS1_V15, + * MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + */ +#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + * + * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C, + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + * + * Enable the ECDH-ECDSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_ECDSA_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + * + * Enable the ECDH-RSA based ciphersuite modes in SSL / TLS. + * + * Requires: MBEDTLS_ECDH_C, MBEDTLS_RSA_C, MBEDTLS_X509_CRT_PARSE_C + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + +/** + * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + * + * Enable the ECJPAKE based ciphersuite modes in SSL / TLS. + * + * \warning This is currently experimental. EC J-PAKE support is based on the + * Thread v1.0.0 specification; incompatible changes to the specification + * might still happen. For this reason, this is disabled by default. + * + * Requires: MBEDTLS_ECJPAKE_C + * MBEDTLS_SHA256_C + * MBEDTLS_ECP_DP_SECP256R1_ENABLED + * + * This enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECJPAKE_WITH_AES_128_CCM_8 + */ +//#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED + +/** + * \def MBEDTLS_PK_PARSE_EC_EXTENDED + * + * Enhance support for reading EC keys using variants of SEC1 not allowed by + * RFC 5915 and RFC 5480. + * + * Currently this means parsing the SpecifiedECDomain choice of EC + * parameters (only known groups are supported, not arbitrary domains, to + * avoid validation issues). + * + * Disable if you only need to support RFC 5915 + 5480 key formats. + */ +//#define MBEDTLS_PK_PARSE_EC_EXTENDED + +/** + * \def MBEDTLS_ERROR_STRERROR_DUMMY + * + * Enable a dummy error function to make use of mbedtls_strerror() in + * third party libraries easier when MBEDTLS_ERROR_C is disabled + * (no effect when MBEDTLS_ERROR_C is enabled). + * + * You can safely disable this if MBEDTLS_ERROR_C is enabled, or if you're + * not using mbedtls_strerror() or error_strerror() in your application. + * + * Disable if you run into name conflicts and want to really remove the + * mbedtls_strerror() + */ +#define MBEDTLS_ERROR_STRERROR_DUMMY + +/** + * \def MBEDTLS_GENPRIME + * + * Enable the prime-number generation code. + * + * Requires: MBEDTLS_BIGNUM_C + */ +#define MBEDTLS_GENPRIME + +/** + * \def MBEDTLS_FS_IO + * + * Enable functions that use the filesystem. + */ +#define MBEDTLS_FS_IO + +/** + * \def MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + * + * Do not add default entropy sources in mbedtls_entropy_init(). + * + * This is useful to have more control over the added entropy sources in an + * application. + * + * Uncomment this macro to prevent loading of default entropy functions. + */ +//#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES + +/** + * \def MBEDTLS_NO_PLATFORM_ENTROPY + * + * Do not use built-in platform entropy functions. + * This is useful if your platform does not support + * standards like the /dev/urandom or Windows CryptoAPI. + * + * Uncomment this macro to disable the built-in platform entropy functions. + */ +#define MBEDTLS_NO_PLATFORM_ENTROPY + +/** + * \def MBEDTLS_ENTROPY_FORCE_SHA256 + * + * Force the entropy accumulator to use a SHA-256 accumulator instead of the + * default SHA-512 based one (if both are available). + * + * Requires: MBEDTLS_SHA256_C + * + * On 32-bit systems SHA-256 can be much faster than SHA-512. Use this option + * if you have performance concerns. + * + * This option is only useful if both MBEDTLS_SHA256_C and + * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. + */ +//#define MBEDTLS_ENTROPY_FORCE_SHA256 + +/** + * \def MBEDTLS_ENTROPY_NV_SEED + * + * Enable the non-volatile (NV) seed file-based entropy source. + * (Also enables the NV seed read/write functions in the platform layer) + * + * This is crucial (if not required) on systems that do not have a + * cryptographic entropy source (in hardware or kernel) available. + * + * Requires: MBEDTLS_ENTROPY_C, MBEDTLS_PLATFORM_C + * + * \note The read/write functions that are used by the entropy source are + * determined in the platform layer, and can be modified at runtime and/or + * compile-time depending on the flags (MBEDTLS_PLATFORM_NV_SEED_*) used. + * + * \note If you use the default implementation functions that read a seedfile + * with regular fopen(), please make sure you make a seedfile with the + * proper name (defined in MBEDTLS_PLATFORM_STD_NV_SEED_FILE) and at + * least MBEDTLS_ENTROPY_BLOCK_SIZE bytes in size that can be read from + * and written to or you will get an entropy source error! The default + * implementation will only use the first MBEDTLS_ENTROPY_BLOCK_SIZE + * bytes from the file. + * + * \note The entropy collector will write to the seed file before entropy is + * given to an external source, to update it. + */ +//#define MBEDTLS_ENTROPY_NV_SEED + +/* MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER + * + * Enable key identifiers that encode a key owner identifier. + * + * The owner of a key is identified by a value of type ::mbedtls_key_owner_id_t + * which is currently hard-coded to be int32_t. + * + * Note that this option is meant for internal use only and may be removed + * without notice. It is incompatible with MBEDTLS_USE_PSA_CRYPTO. + */ +//#define MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER + +/** + * \def MBEDTLS_MEMORY_DEBUG + * + * Enable debugging of buffer allocator memory issues. Automatically prints + * (to stderr) all (fatal) messages on memory allocation issues. Enables + * function for 'debug output' of allocated memory. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Uncomment this macro to let the buffer allocator print out error messages. + */ +//#define MBEDTLS_MEMORY_DEBUG + +/** + * \def MBEDTLS_MEMORY_BACKTRACE + * + * Include backtrace information with each allocated block. + * + * Requires: MBEDTLS_MEMORY_BUFFER_ALLOC_C + * GLIBC-compatible backtrace() an backtrace_symbols() support + * + * Uncomment this macro to include backtrace information + */ +//#define MBEDTLS_MEMORY_BACKTRACE + +/** + * \def MBEDTLS_PK_RSA_ALT_SUPPORT + * + * Support external private RSA keys (eg from a HSM) in the PK layer. + * + * Comment this macro to disable support for external private RSA keys. + */ +#define MBEDTLS_PK_RSA_ALT_SUPPORT + +/** + * \def MBEDTLS_PKCS1_V15 + * + * Enable support for PKCS#1 v1.5 encoding. + * + * Requires: MBEDTLS_RSA_C + * + * This enables support for PKCS#1 v1.5 operations. + */ +#define MBEDTLS_PKCS1_V15 + +/** + * \def MBEDTLS_PKCS1_V21 + * + * Enable support for PKCS#1 v2.1 encoding. + * + * Requires: MBEDTLS_MD_C, MBEDTLS_RSA_C + * + * This enables support for RSAES-OAEP and RSASSA-PSS operations. + */ +#define MBEDTLS_PKCS1_V21 + +/** \def MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS + * + * Enable support for platform built-in keys. If you enable this feature, + * you must implement the function mbedtls_psa_platform_get_builtin_key(). + * See the documentation of that function for more information. + * + * Built-in keys are typically derived from a hardware unique key or + * stored in a secure element. + * + * Requires: MBEDTLS_PSA_CRYPTO_C. + * + * \warning This interface is experimental and may change or be removed + * without notice. + */ +//#define MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS + +/** \def MBEDTLS_PSA_CRYPTO_CLIENT + * + * Enable support for PSA crypto client. + * + * \note This option allows to include the code necessary for a PSA + * crypto client when the PSA crypto implementation is not included in + * the library (MBEDTLS_PSA_CRYPTO_C disabled). The code included is the + * code to set and get PSA key attributes. + * The development of PSA drivers partially relying on the library to + * fulfill the hardware gaps is another possible usage of this option. + * + * \warning This interface is experimental and may change or be removed + * without notice. + */ +//#define MBEDTLS_PSA_CRYPTO_CLIENT + +/** \def MBEDTLS_PSA_CRYPTO_DRIVERS + * + * Enable support for the experimental PSA crypto driver interface. + * + * Requires: MBEDTLS_PSA_CRYPTO_C + * + * \warning This interface is experimental and may change or be removed + * without notice. + */ +//#define MBEDTLS_PSA_CRYPTO_DRIVERS + +/** \def MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG + * + * Make the PSA Crypto module use an external random generator provided + * by a driver, instead of Mbed TLS's entropy and DRBG modules. + * + * \note This random generator must deliver random numbers with cryptographic + * quality and high performance. It must supply unpredictable numbers + * with a uniform distribution. The implementation of this function + * is responsible for ensuring that the random generator is seeded + * with sufficient entropy. If you have a hardware TRNG which is slow + * or delivers non-uniform output, declare it as an entropy source + * with mbedtls_entropy_add_source() instead of enabling this option. + * + * If you enable this option, you must configure the type + * ::mbedtls_psa_external_random_context_t in psa/crypto_platform.h + * and define a function called mbedtls_psa_external_get_random() + * with the following prototype: + * ``` + * psa_status_t mbedtls_psa_external_get_random( + * mbedtls_psa_external_random_context_t *context, + * uint8_t *output, size_t output_size, size_t *output_length); + * ); + * ``` + * The \c context value is initialized to 0 before the first call. + * The function must fill the \c output buffer with \p output_size bytes + * of random data and set \c *output_length to \p output_size. + * + * Requires: MBEDTLS_PSA_CRYPTO_C + * + * \warning If you enable this option, code that uses the PSA cryptography + * interface will not use any of the entropy sources set up for + * the entropy module, nor the NV seed that MBEDTLS_ENTROPY_NV_SEED + * enables. + * + * \note This option is experimental and may be removed without notice. + */ +//#define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG + +/** + * \def MBEDTLS_PSA_CRYPTO_SPM + * + * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is built for SPM (Secure + * Partition Manager) integration which separates the code into two parts: a + * NSPE (Non-Secure Process Environment) and an SPE (Secure Process + * Environment). + * + * Module: library/psa_crypto.c + * Requires: MBEDTLS_PSA_CRYPTO_C + * + */ +//#define MBEDTLS_PSA_CRYPTO_SPM + +/** + * \def MBEDTLS_PSA_INJECT_ENTROPY + * + * Enable support for entropy injection at first boot. This feature is + * required on systems that do not have a built-in entropy source (TRNG). + * This feature is currently not supported on systems that have a built-in + * entropy source. + * + * Requires: MBEDTLS_PSA_CRYPTO_STORAGE_C, MBEDTLS_ENTROPY_NV_SEED + * + */ +//#define MBEDTLS_PSA_INJECT_ENTROPY + +/** + * \def MBEDTLS_RSA_NO_CRT + * + * Do not use the Chinese Remainder Theorem + * for the RSA private operation. + * + * Uncomment this macro to disable the use of CRT in RSA. + * + */ +//#define MBEDTLS_RSA_NO_CRT + +/** + * \def MBEDTLS_SELF_TEST + * + * Enable the checkup functions (*_self_test). + */ +//#define MBEDTLS_SELF_TEST + +/** + * \def MBEDTLS_SHA256_SMALLER + * + * Enable an implementation of SHA-256 that has lower ROM footprint but also + * lower performance. + * + * The default implementation is meant to be a reasonnable compromise between + * performance and size. This version optimizes more aggressively for size at + * the expense of performance. Eg on Cortex-M4 it reduces the size of + * mbedtls_sha256_process() from ~2KB to ~0.5KB for a performance hit of about + * 30%. + * + * Uncomment to enable the smaller implementation of SHA256. + */ +//#define MBEDTLS_SHA256_SMALLER + +/** + * \def MBEDTLS_SHA512_SMALLER + * + * Enable an implementation of SHA-512 that has lower ROM footprint but also + * lower performance. + * + * Uncomment to enable the smaller implementation of SHA512. + */ +//#define MBEDTLS_SHA512_SMALLER + +/** + * \def MBEDTLS_SSL_ALL_ALERT_MESSAGES + * + * Enable sending of alert messages in case of encountered errors as per RFC. + * If you choose not to send the alert messages, mbed TLS can still communicate + * with other servers, only debugging of failures is harder. + * + * The advantage of not sending alert messages, is that no information is given + * about reasons for failures thus preventing adversaries of gaining intel. + * + * Enable sending of all alert messages + */ +#define MBEDTLS_SSL_ALL_ALERT_MESSAGES + +/** + * \def MBEDTLS_SSL_DTLS_CONNECTION_ID + * + * Enable support for the DTLS Connection ID extension + * (version draft-ietf-tls-dtls-connection-id-05, + * https://tools.ietf.org/html/draft-ietf-tls-dtls-connection-id-05) + * which allows to identify DTLS connections across changes + * in the underlying transport. + * + * Setting this option enables the SSL APIs `mbedtls_ssl_set_cid()`, + * `mbedtls_ssl_get_peer_cid()` and `mbedtls_ssl_conf_cid()`. + * See the corresponding documentation for more information. + * + * \warning The Connection ID extension is still in draft state. + * We make no stability promises for the availability + * or the shape of the API controlled by this option. + * + * The maximum lengths of outgoing and incoming CIDs can be configured + * through the options + * - MBEDTLS_SSL_CID_OUT_LEN_MAX + * - MBEDTLS_SSL_CID_IN_LEN_MAX. + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Uncomment to enable the Connection ID extension. + */ +//#define MBEDTLS_SSL_DTLS_CONNECTION_ID + +/** + * \def MBEDTLS_SSL_ASYNC_PRIVATE + * + * Enable asynchronous external private key operations in SSL. This allows + * you to configure an SSL connection to call an external cryptographic + * module to perform private key operations instead of performing the + * operation inside the library. + * + */ +//#define MBEDTLS_SSL_ASYNC_PRIVATE + +/** + * \def MBEDTLS_SSL_CONTEXT_SERIALIZATION + * + * Enable serialization of the TLS context structures, through use of the + * functions mbedtls_ssl_context_save() and mbedtls_ssl_context_load(). + * + * This pair of functions allows one side of a connection to serialize the + * context associated with the connection, then free or re-use that context + * while the serialized state is persisted elsewhere, and finally deserialize + * that state to a live context for resuming read/write operations on the + * connection. From a protocol perspective, the state of the connection is + * unaffected, in particular this is entirely transparent to the peer. + * + * Note: this is distinct from TLS session resumption, which is part of the + * protocol and fully visible by the peer. TLS session resumption enables + * establishing new connections associated to a saved session with shorter, + * lighter handshakes, while context serialization is a local optimization in + * handling a single, potentially long-lived connection. + * + * Enabling these APIs makes some SSL structures larger, as 64 extra bytes are + * saved after the handshake to allow for more efficient serialization, so if + * you don't need this feature you'll save RAM by disabling it. + * + * Comment to disable the context serialization APIs. + */ +#define MBEDTLS_SSL_CONTEXT_SERIALIZATION + +/** + * \def MBEDTLS_SSL_DEBUG_ALL + * + * Enable the debug messages in SSL module for all issues. + * Debug messages have been disabled in some places to prevent timing + * attacks due to (unbalanced) debugging function calls. + * + * If you need all error reporting you should enable this during debugging, + * but remove this for production servers that should log as well. + * + * Uncomment this macro to report all debug messages on errors introducing + * a timing side-channel. + * + */ +//#define MBEDTLS_SSL_DEBUG_ALL + +/** \def MBEDTLS_SSL_ENCRYPT_THEN_MAC + * + * Enable support for Encrypt-then-MAC, RFC 7366. + * + * This allows peers that both support it to use a more robust protection for + * ciphersuites using CBC, providing deep resistance against timing attacks + * on the padding or underlying cipher. + * + * This only affects CBC ciphersuites, and is useless if none is defined. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Encrypt-then-MAC + */ +#define MBEDTLS_SSL_ENCRYPT_THEN_MAC + +/** \def MBEDTLS_SSL_EXTENDED_MASTER_SECRET + * + * Enable support for RFC 7627: Session Hash and Extended Master Secret + * Extension. + * + * This was introduced as "the proper fix" to the Triple Handshake familiy of + * attacks, but it is recommended to always use it (even if you disable + * renegotiation), since it actually fixes a more fundamental issue in the + * original SSL/TLS design, and has implications beyond Triple Handshake. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for Extended Master Secret. + */ +#define MBEDTLS_SSL_EXTENDED_MASTER_SECRET + +/** + * \def MBEDTLS_SSL_KEEP_PEER_CERTIFICATE + * + * This option controls the availability of the API mbedtls_ssl_get_peer_cert() + * giving access to the peer's certificate after completion of the handshake. + * + * Unless you need mbedtls_ssl_peer_cert() in your application, it is + * recommended to disable this option for reduced RAM usage. + * + * \note If this option is disabled, mbedtls_ssl_get_peer_cert() is still + * defined, but always returns \c NULL. + * + * \note This option has no influence on the protection against the + * triple handshake attack. Even if it is disabled, Mbed TLS will + * still ensure that certificates do not change during renegotiation, + * for exaple by keeping a hash of the peer's certificate. + * + * Comment this macro to disable storing the peer's certificate + * after the handshake. + */ +#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE + +/** + * \def MBEDTLS_SSL_RENEGOTIATION + * + * Enable support for TLS renegotiation. + * + * The two main uses of renegotiation are (1) refresh keys on long-lived + * connections and (2) client authentication after the initial handshake. + * If you don't need renegotiation, it's probably better to disable it, since + * it has been associated with security issues in the past and is easy to + * misuse/misunderstand. + * + * Comment this to disable support for renegotiation. + * + * \note Even if this option is disabled, both client and server are aware + * of the Renegotiation Indication Extension (RFC 5746) used to + * prevent the SSL renegotiation attack (see RFC 5746 Sect. 1). + * (See \c mbedtls_ssl_conf_legacy_renegotiation for the + * configuration of this extension). + * + */ +#define MBEDTLS_SSL_RENEGOTIATION + +/** + * \def MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + * + * Enable support for RFC 6066 max_fragment_length extension in SSL. + * + * Comment this macro to disable support for the max_fragment_length extension + */ +#define MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + +/** + * \def MBEDTLS_SSL_PROTO_TLS1_2 + * + * Enable support for TLS 1.2 (and DTLS 1.2 if DTLS is enabled). + * + * Requires: MBEDTLS_SHA1_C or MBEDTLS_SHA256_C or MBEDTLS_SHA512_C + * (Depends on ciphersuites) + * + * Comment this macro to disable support for TLS 1.2 / DTLS 1.2 + */ +#define MBEDTLS_SSL_PROTO_TLS1_2 + +/** + * \def MBEDTLS_SSL_PROTO_TLS1_3 + * + * Enable support for TLS 1.3. + * + * \note The support for TLS 1.3 is not comprehensive yet, in particular + * pre-shared keys are not supported. + * See docs/architecture/tls13-support.md for a description of the TLS + * 1.3 support that this option enables. + * + * Uncomment this macro to enable the support for TLS 1.3. + * + */ +//#define MBEDTLS_SSL_PROTO_TLS1_3 + +/** + * \def MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE + * + * Enable TLS 1.3 middlebox compatibility mode. + * + * As specified in Section D.4 of RFC 8446, TLS 1.3 offers a compatibility + * mode to make a TLS 1.3 connection more likely to pass through middle boxes + * expecting TLS 1.2 traffic. + * + * Turning on the compatibility mode comes at the cost of a few added bytes + * on the wire, but it doesn't affect compatibility with TLS 1.3 implementations + * that don't use it. Therefore, unless transmission bandwidth is critical and + * you know that middlebox compatibility issues won't occur, it is therefore + * recommended to set this option. + * + * Comment to disable compatibility mode for TLS 1.3. If + * MBEDTLS_SSL_PROTO_TLS1_3 is not enabled, this option does not have any + * effect on the build. + * + */ +//#define MBEDTLS_SSL_TLS1_3_COMPATIBILITY_MODE + +/** + * \def MBEDTLS_SSL_PROTO_DTLS + * + * Enable support for DTLS (all available versions). + * + * Enable this and MBEDTLS_SSL_PROTO_TLS1_2 to enable DTLS 1.2. + * + * Requires: MBEDTLS_SSL_PROTO_TLS1_2 + * + * Comment this macro to disable support for DTLS + */ +//#define MBEDTLS_SSL_PROTO_DTLS + +/** + * \def MBEDTLS_SSL_ALPN + * + * Enable support for RFC 7301 Application Layer Protocol Negotiation. + * + * Comment this macro to disable support for ALPN. + */ +#define MBEDTLS_SSL_ALPN + +/** + * \def MBEDTLS_SSL_DTLS_ANTI_REPLAY + * + * Enable support for the anti-replay mechanism in DTLS. + * + * Requires: MBEDTLS_SSL_TLS_C + * MBEDTLS_SSL_PROTO_DTLS + * + * \warning Disabling this is often a security risk! + * See mbedtls_ssl_conf_dtls_anti_replay() for details. + * + * Comment this to disable anti-replay in DTLS. + */ +//#define MBEDTLS_SSL_DTLS_ANTI_REPLAY + +/** + * \def MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Enable support for HelloVerifyRequest on DTLS servers. + * + * This feature is highly recommended to prevent DTLS servers being used as + * amplifiers in DoS attacks against other hosts. It should always be enabled + * unless you know for sure amplification cannot be a problem in the + * environment in which your server operates. + * + * \warning Disabling this can ba a security risk! (see above) + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Comment this to disable support for HelloVerifyRequest. + */ +//#define MBEDTLS_SSL_DTLS_HELLO_VERIFY + +/** + * \def MBEDTLS_SSL_DTLS_SRTP + * + * Enable support for negotiation of DTLS-SRTP (RFC 5764) + * through the use_srtp extension. + * + * \note This feature provides the minimum functionality required + * to negotiate the use of DTLS-SRTP and to allow the derivation of + * the associated SRTP packet protection key material. + * In particular, the SRTP packet protection itself, as well as the + * demultiplexing of RTP and DTLS packets at the datagram layer + * (see Section 5 of RFC 5764), are not handled by this feature. + * Instead, after successful completion of a handshake negotiating + * the use of DTLS-SRTP, the extended key exporter API + * mbedtls_ssl_conf_export_keys_cb() should be used to implement + * the key exporter described in Section 4.2 of RFC 5764 and RFC 5705 + * (this is implemented in the SSL example programs). + * The resulting key should then be passed to an SRTP stack. + * + * Setting this option enables the runtime API + * mbedtls_ssl_conf_dtls_srtp_protection_profiles() + * through which the supported DTLS-SRTP protection + * profiles can be configured. You must call this API at + * runtime if you wish to negotiate the use of DTLS-SRTP. + * + * Requires: MBEDTLS_SSL_PROTO_DTLS + * + * Uncomment this to enable support for use_srtp extension. + */ +//#define MBEDTLS_SSL_DTLS_SRTP + +/** + * \def MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + * + * Enable server-side support for clients that reconnect from the same port. + * + * Some clients unexpectedly close the connection and try to reconnect using the + * same source port. This needs special support from the server to handle the + * new connection securely, as described in section 4.2.8 of RFC 6347. This + * flag enables that support. + * + * Requires: MBEDTLS_SSL_DTLS_HELLO_VERIFY + * + * Comment this to disable support for clients reusing the source port. + */ +//#define MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE + +/** + * \def MBEDTLS_SSL_SESSION_TICKETS + * + * Enable support for RFC 5077 session tickets in SSL. + * Client-side, provides full support for session tickets (maintenance of a + * session store remains the responsibility of the application, though). + * Server-side, you also need to provide callbacks for writing and parsing + * tickets, including authenticated encryption and key management. Example + * callbacks are provided by MBEDTLS_SSL_TICKET_C. + * + * Comment this macro to disable support for SSL session tickets + */ +#define MBEDTLS_SSL_SESSION_TICKETS + +/** + * \def MBEDTLS_SSL_SERVER_NAME_INDICATION + * + * Enable support for RFC 6066 server name indication (SNI) in SSL. + * + * Requires: MBEDTLS_X509_CRT_PARSE_C + * + * Comment this macro to disable support for server name indication in SSL + */ +#define MBEDTLS_SSL_SERVER_NAME_INDICATION + +/** + * \def MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH + * + * When this option is enabled, the SSL buffer will be resized automatically + * based on the negotiated maximum fragment length in each direction. + * + * Requires: MBEDTLS_SSL_MAX_FRAGMENT_LENGTH + */ +//#define MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH + +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + * + * Enable testing of the constant-flow nature of some sensitive functions with + * clang's MemorySanitizer. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires compiling with clang -fsanitize=memory. The test + * suites can then be run normally. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_MEMSAN + +/** + * \def MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + * + * Enable testing of the constant-flow nature of some sensitive functions with + * valgrind's memcheck tool. This causes some existing tests to also test + * this non-functional property of the code under test. + * + * This setting requires valgrind headers for building, and is only useful for + * testing if the tests suites are run with valgrind's memcheck. This can be + * done for an individual test suite with 'valgrind ./test_suite_xxx', or when + * using CMake, this can be done for all test suites with 'make memcheck'. + * + * \warning This macro is only used for extended testing; it is not considered + * part of the library's API, so it may change or disappear at any time. + * + * Uncomment to enable testing of the constant-flow nature of selected code. + */ +//#define MBEDTLS_TEST_CONSTANT_FLOW_VALGRIND + +/** + * \def MBEDTLS_TEST_HOOKS + * + * Enable features for invasive testing such as introspection functions and + * hooks for fault injection. This enables additional unit tests. + * + * Merely enabling this feature should not change the behavior of the product. + * It only adds new code, and new branching points where the default behavior + * is the same as when this feature is disabled. + * However, this feature increases the attack surface: there is an added + * risk of vulnerabilities, and more gadgets that can make exploits easier. + * Therefore this feature must never be enabled in production. + * + * See `docs/architecture/testing/mbed-crypto-invasive-testing.md` for more + * information. + * + * Uncomment to enable invasive tests. + */ +//#define MBEDTLS_TEST_HOOKS + +/** + * \def MBEDTLS_THREADING_ALT + * + * Provide your own alternate threading implementation. + * + * Requires: MBEDTLS_THREADING_C + * + * Uncomment this to allow your own alternate threading implementation. + */ +//#define MBEDTLS_THREADING_ALT + +/** + * \def MBEDTLS_THREADING_PTHREAD + * + * Enable the pthread wrapper layer for the threading layer. + * + * Requires: MBEDTLS_THREADING_C + * + * Uncomment this to enable pthread mutexes. + */ +//#define MBEDTLS_THREADING_PTHREAD + +/** + * \def MBEDTLS_USE_PSA_CRYPTO + * + * Make the X.509 and TLS library use PSA for cryptographic operations, and + * enable new APIs for using keys handled by PSA Crypto. + * + * \note Development of this option is currently in progress, and parts of Mbed + * TLS's X.509 and TLS modules are not ported to PSA yet. However, these parts + * will still continue to work as usual, so enabling this option should not + * break backwards compatibility. + * + * \note See docs/use-psa-crypto.md for a complete description of what this + * option currently does, and of parts that are not affected by it so far. + * + * \warning This option enables new Mbed TLS APIs which are currently + * considered experimental and may change in incompatible ways at any time. + * That is, the APIs enabled by this option are not covered by the usual + * promises of API stability. + * + * Requires: MBEDTLS_PSA_CRYPTO_C. + * + * Uncomment this to enable internal use of PSA Crypto and new associated APIs. + */ +//#define MBEDTLS_USE_PSA_CRYPTO + +/** + * \def MBEDTLS_PSA_CRYPTO_CONFIG + * + * This setting allows support for cryptographic mechanisms through the PSA + * API to be configured separately from support through the mbedtls API. + * + * Uncomment this to enable use of PSA Crypto configuration settings which + * can be found in include/psa/crypto_config.h. + * + * This feature is still experimental and is not ready for production since + * it is not completed. + */ +//#define MBEDTLS_PSA_CRYPTO_CONFIG + +/** + * \def MBEDTLS_VERSION_FEATURES + * + * Allow run-time checking of compile-time enabled features. Thus allowing users + * to check at run-time if the library is for instance compiled with threading + * support via mbedtls_version_check_feature(). + * + * Requires: MBEDTLS_VERSION_C + * + * Comment this to disable run-time checking and save ROM space + */ +//#define MBEDTLS_VERSION_FEATURES + +/** + * \def MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK + * + * If set, this enables the X.509 API `mbedtls_x509_crt_verify_with_ca_cb()` + * and the SSL API `mbedtls_ssl_conf_ca_cb()` which allow users to configure + * the set of trusted certificates through a callback instead of a linked + * list. + * + * This is useful for example in environments where a large number of trusted + * certificates is present and storing them in a linked list isn't efficient + * enough, or when the set of trusted certificates changes frequently. + * + * See the documentation of `mbedtls_x509_crt_verify_with_ca_cb()` and + * `mbedtls_ssl_conf_ca_cb()` for more information. + * + * Uncomment to enable trusted certificate callbacks. + */ +//#define MBEDTLS_X509_TRUSTED_CERTIFICATE_CALLBACK + +/** + * \def MBEDTLS_X509_REMOVE_INFO + * + * Disable mbedtls_x509_*_info() and related APIs. + * + * Uncomment to omit mbedtls_x509_*_info(), as well as mbedtls_debug_print_crt() + * and other functions/constants only used by these functions, thus reducing + * the code footprint by several KB. + */ +//#define MBEDTLS_X509_REMOVE_INFO + +/** + * \def MBEDTLS_X509_RSASSA_PSS_SUPPORT + * + * Enable parsing and verification of X.509 certificates, CRLs and CSRS + * signed with RSASSA-PSS (aka PKCS#1 v2.1). + * + * Comment this macro to disallow using RSASSA-PSS in certificates. + */ +//#define MBEDTLS_X509_RSASSA_PSS_SUPPORT +/* \} name SECTION: mbed TLS feature support */ + +/** + * \name SECTION: mbed TLS modules + * + * This section enables or disables entire modules in mbed TLS + * \{ + */ + +/** + * \def MBEDTLS_AESNI_C + * + * Enable AES-NI support on x86-64. + * + * Module: library/aesni.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the AES-NI instructions on x86-64 + */ +//#define MBEDTLS_AESNI_C + +/** + * \def MBEDTLS_AES_C + * + * Enable the AES block cipher. + * + * Module: library/aes.c + * Caller: library/cipher.c + * library/pem.c + * library/ctr_drbg.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_AES_128_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_AES_256_CBC_SHA + * MBEDTLS_TLS_PSK_WITH_AES_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_AES_128_CBC_SHA + * + * PEM_PARSE uses AES for decrypting encrypted keys. + */ +#define MBEDTLS_AES_C + +/** + * \def MBEDTLS_ASN1_PARSE_C + * + * Enable the generic ASN1 parser. + * + * Module: library/asn1.c + * Caller: library/x509.c + * library/dhm.c + * library/pkcs12.c + * library/pkcs5.c + * library/pkparse.c + */ +#define MBEDTLS_ASN1_PARSE_C + +/** + * \def MBEDTLS_ASN1_WRITE_C + * + * Enable the generic ASN1 writer. + * + * Module: library/asn1write.c + * Caller: library/ecdsa.c + * library/pkwrite.c + * library/x509_create.c + * library/x509write_crt.c + * library/x509write_csr.c + */ +#define MBEDTLS_ASN1_WRITE_C + +/** + * \def MBEDTLS_BASE64_C + * + * Enable the Base64 module. + * + * Module: library/base64.c + * Caller: library/pem.c + * + * This module is required for PEM support (required by X.509). + */ +#define MBEDTLS_BASE64_C + +/** + * \def MBEDTLS_BIGNUM_C + * + * Enable the multi-precision integer library. + * + * Module: library/bignum.c + * Caller: library/dhm.c + * library/ecp.c + * library/ecdsa.c + * library/rsa.c + * library/rsa_alt_helpers.c + * library/ssl_tls.c + * + * This module is required for RSA, DHM and ECC (ECDH, ECDSA) support. + */ +#define MBEDTLS_BIGNUM_C + +/** + * \def MBEDTLS_CAMELLIA_C + * + * Enable the Camellia block cipher. + * + * Module: library/camellia.c + * Caller: library/cipher.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_256_CBC_SHA + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_CAMELLIA_128_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +//#define MBEDTLS_CAMELLIA_C + +/** + * \def MBEDTLS_ARIA_C + * + * Enable the ARIA block cipher. + * + * Module: library/aria.c + * Caller: library/cipher.c + * + * This module enables the following ciphersuites (if other requisites are + * enabled as well): + * + * MBEDTLS_TLS_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 + * MBEDTLS_TLS_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 + * MBEDTLS_TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 + * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 + * MBEDTLS_TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 + */ +#define MBEDTLS_ARIA_C + +/** + * \def MBEDTLS_CCM_C + * + * Enable the Counter with CBC-MAC (CCM) mode for 128-bit block cipher. + * + * Module: library/ccm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C + * + * This module enables the AES-CCM ciphersuites, if other requisites are + * enabled as well. + */ +//#define MBEDTLS_CCM_C + +/** + * \def MBEDTLS_CHACHA20_C + * + * Enable the ChaCha20 stream cipher. + * + * Module: library/chacha20.c + */ +#define MBEDTLS_CHACHA20_C + +/** + * \def MBEDTLS_CHACHAPOLY_C + * + * Enable the ChaCha20-Poly1305 AEAD algorithm. + * + * Module: library/chachapoly.c + * + * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C + */ +#define MBEDTLS_CHACHAPOLY_C + +/** + * \def MBEDTLS_CIPHER_C + * + * Enable the generic cipher layer. + * + * Module: library/cipher.c + * Caller: library/ssl_tls.c + * + * Uncomment to enable generic cipher wrappers. + */ +#define MBEDTLS_CIPHER_C + +/** + * \def MBEDTLS_CMAC_C + * + * Enable the CMAC (Cipher-based Message Authentication Code) mode for block + * ciphers. + * + * \note When #MBEDTLS_CMAC_ALT is active, meaning that the underlying + * implementation of the CMAC algorithm is provided by an alternate + * implementation, that alternate implementation may opt to not support + * AES-192 or 3DES as underlying block ciphers for the CMAC operation. + * + * Module: library/cmac.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_DES_C + * + */ +#define MBEDTLS_CMAC_C + +/** + * \def MBEDTLS_CTR_DRBG_C + * + * Enable the CTR_DRBG AES-based random generator. + * The CTR_DRBG generator uses AES-256 by default. + * To use AES-128 instead, enable \c MBEDTLS_CTR_DRBG_USE_128_BIT_KEY above. + * + * \note To achieve a 256-bit security strength with CTR_DRBG, + * you must use AES-256 *and* use sufficient entropy. + * See ctr_drbg.h for more details. + * + * Module: library/ctr_drbg.c + * Caller: + * + * Requires: MBEDTLS_AES_C + * + * This module provides the CTR_DRBG AES random number generator. + */ +#define MBEDTLS_CTR_DRBG_C + +/** + * \def MBEDTLS_DEBUG_C + * + * Enable the debug functions. + * + * Module: library/debug.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module provides debugging functions. + */ +//#define MBEDTLS_DEBUG_C + +/** + * \def MBEDTLS_DES_C + * + * Enable the DES block cipher. + * + * Module: library/des.c + * Caller: library/pem.c + * library/cipher.c + * + * PEM_PARSE uses DES/3DES for decrypting encrypted keys. + * + * \warning DES is considered a weak cipher and its use constitutes a + * security risk. We recommend considering stronger ciphers instead. + */ +#define MBEDTLS_DES_C + +/** + * \def MBEDTLS_DHM_C + * + * Enable the Diffie-Hellman-Merkle module. + * + * Module: library/dhm.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * DHE-RSA, DHE-PSK + * + * \warning Using DHE constitutes a security risk as it + * is not possible to validate custom DH parameters. + * If possible, it is recommended users should consider + * preferring other methods of key exchange. + * See dhm.h for more details. + * + */ +//#define MBEDTLS_DHM_C + +/** + * \def MBEDTLS_ECDH_C + * + * Enable the elliptic curve Diffie-Hellman library. + * + * Module: library/ecdh.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA, ECDHE-RSA, DHE-PSK + * + * Requires: MBEDTLS_ECP_C + */ +#define MBEDTLS_ECDH_C + +/** + * \def MBEDTLS_ECDSA_C + * + * Enable the elliptic curve DSA library. + * + * Module: library/ecdsa.c + * Caller: + * + * This module is used by the following key exchanges: + * ECDHE-ECDSA + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_ASN1_WRITE_C, MBEDTLS_ASN1_PARSE_C, + * and at least one MBEDTLS_ECP_DP_XXX_ENABLED for a + * short Weierstrass curve. + */ +#define MBEDTLS_ECDSA_C + +/** + * \def MBEDTLS_ECJPAKE_C + * + * Enable the elliptic curve J-PAKE library. + * + * \note EC J-PAKE support is based on the Thread v1.0.0 specification. + * It has not been reviewed for compliance with newer standards such as + * Thread v1.1 or RFC 8236. + * + * Module: library/ecjpake.c + * Caller: + * + * This module is used by the following key exchanges: + * ECJPAKE + * + * Requires: MBEDTLS_ECP_C, MBEDTLS_MD_C + */ +#define MBEDTLS_ECJPAKE_C + +/** + * \def MBEDTLS_ECP_C + * + * Enable the elliptic curve over GF(p) library. + * + * Module: library/ecp.c + * Caller: library/ecdh.c + * library/ecdsa.c + * library/ecjpake.c + * + * Requires: MBEDTLS_BIGNUM_C and at least one MBEDTLS_ECP_DP_XXX_ENABLED + */ +#define MBEDTLS_ECP_C + +/** + * \def MBEDTLS_ENTROPY_C + * + * Enable the platform-specific entropy code. + * + * Module: library/entropy.c + * Caller: + * + * Requires: MBEDTLS_SHA512_C or MBEDTLS_SHA256_C + * + * This module provides a generic entropy pool + */ +#define MBEDTLS_ENTROPY_C + +/** + * \def MBEDTLS_ERROR_C + * + * Enable error code to error string conversion. + * + * Module: library/error.c + * Caller: + * + * This module enables mbedtls_strerror(). + */ +//#define MBEDTLS_ERROR_C + +/** + * \def MBEDTLS_GCM_C + * + * Enable the Galois/Counter Mode (GCM). + * + * Module: library/gcm.c + * + * Requires: MBEDTLS_AES_C or MBEDTLS_CAMELLIA_C or MBEDTLS_ARIA_C + * + * This module enables the AES-GCM and CAMELLIA-GCM ciphersuites, if other + * requisites are enabled as well. + */ +#define MBEDTLS_GCM_C + +/** + * \def MBEDTLS_HKDF_C + * + * Enable the HKDF algorithm (RFC 5869). + * + * Module: library/hkdf.c + * Caller: + * + * Requires: MBEDTLS_MD_C + * + * This module adds support for the Hashed Message Authentication Code + * (HMAC)-based key derivation function (HKDF). + */ +#define MBEDTLS_HKDF_C + +/** + * \def MBEDTLS_HMAC_DRBG_C + * + * Enable the HMAC_DRBG random generator. + * + * Module: library/hmac_drbg.c + * Caller: + * + * Requires: MBEDTLS_MD_C + * + * Uncomment to enable the HMAC_DRBG random number geerator. + */ +//#define MBEDTLS_HMAC_DRBG_C + +/** + * \def MBEDTLS_NIST_KW_C + * + * Enable the Key Wrapping mode for 128-bit block ciphers, + * as defined in NIST SP 800-38F. Only KW and KWP modes + * are supported. At the moment, only AES is approved by NIST. + * + * Module: library/nist_kw.c + * + * Requires: MBEDTLS_AES_C and MBEDTLS_CIPHER_C + */ +#define MBEDTLS_NIST_KW_C + +/** + * \def MBEDTLS_MD_C + * + * Enable the generic message digest layer. + * + * Module: library/md.c + * Caller: + * + * Uncomment to enable generic message digest wrappers. + */ +#define MBEDTLS_MD_C + +/** + * \def MBEDTLS_MD5_C + * + * Enable the MD5 hash algorithm. + * + * Module: library/md5.c + * Caller: library/md.c + * library/pem.c + * library/ssl_tls.c + * + * This module is required for TLS 1.2 depending on the handshake parameters. + * Further, it is used for checking MD5-signed certificates, and for PBKDF1 + * when decrypting PEM-encoded encrypted keys. + * + * \warning MD5 is considered a weak message digest and its use constitutes a + * security risk. If possible, we recommend avoiding dependencies on + * it, and considering stronger message digests instead. + * + */ +#define MBEDTLS_MD5_C + +/** + * \def MBEDTLS_MEMORY_BUFFER_ALLOC_C + * + * Enable the buffer allocator implementation that makes use of a (stack) + * based buffer to 'allocate' dynamic memory. (replaces calloc() and free() + * calls) + * + * Module: library/memory_buffer_alloc.c + * + * Requires: MBEDTLS_PLATFORM_C + * MBEDTLS_PLATFORM_MEMORY (to use it within mbed TLS) + * + * Enable this module to enable the buffer memory allocator. + */ +#ifdef HILINK_E2E_SECURITY_CONFIG +#define MBEDTLS_MEMORY_BUFFER_ALLOC_C +#endif + +/** + * \def MBEDTLS_NET_C + * + * Enable the TCP and UDP over IPv6/IPv4 networking routines. + * + * \note This module only works on POSIX/Unix (including Linux, BSD and OS X) + * and Windows. For other platforms, you'll want to disable it, and write your + * own networking callbacks to be passed to \c mbedtls_ssl_set_bio(). + * + * \note See also our Knowledge Base article about porting to a new + * environment: + * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS + * + * Module: library/net_sockets.c + * + * This module provides networking routines. + */ +#define MBEDTLS_NET_C + +/** + * \def MBEDTLS_OID_C + * + * Enable the OID database. + * + * Module: library/oid.c + * Caller: library/asn1write.c + * library/pkcs5.c + * library/pkparse.c + * library/pkwrite.c + * library/rsa.c + * library/x509.c + * library/x509_create.c + * library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * library/x509write_crt.c + * library/x509write_csr.c + * + * This modules translates between OIDs and internal values. + */ +#define MBEDTLS_OID_C + +/** + * \def MBEDTLS_PADLOCK_C + * + * Enable VIA Padlock support on x86. + * + * Module: library/padlock.c + * Caller: library/aes.c + * + * Requires: MBEDTLS_HAVE_ASM + * + * This modules adds support for the VIA PadLock on x86. + */ +#define MBEDTLS_PADLOCK_C + +/** + * \def MBEDTLS_PEM_PARSE_C + * + * Enable PEM decoding / parsing. + * + * Module: library/pem.c + * Caller: library/dhm.c + * library/pkparse.c + * library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for decoding / parsing PEM files. + */ +#define MBEDTLS_PEM_PARSE_C + +/** + * \def MBEDTLS_PEM_WRITE_C + * + * Enable PEM encoding / writing. + * + * Module: library/pem.c + * Caller: library/pkwrite.c + * library/x509write_crt.c + * library/x509write_csr.c + * + * Requires: MBEDTLS_BASE64_C + * + * This modules adds support for encoding / writing PEM files. + */ +#define MBEDTLS_PEM_WRITE_C + +/** + * \def MBEDTLS_PK_C + * + * Enable the generic public (asymetric) key layer. + * + * Module: library/pk.c + * Caller: library/ssl_tls.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_RSA_C or MBEDTLS_ECP_C + * + * Uncomment to enable generic public key wrappers. + */ +#define MBEDTLS_PK_C + +/** + * \def MBEDTLS_PK_PARSE_C + * + * Enable the generic public (asymetric) key parser. + * + * Module: library/pkparse.c + * Caller: library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key parse functions. + */ +#define MBEDTLS_PK_PARSE_C + +/** + * \def MBEDTLS_PK_WRITE_C + * + * Enable the generic public (asymetric) key writer. + * + * Module: library/pkwrite.c + * Caller: library/x509write.c + * + * Requires: MBEDTLS_PK_C + * + * Uncomment to enable generic public key write functions. + */ +#define MBEDTLS_PK_WRITE_C + +/** + * \def MBEDTLS_PKCS5_C + * + * Enable PKCS#5 functions. + * + * Module: library/pkcs5.c + * + * Requires: MBEDTLS_MD_C + * + * This module adds support for the PKCS#5 functions. + */ +#define MBEDTLS_PKCS5_C + +/** + * \def MBEDTLS_PKCS12_C + * + * Enable PKCS#12 PBE functions. + * Adds algorithms for parsing PKCS#8 encrypted private keys + * + * Module: library/pkcs12.c + * Caller: library/pkparse.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * + * This module enables PKCS#12 functions. + */ +//#define MBEDTLS_PKCS12_C + +/** + * \def MBEDTLS_PLATFORM_C + * + * Enable the platform abstraction layer that allows you to re-assign + * functions like calloc(), free(), snprintf(), printf(), fprintf(), exit(). + * + * Enabling MBEDTLS_PLATFORM_C enables to use of MBEDTLS_PLATFORM_XXX_ALT + * or MBEDTLS_PLATFORM_XXX_MACRO directives, allowing the functions mentioned + * above to be specified at runtime or compile time respectively. + * + * \note This abstraction layer must be enabled on Windows (including MSYS2) + * as other module rely on it for a fixed snprintf implementation. + * + * Module: library/platform.c + * Caller: Most other .c files + * + * This module enables abstraction of common (libc) functions. + */ +#define MBEDTLS_PLATFORM_C + +/** + * \def MBEDTLS_POLY1305_C + * + * Enable the Poly1305 MAC algorithm. + * + * Module: library/poly1305.c + * Caller: library/chachapoly.c + */ +#define MBEDTLS_POLY1305_C + +/** + * \def MBEDTLS_PSA_CRYPTO_C + * + * Enable the Platform Security Architecture cryptography API. + * + * Module: library/psa_crypto.c + * + * Requires: either MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C, + * or MBEDTLS_HMAC_DRBG_C and MBEDTLS_ENTROPY_C, + * or MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG. + * + */ +#define MBEDTLS_PSA_CRYPTO_C + +/** + * \def MBEDTLS_PSA_CRYPTO_SE_C + * + * Enable secure element support in the Platform Security Architecture + * cryptography API. + * + * \warning This feature is not yet suitable for production. It is provided + * for API evaluation and testing purposes only. + * + * Module: library/psa_crypto_se.c + * + * Requires: MBEDTLS_PSA_CRYPTO_C, MBEDTLS_PSA_CRYPTO_STORAGE_C + * + */ +//#define MBEDTLS_PSA_CRYPTO_SE_C + +/** + * \def MBEDTLS_PSA_CRYPTO_STORAGE_C + * + * Enable the Platform Security Architecture persistent key storage. + * + * Module: library/psa_crypto_storage.c + * + * Requires: MBEDTLS_PSA_CRYPTO_C, + * either MBEDTLS_PSA_ITS_FILE_C or a native implementation of + * the PSA ITS interface + */ +#define MBEDTLS_PSA_CRYPTO_STORAGE_C + +/** + * \def MBEDTLS_PSA_ITS_FILE_C + * + * Enable the emulation of the Platform Security Architecture + * Internal Trusted Storage (PSA ITS) over files. + * + * Module: library/psa_its_file.c + * + * Requires: MBEDTLS_FS_IO + */ +#define MBEDTLS_PSA_ITS_FILE_C + +/** + * \def MBEDTLS_RIPEMD160_C + * + * Enable the RIPEMD-160 hash algorithm. + * + * Module: library/ripemd160.c + * Caller: library/md.c + * + */ +//#define MBEDTLS_RIPEMD160_C + +/** + * \def MBEDTLS_RSA_C + * + * Enable the RSA public-key cryptosystem. + * + * Module: library/rsa.c + * library/rsa_alt_helpers.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509.c + * + * This module is used by the following key exchanges: + * RSA, DHE-RSA, ECDHE-RSA, RSA-PSK + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C + */ +#define MBEDTLS_RSA_C + +/** + * \def MBEDTLS_SHA1_C + * + * Enable the SHA1 cryptographic hash algorithm. + * + * Module: library/sha1.c + * Caller: library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * library/x509write_crt.c + * + * This module is required for TLS 1.2 depending on the handshake parameters, + * and for SHA1-signed certificates. + * + * \warning SHA-1 is considered a weak message digest and its use constitutes + * a security risk. If possible, we recommend avoiding dependencies + * on it, and considering stronger message digests instead. + * + */ +#define MBEDTLS_SHA1_C + +/** + * \def MBEDTLS_SHA224_C + * + * Enable the SHA-224 cryptographic hash algorithm. + * + * Requires: MBEDTLS_SHA256_C. The library does not currently support enabling + * SHA-224 without SHA-256. + * + * Module: library/sha256.c + * Caller: library/md.c + * library/ssl_cookie.c + * + * This module adds support for SHA-224. + */ +#define MBEDTLS_SHA224_C + +/** + * \def MBEDTLS_SHA256_C + * + * Enable the SHA-256 cryptographic hash algorithm. + * + * Requires: MBEDTLS_SHA224_C. The library does not currently support enabling + * SHA-256 without SHA-224. + * + * Module: library/sha256.c + * Caller: library/entropy.c + * library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * This module adds support for SHA-256. + * This module is required for the SSL/TLS 1.2 PRF function. + */ +#define MBEDTLS_SHA256_C + +/** + * \def MBEDTLS_SHA384_C + * + * Enable the SHA-384 cryptographic hash algorithm. + * + * Requires: MBEDTLS_SHA512_C + * + * Module: library/sha512.c + * Caller: library/md.c + * library/ssl_cli.c + * library/ssl_srv.c + * + * Comment to disable SHA-384 + */ +#define MBEDTLS_SHA384_C + +/** + * \def MBEDTLS_SHA512_C + * + * Enable SHA-512 cryptographic hash algorithms. + * + * Module: library/sha512.c + * Caller: library/entropy.c + * library/md.c + * library/ssl_tls.c + * library/ssl_cookie.c + * + * This module adds support for SHA-512. + */ +#define MBEDTLS_SHA512_C + +/** + * \def MBEDTLS_SSL_CACHE_C + * + * Enable simple SSL cache implementation. + * + * Module: library/ssl_cache.c + * Caller: + * + * Requires: MBEDTLS_SSL_CACHE_C + */ +#define MBEDTLS_SSL_CACHE_C + +/** + * \def MBEDTLS_SSL_COOKIE_C + * + * Enable basic implementation of DTLS cookies for hello verification. + * + * Module: library/ssl_cookie.c + * Caller: + */ +#define MBEDTLS_SSL_COOKIE_C + +/** + * \def MBEDTLS_SSL_TICKET_C + * + * Enable an implementation of TLS server-side callbacks for session tickets. + * + * Module: library/ssl_ticket.c + * Caller: + * + * Requires: MBEDTLS_CIPHER_C + */ +#define MBEDTLS_SSL_TICKET_C + +/** + * \def MBEDTLS_SSL_CLI_C + * + * Enable the SSL/TLS client code. + * + * Module: library/ssl_cli.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS client support. + */ +#define MBEDTLS_SSL_CLI_C + +/** + * \def MBEDTLS_SSL_SRV_C + * + * Enable the SSL/TLS server code. + * + * Module: library/ssl_srv.c + * Caller: + * + * Requires: MBEDTLS_SSL_TLS_C + * + * This module is required for SSL/TLS server support. + */ +//#define MBEDTLS_SSL_SRV_C + +/** + * \def MBEDTLS_SSL_TLS_C + * + * Enable the generic SSL/TLS code. + * + * Module: library/ssl_tls.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * + * Requires: MBEDTLS_CIPHER_C, MBEDTLS_MD_C + * and at least one of the MBEDTLS_SSL_PROTO_XXX defines + * + * This module is required for SSL/TLS. + */ +#define MBEDTLS_SSL_TLS_C + +/** + * \def MBEDTLS_THREADING_C + * + * Enable the threading abstraction layer. + * By default mbed TLS assumes it is used in a non-threaded environment or that + * contexts are not shared between threads. If you do intend to use contexts + * between threads, you will need to enable this layer to prevent race + * conditions. See also our Knowledge Base article about threading: + * https://tls.mbed.org/kb/development/thread-safety-and-multi-threading + * + * Module: library/threading.c + * + * This allows different threading implementations (self-implemented or + * provided). + * + * You will have to enable either MBEDTLS_THREADING_ALT or + * MBEDTLS_THREADING_PTHREAD. + * + * Enable this layer to allow use of mutexes within mbed TLS + */ +//#define MBEDTLS_THREADING_C + +/** + * \def MBEDTLS_TIMING_C + * + * Enable the semi-portable timing interface. + * + * \note The provided implementation only works on POSIX/Unix (including Linux, + * BSD and OS X) and Windows. On other platforms, you can either disable that + * module and provide your own implementations of the callbacks needed by + * \c mbedtls_ssl_set_timer_cb() for DTLS, or leave it enabled and provide + * your own implementation of the whole module by setting + * \c MBEDTLS_TIMING_ALT in the current file. + * + * \note See also our Knowledge Base article about porting to a new + * environment: + * https://tls.mbed.org/kb/how-to/how-do-i-port-mbed-tls-to-a-new-environment-OS + * + * Module: library/timing.c + */ +//#define MBEDTLS_TIMING_C + +/** + * \def MBEDTLS_VERSION_C + * + * Enable run-time version information. + * + * Module: library/version.c + * + * This module provides run-time version information. + */ +#define MBEDTLS_VERSION_C + +/** + * \def MBEDTLS_X509_USE_C + * + * Enable X.509 core for using certificates. + * + * Module: library/x509.c + * Caller: library/x509_crl.c + * library/x509_crt.c + * library/x509_csr.c + * + * Requires: MBEDTLS_ASN1_PARSE_C, MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, + * MBEDTLS_PK_PARSE_C + * + * This module is required for the X.509 parsing modules. + */ +#define MBEDTLS_X509_USE_C + +/** + * \def MBEDTLS_X509_CRT_PARSE_C + * + * Enable X.509 certificate parsing. + * + * Module: library/x509_crt.c + * Caller: library/ssl_cli.c + * library/ssl_srv.c + * library/ssl_tls.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 certificate parsing. + */ +#define MBEDTLS_X509_CRT_PARSE_C + +/** + * \def MBEDTLS_X509_CRL_PARSE_C + * + * Enable X.509 CRL parsing. + * + * Module: library/x509_crl.c + * Caller: library/x509_crt.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is required for X.509 CRL parsing. + */ +#define MBEDTLS_X509_CRL_PARSE_C + +/** + * \def MBEDTLS_X509_CSR_PARSE_C + * + * Enable X.509 Certificate Signing Request (CSR) parsing. + * + * Module: library/x509_csr.c + * Caller: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_USE_C + * + * This module is used for reading X.509 certificate request. + */ +//#define MBEDTLS_X509_CSR_PARSE_C + +/** + * \def MBEDTLS_X509_CREATE_C + * + * Enable X.509 core for creating certificates. + * + * Module: library/x509_create.c + * + * Requires: MBEDTLS_BIGNUM_C, MBEDTLS_OID_C, MBEDTLS_PK_WRITE_C + * + * This module is the basis for creating X.509 certificates and CSRs. + */ +//#define MBEDTLS_X509_CREATE_C + +/** + * \def MBEDTLS_X509_CRT_WRITE_C + * + * Enable creating X.509 certificates. + * + * Module: library/x509_crt_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate creation. + */ +//#define MBEDTLS_X509_CRT_WRITE_C + +/** + * \def MBEDTLS_X509_CSR_WRITE_C + * + * Enable creating X.509 Certificate Signing Requests (CSR). + * + * Module: library/x509_csr_write.c + * + * Requires: MBEDTLS_X509_CREATE_C + * + * This module is required for X.509 certificate request writing. + */ +//#define MBEDTLS_X509_CSR_WRITE_C + +/* \} name SECTION: mbed TLS modules */ + +/** + * \name SECTION: Module configuration options + * + * This section allows for the setting of module specific sizes and + * configuration options. The default values are already present in the + * relevant header files and should suffice for the regular use cases. + * + * Our advice is to enable options and change their values here + * only if you have a good reason and know the consequences. + * + * Please check the respective header file for documentation on these + * parameters (to prevent duplicate documentation). + * \{ + */ + +/* MPI / BIGNUM options */ +//#define MBEDTLS_MPI_WINDOW_SIZE 6 /**< Maximum window size used. */ +//#define MBEDTLS_MPI_MAX_SIZE 1024 /**< Maximum number of bytes for usable MPIs. */ + +/* CTR_DRBG options */ +//#define MBEDTLS_CTR_DRBG_ENTROPY_LEN 48 /**< Amount of entropy used per seed by default (48 with SHA-512, 32 with SHA-256) */ +//#define MBEDTLS_CTR_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ +//#define MBEDTLS_CTR_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ +//#define MBEDTLS_CTR_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ +//#define MBEDTLS_CTR_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + +/* HMAC_DRBG options */ +//#define MBEDTLS_HMAC_DRBG_RESEED_INTERVAL 10000 /**< Interval before reseed is performed by default */ +//#define MBEDTLS_HMAC_DRBG_MAX_INPUT 256 /**< Maximum number of additional input bytes */ +//#define MBEDTLS_HMAC_DRBG_MAX_REQUEST 1024 /**< Maximum number of requested bytes per call */ +//#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + +/* ECP options */ +//#define MBEDTLS_ECP_WINDOW_SIZE 4 /**< Maximum window size used */ +//#define MBEDTLS_ECP_FIXED_POINT_OPTIM 1 /**< Enable fixed-point speed-up */ + +/* Entropy options */ +//#define MBEDTLS_ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ +//#define MBEDTLS_ENTROPY_MAX_GATHER 128 /**< Maximum amount requested from entropy sources */ +//#define MBEDTLS_ENTROPY_MIN_HARDWARE 32 /**< Default minimum number of bytes required for the hardware entropy source mbedtls_hardware_poll() before entropy is released */ + +/* Memory buffer allocator options */ +//#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4 /**< Align on multiples of this value */ + +/* Platform options */ +//#define MBEDTLS_PLATFORM_STD_MEM_HDR /**< Header to include if MBEDTLS_PLATFORM_NO_STD_FUNCTIONS is defined. Don't define if no header is needed. */ +#define MBEDTLS_PLATFORM_STD_CALLOC calloc /**< Default allocator to use, can be undefined */ +#define MBEDTLS_PLATFORM_STD_FREE free /**< Default free to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT exit /**< Default exit to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_TIME time /**< Default time to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_STD_FPRINTF fprintf /**< Default fprintf to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_PRINTF printf /**< Default printf to use, can be undefined */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ +#define MBEDTLS_PLATFORM_STD_SNPRINTF snprintf /**< Default snprintf to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT_SUCCESS 0 /**< Default exit value to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_EXIT_FAILURE 1 /**< Default exit value to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_READ mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_WRITE mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_STD_NV_SEED_FILE "seedfile" /**< Seed file to read/write with default implementation */ + +/* To Use Function Macros MBEDTLS_PLATFORM_C must be enabled */ +/* MBEDTLS_PLATFORM_XXX_MACRO and MBEDTLS_PLATFORM_XXX_ALT cannot both be defined */ +//#define MBEDTLS_PLATFORM_CALLOC_MACRO calloc /**< Default allocator macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_FREE_MACRO free /**< Default free macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_EXIT_MACRO exit /**< Default exit macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_TIME_MACRO time /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_TIME_TYPE_MACRO time_t /**< Default time macro to use, can be undefined. MBEDTLS_HAVE_TIME must be enabled */ +//#define MBEDTLS_PLATFORM_FPRINTF_MACRO fprintf /**< Default fprintf macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_PRINTF_MACRO printf /**< Default printf macro to use, can be undefined */ +/* Note: your snprintf must correctly zero-terminate the buffer! */ +//#define MBEDTLS_PLATFORM_SNPRINTF_MACRO snprintf /**< Default snprintf macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_VSNPRINTF_MACRO vsnprintf /**< Default vsnprintf macro to use, can be undefined */ +//#define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO mbedtls_platform_std_nv_seed_read /**< Default nv_seed_read function to use, can be undefined */ +//#define MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO mbedtls_platform_std_nv_seed_write /**< Default nv_seed_write function to use, can be undefined */ + +/** \def MBEDTLS_CHECK_RETURN + * + * This macro is used at the beginning of the declaration of a function + * to indicate that its return value should be checked. It should + * instruct the compiler to emit a warning or an error if the function + * is called without checking its return value. + * + * There is a default implementation for popular compilers in platform_util.h. + * You can override the default implementation by defining your own here. + * + * If the implementation here is empty, this will effectively disable the + * checking of functions' return values. + */ +//#define MBEDTLS_CHECK_RETURN __attribute__((__warn_unused_result__)) + +/** \def MBEDTLS_IGNORE_RETURN + * + * This macro requires one argument, which should be a C function call. + * If that function call would cause a #MBEDTLS_CHECK_RETURN warning, this + * warning is suppressed. + */ +//#define MBEDTLS_IGNORE_RETURN( result ) ((void) !(result)) + +/* PSA options */ +/** + * Use HMAC_DRBG with the specified hash algorithm for HMAC_DRBG for the + * PSA crypto subsystem. + * + * If this option is unset: + * - If CTR_DRBG is available, the PSA subsystem uses it rather than HMAC_DRBG. + * - Otherwise, the PSA subsystem uses HMAC_DRBG with either + * #MBEDTLS_MD_SHA512 or #MBEDTLS_MD_SHA256 based on availability and + * on unspecified heuristics. + */ +//#define MBEDTLS_PSA_HMAC_DRBG_MD_TYPE MBEDTLS_MD_SHA256 + +/** \def MBEDTLS_PSA_KEY_SLOT_COUNT + * Restrict the PSA library to supporting a maximum amount of simultaneously + * loaded keys. A loaded key is a key stored by the PSA Crypto core as a + * volatile key, or a persistent key which is loaded temporarily by the + * library as part of a crypto operation in flight. + * + * If this option is unset, the library will fall back to a default value of + * 32 keys. + */ +//#define MBEDTLS_PSA_KEY_SLOT_COUNT 32 + +/* SSL Cache options */ +//#define MBEDTLS_SSL_CACHE_DEFAULT_TIMEOUT 86400 /**< 1 day */ +//#define MBEDTLS_SSL_CACHE_DEFAULT_MAX_ENTRIES 50 /**< Maximum entries in cache */ + +/* SSL options */ + +/** \def MBEDTLS_SSL_MAX_CONTENT_LEN + * + * Maximum length (in bytes) of incoming and outgoing plaintext fragments. + * + * This determines the size of both the incoming and outgoing TLS I/O buffers + * in such a way that both are capable of holding the specified amount of + * plaintext data, regardless of the protection mechanism used. + * + * To configure incoming and outgoing I/O buffers separately, use + * #MBEDTLS_SSL_IN_CONTENT_LEN and #MBEDTLS_SSL_OUT_CONTENT_LEN, + * which overwrite the value set by this option. + * + * \note When using a value less than the default of 16KB on the client, it is + * recommended to use the Maximum Fragment Length (MFL) extension to + * inform the server about this limitation. On the server, there + * is no supported, standardized way of informing the client about + * restriction on the maximum size of incoming messages, and unless + * the limitation has been communicated by other means, it is recommended + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN + * while keeping the default value of 16KB for the incoming buffer. + * + * Uncomment to set the maximum plaintext size of both + * incoming and outgoing I/O buffers. + */ +#define MBEDTLS_SSL_MAX_CONTENT_LEN 16384 + +/** \def MBEDTLS_SSL_IN_CONTENT_LEN + * + * Maximum length (in bytes) of incoming plaintext fragments. + * + * This determines the size of the incoming TLS I/O buffer in such a way + * that it is capable of holding the specified amount of plaintext data, + * regardless of the protection mechanism used. + * + * \note When using a value less than the default of 16KB on the client, it is + * recommended to use the Maximum Fragment Length (MFL) extension to + * inform the server about this limitation. On the server, there + * is no supported, standardized way of informing the client about + * restriction on the maximum size of incoming messages, and unless + * the limitation has been communicated by other means, it is recommended + * to only change the outgoing buffer size #MBEDTLS_SSL_OUT_CONTENT_LEN + * while keeping the default value of 16KB for the incoming buffer. + * + * Uncomment to set the maximum plaintext size of the incoming I/O buffer. + */ +#define MBEDTLS_SSL_IN_CONTENT_LEN 16384 + +/** \def MBEDTLS_SSL_CID_IN_LEN_MAX + * + * The maximum length of CIDs used for incoming DTLS messages. + * + */ +//#define MBEDTLS_SSL_CID_IN_LEN_MAX 32 + +/** \def MBEDTLS_SSL_CID_OUT_LEN_MAX + * + * The maximum length of CIDs used for outgoing DTLS messages. + * + */ +//#define MBEDTLS_SSL_CID_OUT_LEN_MAX 32 + +/** \def MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY + * + * This option controls the use of record plaintext padding + * in TLS 1.3 and when using the Connection ID extension in DTLS 1.2. + * + * The padding will always be chosen so that the length of the + * padded plaintext is a multiple of the value of this option. + * + * Note: A value of \c 1 means that no padding will be used + * for outgoing records. + * + * Note: On systems lacking division instructions, + * a power of two should be preferred. + */ +//#define MBEDTLS_SSL_CID_TLS1_3_PADDING_GRANULARITY 16 + +/** \def MBEDTLS_SSL_OUT_CONTENT_LEN + * + * Maximum length (in bytes) of outgoing plaintext fragments. + * + * This determines the size of the outgoing TLS I/O buffer in such a way + * that it is capable of holding the specified amount of plaintext data, + * regardless of the protection mechanism used. + * + * It is possible to save RAM by setting a smaller outward buffer, while keeping + * the default inward 16384 byte buffer to conform to the TLS specification. + * + * The minimum required outward buffer size is determined by the handshake + * protocol's usage. Handshaking will fail if the outward buffer is too small. + * The specific size requirement depends on the configured ciphers and any + * certificate data which is sent during the handshake. + * + * Uncomment to set the maximum plaintext size of the outgoing I/O buffer. + */ +#define MBEDTLS_SSL_OUT_CONTENT_LEN 16384 + +/** \def MBEDTLS_SSL_DTLS_MAX_BUFFERING + * + * Maximum number of heap-allocated bytes for the purpose of + * DTLS handshake message reassembly and future message buffering. + * + * This should be at least 9/8 * MBEDTLS_SSL_IN_CONTENT_LEN + * to account for a reassembled handshake message of maximum size, + * together with its reassembly bitmap. + * + * A value of 2 * MBEDTLS_SSL_IN_CONTENT_LEN (32768 by default) + * should be sufficient for all practical situations as it allows + * to reassembly a large handshake message (such as a certificate) + * while buffering multiple smaller handshake messages. + * + */ +//#define MBEDTLS_SSL_DTLS_MAX_BUFFERING 32768 + +//#define MBEDTLS_PSK_MAX_LEN 32 /**< Max size of TLS pre-shared keys, in bytes (default 256 bits) */ +//#define MBEDTLS_SSL_COOKIE_TIMEOUT 60 /**< Default expiration delay of DTLS cookies, in seconds if HAVE_TIME, or in number of cookies issued */ + +/** \def MBEDTLS_TLS_EXT_CID + * + * At the time of writing, the CID extension has not been assigned its + * final value. Set this configuration option to make Mbed TLS use a + * different value. + * + * A future minor revision of Mbed TLS may change the default value of + * this option to match evolving standards and usage. + */ +//#define MBEDTLS_TLS_EXT_CID 254 + +/** + * Complete list of ciphersuites to use, in order of preference. + * + * \warning No dependency checking is done on that field! This option can only + * be used to restrict the set of available ciphersuites. It is your + * responsibility to make sure the needed modules are active. + * + * Use this to save a few hundred bytes of ROM (default ordering of all + * available ciphersuites) and a few to a few hundred bytes of RAM. + * + * The value below is only an example, not the default. + */ +//#define MBEDTLS_SSL_CIPHERSUITES MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,MBEDTLS_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 + +/* X509 options */ +//#define MBEDTLS_X509_MAX_INTERMEDIATE_CA 8 /**< Maximum number of intermediate CAs in a verification chain. */ +//#define MBEDTLS_X509_MAX_FILE_PATH_LEN 512 /**< Maximum length of a path/filename string in bytes including the null terminator character ('\0'). */ + +/** + * Uncomment the macro to let mbed TLS use your alternate implementation of + * mbedtls_platform_zeroize(). This replaces the default implementation in + * platform_util.c. + * + * mbedtls_platform_zeroize() is a widely used function across the library to + * zero a block of memory. The implementation is expected to be secure in the + * sense that it has been written to prevent the compiler from removing calls + * to mbedtls_platform_zeroize() as part of redundant code elimination + * optimizations. However, it is difficult to guarantee that calls to + * mbedtls_platform_zeroize() will not be optimized by the compiler as older + * versions of the C language standards do not provide a secure implementation + * of memset(). Therefore, MBEDTLS_PLATFORM_ZEROIZE_ALT enables users to + * configure their own implementation of mbedtls_platform_zeroize(), for + * example by using directives specific to their compiler, features from newer + * C standards (e.g using memset_s() in C11) or calling a secure memset() from + * their system (e.g explicit_bzero() in BSD). + */ +//#define MBEDTLS_PLATFORM_ZEROIZE_ALT + +/** + * Uncomment the macro to let Mbed TLS use your alternate implementation of + * mbedtls_platform_gmtime_r(). This replaces the default implementation in + * platform_util.c. + * + * gmtime() is not a thread-safe function as defined in the C standard. The + * library will try to use safer implementations of this function, such as + * gmtime_r() when available. However, if Mbed TLS cannot identify the target + * system, the implementation of mbedtls_platform_gmtime_r() will default to + * using the standard gmtime(). In this case, calls from the library to + * gmtime() will be guarded by the global mutex mbedtls_threading_gmtime_mutex + * if MBEDTLS_THREADING_C is enabled. We recommend that calls from outside the + * library are also guarded with this mutex to avoid race conditions. However, + * if the macro MBEDTLS_PLATFORM_GMTIME_R_ALT is defined, Mbed TLS will + * unconditionally use the implementation for mbedtls_platform_gmtime_r() + * supplied at compile time. + */ +//#define MBEDTLS_PLATFORM_GMTIME_R_ALT + +/** + * Enable the verified implementations of ECDH primitives from Project Everest + * (currently only Curve25519). This feature changes the layout of ECDH + * contexts and therefore is a compatibility break for applications that access + * fields of a mbedtls_ecdh_context structure directly. See also + * MBEDTLS_ECDH_LEGACY_CONTEXT in include/mbedtls/ecdh.h. + */ +//#define MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED + +/* \} name SECTION: Customisation configuration options */ diff --git a/gr551x/tools/bin_create.py b/gr551x/tools/bin_create.py index e230b0c..9872119 100755 --- a/gr551x/tools/bin_create.py +++ b/gr551x/tools/bin_create.py @@ -363,7 +363,7 @@ class MainFunc(): out_dir = os.path.dirname(input) bin_file_name = os.path.basename(input) tmp = bin_file_name.split('.') - targe_name = "OHOS_Image" + targe_name = "OHOS_Image_BootInfo" self.opt_gen_param = GenFirmware() self.opt_gen_param.config_file = CUSTOM_CONFIG self.opt_gen_param.input_bin = input